summaryrefslogtreecommitdiffhomepage
path: root/src/app/views
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-19 17:02:40 +0900
committerAdam Malczewski <[email protected]>2026-10-19 17:02:40 +0900
commit01f9fb2a4ad6110def531ead16b370c818e8ee81 (patch)
tree398996139295c24350714bb02a88b0dc07545123 /src/app/views
parentc4397f633415a46852f0e3b49c78ab7b2d87d4c1 (diff)
downloaddispatch-web-01f9fb2a4ad6110def531ead16b370c818e8ee81.tar.gz
dispatch-web-01f9fb2a4ad6110def531ead16b370c818e8ee81.zip
feat(chat): cache timer for Claude Code subscription models
Per-step and per-turn timers for the gaps between model requests (the Claude prompt cache expires after 5 min idle). A step gap runs live under the executing tools from step-complete until its last tool result (or the next step's output), then is stamped on that step's metrics line beside its cache badge. A turn gap runs live on the turn's metrics line from done/error until the next message is sent, then is stamped there. Counts m:ss up to 10 min, then '10+ min'; colour tracks the 5-min TTL. Gated on claude/<model>. Pure reducer in core/metrics/cache-timer.ts; the turn gap is seeded from an idle conversation's lastActivityAt so it survives a reload. Stamps are in-memory only.
Diffstat (limited to 'src/app/views')
-rw-r--r--src/app/views/ChatPane.svelte8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/app/views/ChatPane.svelte b/src/app/views/ChatPane.svelte
index 636cd7c..31e719e 100644
--- a/src/app/views/ChatPane.svelte
+++ b/src/app/views/ChatPane.svelte
@@ -7,13 +7,18 @@
* preservation, the ScrollToBottom affordance, and the empty-state
* watermark. Keyed on the active conversation exactly like today's ChatView.
*/
- import { ChatView } from "../../features/chat";
+ import { ChatView, isClaudeSubscriptionModel } from "../../features/chat";
import { createSmartScrollController, ScrollToBottom } from "../../features/smart-scroll";
import { preserveViewportAcross, type AppViewPorts } from "../view-ports";
let { ports }: { ports: AppViewPorts } = $props();
const store = $derived(ports.store);
+ // Cache timer: Claude Code subscription models only (5-minute prompt-cache expiry).
+ const cacheTimer = $derived(
+ isClaudeSubscriptionModel(store.activeModel) ? store.activeChat.cacheTimer : null,
+ );
+
// One controller owns the chat scroll region; the effects below feed it the
// edges (identical to the App.svelte wiring this moved out of).
const smartScroll = createSmartScrollController();
@@ -81,6 +86,7 @@
thinkingKeyBase={store.activeChat.thinkingKeyBase}
providerRetry={store.activeChat.providerRetry}
apiBaseUrl={store.httpBase}
+ {cacheTimer}
/>
{/key}
</div>