@clagentic/console 1.0.2 → 1.0.3-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/README.md +2 -2
- package/lib/project-connection.js +1 -1
- package/lib/project-sessions.js +9 -0
- package/lib/public/index.html +1 -2
- package/lib/public/modules/app-messages.js +24 -17
- package/lib/public/modules/app-panels.js +28 -13
- package/lib/public/modules/sidebar-mobile.js +15 -3
- package/lib/public/modules/sidebar-sessions.js +31 -4
- package/lib/sdk-bridge.js +7 -1
- package/lib/sdk-message-processor.js +0 -11
- package/lib/sessions.js +2 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ No extras bolted on. No opinionated workflows. The floor is solid; you build wha
|
|
|
18
18
|
## What it does
|
|
19
19
|
|
|
20
20
|
- **Full CLI parity in the browser.** Every capability you have in Claude Code CLI is available here — tool approvals, model selection, context management, session history.
|
|
21
|
-
- **Named agent sessions.** Talk directly to any agent defined in your Claude Code config. Agents get their own sessions, context, and history. First-class, not bolted on.
|
|
21
|
+
- **Named agent sessions.** Talk directly to any agent defined in your Claude Code config. Agents get their own sessions, context, and history. First-class, not bolted on. (Claude Code only — see FAQ.)
|
|
22
22
|
- **Multi-project dashboard.** Every repo on your machine in one sidebar. Jump between projects, run sessions in parallel, see live status at a glance.
|
|
23
23
|
- **Mobile PWA + push notifications.** Installable on iOS and Android. Your phone buzzes when Claude needs approval or finishes a long task — tap to respond from anywhere.
|
|
24
24
|
- **Loop automation.** Write a `PROMPT.md`, hit go. Clagentic:Console iterates: run, evaluate, retry until done or capped. Schedule with standard cron.
|
|
@@ -100,7 +100,7 @@ For architecture details, sequence diagrams, and key design decisions, see [docs
|
|
|
100
100
|
No. Clagentic:Console drives Claude Code through the Claude Agent SDK and Codex through the Codex app-server protocol. It adds multi-session orchestration, named agent sessions, scheduled agents, multi-user support, built-in MCP servers, and a full browser UI on top.
|
|
101
101
|
|
|
102
102
|
**"What are named agents?"**
|
|
103
|
-
Agents defined in your Claude Code config (`.claude/agents/`) become first-class sessions. You talk to them directly — their own conversation history, context window, and session state. No workarounds.
|
|
103
|
+
Agents defined in your Claude Code config (`.claude/agents/`) become first-class sessions. You talk to them directly — their own conversation history, context window, and session state. No workarounds. Named agents are currently **Claude Code only** — the Codex adapter has no equivalent API for per-session agent identity injection. The Agent Chat entry point is hidden automatically when you're using a Codex session.
|
|
104
104
|
|
|
105
105
|
**"Can I run Claude Code and Codex in the same workspace?"**
|
|
106
106
|
Yes. Pick a vendor when you open a session. Switch per session.
|
|
@@ -174,7 +174,7 @@ function attachConnection(ctx) {
|
|
|
174
174
|
}
|
|
175
175
|
ws._clayActiveSession = active.localId;
|
|
176
176
|
var _vendorCaps = (sm.capabilitiesByVendor && sm.capabilitiesByVendor[active.vendor || sm.defaultVendor || "claude"]) || {};
|
|
177
|
-
sendTo(ws, { type: "session_switched", id: active.localId, cliSessionId: active.cliSessionId || null, loop: active.loop || null, vendor: active.vendor || null, hasHistory: (active.history && active.history.length > 0), capabilities: _vendorCaps });
|
|
177
|
+
sendTo(ws, { type: "session_switched", id: active.localId, cliSessionId: active.cliSessionId || null, loop: active.loop || null, vendor: active.vendor || null, hasHistory: (active.history && active.history.length > 0), capabilities: _vendorCaps, agentName: active.agentName || null });
|
|
178
178
|
// Send per-session context sources
|
|
179
179
|
var sessionSources = loadContextSources(slug, active.localId);
|
|
180
180
|
sendTo(ws, { type: "context_sources_state", active: sessionSources });
|
package/lib/project-sessions.js
CHANGED
|
@@ -621,6 +621,15 @@ function attachSessions(ctx) {
|
|
|
621
621
|
if (sm.currentModel) {
|
|
622
622
|
sm.currentModel = "";
|
|
623
623
|
}
|
|
624
|
+
// Agent sessions are Claude Code-only. If the user somehow switches
|
|
625
|
+
// vendor to Codex on a session that carries agentName (e.g. via a
|
|
626
|
+
// direct WS message), clear the agent identity so the badge doesn't
|
|
627
|
+
// misrepresent an identity that Codex cannot apply.
|
|
628
|
+
if (msg.vendor === "codex" && vendorSession.agentName) {
|
|
629
|
+
console.warn("[project] set_vendor to codex on agent session " + vendorSession.localId +
|
|
630
|
+
" — clearing agentName '" + vendorSession.agentName + "'");
|
|
631
|
+
vendorSession.agentName = null;
|
|
632
|
+
}
|
|
624
633
|
sm.saveSessionFile(vendorSession);
|
|
625
634
|
sm.broadcastSessionList();
|
|
626
635
|
}
|
package/lib/public/index.html
CHANGED
|
@@ -290,9 +290,8 @@
|
|
|
290
290
|
<div class="usage-divider"></div>
|
|
291
291
|
<div class="usage-section-label">Session</div>
|
|
292
292
|
<div class="usage-row"><span class="usage-label">Cost</span><span id="usage-cost" class="usage-value">$0.0000</span></div>
|
|
293
|
-
<div class="usage-row"><span class="usage-label">
|
|
293
|
+
<div class="usage-row"><span class="usage-label">Context</span><span id="usage-context" class="usage-value">-</span></div>
|
|
294
294
|
<div class="usage-row"><span class="usage-label">Output tokens</span><span id="usage-output" class="usage-value">0</span></div>
|
|
295
|
-
<div class="usage-row"><span class="usage-label">Cache read</span><span id="usage-cache-read" class="usage-value">0</span></div>
|
|
296
295
|
<div class="usage-row"><span class="usage-label">Cache write</span><span id="usage-cache-write" class="usage-value">0</span></div>
|
|
297
296
|
<div class="usage-row"><span class="usage-label">Turns</span><span id="usage-turns" class="usage-value">0</span></div>
|
|
298
297
|
</div>
|
|
@@ -36,7 +36,7 @@ import { handleLoopRegistryUpdated, handleScheduleRunStarted, handleScheduleRunF
|
|
|
36
36
|
import { scrollToBottom, addToMessages, addUserMessage, addSystemMessage, appendDelta, finalizeAssistantBlock, addConflictMessage, addContextOverflowMessage, showSuggestionChips, armStickyBottom, disarmStickyBottom, removePreThinking } from './app-rendering.js';
|
|
37
37
|
import { setActivity, startUrgentBlink, stopUrgentBlink, blinkSessionDot, updateCrossProjectBlink } from './app-favicon.js';
|
|
38
38
|
import { setStatus } from './app-connection.js';
|
|
39
|
-
import { getModelEffortLevels, accumulateUsage, setSessionUsage, updateUsagePanel, accumulateContext, updateContextPanel, renderCtxPopover, updateStatusPanel } from './app-panels.js';
|
|
39
|
+
import { getModelEffortLevels, accumulateUsage, getSessionUsage, setSessionUsage, updateUsagePanel, accumulateContext, updateContextPanel, renderCtxPopover, updateStatusPanel } from './app-panels.js';
|
|
40
40
|
import { updateProjectList, resetClientState, showUpdateAvailable, handleRemoveProjectCheckResult, handleRemoveProjectResult, handleBrowseDirResult, handleAddProjectResult, handleCloneProgress } from './app-projects.js';
|
|
41
41
|
import { updateHistorySentinel, prependOlderHistory } from './app-header.js';
|
|
42
42
|
import { hideHomeHub, handleHubSchedules } from './app-home-hub.js';
|
|
@@ -126,21 +126,20 @@ export function processMessage(msg) {
|
|
|
126
126
|
if (msg.contextUsage) {
|
|
127
127
|
store.set({ richContextUsage: msg.contextUsage });
|
|
128
128
|
}
|
|
129
|
-
// Restore accurate context data from the last result in full history
|
|
129
|
+
// Restore accurate context data from the last result in full history.
|
|
130
|
+
// accumulateContext handles context bar fill; accumulateUsage restores the
|
|
131
|
+
// usage panel's context/cost values. Both assign (not sum) so replay
|
|
132
|
+
// accumulation during history messages is correctly overwritten here.
|
|
130
133
|
if (msg.lastUsage || msg.lastModelUsage) {
|
|
131
134
|
accumulateContext(msg.lastCost, msg.lastUsage, msg.lastModelUsage, msg.lastStreamInputTokens);
|
|
132
135
|
}
|
|
133
|
-
// Restore
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
cacheRead: cu.cacheRead || 0,
|
|
141
|
-
cacheWrite: cu.cacheWrite || 0,
|
|
142
|
-
turns: cu.turns || 0,
|
|
143
|
-
});
|
|
136
|
+
// Restore usage panel from the last result in history.
|
|
137
|
+
// output/cacheWrite are cumulative sums that were accumulated during replay above;
|
|
138
|
+
// we keep them. cost and context come from the last result directly.
|
|
139
|
+
if (msg.lastCost != null) {
|
|
140
|
+
var su = getSessionUsage();
|
|
141
|
+
su.cost = msg.lastCost;
|
|
142
|
+
if (msg.lastStreamInputTokens) su.context = msg.lastStreamInputTokens;
|
|
144
143
|
}
|
|
145
144
|
updateContextPanel();
|
|
146
145
|
updateUsagePanel();
|
|
@@ -484,11 +483,19 @@ export function processMessage(msg) {
|
|
|
484
483
|
if (!msg.hasHistory && !msg.vendor) {
|
|
485
484
|
// Preserve explicit pre-message vendor choice on brand-new sessions.
|
|
486
485
|
}
|
|
487
|
-
// Show vendor toggle only for new sessions (no history)
|
|
486
|
+
// Show vendor toggle only for new sessions (no history).
|
|
487
|
+
// Agent sessions are Claude Code-only — hide the toggle entirely so
|
|
488
|
+
// the user cannot switch an agent session to Codex (which has no
|
|
489
|
+
// equivalent agent identity API and would silently drop the persona).
|
|
488
490
|
var _vtw = document.getElementById("vendor-toggle-wrap");
|
|
489
491
|
if (_vtw) {
|
|
490
|
-
if (msg.
|
|
491
|
-
|
|
492
|
+
if (msg.agentName) {
|
|
493
|
+
_vtw.classList.add("hidden");
|
|
494
|
+
} else if (msg.hasHistory) {
|
|
495
|
+
_vtw.classList.remove("hidden"); _vtw.classList.add("locked");
|
|
496
|
+
} else {
|
|
497
|
+
_vtw.classList.remove("locked"); _vtw.classList.remove("hidden");
|
|
498
|
+
}
|
|
492
499
|
}
|
|
493
500
|
// Session presence is now tracked server-side (user-presence.json)
|
|
494
501
|
clearRemoteCursors();
|
|
@@ -813,7 +820,7 @@ export function processMessage(msg) {
|
|
|
813
820
|
closeToolGroup();
|
|
814
821
|
finalizeAssistantBlock();
|
|
815
822
|
addTurnMeta(msg.cost, msg.duration);
|
|
816
|
-
accumulateUsage(msg.cost, msg.usage);
|
|
823
|
+
accumulateUsage(msg.cost, msg.usage, msg.lastStreamInputTokens);
|
|
817
824
|
accumulateContext(msg.cost, msg.usage, msg.modelUsage, msg.lastStreamInputTokens);
|
|
818
825
|
break;
|
|
819
826
|
|
|
@@ -8,7 +8,9 @@ import { getWs } from './ws-ref.js';
|
|
|
8
8
|
import { VENDOR_NAMES } from './app-rendering.js';
|
|
9
9
|
|
|
10
10
|
// --- Module-owned state (not in store) ---
|
|
11
|
-
|
|
11
|
+
// sessionUsage.context = last-turn context fill (lastStreamInputTokens) — not cumulative,
|
|
12
|
+
// just the most recent value. Correct for display without any accumulation issues.
|
|
13
|
+
var sessionUsage = { cost: 0, context: 0, output: 0, cacheWrite: 0, turns: 0 };
|
|
12
14
|
var contextData = { contextWindow: 0, maxOutputTokens: 0, model: "-", cost: 0, input: 0, output: 0, cacheRead: 0, cacheWrite: 0, turns: 0 };
|
|
13
15
|
var ctxPopoverEl = null;
|
|
14
16
|
var ctxHoverTimer = null;
|
|
@@ -39,9 +41,8 @@ var configWebsearchBar = null;
|
|
|
39
41
|
var usagePanel = null;
|
|
40
42
|
var usagePanelClose = null;
|
|
41
43
|
var usageCostEl = null;
|
|
42
|
-
var
|
|
44
|
+
var usageContextEl = null;
|
|
43
45
|
var usageOutputEl = null;
|
|
44
|
-
var usageCacheReadEl = null;
|
|
45
46
|
var usageCacheWriteEl = null;
|
|
46
47
|
var usageTurnsEl = null;
|
|
47
48
|
|
|
@@ -467,9 +468,8 @@ export function initPanels() {
|
|
|
467
468
|
usagePanel = $("usage-panel");
|
|
468
469
|
usagePanelClose = $("usage-panel-close");
|
|
469
470
|
usageCostEl = $("usage-cost");
|
|
470
|
-
|
|
471
|
+
usageContextEl = $("usage-context");
|
|
471
472
|
usageOutputEl = $("usage-output");
|
|
472
|
-
usageCacheReadEl = $("usage-cache-read");
|
|
473
473
|
usageCacheWriteEl = $("usage-cache-write");
|
|
474
474
|
usageTurnsEl = $("usage-turns");
|
|
475
475
|
|
|
@@ -665,29 +665,44 @@ export function updateUsagePanel() {
|
|
|
665
665
|
usageCostEl.textContent = (vendor === 'codex' || sessionUsage.cost == null)
|
|
666
666
|
? 'N/A'
|
|
667
667
|
: '$' + sessionUsage.cost.toFixed(4);
|
|
668
|
-
|
|
668
|
+
if (usageContextEl) {
|
|
669
|
+
// Show current context fill (same source as the context bar) alongside window size
|
|
670
|
+
var ctxWin = (contextData && contextData.contextWindow) ? contextData.contextWindow : 0;
|
|
671
|
+
usageContextEl.textContent = sessionUsage.context > 0
|
|
672
|
+
? formatTokens(sessionUsage.context) + (ctxWin > 0 ? ' / ' + formatTokens(ctxWin) : '')
|
|
673
|
+
: '-';
|
|
674
|
+
}
|
|
669
675
|
usageOutputEl.textContent = formatTokens(sessionUsage.output);
|
|
670
|
-
usageCacheReadEl.textContent = formatTokens(sessionUsage.cacheRead);
|
|
671
676
|
usageCacheWriteEl.textContent = formatTokens(sessionUsage.cacheWrite);
|
|
672
677
|
usageTurnsEl.textContent = String(sessionUsage.turns);
|
|
673
678
|
}
|
|
674
679
|
|
|
675
|
-
export function accumulateUsage(cost, usage) {
|
|
676
|
-
// cost
|
|
677
|
-
// Assign directly instead of summing to avoid overcounting.
|
|
680
|
+
export function accumulateUsage(cost, usage, lastStreamInputTokens) {
|
|
681
|
+
// cost: SDK total_cost_usd — cumulative running total; assign, never sum.
|
|
678
682
|
if (cost != null) sessionUsage.cost = cost;
|
|
679
683
|
if (usage) {
|
|
680
|
-
|
|
684
|
+
// output_tokens: per-turn output — sum correctly.
|
|
681
685
|
sessionUsage.output += usage.output_tokens || usage.outputTokens || 0;
|
|
682
|
-
|
|
686
|
+
// cache_creation_input_tokens: new cache written this turn — sum correctly.
|
|
683
687
|
sessionUsage.cacheWrite += usage.cache_creation_input_tokens || usage.cacheCreationInputTokens || 0;
|
|
684
688
|
}
|
|
689
|
+
// context: current context window fill from the last message_start event.
|
|
690
|
+
// This is the same value used by the context bar. Assign (not sum) — it represents
|
|
691
|
+
// the current state of the context window, not a cumulative total.
|
|
692
|
+
// Prefer lastStreamInputTokens (accurate per-call); fall back to input+cache_read.
|
|
693
|
+
if (lastStreamInputTokens) {
|
|
694
|
+
sessionUsage.context = lastStreamInputTokens;
|
|
695
|
+
} else if (usage) {
|
|
696
|
+
var directIn = usage.input_tokens || usage.inputTokens || 0;
|
|
697
|
+
var cacheIn = usage.cache_read_input_tokens || usage.cacheReadInputTokens || 0;
|
|
698
|
+
if (directIn + cacheIn > 0) sessionUsage.context = directIn + cacheIn;
|
|
699
|
+
}
|
|
685
700
|
sessionUsage.turns++;
|
|
686
701
|
if (!store.get('replayingHistory')) updateUsagePanel();
|
|
687
702
|
}
|
|
688
703
|
|
|
689
704
|
export function resetUsage() {
|
|
690
|
-
sessionUsage = { cost: 0,
|
|
705
|
+
sessionUsage = { cost: 0, context: 0, output: 0, cacheWrite: 0, turns: 0 };
|
|
691
706
|
updateUsagePanel();
|
|
692
707
|
if (usagePanel) usagePanel.classList.add("hidden");
|
|
693
708
|
}
|
|
@@ -768,6 +768,9 @@ function renderMobileSessionsInto(container) {
|
|
|
768
768
|
actionGrid.className = "mobile-session-actions";
|
|
769
769
|
|
|
770
770
|
var isDmMode = store.get('dmMode');
|
|
771
|
+
// Agent Chat is Claude Code-only — the Codex adapter has no agent identity
|
|
772
|
+
// injection API (no equivalent of the Claude Agent SDK `agent` option).
|
|
773
|
+
var isCodexMode = (store.get('currentVendor') || 'claude') === 'codex';
|
|
771
774
|
|
|
772
775
|
// Row 1: New session
|
|
773
776
|
var newBtn = document.createElement("button");
|
|
@@ -781,8 +784,8 @@ function renderMobileSessionsInto(container) {
|
|
|
781
784
|
});
|
|
782
785
|
actionGrid.appendChild(newBtn);
|
|
783
786
|
|
|
784
|
-
// Row 2: Agent chat (full picker) — hidden in dmMode
|
|
785
|
-
if (!isDmMode) {
|
|
787
|
+
// Row 2: Agent chat (full picker) — hidden in dmMode and Codex mode
|
|
788
|
+
if (!isDmMode && !isCodexMode) {
|
|
786
789
|
var agentBtn = document.createElement("button");
|
|
787
790
|
agentBtn.className = "mobile-session-new";
|
|
788
791
|
agentBtn.innerHTML = '<i data-lucide="message-circle-plus" style="width:16px;height:16px"></i> Agent chat';
|
|
@@ -794,7 +797,7 @@ function renderMobileSessionsInto(container) {
|
|
|
794
797
|
}
|
|
795
798
|
|
|
796
799
|
// Row 3 (optional): preferred agent quick-launch — only when set, no placeholder
|
|
797
|
-
if (!isDmMode) {
|
|
800
|
+
if (!isDmMode && !isCodexMode) {
|
|
798
801
|
var currentSlugMobile = store.get('currentSlug');
|
|
799
802
|
var preferredAgentMobile = null;
|
|
800
803
|
if (currentSlugMobile) {
|
|
@@ -1405,6 +1408,15 @@ export function initSidebarMobile() {
|
|
|
1405
1408
|
showHomeHub();
|
|
1406
1409
|
});
|
|
1407
1410
|
}
|
|
1411
|
+
|
|
1412
|
+
// Re-render the mobile session action grid when vendor changes so the Agent
|
|
1413
|
+
// Chat button appears/disappears correctly when the user switches vendors
|
|
1414
|
+
// while the mobile sheet is already open.
|
|
1415
|
+
store.subscribe(['currentVendor'], function (state, prev) {
|
|
1416
|
+
if (state.currentVendor !== prev.currentVendor && mobileChatSheetOpen) {
|
|
1417
|
+
refreshMobileChatSheet();
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1408
1420
|
}
|
|
1409
1421
|
|
|
1410
1422
|
// Update the Projects tab unread badge with total across all projects
|
|
@@ -312,11 +312,14 @@ function renderSessionTopActions() {
|
|
|
312
312
|
wrap.className = "session-top-actions";
|
|
313
313
|
|
|
314
314
|
var isDm = store.get('dmMode');
|
|
315
|
+
// Agent Chat is Claude Code-only — the Claude Agent SDK supports named-agent
|
|
316
|
+
// identity injection; the Codex adapter has no equivalent API surface.
|
|
317
|
+
var isCodex = (store.get('currentVendor') || 'claude') === 'codex';
|
|
315
318
|
|
|
316
319
|
// Resolve preferred agent for the current project
|
|
317
320
|
var currentSlug = store.get('currentSlug');
|
|
318
321
|
var preferredAgent = null;
|
|
319
|
-
if (currentSlug && !isDm) {
|
|
322
|
+
if (currentSlug && !isDm && !isCodex) {
|
|
320
323
|
var projects = getCachedProjects();
|
|
321
324
|
for (var pi = 0; pi < projects.length; pi++) {
|
|
322
325
|
if (projects[pi].slug === currentSlug) {
|
|
@@ -338,8 +341,9 @@ function renderSessionTopActions() {
|
|
|
338
341
|
});
|
|
339
342
|
wrap.appendChild(newBtn);
|
|
340
343
|
|
|
341
|
-
// Agent Chat (full picker) — hidden in dmMode
|
|
342
|
-
|
|
344
|
+
// Agent Chat (full picker) — hidden in dmMode and in Codex mode (no agent
|
|
345
|
+
// identity injection available in the Codex adapter).
|
|
346
|
+
if (!isDm && !isCodex) {
|
|
343
347
|
var agentBtn = document.createElement("button");
|
|
344
348
|
agentBtn.className = "session-top-action";
|
|
345
349
|
agentBtn.type = "button";
|
|
@@ -352,7 +356,7 @@ function renderSessionTopActions() {
|
|
|
352
356
|
|
|
353
357
|
// Row 2 (optional): preferred agent quick-launch — full width, only when set.
|
|
354
358
|
// Shows nothing when no preferred agent is configured (no placeholder clutter).
|
|
355
|
-
if (!isDm && preferredAgent) {
|
|
359
|
+
if (!isDm && !isCodex && preferredAgent) {
|
|
356
360
|
var favBtn = document.createElement("button");
|
|
357
361
|
favBtn.type = "button";
|
|
358
362
|
favBtn.className = "session-top-action session-top-action--preferred";
|
|
@@ -375,6 +379,19 @@ function renderSessionTopActions() {
|
|
|
375
379
|
return wrap;
|
|
376
380
|
}
|
|
377
381
|
|
|
382
|
+
// Swap just the top-actions node in-place so vendor-toggle changes take
|
|
383
|
+
// effect without a full session list re-render.
|
|
384
|
+
function refreshSessionTopActions() {
|
|
385
|
+
var listEl = getSessionListEl();
|
|
386
|
+
if (!listEl) return;
|
|
387
|
+
var stickyTop = listEl.querySelector('.session-list-sticky-top');
|
|
388
|
+
if (!stickyTop) return;
|
|
389
|
+
var oldActions = stickyTop.querySelector('.session-top-actions');
|
|
390
|
+
if (!oldActions) return;
|
|
391
|
+
var newActions = renderSessionTopActions();
|
|
392
|
+
stickyTop.replaceChild(newActions, oldActions);
|
|
393
|
+
}
|
|
394
|
+
|
|
378
395
|
function runSessionSearch(query) {
|
|
379
396
|
var normalizedQuery = query || "";
|
|
380
397
|
var trimmedQuery = normalizedQuery.trim();
|
|
@@ -545,6 +562,16 @@ export function initSidebarSessions() {
|
|
|
545
562
|
});
|
|
546
563
|
}
|
|
547
564
|
|
|
565
|
+
// --- Reactively update top-actions when vendor changes ---
|
|
566
|
+
// Agent Chat is hidden in Codex mode; the vendor toggle in app-panels
|
|
567
|
+
// updates the store without triggering a session_list, so we subscribe
|
|
568
|
+
// here and swap just the top-actions node to avoid a full list re-render.
|
|
569
|
+
store.subscribe(['currentVendor'], function (state, prev) {
|
|
570
|
+
if (state.currentVendor !== prev.currentVendor) {
|
|
571
|
+
refreshSessionTopActions();
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
|
|
548
575
|
// --- Schedule countdown timer ---
|
|
549
576
|
startCountdownTimer();
|
|
550
577
|
}
|
package/lib/sdk-bridge.js
CHANGED
|
@@ -1170,7 +1170,13 @@ function createSDKBridge(opts) {
|
|
|
1170
1170
|
// resolved (renamed, missing, parse failure) we fall through silently;
|
|
1171
1171
|
// the badge stays on the session for diagnosability but the session uses
|
|
1172
1172
|
// default identity.
|
|
1173
|
-
|
|
1173
|
+
//
|
|
1174
|
+
// Agent injection is Claude Code-only. The Codex adapter has no equivalent
|
|
1175
|
+
// API surface for in-band agent definition injection, so we skip this block
|
|
1176
|
+
// entirely for Codex sessions. The UI already hides the Agent Chat entry
|
|
1177
|
+
// point for Codex projects; this guard is belt-and-suspenders for sessions
|
|
1178
|
+
// that carry agentName from a prior vendor or from a direct ws message.
|
|
1179
|
+
if (session.agentName && sessionAdapter.vendor !== 'codex') {
|
|
1174
1180
|
var agentDef = null;
|
|
1175
1181
|
try { agentDef = agentsModule.getAgentDefinition(session.agentName); }
|
|
1176
1182
|
catch (e) {
|
|
@@ -453,17 +453,6 @@ function attachMessageProcessor(ctx) {
|
|
|
453
453
|
sessionId: parsed.sessionId,
|
|
454
454
|
lastStreamInputTokens: lastStreamInput,
|
|
455
455
|
});
|
|
456
|
-
// Accumulate server-side cumulative usage for accurate history_done replay
|
|
457
|
-
if (!session.cumulativeUsage) {
|
|
458
|
-
session.cumulativeUsage = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, turns: 0 };
|
|
459
|
-
}
|
|
460
|
-
if (parsed.usage) {
|
|
461
|
-
session.cumulativeUsage.input += parsed.usage.input_tokens || parsed.usage.inputTokens || 0;
|
|
462
|
-
session.cumulativeUsage.output += parsed.usage.output_tokens || parsed.usage.outputTokens || 0;
|
|
463
|
-
session.cumulativeUsage.cacheRead += parsed.usage.cache_read_input_tokens || parsed.usage.cacheReadInputTokens || 0;
|
|
464
|
-
session.cumulativeUsage.cacheWrite += parsed.usage.cache_creation_input_tokens || parsed.usage.cacheCreationInputTokens || 0;
|
|
465
|
-
}
|
|
466
|
-
session.cumulativeUsage.turns++;
|
|
467
456
|
if (parsed.fastModeState) {
|
|
468
457
|
sendAndRecord(session, { type: "fast_mode_state", state: parsed.fastModeState });
|
|
469
458
|
}
|
package/lib/sessions.js
CHANGED
|
@@ -264,7 +264,6 @@ function createSessionManager(opts) {
|
|
|
264
264
|
favoriteOrder: null,
|
|
265
265
|
vendor: (sessionOpts && sessionOpts.vendor) || null,
|
|
266
266
|
agentName: (sessionOpts && sessionOpts.agentName) || null,
|
|
267
|
-
cumulativeUsage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, turns: 0 },
|
|
268
267
|
};
|
|
269
268
|
sessions.set(localId, session);
|
|
270
269
|
switchSession(localId, targetWs);
|
|
@@ -298,7 +297,6 @@ function createSessionManager(opts) {
|
|
|
298
297
|
favoriteOrder: null,
|
|
299
298
|
vendor: (sessionOpts && sessionOpts.vendor) || null,
|
|
300
299
|
agentName: (sessionOpts && sessionOpts.agentName) || null,
|
|
301
|
-
cumulativeUsage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, turns: 0 },
|
|
302
300
|
};
|
|
303
301
|
sessions.set(localId, session);
|
|
304
302
|
return session;
|
|
@@ -355,7 +353,7 @@ function createSessionManager(opts) {
|
|
|
355
353
|
}
|
|
356
354
|
}
|
|
357
355
|
|
|
358
|
-
_send({ type: "history_done", lastUsage: lastUsage, lastModelUsage: lastModelUsage, lastCost: lastCost, lastStreamInputTokens: lastStreamInputTokens, contextUsage: session.lastContextUsage || null
|
|
356
|
+
_send({ type: "history_done", lastUsage: lastUsage, lastModelUsage: lastModelUsage, lastCost: lastCost, lastStreamInputTokens: lastStreamInputTokens, contextUsage: session.lastContextUsage || null });
|
|
359
357
|
}
|
|
360
358
|
|
|
361
359
|
function switchSession(localId, targetWs, transform) {
|
|
@@ -382,7 +380,7 @@ function createSessionManager(opts) {
|
|
|
382
380
|
var _capsByVendor = capabilitiesByVendor || {};
|
|
383
381
|
var _sessionVendor = session.vendor || defaultVendor || "claude";
|
|
384
382
|
var _vendorCaps = _capsByVendor[_sessionVendor] || {};
|
|
385
|
-
_send({ type: "session_switched", id: localId, cliSessionId: session.cliSessionId || null, loop: session.loop || null, vendor: session.vendor || null, hasHistory: (session.history && session.history.length > 0), capabilities: _vendorCaps, isProcessing: !!session.isProcessing });
|
|
383
|
+
_send({ type: "session_switched", id: localId, cliSessionId: session.cliSessionId || null, loop: session.loop || null, vendor: session.vendor || null, hasHistory: (session.history && session.history.length > 0), capabilities: _vendorCaps, isProcessing: !!session.isProcessing, agentName: session.agentName || null });
|
|
386
384
|
// Send vendor-specific slash commands
|
|
387
385
|
var _vendorCmds = slashCommandsByVendor[_sessionVendor] || slashCommands || [];
|
|
388
386
|
_send({ type: "slash_commands", commands: _vendorCmds, vendor: _sessionVendor });
|
package/package.json
CHANGED