Commit Graph
338 Commits
Author SHA1 Message Date
bowenliang123 ef8e1d24dd feat(insights): read every card and aggregate at the team scope
The dashboard's row IS the team now: each listed session folds its WHOLE
subagent subtree into itself (all levels, mirroring the Context tab's cost
fold) — subagent-origin sessions never list, so nothing counts twice. The
session card's billed tokens and priced cost (now labeled 团队用量 /
团队费用), the KPI band's volume and spend, the last-7-days usage chart,
and the heatmap all read the family scope: the subtree's cost buckets
merge per row, the daily ledgers merge day by day, and the composition
split proportions each member's OWN composition instead of the root's.
2026-10-07 13:12:52 +08:00
bowenliang123 3dc892c221 feat(context): rebuild the cost card as the Agent Team ledger
The flow's fourth node becomes a three-row team ledger: the family's
billed-token and estimated-cost totals in the header, then one row per
scope — the current agent and the subagent subtree with its session count
— each pairing its billed tokens with the estimated cost (billedTokensOf:
the token face of the same buckets the estimate prices). The subagent
scope is the WHOLE descendant tree, which the copy now spells out; the
rows render unconditionally (a scope with nothing billed reads 0 / —),
and both tooltips gloss the token figure.
2026-10-07 11:53:43 +08:00
bowenliang123 c4ad2e8a9c feat(context): rebuild the Context Stats card as a session flow diagram
The six-cell grid becomes a left-to-right flow: two source cards (Input /
Output — human inputs plus the whole session's file reads/writes, with
searches and image reads when they happen; Context Events broken down by
kind) feed the highlighted Current Session node (turns / steps / subagents
— the subtree's session count, folded from the session list alongside the
cost usage), which drains into the two effect cards (Tool Calls with the
three most-called tools and an overflow pill; Cost with the family figure
and, when a subagent subtree reports, the this-agent/subagents split).
Measured bezier ribbons — a translucent band plus a traveling dash per
element, not a conservative Sankey — connect the nodes and flip to a
top-to-bottom stack when the card narrows past the container-query fold.
2026-10-07 04:23:36 +08:00
bowenliang123 3aed1bd6a2 feat(browser): find-in-text bar for the rich text detail cards
A ctrl+f-style lens scoped to one section, toggled from a magnifier
button beside the copy control: a debounced query (150ms, so rapid
typing or deleting rescans once instead of per keystroke), matches
wrapped as DOM-level <mark> over the rendered body (same lens in raw
and markdown modes, capped at 500 rendered marks with a '+' counter),
Enter/Shift+Enter or the chevrons cycling the active match into view,
Escape folding the bar. The section body remounts on a text change so
React never reconciles over the injected marks; the restore rebuilds
the original text nodes, keeping the copyable source byte-identical.
2026-10-07 02:52:52 +08:00
bowenliang123 fbb00303d9 feat(context): read the occupancy percent at one decimal, off the kernel's own value
The card's reading was the ring's integer (`Math.round`), so a 101.6k /
1.0M session printed 10% while the kernel's own occupancy read 10.2%.

The percent now comes from one shared `occupancyPercent` helper that
mirrors dsh's `contextOccupancy` — the composer ring's derivation
(`min(100, round(used / window * 100))`, `used` = `contextPressure`'s
`projectedTokens ?? pressureTokens`) — on a 0.1 grid, and keeps the
kernel's numerator precedence ahead of the plugin's derived anchor. The
kernel symbol is unreachable from a client plugin (no package export, a
self-registering browser bundle), so the formula is mirrored by
necessity, as docs/compatibility.md now records.

The Agent Network rings read the same helper (whole tenths stay compact
there), and the number row wraps so the wider reading folds to its own
line instead of spilling on the narrowest panes.
2026-10-07 01:00:02 +08:00
bowenliang123 984f31c954 refactor(stats): drop the cache-hit cell from the Context Stats card
The token card's corner already carries the session's cache-hit share
(ef72a7b), so the Context Stats board duplicated it. The grid is now six
cells: turns, steps, human inputs, live tool calls, and the two cost cells.

