@clagentic/console 1.9.0 → 1.10.0-beta.2
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 +9 -3
- package/bin/cli.js +40 -5
- package/deploy/clagentic-console.service +10 -6
- package/lib/agent-dispatch-tool.js +20 -0
- package/lib/audit.js +3 -2
- package/lib/build-changes.js +79 -0
- package/lib/build-identity.js +192 -0
- package/lib/build-monitor.js +125 -0
- package/lib/build-sha.json +2 -2
- package/lib/build-update-check.js +138 -0
- package/lib/build-update-offer.js +141 -0
- package/lib/build-update-restart.js +142 -0
- package/lib/build-update-standing.js +184 -0
- package/lib/cli/daemon-launch.js +25 -22
- package/lib/cli/ipc-subcommands.js +6 -0
- package/lib/cli/session-subcommands.js +122 -0
- package/lib/cli-sessions.js +8 -1
- package/lib/codex-defaults.js +8 -2
- package/lib/config.js +32 -20
- package/lib/daemon-env-settings.js +84 -0
- package/lib/daemon-projects.js +57 -0
- package/lib/daemon.js +288 -205
- 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/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/memory-shed.js +13 -32
- 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 +37 -22
- package/lib/project-external-trigger.js +166 -105
- 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 +17 -9
- 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 +217 -0
- package/lib/project-sessions.js +192 -355
- package/lib/project-user-message.js +27 -15
- package/lib/project.js +212 -147
- 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 +680 -0
- package/lib/public/app.js +1 -1
- package/lib/public/css/diagnostics.css +80 -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/agent-dispatch-tool.js +9 -0
- 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 +52 -47
- package/lib/public/modules/app-notifications.js +47 -71
- package/lib/public/modules/app-panels.js +61 -59
- package/lib/public/modules/app-projects.js +2 -1
- package/lib/public/modules/app-rendering.js +4 -10
- package/lib/public/modules/build-update-detail.js +54 -0
- package/lib/public/modules/diagnostics.js +170 -20
- 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 +81 -906
- package/lib/public/modules/vendor-picker.js +53 -0
- package/lib/public/modules/vendor-registry.js +142 -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 +348 -284
- package/lib/sdk-message-processor.js +117 -146
- package/lib/sdk-skill-discovery.js +65 -60
- package/lib/server-hub-sessions.js +13 -10
- package/lib/server-palette.js +28 -19
- package/lib/server.js +156 -115
- package/lib/service-install.js +96 -0
- package/lib/session-capabilities.js +76 -0
- package/lib/session-id.js +33 -0
- package/lib/session-input-ipc.js +32 -0
- package/lib/session-input.js +379 -0
- package/lib/session-reclaim.js +284 -0
- package/lib/session-resume.js +172 -0
- package/lib/sessions.js +61 -30
- package/lib/supervisor.js +39 -0
- package/lib/turn-initiator.js +108 -0
- 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 +66 -0
- package/lib/ws-origin.js +99 -0
- package/lib/ws-schema.js +36 -23
- package/lib/yoke/adapters/claude-capabilities.js +38 -0
- package/lib/yoke/adapters/claude-vendor.js +34 -0
- package/lib/yoke/adapters/claude-worker.js +57 -87
- package/lib/yoke/adapters/claude.js +182 -88
- package/lib/yoke/adapters/codex-capabilities.js +40 -0
- package/lib/yoke/adapters/codex-vendor.js +46 -0
- package/lib/yoke/adapters/codex.js +462 -211
- 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 +91 -0
- package/lib/yoke/capabilities.js +49 -0
- package/lib/yoke/codex-app-server.js +30 -56
- package/lib/yoke/codex-binary.js +254 -0
- package/lib/yoke/codex-command.js +122 -0
- package/lib/yoke/codex-protocol.js +96 -0
- package/lib/yoke/codex-version.js +135 -0
- package/lib/yoke/env-ownership.js +40 -0
- package/lib/yoke/index.js +84 -174
- package/lib/yoke/install-probe.js +136 -0
- package/lib/yoke/instructions.js +7 -11
- package/lib/yoke/interface.js +206 -4
- package/lib/yoke/package.json +1 -1
- package/lib/yoke/provider-credentials.js +96 -0
- package/lib/yoke/registry.js +377 -0
- package/package.json +12 -9
- 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-build.js +59 -17
- 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"],
|
|
@@ -96,7 +92,6 @@ var EFFORT_LEVELS_BY_VENDOR = {
|
|
|
96
92
|
var THINKING_OPTIONS = ["disabled", "adaptive", "budget"];
|
|
97
93
|
var CODEX_APPROVAL_OPTIONS = [
|
|
98
94
|
{ value: "never", label: "Auto" },
|
|
99
|
-
{ value: "on-failure", label: "On Fail" },
|
|
100
95
|
{ value: "on-request", label: "Ask" },
|
|
101
96
|
];
|
|
102
97
|
var CODEX_SANDBOX_OPTIONS = [
|
|
@@ -132,15 +127,6 @@ function modelDisplayName(value, models) {
|
|
|
132
127
|
return value;
|
|
133
128
|
}
|
|
134
129
|
|
|
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
130
|
function effortDisplayName(value) {
|
|
145
131
|
if (!value) return "";
|
|
146
132
|
if (value === "xhigh") return "X-High";
|
|
@@ -263,13 +249,25 @@ function rebuildModelList() {
|
|
|
263
249
|
refreshIcons(configModelList);
|
|
264
250
|
}
|
|
265
251
|
|
|
252
|
+
// A control the current agent cannot support stays in the popover, disabled,
|
|
253
|
+
// with the one-line reason from the registry.
|
|
254
|
+
function appendUnavailableNote(container, reason) {
|
|
255
|
+
var note = document.createElement("div");
|
|
256
|
+
note.className = "config-unavailable-note";
|
|
257
|
+
note.setAttribute("aria-disabled", "true");
|
|
258
|
+
note.textContent = reason;
|
|
259
|
+
container.appendChild(note);
|
|
260
|
+
}
|
|
261
|
+
|
|
266
262
|
function rebuildModeList() {
|
|
267
263
|
if (!configModeList) return;
|
|
268
264
|
configModeList.innerHTML = "";
|
|
269
|
-
var
|
|
270
|
-
if (
|
|
271
|
-
|
|
265
|
+
var modeGate = capabilityGate("permissionModes");
|
|
266
|
+
if (!modeGate.enabled) {
|
|
267
|
+
appendUnavailableNote(configModeList, modeGate.reason);
|
|
268
|
+
return;
|
|
272
269
|
}
|
|
270
|
+
var options = modeOptions(currentCapabilities(), store.get('skipPermsEnabled'));
|
|
273
271
|
for (var i = 0; i < options.length; i++) {
|
|
274
272
|
var opt = options[i];
|
|
275
273
|
var btn = document.createElement("button");
|
|
@@ -292,6 +290,13 @@ function rebuildModeList() {
|
|
|
292
290
|
|
|
293
291
|
function rebuildEffortBar() {
|
|
294
292
|
if (!configEffortBar || !configEffortSection) return;
|
|
293
|
+
var effortGate = capabilityGate("effort");
|
|
294
|
+
if (!effortGate.enabled) {
|
|
295
|
+
configEffortSection.style.display = "";
|
|
296
|
+
configEffortBar.innerHTML = "";
|
|
297
|
+
appendUnavailableNote(configEffortBar, effortGate.reason);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
295
300
|
var supportsEffort = getModelSupportsEffort();
|
|
296
301
|
if (!supportsEffort) {
|
|
297
302
|
configEffortSection.style.display = "none";
|
|
@@ -390,21 +395,24 @@ function buildSegmentedBar(barEl, options, currentValue, msgType, msgKey) {
|
|
|
390
395
|
}
|
|
391
396
|
}
|
|
392
397
|
|
|
398
|
+
// APPROVAL, SANDBOX and WEB SEARCH are settings an agent either has or lacks
|
|
399
|
+
// (the executionPolicy capability). Unlike a parity control, an agent without
|
|
400
|
+
// them has nothing to show, so the sections are left out for it.
|
|
393
401
|
function rebuildCodexSections() {
|
|
394
402
|
var s = store.snap();
|
|
395
|
-
var
|
|
403
|
+
var hasPolicy = capabilityGate("executionPolicy").enabled;
|
|
396
404
|
|
|
397
405
|
if (configApprovalSection) {
|
|
398
|
-
configApprovalSection.style.display =
|
|
399
|
-
if (
|
|
406
|
+
configApprovalSection.style.display = hasPolicy ? "" : "none";
|
|
407
|
+
if (hasPolicy) buildSegmentedBar(configApprovalBar, CODEX_APPROVAL_OPTIONS, s.codexApproval, "set_codex_approval", "approval");
|
|
400
408
|
}
|
|
401
409
|
if (configSandboxSection) {
|
|
402
|
-
configSandboxSection.style.display =
|
|
403
|
-
if (
|
|
410
|
+
configSandboxSection.style.display = hasPolicy ? "" : "none";
|
|
411
|
+
if (hasPolicy) buildSegmentedBar(configSandboxBar, CODEX_SANDBOX_OPTIONS, s.codexSandbox, "set_codex_sandbox", "sandbox");
|
|
404
412
|
}
|
|
405
413
|
if (configWebsearchSection) {
|
|
406
|
-
configWebsearchSection.style.display =
|
|
407
|
-
if (
|
|
414
|
+
configWebsearchSection.style.display = hasPolicy ? "" : "none";
|
|
415
|
+
if (hasPolicy) buildSegmentedBar(configWebsearchBar, CODEX_WEBSEARCH_OPTIONS, s.codexWebSearch, "set_codex_websearch", "webSearch");
|
|
408
416
|
}
|
|
409
417
|
}
|
|
410
418
|
|
|
@@ -445,30 +453,27 @@ export function initPanels() {
|
|
|
445
453
|
configWebsearchSection = $("config-websearch-section");
|
|
446
454
|
configWebsearchBar = $("config-websearch-bar");
|
|
447
455
|
|
|
448
|
-
// ---
|
|
456
|
+
// --- Agent picker, rendered from the registry ---
|
|
457
|
+
// One button per registered agent. An agent that is not installed is shown
|
|
458
|
+
// disabled with how to install it, and a Re-check button asks the server to
|
|
459
|
+
// look again. Binding the session to an agent still happens at the first
|
|
460
|
+
// message (set_vendor refuses a rebind).
|
|
449
461
|
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
462
|
|
|
454
463
|
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
|
-
}
|
|
464
|
+
if (!vendorToggleWrap) return;
|
|
465
|
+
var rows = pickerRows(store.get('vendorRegistry'), store.get('currentVendor') || defaultVendorId());
|
|
466
|
+
renderVendorPicker(vendorToggleWrap, rows, {
|
|
467
|
+
onSelect: onVendorClick,
|
|
468
|
+
onRecheck: function () {
|
|
469
|
+
var ws = getWs();
|
|
470
|
+
if (ws && ws.readyState === 1) ws.send(JSON.stringify({ type: "recheck_vendors" }));
|
|
471
|
+
},
|
|
472
|
+
});
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
function onVendorClick(vendor) {
|
|
471
|
-
if (vendor === (store.get('currentVendor') ||
|
|
476
|
+
if (vendor === (store.get('currentVendor') || defaultVendorId())) return;
|
|
472
477
|
var installed = store.get('installedVendors') || [];
|
|
473
478
|
if (installed.indexOf(vendor) === -1) return;
|
|
474
479
|
store.set({ currentVendor: vendor, currentModel: "", currentModels: [], vendorSelectionLocked: true });
|
|
@@ -476,14 +481,12 @@ export function initPanels() {
|
|
|
476
481
|
if (ws) ws.send(JSON.stringify({ type: "set_vendor", vendor: vendor }));
|
|
477
482
|
}
|
|
478
483
|
|
|
479
|
-
if (vendorBtnClaude) vendorBtnClaude.addEventListener("click", function() { onVendorClick("claude"); });
|
|
480
|
-
if (vendorBtnCodex) vendorBtnCodex.addEventListener("click", function() { onVendorClick("codex"); });
|
|
481
|
-
|
|
482
484
|
// --- Reactive UI sync ---
|
|
483
|
-
store.subscribe(['availableVendors', 'installedVendors', 'currentVendor', 'richContextUsage', 'ctxPopoverVisible', 'currentModel', 'currentModels', 'currentMode', 'currentEffort', 'currentBetas', 'currentThinking'], function (state, prev) {
|
|
484
|
-
//
|
|
485
|
+
store.subscribe(['availableVendors', 'installedVendors', 'vendorRegistry', 'currentVendor', 'richContextUsage', 'ctxPopoverVisible', 'currentModel', 'currentModels', 'currentMode', 'currentEffort', 'currentBetas', 'currentThinking', 'vendorCapabilities'], function (state, prev) {
|
|
486
|
+
// Agent picker state
|
|
485
487
|
if (state.availableVendors !== prev.availableVendors ||
|
|
486
488
|
state.installedVendors !== prev.installedVendors ||
|
|
489
|
+
state.vendorRegistry !== prev.vendorRegistry ||
|
|
487
490
|
state.currentVendor !== prev.currentVendor) {
|
|
488
491
|
updateVendorToggle();
|
|
489
492
|
}
|
|
@@ -513,6 +516,8 @@ export function initPanels() {
|
|
|
513
516
|
state.currentBetas !== prev.currentBetas ||
|
|
514
517
|
state.currentThinking !== prev.currentThinking ||
|
|
515
518
|
state.currentVendor !== prev.currentVendor ||
|
|
519
|
+
state.vendorCapabilities !== prev.vendorCapabilities ||
|
|
520
|
+
state.vendorRegistry !== prev.vendorRegistry ||
|
|
516
521
|
state.codexApproval !== prev.codexApproval ||
|
|
517
522
|
state.codexSandbox !== prev.codexSandbox ||
|
|
518
523
|
state.codexWebSearch !== prev.codexWebSearch) {
|
|
@@ -667,16 +672,14 @@ export function updateConfigChip() {
|
|
|
667
672
|
if (!configChipWrap || !configChip) return;
|
|
668
673
|
configChipWrap.classList.remove("hidden");
|
|
669
674
|
var s = store.snap();
|
|
670
|
-
var vendor = s.currentVendor || "claude";
|
|
671
675
|
configChipLabel.textContent = modelDisplayName(s.currentModel, s.currentModels);
|
|
672
676
|
rebuildModelList();
|
|
673
677
|
rebuildModeList();
|
|
674
678
|
rebuildEffortBar();
|
|
675
679
|
|
|
676
|
-
//
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
if (configModeList && configModeList.parentElement) configModeList.parentElement.style.display = isClaude ? "" : "none";
|
|
680
|
+
// MODE is shown for every agent; one without permission modes shows it
|
|
681
|
+
// disabled with the reason (see rebuildModeList).
|
|
682
|
+
if (configModeList && configModeList.parentElement) configModeList.parentElement.style.display = "";
|
|
680
683
|
// THINKING: driven by per-model supportsThinking flag (falls back to vendor check)
|
|
681
684
|
rebuildThinkingSection();
|
|
682
685
|
if (configThinkingSection) configThinkingSection.style.display = getModelSupportsThinking() ? "" : "none";
|
|
@@ -700,13 +703,12 @@ export function getModelSupportsEffort() {
|
|
|
700
703
|
|
|
701
704
|
/**
|
|
702
705
|
* Returns true if the currently selected model supports extended thinking.
|
|
703
|
-
* Defaults to the
|
|
704
|
-
*
|
|
706
|
+
* Defaults to the agent's thinking capability when no model-level flag is
|
|
707
|
+
* available.
|
|
705
708
|
*/
|
|
706
709
|
export function getModelSupportsThinking() {
|
|
707
710
|
var s = store.snap();
|
|
708
|
-
var
|
|
709
|
-
var defaultSupportsThinking = vendor === "claude"; // vendor-level fallback
|
|
711
|
+
var defaultSupportsThinking = capabilityGate('thinking').enabled; // agent-level fallback
|
|
710
712
|
if (!s.currentModels || s.currentModels.length === 0) return defaultSupportsThinking;
|
|
711
713
|
for (var i = 0; i < s.currentModels.length; i++) {
|
|
712
714
|
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
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// build-update-detail.js — the body of a "newer build installed" diagnostic:
|
|
2
|
+
// which build is running, which is installed, and the commits between them
|
|
3
|
+
// when git history was available. Every value is set with textContent: commit
|
|
4
|
+
// subjects are repository content, never markup.
|
|
5
|
+
|
|
6
|
+
var SHORT_SHA_LENGTH = 12;
|
|
7
|
+
|
|
8
|
+
export function shortSha(sha) {
|
|
9
|
+
return typeof sha === 'string' && sha ? sha.slice(0, SHORT_SHA_LENGTH) : '(unknown)';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function line(className, text) {
|
|
13
|
+
var el = document.createElement('div');
|
|
14
|
+
el.className = className;
|
|
15
|
+
el.textContent = text;
|
|
16
|
+
return el;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {{loadedBuildSha: ?string, installedBuildSha: ?string, reason: string,
|
|
21
|
+
* changes: {available: boolean, commits: Array<{sha: string, subject: string}>, truncated: boolean, reason: ?string}}} offer
|
|
22
|
+
* @returns {?HTMLElement} null when the diagnostic carries no offer
|
|
23
|
+
*/
|
|
24
|
+
export function buildUpdateDetailEl(offer) {
|
|
25
|
+
if (!offer || typeof offer !== 'object') return null;
|
|
26
|
+
var root = document.createElement('div');
|
|
27
|
+
root.className = 'build-update-detail';
|
|
28
|
+
|
|
29
|
+
root.appendChild(line('build-update-builds',
|
|
30
|
+
'Running: ' + shortSha(offer.loadedBuildSha) + ' Installed: ' + shortSha(offer.installedBuildSha)));
|
|
31
|
+
|
|
32
|
+
var changes = offer.changes || {};
|
|
33
|
+
if (offer.reason === 'content') {
|
|
34
|
+
root.appendChild(line('build-update-note',
|
|
35
|
+
'Both report the same build, but the installed files differ from the ones this process loaded.'));
|
|
36
|
+
} else if (changes.available && Array.isArray(changes.commits) && changes.commits.length > 0) {
|
|
37
|
+
root.appendChild(line('build-update-heading', 'Changes since the running build:'));
|
|
38
|
+
var list = document.createElement('ul');
|
|
39
|
+
list.className = 'build-update-commits';
|
|
40
|
+
changes.commits.forEach(function (c) {
|
|
41
|
+
var item = document.createElement('li');
|
|
42
|
+
item.textContent = shortSha(c.sha).slice(0, 8) + ' ' + c.subject;
|
|
43
|
+
list.appendChild(item);
|
|
44
|
+
});
|
|
45
|
+
root.appendChild(list);
|
|
46
|
+
if (changes.truncated) root.appendChild(line('build-update-note', 'More commits not shown.'));
|
|
47
|
+
} else if (changes.available) {
|
|
48
|
+
root.appendChild(line('build-update-note', 'No commits between these builds were found in the available history.'));
|
|
49
|
+
} else {
|
|
50
|
+
root.appendChild(line('build-update-note',
|
|
51
|
+
'Change list unavailable' + (changes.reason ? ': ' + changes.reason : '') + '.'));
|
|
52
|
+
}
|
|
53
|
+
return root;
|
|
54
|
+
}
|