dsh-coding-enhanced 0.6.6 → 0.7.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 CHANGED
@@ -265,6 +265,7 @@ Open **Settings → Coding Enhanced** (the same controls appear on the plugin's
265
265
  | Setting | Default | What it does |
266
266
  |---|---|---|
267
267
  | **Change gate** (`AI Change Review`) | on | the pre-write review gate for `review_write` / `review_patch` |
268
+ | **AI explanations** | on | require a short note for every added group; off = queue without notes and hide the AI rows |
268
269
  | **Workspace time machine** (`Turn Withdraw`) | on | turn-start snapshots, multi-turn withdraw and the restore action |
269
270
  | **Turns kept for withdraw** | 10 | how many recent turns stay withdrawable (1–50) |
270
271
  | **Snapshot nested git repositories** | on | include nested repositories' working files (excluding `.git`) |
package/lib/client.js CHANGED
@@ -40,6 +40,8 @@ window.__ModuleLoader__.load({
40
40
  resizeDiff: 'Drag to resize · double-click to reset',
41
41
  reviewTools: 'Review tools',
42
42
  autoReview: 'Pre-review',
43
+ aiExplain: 'AI explanations',
44
+ aiExplainDesc: 'Require a short note for every added group. Off: queue changes without notes.',
43
45
  autoReviewDesc: 'The agent must queue every edit with review_write / review_patch before it lands. Off: native write/edit.',
44
46
  reviewFeatureOff: 'AI Change Review is off in Settings. Enable it first, then use this switch.',
45
47
  reviewOn: 'On',
@@ -150,6 +152,8 @@ window.__ModuleLoader__.load({
150
152
  resizeDiff: '拖动调整高度 · 双击还原',
151
153
  reviewTools: 'Review 工具',
152
154
  autoReview: 'AI 改动预审查',
155
+ aiExplain: 'AI 解释',
156
+ aiExplainDesc: '每个新增块都要求一条说明。关闭后排队不再要求解释。',
153
157
  autoReviewDesc: 'AI 的每次改动都必须先进入 review(review_write / review_patch)才能落盘。关闭后走原生 write/edit。',
154
158
  reviewFeatureOff: '设置里的 AI Change Review 处于关闭状态,先启用后再用这个开关。',
155
159
  reviewOn: '开',
@@ -334,8 +338,8 @@ window.__ModuleLoader__.load({
334
338
  .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
339
  .wr-ai-line .wr-no{background:rgba(168,85,247,.10);color:transparent}
336
340
  .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}
341
+ .wr-ai-line .wr-ai-text{display:flex;align-items:flex-start;gap:.5em;white-space:normal;overflow:visible;color:var(--dsw-alias-label-secondary,#555)}
342
+ .wr-ai-line .wr-ai-text > span:last-child{min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;overflow:visible;text-overflow:clip}
339
343
  .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))}
340
344
  .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}
341
345
  .wr-comment:focus{outline:2px solid var(--dsw-alias-state-business-primary,#4d6bfe);outline-offset:-1px}
@@ -1003,6 +1007,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
1003
1007
  const [local, setLocal] = React.useState({})
1004
1008
  const [submitting, setSubmitting] = React.useState(false)
1005
1009
  const [error, setError] = React.useState(null)
1010
+ const [explain, setExplain] = React.useState(true)
1006
1011
  const finishedRef = React.useRef(false)
1007
1012
  const currentReviewRef = React.useRef(review)
1008
1013
  currentReviewRef.current = review
@@ -1221,7 +1226,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
1221
1226
  return anchors
1222
1227
  }
1223
1228
  const aiNote = (items, key) =>
1224
- items.map((note, index) =>
1229
+ explain !== true ? [] : items.map((note, index) =>
1225
1230
  React.createElement(
1226
1231
  'div',
1227
1232
  { className: 'wr-line wr-ai-line', key: `${key}-${index}`, title: note.text },
@@ -1453,6 +1458,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
1453
1458
 
1454
1459
  const enabled = flags?.review === true
1455
1460
  const auto = flags?.autoReview === true
1461
+ const explain = flags?.aiExplain !== false
1456
1462
 
1457
1463
  const toggleOpen = () => {
1458
1464
  if (!open && triggerRef.current !== null) {
@@ -1471,6 +1477,14 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
1471
1477
  if (result.ok === true) setFlags(result.value)
1472
1478
  }
1473
1479
 
1480
+ const toggleExplain = async () => {
1481
+ if (busy || flags === null || !enabled) return
1482
+ setBusy(true)
1483
+ const result = await call('setSettings', { aiExplain: !explain })
1484
+ setBusy(false)
1485
+ if (result.ok === true) setFlags(result.value)
1486
+ }
1487
+
1474
1488
  const popover = open && rect !== null
1475
1489
  ? ReactDOM.createPortal(
1476
1490
  React.createElement(
@@ -1498,26 +1512,53 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
1498
1512
  ),
1499
1513
  enabled
1500
1514
  ? React.createElement(
1501
- 'div',
1502
- { className: 'ce-review-row' },
1515
+ React.Fragment,
1516
+ null,
1503
1517
  React.createElement(
1504
1518
  'div',
1505
- { className: 'ce-review-text' },
1506
- React.createElement('div', { className: 'ce-review-row-title' }, typeof t === 'function' ? t('autoReview') : 'Pre-review'),
1507
- React.createElement('div', { className: 'ce-review-row-desc' }, typeof t === 'function' ? t('autoReviewDesc') : ''),
1519
+ { className: 'ce-review-row' },
1520
+ React.createElement(
1521
+ 'div',
1522
+ { className: 'ce-review-text' },
1523
+ React.createElement('div', { className: 'ce-review-row-title' }, typeof t === 'function' ? t('autoReview') : 'Pre-review'),
1524
+ React.createElement('div', { className: 'ce-review-row-desc' }, typeof t === 'function' ? t('autoReviewDesc') : ''),
1525
+ ),
1526
+ React.createElement(
1527
+ 'button',
1528
+ {
1529
+ type: 'button',
1530
+ role: 'switch',
1531
+ 'aria-checked': auto,
1532
+ 'aria-label': typeof t === 'function' ? t('autoReview') : 'Pre-review',
1533
+ className: `ce-switch${auto ? ' on' : ''}`,
1534
+ disabled: busy || flags === null,
1535
+ onClick: () => { void toggleAuto() },
1536
+ },
1537
+ React.createElement('span', { className: 'ce-switch-thumb' }),
1538
+ ),
1508
1539
  ),
1509
1540
  React.createElement(
1510
- 'button',
1511
- {
1512
- type: 'button',
1513
- role: 'switch',
1514
- 'aria-checked': auto,
1515
- 'aria-label': typeof t === 'function' ? t('autoReview') : 'Pre-review',
1516
- className: `ce-switch${auto ? ' on' : ''}`,
1517
- disabled: busy || flags === null,
1518
- onClick: () => { void toggleAuto() },
1519
- },
1520
- React.createElement('span', { className: 'ce-switch-thumb' }),
1541
+ 'div',
1542
+ { className: 'ce-review-row' },
1543
+ React.createElement(
1544
+ 'div',
1545
+ { className: 'ce-review-text' },
1546
+ React.createElement('div', { className: 'ce-review-row-title' }, typeof t === 'function' ? t('aiExplain') : 'AI explanations'),
1547
+ React.createElement('div', { className: 'ce-review-row-desc' }, typeof t === 'function' ? t('aiExplainDesc') : ''),
1548
+ ),
1549
+ React.createElement(
1550
+ 'button',
1551
+ {
1552
+ type: 'button',
1553
+ role: 'switch',
1554
+ 'aria-checked': explain,
1555
+ 'aria-label': typeof t === 'function' ? t('aiExplain') : 'AI explanations',
1556
+ className: `ce-switch${explain ? ' on' : ''}`,
1557
+ disabled: busy || flags === null,
1558
+ onClick: () => { void toggleExplain() },
1559
+ },
1560
+ React.createElement('span', { className: 'ce-switch-thumb' }),
1561
+ ),
1521
1562
  ),
1522
1563
  )
1523
1564
  : React.createElement('div', { className: 'ce-review-off' }, typeof t === 'function' ? t('reviewFeatureOff') : ''),
@@ -1781,6 +1822,7 @@ div:has(> [data-detail-document]) > [data-plugin-config]{order:-1}
1781
1822
  'div',
1782
1823
  { className: 'ce-card' },
1783
1824
  row('review', typeof t === 'function' ? t('settingsReview') : 'AI Change Review', typeof t === 'function' ? t('settingsReviewDesc') : ''),
1825
+ row('aiExplain', typeof t === 'function' ? t('aiExplain') : 'AI explanations', typeof t === 'function' ? t('aiExplainDesc') : 'Require a short note for every added group. Off: queue changes without notes.'),
1784
1826
  ),
1785
1827
  React.createElement('div', { className: 'ce-group-title' }, typeof t === 'function' ? t('settingsGroupWithdraw') : 'Turn withdraw'),
1786
1828
  React.createElement(
package/lib/index.js CHANGED
@@ -416,12 +416,14 @@ export function apply(ctx) {
416
416
  const settingsPath = path.join(root, 'settings.json')
417
417
  mkdirSync(root, { recursive: true })
418
418
 
419
- const featureFlags = { review: true, withdraw: true, autoReview: true, keepTurns: 10, nestedSnapshots: true, autoGc: true }
419
+ const featureFlags = { review: true, withdraw: true, autoReview: true, aiExplain: true, allowBlockingReviewWait: false, keepTurns: 10, nestedSnapshots: true, autoGc: true }
420
420
  try {
421
421
  const parsed = JSON.parse(readFileSync(settingsPath, 'utf8'))
422
422
  if (typeof parsed.review === 'boolean') featureFlags.review = parsed.review
423
423
  if (typeof parsed.withdraw === 'boolean') featureFlags.withdraw = parsed.withdraw
424
424
  if (typeof parsed.autoReview === 'boolean') featureFlags.autoReview = parsed.autoReview
425
+ if (typeof parsed.aiExplain === 'boolean') featureFlags.aiExplain = parsed.aiExplain
426
+ if (typeof parsed.allowBlockingReviewWait === 'boolean') featureFlags.allowBlockingReviewWait = parsed.allowBlockingReviewWait
425
427
  if (Number.isSafeInteger(parsed.keepTurns)) {
426
428
  featureFlags.keepTurns = Math.min(50, Math.max(1, parsed.keepTurns))
427
429
  }
@@ -864,7 +866,7 @@ export function apply(ctx) {
864
866
  })
865
867
 
866
868
  // ------------------------------------------------------- review gate ---
867
- const REVIEW_TOOLS = new Set(['write', 'edit', 'apply_patch'])
869
+ const REVIEW_TOOLS = new Set(['write', 'edit', 'apply_patch', 'str_replace_editor', 'multi_edit', 'notebook_edit'])
868
870
  const MAX_REVIEW_FILE_BYTES = 2 * 1024 * 1024
869
871
  const MAX_EDITABLE_BYTES = 200 * 1024
870
872
  /** sessionId -> review { id, sessionId, entries, virtual, submitted, finished, canceled, waiters } */
@@ -895,6 +897,8 @@ export function apply(ctx) {
895
897
  return review
896
898
  }
897
899
 
900
+ const hasNotes = (notes) => Array.isArray(notes) && notes.some((note) => note !== null && typeof note === 'object' && typeof note.text === 'string' && note.text.trim() !== '')
901
+
898
902
  const cleanupReview = (sessionId) => {
899
903
  const review = reviews.get(sessionId)
900
904
  if (review === undefined) return
@@ -1258,6 +1262,9 @@ export function apply(ctx) {
1258
1262
  targets.set(newTarget.relative, { ...newTarget, newFile: oldTarget === null })
1259
1263
  }
1260
1264
 
1265
+ if (featureFlags.aiExplain === true && !hasNotes(notes)) {
1266
+ throw new Error('AI explanations are on: add at least one notes entry with a non-empty text for each added group (path/line or hunk). Turn off AI explanations in the input bar to queue without notes.')
1267
+ }
1261
1268
  const review = ensureReview(session.id)
1262
1269
  const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'dsh-ce-patch-'))
1263
1270
  try {
@@ -1334,7 +1341,7 @@ export function apply(ctx) {
1334
1341
  const registerReviewTools = () => {
1335
1342
  ctx.tools.register(defineTool({
1336
1343
  name: 'review_write',
1337
- description: 'Queue a new file or a full-file rewrite for the user\'s review. This does not write the file: the change is held in the Code review tab until the user finishes. Use review_patch for edits to existing files. Add a short notes entry for each group of added lines so the reviewer sees your explanation. The result includes a reviewId and waitKey; reuse the persistent review waiter child with send_message, or start one, instead of blocking this turn.',
1344
+ description: 'Queue a new file or a full-file rewrite for the user\'s review. This does not write the file: the change is held in the Code review tab until the user finishes. Use review_patch for edits to existing files. Add a short notes entry for each group of added lines so the reviewer sees your explanation; notes are required while AI explanations are on. The result includes a reviewId and waitKey; send them to the persistent review waiter child (or start one) and continue; never call review_wait from the main agent.',
1338
1345
  parameters: {
1339
1346
  file_path: { type: 'string', required: true, description: 'Path to write, resolved like the write tool.' },
1340
1347
  content: { type: 'string', required: true, description: 'Full UTF-8 text content to write.' },
@@ -1357,15 +1364,18 @@ export function apply(ctx) {
1357
1364
  const session = exec.agent?.session
1358
1365
  if (session === undefined) return 'No active session.'
1359
1366
  if (featureFlags.review !== true) return 'The review gate is off. Use the write tool instead.'
1367
+ if (featureFlags.aiExplain === true && !hasNotes(args.notes)) {
1368
+ throw new Error('AI explanations are on: add at least one notes entry with a non-empty text for each added group (line or hunk). Turn off AI explanations in the input bar to queue without notes.')
1369
+ }
1360
1370
  const queued = await stageFileChange(session, { id: exec.callId, name: 'write', arguments: { file_path: args.file_path, content: args.content, notes: args.notes } })
1361
1371
  if (queued === undefined) return 'Could not queue this change (missing or invalid file_path).'
1362
- return `Queued for review: ${queued.entry.display} (${queued.review.entries.size} file(s) queued). Nothing is written until the user finishes. reviewId: ${queued.review.id}; waitKey: ${queued.review.waitKey}; if you already have a review waiter child, send_message it the id and key; otherwise start one; only call review_wait yourself if delegation is unavailable.`
1372
+ return `Queued for review: ${queued.entry.display} (${queued.review.entries.size} file(s) queued). Nothing is written until the user finishes. reviewId: ${queued.review.id}; waitKey: ${queued.review.waitKey}; send the id and key to the persistent review waiter child, or start one, and continue; do not call review_wait from the main agent.`
1363
1373
  },
1364
1374
  }), { when: () => featureFlags.review === true && featureFlags.autoReview === true })
1365
1375
 
1366
1376
  ctx.tools.register(defineTool({
1367
1377
  name: 'review_patch',
1368
- description: 'Queue a unified diff for the user\'s review. The patch must use ---/+++ headers and @@ hunks with paths relative to the working directory; a/ and b/ prefixes and diff --git headers are accepted. Use one patch per file when possible; multiple files are allowed. This does not modify the workspace: the change is held in the Code review tab until the user finishes. Add a short notes entry for each group of added lines so the reviewer sees your explanation. The result includes a reviewId and waitKey; reuse the persistent review waiter child with send_message, or start one, instead of blocking this turn. Example:\n--- a/src/app.ts\n+++ b/src/app.ts\n@@ -10,7 +10,9 @@\n const app = createApp()\n- app.use(oldRouter)\n+ app.use(newRouter)\n+ app.use(logger)\n app.listen(3000)\nAfter queueing every change for this turn, start a review waiter subagent with the reviewId and waitKey.',
1378
+ description: 'Queue a unified diff for the user\'s review. The patch must use ---/+++ headers and @@ hunks with paths relative to the working directory; a/ and b/ prefixes and diff --git headers are accepted. Use one patch per file when possible; multiple files are allowed. This does not modify the workspace: the change is held in the Code review tab until the user finishes. Add a short notes entry for each group of added lines so the reviewer sees your explanation; notes are required while AI explanations are on. The result includes a reviewId and waitKey; send them to the persistent review waiter child (or start one) and continue; never call review_wait from the main agent. Example:\n--- a/src/app.ts\n+++ b/src/app.ts\n@@ -10,7 +10,9 @@\n const app = createApp()\n- app.use(oldRouter)\n+ app.use(newRouter)\n+ app.use(logger)\n app.listen(3000)\nSend the reviewId and waitKey to the persistent review waiter child (or start one) and continue; do not call review_wait from the main agent.',
1369
1379
  parameters: {
1370
1380
  patch: { type: 'string', required: true, description: 'A unified diff (---/+++/@@) to queue for review.' },
1371
1381
  notes: {
@@ -1389,13 +1399,13 @@ export function apply(ctx) {
1389
1399
  if (session === undefined) return 'No active session.'
1390
1400
  if (featureFlags.review !== true) return 'The review gate is off. Use apply_patch or edit instead.'
1391
1401
  const queued = await stagePatch(session, exec, args.patch, args.notes)
1392
- return `Queued for review: ${queued.files.join(', ')} (${queued.review.entries.size} file(s) in this review). Nothing is written until the user finishes. reviewId: ${queued.review.id}; waitKey: ${queued.review.waitKey}; if you already have a review waiter child, send_message it the id and key; otherwise start one; only call review_wait yourself if delegation is unavailable.`
1402
+ return `Queued for review: ${queued.files.join(', ')} (${queued.review.entries.size} file(s) in this review). Nothing is written until the user finishes. reviewId: ${queued.review.id}; waitKey: ${queued.review.waitKey}; send the id and key to the persistent review waiter child, or start one, and continue; do not call review_wait from the main agent.`
1393
1403
  },
1394
1404
  }), { when: () => featureFlags.review === true && featureFlags.autoReview === true })
1395
1405
 
1396
1406
  ctx.tools.register(defineTool({
1397
1407
  name: 'review_wait',
1398
- description: 'Wait for a review. Recommended: call it from a review waiter subagent with the reviewId and waitKey from review_write/review_patch. It blocks only the calling agent; the main agent can continue or end its turn. As an owner fallback, omit both to wait on this session\'s review. Returns one structured result per file: applied, rejected (with the user\'s comment), edited, or failed.',
1408
+ description: 'Wait for a review. Only a review waiter subagent should call this: pass the reviewId and waitKey from review_write/review_patch. The main agent must not call it; if it does, the call is refused so the turn never blocks. Returns one structured result per file: applied, rejected (with the user\'s comment), edited, or failed.',
1399
1409
  parameters: {
1400
1410
  reviewId: { type: 'string', description: 'Review id returned by review_write/review_patch.' },
1401
1411
  waitKey: { type: 'string', description: 'Wait key returned by the same tool result.' },
@@ -1406,6 +1416,7 @@ export function apply(ctx) {
1406
1416
  additionalProperties: false,
1407
1417
  properties: {
1408
1418
  status: { type: 'string' },
1419
+ message: { type: 'string' },
1409
1420
  files: {
1410
1421
  type: 'array',
1411
1422
  items: {
@@ -1437,6 +1448,13 @@ export function apply(ctx) {
1437
1448
  review = reviews.get(session.id)
1438
1449
  if (review === undefined || review.entries.size === 0) return { status: 'empty', files: [] }
1439
1450
  }
1451
+ if (review.sessionId === session.id && featureFlags.allowBlockingReviewWait !== true) {
1452
+ return {
1453
+ status: 'blocked',
1454
+ files: [],
1455
+ message: 'The main agent must not call review_wait: start a review waiter subagent with the reviewId and waitKey (or send them to the existing persistent waiter) and continue; only the child may wait. If delegation is unavailable, the user can enable allowBlockingReviewWait in settings.',
1456
+ }
1457
+ }
1440
1458
  if (review.submitted !== true) {
1441
1459
  review.submitted = true
1442
1460
  bumpReview()
@@ -1455,7 +1473,7 @@ export function apply(ctx) {
1455
1473
  if (!REVIEW_TOOLS.has(exec.name)) return next()
1456
1474
  return {
1457
1475
  kind: 'deny',
1458
- reason: 'File changes must go through the review gate while Pre-review is on. Use review_write (new file / full file) or review_patch (unified diff); after queueing all changes start a review waiter subagent (or call review_wait if delegation is unavailable). Shell commands are outside the review.',
1476
+ reason: 'File changes must go through the review gate while Pre-review is on. Use review_write (new file / full file) or review_patch (unified diff) with notes; then send the reviewId/waitKey to the persistent review waiter child (or start one) and continue. Never call review_wait from the main agent. Shell commands are outside the review.',
1459
1477
  }
1460
1478
  }
1461
1479
 
@@ -1466,7 +1484,7 @@ export function apply(ctx) {
1466
1484
  name: 'tool:review-gate',
1467
1485
  order: 110,
1468
1486
  text: () => featureFlags.review === true && featureFlags.autoReview === true
1469
- ? '🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change, and you do not have a backstage pass. Queue every change with review_write (new file / full file) or review_patch (unified diff); when you have queued everything, hand the review to a review waiter subagent and continue. Do not use write/edit/apply_patch — that is the staff-only door, and the bouncer has a long memory. If a file is rejected, read the comment, say "fair enough", and revise. For every group of added lines, include a short notes entry ({"line": <new-file line>, "text": "why this group changed"}) so the human sees a purple explanation row; keep each note to 1-2 sentences. After queueing, do not call review_wait yourself. Use ONE persistent review waiter subagent per conversation: if you already have a waiter child id, send the new reviewId and waitKey to it with send_message; otherwise start it once with the subagent tool. Tell it to call review_wait with both and report the per-file outcomes. Then continue helping the user or end the turn; the waiter will wake you. If delegation is unavailable, call review_wait yourself as a fallback. This is house rules, not a suggestion. 💅'
1487
+ ? '🎟️ FILE-EDIT VELVET ROPE: The human personally reviews every file change. Queue every change with review_write (new file / full file) or review_patch (unified diff) and include a short notes entry for each added group (required while AI explanations are on). Do not use write/edit/apply_patch/str_replace_editor. Do not call review_wait yourself: send the reviewId/waitKey to the persistent review waiter subagent (or start one), then continue or end the turn; the waiter will wake you. If a file is rejected, read the comment and revise. This is house rules. 💅'
1470
1488
  : '',
1471
1489
  }), 'coding-enhanced: review prompt')
1472
1490
  })
@@ -1960,6 +1978,14 @@ export function apply(ctx) {
1960
1978
  featureFlags.autoReview = patch.autoReview
1961
1979
  changed = true
1962
1980
  }
1981
+ if (typeof patch.aiExplain === 'boolean' && patch.aiExplain !== featureFlags.aiExplain) {
1982
+ featureFlags.aiExplain = patch.aiExplain
1983
+ changed = true
1984
+ }
1985
+ if (typeof patch.allowBlockingReviewWait === 'boolean' && patch.allowBlockingReviewWait !== featureFlags.allowBlockingReviewWait) {
1986
+ featureFlags.allowBlockingReviewWait = patch.allowBlockingReviewWait
1987
+ changed = true
1988
+ }
1963
1989
  if (Number.isSafeInteger(patch.keepTurns)) {
1964
1990
  const next = Math.min(50, Math.max(1, patch.keepTurns))
1965
1991
  if (next !== featureFlags.keepTurns) {
@@ -1983,7 +2009,7 @@ export function apply(ctx) {
1983
2009
  cancelReview(review.id, (entry) => `The review gate was turned off in Settings. Nothing was written for "${entry.display}". Do not retry immediately; wait for the user.`)
1984
2010
  }
1985
2011
  }
1986
- return ok({ review: featureFlags.review, withdraw: featureFlags.withdraw, autoReview: featureFlags.autoReview, keepTurns: featureFlags.keepTurns, nestedSnapshots: featureFlags.nestedSnapshots, autoGc: featureFlags.autoGc, version: PLUGIN_VERSION })
2012
+ return ok({ review: featureFlags.review, withdraw: featureFlags.withdraw, autoReview: featureFlags.autoReview, aiExplain: featureFlags.aiExplain, allowBlockingReviewWait: featureFlags.allowBlockingReviewWait, keepTurns: featureFlags.keepTurns, nestedSnapshots: featureFlags.nestedSnapshots, autoGc: featureFlags.autoGc, version: PLUGIN_VERSION })
1987
2013
  }
1988
2014
 
1989
2015
  const handleUpdateCheck = async () => {
@@ -2048,7 +2074,7 @@ export function apply(ctx) {
2048
2074
  const dispatch = async (endpoint, payload) => {
2049
2075
  try {
2050
2076
  if (endpoint === 'status') return handleStatus(payload?.sessionId)
2051
- if (endpoint === 'settings') return ok({ review: featureFlags.review, withdraw: featureFlags.withdraw, autoReview: featureFlags.autoReview, keepTurns: featureFlags.keepTurns, nestedSnapshots: featureFlags.nestedSnapshots, autoGc: featureFlags.autoGc, version: PLUGIN_VERSION })
2077
+ if (endpoint === 'settings') return ok({ review: featureFlags.review, withdraw: featureFlags.withdraw, autoReview: featureFlags.autoReview, aiExplain: featureFlags.aiExplain, allowBlockingReviewWait: featureFlags.allowBlockingReviewWait, keepTurns: featureFlags.keepTurns, nestedSnapshots: featureFlags.nestedSnapshots, autoGc: featureFlags.autoGc, version: PLUGIN_VERSION })
2052
2078
  if (endpoint === 'setSettings') return updateSettings(payload)
2053
2079
  if (endpoint === 'cleanup') return ok(await cleanupSnapshots())
2054
2080
  if (endpoint === 'withdraw') return await handleWithdraw(payload)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-coding-enhanced",
3
- "version": "0.6.6",
3
+ "version": "0.7.0",
4
4
  "description": "The DSH change gate: queue AI edits before write, rewind turns with shadow-git snapshots, and hand review to a non-blocking waiter subagent.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",