The removal takes its dead plumbing with it — the card drops its `usage`
prop, and `cacheHitPercent` loses the `decimals` override that existed only
for this cell's one-decimal display. The README rows and the card's
screenshot move the figure to the token card.
2026-10-06 21:36:06 +08:00
bowenliang123 ef72a7bbb2 feat(stats): session cache-hit on the token card, plain rate figure on the timing card
The token card's title row gains the session's cache-hit share in its
right corner — the harness chat line's own reads-over-billed formula,
reusing the stats board's label and tooltip — hidden until something
was billed. The timing card's throughput chip drops its pill chrome and
bold weight, now reading 输出速度 N tok/s (zh) / TPS N tok/s (en) with
the TPS expansion on the tooltip; both corners share a new plain-text
.lc-card-rate style and keep their native-title tooltips.
2026-10-06 21:21:57 +08:00
bowenliang123 96c8b92caa feat(insights): promote the dashboard to a first-level sidebar panel page
The Context Insights surface moves from a sidebar-foot button opening a
frame-wide overlay to a first-level panel, a sibling of the shipped
Plugins and Automation tasks pages: the page registers on the layout's
keyed `main` slot and the entry on `sidebar.panellist` under one id
(`dsh-context`), so the shell owns the entry row and panel switching —
mounting the page IS opening it (no plugin-side open state, the footer
entry, the overlay seat, and the overviewStore all go away). The
`insightsEntry` preference now mounts/unwinds the registration pair.
Both seats ship on every supported line (0.1.5-rc.1+), pinned per
baseline by the new insightPage seam probe; runtime-verified on a
disposable 0.1.5-rc.1 profile.

