@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
@@ -0,0 +1,76 @@
1
+ // shell-card.js - the card that shows a command typed with ! and how it ended.
2
+ // Everything a command or its output carries goes in as text (textContent), never
3
+ // as markup: output is whatever a program printed.
4
+
5
+ import { describeResult } from './shell-line.js';
6
+
7
+ /**
8
+ * A card for a command, with no outcome yet.
9
+ * @param {string} command
10
+ * @param {string} state - the card's style: pending, ok, failed, error, denied, refused
11
+ * @returns {HTMLElement}
12
+ */
13
+ export function buildCard(command, state) {
14
+ var card = document.createElement("div");
15
+ card.className = "shell-result " + state;
16
+ var cmd = document.createElement("div");
17
+ cmd.className = "shell-cmd";
18
+ var prompt = document.createElement("span");
19
+ prompt.className = "shell-prompt";
20
+ prompt.textContent = "!";
21
+ var text = document.createElement("span");
22
+ text.textContent = command || "";
23
+ cmd.appendChild(prompt);
24
+ cmd.appendChild(text);
25
+ card.appendChild(cmd);
26
+ return card;
27
+ }
28
+
29
+ function clearOutcome(card) {
30
+ card.querySelectorAll(".shell-output, .shell-status, .shell-actions").forEach(function (el) { el.remove(); });
31
+ }
32
+
33
+ function addStatus(card, text) {
34
+ var status = document.createElement("div");
35
+ status.className = "shell-status";
36
+ status.textContent = text;
37
+ card.appendChild(status);
38
+ }
39
+
40
+ /** Shows a card as still running. */
41
+ export function showRunning(card) {
42
+ clearOutcome(card);
43
+ addStatus(card, "Running…");
44
+ }
45
+
46
+ /**
47
+ * Fills a card with a shell_result: its style, its output and how it ended. A
48
+ * refused command gets an Edit action, which hands the command to
49
+ * hooks.onEdit; the page decides where it goes, so a draft is never overwritten.
50
+ * @param {HTMLElement} card
51
+ * @param {object} msg - a shell_result
52
+ * @param {{onEdit: function(string): void}} [hooks]
53
+ */
54
+ export function fillCard(card, msg, hooks) {
55
+ var described = describeResult(msg);
56
+ card.className = "shell-result " + described.state;
57
+ clearOutcome(card);
58
+ if (msg.output) {
59
+ var out = document.createElement("pre");
60
+ out.className = "shell-output";
61
+ out.textContent = msg.output;
62
+ card.appendChild(out);
63
+ }
64
+ addStatus(card, described.status);
65
+ if (msg.refused && msg.command && hooks && hooks.onEdit) {
66
+ var actions = document.createElement("div");
67
+ actions.className = "shell-actions";
68
+ var edit = document.createElement("button");
69
+ edit.type = "button";
70
+ edit.className = "shell-edit";
71
+ edit.textContent = "Edit command";
72
+ edit.addEventListener("click", function () { hooks.onEdit(msg.command); });
73
+ actions.appendChild(edit);
74
+ card.appendChild(actions);
75
+ }
76
+ }
@@ -0,0 +1,49 @@
1
+ // shell-line.js - the pure parts of the composer's ! command line: which typed
2
+ // line is a command, and how a result reads. No DOM here, so the rules are
3
+ // testable on their own; user-shell.js draws and sends.
4
+
5
+ /**
6
+ * The command a composer line carries, or null when the line is not one. A line
7
+ * is a command when it starts with ! (leading whitespace aside) and a command
8
+ * follows. Only the ! and the whitespace right after it are removed: the rest is
9
+ * the command exactly as typed, so a trailing escaped space is part of it.
10
+ * @param {string} raw - the composer's text as typed, not trimmed
11
+ * @returns {?string}
12
+ */
13
+ export function parseShellLine(raw) {
14
+ if (typeof raw !== "string") return null;
15
+ var line = raw.replace(/^\s+/, "");
16
+ if (line.charAt(0) !== "!") return null;
17
+ var command = line.slice(1).replace(/^\s+/, "");
18
+ return command.trim() ? command : null;
19
+ }
20
+
21
+ function formatDuration(ms) {
22
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 0) return "";
23
+ if (ms < 1000) return Math.round(ms) + " ms";
24
+ if (ms < 60000) return (ms / 1000).toFixed(1) + " s";
25
+ return Math.floor(ms / 60000) + " min " + Math.round((ms % 60000) / 1000) + " s";
26
+ }
27
+
28
+ /**
29
+ * How one shell_result reads: its state (for the card's style) and the status
30
+ * line under the output. Every way a command can end says so in words.
31
+ * @param {object} msg - a shell_result
32
+ * @returns {{state: string, status: string}}
33
+ */
34
+ export function describeResult(msg) {
35
+ if (msg.refused) return { state: "refused", status: msg.message || msg.reason || "The command was not run." };
36
+ if (msg.denied) return { state: "denied", status: msg.message || msg.reason || "The command was not approved, so it did not run." };
37
+ if (msg.error) return { state: "error", status: "The command could not run." };
38
+ var parts = [];
39
+ if (msg.timedOut) parts.push("timed out and was stopped");
40
+ else if (msg.interrupted) parts.push("interrupted");
41
+ else if (msg.exitCode === null || msg.exitCode === undefined) parts.push("ended without an exit code");
42
+ else parts.push("exit " + msg.exitCode);
43
+ var took = formatDuration(msg.durationMs);
44
+ if (took) parts.push(took);
45
+ if (msg.truncated) parts.push("output cut at the size limit");
46
+ var failed = msg.timedOut || msg.interrupted || (typeof msg.exitCode === "number" && msg.exitCode !== 0) ||
47
+ msg.exitCode === null || msg.exitCode === undefined;
48
+ return { state: failed ? "failed" : "ok", status: parts.join(" · ") };
49
+ }
@@ -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() {