@clagentic/console 1.9.0 → 1.10.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/LICENSE +117 -12
- package/LICENSES/MIT-legacy.txt +22 -0
- package/LICENSES/README.md +15 -0
- package/README.md +8 -2
- package/bin/cli.js +30 -5
- package/deploy/clagentic-console.service +10 -6
- package/lib/audit.js +3 -2
- package/lib/build-sha.json +2 -2
- package/lib/build-update-check.js +138 -0
- package/lib/cli/daemon-launch.js +17 -17
- package/lib/config.js +32 -20
- package/lib/daemon-env-settings.js +84 -0
- package/lib/daemon-projects.js +38 -0
- package/lib/daemon.js +202 -158
- package/lib/drain.js +74 -17
- package/lib/env-compat.js +61 -0
- package/lib/extension-commands.js +45 -0
- package/lib/history-visibility.js +4 -0
- package/lib/idle-adapter-reaper.js +71 -0
- package/lib/link-trap.js +78 -0
- package/lib/lore-attestation.js +73 -0
- package/lib/mcp-local.js +8 -6
- package/lib/mcp-tool-input.js +116 -0
- package/lib/mcp-tool-schema.js +179 -0
- package/lib/memory-limits.js +61 -5
- package/lib/memory-setting-validate.js +65 -0
- package/lib/new-work-gate.js +47 -0
- package/lib/os-users.js +5 -3
- package/lib/project-access.js +139 -0
- package/lib/project-connection.js +23 -22
- package/lib/project-external-trigger.js +103 -10
- package/lib/project-file-scope.js +172 -0
- package/lib/project-file-watch.js +86 -61
- package/lib/project-filesystem.js +144 -128
- package/lib/project-git.js +119 -0
- package/lib/project-http.js +44 -28
- package/lib/project-loop.js +12 -5
- package/lib/project-mcp.js +53 -72
- package/lib/project-message-gate.js +70 -0
- package/lib/project-notifications.js +31 -4
- package/lib/project-prompt-responses.js +216 -0
- package/lib/project-sessions.js +164 -302
- package/lib/project-user-message.js +36 -11
- package/lib/project.js +189 -142
- package/lib/projects-dir.js +90 -0
- package/lib/prompt-access.js +22 -0
- package/lib/prompt-kinds/answer-limits.js +15 -0
- package/lib/prompt-kinds/ask-user.js +58 -0
- package/lib/prompt-kinds/codecs.js +97 -0
- package/lib/prompt-kinds/elicitation.js +77 -0
- package/lib/prompt-kinds/extension.js +39 -0
- package/lib/prompt-kinds/index.js +68 -0
- package/lib/prompt-kinds/permission.js +114 -0
- package/lib/prompt-kinds/plan.js +79 -0
- package/lib/prompt-kinds/tool-call.js +38 -0
- package/lib/prompt-registry.js +673 -0
- package/lib/public/app.js +1 -1
- package/lib/public/css/diagnostics.css +50 -0
- package/lib/public/css/input.css +17 -3
- package/lib/public/css/menus.css +10 -0
- package/lib/public/css/messages.css +5 -0
- package/lib/public/css/rewind.css +22 -0
- package/lib/public/index.html +4 -12
- package/lib/public/modules/app-connection.js +7 -0
- package/lib/public/modules/app-cursors.js +7 -5
- package/lib/public/modules/app-messages.js +45 -45
- package/lib/public/modules/app-notifications.js +47 -71
- package/lib/public/modules/app-panels.js +61 -58
- package/lib/public/modules/app-projects.js +2 -1
- package/lib/public/modules/app-rendering.js +4 -10
- package/lib/public/modules/diagnostics.js +60 -16
- package/lib/public/modules/filebrowser.js +18 -16
- package/lib/public/modules/history-visibility.js +4 -0
- package/lib/public/modules/mention.js +3 -2
- package/lib/public/modules/mode-options.js +38 -0
- package/lib/public/modules/project-settings.js +19 -8
- package/lib/public/modules/prompt-banner.js +78 -0
- package/lib/public/modules/prompt-card.js +201 -0
- package/lib/public/modules/prompt-kinds/ask-user-codec.js +131 -0
- package/lib/public/modules/prompt-kinds/ask-user.js +213 -0
- package/lib/public/modules/prompt-kinds/elicitation-codec.js +343 -0
- package/lib/public/modules/prompt-kinds/elicitation.js +176 -0
- package/lib/public/modules/prompt-kinds/index.js +18 -0
- package/lib/public/modules/prompt-kinds/own-key.js +29 -0
- package/lib/public/modules/prompt-kinds/package.json +3 -0
- package/lib/public/modules/prompt-kinds/permission-choices.js +31 -0
- package/lib/public/modules/prompt-kinds/permission.js +209 -0
- package/lib/public/modules/prompt-kinds/plan.js +102 -0
- package/lib/public/modules/prompt-state.js +142 -0
- package/lib/public/modules/prompts.js +134 -0
- package/lib/public/modules/rewind.js +4 -1
- package/lib/public/modules/server-settings.js +2 -4
- package/lib/public/modules/sidebar-mobile.js +19 -9
- package/lib/public/modules/sidebar-sessions.js +21 -14
- package/lib/public/modules/sticky-notes.js +3 -2
- package/lib/public/modules/team-panel.js +5 -4
- package/lib/public/modules/tools.js +67 -904
- package/lib/public/modules/vendor-picker.js +53 -0
- package/lib/public/modules/vendor-registry.js +133 -0
- package/lib/public/sw.js +3 -1
- package/lib/rc-migrate.js +44 -0
- package/lib/runtime-env-keys.js +109 -0
- package/lib/runtime-env.js +236 -0
- package/lib/sdk-bridge.js +290 -273
- package/lib/sdk-message-processor.js +125 -145
- package/lib/server-hub-sessions.js +13 -10
- package/lib/server-palette.js +28 -19
- package/lib/server.js +141 -113
- package/lib/service-install.js +96 -0
- package/lib/session-capabilities.js +76 -0
- package/lib/sessions.js +45 -28
- package/lib/users-permissions.js +9 -6
- package/lib/users.js +9 -0
- package/lib/utils.js +4 -2
- package/lib/vendor-auth.js +22 -0
- package/lib/vendor-registry-message.js +65 -0
- package/lib/ws-origin.js +99 -0
- package/lib/ws-schema.js +33 -22
- package/lib/yoke/adapters/claude-capabilities.js +38 -0
- package/lib/yoke/adapters/claude-vendor.js +35 -0
- package/lib/yoke/adapters/claude-worker.js +55 -87
- package/lib/yoke/adapters/claude.js +156 -62
- package/lib/yoke/adapters/codex-capabilities.js +37 -0
- package/lib/yoke/adapters/codex-vendor.js +46 -0
- package/lib/yoke/adapters/codex.js +347 -156
- package/lib/yoke/adapters/effort-control.js +34 -0
- package/lib/yoke/adapters/permission-relay.js +58 -0
- package/lib/yoke/adapters/worker-mcp-servers.js +81 -0
- package/lib/yoke/auth-checks.js +104 -0
- package/lib/yoke/capabilities.js +49 -0
- package/lib/yoke/codex-app-server.js +23 -5
- package/lib/yoke/env-ownership.js +40 -0
- package/lib/yoke/index.js +67 -173
- package/lib/yoke/install-probe.js +121 -0
- package/lib/yoke/instructions.js +7 -11
- package/lib/yoke/interface.js +199 -3
- package/lib/yoke/package.json +1 -1
- package/lib/yoke/provider-credentials.js +96 -0
- package/lib/yoke/registry.js +340 -0
- package/package.json +12 -8
- package/scripts/check-sdk-lock-drift.js +160 -0
- package/scripts/check-test-count.js +76 -1
- package/scripts/postinstall.js +218 -136
- package/scripts/prompt-harness-history.js +202 -0
- package/scripts/verify-installed.js +67 -0
- package/lib/sdk-permission-ownership.js +0 -136
|
@@ -6,11 +6,17 @@ import { refreshIcons, iconHtml } from './icons.js';
|
|
|
6
6
|
import { escapeHtml } from './utils.js';
|
|
7
7
|
import { projectIconHtml } from './project-icon.js';
|
|
8
8
|
import { store } from './store.js';
|
|
9
|
+
import { loginCommandFor, defaultVendorId } from './vendor-registry.js';
|
|
9
10
|
import { getWs } from './ws-ref.js';
|
|
10
11
|
import { getCachedProjects } from './app-projects.js';
|
|
11
12
|
import { switchProject } from './app-projects.js';
|
|
12
13
|
import { userAvatarUrl } from './avatar.js';
|
|
13
14
|
import { openTerminal } from './terminal.js';
|
|
15
|
+
import { askWording } from './prompt-kinds/index.js';
|
|
16
|
+
import { wirePromptBanner, restoreUnconfirmedBanners, bannerActions } from './prompt-banner.js';
|
|
17
|
+
|
|
18
|
+
// The server dismisses a prompt's banner once the prompt settles, however it
|
|
19
|
+
// was answered.
|
|
14
20
|
var notifications = [];
|
|
15
21
|
var unreadCount = 0;
|
|
16
22
|
var bannerContainer = null;
|
|
@@ -110,21 +116,20 @@ function showBanner(notif, autoDismissMs) {
|
|
|
110
116
|
? '<img src="/icon-banded-76.png" width="32" height="32" alt="Clagentic: Console" style="border-radius:8px">'
|
|
111
117
|
: iconHtml("folder");
|
|
112
118
|
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
+
// A tool-approval prompt is titled "Can I ...?", like its card.
|
|
120
|
+
var promptKind = isPermission ? (notif.meta.kind || "permission") : null;
|
|
121
|
+
if (promptKind === "permission" && notif.meta.toolName) {
|
|
122
|
+
var wording = askWording(notif.meta.toolName, notif.meta.toolInput);
|
|
123
|
+
notif = Object.assign({}, notif, { title: "Can I " + wording.verb + (wording.target ? " " + wording.target : "") + "?" });
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
var actionsHtml = "";
|
|
122
127
|
if (isPermission) {
|
|
123
128
|
actionsHtml =
|
|
124
129
|
'<div class="notif-banner-actions">' +
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
bannerActions(promptKind, notif.meta).map(function (a) {
|
|
131
|
+
return '<button class="' + a.className + '" data-decision="' + a.decision + '">' + escapeHtml(a.label) + '</button>';
|
|
132
|
+
}).join("") +
|
|
128
133
|
'<button class="notif-banner-goto" title="Go to session">' + iconHtml("external-link") + '</button>' +
|
|
129
134
|
'</div>';
|
|
130
135
|
} else if (isAuthRequired) {
|
|
@@ -174,37 +179,12 @@ function showBanner(notif, autoDismissMs) {
|
|
|
174
179
|
});
|
|
175
180
|
}
|
|
176
181
|
|
|
177
|
-
//
|
|
182
|
+
// Prompt answers. The banner stays until the server settles the prompt
|
|
183
|
+
// and dismisses it; meanwhile it is in the card's sending state, so a
|
|
184
|
+
// lost confirmation or a dropped socket never reads as an answer.
|
|
178
185
|
if (isPermission) {
|
|
179
|
-
var sureBtn = banner.querySelector(".notif-banner-allow");
|
|
180
|
-
var alwaysBtn = banner.querySelector(".notif-banner-always");
|
|
181
|
-
var noBtn = banner.querySelector(".notif-banner-deny");
|
|
182
186
|
var gotoBtn = banner.querySelector(".notif-banner-goto");
|
|
183
|
-
|
|
184
|
-
if (sureBtn) {
|
|
185
|
-
sureBtn.addEventListener("click", function (e) {
|
|
186
|
-
e.stopPropagation();
|
|
187
|
-
sendPermissionResponse(notif.meta.requestId, true, notif.slug);
|
|
188
|
-
removeBanner(banner);
|
|
189
|
-
dismissNotif(notif.id);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
if (alwaysBtn) {
|
|
193
|
-
alwaysBtn.addEventListener("click", function (e) {
|
|
194
|
-
e.stopPropagation();
|
|
195
|
-
sendPermissionResponse(notif.meta.requestId, "always", notif.slug);
|
|
196
|
-
removeBanner(banner);
|
|
197
|
-
dismissNotif(notif.id);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
if (noBtn) {
|
|
201
|
-
noBtn.addEventListener("click", function (e) {
|
|
202
|
-
e.stopPropagation();
|
|
203
|
-
sendPermissionResponse(notif.meta.requestId, false, notif.slug);
|
|
204
|
-
removeBanner(banner);
|
|
205
|
-
dismissNotif(notif.id);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
187
|
+
wirePromptBanner(banner, { requestId: notif.meta.requestId, kind: promptKind, slug: notif.slug }, sendWs);
|
|
208
188
|
if (gotoBtn) {
|
|
209
189
|
gotoBtn.addEventListener("click", function (e) {
|
|
210
190
|
e.stopPropagation();
|
|
@@ -223,8 +203,7 @@ function showBanner(notif, autoDismissMs) {
|
|
|
223
203
|
activeAuthRequiredMsg = null;
|
|
224
204
|
removeBanner(banner);
|
|
225
205
|
dismissNotif(notif.id);
|
|
226
|
-
|
|
227
|
-
startLoginCommand(authMeta.loginCommand || ((authMeta.vendor || "claude") === "codex" ? "codex login --device-auth" : "claude login"));
|
|
206
|
+
startLoginCommand(authLoginFor(notif).loginCommand);
|
|
228
207
|
showLoginReminderBanner();
|
|
229
208
|
});
|
|
230
209
|
}
|
|
@@ -241,8 +220,8 @@ function showBanner(notif, autoDismissMs) {
|
|
|
241
220
|
|
|
242
221
|
function startLoginCommand(loginCommand) {
|
|
243
222
|
var ws = getWs();
|
|
244
|
-
if (!ws || ws.readyState !== 1) return;
|
|
245
|
-
var termCommand =
|
|
223
|
+
if (!ws || ws.readyState !== 1 || !loginCommand) return;
|
|
224
|
+
var termCommand = loginCommand + "\n";
|
|
246
225
|
store.set({ pendingTermCommand: termCommand });
|
|
247
226
|
ws.send(JSON.stringify({ type: "term_create", cols: 80, rows: 24 }));
|
|
248
227
|
openTerminal();
|
|
@@ -299,10 +278,24 @@ function showLoginReminderBanner() {
|
|
|
299
278
|
}
|
|
300
279
|
}
|
|
301
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Which agent a not-logged-in notice is about and the command that signs in to
|
|
283
|
+
* it: the notice's own, else the registry's for that agent.
|
|
284
|
+
* @param {?object} msg an auth_required message or notification
|
|
285
|
+
* @returns {{vendor: string, loginCommand: string}}
|
|
286
|
+
*/
|
|
287
|
+
export function authLoginFor(msg) {
|
|
288
|
+
var meta = (msg && msg.meta) || {};
|
|
289
|
+
var vendor = (msg && msg.vendor) || meta.vendor || defaultVendorId();
|
|
290
|
+
var loginCommand = (msg && msg.loginCommand) || meta.loginCommand || loginCommandFor(vendor);
|
|
291
|
+
return { vendor: vendor, loginCommand: loginCommand };
|
|
292
|
+
}
|
|
293
|
+
|
|
302
294
|
export function showAuthRequiredBanner(msg) {
|
|
303
295
|
if (!bannerContainer) return;
|
|
304
|
-
var
|
|
305
|
-
var
|
|
296
|
+
var login = authLoginFor(msg);
|
|
297
|
+
var vendor = login.vendor;
|
|
298
|
+
var loginCommand = login.loginCommand;
|
|
306
299
|
activeAuthRequiredMsg = Object.assign({}, msg || {}, {
|
|
307
300
|
id: (msg && msg.id) || ("_auth_" + Date.now()),
|
|
308
301
|
type: "auth_required",
|
|
@@ -378,14 +371,17 @@ function clearAllBanners() {
|
|
|
378
371
|
if (btn && btn.parentNode) btn.parentNode.removeChild(btn);
|
|
379
372
|
}
|
|
380
373
|
|
|
381
|
-
|
|
374
|
+
// Returns true when msg was handed to the socket.
|
|
375
|
+
function sendWs(msg) {
|
|
382
376
|
var ws = getWs();
|
|
383
|
-
if (ws
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
377
|
+
if (!ws || ws.readyState !== 1) return false;
|
|
378
|
+
ws.send(JSON.stringify(msg));
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** The connection is gone: banners awaiting a confirmation can be answered again. */
|
|
383
|
+
export function restoreUnconfirmedPromptBanners(message) {
|
|
384
|
+
restoreUnconfirmedBanners(bannerContainer, message);
|
|
389
385
|
}
|
|
390
386
|
|
|
391
387
|
function dismissNotif(id) {
|
|
@@ -601,26 +597,6 @@ export function showUpdateBanner(msg) {
|
|
|
601
597
|
// Helpers
|
|
602
598
|
// ========================================================
|
|
603
599
|
|
|
604
|
-
function formatPermissionInfo(toolName, toolInput) {
|
|
605
|
-
if (!toolName) return null;
|
|
606
|
-
var input = toolInput && typeof toolInput === "object" ? toolInput : {};
|
|
607
|
-
var verb = "use " + toolName;
|
|
608
|
-
var target = "";
|
|
609
|
-
var shortPath = function (p) { return p ? p.split(/[/\\]/).pop() : ""; };
|
|
610
|
-
|
|
611
|
-
switch (toolName) {
|
|
612
|
-
case "Write": verb = "write to"; target = shortPath(input.file_path); break;
|
|
613
|
-
case "Edit": verb = "edit"; target = shortPath(input.file_path); break;
|
|
614
|
-
case "Read": verb = "read"; target = shortPath(input.file_path); break;
|
|
615
|
-
case "Bash": verb = "run"; target = input.description || (input.command || "").substring(0, 80); break;
|
|
616
|
-
case "Grep": verb = "search"; target = input.pattern || ""; break;
|
|
617
|
-
case "Glob": verb = "search for files in"; target = input.pattern || ""; break;
|
|
618
|
-
case "WebFetch": verb = "fetch"; target = input.url || ""; break;
|
|
619
|
-
case "WebSearch": verb = "search the web for"; target = input.query || ""; break;
|
|
620
|
-
}
|
|
621
|
-
return { verb: verb, target: target };
|
|
622
|
-
}
|
|
623
|
-
|
|
624
600
|
var EMPTY_MESSAGES = [
|
|
625
601
|
"Quiet. Too quiet.",
|
|
626
602
|
"Nothing. Suspiciously nothing.",
|
|
@@ -5,9 +5,11 @@ import { refreshIcons } from "./icons.js";
|
|
|
5
5
|
import { escapeHtml, showToast } from "./utils.js";
|
|
6
6
|
import { store } from './store.js';
|
|
7
7
|
import { getWs } from './ws-ref.js';
|
|
8
|
-
import {
|
|
8
|
+
import { pickerRows, defaultVendorId, capabilityGate, currentCapabilities } from './vendor-registry.js';
|
|
9
|
+
import { renderVendorPicker } from './vendor-picker.js';
|
|
9
10
|
import { splitModelsByTier } from './settings-defaults.js';
|
|
10
11
|
import { isSonnetModel } from './model-families.js';
|
|
12
|
+
import { modeOptions } from './mode-options.js';
|
|
11
13
|
|
|
12
14
|
// --- Module-owned state (not in store) ---
|
|
13
15
|
// sessionUsage.context = last-turn context fill (lastStreamInputTokens) — not cumulative,
|
|
@@ -82,12 +84,6 @@ var contextMiniFill = null;
|
|
|
82
84
|
var contextMiniLabel = null;
|
|
83
85
|
|
|
84
86
|
// --- Constants ---
|
|
85
|
-
var MODE_OPTIONS = [
|
|
86
|
-
{ value: "default", label: "Default" },
|
|
87
|
-
{ value: "plan", label: "Plan" },
|
|
88
|
-
{ value: "acceptEdits", label: "Auto-accept edits" },
|
|
89
|
-
];
|
|
90
|
-
var MODE_FULL_AUTO = { value: "bypassPermissions", label: "Full auto" };
|
|
91
87
|
var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
|
|
92
88
|
var EFFORT_LEVELS_BY_VENDOR = {
|
|
93
89
|
claude: ["low", "medium", "high", "xhigh", "max"],
|
|
@@ -132,15 +128,6 @@ function modelDisplayName(value, models) {
|
|
|
132
128
|
return value;
|
|
133
129
|
}
|
|
134
130
|
|
|
135
|
-
function modeDisplayName(value) {
|
|
136
|
-
for (var i = 0; i < MODE_OPTIONS.length; i++) {
|
|
137
|
-
if (MODE_OPTIONS[i].value === value) return MODE_OPTIONS[i].label;
|
|
138
|
-
}
|
|
139
|
-
if (value === "bypassPermissions") return "Full auto";
|
|
140
|
-
if (value === "dontAsk") return "Don\u2019t ask";
|
|
141
|
-
return value;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
131
|
function effortDisplayName(value) {
|
|
145
132
|
if (!value) return "";
|
|
146
133
|
if (value === "xhigh") return "X-High";
|
|
@@ -263,13 +250,25 @@ function rebuildModelList() {
|
|
|
263
250
|
refreshIcons(configModelList);
|
|
264
251
|
}
|
|
265
252
|
|
|
253
|
+
// A control the current agent cannot support stays in the popover, disabled,
|
|
254
|
+
// with the one-line reason from the registry.
|
|
255
|
+
function appendUnavailableNote(container, reason) {
|
|
256
|
+
var note = document.createElement("div");
|
|
257
|
+
note.className = "config-unavailable-note";
|
|
258
|
+
note.setAttribute("aria-disabled", "true");
|
|
259
|
+
note.textContent = reason;
|
|
260
|
+
container.appendChild(note);
|
|
261
|
+
}
|
|
262
|
+
|
|
266
263
|
function rebuildModeList() {
|
|
267
264
|
if (!configModeList) return;
|
|
268
265
|
configModeList.innerHTML = "";
|
|
269
|
-
var
|
|
270
|
-
if (
|
|
271
|
-
|
|
266
|
+
var modeGate = capabilityGate("permissionModes");
|
|
267
|
+
if (!modeGate.enabled) {
|
|
268
|
+
appendUnavailableNote(configModeList, modeGate.reason);
|
|
269
|
+
return;
|
|
272
270
|
}
|
|
271
|
+
var options = modeOptions(currentCapabilities(), store.get('skipPermsEnabled'));
|
|
273
272
|
for (var i = 0; i < options.length; i++) {
|
|
274
273
|
var opt = options[i];
|
|
275
274
|
var btn = document.createElement("button");
|
|
@@ -292,6 +291,13 @@ function rebuildModeList() {
|
|
|
292
291
|
|
|
293
292
|
function rebuildEffortBar() {
|
|
294
293
|
if (!configEffortBar || !configEffortSection) return;
|
|
294
|
+
var effortGate = capabilityGate("effort");
|
|
295
|
+
if (!effortGate.enabled) {
|
|
296
|
+
configEffortSection.style.display = "";
|
|
297
|
+
configEffortBar.innerHTML = "";
|
|
298
|
+
appendUnavailableNote(configEffortBar, effortGate.reason);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
295
301
|
var supportsEffort = getModelSupportsEffort();
|
|
296
302
|
if (!supportsEffort) {
|
|
297
303
|
configEffortSection.style.display = "none";
|
|
@@ -390,21 +396,24 @@ function buildSegmentedBar(barEl, options, currentValue, msgType, msgKey) {
|
|
|
390
396
|
}
|
|
391
397
|
}
|
|
392
398
|
|
|
399
|
+
// APPROVAL, SANDBOX and WEB SEARCH are settings an agent either has or lacks
|
|
400
|
+
// (the executionPolicy capability). Unlike a parity control, an agent without
|
|
401
|
+
// them has nothing to show, so the sections are left out for it.
|
|
393
402
|
function rebuildCodexSections() {
|
|
394
403
|
var s = store.snap();
|
|
395
|
-
var
|
|
404
|
+
var hasPolicy = capabilityGate("executionPolicy").enabled;
|
|
396
405
|
|
|
397
406
|
if (configApprovalSection) {
|
|
398
|
-
configApprovalSection.style.display =
|
|
399
|
-
if (
|
|
407
|
+
configApprovalSection.style.display = hasPolicy ? "" : "none";
|
|
408
|
+
if (hasPolicy) buildSegmentedBar(configApprovalBar, CODEX_APPROVAL_OPTIONS, s.codexApproval, "set_codex_approval", "approval");
|
|
400
409
|
}
|
|
401
410
|
if (configSandboxSection) {
|
|
402
|
-
configSandboxSection.style.display =
|
|
403
|
-
if (
|
|
411
|
+
configSandboxSection.style.display = hasPolicy ? "" : "none";
|
|
412
|
+
if (hasPolicy) buildSegmentedBar(configSandboxBar, CODEX_SANDBOX_OPTIONS, s.codexSandbox, "set_codex_sandbox", "sandbox");
|
|
404
413
|
}
|
|
405
414
|
if (configWebsearchSection) {
|
|
406
|
-
configWebsearchSection.style.display =
|
|
407
|
-
if (
|
|
415
|
+
configWebsearchSection.style.display = hasPolicy ? "" : "none";
|
|
416
|
+
if (hasPolicy) buildSegmentedBar(configWebsearchBar, CODEX_WEBSEARCH_OPTIONS, s.codexWebSearch, "set_codex_websearch", "webSearch");
|
|
408
417
|
}
|
|
409
418
|
}
|
|
410
419
|
|
|
@@ -445,30 +454,27 @@ export function initPanels() {
|
|
|
445
454
|
configWebsearchSection = $("config-websearch-section");
|
|
446
455
|
configWebsearchBar = $("config-websearch-bar");
|
|
447
456
|
|
|
448
|
-
// ---
|
|
457
|
+
// --- Agent picker, rendered from the registry ---
|
|
458
|
+
// One button per registered agent. An agent that is not installed is shown
|
|
459
|
+
// disabled with how to install it, and a Re-check button asks the server to
|
|
460
|
+
// look again. Binding the session to an agent still happens at the first
|
|
461
|
+
// message (set_vendor refuses a rebind).
|
|
449
462
|
var vendorToggleWrap = $("vendor-toggle-wrap");
|
|
450
|
-
var vendorBtnClaude = $("vendor-btn-claude");
|
|
451
|
-
var vendorBtnCodex = $("vendor-btn-codex");
|
|
452
|
-
var vendorBtns = { claude: vendorBtnClaude, codex: vendorBtnCodex };
|
|
453
463
|
|
|
454
464
|
function updateVendorToggle() {
|
|
455
|
-
|
|
456
|
-
var
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
btn.classList.toggle("active", v === current);
|
|
465
|
-
btn.classList.toggle("disabled", !isInstalled);
|
|
466
|
-
btn.title = isInstalled ? (VENDOR_NAMES[v] || v) : (VENDOR_NAMES[v] || v) + " is not installed";
|
|
467
|
-
}
|
|
465
|
+
if (!vendorToggleWrap) return;
|
|
466
|
+
var rows = pickerRows(store.get('vendorRegistry'), store.get('currentVendor') || defaultVendorId());
|
|
467
|
+
renderVendorPicker(vendorToggleWrap, rows, {
|
|
468
|
+
onSelect: onVendorClick,
|
|
469
|
+
onRecheck: function () {
|
|
470
|
+
var ws = getWs();
|
|
471
|
+
if (ws && ws.readyState === 1) ws.send(JSON.stringify({ type: "recheck_vendors" }));
|
|
472
|
+
},
|
|
473
|
+
});
|
|
468
474
|
}
|
|
469
475
|
|
|
470
476
|
function onVendorClick(vendor) {
|
|
471
|
-
if (vendor === (store.get('currentVendor') ||
|
|
477
|
+
if (vendor === (store.get('currentVendor') || defaultVendorId())) return;
|
|
472
478
|
var installed = store.get('installedVendors') || [];
|
|
473
479
|
if (installed.indexOf(vendor) === -1) return;
|
|
474
480
|
store.set({ currentVendor: vendor, currentModel: "", currentModels: [], vendorSelectionLocked: true });
|
|
@@ -476,14 +482,12 @@ export function initPanels() {
|
|
|
476
482
|
if (ws) ws.send(JSON.stringify({ type: "set_vendor", vendor: vendor }));
|
|
477
483
|
}
|
|
478
484
|
|
|
479
|
-
if (vendorBtnClaude) vendorBtnClaude.addEventListener("click", function() { onVendorClick("claude"); });
|
|
480
|
-
if (vendorBtnCodex) vendorBtnCodex.addEventListener("click", function() { onVendorClick("codex"); });
|
|
481
|
-
|
|
482
485
|
// --- Reactive UI sync ---
|
|
483
|
-
store.subscribe(['availableVendors', 'installedVendors', 'currentVendor', 'richContextUsage', 'ctxPopoverVisible', 'currentModel', 'currentModels', 'currentMode', 'currentEffort', 'currentBetas', 'currentThinking'], function (state, prev) {
|
|
484
|
-
//
|
|
486
|
+
store.subscribe(['availableVendors', 'installedVendors', 'vendorRegistry', 'currentVendor', 'richContextUsage', 'ctxPopoverVisible', 'currentModel', 'currentModels', 'currentMode', 'currentEffort', 'currentBetas', 'currentThinking', 'vendorCapabilities'], function (state, prev) {
|
|
487
|
+
// Agent picker state
|
|
485
488
|
if (state.availableVendors !== prev.availableVendors ||
|
|
486
489
|
state.installedVendors !== prev.installedVendors ||
|
|
490
|
+
state.vendorRegistry !== prev.vendorRegistry ||
|
|
487
491
|
state.currentVendor !== prev.currentVendor) {
|
|
488
492
|
updateVendorToggle();
|
|
489
493
|
}
|
|
@@ -513,6 +517,8 @@ export function initPanels() {
|
|
|
513
517
|
state.currentBetas !== prev.currentBetas ||
|
|
514
518
|
state.currentThinking !== prev.currentThinking ||
|
|
515
519
|
state.currentVendor !== prev.currentVendor ||
|
|
520
|
+
state.vendorCapabilities !== prev.vendorCapabilities ||
|
|
521
|
+
state.vendorRegistry !== prev.vendorRegistry ||
|
|
516
522
|
state.codexApproval !== prev.codexApproval ||
|
|
517
523
|
state.codexSandbox !== prev.codexSandbox ||
|
|
518
524
|
state.codexWebSearch !== prev.codexWebSearch) {
|
|
@@ -667,16 +673,14 @@ export function updateConfigChip() {
|
|
|
667
673
|
if (!configChipWrap || !configChip) return;
|
|
668
674
|
configChipWrap.classList.remove("hidden");
|
|
669
675
|
var s = store.snap();
|
|
670
|
-
var vendor = s.currentVendor || "claude";
|
|
671
676
|
configChipLabel.textContent = modelDisplayName(s.currentModel, s.currentModels);
|
|
672
677
|
rebuildModelList();
|
|
673
678
|
rebuildModeList();
|
|
674
679
|
rebuildEffortBar();
|
|
675
680
|
|
|
676
|
-
//
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
if (configModeList && configModeList.parentElement) configModeList.parentElement.style.display = isClaude ? "" : "none";
|
|
681
|
+
// MODE is shown for every agent; one without permission modes shows it
|
|
682
|
+
// disabled with the reason (see rebuildModeList).
|
|
683
|
+
if (configModeList && configModeList.parentElement) configModeList.parentElement.style.display = "";
|
|
680
684
|
// THINKING: driven by per-model supportsThinking flag (falls back to vendor check)
|
|
681
685
|
rebuildThinkingSection();
|
|
682
686
|
if (configThinkingSection) configThinkingSection.style.display = getModelSupportsThinking() ? "" : "none";
|
|
@@ -700,13 +704,12 @@ export function getModelSupportsEffort() {
|
|
|
700
704
|
|
|
701
705
|
/**
|
|
702
706
|
* Returns true if the currently selected model supports extended thinking.
|
|
703
|
-
* Defaults to the
|
|
704
|
-
*
|
|
707
|
+
* Defaults to the agent's thinking capability when no model-level flag is
|
|
708
|
+
* available.
|
|
705
709
|
*/
|
|
706
710
|
export function getModelSupportsThinking() {
|
|
707
711
|
var s = store.snap();
|
|
708
|
-
var
|
|
709
|
-
var defaultSupportsThinking = vendor === "claude"; // vendor-level fallback
|
|
712
|
+
var defaultSupportsThinking = capabilityGate('thinking').enabled; // agent-level fallback
|
|
710
713
|
if (!s.currentModels || s.currentModels.length === 0) return defaultSupportsThinking;
|
|
711
714
|
for (var i = 0; i < s.currentModels.length; i++) {
|
|
712
715
|
if (s.currentModels[i].value === s.currentModel) {
|
|
@@ -23,7 +23,7 @@ import { closeArchive } from './sticky-notes.js';
|
|
|
23
23
|
import { isSchedulerOpen, closeScheduler, resetScheduler } from './scheduler.js';
|
|
24
24
|
import { connect, cancelReconnect, setStatus } from './app-connection.js';
|
|
25
25
|
import { setTurnCounter, setPrependAnchor, setActivityEl, setIsUserScrolledUp, hideSuggestionChips, resetCurrentFullText } from './app-rendering.js';
|
|
26
|
-
import { resetToolState, enableMainInput, resetTurnMetaCost } from './tools.js';
|
|
26
|
+
import { resetToolState, enableMainInput, resetTurnMetaCost, clearPromptStates } from './tools.js';
|
|
27
27
|
import { clearPendingImages } from './input.js';
|
|
28
28
|
import { clearAllMentionActive } from './sidebar-users.js';
|
|
29
29
|
import { setRewindMode } from './rewind.js';
|
|
@@ -405,6 +405,7 @@ export function resetClientState() {
|
|
|
405
405
|
store.set({ currentFullText: "" });
|
|
406
406
|
resetCurrentFullText("");
|
|
407
407
|
resetToolState();
|
|
408
|
+
clearPromptStates();
|
|
408
409
|
clearPendingImages();
|
|
409
410
|
clearAllMentionActive();
|
|
410
411
|
setActivityEl(null);
|
|
@@ -14,14 +14,8 @@ import { sendMessage, hasSendableContent } from './input.js';
|
|
|
14
14
|
import { getChatLayout } from './theme.js';
|
|
15
15
|
import { getScheduledMsgEl } from './app-rate-limit.js';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
codex: "/codex-avatar.png",
|
|
20
|
-
};
|
|
21
|
-
export var VENDOR_NAMES = {
|
|
22
|
-
claude: "Claude Code",
|
|
23
|
-
codex: "Codex",
|
|
24
|
-
};
|
|
17
|
+
import { VENDOR_AVATARS, VENDOR_NAMES, gatedButtonAttrs } from './vendor-registry.js';
|
|
18
|
+
export { VENDOR_AVATARS, VENDOR_NAMES };
|
|
25
19
|
var NEW_MSG_BTN_DEFAULT = "\u2193 Latest";
|
|
26
20
|
var NEW_MSG_BTN_ACTIVITY = "\u2193 New activity";
|
|
27
21
|
|
|
@@ -590,8 +584,8 @@ export function addUserMessage(text, images, pastes, fromUserId, fromUserName) {
|
|
|
590
584
|
actions.innerHTML =
|
|
591
585
|
'<span class="msg-action-time">' + getMsgTime() + '</span>' +
|
|
592
586
|
'<button class="msg-action-btn msg-action-copy" type="button" title="Copy">' + iconHtml("copy") + '</button>' +
|
|
593
|
-
'<button class="msg-action-btn msg-action-fork" type="button"
|
|
594
|
-
|
|
587
|
+
'<button class="msg-action-btn msg-action-fork" type="button" ' + gatedButtonAttrs("fork", "Fork") + '>' + iconHtml("git-branch") + '</button>' +
|
|
588
|
+
'<button class="msg-action-btn msg-action-rewind msg-user-rewind-btn" type="button" ' + gatedButtonAttrs("rewind", "Rewind") + '>' + iconHtml("rotate-ccw") + '</button>' +
|
|
595
589
|
'<button class="msg-action-btn msg-action-hidden msg-action-edit" type="button" title="Edit">' + iconHtml("pencil") + '</button>';
|
|
596
590
|
div.appendChild(actions);
|
|
597
591
|
|
|
@@ -25,6 +25,35 @@
|
|
|
25
25
|
|
|
26
26
|
import { iconHtml, refreshIcons } from './icons.js';
|
|
27
27
|
import { formatDiagnosticSource as _formatSource } from './diagnostic-format.js';
|
|
28
|
+
import { sendWs } from './ws-ref.js';
|
|
29
|
+
|
|
30
|
+
// lr-e85fec: allowlist of actionable.action values this client will act on.
|
|
31
|
+
// A diagnostic's `actionable.action` string is never sent to the server
|
|
32
|
+
// verbatim as a WS message type — only a value in this map is ever wired to
|
|
33
|
+
// a click, so the backend cannot steer the client into sending an arbitrary
|
|
34
|
+
// WS command by way of a diagnostic message.
|
|
35
|
+
var ACTIONABLE_HANDLERS = {
|
|
36
|
+
restart_for_build_update: function () { sendWs({ type: 'restart_for_build_update' }); },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// lr-e85fec: shared by both render sites below (panel entry + toast). Returns
|
|
40
|
+
// a clickable button when entry.actionable.action is a known action, or null
|
|
41
|
+
// when there is no label or no known handler — callers render their own
|
|
42
|
+
// existing icon+text hint in the null case, so this only owns the "known
|
|
43
|
+
// action -> real button" half of the branch, not the fallback shape.
|
|
44
|
+
function _buildActionableEl(entry, btnClass) {
|
|
45
|
+
if (!entry.actionable || !entry.actionable.label) return null;
|
|
46
|
+
var handler = entry.actionable.action ? ACTIONABLE_HANDLERS[entry.actionable.action] : null;
|
|
47
|
+
if (!handler) return null;
|
|
48
|
+
var btn = document.createElement("button");
|
|
49
|
+
btn.className = btnClass;
|
|
50
|
+
btn.textContent = entry.actionable.label;
|
|
51
|
+
btn.addEventListener("click", function () {
|
|
52
|
+
btn.disabled = true;
|
|
53
|
+
handler();
|
|
54
|
+
});
|
|
55
|
+
return btn;
|
|
56
|
+
}
|
|
28
57
|
|
|
29
58
|
// --- Module state ---
|
|
30
59
|
var diagnostics = []; // [{id, severity, source, message, actionable, ts}]
|
|
@@ -222,13 +251,19 @@ function _showDiagnosticToast(entry) {
|
|
|
222
251
|
msgEl.className = "toast-diagnostic-msg";
|
|
223
252
|
msgEl.textContent = entry.message;
|
|
224
253
|
|
|
225
|
-
var hintEl = document.createElement("div");
|
|
226
|
-
hintEl.className = "toast-diagnostic-hint";
|
|
227
|
-
hintEl.textContent = "See Diagnostics panel for details";
|
|
228
|
-
|
|
229
254
|
el.appendChild(headerEl);
|
|
230
255
|
el.appendChild(msgEl);
|
|
231
|
-
|
|
256
|
+
|
|
257
|
+
// lr-e85fec: known actionable.action -> real button; else the plain hint.
|
|
258
|
+
var actionBtn = _buildActionableEl(entry, "toast-diagnostic-action-btn");
|
|
259
|
+
if (actionBtn) {
|
|
260
|
+
el.appendChild(actionBtn);
|
|
261
|
+
} else {
|
|
262
|
+
var hintEl = document.createElement("div");
|
|
263
|
+
hintEl.className = "toast-diagnostic-hint";
|
|
264
|
+
hintEl.textContent = "See Diagnostics panel for details";
|
|
265
|
+
el.appendChild(hintEl);
|
|
266
|
+
}
|
|
232
267
|
|
|
233
268
|
_getToastContainer().appendChild(el);
|
|
234
269
|
refreshIcons();
|
|
@@ -236,8 +271,10 @@ function _showDiagnosticToast(entry) {
|
|
|
236
271
|
// Animate in.
|
|
237
272
|
requestAnimationFrame(function () { el.classList.add("visible"); });
|
|
238
273
|
|
|
239
|
-
// Auto-dismiss after 6s
|
|
240
|
-
|
|
274
|
+
// Auto-dismiss after 6s — EXCEPT when an action button is present: an
|
|
275
|
+
// operator deciding whether to restart must not have the offer vanish out
|
|
276
|
+
// from under them before they've read it (lr-e85fec).
|
|
277
|
+
var timer = actionBtn ? null : setTimeout(function () { _removeDiagnosticToast(el); }, 6000);
|
|
241
278
|
|
|
242
279
|
// Manual dismiss.
|
|
243
280
|
dismissBtn.addEventListener("click", function () {
|
|
@@ -329,21 +366,28 @@ function _appendEntry(entry) {
|
|
|
329
366
|
item.appendChild(meta);
|
|
330
367
|
item.appendChild(msgEl);
|
|
331
368
|
|
|
332
|
-
// Actionable hint: surface label when present.
|
|
369
|
+
// Actionable hint: surface label when present. lr-e85fec: a known action
|
|
370
|
+
// renders as a real button (_buildActionableEl), not just a hint icon — a
|
|
371
|
+
// detector with no attached actuator is the failure mode this closes.
|
|
333
372
|
if (entry.actionable && entry.actionable.label) {
|
|
334
373
|
var actionEl = document.createElement("div");
|
|
335
374
|
actionEl.className = "diagnostics-actionable";
|
|
336
375
|
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
|
|
376
|
+
var panelBtn = _buildActionableEl(entry, "diagnostics-actionable-btn");
|
|
377
|
+
if (panelBtn) {
|
|
378
|
+
actionEl.appendChild(panelBtn);
|
|
379
|
+
} else {
|
|
380
|
+
var fixIcon = document.createElement("span");
|
|
381
|
+
fixIcon.className = "diagnostics-actionable-icon";
|
|
382
|
+
fixIcon.innerHTML = iconHtml("info");
|
|
340
383
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
384
|
+
var fixText = document.createElement("span");
|
|
385
|
+
fixText.className = "diagnostics-actionable-text";
|
|
386
|
+
fixText.textContent = entry.actionable.label;
|
|
344
387
|
|
|
345
|
-
|
|
346
|
-
|
|
388
|
+
actionEl.appendChild(fixIcon);
|
|
389
|
+
actionEl.appendChild(fixText);
|
|
390
|
+
}
|
|
347
391
|
item.appendChild(actionEl);
|
|
348
392
|
}
|
|
349
393
|
|