feat: BooCode 2.0 UI — Ember theme, brand banner, coder tabs, model-attribution chips
- Ember theme (Obsidian charcoal + #ff7a18 orange), now DEFAULT_THEME_ID; server theme_id whitelist gains 'ember' - Brand banner: transparent Westie mascot + >_BooCode wordmark, big/edge-to-edge (flood-filled to transparency + cropped) - Coder panes are multi-tab: + opens a BooCode tab, split opens a pane (shared ChatTabBar via tabKind + createCoderTab; closeOtherTabs/tab-numbering extended to coder) - Model-attribution: new messages.model column stamped at finalizeCompletion (BooChat/native coder) + dispatcher assistant-row creation (external coder); surfaced via view + wire types + live frame; rendered as a subtle shortened-name chip (shortenModelName) - Composer Web toggle moved into a boxed focus-ringed input; glowing accent dot on tool rows - Claude SDK follow-ups (1M context, follow-up-message fix, collapsed thinking/tool chips) + CLAUDE_SDK_BACKEND=1 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,18 +19,24 @@ interface Props {
|
||||
// the same boundaries the server's auto-compaction triggers.
|
||||
const COMPACTION_BUFFER = 20_000;
|
||||
|
||||
// Walk newest-first; first message with both ctx_used and ctx_max non-null
|
||||
// AND ctx_max > 0 wins. Older messages may have ctx_used but missing ctx_max
|
||||
// (early v1 before llama-swap's n_ctx capture worked) — skip them and keep
|
||||
// walking. Returns null when no usable pair exists in the chat.
|
||||
// Take the latest ctx_used and the latest ctx_max INDEPENDENTLY (newest-first).
|
||||
// They needn't be on the same message: ctx_max is the model's context window — a
|
||||
// constant per model — while some agents report it only intermittently (the claude
|
||||
// SDK populates modelUsage.contextWindow on some turns, not all) yet report
|
||||
// ctx_used every turn. Pairing the latest of each gives a correct used/max even
|
||||
// when the most recent turn omitted the window. Native BooChat sets both on the
|
||||
// same assistant message, so this is identical there. Returns null until BOTH a
|
||||
// used and a positive max have been seen at least once.
|
||||
function latestPair(messages: Message[]): { used: number; max: number } | null {
|
||||
let used: number | null = null;
|
||||
let max: number | null = null;
|
||||
for (let i = messages.length - 1; i >= 0; i--) {
|
||||
const m = messages[i]!;
|
||||
if (m.ctx_used == null || m.ctx_max == null) continue;
|
||||
if (m.ctx_max <= 0) continue;
|
||||
return { used: m.ctx_used, max: m.ctx_max };
|
||||
if (used === null && m.ctx_used != null) used = m.ctx_used;
|
||||
if (max === null && m.ctx_max != null && m.ctx_max > 0) max = m.ctx_max;
|
||||
if (used !== null && max !== null) break;
|
||||
}
|
||||
return null;
|
||||
return used !== null && max !== null ? { used, max } : null;
|
||||
}
|
||||
|
||||
interface ColorTier {
|
||||
|
||||
Reference in New Issue
Block a user