dsh-trajectory-traceview-plus 0.0.0-stage → 0.10.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 +32 -0
- package/LICENSE +21 -0
- package/README.en.md +251 -0
- package/README.md +258 -2
- package/cordis.patch.yml +10 -0
- package/docs/DESIGN.md +6711 -0
- package/docs/PROVENANCE.md +154 -0
- package/lib/client.js +5551 -0
- package/lib/index.js +6 -0
- package/package.json +66 -4
- package/screenshot/overview.jpg +0 -0
- package/scripts/bench-fold.mjs +141 -0
- package/scripts/browser-check.mjs +70 -0
- package/scripts/browser-harness.mjs +146 -0
- package/scripts/build-client.mjs +96 -0
- package/scripts/provenance.mjs +160 -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,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.10.0 — 2026-11-22
|
|
4
|
+
|
|
5
|
+
First npm release of **dsh-trajectory-traceview-plus**, derived from AFAP/dsh-trajectory-traceview v0.3.0 (MIT).
|
|
6
|
+
|
|
7
|
+
### Included
|
|
8
|
+
|
|
9
|
+
- Replayable horizontal timeline, minimap, turn navigation, loaded-window search, follow mode and history pagination.
|
|
10
|
+
- Stable event anchors and deep links; orphan tool-result stations; clock-axis display.
|
|
11
|
+
- Step/tool timing, token usage, prompt changes, raw-request inspection and Markdown export.
|
|
12
|
+
- Hardened request matching, streaming projection, malformed-input handling and unique UI identities.
|
|
13
|
+
- Accessible named panel region and responsive layouts checked at 390–1440px.
|
|
14
|
+
- Unified package/repository identity; corrected contributor build instructions.
|
|
15
|
+
|
|
16
|
+
### Compatibility and validation
|
|
17
|
+
|
|
18
|
+
- Requires **DSH 0.2.2-rc.2 exactly** and **Node.js >=24.9.0**; browser-only plugin.
|
|
19
|
+
- Build/provenance consistency, smoke regression tests and browser behavior checks were run before release.
|
|
20
|
+
- Review history: `docs/DESIGN.md` §§13.28–13.31; upstream attribution: `docs/PROVENANCE.md` and `LICENSE`.
|
|
21
|
+
- 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.
|
|
22
|
+
|
|
23
|
+
### Recovery
|
|
24
|
+
|
|
25
|
+
- Disable/uninstall the Plus bundle if needed. It is a local read-only view and does not own session data.
|
|
26
|
+
- A faulty published version requires a new corrected version or npm deprecation; do not rely on npm unpublish as rollback.
|
|
27
|
+
|
|
28
|
+
Earlier development changes are recorded in `docs/DESIGN.md` and Git tags v0.9.1–v0.9.29.
|
|
29
|
+
|
|
30
|
+
### Notes on provenance
|
|
31
|
+
|
|
32
|
+
`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,251 @@
|
|
|
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/ # repo root (npm package name is dsh-trajectory-traceview-plus)
|
|
102
|
+
├── package.json # dsh.bundle.patch + dsh.client (browser declaration) + exports["./client"]
|
|
103
|
+
├── cordis.patch.yml # composition row: a single plugin record (no route, no config)
|
|
104
|
+
├── LICENSE # MIT
|
|
105
|
+
├── screenshot/ # screenshots for the README "Preview" section
|
|
106
|
+
├── test/
|
|
107
|
+
│ └── smoke.test.cjs # zero-dependency helper unit tests (plain node)
|
|
108
|
+
└── lib/
|
|
109
|
+
├── index.js # host half: no-op stub (browser-only plugin)
|
|
110
|
+
└── client.js # browser bundle: the trace view (timeline / minimap / detail / raw request)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 5. Quick start
|
|
114
|
+
|
|
115
|
+
One-line install (GitHub):
|
|
116
|
+
|
|
117
|
+
```powershell
|
|
118
|
+
dsh plugin --profile web add github:MisonL/dsh-trajectory-traceview-plus
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Then **restart `dsh web`** to take effect.
|
|
122
|
+
|
|
123
|
+
> 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.
|
|
124
|
+
|
|
125
|
+
Upgrade:
|
|
126
|
+
|
|
127
|
+
```powershell
|
|
128
|
+
dsh plugin --profile web update dsh-trajectory-traceview-plus
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Uninstall:
|
|
132
|
+
|
|
133
|
+
```powershell
|
|
134
|
+
dsh plugin --profile web remove dsh-trajectory-traceview-plus
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Manual install from a source directory (for equivalent verification)
|
|
138
|
+
|
|
139
|
+
```powershell
|
|
140
|
+
dsh plugin --profile web add "G:\path\to\dsh-trajectory-traceview"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Verify it loaded
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
## 6. Usage
|
|
148
|
+
|
|
149
|
+
1. Open any session that has an AI execution trace.
|
|
150
|
+
2. Click the "Trace View" tab: the minimap at the top thumbnails every station; the timeline below is ordered by real wall-clock time.
|
|
151
|
+
3. **Browse / replay**: ◀ ▶ or the arrow keys step through stations; ▶ auto-replays (×1 / ×2 / ×4 speeds); Space toggles play / pause.
|
|
152
|
+
4. **Search**: press `/` to focus the search box, type a tool name / arg / body text / error name, and press Enter to hop between hits.
|
|
153
|
+
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.
|
|
154
|
+
6. **Export notes**: click the 📋 header button to copy the whole trace as Markdown.
|
|
155
|
+
7. **Long sessions**: click ⬆ to load older history; switch on ⇣ follow mode while the AI is working.
|
|
156
|
+
|
|
157
|
+
## 7. Shortcuts
|
|
158
|
+
|
|
159
|
+
| Key | Action |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `←` / `→` | previous / next station |
|
|
162
|
+
| `Home` / `End` | jump to the start / end |
|
|
163
|
+
| `Space` | play / pause replay |
|
|
164
|
+
| `PageUp` / `PageDown` | previous / next turn start |
|
|
165
|
+
| `/` or `f` | focus the search box |
|
|
166
|
+
| `↑` / `↓` (searching) | previous / next search hit |
|
|
167
|
+
| `Enter` / `Shift+Enter` (searching) | next / previous hit |
|
|
168
|
+
| `Esc` | clear search / dismiss |
|
|
169
|
+
| `r` | toggle the "Raw Request" panel |
|
|
170
|
+
|
|
171
|
+
## 8. Implementation notes (data sources)
|
|
172
|
+
|
|
173
|
+
| Concern | Approach |
|
|
174
|
+
|---|---|
|
|
175
|
+
| 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. |
|
|
176
|
+
| 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. |
|
|
177
|
+
| Laziness | The message list is rebuilt only when the "Raw Request" tab is opened — long sessions stay responsive. |
|
|
178
|
+
| 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`). |
|
|
179
|
+
| Deep link | Implements the session view's `inspect` protocol: when a tool-inspection request arrives, it locates the station containing that call. |
|
|
180
|
+
|
|
181
|
+
## 9. Troubleshooting
|
|
182
|
+
|
|
183
|
+
| Symptom | Where to look |
|
|
184
|
+
|---|---|
|
|
185
|
+
| "Trace View" tab missing | Confirm `dsh web` was restarted; search F12 Console for `dsh-trajectory-traceview-plus`. |
|
|
186
|
+
| Timeline empty / no stations | The session needs an AI execution trace (user message → assistant steps); brand-new sessions show the empty-state hint. |
|
|
187
|
+
| Search finds nothing | The search term must match a tool name / arg / body text / error name. |
|
|
188
|
+
| 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. |
|
|
189
|
+
| Old sessions feel slow | Only opening the "Raw Request" tab rebuilds the message list; plain timeline browsing is unaffected. |
|
|
190
|
+
|
|
191
|
+
## 10. Security & compliance
|
|
192
|
+
|
|
193
|
+
- **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.
|
|
194
|
+
- **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.
|
|
195
|
+
- **No persistence**: nothing written to localStorage / cookies; uninstalling leaves no trace.
|
|
196
|
+
|
|
197
|
+
## 11. Development & build
|
|
198
|
+
|
|
199
|
+
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`:
|
|
200
|
+
|
|
201
|
+
```powershell
|
|
202
|
+
node scripts/build-client.mjs
|
|
203
|
+
node scripts/build-client.mjs --check
|
|
204
|
+
node scripts/provenance.mjs
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
```powershell
|
|
210
|
+
node test/smoke.test.cjs
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
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.
|
|
214
|
+
|
|
215
|
+
## 12. Compatibility and data contract
|
|
216
|
+
|
|
217
|
+
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:
|
|
218
|
+
|
|
219
|
+
- **Malformed data never crashes the page**: `null`, wrong types and missing fields are skipped with an explicit `⚠ N record(s) malformed` notice.
|
|
220
|
+
- **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**.
|
|
221
|
+
- **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.
|
|
222
|
+
|
|
223
|
+
`engines.dsh` is pinned to `=0.2.2-rc.2` (verified live on 2026-11-14). The earlier `=0.2.1-rc.5` conclusions are kept in `docs/DESIGN.md` §12.25–§12.27.
|
|
224
|
+
|
|
225
|
+
**Why a hard pin instead of a range**: DSH validates `engines.dsh` at boot and *skips* an unmatched plugin outright (`skipping profile bundle … requirements {"engines.dsh":…}`) instead of degrading. Getting the pin wrong therefore makes the whole tab vanish — louder and easier to explain than a build that looks fine and misbehaves inside.
|
|
226
|
+
|
|
227
|
+
## 13. License
|
|
228
|
+
|
|
229
|
+
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.
|
|
230
|
+
|
|
231
|
+
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.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
> **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.
|
|
236
|
+
## 14. Versioning
|
|
237
|
+
|
|
238
|
+
**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`.
|
|
239
|
+
|
|
240
|
+
**Numbering** — the second digit tells you whether you must upgrade alongside the host:
|
|
241
|
+
|
|
242
|
+
| Change | Position | Example |
|
|
243
|
+
| --- | --- | --- |
|
|
244
|
+
| `engines.dsh` pin moves (host upgrade) | **minor** | `0.7.0 → 0.8.0` for DSH 0.2.2 |
|
|
245
|
+
| New capability, or changed behaviour | **minor** | `0.8.2 → 0.9.0` light theme + a11y |
|
|
246
|
+
| Fixes, performance, copy, docs | **patch** | `0.8.1 → 0.8.2` |
|
|
247
|
+
| Breaking (anchor format, view id, config) | **major** | none yet |
|
|
248
|
+
|
|
249
|
+
`engines.dsh` is pinned to a **single** version, so every host upgrade may require a matching plugin release. That is why the number moves fastest — it is not feature bloat.
|
|
250
|
+
|
|
251
|
+
**Release steps**: bump the version, tag it (`v0.9.1`), and run `node scripts/provenance.mjs`. The provenance doc is guarded by the smoke test (`V1`) and fails the suite when stale.
|
package/README.md
CHANGED
|
@@ -1,3 +1,259 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 轨迹视图 · Trace View
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
<b>中文</b> · <a href="README.en.md">English</a>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
> **把 DeepSeek Harness Web GUI 会话里 AI 的执行过程渲染成一条可回放的横向时间轴——每一步做了什么、每次发给大模型的原始请求都摊开在眼前。**
|
|
8
|
+
> 专为「学习与调优提示词」设计:想弄清 AI 为什么这么回答?打开轨迹视图,看它思考了什么、调用了哪些工具、拿到了什么结果,以及它当时真正"看到"的消息载荷。
|
|
9
|
+
|
|
10
|
+
> **这是增强版(Plus),不是上游原版。** 基于 [AFAP/dsh-trajectory-traceview](https://github.com/AFAP/dsh-trajectory-traceview)(MIT)改造:保留原版全部能力,新增稳定锚点、孤立工具结果站点、行内耗时、时钟轴、检索范围标注等。**与原版不要同时安装**(会出现两个「轨迹视图」标签),先 `dsh plugin --profile web remove dsh-trajectory-traceview`,再装本包。
|
|
11
|
+
|
|
12
|
+
**版本基线**:分叉自上游 `v0.3.0`(commit `2d1d07d`,2026-08-26)。上游此后未再更新(仓库共 3 个提交)。本仓从 `0.4.0` 起自主演进,**版本号与上游不再对齐**——不要拿本仓的 `0.9.x` 去推断上游版本。版本规则见 [§11](#11-版本与发布规则)。
|
|
13
|
+
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](https://github.com/MisonL/dsh-trajectory-traceview-plus/releases)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. 它解决了什么问题
|
|
20
|
+
|
|
21
|
+
长会话里想还原「AI 当时是怎么执行的」,内置轨迹标签只能逐条翻事件列表;想看「某次请求到底把什么发给了大模型」(系统提示、工具目录、重建消息)更是无从下手——这些数据散落在会话内部状态里,没有画面。
|
|
22
|
+
|
|
23
|
+
本插件在「轨迹」标签右侧新增一个「**轨迹视图**」标签,把同一份会话状态渲染成**可回放、可搜索、可导出的横向时间轴**:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
会话轨迹(views.get("trajectory") 快照,官方数据完全复用)
|
|
27
|
+
│
|
|
28
|
+
├─ 顶部 minimap:按时间序的站点色块,点击秒跳
|
|
29
|
+
├─ 横向时间轴:真实时钟时间标注,◀ ▶ 逐站回放
|
|
30
|
+
├─ 底部【步骤详情】:思考 / 工具参数 / 结果全文 / 子调用链 / 耗时
|
|
31
|
+
├─ 底部【原始请求】:该步骤当次发给大模型的完整上下文(提示词学习)
|
|
32
|
+
└─ 头部 KPI:轮次 / 步骤 / 工具 / 错误 / 耗时 / tokens + 📋 一键 Markdown
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**只读**:只读取会话视图里已生成好的 `TrajectorySnapshot` 快照并重新渲染;不修改任何文件、不访问网络,宿主半部是无操作桩。
|
|
36
|
+
|
|
37
|
+
## 2. 功能特性
|
|
38
|
+
|
|
39
|
+
每个条形目标注来源:**〔原版〕** = 上游 v0.3.0 已有;**〔Plus〕** = 本仓新增或改变。
|
|
40
|
+
逐项、逐函数的机械清单见 [`docs/PROVENANCE.md`](docs/PROVENANCE.md)(自动生成,不会过期)。
|
|
41
|
+
|
|
42
|
+
### 流向总览
|
|
43
|
+
|
|
44
|
+
- ✅ 〔原版〕横向时间轴 + 顶部 **minimap**:每个站点一个色块(用户=蓝 / 步骤=绿 / 工具=橙 / 压缩=紫 / 错误=红 / 重试=黄 / 命令=青),点击色块即跳转,回放时高亮当前站点。
|
|
45
|
+
- ✅ 〔原版〕完整事件流:用户消息、助手步骤、工具调用、**上下文压缩**、**轮次失败**、**模型重试**、**输出超限**、**命令**都按时间序上轴;压缩 / 命令事件按 seq 精确归位到所属轮次。
|
|
46
|
+
- ✅ 〔原版〕KPI 条:轮次 / 步骤 / 工具次数 / 错误数 / 工具总耗时 / 请求与生成 tokens,实时「当前步骤」指示灯 + 当前模型名。
|
|
47
|
+
- ✅ 〔原版〕站点轴上标注**真实时钟时间**(不是事件序号)。
|
|
48
|
+
|
|
49
|
+
### 快速定位
|
|
50
|
+
|
|
51
|
+
- ✅ 〔原版〕🔍 **搜索**:按工具名 / 参数 / 正文 / 错误名过滤站点,命中站点金色描边 + minimap 高亮;`Enter` / `Shift+Enter` 或 `↑` `↓` 逐个跳转;`/` 或 `f` 聚焦搜索框,`Esc` 清空。
|
|
52
|
+
- ✅ 〔原版〕**⇤ / ⇥ 轮次跳转**(PageUp / PageDown):在轮次起点之间跳跃。
|
|
53
|
+
- ✅ 〔原版〕**⇣ 跟随模式**:AI 正在工作时新站点自动滚入视野;任何手动导航自动暂停跟随,⏭「显示全部」恢复。
|
|
54
|
+
- ✅ 〔原版〕**检查联动契约**:实现了会话视图的 `inspect` 深链协议——本标签处于活动时若收到工具检查请求,自动定位到包含该调用的站点。
|
|
55
|
+
- ✅ 〔原版〕**⬆ 加载更早历史**:长会话窗口外的事件一键分页加载(复用会话的 `hasMore` / `loadOlder`)。
|
|
56
|
+
- ✅ 〔Plus〕**检索范围显式标注**(Plus 新增):搜索只覆盖**当前已加载**的轨迹,所以命中计数旁会显示 `⬆ 仅已加载范围` 徽标——点它即可加载更早一页,新加载的站点立即纳入检索。**没加载的历史永远不会被误报成"无命中"**。
|
|
57
|
+
|
|
58
|
+
### 站点可定位、可复制(Plus 新增)
|
|
59
|
+
|
|
60
|
+
- ✅ 〔Plus〕🔗 **稳定锚点**:每个站点都有可复制的引用(详情头部「🔗 复制锚点」),形如 `tvp1:e3019`。粘进工具栏的 🔗 输入框回车即可精确定位;**地址栏会同步成 `#tvp1:e3019`**,把这个链接发给别人、或刷新页面,都会回到同一条记录。
|
|
61
|
+
- ✅ 〔Plus〕**跨页定位**:目标在未加载的历史里时,会自动向前翻页直到命中(有页数上限,到顶会如实提示"不在当前窗口"而不是假装成功)。
|
|
62
|
+
- ✅ 〔Plus〕**合成记录不骗人**:还没落盘的记录(助手刚中断、工具调用被打断)给的是 `tvp1:p3s7` 形式的合成锚点,并明确标注"未持久化、不可深链",不会给出刷新后就失效的链接。
|
|
63
|
+
- ✅ 〔Plus〕**孤立工具结果也上轴**:窗口切分导致助手头不在窗口里的 `ToolResultNode`(`call === null`)不再丢失,单独成为 `orphan-tool` 站点,同样可搜索、可定位。
|
|
64
|
+
|
|
65
|
+
### 时间看得见(Plus 新增)
|
|
66
|
+
|
|
67
|
+
- ✅ 〔Plus〕**行内起止时间**:每个步骤卡片上直接写 `14:24:21 → 14:24:53`(不必悬停、不必点开详情)。
|
|
68
|
+
- ✅ 〔Plus〕**耗时来源诚实标注**:区分「有耗时」「未记录耗时」「耗时不全」三态——**不会把"没记录"显示成 0**。
|
|
69
|
+
- ✅ 〔Plus〕**空闲色带**:两个动作之间超过 30 秒的空档在轴上标注时长(`⏸ 47,628 ms`),回答"这两步之间那 4 小时在等什么"。
|
|
70
|
+
- ✅ 〔Plus〕**⏱ 等距 / 按时钟切换**:等距模式站点均匀排列便于阅读,按时钟模式空闲色带按对数缩放,长等待肉眼可见。
|
|
71
|
+
|
|
72
|
+
### 每一步做了什么(底部「步骤详情」)
|
|
73
|
+
|
|
74
|
+
- ✅ 〔原版〕助手输出文本与 💭 思考内容(可折叠)。
|
|
75
|
+
- ✅ 〔原版〕每个工具调用:参数(格式化 JSON)、**工具结果全文**、**子调用链完整卡片**(子调用自己的参数 / 结果 / 耗时 / 错误)、耗时条、错误码。
|
|
76
|
+
- ✅ 〔原版〕步骤级元信息:⏱ 步骤总耗时、首 token 延迟(TTFT)、⚡ 解码吞吐 tok/s、token 用量、「已停止」中断标记。
|
|
77
|
+
- ✅ 〔Plus〕**证据等级**:面板里逐项标注这份数据是原始记录、近似重建、还是可能不全——**不会让读者把推测当成记录**。
|
|
78
|
+
- ✅ 〔Plus〕**📋 复制本步复盘**:把该步的请求配置、提示词变化、工具结果、证据等级打包成一段 Markdown。
|
|
79
|
+
- ✅ 〔原版〕详情面板可 ⤢ 展开全高 / ⤡ 收起。
|
|
80
|
+
|
|
81
|
+
### 原始请求(底部「原始请求」标签,快捷键 `r`)
|
|
82
|
+
|
|
83
|
+
- ✅ 〔原版〕**模型配置**:provider / model / temperature / reasoningEffort / thinking / maxTokens / stop / 状态 / 耗时 / 重试信息。
|
|
84
|
+
- ✅ 〔原版〕**⚡ 提示词变更**:当次请求相对上次的差异摘要——系统提示字符数变化、`+ 新增` / `- 移除` 的工具名(`initial` 为首份系统提示)。
|
|
85
|
+
- ✅ 〔原版〕**系统提示全文**:字符数 + 一键复制(含工具目录 JSON)。
|
|
86
|
+
- ✅ 〔原版〕**工具目录**:当次请求携带的全部工具 schema,逐个展开,可一键复制。
|
|
87
|
+
- ✅ 〔原版〕**消息列表**:按会话日志**近似重建**的 model-visible 消息(用户 / 助手 / 工具结果,含压缩标记),逐条展开全文;可一键复制完整请求载荷 JSON。**仅在打开本标签时才重建**(懒加载,长会话不卡顿)。
|
|
88
|
+
- ✅ 〔原版〕**Token 用量**:入站(含缓存读 / 写)与出站(含思考)明细。
|
|
89
|
+
- ✅ 〔原版〕**上下文压缩站点**也有自己的「原始请求」:压缩请求的模型 / 耗时 / usage 与**压缩产出全文**。
|
|
90
|
+
|
|
91
|
+
### 导出学习笔记
|
|
92
|
+
|
|
93
|
+
- ✅ 〔原版〕头部 **📋 Markdown**:一键把整段轨迹复制为 Markdown——每步的思考 / 正文 / 工具参数 / 结果、每步请求配置摘要,以及附录「首个请求的系统提示与工具目录」。
|
|
94
|
+
|
|
95
|
+
## 3. 效果预览
|
|
96
|
+
|
|
97
|
+
| 轨迹视图总览(时间轴 + minimap + 底部详情 / 原始请求面板) |
|
|
98
|
+
|:---:|
|
|
99
|
+
|  |
|
|
100
|
+
|
|
101
|
+
## 4. 目录结构
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
dsh-trajectory-traceview/ # 仓库根(npm 包名为 dsh-trajectory-traceview-plus)
|
|
105
|
+
├── package.json # dsh.bundle.patch + dsh.client(浏览器端声明)+ exports["./client"]
|
|
106
|
+
├── cordis.patch.yml # 组合行:仅插入一行插件记录(无路由、无配置)
|
|
107
|
+
├── LICENSE # MIT
|
|
108
|
+
├── screenshot/ # 效果截图(README「效果预览」用)
|
|
109
|
+
├── test/
|
|
110
|
+
│ └── smoke.test.cjs # 纯 helpers 单测(零依赖,node 直接跑)
|
|
111
|
+
└── lib/
|
|
112
|
+
├── index.js # 宿主半部:无操作桩(纯浏览器端插件)
|
|
113
|
+
└── client.js # 浏览器 bundle:轨迹视图(时间轴 / minimap / 详情 / 原始请求)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 5. 快速开始
|
|
117
|
+
|
|
118
|
+
一键安装(GitHub):
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
dsh plugin --profile web add github:MisonL/dsh-trajectory-traceview-plus
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
然后**重启 `dsh web`** 生效。
|
|
125
|
+
|
|
126
|
+
> 安装后插件位于 `$DSH_HOME\profiles\web\node_modules\dsh-trajectory-traceview-plus`(pnpm 从 GitHub 克隆),与源码仓库位置无关。
|
|
127
|
+
|
|
128
|
+
升级:
|
|
129
|
+
|
|
130
|
+
```powershell
|
|
131
|
+
dsh plugin --profile web update dsh-trajectory-traceview-plus
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
卸载:
|
|
135
|
+
|
|
136
|
+
```powershell
|
|
137
|
+
dsh plugin --profile web remove dsh-trajectory-traceview-plus
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 从源码目录手动安装(等价验证用)
|
|
141
|
+
|
|
142
|
+
```powershell
|
|
143
|
+
dsh plugin --profile web add "G:\path\to\dsh-trajectory-traceview"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 验证是否加载成功
|
|
147
|
+
|
|
148
|
+
打开任意有 AI 执行轨迹的会话 → 会话顶部「轨迹」标签旁出现「轨迹视图」标签 → 点击后能看到横向时间轴与 minimap,即加载成功。
|
|
149
|
+
|
|
150
|
+
## 6. 使用
|
|
151
|
+
|
|
152
|
+
1. 打开任意会话(有 AI 执行轨迹即可)。
|
|
153
|
+
2. 点击「轨迹视图」标签:顶部 minimap 是全部站点缩略图,下方时间轴按真实时钟时间排列。
|
|
154
|
+
3. **浏览 / 回放**:◀ ▶ 或键盘逐站浏览;▶ 自动回放(×1 / ×2 / ×4 三档速度);空格 播放 / 暂停。
|
|
155
|
+
4. **搜索**:按 `/` 聚焦搜索框,输入工具名 / 参数 / 正文 / 错误名,Enter 逐个跳转命中站点。
|
|
156
|
+
5. **选中任意助手步骤**:底部「步骤详情」展示思考、正文与每个工具调用的参数 / 结果 / 子调用 / 耗时;点「原始请求」标签(或按 `r`)查看当次发给大模型的完整上下文,用于提示词学习。
|
|
157
|
+
6. **导出笔记**:点头部 📋 把整段轨迹复制为 Markdown。
|
|
158
|
+
7. **长会话**:点 ⬆ 加载更早历史;AI 正在工作时开 ⇣ 跟随模式自动跟进。
|
|
159
|
+
|
|
160
|
+
## 7. 快捷键
|
|
161
|
+
|
|
162
|
+
| 按键 | 功能 |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `←` / `→` | 上一个 / 下一个站点 |
|
|
165
|
+
| `Home` / `End` | 跳到开头 / 结尾 |
|
|
166
|
+
| `空格` | 播放 / 暂停回放 |
|
|
167
|
+
| `PageUp` / `PageDown` | 上一个 / 下一个轮次起点 |
|
|
168
|
+
| `/` 或 `f` | 聚焦搜索框 |
|
|
169
|
+
| `↑` / `↓`(搜索时) | 上一个 / 下一个搜索命中 |
|
|
170
|
+
| `Enter` / `Shift+Enter`(搜索时) | 下一个 / 上一个命中 |
|
|
171
|
+
| `Esc` | 清空搜索 / 取消 |
|
|
172
|
+
| `r` | 切换「原始请求」面板 |
|
|
173
|
+
|
|
174
|
+
## 8. 实现要点(数据来源)
|
|
175
|
+
|
|
176
|
+
| 关注点 | 做法 |
|
|
177
|
+
|---|---|
|
|
178
|
+
| 数据来源 | 完全复用 DSH Web 会话状态里的 `views.get("trajectory")` 快照(`TrajectorySnapshot`):`eventNodes`(含 `timing` / `usage` / `provenance` / `interrupted`)、`requests`(助手请求 + 压缩请求)、`callSchemas`(调用时刻的工具 schema)、`partial` / `runningCalls`(流式实时态),以及会话级 `hasMore` / `loadOlder` 历史分页。 |
|
|
179
|
+
| 原始请求 | 「消息列表」是按会话日志**近似重建**的载荷(原始 messages 数组不落快照),面板内已注明"近似",用于提示词学习足够精确。 |
|
|
180
|
+
| 懒加载 | 消息列表仅在打开「原始请求」标签时才重建,长会话不卡顿。 |
|
|
181
|
+
| 挂载方式 | 通过 `dsh.client.inject`(`dsh-client-runtime` / `dsh-client-locale` / `dsh-client-ui-conversation`)在会话视图「轨迹」标签旁注册新标签。 |
|
|
182
|
+
| 检查联动 | 实现会话视图的 `inspect` 深链协议:收到工具检查请求时自动定位到包含该调用的站点。 |
|
|
183
|
+
|
|
184
|
+
## 9. 日志与排错
|
|
185
|
+
|
|
186
|
+
| 现象 | 排查方向 |
|
|
187
|
+
|---|---|
|
|
188
|
+
| 看不到「轨迹视图」标签 | 确认已重启 `dsh web`;F12 Console 搜 `dsh-trajectory-traceview-plus`。 |
|
|
189
|
+
| 时间轴空白 / 无站点 | 会话需要已有 AI 执行轨迹(用户消息 → 助手步骤);新会话无数据时面板显示空态提示。 |
|
|
190
|
+
| 搜索无命中 | 检查搜索词是否匹配 工具名 / 参数 / 正文 / 错误名。 |
|
|
191
|
+
| 消息列表与实际请求不符 | 「消息列表」是近似重建(原始 messages 不落快照),面板内已注明;以系统提示与工具目录为准。 |
|
|
192
|
+
| 打开较旧会话缓慢 | 只有打开「原始请求」标签才重建消息列表;正常浏览时间轴不受影响。 |
|
|
193
|
+
|
|
194
|
+
## 10. 安全与合规
|
|
195
|
+
|
|
196
|
+
- **只读**:只读取会话视图已生成的 `TrajectorySnapshot` 快照并渲染;不修改 DOM 业务结构、不修改 / 删除任何文件、无宿主路由、不访问网络。
|
|
197
|
+
- **本地数据**:所有数据均在浏览器内处理;原始请求只在主动打开面板时才重建,不写入任何存储。
|
|
198
|
+
- **无持久化**:不写 localStorage / cookie;卸载即无痕。
|
|
199
|
+
|
|
200
|
+
## 11. 开发与自测
|
|
201
|
+
|
|
202
|
+
纯 JS,运行时不需构建(无打包器、无产物格式转换)。但 **`lib/client.js`是生成物**,必须由 `src/*.js`构建出来,不要手改:
|
|
203
|
+
|
|
204
|
+
```powershell
|
|
205
|
+
node scripts/build-client.mjs
|
|
206
|
+
node scripts/build-client.mjs --check
|
|
207
|
+
node scripts/provenance.mjs
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
改了 `src/`却忘了重建时,`--check`会失败,`test/smoke.test.cjs`也会报 `BUILD1`。`lib/index.js`(宿主半部)是无操作桩;`lib/client.js`是经典脚本(`window.__ModuleLoader__.load`),由客户端模块系统直接服务。
|
|
211
|
+
|
|
212
|
+
```powershell
|
|
213
|
+
node test/smoke.test.cjs
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
自测用 mock 快照覆盖:树构建 / 请求附加 / 压缩请求配对 / 子调用详情 / prompt diff / 步骤计时 / 搜索匹配 / Markdown 导出 / token 统计。
|
|
217
|
+
|
|
218
|
+
## 12. 兼容性与数据契约
|
|
219
|
+
|
|
220
|
+
本插件读取 DSH 官方的轨迹快照(`eventNodes` / `requests` / `callSchemas` / `partial` / `runningCalls`)。因为快照来自另一个插件、契约不由本插件所有,所以有两条明确承诺:
|
|
221
|
+
|
|
222
|
+
- **畸形数据不会让页面崩**:`null`、错型、缺字段一律降级跳过,并有显式 `⚠ N 条记录结构异常` 提示。
|
|
223
|
+
- **版本不兼容会大声说**:如果 DSH 升级后字段名或节点类型变了,头部显示 `⚠ N 条记录无法识别 [类型名]`;若**一条都认不出**,显示「无法识别当前会话的轨迹数据格式」并列出原因码——**不会伪装成"暂无数据"或一份看起来正常的残缺轨迹**。
|
|
224
|
+
- **不冤枉宿主**:`kind: "unknown"` 是契约里**有名字**的节点类型(宿主明确表示"这条事件我不建模"),所以它被当成一等站点画出来,标出事件类型与原始数据,**不计入"版本不兼容"**。只有真正没见过的节点类型才报警。这条区别很重要:一个陌生事件不该让整棵树改口说"格式不认识"。
|
|
225
|
+
|
|
226
|
+
`engines.dsh` 钉在 `=0.2.2-rc.2`(2026-11-14 真机升级后实测版本)。旧钉版 `=0.2.1-rc.5` 的历史结论保留在 `docs/DESIGN.md` §12.25–§12.27。
|
|
227
|
+
|
|
228
|
+
**为什么是硬钉而不是范围**:DSH 在启动时就校验 `engines.dsh`,不匹配的插件会被**直接跳过**(日志里是 `skipping profile bundle … requirements {"engines.dsh":…}`),不是降级运行。所以钉错版本的后果是"整个页签消失",这比"看起来能用但内部错乱"更容易被发现,也更容易解释。
|
|
229
|
+
|
|
230
|
+
## 13. License
|
|
231
|
+
|
|
232
|
+
MIT。原版 © [AFAP](https://github.com/AFAP/dsh-trajectory-traceview);本增强版基于其 v0.3.0 改造,同样以 MIT 发布,文件名与版权声明保留。
|
|
233
|
+
|
|
234
|
+
相对上游的实质改动(便于上游合并或比对):稳定锚点与深链解析、孤立工具结果站点、步骤行内起止时间与耗时三态、空闲色带与时钟轴切换、检索范围标注、包名/视图 id 改为 `-plus` / `traceview-plus`(order 21,避免与原版冲突)。
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
> **免责声明**:本插件为本地学习 / 调试工具,不对任何因使用轨迹数据(含近似重建的消息载荷)做出的决策负责;请勿在共享 / 多人环境展示含敏感内容的会话轨迹。
|
|
239
|
+
## 14. 版本与发布规则
|
|
240
|
+
|
|
241
|
+
**基线**:本仓分叉自上游 `v0.3.0`(commit `2d1d07d`,2026-08-26),上游此后未再发布。本仓 `0.4.0` 起自主演进,**版本号与上游不再可比较**。
|
|
242
|
+
|
|
243
|
+
**号段规则**(看第二位就知道要不要跟着宿主升级):
|
|
244
|
+
|
|
245
|
+
| 变化 | 版本位 | 例子 |
|
|
246
|
+
| --- | --- | --- |
|
|
247
|
+
| `engines.dsh` 钉版变动(宿主升级) | **minor** | `0.7.0 → 0.8.0` 为适配 DSH 0.2.2 |
|
|
248
|
+
| 新增能力、或改变已有行为 | **minor** | `0.8.2 → 0.9.0` 浅色主题与无障碍 |
|
|
249
|
+
| 修复、性能、文案、文档 | **patch** | `0.8.1 → 0.8.2` |
|
|
250
|
+
| 破坏性变更(锚点格式、视图 id、配置项) | **major** | 尚未发生 |
|
|
251
|
+
|
|
252
|
+
`0.x` 阶段:`engines.dsh` 是**硬钉单一版本**,宿主每次升级都可能要求插件跟随发版——这是版本号跳得最快的原因,不是功能膨胀。
|
|
253
|
+
|
|
254
|
+
**发布动作**:每次改版本号时同步打 tag(`v0.9.1`),并跑 `node scripts/provenance.mjs` 刷新来源清单。两者都有测试守着:
|
|
255
|
+
|
|
256
|
+
- `docs/PROVENANCE.md` 过期 → 冒烟测试直接失败(`V1`)
|
|
257
|
+
- 版本号与 tag 不一致 → 暂无自动检查,人工确认
|
|
258
|
+
|
|
259
|
+
**来源可查**:`git diff v0.3.0 -- lib/client.js` 看原始差异,`docs/PROVENANCE.md` 看改动落在哪些函数,`docs/DESIGN.md` 看每处改动的原因。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# dsh-trajectory-traceview-plus bundle patch: adds this local plugin row to the web
|
|
2
|
+
# profile composition. Applied as a bundle layer (dsh.bundle.patch) after
|
|
3
|
+
# dsh-base and dsh-web-app, so the row lands beside the other dsh.client rows.
|
|
4
|
+
#
|
|
5
|
+
# The plugin is client-only: the host half is a no-op that ships purely to make
|
|
6
|
+
# the row a valid Loader entry, while the real surface (the "轨迹视图" mind-map
|
|
7
|
+
# tab next to 轨迹) lives in the browser bundle discovered via dsh.client exports.
|
|
8
|
+
- insert:
|
|
9
|
+
- id: dsh-trajectory-traceview-plus
|
|
10
|
+
name: dsh-trajectory-traceview-plus
|