@allbluecn/web-app 0.27.40 → 0.28.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.
Files changed (299) hide show
  1. package/package.json +1 -1
  2. package/public/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  3. package/public/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  4. package/public/pdfjs/cmaps/78-H.bcmap +0 -0
  5. package/public/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  6. package/public/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  7. package/public/pdfjs/cmaps/78-V.bcmap +0 -0
  8. package/public/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  9. package/public/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  10. package/public/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  11. package/public/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  12. package/public/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  13. package/public/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  14. package/public/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  15. package/public/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  16. package/public/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  17. package/public/pdfjs/cmaps/Add-H.bcmap +0 -0
  18. package/public/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  19. package/public/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  20. package/public/pdfjs/cmaps/Add-V.bcmap +0 -0
  21. package/public/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  22. package/public/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  23. package/public/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  24. package/public/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  25. package/public/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  26. package/public/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  27. package/public/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  28. package/public/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  29. package/public/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  30. package/public/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  31. package/public/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  32. package/public/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  33. package/public/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  34. package/public/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  35. package/public/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  36. package/public/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  37. package/public/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  38. package/public/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  39. package/public/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  40. package/public/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  41. package/public/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  42. package/public/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  43. package/public/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  44. package/public/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  45. package/public/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  46. package/public/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  47. package/public/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  48. package/public/pdfjs/cmaps/B5-H.bcmap +0 -0
  49. package/public/pdfjs/cmaps/B5-V.bcmap +0 -0
  50. package/public/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  51. package/public/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  52. package/public/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  53. package/public/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  54. package/public/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  55. package/public/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  56. package/public/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  57. package/public/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  58. package/public/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  59. package/public/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  60. package/public/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  61. package/public/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  62. package/public/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  63. package/public/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  64. package/public/pdfjs/cmaps/EUC-H.bcmap +0 -0
  65. package/public/pdfjs/cmaps/EUC-V.bcmap +0 -0
  66. package/public/pdfjs/cmaps/Ext-H.bcmap +0 -0
  67. package/public/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  68. package/public/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  69. package/public/pdfjs/cmaps/Ext-V.bcmap +0 -0
  70. package/public/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  71. package/public/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  72. package/public/pdfjs/cmaps/GB-H.bcmap +4 -0
  73. package/public/pdfjs/cmaps/GB-V.bcmap +0 -0
  74. package/public/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  75. package/public/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  76. package/public/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  77. package/public/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  78. package/public/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  79. package/public/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  80. package/public/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  81. package/public/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  82. package/public/pdfjs/cmaps/GBT-H.bcmap +0 -0
  83. package/public/pdfjs/cmaps/GBT-V.bcmap +0 -0
  84. package/public/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  85. package/public/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  86. package/public/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  87. package/public/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  88. package/public/pdfjs/cmaps/H.bcmap +0 -0
  89. package/public/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  90. package/public/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  91. package/public/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  92. package/public/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  93. package/public/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  94. package/public/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  95. package/public/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  96. package/public/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  97. package/public/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  98. package/public/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  99. package/public/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  100. package/public/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  101. package/public/pdfjs/cmaps/Hankaku.bcmap +0 -0
  102. package/public/pdfjs/cmaps/Hiragana.bcmap +0 -0
  103. package/public/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  104. package/public/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  105. package/public/pdfjs/cmaps/KSC-H.bcmap +0 -0
  106. package/public/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  107. package/public/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  108. package/public/pdfjs/cmaps/KSC-V.bcmap +0 -0
  109. package/public/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  110. package/public/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  111. package/public/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  112. package/public/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  113. package/public/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  114. package/public/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  115. package/public/pdfjs/cmaps/Katakana.bcmap +0 -0
  116. package/public/pdfjs/cmaps/LICENSE +36 -0
  117. package/public/pdfjs/cmaps/NWP-H.bcmap +0 -0
  118. package/public/pdfjs/cmaps/NWP-V.bcmap +0 -0
  119. package/public/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  120. package/public/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  121. package/public/pdfjs/cmaps/Roman.bcmap +0 -0
  122. package/public/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  123. package/public/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  124. package/public/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  125. package/public/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  126. package/public/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  127. package/public/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  128. package/public/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  129. package/public/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  130. package/public/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  131. package/public/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  132. package/public/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  133. package/public/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  134. package/public/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  135. package/public/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  136. package/public/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  137. package/public/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  138. package/public/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  139. package/public/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  140. package/public/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  141. package/public/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  142. package/public/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  143. package/public/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  144. package/public/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  145. package/public/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  146. package/public/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  147. package/public/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  148. package/public/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  149. package/public/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  150. package/public/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  151. package/public/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  152. package/public/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  153. package/public/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  154. package/public/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  155. package/public/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  156. package/public/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  157. package/public/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  158. package/public/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  159. package/public/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  160. package/public/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  161. package/public/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  162. package/public/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  163. package/public/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  164. package/public/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  165. package/public/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  166. package/public/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  167. package/public/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  168. package/public/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  169. package/public/pdfjs/cmaps/V.bcmap +0 -0
  170. package/public/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  171. package/src/components/ai/ai-prompt-input/index.tsx +3 -87
  172. package/src/components/ai-elements/__tests__/context.test.tsx +167 -0
  173. package/src/components/ai-elements/context.tsx +182 -94
  174. package/src/components/ai-elements/prompt-input.tsx +6 -104
  175. package/src/components/harness/__tests__/composer-attachments.test.tsx +17 -9
  176. package/src/components/harness/__tests__/composer-click-focus.test.tsx +175 -0
  177. package/src/components/harness/__tests__/composer-focus.test.tsx +7 -0
  178. package/src/components/harness/__tests__/composer-keymap.test.ts +57 -0
  179. package/src/components/harness/__tests__/composer-paste.test.tsx +7 -0
  180. package/src/components/harness/__tests__/composer-pending-guard.test.tsx +207 -0
  181. package/src/components/harness/__tests__/composer-placeholder.test.ts +7 -6
  182. package/src/components/harness/__tests__/composer-plus-menu.test.tsx +202 -0
  183. package/src/components/harness/__tests__/composer-primary-button.test.tsx +7 -0
  184. package/src/components/harness/__tests__/composer-send.test.tsx +12 -4
  185. package/src/components/harness/__tests__/composer-undo.test.tsx +7 -0
  186. package/src/components/harness/__tests__/dock-registry.test.ts +3 -0
  187. package/src/components/harness/__tests__/harness-workbench-auth-error.test.tsx +42 -4
  188. package/src/components/harness/__tests__/mention-kbid.test.ts +69 -0
  189. package/src/components/harness/__tests__/undo-last-turn.test.ts +134 -0
  190. package/src/components/harness/__tests__/voice-activity.test.tsx +2 -2
  191. package/src/components/harness/conversation-panel/composer/__tests__/file-chip-open.test.tsx +195 -0
  192. package/src/components/harness/conversation-panel/composer/__tests__/menu-view.test.tsx +107 -0
  193. package/src/components/harness/conversation-panel/composer/command/__tests__/claim-attachments.test.tsx +271 -0
  194. package/src/components/harness/conversation-panel/composer/command/__tests__/claim-client-submit.test.tsx +291 -0
  195. package/src/components/harness/conversation-panel/composer/command/__tests__/claim-guard.test.tsx +275 -0
  196. package/src/components/harness/conversation-panel/composer/command/__tests__/command-permission.test.tsx +286 -0
  197. package/src/components/harness/conversation-panel/composer/command/__tests__/command-plan.test.tsx +344 -0
  198. package/src/components/harness/conversation-panel/composer/command/__tests__/command-popup.test.tsx +193 -0
  199. package/src/components/harness/conversation-panel/composer/command/__tests__/command-server-source.test.tsx +235 -0
  200. package/src/components/harness/conversation-panel/composer/command/__tests__/command-suggestion-menu.test.tsx +151 -1
  201. package/src/components/harness/conversation-panel/composer/command/__tests__/command-undo.test.tsx +168 -0
  202. package/src/components/harness/conversation-panel/composer/command/__tests__/exclude-composer-seat.test.ts +106 -0
  203. package/src/components/harness/conversation-panel/composer/command/__tests__/menu-view.test.tsx +55 -2
  204. package/src/components/harness/conversation-panel/composer/command/__tests__/skill-source.test.tsx +336 -0
  205. package/src/components/harness/conversation-panel/composer/command/claim.ts +7 -1
  206. package/src/components/harness/conversation-panel/composer/command/command-popup.tsx +140 -0
  207. package/src/components/harness/conversation-panel/composer/command/command-suggestion-menu.tsx +261 -75
  208. package/src/components/harness/conversation-panel/composer/command/menu-view.tsx +188 -50
  209. package/src/components/harness/conversation-panel/composer/command/popup-panel.tsx +106 -0
  210. package/src/components/harness/conversation-panel/composer/command/skill-source.ts +231 -0
  211. package/src/components/harness/conversation-panel/composer/composer-editor.tsx +216 -14
  212. package/src/components/harness/conversation-panel/composer/composer-keymap.ts +26 -0
  213. package/src/components/harness/conversation-panel/composer/extension/__tests__/command-menu.test.ts +128 -12
  214. package/src/components/harness/conversation-panel/composer/extension/command-menu.ts +303 -44
  215. package/src/components/harness/conversation-panel/composer/extension/index.ts +8 -0
  216. package/src/components/harness/conversation-panel/composer/harness-composer.tsx +551 -83
  217. package/src/components/harness/conversation-panel/composer/mention/__tests__/file-mention.test.tsx +517 -0
  218. package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-source-registration.test.tsx +5 -2
  219. package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-suggestion-menu.test.tsx +120 -0
  220. package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-trigger-source.test.ts +52 -9
  221. package/src/components/harness/conversation-panel/composer/mention/__tests__/story-mention.test.tsx +356 -0
  222. package/src/components/harness/conversation-panel/composer/mention/__tests__/thread-mention.test.tsx +377 -0
  223. package/src/components/harness/conversation-panel/composer/mention/file-mention.ts +162 -0
  224. package/src/components/harness/conversation-panel/composer/mention/mention-resolvers.ts +6 -0
  225. package/src/components/harness/conversation-panel/composer/mention/mention-suggestion-menu.tsx +212 -107
  226. package/src/components/harness/conversation-panel/composer/mention/mention-trigger-source.ts +71 -8
  227. package/src/components/harness/conversation-panel/composer/mention/story-mention.ts +131 -0
  228. package/src/components/harness/conversation-panel/composer/mention/thread-mention.ts +159 -0
  229. package/src/components/harness/conversation-panel/composer/mention/use-mention-sources.ts +9 -1
  230. package/src/components/harness/conversation-panel/composer/model-selector/__tests__/model-selector.test.tsx +401 -0
  231. package/src/components/harness/conversation-panel/composer/model-selector/__tests__/wiring.test.ts +117 -0
  232. package/src/components/harness/conversation-panel/composer/model-selector/model-selector-panel.tsx +411 -0
  233. package/src/components/harness/conversation-panel/composer/model-selector/model-selector-trigger.tsx +254 -0
  234. package/src/components/harness/conversation-panel/composer/model-selector/wiring.ts +112 -0
  235. package/src/components/harness/conversation-panel/composer/permission/__tests__/permission-select.test.tsx +264 -0
  236. package/src/components/harness/conversation-panel/composer/permission/permission-policy.ts +76 -0
  237. package/src/components/harness/conversation-panel/composer/permission/permission-popup.tsx +302 -0
  238. package/src/components/harness/conversation-panel/composer/permission/permission-select-button.tsx +140 -0
  239. package/src/components/harness/conversation-panel/composer/workspace/__tests__/workspace-select.test.tsx +390 -0
  240. package/src/components/harness/conversation-panel/composer/workspace/workspace-select-button.tsx +367 -0
  241. package/src/components/harness/conversation-panel/messages/harness-chain/__tests__/use-harness-session-putmedia.test.tsx +17 -0
  242. package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +26 -6
  243. package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +21 -3
  244. package/src/components/harness/extension-panel/dock/__tests__/dock-persist.test.ts +2 -1
  245. package/src/components/harness/extension-panel/dock/__tests__/guide-page.test.tsx +44 -3
  246. package/src/components/harness/extension-panel/dock/dock-persist.ts +6 -4
  247. package/src/components/harness/extension-panel/dock/dock-registry.ts +35 -14
  248. package/src/components/harness/extension-panel/dock/dock-surface.tsx +2 -0
  249. package/src/components/harness/extension-panel/dock/guide-page.tsx +75 -45
  250. package/src/components/harness/extension-panel/panels/browser/__tests__/webview-frame.test.tsx +5 -2
  251. package/src/components/harness/extension-panel/panels/plugin/__tests__/install-dialog.test.tsx +260 -0
  252. package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-page.test.tsx +912 -0
  253. package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-row.test.tsx +215 -0
  254. package/src/components/harness/extension-panel/panels/plugin/builtin-section.tsx +204 -0
  255. package/src/components/harness/extension-panel/panels/plugin/install-dialog.tsx +195 -0
  256. package/src/components/harness/extension-panel/panels/plugin/installed-section.tsx +378 -0
  257. package/src/components/harness/extension-panel/panels/plugin/kind.tsx +17 -4
  258. package/src/components/harness/extension-panel/panels/plugin/pending-builds-block.tsx +49 -0
  259. package/src/components/harness/extension-panel/panels/plugin/plugin-page.tsx +257 -0
  260. package/src/components/harness/extension-panel/panels/plugin/plugin-row.tsx +206 -0
  261. package/src/components/harness/extension-panel/panels/plugin/plugin-types.ts +13 -0
  262. package/src/components/harness/extension-panel/panels/plugin/worker-section.tsx +322 -0
  263. package/src/components/harness/workbench/__tests__/provider-model-groups.test.ts +301 -0
  264. package/src/components/harness/workbench/harness-workbench-page.tsx +164 -2
  265. package/src/components/harness/workbench/provider-model-groups.ts +140 -0
  266. package/src/components/harness/workbench/undo-last-turn.ts +79 -0
  267. package/src/components/harness/workbench/workbench-context.tsx +53 -3
  268. package/src/components/tiptap/hooks/__tests__/use-floating-element.test.tsx +131 -0
  269. package/src/components/tiptap/hooks/use-floating-element.ts +15 -2
  270. package/src/components/tiptap/hooks/use-menu-navigation.ts +5 -0
  271. package/src/components/tiptap/node/mention-extension.ts +33 -0
  272. package/src/components/tiptap/ui/suggestion-menu/__tests__/suggestion-menu.test.tsx +366 -0
  273. package/src/components/tiptap/ui/suggestion-menu/suggestion-menu-types.ts +54 -0
  274. package/src/components/tiptap/ui/suggestion-menu/suggestion-menu.tsx +176 -45
  275. package/src/lib/changelog/sdk-versions.ts +2 -2
  276. package/src/lib/queries/__tests__/harness-plugin-queries.test.ts +49 -0
  277. package/src/lib/queries/harness.ts +50 -0
  278. package/src/paraglide/messages/_index.js +1574 -311
  279. package/src/paraglide/messages/en.js +513 -103
  280. package/src/paraglide/messages/zh.js +514 -104
  281. package/src/routeTree.gen.ts +31 -0
  282. package/src/routes/_nav/harness/route.lazy.tsx +13 -0
  283. package/src/server/ai-gateway/sandbox/policy.ts +6 -6
  284. package/src/server/harness/__tests__/compact-plugin.server.test.ts +46 -0
  285. package/src/server/harness/__tests__/define-expose.test.ts +17 -0
  286. package/src/server/harness/__tests__/thread-reference.server.test.ts +258 -0
  287. package/src/server/harness/define.server.ts +21 -3
  288. package/src/server/harness/thread-reference.server.ts +446 -0
  289. package/src/server/serverFns/chat/__tests__/conversations-sandbox-default.test.ts +23 -0
  290. package/src/server/serverFns/chat/conversations.ts +18 -3
  291. package/src/server/serverFns/harness/search-mention-candidates.ts +14 -1
  292. package/src/shared/harness/__tests__/thread-reference-format.test.ts +128 -0
  293. package/src/shared/harness/thread-reference-format.ts +98 -0
  294. package/LICENSE +0 -661
  295. package/src/components/agents/slash-skill-menu.tsx +0 -75
  296. package/src/components/harness/conversation-panel/composer/extension/__tests__/demo-story-reference.test.tsx +0 -177
  297. package/src/components/harness/conversation-panel/composer/extension/demo-story-reference.tsx +0 -227
  298. package/src/components/harness/conversation-panel/composer/plugin-mention-menu.tsx +0 -109
  299. package/src/components/harness/extension-panel/panels/plugin-panel.tsx +0 -1021
