@mingozhou/dsh-replay 0.3.3 → 0.4.2
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/README.md +225 -164
- package/README.zh.md +225 -164
- package/assets/icon.png +0 -0
- package/lib/client.js +955 -2419
- package/lib/core.js +557 -86
- package/lib/index.js +1043 -51
- package/lib/types/src/client/api.d.ts +44 -0
- package/lib/types/src/client/components/AuditView.d.ts +2 -1
- package/lib/types/src/client/components/CompareView.d.ts +2 -1
- package/lib/types/src/client/components/DashboardView.d.ts +8 -0
- package/lib/types/src/client/components/ExportDialog.d.ts +9 -0
- package/lib/types/src/client/components/ReplayApp.d.ts +4 -2
- package/lib/types/src/client/components/ReplayModal.d.ts +1 -1
- package/lib/types/src/client/components/SessionPicker.d.ts +4 -3
- package/lib/types/src/client/components/TimelineView.d.ts +2 -1
- package/lib/types/src/client/export.d.ts +6 -1
- package/lib/types/src/client/i18n.d.ts +8 -1
- package/lib/types/src/client/pricing.d.ts +6 -0
- package/lib/types/src/core/audit.d.ts +18 -0
- package/lib/types/src/core/compare.d.ts +8 -3
- package/lib/types/src/core/cost.d.ts +21 -3
- package/lib/types/src/core/index.d.ts +1 -0
- package/lib/types/src/core/redact.d.ts +40 -0
- package/lib/types/src/core/timeline.d.ts +9 -0
- package/lib/types/src/index.d.ts +52 -1
- package/lib/viewer.js +282 -29
- package/package.json +118 -107
- package/scripts/build.mjs +8 -2
- package/src/client/api.ts +114 -10
- package/src/client/components/AuditView.tsx +89 -10
- package/src/client/components/CompareView.tsx +89 -13
- package/src/client/components/DashboardView.tsx +232 -0
- package/src/client/components/ExportDialog.tsx +136 -0
- package/src/client/components/ItemDetail.tsx +36 -4
- package/src/client/components/OverviewView.tsx +150 -34
- package/src/client/components/ReplayApp.tsx +207 -60
- package/src/client/components/ReplayModal.tsx +41 -6
- package/src/client/components/SessionPicker.tsx +55 -27
- package/src/client/components/TimelineView.tsx +106 -41
- package/src/client/export.ts +20 -4
- package/src/client/i18n.ts +266 -45
- package/src/client/index.ts +7 -5
- package/src/client/mascot-image.ts +1 -1
- package/src/client/pricing.ts +90 -0
- package/src/client/styles.css +250 -1
- package/src/client/viewer-entry.tsx +25 -4
- package/src/core/audit.ts +274 -67
- package/src/core/compare.ts +0 -0
- package/src/core/cost.ts +94 -16
- package/src/core/index.ts +1 -0
- package/src/core/redact.ts +182 -0
- package/src/core/timeline.ts +107 -12
- package/src/index.ts +290 -54
package/README.md
CHANGED
|
@@ -1,164 +1,225 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img src="
|
|
4
|
-
|
|
5
|
-
# dsh-replay
|
|
6
|
-
|
|
7
|
-
**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
[ · [Live demo](https://mingozhou.github.io/dsh-replay/) · [Install](#install) · [Why not Trajectory?](#why-not-trajectory) · [Privacy](PRIVACY.md)
|
|
11
|
+
|
|
12
|
+
[](https://www.npmjs.com/package/@mingozhou/dsh-replay)
|
|
13
|
+
[](https://www.npmjs.com/package/@mingozhou/dsh-replay)
|
|
14
|
+
[](https://github.com/MingoZhou/dsh-replay/actions/workflows/ci.yml)
|
|
15
|
+
[](./LICENSE)
|
|
16
|
+
[](https://github.com/MingoZhou/dsh-replay#compatibility)
|
|
17
|
+
|
|
18
|
+
> **Desktop one-click install:** **Plugins → Add plugin → `@mingozhou/dsh-replay` → Install** → restart.
|
|
19
|
+
> Web/source: [`dsh plugin --profile <profile> add …`](#install).
|
|
20
|
+
|
|
21
|
+
<img src="https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/demo.webp" width="880" alt="15-second dsh-replay demo: archive, cost, audit, export" />
|
|
22
|
+
|
|
23
|
+
<sub>15-second demo · sample sessions · the exported HTML is offline and read-only<br/>[GIF fallback](https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/demo.gif) · [full demo](https://mingozhou.github.io/dsh-replay/)</sub>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
> **“Replay” here means read-only.** dsh-replay never re-sends a session to a model, never writes the log, and never spends tokens. It parses the append-only session log and renders it. See [FAQ](#faq).
|
|
28
|
+
>
|
|
29
|
+
> **Historical note (preserving the original claim).** ~~DeepSeek Harness keeps a beautiful append-only log where everything that reached the model is reconstructible — but ships no viewer for it. **dsh-replay is that viewer.**~~
|
|
30
|
+
> That was true when this project started in **2026-08**. Since **DSH 0.2.1-rc.2**, the official Web UI ships the **Trajectory (轨迹)** view, which covers the current session's event ledger. dsh-replay is now the viewer for the **archive**: every session, cost, Windows-aware audit, fork/compare, and redacted standalone export. [Details below](#why-not-trajectory).
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
### DeepSeek Harness Desktop (recommended)
|
|
37
|
+
|
|
38
|
+
1. Open **Plugins** in the left sidebar.
|
|
39
|
+
2. Click **Add plugin**.
|
|
40
|
+
3. Enter `@mingozhou/dsh-replay` and click **Install**.
|
|
41
|
+
4. Restart Harness.
|
|
42
|
+
|
|
43
|
+
> Desktop profiles are managed by the Electron app. `dsh plugin --profile desktop …` is refused by design (`profile "desktop" is managed exclusively by the Electron application`). Use the Plugins page instead.
|
|
44
|
+
|
|
45
|
+
<img src="https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/plugins-installed.png" width="720" alt="DeepSeek Harness Plugins page with dsh-replay installed" />
|
|
46
|
+
|
|
47
|
+
<sub>Plugins → Installed plugins. This is the 0.4.1 row; 0.4.2 uses the new description.</sub>
|
|
48
|
+
|
|
49
|
+
### Web UI / source checkout
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
# released CLI (npm i -g @deepseek-ai/dsh)
|
|
53
|
+
dsh plugin --profile <your-profile> add @mingozhou/dsh-replay
|
|
54
|
+
|
|
55
|
+
# source checkout
|
|
56
|
+
cd deepseek-harness
|
|
57
|
+
pnpm dsh plugin --profile web add @mingozhou/dsh-replay
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Verify with `dsh --profile <your-profile> --dump-config` (look for the `@mingozhou/dsh-replay` / `replay` row), then restart Harness.
|
|
61
|
+
|
|
62
|
+
### From source (development / unreleased changes)
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
git clone https://github.com/MingoZhou/dsh-replay.git
|
|
66
|
+
cd dsh-replay
|
|
67
|
+
npm install && npm run build # lib/ is a build artifact
|
|
68
|
+
npm run demo # http://localhost:4173 — no harness needed
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Point a profile at the folder:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
dsh plugin --profile <your-profile> add <absolute-path>/dsh-replay
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Uninstall
|
|
78
|
+
|
|
79
|
+
- **Desktop:** Plugins → dsh-replay → **Remove**.
|
|
80
|
+
- **Web:** `dsh plugin --profile <your-profile> remove @mingozhou/dsh-replay`
|
|
81
|
+
- **Manual fallback:** remove `@mingozhou/dsh-replay` from both `dependencies` and `dsh.profile.bundles` in the profile's `package.json`, then `pnpm install` in the profile directory.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Why not Trajectory?
|
|
86
|
+
|
|
87
|
+
Trajectory is excellent for **the session you are in**: a live ledger, timing overview, per-record tokens, thinking, system prompt, virtual scrolling. If that is all you need, use it. dsh-replay is for **after the session ends**, and for the questions Trajectory does not answer:
|
|
88
|
+
|
|
89
|
+
| | Official Trajectory | dsh-replay |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| Scope | current session | **all sessions + archive dashboard** |
|
|
92
|
+
| Timeline | native, live, virtualized | playback, reasoning, system prompt, tool summaries |
|
|
93
|
+
| Cost | token counts | **per-model cost, USD/CNY, editable price table** |
|
|
94
|
+
| Risk | — | **Windows-aware audit, baseline suppression, secret redaction** |
|
|
95
|
+
| Lineage | — | **fork tree + exact divergence + cost/risk deltas** |
|
|
96
|
+
| Sharing | raw session ZIP | **redacted, standalone, interactive HTML** |
|
|
97
|
+
| Data | in the session | **local archive; no telemetry** |
|
|
98
|
+
|
|
99
|
+
The two coexist. dsh-replay does not replace Trajectory; it answers “what happened across all of this, what did it cost, what was risky, and how do I show someone?”
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## What you get
|
|
104
|
+
|
|
105
|
+
| | |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| 📊 **Archive dashboard** | Every session on this machine: month/all-time tokens, estimated cost, high-risk findings, search by title/id/workspace. |
|
|
108
|
+
| 💰 **Per-model cost** | Cache-aware totals, a per-model breakdown, USD/CNY, and an editable price table. No more charging every token at one model's rate. |
|
|
109
|
+
| 🛡️ **Windows-aware audit** | `pwsh`/PowerShell/`cmd` as well as bash; destructive deletes, credential reads, exfil, persistence and policy changes. Initial permission/sandbox state is treated as baseline, not a finding. |
|
|
110
|
+
| 🔐 **Secret redaction** | Common API keys, `.env` assignments, private keys, home paths. The export dialog shows the redaction count before you share. |
|
|
111
|
+
| 📤 **Shareable HTML** | One session baked into a single offline `.html`: no install, no network, no model. Ideal for bug reports and post-mortems. |
|
|
112
|
+
| 🌿 **Fork tree** | Full lineage, subagents, fork boundaries, click-through. |
|
|
113
|
+
| ⚖️ **Compare** | Any two sessions: stats, tool mix, cost/risk deltas, full-lineage relation, and the first differing event on each side. |
|
|
114
|
+
| ⏪ **Timeline** | 1–16× playback, reasoning, system prompt, search, type filters, keyboard navigation, tool summaries instead of raw JSON. |
|
|
115
|
+
| 🌏 **English / 中文** | The app UI switches language; DSH-injected view labels remain whatever the host provides. |
|
|
116
|
+
|
|
117
|
+
### Dashboard, cost, audit, export
|
|
118
|
+
|
|
119
|
+
<div align="center">
|
|
120
|
+
<img src="https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/overview-light.png" width="880" alt="Overview dashboard and cost estimate" />
|
|
121
|
+
<img src="https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/audit-light.png" width="880" alt="Security audit with baseline suppression and redacted details" />
|
|
122
|
+
<img src="https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/export-light.png" width="880" alt="Redacted standalone HTML export dialog" />
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
More: [dashboard](https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/dashboard-light.png) · [timeline](https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/timeline-light.png) · [forks](https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/forks-light.png) · [compare](https://raw.githubusercontent.com/MingoZhou/dsh-replay/main/assets/compare-light.png)
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## What changed in 0.4.2
|
|
130
|
+
|
|
131
|
+
This is the “still alive” maintenance release, focused on trust and first-run:
|
|
132
|
+
|
|
133
|
+
- **Audit correctness:** `pwsh`/PowerShell/`cmd`, Windows destructive commands, credential reads and exfiltration; initial `permission/preset` / `sandbox/mode` no longer raises a finding; routine writes/network reads no longer flood the list.
|
|
134
|
+
- **Cost correctness:** per-model totals; mixed-model sessions are priced separately; editable price table; USD/CNY.
|
|
135
|
+
- **Share safely:** redaction preview + count + size estimate; unredacted export is an explicit opt-in; exported viewer has no empty Forks/Compare tabs.
|
|
136
|
+
- **Actually smaller:** client bundle **2.0 MB → 232 KB**; mascot **1.4 MB → 73 KB**; README GIF **28.8 MB → 164 KB**; 15-second WebP **116 KB**.
|
|
137
|
+
- **More useful timeline:** reasoning, system prompt, model selection, tool summaries, keyboard navigation, selected-event preservation under filters.
|
|
138
|
+
- **Archive dashboard:** every session, month/all-time, tokens, cost, risk, search, workspace filter.
|
|
139
|
+
- **Privacy/security:** loopback-only API by default; secret redaction; [PRIVACY.md](PRIVACY.md) and [SECURITY.md](SECURITY.md).
|
|
140
|
+
- **Compatibility:** `engines.dsh`; targeted at DSH Desktop 0.2.1-rc.2 (the `sessionQuery` contract was checked against the running app; the UI was verified in demo mode).
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Compatibility
|
|
145
|
+
|
|
146
|
+
| Component | Tested / required |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| DSH Desktop | **0.2.1-rc.2** — target / API contract checked |
|
|
149
|
+
| DSH Web | 0.2.x expected (same `sessionQuery` / webServer contract) |
|
|
150
|
+
| Node | **22+** |
|
|
151
|
+
| Package | `@mingozhou/dsh-replay@0.4.2` |
|
|
152
|
+
| Plugin API range | `engines.dsh >= 0.2.0-rc.8` |
|
|
153
|
+
|
|
154
|
+
DSH moves fast. If a future release breaks the adapter, `npm run demo` still works because the analysis/UI layers are independent of the host. Open an issue with the DSH version and the failing route.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Privacy and security
|
|
159
|
+
|
|
160
|
+
- The plugin reads session logs through `ctx.sessionQuery`; it writes **no session data**.
|
|
161
|
+
- The UI calls the **local DSH origin only**; no telemetry, no cloud parser.
|
|
162
|
+
- The host API is **loopback-only by default** and read-only. `allowRemote` is an explicit opt-in and remains unauthenticated — do not expose it to a network.
|
|
163
|
+
- Exported HTML is self-contained and offline. **Session logs are raw data**: the export redacts common credentials, but review the file before sharing.
|
|
164
|
+
- Read [PRIVACY.md](PRIVACY.md) and [SECURITY.md](SECURITY.md).
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## FAQ
|
|
169
|
+
|
|
170
|
+
**Does “replay” re-run the session or call the model?**
|
|
171
|
+
No. It is a read-only projection of the append-only log. No model request, no token spend, no writes. This is also [issue #2](https://github.com/MingoZhou/dsh-replay/issues/2), now in the FAQ.
|
|
172
|
+
|
|
173
|
+
**Then why is it called replay?**
|
|
174
|
+
The project started before the official view existed; “replay” meant “play back the recording”, like a match recording, not “replay the match”. The UI now says **Session Review / 会话复盘** and the README says read-only up front.
|
|
175
|
+
|
|
176
|
+
**Trajectory already exists. Why install this?**
|
|
177
|
+
Trajectory is per-session and live. dsh-replay is archive-wide (all sessions), adds money/risk/lineage/share, and exports a file a teammate can open with zero install. See [the table](#why-not-trajectory).
|
|
178
|
+
|
|
179
|
+
**Does it work on Windows?**
|
|
180
|
+
Yes — 0.4.2 added `pwsh`/PowerShell/`cmd` rules and Windows path handling. The old audit missed `Remove-Item` entirely; that is fixed.
|
|
181
|
+
|
|
182
|
+
**Why is the bundle smaller now?**
|
|
183
|
+
The 1.4 MB mascot was embedded into every client bundle. It is now a 73 KB 256px asset; the sidebar still uses the colorful mascot (not a monochrome glyph), and the base client bundle is ~232 KB.
|
|
184
|
+
|
|
185
|
+
**The Plugins page says the plugin is installed, but there is no entry.**
|
|
186
|
+
Fully restart Harness; client plugin sets are scanned at boot. If the API works but the UI does not, confirm `lib/client.js` exists (source install: `npm run build`).
|
|
187
|
+
|
|
188
|
+
**`GET /replay/api/sessions` returns 404.**
|
|
189
|
+
The profile did not compose the bundle. Re-add it and check the configuration; on Desktop use the Plugins page, on Web use `dsh --profile <profile> --dump-config`.
|
|
190
|
+
|
|
191
|
+
**I'm on Desktop and `dsh plugin --profile desktop …` fails.**
|
|
192
|
+
Expected: the Desktop app owns that profile. Use **Plugins → Add plugin**.
|
|
193
|
+
|
|
194
|
+
**Is redaction guaranteed?**
|
|
195
|
+
No. It is pattern-based and best-effort. The dialog shows how many values will be masked; unredacted export is opt-in. Never share a real session without reviewing it.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Roadmap
|
|
200
|
+
|
|
201
|
+
- **File diff reconstruction** from `edit`/`write` calls (the next big differentiator over a raw ledger).
|
|
202
|
+
- **Annotations + share links** for exported reviews.
|
|
203
|
+
- **Deeper audit packs** (supply chain, network egress, CI credentials) with a rule editor.
|
|
204
|
+
- **More archive analytics**: per-workspace spend, weekly digest, budget alerts.
|
|
205
|
+
- **Native Trajectory deep links** from audit findings, instead of a second timeline.
|
|
206
|
+
|
|
207
|
+
Live-follow is intentionally not the focus: Trajectory already does it well. dsh-replay invests in the archive, money, risk, and sharing.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Star
|
|
212
|
+
|
|
213
|
+
If dsh-replay saved you an afternoon of log spelunking, a ⭐ helps other DSH users find it:
|
|
214
|
+
|
|
215
|
+
**[github.com/MingoZhou/dsh-replay](https://github.com/MingoZhou/dsh-replay)** · [Live demo](https://mingozhou.github.io/dsh-replay/) · [Issues](https://github.com/MingoZhou/dsh-replay/issues) · [Discussions](https://github.com/MingoZhou/dsh-replay/discussions)
|
|
216
|
+
|
|
217
|
+
Writing about it? A ready-to-edit launch/content pack is in [docs/content](docs/content/README.md).
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## License & credits
|
|
222
|
+
|
|
223
|
+
MIT. Jing Xiaoshen (鲸小深) is an original character created for this project — not the official DeepSeek logo and not third-party fan art. Mascot artwork lives at `assets/jingxiaoshen.png`; replace it and rebuild to embed your own version.
|
|
224
|
+
|
|
225
|
+
The `core/` layer is dependency-free and importable as `dsh-replay/core` if you want to build your own tooling over session logs. It understands packed chunk rows, torn crash tails, seed boundaries, compaction shadowing, reasoning blocks, and per-model usage.
|