@herbertgao/pi-extensions 2026.11.4 → 2026.11.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.
Files changed (207) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +9 -9
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +5 -4
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -4
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +4 -4
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +6 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +22 -4
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/session-tokens.ts +3 -3
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +22 -2
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +5 -0
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +38 -6
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +2 -1
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +4 -4
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +6 -6
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +4 -4
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +3 -2
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-mode.ts +465 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-scope.ts +44 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  23. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +2 -4
  24. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +3 -5
  25. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +2 -4
  26. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +3 -5
  27. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +10 -0
  28. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  29. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +1 -1
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/asset-producer.md +1 -1
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +4 -4
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
  35. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +13 -7
  36. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/init.md +2 -0
  37. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +5 -3
  38. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +2 -2
  39. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  40. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  41. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +39 -22
  42. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +43 -15
  43. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +357 -139
  44. package/node_modules/@narumitw/pi-btw/CHANGELOG.md +8 -0
  45. package/node_modules/@narumitw/pi-btw/README.md +1 -0
  46. package/node_modules/@narumitw/pi-btw/dist/chunks/bring-to-main-VMICX6GU.ts +450 -0
  47. package/node_modules/@narumitw/pi-btw/dist/chunks/bring-to-main-VMICX6GU.ts.map +7 -0
  48. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-6GO5M6UJ.ts +142 -0
  49. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-6GO5M6UJ.ts.map +7 -0
  50. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-E4LBFYRH.ts +452 -0
  51. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-E4LBFYRH.ts.map +7 -0
  52. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-FWW662MW.ts +329 -0
  53. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-FWW662MW.ts.map +7 -0
  54. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-TPDBHPLD.ts +614 -0
  55. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-TPDBHPLD.ts.map +7 -0
  56. package/node_modules/@narumitw/pi-btw/dist/chunks/fullscreen-ui-4MJ3HOFJ.ts +1400 -0
  57. package/node_modules/@narumitw/pi-btw/dist/chunks/fullscreen-ui-4MJ3HOFJ.ts.map +7 -0
  58. package/node_modules/@narumitw/pi-btw/dist/chunks/import-main-updates-XFSIED52.ts +79 -0
  59. package/node_modules/@narumitw/pi-btw/dist/chunks/import-main-updates-XFSIED52.ts.map +7 -0
  60. package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-WHRN26NJ.ts +328 -0
  61. package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-WHRN26NJ.ts.map +7 -0
  62. package/node_modules/@narumitw/pi-btw/dist/chunks/menu-SYMLQYWC.ts +15 -0
  63. package/node_modules/@narumitw/pi-btw/dist/chunks/menu-SYMLQYWC.ts.map +7 -0
  64. package/node_modules/@narumitw/pi-btw/dist/chunks/transcript-pager-D7XAJC65.ts +824 -0
  65. package/node_modules/@narumitw/pi-btw/dist/chunks/transcript-pager-D7XAJC65.ts.map +7 -0
  66. package/node_modules/@narumitw/pi-btw/dist/index.ts +111 -4497
  67. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  68. package/node_modules/@narumitw/pi-btw/package.json +2 -2
  69. package/node_modules/@narumitw/pi-btw/src/btw.ts +55 -30
  70. package/node_modules/pi-antigravity/README.md +6 -2
  71. package/node_modules/pi-antigravity/package.json +9 -5
  72. package/node_modules/pi-antigravity/src/features/generate-image.ts +9 -3
  73. package/node_modules/pi-antigravity/src/features/google-search.ts +3 -2
  74. package/node_modules/pi-antigravity/src/image/image.ts +42 -4
  75. package/node_modules/pi-antigravity/src/index.ts +3 -1
  76. package/node_modules/pi-antigravity/src/models/models.ts +27 -2
  77. package/node_modules/pi-antigravity/src/search/search.ts +7 -2
  78. package/node_modules/pi-antigravity/src/stream/stream.ts +91 -15
  79. package/node_modules/pi-antigravity/src/types/types.ts +2 -0
  80. package/node_modules/pi-antigravity/src/utils/util.ts +7 -0
  81. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  82. package/node_modules/pi-lens/CHANGELOG.md +80 -0
  83. package/node_modules/pi-lens/README.md +2 -0
  84. package/node_modules/pi-lens/dist/{chunk-CM6BDY4E.js → chunk-2ADRLTM2.js} +2 -2
  85. package/node_modules/pi-lens/dist/{chunk-XO756WE5.js → chunk-2LVJQU3I.js} +15 -14
  86. package/node_modules/pi-lens/dist/{chunk-W5E72HJA.js → chunk-3FRI5H4T.js} +13 -1
  87. package/node_modules/pi-lens/dist/{chunk-N5CEGQPG.js → chunk-3HM4BUHR.js} +11 -11
  88. package/node_modules/pi-lens/dist/{chunk-UAKO2M6B.js → chunk-3QWVOBZJ.js} +30 -30
  89. package/node_modules/pi-lens/dist/{chunk-QB7T2PHK.js → chunk-46TQJSUE.js} +3 -1
  90. package/node_modules/pi-lens/dist/{chunk-ZZN74OGD.js → chunk-4ITEFRDH.js} +3 -2
  91. package/node_modules/pi-lens/dist/{chunk-C3YRO3EU.js → chunk-4NCDHTFI.js} +6 -6
  92. package/node_modules/pi-lens/dist/{chunk-G22UNQID.js → chunk-6I44EDNQ.js} +10 -10
  93. package/node_modules/pi-lens/dist/{chunk-OUYAUXAT.js → chunk-6MDM5MQT.js} +169 -56
  94. package/node_modules/pi-lens/dist/{chunk-CDFJF5YD.js → chunk-7JX3RNG4.js} +1 -1
  95. package/node_modules/pi-lens/dist/{chunk-PIIUNJIT.js → chunk-7WJ55KBN.js} +1 -1
  96. package/node_modules/pi-lens/dist/{chunk-ZMMHHXSW.js → chunk-A5TEJZGJ.js} +1 -0
  97. package/node_modules/pi-lens/dist/{chunk-HEA3EM23.js → chunk-ALIZWXHZ.js} +8 -8
  98. package/node_modules/pi-lens/dist/{chunk-MQ4PPCJB.js → chunk-AON2QIJF.js} +32 -36
  99. package/node_modules/pi-lens/dist/{chunk-DGKFWQK4.js → chunk-B2YUE6YD.js} +7 -7
  100. package/node_modules/pi-lens/dist/{chunk-GQTQUNCG.js → chunk-B6HXETWY.js} +20 -20
  101. package/node_modules/pi-lens/dist/{chunk-KR5VGMVT.js → chunk-BDR5MEZY.js} +9 -9
  102. package/node_modules/pi-lens/dist/{chunk-MRLH4MYU.js → chunk-BGLS5SDN.js} +1 -1
  103. package/node_modules/pi-lens/dist/{chunk-PRHYIA6X.js → chunk-BRESRQBE.js} +4 -4
  104. package/node_modules/pi-lens/dist/{chunk-5GEYJJHG.js → chunk-C6AODRNU.js} +7 -7
  105. package/node_modules/pi-lens/dist/{chunk-ZZSJAR76.js → chunk-CTB5BAJI.js} +24 -11
  106. package/node_modules/pi-lens/dist/{chunk-IICERRFF.js → chunk-CYUJB552.js} +4 -4
  107. package/node_modules/pi-lens/dist/{chunk-THYHUIDR.js → chunk-CZAWWXP6.js} +1 -1
  108. package/node_modules/pi-lens/dist/{chunk-QJJKOHLH.js → chunk-DBS736MA.js} +27 -27
  109. package/node_modules/pi-lens/dist/{chunk-XLAI7UYY.js → chunk-DOUAWKLO.js} +8 -8
  110. package/node_modules/pi-lens/dist/{chunk-LAHHGNAY.js → chunk-DVRJBQOJ.js} +12 -12
  111. package/node_modules/pi-lens/dist/{chunk-KV6GQOGN.js → chunk-E4VXKTBR.js} +28 -28
  112. package/node_modules/pi-lens/dist/{chunk-XKFO2SZV.js → chunk-F6FT6BVQ.js} +26 -26
  113. package/node_modules/pi-lens/dist/{chunk-VWLSU3XV.js → chunk-FCQSZQAT.js} +1 -1
  114. package/node_modules/pi-lens/dist/{chunk-X5BJ3G2P.js → chunk-FOEPIX76.js} +1 -1
  115. package/node_modules/pi-lens/dist/{chunk-F6BEQWAK.js → chunk-GMC4ZGYR.js} +4 -4
  116. package/node_modules/pi-lens/dist/{chunk-TOE2RRCS.js → chunk-GTTMQ6XB.js} +1 -1
  117. package/node_modules/pi-lens/dist/{chunk-5YSEQHJN.js → chunk-GUGKKGG7.js} +1 -1
  118. package/node_modules/pi-lens/dist/{chunk-OSEKJEUU.js → chunk-GVWIU7M7.js} +1 -1
  119. package/node_modules/pi-lens/dist/{chunk-TMNUTMT5.js → chunk-H65TYP6V.js} +25 -4
  120. package/node_modules/pi-lens/dist/{chunk-7R5GZIA6.js → chunk-HILZE4BQ.js} +5 -4
  121. package/node_modules/pi-lens/dist/{chunk-HYSKJMZK.js → chunk-HSYFLOZY.js} +2 -2
  122. package/node_modules/pi-lens/dist/{chunk-V2WDBOLZ.js → chunk-I32RSMH6.js} +7 -7
  123. package/node_modules/pi-lens/dist/chunk-I74RQGKA.js +88 -0
  124. package/node_modules/pi-lens/dist/{chunk-RNXOWDM6.js → chunk-IDCTDKIA.js} +3 -3
  125. package/node_modules/pi-lens/dist/{chunk-TYHPVE5H.js → chunk-IK4YS3KC.js} +8 -8
  126. package/node_modules/pi-lens/dist/{chunk-ZCQBNPRH.js → chunk-IL6PIV33.js} +2 -2
  127. package/node_modules/pi-lens/dist/{chunk-6GPB3JLL.js → chunk-J6BR5XN2.js} +2 -2
  128. package/node_modules/pi-lens/dist/{chunk-UC5AXW5Z.js → chunk-JKOZ2Z4U.js} +6 -6
  129. package/node_modules/pi-lens/dist/{chunk-WSSLVMDA.js → chunk-JZQGRARR.js} +7 -7
  130. package/node_modules/pi-lens/dist/{chunk-7UTSNTWM.js → chunk-K6WIBVMK.js} +4 -3
  131. package/node_modules/pi-lens/dist/{chunk-QVBOXT3L.js → chunk-KDCIG23C.js} +6 -6
  132. package/node_modules/pi-lens/dist/{chunk-NOWH2VA2.js → chunk-KFRDFAOE.js} +4 -4
  133. package/node_modules/pi-lens/dist/{chunk-NMUSOZ2D.js → chunk-KJ3AHOCK.js} +6 -6
  134. package/node_modules/pi-lens/dist/{chunk-E65WJVI5.js → chunk-KSTQ4VXT.js} +5 -5
  135. package/node_modules/pi-lens/dist/{chunk-4ENEJHF4.js → chunk-MAD4QJTP.js} +9 -9
  136. package/node_modules/pi-lens/dist/{chunk-KXMJLOZF.js → chunk-NBM7PNBP.js} +7 -7
  137. package/node_modules/pi-lens/dist/{chunk-7YTRG6YW.js → chunk-NE4EFHJX.js} +1 -1
  138. package/node_modules/pi-lens/dist/{chunk-AACN5GNE.js → chunk-NPNFGYLV.js} +3 -1
  139. package/node_modules/pi-lens/dist/{chunk-H3BVMK47.js → chunk-OPFNQBS5.js} +5 -5
  140. package/node_modules/pi-lens/dist/{chunk-WTB4GKMH.js → chunk-OTSTS7L2.js} +11 -2
  141. package/node_modules/pi-lens/dist/{chunk-JUZ67QZQ.js → chunk-PTSA6QKL.js} +7 -7
  142. package/node_modules/pi-lens/dist/{chunk-ZPM7ZIFL.js → chunk-Q2VCKC3X.js} +3 -3
  143. package/node_modules/pi-lens/dist/{chunk-2VZ3VN3N.js → chunk-QHOTTC4A.js} +2 -2
  144. package/node_modules/pi-lens/dist/{chunk-L7O774U7.js → chunk-QL37SGTS.js} +105 -13
  145. package/node_modules/pi-lens/dist/{chunk-FRUBVFXV.js → chunk-QMV2APEH.js} +27 -27
  146. package/node_modules/pi-lens/dist/{chunk-L4Y3ROKQ.js → chunk-QSCZAP24.js} +3 -3
  147. package/node_modules/pi-lens/dist/{chunk-IILEH3ZC.js → chunk-QUPYLQA4.js} +4 -4
  148. package/node_modules/pi-lens/dist/{chunk-3NPWO5UO.js → chunk-QUQY3IME.js} +4 -4
  149. package/node_modules/pi-lens/dist/{chunk-FGNSESAC.js → chunk-QWTHFFU6.js} +8 -8
  150. package/node_modules/pi-lens/dist/{chunk-EKNYSXFB.js → chunk-RQRKIRFY.js} +5 -5
  151. package/node_modules/pi-lens/dist/{chunk-NCLO6E6N.js → chunk-S3WFVG5P.js} +14 -21
  152. package/node_modules/pi-lens/dist/{chunk-RTFMDIKV.js → chunk-SG2JQ2YP.js} +1 -1
  153. package/node_modules/pi-lens/dist/{chunk-VO4JFPTV.js → chunk-SJQUWQR6.js} +2 -2
  154. package/node_modules/pi-lens/dist/{chunk-SLSMJPEF.js → chunk-SKVNHCT5.js} +32 -32
  155. package/node_modules/pi-lens/dist/{chunk-3HTZDY3C.js → chunk-TJQSYX3J.js} +3 -3
  156. package/node_modules/pi-lens/dist/{chunk-RNJFRXEN.js → chunk-TLWFZ66Y.js} +3 -3
  157. package/node_modules/pi-lens/dist/{chunk-LWOM6LVS.js → chunk-TN5CWX5D.js} +26 -26
  158. package/node_modules/pi-lens/dist/{chunk-UTJP6WOS.js → chunk-TQHOKMVZ.js} +11 -11
  159. package/node_modules/pi-lens/dist/{chunk-N56BNAA6.js → chunk-TYHOEX4V.js} +15 -15
  160. package/node_modules/pi-lens/dist/{chunk-QP33NKYC.js → chunk-UNBRHPHJ.js} +10 -10
  161. package/node_modules/pi-lens/dist/{chunk-EY6LY2HO.js → chunk-UOO4D2TK.js} +11 -11
  162. package/node_modules/pi-lens/dist/{chunk-47UCC4MM.js → chunk-UY745U35.js} +1 -1
  163. package/node_modules/pi-lens/dist/{chunk-ZDMFGACN.js → chunk-V7F7JHS5.js} +71 -55
  164. package/node_modules/pi-lens/dist/{chunk-PBZNYHMM.js → chunk-VGTBLTPN.js} +4 -4
  165. package/node_modules/pi-lens/dist/{chunk-L6WBJGQS.js → chunk-VPFRU5IG.js} +1 -1
  166. package/node_modules/pi-lens/dist/{chunk-Q6JQKWPK.js → chunk-VS2L7QDI.js} +8 -8
  167. package/node_modules/pi-lens/dist/{chunk-PXQ45SGD.js → chunk-W4CUK5G6.js} +2 -2
  168. package/node_modules/pi-lens/dist/{chunk-MKPDIAZH.js → chunk-WAA63ZJV.js} +1 -1
  169. package/node_modules/pi-lens/dist/{chunk-J3Q2NYJR.js → chunk-WS3UFJOU.js} +1 -1
  170. package/node_modules/pi-lens/dist/{chunk-T5QSLSMM.js → chunk-XAFZJEXY.js} +16 -16
  171. package/node_modules/pi-lens/dist/{chunk-YOXCCJDF.js → chunk-XPGH5O74.js} +56 -46
  172. package/node_modules/pi-lens/dist/{chunk-UXTQ3QPD.js → chunk-Y3EHLUPL.js} +2 -2
  173. package/node_modules/pi-lens/dist/{chunk-HSOBIN22.js → chunk-YF4G5NN5.js} +2 -2
  174. package/node_modules/pi-lens/dist/{chunk-SIQHOB6P.js → chunk-YQA34KAF.js} +7 -7
  175. package/node_modules/pi-lens/dist/{chunk-V67D6TMU.js → chunk-YT2VR4SL.js} +4 -4
  176. package/node_modules/pi-lens/dist/{chunk-CJS6WE66.js → chunk-ZOPXB2KK.js} +11 -11
  177. package/node_modules/pi-lens/dist/{chunk-H6FLQ5NW.js → chunk-ZPFLHB3R.js} +11 -11
  178. package/node_modules/pi-lens/dist/{chunk-ZVCDHYWZ.js → chunk-ZZDVGCGG.js} +6 -6
  179. package/node_modules/pi-lens/dist/index.js +537 -269
  180. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +6 -6
  181. package/node_modules/pi-lens/dist/mcp/cli.js +32 -32
  182. package/node_modules/pi-lens/dist/mcp/server.js +109 -109
  183. package/node_modules/pi-lens/dist/mcp/worker.js +49 -49
  184. package/node_modules/pi-lens/dist/probes/installer.js +13 -13
  185. package/node_modules/pi-lens/docs/agent-guide.md +2 -1
  186. package/node_modules/pi-lens/docs/agent-tools.md +13 -2
  187. package/node_modules/pi-lens/docs/configuration.md +9 -4
  188. package/node_modules/pi-lens/docs/defect-shapes.md +15 -1
  189. package/node_modules/pi-lens/docs/features.md +11 -1
  190. package/node_modules/pi-lens/docs/globalconfig.md +13 -0
  191. package/node_modules/pi-lens/docs/invariants/language-config.md +9 -1
  192. package/node_modules/pi-lens/docs/language-coverage.md +66 -0
  193. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +66 -20
  194. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +17 -13
  195. package/node_modules/pi-lens/docs/pi-lens-fixer.md +8 -6
  196. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +5 -1
  197. package/node_modules/pi-lens/docs/pi-lens-release.md +3 -2
  198. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +52 -11
  199. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  200. package/node_modules/pi-lens/docs/settings.md +7 -4
  201. package/node_modules/pi-lens/docs/usage.md +1 -0
  202. package/node_modules/pi-lens/package.json +2 -2
  203. package/node_modules/pi-lens/scripts/download-grammars.js +10 -0
  204. package/node_modules/pi-lens/scripts/grammars.lock.json +7 -0
  205. package/node_modules/pi-lens/vendor/grammars/tree-sitter-groovy.wasm +0 -0
  206. package/package.json +7 -7
  207. package/node_modules/pi-lens/dist/chunk-TGQDAG4B.js +0 -88