@@ -0,0 +1,175 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ /**
19
+ * 输入框点击任意位置获取焦点(2026-11-20 任务 B 需求 3):
20
+ *
21
+ * 背景:TipTap contenteditable 无 min-height(只有内容高),容器
22
+ * `min-h-18 p-3` 撑出的空白区点击落在外层容器 div 且无聚焦接线——
23
+ * 用户反馈「只有第一行点击才有光标,下方区域是箭头、点击无光标」。
24
+ *
25
+ * 修复(双层):
26
+ * ① contenteditable `min-h-12`(3rem = 容器 min-h-18(72px) − p-3 上下(24px)),
27
+ * contenteditable 覆盖整容器内容区 → 光标天生命中;
28
+ * ② 容器 onClick 兜底:点击容器 padding/空白 → `editor.commands.focus('end')`;
29
+ * 点击 contenteditable 内 → ProseMirror 原生落光标(不干预);点击浮层
30
+ * (@/'/' suggestion 菜单 / MenuView / popup)→ 不干预(任务 A 后浮层渲染在
31
+ * composer-editor 内,条目点击有自己的选中链路,误 focus 会抢走选中)。
32
+ *
33
+ * 焦点断言口径:jsdom 不把 contenteditable 视为可聚焦元素(focus() no-op),
34
+ * 测试给编辑器 DOM 补 tabindex=0(浏览器实测无需)。TipTap focus 命令是
35
+ * rAF 延迟执行(delayedFocus → requestAnimationFrame(view.focus)),waitFor 等待。
36
+ * 守卫负例用 EditorView.prototype.focus spy——若守卫失效(误调 focus('end')),
37
+ * rAF 后 view.focus() 被调用,spy 记录到调用。
38
+ */
39
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
40
+ import { cleanup, fireEvent, render, waitFor } from "@testing-library/react"
41
+ import { EditorView } from "@tiptap/pm/view"
42
+ import { HarnessComposer } from "../conversation-panel/composer/harness-composer"
43
+
44
+ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
45
+ useMentionSources: () => ({ all: [], isLoading: false }),
46
+ }))
47
+ vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
48
+ // mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
49
+ // import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
50
+ vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
51
+ SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
52
+ getSandboxPolicy: vi.fn(),
53
+ setSandboxPolicy: vi.fn(),
54
+ }))
55
+ vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
56
+ vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
57
+
58
+ let focusSpy: ReturnType<typeof vi.spyOn> | undefined
59
+
60
+ beforeEach(() => {
61
+ sessionStorage.clear()
62
+ document.body.focus()
63
+ })
64
+ afterEach(() => {
65
+ // spy 还原放 afterEach:用例中途断言失败不泄漏 spy 到后续用例
66
+ focusSpy?.mockRestore()
67
+ focusSpy = undefined
68
+ cleanup()
69
+ })
70
+
71
+ function setup() {
72
+ return render(
73
+ <HarnessComposer
74
+ threadId="t1"
75
+ isRunning={false}
76
+ hasAiKey
77
+ busyPreference="queue"
78
+ onSend={vi.fn()}
79
+ onStop={vi.fn()}
80
+ messages={[]}
81
+ conversationRegionRef={{ current: null }}
82
+ />,
83
+ )
84
+ }
85
+
86
+ function getEditorDom(): HTMLElement {
87
+ const el = document.querySelector<HTMLElement>(".tiptap.ProseMirror")
88
+ if (!el) throw new Error("TipTap 编辑器 DOM 未挂载")
89
+ return el
90
+ }
91
+
92
+ function getControlContainer(): HTMLElement {
93
+ const el = document.querySelector<HTMLElement>('[data-slot="input-group-control"]')
94
+ if (!el) throw new Error("input-group-control 容器未挂载")
95
+ return el
96
+ }
97
+
98
+ /** jsdom 焦点可观察前提:编辑器 DOM 补 tabindex=0(浏览器实测无需) */
99
+ function makeFocusObservable(): void {
100
+ getEditorDom().setAttribute("tabindex", "0")
101
+ }
102
+
103
+ describe("输入框点击任意位置获取焦点(任务 B 需求 3)", () => {
104
+ it("contenteditable 含 min-h-12(覆盖容器内容区,光标天生命中)", async () => {
105
+ setup()
106
+ await waitFor(() => expect(getEditorDom()).not.toBeNull())
107
+ expect(getEditorDom().className).toContain("min-h-12")
108
+ })
109
+
110
+ it("点击容器空白(target=容器 div)→ 编辑器获得焦点", async () => {
111
+ setup()
112
+ await waitFor(() => expect(getEditorDom()).not.toBeNull())
113
+ makeFocusObservable()
114
+ expect(document.activeElement).toBe(document.body)
115
+ fireEvent.click(getControlContainer())
116
+ // TipTap focus 命令 rAF 延迟(delayedFocus → requestAnimationFrame(view.focus))
117
+ await waitFor(() => expect(document.activeElement).toBe(getEditorDom()))
118
+ })
119
+
120
+ it("点击 contenteditable 内 → 不干预(ProseMirror 原生落光标,view.focus 未被容器调)", async () => {
121
+ setup()
122
+ await waitFor(() => expect(getEditorDom()).not.toBeNull())
123
+ makeFocusObservable()
124
+ focusSpy = vi.spyOn(EditorView.prototype, "focus").mockImplementation(() => {})
125
+ fireEvent.click(getEditorDom())
126
+ // rAF 窗口:若守卫失效误调 focus('end'),rAF 后 view.focus() 被 spy 记录
127
+ await new Promise((resolve) => setTimeout(resolve, 50))
128
+ expect(focusSpy).not.toHaveBeenCalled()
129
+ expect(document.activeElement).not.toBe(getEditorDom())
130
+ })
131
+
132
+ it("点击 @/'/' 菜单浮层(data-selector + data-menu-view)→ 不触发容器 focus", async () => {
133
+ setup()
134
+ await waitFor(() => expect(getEditorDom()).not.toBeNull())
135
+ makeFocusObservable()
136
+ // 仿真浮层(任务 A 后菜单渲染在 composer-editor 内、容器 onClick 的冒泡路径上)
137
+ const container = getControlContainer()
138
+ const overlay = document.createElement("div")
139
+ overlay.setAttribute("data-selector", "tiptap-mention-suggestion-menu")
140
+ const menuView = document.createElement("div")
141
+ menuView.setAttribute("data-menu-view", "")
142
+ const row = document.createElement("div")
143
+ row.setAttribute("role", "option")
144
+ row.textContent = "候选条目"
145
+ menuView.appendChild(row)
146
+ overlay.appendChild(menuView)
147
+ container.appendChild(overlay)
148
+ focusSpy = vi.spyOn(EditorView.prototype, "focus").mockImplementation(() => {})
149
+ fireEvent.click(row)
150
+ await new Promise((resolve) => setTimeout(resolve, 50))
151
+ expect(focusSpy).not.toHaveBeenCalled()
152
+ expect(document.activeElement).not.toBe(getEditorDom())
153
+ overlay.remove()
154
+ })
155
+
156
+ it("点击 popup 浮层(data-command-popup)→ 不触发容器 focus", async () => {
157
+ setup()
158
+ await waitFor(() => expect(getEditorDom()).not.toBeNull())
159
+ makeFocusObservable()
160
+ const container = getControlContainer()
161
+ const popup = document.createElement("div")
162
+ popup.setAttribute("data-command-popup", "")
163
+ const row = document.createElement("div")
164
+ row.setAttribute("role", "option")
165
+ row.textContent = "模型条目"
166
+ popup.appendChild(row)
167
+ container.appendChild(popup)
168
+ focusSpy = vi.spyOn(EditorView.prototype, "focus").mockImplementation(() => {})
169
+ fireEvent.click(row)
170
+ await new Promise((resolve) => setTimeout(resolve, 50))
171
+ expect(focusSpy).not.toHaveBeenCalled()
172
+ expect(document.activeElement).not.toBe(getEditorDom())
173
+ popup.remove()
174
+ })
175
+ })
@@ -28,6 +28,13 @@ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
28
28
  useMentionSources: () => ({ all: [], isLoading: false }),
