@lingda-ai/dsh-plugin-replay 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +102 -2
- package/cordis.patch.yml +7 -0
- package/docs/replay-contract.md +81 -0
- package/index.js +146 -0
- package/lib/client.js +682 -0
- package/lib/projector.js +253 -0
- package/lib/rates.js +172 -0
- package/lib/redact.js +58 -0
- package/lib/route.js +196 -0
- package/lib/store.js +439 -0
- package/package.json +71 -4
package/lib/store.js
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 回放存储:一会话一文件,追加写,热路径零 IO。
|
|
3
|
+
*
|
|
4
|
+
* 为什么按会话分文件,而不是像账本那样按天分片:
|
|
5
|
+
* 回放**永远按会话查**。按天分片会让"看这一个会话"扫 30 个文件,
|
|
6
|
+
* 而按会话分文件时,一次回放只碰一个文件。
|
|
7
|
+
*
|
|
8
|
+
* 为什么仍然入队 + 定时合并写:
|
|
9
|
+
* append() 在 session/event 热路径上。同步写盘会拖慢宿主的 post-commit 广播,
|
|
10
|
+
* 这是账本已经踩过的坑(并留下了性能门禁)。这里沿用同一机制。
|
|
11
|
+
*
|
|
12
|
+
* 超限处理:
|
|
13
|
+
* 单会话超过 maxSpans 后不再逐条记,改为"每 10 条合成一行"(op:'aggr');
|
|
14
|
+
* 单文件超过 maxBytes 后封盘,只写一条截断标记。宁可概略,也不无限涨。
|
|
15
|
+
*/
|
|
16
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs'
|
|
17
|
+
import { homedir } from 'node:os'
|
|
18
|
+
import { join } from 'node:path'
|
|
19
|
+
import { safeFileName } from './redact.js'
|
|
20
|
+
|
|
21
|
+
export const REPLAY_SUBDIR = join('.dsh', 'ops', 'replay')
|
|
22
|
+
|
|
23
|
+
export function defaultReplayDir() {
|
|
24
|
+
return join(homedir(), REPLAY_SUBDIR)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const FOLD_EVERY = 10
|
|
28
|
+
|
|
29
|
+
function emptyTotals() {
|
|
30
|
+
return {
|
|
31
|
+
cost: { amount: null, currency: null, knownEntries: 0, unknownEntries: 0 },
|
|
32
|
+
saved: { amount: null, currency: null },
|
|
33
|
+
tokens: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
34
|
+
steps: 0,
|
|
35
|
+
turns: 0,
|
|
36
|
+
calls: 0,
|
|
37
|
+
failures: 0,
|
|
38
|
+
firstAt: null,
|
|
39
|
+
lastAt: null,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {{dir?: string, maxSpans?: number, maxBytes?: number, flushMs?: number,
|
|
45
|
+
* retentionDays?: number, now?: () => number}} [options]
|
|
46
|
+
*/
|
|
47
|
+
export function createReplayStore(options = {}) {
|
|
48
|
+
const dir = options.dir ?? defaultReplayDir()
|
|
49
|
+
const maxSpans = Math.max(50, Number(options.maxSpans ?? 2000))
|
|
50
|
+
const maxBytes = Math.max(64 * 1024, Number(options.maxBytes ?? 8 * 1024 * 1024))
|
|
51
|
+
const flushMs = Math.max(50, Number(options.flushMs ?? 500))
|
|
52
|
+
const retentionDays = Math.max(1, Number(options.retentionDays ?? 90))
|
|
53
|
+
const now = options.now ?? Date.now
|
|
54
|
+
|
|
55
|
+
const queues = new Map() // sid → string[]
|
|
56
|
+
const counters = new Map() // sid → {spans, bytes, sealed, pending:{n,amount,currency,meas,at}}
|
|
57
|
+
const dropped = { lines: 0, errors: 0 }
|
|
58
|
+
|
|
59
|
+
function countersOf(sid) {
|
|
60
|
+
let value = counters.get(sid)
|
|
61
|
+
if (value === undefined) {
|
|
62
|
+
value = { spans: 0, sealed: false, pending: null }
|
|
63
|
+
counters.set(sid, value)
|
|
64
|
+
}
|
|
65
|
+
return value
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function pathOf(sid) {
|
|
69
|
+
return join(dir, `${safeFileName(sid)}.jsonl`)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function ensureDir() {
|
|
73
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** 热路径:只序列化 + push,不做任何 IO。 */
|
|
77
|
+
function append(sid, rows) {
|
|
78
|
+
if (typeof sid !== 'string' || !Array.isArray(rows) || rows.length === 0) return 0
|
|
79
|
+
const c = countersOf(sid)
|
|
80
|
+
if (c.sealed) return 0
|
|
81
|
+
let queue = queues.get(sid)
|
|
82
|
+
if (queue === undefined) {
|
|
83
|
+
queue = []
|
|
84
|
+
queues.set(sid, queue)
|
|
85
|
+
}
|
|
86
|
+
let accepted = 0
|
|
87
|
+
for (const row of rows) {
|
|
88
|
+
c.spans += 1
|
|
89
|
+
if (c.spans <= maxSpans) {
|
|
90
|
+
try {
|
|
91
|
+
queue.push(JSON.stringify(row) + '\n')
|
|
92
|
+
accepted += 1
|
|
93
|
+
} catch {
|
|
94
|
+
dropped.errors += 1
|
|
95
|
+
}
|
|
96
|
+
continue
|
|
97
|
+
}
|
|
98
|
+
// 超限:折叠。每满 10 条写一行汇总,保留"哪里变贵了"这一层信息。
|
|
99
|
+
const pending = c.pending ?? { n: 0, amount: 0, currency: null, meas: new Map(), at: row.at }
|
|
100
|
+
pending.n += 1
|
|
101
|
+
pending.at = row.at ?? pending.at
|
|
102
|
+
if (row.cost && Number.isFinite(row.cost.amount)) {
|
|
103
|
+
pending.amount += row.cost.amount
|
|
104
|
+
pending.currency = row.cost.currency ?? pending.currency
|
|
105
|
+
}
|
|
106
|
+
for (const m of row.meas ?? []) {
|
|
107
|
+
pending.meas.set(m.unit, (pending.meas.get(m.unit) ?? 0) + m.value)
|
|
108
|
+
}
|
|
109
|
+
c.pending = pending
|
|
110
|
+
if (pending.n >= FOLD_EVERY) {
|
|
111
|
+
const fold = {
|
|
112
|
+
v: 1,
|
|
113
|
+
t: 'span',
|
|
114
|
+
sid,
|
|
115
|
+
at: pending.at,
|
|
116
|
+
op: 'aggr',
|
|
117
|
+
aggr: pending.n,
|
|
118
|
+
cost: Number.isFinite(pending.amount) && pending.amount > 0
|
|
119
|
+
? { amount: Math.round(pending.amount * 1e6) / 1e6, currency: pending.currency ?? 'CNY' }
|
|
120
|
+
: null,
|
|
121
|
+
meas: [...pending.meas.entries()].map(([unit, value]) => ({ unit, value })),
|
|
122
|
+
eid: `aggr:${sid}:${c.spans}`,
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
queue.push(JSON.stringify(fold) + '\n')
|
|
126
|
+
accepted += 1
|
|
127
|
+
} catch {
|
|
128
|
+
dropped.errors += 1
|
|
129
|
+
}
|
|
130
|
+
c.pending = null
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (queue.length > 20000) {
|
|
134
|
+
const overflow = queue.length - 20000
|
|
135
|
+
queue.splice(0, overflow)
|
|
136
|
+
dropped.lines += overflow
|
|
137
|
+
}
|
|
138
|
+
return accepted
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** 会话结束:写一条 sum 行,作为列表页与"已收场"状态的唯一依据。 */
|
|
142
|
+
function writeSum(sid, sum) {
|
|
143
|
+
if (typeof sid !== 'string') return false
|
|
144
|
+
try {
|
|
145
|
+
ensureDir()
|
|
146
|
+
queues.delete(sid)
|
|
147
|
+
counters.delete(sid)
|
|
148
|
+
appendFileSync(pathOf(sid), JSON.stringify({ ...sum, v: 1, t: 'sum', sid }) + '\n', 'utf8')
|
|
149
|
+
return true
|
|
150
|
+
} catch {
|
|
151
|
+
dropped.errors += 1
|
|
152
|
+
return false
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function flush() {
|
|
157
|
+
if (queues.size === 0) return 0
|
|
158
|
+
ensureDir()
|
|
159
|
+
let written = 0
|
|
160
|
+
for (const [sid, lines] of queues) {
|
|
161
|
+
if (lines.length === 0) continue
|
|
162
|
+
const c = countersOf(sid)
|
|
163
|
+
const path = pathOf(sid)
|
|
164
|
+
let size = 0
|
|
165
|
+
try {
|
|
166
|
+
size = existsSync(path) ? statSync(path).size : 0
|
|
167
|
+
} catch {
|
|
168
|
+
size = 0
|
|
169
|
+
}
|
|
170
|
+
if (size >= maxBytes) {
|
|
171
|
+
c.sealed = true
|
|
172
|
+
queues.delete(sid)
|
|
173
|
+
try {
|
|
174
|
+
appendFileSync(path, JSON.stringify({ v: 1, t: 'trunc', at: now(), reason: 'max-bytes' }) + '\n', 'utf8')
|
|
175
|
+
} catch {}
|
|
176
|
+
continue
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
appendFileSync(path, lines.join(''), 'utf8')
|
|
180
|
+
written += lines.length
|
|
181
|
+
lines.length = 0
|
|
182
|
+
} catch {
|
|
183
|
+
dropped.errors += 1
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return written
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
let timer = null
|
|
190
|
+
if (flushMs > 0) {
|
|
191
|
+
timer = setInterval(() => {
|
|
192
|
+
try {
|
|
193
|
+
flush()
|
|
194
|
+
} catch {}
|
|
195
|
+
}, flushMs)
|
|
196
|
+
if (typeof timer.unref === 'function') timer.unref()
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function parseFile(path) {
|
|
200
|
+
const text = readFileSync(path, 'utf8')
|
|
201
|
+
const spans = []
|
|
202
|
+
let sum = null
|
|
203
|
+
let truncated = false
|
|
204
|
+
let skipped = 0
|
|
205
|
+
for (const line of text.split('\n')) {
|
|
206
|
+
if (line.length === 0) continue
|
|
207
|
+
let row
|
|
208
|
+
try {
|
|
209
|
+
row = JSON.parse(line)
|
|
210
|
+
} catch {
|
|
211
|
+
skipped += 1
|
|
212
|
+
continue
|
|
213
|
+
}
|
|
214
|
+
if (row?.t === 'sum') sum = row
|
|
215
|
+
else if (row?.t === 'trunc') truncated = true
|
|
216
|
+
else if (row?.t === 'span') spans.push(row)
|
|
217
|
+
}
|
|
218
|
+
return { spans, sum, truncated, skipped }
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function read(sid, { limit = 200, offset = 0, order = 'desc' } = {}) {
|
|
222
|
+
const path = pathOf(sid)
|
|
223
|
+
if (!existsSync(path)) return { ok: false, error: '没有找到这个会话的回放', rows: [], total: 0 }
|
|
224
|
+
let parsed
|
|
225
|
+
try {
|
|
226
|
+
parsed = parseFile(path)
|
|
227
|
+
} catch (error) {
|
|
228
|
+
return { ok: false, error: '回放文件读取失败', rows: [], total: 0 }
|
|
229
|
+
}
|
|
230
|
+
const all = parsed.spans.slice().sort((a, b) => (a.at ?? 0) - (b.at ?? 0))
|
|
231
|
+
const ordered = order === 'asc' ? all : all.slice().reverse()
|
|
232
|
+
const from = Math.max(0, Number(offset) || 0)
|
|
233
|
+
const take = Math.max(1, Math.min(1000, Number(limit) || 200))
|
|
234
|
+
return {
|
|
235
|
+
ok: true,
|
|
236
|
+
rows: ordered.slice(from, from + take),
|
|
237
|
+
total: all.length,
|
|
238
|
+
sum: parsed.sum,
|
|
239
|
+
truncated: parsed.truncated,
|
|
240
|
+
skipped: parsed.skipped,
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function summarize(sid) {
|
|
245
|
+
const path = pathOf(sid)
|
|
246
|
+
if (!existsSync(path)) return null
|
|
247
|
+
let parsed
|
|
248
|
+
try {
|
|
249
|
+
parsed = parseFile(path)
|
|
250
|
+
} catch {
|
|
251
|
+
return null
|
|
252
|
+
}
|
|
253
|
+
const totals = emptyTotals()
|
|
254
|
+
const turns = new Set()
|
|
255
|
+
const steps = new Set()
|
|
256
|
+
let amount = 0
|
|
257
|
+
let saved = 0
|
|
258
|
+
let currency = null
|
|
259
|
+
const byTool = new Map()
|
|
260
|
+
const byModel = new Map()
|
|
261
|
+
|
|
262
|
+
for (const row of parsed.spans) {
|
|
263
|
+
if (row.turn !== undefined) turns.add(row.turn)
|
|
264
|
+
if (row.turn !== undefined && row.step !== undefined) steps.add(`${row.turn}:${row.step}`)
|
|
265
|
+
if (row.at !== null && row.at !== undefined) {
|
|
266
|
+
if (totals.firstAt === null || row.at < totals.firstAt) totals.firstAt = row.at
|
|
267
|
+
if (totals.lastAt === null || row.at > totals.lastAt) totals.lastAt = row.at
|
|
268
|
+
}
|
|
269
|
+
const weight = row.aggr ?? 1
|
|
270
|
+
if (row.op === 'model.call') totals.calls += weight
|
|
271
|
+
if (row.op === 'tool.call') {
|
|
272
|
+
totals.calls += weight
|
|
273
|
+
if (row.ok === false) totals.failures += 1
|
|
274
|
+
}
|
|
275
|
+
for (const m of row.meas ?? []) {
|
|
276
|
+
const key = m.unit === 'token.input' ? 'input'
|
|
277
|
+
: m.unit === 'token.output' ? 'output'
|
|
278
|
+
: m.unit === 'token.cache_read' ? 'cacheRead'
|
|
279
|
+
: m.unit === 'token.cache_write' ? 'cacheWrite' : null
|
|
280
|
+
if (key !== null) totals.tokens[key] += m.value
|
|
281
|
+
}
|
|
282
|
+
if (row.cost && Number.isFinite(row.cost.amount)) {
|
|
283
|
+
amount += row.cost.amount
|
|
284
|
+
currency = row.cost.currency ?? currency
|
|
285
|
+
totals.cost.knownEntries += 1
|
|
286
|
+
} else if (row.op === 'model.call') {
|
|
287
|
+
totals.cost.unknownEntries += 1
|
|
288
|
+
}
|
|
289
|
+
if (Number.isFinite(row.saved)) saved += row.saved
|
|
290
|
+
|
|
291
|
+
if (row.cost && Number.isFinite(row.cost.amount)) {
|
|
292
|
+
const toolKey = row.op === 'tool.call' ? row.tool ?? '未归因' : null
|
|
293
|
+
if (toolKey !== null) {
|
|
294
|
+
byTool.set(toolKey, (byTool.get(toolKey) ?? 0))
|
|
295
|
+
}
|
|
296
|
+
if (row.op === 'model.call') {
|
|
297
|
+
const driver = row.driver ?? '未归因'
|
|
298
|
+
byTool.set(driver, (byTool.get(driver) ?? 0) + row.cost.amount)
|
|
299
|
+
const model = row.model ?? '未知模型'
|
|
300
|
+
const bucket = byModel.get(model) ?? { amount: 0, calls: 0 }
|
|
301
|
+
bucket.amount += row.cost.amount
|
|
302
|
+
bucket.calls += 1
|
|
303
|
+
byModel.set(model, bucket)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
totals.cost.amount = totals.cost.knownEntries > 0 ? Math.round(amount * 1e6) / 1e6 : null
|
|
309
|
+
totals.cost.currency = currency
|
|
310
|
+
totals.saved.amount = saved > 0 ? Math.round(saved * 1e6) / 1e6 : null
|
|
311
|
+
totals.saved.currency = currency
|
|
312
|
+
totals.turns = turns.size
|
|
313
|
+
totals.steps = steps.size
|
|
314
|
+
|
|
315
|
+
const toList = (map) => [...map.entries()]
|
|
316
|
+
.map(([key, value]) => {
|
|
317
|
+
const amountValue = typeof value === 'number' ? value : value.amount
|
|
318
|
+
return { key, amount: Math.round(amountValue * 1e6) / 1e6, calls: typeof value === 'object' ? value.calls : null }
|
|
319
|
+
})
|
|
320
|
+
.filter((item) => item.amount > 0)
|
|
321
|
+
.sort((a, b) => b.amount - a.amount)
|
|
322
|
+
|
|
323
|
+
return {
|
|
324
|
+
totals,
|
|
325
|
+
byTool: toList(byTool),
|
|
326
|
+
byModel: toList(byModel),
|
|
327
|
+
sum: parsed.sum,
|
|
328
|
+
truncated: parsed.truncated,
|
|
329
|
+
skipped: parsed.skipped,
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function listSessions({ limit = 20 } = {}) {
|
|
334
|
+
if (!existsSync(dir)) return []
|
|
335
|
+
let names = []
|
|
336
|
+
try {
|
|
337
|
+
names = readdirSync(dir).filter((name) => name.endsWith('.jsonl'))
|
|
338
|
+
} catch {
|
|
339
|
+
return []
|
|
340
|
+
}
|
|
341
|
+
const files = names
|
|
342
|
+
.map((name) => {
|
|
343
|
+
const path = join(dir, name)
|
|
344
|
+
try {
|
|
345
|
+
const stat = statSync(path)
|
|
346
|
+
return { path, mtime: stat.mtimeMs, size: stat.size }
|
|
347
|
+
} catch {
|
|
348
|
+
return null
|
|
349
|
+
}
|
|
350
|
+
})
|
|
351
|
+
.filter(Boolean)
|
|
352
|
+
.sort((a, b) => b.mtime - a.mtime)
|
|
353
|
+
.slice(0, Math.max(1, Math.min(200, Number(limit) || 20)))
|
|
354
|
+
|
|
355
|
+
return files.map((file) => {
|
|
356
|
+
// 只读文件尾巴:已收场的最后一行是 sum;未收场的用 mtime 兜底。
|
|
357
|
+
let tail = ''
|
|
358
|
+
try {
|
|
359
|
+
const text = readFileSync(file.path, 'utf8')
|
|
360
|
+
tail = text.slice(-8192)
|
|
361
|
+
} catch {
|
|
362
|
+
tail = ''
|
|
363
|
+
}
|
|
364
|
+
const lines = tail.split('\n').filter((line) => line.trim().length > 0)
|
|
365
|
+
let sum = null
|
|
366
|
+
for (let i = lines.length - 1; i >= 0; i -= 1) {
|
|
367
|
+
try {
|
|
368
|
+
const row = JSON.parse(lines[i])
|
|
369
|
+
if (row?.t === 'sum') {
|
|
370
|
+
sum = row
|
|
371
|
+
break
|
|
372
|
+
}
|
|
373
|
+
} catch {}
|
|
374
|
+
}
|
|
375
|
+
const sid = (sum?.sid ?? file.path.split('/').pop().replace(/\.jsonl$/, ''))
|
|
376
|
+
return {
|
|
377
|
+
sid,
|
|
378
|
+
title: sum?.title ?? null,
|
|
379
|
+
cwdName: sum?.cwdName ?? null,
|
|
380
|
+
lastAt: sum?.endedAt ?? file.mtime,
|
|
381
|
+
startedAt: sum?.startedAt ?? null,
|
|
382
|
+
closed: sum !== null,
|
|
383
|
+
cost: sum?.cost ?? null,
|
|
384
|
+
saved: sum?.saved ?? null,
|
|
385
|
+
steps: sum?.steps ?? null,
|
|
386
|
+
turns: sum?.turns ?? null,
|
|
387
|
+
failures: sum?.failures ?? null,
|
|
388
|
+
outcome: sum?.outcome ?? null,
|
|
389
|
+
size: file.size,
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function prune() {
|
|
395
|
+
if (!existsSync(dir)) return 0
|
|
396
|
+
const cutoff = now() - retentionDays * 24 * 60 * 60 * 1000
|
|
397
|
+
let removed = 0
|
|
398
|
+
let names = []
|
|
399
|
+
try {
|
|
400
|
+
names = readdirSync(dir)
|
|
401
|
+
} catch {
|
|
402
|
+
return 0
|
|
403
|
+
}
|
|
404
|
+
for (const name of names) {
|
|
405
|
+
if (!name.endsWith('.jsonl')) continue
|
|
406
|
+
const path = join(dir, name)
|
|
407
|
+
try {
|
|
408
|
+
if (statSync(path).mtimeMs < cutoff) {
|
|
409
|
+
rmSync(path, { force: true })
|
|
410
|
+
removed += 1
|
|
411
|
+
}
|
|
412
|
+
} catch {}
|
|
413
|
+
}
|
|
414
|
+
return removed
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function close() {
|
|
418
|
+
try {
|
|
419
|
+
flush()
|
|
420
|
+
} catch {}
|
|
421
|
+
if (timer !== null) {
|
|
422
|
+
clearInterval(timer)
|
|
423
|
+
timer = null
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
return {
|
|
428
|
+
dir,
|
|
429
|
+
append,
|
|
430
|
+
writeSum,
|
|
431
|
+
flush,
|
|
432
|
+
read,
|
|
433
|
+
summarize,
|
|
434
|
+
listSessions,
|
|
435
|
+
prune,
|
|
436
|
+
close,
|
|
437
|
+
stats: () => ({ dir, sessions: counters.size, dropped: { ...dropped }, maxSpans, maxBytes, retentionDays }),
|
|
438
|
+
}
|
|
439
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingda-ai/dsh-plugin-replay",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "黑匣子:DSH 会话回放。把一次会话还原成时间轴上的每一步——做了什么、花了多少、成没成——并给出按工具与模型的花钱热点。只记结构不记内容,默认全本地,零运行时依赖。",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"dsh",
|
|
9
|
+
"dsh-plugin",
|
|
10
|
+
"deepseek-harness",
|
|
11
|
+
"replay",
|
|
12
|
+
"session-replay",
|
|
13
|
+
"observability",
|
|
14
|
+
"trace",
|
|
15
|
+
"cost"
|
|
16
|
+
],
|
|
17
|
+
"author": "LingDaAi",
|
|
18
|
+
"homepage": "https://gitee.com/linzhengtong/dsh-plugin-replay#readme",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/lingda-ai/dsh-plugin-replay.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://gitee.com/linzhengtong/dsh-plugin-replay/issues"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"main": "./index.js",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": "./index.js",
|
|
32
|
+
"./client": "./lib/client.js",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"index.js",
|
|
37
|
+
"lib",
|
|
38
|
+
"cordis.patch.yml",
|
|
39
|
+
"README.md",
|
|
40
|
+
"docs/*.md"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=22.6"
|
|
44
|
+
},
|
|
45
|
+
"dsh": {
|
|
46
|
+
"bundle": {
|
|
47
|
+
"patch": "./cordis.patch.yml"
|
|
48
|
+
},
|
|
49
|
+
"client": {
|
|
50
|
+
"platform": "web",
|
|
51
|
+
"inject": [
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"catalog": {
|
|
56
|
+
"category": "other",
|
|
57
|
+
"summary": {
|
|
58
|
+
"en": "Blackbox: session replay for DeepSeek Harness. Rebuilds a session as a step-by-step timeline — what ran, what it cost, whether it failed — plus cost hotspots by tool and model. Structure only, never conversation content; local by default.",
|
|
59
|
+
"zh": "黑匣子:DSH 会话回放。把一次会话还原成逐步时间轴——做了什么、花了多少、成没成,并给出按工具与模型的花钱热点。只记结构不记内容,默认全本地。"
|
|
60
|
+
},
|
|
61
|
+
"capabilities": [
|
|
62
|
+
"session",
|
|
63
|
+
"fs",
|
|
64
|
+
"local-endpoint",
|
|
65
|
+
"dsh-client-ui-sidebar-right"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"test": "node --test test/*.test.mjs",
|
|
71
|
+
"check": "node scripts/check-listing.mjs"
|
|
72
|
+
}
|
|
73
|
+
}
|