@@ -62,6 +62,10 @@
62
62
  const Z = { highlight: 100001, bar: 100005, picker: 100007, toast: 100010 };
63
63
  const EASE = 'cubic-bezier(0.22, 1, 0.36, 1)'; // ease-out-quint
64
64
  const PREFIX = 'impeccable-live';
65
+ // A removed element stays in the DOM, hidden by this attribute, so a
66
+ // framework that owns the node never reconciles against a missing child;
67
+ // Undo and Discard restore it by dropping the attribute.
68
+ const REMOVED_ATTR = 'data-impeccable-removed';
65
69
  const IMPECCABLE_COMMAND = (window.__IMPECCABLE_COMMAND_PREFIX__ || '/') + 'impeccable';
66
70
  const PICK_CURSOR_STYLE_ID = PREFIX + '-pick-cursor-style';
67
71
  const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
@@ -974,6 +978,16 @@
974
978
 
975
979
  function stripManualEditRuntimeState(root) {
976
980
  if (!root || root.nodeType !== 1) return;
981
+ // A removed element is gone as far as the agent is concerned: drop it from
982
+ // the clone rather than describing a hidden child it might regenerate.
983
+ // handleGo also runs this helper on the live selection. A connected node is
984
+ // the page, and a staged removal stays in the DOM, hidden, so Undo and
985
+ // Discard can restore it by clearing the attribute. Detaching it would
986
+ // also make a framework reconcile a missing child.
987
+ if (!root.isConnected) {
988
+ for (const removed of root.querySelectorAll('[' + REMOVED_ATTR + ']')) removed.remove();
989
+ root.removeAttribute(REMOVED_ATTR);
990
+ }
977
991
  unwrapMixedContentTextNodes(root);
978
992
  const nodes = [root, ...root.querySelectorAll('[data-impeccable-editable], [data-impeccable-original-text], [data-impeccable-text-wrap]')];
979
993
  for (const node of nodes) {
@@ -3130,11 +3144,12 @@
3130
3144
  let paramsPanelBody = null; // grid holding the knob cells
3131
3145
  let paramsCurrentValues = {}; // {paramId: value} - mirror of the visible variant's live values
3132
3146
  let tuneOpen = false; // whether the Tune popover is open right now
3133
- // Tune values a saved session carried across a reload: {sessionId, variant,
3134
- // values}. Cycling refreshes of that session and variant restore them (a
3135
- // resume refreshes more than once); a refresh for any other variant, or a
3136
- // knob edit, drops them.
3137
- let restoredParamValues = null;
3147
+ // Tune values to keep for one session and variant: {sessionId, variant,
3148
+ // values}. A reload restores them from the saved session and every knob
3149
+ // edit replaces them. Cycling refreshes of that session and variant keep
3150
+ // them (a resume, or the last progressive variant landing, refreshes more
3151
+ // than once); a refresh for any other variant drops them.
3152
+ let keptParamValues = null;
3138
3153
 
3139
3154
  // Theme-aware Tune popover. Appears as a drawer that slides out from the
3140
3155
  // contextual bar's bar-facing edge (below if the bar sits below the
@@ -3276,21 +3291,21 @@
3276
3291
  if (!values || typeof values !== 'object' || Array.isArray(values)) return;
3277
3292
  if (Object.keys(values).length === 0) return;
3278
3293
  const variant = Number(saved.visible != null ? saved.visible : saved.visibleVariant) || 0;
3279
- restoredParamValues = { sessionId: saved.id || null, variant, values: { ...values } };
3294
+ keptParamValues = { sessionId: saved.id || null, variant, values: { ...values } };
3280
3295
  }
3281
3296
 
3282
- function restoredParamValuesForVisibleVariant() {
3283
- const restored = restoredParamValues;
3284
- if (!restored) return null;
3285
- if (restored.sessionId === currentSessionId && restored.variant === visibleVariant) return restored.values;
3286
- restoredParamValues = null;
3297
+ function keptParamValuesForVisibleVariant() {
3298
+ const kept = keptParamValues;
3299
+ if (!kept) return null;
3300
+ if (kept.sessionId === currentSessionId && kept.variant === visibleVariant) return kept.values;
3301
+ keptParamValues = null;
3287
3302
  return null;
3288
3303
  }
3289
3304
 
3290
3305
  // The local save is what a reload resumes from, so an edit is saved there
3291
3306
  // as well as checkpointed to the server.
3292
3307
  function noteParamEdited() {
3293
- restoredParamValues = null;
3308
+ keptParamValues = { sessionId: currentSessionId, variant: visibleVariant, values: { ...paramsCurrentValues } };
3294
3309
  saveSession();
3295
3310
  queueCheckpoint('param_changed');
3296
3311
  }
@@ -3855,6 +3870,156 @@
3855
3870
  return out;
3856
3871
  }
3857
3872
 
3873
+ function ensureRemovedElementStyle() {
3874
+ if (document.getElementById(PREFIX + '-removed-style')) return;
3875
+ const style = document.createElement('style');
3876
+ style.id = PREFIX + '-removed-style';
3877
+ style.textContent = '[' + REMOVED_ATTR + '] { display: none !important; }';
3878
+ (document.head || document.documentElement).appendChild(style);
3879
+ }
3880
+
3881
+ // The text the applier and the verifier look for in source: a text leaf
3882
+ // (preferring one free of characters source tends to entity-encode, so the
3883
+ // literal search finds it), else the attribute that names the element, else
3884
+ // its id.
3885
+ function removalOriginalText(el) {
3886
+ const leaves = collectEditableTextRows(el, { isOwn: own })
3887
+ .map((row) => normalizeManualContextText(row.text))
3888
+ .filter(Boolean);
3889
+ const plain = leaves.find((text) => !/[&<>"]/.test(text));
3890
+ if (plain || leaves.length) return (plain || leaves[0]).slice(0, 200);
3891
+ for (const attr of ['alt', 'aria-label', 'title']) {
3892
+ const value = normalizeManualContextText(el.getAttribute?.(attr));
3893
+ if (value) return value.slice(0, 200);
3894
+ }
3895
+ for (const attr of ['src', 'href']) {
3896
+ const value = String(el.getAttribute?.(attr) || '').split(/[?#]/)[0];
3897
+ const base = value.split('/').filter(Boolean).pop();
3898
+ if (base) return base.slice(0, 200);
3899
+ }
3900
+ if (el.id) return el.id;
3901
+ const cls = [...(el.classList || [])].find((c) => c.indexOf('impeccable-') !== 0);
3902
+ if (cls) return cls;
3903
+ return normalizeManualContextText(el.textContent).slice(0, 200);
3904
+ }
3905
+
3906
+ function removalDisallowedReason(el) {
3907
+ if (!el || !el.isConnected || own(el)) return 'no_selection';
3908
+ const tag = el.tagName.toLowerCase();
3909
+ if (tag === 'html' || tag === 'body') return 'root';
3910
+ if (el.hasAttribute('data-impeccable-insert-placeholder')) return 'placeholder';
3911
+ if (el.closest('[data-impeccable-variants], [data-impeccable-carbonize]')) return 'variant';
3912
+ return null;
3913
+ }
3914
+
3915
+ // Remove badge: stage one removal op through the same buffer copy edits
3916
+ // use, hide the element, and offer Undo. The source edit happens when the
3917
+ // user clicks Apply, like every other staged edit.
3918
+ async function removeSelectedElement() {
3919
+ if (pendingApplyInFlight) { showManualApplyBusyToast(); return; }
3920
+ const target = selectedElement;
3921
+ const refused = removalDisallowedReason(target);
3922
+ if (refused) {
3923
+ if (refused !== 'no_selection') showToast('This element cannot be removed from here.', 3500);
3924
+ return;
3925
+ }
3926
+ const parent = target.parentElement;
3927
+ const ref = documentRefForElement(target);
3928
+ const originalText = removalOriginalText(target);
3929
+ if (!originalText) {
3930
+ // Nothing to find it by in source, so the applier could neither locate
3931
+ // nor verify the removal. Better to say so than to stage a dead op.
3932
+ showToast('Nothing identifies this element in source; give it an id or class, or remove it in the editor.', 5000);
3933
+ return;
3934
+ }
3935
+ const op = {
3936
+ ref,
3937
+ tag: target.tagName.toLowerCase(),
3938
+ elementId: target.id || null,
3939
+ classes: [...target.classList].filter((cls) => cls.indexOf('impeccable-') !== 0),
3940
+ originalText,
3941
+ deleted: true,
3942
+ removeElement: true,
3943
+ leaf: copyEditLeafContext(target, originalText, ''),
3944
+ };
3945
+ const contextRef = documentRefForElement(parent);
3946
+ if (contextRef) op.contextRef = contextRef;
3947
+ const container = copyEditContainerContext(parent);
3948
+ if (container) op.container = container;
3949
+ const sourceHint = sourceHintForElement(target);
3950
+ if (sourceHint) op.sourceHint = sourceHint;
3951
+ hideConfigureBarTooltip();
3952
+ let stashResult;
3953
+ try {
3954
+ const res = await fetch('http://localhost:' + PORT + '/manual-edit-stash?token=' + encodeURIComponent(TOKEN), {
3955
+ method: 'POST',
3956
+ headers: { 'Content-Type': 'application/json' },
3957
+ body: JSON.stringify({
3958
+ token: TOKEN,
3959
+ id: id8(),
3960
+ pageUrl: location.pathname,
3961
+ element: extractContext(parent || target),
3962
+ ops: [op],
3963
+ }),
3964
+ });
3965
+ if (!res.ok) {
3966
+ const errBody = await res.json().catch(() => ({}));
3967
+ throw new Error(errBody.error || ('HTTP ' + res.status));
3968
+ }
3969
+ stashResult = await res.json();
3970
+ } catch (err) {
3971
+ console.error('[impeccable] element removal stash failed:', err);
3972
+ showToast('Remove failed - retry or cancel', 4000);
3973
+ return;
3974
+ }
3975
+ ensureRemovedElementStyle();
3976
+ target.setAttribute(REMOVED_ATTR, ref || op.tag);
3977
+ selectedElement = null;
3978
+ exitConfigureToPicking('remove-element', { clearHover: true });
3979
+ updatePendingCounter(stashResult.pendingCount || 0);
3980
+ showToast('Removed ' + desc(target), 6000, {
3981
+ action: { label: 'Undo', onClick: () => undoElementRemoval(target, ref) },
3982
+ });
3983
+ }
3984
+
3985
+ async function undoElementRemoval(target, ref) {
3986
+ if (pendingApplyInFlight) { showManualApplyBusyToast(); return; }
3987
+ dismissToast();
3988
+ try {
3989
+ const res = await fetch(
3990
+ 'http://localhost:' + PORT + '/manual-edit-discard?token=' + encodeURIComponent(TOKEN)
3991
+ + '&pageUrl=' + encodeURIComponent(location.pathname)
3992
+ + '&ref=' + encodeURIComponent(ref || ''),
3993
+ { method: 'POST' },
3994
+ );
3995
+ if (res.status === 409) {
3996
+ // An Apply owns this page's edits (started from another tab, or
3997
+ // before our dock caught up); the removal stays staged and hidden.
3998
+ showToast('Apply is running; undo once it finishes', 4000);
3999
+ fetchPendingCount();
4000
+ return;
4001
+ }
4002
+ if (!res.ok) throw new Error('HTTP ' + res.status);
4003
+ const result = await res.json().catch(() => ({}));
4004
+ target.removeAttribute(REMOVED_ATTR);
4005
+ const remaining = remainingManualEditCount(result);
4006
+ if (remaining === null) fetchPendingCount();
4007
+ else updatePendingCounter(remaining);
4008
+ showToast('Restored ' + desc(target), 2500);
4009
+ } catch (err) {
4010
+ console.error('[impeccable] undo removal failed:', err);
4011
+ showToast('Undo failed - see console', 4000);
4012
+ }
4013
+ }
4014
+
4015
+ function restoreRemovedElement(op) {
4016
+ const ref = typeof op?.ref === 'string' ? op.ref : '';
4017
+ if (!ref) return;
4018
+ for (const el of document.querySelectorAll('[' + REMOVED_ATTR + ']')) {
4019
+ if (el.getAttribute(REMOVED_ATTR) === ref) el.removeAttribute(REMOVED_ATTR);
4020
+ }
4021
+ }
4022
+
3858
4023
  async function applyEditing() {
3859
4024
  if (pendingApplyInFlight) { showManualApplyBusyToast(); return; }
3860
4025
  const ops = [];
@@ -3983,7 +4148,7 @@
3983
4148
  }
3984
4149
 
3985
4150
  function pendingApplyLabel(count) {
3986
- return count === 1 ? 'Apply copy edit' : 'Apply copy edits';
4151
+ return count === 1 ? 'Apply edit' : 'Apply edits';
3987
4152
  }
3988
4153
 
3989
4154
  function showManualApplyBusyToast() {
@@ -4058,13 +4223,13 @@
4058
4223
  const max = Number(stored.repairMaxAttempts) || 3;
4059
4224
  return 'Fixing apply issue, attempt ' + attempt + '/' + max;
4060
4225
  }
4061
- if (stored?.phase === 'verifying') return 'Verifying copy edits';
4226
+ if (stored?.phase === 'verifying') return 'Verifying edits';
4062
4227
  const remaining = Number.isFinite(Number(stored?.remainingCount))
4063
4228
  ? Number(stored.remainingCount)
4064
4229
  : Number(fallbackCount) || 0;
4065
4230
  return remaining > 0
4066
- ? 'Applying ' + remaining + ' copy edit' + (remaining === 1 ? '' : 's')
4067
- : 'Verifying copy edits';
4231
+ ? 'Applying ' + remaining + ' edit' + (remaining === 1 ? '' : 's')
4232
+ : 'Verifying edits';
4068
4233
  }
4069
4234
 
4070
4235
  function resetManualApplyProgress(count) {
@@ -4120,7 +4285,7 @@
4120
4285
  }
4121
4286
  if (editBadgeEl && editBadgeEl.style.display !== 'none') {
4122
4287
  if (pendingApplyInFlight) renderEditBadge('idle-disabled');
4123
- else if (state === 'CONFIGURING' && selectedElement && hasTextRows(selectedElement)) renderEditBadge('idle');
4288
+ else if (state === 'CONFIGURING' && selectedElement) renderEditBadge('idle');
4124
4289
  }
4125
4290
  updateGlobalBarState();
4126
4291
  }
@@ -4130,32 +4295,46 @@
4130
4295
  retryDeclinedAgentTargets();
4131
4296
  clearStoredManualApplyState();
4132
4297
  if (pendingIntroAnimation) { pendingIntroAnimation.cancel(); pendingIntroAnimation = null; }
4298
+ renderPendingDockControls('normal', 0);
4133
4299
  if (pendingDockEl) pendingDockEl.style.display = 'none';
4134
4300
  if (pendingPillEl) {
4135
4301
  pendingPillEl.dataset.count = '0';
4136
4302
  pendingPillEl.style.display = 'none';
4137
- pendingPillEl.disabled = false;
4138
- pendingPillEl.setAttribute('aria-busy', 'false');
4139
- pendingPillEl.setAttribute('aria-label', 'Apply copy edits to source');
4140
- pendingPillEl.style.cursor = 'pointer';
4141
- pendingPillEl.style.filter = 'none';
4142
- pendingPillEl.style.transform = 'scale(1)';
4303
+ pendingPillEl.setAttribute('aria-label', 'Apply edits to source');
4143
4304
  }
4144
- if (pendingPillSpinnerEl) pendingPillSpinnerEl.style.display = 'none';
4145
- if (pendingPillLabelEl) pendingPillLabelEl.textContent = pendingApplyLabel(0);
4146
- if (pendingPillCountEl) {
4147
- pendingPillCountEl.textContent = '0';
4148
- pendingPillCountEl.style.display = 'inline-flex';
4305
+ if (pendingPillCountEl) pendingPillCountEl.textContent = '0';
4306
+ if (pendingTrashBtn) pendingTrashBtn.style.display = 'none';
4307
+ refreshLiveControlsForManualApply();
4308
+ }
4309
+
4310
+ // Sets every control the dock's modes differ in, so leaving a mode can never
4311
+ // leave its controls behind. 'normal': Apply and Discard enabled.
4312
+ // 'applying': a spinner, both disabled. 'decision': Keep fixing and Rollback.
4313
+ function renderPendingDockControls(mode, count) {
4314
+ const applying = mode === 'applying';
4315
+ const decision = mode === 'decision';
4316
+ const normal = !applying && !decision;
4317
+ if (pendingPillSpinnerEl) pendingPillSpinnerEl.style.display = applying ? 'inline-block' : 'none';
4318
+ if (pendingPillLabelEl) {
4319
+ pendingPillLabelEl.textContent = decision ? 'Apply needs attention'
4320
+ : applying ? manualApplyLoadingText(count) : pendingApplyLabel(count);
4321
+ }
4322
+ if (pendingPillCountEl) pendingPillCountEl.style.display = normal ? 'inline-flex' : 'none';
4323
+ if (pendingPillEl) {
4324
+ pendingPillEl.disabled = !normal;
4325
+ pendingPillEl.setAttribute('aria-busy', applying ? 'true' : 'false');
4326
+ pendingPillEl.style.cursor = applying ? 'wait' : decision ? 'default' : 'pointer';
4327
+ pendingPillEl.style.filter = applying ? 'brightness(0.98)' : 'none';
4328
+ pendingPillEl.style.transform = 'scale(1)';
4149
4329
  }
4150
4330
  if (pendingTrashBtn) {
4151
- pendingTrashBtn.style.display = 'none';
4152
- pendingTrashBtn.disabled = false;
4153
- pendingTrashBtn.style.cursor = 'pointer';
4154
- pendingTrashBtn.style.opacity = '1';
4331
+ pendingTrashBtn.style.display = decision ? 'none' : 'inline-flex';
4332
+ pendingTrashBtn.disabled = !normal;
4333
+ pendingTrashBtn.style.cursor = normal ? 'pointer' : 'not-allowed';
4334
+ pendingTrashBtn.style.opacity = normal ? '1' : '0.58';
4155
4335
  }
4156
- if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'none';
4157
- if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'none';
4158
- refreshLiveControlsForManualApply();
4336
+ if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = decision ? 'inline-flex' : 'none';
4337
+ if (pendingRollbackBtn) pendingRollbackBtn.style.display = decision ? 'inline-flex' : 'none';
4159
4338
  }
4160
4339
 
4161
4340
  function setPendingApplyLoading(loading, count) {
@@ -4165,24 +4344,7 @@
4165
4344
  const currentCount = count || parseInt(pendingPillEl.dataset.count || '0', 10) || 0;
4166
4345
  if (pendingApplyInFlight) storeManualApplyState(currentCount);
4167
4346
  else clearStoredManualApplyState();
4168
- if (pendingPillSpinnerEl) pendingPillSpinnerEl.style.display = pendingApplyInFlight ? 'inline-block' : 'none';
4169
- pendingPillLabelEl.textContent = pendingApplyInFlight
4170
- ? manualApplyLoadingText(currentCount)
4171
- : pendingApplyLabel(currentCount);
4172
- pendingPillCountEl.style.display = pendingApplyInFlight ? 'none' : 'inline-flex';
4173
- pendingPillEl.disabled = pendingApplyInFlight;
4174
- pendingPillEl.setAttribute('aria-busy', pendingApplyInFlight ? 'true' : 'false');
4175
- pendingPillEl.style.cursor = pendingApplyInFlight ? 'wait' : 'pointer';
4176
- pendingPillEl.style.filter = pendingApplyInFlight ? 'brightness(0.98)' : 'none';
4177
- pendingPillEl.style.transform = 'scale(1)';
4178
- pendingTrashBtn.disabled = pendingApplyInFlight;
4179
- pendingTrashBtn.style.cursor = pendingApplyInFlight ? 'not-allowed' : 'pointer';
4180
- pendingTrashBtn.style.opacity = pendingApplyInFlight ? '0.58' : '1';
4181
- if (pendingApplyInFlight) {
4182
- if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'none';
4183
- if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'none';
4184
- pendingTrashBtn.style.display = 'inline-flex';
4185
- }
4347
+ renderPendingDockControls(pendingApplyInFlight ? 'applying' : 'normal', currentCount);
4186
4348
  schedulePendingDockPosition();
4187
4349
  refreshLiveControlsForManualApply();
4188
4350
  }
@@ -4196,12 +4358,13 @@
4196
4358
  }
4197
4359
  pendingPillLabelEl.textContent = pendingApplyLabel(currentPageCount);
4198
4360
  pendingPillCountEl.textContent = String(currentPageCount);
4199
- pendingPillEl.setAttribute('aria-label', 'Apply ' + currentPageCount + ' copy edit' + (currentPageCount === 1 ? '' : 's') + ' to source');
4361
+ pendingPillEl.setAttribute('aria-label', 'Apply ' + currentPageCount + ' edit' + (currentPageCount === 1 ? '' : 's') + ' to source');
4200
4362
  pendingPillEl.style.display = 'inline-flex';
4201
4363
  pendingTrashBtn.style.display = 'inline-flex';
4202
4364
  pendingDockEl.style.display = 'inline-flex';
4203
4365
  pendingPillEl.dataset.count = String(currentPageCount);
4204
- if (pendingApplyInFlight || shouldResumeManualApplyLoading(currentPageCount)) setPendingApplyLoading(true, currentPageCount);
4366
+ if (readStoredManualApplyState()?.phase === 'repair-decision') showManualApplyDecision();
4367
+ else if (pendingApplyInFlight || shouldResumeManualApplyLoading(currentPageCount)) setPendingApplyLoading(true, currentPageCount);
4205
4368
  schedulePendingDockPosition();
4206
4369
  if (previousCount <= 0) playPendingIntroAnimation();
4207
4370
  }
@@ -4209,7 +4372,7 @@
4209
4372
  function maybeShowFirstSaveToast() {
4210
4373
  if (!firstSaveOfSession) return;
4211
4374
  firstSaveOfSession = false;
4212
- showToast('Saved. Click "Apply copy edits" to write changes.', 4500);
4375
+ showToast('Saved. Click "Apply edits" to write changes.', 4500);
4213
4376
  }
4214
4377
 
4215
4378
  async function fetchPendingCount() {
@@ -4228,7 +4391,7 @@
4228
4391
  async function onPendingPillClick() {
4229
4392
  const count = parseInt(pendingPillEl?.dataset.count || '0', 10);
4230
4393
  if (count <= 0 || pendingApplyInFlight) return;
4231
- const ok = confirm('Apply ' + count + ' copy edit' + (count === 1 ? '' : 's') + ' to source?');
4394
+ const ok = confirm('Apply ' + count + ' edit' + (count === 1 ? '' : 's') + ' to source?');
4232
4395
  if (!ok) return;
4233
4396
  let waitForSseCompletion = false;
4234
4397
  resetManualApplyProgress(count);
@@ -4275,7 +4438,7 @@
4275
4438
  async function onPendingTrashClick() {
4276
4439
  const count = parseInt(pendingPillEl?.dataset.count || '0', 10);
4277
4440
  if (count <= 0 || pendingApplyInFlight) return;
4278
- const ok = confirm('Discard ' + count + ' copy edit' + (count === 1 ? '' : 's') + ' on this page?');
4441
+ const ok = confirm('Discard ' + count + ' edit' + (count === 1 ? '' : 's') + ' on this page?');
4279
4442
  if (!ok) return;
4280
4443
  try {
4281
4444
  const res = await fetch(
@@ -4287,9 +4450,9 @@
4287
4450
  const restoreFailures = restoreDiscardedManualEdits(result.entries || []);
4288
4451
  updatePendingCounter(0);
4289
4452
  if (restoreFailures > 0) {
4290
- showToast('Discarded ' + count + ' copy edit' + (count === 1 ? '' : 's') + ' - refresh to reset ' + restoreFailures, 4000);
4453
+ showToast('Discarded ' + count + ' edit' + (count === 1 ? '' : 's') + ' - refresh to reset ' + restoreFailures, 4000);
4291
4454
  } else {
4292
- showToast('Discarded ' + count + ' copy edit' + (count === 1 ? '' : 's'), 2500);
4455
+ showToast('Discarded ' + count + ' edit' + (count === 1 ? '' : 's'), 2500);
4293
4456
  }
4294
4457
  } catch (err) {
4295
4458
  console.error('[impeccable] discard failed:', err);
@@ -4305,18 +4468,8 @@
4305
4468
  repairAttempt: numberOrNull(msg?.repair?.attempts) || numberOrNull(msg?.repair?.attempt) || 3,
4306
4469
  repairMaxAttempts: numberOrNull(msg?.repair?.maxAttempts) || 3,
4307
4470
  });
4308
- if (pendingPillSpinnerEl) pendingPillSpinnerEl.style.display = 'none';
4309
- if (pendingPillLabelEl) pendingPillLabelEl.textContent = 'Apply needs attention';
4310
- if (pendingPillCountEl) pendingPillCountEl.style.display = 'none';
4311
- if (pendingPillEl) {
4312
- pendingPillEl.disabled = true;
4313
- pendingPillEl.setAttribute('aria-busy', 'false');
4314
- pendingPillEl.style.cursor = 'default';
4315
- pendingPillEl.style.display = 'inline-flex';
4316
- }
4317
- if (pendingTrashBtn) pendingTrashBtn.style.display = 'none';
4318
- if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'inline-flex';
4319
- if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'inline-flex';
4471
+ renderPendingDockControls('decision', count);
4472
+ if (pendingPillEl) pendingPillEl.style.display = 'inline-flex';
4320
4473
  if (pendingDockEl) pendingDockEl.style.display = 'inline-flex';
4321
4474
  schedulePendingDockPosition();
4322
4475
  refreshLiveControlsForManualApply();
@@ -4332,9 +4485,6 @@
4332
4485
  { method: 'POST', keepalive: true },
4333
4486
  );
4334
4487
  if (!res.ok) throw new Error('HTTP ' + res.status);
4335
- if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'none';
4336
- if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'none';
4337
- if (pendingTrashBtn) pendingTrashBtn.style.display = 'inline-flex';
4338
4488
  } catch (err) {
4339
4489
  console.error('[impeccable] repair retry failed:', err);
4340
4490
  showToast('Repair retry failed - see console', 4000);
@@ -4356,9 +4506,9 @@
4356
4506
  );
4357
4507
  if (!res.ok) throw new Error('HTTP ' + res.status);
4358
4508
  const result = await res.json().catch(() => ({}));
4359
- clearStoredManualApplyState();
4509
+ setPendingApplyLoading(false);
4360
4510
  updatePendingCounter(numberOrNull(result.remainingCount) || 0);
4361
- showToast('Rolled back source; copy edits are still staged.', 3500);
4511
+ showToast('Rolled back source; edits are still staged.', 3500);
4362
4512
  } catch (err) {
4363
4513
  console.error('[impeccable] manual Apply rollback failed:', err);
4364
4514
  showToast('Rollback failed - see console', 4000);
@@ -4419,7 +4569,7 @@
4419
4569
  }
4420
4570
 
4421
4571
  if (msg.type === 'manual_edit_repair_rollback_done') {
4422
- clearStoredManualApplyState();
4572
+ setPendingApplyLoading(false);
4423
4573
  fetchPendingCount();
4424
4574
  return;
4425
4575
  }
@@ -4463,7 +4613,11 @@
4463
4613
  function restoreDiscardedManualEdits(entries) {
4464
4614
  let failures = 0;
4465
4615
  for (const entry of entries || []) {
4466
- for (const op of entry.ops || []) {
4616
+ // A removal that superseded a copy edit carries it; a discard that
4617
+ // drops both must restore the text as well as the element.
4618
+ const ops = (entry.ops || []).flatMap((op) => (op?.supersededOp ? [op, op.supersededOp] : [op]));
4619
+ for (const op of ops) {
4620
+ if (op?.removeElement === true) { restoreRemovedElement(op); continue; }
4467
4621
  if (restoreMixedTextNodeManualEdit(op)) continue;
4468
4622
  const el = findManualEditRestoreElement(op);
4469
4623
  if (!el || typeof op.originalText !== 'string' || !canRestoreManualEditElement(el, op)) {
@@ -4604,6 +4758,14 @@
4604
4758
  '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
4605
4759
  '<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/>' +
4606
4760
  '</svg>';
4761
+ const REMOVE_ELEMENT_LABEL = 'Remove element';
4762
+ const REMOVE_ELEMENT_ICON =
4763
+ '<svg width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
4764
+ '<path d="M3 4h8"/><path d="M5 4V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1"/><path d="M4 4l.5 7a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1L10 4"/>' +
4765
+ '</svg>';
4766
+ // Coral chip, ink glyph: the pencil's own recipe in a destructive hue, so
4767
+ // the two badges carry equal weight on light and dark pages.
4768
+ const REMOVE_BADGE_FILL = 'oklch(66% 0.17 30)';
4607
4769
 
4608
4770
  function usesShadowChromeRoot() {
4609
4771
  const root = liveUiRoot();
@@ -4842,40 +5004,49 @@
4842
5004
  if (mode === 'idle' || mode === 'idle-disabled') {
4843
5005
  const disabled = mode === 'idle-disabled';
4844
5006
  editBadgeEl.innerHTML = '';
4845
- const btn = document.createElement('button');
4846
- btn.type = 'button';
4847
- btn.innerHTML = EDIT_COPY_ICON;
4848
- btn.setAttribute('aria-label', EDIT_COPY_LABEL);
4849
- Object.assign(btn.style, calloutStyle(
4850
- disabled ? MUTED : PRIMARY_TEXT,
4851
- disabled ? HAIRLINE : ACCENT,
4852
- ));
4853
- Object.assign(btn.style, {
4854
- padding: '4px',
4855
- minWidth: '22px',
4856
- width: '22px',
4857
- height: '22px',
4858
- minHeight: '22px',
4859
- display: 'inline-flex',
4860
- alignItems: 'center',
4861
- justifyContent: 'center',
4862
- lineHeight: '0',
4863
- letterSpacing: '0',
4864
- background: disabled ? SURFACE : ACCENT,
4865
- });
4866
- if (disabled) {
4867
- btn.style.cursor = 'not-allowed';
4868
- btn.style.opacity = '0.55';
4869
- btn.disabled = true;
4870
- const disabledTip = EDIT_COPY_LABEL + ' is disabled while the current copy edit is applying';
4871
- btn.addEventListener('mouseenter', () => showConfigureBarTooltip(btn, disabledTip));
4872
- btn.addEventListener('mouseleave', hideConfigureBarTooltip);
4873
- } else {
4874
- btn.addEventListener('mouseenter', () => showConfigureBarTooltip(btn, EDIT_COPY_LABEL));
4875
- btn.addEventListener('mouseleave', hideConfigureBarTooltip);
4876
- btn.onclick = enterEditingMode;
5007
+ editBadgeEl.style.gap = '4px';
5008
+ const chip = (icon, label, fill, onClick) => {
5009
+ const btn = document.createElement('button');
5010
+ btn.type = 'button';
5011
+ btn.innerHTML = icon;
5012
+ btn.setAttribute('aria-label', label);
5013
+ Object.assign(btn.style, calloutStyle(
5014
+ disabled ? MUTED : PRIMARY_TEXT,
5015
+ disabled ? HAIRLINE : fill,
5016
+ ));
5017
+ Object.assign(btn.style, {
5018
+ padding: '4px',
5019
+ minWidth: '22px',
5020
+ width: '22px',
5021
+ height: '22px',
5022
+ minHeight: '22px',
5023
+ display: 'inline-flex',
5024
+ alignItems: 'center',
5025
+ justifyContent: 'center',
5026
+ lineHeight: '0',
5027
+ letterSpacing: '0',
5028
+ background: disabled ? SURFACE : fill,
5029
+ });
5030
+ if (disabled) {
5031
+ btn.style.cursor = 'not-allowed';
5032
+ btn.style.opacity = '0.55';
5033
+ btn.disabled = true;
5034
+ const disabledTip = label + ' is disabled while the current edit is applying';
5035
+ btn.addEventListener('mouseenter', () => showConfigureBarTooltip(btn, disabledTip));
5036
+ btn.addEventListener('mouseleave', hideConfigureBarTooltip);
5037
+ } else {
5038
+ btn.addEventListener('mouseenter', () => showConfigureBarTooltip(btn, label));
5039
+ btn.addEventListener('mouseleave', hideConfigureBarTooltip);
5040
+ btn.onclick = onClick;
5041
+ }
5042
+ return btn;
5043
+ };
5044
+ // The pencil only shows when there is copy to edit; Remove is the last
5045
+ // chip on every selection, the destructive action at the far end.
5046
+ if (selectedElement && hasTextRows(selectedElement)) {
5047
+ editBadgeEl.appendChild(chip(EDIT_COPY_ICON, EDIT_COPY_LABEL, ACCENT, enterEditingMode));
4877
5048
  }
4878
- editBadgeEl.appendChild(btn);
5049
+ editBadgeEl.appendChild(chip(REMOVE_ELEMENT_ICON, REMOVE_ELEMENT_LABEL, REMOVE_BADGE_FILL, removeSelectedElement));
4879
5050
  } else {
4880
5051
  // 'editing' - show Cancel + Save separated
4881
5052
  editBadgeEl.innerHTML = '';
@@ -4979,7 +5150,7 @@
4979
5150
  }
4980
5151
 
4981
5152
  // Build/rebuild the panel's contents for the current variant AND apply
4982
- // its defaults to the variant wrapper (so scoped CSS responds even before
5153
+ // its values to the variant wrapper (so scoped CSS responds even before
4983
5154
  // the user opens the popover). Visibility is governed by tuneOpen.
4984
5155
  function refreshParamsPanel() {
4985
5156
  if (state !== 'CYCLING') {
@@ -4990,9 +5161,9 @@
4990
5161
  }
4991
5162
  const variantEl = getVisibleVariantEl();
4992
5163
  const params = parseVariantParams(variantEl);
4993
- // Values saved before a reload come back for the variant they were saved
4994
- // on; a switch to any other variant starts from its defaults.
4995
- const restored = restoredParamValuesForVisibleVariant();
5164
+ // Values kept for this session and variant (restored by a reload, or the
5165
+ // last knob edit) come back; any other variant starts from its defaults.
5166
+ const kept = keptParamValuesForVisibleVariant();
4996
5167
  if (!variantEl || params.length === 0) {
4997
5168
  paramsCurrentValues = {};
4998
5169
  tuneOpen = false;
@@ -5001,7 +5172,7 @@
5001
5172
  return;
5002
5173
  }
5003
5174
  applyParamDefaults(variantEl, params);
5004
- if (restored) applySavedParamValues(variantEl, params, restored);
5175
+ if (kept) applySavedParamValues(variantEl, params, kept);
5005
5176
  buildParamsPanel(variantEl, params);
5006
5177
  if (tuneOpen) {
5007
5178
  // If already visible (variant cycled while open), refresh in place
@@ -6335,8 +6506,8 @@
6335
6506
  showToast('The previous live session no longer matches the source file, so it was discarded. Pick an element to start fresh.', 6000);
6336
6507
  }
6337
6508
 
6338
- function isJsxSourceFile(filePath) {
6339
- return /\.[cm]?[jt]sx$/i.test(String(filePath || ''));
6509
+ function isCompiledTemplateSourceFile(filePath) {
6510
+ return /\.([cm]?[jt]sx|vue|svelte)$/i.test(String(filePath || ''));
6340
6511
  }
6341
6512
 
6342
6513
  function sourceHasSessionWrapper(text, sessionId) {
@@ -6483,15 +6654,15 @@
6483
6654
  return;
6484
6655
  }
6485
6656
  rememberSessionFileMeta({ file: filePath });
6486
- if (isJsxSourceFile(filePath)) {
6657
+ if (isCompiledTemplateSourceFile(filePath)) {
6487
6658
  const liveWrapper = findVariantsWrapper(sessionId);
6488
6659
  if (liveWrapper && liveWrapper.querySelector('[data-impeccable-variant]:not([data-impeccable-variant="original"])')) {
6489
6660
  completeSourceInjection(liveWrapper, sessionId, { ...opts, filePath });
6490
6661
  return;
6491
6662
  }
6492
- // #454: never fetch/parse JSX. Missing wrap waits for mount (closed
6493
- // modal / other route). Insert scaffolds stay for late HMR. A replace
6494
- // scaffold with no variants after retries is a failed generation.
6663
+ // #454, #1279, #1282: never fetch/parse JSX, Vue or Svelte. Missing wrap waits for
6664
+ // mount (closed modal / other route). Insert scaffolds stay for late HMR.
6665
+ // A replace scaffold with no variants after retries is a failed generation.
6495
6666
  if (opts.generationCompleted && sessionId === currentSessionId) {
6496
6667
  const attempt = opts.attempt || 0;
6497
6668
  if (attempt < COMPLETED_SOURCE_FALLBACK_RETRIES) {
@@ -8035,8 +8206,11 @@
8035
8206
  return;
8036
8207
  }
8037
8208
  if (state !== 'PICKING' || !pickActive) return;
8038
- const target = document.elementFromPoint(e.clientX, e.clientY);
8039
- if (!target || !pickable(target) || target === hoveredElement) return;
8209
+ let target = document.elementFromPoint(e.clientX, e.clientY);
8210
+ if (own(target)) return;
8211
+ // Too small to pick (a bare <label>, an icon): take the nearest ancestor that is (#1297).
8212
+ while (target && !pickable(target)) target = target.parentElement;
8213
+ if (!target || target === hoveredElement) return;
8040
8214
  hoveredElement = target;
8041
8215
  showHighlight(target);
8042
8216
  }
@@ -8110,7 +8284,7 @@
8110
8284
  clearAnnotations();
8111
8285
  showAnnotOverlay(selectedElement);
8112
8286
  showBar('configure');
8113
- renderEditBadge(hasTextRows(selectedElement) ? 'idle' : 'hidden');
8287
+ renderEditBadge('idle');
8114
8288
  startScrollTracking();
8115
8289
  maybePrefetchPage();
8116
8290
  maybeWarnConditionalAncestor(selectedElement);
@@ -8190,9 +8364,17 @@
8190
8364
  sendEvent({ type: 'prefetch', pageUrl: path });
8191
8365
  }
8192
8366
 
8367
+ // Delete or Backspace with no modifier, the keyboard's way to the Remove
8368
+ // badge. It only acts on an empty prompt, so clearing typed text never
8369
+ // takes the element with it.
8370
+ function isRemoveKey(e) {
8371
+ return (e.key === 'Delete' || e.key === 'Backspace')
8372
+ && !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && !isImeKeydown(e);
8373
+ }
8374
+
8193
8375
  function shouldPassthroughElementNav(deepActive, e) {
8194
8376
  if (!deepActive || !own(deepActive)) return false;
8195
- if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return false;
8377
+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown' && !isRemoveKey(e)) return false;
8196
8378
  if (!/^(INPUT|TEXTAREA)$/.test(deepActive.tagName || '')) return false;
8197
8379
  if (deepActive.value) return false;
8198
8380
  if (deepActive.id === PREFIX + '-input' && state === 'CONFIGURING') return true;
@@ -8263,6 +8445,13 @@
8263
8445
  }
8264
8446
  }
8265
8447
 
8448
+ if (isRemoveKey(e) && state === 'CONFIGURING' && selectedElement && configureKind !== 'insert') {
8449
+ e.preventDefault();
8450
+ e.stopPropagation();
8451
+ removeSelectedElement();
8452
+ return;
8453
+ }
8454
+
8266
8455
  // Arrow/Enter nav works in PICKING (hover) and CONFIGURING (selected, input empty)
8267
8456
  var navEl = (state === 'PICKING') ? hoveredElement : (state === 'CONFIGURING') ? selectedElement : null;
8268
8457
  if (navEl && (e.key === 'ArrowUp' || e.key === 'ArrowDown' || (e.key === 'Enter' && state === 'PICKING'))) {
@@ -8287,7 +8476,7 @@
8287
8476
  clearAnnotations();
8288
8477
  showAnnotOverlay(selectedElement);
8289
8478
  showBar('configure');
8290
- renderEditBadge(hasTextRows(selectedElement) ? 'idle' : 'hidden');
8479
+ renderEditBadge('idle');
8291
8480
  startScrollTracking();
8292
8481
  return;
8293
8482
  }
@@ -8302,7 +8491,7 @@
8302
8491
  showAnnotOverlay(next);
8303
8492
  showBar('configure');
8304
8493
  disableInlineEdit();
8305
- renderEditBadge(hasTextRows(selectedElement) ? 'idle' : 'hidden');
8494
+ renderEditBadge('idle');
8306
8495
  startScrollTracking();
8307
8496
  }
8308
8497
  showHighlight(next);
@@ -8531,6 +8720,12 @@
8531
8720
  }
8532
8721
  return btoa(binary);
8533
8722
  }
8723
+ // CSSOM keeps url() as written, and a relative source can't load inside the rasterized SVG.
8724
+ function absolutizeUrls(cssText, base) {
8725
+ return cssText.replace(/url\((?:(['"])([^'"]*)\1|([^'")\s]+))\)/g, (orig, q = '', quoted, bare) => {
8726
+ try { return 'url(' + q + new URL(quoted ?? bare, base).href + q + ')'; } catch { return orig; }
8727
+ });
8728
+ }
8534
8729
  async function inlineFontUrls(cssText) {
8535
8730
  const urlRe = /url\((['"]?)(https?:\/\/[^'")\s]+)\1\)/g;
8536
8731
  const urls = new Set();
@@ -8562,7 +8757,7 @@
8562
8757
  const rules = sheet.cssRules;
8563
8758
  for (const rule of rules) {
8564
8759
  if (rule.constructor.name === 'CSSFontFaceRule' || rule.cssText?.startsWith('@font-face')) {
8565
- chunks.push(rule.cssText);
8760
+ chunks.push(absolutizeUrls(rule.cssText, sheet.href || document.baseURI));
8566
8761
  }
8567
8762
  }
8568
8763
  } catch {
@@ -8572,7 +8767,7 @@
8572
8767
  if (!res.ok) continue;
8573
8768
  const text = await res.text();
8574
8769
  let m2;
8575
- while ((m2 = fontFaceRe.exec(text))) chunks.push(m2[0]);
8770
+ while ((m2 = fontFaceRe.exec(text))) chunks.push(absolutizeUrls(m2[0], sheet.href));
8576
8771
  } catch { /* ignore; capture is best-effort */ }
8577
8772
  }
8578
8773
  }
@@ -9941,8 +10136,9 @@ void main() {
9941
10136
  toastEl = null;
9942
10137
  }
9943
10138
 
9944
- function showToast(message, duration) {
10139
+ function showToast(message, duration, opts) {
9945
10140
  dismissToast();
10141
+ const action = opts && opts.action;
9946
10142
  // Stack the toast above the global bar (which sits at bottom:14px) so
9947
10143
  // the two never overlap. Read the bar's actual rect - its height varies
9948
10144
  // with hover-expanded labels - and fall back to a sensible default
@@ -9959,11 +10155,33 @@ void main() {
9959
10155
  padding: '8px 16px', borderRadius: '8px',
9960
10156
  zIndex: Z.toast, opacity: '0',
9961
10157
  transition: 'opacity 0.25s ' + EASE + ', transform 0.25s ' + EASE,
9962
- pointerEvents: 'none', maxWidth: '420px', textAlign: 'center',
10158
+ pointerEvents: action ? 'auto' : 'none', maxWidth: '420px', textAlign: 'center',
9963
10159
  });
9964
10160
  toastEl = currentToast;
9965
10161
  currentToast.id = PREFIX + '-toast';
9966
- currentToast.textContent = message;
10162
+ if (action) {
10163
+ Object.assign(currentToast.style, {
10164
+ display: 'inline-flex', alignItems: 'center', gap: '12px', padding: '6px 6px 6px 16px',
10165
+ });
10166
+ const label = el('span', { whiteSpace: 'nowrap' });
10167
+ label.textContent = message;
10168
+ const btn = el('button', {
10169
+ fontFamily: FONT, fontSize: '12px', fontWeight: '600', lineHeight: '1',
10170
+ color: C.ink, background: C.brand, border: 'none', borderRadius: '999px',
10171
+ padding: '6px 11px', cursor: 'pointer', whiteSpace: 'nowrap',
10172
+ });
10173
+ btn.type = 'button';
10174
+ btn.textContent = action.label;
10175
+ btn.addEventListener('click', (e) => {
10176
+ e.preventDefault();
10177
+ e.stopPropagation();
10178
+ if (toastEl === currentToast) dismissToast();
10179
+ action.onClick();
10180
+ });
10181
+ currentToast.append(label, btn);
10182
+ } else {
10183
+ currentToast.textContent = message;
10184
+ }
9967
10185
  uiAppend(currentToast);
9968
10186
  requestAnimationFrame(() => {
9969
10187
  if (toastEl !== currentToast) return;
@@ -11923,7 +12141,7 @@ void main() {
11923
12141
  boxShadow: '0 4px 16px oklch(0% 0 0 / 0.16), 0 1px 3px oklch(0% 0 0 / 0.1)',
11924
12142
  transition: 'filter 0.12s ease, transform 0.1s ease, box-shadow 0.18s ease',
11925
12143
  });
11926
- pendingPillEl.title = 'Apply copy edits to source';
12144
+ pendingPillEl.title = 'Apply edits to source';
11927
12145
  pendingPillSpinnerEl = el('span', {
11928
12146
  display: 'none',
11929
12147
  width: '12px',
@@ -11938,7 +12156,7 @@ void main() {
11938
12156
  boxSizing: 'border-box',
11939
12157
  });
11940
12158
  pendingPillLabelEl = el('span', { lineHeight: '1', whiteSpace: 'nowrap' });
11941
- pendingPillLabelEl.textContent = 'Apply copy edits';
12159
+ pendingPillLabelEl.textContent = 'Apply edits';
11942
12160
  pendingPillCountEl = el('span', {
11943
12161
  display: 'inline-flex',
11944
12162
  alignItems: 'center',
@@ -12008,10 +12226,10 @@ void main() {
12008
12226
  textAlign: 'center',
12009
12227
  transition: 'opacity 0.16s ease, transform 0.18s ' + EASE,
12010
12228
  });
12011
- pendingTrashTooltipEl.textContent = 'Discard copy edits';
12229
+ pendingTrashTooltipEl.textContent = 'Discard edits';
12012
12230
  pendingTrashTooltipEl.setAttribute('role', 'tooltip');
12013
12231
  pendingTrashBtn.appendChild(pendingTrashTooltipEl);
12014
- pendingTrashBtn.setAttribute('aria-label', 'Discard copy edits on this page');
12232
+ pendingTrashBtn.setAttribute('aria-label', 'Discard edits on this page');
12015
12233
  const showTrashTooltip = () => {
12016
12234
  pendingTrashBtn.style.color = P.accent;
12017
12235
  pendingTrashBtn.style.boxShadow = '0 7px 22px oklch(0% 0 0 / 0.16), 0 2px 5px oklch(0% 0 0 / 0.1)';
@@ -12057,7 +12275,7 @@ void main() {
12057
12275
  pendingKeepFixingBtn.setAttribute('aria-label', 'Ask the agent to keep fixing Apply errors');
12058
12276
  pendingKeepFixingBtn.addEventListener('click', onPendingKeepFixingClick);
12059
12277
  pendingRollbackBtn = makePendingDecisionBtn('Rollback', false);
12060
- pendingRollbackBtn.setAttribute('aria-label', 'Rollback source and keep copy edits staged');
12278
+ pendingRollbackBtn.setAttribute('aria-label', 'Rollback source and keep edits staged');
12061
12279
  pendingRollbackBtn.addEventListener('click', onPendingRollbackClick);
12062
12280
 
12063
12281
  pendingDockEl.appendChild(pendingPillEl);