29
29
  }))
30
30
  vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
31
+ // mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
32
+ // import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
33
+ vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
34
+ SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
35
+ getSandboxPolicy: vi.fn(),
36
+ setSandboxPolicy: vi.fn(),
37
+ }))
31
38
  vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
32
39
  vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
33
40
 
@@ -184,6 +184,63 @@ describe("createComposerKeyDownHandler(唯一提交入口,F5 提交单轨化
184
184
  const event = new KeyboardEvent("keydown", { key: " ", bubbles: true, cancelable: true })
185
185
  expect(handler(fakeView, event)).toBe(false)
186
186
  })
187
+
188
+ // pending 守卫(整分支审查 finding 1 兑现,设计 §5.2):@ / '/' 菜单取数窗口
189
+ // (isPending=true)内 Enter/Tab 显式 no-op——吞掉、不提交。窄域:pending=false
190
+ // 行为完全不变(无候选 settle 后 Enter 照常提交基线不触碰);IME/Shift 分支
191
+ // 优先级在守卫之前/之外,语义保持。
192
+ it("pending 守卫:isPending=true + Enter → 吞掉(preventDefault + 返回 true)、不提交", () => {
193
+ const { onSubmit, handler } = setup({ isPending: () => true })
194
+ const event = makeEnterEvent()
195
+ expect(handler(fakeView, event)).toBe(true)
196
+ expect(event.defaultPrevented).toBe(true)
197
+ expect(onSubmit).not.toHaveBeenCalled()
198
+ })
199
+
200
+ it("pending 守卫:isPending=true + Tab → 吞掉、不提交(菜单取数窗口 Tab no-op)", () => {
201
+ const { onSubmit, handler } = setup({ isPending: () => true })
202
+ const event = new KeyboardEvent("keydown", { key: "Tab", bubbles: true, cancelable: true })
203
+ expect(handler(fakeView, event)).toBe(true)
204
+ expect(event.defaultPrevented).toBe(true)
205
+ expect(onSubmit).not.toHaveBeenCalled()
206
+ })
207
+
208
+ it("pending 守卫:Shift+Enter → 放行换行(守卫不含 shift,非提交意图)", () => {
209
+ const { onSubmit, handler } = setup({ isPending: () => true })
210
+ const event = makeEnterEvent({ shiftKey: true })
211
+ expect(handler(fakeView, event)).toBe(false)
212
+ expect(event.defaultPrevented).toBe(false)
213
+ expect(onSubmit).not.toHaveBeenCalled()
214
+ })
215
+
216
+ it("pending 守卫:Shift+Tab → 放行(关菜单语义不变,交 useMenuNavigation)", () => {
217
+ const { onSubmit, handler } = setup({ isPending: () => true })
218
+ const event = new KeyboardEvent("keydown", { key: "Tab", shiftKey: true, bubbles: true, cancelable: true })
219
+ expect(handler(fakeView, event)).toBe(false)
220
+ expect(onSubmit).not.toHaveBeenCalled()
221
+ })
222
+
223
+ it("pending 守卫:isPending=false(settle 后无候选)→ Enter 照常提交(基线不触碰)", () => {
224
+ const { onSubmit, handler } = setup({ isPending: () => false })
225
+ const event = makeEnterEvent()
226
+ expect(handler(fakeView, event)).toBe(true)
227
+ expect(onSubmit).toHaveBeenCalledWith(false)
228
+ })
229
+
230
+ it("pending 守卫:未提供 isPending(既有消费方)→ Enter 照常提交(14 例语义不变)", () => {
231
+ const { onSubmit, handler } = setup()
232
+ const event = makeEnterEvent()
233
+ expect(handler(fakeView, event)).toBe(true)
234
+ expect(onSubmit).toHaveBeenCalledTimes(1)
235
+ })
236
+
237
+ it("pending 守卫:IME 组合期 Enter 优先放行(isComposing 分支先于守卫)", () => {
238
+ const { onSubmit, handler } = setup({ isPending: () => true })
239
+ const event = makeEnterEvent({ isComposing: true })
240
+ expect(handler(fakeView, event)).toBe(false)
241
+ expect(event.defaultPrevented).toBe(false)
242
+ expect(onSubmit).not.toHaveBeenCalled()
243
+ })
187
244
  })
