@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,367 @@
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
+ * 控制行工作区选择按钮(任务 5):`+` 钮与权限钮之间的工作区入口(DSH 控制行
20
+ * 次序)。两种数据面:
21
+ * - cloud:切换线程挂靠的云端工作区(列表自取 harnessWorkspacesQueryOptions 既有
22
+ * 工厂——复用 key ['harness-workspaces'],与左面板 WorkspaceBrowser 共享缓存,
23
+ * 禁止新建工厂;kind === 'cloud' 为可选行,mirrorOfName 非空的镜像行不重复列出,
24
+ * local-meta 行不进云端列表)。选择经 onSwitchWorkspace 上抛(page 组装
25
+ * updateConversationFn({ workspaceId }) + conversations 同步)。**已有消息的线程
26
+ * 锁定切换**(2026-11-21 打磨裁决:工作区仅新会话可选——会话开始后不可再选,云端与
27
+ * 本地同口径;服务端 workspaceId 切换守卫仍独立在位)。
28
+ * - local:选本地授权目录(desktopAgentWorkspacesQueryOptions 清单 +
29
+ * getDesktopBridge().pickDirectory 原生对话框,AgentWorkspaceCard.addMutation
30
+ * 同款 mutation,成功 invalidate DESKTOP_AGENT_QUERY_KEY;取消 null 不调)。
31
+ * 选择经 onSelectLocalCwd 上抛(page 组装 setLocalCwd + updateConversationFn)。
32
+ * 已有消息的线程锁定(服务端引擎块要求空线程才可写,客户端 disabled 同口径)。
33
+ *
34
+ * 无 threadId 空态与本地锁定态:触发钮 disabled + Tooltip 说明(不渲染浮层)。
35
+ * open 态统一经 changeOpen 同步上报 onMenuOpenChange(与 @ / `+` 菜单 /
36
+ * PermissionSelectButton / ModelSelector 同款——menuOpen=true 屏蔽 Esc-Esc 停止
37
+ * 序列);Popover 走 ui/popover(Base UI portal,Esc 走 document 冒泡,本通道已
38
+ * 屏蔽停止热键,`+` 菜单任务 10 同构)。
39
+ *
40
+ * react-query 经 query-client-seam 显式直连(useQuery/useMutation 的可选 client
41
+ * 形参——mention-suggestion-menu fetchDir 同款):composer 树无 QueryClientProvider
42
+ * (既有 27 处 composer 渲染测试裸渲染),context 形式的 useQueryClient 会抛
43
+ * "No QueryClient set";seam 单例即 router.tsx 装配的同一 client(单实例纪律),
44
+ * 测试环境懒创建兜底。
45
+ */
46
+ import { useCallback, useMemo, useState } from "react"
47
+ import { useMutation, useQuery } from "@tanstack/react-query"
48
+ import { Check, ChevronDown, Folder, FolderOpen, FolderPlus, Loader2, Settings2 } from "lucide-react"
49
+ import { cn } from "cn"
50
+ import { PromptInputButton } from "@/components/ai-elements/prompt-input"
51
+ import { Button } from "@/components/ui/button"
52
+ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
53
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
54
+ import { toast } from "@/components/ui/toast"
55
+ import { getDesktopBridge } from "@/lib/desktop-bridge-types"
56
+ import { getQueryClient } from "@/lib/query-client-seam"
57
+ import {
58
+ DESKTOP_AGENT_QUERY_KEY,
59
+ desktopAgentWorkspacesQueryOptions,
60
+ } from "@/lib/queries/desktop-agent"
61
+ import { harnessWorkspacesQueryOptions } from "@/lib/queries/harness"
62
+ import { m } from "@/paraglide/messages.js"
63
+
64
+ export interface WorkspaceSelectButtonProps {
65
+ /** 执行引擎:cloud=服务端模型(选云端工作区);local=本地 ACP agent(选授权目录) */
66
+ engine: "cloud" | "local"
67
+ /** 目标线程 id;null = 空态(首条消息后建线),触发钮 disabled */
68
+ threadId: string | null
69
+ /** 当前线程挂靠的云端工作区 id(conversations.find 投影;null=未挂靠) */
70
+ threadWorkspaceId: string | null
71
+ /** 本地 Agent 的授权工作目录(engine=local 显示尾段;null=未选) */
72
+ localCwd: string | null
73
+ /** 已有消息(全引擎锁定工作区切换——打磨裁决:工作区仅新会话可选) */
74
+ hasMessages: boolean
75
+ /** cloud 切换(page 组装 updateConversationFn({ workspaceId }) + conversations 同步) */
76
+ onSwitchWorkspace?: (workspaceId: string) => Promise<void> | void
77
+ /** 本地目录选择(page 组装 setLocalCwd + updateConversationFn({ localCwd })) */
78
+ onSelectLocalCwd?: (path: string) => void
79
+ /** 打开左侧工作空间面板(云端菜单空态新建/管理入口通路;缺省 toast 引导) */
80
+ onOpenWorkspacePanel?: () => void
81
+ /** open 态上报(composer 的 setMenuOpen——Esc-Esc 停止序列屏蔽通道) */
82
+ onMenuOpenChange: (open: boolean) => void
83
+ }
84
+
85
+ /** 路径末段作为目录显示名(POSIX / Windows 分隔符均可;agent-workspace-card 同款复制,
86
+ * 不改既有文件导出面) */
87
+ function folderNameOf(path: string): string {
88
+ return path.split(/[\\/]/).filter(Boolean).at(-1) ?? path
89
+ }
90
+
91
+ export function WorkspaceSelectButton({
92
+ engine,
93
+ threadId,
94
+ threadWorkspaceId,
95
+ localCwd,
96
+ hasMessages,
97
+ onSwitchWorkspace,
98
+ onSelectLocalCwd,
99
+ onOpenWorkspacePanel,
100
+ onMenuOpenChange,
101
+ }: WorkspaceSelectButtonProps) {
102
+ const [open, setOpen] = useState(false)
103
+ // open 变化统一经此(点钮开 / Esc 外点关)——同步上报 onMenuOpenChange
104
+ const changeOpen = useCallback(
105
+ (next: boolean) => {
106
+ setOpen(next)
107
+ onMenuOpenChange(next)
108
+ },
109
+ [onMenuOpenChange],
110
+ )
111
+
112
+ // 锁定判定:空态(无线程可写)或已有消息(打磨裁决 2026-11-21:工作区仅新会话可选,
113
+ // 云端与本地同口径;服务端守卫仍为最后防线)
114
+ const locked = threadId == null || hasMessages
115
+
116
+ const queryClient = getQueryClient()
117
+ // 云端列表(复用既有工厂与 key ['harness-workspaces'],与左面板共享缓存);
118
+ // local 引擎不取(引擎互斥)。**enabled 附加 open**(简报字面为 engine !== 'local',
119
+ // 实测差异见下):composer 27 处既有渲染测试裸渲染无 QueryClientProvider,挂载即
120
+ // 取数会真实发起 serverFn RPC(thread-mention 的「legacy gating 不发
121
+ // harness-workspaces 请求」哨兵断言直接红)。open 门控后:关闭态名称回显仍生效
122
+ // ——TanStack Query enabled:false 的 observer 依旧订阅缓存(左面板 WorkspaceBrowser
123
+ // 挂载即取同一工厂,缓存恒有值;测试环境用 setQueryData 预置同形缓存)。
124
+ const cloudQuery = useQuery(
125
+ { ...harnessWorkspacesQueryOptions(), enabled: open && engine !== "local" },
126
+ queryClient,
127
+ )
128
+ // 本地授权目录清单;cloud 引擎不取(同 open 门控——菜单不打开不跑桥 IPC)
129
+ const localQuery = useQuery(
130
+ { ...desktopAgentWorkspacesQueryOptions(), enabled: open && engine === "local" },
131
+ queryClient,
132
+ )
133
+ // 添加目录(AgentWorkspaceCard.addMutation 同款:pickDirectory 成功写入清单并
134
+ // 返回规范化绝对路径,取消返回 null;成功后按前缀 invalidate 清单)
135
+ const addMutation = useMutation(
136
+ {
137
+ mutationFn: async () => (await getDesktopBridge()?.pickDirectory?.()) ?? null,
138
+ onSuccess: async (picked) => {
139
+ if (!picked) return // 用户取消对话框:不调不关菜单
140
+ await queryClient.invalidateQueries({ queryKey: DESKTOP_AGENT_QUERY_KEY })
141
+ onSelectLocalCwd?.(picked)
142
+ changeOpen(false)
143
+ },
144
+ onError: () => {
145
+ toast.error(m.agent_desktop_workspaceAddFailed())
146
+ },
147
+ },
148
+ queryClient,
149
+ )
150
+
151
+ const cloudWorkspaces = cloudQuery.data?.workspaces ?? []
152
+ // 触发钮云端名称:全量行里找当前挂靠(镜像行不进可选列表但名称仍可回显)
153
+ const cloudCurrentName = threadWorkspaceId
154
+ ? (cloudWorkspaces.find((w) => w.id === threadWorkspaceId)?.name ?? null)
155
+ : null
156
+ // 可选云端行:kind === 'cloud'(local-meta 是本地挂载元数据行)+ 镜像行
157
+ // (mirrorOfName 非空 = 已有本地镜像承载)不重复列出
158
+ const cloudOptions = useMemo(
159
+ () => cloudWorkspaces.filter((w) => w.kind === "cloud" && w.mirrorOfName == null),
160
+ [cloudWorkspaces],
161
+ )
162
+ const localDirs = localQuery.data ?? []
163
+
164
+ // 触发钮图标/名称:已选 FolderOpen(cloud=挂靠名 / local=目录尾段),未选 Folder + 占位
165
+ const isSelected =
166
+ (engine === "cloud" && threadWorkspaceId != null) ||
167
+ (engine === "local" && localCwd != null)
168
+ const SelectedIcon = isSelected ? FolderOpen : Folder
169
+ const label =
170
+ engine === "cloud"
171
+ ? threadWorkspaceId != null
172
+ ? (cloudCurrentName ?? m.harness_workspace_selectPlaceholder())
173
+ : m.harness_workspace_selectPlaceholder()
174
+ : localCwd != null
175
+ ? folderNameOf(localCwd)
176
+ : m.harness_workspace_selectPlaceholder()
177
+
178
+ // 空态/锁定态:disabled 触发钮 + Tooltip 说明(disabled 钮不接收指针事件,
179
+ // tooltip trigger 包一层 span 承接 hover——design-share-panel 同款配方)
180
+ const lockTooltip =
181
+ threadId == null
182
+ ? m.harness_workspace_emptyTooltip()
183
+ : m.harness_workspace_lockedTooltip()
184
+
185
+ const triggerButton = (
186
+ <PromptInputButton
187
+ size="sm"
188
+ variant="outline"
189
+ className="rounded-full"
190
+ data-workspace-select-trigger=""
191
+ aria-label={m.harness_workspace_aria({ name: label })}
192
+ disabled={locked}
193
+ >
194
+ <SelectedIcon aria-hidden className="size-3.5 shrink-0" />
195
+ <span className="max-w-28 truncate text-xs">{label}</span>
196
+ <ChevronDown
197
+ aria-hidden
198
+ className={cn(
199
+ "size-3.5 shrink-0 text-muted-foreground transition-transform",
200
+ open && "rotate-180",
201
+ )}
202
+ />
203
+ </PromptInputButton>
204
+ )
205
+
206
+ // 打开左面板工作区通路(新建/管理入口);通道缺省(非 workbench 装配点)toast 引导
207
+ const handleOpenPanel = useCallback(() => {
208
+ if (onOpenWorkspacePanel) {
209
+ onOpenWorkspacePanel()
210
+ } else {
211
+ toast.info(m.harness_workspace_openPanelHint())
212
+ }
213
+ changeOpen(false)
214
+ }, [onOpenWorkspacePanel, changeOpen])
215
+
216
+ if (locked) {
217
+ return (
218
+ <Tooltip>
219
+ <TooltipTrigger render={<span className="inline-flex cursor-not-allowed" />}>
220
+ {triggerButton}
221
+ </TooltipTrigger>
222
+ <TooltipContent>{lockTooltip}</TooltipContent>
223
+ </Tooltip>
224
+ )
225
+ }
226
+
227
+ return (
228
+ <Popover open={open} onOpenChange={changeOpen}>
229
+ <PopoverTrigger render={triggerButton} />
230
+ {open && (
231
+ <PopoverContent align="start" className="w-64 gap-0 p-1">
232
+ {engine === "cloud" ? (
233
+ <div className="flex flex-col">
234
+ <div className="px-2 py-1.5 text-xs text-muted-foreground">
235
+ {m.harness_workspace_switchHint()}
236
+ </div>
237
+ {cloudQuery.isPending ? (
238
+ <div className="flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground">
239
+ <Loader2 aria-hidden className="size-3.5 animate-spin" />
240
+ {m.harness_workspace_loading()}
241
+ </div>
242
+ ) : cloudOptions.length === 0 ? (
243
+ <div className="flex flex-col">
244
+ <div className="px-2 py-3 text-center text-sm text-muted-foreground">
245
+ {m.harness_workspace_emptyList()}
246
+ </div>
247
+ <MenuRow
248
+ icon={<FolderPlus aria-hidden className="size-3.5" />}
249
+ label={m.harness_workspace_createEntry()}
250
+ onClick={handleOpenPanel}
251
+ />
252
+ <MenuRow
253
+ icon={<Settings2 aria-hidden className="size-3.5" />}
254
+ label={m.harness_workspace_manageEntry()}
255
+ onClick={handleOpenPanel}
256
+ />
257
+ </div>
258
+ ) : (
259
+ <div className="max-h-64 overflow-y-auto">
260
+ {cloudOptions.map((w) => {
261
+ const current = w.id === threadWorkspaceId
262
+ return (
263
+ <MenuRow
264
+ key={w.id}
265
+ icon={
266
+ <FolderOpen aria-hidden className="size-3.5 text-muted-foreground" />
267
+ }
268
+ label={w.name}
269
+ checked={current}
270
+ onClick={() => {
271
+ void onSwitchWorkspace?.(w.id)
272
+ changeOpen(false)
273
+ }}
274
+ />
275
+ )
276
+ })}
277
+ </div>
278
+ )}
279
+ </div>
280
+ ) : (
281
+ <div className="flex flex-col">
282
+ <div className="max-h-64 overflow-y-auto">
283
+ {localDirs.map((path) => {
284
+ const current = path === localCwd
285
+ return (
286
+ <MenuRow
287
+ key={path}
288
+ icon={
289
+ <FolderOpen aria-hidden className="size-3.5 text-muted-foreground" />
290
+ }
291
+ label={folderNameOf(path)}
292
+ checked={current}
293
+ onClick={() => {
294
+ onSelectLocalCwd?.(path)
295
+ changeOpen(false)
296
+ }}
297
+ />
298
+ )
299
+ })}
300
+ {localDirs.length === 0 && !localQuery.isPending && (
301
+ <div className="px-2 py-3 text-center text-sm text-muted-foreground">
302
+ {m.agent_desktop_workspaceEmpty()}
303
+ </div>
304
+ )}
305
+ {localQuery.isPending && (
306
+ <div className="flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground">
307
+ <Loader2 aria-hidden className="size-3.5 animate-spin" />
308
+ {m.harness_workspace_loading()}
309
+ </div>
310
+ )}
311
+ </div>
312
+ <div className="my-1 border-t" />
313
+ <MenuRow
314
+ icon={
315
+ addMutation.isPending ? (
316
+ <Loader2 aria-hidden className="size-3.5 animate-spin" />
317
+ ) : (
318
+ <FolderPlus aria-hidden className="size-3.5" />
319
+ )
320
+ }
321
+ label={m.agent_desktop_workspaceAdd()}
322
+ disabled={addMutation.isPending}
323
+ onClick={() => addMutation.mutate()}
324
+ />
325
+ </div>
326
+ )}
327
+ </PopoverContent>
328
+ )}
329
+ </Popover>
330
+ )
331
+ }
332
+
333
+ /** 菜单行(云端工作区 / 本地目录 / 入口项共用):icon + label + 当前行 ✓。用
334
+ * ui/button ghost 承载(AGENTS.md 选型④禁手写原生按钮;ghost 基类自带
335
+ * focus-visible 焦点环,修复原生实现的键盘焦点不可见)。className 覆盖项:
336
+ * justify-start/text-left(按钮默认居中)、px-2(size sm 的 2.5 收窄回原行距)、
337
+ * gap-2、font-normal(基类 font-medium 回常规字重);高度 h-8 与原 py-1.5 自然行高
338
+ * 等值,选中语义(checked ✓ / sr-only)不变。 */
339
+ function MenuRow({
340
+ icon,
341
+ label,
342
+ checked = false,
343
+ disabled = false,
344
+ onClick,
345
+ }: {
346
+ icon: React.ReactNode
347
+ label: string
348
+ checked?: boolean
349
+ disabled?: boolean
350
+ onClick: () => void
351
+ }) {
352
+ return (
353
+ <Button
354
+ type="button"
355
+ variant="ghost"
356
+ size="sm"
357
+ className="w-full justify-start gap-2 px-2 text-left font-normal"
358
+ disabled={disabled}
359
+ onClick={onClick}
360
+ >
361
+ {icon}
362
+ <span className="min-w-0 flex-1 truncate">{label}</span>
363
+ {checked && <Check aria-hidden className="size-3.5 shrink-0" />}
364
+ {checked && <span className="sr-only">✓</span>}
365
+ </Button>
366
+ )
367
+ }
@@ -128,6 +128,26 @@ describe('useHarnessChatAdapter(T2.8 适配层)', () => {
128
128
  expect(idle.result.current.connectionStatus).toBe('connected')
129
129
  })
