From 084f4d75fce7d27b5d06ae73d741ecb121b55c17 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Tue, 2 Jun 2026 14:30:57 +0900 Subject: Fix cache req badge wrap, remove cache cost note, pace-aware key usage bars --- .../src/lib/components/CacheRatePanel.svelte | 7 +------ .../frontend/src/lib/components/KeyUsage.svelte | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'packages/frontend/src/lib/components') diff --git a/packages/frontend/src/lib/components/CacheRatePanel.svelte b/packages/frontend/src/lib/components/CacheRatePanel.svelte index c35cbb5..88985a0 100644 --- a/packages/frontend/src/lib/components/CacheRatePanel.svelte +++ b/packages/frontend/src/lib/components/CacheRatePanel.svelte @@ -55,7 +55,7 @@ const lastHitPct = $derived( {#if tabTitle} {tabTitle} {/if} - {cacheStats.requests} req + {cacheStats.requests} req @@ -120,10 +120,5 @@ const lastHitPct = $derived( - -

- Cache reads cost ~10% of fresh input; writes cost ~25% more. A high hit - rate after the first turn means caching is working. Resets on reload. -

{/if} diff --git a/packages/frontend/src/lib/components/KeyUsage.svelte b/packages/frontend/src/lib/components/KeyUsage.svelte index 00d179e..7c0cadc 100644 --- a/packages/frontend/src/lib/components/KeyUsage.svelte +++ b/packages/frontend/src/lib/components/KeyUsage.svelte @@ -131,6 +131,17 @@ function progressClass(utilization: number): string { return "progress-success"; } +// Pace-aware coloring for cycle bars that show a "time dot" (elapsed % of the +// reset window). Red once usage hits 90%, otherwise green when usage is at or +// behind the dot and orange when it has run ahead of it. Falls back to the +// plain threshold coloring when no dot is present (elapsedPct < 0). +function pacedProgressClass(percentUsed: number, elapsedPct: number): string { + if (percentUsed >= 90) return "progress-error"; + if (elapsedPct < 0) return progressClass(percentUsed / 100); + if (percentUsed <= elapsedPct) return "progress-success"; + return "progress-warning"; +} + function formatDate(ts: number): string { const diff = ts - Date.now(); const days = Math.floor(diff / 86400000); @@ -245,7 +256,7 @@ function hasBucketData(bucket: UsageBucket | undefined): boolean { {p}%
- + {#if tp >= 0}
{/if} @@ -266,7 +277,7 @@ function hasBucketData(bucket: UsageBucket | undefined): boolean { {p}%
- + {#if tp >= 0}
{/if} @@ -330,7 +341,7 @@ function hasBucketData(bucket: UsageBucket | undefined): boolean { {p}%
- + {#if tp >= 0}
{/if} @@ -351,7 +362,7 @@ function hasBucketData(bucket: UsageBucket | undefined): boolean { {p}%
- + {#if tp >= 0}
{/if} @@ -372,7 +383,7 @@ function hasBucketData(bucket: UsageBucket | undefined): boolean { {p}%
- + {#if tp >= 0}
{/if} -- cgit v1.2.3 From 2756730aeba633c3cc331500bcfb9a67d85dc892 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Tue, 2 Jun 2026 14:39:20 +0900 Subject: Add status bar beneath chat input with send/stop button and context display Restructure ChatInput into two stacked bars: - Top bar: auto-resizing textarea + fixed-width send/stop button that morphs in place (no layout shift) across idle/generating states. - Bottom bar: agent status icon, context-window fill bar, and compact token count + percent (inert bar when model max is unknown). Wire contextLimit prop from App.svelte into ChatInput, reusing the shared computeContextUsage helper so it agrees with the sidebar. --- packages/frontend/src/App.svelte | 2 +- .../frontend/src/lib/components/ChatInput.svelte | 145 ++++++++++++++++----- 2 files changed, 111 insertions(+), 36 deletions(-) (limited to 'packages/frontend/src/lib/components') diff --git a/packages/frontend/src/App.svelte b/packages/frontend/src/App.svelte index ecfdc9f..a0b25b7 100644 --- a/packages/frontend/src/App.svelte +++ b/packages/frontend/src/App.svelte @@ -174,7 +174,7 @@ onMount(() => {
- +
diff --git a/packages/frontend/src/lib/components/ChatInput.svelte b/packages/frontend/src/lib/components/ChatInput.svelte index 0c99078..95712c7 100644 --- a/packages/frontend/src/lib/components/ChatInput.svelte +++ b/packages/frontend/src/lib/components/ChatInput.svelte @@ -1,6 +1,9 @@ -
- {#if agentStatus === "running"} +
+ +
+ + - {:else if agentStatus === "idle"} - - - - {:else if agentStatus === "error"} - - - - - - {/if} - - +
+ + +
+ + + {#if agentStatus === "running"} + + {:else if agentStatus === "error"} + + + + + + {:else} + + + + {/if} + + + + {#if usage.percent !== null} + + {:else} + + + {/if} + + + + {#if hasUsage} + {fmtCompact(usage.current)}{#if usage.max !== null} / {fmtCompact(usage.max)}{/if} + {#if usage.percent !== null} + · {usage.percent.toFixed(1)}% + {/if} + {:else} + — tokens + {/if} + +
-- cgit v1.2.3