@allbluecn/web-app 0.27.41 → 0.28.1

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 (342) hide show
  1. package/package.json +4 -3
  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 +46 -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-chat-adapter.test.ts +20 -0
  242. package/src/components/harness/conversation-panel/messages/harness-chain/__tests__/use-harness-session-putmedia.test.tsx +17 -0
  243. package/src/components/harness/conversation-panel/messages/harness-chain/use-agent-terminals.ts +116 -0
  244. package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +43 -11
  245. package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +25 -4
  246. package/src/components/harness/conversation-panel/messages/tools/__tests__/tool-run.test.ts +26 -1
  247. package/src/components/harness/conversation-panel/messages/tools/tool-run.ts +11 -0
  248. package/src/components/harness/extension-panel/dock/__tests__/dock-persist.test.ts +2 -1
  249. package/src/components/harness/extension-panel/dock/__tests__/guide-page.test.tsx +44 -3
  250. package/src/components/harness/extension-panel/dock/__tests__/tab-strip.test.tsx +45 -0
  251. package/src/components/harness/extension-panel/dock/dock-persist.ts +6 -4
  252. package/src/components/harness/extension-panel/dock/dock-registry.ts +69 -14
  253. package/src/components/harness/extension-panel/dock/dock-surface.tsx +35 -0
  254. package/src/components/harness/extension-panel/dock/guide-page.tsx +78 -45
  255. package/src/components/harness/extension-panel/dock/tab-strip.tsx +9 -1
  256. package/src/components/harness/extension-panel/panels/plugin/__tests__/install-dialog.test.tsx +260 -0
  257. package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-page.test.tsx +912 -0
  258. package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-row.test.tsx +215 -0
  259. package/src/components/harness/extension-panel/panels/plugin/builtin-section.tsx +204 -0
  260. package/src/components/harness/extension-panel/panels/plugin/install-dialog.tsx +195 -0
  261. package/src/components/harness/extension-panel/panels/plugin/installed-section.tsx +378 -0
  262. package/src/components/harness/extension-panel/panels/plugin/kind.tsx +17 -4
  263. package/src/components/harness/extension-panel/panels/plugin/pending-builds-block.tsx +49 -0
  264. package/src/components/harness/extension-panel/panels/plugin/plugin-page.tsx +257 -0
  265. package/src/components/harness/extension-panel/panels/plugin/plugin-row.tsx +206 -0
  266. package/src/components/harness/extension-panel/panels/plugin/plugin-types.ts +13 -0
  267. package/src/components/harness/extension-panel/panels/plugin/worker-section.tsx +322 -0
  268. package/src/components/harness/extension-panel/panels/terminal/__tests__/kind.test.tsx +219 -2
  269. package/src/components/harness/extension-panel/panels/terminal/__tests__/terminal-instance.test.tsx +322 -19
  270. package/src/components/harness/extension-panel/panels/terminal/__tests__/use-agent-terminal-roster.test.tsx +393 -0
  271. package/src/components/harness/extension-panel/panels/terminal/__tests__/ws-transport.test.ts +25 -0
  272. package/src/components/harness/extension-panel/panels/terminal/kind.tsx +55 -1
  273. package/src/components/harness/extension-panel/panels/terminal/shell-pref.ts +7 -4
  274. package/src/components/harness/extension-panel/panels/terminal/sse-transport.ts +26 -6
  275. package/src/components/harness/extension-panel/panels/terminal/tab-control-state.tsx +114 -0
  276. package/src/components/harness/extension-panel/panels/terminal/terminal-instance.tsx +190 -96
  277. package/src/components/harness/extension-panel/panels/terminal/terminal-theme.ts +113 -0
  278. package/src/components/harness/extension-panel/panels/terminal/transport.ts +28 -6
  279. package/src/components/harness/extension-panel/panels/terminal/use-agent-terminal-roster.ts +107 -0
  280. package/src/components/harness/extension-panel/panels/terminal/ws-transport.ts +7 -5
  281. package/src/components/harness/extension-panel/panels/terminal/xterm-terminal.tsx +5 -67
  282. package/src/components/harness/workbench/__tests__/provider-model-groups.test.ts +301 -0
  283. package/src/components/harness/workbench/harness-workbench-page.tsx +164 -2
  284. package/src/components/harness/workbench/provider-model-groups.ts +140 -0
  285. package/src/components/harness/workbench/undo-last-turn.ts +79 -0
  286. package/src/components/harness/workbench/workbench-context.tsx +53 -3
  287. package/src/components/tiptap/hooks/__tests__/use-floating-element.test.tsx +131 -0
  288. package/src/components/tiptap/hooks/use-floating-element.ts +15 -2
  289. package/src/components/tiptap/hooks/use-menu-navigation.ts +5 -0
  290. package/src/components/tiptap/node/mention-extension.ts +33 -0
  291. package/src/components/tiptap/ui/suggestion-menu/__tests__/suggestion-menu.test.tsx +366 -0
  292. package/src/components/tiptap/ui/suggestion-menu/suggestion-menu-types.ts +54 -0
  293. package/src/components/tiptap/ui/suggestion-menu/suggestion-menu.tsx +176 -45
  294. package/src/lib/changelog/sdk-versions.ts +2 -2
  295. package/src/lib/queries/__tests__/harness-plugin-queries.test.ts +49 -0
  296. package/src/lib/queries/harness-terminal.ts +77 -0
  297. package/src/lib/queries/harness.ts +50 -0
  298. package/src/paraglide/messages/_index.js +1622 -311
  299. package/src/paraglide/messages/en.js +528 -103
  300. package/src/paraglide/messages/zh.js +529 -104
  301. package/src/routes/_nav/harness/route.lazy.tsx +13 -0
  302. package/src/routes/api/harness/$.ts +19 -2
  303. package/src/routes/api/harness/terminal/$.ts +37 -6
  304. package/src/routes/api/harness/terminal/__tests__/route.test.ts +120 -0
  305. package/src/server/ai-gateway/sandbox/policy.ts +6 -6
  306. package/src/server/harness/__tests__/agent-terminal.server.test.ts +448 -0
  307. package/src/server/harness/__tests__/builtin-tools-invariant.test.ts +22 -12
  308. package/src/server/harness/__tests__/compact-plugin.server.test.ts +46 -0
  309. package/src/server/harness/__tests__/define-expose.test.ts +17 -0
  310. package/src/server/harness/__tests__/first-contact-fakes.test.ts +103 -3
  311. package/src/server/harness/__tests__/terminal-manager.server.test.ts +761 -2
  312. package/src/server/harness/__tests__/thread-reference.server.test.ts +258 -0
  313. package/src/server/harness/agent-terminal.server.ts +631 -0
  314. package/src/server/harness/define.server.ts +21 -3
  315. package/src/server/harness/first-contact-fakes.ts +115 -4
  316. package/src/server/harness/host.server.ts +28 -1
  317. package/src/server/harness/persistence/__tests__/session-index-store.server.test.ts +83 -0
  318. package/src/server/harness/persistence/prisma-persistence.server.ts +12 -3
  319. package/src/server/harness/persistence/session-index-store.server.ts +26 -0
  320. package/src/server/harness/plugins/__tests__/assemble-disable.test.ts +25 -17
  321. package/src/server/harness/plugins/__tests__/tool-risk-audit.test.ts +16 -6
  322. package/src/server/harness/plugins/assemble-app.ts +12 -0
  323. package/src/server/harness/plugins/base-patch.ts +9 -2
  324. package/src/server/harness/plugins/builtin/__tests__/agent-terminal.plugin.test.ts +702 -0
  325. package/src/server/harness/plugins/builtin/agent-terminal.plugin.ts +518 -0
  326. package/src/server/harness/terminal-frame-builder.server.ts +5 -3
  327. package/src/server/harness/terminal-manager.server.ts +772 -35
  328. package/src/server/harness/terminal-ws-handler.server.ts +8 -2
  329. package/src/server/harness/thread-reference.server.ts +446 -0
  330. package/src/server/harness/tool-risk.ts +20 -4
  331. package/src/server/serverFns/chat/__tests__/conversations-sandbox-default.test.ts +23 -0
  332. package/src/server/serverFns/chat/conversations.ts +18 -3
  333. package/src/server/serverFns/harness/search-mention-candidates.ts +14 -1
  334. package/src/shared/harness/__tests__/thread-reference-format.test.ts +128 -0
  335. package/src/shared/harness/thread-reference-format.ts +98 -0
  336. package/LICENSE +0 -661
  337. package/src/components/agents/slash-skill-menu.tsx +0 -75
  338. package/src/components/harness/conversation-panel/composer/extension/__tests__/demo-story-reference.test.tsx +0 -177
  339. package/src/components/harness/conversation-panel/composer/extension/demo-story-reference.tsx +0 -227
  340. package/src/components/harness/conversation-panel/composer/plugin-mention-menu.tsx +0 -109
  341. package/src/components/harness/extension-panel/panels/plugin-panel.tsx +0 -1021
  342. package/src/components/harness/extension-panel/panels/terminal/__tests__/xterm-webgl.test.ts +0 -68
