dsh-context 0.38.0 → 0.38.1

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.
Files changed (3) hide show
  1. package/README.md +69 -73
  2. package/lib/client.js +3 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  **The best [DeepSeek Harness plugin](https://www.deepseek.com/harness/) for Agent's context insights and management.**
10
10
 
11
11
  `dsh-context` provides full context lifecycle management features.
12
- - **Context tab** — an UI context dashboard for DeepSeek Harnesss context stats, composition, trend, events, and messages.
12
+ - **Context tab** — an UI context dashboard for DeepSeek Harness's context stats, composition, trend, events, and messages.
13
13
  - **`/context` command** — the slash command shows the context model for current context composition and recent context evolution.
14
14
 
15
15
  ## Install / Update
@@ -30,122 +30,118 @@ Then start the web UI with `dsh web`. No build step, no restart.
30
30
 
31
31
  ## Use it
32
32
 
33
- ### Context tab
33
+ Three surfaces, one story — what your agent is carrying, how it got there, and what it did with it:
34
34
 
35
- Open any session and click the **Context / 上下文** tab:
36
-
37
- ![Context panel overview](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-overview.png)
38
-
39
- ### ⌨️ `/context` command In-session Context Insight modal
40
-
41
- Type `/context` (or pick it from the `/` menu) and press Enter: a centered dialog shows the **Current Composition** card and the **Context browser** — the same composition bar, legend, and per-step browsing as the tab, so you can inspect what any request was assembled from without leaving the chat.
35
+ | Where | What you get |
36
+ | --- | --- |
37
+ | **Context tab** | The full dashboard: stats, composition, per-request trend, events, file activity, and the agent network — in every session. |
38
+ | **`/context` command** | A centered modal with the same composition and context browser, without leaving the chat. |
39
+ | **Settings Plugin configuration** | Per-user defaults: trend granularity & mode, File Activity sort. |
42
40
 
43
- ![Context command_entry](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-command-entry.png)
41
+ ## 📊 The Context tab
44
42
 
45
- ![Context command](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-command.png)
46
-
47
- ### ⚙️ Settings — per-user preferences
48
-
49
- In **Settings → Plugins → Plugin configuration**, the **Context / 上下文** card holds this plugin's per-user preferences — the **default trend granularity** (Step/Turn), the **default trend mode** (Total/Delta), and the **File Activity default sort** (Most active / Latest / By path) the Context tab opens with. In-chart and in-card toggling stays per-view and never overwrites the stored preference. The card appears only when the Host half is installed and the settings document is writable (a remote browser keeps settings process-local and shows no card).
50
-
51
- ## What you'll see
43
+ Open any session and click the **Context / 上下文** tab:
52
44
 
53
- ### 📊 Context stats — the session at a glance
45
+ ![Context panel overview](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-overview.png)
54
46
 
55
- Four equal-width cards up top the three stat cards, with the plugin info card keeping them company:
47
+ | Card | The question it answers |
48
+ | --- | --- |
49
+ | **Context Stats** | Turns, steps, live tool calls & images, context-event tallies — plus a list-price cost estimate (hover the `?` for per-1M rates). |
50
+ | **Token Stats** | Where the billed tokens went: cache read/write, uncached input, output — around the cache-hit ring. |
51
+ | **Timing Stats** | How active time split across model calls, tool runs, and overhead. |
52
+ | **Current Context** | What's in the window *right now*. |
53
+ | **Context Trend** | Every request's size — and its story. |
54
+ | **Context Browser** | What any request was *actually* assembled from. |
55
+ | **Context Events** | When and why the window changed. |
56
+ | **File Activity** | What the agent *did* to your files. |
57
+ | **Agent Network** | The whole agent family, live. |
56
58
 
57
- - **Context Stats** an eight-cell grid: turns, steps, live tool calls and images, the context-event tally (injections, compactions, prunes), and the list-price cost estimate with its per-1M rates on hover.
58
- - **Token Stats** — a ring of the provider-reported billing buckets (cache reads/writes, uncached input, output) around the cache-hit share.
59
- - **Timing Stats** — a ring splitting the session's active time into model calls vs tool runs (the center shows the total).
59
+ The headline occupancy and composition read the **same official token-meter projections as the chat composer's context ring** (`contextPressure` / `contextBreakdown`), so the figures always match what the ring tells you.
60
60
 
61
- ### 🧱 Current compositionwhat's in the window right now
61
+ ### 🧱 Current Contextwho ate the budget
62
62
 
63
- A six-color stacked bar scaled against the model's full context window (the gray track is your remaining headroom): system prompt, tool schemas, your messages, injected context, assistant replies, and tool results — plus the top-5 most expensive tool schemas. When a conversation starts degrading, this is where you find out *which part ate the budget*.
63
+ ![Current Context card](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/current-context.png)
64
64
 
65
- The headline occupancy and the composition counts read the **same official token-meter projections the chat composer's context ring reads** (`contextPressure` / `contextBreakdown`), so the legend's `≈` figures and proportions match the ring's click-open panel exactly; the message bucket is subdivided into the four surface categories by the fold's per-category ratios.
65
+ A six-color stacked bar against the model's full window (hatching = free headroom): system prompt, tool schemas, user messages, injected context, assistant replies, tool results each with its ≈token figure and share. When a conversation starts degrading, this is where you see *which part* is responsible.
66
66
 
67
- ### 📈 Context Trend — every request's size *and* its story
67
+ ### 📈 Context Trend — every request, sized and explained
68
68
 
69
- One stacked bar per model request — finer than per-message — so you watch the window grow turn by turn, and drop in one ✂ when compaction hits:
69
+ ![Context Trend with the step brief](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-trend.png)
70
70
 
71
- ![Context Trend card with the step brief](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-trend.png)
71
+ One stacked bar per model request — finer than per-message — so you watch the window grow turn by turn:
72
72
 
73
- - **✨ Step brief — what a step *was*, not just how big.** Three plain-language rows under the chart: **User** recalls the message that opened the turn (on any of its steps), **In** lists what newly entered the context — usually the previous tool calls' results, failures flagged, empty on a turn's opening step — and **Response** shows what the model returned: its reply text and/or the tools it called. Hover a row's tag to learn what the row means; click any row to open that exact message in the Context browser.
74
- - **Read it your way** — **Step** or **Turn** granularity, **Total** (cumulative makeup) or **Delta** (each request's signed change), and sideways scroll through the whole session.
75
- - **Hover & pin** — scrub for an instant tooltip (turn/step, time, tokens, a one-line reply preview); click to pin the full category breakdown, with provider-reported actual prompt/output/cache figures next to the estimates.
76
- - **✂ marks the events** — compactions and prunes land exactly where they happened, so the bars' drops explain themselves.
77
- - **Live linkage** — hovering a bar previews that step's assembled context in the Context browser beside the chart; leave the chart and it returns to your own pick.
73
+ - **✨ Step brief**three plain-language rows under the chart: **User** recalls the message that opened the turn, **In** lists what newly entered (usually the previous tool results), **Response** shows the reply and/or tools called. Click a row to open that exact message in the Context browser.
74
+ - **✂ marks the events** — compactions and prunes are pinned to the bar where they happened, so the drops explain themselves.
75
+ - **Read it your way** — **Step / Turn** granularity, **Total** (cumulative makeup) or **Delta** (each request's signed change), and sideways scrolling through the whole session. In Delta mode, growth piles up above the baseline and a compaction dives below it:
78
76
 
79
- Above: Turn 1 · Step 15 of a real session — the brief recalls the turn's opening message, the files just read in, and the reply that called `read` next.
77
+ ![Context Trend in Delta mode](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/history-delta.png)
80
78
 
81
- A longer session tells the dramatic version ~563k tokens across 48 turns, then compaction (✂) recycled −535.5k in one step, and the conversation continued from a fresh, small window:
79
+ - **Hover & pin** scrub for an instant tooltip; click to pin the full breakdown, with provider-reported **Actual Prompt / Output / Cache** next to the estimates.
80
+ - **Live linkage** — hovering a bar previews that step's assembled context in the Context browser beside the chart; leaving the chart returns to your own pick.
82
81
 
83
- ![History chart with a pinned request](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/history-detail.png)
82
+ ### 🧭 Context Browser open the box of any request
84
83
 
85
- Switch the chart from **Total** to **Delta** and each bar becomes the *change* that request made to the window instead of its cumulative size: diverging stacks pile up from the solid zero baseline when the window grew and hang below it when it shrank, tooltips read `Δ ±Nk`, and the pinned detail card re-prices every category as a signed delta so you can tell exactly which part of a request added (or reclaimed) tokens. Below, Turn 5's first step grew the window by **+1.6k**: injected context **+803**, the user message **+649**, the assistant reply **+178** — and nothing else moved:
84
+ Pick **Live (next request)** or any retained step, and browse what that request was assembled from: six collapsible categories expand into one row per element with its token price, and every element expands again into its **actual content**the system prompt, each tool's JSON schema, message text, reasoning, tool arguments, and tool outputs.
86
85
 
87
- ![History chart in Delta mode](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/history-delta.png)
86
+ - **Who provides each tool** — every tool-schema row carries a best-effort source chip: `tool-*` first-party packages, `dsh-*` capability packages, `mcp:<server>` proxies, or the exact plugin watched live from `tools.register()`. Sort by **size / name**, and filter every category by its own searchable fields:
88
87
 
89
- ### Context events when and why the window changed
88
+ ![Tool schemas with source chips, filter, and sort](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-tools.png)
90
89
 
91
- Every compaction, tool-output prune, skill or plugin context injection, model switch, and plan-mode toggle each labeled with its producer source (instruction file paths, plugin id, skill name), its token delta (compactions/prunes show the **net** reclaimed amount, matching the chart's drop), turn/step attribution, and timestamp. Filter by category (**Inject / Compact / Prune / Switch / Mode**) to see exactly when each kind of event happened and its impact — e.g. when a skill was injected, when instructions were added, or how much a compaction reclaimed:
90
+ - **Tool results open into the full call** the tool name and arguments with its **OK/error** status, the result body with line count and a **Raw / Markdown** toggle:
92
91
 
93
- ![Context events and messages](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-events.png)
92
+ ![A tool result expanded with Raw/Markdown toggle](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-tool-result.png)
94
93
 
95
- ### 📁 File Activitywhat the agent *did* to your files
94
+ - **Image payloads render as cards** thumbnails with name, dimensions, stored size, and the official DeepSeek image-token estimate (dsh 0.1.1+ multimodal pipeline, e.g. `read_image` results and image attachments):
96
95
 
97
- Not what the context is made of, but what it was good for: one row per touched file — read, written, or searched — aggregated up to the step you pick on the trend chart (the card scrubs live as you hover the bars; the default is the whole session to date):
96
+ ![An image payload rendered as a thumbnail card](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-images.png)
98
97
 
99
- ![File Activity card sorted by most active](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/file-activity.png)
98
+ - **Diff against the previous turn** — signed delta badges per category (`+N` items, `±Nk` tokens) tell you what a turn added or reclaimed at one glance. Steps older than a compaction are reconstructed from the removed-message archive — and the card says so when a step's makeup is only approximate.
100
99
 
101
- - **Per-purpose counts**how many times each file was read, written, and searched, with the header chips doubling as purpose filters (**Read / Written / Searched**), an **Images** chip for the multimodal view (`read_image` calls and image extensions), and a path search box.
102
- - **Line deltas** — every `edit`/`write` contributes its estimated footprint (`+added / −removed`, read off the call arguments), per file and summed in the header.
103
- - **Every mode counts** — native tool calls, the Minimal preset's `str_replace_editor`, and the nested `read`/`write`/`edit`/`grep`/`glob` calls a PTC (`run_code`) program makes are all folded: each nested call rows under its own tool, annotated with the program's description, and jumps to the parent `run_code` result.
104
- - **Searches land on real files** — when a search result carries its matched-file list, the ops row per matched file with the hit count (pattern as detail); only a capped or unknown result falls back to the searched path/pattern itself.
105
- - **Sorted your way** — **Most active**, **Latest**, or **By path**; each row carries per-purpose badges, its cumulative line delta, the last operation's time, and a red dot when an operation failed.
106
- - **Click to inspect** — a row expands into the file's own operation log — every operation, no cap (tool, time, per-op delta, search detail, failures flagged); each operation jumps straight to the exact tool result in the Context browser.
100
+ ### Context Events when and why the window changed
107
101
 
108
- ### 🕸 Agent Network — the whole agent family at the foot of the tab
102
+ ![Context Events with a compaction](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-events.png)
109
103
 
110
- The current agent, its parents, and every subagent it spawned one node per agent, colored edges for the parent→child lineage:
104
+ Every injection, compaction, prune, model switch, and plan-mode toggle labeled with its producer (instruction file, plugin id, skill name), its net token delta (compactions show what they reclaimed), turn/step, and time. The **Inject / Compact / Prune / Switch / Mode** chips filter the log by kind.
111
105
 
112
- ![Agent network card](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/agent-network.png)
106
+ ### 📁 File Activity — what the agent did to your files
113
107
 
114
- - **Subagents and multi-level delegation, on one live map** — the card walks the `parentId` chain to the topmost ancestor and lays out the whole family at any depth: ancestors, siblings, grandchildren. Each level-1 subtree owns a hue, so a node's allegiance reads from its link color; running agents breathe with a green halo and a flowing pulse on their edge.
115
- - **Every node carries that agent's own context** — each ring is one session's composition (the same six categories and estimator as the overview card) scaled to its window occupancy, with the fill percentage at the center. Hover for the full story: name, one-shot / continuable mode, tokens and window, requests, billed, active time.
116
- - **Click to jump** — any node opens that agent's session, so a subagent's own Context tab (trend, events, file activity, its own sub-network) is one click away. The layout adapts to the card's width, from a solo agent to an 18-agent clan.
108
+ ![File Activity](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/file-activity.png)
117
109
 
118
- ### 🧭 Context browseropen the box of any request
110
+ One row per touched file read, written, or searched aggregated up to whichever step you pick on the trend chart:
119
111
 
120
- Pick **Live (next request)** or any retained step from the picker, and browse what that request was actually assembled from:
112
+ - **Per-purpose counts** with header chips doubling as filters (**Read / Written / Searched / Images**) and a path search box.
113
+ - **Line deltas** — every `edit`/`write` contributes its estimated `+added / −removed` footprint, per file and summed.
114
+ - **Every mode counts** — native tools, the Minimal preset's `str_replace_editor`, and the nested calls inside PTC `run_code` programs are all folded into per-tool rows.
115
+ - **Searches land on real files** — matched files get their own ops rows with hit counts.
116
+ - **Click a row** to expand its full operation log — every op jumps straight to the exact tool result in the Context browser.
121
117
 
122
- ![Context browser](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser.png)
118
+ ### 🕸 Agent Network — the family portrait
123
119
 
124
- Six collapsible category sections (system prompt, tool schemas, user messages, injected context, assistant replies, tool results) expand into one row per element — each with its token price — and every element expands again into its **actual content**: the full system prompt, each tool's description and JSON schema, message text, reasoning, tool-call arguments, and tool outputs.
120
+ ![Agent Network with two subagents](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/agent-network.png)
125
121
 
126
- - **Who provides each tool** tool-schema rows carry a best-effort source tag when attribution is knowable: the pinned first-party package map (`@deepseek-ai/dsh-tool-*`) for shipped tools, `mcp:<server>` for MCP-proxied tools (their public names encode the server), or a harness-logged `plugin` field. Beyond those, the host also watches live `tools.register()` calls and tags each tool to the plugin that registered it third-party, agent-scoped and dynamically named tools included, even plugins installed from a local path or npm/pnpm link (their package name is resolved from the registering code's directory). The session log itself records only each tool's name/description/parameters, so a tool that was **already registered when the context plugin mounted** (e.g. local-link plugins that load earlier in the bundle) shows an **Unknown plugin** tag instead: the registering plugin is gone from every observable surface by the time attribution starts. Tools not in the current registry at all (older sessions) stay untagged.
122
+ The current agent, its parents, and every subagent one node per agent, colored edges for the lineage, multi-level delegation on one map. Each ring is that session's composition scaled to its window occupancy; hover for tokens, requests, billing, and active time; click to jump into that session's own Context tab. Running agents breathe with a green pulse.
127
123
 
128
- ![Context browser tool schemas with per-plugin source chips, a text filter, and the size/name sort](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-tools.png)
124
+ ## ⌨️ `/context` command
129
125
 
130
- - **Filter every category, sort the tools** — every category body carries a text filter that scans exactly what its rows show: tool schemas match name/description/parameters/plugin; message rows match the preview and the tag chip (call breadcrumbs, call-argument summaries) — full bodies stay out of scope, they load on demand. Each filter box names its own searchable fields, and the tools category adds a **size / name** sort with size (token price) as the default, mirroring the overview's Top chips. The filter is a lens on the open category: switching categories resets it, picking steps keeps it.
126
+ Type `/context` (or pick it from the `/` menu) and press Enter:
131
127
 
132
- ![Row filtering in the Context browser: tool results narrowed by "fileCard"](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-search.png)
128
+ ![Slash menu with the context command](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-command-entry.png)
133
129
 
134
- - **Linked with the trend chart** hover any bar in the Context trend card and the browser previews that step instantly; leave the chart and it returns to your own pick. Keep a category open while scrubbing to compare one category across steps. Clicking a step-brief row (**User** / **In** / **Response**) opens that exact message here, expanded and scrolled into view.
135
- - **Honest about coverage** — steps before a compaction are reconstructed from the removed-message archive, and the card says so when a step's makeup is only approximate. Elements older than the loaded chat window page older history in automatically when you expand them, and live injections (AGENTS.md, session-start context, …) are always listed — never a token sum without its items.
136
- - **Diff against the previous turn** — switch the picker to **vs previous turn** and every category gets signed delta badges (`+N` items, `+Nk` tokens), so one glance tells you what the conversation added since the end of the last turn.
130
+ A centered dialog opens with the **Current Composition** card and the **Context browser** the same composition bar, per-step picker, and `vs previous turn` diff badges as the tab:
137
131
 
138
- Tool results open into the full call and response: the tool's name and arguments with its **OK/error** status on top, the result body with its line count and a **Raw / Markdown** display toggle, and any image payload (e.g. `read_image` output) rendered as a thumbnail card with its name, dimensions, stored size, and estimated token cost — instead of a flattened blob of text:
132
+ ![The /context modal](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-command.png)
139
133
 
140
- ![Context browser showing a tool result with Raw/Markdown toggle and an image payload](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-tool-result.png)
134
+ ## ⚙️ Settings
141
135
 
142
- ### 🖼 Multimodalimage attachments in full view (DeepSeek Harness 0.1.1+)
136
+ In **Settings Plugins → Plugin configuration**, the **Context** card holds this plugin's per-user preferences default trend granularity (Step/Turn), default trend mode (Total/Delta), and the File Activity default sort. In-chart and in-card toggles stay per-view and never overwrite the stored preference.
143
137
 
144
- Fully adapted to DeepSeek Harness 0.1.1's multimodal pipeline and the vision capability of **DeepSeek-V4-Flash-Vision-Exp**. A user message carrying images expands into a card layout — prose in the text card (with the usual raw/Markdown toggle), each image attachment as a thumbnail card in an equal-width two-column grid with its name, normalized dimensions (plus the pre-normalization size when 0.1.1's image pipeline downscaled it), stored size, and **estimated token cost** — priced by DeepSeek's official image-size→token conversion (the docs' image token calculator; 117–384 tokens per image under the provider's per-image cap), the same estimate the message/token breakdowns carry — and anything unrecognized as raw content:
138
+ ![The Context settings card](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/settings.png)
145
139
 
146
- ![Context browser rendering image attachments](https://raw.githubusercontent.com/bowenliang123/dsh-context/main/docs/context-browser-images.png)
140
+ ## Good to know
147
141
 
148
- Images load through the harness's own session-authorized loader the same one the chat history uses — and degrade to metadata-only cards when it is unavailable. Image blocks in assistant messages and tool results (e.g. `read_image` output) now render too, instead of being silently dropped.
142
+ - **Estimates vs actuals** — category figures use dsh's own fixed-density heuristic (the same one as its built-in token meter); the pinned trend details and Token/Timing rings show provider-reported actuals next to them.
143
+ - **Compatibility** — works on `@deepseek-ai/dsh` **0.1.0-rc7+**, **0.1.1-rc2+**, and **0.1.2-alpha1+**; multimodal rendering requires 0.1.1+.
144
+ - **I18n** — UI in English and 简体中文.
149
145
 
150
146
  ## Like it?
151
147
 
package/lib/client.js CHANGED
@@ -4794,7 +4794,7 @@ window.__ModuleLoader__.load({
4794
4794
  return function PluginInfo() {
4795
4795
  const [latest, setLatest] = React.useState(null);
4796
4796
  React.useEffect(() => {
4797
- if ("0.38.0".includes("-dev")) return;
4797
+ if ("0.38.1".includes("-dev")) return;
4798
4798
  let on = true;
4799
4799
  fetchLatestVersion().then((v) => {
4800
4800
  if (on && v) setLatest(v);
@@ -4803,8 +4803,8 @@ window.__ModuleLoader__.load({
4803
4803
  on = false;
4804
4804
  };
4805
4805
  }, []);
4806
- const update = latest !== null && isNewerVersion(latest, "0.38.0") ? latest : null;
4807
- const nameValue = ["dsh-context (v0.38.0)"];
4806
+ const update = latest !== null && isNewerVersion(latest, "0.38.1") ? latest : null;
4807
+ const nameValue = ["dsh-context (v0.38.1)"];
4808
4808
  if (update) nameValue.push(/* @__PURE__ */ React.createElement("span", {
4809
4809
  key: "update",
4810
4810
  className: "lc-pi-update"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context",
3
- "version": "0.38.0",
3
+ "version": "0.38.1",
4
4
  "description": "A DeepSeek Harness plugin for context insight and management, with context dashboard and context command, for understanding how the context is made of, and how it evolves.",
5
5
  "author": "bowenliang123",
6
6
  "repository": {