@clagentic/console 1.12.0-beta.1 → 1.12.0-beta.3

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 (161) hide show
  1. package/LICENSES/README.md +5 -0
  2. package/README.md +1 -0
  3. package/bin/cli.js +5 -2
  4. package/lib/agent-roster-ws.js +84 -0
  5. package/lib/agent-roster.js +312 -0
  6. package/lib/auth-required-notify.js +42 -0
  7. package/lib/build-changes.js +8 -2
  8. package/lib/build-sha.json +2 -2
  9. package/lib/build-update-notify.js +45 -0
  10. package/lib/build-update-offer.js +34 -11
  11. package/lib/build-update-standing.js +34 -14
  12. package/lib/claude-settings-env.js +142 -0
  13. package/lib/cli/duration.js +27 -0
  14. package/lib/cli/schedule-input-subcommands.js +1 -22
  15. package/lib/cli/session-subcommands.js +60 -11
  16. package/lib/client-address.js +44 -0
  17. package/lib/daemon.js +31 -10
  18. package/lib/idle-compaction-setting.js +203 -0
  19. package/lib/mcp-bridge-credential.js +41 -0
  20. package/lib/notification-prefs.js +18 -22
  21. package/lib/notify/core.js +210 -0
  22. package/lib/notify/index.js +31 -0
  23. package/lib/notify/live-prompts.js +36 -0
  24. package/lib/notify/payload.js +62 -0
  25. package/lib/notify/target.js +5 -0
  26. package/lib/notify/type-registry.js +81 -0
  27. package/lib/notify/types.js +57 -0
  28. package/lib/open-sockets.js +27 -0
  29. package/lib/outbound-access.js +85 -0
  30. package/lib/outbound-entry.js +116 -0
  31. package/lib/outbound-ledger.js +306 -0
  32. package/lib/outbound-query.js +153 -0
  33. package/lib/pending-prompts.js +31 -16
  34. package/lib/project-connection.js +48 -8
  35. package/lib/project-filesystem.js +43 -5
  36. package/lib/project-http.js +9 -1
  37. package/lib/project-loop.js +38 -26
  38. package/lib/project-notifications.js +122 -39
  39. package/lib/project-prompt-responses.js +1 -1
  40. package/lib/project-sessions.js +11 -1
  41. package/lib/project-user-mention.js +22 -34
  42. package/lib/project-user-message.js +208 -4
  43. package/lib/project-user-shell.js +298 -0
  44. package/lib/project.js +41 -5
  45. package/lib/prompt-answer.js +145 -0
  46. package/lib/prompt-expiry.js +50 -0
  47. package/lib/prompt-registry.js +98 -25
  48. package/lib/prompt-reminders.js +38 -33
  49. package/lib/prompt-source.js +59 -8
  50. package/lib/public/app.js +32 -2
  51. package/lib/public/css/agent-messages.css +96 -0
  52. package/lib/public/css/agent-roster.css +93 -0
  53. package/lib/public/css/diagnostics.css +29 -1
  54. package/lib/public/css/home-hub.css +12 -0
  55. package/lib/public/css/icon-strip.css +9 -0
  56. package/lib/public/css/input.css +20 -141
  57. package/lib/public/css/login-panel.css +73 -0
  58. package/lib/public/css/menus.css +2 -2
  59. package/lib/public/css/mobile-nav.css +11 -0
  60. package/lib/public/css/sidebar.css +18 -0
  61. package/lib/public/css/team-panel.css +1 -6
  62. package/lib/public/css/team-view.css +101 -0
  63. package/lib/public/css/title-bar.css +10 -0
  64. package/lib/public/css/user-shell.css +144 -0
  65. package/lib/public/index.html +44 -7
  66. package/lib/public/modules/activity-state.js +20 -4
  67. package/lib/public/modules/agent-avatar-picker.js +162 -0
  68. package/lib/public/modules/agent-avatar.js +153 -0
  69. package/lib/public/modules/agent-messages.js +285 -0
  70. package/lib/public/modules/agent-roster.js +157 -0
  71. package/lib/public/modules/app-connection.js +34 -5
  72. package/lib/public/modules/app-messages.js +55 -16
  73. package/lib/public/modules/app-notifications.js +104 -75
  74. package/lib/public/modules/app-panels.js +26 -3
  75. package/lib/public/modules/app-projects.js +3 -1
  76. package/lib/public/modules/app-rate-limit.js +8 -165
  77. package/lib/public/modules/app-rendering.js +32 -7
  78. package/lib/public/modules/build-update-sessions.js +81 -0
  79. package/lib/public/modules/collapsible-text.js +33 -18
  80. package/lib/public/modules/compaction-state.js +34 -0
  81. package/lib/public/modules/custom-icons.js +23 -5
  82. package/lib/public/modules/diagnostics.js +61 -57
  83. package/lib/public/modules/env-shadow-notice.js +34 -0
  84. package/lib/public/modules/injected-identity.js +24 -21
  85. package/lib/public/modules/input.js +176 -15
  86. package/lib/public/modules/login-panel.js +136 -0
  87. package/lib/public/modules/login-parser.js +73 -0
  88. package/lib/public/modules/login-tab.js +66 -0
  89. package/lib/public/modules/notifications.js +9 -1
  90. package/lib/public/modules/notify-client.js +246 -0
  91. package/lib/public/modules/pending-term-request.js +30 -0
  92. package/lib/public/modules/project-icon.js +22 -2
  93. package/lib/public/modules/project-settings.js +5 -0
  94. package/lib/public/modules/prompt-state.js +3 -3
  95. package/lib/public/modules/prompts.js +1 -1
  96. package/lib/public/modules/queued-button.js +11 -0
  97. package/lib/public/modules/scheduled-input-actions.js +12 -4
  98. package/lib/public/modules/scheduled-outbox.js +230 -0
  99. package/lib/public/modules/send-now.js +200 -0
  100. package/lib/public/modules/server-settings.js +50 -1
  101. package/lib/public/modules/shell-card.js +76 -0
  102. package/lib/public/modules/shell-line.js +49 -0
  103. package/lib/public/modules/shell-queue.js +253 -0
  104. package/lib/public/modules/shell-settings-controls.js +76 -0
  105. package/lib/public/modules/sidebar-mobile.js +3 -3
  106. package/lib/public/modules/sidebar-sessions.js +8 -0
  107. package/lib/public/modules/sidebar-users.js +5 -7
  108. package/lib/public/modules/team-panel.js +30 -88
  109. package/lib/public/modules/team-view.js +211 -0
  110. package/lib/public/modules/terminal-links.js +193 -0
  111. package/lib/public/modules/terminal.js +84 -107
  112. package/lib/public/modules/tools.js +19 -0
  113. package/lib/public/modules/user-shell.js +824 -0
  114. package/lib/public/notify-sw-logic.js +252 -0
  115. package/lib/public/notify-target.js +157 -0
  116. package/lib/public/style.css +5 -0
  117. package/lib/public/sw.js +20 -69
  118. package/lib/push.js +63 -19
  119. package/lib/queued-chat.js +392 -0
  120. package/lib/runtime-env.js +1 -0
  121. package/lib/scheduled-input/ws.js +67 -9
  122. package/lib/sdk-bridge.js +184 -73
  123. package/lib/sdk-message-processor.js +124 -76
  124. package/lib/server-auth.js +6 -4
  125. package/lib/server-dm.js +11 -20
  126. package/lib/server-settings.js +39 -1
  127. package/lib/server.js +112 -16
  128. package/lib/session-directory.js +39 -12
  129. package/lib/session-end.js +97 -0
  130. package/lib/session-input-ipc.js +37 -1
  131. package/lib/session-input.js +263 -21
  132. package/lib/session-liveness.js +53 -0
  133. package/lib/session-reclaim.js +37 -2
  134. package/lib/session-resume.js +1 -0
  135. package/lib/session-settings-file.js +53 -0
  136. package/lib/sessions.js +80 -9
  137. package/lib/team-traffic-ws.js +68 -0
  138. package/lib/team-traffic.js +318 -0
  139. package/lib/usage-store.js +36 -7
  140. package/lib/user-shell-settings.js +105 -0
  141. package/lib/vendor-auth.js +33 -2
  142. package/lib/ws-schema.js +33 -5
  143. package/lib/yoke/adapters/claude-capabilities.js +2 -0
  144. package/lib/yoke/adapters/claude-vendor.js +17 -1
  145. package/lib/yoke/adapters/claude-worker.js +39 -11
  146. package/lib/yoke/adapters/claude.js +225 -6
  147. package/lib/yoke/adapters/codex-capabilities.js +6 -1
  148. package/lib/yoke/adapters/codex-user-shell.js +265 -0
  149. package/lib/yoke/adapters/codex-vendor.js +7 -0
  150. package/lib/yoke/adapters/codex.js +186 -52
  151. package/lib/yoke/auth-checks.js +17 -2
  152. package/lib/yoke/codex-app-server.js +8 -2
  153. package/lib/yoke/index.js +21 -3
  154. package/lib/yoke/interface.js +54 -1
  155. package/lib/yoke/mcp-bridge-server.js +12 -8
  156. package/lib/yoke/provider-credentials.js +24 -0
  157. package/lib/yoke/registry.js +40 -1
  158. package/lib/yoke/user-shell.js +224 -0
  159. package/package.json +2 -2
  160. package/scripts/check-test-count.js +14 -0
  161. package/lib/public/modules/build-notice-gate.js +0 -73