@@ -0,0 +1,517 @@
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
+ * @file 工作区文件提及源测试(任务 5):
20
+ * - 纯逻辑 describe:fileMentionCandidates 三模式(root 首屏 / rg 搜索 / 目录下钻)
21
+ * + dirname 边界表(空 basename 全放行、`/` 归 root、`a//b` 规范化)+ gating + 抛错兜底;
22
+ * - 集成 describe:渲染 HarnessComposer / ComposerEditor(真实 TipTap),断言 file 组置顶、
23
+ * truncated footer、目录行 drill 不插 chip、下钻面包屑、文件行插 chip、纯文本死文本边界、
24
+ * 空态与 legacy 链 gating。
25
+ *
26
+ * 真实 TipTap + mock 两个 serverFn 模块(thread-workspace-search / thread-workspace-files)——
27
+ * 不 mock 会真发 RPC 挂起。i18n 断言一律对 `m.*` 解析值(locale 无关)。
28
+ */
29
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
30
+ import { cleanup, fireEvent, render, waitFor } from "@testing-library/react"
31
+ import type { Editor } from "@tiptap/core"
32
+ import type { JSONContent } from "@tiptap/core"
33
+
34
+ import { HarnessComposer } from "../../harness-composer"
35
+ import { ComposerEditor } from "../../composer-editor"
36
+ import { clearComposerExtensions } from "../../extension"
37
+ import { fileMentionCandidates } from "../file-mention"
38
+ import { getQueryClient, setQueryClient } from "@/lib/query-client-seam"
39
+ import { QueryClient } from "@tanstack/react-query"
40
+ import { m } from "@/paraglide/messages.js"
41
+
42
+ // ── hoisted 可变 mock 状态(gate 开关 + 两 serverFn 返回值)──
43
+ const gateState = vi.hoisted(() => ({ enabled: true }))
44
+
45
+ vi.mock("@/lib/harness-gate", () => ({
46
+ isHarnessClientEnabled: () => gateState.enabled,
47
+ }))
48
+ vi.mock("@/server/serverFns/harness/thread-workspace-search", () => ({
49
+ searchThreadWorkspaceFilesFn: vi.fn(),
50
+ }))
51
+ vi.mock("@/server/serverFns/harness/thread-workspace-files", () => ({
52
+ listThreadWorkspaceDirFn: vi.fn(),
53
+ }))
54
+ vi.mock("@/server/serverFns/harness/media", () => ({ generatePrototypeFn: vi.fn(() => Promise.resolve({})) }))
55
+ vi.mock("../../voice-input-button", () => ({ VoiceInputButton: () => null }))
56
+ vi.mock("@/components/billing/use-feature", () => ({ useFeature: () => ({ enabled: true, loading: false }) }))
57
+ vi.mock("../use-mention-sources", () => ({
58
+ useMentionSources: () => ({
59
+ all: [
60
+ { kind: "kb-doc", id: "doc-1", label: "KB doc alpha", kbId: "kb-1", kbName: "测试知识库" },
61
+ { kind: "design", id: "design-1", label: "Design beta" },
62
+ ],
63
+ isLoading: false,
64
+ }),
65
+ }))
66
+
67
+ import { searchThreadWorkspaceFilesFn as searchFn } from "@/server/serverFns/harness/thread-workspace-search"
68
+ import { listThreadWorkspaceDirFn as listDirFn } from "@/server/serverFns/harness/thread-workspace-files"
69
+
70
+ const searchMock = vi.mocked(searchFn)
71
+ const listDirMock = vi.mocked(listDirFn)
72
+
73
+ /** 默认 root 目录 listing(src 目录 + README.md 文件)。 */
74
+ const ROOT_LISTING = {
75
+ entries: [
76
+ { name: "src", kind: "dir" as const },
77
+ { name: "README.md", kind: "file" as const },
78
+ ],
79
+ truncated: false,
80
+ }
81
+ /** 默认 src 目录 listing(嵌套文件 + 子目录)。 */
82
+ const SRC_LISTING = {
83
+ entries: [
84
+ { name: "a.ts", kind: "file" as const },
85
+ { name: "components", kind: "dir" as const },
86
+ ],
87
+ truncated: false,
88
+ }
89
+
90
+ beforeEach(() => {
91
+ sessionStorage.clear()
92
+ gateState.enabled = true
93
+ searchMock.mockReset()
94
+ listDirMock.mockReset()
95
+ // 全新 QueryClient:避免跨测试目录 listing 缓存串染
96
+ setQueryClient(new QueryClient())
97
+ })
98
+ afterEach(() => {
99
+ cleanup()
100
+ clearComposerExtensions()
101
+ getQueryClient().clear()
102
+ })
103
+
104
+ function renderComposer(threadId: string | null = "t1") {
105
+ return render(
106
+ <HarnessComposer
107
+ threadId={threadId}
108
+ isRunning={false}
109
+ hasAiKey
110
+ busyPreference="queue"
111
+ onSend={vi.fn()}
112
+ onStop={vi.fn()}
113
+ conversationRegionRef={{ current: null }}
114
+ messages={[]}
115
+ handoffPrefillText="@"
116
+ />,
117
+ )
118
+ }
119
+
120
+ function getEditorDom(): HTMLElement {
121
+ const el = document.querySelector<HTMLElement>(".tiptap.ProseMirror")
122
+ if (!el) throw new Error("TipTap 编辑器 DOM 未挂载")
123
+ return el
124
+ }
125
+
126
+ function getMenuView(): HTMLElement {
127
+ const el = document.querySelector<HTMLElement>(
128
+ '[data-selector="tiptap-mention-suggestion-menu"] [data-menu-view]',
129
+ )
130
+ if (!el) throw new Error("@ 菜单 MenuView 未挂载")
131
+ return el
132
+ }
133
+
134
+ function tryGetMenuView(): HTMLElement | null {
135
+ return document.querySelector<HTMLElement>(
136
+ '[data-selector="tiptap-mention-suggestion-menu"] [data-menu-view]',
137
+ )
138
+ }
139
+
140
+ function getOptions(menu: HTMLElement): HTMLElement[] {
141
+ return Array.from(menu.querySelectorAll<HTMLElement>('[role="option"]'))
142
+ }
143
+
144
+ function findMentionNodes(doc: JSONContent): JSONContent[] {
145
+ const found: JSONContent[] = []
146
+ const walk = (nodes: JSONContent[] | undefined) => {
147
+ for (const node of nodes ?? []) {
148
+ if (node.type === "mention") found.push(node)
149
+ if (Array.isArray(node.content)) walk(node.content)
150
+ }
151
+ }
152
+ walk(doc.content)
153
+ return found
154
+ }
155
+
156
+ // ═══════════════════════════════════════════════════════════════════
157
+ // 纯逻辑:fileMentionCandidates 三模式 + dirname 边界 + gating + 抛错
158
+ // ═══════════════════════════════════════════════════════════════════
159
+ describe("fileMentionCandidates(纯查询→候选映射)", () => {
160
+ const makeFetchDir = () =>
161
+ vi.fn(async (_threadId: string, dirPath?: string) => {
162
+ if (dirPath === "src") return { entries: SRC_LISTING.entries.map((e) => ({ name: e.name, isDir: e.kind === "dir" })), truncated: false }
163
+ return { entries: ROOT_LISTING.entries.map((e) => ({ name: e.name, isDir: e.kind === "dir" })), truncated: false }
164
+ })
165
+
166
+ it("空查询 → root 首屏(fetchDir 列 root,目录在前,path 无前缀)", async () => {
167
+ const fetchDir = makeFetchDir()
168
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "", fetchDir })
169
+ expect(fetchDir).toHaveBeenCalledWith("t1", undefined)
170
+ expect(res.truncated).toBe(false)
171
+ expect(res.items.map((c) => c.data?.path)).toEqual(["src", "README.md"])
172
+ expect(res.items[0].data?.isDir).toBe(true)
173
+ expect(res.items[1].data?.isDir).toBe(false)
174
+ })
175
+
176
+ it("纯 '/' 归 root 模式(dirPath undefined)", async () => {
177
+ const fetchDir = makeFetchDir()
178
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "/", fetchDir })
179
+ expect(fetchDir).toHaveBeenCalledWith("t1", undefined)
180
+ expect(res.items).toHaveLength(2)
181
+ })
182
+
183
+ it("裸查询(不含 '/' 且非空)→ rg 搜索,透传 truncated", async () => {
184
+ searchMock.mockResolvedValue({ matches: [{ path: "src/a.ts" }], engine: "rg", truncated: true, incomplete: false })
185
+ const fetchDir = makeFetchDir()
186
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "a.ts", fetchDir })
187
+ expect(searchMock).toHaveBeenCalledTimes(1)
188
+ expect(searchMock.mock.calls[0][0].data.query).toBe("a.ts")
189
+ expect(fetchDir).not.toHaveBeenCalled()
190
+ expect(res.items.map((c) => c.data?.path)).toEqual(["src/a.ts"])
191
+ expect(res.items[0].data?.isDir).toBe(false)
192
+ expect(res.truncated).toBe(true)
193
+ })
194
+
195
+ it("含 '/' 下钻:src/ 空 basename 全放行(fetchDir('src'),出全部内容)", async () => {
196
+ const fetchDir = makeFetchDir()
197
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "src/", fetchDir })
198
+ expect(fetchDir).toHaveBeenCalledWith("t1", "src")
199
+ expect(res.items.map((c) => c.data?.path)).toEqual(["src/a.ts", "src/components"])
200
+ expect(res.items[1].data?.isDir).toBe(true)
201
+ })
202
+
203
+ it("含 '/' 下钻:src/ab 非 空 basename 按前缀过滤", async () => {
204
+ const fetchDir = makeFetchDir()
205
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "src/a", fetchDir })
206
+ expect(fetchDir).toHaveBeenCalledWith("t1", "src")
207
+ expect(res.items.map((c) => c.data?.path)).toEqual(["src/a.ts"])
208
+ })
209
+
210
+ it("连续 '/' 规范化:a//b → a/b(fetchDir('a'),basename 'b')", async () => {
211
+ const fetchDir = vi.fn(async (_t: string, dirPath?: string) => ({
212
+ entries: [
213
+ { name: "b", isDir: true },
214
+ { name: "b.txt", isDir: false },
215
+ ],
216
+ truncated: false,
217
+ }))
218
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "a//b", fetchDir })
219
+ expect(fetchDir).toHaveBeenCalledWith("t1", "a")
220
+ expect(res.items.map((c) => c.data?.path)).toEqual(["a/b", "a/b.txt"])
221
+ })
222
+
223
+ it("空态 gating:rawThreadId null → 恒空(fetchDir/search 均不调)", async () => {
224
+ const fetchDir = makeFetchDir()
225
+ const res = await fileMentionCandidates({ rawThreadId: null, query: "", fetchDir })
226
+ expect(res).toEqual({ items: [], truncated: false })
227
+ expect(fetchDir).not.toHaveBeenCalled()
228
+ expect(searchMock).not.toHaveBeenCalled()
229
+ })
230
+
231
+ it("legacy 链 gating:gate false → 恒空", async () => {
232
+ gateState.enabled = false
233
+ const fetchDir = makeFetchDir()
234
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "", fetchDir })
235
+ expect(res).toEqual({ items: [], truncated: false })
236
+ expect(fetchDir).not.toHaveBeenCalled()
237
+ })
238
+
239
+ it("signal 已 abort → 提前返回空(不发 search)", async () => {
240
+ const controller = new AbortController()
241
+ controller.abort()
242
+ const fetchDir = makeFetchDir()
243
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "foo", signal: controller.signal, fetchDir })
244
+ expect(res).toEqual({ items: [], truncated: false })
245
+ expect(searchMock).not.toHaveBeenCalled()
246
+ })
247
+
248
+ it("serverFn 抛错 → catch 返回空(不 rethrow)", async () => {
249
+ searchMock.mockRejectedValue(new Error("boom"))
250
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "foo", fetchDir: makeFetchDir() })
251
+ expect(res).toEqual({ items: [], truncated: false })
252
+ })
253
+
254
+ it("候选形状:kind 'file'、label=完整 path、group=文件组、data{path,isDir}", async () => {
255
+ const fetchDir = makeFetchDir()
256
+ const res = await fileMentionCandidates({ rawThreadId: "t1", query: "", fetchDir })
257
+ expect(res.items[0]).toMatchObject({
258
+ id: "file:src",
259
+ label: "src",
260
+ kind: "file",
261
+ group: m.harness_mention_fileGroup(),
262
+ data: { path: "src", isDir: true },
263
+ })
264
+ })
265
+ })
266
+
267
+ // ═══════════════════════════════════════════════════════════════════
268
+ // 集成:真实 TipTap 渲染 composer
269
+ // ═══════════════════════════════════════════════════════════════════
270
+ describe("@file 工作区文件提及源(集成)", () => {
271
+ it("空查询 root 首屏:file 组置顶 + 「文件与文件夹」组头", async () => {
272
+ listDirMock.mockResolvedValue(ROOT_LISTING)
273
+ renderComposer()
274
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
275
+ const options = getOptions(menu)
276
+ // file 组置顶:首个 option 是 root 目录 src(file 候选先于 kb-doc/design)
277
+ await waitFor(() => expect(options[0]?.textContent).toContain("src"), { timeout: 3000 })
278
+ expect(menu.textContent).toContain("README.md")
279
+ expect(menu.textContent).toContain(m.harness_mention_fileGroup())
280
+ // file 组头出现在 kb 组头(kbName 测试知识库)之前
281
+ const text = menu.textContent ?? ""
282
+ expect(text.indexOf(m.harness_mention_fileGroup())).toBeLessThan(text.indexOf("测试知识库"))
283
+ })
284
+
285
+ it("裸查询走 rg 搜索 + truncated footer 提示行", async () => {
286
+ searchMock.mockResolvedValue({ matches: [{ path: "src/a.ts" }], engine: "rg", truncated: true, incomplete: false })
287
+ const { unmount } = render(
288
+ <HarnessComposer
289
+ threadId="t1"
290
+ isRunning={false}
291
+ hasAiKey
292
+ busyPreference="queue"
293
+ onSend={vi.fn()}
294
+ onStop={vi.fn()}
295
+ conversationRegionRef={{ current: null }}
296
+ messages={[]}
297
+ handoffPrefillText="@a"
298
+ />,
299
+ )
300
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
301
+ await waitFor(() => expect(menu.textContent).toContain("src/a.ts"), { timeout: 3000 })
302
+ // truncated → MenuView footer 截断提示
303
+ const footer = menu.querySelector<HTMLElement>("[data-menu-view-footer]")
304
+ expect(footer).not.toBeNull()
305
+ expect(footer?.textContent).toContain(m.harness_mention_truncated())
306
+ unmount()
307
+ })
308
+
309
+ it("目录行 Enter = 下钻不插 chip(文本变 @src/、菜单仍开、列新目录)", async () => {
310
+ listDirMock.mockImplementation(async ({ data }) => {
311
+ if (data.dirPath === "src") return SRC_LISTING
312
+ return ROOT_LISTING
313
+ })
314
+ renderComposer()
315
+ const textbox = getEditorDom()
316
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
317
+ // 等到 root 列表就绪(首项 src 目录)
318
+ await waitFor(() => expect(getOptions(menu)[0]?.textContent).toContain("src"), { timeout: 3000 })
319
+ // Enter 选中首项(src 目录)→ 下钻
320
+ fireEvent.keyDown(textbox, { key: "Enter" })
321
+ // 文本变 @src/(不插 chip)
322
+ await waitFor(() => expect(textbox.textContent).toContain("@src/"), { timeout: 3000 })
323
+ // 菜单仍开(listbox 存在)
324
+ await waitFor(() => expect(tryGetMenuView()).not.toBeNull(), { timeout: 3000 })
325
+ // 查询为新目录内容(src 下钻出 a.ts / components)
326
+ const reopened = await waitFor(() => getMenuView(), { timeout: 3000 })
327
+ await waitFor(() => expect(reopened.textContent).toContain("src/a.ts"), { timeout: 3000 })
328
+ // 未插 chip:doc 无 mention 节点(编辑器纯文本 @src/)
329
+ const mentionSpans = textbox.querySelectorAll('[data-type="mention"]')
330
+ expect(mentionSpans).toHaveLength(0)
331
+ })
332
+
333
+ it("下钻后面包屑:header 出现「工作区 › src」(仅 drill 产生)", async () => {
334
+ listDirMock.mockImplementation(async ({ data }) => {
335
+ if (data.dirPath === "src") return SRC_LISTING
336
+ return ROOT_LISTING
337
+ })
338
+ renderComposer()
339
+ const textbox = getEditorDom()
340
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
341
+ await waitFor(() => expect(getOptions(menu)[0]?.textContent).toContain("src"), { timeout: 3000 })
342
+ fireEvent.keyDown(textbox, { key: "Enter" })
343
+ const reopened = await waitFor(() => getMenuView(), { timeout: 3000 })
344
+ const header = await waitFor(
345
+ () => {
346
+ const h = reopened.querySelector<HTMLElement>("[data-menu-view-header]")
347
+ expect(h?.textContent).toContain(`${m.harness_mention_crumbRoot()} › src`)
348
+ return h
349
+ },
350
+ { timeout: 3000 },
351
+ )
352
+ expect(header?.textContent).toContain(m.harness_mention_crumbRoot())
353
+ })
354
+
355
+ it("drill 后 query 退回无 '/'(删除 '/')→ 面包屑清空(跟随查询回退,任务 B 遗留清理 5)", async () => {
356
+ listDirMock.mockImplementation(async ({ data }) => {
357
+ if (data.dirPath === "src") return SRC_LISTING
358
+ return ROOT_LISTING
359
+ })
360
+ // query "src"(无 '/')→ rg 搜索模式
361
+ searchMock.mockResolvedValue({ matches: [{ path: "src/a.ts" }], engine: "rg", truncated: false, incomplete: false })
362
+ // 渲染 ComposerEditor(非 HarnessComposer):jsdom 无原生 Backspace 行为
363
+ // (PM 把字符级删除交给浏览器 DOM 变更同步,jsdom 不实现),须持 editor 句柄
364
+ // 经事务删除字符——与「纯文本死文本边界」用例的 insertContent 键入同口径。
365
+ const holder: { current: Editor | null } = { current: null }
366
+ render(
367
+ <ComposerEditor
368
+ threadId="t1"
369
+ rawThreadId="t1"
370
+ editable
371
+ onTextChange={() => {}}
372
+ editorRef={(e) => {
373
+ holder.current = e
374
+ }}
375
+ />,
376
+ )
377
+ await waitFor(() => expect(holder.current).not.toBeNull(), { timeout: 3000 })
378
+ const editor = holder.current!
379
+ editor.commands.insertContent("@")
380
+ const textbox = getEditorDom()
381
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
382
+ await waitFor(() => expect(getOptions(menu)[0]?.textContent).toContain("src"), { timeout: 3000 })
383
+ // drill → 面包屑出现(工作区 › src)
384
+ fireEvent.keyDown(textbox, { key: "Enter" })
385
+ await waitFor(
386
+ () => {
387
+ const h = tryGetMenuView()?.querySelector<HTMLElement>("[data-menu-view-header]")
388
+ expect(h?.textContent).toContain(`${m.harness_mention_crumbRoot()} › src`)
389
+ },
390
+ { timeout: 3000 },
391
+ )
392
+ // 删除尾随 '/' → query "src"(rg 模式,非目录模式)→ 面包屑清空(header 移除)。
393
+ // doc 单段落文本起始 pos=1:尾字符 '/' 占 [textLen, textLen+1]。
394
+ const textLen = editor.state.doc.textContent.length // "@src/" → 5
395
+ editor.commands.deleteRange({ from: textLen, to: textLen + 1 })
396
+ await waitFor(
397
+ () => expect(tryGetMenuView()?.querySelector("[data-menu-view-header]")).toBeNull(),
398
+ { timeout: 3000 },
399
+ )
400
+ // 菜单仍开、rg 命中仍在(清栈不关菜单)
401
+ const reopened = await waitFor(() => getMenuView(), { timeout: 3000 })
402
+ await waitFor(() => expect(reopened.textContent).toContain("src/a.ts"), { timeout: 3000 })
403
+ })
404
+
405
+ it("getItems 并行化:file 源与内置源取数并行,合并结果 file 组置顶(任务 B 遗留清理 4,行为锁定)", async () => {
406
+ // file 目录 listing 延迟 settle——并行化后内置源候选与 file 候选同一 Promise.all
407
+ // 窗口汇合,合并顺序保持 file 组置顶(重构前后行为一致)
408
+ listDirMock.mockImplementation(async ({ data }) => {
409
+ await new Promise((resolve) => setTimeout(resolve, 30))
410
+ if (data.dirPath === "src") return SRC_LISTING
411
+ return ROOT_LISTING
412
+ })
413
+ renderComposer()
414
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
415
+ await waitFor(
416
+ () => {
417
+ expect(menu.textContent).toContain("README.md")
418
+ expect(menu.textContent).toContain("KB doc alpha")
419
+ },
420
+ { timeout: 3000 },
421
+ )
422
+ // file 组置顶:首个 option 是文件候选(src 目录),kb/design 组随后
423
+ expect(getOptions(menu)[0]?.textContent).toContain("src")
424
+ })
425
+
426
+ it("文件行 Enter = 插 chip + 尾随空格(getText 含 @src/a.ts)", async () => {
427
+ listDirMock.mockImplementation(async ({ data }) => {
428
+ if (data.dirPath === "src") return SRC_LISTING
429
+ return ROOT_LISTING
430
+ })
431
+ // 直接预填 @src/ 进入 src 目录(file 候选置顶:a.ts 首项)
432
+ const { unmount } = render(
433
+ <HarnessComposer
434
+ threadId="t1"
435
+ isRunning={false}
436
+ hasAiKey
437
+ busyPreference="queue"
438
+ onSend={vi.fn()}
439
+ onStop={vi.fn()}
440
+ conversationRegionRef={{ current: null }}
441
+ messages={[]}
442
+ handoffPrefillText="@src/"
443
+ />,
444
+ )
445
+ const textbox = getEditorDom()
446
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
447
+ await waitFor(() => expect(getOptions(menu)[0]?.textContent).toContain("src/a.ts"), { timeout: 3000 })
448
+ fireEvent.keyDown(textbox, { key: "Enter" })
449
+ await waitFor(() => expect(textbox.textContent).toContain("@src/a.ts"), { timeout: 3000 })
450
+ // 插 chip:doc 有 mention 节点(DOM 可见 @src/a.ts + 尾随空格)
451
+ expect(textbox.querySelectorAll('[data-type="mention"]')).toHaveLength(1)
452
+ unmount()
453
+ })
454
+
455
+ it("纯文本死文本边界:dismiss 后键入 @src/a.ts 不重建 chip(findMentionNodes=0)", async () => {
456
+ listDirMock.mockResolvedValue(SRC_LISTING)
457
+ searchMock.mockResolvedValue({ matches: [{ path: "src/a.ts" }], engine: "rg", truncated: false, incomplete: false })
458
+ const holder: { current: Editor | null } = { current: null }
459
+ render(
460
+ <ComposerEditor
461
+ threadId="t1"
462
+ rawThreadId="t1"
463
+ editable
464
+ onTextChange={() => {}}
465
+ editorRef={(e) => {
466
+ holder.current = e
467
+ }}
468
+ />,
469
+ )
470
+ // 编辑器就绪 → insertContent("@")(事务触发 suggestion,菜单开)
471
+ await waitFor(() => expect(holder.current).not.toBeNull(), { timeout: 3000 })
472
+ const editor = holder.current!
473
+ editor.commands.insertContent("@")
474
+ const textbox = getEditorDom()
475
+ await waitFor(() => expect(tryGetMenuView()).not.toBeNull(), { timeout: 3000 })
476
+ // Escape dismiss(死区)
477
+ fireEvent.keyDown(textbox, { key: "Escape" })
478
+ await waitFor(() => expect(tryGetMenuView()).toBeNull(), { timeout: 3000 })
479
+ // dismiss 后直接键入纯文本路径(不经菜单)
480
+ editor.commands.insertContent("src/a.ts")
481
+ // 反向断言:纯文本不重建 chip,且 wire 等价(getText 含字面)
482
+ expect(findMentionNodes(editor.getJSON())).toHaveLength(0)
483
+ expect(editor.getText()).toContain("@src/a.ts")
484
+ })
485
+
486
+ it("空态 gating:threadId=null → 无「文件与文件夹」组(kb/design 仍在)", async () => {
487
+ listDirMock.mockResolvedValue(ROOT_LISTING)
488
+ const { unmount } = render(
489
+ <HarnessComposer
490
+ threadId={null}
491
+ isRunning={false}
492
+ hasAiKey
493
+ busyPreference="queue"
494
+ onSend={vi.fn()}
495
+ onStop={vi.fn()}
496
+ conversationRegionRef={{ current: null }}
497
+ messages={[]}
498
+ handoffPrefillText="@"
499
+ />,
500
+ )
501
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
502
+ await waitFor(() => expect(menu.textContent).toContain("KB doc alpha"), { timeout: 3000 })
503
+ expect(menu.textContent).not.toContain(m.harness_mention_fileGroup())
504
+ expect(menu.textContent).not.toContain("README.md")
505
+ unmount()
506
+ })
507
+
508
+ it("legacy 链 gating:gate false → 无「文件与文件夹」组", async () => {
509
+ gateState.enabled = false
510
+ listDirMock.mockResolvedValue(ROOT_LISTING)
511
+ renderComposer()
512
+ const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
513
+ await waitFor(() => expect(menu.textContent).toContain("KB doc alpha"), { timeout: 3000 })
514
+ expect(menu.textContent).not.toContain(m.harness_mention_fileGroup())
515
+ expect(menu.textContent).not.toContain("README.md")
516
+ })
517
+ })
@@ -70,8 +70,11 @@ it("composer mount 后 '@' 内置源进 registry:candidates 喂 use-mention-so
70
70
  expect(sources).toHaveLength(1)
71
71
  expect(sources[0].name).toBe("builtin/mention")
72
72
  })
