diff --git a/README.md b/README.md index 6a3b329..89f06ba 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ **The best [DeepSeek Harness plugin](https://www.deepseek.com/harness/) for Agent's context insights and management.** [`dsh-context`](https://www.npmjs.com/package/dsh-context) provides full context lifecycle management features. +- **Context Dashboard** — the cross-session overview above Settings on the sidebar foot: KPI band, activity heatmap, aggregate composition ring, and filterable session cards that jump straight into any session. - **Context tab** — an UI context dashboard for DeepSeek Harness's context stats, composition, trend, events, and messages. - **Context panel** — the same dashboard as a right-sidebar tab (dsh 0.1.5-rc.1+): pick **Context** on the sidebar's guide page and the panel opens beside the chat. - **`/context` command** — the slash command shows the context model for current context composition and recent context evolution. @@ -31,14 +32,29 @@ Then start the web UI with `dsh web`. No build step, no restart. ## Use it -Three surfaces, one story — what your agent is carrying, how it got there, and what it did with it: +Four surfaces, one story — what your agent is carrying, how it got there, and what it did with it: | Where | What you get | | --- | --- | +| **Context Dashboard** | Every session at a glance: usage, cost, cache hit, daily activity, and per-session context profiles — filtered by range, day, group, or search, one click to jump in. | | **Context tab** | The full dashboard: stats, composition, per-request trend, events, file activity, and the agent network — in every session. | | **`/context` command** | A centered modal with the same composition and context browser, without leaving the chat. | | **Settings → Plugin configuration** | Per-user defaults: trend granularity & mode, File Activity sort. | +## 🗂️ The Context Dashboard + +Click **Context Dashboard / 上下文仪表盘** at the bottom-left of the sidebar, right above **Settings**: + +![Context Dashboard](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-dashboard.png) + +| Section | The question it answers | +| --- | --- | +| **KPI band** | How much am I using — sessions, billed tokens, estimated cost, and cache-hit rate over the picked range (7d / 30d / all). | +| **Activity heatmap** | When do I actually work — the last 12 weeks of daily billed tokens; click a day to filter the sessions that were active on it. | +| **Context Composition** | Where the context windows went, summed over the range's sessions. | +| **Session cards** | Each session's profile: composition ring, billed tokens, turns, cost, and its workspace-group / project breadcrumb — sorted by recency, tokens, or context size, searchable, grouped by workspace. A card click opens the session. | + + ## 📊 The Context tab Open any session and click the **Context / 上下文** tab: diff --git a/docs/compatibility.md b/docs/compatibility.md index da90f4b..fe80927 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -71,6 +71,8 @@ The skill-injection category (issue #66) bumps the timeline projection's `stateV The Agent network card covers the orphaned relatives without waiting for a visit: a session listed without a `contextTimeline` row (composition absent, occupancy only) fetches its slim head from the plugin's `/api/dsh-context/detail` fetch route (mounted through Connection's exact-route registry, behind the same authenticated `/api` fence), which folds the durable log on demand — the node's ring renders the full composition the first time the card opens. The same backfill serves sessions whose cache predates the plugin's installation entirely. Where the route is unavailable (the baseline gate, a connection service without the exact-route registry), the card degrades to the pressure-only occupancy ring as before. +The Context Dashboard (the sidebar-foot panel) reads its `contextActivity` projection — a per-day ledger of billed tokens and completed requests, `stateVersion` 1 — off every session-list row's projection column. A new key is purely additive: no existing cached row is invalidated, but sessions folded before the unit existed (and sessions that predate the plugin entirely, whose `contextTimeline`/`contextHeaders` rows are missing too) have nothing to serve until they next go live. The plugin therefore runs a one-pass warm-up at startup (`src/host/backfill.ts`): for every stored session missing the row it cold-reads the durable log once through the projection cache's own cold-read ladder (`coldSnapshot`), which seeds each unit from its cached rows, folds the remainder, and writes the refreshed checkpoint back — live sessions are skipped (they fold for themselves), unreadable logs are logged and skipped, and a connected browser picks the new rows up on the dashboard's next open (the panel re-pulls the session list). A deployment without the sessionQuery/sessionProjectionCache/sessionPersistence/sessions services simply skips the pass. + To force a full refold of an existing session sooner, delete its cached projection row — it is a derived cache and is rebuilt from the durable log: ```bash diff --git a/docs/context-dashboard.png b/docs/context-dashboard.png new file mode 100644 index 0000000..59db9cc Binary files /dev/null and b/docs/context-dashboard.png differ