dsh-coding-enhanced 0.5.16 → 0.6.6
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 +0 -7
- package/README.md +76 -74
- package/docs/prior-art.md +194 -0
- package/docs/ui-directions/README.md +35 -0
- package/docs/ui-directions/index.html +869 -0
- package/docs/web-review-architecture.md +668 -0
- package/lib/client.js +306 -28
- package/lib/index.js +385 -60
- package/package.json +9 -6
package/lib/client.js
CHANGED
|
@@ -39,11 +39,16 @@ window.__ModuleLoader__.load({
|
|
|
39
39
|
fold: 'Fold',
|
|
40
40
|
resizeDiff: 'Drag to resize · double-click to reset',
|
|
41
41
|
reviewTools: 'Review tools',
|
|
42
|
-
autoReview: '
|
|
43
|
-
autoReviewDesc: 'The agent
|
|
42
|
+
autoReview: 'Pre-review',
|
|
43
|
+
autoReviewDesc: 'The agent must queue every edit with review_write / review_patch before it lands. Off: native write/edit.',
|
|
44
44
|
reviewFeatureOff: 'AI Change Review is off in Settings. Enable it first, then use this switch.',
|
|
45
45
|
reviewOn: 'On',
|
|
46
46
|
reviewOff: 'Off',
|
|
47
|
+
restoreBackup: 'Restore pre-withdraw files',
|
|
48
|
+
restoreBackupConfirm: 'Restore the workspace files to the state before the last withdraw? The withdrawn turn stays hidden from the model.',
|
|
49
|
+
restoreBackupDone: 'Restored {count} files from the pre-withdraw backup.',
|
|
50
|
+
restoreBackupFailed: 'Restore failed: {message}',
|
|
51
|
+
rewindGap: 'Turns {turns} have no snapshot (the plugin was off, installed later, or the snapshot was pruned); their changes will also be reverted.',
|
|
47
52
|
unfold: 'Unfold',
|
|
48
53
|
badge: 'Withdrawn',
|
|
49
54
|
files: 'restored {count} file(s)',
|
|
@@ -83,15 +88,20 @@ window.__ModuleLoader__.load({
|
|
|
83
88
|
editedNeedsApprove: 'Some files have your edits but are marked Reject. Approve them or reset the edits before finishing.',
|
|
84
89
|
settingsNav: 'Coding Enhanced',
|
|
85
90
|
settingsTitle: 'Coding Enhanced',
|
|
86
|
-
settingsSubtitle: '
|
|
91
|
+
settingsSubtitle: "DSH's change gate, workspace time machine, and non-blocking review handoff.",
|
|
92
|
+
positioning: 'Not another AI PR reviewer — a workflow layer for DSH agents.',
|
|
93
|
+
pillarGate: 'Pre-write gate',
|
|
94
|
+
pillarRewind: 'Multi-turn rewind',
|
|
95
|
+
pillarWaiter: 'Non-blocking waiter',
|
|
96
|
+
pillarRemote: 'Passkey web + cross-AI · next',
|
|
87
97
|
settingsReview: 'AI Change Review',
|
|
88
|
-
settingsReviewDesc: '
|
|
98
|
+
settingsReviewDesc: 'Queue every write/edit in the review tab; nothing lands until you finish. The main agent keeps working while the review waits.',
|
|
89
99
|
settingsWithdraw: 'Turn Withdraw',
|
|
90
100
|
settingsWithdrawDesc: 'Snapshot each turn and restore the workspace when you withdraw the latest turn.',
|
|
91
101
|
settingsLoading: 'Loading settings…',
|
|
92
102
|
settingsFailed: 'Could not update: {message}',
|
|
93
|
-
settingsGroupReview: '
|
|
94
|
-
settingsGroupWithdraw: '
|
|
103
|
+
settingsGroupReview: 'Change gate',
|
|
104
|
+
settingsGroupWithdraw: 'Workspace time machine',
|
|
95
105
|
settingsKeepTurns: 'Turns kept for withdraw',
|
|
96
106
|
settingsKeepTurnsDesc: 'How many recent turns stay withdrawable. Older snapshots are pruned automatically.',
|
|
97
107
|
settingsKeepTurnsInvalid: 'Enter a whole number from 1 to 50.',
|
|
@@ -105,7 +115,24 @@ window.__ModuleLoader__.load({
|
|
|
105
115
|
cleanupFailed: 'Cleanup failed: {message}',
|
|
106
116
|
rewindAction: 'Withdraw from here',
|
|
107
117
|
rewindConfirm: 'Withdraw turn {turn}? Turns {turn} through {latest} will be canceled in the model context, and the workspace will be restored to before turn {turn}.',
|
|
108
|
-
settingsFeatures: '
|
|
118
|
+
settingsFeatures: 'Change gate · time machine · handoff',
|
|
119
|
+
settingsGroupUpdates: 'Updates',
|
|
120
|
+
settingsAbout: 'About',
|
|
121
|
+
settingsAboutTitle: 'Coding Enhanced',
|
|
122
|
+
settingsAboutDesc: 'The DSH change gate: pre-write review, multi-turn withdraw, and a non-blocking review handoff. The full README lives on the plugin page and in the repository.',
|
|
123
|
+
settingsReadme: 'Open the full README',
|
|
124
|
+
settingsUpdates: 'Plugin updates',
|
|
125
|
+
settingsUpdatesDesc: 'Check npm for the latest release and install it from here.',
|
|
126
|
+
settingsCurrentVersion: 'Current version',
|
|
127
|
+
settingsCheckUpdates: 'Check for updates',
|
|
128
|
+
settingsCheckingUpdates: 'Checking npm…',
|
|
129
|
+
settingsUpToDate: 'Up to date.',
|
|
130
|
+
settingsUpdateAvailable: 'v{version} is available.',
|
|
131
|
+
settingsUpdateNow: 'Update now',
|
|
132
|
+
settingsUpdating: 'Updating…',
|
|
133
|
+
settingsUpdateDone: 'Installed v{version}. Restart DSH to load it.',
|
|
134
|
+
settingsUpdateFailed: 'Update failed: {message}',
|
|
135
|
+
settingsUpdateConfirm: 'Update to v{version}? DSH will need a restart.',
|
|
109
136
|
collecting: 'The agent is still proposing changes. Finish unlocks when it calls review_wait.',
|
|
110
137
|
waitingSubmit: 'Waiting for the agent…',
|
|
111
138
|
}
|
|
@@ -122,11 +149,16 @@ window.__ModuleLoader__.load({
|
|
|
122
149
|
fold: '折叠',
|
|
123
150
|
resizeDiff: '拖动调整高度 · 双击还原',
|
|
124
151
|
reviewTools: 'Review 工具',
|
|
125
|
-
autoReview: '
|
|
126
|
-
autoReviewDesc: 'AI
|
|
152
|
+
autoReview: 'AI 改动预审查',
|
|
153
|
+
autoReviewDesc: 'AI 的每次改动都必须先进入 review(review_write / review_patch)才能落盘。关闭后走原生 write/edit。',
|
|
127
154
|
reviewFeatureOff: '设置里的 AI Change Review 处于关闭状态,先启用后再用这个开关。',
|
|
128
155
|
reviewOn: '开',
|
|
129
156
|
reviewOff: '关',
|
|
157
|
+
restoreBackup: '恢复撤回前文件',
|
|
158
|
+
restoreBackupConfirm: '把工作区文件恢复到最近一次撤回前的状态?已撤销的轮次仍会对模型隐藏。',
|
|
159
|
+
restoreBackupDone: '已从撤回前备份恢复 {count} 个文件。',
|
|
160
|
+
restoreBackupFailed: '恢复失败:{message}',
|
|
161
|
+
rewindGap: '第 {turns} 轮没有快照(插件当时关闭、晚装或快照已被清理),这些轮次的改动也会被一并回退。',
|
|
130
162
|
unfold: '展开',
|
|
131
163
|
badge: '已撤销',
|
|
132
164
|
files: '恢复 {count} 个文件',
|
|
@@ -165,15 +197,20 @@ window.__ModuleLoader__.load({
|
|
|
165
197
|
editedNeedsApprove: '有文件包含你的修改但被标记为拒绝。请通过它们或还原修改后再完成。',
|
|
166
198
|
settingsNav: '编码增强',
|
|
167
199
|
settingsTitle: '编码增强',
|
|
168
|
-
settingsSubtitle: '
|
|
200
|
+
settingsSubtitle: 'DSH 的变更闸门、工作区时间机器、非阻塞 review 交接。',
|
|
201
|
+
positioning: '不是又一个 AI PR 审查器,而是 DSH agent 的工作流层。',
|
|
202
|
+
pillarGate: '写入前闸门',
|
|
203
|
+
pillarRewind: '多轮回退',
|
|
204
|
+
pillarWaiter: '非阻塞 waiter',
|
|
205
|
+
pillarRemote: 'Passkey Web + 跨 AI · 下一步',
|
|
169
206
|
settingsReview: 'AI 改动审查',
|
|
170
|
-
settingsReviewDesc: '每次 write/edit
|
|
207
|
+
settingsReviewDesc: '每次 write/edit 先进入审查页,Finish 前不落盘;review 等待期间主 agent 可以继续工作。',
|
|
171
208
|
settingsWithdraw: '撤回本轮',
|
|
172
209
|
settingsWithdrawDesc: '每轮开始时记录工作区快照;撤回最新一轮时恢复工作区。',
|
|
173
210
|
settingsLoading: '正在加载设置…',
|
|
174
211
|
settingsFailed: '更新失败:{message}',
|
|
175
|
-
settingsGroupReview: '
|
|
176
|
-
settingsGroupWithdraw: '
|
|
212
|
+
settingsGroupReview: '变更闸门',
|
|
213
|
+
settingsGroupWithdraw: '工作区时间机器',
|
|
177
214
|
settingsKeepTurns: '保留可撤回轮数',
|
|
178
215
|
settingsKeepTurnsDesc: '最近多少轮保持可撤回;更早的快照会自动清理。',
|
|
179
216
|
settingsKeepTurnsInvalid: '请输入 1–50 的整数。',
|
|
@@ -187,7 +224,24 @@ window.__ModuleLoader__.load({
|
|
|
187
224
|
cleanupFailed: '清理失败:{message}',
|
|
188
225
|
rewindAction: '从这里撤回',
|
|
189
226
|
rewindConfirm: '撤回第 {turn} 轮?第 {turn} 到第 {latest} 轮都会从模型上下文中撤销,工作区恢复到第 {turn} 轮开始前。',
|
|
190
|
-
settingsFeatures: '
|
|
227
|
+
settingsFeatures: '闸门 · 时间机器 · 交接',
|
|
228
|
+
settingsGroupUpdates: '更新',
|
|
229
|
+
settingsAbout: '关于',
|
|
230
|
+
settingsAboutTitle: 'Coding Enhanced',
|
|
231
|
+
settingsAboutDesc: 'DSH 变更闸门:写入前审查、多轮回退、非阻塞 review 交接。完整 README 在插件页和仓库里。',
|
|
232
|
+
settingsReadme: '打开完整 README',
|
|
233
|
+
settingsUpdates: '插件更新',
|
|
234
|
+
settingsUpdatesDesc: '检查 npm 最新版本,并在这里安装。',
|
|
235
|
+
settingsCurrentVersion: '当前版本',
|
|
236
|
+
settingsCheckUpdates: '检查更新',
|
|
237
|
+
settingsCheckingUpdates: '正在检查 npm…',
|
|
238
|
+
settingsUpToDate: '已是最新版本。',
|
|
239
|
+
settingsUpdateAvailable: '发现 v{version}。',
|
|
240
|
+
settingsUpdateNow: '立即更新',
|
|
241
|
+
settingsUpdating: '正在更新…',
|
|
242
|
+
settingsUpdateDone: '已安装 v{version},重启 DSH 后生效。',
|
|
243
|
+
settingsUpdateFailed: '更新失败:{message}',
|
|
244
|
+
settingsUpdateConfirm: '更新到 v{version}?需要重启 DSH。',
|
|
191
245
|
collecting: 'AI 还在提交改动;等它调用 review_wait 后即可完成。',
|
|
192
246
|
waitingSubmit: '等待 AI…',
|
|
193
247
|
}
|
|
@@ -208,6 +262,9 @@ window.__ModuleLoader__.load({
|
|
|
208
262
|
.wr-withdrawn-title{font-size:.92em;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary,#1a1a1a)}
|
|
209
263
|
.wr-withdrawn-desc{font-size:.82em;line-height:1.45;color:var(--dsw-alias-label-tertiary,#888);margin-top:.15em}
|
|
210
264
|
.wr-withdrawn-chip{flex:none;align-self:center;padding:.1em .55em;border-radius:.4em;background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#9a6700) 14%,transparent);color:var(--dsw-alias-state-warn-primary,#9a6700);font-size:.74em;font-weight:600;line-height:1.6;white-space:nowrap}
|
|
265
|
+
.wr-withdrawn-restore{flex:none;height:calc(22px + var(--dsh-content-font-delta,0px));padding:0 .55em;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.12));border-radius:999px;background:transparent;color:var(--dsw-alias-label-secondary);font-size:calc(12px + var(--dsh-content-font-delta,0px));line-height:1;cursor:pointer}
|
|
266
|
+
.wr-withdrawn-restore:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
267
|
+
.wr-withdrawn-restore:disabled{opacity:.5;cursor:default}
|
|
211
268
|
.wr-withdrawn-actions{display:inline-flex;align-items:center;gap:.35em;flex:none}
|
|
212
269
|
.wr-withdrawn-action{display:inline-flex;align-items:center;gap:.35em;padding:.15em .55em;border-radius:.45em;border:1px dashed color-mix(in srgb,var(--dsw-alias-state-warn-primary,#9a6700) 40%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#9a6700) 8%,transparent);color:var(--dsw-alias-state-warn-primary,#9a6700);font-size:.78em;line-height:1.5;white-space:nowrap}
|
|
213
270
|
.wr-withdrawn-action svg{width:1em;height:1em}
|
|
@@ -273,6 +330,12 @@ window.__ModuleLoader__.load({
|
|
|
273
330
|
.wr-diff-resize{flex:none;height:.75em;min-height:10px;cursor:ns-resize;background:linear-gradient(to bottom,transparent,color-mix(in srgb,var(--dsw-alias-border-l1,rgba(0,0,0,.08)) 60%,transparent));position:relative}
|
|
274
331
|
.wr-diff-resize::after{content:'';position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:2.4em;height:.25em;border-radius:999px;background:var(--dsw-alias-border-l3,rgba(0,0,0,.18))}
|
|
275
332
|
.wr-diff-resize:hover{background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#4d6bfe) 12%,transparent)}
|
|
333
|
+
.wr-ai-line{background:linear-gradient(90deg,rgba(124,58,237,.10),rgba(217,70,239,.07) 55%,rgba(34,211,238,.05));box-shadow:inset 2px 0 0 #a855f7;cursor:help}
|
|
334
|
+
.wr-ai-line:hover{background:linear-gradient(90deg,rgba(124,58,237,.15),rgba(217,70,239,.10) 55%,rgba(34,211,238,.07))}
|
|
335
|
+
.wr-ai-line .wr-no{background:rgba(168,85,247,.10);color:transparent}
|
|
336
|
+
.wr-ai-line .wr-ai-sign{color:#7c3aed;font-size:.6em;font-weight:800;letter-spacing:.02em;text-shadow:0 0 8px rgba(168,85,247,.35)}
|
|
337
|
+
.wr-ai-line .wr-ai-text{display:flex;align-items:center;gap:.5em;white-space:nowrap;overflow:hidden;color:var(--dsw-alias-label-secondary,#555)}
|
|
338
|
+
.wr-ai-line .wr-ai-text > span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
276
339
|
.wr-hunk{padding:.15em .5em;font-size:.78em;line-height:1.5;color:var(--dsw-alias-label-tertiary,#999);background:var(--dsw-alias-bg-base,#fafafa);border-top:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.06));border-bottom:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.06))}
|
|
277
340
|
.wr-comment{display:block;width:calc(100% - 1.4em);margin:.55em .7em .7em;box-sizing:border-box;min-height:2.8em;resize:vertical;padding:.4em .55em;border-radius:.5em;border:1px solid var(--dsw-alias-border-l3,rgba(0,0,0,.16));background:var(--dsw-alias-bg-base,#fafafa);color:inherit;font:inherit;font-size:.88em;line-height:1.5}
|
|
278
341
|
.wr-comment:focus{outline:2px solid var(--dsw-alias-state-business-primary,#4d6bfe);outline-offset:-1px}
|
|
@@ -304,11 +367,25 @@ window.__ModuleLoader__.load({
|
|
|
304
367
|
.ce-number:focus{border-color:var(--dsw-alias-state-business-primary,#4d6bfe);box-shadow:0 0 0 2px color-mix(in srgb,var(--dsw-alias-state-business-primary,#4d6bfe) 18%,transparent)}
|
|
305
368
|
.ce-number:disabled{opacity:.5}
|
|
306
369
|
.ce-number-unit{font-size:.78em;color:var(--dsw-alias-label-tertiary,#888)}
|
|
370
|
+
.ce-about .ce-row-desc{margin-top:.3em}
|
|
371
|
+
.ce-about-link{display:inline-flex;margin-top:.6em;font-size:.85em;font-weight:500;color:var(--dsw-alias-state-business-primary,#4d6bfe);text-decoration:none}
|
|
372
|
+
.ce-about-link:hover{text-decoration:underline}
|
|
373
|
+
.ce-update .ce-row{align-items:flex-start;gap:.8em}
|
|
374
|
+
.ce-update-actions{display:flex;gap:.4em;flex-wrap:wrap;justify-content:flex-end}
|
|
375
|
+
.ce-update-meta{margin-top:.35em;font-size:.76em;color:var(--dsw-alias-label-tertiary)}
|
|
376
|
+
.ce-action.primary{border-color:transparent;background:var(--dsw-alias-state-business-primary,#4d6bfe);color:#fff}
|
|
377
|
+
.ce-action.primary:hover:not(:disabled){filter:brightness(1.05)}
|
|
307
378
|
.ce-action{flex:none;padding:.4em .75em;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.12));border-radius:.5em;background:var(--dsw-alias-bg-base,#fafafa);color:var(--dsw-alias-label-primary,#1a1a1a);font-size:.82em;line-height:1.4;cursor:pointer}
|
|
308
379
|
.ce-action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(0,0,0,.06))}
|
|
309
380
|
.ce-action:disabled{opacity:.5;cursor:default}
|
|
310
381
|
.ce-error{font-size:.82em;line-height:1.45;color:var(--dsw-alias-state-error-primary,#cf222e);margin:.7em 0 0}
|
|
311
382
|
.ce-settings.compact{padding:0;max-width:none}
|
|
383
|
+
.ce-position{font-size:.87em;line-height:1.5;color:var(--dsw-alias-label-tertiary);margin:0 0 .75em}
|
|
384
|
+
.ce-position.compact{font-size:.82em;margin:.1em 0 .55em}
|
|
385
|
+
.ce-pillars{display:flex;flex-wrap:wrap;gap:.35em;margin:0 0 1.05em}
|
|
386
|
+
.ce-pillars.compact{margin-bottom:.7em}
|
|
387
|
+
.ce-pillar{display:inline-flex;align-items:center;padding:.18em .55em;border-radius:999px;border:1px solid color-mix(in srgb,var(--dsw-alias-state-business-primary,#6e40c9) 18%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#6e40c9) 7%,transparent);color:var(--dsw-alias-state-business-primary,#6e40c9);font-size:.76em;line-height:1.5;white-space:nowrap}
|
|
388
|
+
.ce-pillar.next{border-style:dashed;color:var(--dsw-alias-label-tertiary);background:transparent}
|
|
312
389
|
.ce-compact-title{font-size:.82em;line-height:1.4;font-weight:600;color:var(--dsw-alias-label-secondary,#555);margin:0 0 .45em}
|
|
313
390
|
.ce-group-title{font-size:.76em;line-height:1.4;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--dsw-alias-label-tertiary,#888);margin:1.1em 0 .45em}
|
|
314
391
|
.ce-group-title:first-of-type{margin-top:0}
|
|
@@ -549,6 +626,24 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
549
626
|
writeFold(sessionId, turn, next)
|
|
550
627
|
applyFold(turn, next)
|
|
551
628
|
}
|
|
629
|
+
const restoreBackup = async () => {
|
|
630
|
+
if (busy) return
|
|
631
|
+
const question = typeof t === 'function'
|
|
632
|
+
? t('restoreBackupConfirm')
|
|
633
|
+
: 'Restore the workspace files to the state before the last withdraw?'
|
|
634
|
+
if (typeof window.confirm === 'function' && !window.confirm(question)) return
|
|
635
|
+
setBusy(true)
|
|
636
|
+
const result = await call('restoreBackup', { sessionId })
|
|
637
|
+
setBusy(false)
|
|
638
|
+
const message = result.ok === true
|
|
639
|
+
? (typeof t === 'function'
|
|
640
|
+
? t('restoreBackupDone', { count: String(result.value?.restored ?? 0) })
|
|
641
|
+
: `Restored ${result.value?.restored ?? 0} files.`)
|
|
642
|
+
: (typeof t === 'function'
|
|
643
|
+
? t('restoreBackupFailed', { message: result.error?.message ?? 'unknown error' })
|
|
644
|
+
: `Restore failed: ${result.error?.message ?? 'unknown error'}`)
|
|
645
|
+
if (typeof window.alert === 'function') window.alert(message)
|
|
646
|
+
}
|
|
552
647
|
return React.createElement(
|
|
553
648
|
'span',
|
|
554
649
|
{ className: 'wr-withdrawn-actions' },
|
|
@@ -574,6 +669,19 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
574
669
|
? (typeof t === 'function' ? t('unfold') : 'Unfold')
|
|
575
670
|
: (typeof t === 'function' ? t('fold') : 'Fold'),
|
|
576
671
|
),
|
|
672
|
+
typeof value?.backupAt === 'number'
|
|
673
|
+
? React.createElement(
|
|
674
|
+
'button',
|
|
675
|
+
{
|
|
676
|
+
type: 'button',
|
|
677
|
+
className: 'wr-withdrawn-restore',
|
|
678
|
+
disabled: busy,
|
|
679
|
+
title: typeof t === 'function' ? t('restoreBackup') : 'Restore pre-withdraw files',
|
|
680
|
+
onClick: () => { void restoreBackup() },
|
|
681
|
+
},
|
|
682
|
+
typeof t === 'function' ? t('restoreBackup') : 'Restore pre-withdraw files',
|
|
683
|
+
)
|
|
684
|
+
: null,
|
|
577
685
|
)
|
|
578
686
|
}
|
|
579
687
|
const latest = value?.latestTurn
|
|
@@ -595,9 +703,22 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
595
703
|
: (typeof t === 'function' ? t('action') : 'Withdraw this turn')
|
|
596
704
|
const onClick = async () => {
|
|
597
705
|
if (busy) return
|
|
598
|
-
const
|
|
706
|
+
const snapshotTurns = Array.isArray(value?.snapshotTurns) ? value.snapshotTurns : []
|
|
707
|
+
const missing = []
|
|
708
|
+
if (rewind) {
|
|
709
|
+
for (let index = turn + 1; index <= latest; index += 1) {
|
|
710
|
+
if (!snapshotTurns.includes(index)) missing.push(index)
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
const gap = missing.length === 0
|
|
714
|
+
? ''
|
|
715
|
+
: (typeof t === 'function'
|
|
716
|
+
? t('rewindGap', { turns: missing.join(', ') })
|
|
717
|
+
: `Turns ${missing.join(', ')} have no snapshot; their changes will also be reverted.`)
|
|
718
|
+
const base = typeof t === 'function'
|
|
599
719
|
? (rewind ? t('rewindConfirm', { turn: String(turn), latest: String(latest) }) : t('confirm', { turn: String(turn) }))
|
|
600
720
|
: (rewind ? `Withdraw turns ${turn}–${latest}?` : `Withdraw turn ${turn}?`)
|
|
721
|
+
const question = gap === '' ? base : `${base}\n\n${gap}`
|
|
601
722
|
if (typeof window.confirm === 'function' && !window.confirm(question)) return
|
|
602
723
|
setBusy(true)
|
|
603
724
|
const result = await call('withdraw', { sessionId, turn })
|
|
@@ -1070,25 +1191,73 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1070
1191
|
const editing = localEntry.editing === true
|
|
1071
1192
|
const editedText = localEntry.editedAfter ?? entry.afterText ?? ''
|
|
1072
1193
|
|
|
1194
|
+
const notes = Array.isArray(entry.notes) ? entry.notes : []
|
|
1195
|
+
const anchorsFor = (hunk, hunkIndex) => {
|
|
1196
|
+
const anchors = new Map()
|
|
1197
|
+
const items = notes.filter((note) => {
|
|
1198
|
+
if (note === null || typeof note !== 'object') return false
|
|
1199
|
+
if (typeof note.line === 'number') {
|
|
1200
|
+
return hunk.lines.some((line) => line.type === 'add' && line.newNo === note.line)
|
|
1201
|
+
}
|
|
1202
|
+
if (typeof note.hunk === 'number') return note.hunk === hunkIndex + 1
|
|
1203
|
+
return hunkIndex === 0
|
|
1204
|
+
})
|
|
1205
|
+
for (const note of items) {
|
|
1206
|
+
let index = -1
|
|
1207
|
+
if (typeof note.line === 'number') {
|
|
1208
|
+
const found = hunk.lines.findIndex((line) => line.type === 'add' && line.newNo === note.line)
|
|
1209
|
+
if (found >= 0) index = found
|
|
1210
|
+
}
|
|
1211
|
+
if (index < 0) {
|
|
1212
|
+
for (let at = hunk.lines.length - 1; at >= 0; at -= 1) {
|
|
1213
|
+
if (hunk.lines[at].type === 'add') { index = at; break }
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
if (index < 0) index = hunk.lines.length - 1
|
|
1217
|
+
const list = anchors.get(index) ?? []
|
|
1218
|
+
list.push(note)
|
|
1219
|
+
anchors.set(index, list)
|
|
1220
|
+
}
|
|
1221
|
+
return anchors
|
|
1222
|
+
}
|
|
1223
|
+
const aiNote = (items, key) =>
|
|
1224
|
+
items.map((note, index) =>
|
|
1225
|
+
React.createElement(
|
|
1226
|
+
'div',
|
|
1227
|
+
{ className: 'wr-line wr-ai-line', key: `${key}-${index}`, title: note.text },
|
|
1228
|
+
React.createElement('span', { className: 'wr-no' }, ''),
|
|
1229
|
+
React.createElement('span', { className: 'wr-no' }, ''),
|
|
1230
|
+
React.createElement('span', { className: 'wr-sign wr-ai-sign', 'aria-hidden': true }, 'AI'),
|
|
1231
|
+
React.createElement(
|
|
1232
|
+
'span',
|
|
1233
|
+
{ className: 'wr-text wr-ai-text' },
|
|
1234
|
+
React.createElement('span', null, note.text),
|
|
1235
|
+
),
|
|
1236
|
+
),
|
|
1237
|
+
)
|
|
1238
|
+
|
|
1073
1239
|
const diff = entry.hunks.length === 0
|
|
1074
1240
|
? React.createElement('div', { className: 'wr-note' }, typeof t === 'function' ? t('noDiff') : 'No diff')
|
|
1075
|
-
: entry.hunks.map((hunk, hunkIndex) =>
|
|
1076
|
-
|
|
1241
|
+
: entry.hunks.map((hunk, hunkIndex) => {
|
|
1242
|
+
const anchors = anchorsFor(hunk, hunkIndex)
|
|
1243
|
+
return React.createElement(
|
|
1077
1244
|
'div',
|
|
1078
1245
|
{ key: `h${hunkIndex}` },
|
|
1079
1246
|
React.createElement('div', { className: 'wr-hunk' }, hunk.header),
|
|
1080
|
-
hunk.lines.
|
|
1081
|
-
React.createElement(
|
|
1247
|
+
hunk.lines.flatMap((line, lineIndex) => {
|
|
1248
|
+
const row = React.createElement(
|
|
1082
1249
|
'div',
|
|
1083
|
-
{ key: lineIndex
|
|
1250
|
+
{ key: `l${lineIndex}`, className: `wr-line ${line.type}` },
|
|
1084
1251
|
React.createElement('span', { className: 'wr-no' }, line.oldNo === null ? '' : line.oldNo),
|
|
1085
1252
|
React.createElement('span', { className: 'wr-no' }, line.newNo === null ? '' : line.newNo),
|
|
1086
1253
|
React.createElement('span', { className: 'wr-sign' }, line.type === 'add' ? '+' : line.type === 'del' ? '-' : ' '),
|
|
1087
1254
|
React.createElement('span', { className: 'wr-text' }, line.text === '' ? ' ' : line.text),
|
|
1088
|
-
)
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1255
|
+
)
|
|
1256
|
+
const items = anchors.get(lineIndex)
|
|
1257
|
+
return items === undefined ? [row] : [row, ...aiNote(items, `n${hunkIndex}-${lineIndex}`)]
|
|
1258
|
+
}),
|
|
1259
|
+
)
|
|
1260
|
+
})
|
|
1092
1261
|
|
|
1093
1262
|
return React.createElement(
|
|
1094
1263
|
'div',
|
|
@@ -1334,7 +1503,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1334
1503
|
React.createElement(
|
|
1335
1504
|
'div',
|
|
1336
1505
|
{ className: 'ce-review-text' },
|
|
1337
|
-
React.createElement('div', { className: 'ce-review-row-title' }, typeof t === 'function' ? t('autoReview') : '
|
|
1506
|
+
React.createElement('div', { className: 'ce-review-row-title' }, typeof t === 'function' ? t('autoReview') : 'Pre-review'),
|
|
1338
1507
|
React.createElement('div', { className: 'ce-review-row-desc' }, typeof t === 'function' ? t('autoReviewDesc') : ''),
|
|
1339
1508
|
),
|
|
1340
1509
|
React.createElement(
|
|
@@ -1343,7 +1512,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1343
1512
|
type: 'button',
|
|
1344
1513
|
role: 'switch',
|
|
1345
1514
|
'aria-checked': auto,
|
|
1346
|
-
'aria-label': typeof t === 'function' ? t('autoReview') : '
|
|
1515
|
+
'aria-label': typeof t === 'function' ? t('autoReview') : 'Pre-review',
|
|
1347
1516
|
className: `ce-switch${auto ? ' on' : ''}`,
|
|
1348
1517
|
disabled: busy || flags === null,
|
|
1349
1518
|
onClick: () => { void toggleAuto() },
|
|
@@ -1386,6 +1555,9 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1386
1555
|
const [turnsDraft, setTurnsDraft] = React.useState(null)
|
|
1387
1556
|
const [cleanupBusy, setCleanupBusy] = React.useState(false)
|
|
1388
1557
|
const [cleanupText, setCleanupText] = React.useState(null)
|
|
1558
|
+
const [update, setUpdate] = React.useState(null)
|
|
1559
|
+
const [updateBusy, setUpdateBusy] = React.useState(null)
|
|
1560
|
+
const [updateError, setUpdateError] = React.useState(null)
|
|
1389
1561
|
|
|
1390
1562
|
React.useEffect(() => {
|
|
1391
1563
|
let alive = true
|
|
@@ -1442,6 +1614,35 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1442
1614
|
}
|
|
1443
1615
|
}
|
|
1444
1616
|
|
|
1617
|
+
const checkUpdate = async () => {
|
|
1618
|
+
if (updateBusy !== null) return
|
|
1619
|
+
setUpdateBusy('check')
|
|
1620
|
+
setUpdateError(null)
|
|
1621
|
+
const result = await call('updateCheck')
|
|
1622
|
+
setUpdateBusy(null)
|
|
1623
|
+
if (result.ok === true) setUpdate(result.value)
|
|
1624
|
+
else setUpdateError(typeof t === 'function' ? t('settingsUpdateFailed', { message: result.error?.message ?? '' }) : String(result.error?.message ?? ''))
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
const installUpdate = async () => {
|
|
1628
|
+
if (updateBusy !== null || update === null || update.available !== true) return
|
|
1629
|
+
const question = typeof t === 'function'
|
|
1630
|
+
? t('settingsUpdateConfirm', { version: String(update.latest) })
|
|
1631
|
+
: `Update to v${update.latest}? DSH will need a restart.`
|
|
1632
|
+
if (typeof window.confirm === 'function' && !window.confirm(question)) return
|
|
1633
|
+
setUpdateBusy('install')
|
|
1634
|
+
setUpdateError(null)
|
|
1635
|
+
const result = await call('updateInstall')
|
|
1636
|
+
setUpdateBusy(null)
|
|
1637
|
+
if (result.ok === true) setUpdate({ ...update, ...result.value, available: false })
|
|
1638
|
+
else setUpdateError(typeof t === 'function' ? t('settingsUpdateFailed', { message: result.error?.message ?? '' }) : String(result.error?.message ?? ''))
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
React.useEffect(() => {
|
|
1642
|
+
if (flags === null) return
|
|
1643
|
+
void checkUpdate()
|
|
1644
|
+
}, [flags === null])
|
|
1645
|
+
|
|
1445
1646
|
const toggle = async (key) => {
|
|
1446
1647
|
if (busy !== null || flags === null) return
|
|
1447
1648
|
const next = { ...flags, [key]: flags[key] !== true }
|
|
@@ -1553,11 +1754,28 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1553
1754
|
'div',
|
|
1554
1755
|
{ className: wrapper },
|
|
1555
1756
|
compact === true
|
|
1556
|
-
? React.createElement('div', { className: 'ce-compact-title' }, typeof t === 'function' ? t('settingsFeatures') : '
|
|
1757
|
+
? React.createElement('div', { className: 'ce-compact-title' }, typeof t === 'function' ? t('settingsFeatures') : 'Change gate · time machine · handoff')
|
|
1557
1758
|
: React.createElement('h2', { className: 'ce-title' }, title),
|
|
1558
1759
|
compact === true
|
|
1559
1760
|
? null
|
|
1560
|
-
: React.createElement('p', { className: 'ce-sub' }, typeof t === 'function' ? t('settingsSubtitle') : '
|
|
1761
|
+
: React.createElement('p', { className: 'ce-sub' }, typeof t === 'function' ? t('settingsSubtitle') : "DSH's change gate, workspace time machine, and non-blocking review handoff."),
|
|
1762
|
+
React.createElement('p', { className: `ce-position${compact === true ? ' compact' : ''}` }, typeof t === 'function' ? t('positioning') : 'Not another AI PR reviewer — a workflow layer for DSH agents.'),
|
|
1763
|
+
React.createElement(
|
|
1764
|
+
'div',
|
|
1765
|
+
{ className: `ce-pillars${compact === true ? ' compact' : ''}` },
|
|
1766
|
+
...[
|
|
1767
|
+
['pillarGate', false],
|
|
1768
|
+
['pillarRewind', false],
|
|
1769
|
+
['pillarWaiter', false],
|
|
1770
|
+
['pillarRemote', true],
|
|
1771
|
+
].map(([key, next]) =>
|
|
1772
|
+
React.createElement(
|
|
1773
|
+
'span',
|
|
1774
|
+
{ key, className: `ce-pillar${next ? ' next' : ''}` },
|
|
1775
|
+
typeof t === 'function' ? t(key) : key,
|
|
1776
|
+
),
|
|
1777
|
+
),
|
|
1778
|
+
),
|
|
1561
1779
|
React.createElement('div', { className: 'ce-group-title' }, typeof t === 'function' ? t('settingsGroupReview') : 'Review'),
|
|
1562
1780
|
React.createElement(
|
|
1563
1781
|
'div',
|
|
@@ -1585,6 +1803,66 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
|
|
|
1585
1803
|
),
|
|
1586
1804
|
cleanupRow,
|
|
1587
1805
|
),
|
|
1806
|
+
React.createElement('div', { className: 'ce-group-title' }, typeof t === 'function' ? t('settingsGroupUpdates') : 'Updates'),
|
|
1807
|
+
React.createElement(
|
|
1808
|
+
'div',
|
|
1809
|
+
{ className: 'ce-card ce-update' },
|
|
1810
|
+
React.createElement(
|
|
1811
|
+
'div',
|
|
1812
|
+
{ className: 'ce-row' },
|
|
1813
|
+
React.createElement(
|
|
1814
|
+
'div',
|
|
1815
|
+
{ className: 'ce-row-text' },
|
|
1816
|
+
React.createElement('div', { className: 'ce-row-title' }, typeof t === 'function' ? t('settingsUpdates') : 'Plugin updates'),
|
|
1817
|
+
React.createElement(
|
|
1818
|
+
'div',
|
|
1819
|
+
{ className: 'ce-row-desc' },
|
|
1820
|
+
updateBusy === 'check'
|
|
1821
|
+
? (typeof t === 'function' ? t('settingsCheckingUpdates') : 'Checking npm…')
|
|
1822
|
+
: updateBusy === 'install'
|
|
1823
|
+
? (typeof t === 'function' ? t('settingsUpdating') : 'Updating…')
|
|
1824
|
+
: updateError !== null
|
|
1825
|
+
? updateError
|
|
1826
|
+
: update === null
|
|
1827
|
+
? (typeof t === 'function' ? t('settingsUpdatesDesc') : 'Check npm for the latest release and install it from here.')
|
|
1828
|
+
: update.updated === true
|
|
1829
|
+
? (typeof t === 'function' ? t('settingsUpdateDone', { version: String(update.to ?? update.latest) }) : `Installed v${update.to ?? update.latest}. Restart DSH to load it.`)
|
|
1830
|
+
: update.available === true
|
|
1831
|
+
? (typeof t === 'function' ? t('settingsUpdateAvailable', { version: String(update.latest) }) : `v${update.latest} is available.`)
|
|
1832
|
+
: (typeof t === 'function' ? t('settingsUpToDate') : 'Up to date.'),
|
|
1833
|
+
),
|
|
1834
|
+
React.createElement('div', { className: 'ce-update-meta' }, `${typeof t === 'function' ? t('settingsCurrentVersion') : 'Current version'} v${update?.current ?? flags?.version ?? '—'}`),
|
|
1835
|
+
),
|
|
1836
|
+
React.createElement(
|
|
1837
|
+
'div',
|
|
1838
|
+
{ className: 'ce-update-actions' },
|
|
1839
|
+
React.createElement(
|
|
1840
|
+
'button',
|
|
1841
|
+
{ type: 'button', className: 'ce-action', disabled: updateBusy !== null, onClick: () => { void checkUpdate() } },
|
|
1842
|
+
updateBusy === 'check' ? '…' : (typeof t === 'function' ? t('settingsCheckUpdates') : 'Check for updates'),
|
|
1843
|
+
),
|
|
1844
|
+
update !== null && update.available === true
|
|
1845
|
+
? React.createElement(
|
|
1846
|
+
'button',
|
|
1847
|
+
{ type: 'button', className: 'ce-action primary', disabled: updateBusy !== null, onClick: () => { void installUpdate() } },
|
|
1848
|
+
updateBusy === 'install' ? '…' : (typeof t === 'function' ? t('settingsUpdateNow') : 'Update now'),
|
|
1849
|
+
)
|
|
1850
|
+
: null,
|
|
1851
|
+
),
|
|
1852
|
+
),
|
|
1853
|
+
),
|
|
1854
|
+
React.createElement('div', { className: 'ce-group-title' }, typeof t === 'function' ? t('settingsAbout') : 'About'),
|
|
1855
|
+
React.createElement(
|
|
1856
|
+
'div',
|
|
1857
|
+
{ className: 'ce-card ce-about' },
|
|
1858
|
+
React.createElement('div', { className: 'ce-row-title' }, typeof t === 'function' ? t('settingsAboutTitle') : 'Coding Enhanced'),
|
|
1859
|
+
React.createElement('div', { className: 'ce-row-desc' }, typeof t === 'function' ? t('settingsAboutDesc') : 'The DSH change gate: pre-write review, multi-turn withdraw, and a non-blocking review handoff. The full README lives on the plugin page and in the repository.'),
|
|
1860
|
+
React.createElement(
|
|
1861
|
+
'a',
|
|
1862
|
+
{ className: 'ce-about-link', href: 'https://github.com/hello-2021/dsh-coding-enhanced#readme', target: '_blank', rel: 'noreferrer' },
|
|
1863
|
+
typeof t === 'function' ? t('settingsReadme') : 'Open the full README',
|
|
1864
|
+
),
|
|
1865
|
+
),
|
|
1588
1866
|
error !== null ? React.createElement('p', { className: 'ce-error' }, error) : null,
|
|
1589
1867
|
)
|
|
1590
1868
|
}
|