@clagentic/console 1.12.0-beta.2 → 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 (127) hide show
  1. package/LICENSES/README.md +5 -0
  2. package/bin/cli.js +4 -2
  3. package/lib/agent-roster-ws.js +84 -0
  4. package/lib/agent-roster.js +312 -0
  5. package/lib/auth-required-notify.js +42 -0
  6. package/lib/build-sha.json +2 -2
  7. package/lib/build-update-notify.js +45 -0
  8. package/lib/build-update-offer.js +3 -4
  9. package/lib/build-update-standing.js +34 -14
  10. package/lib/cli/session-subcommands.js +26 -8
  11. package/lib/client-address.js +44 -0
  12. package/lib/daemon.js +25 -10
  13. package/lib/idle-compaction-setting.js +203 -0
  14. package/lib/mcp-bridge-credential.js +41 -0
  15. package/lib/notification-prefs.js +16 -22
  16. package/lib/notify/core.js +53 -18
  17. package/lib/notify/payload.js +2 -3
  18. package/lib/notify/type-registry.js +17 -0
  19. package/lib/notify/types.js +38 -1
  20. package/lib/outbound-access.js +12 -1
  21. package/lib/outbound-entry.js +8 -1
  22. package/lib/project-connection.js +9 -8
  23. package/lib/project-filesystem.js +23 -0
  24. package/lib/project-loop.js +16 -19
  25. package/lib/project-notifications.js +68 -7
  26. package/lib/project-sessions.js +9 -0
  27. package/lib/project-user-mention.js +22 -34
  28. package/lib/project-user-message.js +208 -4
  29. package/lib/project-user-shell.js +298 -0
  30. package/lib/project.js +26 -4
  31. package/lib/prompt-answer.js +145 -0
  32. package/lib/prompt-expiry.js +50 -0
  33. package/lib/prompt-registry.js +24 -1
  34. package/lib/prompt-source.js +16 -0
  35. package/lib/public/app.js +31 -2
  36. package/lib/public/css/agent-messages.css +96 -0
  37. package/lib/public/css/agent-roster.css +93 -0
  38. package/lib/public/css/diagnostics.css +1 -1
  39. package/lib/public/css/input.css +20 -141
  40. package/lib/public/css/login-panel.css +73 -0
  41. package/lib/public/css/menus.css +2 -2
  42. package/lib/public/css/sidebar.css +11 -0
  43. package/lib/public/css/team-panel.css +1 -6
  44. package/lib/public/css/team-view.css +101 -0
  45. package/lib/public/css/title-bar.css +10 -0
  46. package/lib/public/css/user-shell.css +144 -0
  47. package/lib/public/index.html +41 -7
  48. package/lib/public/modules/agent-avatar-picker.js +162 -0
  49. package/lib/public/modules/agent-avatar.js +153 -0
  50. package/lib/public/modules/agent-messages.js +285 -0
  51. package/lib/public/modules/agent-roster.js +157 -0
  52. package/lib/public/modules/app-connection.js +12 -0
  53. package/lib/public/modules/app-messages.js +55 -16
  54. package/lib/public/modules/app-notifications.js +59 -29
  55. package/lib/public/modules/app-panels.js +26 -3
  56. package/lib/public/modules/app-rate-limit.js +8 -165
  57. package/lib/public/modules/app-rendering.js +22 -7
  58. package/lib/public/modules/collapsible-text.js +33 -18
  59. package/lib/public/modules/compaction-state.js +34 -0
  60. package/lib/public/modules/custom-icons.js +23 -5
  61. package/lib/public/modules/diagnostics.js +52 -55
  62. package/lib/public/modules/injected-identity.js +24 -21
  63. package/lib/public/modules/input.js +176 -15
  64. package/lib/public/modules/login-panel.js +136 -0
  65. package/lib/public/modules/login-parser.js +73 -0
  66. package/lib/public/modules/login-tab.js +66 -0
  67. package/lib/public/modules/notifications.js +9 -1
  68. package/lib/public/modules/notify-client.js +114 -21
  69. package/lib/public/modules/pending-term-request.js +30 -0
  70. package/lib/public/modules/project-icon.js +22 -2
  71. package/lib/public/modules/queued-button.js +11 -0
  72. package/lib/public/modules/scheduled-input-actions.js +12 -4
  73. package/lib/public/modules/scheduled-outbox.js +230 -0
  74. package/lib/public/modules/send-now.js +200 -0
  75. package/lib/public/modules/server-settings.js +47 -1
  76. package/lib/public/modules/shell-card.js +76 -0
  77. package/lib/public/modules/shell-line.js +49 -0
  78. package/lib/public/modules/shell-queue.js +253 -0
  79. package/lib/public/modules/shell-settings-controls.js +76 -0
  80. package/lib/public/modules/sidebar-mobile.js +3 -3
  81. package/lib/public/modules/sidebar-sessions.js +8 -0
  82. package/lib/public/modules/sidebar-users.js +5 -7
  83. package/lib/public/modules/team-panel.js +30 -88
  84. package/lib/public/modules/team-view.js +211 -0
  85. package/lib/public/modules/terminal-links.js +18 -0
  86. package/lib/public/modules/terminal.js +65 -4
  87. package/lib/public/modules/tools.js +19 -0
  88. package/lib/public/modules/user-shell.js +824 -0
  89. package/lib/public/notify-sw-logic.js +35 -83
  90. package/lib/public/notify-target.js +70 -10
  91. package/lib/public/style.css +5 -0
  92. package/lib/public/sw.js +7 -3
  93. package/lib/queued-chat.js +392 -0
  94. package/lib/scheduled-input/ws.js +67 -9
  95. package/lib/sdk-bridge.js +122 -43
  96. package/lib/sdk-message-processor.js +46 -39
  97. package/lib/server-auth.js +6 -4
  98. package/lib/server-dm.js +11 -20
  99. package/lib/server-settings.js +39 -1
  100. package/lib/server.js +83 -19
  101. package/lib/session-directory.js +33 -8
  102. package/lib/session-end.js +97 -0
  103. package/lib/session-input-ipc.js +26 -0
  104. package/lib/session-input.js +176 -9
  105. package/lib/session-resume.js +1 -0
  106. package/lib/session-settings-file.js +53 -0
  107. package/lib/sessions.js +49 -5
  108. package/lib/team-traffic-ws.js +68 -0
  109. package/lib/team-traffic.js +318 -0
  110. package/lib/usage-store.js +7 -0
  111. package/lib/user-shell-settings.js +105 -0
  112. package/lib/ws-schema.js +27 -4
  113. package/lib/yoke/adapters/claude-capabilities.js +2 -0
  114. package/lib/yoke/adapters/claude-vendor.js +6 -0
  115. package/lib/yoke/adapters/claude-worker.js +39 -11
  116. package/lib/yoke/adapters/claude.js +218 -6
  117. package/lib/yoke/adapters/codex-capabilities.js +6 -1
  118. package/lib/yoke/adapters/codex-user-shell.js +265 -0
  119. package/lib/yoke/adapters/codex-vendor.js +7 -0
  120. package/lib/yoke/adapters/codex.js +186 -52
  121. package/lib/yoke/codex-app-server.js +8 -2
  122. package/lib/yoke/interface.js +54 -1
  123. package/lib/yoke/mcp-bridge-server.js +12 -8
  124. package/lib/yoke/registry.js +32 -0
  125. package/lib/yoke/user-shell.js +224 -0
  126. package/package.json +1 -1
  127. package/lib/public/modules/build-notice-gate.js +0 -73