@@ -4,6 +4,10 @@ import { closeFileViewer } from './filebrowser.js';
4
4
  import { copyToClipboard } from './utils.js';
5
5
  import { getTerminalTheme } from './theme.js';
6
6
  import { positionAtPoint } from './popover-position.js';
7
+ import { createMultiLineLinkProvider, copyTextForSelection } from './terminal-links.js';
8
+ import { store } from './store.js';
9
+ import { vendorEntry } from './vendor-registry.js';
10
+ import { createLoginTab } from './login-tab.js';
7
11
 
8
12
  var ctx;
9
13
  var tabs = new Map(); // termId -> { id, title, exited, xterm, fitAddon, bodyEl }
@@ -14,8 +18,53 @@ var altActive = false;
14
18
  var isTouchDevice = "ontouchstart" in window;
15
19
  var viewportHandler = null;
16
20
  var resizeObserver = null;
21
+ // termId -> sign-in panel controller. Present only for the terminal that
22
+ // startLoginCommand opened; every other terminal's output is never parsed.
23
+ var loginTabs = new Map();
24
+
25
+ function closeLoginTab(termId) {
26
+ var login = loginTabs.get(termId);
27
+ if (!login) return;
28
+ login.close();
29
+ loginTabs.delete(termId);
30
+ }
31
+
32
+ function loginIdentity() {
33
+ if (store.get('isOsUsers')) return "os-users";
34
+ return store.get('isMultiUserMode') ? "shared" : "";
35
+ }
36
+
37
+ /**
38
+ * Marks a terminal as the login tab for an agent, so its output feeds the
39
+ * sign-in panel. Called once, for the terminal the login command was typed into.
40
+ * @param {string} termId
41
+ * @param {string} vendorId
42
+ */
43
+ export function markLoginTerminal(termId, vendorId) {
44
+ if (!termId) return;
45
+ var entry = vendorEntry(vendorId);
46
+ if (!entry || !entry.loginPatterns) return;
47
+ closeLoginTab(termId);
48
+ loginTabs.set(termId, createLoginTab({
49
+ patterns: entry.loginPatterns,
50
+ vendorName: entry.displayName,
51
+ identity: loginIdentity(),
52
+ sendCode: function (text) { sendTerminalInput(termId, text); },
53
+ copy: copyToClipboard,
54
+ openLink: function (url) { window.open(url, "_blank", "noopener"); },
55
+ mount: function (panelEl) {
56
+ ctx.terminalContainerEl.insertBefore(panelEl, ctx.terminalBodyEl);
57
+ },
58
+ }));
59
+ syncLoginPanels();
60
+ }
61
+
62
+ function syncLoginPanels() {
63
+ for (var entry of loginTabs.entries()) entry[1].setActive(entry[0] === activeTabId);
64
+ }
17
65
 
