clay-server 5.2.0-beta.5 → 5.2.0-beta.6
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/lib/claude-hook-installer.js +1 -267
- package/lib/claude-jsonl-watcher.js +1 -204
- package/lib/clay-skill-install.js +1 -33
- package/lib/cli-sessions.js +1 -300
- package/lib/codex-defaults.js +1 -28
- package/lib/context-usage.js +3 -2
- package/lib/daemon.js +5 -55
- package/lib/default-ai-runtime.js +4 -8
- package/lib/email-mcp-server.js +1 -1
- package/lib/kiro-defaults.js +1 -22
- package/lib/mcp-proxy.js +2 -32
- package/lib/mcp-query-bridge.js +1 -1
- package/lib/mcp-source-adapters.js +1 -91
- package/lib/mcp-source-context.js +1 -42
- package/lib/mcp-source-discovery.js +1 -169
- package/lib/mcp-source-plugins.js +1 -68
- package/lib/mcp-source-restrictions.js +1 -47
- package/lib/mcp-tool-policy.js +1 -26
- package/lib/os-user-diagnostics.js +2 -4
- package/lib/os-users.js +4 -65
- package/lib/project-connection.js +8 -7
- package/lib/project-http.js +4 -4
- package/lib/project-mcp.js +2 -2
- package/lib/project-pair-result-delivery.js +2 -2
- package/lib/project-pair-usage.js +12 -13
- package/lib/project-pending-message-queue.js +3 -1
- package/lib/project-session-history-actions.js +5 -3
- package/lib/project-session-pair.js +1 -1
- package/lib/project-session-runtime-actions.js +2 -1
- package/lib/project-session-spawn.js +2 -3
- package/lib/project-session-vendor.js +2 -1
- package/lib/project-sessions.js +18 -26
- package/lib/project-user-message.js +1 -0
- package/lib/project-vendor-login.js +6 -36
- package/lib/public/app.js +1 -0
- package/lib/public/css/messages.css +6 -2
- package/lib/public/modules/app-favicon.js +11 -2
- package/lib/public/modules/app-header.js +4 -2
- package/lib/public/modules/app-loop-ui.js +2 -0
- package/lib/public/modules/app-messages.js +36 -5
- package/lib/public/modules/app-notifications.js +1 -2
- package/lib/public/modules/app-panels.js +61 -123
- package/lib/public/modules/app-rate-limit.js +7 -27
- package/lib/public/modules/chat-render-runtime.js +3 -0
- package/lib/public/modules/mcp-connection-view.js +1 -1
- package/lib/public/modules/permission-control.js +5 -4
- package/lib/public/modules/scheduler.js +2 -0
- package/lib/public/modules/session-create-form.js +10 -10
- package/lib/public/modules/settings-defaults.js +27 -28
- package/lib/public/modules/tools.js +2 -1
- package/lib/public/modules/tui-grab.js +1 -2
- package/lib/public/modules/vendor-login-browser.js +5 -3
- package/lib/public/modules/vendor-login.js +2 -2
- package/lib/public/modules/vendor-priority.js +15 -1
- package/lib/public/muse-avatar.svg +4 -0
- package/lib/safe-bash-commands.js +3 -45
- package/lib/sdk-bridge.js +127 -395
- package/lib/sdk-foreground-admission.js +16 -0
- package/lib/sdk-mcp-descriptors.js +2 -37
- package/lib/sdk-message-processor.js +50 -17
- package/lib/sdk-quota-snapshot.js +1 -1
- package/lib/sdk-response-recovery.js +1 -155
- package/lib/sdk-worker.js +2 -677
- package/lib/server.js +1 -1
- package/lib/session-fork-history.js +21 -0
- package/lib/session-hygiene.js +3 -35
- package/lib/session-permission-mode.js +4 -3
- package/lib/session-skill-scope.js +11 -0
- package/lib/sessions.js +17 -89
- package/lib/tool-llm.js +1 -1
- package/lib/tui-transcript-index.js +1 -132
- package/lib/vendor-login-browser.js +1 -11
- package/lib/yoke/acp-agent-profiles.js +5 -3
- package/lib/yoke/adapters/antigravity.js +3 -14
- package/lib/yoke/adapters/claude-query-contract.js +9 -0
- package/lib/yoke/adapters/claude.js +7 -42
- package/lib/yoke/adapters/codex-query-contract.js +24 -0
- package/lib/yoke/adapters/codex.js +1 -0
- package/lib/yoke/adapters/kiro.js +3 -1
- package/lib/yoke/adapters/muse-query-contract.js +7 -0
- package/lib/yoke/adapters/muse.js +122 -0
- package/lib/yoke/auth-events.js +17 -0
- package/lib/yoke/claude-hook-installer.js +267 -0
- package/lib/yoke/claude-jsonl-watcher.js +204 -0
- package/lib/yoke/claude-maintenance.js +55 -0
- package/lib/yoke/claude-permission-patterns.js +53 -0
- package/lib/yoke/claude-response-recovery.js +155 -0
- package/lib/yoke/claude-transcript-hygiene.js +34 -0
- package/lib/yoke/clay-skill-install.js +33 -0
- package/lib/yoke/cli-sessions.js +300 -0
- package/lib/yoke/codex-app-server.js +7 -12
- package/lib/yoke/configuration.js +13 -0
- package/lib/yoke/discovery.js +70 -0
- package/lib/yoke/errors.js +8 -0
- package/lib/yoke/host-environment.js +7 -0
- package/lib/yoke/index.js +9 -51
- package/lib/yoke/interface.js +116 -0
- package/lib/yoke/kiro-acp-server.js +5 -5
- package/lib/yoke/legacy-sessions.js +89 -0
- package/lib/yoke/login-protocol.js +25 -0
- package/lib/yoke/maintenance.js +12 -0
- package/lib/yoke/mcp-proxy.js +32 -0
- package/lib/yoke/mcp-source-adapters.js +91 -0
- package/lib/yoke/mcp-source-context.js +42 -0
- package/lib/yoke/mcp-source-discovery.js +169 -0
- package/lib/yoke/mcp-source-plugins.js +68 -0
- package/lib/yoke/mcp-source-restrictions.js +47 -0
- package/lib/yoke/mcp-tool-policy-normalize.js +28 -0
- package/lib/yoke/model-preferences.js +6 -0
- package/lib/yoke/muse-artifacts.js +36 -0
- package/lib/yoke/muse-controls.js +50 -0
- package/lib/yoke/muse-input.js +64 -0
- package/lib/yoke/muse-items.js +157 -0
- package/lib/yoke/muse-policy.js +52 -0
- package/lib/yoke/muse-query.js +428 -0
- package/lib/yoke/muse-runtime.js +211 -0
- package/lib/yoke/muse-services.js +79 -0
- package/lib/yoke/muse-skills.js +79 -0
- package/lib/yoke/muse-turns.js +71 -0
- package/lib/yoke/options/acp.js +2 -0
- package/lib/yoke/options/antigravity.js +2 -0
- package/lib/yoke/options/claude.js +21 -0
- package/lib/yoke/options/codex-defaults.js +29 -0
- package/lib/yoke/options/codex-settings.js +21 -0
- package/lib/yoke/options/codex.js +6 -0
- package/lib/yoke/options/kiro-defaults.js +22 -0
- package/lib/yoke/options/kiro.js +5 -0
- package/lib/yoke/options/muse.js +5 -0
- package/lib/yoke/provider-contract.js +5 -0
- package/lib/yoke/providers/antigravity-executable.js +8 -0
- package/lib/yoke/providers/claude-executable.js +40 -0
- package/lib/yoke/providers/claude-model-descriptions.js +14 -0
- package/lib/yoke/providers/claude-process.js +97 -0
- package/lib/yoke/providers/claude-provision.js +75 -0
- package/lib/yoke/providers/codex-errors.js +8 -0
- package/lib/yoke/providers/muse-executable.js +17 -0
- package/lib/yoke/provisioning.js +6 -0
- package/lib/yoke/query-options.js +10 -0
- package/lib/yoke/response-recovery.js +41 -0
- package/lib/yoke/sdk-mcp-descriptors.js +37 -0
- package/lib/yoke/sdk-server-factory.js +7 -0
- package/lib/yoke/session-history.js +8 -0
- package/lib/yoke/session-tool-transport.js +31 -13
- package/lib/yoke/settings.js +23 -0
- package/lib/yoke/source-locations.js +4 -0
- package/lib/yoke/title-query.js +18 -7
- package/lib/yoke/tui-transcript-index.js +132 -0
- package/lib/yoke/usage.js +48 -0
- package/lib/yoke/user-input.js +13 -0
- package/lib/yoke/vendor-registry.js +81 -1
- package/package.json +3 -2
|
@@ -93,42 +93,6 @@ var MODE_OPTIONS = [
|
|
|
93
93
|
var MODE_FULL_AUTO = { value: "auto", label: "Auto" };
|
|
94
94
|
var MODE_SKIP = { value: "bypassPermissions", label: "Skip permissions" };
|
|
95
95
|
var EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
|
|
96
|
-
var EFFORT_LEVELS_BY_VENDOR = {
|
|
97
|
-
claude: ["low", "medium", "high", "xhigh", "max"],
|
|
98
|
-
codex: ["low", "medium", "high", "xhigh", "max"],
|
|
99
|
-
antigravity: [],
|
|
100
|
-
opencode: [],
|
|
101
|
-
kiro: ["low", "medium", "high", "xhigh", "max"],
|
|
102
|
-
};
|
|
103
|
-
var THINKING_OPTIONS = ["disabled", "adaptive", "budget"];
|
|
104
|
-
var CODEX_APPROVAL_OPTIONS = [
|
|
105
|
-
{ value: "never", label: "Auto" },
|
|
106
|
-
{ value: "untrusted", label: "Untrusted" },
|
|
107
|
-
{ value: "on-request", label: "Ask" },
|
|
108
|
-
];
|
|
109
|
-
var CODEX_SANDBOX_OPTIONS = [
|
|
110
|
-
{ value: "read-only", label: "Read Only" },
|
|
111
|
-
{ value: "workspace-write", label: "Workspace" },
|
|
112
|
-
{ value: "danger-full-access", label: "Full Access" },
|
|
113
|
-
];
|
|
114
|
-
var CODEX_WEBSEARCH_OPTIONS = [
|
|
115
|
-
{ value: "disabled", label: "Off" },
|
|
116
|
-
{ value: "cached", label: "Cached" },
|
|
117
|
-
{ value: "live", label: "Live" },
|
|
118
|
-
];
|
|
119
|
-
var KNOWN_CONTEXT_WINDOWS = {
|
|
120
|
-
"opus-4-6": 1000000,
|
|
121
|
-
"claude-sonnet-4": 1000000,
|
|
122
|
-
"gpt-6-astra": 1050000,
|
|
123
|
-
"gpt-5.6": 1050000,
|
|
124
|
-
"gpt-5.5": 1048576,
|
|
125
|
-
"gpt-5.4": 1048576,
|
|
126
|
-
"gpt-5.3": 1048576,
|
|
127
|
-
"gpt-5.2": 1048576,
|
|
128
|
-
"gpt-4.1": 1047576,
|
|
129
|
-
"o3": 200000,
|
|
130
|
-
"o4-mini": 200000,
|
|
131
|
-
};
|
|
132
96
|
// Categories to hide from the legend (noise, not actionable)
|
|
133
97
|
var CTX_HIDDEN_CATS = { "Free space": 1, "Autocompact buffer": 1 };
|
|
134
98
|
|
|
@@ -160,12 +124,12 @@ export function effortDisplayName(value) {
|
|
|
160
124
|
// uses this for sessions other than the active one). Falls back from the
|
|
161
125
|
// model's own supportedEffortLevels to the vendor table.
|
|
162
126
|
export function effortLevelsFor(vendor, models, modelValue) {
|
|
163
|
-
var defaults =
|
|
127
|
+
var defaults = ((store.get("vendorInfo") || {})[vendor] || {}).effortLevels || [];
|
|
164
128
|
var list = models || [];
|
|
165
129
|
for (var i = 0; i < list.length; i++) {
|
|
166
130
|
var value = typeof list[i] === "string" ? list[i] : (list[i] && (list[i].value || list[i].id)) || "";
|
|
167
131
|
if (value === modelValue) {
|
|
168
|
-
if (
|
|
132
|
+
if (Array.isArray(list[i].supportedEffortLevels)) {
|
|
169
133
|
return list[i].supportedEffortLevels;
|
|
170
134
|
}
|
|
171
135
|
return defaults;
|
|
@@ -182,9 +146,8 @@ function thinkingDisplayName(value) {
|
|
|
182
146
|
}
|
|
183
147
|
|
|
184
148
|
function isSonnetModel(model) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return lower.indexOf("sonnet") !== -1;
|
|
149
|
+
var models = store.get("currentModels") || [];
|
|
150
|
+
return models.some(function(entry) { return entry && entry.value === model && entry.supportsBetaContext === true; });
|
|
188
151
|
}
|
|
189
152
|
|
|
190
153
|
function hasBeta(name) {
|
|
@@ -198,7 +161,7 @@ function hasBeta(name) {
|
|
|
198
161
|
function rebuildModeList() {
|
|
199
162
|
if (!configModeList) return;
|
|
200
163
|
configModeList.innerHTML = "";
|
|
201
|
-
var options =
|
|
164
|
+
var options = (providerConfiguration().permissionModes || []).slice();
|
|
202
165
|
options.push(MODE_FULL_AUTO);
|
|
203
166
|
options.push(MODE_SKIP);
|
|
204
167
|
var autoSupported = store.get('permissionCapabilities').auto === true;
|
|
@@ -212,8 +175,8 @@ function rebuildModeList() {
|
|
|
212
175
|
btn.textContent = opt.label;
|
|
213
176
|
if (opt.value === "auto" && !autoSupported) {
|
|
214
177
|
btn.disabled = true;
|
|
215
|
-
btn.title = "Auto permissions
|
|
216
|
-
btn.setAttribute("aria-description", "
|
|
178
|
+
btn.title = "Auto permissions are unavailable for this session.";
|
|
179
|
+
btn.setAttribute("aria-description", "The current runtime does not support Auto permissions.");
|
|
217
180
|
}
|
|
218
181
|
if (globallyForced) {
|
|
219
182
|
btn.disabled = true;
|
|
@@ -232,13 +195,13 @@ function rebuildModeList() {
|
|
|
232
195
|
function rebuildEffortBar() {
|
|
233
196
|
if (!configEffortBar || !configEffortSection) return;
|
|
234
197
|
var supportsEffort = getModelSupportsEffort();
|
|
235
|
-
|
|
198
|
+
var levels = getModelEffortLevels();
|
|
199
|
+
if (!supportsEffort || !levels.length) {
|
|
236
200
|
configEffortSection.style.display = "none";
|
|
237
201
|
return;
|
|
238
202
|
}
|
|
239
203
|
configEffortSection.style.display = "";
|
|
240
204
|
configEffortBar.innerHTML = "";
|
|
241
|
-
var levels = getModelEffortLevels();
|
|
242
205
|
for (var i = 0; i < levels.length; i++) {
|
|
243
206
|
var level = levels[i];
|
|
244
207
|
var btn = document.createElement("button");
|
|
@@ -277,8 +240,9 @@ function rebuildThinkingSection() {
|
|
|
277
240
|
configThinkingSection.style.display = "";
|
|
278
241
|
configThinkingBar.innerHTML = "";
|
|
279
242
|
var s = store.snap();
|
|
280
|
-
|
|
281
|
-
|
|
243
|
+
var thinkingOptions = (providerConfiguration().thinking || {}).options || [];
|
|
244
|
+
for (var i = 0; i < thinkingOptions.length; i++) {
|
|
245
|
+
var opt = thinkingOptions[i];
|
|
282
246
|
var btn = document.createElement("button");
|
|
283
247
|
btn.className = "config-segment-btn";
|
|
284
248
|
if (opt === s.currentThinking) btn.classList.add("active");
|
|
@@ -329,22 +293,21 @@ function buildSegmentedBar(barEl, options, currentValue, msgType, msgKey) {
|
|
|
329
293
|
}
|
|
330
294
|
}
|
|
331
295
|
|
|
332
|
-
function
|
|
333
|
-
var
|
|
334
|
-
|
|
296
|
+
function providerConfiguration() {
|
|
297
|
+
var state = store.snap();
|
|
298
|
+
return ((state.vendorInfo || {})[state.currentVendor] || {}).configuration || {};
|
|
299
|
+
}
|
|
335
300
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (isCodex) buildSegmentedBar(configSandboxBar, CODEX_SANDBOX_OPTIONS, s.codexSandbox, "set_codex_sandbox", "sandbox");
|
|
343
|
-
}
|
|
344
|
-
if (configWebsearchSection) {
|
|
345
|
-
configWebsearchSection.style.display = isCodex ? "" : "none";
|
|
346
|
-
if (isCodex) buildSegmentedBar(configWebsearchBar, CODEX_WEBSEARCH_OPTIONS, s.codexWebSearch, "set_codex_websearch", "webSearch");
|
|
301
|
+
function rebuildProviderSections() {
|
|
302
|
+
var state = store.snap(), config = providerConfiguration();
|
|
303
|
+
function section(element, bar, description) {
|
|
304
|
+
if (!element) return;
|
|
305
|
+
element.style.display = description ? "" : "none";
|
|
306
|
+
if (description) buildSegmentedBar(bar, description.options || [], state[description.state], description.message, description.key);
|
|
347
307
|
}
|
|
308
|
+
section(configApprovalSection, configApprovalBar, config.approval);
|
|
309
|
+
section(configSandboxSection, configSandboxBar, config.sandbox);
|
|
310
|
+
section(configWebsearchSection, configWebsearchBar, config.webSearch);
|
|
348
311
|
}
|
|
349
312
|
|
|
350
313
|
function escHtml(s) {
|
|
@@ -584,25 +547,17 @@ export function updateConfigChip() {
|
|
|
584
547
|
if (!configChipWrap || !configChip) return;
|
|
585
548
|
configChipWrap.classList.remove("hidden");
|
|
586
549
|
var s = store.snap();
|
|
587
|
-
var vendor = s.currentVendor || "claude";
|
|
588
550
|
configChipLabel.textContent = modelDisplayName(s.currentModel, s.currentModels);
|
|
589
551
|
renderModelPicker();
|
|
590
552
|
rebuildModeList();
|
|
591
553
|
rebuildEffortBar();
|
|
592
554
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
if (configModeList && configModeList.parentElement) configModeList.parentElement.style.display = isClaude ? "" : "none";
|
|
555
|
+
var configuration = providerConfiguration();
|
|
556
|
+
if (configModeList && configModeList.parentElement) configModeList.parentElement.style.display = configuration.permissionModes ? "" : "none";
|
|
596
557
|
rebuildThinkingSection();
|
|
597
|
-
|
|
598
|
-
// vendor), NOT "accepts thinking config". The adaptive/extended toggle and
|
|
599
|
-
// budget only feed Claude queries (sm.currentThinking), so the section
|
|
600
|
-
// stays Claude-only until a dedicated thinkingConfig capability exists.
|
|
601
|
-
if (configThinkingSection) configThinkingSection.style.display = isClaude ? "" : "none";
|
|
602
|
-
// BETA section deprecated (1M context is now standard)
|
|
558
|
+
if (configThinkingSection) configThinkingSection.style.display = configuration.thinking ? "" : "none";
|
|
603
559
|
if (configBetaSection) configBetaSection.style.display = "none";
|
|
604
|
-
|
|
605
|
-
rebuildCodexSections();
|
|
560
|
+
rebuildProviderSections();
|
|
606
561
|
}
|
|
607
562
|
|
|
608
563
|
export function getModelSupportsEffort() {
|
|
@@ -645,10 +600,10 @@ export function accumulateUsage(cost, usage) {
|
|
|
645
600
|
// Assign directly instead of summing to avoid overcounting.
|
|
646
601
|
if (cost != null) sessionUsage.cost = cost;
|
|
647
602
|
if (usage) {
|
|
648
|
-
sessionUsage.input += usage.
|
|
649
|
-
sessionUsage.output += usage.
|
|
650
|
-
sessionUsage.cacheRead += usage.
|
|
651
|
-
sessionUsage.cacheWrite += usage.
|
|
603
|
+
sessionUsage.input += usage.inputTokens || 0;
|
|
604
|
+
sessionUsage.output += usage.outputTokens || 0;
|
|
605
|
+
sessionUsage.cacheRead += usage.cacheReadInputTokens || 0;
|
|
606
|
+
sessionUsage.cacheWrite += usage.cacheCreationInputTokens || 0;
|
|
652
607
|
}
|
|
653
608
|
sessionUsage.turns++;
|
|
654
609
|
if (!store.get('replayingHistory')) updateUsagePanel();
|
|
@@ -724,14 +679,8 @@ export function toggleStatusPanel() {
|
|
|
724
679
|
|
|
725
680
|
// --- Context panel ---
|
|
726
681
|
|
|
727
|
-
export function resolveContextWindow(model,
|
|
728
|
-
|
|
729
|
-
if (lc.includes("[1m]")) return 1000000;
|
|
730
|
-
if (sdkValue) return sdkValue;
|
|
731
|
-
for (var key in KNOWN_CONTEXT_WINDOWS) {
|
|
732
|
-
if (lc.includes(key)) return KNOWN_CONTEXT_WINDOWS[key];
|
|
733
|
-
}
|
|
734
|
-
return 200000;
|
|
682
|
+
export function resolveContextWindow(model, reported) {
|
|
683
|
+
return typeof reported === "number" && reported > 0 ? reported : 0;
|
|
735
684
|
}
|
|
736
685
|
|
|
737
686
|
export function contextPctClass(pct) {
|
|
@@ -744,21 +693,21 @@ export function updateContextPanel() {
|
|
|
744
693
|
// only supplies currentInput from a verified last-turn snapshot; rich
|
|
745
694
|
// context usage is more authoritative when available.
|
|
746
695
|
var rich = store.get('richContextUsage');
|
|
747
|
-
var
|
|
748
|
-
|
|
749
|
-
(typeof rich.input_tokens === "number" && typeof rich.contextWindow === "number" && rich.contextWindow > 0)
|
|
750
|
-
);
|
|
696
|
+
var richContext = rich && rich.context;
|
|
697
|
+
var hasRich = richContext && typeof richContext.usedTokens === "number" && typeof richContext.windowTokens === "number" && richContext.windowTokens > 0;
|
|
751
698
|
var hasCurrent = typeof contextData.currentInput === "number";
|
|
752
699
|
var hasContext = !!(hasRich || hasCurrent);
|
|
753
|
-
var used = hasRich ?
|
|
754
|
-
var win = hasRich ?
|
|
700
|
+
var used = hasRich ? richContext.usedTokens : (hasCurrent ? contextData.currentInput : 0);
|
|
701
|
+
var win = hasRich ? richContext.windowTokens : (hasCurrent ? contextData.contextWindow : 0);
|
|
702
|
+
hasContext = hasContext && win > 0;
|
|
703
|
+
var measurement = hasRich ? richContext.measurement : store.get("contextMeasurement");
|
|
755
704
|
var pct = win > 0 ? Math.min(100, (used / win) * 100) : 0;
|
|
756
705
|
var cls = contextPctClass(pct);
|
|
757
706
|
reportPaneContext({ pct: pct, used: used, win: win, cls: cls, model: contextData.model, cost: contextData.cost });
|
|
758
707
|
// Panel bar
|
|
759
708
|
contextBarFill.style.width = pct.toFixed(1) + "%";
|
|
760
709
|
contextBarFill.className = "context-bar-fill" + cls;
|
|
761
|
-
contextBarPct.textContent = pct.toFixed(0) + "%";
|
|
710
|
+
contextBarPct.textContent = hasContext ? pct.toFixed(0) + "%" : "-";
|
|
762
711
|
// Mini bar
|
|
763
712
|
if (contextMiniFill) {
|
|
764
713
|
contextMiniFill.style.width = pct.toFixed(1) + "%";
|
|
@@ -807,7 +756,8 @@ export function updateContextPanel() {
|
|
|
807
756
|
}
|
|
808
757
|
}
|
|
809
758
|
}
|
|
810
|
-
contextUsedEl.textContent = formatTokens(used);
|
|
759
|
+
contextUsedEl.textContent = hasRich || hasCurrent ? (measurement === "estimated" ? "~" : "") + formatTokens(used) : "-";
|
|
760
|
+
contextUsedEl.title = hasRich || hasCurrent ? (measurement === "estimated" ? "Estimated current context" : "Observed current context") : "Current context unavailable";
|
|
811
761
|
contextWindowEl.textContent = win > 0 ? formatTokens(win) : "-";
|
|
812
762
|
contextMaxOutputEl.textContent = contextData.maxOutputTokens > 0 ? formatTokens(contextData.maxOutputTokens) : "-";
|
|
813
763
|
contextInputEl.textContent = formatTokens(contextData.input);
|
|
@@ -829,7 +779,13 @@ export function updateContextPanel() {
|
|
|
829
779
|
contextTurnsEl.textContent = String(contextData.turns);
|
|
830
780
|
}
|
|
831
781
|
|
|
832
|
-
export function accumulateContext(cost, usage, modelUsage, lastStreamInputTokens) {
|
|
782
|
+
export function accumulateContext(cost, usage, modelUsage, lastStreamInputTokens, context) {
|
|
783
|
+
if (context) {
|
|
784
|
+
if (context.source === "last_turn") store.set({ richContextUsage: null });
|
|
785
|
+
store.set({ contextMeasurement: context.measurement || "unavailable" });
|
|
786
|
+
contextData.currentInput = typeof context.usedTokens === "number" ? context.usedTokens : null;
|
|
787
|
+
if (typeof context.windowTokens === "number") contextData.contextWindow = context.windowTokens;
|
|
788
|
+
}
|
|
833
789
|
// cost is the SDK's total_cost_usd -- a cumulative running total, not a delta.
|
|
834
790
|
if (cost != null) contextData.cost = cost;
|
|
835
791
|
// Use latest turn values (not cumulative) since each turn's input_tokens
|
|
@@ -842,17 +798,14 @@ export function accumulateContext(cost, usage, modelUsage, lastStreamInputTokens
|
|
|
842
798
|
if (typeof lastStreamInputTokens === "number") {
|
|
843
799
|
contextData.input = lastStreamInputTokens;
|
|
844
800
|
} else {
|
|
845
|
-
contextData.input = (usage.
|
|
846
|
-
+ (usage.
|
|
847
|
-
}
|
|
848
|
-
contextData.output = usage.output_tokens || usage.outputTokens || 0;
|
|
849
|
-
contextData.cacheRead = usage.cache_read_input_tokens || usage.cacheReadInputTokens || 0;
|
|
850
|
-
contextData.cacheWrite = usage.cache_creation_input_tokens || usage.cacheCreationInputTokens || 0;
|
|
851
|
-
if (store.get('currentVendor') === "codex") {
|
|
852
|
-
contextData.currentInput = typeof lastStreamInputTokens === "number" ? lastStreamInputTokens : null;
|
|
853
|
-
} else {
|
|
854
|
-
contextData.currentInput = typeof lastStreamInputTokens === "number" ? lastStreamInputTokens : contextData.input;
|
|
801
|
+
contextData.input = (usage.inputTokens || 0)
|
|
802
|
+
+ (usage.cacheReadInputTokens || 0);
|
|
855
803
|
}
|
|
804
|
+
contextData.output = usage.outputTokens || 0;
|
|
805
|
+
contextData.cacheRead = usage.cacheReadInputTokens || 0;
|
|
806
|
+
contextData.cacheWrite = usage.cacheCreationInputTokens || 0;
|
|
807
|
+
contextData.currentInput = context && typeof context.usedTokens === "number" ? context.usedTokens : null;
|
|
808
|
+
if (context && typeof context.windowTokens === "number") contextData.contextWindow = context.windowTokens;
|
|
856
809
|
}
|
|
857
810
|
contextData.turns++;
|
|
858
811
|
if (modelUsage) {
|
|
@@ -864,23 +817,8 @@ export function accumulateContext(cost, usage, modelUsage, lastStreamInputTokens
|
|
|
864
817
|
// (e.g. CLI reports "claude-sonnet-4-6" even when running as opus[1m])
|
|
865
818
|
var displayModel = store.get('currentModel') || m;
|
|
866
819
|
contextData.model = displayModel;
|
|
867
|
-
contextData.contextWindow = resolveContextWindow(displayModel, mu.contextWindow);
|
|
820
|
+
contextData.contextWindow = context && typeof context.windowTokens === "number" ? context.windowTokens : resolveContextWindow(displayModel, mu.contextWindow);
|
|
868
821
|
if (mu.maxOutputTokens) contextData.maxOutputTokens = mu.maxOutputTokens;
|
|
869
|
-
if (store.get('currentVendor') === "codex") {
|
|
870
|
-
var snapshot = mu.contextSnapshot;
|
|
871
|
-
if (snapshot) store.set({ richContextUsage: null });
|
|
872
|
-
if (snapshot && snapshot.valid === true
|
|
873
|
-
&& typeof snapshot.inputTokens === "number"
|
|
874
|
-
&& typeof snapshot.contextWindow === "number"
|
|
875
|
-
&& snapshot.contextWindow > 0) {
|
|
876
|
-
contextData.currentInput = snapshot.inputTokens;
|
|
877
|
-
contextData.contextWindow = snapshot.contextWindow;
|
|
878
|
-
} else {
|
|
879
|
-
// An explicit invalid marker is authoritative: do not retain an
|
|
880
|
-
// occupancy value from the previous live turn or history replay.
|
|
881
|
-
contextData.currentInput = null;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
822
|
|
|
885
823
|
// thinkingTokens and costBasis are per-model and optional: absent on
|
|
886
824
|
// older CLI builds and, for a resumed session, on the turns that ran
|
|
@@ -1009,8 +947,8 @@ export function renderCtxPopover() {
|
|
|
1009
947
|
if (!ctxPopoverEl || !richContextUsage) return;
|
|
1010
948
|
var d = richContextUsage;
|
|
1011
949
|
var cats = d.categories || [];
|
|
1012
|
-
var total = d.
|
|
1013
|
-
var max = d.
|
|
950
|
+
var total = d.context && d.context.usedTokens || 0;
|
|
951
|
+
var max = d.context && d.context.windowTokens || 0;
|
|
1014
952
|
var pct = d.percentage != null ? d.percentage : (max > 0 ? (total / max) * 100 : 0);
|
|
1015
953
|
|
|
1016
954
|
var html = "";
|
|
@@ -22,34 +22,15 @@ function getVendorUsageMeta(vendor) {
|
|
|
22
22
|
var vendors = store.get('vendorInfo') || {};
|
|
23
23
|
var info = vendors[vendor];
|
|
24
24
|
if (info && info.usageDashboard) return info.usageDashboard;
|
|
25
|
-
|
|
26
|
-
codex: {
|
|
27
|
-
icon: "/codex-avatar.png",
|
|
28
|
-
alt: "Codex",
|
|
29
|
-
href: "https://chatgpt.com/codex/settings/usage",
|
|
30
|
-
title: "Check usage on ChatGPT",
|
|
31
|
-
},
|
|
32
|
-
claude: {
|
|
33
|
-
icon: "/claude-code-avatar.png",
|
|
34
|
-
alt: "Claude Code",
|
|
35
|
-
href: "https://claude.ai/settings/usage",
|
|
36
|
-
title: "Check usage on claude.ai",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
return fallbacks[vendor] || null;
|
|
25
|
+
return null;
|
|
40
26
|
}
|
|
41
27
|
|
|
42
28
|
function vendorTracksRateLimits(vendor) {
|
|
43
|
-
|
|
44
|
-
var info = vendors[vendor];
|
|
45
|
-
if (info) return info.rateLimitTracking !== false;
|
|
46
|
-
var legacyTrackedVendors = ["claude", "codex"];
|
|
47
|
-
return legacyTrackedVendors.indexOf(vendor) !== -1;
|
|
29
|
+
return ((store.get('vendorInfo') || {})[vendor] || {}).rateLimitTracking === true;
|
|
48
30
|
}
|
|
49
31
|
|
|
50
32
|
function vendorSupportsScheduledMessages(vendor) {
|
|
51
|
-
|
|
52
|
-
return scheduledMessageVendors.indexOf(vendor) !== -1;
|
|
33
|
+
return ((store.get('vendorInfo') || {})[vendor] || {}).rateLimitScheduling === true;
|
|
53
34
|
}
|
|
54
35
|
|
|
55
36
|
function rateLimitEventAppliesToPane(msg, state) {
|
|
@@ -60,7 +41,7 @@ function rateLimitEventAppliesToPane(msg, state) {
|
|
|
60
41
|
if (msg.vendor) return msg.vendor === activeVendor;
|
|
61
42
|
// Legacy Claude records predate vendor/session stamps. Never project them
|
|
62
43
|
// into a non-Claude pane, where they would look like Claude usage.
|
|
63
|
-
return activeVendor ===
|
|
44
|
+
return ((state.vendorInfo || {})[activeVendor] || {}).acceptsUnstampedQuota === true;
|
|
64
45
|
}
|
|
65
46
|
|
|
66
47
|
function rateLimitStateKey(sessionId, vendor) {
|
|
@@ -84,7 +65,6 @@ function setActiveRateLimitState(next) {
|
|
|
84
65
|
}
|
|
85
66
|
|
|
86
67
|
function extraUsageDescription(msg) {
|
|
87
|
-
if (msg.vendor && msg.vendor !== "claude") return "";
|
|
88
68
|
var reason = msg.overageDisabledReason;
|
|
89
69
|
if (reason === "out_of_credits") return "Extra usage has no credits remaining";
|
|
90
70
|
if (reason === "fetch_error") return "Extra usage availability could not be checked";
|
|
@@ -350,7 +330,7 @@ export function initRateLimit() {
|
|
|
350
330
|
export function handleRateLimitEvent(msg) {
|
|
351
331
|
if (!rateLimitEventAppliesToPane(msg, store.snap())) return;
|
|
352
332
|
// Old Codex history contains quota snapshots misrecorded as rejections.
|
|
353
|
-
if (msg.
|
|
333
|
+
if (msg.ignored === true) return;
|
|
354
334
|
if (msg.resetsAt && msg.resetsAt <= Date.now()) {
|
|
355
335
|
var expiredState = Object.assign({}, getActiveRateLimitState());
|
|
356
336
|
if (msg.rateLimitType) delete expiredState[msg.rateLimitType];
|
|
@@ -408,12 +388,12 @@ export function handleRateLimitEvent(msg) {
|
|
|
408
388
|
|
|
409
389
|
export function updateRateLimitUsage(msg) {
|
|
410
390
|
if (!rateLimitEventAppliesToPane(msg, store.snap())) return;
|
|
411
|
-
if (msg.
|
|
391
|
+
if (msg.source === "account_snapshot" && Array.isArray(msg.quotaWindows)) {
|
|
412
392
|
applyQuotaSnapshot(msg);
|
|
413
393
|
renderRateLimitUsage();
|
|
414
394
|
return;
|
|
415
395
|
}
|
|
416
|
-
if (msg.
|
|
396
|
+
if (msg.ignored === true) return;
|
|
417
397
|
var activeVendor = store.get('currentVendor') || "claude";
|
|
418
398
|
if (!vendorTracksRateLimits(activeVendor)) {
|
|
419
399
|
renderRateLimitUsage();
|
|
@@ -7,6 +7,7 @@ import { getProjectAssistantPlaceholder } from './project-chat-identity.js';
|
|
|
7
7
|
export var VENDOR_AVATARS = {
|
|
8
8
|
claude: "/claude-code-avatar.png",
|
|
9
9
|
codex: "/codex-avatar.png",
|
|
10
|
+
muse: "/muse-avatar.svg",
|
|
10
11
|
antigravity: "/antigravity-avatar.png",
|
|
11
12
|
opencode: "/opencode-avatar.svg",
|
|
12
13
|
kimi: "/kimi-avatar.svg",
|
|
@@ -20,6 +21,7 @@ export var VENDOR_AVATARS = {
|
|
|
20
21
|
export var VENDOR_NAMES = {
|
|
21
22
|
claude: "Claude Code",
|
|
22
23
|
codex: "Codex",
|
|
24
|
+
muse: "Muse Code",
|
|
23
25
|
antigravity: "Antigravity CLI",
|
|
24
26
|
opencode: "OpenCode",
|
|
25
27
|
kimi: "Kimi Code",
|
|
@@ -33,6 +35,7 @@ export var VENDOR_NAMES = {
|
|
|
33
35
|
export var VENDOR_HOMEPAGES = {
|
|
34
36
|
claude: "https://claude.com/product/claude-code",
|
|
35
37
|
codex: "https://openai.com/codex/",
|
|
38
|
+
muse: "https://dev.meta.ai/docs/muse-code",
|
|
36
39
|
antigravity: "https://antigravity.google/product/antigravity-cli",
|
|
37
40
|
opencode: "https://opencode.ai/",
|
|
38
41
|
kimi: "https://www.kimi.com/code/",
|
|
@@ -89,7 +89,7 @@ export function renderConnections(root, state, events) {
|
|
|
89
89
|
var screen = state.screen || 'list';
|
|
90
90
|
var html = screen !== 'list' ? '<button type="button" class="mc-back" data-action="back">' + iconHtml('arrow-left') + 'MCP Servers</button>' : '';
|
|
91
91
|
if (state.error) html += '<div class="mc-alert" role="alert">' + iconHtml('circle-alert') + '<span>' + text(state.error) + '</span></div>';
|
|
92
|
-
html += '<p class="mc-muted">Clay connections
|
|
92
|
+
html += '<p class="mc-muted">Clay connections require a runtime that supports session-bound tools. Availability follows the selected runtime’s capabilities.</p>';
|
|
93
93
|
if (state.notice) html += '<p class="mc-notice" role="status">' + text(state.notice) + '</p>';
|
|
94
94
|
if (screen === 'add') html += addView();
|
|
95
95
|
else if (screen === 'remote') html += remoteView(state);
|
|
@@ -66,7 +66,7 @@ export function permissionStatusText(state, pending, autoSupported, autoVisible)
|
|
|
66
66
|
if (state.permissionMode === "plan") return "Plan workflow";
|
|
67
67
|
if (state.permissionMode === "acceptEdits") return "Auto-accept edits workflow";
|
|
68
68
|
if (state.permissionMode === "dontAsk") return "Don't ask workflow";
|
|
69
|
-
if (autoVisible && !autoSupported) return "Auto unavailable for this
|
|
69
|
+
if (autoVisible && !autoSupported) return "Auto unavailable for this session";
|
|
70
70
|
if (state.permissionMode === "auto" && !state.effectivePermissionMode) return "Auto selected · waiting for runtime";
|
|
71
71
|
if (state.permissionMode === "auto" && state.effectivePermissionMode !== "auto") {
|
|
72
72
|
return "Auto unavailable at runtime · using " + modeLabel(state.effectivePermissionMode);
|
|
@@ -91,7 +91,8 @@ export function renderPermissionControl(control, state) {
|
|
|
91
91
|
var projectSlug = state.projectSlug || "";
|
|
92
92
|
var sessionId = state.sessionId || null;
|
|
93
93
|
var pending = permissionPendingFor(projectSlug, sessionId);
|
|
94
|
-
var
|
|
94
|
+
var description = ((store.get("vendorInfo") || {})[state.vendor] || {}).configuration || {};
|
|
95
|
+
var autoVisible = description.auto === true || !!(state.permissionCapabilities && state.permissionCapabilities.auto === true);
|
|
95
96
|
var autoSupported = !!(state.permissionCapabilities && state.permissionCapabilities.auto === true);
|
|
96
97
|
var globallyForced = state.globalPermissionModeForced === true;
|
|
97
98
|
var connected = state.connected !== false && !!getWs() && getWs().readyState === 1;
|
|
@@ -114,7 +115,7 @@ export function renderPermissionControl(control, state) {
|
|
|
114
115
|
buttons[i].classList.toggle("pending", requested);
|
|
115
116
|
buttons[i].setAttribute("aria-pressed", selected ? "true" : "false");
|
|
116
117
|
buttons[i].setAttribute("aria-busy", requested ? "true" : "false");
|
|
117
|
-
buttons[i].title = unsupported ? "Auto permissions are unavailable for this
|
|
118
|
+
buttons[i].title = unsupported ? "Auto permissions are unavailable for this session." : buttonTitles[mode];
|
|
118
119
|
}
|
|
119
120
|
var status = control.querySelector(".session-permission-status");
|
|
120
121
|
if (status) {
|
|
@@ -138,7 +139,7 @@ export function bindPermissionControl(control, getState) {
|
|
|
138
139
|
var autoSupported = !!(state.permissionCapabilities && state.permissionCapabilities.auto === true);
|
|
139
140
|
if (state.visible === false || state.locked === true || state.globalPermissionModeForced === true || state.connected === false || store.get('connected') === false) return;
|
|
140
141
|
if (!state.projectSlug || state.projectSlug !== store.get('currentSlug') || !state.sessionId) return;
|
|
141
|
-
if (mode === "auto" &&
|
|
142
|
+
if (mode === "auto" && !autoSupported) return;
|
|
142
143
|
sendPermissionMode(state.projectSlug, state.sessionId, mode);
|
|
143
144
|
});
|
|
144
145
|
}
|
|
@@ -784,6 +784,8 @@ function renderModelTab(bodyEl, rec) {
|
|
|
784
784
|
}
|
|
785
785
|
|
|
786
786
|
var opts = {
|
|
787
|
+
effortLevels: ((store.get("vendorInfo") || {})[store.get("currentVendor")] || {}).effortLevels || [],
|
|
788
|
+
configuration: ((store.get("vendorInfo") || {})[store.get("currentVendor")] || {}).configuration || {},
|
|
787
789
|
models: store.get('currentModels') || [],
|
|
788
790
|
currentModel: settings.model || "",
|
|
789
791
|
currentMode: settings.permissionMode || "default",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { store } from './store.js';
|
|
9
9
|
import { iconHtml, refreshIcons } from './icons.js';
|
|
10
10
|
import { VENDOR_AVATARS, VENDOR_NAMES, VENDOR_ORDER, isExperimentalVendor } from './app-rendering.js';
|
|
11
|
+
import { sortVendorEntries } from './vendor-priority.js';
|
|
11
12
|
import { startNewSession } from './sidebar-sessions.js';
|
|
12
13
|
import { closeMobileSheet } from './sidebar-mobile.js';
|
|
13
14
|
import {
|
|
@@ -15,20 +16,19 @@ import {
|
|
|
15
16
|
beginSessionCreate, closeSessionCreate, chooseVendor, setCreateMenu, submitSessionCreate, submitMateSessionCreate, saveProjectDefault, retryOptions
|
|
16
17
|
} from './session-create.js';
|
|
17
18
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
19
|
+
// Installed providers first, each group in the established priority order,
|
|
20
|
+
// followed by unknown providers in server order. Installed state is the
|
|
20
21
|
// server's, per user; the dropdown never invents or hardcodes availability.
|
|
21
22
|
function vendorEntries(options) {
|
|
22
23
|
var byId = {};
|
|
23
24
|
options.vendors.forEach(function (v) { byId[v.id] = v; });
|
|
24
25
|
var ids = VENDOR_ORDER.slice();
|
|
25
26
|
options.vendors.forEach(function (v) { if (ids.indexOf(v.id) === -1) ids.push(v.id); });
|
|
26
|
-
return ids.map(function (id) {
|
|
27
|
+
return sortVendorEntries(ids.map(function (id) {
|
|
27
28
|
var known = byId[id];
|
|
28
29
|
return { id: id, name: VENDOR_NAMES[id] || (known && known.displayName) || id, installed: !!(known && known.installed) };
|
|
29
|
-
});
|
|
30
|
+
}));
|
|
30
31
|
}
|
|
31
|
-
|
|
32
32
|
function vendorLabel(id) {
|
|
33
33
|
return VENDOR_NAMES[id] || id;
|
|
34
34
|
}
|
|
@@ -69,7 +69,6 @@ function focusCreateRow(folderId) {
|
|
|
69
69
|
if (target && !target.disabled) { target.focus({ preventScroll: true }); return; }
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
function prefersReducedMotion() {
|
|
74
73
|
return typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
75
74
|
}
|
|
@@ -381,7 +380,8 @@ function paintRow(root) {
|
|
|
381
380
|
}
|
|
382
381
|
placeMenu(root);
|
|
383
382
|
if (form.menuOpen && form.menuFocus && root.getClientRects().length) {
|
|
384
|
-
var
|
|
383
|
+
var entry = entries[form.menuIndex || 0];
|
|
384
|
+
var first = entry && root.querySelector('[data-focus-key="item:' + encodeURIComponent(entry.id) + '"]');
|
|
385
385
|
if (first) { first.focus({ preventScroll: true }); store.set({ sessionCreate: Object.assign({}, createState(), { menuFocus: false }) }); }
|
|
386
386
|
}
|
|
387
387
|
}
|
|
@@ -406,14 +406,14 @@ function renderMenu(entries, form, options, installed) {
|
|
|
406
406
|
menu.className = "session-create-menu";
|
|
407
407
|
menu.setAttribute("role", "menu");
|
|
408
408
|
menu.setAttribute("aria-label", "Providers");
|
|
409
|
-
entries.forEach(function (entry
|
|
409
|
+
entries.forEach(function (entry) {
|
|
410
410
|
var row = document.createElement("div");
|
|
411
411
|
row.className = "session-create-menu-provider";
|
|
412
412
|
var html = '<img src="' + (VENDOR_AVATARS[entry.id] || VENDOR_AVATARS.claude) + '" class="session-create-icon" alt="">' +
|
|
413
413
|
'<span class="session-create-menu-name"></span>' +
|
|
414
414
|
(entry.installed && isExperimentalVendor(entry.id) ? '<span class="vendor-experimental-badge" aria-label="Experimental integration" title="Experimental integration; not yet validated through direct use testing">🧪</span>' : "") +
|
|
415
415
|
(entry.installed ? (options.projectDefault === entry.id ? '<span class="session-create-menu-note">Default</span>' : "") : '<span class="session-create-menu-note">Not installed</span>');
|
|
416
|
-
var item = menuItem("item:" +
|
|
416
|
+
var item = menuItem("item:" + encodeURIComponent(entry.id), (entry.installed ? "" : "unavailable ") + (entry.id === form.vendor ? "selected" : ""), html, function () {
|
|
417
417
|
if (entry.installed) { chooseVendor(entry.id); var live = createState(); store.set({ sessionCreate: Object.assign({}, live, { focusKey: "vendor", wantFocus: true }) }); }
|
|
418
418
|
}, entry.installed ? "New " + entry.name + " session" : entry.name + " is not installed");
|
|
419
419
|
item.querySelector(".session-create-menu-name").textContent = entry.name;
|
|
@@ -423,7 +423,7 @@ function renderMenu(entries, form, options, installed) {
|
|
|
423
423
|
row.appendChild(item);
|
|
424
424
|
if (entry.installed && options.canSetProjectDefault && options.projectDefault !== entry.id) {
|
|
425
425
|
var savingThis = form.defaultSaving && form.defaultVendor === entry.id;
|
|
426
|
-
var setDefault = menuItem("default:" +
|
|
426
|
+
var setDefault = menuItem("default:" + encodeURIComponent(entry.id), "session-create-default-btn", "<span></span>", function () { saveProjectDefault(entry.id); }, "Set " + entry.name + " as the project default");
|
|
427
427
|
setDefault.firstChild.textContent = savingThis ? "Saving" : "Set default";
|
|
428
428
|
setDefault.disabled = !!form.defaultSaving;
|
|
429
429
|
row.appendChild(setDefault);
|