@@ -0,0 +1,253 @@
1
+ // shell-queue.js - what is typed while a turn or a ! command runs: chat and ! lines.
2
+ // The page keeps each, shows it as queued, and sends them one at a time in the
3
+ // order typed once the session is free (a ! entry waits for the turn to end, and
4
+ // whatever follows it waits for that command's result). The server holds nothing.
5
+ // An entry has a kind: "chat" (the default) or "shell" (item.command is the line).
6
+ //
7
+ // Two rules keep a message from being lost or doubled:
8
+ // - a message leaves the queue only by being sent. A send that fails leaves it
9
+ // (and everything behind it) queued, shown as not sent, for the next flush;
10
+ // - a message is drawn once, when it is added. A flush after a failure never
11
+ // draws it again.
12
+ // A message whose session is no longer on screen is parked as plain text, kept
13
+ // (and saved through hooks.storage, so a reload keeps it) until the person is
14
+ // back in that session's composer, where it is restored. No DOM here.
15
+
16
+ /**
17
+ * @param {object} hooks
18
+ * @param {function(object): *} hooks.show draws one queued entry, returns a handle
19
+ * @param {function(*): void} hooks.hide removes what show drew
20
+ * @param {function(*, string): void} hooks.markUnsent shows an entry as not sent, with why
21
+ * @param {{load: function(): ?Array, save: function(Array): void}} [hooks.storage]
22
+ */
23
+ export function createChatQueue(hooks) {
24
+ // Waiting in this page for their session's command to end.
25
+ var entries = [];
26
+ // scope -> [{text, imageCount}]: kept for a composer that is not on screen.
27
+ var parked = new Map();
28
+ var nextId = 1;
29
+
30
+ // What is kept of an entry for a composer or a reload: its text, and for a !
31
+ // entry the command, so it can be queued again as a command.
32
+ function savedItem(text, imageCount, kind, command) {
33
+ var item = { text: text, imageCount: imageCount | 0 };
34
+ if (kind === "shell" && typeof command === "string") { item.kind = "shell"; item.command = command; }
35
+ else if (kind === "draft") item.kind = "draft";
36
+ return item;
37
+ }
38
+
39
+ function loadSaved() {
40
+ var saved = hooks.storage ? hooks.storage.load() : null;
41
+ if (!Array.isArray(saved)) return;
42
+ saved.forEach(function (pair) {
43
+ if (!Array.isArray(pair) || typeof pair[0] !== "string" || !Array.isArray(pair[1])) return;
44
+ var items = pair[1].filter(function (it) { return it && typeof it.text === "string"; })
45
+ .map(function (it) { return savedItem(it.text, it.imageCount, it.kind, it.command); });
46
+ if (items.length > 0) parked.set(pair[0], items);
47
+ });
48
+ }
49
+
50
+ // What a reload must still find: the parked text and the entries still waiting.
51
+ function persist() {
52
+ if (!hooks.storage) return;
53
+ var out = new Map();
54
+ parked.forEach(function (items, scope) { out.set(scope, items.slice()); });
55
+ entries.forEach(function (e) {
56
+ if (!out.has(e.scope)) out.set(e.scope, []);
57
+ out.get(e.scope).push(savedItem(e.restoreText, e.imageCount, e.kind, e.command));
58
+ });
59
+ hooks.storage.save(Array.from(out.entries()));
60
+ }
61
+
62
+ loadSaved();
63
+
64
+ return {
65
+ /**
66
+ * Queues a message and draws it as queued.
67
+ * @param {{scope: string, text: string, restoreText: string, imageCount: number}} item
68
+ * plus whatever the caller needs to send it (kept as given)
69
+ */
70
+ add: function (item) {
71
+ var entry = Object.assign({ id: nextId++, drawn: false, unsent: null, handle: null }, item);
72
+ entries.push(entry);
73
+ entry.handle = hooks.show(entry);
74
+ entry.drawn = true;
75
+ persist();
76
+ return entry;
77
+ },
78
+
79
+ /**
80
+ * Puts an entry back at the head of its session's queue (a command the server
81
+ * refused as busy, or one restored after a reload). It is drawn with the rest
82
+ * by draw(), or at once when draw is true.
83
+ */
84
+ addFirst: function (item, draw) {
85
+ var entry = Object.assign({ id: nextId++, drawn: false, unsent: null, handle: null }, item);
86
+ var at = entries.findIndex(function (e) { return e.scope === entry.scope; });
87
+ entries.splice(at === -1 ? entries.length : at, 0, entry);
88
+ if (draw) {
89
+ // Drawn again from the head so the lines on screen stay in queue order.
90
+ entries.forEach(function (e) {
91
+ if (e.scope !== entry.scope) return;
92
+ if (e.drawn) hooks.hide(e.handle);
93
+ e.handle = hooks.show(e);
94
+ e.drawn = true;
95
+ if (e.unsent) hooks.markUnsent(e.handle, e.unsent);
96
+ });
97
+ }
98
+ persist();
99
+ return entry;
100
+ },
101
+
102
+ /**
103
+ * Puts a session's saved entries back in typed order, undrawn (draw() shows them).
104
+ * @param {Array<object>} items - queue items, oldest first
105
+ */
106
+ restore: function (items) {
107
+ items.forEach(function (item) {
108
+ entries.push(Object.assign({ id: nextId++, drawn: false, unsent: null, handle: null }, item));
109
+ });
110
+ persist();
111
+ },
112
+
113
+ /** A session's waiting entries, oldest first (a copy: changing it changes nothing). */
114
+ entriesFor: function (scope) {
115
+ return entries.filter(function (e) { return e.scope === scope; });
116
+ },
117
+
118
+ /** Calls fn(entry) for each entry that is on screen. */
119
+ eachDrawn: function (fn) {
120
+ entries.slice().forEach(function (e) { if (e.drawn) fn(e); });
121
+ },
122
+
123
+ /**
124
+ * Takes an entry out of the queue without sending it (Cancel, Edit, take-back).
125
+ * @returns {boolean} whether it was waiting
126
+ */
127
+ remove: function (id) {
128
+ var at = entries.findIndex(function (e) { return e.id === id; });
129
+ if (at === -1) return false;
130
+ var gone = entries.splice(at, 1)[0];
131
+ if (gone.drawn) hooks.hide(gone.handle);
132
+ persist();
133
+ return true;
134
+ },
135
+
136
+ /**
137
+ * Moves entries to the head of their session's queue, keeping their order, so
138
+ * they are the next to be sent. Entries drawn out of order are drawn again from
139
+ * the head so the lines on screen follow the queue.
140
+ * @param {string} scope
141
+ * @param {function(object): boolean} pick which entries go to the head
142
+ */
143
+ promote: function (scope, pick) {
144
+ var mine = entries.filter(function (e) { return e.scope === scope; });
145
+ var front = mine.filter(pick);
146
+ if (front.length === 0) return;
147
+ var rest = mine.filter(function (e) { return !pick(e); });
148
+ var ordered = front.concat(rest);
149
+ var changed = ordered.some(function (e, i) { return e !== mine[i]; });
150
+ var rebuilt = [];
151
+ var placed = false;
152
+ entries.forEach(function (e) {
153
+ if (e.scope !== scope) { rebuilt.push(e); return; }
154
+ if (!placed) { rebuilt.push.apply(rebuilt, ordered); placed = true; }
155
+ });
156
+ entries = rebuilt;
157
+ if (changed) {
158
+ ordered.forEach(function (e) {
159
+ if (!e.drawn) return;
160
+ hooks.hide(e.handle);
161
+ e.handle = hooks.show(e);
162
+ if (e.unsent) hooks.markUnsent(e.handle, e.unsent);
163
+ });
164
+ }
165
+ persist();
166
+ },
167
+
168
+ /** How many messages of a session are waiting. */
169
+ sizeFor: function (scope) {
170
+ return entries.filter(function (e) { return e.scope === scope; }).length;
171
+ },
172
+
173
+ /**
174
+ * Sends a session's waiting messages in order and stops at the first that
175
+ * fails. send(entry) returns true once the message has been sent. ready(entry),
176
+ * when given, is asked before each one: false holds it and everything behind it
177
+ * without marking it unsent (a turn or a command is still running).
178
+ * @returns {{sent: number, failed: boolean, held: boolean}}
179
+ */
180
+ flush: function (scope, send, ready) {
181
+ var sent = 0;
182
+ for (;;) {
183
+ var next = null;
184
+ for (var i = 0; i < entries.length; i++) {
185
+ if (entries[i].scope === scope) { next = entries[i]; break; }
186
+ }
187
+ if (!next) return { sent: sent, failed: false, held: false };
188
+ if (ready && !ready(next)) return { sent: sent, failed: false, held: true };
189
+ var ok = false;
190
+ var why = "the connection is not open";
191
+ try {
192
+ ok = send(next) === true;
193
+ } catch (err) {
194
+ why = (err && err.message) || String(err);
195
+ }
196
+ if (!ok) {
197
+ next.unsent = why;
198
+ if (next.drawn) hooks.markUnsent(next.handle, why);
199
+ return { sent: sent, failed: true, held: false };
200
+ }
201
+ entries.splice(entries.indexOf(next), 1);
202
+ if (next.drawn) hooks.hide(next.handle);
203
+ sent++;
204
+ persist();
205
+ }
206
+ },
207
+
208
+ /**
209
+ * The page's transcript was cleared and rebuilt for a session: forget what
210
+ * was drawn, so draw() puts the session's entries back once each.
211
+ */
212
+ forgetDrawn: function () {
213
+ entries.forEach(function (e) { e.drawn = false; e.handle = null; });
214
+ },
215
+
216
+ /** Draws a session's entries that are not on screen; the ones that failed show as not sent. */
217
+ draw: function (scope) {
218
+ entries.forEach(function (e) {
219
+ if (e.scope !== scope || e.drawn) return;
220
+ e.handle = hooks.show(e);
221
+ e.drawn = true;
222
+ if (e.unsent) hooks.markUnsent(e.handle, e.unsent);
223
+ });
224
+ },
225
+
226
+ /** The session on screen changed: waiting messages of any other session are parked. */
227
+ leave: function (scope) {
228
+ var stay = [];
229
+ entries.forEach(function (e) {
230
+ if (e.scope === scope) { stay.push(e); return; }
231
+ if (!parked.has(e.scope)) parked.set(e.scope, []);
232
+ parked.get(e.scope).push(savedItem(e.restoreText, e.imageCount, e.kind, e.command));
233
+ });
234
+ entries = stay;
235
+ persist();
236
+ },
237
+
238
+ /** Keeps plain text for a session's composer. */
239
+ park: function (scope, text) {
240
+ if (!parked.has(scope)) parked.set(scope, []);
241
+ parked.get(scope).push(savedItem(text, 0, "draft"));
242
+ persist();
243
+ },
244
+
245
+ /** Takes what is parked for a session, oldest first, for its composer. */
246
+ takeParked: function (scope) {
247
+ var items = parked.get(scope) || [];
248
+ parked.delete(scope);
249
+ persist();
250
+ return items;
251
+ },
252
+ };
253
+ }
@@ -0,0 +1,76 @@
1
+ // shell-settings-controls.js - the ! command line's controls on the server
2
+ // settings page: on or off, the time a command may run, and how much of its
3
+ // output is kept. The server holds the values and sends them on connect and after
4
+ // every change; only an administrator's change is accepted, and the card is shown
5
+ // to administrators only. The values are read from the store, where
6
+ // user-shell.js puts what the server last sent.
7
+
8
+ import { store } from './store.js';
9
+
10
+ // The defaults the server runs with until it says otherwise, and the ranges it
11
+ // accepts (lib/user-shell-settings.js); a value outside a range is not sent.
12
+ var DEFAULTS = { enabled: true, timeoutMinutes: 10, maxOutputKiB: 256 };
13
+ var RANGES = { userShellTimeoutMinutes: [1, 24 * 60], userShellMaxOutputKiB: [1, 4096] };
14
+
15
+ var sendSetting = null;
16
+
17
+ function current() {
18
+ return Object.assign({}, DEFAULTS, store.get("userShellSettings") || {});
19
+ }
20
+
21
+ function showProblem(text) {
22
+ var el = document.getElementById("ss-user-shell-problem");
23
+ if (el) el.textContent = text;
24
+ }
25
+
26
+ // Sends one numeric setting when the typed value is a whole number in range;
27
+ // otherwise says so and puts the current value back.
28
+ function changeCount(input, name, label, redraw) {
29
+ var range = RANGES[name];
30
+ var typed = input.value.trim();
31
+ var n = Number(typed);
32
+ if (typed === "" || !isFinite(n) || Math.floor(n) !== n || n < range[0] || n > range[1]) {
33
+ showProblem(label + " must be a whole number from " + range[0] + " to " + range[1] + ".");
34
+ redraw();
35
+ return;
36
+ }
37
+ showProblem("");
38
+ if (sendSetting) {
39
+ var values = {};
40
+ values[name] = n;
41
+ sendSetting("set_user_shell_settings", values);
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Draws the controls from the latest values. sendMsg(type, data) is the page's
47
+ * WebSocket sender; it is kept for the controls to use.
48
+ */
49
+ export function renderUserShellSettings(sendMsg) {
50
+ if (sendMsg) sendSetting = sendMsg;
51
+ var now = current();
52
+
53
+ var toggle = document.getElementById("ss-user-shell-enabled");
54
+ if (toggle) {
55
+ toggle.checked = now.enabled !== false;
56
+ toggle.onchange = function () {
57
+ if (sendSetting) sendSetting("set_user_shell_settings", { userShellEnabled: toggle.checked });
58
+ };
59
+ }
60
+
61
+ var timeout = document.getElementById("ss-user-shell-timeout");
62
+ if (timeout) {
63
+ timeout.value = String(now.timeoutMinutes);
64
+ timeout.onchange = function () {
65
+ changeCount(timeout, "userShellTimeoutMinutes", "The time limit", function () { timeout.value = String(current().timeoutMinutes); });
66
+ };
67
+ }
68
+
69
+ var cap = document.getElementById("ss-user-shell-cap");
70
+ if (cap) {
71
+ cap.value = String(now.maxOutputKiB);
72
+ cap.onchange = function () {
73
+ changeCount(cap, "userShellMaxOutputKiB", "The output limit", function () { cap.value = String(current().maxOutputKiB); });
74
+ };
75
+ }
76
+ }
@@ -45,7 +45,7 @@ import { openDm } from './app-dm.js';
45
45
  import { showHomeHub, hideHomeHub, isHomeHubVisible } from './app-home-hub.js';
46
46
  import { openTerminal } from './terminal.js';
47
47
  import { loadRootDirectory } from './filebrowser.js';
48
- import { renderSheetTeam as renderTeamView } from './team-panel.js';
48
+ import { renderTeamSections } from './team-view.js';
49
49
 
50
50
  // --- Mobile state ---
51
51
  var mobileChatSheetOpen = false;
@@ -125,7 +125,7 @@ function closeMobileSheet() {
125
125
  // Close the sheet and run fn after the close animation completes.
126
126
  // Use this for session/project switches so the history replay flood
127
127
  // doesn't begin while the sheet slide-down is still animating.
128
- function closeMobileSheetThen(fn) {
128
+ export function closeMobileSheetThen(fn) {
129
129
  var sheet = document.getElementById("mobile-sheet");
130
130
  if (!sheet || sheet.classList.contains("hidden")) {
131
131
  // Already closed — run immediately
@@ -1021,7 +1021,7 @@ export function refreshMobileChatSheet() {
1021
1021
  }
1022
1022
 
1023
1023
  function renderSheetTeam(listEl) {
1024
- renderTeamView(listEl);
1024
+ renderTeamSections(listEl);
1025
1025
  }
1026
1026
 
1027
1027
  function renderSheetMore(listEl) {
@@ -1023,6 +1023,7 @@ function renderLoopChild(s) {
1023
1023
  if (childActivityCls) {
1024
1024
  textHtml += '<span class="session-processing ' + childActivityCls + '" title="' + escapeHtml(childActivityState.label) + '"></span>';
1025
1025
  }
1026
+ textHtml += compactingBadgeHtml(s);
1026
1027
  if (s.loop) {
1027
1028
  var isRalphChild = s.loop.source === "ralph";
1028
1029
  var roleName = s.loop.role === "crafting" ? "Crafting" : s.loop.role === "judge" ? "Judge" : (isRalphChild ? "Coder" : "Run");
@@ -1295,6 +1296,7 @@ function renderSessionItem(s) {
1295
1296
  if (itemActivityCls) {
1296
1297
  textHtml += '<span class="session-processing ' + itemActivityCls + '" title="' + escapeHtml(itemActivityState.label) + '"></span>';
1297
1298
  }
1299
+ textHtml += compactingBadgeHtml(s);
1298
1300
  if (s.sessionVisibility === "private") {
1299
1301
  textHtml += '<span class="session-private-icon" title="Private session">' + iconHtml("lock") + '</span>';
1300
1302
  }
@@ -1354,6 +1356,11 @@ function renderSessionItem(s) {
1354
1356
 
1355
1357
  // --- Main session list ---
1356
1358
 
1359
+ // Text, not colour alone: the list entry carries the vendor-reported flag.
1360
+ function compactingBadgeHtml(s) {
1361
+ return s.compacting ? '<span class="session-compacting" title="Compacting context">Compacting</span>' : "";
1362
+ }
1363
+
1357
1364
  // lr-66c118: the activity field below is the derived class (indicatorClass/
1358
1365
  // sessionActivity), not a raw processing-flag read — also captures an
1359
1366
  // ownerId-driven tone change a boolean would have missed.
@@ -1368,6 +1375,7 @@ function _fingerprintSessions(list, expanded, expandedRuns) {
1368
1375
  (s.active ? "1" : "0") + "," +
1369
1376
  indicatorClass(sessionActivity(s, myUserId)) + "," +
1370
1377
  (s.bookmarked ? "1" : "0") + "," +
1378
+ (s.compacting ? "1" : "0") + "," +
1371
1379
  (s.keepAlive ? "1" : "0") + "," +
1372
1380
  (s.promptRemindersOff ? "1" : "0") + "," +
1373
1381
  // favoriteOrder drives sort order within the favorites section
@@ -5,7 +5,7 @@
5
5
  import { userAvatarUrl } from './avatar.js';
6
6
  import { store } from './store.js';
7
7
  import { getWs } from './ws-ref.js';
8
- import { toggleTeamPanel } from './team-panel.js';
8
+ import { toggleTeamView } from './team-view.js';
9
9
 
10
10
  function sendWs(msg) {
11
11
  var ws = getWs();
@@ -35,9 +35,7 @@ export function initSidebarUsers() {
35
35
  // Wire the permanent Teams button in the icon strip.
36
36
  var teamBtn = document.getElementById("icon-strip-team-btn");
37
37
  if (teamBtn) {
38
- teamBtn.addEventListener("click", function () {
39
- if (typeof toggleTeamPanel === "function") toggleTeamPanel();
40
- });
38
+ teamBtn.addEventListener("click", toggleTeamView);
41
39
  teamBtn.addEventListener("mouseenter", function () { showIconTooltip(teamBtn, "Team"); });
42
40
  teamBtn.addEventListener("mouseleave", hideIconTooltip);
43
41
  }
@@ -155,11 +153,11 @@ export function closeDmUserPicker() {
155
153
  export function setCurrentDmUser(userId) {
156
154
  currentDmUserId = userId;
157
155
  // Icon-strip user avatars are gone; active DM state is tracked in currentDmUserId
158
- // for use by the team panel and DM picker.
156
+ // for use by the Team view and DM picker.
159
157
  }
160
158
 
161
- // updateDmBadge: no-op — DM unread counts are now shown only inside the team panel.
162
- // Future: wire DM unread count to team panel badge. No-op until team panel supports per-user DM count display.
159
+ // updateDmBadge: no-op — DM unread counts are now shown only inside the Team view.
160
+ // Future: wire DM unread count to a Team view badge. No-op until a section shows per-user DM counts.
163
161
  export function updateDmBadge(userId, count) { /* no-op: icon-strip user badges removed */ }
164
162
 
165
163
  export function getCurrentDmUserId() {
@@ -1,16 +1,16 @@
1
- // team-panel.js - Live team-activity panel (desktop + mobile)
1
+ // team-panel.js - The Agent Teams section of the Team view
2
2
  // Handles team_state, team_member_update, team_task_update, team_message,
3
- // team_gone WS messages. Renders desktop #team-panel and mobile team sheet.
3
+ // team_gone WS messages and registers the "Agent Teams" section with the
4
+ // section registry in team-view.js, which draws it on desktop and mobile.
4
5
 
5
6
  import { store } from './store.js';
6
7
  import { getWs } from './ws-ref.js';
7
8
  import { escapeHtml } from './utils.js';
8
- import { refreshIcons } from './icons.js';
9
+ import { registerTeamSection, openTeamView, refreshTeamView, closeTeamViewIfAutoOpened } from './team-view.js';
9
10
 
10
11
  // --- Module state ---
11
12
  var currentTeam = null;
12
13
  var teamMessages = [];
13
- var panelOpen = false;
14
14
 
15
15
  // --- Helpers ---
16
16
 
@@ -172,46 +172,38 @@ function renderMessagesSection(container, messages) {
172
172
  }
173
173
  }
174
174
 
175
- function renderTeamPanelBody() {
176
- var bodyEl = document.getElementById("team-panel-body");
177
- if (!bodyEl) return;
178
- bodyEl.innerHTML = "";
179
-
180
- if (!currentTeam) {
181
- bodyEl.innerHTML =
182
- '<div class="team-empty-state">' +
183
- '<p>No active team</p>' +
184
- '<p class="team-empty-hint">Start a session with Agent Teams enabled to see live activity here.</p>' +
185
- '</div>';
186
- return;
187
- }
175
+ function renderAgentTeamsSection(container) {
176
+ if (!currentTeam) return;
188
177
 
189
- renderMembersSection(bodyEl, currentTeam.members, currentTeam._memberStatuses, currentTeam._memberActivities);
178
+ renderMembersSection(container, currentTeam.members, currentTeam._memberStatuses, currentTeam._memberActivities);
190
179
 
191
180
  var divider1 = document.createElement("hr");
192
181
  divider1.className = "mobile-sheet-divider";
193
- bodyEl.appendChild(divider1);
182
+ container.appendChild(divider1);
194
183
 
195
- renderTasksSection(bodyEl, currentTeam.tasks);
184
+ renderTasksSection(container, currentTeam.tasks);
196
185
 
197
186
  var divider2 = document.createElement("hr");
198
187
  divider2.className = "mobile-sheet-divider";
199
- bodyEl.appendChild(divider2);
188
+ container.appendChild(divider2);
189
+
190
+ renderMessagesSection(container, teamMessages);
191
+ }
200
192
 
201
- renderMessagesSection(bodyEl, teamMessages);
193
+ export function hasActiveTeam() {
194
+ return !!currentTeam;
202
195
  }
203
196
 
197
+ registerTeamSection({
198
+ id: "agent-teams",
199
+ title: "Agent Teams",
200
+ render: renderAgentTeamsSection,
201
+ isAvailable: hasActiveTeam,
202
+ });
203
+
204
204
  // --- Exports ---
205
205
 
206
206
  export function initTeamPanel() {
207
- // Wire close button
208
- var closeBtn = document.getElementById("team-panel-close");
209
- if (closeBtn) {
210
- closeBtn.addEventListener("click", function () {
211
- toggleTeamPanel();
212
- });
213
- }
214
-
215
207
  // Send team_request_state when WS connects
216
208
  store.subscribe(["connected"], function (state, prev) {
217
209
  if (state.connected && !prev.connected) {
@@ -229,14 +221,8 @@ export function handleTeamState(msg) {
229
221
  }
230
222
  teamMessages = msg.messages || [];
231
223
 
232
- var panel = document.getElementById("team-panel");
233
- if (panel) {
234
- if (currentTeam) {
235
- panel.classList.remove("hidden");
236
- }
237
- }
238
-
239
- renderTeamPanelBody();
224
+ if (currentTeam) openTeamView({ auto: true });
225
+ else refreshTeamView();
240
226
  }
241
227
 
242
228
  export function handleTeamMemberUpdate(msg) {
@@ -259,7 +245,7 @@ export function handleTeamMemberUpdate(msg) {
259
245
  }
260
246
  }
261
247
 
262
- renderTeamPanelBody();
248
+ refreshTeamView();
263
249
  }
264
250
 
265
251
  export function handleTeamTaskUpdate(msg) {
@@ -267,7 +253,7 @@ export function handleTeamTaskUpdate(msg) {
267
253
  if (msg.tasks) {
268
254
  currentTeam.tasks = msg.tasks;
269
255
  }
270
- renderTeamPanelBody();
256
+ refreshTeamView();
271
257
  }
272
258
 
273
259
  export function handleTeamMessage(msg) {
@@ -275,58 +261,14 @@ export function handleTeamMessage(msg) {
275
261
  teamMessages.push(msg.message);
276
262
  if (teamMessages.length > 50) teamMessages.shift();
277
263
  }
278
- renderTeamPanelBody();
264
+ refreshTeamView();
279
265
  }
280
266
 
281
267
  export function handleTeamGone() {
282
268
  currentTeam = null;
283
269
  teamMessages = [];
284
- panelOpen = false;
285
-
286
- var panel = document.getElementById("team-panel");
287
- if (panel) panel.classList.add("hidden");
288
-
289
- renderTeamPanelBody();
290
- }
291
270
 
292
- export function renderSheetTeam(listEl) {
293
- if (!currentTeam) {
294
- var empty = document.createElement("div");
295
- empty.className = "team-empty-state";
296
- empty.innerHTML =
297
- '<p>No active team</p>' +
298
- '<p class="team-empty-hint">Start a session with Agent Teams enabled to see live activity here.</p>';
299
- listEl.appendChild(empty);
300
- return;
301
- }
302
-
303
- renderMembersSection(listEl, currentTeam.members, currentTeam._memberStatuses, currentTeam._memberActivities);
304
-
305
- var d1 = document.createElement("hr");
306
- d1.className = "mobile-sheet-divider";
307
- listEl.appendChild(d1);
308
-
309
- renderTasksSection(listEl, currentTeam.tasks);
310
-
311
- var d2 = document.createElement("hr");
312
- d2.className = "mobile-sheet-divider";
313
- listEl.appendChild(d2);
314
-
315
- renderMessagesSection(listEl, teamMessages);
316
- }
317
-
318
- export function toggleTeamPanel() {
319
- var panel = document.getElementById("team-panel");
320
- if (!panel) return;
321
- panelOpen = !panelOpen;
322
- if (panelOpen) {
323
- panel.classList.remove("hidden");
324
- renderTeamPanelBody();
325
- } else {
326
- panel.classList.add("hidden");
327
- }
328
- }
329
-
330
- export function hasActiveTeam() {
331
- return !!currentTeam;
271
+ refreshTeamView();
272
+ // A view team_state opened goes away with the team; one the user opened stays.
273
+ closeTeamViewIfAutoOpened();
332
274
  }