188
245
 
189
246
  /**
@@ -30,6 +30,13 @@ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
30
30
  useMentionSources: () => ({ all: [], isLoading: false }),
31
31
  }))
32
32
  vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
33
+ // mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
34
+ // import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
35
+ vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
36
+ SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
37
+ getSandboxPolicy: vi.fn(),
38
+ setSandboxPolicy: vi.fn(),
39
+ }))
33
40
  vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
34
41
  vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
35
42
 
@@ -0,0 +1,207 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ /**
19
+ * composer 消费侧 pending 守卫(整分支审查 Important finding 1 兑现,设计 §5.2
20
+ * 「pending 期 Enter/Tab 显式 no-op(防误发,最高优先)」):
21
+ *
22
+ * - **① pending 空候选穿透**:@ 菜单取数窗口(debounce / 异步源未 settle)内 Enter
23
+ * 穿透到 composer 提交 keymap 发出半截查询——守卫后吞掉(不发送、输入保留)。
24
+ * - **② pending 有旧行**:SWR 旧行留屏期 Enter 曾照常选中旧行——守卫后 no-op
25
+ * (不选中、菜单仍开,与 T2 旧用例 2 语义一致)。
26
+ * - **③ settle 后基线锁住**:pending 结束(loading:false)后行为完全不变——
27
+ * 无候选 Enter 透传发送(既有基线)、有候选 Enter 选中(composer-send 用例 3 锁定)。
28
+ * - **④ 同步源零变化**:kb/design 消费方默认不注册守卫——composer-send 既有三例
29
+ * (option 等待写法)跑绿即可,本文件不重复。
30
+ *
31
+ * pending 窗口确定性:VITE_HARNESS_DEV stub 打开 file 源 gating,fetchDir
32
+ * (queries/harness mock)与 rg 搜索(thread-workspace-search mock)均由测试
33
+ * 手控 settle——「resolvers 增长 / mock 被调用」即取数进行中,无真实计时竞态。
34
+ */
35
+ import { afterEach, beforeEach, expect, it, vi } from "vitest"
36
+ import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"
37
+ import { HarnessComposer } from "../conversation-panel/composer/harness-composer"
38
+
39
+ /** hoisted 可控桩状态:fetchDir / rg 搜索的 pending promise 由测试手控 settle */
40
+ const h = vi.hoisted(() => ({
41
+ /** @ 菜单 mention 候选(use-mention-sources all)——逐测试覆写 */
42
+ mentionAll: [] as Array<Record<string, unknown>>,
43
+ /** fetchDir 调用序(queryKey 内含序号防 fetchQuery 缓存去重)+ settle 队列 */
44
+ dirSeq: 0,
45
+ dirResolvers: [] as Array<(v: { entries: Array<{ name: string; isDir: boolean }>; truncated: boolean }) => void>,
46
+ /** rg 搜索调用计数 + settle 队列(裸查询模式) */
47
+ searchCalls: 0,
48
+ searchResolvers: [] as Array<(v: { matches: Array<{ path: string }>; truncated: boolean }) => void>,
49
+ }))
50
+
51
+ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
52
+ useMentionSources: () => ({ all: h.mentionAll, isLoading: false }),
53
+ }))
54
+
55
+ // fetchDir 生产实现(mention-suggestion-menu.fetchDirFromQueryClient):queryFn
56
+ // 换成测试手控 promise;queryKey 注入自增序号——staleTime 0 亦会被同 key 去重,
57
+ // 序号隔离保证每次取数新 promise(pending 窗口逐次可控)
58
+ vi.mock("@/lib/queries/harness", async (importOriginal) => {
59
+ const actual = await importOriginal<typeof import("@/lib/queries/harness")>()
60
+ return {
61
+ ...actual,
62
+ threadWorkspaceDirQueryOptions: (threadId: string, dirPath?: string) => {
63
+ h.dirSeq += 1
64
+ return {
65
+ queryKey: ["test-tw-dir", threadId, dirPath, h.dirSeq],
66
+ queryFn: () =>
67
+ new Promise<{ entries: Array<{ name: string; isDir: boolean }>; truncated: boolean }>((resolve) => {
68
+ h.dirResolvers.push(resolve)
69
+ }),
70
+ staleTime: 0,
71
+ }
72
+ },
73
+ }
74
+ })
75
+
76
+ vi.mock("@/server/serverFns/harness/thread-workspace-search", () => ({
77
+ searchThreadWorkspaceFilesFn: () =>
78
+ new Promise<{ matches: Array<{ path: string }>; truncated: boolean }>((resolve) => {
79
+ h.searchCalls += 1
80
+ h.searchResolvers.push(resolve)
81
+ }),
82
+ }))
83
+
84
+ // file 源 gating(file-mention 的 isHarnessClientEnabled 门)恒开:fetchDir /
85
+ // search 桩可被触达,pending 窗口由桩手控(import.meta.env stub 在 vitest 对
86
+ // 构建期内联读取不稳定,改模块级 mock——本文件内唯一导出即此函数)
87
+ vi.mock("@/lib/harness-gate", () => ({
88
+ isHarnessClientEnabled: () => true,
89
+ }))
90
+
91
+ vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
92
+ // mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
93
+ // import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
94
+ vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
95
+ SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
96
+ getSandboxPolicy: vi.fn(),
97
+ setSandboxPolicy: vi.fn(),
98
+ }))
99
+ vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
100
+ vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
101
+
102
+ const KB_DOC = { kind: "kb-doc", id: "doc-1", label: "KB doc alpha", kbId: "kb-1", kbName: "测试知识库" }
103
+
104
+ beforeEach(() => {
105
+ sessionStorage.clear()
106
+ h.mentionAll = []
107
+ // h.dirSeq 不复位:query client 为文件级单例,序号单调递增保证 queryKey
108
+ // 全程唯一——跨测试在途 promise 不被 fetchQuery 去重复用(序号复位会让
109
+ // 下一测试复用上一测试未 settle 的同 key 查询,resolver 不再入队)
110
+ h.dirResolvers = []
111
+ h.searchCalls = 0
112
+ h.searchResolvers = []
113
+ })
114
+
115
+ afterEach(cleanup)
116
+
117
+ /**
118
+ * 取 ProseMirror 编辑面(view.dom)。jsdom 不给 contenteditable 赋隐式
119
+ * textbox role,getByRole("textbox") 查不到,按类名定位(afterEach cleanup
120
+ * 保证同一时刻最多一个实例)。
121
+ */
122
+ function getEditorDom(): HTMLElement {
123
+ const el = document.querySelector<HTMLElement>(".tiptap.ProseMirror")
124
+ if (!el) throw new Error("TipTap 编辑器 DOM 未挂载")
125
+ return el
126
+ }
127
+
128
+ function setup(threadId: string | null = "t1", prefill: string | null = "@") {
129
+ const onSend = vi.fn()
130
+ render(
131
+ <HarnessComposer
132
+ threadId={threadId}
133
+ isRunning={false}
134
+ hasAiKey
135
+ busyPreference="queue"
136
+ onSend={onSend}
137
+ onStop={vi.fn()}
138
+ conversationRegionRef={{ current: null }}
139
+ messages={[]}
140
+ handoffPrefillText={prefill}
141
+ />,
142
+ )
143
+ return onSend
144
+ }
145
+
146
+ /** 纯文本粘贴(PM 真实 paste 事件路径,doc 变更 → 插件 re-track → 新一轮取数) */
147
+ function pasteText(textbox: HTMLElement, text: string) {
148
+ fireEvent.paste(textbox, {
149
+ clipboardData: {
150
+ files: [],
151
+ getData: (type: string) => (type === "text/plain" ? text : ""),
152
+ },
153
+ })
154
+ }
155
+
156
+ it("① pending 期(异步源未 settle)Enter 不发送、输入保留", async () => {
157
+ const send = setup("t1", "@")
158
+ const textbox = getEditorDom()
159
+ // 触发 @ 菜单 → debounce 后 file 源 fetchDir 发出且**不 settle** → pending 窗口
160
+ await waitFor(() => expect(h.dirResolvers.length).toBeGreaterThanOrEqual(1), { timeout: 3000 })
161
+ // 菜单已开(空候选期仅 listbox 容器,无 option)
162
+ expect(screen.queryByRole("listbox")).not.toBeNull()
163
+ // pending 期 Enter:被消费侧守卫吞掉(不提交半截查询 "@")
164
+ fireEvent.keyDown(textbox, { key: "Enter" })
165
+ expect(send).not.toHaveBeenCalled()
166
+ // 输入保留(不 clearContent)
167
+ expect(textbox.textContent).toBe("@")
168
+ })
169
+
170
+ it("② pending 期有旧行 Enter no-op(不选中、菜单仍开、不发送)", async () => {
171
+ h.mentionAll = [KB_DOC]
172
+ const send = setup("t1", "@")
173
+ const textbox = getEditorDom()
174
+ // 首轮取数 settle(file 源空 entries)→ 内置 KB 候选上屏
175
+ await waitFor(() => expect(h.dirResolvers.length).toBeGreaterThanOrEqual(1), { timeout: 3000 })
176
+ h.dirResolvers[0]({ entries: [], truncated: false })
177
+ await screen.findAllByRole("option", {}, { timeout: 3000 })
178
+ // 改查询(裸查询 → rg 搜索桩,**不 settle**)→ SWR 旧行留屏、pending=true
179
+ pasteText(textbox, "x")
180
+ await waitFor(() => expect(h.searchCalls).toBeGreaterThanOrEqual(1), { timeout: 3000 })
181
+ // pending 期 Enter:no-op——旧行不选中(旧 T2 用例 2 语义)、不发送、菜单仍开
182
+ fireEvent.keyDown(textbox, { key: "Enter" })
183
+ expect(send).not.toHaveBeenCalled()
184
+ expect(textbox.textContent).toBe("@x")
185
+ // 菜单仍开(SWR 旧行留屏):浮层容器 + MenuView 内层各一个 role=listbox
186
+ expect(screen.queryAllByRole("listbox").length).toBeGreaterThanOrEqual(1)
187
+ })
188
+
189
+ it("③ settle 后(pending 结束)基线不变:无候选 Enter 透传发送", async () => {
190
+ h.mentionAll = [KB_DOC]
191
+ const send = setup("t1", "@")
192
+ const textbox = getEditorDom()
193
+ await waitFor(() => expect(h.dirResolvers.length).toBeGreaterThanOrEqual(1), { timeout: 3000 })
194
+ h.dirResolvers[0]({ entries: [], truncated: false })
195
+ await screen.findAllByRole("option", {}, { timeout: 3000 })
196
+ // 改查询 → rg 搜索 settle 空 → loading:false(pending 结束)、无候选
197
+ pasteText(textbox, "x")
198
+ await waitFor(() => expect(h.searchCalls).toBeGreaterThanOrEqual(1), { timeout: 3000 })
199
+ h.searchResolvers[0]({ matches: [], truncated: false })
200
+ // settle 落地标记:loading:false 的 onUpdate 到达(SWR 旧行撤下)→ option 消失,
201
+ // 此后 isPending=false——在此前按 Enter 会落入 pending 窗口(旧行被选中)
202
+ await waitFor(() => expect(screen.queryByRole("option")).toBeNull(), { timeout: 3000 })
203
+ // settle 后 Enter:守卫不拦(isPending=false)→ 提交既有基线照常
204
+ fireEvent.keyDown(textbox, { key: "Enter" })
205
+ expect(send).toHaveBeenCalledTimes(1)
206
+ expect(send).toHaveBeenCalledWith("@x", expect.objectContaining({ whenBusy: "queue" }))
207
+ })
@@ -25,13 +25,14 @@ import { computePlaceholder } from "../conversation-panel/composer/harness-compo
25
25
  import type { ComposerTakeover } from "../conversation-panel/composer/takeover"