130
130
 
131
+ it('空闲期重连静默(2026-11-21 对齐 DSH):reconnecting 仅在 running 才报 connecting', () => {
132
+ // 空闲会话(含空 entry 桥接交接的 open→reconnecting→open 闪断)重连是后台
133
+ // 自愈,指示灯必须保持隐藏(connected → workbench-page 映射 hidden)。
134
+ const idle = renderHook(() =>
135
+ useHarnessChatAdapter(
136
+ makeFakeSession({ status: 'idle', connection: 'reconnecting' }),
137
+ ),
138
+ )
139
+ expect(idle.result.current.connectionStatus).toBe('connected')
140
+
141
+ // requires_action(审批等待)掉线同样静默:审批卡已落客户端 store,
142
+ // approve 结果经重连后的流补投。
143
+ const acting = renderHook(() =>
144
+ useHarnessChatAdapter(
145
+ makeFakeSession({ status: 'requires_action', connection: 'reconnecting' }),
146
+ ),
147
+ )
148
+ expect(acting.result.current.connectionStatus).toBe('connected')
149
+ })
150
+
131
151
  it('interrupts:approvals/interrupts/questions 保 kind 分类(F5-2 三档选举原料)', () => {
132
152
  const session = makeFakeSession({
133
153
  approvals: [{ id: 'ap1', tool: 'bash', args: {}, approve: vi.fn(), reject: vi.fn() }],
@@ -11,11 +11,13 @@ import { renderHook, act } from '@testing-library/react'
11
11
  import { createStore } from '@tanstack/store'
12
12
 
13
13
  const putMediaMock = vi.fn()
14
+ const runCommandMock = vi.fn()
14
15
  const sendViewMock = vi.fn()
15
16
 
16
17
  vi.mock('@tanstack/ai-harness/client', () => ({
17
18
  createHarnessClient: () => ({
18
19
  putMedia: putMediaMock,
20
+ runCommand: runCommandMock,
19
21
  }),
20
22
  }))
21
23
 
@@ -46,6 +48,8 @@ import { useHarnessSession } from '../use-harness-session'
46
48
 
47
49
  beforeEach(() => {
48
50
  putMediaMock.mockReset()
51
+ runCommandMock.mockReset()
52
+ runCommandMock.mockResolvedValue({ ok: true })
49
53
  putMediaMock.mockResolvedValue({
50
54
  id: 'm1',
51
55
  threadId: 't1',
@@ -79,4 +83,17 @@ describe('useHarnessSession putMedia 接线(T2.11 ④)', () => {
79
83
  const { result } = renderHook(() => useHarnessSession({ threadId: 't1' }))
80
84
  expect(result.current.client).toBeDefined()
81
85
  })
86
+
87
+ it('暴露的 runCommand 透传 (name, input) 到 client.runCommand({ name, input })(P2 任务 1 断点③最深跳)', async () => {
88
+ const { result } = renderHook(() => useHarnessSession({ threadId: 't1' }))
89
+ const runCommand = result.current.runCommand
90
+ expect(typeof runCommand).toBe('function')
91
+
92
+ await act(async () => {
93
+ await runCommand?.('export', '每周汇总')
94
+ })
95
+
96
+ // args 经 input 透传(修复前仅 client.runCommand({ name })、input 丢弃)
97
+ expect(runCommandMock).toHaveBeenCalledWith({ name: 'export', input: '每周汇总' })
98
+ })
82
99
  })
@@ -0,0 +1,116 @@
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
+ // T13 旁路插件事件 → roster query invalidate(设计 §6.6/§7.2):包一层 harness
19
+ // client.events()(仿 use-file-changes.ts 同款 wrap),遇 AgentTerminalOpened /
20
+ // AgentTerminalClosed 插件事件(CUSTOM name='harness.plugin.event' 信封,value =
21
+ // { plugin, name, value })时 invalidate ['harnessTerminalRoster'] 前缀——roster
22
+ // query(10s 轮询)立即重取,DockSurface 的 reconcile effect 即刻开/关 agent tab,
23
+ // 不必等下一个轮询周期。
24
+ //
25
+ // 事件名镜像(服务端 agent-terminal.plugin.ts 的 createPluginEvent 名,客户端不
26
+ // 跨界 import server 模块——eslint TL-01 + bundle 纪律;wire 名对账由服务端
27
+ // agent-terminal.plugin.test.ts 的「typed 通道名」断言锁定,本处改名须连带):
28
+ // - allblue/agent-terminal:opened,载荷 { terminalId, title }
29
+ // - allblue/agent-terminal:closed,载荷 { terminalId }(仅真杀 outcome='closed'
30
+ // 才发;接管除名 left-for-user 不发——tab 不关)
31
+ //
32
+ // 直接 invalidate 而非旁路 store:消费方只关心「事件发生了」(触发重取),不消费
33
+ // 载荷内容(开/关指令由 roster 重建,事件只做加速)——store→hook→invalidate 的
34
+ // 间接层无增益,故经 query-client-seam 单例直呼(与 harness-workbench-page 同源
35
+ // client,router.tsx 装配)。挂载点:use-harness-session 的包装链(compaction →
36
+ // model-retry → file-changes → 本层)。
37
+
38
+ import type { SessionEvent } from '@tanstack/ai-harness'
39
+ import type { SessionViewSource } from '@tanstack/ai-harness/view'
40
+ import { getQueryClient } from '@/lib/query-client-seam'
41
+ import { HARNESS_TERMINAL_ROSTER_QUERY_KEY } from '@/lib/queries/harness-terminal'
42
+
43
+ /** wire 事件名镜像:AgentTerminalOpened(服务端 createPluginEvent 名)。 */
44
+ const AGENT_TERMINAL_OPENED = 'allblue/agent-terminal:opened'
45
+ /** wire 事件名镜像:AgentTerminalClosed(服务端 createPluginEvent 名)。 */
46
+ const AGENT_TERMINAL_CLOSED = 'allblue/agent-terminal:closed'
47
+
48
+ /** 旁路事件 sightings(判别联合,readAgentTerminalEvent 的产出)。 */
49
+ export type AgentTerminalEventSight =
50
+ | { kind: 'opened'; terminalId: string; title: string }
51
+ | { kind: 'closed'; terminalId: string }
52
+
53
+ /**
54
+ * 从 CUSTOM 事件抽 AgentTerminalOpened/Closed sighting(fail-closed:信封/载荷
55
+ * 结构不符或非终端事件 → null)。插件事件 wire 信封:CUSTOM name=
56
+ * 'harness.plugin.event',value = { plugin, name, value }(toolcall-diff 同口径;
57
+ * name 全局唯一带 'allblue/agent-terminal:' 前缀,plugin 字段不再重复校验)。
58
+ */
59
+ export function readAgentTerminalEvent(event: SessionEvent['event']): AgentTerminalEventSight | null {
60
+ if (event.type !== 'CUSTOM') return null
61
+ if (event.name !== 'harness.plugin.event') return null
62
+ const value = (event as { value?: unknown }).value
63
+ if (!value || typeof value !== 'object') return null
64
+ const record = value as { name?: unknown; value?: unknown }
65
+ const inner = record.value
66
+ if (!inner || typeof inner !== 'object') return null
67
+ if (record.name === AGENT_TERMINAL_OPENED) {
68
+ const payload = inner as { terminalId?: unknown; title?: unknown }
69
+ if (typeof payload.terminalId !== 'string' || payload.terminalId.length === 0) return null
70
+ // title 服务端已兜底 'shell',此处仍防缺省(跨版本 wire 容错)
71
+ return {
72
+ kind: 'opened',
73
+ terminalId: payload.terminalId,
74
+ title: typeof payload.title === 'string' && payload.title.length > 0 ? payload.title : 'shell',
75
+ }
76
+ }
77
+ if (record.name === AGENT_TERMINAL_CLOSED) {
78
+ const payload = inner as { terminalId?: unknown }
79
+ if (typeof payload.terminalId !== 'string' || payload.terminalId.length === 0) return null
80
+ return { kind: 'closed', terminalId: payload.terminalId }
81
+ }
82
+ return null
83
+ }
84
+
85
+ /**
86
+ * 包一层 session source(HarnessClient 满足 SessionViewSource):events() 流内遇
87
+ * AgentTerminalOpened/Closed 时 invalidate roster query 前缀(原事件照旧 yield 给
88
+ * view,互不影响)。source 为 null(空态)时原样返回。泛型保持入参类型,使
89
+ * createSessionView(wrapped) 的类型与原 client 一致。
90
+ */
91
+ export function wrapClientWithAgentTerminals<TSource extends SessionViewSource>(
92
+ source: TSource | null,
93
+ ): TSource | null {
94
+ if (!source) return null
95
+ const wrapped = {
96
+ ...source,
97
+ events: (eventOptions?: { from?: string; signal?: AbortSignal }) =>
98
+ injectAgentTerminalEvents(source, eventOptions ?? {}),
99
+ } as unknown as TSource
100
+ return wrapped
101
+ }
102
+
103
+ /** 异步生成器:透传原事件给 view,旁路遇终端插件事件即 invalidate roster query。 */
104
+ async function* injectAgentTerminalEvents(
105
+ source: SessionViewSource,
106
+ eventOptions: { from?: string; signal?: AbortSignal },
107
+ ): AsyncGenerator<SessionEvent> {
108
+ for await (const entry of source.events(eventOptions ?? {})) {
109
+ yield entry
110
+ const sight = readAgentTerminalEvent(entry.event)
111
+ if (!sight) continue
112
+ // 前缀失效(threadId 段位不参与)——现网单工作台单活动会话,命中当前 roster
113
+ // query;切线程后的旧 query 无观察者,标记 stale 无代价。
114
+ getQueryClient().invalidateQueries({ queryKey: [HARNESS_TERMINAL_ROSTER_QUERY_KEY] })
115
+ }
116
+ }
@@ -33,7 +33,7 @@ import type {
33
33
  ViewPart,
34
34
  } from '@tanstack/ai-harness/view'
35
35
  import type { MediaRecord } from '@tanstack/ai-harness/client'
36
- import type { SessionUsage } from '@tanstack/ai-harness'
36
+ import type { SessionUsage, ThreadSettings, ThreadSettingsChange } from '@tanstack/ai-harness'
37
37
  import type { TerminalEntry } from './terminal-entries'
38
38
  import { HarnessSessionAppChat } from './harness-session-appchat'
39
39
  import type { HarnessSession } from './use-harness-session'
@@ -77,6 +77,18 @@ export interface HarnessChatLike {
77
77
  * (total/byModel/bySender/bySource)。undefined = 尚无模型调用(用量 pill 不渲染)。
78
78
  */
79
79
  sessionUsage?: SessionUsage
80
+ /**
81
+ * 线程持久化设置切片(P2 composer 控制,任务 1):view state 顶层 settings
82
+ * (ThreadSettings:model/reasoning/instructions/...,服务端 configure op 写入后
83
+ * 经 settingsChanged 事件回流)。undefined = 尚无 settings 或旧链(消费方显示回落值)。
84
+ */
85
+ threadSettings?: ThreadSettings
86
+ /**
87
+ * 线程设置写入(P2 composer 控制,任务 1):view.updateThreadSettings(configure
88
+ * op,服务端 expose.settings 白名单逐 key 校验)透传。空态无 view → undefined。
89
+ * Receipt 收窄为 unknown 防包类型穿透(消费方无需感知 ai-harness Receipt 形状)。
90
+ */
91
+ updateThreadSettings?: (settings: ThreadSettingsChange) => Promise<unknown> | undefined
80
92
  /** 沙箱终端 bash 调用序列(P3-5,transcript 聚合;空 = 无 bash 调用) */
81
93
  terminalEntries: TerminalEntry[]
82
94
  interrupts: TakeoverInterruptLike[]
@@ -107,11 +119,12 @@ export interface HarnessChatLike {
107
119
  */
108
120
  commands: ReadonlyArray<{ name: string; description: string }>
109
121
  /**
110
- * 服务端命令执行(F5-4 runCommand 通路):harness client.runCommand({ name })
111
- * 透传,结果经 harness.command.result 事件回流。空态无 client → undefined。
112
- * 旧链无此能力(undefined → workbench-page onRunCommand 兜底 resolve)。
122
+ * 服务端命令执行(F5-4 runCommand 通路):harness client.runCommand({ name, input })
123
+ * 透传,结果经 harness.command.result 事件回流。input 为 claim 结算参数(E2,P2 任务 1:
124
+ * input 型 server 命令 claim.submit(args) 经此透传,缺省 undefined=非 claim 调用)。
125
+ * 空态无 client → undefined。旧链无此能力(undefined → workbench-page onRunCommand 兜底 resolve)。
113
126
  */
114
- runCommand?: (name: string) => Promise<unknown>
127
+ runCommand?: (name: string, input?: unknown) => Promise<unknown>
115
128
  /**
116
129
  * 继续生成(A5/B8,F5-6 批 2):view.continueWithoutMessage——无新消息、从已存
117
130
  * transcript 续跑一回合。steerQueue 快捷键(空草稿+Cmd/Ctrl+Enter)与主按钮
@@ -178,10 +191,22 @@ function mapStatus(status: 'idle' | 'running' | 'requires_action'): LegacyChatSt
178
191
  return 'ready'
179
192
  }
180
193
 
181
- /** harness connection → 旧 ConnectionStatus。 */
182
- function mapConnection(connection: 'open' | 'reconnecting' | 'closed'): LegacyConnectionStatus {
183
- if (connection === 'reconnecting') return 'connecting'
184
- // open(正常)/ closed(未启动或已释放):指示灯隐藏,不报警
194
+ /**
195
+ * harness connection → 旧 ConnectionStatus。
196
+ *
197
+ * 空闲期重连静默(2026-11-21 用户裁决,对齐 DSH):官方 client.events 对流结束
198
+ * 无限退避重连(1s→30s 封顶),空闲会话的重连是后台自愈、不丢任何可见状态,
199
+ * 指示灯只在「运行中掉线」(丢流式输出,用户正在等的那段回复可能中断)时亮。
200
+ * 发送路径的失败经 error 字段另行反馈(workbench-page 的 error 分支),不依赖
201
+ * 连接灯;requires_action(审批等待)掉线不亮——审批卡是客户端已落 store 的
202
+ * 状态,approve 结果经重连后的流补投,无需报警。
203
+ */
204
+ function mapConnection(
205
+ connection: 'open' | 'reconnecting' | 'closed',
206
+ status: 'idle' | 'running' | 'requires_action',
207
+ ): LegacyConnectionStatus {
208
+ if (connection === 'reconnecting' && status === 'running') return 'connecting'
209
+ // open(正常)/ closed(未启动或已释放)/ 空闲期 reconnecting:指示灯隐藏,不报警
185
210
  return 'connected'
186
211
  }
187
212
 
@@ -336,7 +361,7 @@ function singleSourceFromArgs(args: unknown): Array<{ title: string; url: string
336
361
  * 调用方经 options.harnessAttachments 透传,见 tie-up 3)。
337
362
  */
338
363
  export function useHarnessChatAdapter(session: HarnessSession): HarnessChatLike {
339
- const { view, messages: viewMessages, status, connection, approvals, interrupts: viewInterrupts, questions, send, followUp, continueWithoutMessage, queuedTurns, cancel, putMedia, contextTokens, sessionUsage, terminalEntries, commands: sessionCommands, runCommand: sessionRunCommand } = session
364
+ const { view, messages: viewMessages, status, connection, approvals, interrupts: viewInterrupts, questions, send, followUp, continueWithoutMessage, queuedTurns, cancel, putMedia, contextTokens, sessionUsage, threadSettings, updateThreadSettings, terminalEntries, commands: sessionCommands, runCommand: sessionRunCommand } = session
340
365
 
341
366
  const [error, setError] = useState<Error | null>(null)
342
367
 
@@ -367,6 +392,11 @@ export function useHarnessChatAdapter(session: HarnessSession): HarnessChatLike
367
392
 
368
393
  // 服务端命令投影(F5-4):ViewCommand → '/' 菜单 server 类最小形状(name+
369
394
  // description;owner 不进菜单)。现状 view.commands 空(内置插件零注册)→ []。
395
+ // ⚠ input 旗标翻译边界(P2 任务 1):上游 ViewCommand.input 是 JSON Schema(非
396
+ // 布尔),composer 的 ComposerServerCommand.input 是布尔旗标——本投影**不做**翻译,
397
+ // 故 server input 型命令即使存在也不会被 claim 通路认作 input 型(零消费者:expose
398
+ // .commands 现无 input 型命令)。留待真实 server input 命令出现时在此定
399
+ // 「JSON Schema → 布尔旗标」翻译层(届时一并补 claim 用例)。
370
400
  const commands = useMemo(
371
401
  () => sessionCommands.map((c) => ({ name: c.name, description: c.description })),
372
402
  [sessionCommands],
@@ -455,10 +485,12 @@ export function useHarnessChatAdapter(session: HarnessSession): HarnessChatLike
455
485
  isLoading: status === 'running',
456
486
  error,
457
487
  status: mapStatus(status),
458
- connectionStatus: mapConnection(connection),
488
+ connectionStatus: mapConnection(connection, status),
459
489
  runId: null,
460
490
  contextTokens,
461
491
  sessionUsage,
492
+ threadSettings,
493
+ updateThreadSettings,
462
494
  terminalEntries,
463
495
  interrupts,
464
496
  sendMessage,