dsh-vscode-mode 0.36.0 → 0.38.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/README.md +32 -4
- package/lib/client.js +68 -65
- package/lib/client.js.map +1 -1
- package/lib/index.js +1961 -222
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/dsh-vscodemode-html-plan/SKILL.md +1 -1
- package/src/archivePurge.ts +411 -0
- package/src/client/addToConversation.ts +77 -18
- package/src/client/htmlPlan/HtmlPlanPanel.ts +9 -13
- package/src/client/htmlPlan/planActions.ts +97 -23
- package/src/client/htmlPlan/planPage.ts +2 -2
- package/src/client/reviewBatch.ts +48 -1
- package/src/client/state/diffSummary.ts +2 -1
- package/src/client/styles/editor.css +3 -1
- package/src/client/ui/EditorView.ts +8 -9
- package/src/client/ui/SvnCommitDialog.ts +256 -31
- package/src/client/ui/svnCommitModel.ts +63 -0
- package/src/index.ts +13 -0
- package/src/pending/capture.ts +201 -34
- package/src/pending/decide.ts +33 -1
- package/src/pending/externalCapture.ts +171 -8
- package/src/pending/kernel.ts +13 -2
- package/src/pending/noteTool.ts +96 -0
- package/src/pending/notes.ts +83 -0
- package/src/pending/persist.ts +301 -51
- package/src/pending/provenance.ts +45 -11
- package/src/pending/receipt.ts +177 -0
- package/src/pending/store.ts +161 -69
- package/src/pending/vcs.ts +25 -7
- package/src/pending/verdict.ts +170 -0
- package/src/pendingCompat.ts +14 -1
- package/src/pendingRpc.ts +19 -1
- package/src/reviewDb.ts +63 -2
- package/src/reviewRpc.ts +47 -1
- package/src/rpc.ts +36 -4
- package/src/shared/pendingReview.ts +20 -2
- package/src/shared/review.ts +17 -0
- package/src/shared/reviewRegions.ts +48 -3
- package/src/shared/rpc.ts +7 -1
- package/src/slowLog.ts +74 -0
- package/src/textEncoding.probe.ts +1 -0
package/src/slowLog.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-vscode-mode host — 慢操作与事件循环阻塞观测。
|
|
3
|
+
* 职责:把「哪一步慢、卡了多久」写进插件日志,供卡顿定位;低于阈值零输出。
|
|
4
|
+
* 说明:宿主是单进程单事件循环,任何同步大活都会把所有 RPC 一起拖住,
|
|
5
|
+
* 所以除了单操作耗时,还要单独盯事件循环的最大延迟,并带上最近一次慢操作归因。
|
|
6
|
+
* @author ddj 2026年11月25号
|
|
7
|
+
*/
|
|
8
|
+
import { monitorEventLoopDelay } from 'node:perf_hooks'
|
|
9
|
+
import { performance } from 'node:perf_hooks'
|
|
10
|
+
import { log } from './log.js'
|
|
11
|
+
|
|
12
|
+
/** 单操作耗时告警阈值(毫秒)。 */
|
|
13
|
+
export const SLOW_MS = 300
|
|
14
|
+
/** 事件循环单次阻塞告警阈值(毫秒)。 */
|
|
15
|
+
export const BLOCKED_MS = 500
|
|
16
|
+
|
|
17
|
+
/** 最近一次超过阈值的操作,用于阻塞归因。 */
|
|
18
|
+
let recent: { name: string; ms: number } | undefined
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
* @author ddj 2026年11月25号
|
|
23
|
+
* @description: 记录一次操作耗时;超过阈值落一条 warn,并记住它供阻塞归因。
|
|
24
|
+
* @param name 操作名(如 `rpc:edrv.review.list`)
|
|
25
|
+
* @param ms 耗时毫秒
|
|
26
|
+
* @param note 附加说明(如条目数)
|
|
27
|
+
* @returns 无
|
|
28
|
+
*/
|
|
29
|
+
export function noteOperation(name: string, ms: number, note = ''): void {
|
|
30
|
+
if (ms < SLOW_MS) return
|
|
31
|
+
recent = { name, ms }
|
|
32
|
+
log.warn(`[slow] ${name} ${Math.round(ms)}ms${note ? ' ' + note : ''}`)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @public
|
|
37
|
+
* @author ddj 2026年11月25号
|
|
38
|
+
* @description: 开始计时;返回的函数在调用时结算。用闭包而不用 async 包装,避免改动既有返回类型。
|
|
39
|
+
* @param name 操作名
|
|
40
|
+
* @param note 附加说明
|
|
41
|
+
* @returns 结算函数
|
|
42
|
+
*/
|
|
43
|
+
export function beginOperation(name: string, note = ''): () => void {
|
|
44
|
+
const started = performance.now()
|
|
45
|
+
return () => { noteOperation(name, performance.now() - started, note) }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
* @author ddj 2026年11月25号
|
|
51
|
+
* @description: 启动事件循环看门狗:每个周期检查最大延迟,超过阈值就记一条并带上最近慢操作。
|
|
52
|
+
* @param intervalMs 检查周期(毫秒)
|
|
53
|
+
* @returns 可释放句柄
|
|
54
|
+
*/
|
|
55
|
+
export function startLoopWatchdog(intervalMs = 5000): { dispose(): void } {
|
|
56
|
+
const histogram = monitorEventLoopDelay({ resolution: 20 })
|
|
57
|
+
try { histogram.enable() } catch { /* 观测不可用不影响主流程 */ }
|
|
58
|
+
const timer = setInterval(() => {
|
|
59
|
+
try {
|
|
60
|
+
const worst = histogram.max / 1e6
|
|
61
|
+
histogram.reset()
|
|
62
|
+
if (!Number.isFinite(worst) || worst < BLOCKED_MS) return
|
|
63
|
+
const cause = recent ? `;最近慢操作 ${recent.name} ${Math.round(recent.ms)}ms` : ''
|
|
64
|
+
log.warn(`[slow] 事件循环阻塞 ${Math.round(worst)}ms${cause}`)
|
|
65
|
+
} catch { /* 统计失败不影响业务 */ }
|
|
66
|
+
}, intervalMs)
|
|
67
|
+
if (typeof timer.unref === 'function') timer.unref()
|
|
68
|
+
return {
|
|
69
|
+
dispose(): void {
|
|
70
|
+
clearInterval(timer)
|
|
71
|
+
try { histogram.disable() } catch { /* 已释放 */ }
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// probe
|