26
26
  import { m } from "@/paraglide/messages.js"
27
27
 
28
- const base = { hasAiKey: true, queuedTurns: 0, takeover: null as ComposerTakeover, isEmpty: false }
28
+ const base = { queuedTurns: 0, takeover: null as ComposerTakeover, isEmpty: false }
29
29
 
30
- describe("computePlaceholder(A2 五态,队列驱动)", () => {
31
- it("无 key 最高优先:无论队列/接管/hero 什么状态都提示配 key", () => {
32
- expect(
33
- computePlaceholder({ ...base, hasAiKey: false, queuedTurns: 2, isEmpty: true }),
34
- ).toBe(m.harness_composer_placeholderNoKey())
30
+ describe("computePlaceholder(A2 五态,队列驱动;2026-11-21 打磨去 noKey 态——未配 key 恒默认文案)", () => {
31
+ it("未配 key 不再特殊提示:占位恒默认文案(发送门控仍在主按钮/decideSubmit)", () => {
32
+ expect(m.harness_composer_placeholderDefault()).not.toContain("AI API Key")
33
+ // hero 态含 / 与 @ 文案(打磨裁决)
34
+ expect(m.harness_composer_placeholderHero()).toContain("/")
35
+ expect(m.harness_composer_placeholderHero()).toContain("@")
35
36
  })
36
37
 
37
38
  it("接管 locked 次之:提示先处理上方确认", () => {