73
- // '/' 触发面不受 '@' 源影响(F5-4 接命令源)
74
- expect(getComposerInputTriggers("/")).toEqual([])
73
+ // '/' 触发面不受 '@' 源影响:唯一 '/' 源是 builtin/skills(P1 任务 3,'/' 菜单
74
+ // CommandSuggestionMenu mount 注册的技能源——'@' 注册不污染 '/' 面)
75
+ const slashSources = getComposerInputTriggers("/")
76
+ expect(slashSources).toHaveLength(1)
77
+ expect(slashSources[0].name).toBe("skills")
75
78
  // 候选来自(mock 的)mention 数据面(内置源实际同步返回,接口面为 union → 收窄)
76
79
  const candidates = getComposerInputTriggers("@")[0].candidates("") as Array<{
77
80
  id: string
@@ -0,0 +1,120 @@
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
+ * @ 提及菜单迁移 MenuView 渲染骨架(批 18):结构断言(非分组功能——分组现状已有,
20
+ * 迁移是换骨架)。渲染 HarnessComposer + handoffPrefillText '@' 开菜单,断言
21
+ * MenuView combobox 语义(data-menu-view + role=listbox + role=option +
22
+ * aria-activedescendant 随 ArrowDown 移动)与 ItemMedia 图标元素。
23
+ */
24
+ import { afterEach, beforeEach, expect, it, vi } from "vitest"
25
+ import { cleanup, fireEvent, render, waitFor } from "@testing-library/react"
26
+ import { HarnessComposer } from "../../harness-composer"
27
+ import { clearComposerExtensions } from "../../extension"
28
+
29
+ vi.mock("@/server/serverFns/harness/media", () => ({ generatePrototypeFn: vi.fn(() => Promise.resolve({})) }))
30
+ vi.mock("../use-mention-sources", () => ({
31
+ useMentionSources: () => ({
32
+ all: [
33
+ { kind: "kb-doc", id: "doc-1", label: "KB doc alpha", kbId: "kb-1", kbName: "测试知识库" },
34
+ { kind: "design", id: "design-1", label: "Design beta" },
35
+ ],
36
+ isLoading: false,
37
+ }),
38
+ }))
39
+ vi.mock("@/components/billing/use-feature", () => ({ useFeature: () => ({ enabled: true, loading: false }) }))
40
+ vi.mock("../../voice-input-button", () => ({ VoiceInputButton: () => null }))
41
+
42
+ beforeEach(() => {
43
+ sessionStorage.clear()
44
+ })
45
+ afterEach(() => {
46
+ cleanup()
47
+ clearComposerExtensions()
48
+ })
49
+
50
+ function renderComposer() {
51
+ return render(
52
+ <HarnessComposer
53
+ threadId="t1"
54
+ isRunning={false}
55
+ hasAiKey
56
+ busyPreference="queue"
57
+ onSend={vi.fn()}
58
+ onStop={vi.fn()}
59
+ conversationRegionRef={{ current: null }}
60
+ messages={[]}
61
+ handoffPrefillText="@"
62
+ />,
63
+ )
64
+ }
65
+
66
+ function getEditorDom(): HTMLElement {
67
+ const el = document.querySelector<HTMLElement>(".tiptap.ProseMirror")
68
+ if (!el) throw new Error("TipTap 编辑器 DOM 未挂载")
69
+ return el
70
+ }
71
+
72
+ /** @ 菜单 MenuView 容器(浮层内 data-menu-view 节点;迁移后由 MenuView 渲染) */
73
+ function getMenuView(): HTMLElement {
74
+ const el = document.querySelector<HTMLElement>(
75
+ '[data-selector="tiptap-mention-suggestion-menu"] [data-menu-view]',
76
+ )
77
+ if (!el) throw new Error("@ 菜单 MenuView 未挂载")
78
+ return el
79
+ }
80
+
81
+ it("@ 菜单迁移 MenuView:combobox 结构 + ItemMedia 图标 + ArrowDown 移动高亮", async () => {
82
+ renderComposer()
83
+ const textbox = getEditorDom()
84
+ const menu = await waitFor(() => getMenuView())
85
+ // combobox 结构(MenuView 骨架)
86
+ expect(menu.getAttribute("data-menu-view")).toBe("")
87
+ expect(menu.getAttribute("role")).toBe("listbox")
88
+ const options = menu.querySelectorAll('[role="option"]')
89
+ expect(options.length).toBeGreaterThanOrEqual(2)
90
+ // 初始高亮首项(autoSelectFirstItem)
91
+ expect(menu.getAttribute("aria-activedescendant")).toBe(
92
+ "tiptap-mention-suggestion-menu-option-0",
93
+ )
94
+ // 条目含 ItemMedia 图标元素(renderMedia 按 kind 映射)
95
+ expect(menu.querySelectorAll('[data-slot="item-media"] svg').length).toBeGreaterThanOrEqual(1)
96
+ // ArrowDown 移动高亮 → aria-activedescendant 跟随(键盘导航保留)
97
+ fireEvent.keyDown(textbox, { key: "ArrowDown" })
98
+ await waitFor(() =>
99
+ expect(menu.getAttribute("aria-activedescendant")).toBe(
100
+ "tiptap-mention-suggestion-menu-option-1",
101
+ ),
102
+ )
103
+ })
104
+
105
+ it("@ 菜单 mousemove 共享高亮:hover 行 → aria-activedescendant 移动(与键盘同一高亮源)", async () => {
106
+ renderComposer()
107
+ const menu = await waitFor(() => getMenuView())
108
+ // 初始高亮首项
109
+ expect(menu.getAttribute("aria-activedescendant")).toBe(
110
+ "tiptap-mention-suggestion-menu-option-0",
111
+ )
112
+ // mousemove 第二行 → 高亮随指针移动(setSelectedIndex 接线,非纯 CSS hover)
113
+ const secondRow = menu.querySelectorAll('[role="option"]')[1] as HTMLElement
114
+ fireEvent.mouseMove(secondRow)
115
+ await waitFor(() =>
116
+ expect(menu.getAttribute("aria-activedescendant")).toBe(
117
+ "tiptap-mention-suggestion-menu-option-1",
118
+ ),
119
+ )
120
+ })