18
66
  function disposeTab(tab) {
67
+ closeLoginTab(tab.id);
19
68
  if (tab._webglAddon) {
20
69
  try { tab._webglAddon.dispose(); } catch (e) {}
21
70
  tab._webglAddon = null;
@@ -33,106 +82,6 @@ function disposeTab(tab) {
33
82
  var toolbarBound = false;
34
83
  var termCtxMenu = null;
35
84
 
36
- // --- Multi-line link provider ---
37
- // xterm's WebLinksAddon only detects URLs on a single line.
38
- // This provider reconstructs "logical lines" from wrapped buffer lines
39
- // and detects URLs that span multiple rows.
40
- function createMultiLineLinkProvider(xterm) {
41
- var URL_RE = /https?:\/\/[^\s'"\]>)}{]+/g;
42
-
43
- function getLogicalLine(buffer, y) {
44
- // Walk backward to find the start of the logical line
45
- var startY = y;
46
- while (startY > 0) {
47
- var line = buffer.getLine(startY);
48
- if (!line || !line.isWrapped) break;
49
- startY--;
50
- }
51
-
52
- // Walk forward to collect all wrapped continuation lines
53
- var endY = startY;
54
- var cols = xterm.cols;
55
- while (endY < buffer.length - 1) {
56
- var next = buffer.getLine(endY + 1);
57
- if (!next || !next.isWrapped) break;
58
- endY++;
59
- }
60
-
61
- // Build the full logical line text and track row boundaries
62
- var text = "";
63
- var rowOffsets = []; // { y, startOffset, length }
64
- for (var row = startY; row <= endY; row++) {
65
- var line = buffer.getLine(row);
66
- if (!line) break;
67
- var trimRight = (row === endY); // only trim trailing spaces on last row
68
- var rowText = line.translateToString(trimRight);
69
- rowOffsets.push({ y: row, startOffset: text.length, length: rowText.length });
70
- text += rowText;
71
- }
72
-
73
- return { text: text, startY: startY, endY: endY, rowOffsets: rowOffsets };
74
- }
75
-
76
- function offsetToBufferPos(rowOffsets, offset) {
77
- for (var i = 0; i < rowOffsets.length; i++) {
78
- var ro = rowOffsets[i];
79
- if (offset < ro.startOffset + ro.length) {
80
- return { x: offset - ro.startOffset + 1, y: ro.y + 1 }; // 1-based
81
- }
82
- }
83
- // Past end, clamp to last row
84
- var last = rowOffsets[rowOffsets.length - 1];
85
- return { x: last.length + 1, y: last.y + 1 };
86
- }
87
-
88
- return {
89
- provideLinks: function (y, callback) {
90
- var buffer = xterm.buffer.active;
91
- // y is 1-based in provideLinks
92
- var bufferY = y - 1;
93
- var logical = getLogicalLine(buffer, bufferY);
94
-
95
- // Only process if this logical line spans multiple rows
96
- if (logical.startY === logical.endY) {
97
- callback(undefined);
98
- return;
99
- }
100
-
101
- // Only trigger on the first row of the logical line to avoid duplicates
102
- if (bufferY !== logical.startY) {
103
- callback(undefined);
104
- return;
105
- }
106
-
107
- var links = [];
108
- var match;
109
- URL_RE.lastIndex = 0;
110
- while ((match = URL_RE.exec(logical.text)) !== null) {
111
- var urlStart = match.index;
112
- var urlEnd = match.index + match[0].length - 1;
113
-
114
- var startPos = offsetToBufferPos(logical.rowOffsets, urlStart);
115
- var endPos = offsetToBufferPos(logical.rowOffsets, urlEnd);
116
-
117
- // Only include if the URL actually spans multiple rows
118
- if (startPos.y !== endPos.y) {
119
- (function (url) {
120
- links.push({
121
- range: { start: startPos, end: endPos },
122
- text: url,
123
- activate: function () {
124
- window.open(url, "_blank", "noopener");
125
- },
126
- });
127
- })(match[0]);
128
- }
129
- }
130
-
131
- callback(links.length > 0 ? links : undefined);
132
- },
133
- };
134
- }
135
-
136
85
  // --- Init ---
137
86
  export function initTerminal(_ctx) {
138
87
  ctx = _ctx;
@@ -299,6 +248,7 @@ function activateTab(termId) {
299
248
  }
300
249
 
301
250
  activeTabId = termId;
251
+ syncLoginPanels();
302
252
 
303
253
  // Lazy-create xterm instance
304
254
  if (!tab.xterm) {
@@ -365,7 +315,10 @@ function createXtermForTab(tab) {
365
315
  }
366
316
 
367
317
  // Custom multi-line link provider: detect URLs that wrap across lines
368
- xterm.registerLinkProvider(createMultiLineLinkProvider(xterm));
318
+ xterm.registerLinkProvider(createMultiLineLinkProvider(xterm, {
319
+ onHover: function (url) { tab._hoverLink = url; },
320
+ onLeave: function () { tab._hoverLink = null; },
321
+ }));
369
322
 
370
323
  // Create a container div for this tab's terminal
371
324
  var bodyEl = document.createElement("div");
@@ -402,7 +355,7 @@ function createXtermForTab(tab) {
402
355
  if (e.type !== "keydown") return true;
403
356
  // Cmd/Ctrl+C: copy selection if any, otherwise send SIGINT
404
357
  if ((e.ctrlKey || e.metaKey) && e.key === "c") {
405
- var sel = xterm.getSelection();
358
+ var sel = copyTextForSelection(xterm, xterm.getSelection());
406
359
  if (sel) {
407
360
  if (navigator.clipboard && navigator.clipboard.writeText) {
408
361
  navigator.clipboard.writeText(sel).catch(function () {});
@@ -728,7 +681,13 @@ export function handleTermOutput(msg) {
728
681
  if (!msg.id) return;
729
682
  var tab = tabs.get(msg.id);
730
683
  if (tab && tab.xterm && msg.data) {
731
- tab.xterm.write(msg.data);
684
+ var login = loginTabs.get(msg.id);
685
+ if (login) {
686
+ // Read the buffer once xterm has parsed this chunk, not the raw bytes.
687
+ tab.xterm.write(msg.data, function () { login.feed(tab.xterm); });
688
+ } else {
689
+ tab.xterm.write(msg.data);
690
+ }
732
691
  }
733
692
  }
734
693
 
@@ -745,6 +704,7 @@ export function handleTermExited(msg) {
745
704
  var tab = tabs.get(msg.id);
746
705
  if (tab) {
747
706
  tab.exited = true;
707
+ closeLoginTab(msg.id);
748
708
  if (tab.xterm) {
749
709
  tab.xterm.write("\r\n\x1b[90m[Process exited]\x1b[0m\r\n");
750
710
  }
@@ -788,13 +748,18 @@ export function resetTerminals() {
788
748
  renderTabBar();
789
749
  }
790
750
 
791
- export function sendTerminalCommand(command) {
792
- if (!activeTabId || !tabs.has(activeTabId)) return;
751
+ // Types text into one named terminal through the ordinary input message.
752
+ export function sendTerminalInput(termId, data) {
753
+ if (!termId || !tabs.has(termId)) return;
793
754
  if (ctx.ws && ctx.connected) {
794
- ctx.ws.send(JSON.stringify({ type: "term_input", id: activeTabId, data: command }));
755
+ ctx.ws.send(JSON.stringify({ type: "term_input", id: termId, data: data }));
795
756
  }
796
757
  }
797
758
 
759
+ export function sendTerminalCommand(command) {
760
+ sendTerminalInput(activeTabId, command);
761
+ }
762
+
798
763
  export function setTerminalTheme(xtermTheme) {
799
764
  for (var tab of tabs.values()) {
800
765
  if (tab.xterm) {
@@ -820,7 +785,19 @@ function showTermCtxMenu(e, tab) {
820
785
  menu.className = "term-ctx-menu";
821
786
 
822
787
  // Copy selection
823
- var sel = tab.xterm ? tab.xterm.getSelection() : "";
788
+ var sel = tab.xterm ? copyTextForSelection(tab.xterm, tab.xterm.getSelection()) : "";
789
+ if (tab._hoverLink) {
790
+ var hoverUrl = tab._hoverLink;
791
+ var copyLinkItem = document.createElement("button");
792
+ copyLinkItem.className = "term-ctx-item";
793
+ copyLinkItem.innerHTML = iconHtml("link") + " <span>Copy Link</span>";
794
+ copyLinkItem.addEventListener("click", function (ev) {
795
+ ev.stopPropagation();
796
+ closeTermCtxMenu();
797
+ copyToClipboard(hoverUrl);
798
+ });
799
+ menu.appendChild(copyLinkItem);
800
+ }
824
801
  if (sel) {
825
802
  var copySelItem = document.createElement("button");
826
803
  copySelItem.className = "term-ctx-item";
@@ -8,6 +8,9 @@ import { store } from './store.js';
8
8
  import { VENDOR_NAMES } from './app-rendering.js';
9
9
  import { createPromptController } from './prompts.js';
10
10
  import { isAgentDispatchTool } from './agent-dispatch-tool.js';
11
+ import { createAgentAvatar } from './agent-avatar.js';
12
+
13
+ var SUBAGENT_AVATAR_SIZE = 16;
11
14
 
12
15
  var ctx;
13
16
 
@@ -822,6 +825,21 @@ export function createToolItem(id, name) {
822
825
  tools[id] = { el: el, name: name, input: null, done: false, groupId: currentToolGroup.id };
823
826
  }
824
827
 
828
+ // A Task or Agent dispatch is labelled with the sub-agent it starts: its avatar
829
+ // from the shared resolver (agent-avatar.js), then its subagent_type as given.
830
+ function addSubagentLabel(tool, descEl, name, input) {
831
+ if (!isAgentDispatchTool(name) || !input || typeof input.subagent_type !== "string" || !input.subagent_type) return;
832
+ if (tool.el.querySelector(".tool-agent")) return;
833
+ var label = document.createElement("span");
834
+ label.className = "tool-agent";
835
+ label.appendChild(createAgentAvatar(input.subagent_type, SUBAGENT_AVATAR_SIZE, "tool-agent-avatar"));
836
+ var text = document.createElement("span");
837
+ text.className = "tool-agent-name";
838
+ text.textContent = input.subagent_type;
839
+ label.appendChild(text);
840
+ descEl.parentNode.insertBefore(label, descEl);
841
+ }
842
+
825
843
  export function updateToolExecuting(id, name, input) {
826
844
  var tool = tools[id];
827
845
  if (!tool) return;
@@ -829,6 +847,7 @@ export function updateToolExecuting(id, name, input) {
829
847
  tool.input = input;
830
848
  var descEl = tool.el.querySelector(".tool-desc");
831
849
  descEl.textContent = toolSummary(name, input);
850
+ addSubagentLabel(tool, descEl, name, input);
832
851
 
833
852
  // Make file path clickable for Read/Edit/Write tools
834
853
  var filePath = input && input.file_path;