@clagentic/console 1.12.0-beta.3 → 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.
- package/README.md +7 -1
- package/bin/cli.js +18 -15
- package/lib/agent-roster-ws.js +38 -13
- package/lib/agent-roster.js +111 -12
- package/lib/agents.js +68 -33
- package/lib/atomic-install.js +334 -0
- package/lib/build-changes.js +33 -4
- package/lib/build-sha.json +2 -2
- package/lib/build-update-offer.js +12 -0
- package/lib/chat-width.js +31 -0
- package/lib/cli/agent-usage.js +126 -0
- package/lib/cli/arg-validation.js +1 -1
- package/lib/cli/compact-output.js +69 -0
- package/lib/cli/ipc-subcommands.js +92 -67
- package/lib/cli/output.js +28 -0
- package/lib/cli/restart-verb.js +132 -0
- package/lib/cli/schedule-input-subcommands.js +45 -8
- package/lib/cli/session-subcommands.js +37 -11
- package/lib/cli/settings-subcommands.js +74 -0
- package/lib/cli-transcript-title.js +56 -3
- package/lib/client-files.js +79 -0
- package/lib/daemon.js +100 -28
- package/lib/default-avatar-color.js +4 -0
- package/lib/drain.js +58 -10
- package/lib/mcp-tool-input.js +2 -2
- package/lib/model-families.js +49 -1
- package/lib/notify/type-registry.js +4 -0
- package/lib/notify/types.js +7 -4
- package/lib/pages.js +13 -63
- package/lib/permission-summary.js +12 -16
- package/lib/plan-usage-reader.js +70 -0
- package/lib/project-connection.js +4 -2
- package/lib/project-filesystem.js +6 -7
- package/lib/project-notifications.js +55 -8
- package/lib/project-prompt-expiry-settings.js +42 -0
- package/lib/project-sessions.js +52 -0
- package/lib/project-settings-gate.js +98 -0
- package/lib/project-user-mention.js +3 -2
- package/lib/project.js +1 -1
- package/lib/prompt-expiry-settings.js +49 -0
- package/lib/prompt-expiry.js +24 -3
- package/lib/prompt-kinds/codecs.js +6 -2
- package/lib/public/app.js +36 -36
- package/lib/public/css/admin.css +156 -170
- package/lib/public/css/agent-messages.css +24 -24
- package/lib/public/css/agent-picker.css +90 -38
- package/lib/public/css/agent-roster.css +61 -27
- package/lib/public/css/at-agents.css +10 -10
- package/lib/public/css/base.css +207 -184
- package/lib/public/css/chat-layout.css +228 -0
- package/lib/public/css/command-palette.css +86 -88
- package/lib/public/css/diagnostics.css +78 -204
- package/lib/public/css/diff.css +10 -10
- package/lib/public/css/filebrowser.css +32 -60
- package/lib/public/css/home-hub.css +100 -100
- package/lib/public/css/icon-strip.css +195 -238
- package/lib/public/css/input.css +191 -212
- package/lib/public/css/login-panel.css +16 -16
- package/lib/public/css/loop.css +96 -187
- package/lib/public/css/mention.css +49 -110
- package/lib/public/css/menus.css +162 -169
- package/lib/public/css/messages.css +49 -123
- package/lib/public/css/mobile-nav.css +207 -264
- package/lib/public/css/notifications-center.css +45 -124
- package/lib/public/css/overlay.css +269 -0
- package/lib/public/css/overlays.css +134 -156
- package/lib/public/css/playbook.css +41 -41
- package/lib/public/css/profile.css +43 -112
- package/lib/public/css/rewind.css +112 -112
- package/lib/public/css/scheduler-modal.css +27 -135
- package/lib/public/css/scheduler.css +204 -210
- package/lib/public/css/server-settings.css +173 -239
- package/lib/public/css/session-search.css +20 -20
- package/lib/public/css/settings-nav.css +197 -0
- package/lib/public/css/sidebar.css +213 -304
- package/lib/public/css/skills.css +121 -135
- package/lib/public/css/sticky-notes.css +114 -200
- package/lib/public/css/stt.css +17 -26
- package/lib/public/css/team-panel.css +36 -36
- package/lib/public/css/team-view.css +9 -9
- package/lib/public/css/title-bar.css +83 -100
- package/lib/public/css/tooltip.css +10 -10
- package/lib/public/css/user-settings.css +78 -131
- package/lib/public/css/user-shell.css +125 -29
- package/lib/public/index.html +178 -177
- package/lib/public/manifest.json +0 -2
- package/lib/public/modules/admin.js +54 -92
- package/lib/public/modules/agent-avatar.js +134 -3
- package/lib/public/modules/agent-messages.js +2 -1
- package/lib/public/modules/agent-picker.js +23 -21
- package/lib/public/modules/agent-roster-groups.js +128 -0
- package/lib/public/modules/agent-roster.js +40 -11
- package/lib/public/modules/app-connection.js +13 -1
- package/lib/public/modules/app-cursors.js +9 -9
- package/lib/public/modules/app-favicon.js +8 -16
- package/lib/public/modules/app-header.js +28 -19
- package/lib/public/modules/app-history-replay.js +67 -4
- package/lib/public/modules/app-home-hub.js +15 -0
- package/lib/public/modules/app-loop-ui.js +41 -47
- package/lib/public/modules/app-loop-wizard.js +9 -10
- package/lib/public/modules/app-messages.js +32 -36
- package/lib/public/modules/app-misc.js +22 -92
- package/lib/public/modules/app-modals.js +98 -0
- package/lib/public/modules/app-notifications.js +124 -135
- package/lib/public/modules/app-panels.js +28 -32
- package/lib/public/modules/app-projects.js +30 -40
- package/lib/public/modules/app-rate-limit.js +26 -9
- package/lib/public/modules/app-rendering.js +128 -110
- package/lib/public/modules/app-skills-install.js +6 -4
- package/lib/public/modules/assistant-identity.js +55 -0
- package/lib/public/modules/at-agents.js +3 -0
- package/lib/public/modules/build-guard.js +25 -11
- package/lib/public/modules/chat-width-choice.js +75 -0
- package/lib/public/modules/chat-width-prefs.js +52 -0
- package/lib/public/modules/chat-width.js +102 -0
- package/lib/public/modules/collapsible-text.js +36 -4
- package/lib/public/modules/command-palette.js +28 -34
- package/lib/public/modules/context-sources.js +3 -5
- package/lib/public/modules/diagnostics.js +130 -129
- package/lib/public/modules/info-panel.js +31 -0
- package/lib/public/modules/injected-identity.js +8 -8
- package/lib/public/modules/input-list-menu.js +39 -0
- package/lib/public/modules/input.js +22 -21
- package/lib/public/modules/markdown.js +10 -11
- package/lib/public/modules/mcp-ui.js +4 -14
- package/lib/public/modules/mention.js +100 -229
- package/lib/public/modules/message-header.js +80 -0
- package/lib/public/modules/message-participants.js +39 -0
- package/lib/public/modules/mobile-action-sheet.js +46 -0
- package/lib/public/modules/mobile-nav-sheet.js +104 -0
- package/lib/public/modules/model-families.js +41 -4
- package/lib/public/modules/note-order.js +39 -0
- package/lib/public/modules/notifications.js +35 -52
- package/lib/public/modules/overlay-history.js +73 -19
- package/lib/public/modules/overlay-menu.js +123 -0
- package/lib/public/modules/overlay-modal.js +186 -0
- package/lib/public/modules/overlay-registry.js +392 -0
- package/lib/public/modules/overlay-stack.js +110 -0
- package/lib/public/modules/overlay.js +117 -0
- package/lib/public/modules/popover-position.js +18 -2
- package/lib/public/modules/preference-sync.js +28 -0
- package/lib/public/modules/profile.js +24 -49
- package/lib/public/modules/project-settings.js +27 -172
- package/lib/public/modules/prompt-expiry-controls.js +46 -0
- package/lib/public/modules/prompt-kinds/command-summary.js +149 -0
- package/lib/public/modules/prompt-kinds/permission.js +70 -92
- package/lib/public/modules/prompts.js +1 -2
- package/lib/public/modules/qrcode.js +6 -21
- package/lib/public/modules/queued-button.js +15 -2
- package/lib/public/modules/rewind.js +9 -3
- package/lib/public/modules/schedule-time.js +32 -7
- package/lib/public/modules/scheduled-outbox.js +51 -18
- package/lib/public/modules/scheduler-config.js +87 -127
- package/lib/public/modules/scheduler.js +29 -26
- package/lib/public/modules/serialized-save.js +79 -0
- package/lib/public/modules/server-settings.js +75 -65
- package/lib/public/modules/session-grants.js +16 -19
- package/lib/public/modules/session-list-avatars.js +98 -0
- package/lib/public/modules/session-vendor-state.js +86 -0
- package/lib/public/modules/settings-access.js +35 -0
- package/lib/public/modules/settings-hub.js +125 -0
- package/lib/public/modules/settings-nav.js +182 -0
- package/lib/public/modules/shell-line.js +24 -0
- package/lib/public/modules/sidebar-mobile.js +151 -195
- package/lib/public/modules/sidebar-projects.js +88 -129
- package/lib/public/modules/sidebar-sessions.js +66 -34
- package/lib/public/modules/sidebar.js +2 -2
- package/lib/public/modules/skills.js +11 -26
- package/lib/public/modules/sticky-notes.js +19 -16
- package/lib/public/modules/stt.js +9 -23
- package/lib/public/modules/terminal.js +86 -90
- package/lib/public/modules/theme-choice.js +126 -0
- package/lib/public/modules/theme-colors.js +19 -0
- package/lib/public/modules/theme-prefs.js +121 -0
- package/lib/public/modules/theme.js +227 -605
- package/lib/public/modules/tool-palette.js +7 -17
- package/lib/public/modules/tools.js +8 -10
- package/lib/public/modules/user-settings.js +59 -115
- package/lib/public/modules/user-shell.js +9 -2
- package/lib/public/modules/utils.js +10 -12
- package/lib/public/modules/vendor-picker.js +4 -2
- package/lib/public/modules/vendor-registry.js +1 -2
- package/lib/public/style.css +3 -1
- package/lib/public/sw.js +9 -2
- package/lib/public/theme-core.js +411 -0
- package/lib/request-body.js +70 -0
- package/lib/sdk-bridge.js +227 -88
- package/lib/sdk-message-processor.js +44 -16
- package/lib/server-admin.js +198 -200
- package/lib/server-auth.js +16 -13
- package/lib/server-dm.js +4 -3
- package/lib/server-settings.js +177 -130
- package/lib/server.js +87 -36
- package/lib/session-background-tasks.js +79 -0
- package/lib/session-directory.js +138 -13
- package/lib/session-input-ipc.js +2 -0
- package/lib/session-input.js +39 -5
- package/lib/session-list-avatars.js +16 -0
- package/lib/session-reclaim.js +37 -25
- package/lib/session-vendor.js +37 -0
- package/lib/sessions.js +99 -34
- package/lib/settings-ipc.js +60 -0
- package/lib/settings-registry.js +86 -0
- package/lib/terminal-manager.js +17 -5
- package/lib/theme-files.js +132 -0
- package/lib/theme-seed.js +136 -0
- package/lib/themes/clagentic-dark.json +13 -6
- package/lib/themes/clagentic-light.json +12 -5
- package/lib/updater.js +6 -4
- package/lib/usage-store.js +97 -10
- package/lib/users-preferences.js +118 -19
- package/lib/users.js +19 -10
- package/lib/vendor-catalog.js +130 -0
- package/lib/ws-schema.js +4 -2
- package/lib/yoke/adapters/claude.js +81 -1
- package/lib/yoke/adapters/codex-user-shell.js +87 -23
- package/lib/yoke/adapters/codex.js +89 -5
- package/lib/yoke/codex-binary.js +59 -0
- package/package.json +1 -1
- package/scripts/check-test-count.js +5 -0
- package/scripts/install-local-test.js +50 -9
- package/scripts/write-build-sha.js +18 -2
- package/lib/public/css/channel-layout.css +0 -329
- package/lib/themes/ayu-light.json +0 -9
- package/lib/themes/catppuccin-latte.json +0 -9
- package/lib/themes/catppuccin-mocha.json +0 -9
- package/lib/themes/dracula.json +0 -9
- package/lib/themes/everforest-light.json +0 -9
- package/lib/themes/everforest.json +0 -9
- package/lib/themes/github-light.json +0 -9
- package/lib/themes/gruvbox-dark.json +0 -9
- package/lib/themes/gruvbox-light.json +0 -9
- package/lib/themes/monokai.json +0 -9
- package/lib/themes/nord-light.json +0 -9
- package/lib/themes/nord.json +0 -9
- package/lib/themes/one-dark.json +0 -9
- package/lib/themes/one-light.json +0 -9
- package/lib/themes/rose-pine-dawn.json +0 -9
- package/lib/themes/rose-pine.json +0 -9
- package/lib/themes/solarized-dark.json +0 -9
- package/lib/themes/solarized-light.json +0 -9
- package/lib/themes/tokyo-night-light.json +0 -9
- package/lib/themes/tokyo-night.json +0 -9
|
@@ -2,6 +2,7 @@ import { copyToClipboard, escapeHtml } from './utils.js';
|
|
|
2
2
|
import { refreshIcons } from './icons.js';
|
|
3
3
|
import { getMermaidThemeVars } from './theme.js';
|
|
4
4
|
import { store } from './store.js';
|
|
5
|
+
import { showOverlay } from './overlay.js';
|
|
5
6
|
|
|
6
7
|
// --- Web Worker for off-main-thread markdown parsing ---
|
|
7
8
|
// The worker handles marked.parse() (the heavy part). DOMPurify.sanitize()
|
|
@@ -77,17 +78,19 @@ marked.use({
|
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
80
|
|
|
80
|
-
// Initialize mermaid
|
|
81
|
+
// Initialize mermaid. "base" is the theme that takes its colours from
|
|
82
|
+
// themeVariables, which the active mode's palette supplies (theme-core.js), so
|
|
83
|
+
// diagrams are drawn in the colours of Dark or Light and not a fixed dark theme.
|
|
81
84
|
mermaid.initialize({
|
|
82
85
|
startOnLoad: false,
|
|
83
|
-
theme: "
|
|
86
|
+
theme: "base",
|
|
84
87
|
themeVariables: getMermaidThemeVars()
|
|
85
88
|
});
|
|
86
89
|
|
|
87
90
|
export function updateMermaidTheme(vars) {
|
|
88
91
|
mermaid.initialize({
|
|
89
92
|
startOnLoad: false,
|
|
90
|
-
theme: "
|
|
93
|
+
theme: "base",
|
|
91
94
|
themeVariables: vars
|
|
92
95
|
});
|
|
93
96
|
}
|
|
@@ -258,7 +261,8 @@ export function showMermaidModal(svgHtml) {
|
|
|
258
261
|
// defensively here too since showMermaidModal is also exported and callable
|
|
259
262
|
// from other paths.
|
|
260
263
|
body.innerHTML = DOMPurify.sanitize(svgHtml, { USE_PROFILES: { svg: true, svgFilters: true } });
|
|
261
|
-
|
|
264
|
+
// Escape, the scrim and the shared close control close it.
|
|
265
|
+
showOverlay({ kind: "modal", el: modal });
|
|
262
266
|
refreshIcons();
|
|
263
267
|
|
|
264
268
|
var dlBtn = document.getElementById("mermaid-download-btn");
|
|
@@ -267,11 +271,6 @@ export function showMermaidModal(svgHtml) {
|
|
|
267
271
|
};
|
|
268
272
|
}
|
|
269
273
|
|
|
270
|
-
export function closeMermaidModal() {
|
|
271
|
-
var modal = document.getElementById("mermaid-modal");
|
|
272
|
-
if (modal) modal.classList.add("hidden");
|
|
273
|
-
}
|
|
274
|
-
|
|
275
274
|
export function downloadMermaidPng(svgEl) {
|
|
276
275
|
if (!svgEl) return;
|
|
277
276
|
var svgClone = svgEl.cloneNode(true);
|
|
@@ -294,8 +293,8 @@ export function downloadMermaidPng(svgEl) {
|
|
|
294
293
|
canvas.width = w;
|
|
295
294
|
canvas.height = h;
|
|
296
295
|
var ctx = canvas.getContext("2d");
|
|
297
|
-
//
|
|
298
|
-
ctx.fillStyle = "
|
|
296
|
+
// The diagram is drawn for the active theme, so it lands on that theme's code surface.
|
|
297
|
+
ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue("--code-bg").trim();
|
|
299
298
|
ctx.fillRect(0, 0, w, h);
|
|
300
299
|
ctx.drawImage(img, 0, 0, w, h);
|
|
301
300
|
URL.revokeObjectURL(url);
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
import { getWs } from './ws-ref.js';
|
|
5
5
|
import { refreshIcons } from './icons.js';
|
|
6
6
|
import { setHttpMcpServers } from './app-misc.js';
|
|
7
|
+
import { showOverlay } from './overlay.js';
|
|
7
8
|
|
|
8
9
|
var modal = null;
|
|
10
|
+
var modalHandle = null;
|
|
9
11
|
var contentEl = null;
|
|
10
12
|
var _mcpServers = []; // { name, transport, toolCount, extensionEnabled, projectEnabled }
|
|
11
13
|
var _extensionConnected = false;
|
|
@@ -18,20 +20,9 @@ export function initMcp() {
|
|
|
18
20
|
|
|
19
21
|
var btn = document.getElementById("mcp-btn");
|
|
20
22
|
var mateBtn = document.getElementById("mate-mcp-btn");
|
|
21
|
-
var closeBtn = document.getElementById("mcp-modal-close");
|
|
22
|
-
var backdrop = modal ? modal.querySelector(".confirm-backdrop") : null;
|
|
23
23
|
|
|
24
24
|
if (btn) btn.addEventListener("click", openMcpModal);
|
|
25
25
|
if (mateBtn) mateBtn.addEventListener("click", openMcpModal);
|
|
26
|
-
if (closeBtn) closeBtn.addEventListener("click", closeMcpModal);
|
|
27
|
-
if (backdrop) backdrop.addEventListener("click", closeMcpModal);
|
|
28
|
-
|
|
29
|
-
// ESC to close
|
|
30
|
-
document.addEventListener("keydown", function (e) {
|
|
31
|
-
if (e.key === "Escape" && modal && !modal.classList.contains("hidden")) {
|
|
32
|
-
closeMcpModal();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
26
|
}
|
|
36
27
|
|
|
37
28
|
export function handleMcpServersState(msg) {
|
|
@@ -62,14 +53,13 @@ export function getMcpServers() {
|
|
|
62
53
|
|
|
63
54
|
function openMcpModal() {
|
|
64
55
|
if (!modal) return;
|
|
65
|
-
|
|
56
|
+
modalHandle = showOverlay({ kind: "modal", el: modal });
|
|
66
57
|
refreshIcons(modal);
|
|
67
58
|
renderMcpServerList();
|
|
68
59
|
}
|
|
69
60
|
|
|
70
61
|
function closeMcpModal() {
|
|
71
|
-
if (
|
|
72
|
-
modal.classList.add("hidden");
|
|
62
|
+
if (modalHandle) modalHandle.close();
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
function updateBadge() {
|
|
@@ -4,6 +4,8 @@ import { escapeHtml, copyToClipboard } from './utils.js';
|
|
|
4
4
|
import { iconHtml, refreshIcons } from './icons.js';
|
|
5
5
|
import { store } from './store.js';
|
|
6
6
|
import { gatedButtonAttrs } from './vendor-registry.js';
|
|
7
|
+
import { buildMessageHeader, AVATAR_REQUEST_SIZE } from './message-header.js';
|
|
8
|
+
import { openInputList, closeInputList } from './input-list-menu.js';
|
|
7
9
|
|
|
8
10
|
var ctx;
|
|
9
11
|
|
|
@@ -234,6 +236,7 @@ export function showMentionMenu(query) {
|
|
|
234
236
|
'</div>';
|
|
235
237
|
}).join("");
|
|
236
238
|
menuEl.classList.add("visible");
|
|
239
|
+
openInputList(menuEl, ctx && ctx.inputEl, hideMentionMenu);
|
|
237
240
|
}
|
|
238
241
|
|
|
239
242
|
export function hideMentionMenu() {
|
|
@@ -246,6 +249,7 @@ export function hideMentionMenu() {
|
|
|
246
249
|
if (menuEl) {
|
|
247
250
|
menuEl.classList.remove("visible");
|
|
248
251
|
menuEl.innerHTML = "";
|
|
252
|
+
closeInputList(menuEl);
|
|
249
253
|
}
|
|
250
254
|
}
|
|
251
255
|
|
|
@@ -523,107 +527,49 @@ export function handleMentionStart(msg) {
|
|
|
523
527
|
|
|
524
528
|
var avatarSrc = buildMentionAvatarUrl(msg);
|
|
525
529
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
'<span class="activity-text">Thinking...</span>';
|
|
570
|
-
contentWrap.appendChild(activityDiv);
|
|
571
|
-
|
|
572
|
-
// Content area for streamed markdown
|
|
573
|
-
var contentDiv = document.createElement("div");
|
|
574
|
-
contentDiv.className = "md-content mention-content";
|
|
575
|
-
contentDiv.dir = "auto";
|
|
576
|
-
contentWrap.appendChild(contentDiv);
|
|
577
|
-
|
|
578
|
-
currentMentionEl.appendChild(contentWrap);
|
|
579
|
-
} else {
|
|
580
|
-
// Project chat: mention block style
|
|
581
|
-
currentMentionEl = document.createElement("div");
|
|
582
|
-
currentMentionEl.className = "msg-mention";
|
|
583
|
-
currentMentionEl.style.setProperty("--mention-color", msg.avatarColor || "#6c5ce7");
|
|
584
|
-
|
|
585
|
-
var header = document.createElement("div");
|
|
586
|
-
header.className = "mention-header";
|
|
587
|
-
|
|
588
|
-
var avatar = document.createElement("img");
|
|
589
|
-
avatar.className = "mention-avatar";
|
|
590
|
-
avatar.src = avatarSrc;
|
|
591
|
-
avatar.width = 20;
|
|
592
|
-
avatar.height = 20;
|
|
593
|
-
header.appendChild(avatar);
|
|
594
|
-
|
|
595
|
-
var nameSpan = document.createElement("span");
|
|
596
|
-
nameSpan.className = "mention-name";
|
|
597
|
-
nameSpan.textContent = msg.mateName || "Mate";
|
|
598
|
-
header.appendChild(nameSpan);
|
|
599
|
-
|
|
600
|
-
var stopBtn = document.createElement("button");
|
|
601
|
-
stopBtn.className = "mention-stop-btn";
|
|
602
|
-
stopBtn.title = "Stop";
|
|
603
|
-
stopBtn.textContent = "Stop";
|
|
604
|
-
stopBtn.addEventListener("click", function () {
|
|
605
|
-
if (ctx.ws && ctx.connected) {
|
|
606
|
-
ctx.ws.send(JSON.stringify({ type: "mention_stop", mateId: msg.mateId }));
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
header.appendChild(stopBtn);
|
|
610
|
-
|
|
611
|
-
currentMentionEl.appendChild(header);
|
|
612
|
-
|
|
613
|
-
// Activity indicator
|
|
614
|
-
var activityDiv = document.createElement("div");
|
|
615
|
-
activityDiv.className = "activity-inline mention-activity-bar";
|
|
616
|
-
activityDiv.innerHTML =
|
|
617
|
-
'<span class="activity-icon">' + iconHtml("sparkles") + '</span>' +
|
|
618
|
-
'<span class="activity-text">Thinking...</span>';
|
|
619
|
-
currentMentionEl.appendChild(activityDiv);
|
|
620
|
-
|
|
621
|
-
// Content area for streamed markdown
|
|
622
|
-
var contentDiv = document.createElement("div");
|
|
623
|
-
contentDiv.className = "md-content mention-content";
|
|
624
|
-
contentDiv.dir = "auto";
|
|
625
|
-
currentMentionEl.appendChild(contentDiv);
|
|
626
|
-
}
|
|
530
|
+
currentMentionEl = document.createElement("div");
|
|
531
|
+
currentMentionEl.className = "msg-assistant msg-mention-dm";
|
|
532
|
+
|
|
533
|
+
var avi = document.createElement("img");
|
|
534
|
+
avi.className = "dm-bubble-avatar dm-bubble-avatar-agent";
|
|
535
|
+
avi.src = avatarSrc;
|
|
536
|
+
avi.alt = "";
|
|
537
|
+
|
|
538
|
+
var badge = document.createElement("span");
|
|
539
|
+
badge.className = "mention-badge";
|
|
540
|
+
badge.textContent = "@MENTION";
|
|
541
|
+
|
|
542
|
+
var stopBtn = document.createElement("button");
|
|
543
|
+
stopBtn.className = "mention-stop-btn";
|
|
544
|
+
stopBtn.title = "Stop";
|
|
545
|
+
stopBtn.textContent = "Stop";
|
|
546
|
+
stopBtn.addEventListener("click", function () {
|
|
547
|
+
if (ctx.ws && ctx.connected) {
|
|
548
|
+
ctx.ws.send(JSON.stringify({ type: "mention_stop", mateId: msg.mateId }));
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
currentMentionEl.appendChild(buildMessageHeader({
|
|
553
|
+
side: "other",
|
|
554
|
+
avatarEl: avi,
|
|
555
|
+
name: msg.mateName || "Mate",
|
|
556
|
+
nameColor: msg.avatarColor,
|
|
557
|
+
extras: [badge, stopBtn],
|
|
558
|
+
}).el);
|
|
559
|
+
|
|
560
|
+
// Activity indicator
|
|
561
|
+
var activityDiv = document.createElement("div");
|
|
562
|
+
activityDiv.className = "activity-inline mention-activity-bar";
|
|
563
|
+
activityDiv.innerHTML =
|
|
564
|
+
'<span class="activity-icon">' + iconHtml("sparkles") + '</span>' +
|
|
565
|
+
'<span class="activity-text">Thinking...</span>';
|
|
566
|
+
currentMentionEl.appendChild(activityDiv);
|
|
567
|
+
|
|
568
|
+
// Content area for streamed markdown
|
|
569
|
+
var contentDiv = document.createElement("div");
|
|
570
|
+
contentDiv.className = "md-content mention-content";
|
|
571
|
+
contentDiv.dir = "auto";
|
|
572
|
+
currentMentionEl.appendChild(contentDiv);
|
|
627
573
|
|
|
628
574
|
mentionFullText = "";
|
|
629
575
|
mentionStreamBuffer = "";
|
|
@@ -764,19 +710,11 @@ export function handleMentionError(msg) {
|
|
|
764
710
|
}
|
|
765
711
|
|
|
766
712
|
// --- Helpers ---
|
|
767
|
-
function isWideView() {
|
|
768
|
-
return document.body.classList.contains("wide-view");
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
function isDmLayout() {
|
|
772
|
-
return isWideView();
|
|
773
|
-
}
|
|
774
|
-
|
|
775
713
|
function getMyAvatarSrc() {
|
|
776
714
|
if (document.body.dataset.myAvatarUrl) return document.body.dataset.myAvatarUrl;
|
|
777
715
|
var myUser = null;
|
|
778
716
|
try { myUser = JSON.parse(localStorage.getItem("clagentic_my_user") || localStorage.getItem("clay_my_user") || "null"); } catch (e) {}
|
|
779
|
-
return userAvatarUrl(myUser || {},
|
|
717
|
+
return userAvatarUrl(myUser || {}, AVATAR_REQUEST_SIZE);
|
|
780
718
|
}
|
|
781
719
|
|
|
782
720
|
function getMyDisplayName() {
|
|
@@ -877,32 +815,21 @@ export function renderUserMention(entry) {
|
|
|
877
815
|
var avi = document.createElement("img");
|
|
878
816
|
avi.className = "dm-bubble-avatar dm-bubble-avatar-me";
|
|
879
817
|
avi.src = buildUserAvatarUrlFromEntry(entry, "from");
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
var contentWrap = document.createElement("div");
|
|
883
|
-
contentWrap.className = "dm-bubble-content";
|
|
884
|
-
|
|
885
|
-
var header = document.createElement("div");
|
|
886
|
-
header.className = "dm-bubble-header";
|
|
887
|
-
var nameSpan = document.createElement("span");
|
|
888
|
-
nameSpan.className = "dm-bubble-name";
|
|
889
|
-
nameSpan.textContent = fromName;
|
|
890
|
-
header.appendChild(nameSpan);
|
|
818
|
+
avi.alt = "";
|
|
891
819
|
|
|
892
820
|
var sideTag = document.createElement("span");
|
|
893
821
|
sideTag.className = "mention-badge mention-badge-user";
|
|
894
822
|
sideTag.textContent = "@" + targetName.toUpperCase();
|
|
895
823
|
sideTag.title = "Side conversation with " + targetName + ". The coding agent will see this on the next message.";
|
|
896
|
-
header.appendChild(sideTag);
|
|
897
|
-
|
|
898
|
-
var ts = document.createElement("span");
|
|
899
|
-
ts.className = "dm-bubble-time";
|
|
900
|
-
ts.textContent = timeStr();
|
|
901
|
-
header.appendChild(ts);
|
|
902
824
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
825
|
+
div.appendChild(buildMessageHeader({
|
|
826
|
+
side: "own",
|
|
827
|
+
avatarEl: avi,
|
|
828
|
+
name: fromName,
|
|
829
|
+
extras: [sideTag],
|
|
830
|
+
time: timeStr(),
|
|
831
|
+
}).el);
|
|
832
|
+
div.appendChild(bubble);
|
|
906
833
|
|
|
907
834
|
if (ctx.addToMessages) ctx.addToMessages(div);
|
|
908
835
|
else if (ctx.messagesEl) ctx.messagesEl.appendChild(div);
|
|
@@ -971,40 +898,29 @@ export function renderMentionUser(entry) {
|
|
|
971
898
|
textEl.innerHTML = '<span class="mention-chip">@' + escapeHtml(entry.mateName || "Mate") + '</span> ' + escapeHtml(entry.text || "");
|
|
972
899
|
bubble.appendChild(textEl);
|
|
973
900
|
|
|
974
|
-
//
|
|
901
|
+
// The viewer's own mention: the same mirrored header as any own message,
|
|
902
|
+
// with the action bar in it.
|
|
975
903
|
var avi = document.createElement("img");
|
|
976
904
|
avi.className = "dm-bubble-avatar dm-bubble-avatar-me";
|
|
977
905
|
avi.src = getMyAvatarSrc();
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
var contentWrap = document.createElement("div");
|
|
981
|
-
contentWrap.className = "dm-bubble-content";
|
|
982
|
-
|
|
983
|
-
var header = document.createElement("div");
|
|
984
|
-
header.className = "dm-bubble-header";
|
|
985
|
-
var nameSpan = document.createElement("span");
|
|
986
|
-
nameSpan.className = "dm-bubble-name";
|
|
987
|
-
nameSpan.textContent = getMyDisplayName();
|
|
988
|
-
header.appendChild(nameSpan);
|
|
989
|
-
var ts = document.createElement("span");
|
|
990
|
-
ts.className = "dm-bubble-time";
|
|
991
|
-
ts.textContent = timeStr();
|
|
992
|
-
header.appendChild(ts);
|
|
993
|
-
contentWrap.appendChild(header);
|
|
994
|
-
contentWrap.appendChild(bubble);
|
|
995
|
-
div.appendChild(contentWrap);
|
|
996
|
-
|
|
997
|
-
// Action bar below bubble (same as regular user messages)
|
|
906
|
+
avi.alt = "";
|
|
907
|
+
|
|
998
908
|
var actions = document.createElement("div");
|
|
999
909
|
actions.className = "msg-actions";
|
|
1000
|
-
var ts2 = timeStr();
|
|
1001
910
|
actions.innerHTML =
|
|
1002
|
-
'<span class="msg-action-time">' + ts2 + '</span>' +
|
|
1003
911
|
'<button class="msg-action-btn msg-action-copy" type="button" title="Copy">' + iconHtml("copy") + '</button>' +
|
|
1004
912
|
'<button class="msg-action-btn msg-action-fork" type="button" ' + gatedButtonAttrs("fork", "Fork") + '>' + iconHtml("git-branch") + '</button>' +
|
|
1005
913
|
'<button class="msg-action-btn msg-action-rewind msg-user-rewind-btn" type="button" ' + gatedButtonAttrs("rewind", "Rewind") + '>' + iconHtml("rotate-ccw") + '</button>' +
|
|
1006
914
|
'<button class="msg-action-btn msg-action-hidden msg-action-edit" type="button" title="Edit">' + iconHtml("pencil") + '</button>';
|
|
1007
|
-
|
|
915
|
+
|
|
916
|
+
div.appendChild(buildMessageHeader({
|
|
917
|
+
side: "own",
|
|
918
|
+
avatarEl: avi,
|
|
919
|
+
name: getMyDisplayName(),
|
|
920
|
+
time: timeStr(),
|
|
921
|
+
actions: actions,
|
|
922
|
+
}).el);
|
|
923
|
+
div.appendChild(bubble);
|
|
1008
924
|
|
|
1009
925
|
// Copy handler
|
|
1010
926
|
var rawText = (entry.mateName ? "@" + entry.mateName + " " : "") + (entry.text || "");
|
|
@@ -1024,81 +940,36 @@ export function renderMentionUser(entry) {
|
|
|
1024
940
|
export function renderMentionResponse(entry) {
|
|
1025
941
|
var avatarSrc = buildMentionAvatarUrl(entry);
|
|
1026
942
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
contentWrap.appendChild(header);
|
|
1058
|
-
|
|
1059
|
-
var contentDiv = document.createElement("div");
|
|
1060
|
-
contentDiv.className = "md-content mention-content";
|
|
1061
|
-
contentDiv.dir = "auto";
|
|
1062
|
-
contentDiv.innerHTML = renderMarkdown(entry.text || "");
|
|
1063
|
-
highlightCodeBlocks(contentDiv);
|
|
1064
|
-
contentWrap.appendChild(contentDiv);
|
|
1065
|
-
el.appendChild(contentWrap);
|
|
1066
|
-
|
|
1067
|
-
if (ctx.addToMessages) ctx.addToMessages(el);
|
|
1068
|
-
else if (ctx.messagesEl) ctx.messagesEl.appendChild(el);
|
|
1069
|
-
} else {
|
|
1070
|
-
// Project chat: use mention block style
|
|
1071
|
-
var el = document.createElement("div");
|
|
1072
|
-
el.className = "msg-mention";
|
|
1073
|
-
el.style.setProperty("--mention-color", entry.avatarColor || "#6c5ce7");
|
|
1074
|
-
|
|
1075
|
-
var mheader = document.createElement("div");
|
|
1076
|
-
mheader.className = "mention-header";
|
|
1077
|
-
|
|
1078
|
-
var avatar = document.createElement("img");
|
|
1079
|
-
avatar.className = "mention-avatar";
|
|
1080
|
-
avatar.src = avatarSrc;
|
|
1081
|
-
avatar.width = 20;
|
|
1082
|
-
avatar.height = 20;
|
|
1083
|
-
mheader.appendChild(avatar);
|
|
1084
|
-
|
|
1085
|
-
var mname = document.createElement("span");
|
|
1086
|
-
mname.className = "mention-name";
|
|
1087
|
-
mname.textContent = entry.mateName || "Mate";
|
|
1088
|
-
mheader.appendChild(mname);
|
|
1089
|
-
|
|
1090
|
-
el.appendChild(mheader);
|
|
1091
|
-
|
|
1092
|
-
var contentDiv = document.createElement("div");
|
|
1093
|
-
contentDiv.className = "md-content mention-content";
|
|
1094
|
-
contentDiv.dir = "auto";
|
|
1095
|
-
contentDiv.innerHTML = renderMarkdown(entry.text || "");
|
|
1096
|
-
highlightCodeBlocks(contentDiv);
|
|
1097
|
-
el.appendChild(contentDiv);
|
|
1098
|
-
|
|
1099
|
-
if (ctx.addToMessages) ctx.addToMessages(el);
|
|
1100
|
-
else if (ctx.messagesEl) ctx.messagesEl.appendChild(el);
|
|
1101
|
-
}
|
|
943
|
+
var el = document.createElement("div");
|
|
944
|
+
el.className = "msg-assistant msg-mention-dm";
|
|
945
|
+
|
|
946
|
+
var avi = document.createElement("img");
|
|
947
|
+
avi.className = "dm-bubble-avatar dm-bubble-avatar-agent";
|
|
948
|
+
avi.src = avatarSrc;
|
|
949
|
+
avi.alt = "";
|
|
950
|
+
|
|
951
|
+
var badge = document.createElement("span");
|
|
952
|
+
badge.className = "mention-badge";
|
|
953
|
+
badge.textContent = "@MENTION";
|
|
954
|
+
|
|
955
|
+
el.appendChild(buildMessageHeader({
|
|
956
|
+
side: "other",
|
|
957
|
+
avatarEl: avi,
|
|
958
|
+
name: entry.mateName || "Mate",
|
|
959
|
+
nameColor: entry.avatarColor,
|
|
960
|
+
extras: [badge],
|
|
961
|
+
time: timeStr(),
|
|
962
|
+
}).el);
|
|
963
|
+
|
|
964
|
+
var contentDiv = document.createElement("div");
|
|
965
|
+
contentDiv.className = "md-content mention-content";
|
|
966
|
+
contentDiv.dir = "auto";
|
|
967
|
+
contentDiv.innerHTML = renderMarkdown(entry.text || "");
|
|
968
|
+
highlightCodeBlocks(contentDiv);
|
|
969
|
+
el.appendChild(contentDiv);
|
|
970
|
+
|
|
971
|
+
if (ctx.addToMessages) ctx.addToMessages(el);
|
|
972
|
+
else if (ctx.messagesEl) ctx.messagesEl.appendChild(el);
|
|
1102
973
|
|
|
1103
974
|
// Add copy handler
|
|
1104
975
|
if (ctx.addCopyHandler && entry.text) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// message-header.js - the one header line every message in the transcript uses.
|
|
2
|
+
//
|
|
3
|
+
// buildMessageHeader({ side, avatarEl, showAvatar, name, nameColor, showName,
|
|
4
|
+
// label, time, extras, control, actions, compact })
|
|
5
|
+
//
|
|
6
|
+
// Avatar, name, label, time and controls sit on a single line of
|
|
7
|
+
// --msg-header-height; nothing in a header is placed on a row by itself. The
|
|
8
|
+
// other-speaker side reads avatar, name, label, time, then the controls at the
|
|
9
|
+
// far end. The own side is the same line mirrored by CSS (row-reverse), so the
|
|
10
|
+
// DOM order is the same and a screen reader hears one order for both.
|
|
11
|
+
//
|
|
12
|
+
// Per-use options, so a surface adapts the shape and never forks it:
|
|
13
|
+
// side "other" (default) or "own": picks the mirrored styling
|
|
14
|
+
// avatarEl the <img> the caller built (through agent-avatar.js for an agent);
|
|
15
|
+
// absent draws no avatar
|
|
16
|
+
// showAvatar false draws no avatar even when avatarEl is given (default true)
|
|
17
|
+
// name the speaker's name; showName false leaves it out (default true)
|
|
18
|
+
// nameColor an accent for the name (a mention's own colour)
|
|
19
|
+
// label the one-line label after the name (an injected message's
|
|
20
|
+
// initiator, note and sender kind)
|
|
21
|
+
// time the time text; absent draws none
|
|
22
|
+
// extras elements placed after the label (badges, a stop button)
|
|
23
|
+
// control the collapse control, placed at the far end
|
|
24
|
+
// actions the copy/fork/rewind bar, placed after the control
|
|
25
|
+
// compact the compact header: avatar and name are left out and only the
|
|
26
|
+
// time and controls remain
|
|
27
|
+
//
|
|
28
|
+
// Returns { el, avatarEl, nameEl, labelEl, timeEl }. All text is set with
|
|
29
|
+
// textContent; a name or label can come from another process.
|
|
30
|
+
|
|
31
|
+
// Avatars are drawn at --msg-avatar-size; resolvers are asked for twice that so
|
|
32
|
+
// they stay sharp on a dense screen.
|
|
33
|
+
export var AVATAR_REQUEST_SIZE = 48;
|
|
34
|
+
|
|
35
|
+
function textSpan(className, text) {
|
|
36
|
+
var span = document.createElement("span");
|
|
37
|
+
span.className = className;
|
|
38
|
+
span.textContent = text;
|
|
39
|
+
return span;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function buildMessageHeader(options) {
|
|
43
|
+
var o = options || {};
|
|
44
|
+
var own = o.side === "own";
|
|
45
|
+
var header = document.createElement("div");
|
|
46
|
+
header.className = "dm-bubble-header msg-header" + (own ? " msg-header-own" : "") + (o.compact ? " msg-header-compact" : "");
|
|
47
|
+
|
|
48
|
+
var avatarEl = null;
|
|
49
|
+
if (o.avatarEl && o.showAvatar !== false && !o.compact) {
|
|
50
|
+
avatarEl = o.avatarEl;
|
|
51
|
+
avatarEl.classList.add("msg-header-avatar");
|
|
52
|
+
header.appendChild(avatarEl);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var nameEl = null;
|
|
56
|
+
if (o.name != null && o.showName !== false && !o.compact) {
|
|
57
|
+
nameEl = textSpan("dm-bubble-name", o.name);
|
|
58
|
+
if (o.nameColor) nameEl.style.color = o.nameColor;
|
|
59
|
+
header.appendChild(nameEl);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var labelEl = null;
|
|
63
|
+
if (o.label) {
|
|
64
|
+
labelEl = textSpan("injected-label msg-header-label", o.label);
|
|
65
|
+
header.appendChild(labelEl);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
(o.extras || []).forEach(function (extra) { header.appendChild(extra); });
|
|
69
|
+
|
|
70
|
+
var timeEl = null;
|
|
71
|
+
if (o.time) {
|
|
72
|
+
timeEl = textSpan("dm-bubble-time", o.time);
|
|
73
|
+
header.appendChild(timeEl);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (o.control) header.appendChild(o.control);
|
|
77
|
+
if (o.actions) header.appendChild(o.actions);
|
|
78
|
+
|
|
79
|
+
return { el: header, avatarEl: avatarEl, nameEl: nameEl, labelEl: labelEl, timeEl: timeEl };
|
|
80
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// message-participants.js - how many different people have typed in the
|
|
2
|
+
// transcript on screen, which decides what the viewer's own header shows: time
|
|
3
|
+
// only while one person has spoken, avatar, name and time once two or more have.
|
|
4
|
+
// Agents and injected input are never people here.
|
|
5
|
+
//
|
|
6
|
+
// Pure state and no DOM, so node:test can run it. The renderer calls noteHuman()
|
|
7
|
+
// for each typed message and applies the result as a class on the transcript;
|
|
8
|
+
// the stylesheet does the rest, so an earlier own message changes the moment a
|
|
9
|
+
// second person speaks.
|
|
10
|
+
|
|
11
|
+
export var MULTI_HUMAN_CLASS = "multi-human";
|
|
12
|
+
|
|
13
|
+
var speakers = Object.create(null);
|
|
14
|
+
var count = 0;
|
|
15
|
+
|
|
16
|
+
/** Records a person who typed a message. Returns how many people have spoken. */
|
|
17
|
+
export function noteHuman(userId) {
|
|
18
|
+
var key = userId == null || userId === "" ? "self" : String(userId);
|
|
19
|
+
if (!speakers[key]) {
|
|
20
|
+
speakers[key] = true;
|
|
21
|
+
count++;
|
|
22
|
+
}
|
|
23
|
+
return count;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function humanCount() {
|
|
27
|
+
return count;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** True once two or more people have spoken. */
|
|
31
|
+
export function isMultiHuman() {
|
|
32
|
+
return count >= 2;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Forget everyone: the transcript was cleared (session or project switch). */
|
|
36
|
+
export function resetHumans() {
|
|
37
|
+
speakers = Object.create(null);
|
|
38
|
+
count = 0;
|
|
39
|
+
}
|