dsh-trajectory-traceview-plus 0.0.0-stage → 0.11.0
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.
- package/CHANGELOG.md +62 -0
- package/LICENSE +21 -0
- package/README.en.md +318 -0
- package/README.md +337 -2
- package/cordis.patch.yml +10 -0
- package/docs/DESIGN.md +7797 -0
- package/docs/PROVENANCE.md +149 -0
- package/lib/client.js +5551 -0
- package/lib/index.js +6 -0
- package/package.json +67 -4
- package/screenshot/overview.png +0 -0
- package/scripts/bench-fold.mjs +141 -0
- package/scripts/browser-check.mjs +75 -0
- package/scripts/browser-harness.mjs +162 -0
- package/scripts/build-client.mjs +96 -0
- package/scripts/doc-heading-check.mjs +66 -0
- package/scripts/doc-ref-check.mjs +94 -0
- package/scripts/provenance.mjs +197 -0
- package/scripts/readme-numbers.mjs +157 -0
- package/scripts/release-status.mjs +92 -0
- package/scripts/version-check.mjs +105 -0
- package/src/00-locale.js +366 -0
- package/src/10-styles.js +321 -0
- package/src/20-fields.js +21 -0
- package/src/30-helpers.js +2627 -0
- package/src/40-view.js +2130 -0
- package/src/50-entry.js +61 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.11.0 — 2026-11-24
|
|
4
|
+
|
|
5
|
+
`engines.dsh` 从硬钉单一版本改为**已验证版本的区间**,插件不再因为宿主小版本升级就被整体跳过。
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- `engines.dsh`: `=0.2.2-rc.2` → `>=0.2.2-rc.2 <0.2.3-0`。覆盖 0.2.2 线上的 rc.2/rc.3/rc.4/rc.5 与正式版;**不跨 minor**,0.2.3 起仍需重新验证并跟版。
|
|
10
|
+
- 版本号段规则补一条:区间内放宽属 **minor**,因为它是兼容策略变更,不是纯修复。
|
|
11
|
+
|
|
12
|
+
### Why
|
|
13
|
+
|
|
14
|
+
0.10.0 在 dsh 0.2.2-rc.5 上**整个页签消失**——`=0.2.2-rc.2` 精确匹配拒绝 rc.5,宿主直接跳过该 bundle。这是硬钉的代价,而硬钉原本是为了诚实(只声明实测过的版本)。
|
|
15
|
+
|
|
16
|
+
现在两者兼顾:区间**只覆盖实测过的线**,并且实测证据是逐包比对的,不是"启动没报错"——
|
|
17
|
+
|
|
18
|
+
- 本插件绑定的四个宿主包在 rc.2 与 rc.5 之间**逐字节相同**:`dsh-client-locale`、`dsh-api-session-controller`、`dsh-client-ui-conversation`、`dsh-client-ui-trajectory`(以及 `dsh-client-modules/lib/client.js`、`dsh-client-store`)。
|
|
19
|
+
- 唯一有差异的 `dsh-client-ui-primitives` 是纯增量(新增三个 `IconUploadOutline*` 导出),本插件没有 `require` 它。
|
|
20
|
+
- rc.3 的升级项是错误码 `MALFORMED_RESPONSE` → `CONTENT_REFUSED`:本插件不硬编码任何错误码,读的是 `node.code` / `failure.code` 并原样展示(`src/30-helpers.js`)。
|
|
21
|
+
- rc.4 的升级项是 web search 默认提供方,与本插件无关。
|
|
22
|
+
- **真机实跑**(rc.5,web profile,真实会话 216 个站点):视图渲染、minimap、详情面板、站点跳转、复制锚点、KPI、时钟时间全部正常,无渲染错误;`browser-check` 47 条断言全过;`npm run check` 7 步全过。
|
|
23
|
+
|
|
24
|
+
### Verified on
|
|
25
|
+
|
|
26
|
+
dsh 0.2.2-rc.5(本机全局安装)、Node v24.22.1、macOS。
|
|
27
|
+
|
|
28
|
+
### Notes
|
|
29
|
+
|
|
30
|
+
- 0.2.3 及以后仍会被跳过。这是有意的:新 minor 意味着新局面,需要重新验证。被跳过时宿主日志会说明原因;临时放行用 `dsh plugin allow-version`(精确版本豁免)。
|
|
31
|
+
- 已发布到 npm 的 0.10.0 仍带旧钉版声明,需要本版本才能在新宿主上加载。
|
|
32
|
+
|
|
33
|
+
## 0.10.0 — 2026-11-22
|
|
34
|
+
|
|
35
|
+
First npm release of **dsh-trajectory-traceview-plus**, derived from AFAP/dsh-trajectory-traceview v0.3.0 (MIT).
|
|
36
|
+
|
|
37
|
+
### Included
|
|
38
|
+
|
|
39
|
+
- Replayable horizontal timeline, minimap, turn navigation, loaded-window search, follow mode and history pagination.
|
|
40
|
+
- Stable event anchors and deep links; orphan tool-result stations; clock-axis display.
|
|
41
|
+
- Step/tool timing, token usage, prompt changes, raw-request inspection and Markdown export.
|
|
42
|
+
- Hardened request matching, streaming projection, malformed-input handling and unique UI identities.
|
|
43
|
+
- Accessible named panel region and responsive layouts checked at 390–1440px.
|
|
44
|
+
- Unified package/repository identity; corrected contributor build instructions.
|
|
45
|
+
|
|
46
|
+
### Compatibility and validation
|
|
47
|
+
|
|
48
|
+
- Requires **DSH 0.2.2-rc.2 exactly** and **Node.js >=24.9.0**; browser-only plugin.
|
|
49
|
+
- Build/provenance consistency, smoke regression tests and browser behavior checks were run before release.
|
|
50
|
+
- Review history: `docs/DESIGN.md` §§13.28–13.31; upstream attribution: `docs/PROVENANCE.md` and `LICENSE`.
|
|
51
|
+
- Manual screen-reader/touch testing and an exhaustive dark-theme contrast audit remain unverified. Automated clipboard checks verify the write path, not OS clipboard read-back.
|
|
52
|
+
|
|
53
|
+
### Recovery
|
|
54
|
+
|
|
55
|
+
- Disable/uninstall the Plus bundle if needed. It is a local read-only view and does not own session data.
|
|
56
|
+
- A faulty published version requires a new corrected version or npm deprecation; do not rely on npm unpublish as rollback.
|
|
57
|
+
|
|
58
|
+
Earlier development changes are recorded in `docs/DESIGN.md` and Git tags v0.9.1–v0.9.29.
|
|
59
|
+
|
|
60
|
+
### Notes on provenance
|
|
61
|
+
|
|
62
|
+
`docs/PROVENANCE.md` was regenerated after adding this file. The published bundle is byte-identical to the artifacts that passed the full gate run and browser behavior checks recorded in `docs/DESIGN.md` §13.31.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AFAP
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# 轨迹视图 · Trace View
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="README.md">中文</a> · <b>English</b>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
> **Render the AI execution flow of a DeepSeek Harness Web GUI session as a replayable, horizontal timeline — every step's actions and every raw request sent to the model, laid out in front of you.**
|
|
8
|
+
> Built for learning and tuning prompts: wondering why the AI answered that way? Open Trace View to see what it reasoned about, which tools it called, what results it got, and the actual message payload it saw at the time.
|
|
9
|
+
|
|
10
|
+
**Version baseline**: forked from upstream `v0.3.0` (commit `2d1d07d`, 2026-08-26). Upstream has not released since (three commits in total). This repository has evolved independently from `0.4.0`, so **the version numbers are no longer comparable to upstream** — do not read `0.9.x` as an upstream version. Per-file and per-function provenance lives in [`docs/PROVENANCE.md`](docs/PROVENANCE.md) (auto-generated). Versioning rules: [§11](#11-versioning).
|
|
11
|
+
|
|
12
|
+
> **This is the Plus edition, not upstream.** Built on [AFAP/dsh-trajectory-traceview](https://github.com/AFAP/dsh-trajectory-traceview) (MIT): every upstream capability is kept, plus stable anchors, orphan tool-result stations, inline durations, a clock axis, and an explicit search-scope badge. **Do not install both** (you would get two "Trace View" tabs) — run `dsh plugin --profile web remove dsh-trajectory-traceview` first.
|
|
13
|
+
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](https://github.com/MisonL/dsh-trajectory-traceview-plus/releases)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. The problem it solves
|
|
20
|
+
|
|
21
|
+
Reconstructing "how did the AI actually execute this session?" with the built-in trajectory tab means flipping through a bare event list; and "what exactly was sent to the model for that request?" (system prompt, tool catalog, rebuilt messages) is invisible — the data lives in the session's internal state with no picture to look at.
|
|
22
|
+
|
|
23
|
+
This plugin adds a "**Trace View**" tab right next to the "轨迹" tab, rendering the same session state as an **interactive, searchable, exportable horizontal timeline**:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
session trajectory (views.get("trajectory") snapshot — reuses official data as-is)
|
|
27
|
+
│
|
|
28
|
+
├─ top minimap: time-ordered station blocks, click to jump
|
|
29
|
+
├─ horizontal timeline: real wall-clock labels, ◀ ▶ step-by-step replay
|
|
30
|
+
├─ bottom [Step Detail]: reasoning / tool args / full results / sub-calls / timings
|
|
31
|
+
├─ bottom [Raw Request]: the full context sent to the model for that step (prompt study)
|
|
32
|
+
└─ header KPIs: turns / steps / tools / errors / duration / tokens + 📋 one-click Markdown
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Read-only**: it only re-renders the `TrajectorySnapshot` the session view has already produced; no file is modified, no network is touched, and the host half is a no-op stub.
|
|
36
|
+
|
|
37
|
+
## 2. Features
|
|
38
|
+
|
|
39
|
+
Each item is tagged **〔upstream〕** (present in upstream v0.3.0) or **〔Plus〕** (added or changed here).
|
|
40
|
+
|
|
41
|
+
### Flow overview
|
|
42
|
+
|
|
43
|
+
- ✅ 〔upstream〕 Horizontal timeline + top **minimap**: one color block per station (user=blue / step=green / tool=orange / compaction=purple / error=red / retry=yellow / command=cyan); click a block to jump instantly; the current station is highlighted during replay.
|
|
44
|
+
- ✅ 〔upstream〕 Full event stream: user messages, assistant steps, tool calls, **context compaction**, **turn failures**, **model retries**, **max-output cutoffs** and **commands** all land on the timeline in time order; compaction / command events are pinned to their owning turn by `seq`.
|
|
45
|
+
- ✅ 〔upstream〕 KPI bar: turns / steps / tool count / errors / total tool time / request & generation tokens, a live "current step" indicator, and the active model name.
|
|
46
|
+
- ✅ 〔upstream〕 Stations are labeled with **real wall-clock time** (not event indexes).
|
|
47
|
+
|
|
48
|
+
### Finding what you want
|
|
49
|
+
|
|
50
|
+
- ✅ 〔upstream〕 🔍 **Search**: filter stations by tool name / args / body text / error name; hits get a gold outline plus a minimap highlight; `Enter` / `Shift+Enter` or `↑` `↓` step through hits; `/` or `f` focuses the search box, `Esc` clears.
|
|
51
|
+
- ✅ 〔upstream〕 **⇤ / ⇥ turn jumps** (PageUp / PageDown): hop between turn start points.
|
|
52
|
+
- ✅ 〔upstream〕 **⇣ follow mode**: while the AI is working, new stations auto-scroll into view; any manual navigation pauses following, ⏭ "show all" resumes it.
|
|
53
|
+
- ✅ 〔upstream〕 **Inspect deep-link contract**: implements the session view's `inspect` protocol — if a tool-inspection request arrives while this tab is active, it locates the station containing that call.
|
|
54
|
+
- ✅ 〔upstream〕 **⬆ load older history**: one-click paging for events outside the long-session window (reuses the session's `hasMore` / `loadOlder`).
|
|
55
|
+
- ✅ 〔upstream〕 **Explicit search scope** (Plus): search only covers the **currently loaded** trace, so the hit counter carries a `⬆ loaded range only` badge — click it to page in one more chunk, and the newly loaded stations join the search immediately. Unloaded history is **never** reported as "no match".
|
|
56
|
+
|
|
57
|
+
### Locatable, copyable stations (Plus)
|
|
58
|
+
|
|
59
|
+
- ✅ 〔Plus〕 🔗 **Stable anchors**: every station has a copyable reference (🔗 in the detail header) such as `tvp1:e3019`. Paste it into the 🔗 box in the toolbar and press Enter; **the address bar mirrors it as `#tvp1:e3019`**, so the link survives a reload and can be shared.
|
|
60
|
+
- ✅ 〔Plus〕 **Cross-page locating**: when the target sits in unloaded history, older pages are pulled automatically until it appears (page-bounded; on hitting the cap it says "not in the loaded window" instead of pretending to succeed).
|
|
61
|
+
- ✅ 〔Plus〕 **Honest about synthetic records**: records that are not yet durable (an interrupted assistant message, a tool call cut off mid-flight) get a `tvp1:p3s7`-style anchor and are explicitly marked "not persisted, not deep-linkable" instead of handing out a link that dies on reload.
|
|
62
|
+
- ✅ 〔Plus〕 **Orphan tool results still appear**: a `ToolResultNode` whose assistant header fell outside the window (`call === null`) is no longer lost — it becomes its own `orphan-tool` station, searchable and locatable like any other.
|
|
63
|
+
|
|
64
|
+
### Time you can actually see (Plus)
|
|
65
|
+
|
|
66
|
+
- ✅ 〔Plus〕 **Inline start/end times**: each step card shows `14:24:21 → 14:24:53` directly — no hover, no detail panel.
|
|
67
|
+
- ✅ 〔Plus〕 **Honest duration provenance**: "has timing" / "no timing recorded" / "partial timing" are three distinct states — a missing record is never rendered as 0.
|
|
68
|
+
- ✅ 〔Plus〕 **Idle bands**: gaps longer than 30 s between two actions are labeled on the rail (`⏸ 47,628 ms`), answering "what were those 4 hours spent on".
|
|
69
|
+
- ✅ 〔Plus〕 **⏱ even / clock toggle**: even spacing for reading, clock mode scales idle bands logarithmically so long waits are visible at a glance.
|
|
70
|
+
|
|
71
|
+
### What each step did (bottom "Step Detail")
|
|
72
|
+
|
|
73
|
+
- ✅ 〔upstream〕 Assistant output text and 💭 reasoning content (collapsible).
|
|
74
|
+
- ✅ 〔upstream〕 Every tool call: args (formatted JSON), **full tool result**, a **complete sub-call card** (each sub-call's own args / result / duration / error), a duration bar, and the error code.
|
|
75
|
+
- ✅ 〔upstream〕 Step-level metadata: ⏱ total step duration, time-to-first-token (TTFT), ⚡ decode throughput tok/s, token usage, and a "stopped" interruption flag.
|
|
76
|
+
- ✅ 〔upstream〕 The detail panel can be ⤢ expanded to full height / ⤡ collapsed.
|
|
77
|
+
|
|
78
|
+
### Raw request (bottom "Raw Request" tab, shortcut `r`)
|
|
79
|
+
|
|
80
|
+
- ✅ 〔upstream〕 **Model config**: provider / model / temperature / reasoningEffort / thinking / maxTokens / stop / status / duration / retry info.
|
|
81
|
+
- ✅ 〔upstream〕 **⚡ Prompt diff**: what changed versus the previous request — system-prompt character delta and `+ added` / `- removed` tool names (`initial` = the first system prompt).
|
|
82
|
+
- ✅ 〔upstream〕 **Full system prompt**: character count + one-click copy (includes the tool-catalog JSON).
|
|
83
|
+
- ✅ 〔upstream〕 **Tool catalog**: every tool schema carried by that request, expanded one by one; copyable.
|
|
84
|
+
- ✅ 〔upstream〕 **Message list**: the model-visible messages **approximately rebuilt** from the session log (user / assistant / tool results, with compaction markers), each expandable in full; the whole request payload JSON is copyable. It is rebuilt **only while this tab is open** (lazy — long sessions stay snappy).
|
|
85
|
+
- ✅ 〔upstream〕 **Token usage**: inbound (incl. cache reads / writes) and outbound (incl. thinking) breakdown.
|
|
86
|
+
- ✅ 〔upstream〕 **Context-compaction stations** have their own "Raw Request" too: the compaction request's model / duration / usage plus the **full compaction output**.
|
|
87
|
+
|
|
88
|
+
### Export study notes
|
|
89
|
+
|
|
90
|
+
- ✅ 〔upstream〕 Header **📋 Markdown**: one click copies the whole trace as Markdown — each step's reasoning / text / tool args / results and a per-step request-config summary, plus an appendix with the first request's system prompt and tool catalog.
|
|
91
|
+
|
|
92
|
+
## 3. Preview
|
|
93
|
+
|
|
94
|
+
| Trace View overview (timeline + minimap + bottom detail / raw-request panels) |
|
|
95
|
+
|:---:|
|
|
96
|
+
|  |
|
|
97
|
+
|
|
98
|
+
## 4. Directory layout
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
dsh-trajectory-traceview-plus/ # repo root (directory name == npm package name)
|
|
102
|
+
├── package.json # dsh.bundle.patch + dsh.client (browser declaration) + exports["./client"]
|
|
103
|
+
├── package-lock.json # for CI's npm ci only (not in the published files list)
|
|
104
|
+
├── cordis.patch.yml # composition row: a single plugin record (no route, no config)
|
|
105
|
+
├── LICENSE # MIT
|
|
106
|
+
├── CHANGELOG.md # release record (version-check verifies the entry)
|
|
107
|
+
├── screenshot/ # screenshots for the README "Preview" section
|
|
108
|
+
├── .github/workflows/
|
|
109
|
+
│ └── check.yml # CI: the eight gates, in the same order as the local commands
|
|
110
|
+
├── src/ # browser source (lib/client.js is generated from it; never hand-edit)
|
|
111
|
+
├── scripts/
|
|
112
|
+
│ ├── build-client.mjs # src/ -> lib/client.js
|
|
113
|
+
│ ├── provenance.mjs # generates docs/PROVENANCE.md
|
|
114
|
+
│ ├── version-check.mjs # version / tag / CHANGELOG agreement
|
|
115
|
+
│ ├── doc-ref-check.mjs # DESIGN.md §x.y references resolve
|
|
116
|
+
│ ├── doc-heading-check.mjs # headings must be valid Markdown (space after #)
|
|
117
|
+
│ ├── readme-numbers.mjs # README numbers match the code (computed, not typed)
|
|
118
|
+
│ ├── release-status.mjs # are tag / GitHub Release / npm all on this version? (network; not in CI)
|
|
119
|
+
│ ├── browser-check.mjs # real-browser assertions (needs agent-browser)
|
|
120
|
+
│ └── browser-harness.mjs / bench-fold.mjs
|
|
121
|
+
├── docs/ # DESIGN.md (why each change) / PROVENANCE.md (generated)
|
|
122
|
+
├── test/
|
|
123
|
+
│ └── smoke.test.cjs # helper unit tests (plain node)
|
|
124
|
+
└── lib/
|
|
125
|
+
├── index.js # host half: no-op stub (browser-only plugin)
|
|
126
|
+
└── client.js # browser bundle: the trace view (generated)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 5. Quick start
|
|
130
|
+
|
|
131
|
+
One-line install (GitHub):
|
|
132
|
+
|
|
133
|
+
```powershell
|
|
134
|
+
dsh plugin --profile web add github:MisonL/dsh-trajectory-traceview-plus
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Then **restart `dsh web`** to take effect.
|
|
138
|
+
|
|
139
|
+
> After installation the plugin lives at `$DSH_HOME\profiles\web\node_modules\dsh-trajectory-traceview-plus` (cloned by pnpm from GitHub), independent of the source checkout location.
|
|
140
|
+
|
|
141
|
+
Upgrade:
|
|
142
|
+
|
|
143
|
+
```powershell
|
|
144
|
+
dsh plugin --profile web update dsh-trajectory-traceview-plus
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Uninstall:
|
|
148
|
+
|
|
149
|
+
```powershell
|
|
150
|
+
dsh plugin --profile web remove dsh-trajectory-traceview-plus
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Manual install from a source directory (for equivalent verification)
|
|
154
|
+
|
|
155
|
+
```powershell
|
|
156
|
+
dsh plugin --profile web add "G:\path\to\dsh-trajectory-traceview-plus"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Verify it loaded
|
|
160
|
+
|
|
161
|
+
Open any session with an AI execution trace → a "Trace View" tab appears next to the built-in trajectory tab → clicking it shows the horizontal timeline and minimap.
|
|
162
|
+
|
|
163
|
+
## 6. Usage
|
|
164
|
+
|
|
165
|
+
1. Open any session that has an AI execution trace.
|
|
166
|
+
2. Click the "Trace View" tab: the minimap at the top thumbnails every station; the timeline below is ordered by real wall-clock time.
|
|
167
|
+
3. **Browse / replay**: ◀ ▶ or the arrow keys step through stations; ▶ auto-replays (×1 / ×2 / ×4 speeds); Space toggles play / pause.
|
|
168
|
+
4. **Search**: press `/` to focus the search box, type a tool name / arg / body text / error name, and press Enter to hop between hits.
|
|
169
|
+
5. **Select any assistant step**: the bottom "Step Detail" shows its reasoning, text and every tool call's args / results / sub-calls / timing; switch to the "Raw Request" tab (`r`) to study the full context that request sent to the model.
|
|
170
|
+
6. **Export notes**: click the 📋 header button to copy the whole trace as Markdown.
|
|
171
|
+
7. **Long sessions**: click ⬆ to load older history; switch on ⇣ follow mode while the AI is working.
|
|
172
|
+
|
|
173
|
+
## 7. Shortcuts
|
|
174
|
+
|
|
175
|
+
| Key | Action |
|
|
176
|
+
|---|---|
|
|
177
|
+
| `←` / `→` | previous / next station |
|
|
178
|
+
| `Home` / `End` | jump to the start / end |
|
|
179
|
+
| `Space` | play / pause replay |
|
|
180
|
+
| `PageUp` / `PageDown` | previous / next turn start |
|
|
181
|
+
| `/` or `f` | focus the search box |
|
|
182
|
+
| `↑` / `↓` (searching) | previous / next search hit |
|
|
183
|
+
| `Enter` / `Shift+Enter` (searching) | next / previous hit |
|
|
184
|
+
| `Esc` | clear search / dismiss |
|
|
185
|
+
| `r` | toggle the "Raw Request" panel |
|
|
186
|
+
|
|
187
|
+
## 8. Implementation notes (data sources)
|
|
188
|
+
|
|
189
|
+
| Concern | Approach |
|
|
190
|
+
|---|---|
|
|
191
|
+
| Data source | Reuses ONLY the `views.get("trajectory")` snapshot (`TrajectorySnapshot`) of the DSH Web session state: `eventNodes` (with `timing` / `usage` / `provenance` / `interrupted`), `requests` (assistant + compaction requests), `callSchemas` (tool schemas at call time), `partial` / `runningCalls` (live streaming state), plus the session-level `hasMore` / `loadOlder` paging. |
|
|
192
|
+
| Raw request | The "message list" is an **approximately rebuilt** payload from the session log (the original messages array is not snapshotted); the panel marks it "approximate" — precise enough for prompt study. |
|
|
193
|
+
| Laziness | The message list is rebuilt only when the "Raw Request" tab is opened — long sessions stay responsive. |
|
|
194
|
+
| Mounting | Registers the new tab beside the session view's built-in trajectory tab via `dsh.client.inject` (`dsh-client-runtime` / `dsh-client-locale` / `dsh-client-ui-conversation`). |
|
|
195
|
+
| Deep link | Implements the session view's `inspect` protocol: when a tool-inspection request arrives, it locates the station containing that call. |
|
|
196
|
+
|
|
197
|
+
## 9. Troubleshooting
|
|
198
|
+
|
|
199
|
+
| Symptom | Where to look |
|
|
200
|
+
|---|---|
|
|
201
|
+
| "Trace View" tab missing | Confirm `dsh web` was restarted; search F12 Console for `dsh-trajectory-traceview-plus`. |
|
|
202
|
+
| Timeline empty / no stations | The session needs an AI execution trace (user message → assistant steps); brand-new sessions show the empty-state hint. |
|
|
203
|
+
| Search finds nothing | The search term must match a tool name / arg / body text / error name. |
|
|
204
|
+
| Message list differs from the real request | The list is an approximate rebuild (the original messages array is not snapshotted) — the panel marks this; treat the system prompt and tool catalog as authoritative. |
|
|
205
|
+
| Old sessions feel slow | Only opening the "Raw Request" tab rebuilds the message list; plain timeline browsing is unaffected. |
|
|
206
|
+
|
|
207
|
+
## 10. Security & compliance
|
|
208
|
+
|
|
209
|
+
- **Read-only**: only renders the `TrajectorySnapshot` the session view already produced; no business-DOM mutation, no file modification or deletion, no host route, no network access.
|
|
210
|
+
- **Local data**: everything is processed inside the browser; the raw request is rebuilt only when you open its panel, and nothing is written to storage.
|
|
211
|
+
- **No persistence**: nothing written to localStorage / cookies; uninstalling leaves no trace.
|
|
212
|
+
|
|
213
|
+
## 11. Development & build
|
|
214
|
+
|
|
215
|
+
Plain JS, and nothing is bundled at runtime — but **`lib/client.js` is a generated file**. Edit `src/*.js` and rebuild; never hand-edit `lib/client.js`:
|
|
216
|
+
|
|
217
|
+
```powershell
|
|
218
|
+
node scripts/build-client.mjs
|
|
219
|
+
node scripts/build-client.mjs --check
|
|
220
|
+
node scripts/provenance.mjs
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Editing `src/` without rebuilding makes `--check` fail and the smoke suite report `BUILD1`. `lib/index.js` (host half) is a no-op stub; `lib/client.js` is a classic script (`window.__ModuleLoader__.load`) served directly by the client module system.
|
|
224
|
+
|
|
225
|
+
```powershell
|
|
226
|
+
npm run check # 7 steps: build --check / provenance --check / version-check
|
|
227
|
+
# doc-ref-check / doc-heading-check / smoke / readme-numbers
|
|
228
|
+
npm test # smoke only
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The tests run the helper region against mock snapshots covering: tree building / request attachment / compaction-request pairing / sub-call detail / prompt diff / step timing / search matching / Markdown export / token stats.
|
|
232
|
+
|
|
233
|
+
**What needs a real browser** (`react-dom/server` cannot see scroll, focus, clipboard, intervals or layout):
|
|
234
|
+
|
|
235
|
+
```powershell
|
|
236
|
+
node scripts/browser-check.mjs # builds the harness; 47 assertions over 13 recorded groups
|
|
237
|
+
node scripts/browser-check.mjs --shots # also captures a 375px screenshot
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
It needs `agent-browser` (Chrome via CDP). **Deliberately not in CI**: adding a browser to the runner is more moving parts than the check is worth, and a flaky browser job trains people to ignore red builds. Run it locally before releasing.
|
|
241
|
+
|
|
242
|
+
Other scripts: `scripts/bench-fold.mjs` times the pure fold that the streaming path repeats; `scripts/browser-harness.mjs` builds the standalone harness page (`test/browser/harness.html`) normally invoked by `browser-check`.
|
|
243
|
+
|
|
244
|
+
## 12. Compatibility and data contract
|
|
245
|
+
|
|
246
|
+
This plugin reads the official trajectory snapshot (`eventNodes` / `requests` / `callSchemas` / `partial` / `runningCalls`). Because that snapshot comes from another plugin and the contract is not ours, there are two explicit promises:
|
|
247
|
+
|
|
248
|
+
- **Malformed data never crashes the page**: `null`, wrong types and missing fields are skipped with an explicit `⚠ N record(s) malformed` notice.
|
|
249
|
+
- **Version drift is stated loudly**: if a DSH upgrade renames fields or node kinds, the header shows `⚠ N record(s) not recognized [kinds]`; if *nothing* is recognizable you get "Cannot recognize this session's trajectory data" with reason codes — **never a silent "no data yet" or a plausible-looking partial trace**.
|
|
250
|
+
- **The host is never accused wrongly**: `kind: "unknown"` is a *named* node kind in the contract (the host saying "I do not model this event"), so it renders as a first-class station carrying the event type and its raw payload, and it is **not** counted as drift. Only genuinely unseen kinds raise the alarm — one exotic event must not make the whole tree claim the format is unrecognized.
|
|
251
|
+
|
|
252
|
+
`engines.dsh` is `>=0.2.2-rc.2 <0.2.3-0` — it covers **only the 0.2.2 line that was actually tested**, and stops at the minor boundary. Earlier hard-pin conclusions (`=0.2.1-rc.5`, `=0.2.2-rc.2`) are kept in `docs/DESIGN.md` §12.25–§12.27 and §13.43.
|
|
253
|
+
|
|
254
|
+
**DSH *skips* an unmatched plugin** at boot (`skipping profile bundle … requirements {"engines.dsh":…}`) instead of degrading it, so getting the requirement wrong makes the whole tab vanish.
|
|
255
|
+
|
|
256
|
+
**Why a range instead of a hard pin**: the hard pin's cost came due on 0.2.2-rc.5 — the host moved one patch version and the tab vanished, though nothing in the plugin was broken. A range means patch releases inside the same minor no longer require a matching plugin release.
|
|
257
|
+
|
|
258
|
+
**Why the range stops at the minor boundary**: the ceiling is `<0.2.3-0`, not `<0.3.0`. Declaring compatibility is declaring *tested*; 0.2.3 has not been tested, so it is not claimed. On a new minor the plugin is skipped again, which is the signal to re-verify and cut a release — **being skipped is a clear signal, and far better than silently degrading**. To unblock temporarily, use the host's exact-version exemption:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
dsh plugin allow-version # interactive; see dsh plugin --help
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The host prints the exact command in the skip warning.
|
|
265
|
+
|
|
266
|
+
## 13. License
|
|
267
|
+
|
|
268
|
+
MIT. Upstream © [AFAP](https://github.com/AFAP/dsh-trajectory-traceview); this Plus edition is a derivative of v0.3.0, released under the same MIT terms with the original copyright notice kept.
|
|
269
|
+
|
|
270
|
+
Substantive changes versus upstream: stable anchors and deep-link parsing, orphan tool-result stations, inline step start/end with three-state duration provenance, idle bands and the clock axis, search-scope badge, and package/view ids renamed to `-plus` / `traceview-plus` (order 21) so the two never collide.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
> **Disclaimer**: This plugin is a local learning / debugging tool. The authors are not responsible for any decision made based on trace data (including approximately rebuilt message payloads); please don't share session traces containing sensitive content on shared / multi-user screens.
|
|
275
|
+
## 14. Versioning
|
|
276
|
+
|
|
277
|
+
**Baseline**: forked from upstream `v0.3.0` (commit `2d1d07d`, 2026-08-26); upstream has not published since. This repo has evolved independently from `0.4.0`.
|
|
278
|
+
|
|
279
|
+
**Numbering** — the second digit tells you whether you must upgrade alongside the host:
|
|
280
|
+
|
|
281
|
+
| Change | Position | Example |
|
|
282
|
+
| --- | --- | --- |
|
|
283
|
+
| `engines.dsh` moves (re-pin or widen to a range) | **minor** | `0.7.0 → 0.8.0` for DSH 0.2.2; `0.10.0 → 0.11.0` for the range |
|
|
284
|
+
| New capability, or changed behaviour | **minor** | `0.8.2 → 0.9.0` light theme + a11y |
|
|
285
|
+
| Fixes, performance, copy, docs | **patch** | `0.8.1 → 0.8.2` |
|
|
286
|
+
| Breaking (anchor format, view id, config) | **major** | none yet |
|
|
287
|
+
|
|
288
|
+
`engines.dsh` covers only the current minor, so a host minor bump still requires a matching plugin release. That is one reason the number moves fastest — it is not feature bloat.
|
|
289
|
+
|
|
290
|
+
**Release steps** — every one of them, in order (skipping `npm publish` is what §13.47 records):
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# 1-3 edit files: package.json version, CHANGELOG.md entry
|
|
294
|
+
node scripts/provenance.mjs # 4. refresh the provenance list (rerun after any add/rename)
|
|
295
|
+
npm run check # 5. the 7 local gates; all green before going further
|
|
296
|
+
git add -A; git commit -m "..." # 6.
|
|
297
|
+
git push origin main # 7.
|
|
298
|
+
git tag -a v0.11.0 -m "..." # 8.
|
|
299
|
+
git push origin v0.11.0 # 9.
|
|
300
|
+
npm publish # 10. runs prepublishOnly -> the whole check again
|
|
301
|
+
gh release create v0.11.0 --notes-file … # 11. the badge reads the Release, not the tag
|
|
302
|
+
|
|
303
|
+
node scripts/release-status.mjs # 12. do all three agree? (tag / Release / npm)
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Step 10 is the easiest to miss and it fails silently.** After `git push` and `git tag` the repo looks "released" — but the registry still serves the old version, so `npm i <name>@latest` hands people the old package. That happened here once: tag and Release both present, npm still on the previous release (§13.47).
|
|
307
|
+
|
|
308
|
+
**Step 11 is not ceremony**: the version badge at the top of the page reads the GitHub **Release**, not the tag. Tagging without creating a Release makes the badge show a red `no releases`, which reads as an abandoned repo (§13.45).
|
|
309
|
+
|
|
310
|
+
Three things guard the release, and all live in CI (`.github/workflows/check.yml`) so they run on every push to `main` and every pull request:
|
|
311
|
+
|
|
312
|
+
- stale `docs/PROVENANCE.md` — the smoke suite fails (`V1`)
|
|
313
|
+
- version / tag disagreement — `node scripts/version-check.mjs` fails (`F1`)
|
|
314
|
+
- a missing `CHANGELOG.md` entry for the version (`F2`), or a version that goes backwards relative to an existing tag (`F3`)
|
|
315
|
+
|
|
316
|
+
CI runs those 8 gates plus an install step (`npm ci --include=dev`): `build-client --check`, `node --check lib/client.js`, `provenance --check`, `version-check`, `doc-ref-check`, `doc-heading-check`, smoke, readme-numbers. `npm run check` runs 7 of them locally (build, provenance, version-check, doc-ref-check, doc-heading-check, smoke, readme-numbers) — everything but `node --check lib/client.js`; run `browser-check` too before releasing — see §11.
|
|
317
|
+
|
|
318
|
+
**Those numbers have a gate of their own**: `readme-numbers` derives the true values from `check.yml`, `package.json` and `test/browser/probe.js`, then checks both READMEs against them. A number written down twice will eventually disagree with itself (§13.37).
|