The chrome mirrors the shipped first-level pages: one scroll region
with the 960px centered column, the 20px page heading beside the range
group and the balance capsule, and the page element as the `lc-ov`
query container. Inline-size containment makes the page the containing
block for fixed descendants, so the heatmap/usage/balance tooltips can
no longer ride the harness Tooltip (its portal prop is 0.1.7+): they
now carry `data-lc-tip` served by the page's own hover tip — one fixed
bubble portaled to <body>, delegated off the page root (the image
lightbox's precedent), correct on every supported line.

Session card jumps need no close (openSession's own navigation returns
to the conversation); the settings row jump unmounts the page by
selecting the Plugins panel. Verified across 1440-390px in both
locales, and the /context modal is untouched.
2026-10-05 11:20:59 +08:00
bowenliang123 84fe1d7038 fix(trend): merge the title's three modifier toggles into one segmented group
The Duration toggle (added in 01b1532) never joined the title-adjacent
zero-margin rule, so its bare .lc-gran kept margin-left: auto and split
the free space with the control cluster — on wide cards it drifted to
the middle of the title row (242px each side at ~930px), and on wrapping
widths it landed wherever the auto margin happened to put it (line 1's
right end in English, line 2's lead at the narrowest).

DNA / Adaptive / Duration now ride the title text's right as ONE
multi-toggle segmented group (.lc-trend-mods), the tips moving from the
group wrappers onto the buttons; the row keeps a single auto-margin push
(the control cluster), so wrapping drops the two semantic groups whole
instead of scattering the modifiers. Also drop the stale "Total/Delta
disables under DNA" note on the disabled-chip rule — no gran button has
been disabled since DNA+Delta shipped.
2026-10-05 07:14:16 +08:00
bowenliang123 2adc9bb355 feat(trend): drop the focused-category subtitle from the trend card 2026-10-04 17:09:29 +08:00
bowenliang123 4dcdfafbef feat(settings): trend duration curve visibility preference (default on)
The Context preferences card gains its eighth row — the trend
duration curve — served across both settings generations: the V3
`settings.register` schema and the V4 Config form (a `.volatile()`
field, so an edit never remounts the entry). The client settings store
parses it fail-open like its neighbours; the trend card's Duration
toggle seeds its mount state from it (default on), and in-chart
toggling stays mount-local and never writes back.
2026-10-04 11:12:50 +08:00
bowenliang123 01b1532b72 feat(trend): duration overlay — each step's active time as a curve over the bars
The trend card gains a title-adjacent Duration toggle: every request's
step active time (`activeMs`) drawn as a curve over the bars, read off
a right-hand quartile axis; turn granularity sums the turn's steps, and
a bar without the figure breaks the line instead of faking a point.

The fold stamps it at `step/end` onto the step's committed request
record: the whole step window (the model call plus its tool runs, per
the agent-loop's in-step `executeToolCalls`) minus the step's user
waits — approval decision intervals (`approval/asked` →
`approval/decided`, a crash-dangling pair closing at the step's own
end) and `ask_user_question` answer windows (the tool's body is the
wait itself, in both the blocking and the timed schema's foreground
phase). Overlapping waits price their clamped union, never twice.

The wire field is additive-optional and bumps the timeline projection's
stateVersion (25 → 26): requests already folded can never gain the
figure later, so cached rows refold from the durable log on upgrade.
2026-10-04 11:12:50 +08:00
quifox 06ec2af4ff fix(client): ignore stale detail reads after refold (#106) 2026-10-04 00:26:35 +08:00
quifox b65939e887 fix(host): fold V4 tool-registry developer messages into the timeline
V4 harness releases log a `developer/message` event whenever the effective tool registry changes mid-session (first shipped in 0.1.7-rc.2): the message nests under data.message with role `developer`, source kind `tool-registry`, and `tool-addition`/`tool-removal` content blocks, lands on the session surface, and the harness's own token meter prices it like any non-system message. The timeline fold had no case for it, so every such message vanished from the plugin's accounting — injection totals, per-request composition, the live surface, and compaction archives under-reported, and the Context tab's numbers could not reconcile with the harness meter or a compaction shadow price.

The fold now treats the event like an injected user message: the nested message is read structurally (the pinned 0.1.5-rc.1 dependency's deriveEventMessage predates the family), the node prices through the shared estimator with the harness's empty-content-is-zero rule, and the injection record takes the producer kind as its label. Developer messages never count as human inputs whatever a hostile source claims; malformed payloads leave the state reference-equal.

stateVersion 24 -> 25: earlier cached rows omitted these nodes and later events cannot recover them, so on upgrade every timeline row refolds once from the durable log (the dashboard warm-up rebuilds idle sessions). The wire shape and durable logs are unchanged. The V4 baselines now carry the event family, and the real-source compat matrix asserts surface tokens, request composition, warm restore, and a v24-row rebuild on both supported V4 lines.

Validation: 102 test files / 1,910 tests with per-file coverage 100%; the real-source matrix passed for 0.1.5-rc.1, 0.1.7-rc.2, and 0.2.0-rc.2; GitHub PR checks green (486069f fixed the workflow's pnpm setup that had failed every external PR at its first step).
2026-10-04 00:03:27 +08:00
bowenliang123 0ece2c85ec fix(attribution): peel per-read traced proxies to the stable tools instance
Cordis hands out a fresh traced proxy on every ctx.tools property read of a
tracked Service (ToolRuntime is one), each closing over the reader's context.
The hook keyed its WeakSet dedupe on the proxy identity, so every read
re-wrapped and pinned one restore closure per read — patched[] then retained
each caller's whole agent (scope tag -> agent -> session log) past disposal,
and the unload restore guard (instance.register === wrappedRegister) never
held through a traced proxy, leaving the dead wrapper on the shared service.

Peel to the stable underlying instance before dedupe/patch/restore (the
handler still returns the caller's own proxy, keeping scoped registration
this-binding), record the reader as a scalar fiber name instead of the
reader Context, and add a tracked-service regression test: single wrap
across reads, live scoped attribution, and restore on unload. #108
2026-10-03 10:49:43 +08:00
bowenliang123 4136d0e565 fix(timing): open the decode window at the first marker, not the first token
A redacted reasoning block leaves no chunk behind, so the first token
lands after the reasoning window — pricing ttftMs/genMs off the token
charged the marker-tiled decode window to the wait as well, and the
legend's rows summed past 100%. The wait/generation boundary now sits
at the first observable instant (the earlier of the first token and the
first block marker), the same boundary the strip's spans already paint;
the TPS chip keeps the first-token anchor for harness parity.
stateVersion 23 → 24 refolds cached rows with the corrected totals.
2026-09-30 23:53:59 +08:00
bowenliang123 301b3d8ea5 test(timing): fit the 2_000-span cap test in the CI 5s timeout
Folding 1_001 sparse steps (3_003 events, each flushing into the growing
spans array) passed locally but timed out on the release runner. Drive 41
denser steps instead — 50 spans each via a 48-marker decode run — so the
same 2_050 → 2_000 tail-cut assertions hold on 25x less fold work.
2026-09-30 21:28:09 +08:00
bowenliang123 9bec22959b feat(timing): the session-time strip — the session's active time as one packed band
The timing card gains a bottom band that reads where the session's ACTIVE
time went: every completed step's slices — the TTFT wait, the decode blocks
in stream order, the tool-run windows, and the in-step residue — packed
gapless in occurrence order, each band's width its share of the cumulative
active time (idle time between steps takes no track), with ticks at zero,
the quartiles, and the full span.

Host: the fold tiles each step at step/end (clamped into the step window,
first-wins de-overlap so parallel runs paint their union, holes filled with
the residue kind) into a new spans collection — bounded to the newest 2,000,
riding the detail channel and the inline view, never the slim head. The
decode window anchors at the first OBSERVABLE instant (the first token, or
an earlier block marker the token packing could not stamp), so a redacted
reasoning block keeps its span instead of being swallowed by the wait.
stateVersion 22 → 23: the per-step collection cannot be backfilled by later
events, so cached rows refold from the durable log.

Client: the strip joins the card's hover link by KIND — a band hover lights
every span of its kind plus the donut arc and the legend row, and the
floating tip answers only the strip's own pointer (the mirror rule).
2026-09-30 17:56:09 +08:00
bowenliang123 811bb14957 fix(trend): hover off the DNA+delta arms shows the delta row, not the churn as a total (#96)
In DNA+delta combo mode the tooltip's no-band fallback read
tip.total over the delta record, whose total IS the churn —
the label claimed a total while the figure was the change
magnitude (and a zero-churn bar showed 'Total ≈ 0' anywhere).

The band lookup now sits ahead of the mode branches: a hover
with no band under the pointer falls through to the mode's own
row — the shared delta row (fmtSigned of the net) in delta
modes, the total row otherwise. The delta branch reuses
fmtSigned instead of its inline sign formatting.
2026-09-30 12:21:15 +08:00
bowenliang123 dc11a0bb9c feat(browser): link the DNA toggle with the trend card — one switch, both cards
The DNA on/off state lifts no further than it already sat: the Context
tab's `dna` state now feeds the Context browser through a controlled
pair of props (dna + onDnaChange), so toggling either card's switch
moves the other — the trend bars and the browser's composition bar
become fingerprints together, and drop back together.

The browser stays self-contained where no parent links it: the pair is
controlled only when BOTH props arrive, a lone `dna` prop is ignored,
and the /context modal keeps its mount-local toggle (the established
optional-seam idiom).
2026-09-30 01:33:46 +08:00
bowenliang123 8f2fcf7903 feat(trend): combine DNA mode with Delta — per-item change around the zero line
DNA and Delta are orthogonal now: the Total/Delta switch stays live under
DNA, and delta diffs each bar's bands against the previous bar's by key
(deltaBandsOf, dna.ts) instead of diffing category totals. Newcomers and
grown items ride the up arm in read order, removed and shrunk items hang
on the down arm in the previous bar's read order, and unchanged items
vanish from both — the first bar carries no change at all, mirroring the
record delta so the axis stays change-driven.

DnaDeltaBar renders each bar as ONE gradient div spanning both arms
around the zero line (down arm reversed bottom-up, then the up arm),
absolutely positioned like the segmented delta arms, with the entrance
rise anchored at the zero line via a per-bar transform-origin. The
cross-bar lifetime highlight becomes a dumb resolved-slice layer both
DNA flavors feed; the tooltip shows the signed per-item change; band
clicks reveal the item in the Context browser through the same bridge
in both flavors. Adaptive rescaling measures the band arms and
re-measures on any mode flip so the axis never rides a stale scale.
2026-09-30 01:09:42 +08:00
bowenliang123 3759e39275 feat(trend): reveal a band's item in the Context browser on click
A click inside a DNA bar hit-tests the same pointer-to-band mapping the
hover uses and lifts (bar seq, band) to the view, which forwards it
through the browser's one-shot reveal bridge: the browser switches off
the live surface to the bar's step, opens the item's category and
element row, and scrolls it into view. The bar's own click still pins
the step in the detail panel, and both land on the same seq.

The nodeFocus bridge generalizes from message-only (seq) to the band
keys both DNA surfaces share — 'sys' (system prompt), 'tool:<name>'
(a tool schema), 'n<seq>' (a message) — so header bands and message
nodes reveal through one path, and the step-brief / file-activity
locates convert to the same keys. The reveal now also clears the row
lens, so a stale filter can no longer hide the revealed row (the
brief flow had the same latent trap).

DnaBar's hit-test becomes a total function: the first visible band
starts at off 0 (leading zero-token bands advance nothing) and the
pointer fraction clamps into [0, 1], so a hit always exists.
2026-09-30 00:17:19 +08:00
bowenliang123 31ae13aa92 feat(icon): monochrome emblem seat for the sidebar-foot entry
The Context Dashboard entry now renders the document sheet in the
surrounding text colour instead of the six-colour palette, so it sits
quietly beside the harness's own footer rows. The identity seats (tab
chip, command, sidebar registration, panel head) keep the polychrome
default; the package icon.svg is untouched.

Closes #95
2026-09-29 23:48:28 +08:00
bowenliang123 6a6e292f2b feat(trend): DNA mode for the trend chart bars
Each bar redraws as that request's context fingerprint — ONE gradient
div paints the assembled items in read order (system prompt, tool
schemas, then messages by seq), coalescing adjacent same-color bands,
so thousands of bars cost the same DOM as the segmented stacks.

Hovering a band lights its lifetime slice in every bar at once (the
items' keys are stable across requests), and the tooltip names the
item via the label core shared with the browser's DNA mode
(dnaBaseLabel). The toggle rides the title's right, left of the
adaptive switch; the Total/Delta switch suspends while DNA is on —
DNA plots absolute composition, and a stale 'delta' state degrades to
total semantics instead of emptying the chart. The browser category
focus is ignored (the bands already are the full composition).

Bands are built per displayed record with the same pure client-side
assemble() reconstruction the Context browser uses, memoized on the
timeline so hover re-renders never reassemble. Host-side is untouched
— no wire or protocol change.
2026-09-29 23:32:44 +08:00
bowenliang123 74117d8ae5 feat(compat): support dsh 0.2.0-rc.2 as a third baseline
Add dsh-v0.2.0-rc.2 to the supported set alongside the 0.1.5-rc.1 and
0.1.7-rc.2 lines: the manifest's dshReleases, the baseline matrix, the
release workflow's tag fetch, and the compatibility docs.

Every seam the plugin rides is spelled as at 0.1.7-rc.2 - the projection
registry contract, the platform module table, the right Sidebar seats and
guide-entry contract, the session-jump verb pair, the detail channel RPC
faces, the Plugins page card slot over the configForms transport, the
balance settings faces, the step-boundary guard, and the durable event
vocabulary (still the V4 log generation, no v4-to-v5 migration). Cordis
stays 4.0.4 and the dsh peers stay >=0.1.5-rc.1.

Verified on the new tag: all 25 compat-matrix probes pass against the real
harness sources and the vendored cordis, `pnpm run lint:fix && pnpm run
test && pnpm run build` is green (1837 tests, 100% per-file coverage), and
on a disposable DSH_HOME the 0.2.0-rc.2 CLI installs dsh-context@0.60.0
into exactly one composed config row and removes it back to zero.

Also refresh the docs' verification stamp (plugin 0.58.0 -> 0.60.0).
2026-09-29 19:38:55 +08:00
bowenliang123 6bf3de8cde feat(settings): default delta baseline preference for the Context browser
A 'Context Browser · Diff baseline' row leads the tool-sort preference:
'prev step' (default) or 'prev turn', reusing the toolbar's vocabulary.
The browser's baseline toggle mounts from the persisted value; in-toolbar
toggling stays mount-local. Served through the settings namespace schema
and the Config-form generation, degrading to the default on stale values.
2026-09-29 18:52:36 +08:00
bowenliang123 db81a6e60a feat(browser): pick the delta baseline — previous step or previous turn's last step
Replace the fixed 'vs previous turn' hint with a baseline toggle (default:
previous step). A predecessor-less step or live surface diffs against zero,
so the whole makeup reads as change; on live, 'previous turn' measures this
turn's growth so far. The step picker options drop their time suffix.
2026-09-29 18:20:30 +08:00
bowenliang123 67787685fe test(browser): cover the cold start, failure surface, and pushed takeover
Add useTimelineSource cases for the cold read rendering from its own slim
head, the retry after a failed/absent/headless cold read, and a pushed head
taking the shared per-session store back. Surface the retryable failure note
in the Context tab and /context modal specs, isolate the page-lifetime
detail stores between tests, and record the no-stall contract in
docs/compatibility.md.
2026-09-29 17:10:36 +08:00
bowenliang123 9ec53289ba fix(browser): rename the Response section head to Answer
Align the assistant text section head with the Answer filter capsule
term, matching dsh's finalized-answer vocabulary for the non-thinking
reply content.
2026-09-29 10:43:37 +08:00
bowenliang123 079f284e6e fix(browser): make tool-name capsules inert
A tool-name capsule — a row tag (tool results, call breadcrumbs) or a
call head (→ bash, ← bash) — no longer clicks through to the tool's
definition row in the Tool Schemas category: the schema reveal from
5a62b2b is removed whole (the reveal jump, the onSchema threading, the
Section label click affordance, the hover-link styles, and the tooltip
key in both locales). The ×N call-name grouping stays — one capsule per
distinct call name, repeats folded into a multiplier — as plain tags on
the row button, so a tag click bubbles to the row's own toggle.
2026-09-29 10:27:55 +08:00
bowenliang123 647bf7bd08 feat(browser): scan reasoning blocks in the assistant row filter
The assistant search box scanned the tag, preview, and the node's
stamped text — the reasoning blocks live only on the conversation join,
so thinking text was unsearchable. Derive one concatenated reasoning
face per assistant row (both block vocabularies, malformed blocks drop)
and scan it alongside the other faces; the placeholder names the new
face in both locales.
2026-09-29 02:31:39 +08:00
bowenliang123 284eaf9a08 feat(browser): group call-name capsules by name with a ×N multiplier
A call breadcrumb no longer renders one capsule per call joined by '›'.
The names group by identity: one capsule per DISTINCT tool in
first-appearance order, repeats folded into a multiplier ('bash ×3'),
each capsule still clickable to reveal the tool's schema. The row's tag
slot becomes a shrinkable capsule group, and the hover affordance moves
from the inner segment to the whole capsule. The tag's scan text keeps
the raw joined names, so the text filter still matches every call.
2026-09-29 02:26:34 +08:00
bowenliang123 5a62b2b306 feat(browser): tool-name capsules reveal the tool's schema row
A tool-name capsule — a row tag (tool results, call breadcrumbs) or a
call head (→ bash, ← bash) — is now clickable and reveals the tool's
definition row in the Tool Schemas category: the category opens
unfiltered, the named row expands, and a one-shot scroll lands on it
(the same reveal the DNA bands use). A breadcrumb renders one clickable
segment per call; its segment click stops propagation so the row toggle
cannot overwrite the reveal. Tags that do not name tools stay inert.

Hover affordances: tag segments lift to the primary label on the shared
interactive hover face; call heads shift to the brand face + underline.
2026-09-29 02:21:07 +08:00
bowenliang123 0ddef0761f fix(browser): recover the call breadcrumb on mixed text+calls assistant rows
The fold stamps SurfaceNode.calls only on text-less replies, so a reply
carrying both text and tool calls passed the Tools kind filter (proved
via the conversation join) but showed no tool name on its collapsed row.
Fall back to the join-derived call names for the row tag — the same
recovery the step brief applies — so every row the Tools filter keeps
carries its tool breadcrumb.
2026-09-29 02:07:00 +08:00
bowenliang123 f099cd9c88 feat(browser): filter assistant messages by content kind with per-kind counts
The assistant category's search box gains Thinking / Tools / Answer chips, each carrying the shown step's message count; clicking one keeps only the replies carrying that kind (intersected with the text query), clicking again clears, and the pick follows the text filter's lens rules (reset on a category switch, kept across step picks). Kinds classify from the conversation join's blocks (reasoning / tool-call / text, legacy content joins included) and fall back to the surface node's calls/text when the join misses.
2026-09-29 01:52:44 +08:00
bowenliang123 a5dff08fd4 fix(cost): count a seeded fork's cost from its own seed cut
A seeded fork (a dsh-better-sidebar Side tab, a subagent_fork child,
a UI fork) replays its parent's event log verbatim, usage settlements
included, so its cumulative cost fold re-priced history the parent
session had already booked - a family of idle Side tabs billed the
parent's whole history again (#94).

The fold now zeroes the session-cost totals at the tagged
`session/end-seed` marker the session core stamps at the inherited
cut, in both projection units: the timeline's cost book and the
activity day ledger (whose armed step slot dies with the cut, so a
child settlement cannot attribute to a parent day). Untagged resume
markers reset nothing; nested seeds re-mark at their own cut, so a
session's totals are always its own post-seed spend. stateVersion
bumps (timeline 22, activity 3) refold cached rows from the log on
upgrade.
2026-09-28 22:19:40 +08:00
bowenliang123 94db113732 feat(stats): open the models.dev provider listing from the cost cell
When one models.dev provider priced the whole scope, the cost cell
renders as an anchor opening https://models.dev/providers/<pid>/ in a
new tab — the natural "check these rates" follow-up to the tooltip's
listing lines. A multi-provider scope stays unlinked (the tooltip names
each face instead), and the anchor reuses the framed cell chrome with
the link chrome reset.
2026-09-28 18:36:32 +08:00
bowenliang123 1b1c811738 feat(stats): revamp the cost tooltip around the resolved listing face
The cost and subagent-cost tips render a per-model price table: each
billed model lists its non-zero bucket rates at two decimals, closed by
a line naming the registry face — the models.dev provider id and model
id — its rates resolved from, so a gateway route prices visibly against
its actual carrier (the confusion behind issue #93). priceFaceOf
carries that face out of the resolution: resolution candidates keep
their branch model id, the branch lookup returns its hit, and priceOf
delegates to the face. The peak|off pair display gives way to the
peak-window footnote, and the CNY conversion note rides the CNY display
only.
2026-09-28 18:30:35 +08:00
bowenliang123 ee236f21a1 fix(cost): price deepseek- model ids from the first-party branch first
A gateway provider id outside the models.dev registry falls back to the
model-side resolution, where azure's self-named SDK package won
`deepseek-v4-pro` and its flat listing (no cache_read published) billed
cache hits as plain input at 4x the official input rate (issue #93). A
`deepseek-` model id now prices from DeepSeek's own registry branch
first — the same first-party specialness the peak/off-peak split
already grants DeepSeek — and falls back to the model-side tiers when
the first party does not list the id.

Fixes #93.
2026-09-28 17:38:11 +08:00
bowenliang123 66d0b2ba5d feat(overview): scroll the panel content as one under a fixed head
The KPI band, the aggregate stats row, and the 3:7 body now share one
scroll region (.lc-ov-scroll) under the fixed head; the columns drop
their own scrollers and keep natural heights (align-items: start), and
the folded width's whole-card scroll branch goes away with them.
2026-09-28 14:24:13 +08:00
bowenliang123 8263f2eadb feat(overview): add a 7-day usage chart and split the first row 1:1
The dashboard's first row becomes a 1:1 column pair: the KPI band's six
figures (three per row) beside a new last-7-days usage chart whose card
stretches to the same height. Each day pairs a billed-tokens bar (the
heatmap's blue) with its priced fee (green), folded off the merged daily
ledger and priced by the same book and estimator as the KPI cost cell —
per-turn attribution, never the session's last-active day. The plot is
framed like a chart: hairline gridlines at quarters of each series' own
peak, a solid baseline, tick rails on both sides (tokens left, cost
right, dashes while nothing prices), and a day strip mirroring the
columns' flex geometry. The pair folds to one column at 932px of
container and the KPI grid to 2x3 at 640px; the bars' box keeps a
min-height floor so percentage heights survive the folded single-column
row. The cost legend qualifies its scope (price-mapped models only)
while the tooltip line stays bare.
2026-09-28 13:45:08 +08:00
bowenliang123 1935492d93 feat(activity): fold per-day pricing records into the contextActivity ledger
Each metered settlement now books its billed buckets into its day under
the (provider, model, period) in force — the same SessionCostUsage raw
material the timeline's session-cost totals carry, attributed to the day
the open step INITIATED (step/start armed, step/end cleared, settlement
instant as fallback) so fees land on the turn's own calendar day. The
fold tracks the route in force (last request/header wins) and splits
DeepSeek peak/off-peak off the same instant, so its per-day records
price identically to the session-cost totals. stateVersion bumps 1 → 2:
the dashboard's warm-up cold-refolds every stale row from the durable
log on upgrade. The client's activityOf re-proves the additive-optional
record with the same sanitizer the session-cost rides — a malformed
record drops the fee whole and keeps the day's tokens.
2026-09-28 13:44:25 +08:00
bowenliang123 6dabe813d7 fix(cost): price subscription and proxy routes through a model-side vendor index
dsh provider route keys are arbitrary strings (subscription plugins
register 'claude'/'codex', users declare gateway profiles), while the
models.dev registry is keyed by vendor slugs — so every session billed
through such a route fell to the cross-provider scan, which priced only
when exactly one branch carried the model. The Cost tile dashed
hundreds of sessions whose model ids match models.dev exactly
(issue #91): claude-* resolves under 9-20 resellers, gpt-* under 20.

pricesBookOf now also extracts each provider's registry npm package and
builds a resolution index over the book (cost.ts priceIndexOf): every
model id lands under its lowercased key and its '-'-suffix tails, so a
provider the book does not know prices by model id alone. The vendor
branch is picked from registry data, never a per-model hardcode:

- 'vendor/model' dialects: the org segment names the vendor (exact, or
  the registry id behind a variant org — deepseek-ai -> deepseek),
  falling back to the bare last segment;
- the model's own vendor: a provider whose @ai-sdk package is named
  after itself (@ai-sdk/anthropic -> anthropic) — mirrors and gateways
  ride the generic openai-compatible package or someone else's;
- a provider the id itself names (deepseek-v4-flash -> deepseek),
  matching '-' and '/' separators;
- a lone carrier, as before.

Each tier takes only a unique or unanimous rate (float-noise tolerant);
disagreeing candidates price nothing rather than guess. A provider the
book DOES know still never falls back — known branches stay
authoritative.

The rename table gains only 'deepseek-account' -> 'deepseek': the
native account route shares DeepSeek's period-based list, so the fold
now splits its peak/off-peak buckets too (stateVersion 21 refolds
cached rows that booked everything under 'peak').

Measured against the live models.dev dump over dsh's real vocabulary —
both native routes, every llm-pi-ai catalog route x its catalog models,
and issue #91's subscription/proxy ledger routes (1397 pairs, 49
routes): priced pairs 931 -> 1157 (+24%), routes with at least one
priced model 35 -> 47, with zero regressions and zero rate drift
against the old resolution; issue #91's routes go 0/35 -> 35/35.

The Cost KPI sub-line now reads 'N of M sessions priced' so unpriced
sessions are visible instead of reading as the full count (also #91).
Bumps @opencode-ai/models consumption onto the refreshed registry.

Fixes #91
2026-09-28 02:37:30 +08:00
bowenliang123 33ce976996 feat(trend): plant a step-number flag on every 5th step bar
The step-granularity chart had no position landmark along its column
grid (the turn strip numbers turns, not steps). Every 5th bar now
plants a flag at its right edge: a 1px pole rising from the baseline
into the top padding band, the bar's cumulative step number boxed at
the pole's top and streaming left over its own bar, so the banner
never contributes to scrollable overflow at any step count. Turn
granularity plants none (the turn strip already numbers that grid);
the flag renders under the scissors glyph on a same-bar collision.
2026-09-28 00:07:46 +08:00
bowenliang123 423ea4f2ac fix(host): read the balance facts through both settings generations
The 0.1.7 line's SettingsForms service retired the `get(ns)` section
read, so the balance route never resolved the DeepSeek API key on V4+
deployments and the capsule stayed hidden. deepseekSectionOf now folds
over whichever face the running line serves: the registered
`llm-deepseek` section through V3, and on V4+ the Config-form
`describe()` projection, matching the provider's row by its own
apiKeyEnv-bearing section shape and preferring the settings ids the
generations have served it as. Rows fold in isolation, and a describe
that throws is no section — the capsule still arms nowhere it cannot.
The per-baseline `balance` probe pins the settings face and the
provider row's sources against each tag's real sources.
2026-09-27 02:15:38 +08:00
bowenliang123 7ce259384f feat(overview): lead Context Insights with a full-width KPI metrics band
The panel's first row is now the range's six KPI figures in one
full-width line, lifted out of the insight column; the aggregate Token
and Timing Stats pair moves below it, and the 3:7 body keeps the
activity heatmap and the preferences entry beside the session column.
The band folds 6 -> 3x2 at 1000px of container and 2x3 at 640px, so no
cell ever ellipsizes its figure.
2026-09-27 00:44:43 +08:00
bowenliang123 17724b663d feat(overview): open Context Insights with aggregate Token and Timing Stats
The panel's first row folds the range's sessions into the two donut cards
the per-session Context tab opens with. Token Stats splits the billed
volume by the SAME composition categories: each session's billedParts
estimate sums by category (output exact), and the center total stays the
merged billed figure the Tokens Used cell shows. Timing Stats reuses the
per-session card verbatim over a summed TimingTotals whose additive-
optional decode-split and throughput fields sum their carriers only, so
older cached rows keep the un-split shape and no-chip fallbacks. The pair
sits at half width over the 3:7 body and folds to one column at 700px of
panel width.
2026-09-27 00:04:46 +08:00
bowenliang123 646344162a fix(client): jump to sessions through the view owner's navigation verb (issue #90)
dsh's 0.1.6 selection refactor moved session selection to the view owner:
uiWorkspace.openSession is the verb the built-in sidebar's row click uses,
and the sessions service no longer carries open(). The plugin's jump (the
Context Dashboard's session cards and the Agent network card's nodes) still
called the retired sessions.open spelling, so on 0.1.7-rc.2 the panel closed
but no session opened — silently, by the verb's fail-soft design.

One shared openSessionVia (services.ts) now serves both call sites: it
re-proves both faces per call, prefers the view owner's verb (invoked bound
to the service instance), and keeps the retired sessions.open as the
degradation path. The per-baseline sessionNav seam pins both spellings
presence-as-declared in the real-code matrix, and the always-on client-face
probe drives the jump through each generation's exact composition (the V4
baseline serves no sessions-side selection at all — the exact shape issue
#90 died on).
2026-09-25 21:37:32 +08:00
bowenliang123 7d5c721b3d feat(client): rename the settings jump copy to "Open plugin settings"
The plugin.settingsOpen hint - the Plugin Info card's row value and
tooltip, and now the insights panel's settings row hint too - read
"Open preferences" / 打开偏好设置; both locales now name what the jump
actually opens, this plugin's own settings page ("Open plugin
settings" / 打开插件设置), not the shell's preference center. The two
settingsCard comments quoting the jump's label follow.
2026-09-25 01:50:57 +08:00
bowenliang123 aeb1eb2489 feat(client): put a settings entry under the activity card
The Context Insights panel's insight column now closes with a framed
settings row: the plugin gear plus the localized jump hint, styled as
the column's third card (the session-card hover). The click rides the
same guarded preferences jump as the Plugin Info card's row
(settingsJump.ts) and closes the overlay with it - the jump drives the
shell chrome behind the panel, so staying open would hide its landing.
The panel spec drives the jump end-to-end against a simulated
Plugins-page chrome, from the panel-entry click to the card-open
control.
2026-09-25 01:50:23 +08:00