@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.
- package/package.json +4 -3
- package/public/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/public/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/public/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/public/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/public/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/public/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/public/pdfjs/cmaps/LICENSE +36 -0
- package/public/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/public/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/public/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Roman.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/V.bcmap +0 -0
- package/public/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/src/components/ai/ai-prompt-input/index.tsx +3 -87
- package/src/components/ai-elements/__tests__/context.test.tsx +167 -0
- package/src/components/ai-elements/context.tsx +182 -94
- package/src/components/ai-elements/prompt-input.tsx +6 -104
- package/src/components/harness/__tests__/composer-attachments.test.tsx +17 -9
- package/src/components/harness/__tests__/composer-click-focus.test.tsx +175 -0
- package/src/components/harness/__tests__/composer-focus.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-keymap.test.ts +57 -0
- package/src/components/harness/__tests__/composer-paste.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-pending-guard.test.tsx +207 -0
- package/src/components/harness/__tests__/composer-placeholder.test.ts +7 -6
- package/src/components/harness/__tests__/composer-plus-menu.test.tsx +202 -0
- package/src/components/harness/__tests__/composer-primary-button.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-send.test.tsx +12 -4
- package/src/components/harness/__tests__/composer-undo.test.tsx +7 -0
- package/src/components/harness/__tests__/dock-registry.test.ts +46 -0
- package/src/components/harness/__tests__/harness-workbench-auth-error.test.tsx +42 -4
- package/src/components/harness/__tests__/mention-kbid.test.ts +69 -0
- package/src/components/harness/__tests__/undo-last-turn.test.ts +134 -0
- package/src/components/harness/__tests__/voice-activity.test.tsx +2 -2
- package/src/components/harness/conversation-panel/composer/__tests__/file-chip-open.test.tsx +195 -0
- package/src/components/harness/conversation-panel/composer/__tests__/menu-view.test.tsx +107 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-attachments.test.tsx +271 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-client-submit.test.tsx +291 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-guard.test.tsx +275 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-permission.test.tsx +286 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-plan.test.tsx +344 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-popup.test.tsx +193 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-server-source.test.tsx +235 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-suggestion-menu.test.tsx +151 -1
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-undo.test.tsx +168 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/exclude-composer-seat.test.ts +106 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/menu-view.test.tsx +55 -2
- package/src/components/harness/conversation-panel/composer/command/__tests__/skill-source.test.tsx +336 -0
- package/src/components/harness/conversation-panel/composer/command/claim.ts +7 -1
- package/src/components/harness/conversation-panel/composer/command/command-popup.tsx +140 -0
- package/src/components/harness/conversation-panel/composer/command/command-suggestion-menu.tsx +261 -75
- package/src/components/harness/conversation-panel/composer/command/menu-view.tsx +188 -50
- package/src/components/harness/conversation-panel/composer/command/popup-panel.tsx +106 -0
- package/src/components/harness/conversation-panel/composer/command/skill-source.ts +231 -0
- package/src/components/harness/conversation-panel/composer/composer-editor.tsx +216 -14
- package/src/components/harness/conversation-panel/composer/composer-keymap.ts +26 -0
- package/src/components/harness/conversation-panel/composer/extension/__tests__/command-menu.test.ts +128 -12
- package/src/components/harness/conversation-panel/composer/extension/command-menu.ts +303 -44
- package/src/components/harness/conversation-panel/composer/extension/index.ts +8 -0
- package/src/components/harness/conversation-panel/composer/harness-composer.tsx +551 -83
- package/src/components/harness/conversation-panel/composer/mention/__tests__/file-mention.test.tsx +517 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-source-registration.test.tsx +5 -2
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-suggestion-menu.test.tsx +120 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-trigger-source.test.ts +52 -9
- package/src/components/harness/conversation-panel/composer/mention/__tests__/story-mention.test.tsx +356 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/thread-mention.test.tsx +377 -0
- package/src/components/harness/conversation-panel/composer/mention/file-mention.ts +162 -0
- package/src/components/harness/conversation-panel/composer/mention/mention-resolvers.ts +6 -0
- package/src/components/harness/conversation-panel/composer/mention/mention-suggestion-menu.tsx +212 -107
- package/src/components/harness/conversation-panel/composer/mention/mention-trigger-source.ts +71 -8
- package/src/components/harness/conversation-panel/composer/mention/story-mention.ts +131 -0
- package/src/components/harness/conversation-panel/composer/mention/thread-mention.ts +159 -0
- package/src/components/harness/conversation-panel/composer/mention/use-mention-sources.ts +9 -1
- package/src/components/harness/conversation-panel/composer/model-selector/__tests__/model-selector.test.tsx +401 -0
- package/src/components/harness/conversation-panel/composer/model-selector/__tests__/wiring.test.ts +117 -0
- package/src/components/harness/conversation-panel/composer/model-selector/model-selector-panel.tsx +411 -0
- package/src/components/harness/conversation-panel/composer/model-selector/model-selector-trigger.tsx +254 -0
- package/src/components/harness/conversation-panel/composer/model-selector/wiring.ts +112 -0
- package/src/components/harness/conversation-panel/composer/permission/__tests__/permission-select.test.tsx +264 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-policy.ts +76 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-popup.tsx +302 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-select-button.tsx +140 -0
- package/src/components/harness/conversation-panel/composer/workspace/__tests__/workspace-select.test.tsx +390 -0
- package/src/components/harness/conversation-panel/composer/workspace/workspace-select-button.tsx +367 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/__tests__/use-harness-chat-adapter.test.ts +20 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/__tests__/use-harness-session-putmedia.test.tsx +17 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/use-agent-terminals.ts +116 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +43 -11
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +25 -4
- package/src/components/harness/conversation-panel/messages/tools/__tests__/tool-run.test.ts +26 -1
- package/src/components/harness/conversation-panel/messages/tools/tool-run.ts +11 -0
- package/src/components/harness/extension-panel/dock/__tests__/dock-persist.test.ts +2 -1
- package/src/components/harness/extension-panel/dock/__tests__/guide-page.test.tsx +44 -3
- package/src/components/harness/extension-panel/dock/__tests__/tab-strip.test.tsx +45 -0
- package/src/components/harness/extension-panel/dock/dock-persist.ts +6 -4
- package/src/components/harness/extension-panel/dock/dock-registry.ts +69 -14
- package/src/components/harness/extension-panel/dock/dock-surface.tsx +35 -0
- package/src/components/harness/extension-panel/dock/guide-page.tsx +78 -45
- package/src/components/harness/extension-panel/dock/tab-strip.tsx +9 -1
- package/src/components/harness/extension-panel/panels/plugin/__tests__/install-dialog.test.tsx +260 -0
- package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-page.test.tsx +912 -0
- package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-row.test.tsx +215 -0
- package/src/components/harness/extension-panel/panels/plugin/builtin-section.tsx +204 -0
- package/src/components/harness/extension-panel/panels/plugin/install-dialog.tsx +195 -0
- package/src/components/harness/extension-panel/panels/plugin/installed-section.tsx +378 -0
- package/src/components/harness/extension-panel/panels/plugin/kind.tsx +17 -4
- package/src/components/harness/extension-panel/panels/plugin/pending-builds-block.tsx +49 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-page.tsx +257 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-row.tsx +206 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-types.ts +13 -0
- package/src/components/harness/extension-panel/panels/plugin/worker-section.tsx +322 -0
- package/src/components/harness/extension-panel/panels/terminal/__tests__/kind.test.tsx +219 -2
- package/src/components/harness/extension-panel/panels/terminal/__tests__/terminal-instance.test.tsx +322 -19
- package/src/components/harness/extension-panel/panels/terminal/__tests__/use-agent-terminal-roster.test.tsx +393 -0
- package/src/components/harness/extension-panel/panels/terminal/__tests__/ws-transport.test.ts +25 -0
- package/src/components/harness/extension-panel/panels/terminal/kind.tsx +55 -1
- package/src/components/harness/extension-panel/panels/terminal/shell-pref.ts +7 -4
- package/src/components/harness/extension-panel/panels/terminal/sse-transport.ts +26 -6
- package/src/components/harness/extension-panel/panels/terminal/tab-control-state.tsx +114 -0
- package/src/components/harness/extension-panel/panels/terminal/terminal-instance.tsx +190 -96
- package/src/components/harness/extension-panel/panels/terminal/terminal-theme.ts +113 -0
- package/src/components/harness/extension-panel/panels/terminal/transport.ts +28 -6
- package/src/components/harness/extension-panel/panels/terminal/use-agent-terminal-roster.ts +107 -0
- package/src/components/harness/extension-panel/panels/terminal/ws-transport.ts +7 -5
- package/src/components/harness/extension-panel/panels/terminal/xterm-terminal.tsx +5 -67
- package/src/components/harness/workbench/__tests__/provider-model-groups.test.ts +301 -0
- package/src/components/harness/workbench/harness-workbench-page.tsx +164 -2
- package/src/components/harness/workbench/provider-model-groups.ts +140 -0
- package/src/components/harness/workbench/undo-last-turn.ts +79 -0
- package/src/components/harness/workbench/workbench-context.tsx +53 -3
- package/src/components/tiptap/hooks/__tests__/use-floating-element.test.tsx +131 -0
- package/src/components/tiptap/hooks/use-floating-element.ts +15 -2
- package/src/components/tiptap/hooks/use-menu-navigation.ts +5 -0
- package/src/components/tiptap/node/mention-extension.ts +33 -0
- package/src/components/tiptap/ui/suggestion-menu/__tests__/suggestion-menu.test.tsx +366 -0
- package/src/components/tiptap/ui/suggestion-menu/suggestion-menu-types.ts +54 -0
- package/src/components/tiptap/ui/suggestion-menu/suggestion-menu.tsx +176 -45
- package/src/lib/changelog/sdk-versions.ts +2 -2
- package/src/lib/queries/__tests__/harness-plugin-queries.test.ts +49 -0
- package/src/lib/queries/harness-terminal.ts +77 -0
- package/src/lib/queries/harness.ts +50 -0
- package/src/paraglide/messages/_index.js +1622 -311
- package/src/paraglide/messages/en.js +528 -103
- package/src/paraglide/messages/zh.js +529 -104
- package/src/routes/_nav/harness/route.lazy.tsx +13 -0
- package/src/routes/api/harness/$.ts +19 -2
- package/src/routes/api/harness/terminal/$.ts +37 -6
- package/src/routes/api/harness/terminal/__tests__/route.test.ts +120 -0
- package/src/server/ai-gateway/sandbox/policy.ts +6 -6
- package/src/server/harness/__tests__/agent-terminal.server.test.ts +448 -0
- package/src/server/harness/__tests__/builtin-tools-invariant.test.ts +22 -12
- package/src/server/harness/__tests__/compact-plugin.server.test.ts +46 -0
- package/src/server/harness/__tests__/define-expose.test.ts +17 -0
- package/src/server/harness/__tests__/first-contact-fakes.test.ts +103 -3
- package/src/server/harness/__tests__/terminal-manager.server.test.ts +761 -2
- package/src/server/harness/__tests__/thread-reference.server.test.ts +258 -0
- package/src/server/harness/agent-terminal.server.ts +631 -0
- package/src/server/harness/define.server.ts +21 -3
- package/src/server/harness/first-contact-fakes.ts +115 -4
- package/src/server/harness/host.server.ts +28 -1
- package/src/server/harness/persistence/__tests__/session-index-store.server.test.ts +83 -0
- package/src/server/harness/persistence/prisma-persistence.server.ts +12 -3
- package/src/server/harness/persistence/session-index-store.server.ts +26 -0
- package/src/server/harness/plugins/__tests__/assemble-disable.test.ts +25 -17
- package/src/server/harness/plugins/__tests__/tool-risk-audit.test.ts +16 -6
- package/src/server/harness/plugins/assemble-app.ts +12 -0
- package/src/server/harness/plugins/base-patch.ts +9 -2
- package/src/server/harness/plugins/builtin/__tests__/agent-terminal.plugin.test.ts +702 -0
- package/src/server/harness/plugins/builtin/agent-terminal.plugin.ts +518 -0
- package/src/server/harness/terminal-frame-builder.server.ts +5 -3
- package/src/server/harness/terminal-manager.server.ts +772 -35
- package/src/server/harness/terminal-ws-handler.server.ts +8 -2
- package/src/server/harness/thread-reference.server.ts +446 -0
- package/src/server/harness/tool-risk.ts +20 -4
- package/src/server/serverFns/chat/__tests__/conversations-sandbox-default.test.ts +23 -0
- package/src/server/serverFns/chat/conversations.ts +18 -3
- package/src/server/serverFns/harness/search-mention-candidates.ts +14 -1
- package/src/shared/harness/__tests__/thread-reference-format.test.ts +128 -0
- package/src/shared/harness/thread-reference-format.ts +98 -0
- package/LICENSE +0 -661
- package/src/components/agents/slash-skill-menu.tsx +0 -75
- package/src/components/harness/conversation-panel/composer/extension/__tests__/demo-story-reference.test.tsx +0 -177
- package/src/components/harness/conversation-panel/composer/extension/demo-story-reference.tsx +0 -227
- package/src/components/harness/conversation-panel/composer/plugin-mention-menu.tsx +0 -109
- package/src/components/harness/extension-panel/panels/plugin-panel.tsx +0 -1021
- package/src/components/harness/extension-panel/panels/terminal/__tests__/xterm-webgl.test.ts +0 -68
package/src/components/harness/conversation-panel/composer/mention/__tests__/thread-mention.test.tsx
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
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
|
+
* @thread 会话提及源测试(P1 任务 4):
|
|
20
|
+
* - 纯逻辑 describe:threadMentionCandidates 候选形状(id 'thread:'+id / kind 'thread' /
|
|
21
|
+
* data{threadId,title})、排除当前线程、排除 archived、fuzzy 过滤、候选上限 20、
|
|
22
|
+
* 抛错 fail-closed、legacy gating(gate 关恒空且不发请求);
|
|
23
|
+
* - 集成 describe:真实 TipTap 渲染 composer,断言 thread 组出现(file→thread→kb/design
|
|
24
|
+
* 组序)、排除当前线程 / archived、空态(rawThreadId=null)thread 组仍出现、
|
|
25
|
+
* legacy gating 无 thread 组、选中插 chip(attrs id=threadId / docType 'thread' /
|
|
26
|
+
* threadId attr + 尾随空格 + renderText canonical 标记 @[标题](allblue-thread:id))。
|
|
27
|
+
*
|
|
28
|
+
* mock 组合照 file-mention.test.tsx(hoisted gateState + serverFn 整模块 mock +
|
|
29
|
+
* 全新 QueryClient);i18n 断言一律对 m.* 解析值(locale 无关)。
|
|
30
|
+
*/
|
|
31
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
|
|
32
|
+
import { cleanup, fireEvent, render, waitFor } from "@testing-library/react"
|
|
33
|
+
import type { Editor } from "@tiptap/core"
|
|
34
|
+
import type { JSONContent } from "@tiptap/core"
|
|
35
|
+
|
|
36
|
+
import { HarnessComposer } from "../../harness-composer"
|
|
37
|
+
import { ComposerEditor } from "../../composer-editor"
|
|
38
|
+
import { clearComposerExtensions } from "../../extension"
|
|
39
|
+
import type { InputTriggerSource, TriggerCandidate } from "../../extension"
|
|
40
|
+
import { formatThreadReference } from "@/shared/harness/thread-reference-format"
|
|
41
|
+
import { threadMentionCandidates } from "../thread-mention"
|
|
42
|
+
import { createBuiltinMentionSource } from "../mention-trigger-source"
|
|
43
|
+
import { getQueryClient, setQueryClient } from "@/lib/query-client-seam"
|
|
44
|
+
import { QueryClient } from "@tanstack/react-query"
|
|
45
|
+
import { m } from "@/paraglide/messages.js"
|
|
46
|
+
import type { WorkspaceSessionProjection } from "@/server/serverFns/harness/workspace-threads"
|
|
47
|
+
|
|
48
|
+
// ── hoisted 可变 mock 状态(gate 开关)──
|
|
49
|
+
const gateState = vi.hoisted(() => ({ enabled: true }))
|
|
50
|
+
|
|
51
|
+
vi.mock("@/lib/harness-gate", () => ({
|
|
52
|
+
isHarnessClientEnabled: () => gateState.enabled,
|
|
53
|
+
}))
|
|
54
|
+
vi.mock("@/server/serverFns/harness/workspace-threads", () => ({
|
|
55
|
+
listHarnessWorkspacesWithThreadsFn: vi.fn(),
|
|
56
|
+
setThreadPinnedFn: vi.fn(),
|
|
57
|
+
getWorkspaceRootStatusFn: vi.fn(),
|
|
58
|
+
}))
|
|
59
|
+
vi.mock("@/server/serverFns/harness/thread-workspace-search", () => ({
|
|
60
|
+
searchThreadWorkspaceFilesFn: vi.fn(),
|
|
61
|
+
}))
|
|
62
|
+
vi.mock("@/server/serverFns/harness/thread-workspace-files", () => ({
|
|
63
|
+
listThreadWorkspaceDirFn: vi.fn(),
|
|
64
|
+
}))
|
|
65
|
+
vi.mock("@/server/serverFns/harness/media", () => ({ generatePrototypeFn: vi.fn(() => Promise.resolve({})) }))
|
|
66
|
+
vi.mock("../../voice-input-button", () => ({ VoiceInputButton: () => null }))
|
|
67
|
+
vi.mock("@/components/billing/use-feature", () => ({ useFeature: () => ({ enabled: true, loading: false }) }))
|
|
68
|
+
vi.mock("../use-mention-sources", () => ({
|
|
69
|
+
useMentionSources: () => ({
|
|
70
|
+
all: [
|
|
71
|
+
{ kind: "kb-doc", id: "doc-1", label: "KB doc alpha", kbId: "kb-1", kbName: "测试知识库" },
|
|
72
|
+
],
|
|
73
|
+
isLoading: false,
|
|
74
|
+
}),
|
|
75
|
+
}))
|
|
76
|
+
|
|
77
|
+
import { listHarnessWorkspacesWithThreadsFn as listWsFn } from "@/server/serverFns/harness/workspace-threads"
|
|
78
|
+
import { listThreadWorkspaceDirFn as listDirFn } from "@/server/serverFns/harness/thread-workspace-files"
|
|
79
|
+
|
|
80
|
+
const listWsMock = vi.mocked(listWsFn)
|
|
81
|
+
const listDirMock = vi.mocked(listDirFn)
|
|
82
|
+
|
|
83
|
+
/** 会话投影夹具(服务端 updatedAt desc 序:t-1 → t-4)。 */
|
|
84
|
+
const makeSession = (over: Partial<WorkspaceSessionProjection> & { id: string }): WorkspaceSessionProjection => ({
|
|
85
|
+
title: `会话 ${over.id}`,
|
|
86
|
+
workspaceId: null,
|
|
87
|
+
engine: "local",
|
|
88
|
+
isArchived: false,
|
|
89
|
+
pinned: false,
|
|
90
|
+
lastMessageAt: "2026-11-20T00:00:00.000Z",
|
|
91
|
+
messageCount: 1,
|
|
92
|
+
statusPoint: "completed",
|
|
93
|
+
...over,
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const SESSIONS: WorkspaceSessionProjection[] = [
|
|
97
|
+
makeSession({ id: "t-1", title: "调试登录态" }),
|
|
98
|
+
makeSession({ id: "t-2", title: "重构 prompt 输入" }),
|
|
99
|
+
makeSession({ id: "t-3", title: null }),
|
|
100
|
+
makeSession({ id: "t-4", title: "归档会话", isArchived: true }),
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
const EMPTY_DIR = { entries: [], truncated: false }
|
|
104
|
+
|
|
105
|
+
beforeEach(() => {
|
|
106
|
+
sessionStorage.clear()
|
|
107
|
+
gateState.enabled = true
|
|
108
|
+
listWsMock.mockReset()
|
|
109
|
+
listWsMock.mockResolvedValue({ workspaces: [], sessions: SESSIONS })
|
|
110
|
+
listDirMock.mockReset()
|
|
111
|
+
listDirMock.mockResolvedValue(EMPTY_DIR)
|
|
112
|
+
// 全新 QueryClient:避免跨测试 harness-workspaces / 目录 listing 缓存串染
|
|
113
|
+
setQueryClient(new QueryClient())
|
|
114
|
+
})
|
|
115
|
+
afterEach(() => {
|
|
116
|
+
cleanup()
|
|
117
|
+
clearComposerExtensions()
|
|
118
|
+
getQueryClient().clear()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
function getEditorDom(): HTMLElement {
|
|
122
|
+
const el = document.querySelector<HTMLElement>(".tiptap.ProseMirror")
|
|
123
|
+
if (!el) throw new Error("TipTap 编辑器 DOM 未挂载")
|
|
124
|
+
return el
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getMenuView(): HTMLElement {
|
|
128
|
+
const el = document.querySelector<HTMLElement>(
|
|
129
|
+
'[data-selector="tiptap-mention-suggestion-menu"] [data-menu-view]',
|
|
130
|
+
)
|
|
131
|
+
if (!el) throw new Error("@ 菜单 MenuView 未挂载")
|
|
132
|
+
return el
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function findMentionNodes(doc: JSONContent): JSONContent[] {
|
|
136
|
+
const found: JSONContent[] = []
|
|
137
|
+
const walk = (nodes: JSONContent[] | undefined) => {
|
|
138
|
+
for (const node of nodes ?? []) {
|
|
139
|
+
if (node.type === "mention") found.push(node)
|
|
140
|
+
if (Array.isArray(node.content)) walk(node.content)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
walk(doc.content)
|
|
144
|
+
return found
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
148
|
+
// 纯逻辑:threadMentionCandidates(候选映射 + 过滤 + gating)
|
|
149
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
150
|
+
describe("threadMentionCandidates(纯查询→候选映射)", () => {
|
|
151
|
+
it("候选形状:kind 'thread'、id 'thread:'+id、group 会话组、data{threadId,title};title null → untitled 兜底", async () => {
|
|
152
|
+
const res = await threadMentionCandidates({ rawThreadId: null, query: "", getSessions: () => SESSIONS })
|
|
153
|
+
expect(res.map((c) => c.id)).toEqual(["thread:t-1", "thread:t-2", "thread:t-3"])
|
|
154
|
+
expect(res[0]).toMatchObject({
|
|
155
|
+
id: "thread:t-1",
|
|
156
|
+
label: "调试登录态",
|
|
157
|
+
kind: "thread",
|
|
158
|
+
group: m.harness_mention_threadGroup(),
|
|
159
|
+
// 副文本 = 最近消息相对时间(用户裁决 2026-11-20:原为组名「会话」复读)——
|
|
160
|
+
// 值随运行时刻变化(formatDistanceToNowStrict),只锁字符串形状
|
|
161
|
+
subtext: expect.any(String),
|
|
162
|
+
data: { threadId: "t-1", title: "调试登录态" },
|
|
163
|
+
})
|
|
164
|
+
expect(res[2].label).toBe(m.harness_mention_threadUntitled())
|
|
165
|
+
expect(res[2].data?.title).toBe(m.harness_mention_threadUntitled())
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
it("排除当前线程(rawThreadId 匹配项不出现;rawThreadId null 时不排除)", async () => {
|
|
169
|
+
const withSelf = await threadMentionCandidates({ rawThreadId: "t-1", query: "", getSessions: () => SESSIONS })
|
|
170
|
+
expect(withSelf.map((c) => c.data?.threadId)).toEqual(["t-2", "t-3"])
|
|
171
|
+
const emptyState = await threadMentionCandidates({ rawThreadId: null, query: "", getSessions: () => SESSIONS })
|
|
172
|
+
expect(emptyState.map((c) => c.data?.threadId)).toEqual(["t-1", "t-2", "t-3"])
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
it("排除 archived(isArchived 项不出候选)", async () => {
|
|
176
|
+
const res = await threadMentionCandidates({ rawThreadId: null, query: "", getSessions: () => SESSIONS })
|
|
177
|
+
expect(res.map((c) => c.data?.threadId)).not.toContain("t-4")
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
it("fuzzy 过滤:includes 命中 + 子序列命中 + 无命中恒空;空 query 全量", async () => {
|
|
181
|
+
const byIncludes = await threadMentionCandidates({ rawThreadId: null, query: "登录", getSessions: () => SESSIONS })
|
|
182
|
+
expect(byIncludes.map((c) => c.data?.threadId)).toEqual(["t-1"])
|
|
183
|
+
// 子序列:'构pr' 命中「重构 prompt 输入」(构→p→r 按序)
|
|
184
|
+
const byFuzzy = await threadMentionCandidates({ rawThreadId: null, query: "构pr", getSessions: () => SESSIONS })
|
|
185
|
+
expect(byFuzzy.map((c) => c.data?.threadId)).toEqual(["t-2"])
|
|
186
|
+
const none = await threadMentionCandidates({ rawThreadId: null, query: "zzz", getSessions: () => SESSIONS })
|
|
187
|
+
expect(none).toEqual([])
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
it("候选上限 20(25 条会话 → 前 20 条,服务端序保留)", async () => {
|
|
191
|
+
const many = Array.from({ length: 25 }, (_, i) => makeSession({ id: `s-${i}` }))
|
|
192
|
+
const res = await threadMentionCandidates({ rawThreadId: null, query: "", getSessions: () => many })
|
|
193
|
+
expect(res).toHaveLength(20)
|
|
194
|
+
expect(res[0].data?.threadId).toBe("s-0")
|
|
195
|
+
expect(res[19].data?.threadId).toBe("s-19")
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it("getSessions 抛错 → fail-closed 空数组(不 rethrow)", async () => {
|
|
199
|
+
const res = await threadMentionCandidates({
|
|
200
|
+
rawThreadId: null,
|
|
201
|
+
query: "",
|
|
202
|
+
getSessions: () => Promise.reject(new Error("boom")),
|
|
203
|
+
})
|
|
204
|
+
expect(res).toEqual([])
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
it("legacy gating:gate false → 恒空且 getter 不调用(不发请求)", async () => {
|
|
208
|
+
gateState.enabled = false
|
|
209
|
+
const getSessions = vi.fn(() => SESSIONS)
|
|
210
|
+
const res = await threadMentionCandidates({ rawThreadId: null, query: "", getSessions })
|
|
211
|
+
expect(res).toEqual([])
|
|
212
|
+
expect(getSessions).not.toHaveBeenCalled()
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
217
|
+
// 防御面:内置源 thread 放行(mention 数据面无 thread 生产者;若未来产出则透传)
|
|
218
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
219
|
+
describe("createBuiltinMentionSource thread 放行(防御面)", () => {
|
|
220
|
+
/** 内置源 candidates 实际同步返回(接口面为 union),测试内收窄 */
|
|
221
|
+
function syncCandidates(source: InputTriggerSource, query: string): TriggerCandidate[] {
|
|
222
|
+
return source.candidates(query) as TriggerCandidate[]
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
it("thread MentionCandidate 透传:group 会话组 + data.threadId;onPick 插 chip attrs.id=threadId", () => {
|
|
226
|
+
const source = createBuiltinMentionSource(() => [
|
|
227
|
+
{ kind: "thread", id: "th-9", label: "防御面会话" },
|
|
228
|
+
])
|
|
229
|
+
const candidates = syncCandidates(source, "")
|
|
230
|
+
expect(candidates).toHaveLength(1)
|
|
231
|
+
expect(candidates[0]).toMatchObject({
|
|
232
|
+
id: "th-9",
|
|
233
|
+
label: "防御面会话",
|
|
234
|
+
kind: "thread",
|
|
235
|
+
group: m.harness_mention_threadGroup(),
|
|
236
|
+
data: { threadId: "th-9" },
|
|
237
|
+
})
|
|
238
|
+
// onPick → insertMentionCandidateChip:attrs.id=threadId 本身 + threadId attr
|
|
239
|
+
const insertContentAt = vi.fn()
|
|
240
|
+
const chain: Record<string, unknown> = {}
|
|
241
|
+
chain.focus = vi.fn(() => chain)
|
|
242
|
+
chain.insertContentAt = vi.fn((...args: unknown[]) => {
|
|
243
|
+
insertContentAt(...args)
|
|
244
|
+
return chain
|
|
245
|
+
})
|
|
246
|
+
chain.run = vi.fn(() => undefined)
|
|
247
|
+
const editor = { chain: vi.fn(() => chain) } as unknown as Editor
|
|
248
|
+
source.onPick(candidates[0], { editor, range: { from: 1, to: 2 } })
|
|
249
|
+
const [, content] = insertContentAt.mock.calls[0] as [unknown, Array<Record<string, unknown>>]
|
|
250
|
+
expect(content[0]).toEqual({
|
|
251
|
+
type: "mention",
|
|
252
|
+
attrs: { id: "th-9", label: "防御面会话", docType: "thread", docGroup: "", threadId: "th-9" },
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
258
|
+
// 集成:真实 TipTap 渲染 composer
|
|
259
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
260
|
+
describe("@thread 会话提及源(集成)", () => {
|
|
261
|
+
it("thread 组出现:排除当前线程与 archived,组序 file→thread→kb/design", async () => {
|
|
262
|
+
listDirMock.mockResolvedValue({
|
|
263
|
+
entries: [
|
|
264
|
+
{ name: "src", kind: "dir" as const },
|
|
265
|
+
{ name: "README.md", kind: "file" as const },
|
|
266
|
+
],
|
|
267
|
+
truncated: false,
|
|
268
|
+
})
|
|
269
|
+
const holder: { current: Editor | null } = { current: null }
|
|
270
|
+
render(
|
|
271
|
+
<ComposerEditor
|
|
272
|
+
threadId="t-1"
|
|
273
|
+
rawThreadId="t-1"
|
|
274
|
+
editable
|
|
275
|
+
onTextChange={() => {}}
|
|
276
|
+
editorRef={(e) => {
|
|
277
|
+
holder.current = e
|
|
278
|
+
}}
|
|
279
|
+
/>,
|
|
280
|
+
)
|
|
281
|
+
await waitFor(() => expect(holder.current).not.toBeNull(), { timeout: 3000 })
|
|
282
|
+
holder.current!.commands.insertContent("@")
|
|
283
|
+
const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
|
|
284
|
+
// thread 候选出现(排除当前线程 t-1 与 archived t-4)
|
|
285
|
+
await waitFor(() => expect(menu.textContent).toContain("重构 prompt 输入"), { timeout: 3000 })
|
|
286
|
+
expect(menu.textContent).toContain(m.harness_mention_threadUntitled())
|
|
287
|
+
expect(menu.textContent).toContain("KB doc alpha")
|
|
288
|
+
expect(menu.textContent).not.toContain("调试登录态")
|
|
289
|
+
expect(menu.textContent).not.toContain("归档会话")
|
|
290
|
+
// 组序:file → thread → kb
|
|
291
|
+
const text = menu.textContent ?? ""
|
|
292
|
+
expect(text.indexOf(m.harness_mention_fileGroup())).toBeLessThan(text.indexOf(m.harness_mention_threadGroup()))
|
|
293
|
+
expect(text.indexOf(m.harness_mention_threadGroup())).toBeLessThan(text.indexOf("测试知识库"))
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
it("选中插 chip:attrs id=threadId / docType 'thread' / threadId attr + 尾随空格 + renderText canonical 标记", async () => {
|
|
297
|
+
const holder: { current: Editor | null } = { current: null }
|
|
298
|
+
render(
|
|
299
|
+
<ComposerEditor
|
|
300
|
+
threadId="t-1"
|
|
301
|
+
rawThreadId="t-1"
|
|
302
|
+
editable
|
|
303
|
+
onTextChange={() => {}}
|
|
304
|
+
editorRef={(e) => {
|
|
305
|
+
holder.current = e
|
|
306
|
+
}}
|
|
307
|
+
/>,
|
|
308
|
+
)
|
|
309
|
+
await waitFor(() => expect(holder.current).not.toBeNull(), { timeout: 3000 })
|
|
310
|
+
const editor = holder.current!
|
|
311
|
+
editor.commands.insertContent("@")
|
|
312
|
+
const textbox = getEditorDom()
|
|
313
|
+
const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
|
|
314
|
+
// 空目录(file 源无候选)→ 首项 = thread 候选(重构 prompt 输入)
|
|
315
|
+
await waitFor(() => expect(menu.textContent).toContain("重构 prompt 输入"), { timeout: 3000 })
|
|
316
|
+
fireEvent.keyDown(textbox, { key: "Enter" })
|
|
317
|
+
// chip 插入 + 尾随空格(DOM 可见 @label)
|
|
318
|
+
await waitFor(() => expect(textbox.textContent).toContain("@重构 prompt 输入"), { timeout: 3000 })
|
|
319
|
+
const mentions = findMentionNodes(editor.getJSON())
|
|
320
|
+
expect(mentions).toHaveLength(1)
|
|
321
|
+
expect(mentions[0].attrs).toMatchObject({
|
|
322
|
+
id: "t-2",
|
|
323
|
+
label: "重构 prompt 输入",
|
|
324
|
+
docType: "thread",
|
|
325
|
+
threadId: "t-2",
|
|
326
|
+
})
|
|
327
|
+
// renderText canonical 标记(getText 经 renderText 序列化)+ 尾随空格
|
|
328
|
+
expect(editor.getText()).toBe(
|
|
329
|
+
`${formatThreadReference({ id: "t-2", label: "重构 prompt 输入" })} `,
|
|
330
|
+
)
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
it("空态 rawThreadId=null:thread 组仍出现(空态新对话可引用历史会话)", async () => {
|
|
334
|
+
const { unmount } = render(
|
|
335
|
+
<HarnessComposer
|
|
336
|
+
threadId={null}
|
|
337
|
+
isRunning={false}
|
|
338
|
+
hasAiKey
|
|
339
|
+
busyPreference="queue"
|
|
340
|
+
onSend={vi.fn()}
|
|
341
|
+
onStop={vi.fn()}
|
|
342
|
+
conversationRegionRef={{ current: null }}
|
|
343
|
+
messages={[]}
|
|
344
|
+
handoffPrefillText="@"
|
|
345
|
+
/>,
|
|
346
|
+
)
|
|
347
|
+
const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
|
|
348
|
+
await waitFor(() => expect(menu.textContent).toContain("调试登录态"), { timeout: 3000 })
|
|
349
|
+
// 空态文件源 gating:无 file 组(rawThreadId null 恒空);thread 组不受影响
|
|
350
|
+
expect(menu.textContent).not.toContain(m.harness_mention_fileGroup())
|
|
351
|
+
// 排除逻辑自然无操作:全部非归档会话在列
|
|
352
|
+
expect(menu.textContent).toContain(m.harness_mention_threadUntitled())
|
|
353
|
+
unmount()
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
it("legacy gating:gate false → 无「会话」组(不发 harness-workspaces 请求)", async () => {
|
|
357
|
+
gateState.enabled = false
|
|
358
|
+
render(
|
|
359
|
+
<HarnessComposer
|
|
360
|
+
threadId="t-1"
|
|
361
|
+
isRunning={false}
|
|
362
|
+
hasAiKey
|
|
363
|
+
busyPreference="queue"
|
|
364
|
+
onSend={vi.fn()}
|
|
365
|
+
onStop={vi.fn()}
|
|
366
|
+
conversationRegionRef={{ current: null }}
|
|
367
|
+
messages={[]}
|
|
368
|
+
handoffPrefillText="@"
|
|
369
|
+
/>,
|
|
370
|
+
)
|
|
371
|
+
const menu = await waitFor(() => getMenuView(), { timeout: 3000 })
|
|
372
|
+
await waitFor(() => expect(menu.textContent).toContain("KB doc alpha"), { timeout: 3000 })
|
|
373
|
+
expect(menu.textContent).not.toContain(m.harness_mention_threadGroup())
|
|
374
|
+
expect(menu.textContent).not.toContain("调试登录态")
|
|
375
|
+
expect(listWsMock).not.toHaveBeenCalled()
|
|
376
|
+
})
|
|
377
|
+
})
|
|
@@ -0,0 +1,162 @@
|
|
|
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,@file):纯查询→候选映射,单一职责。
|
|
20
|
+
*
|
|
21
|
+
* 三模式(按 query 形态派发):
|
|
22
|
+
* - **裸查询**(不含 `/` 且非空)→ 直调 `searchThreadWorkspaceFilesFn`(rg 文件名搜索,
|
|
23
|
+
* staleTime 0 无缓存价值;逐调用 `signal` 传导到 fetch 取消,省流量);
|
|
24
|
+
* - **空查询 / 纯 `/`** → `fetchDir(threadId)` 列 root(目录在前);
|
|
25
|
+
* - **含 `/`**(目录下钻)→ `fetchDir(threadId, dirname)`,basename 空串全放行(下钻产物
|
|
26
|
+
* `src/` 必须出内容),非空按前缀过滤;路径段去重连续 `/`(`a//b` → `a/b`)。
|
|
27
|
+
*
|
|
28
|
+
* dirname 边界表:
|
|
29
|
+
* | query | dirPath | basename | 行为 |
|
|
30
|
+
* |------------|------------|----------|-------------------------------|
|
|
31
|
+
* | "" | undefined | "" | root 首屏 |
|
|
32
|
+
* | "/" | undefined | "" | 归 root 模式 |
|
|
33
|
+
* | "src/" | "src" | "" | 列 src 全部(下钻空 basename) |
|
|
34
|
+
* | "src/ab" | "src" | "ab" | 列 src + 前缀过滤 ab |
|
|
35
|
+
* | "a//b" | "a" | "b" | 规范化连续 / 后下钻 |
|
|
36
|
+
*
|
|
37
|
+
* gating:`rawThreadId == null || !isHarnessClientEnabled()` → 恒空(不发任何请求);
|
|
38
|
+
* serverFn 抛错 catch 返回空(**不 rethrow**——插件对 items 抛错会派发空 items 清旧行,
|
|
39
|
+
* catch 返回与之一致)。
|
|
40
|
+
*
|
|
41
|
+
* 竞态兜底:插件 async manager 对晚归 resolve 一律丢弃——signal 只是省流量,正确性不依赖它。
|
|
42
|
+
*
|
|
43
|
+
* fetchDir 注入(便于测试):生产实现由 mention-suggestion-menu 提供(getQueryClient 包装
|
|
44
|
+
* listThreadWorkspaceDirFn,复用 files panel 缓存、无 signal);测试可替换为桩。
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
import { searchThreadWorkspaceFilesFn } from "@/server/serverFns/harness/thread-workspace-search"
|
|
48
|
+
import { isHarnessClientEnabled } from "@/lib/harness-gate"
|
|
49
|
+
import type { TriggerCandidate } from "../extension"
|
|
50
|
+
import { m } from "@/paraglide/messages.js"
|
|
51
|
+
|
|
52
|
+
/** fileMentionCandidates 入参(fetchDir 注入,生产/测试各一实现)。 */
|
|
53
|
+
export interface FileMentionCandidateInput {
|
|
54
|
+
/** 未兜底的 threadId(null = 空态,直接 gating 恒空) */
|
|
55
|
+
rawThreadId: string | null | undefined
|
|
56
|
+
/** 触发词后查询串(含可能的 `/` 下钻路径) */
|
|
57
|
+
query: string
|
|
58
|
+
/** 取消信号(仅裸查询 search 透传;目录列表复用缓存、无 signal) */
|
|
59
|
+
signal?: AbortSignal
|
|
60
|
+
/**
|
|
61
|
+
* 目录列表注入(生产:getQueryClient().fetchQuery 包装;测试:可替换)——复用 files
|
|
62
|
+
* panel 缓存,无 signal。返回 entries(name + isDir)+ truncated。
|
|
63
|
+
*/
|
|
64
|
+
fetchDir: (
|
|
65
|
+
threadId: string,
|
|
66
|
+
dirPath?: string,
|
|
67
|
+
) => Promise<{ entries: Array<{ name: string; isDir: boolean }>; truncated: boolean }>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** fileMentionCandidates 结果(items 全为 kind:'file' 候选 + truncated 透传)。 */
|
|
71
|
+
export interface FileMentionResult {
|
|
72
|
+
items: TriggerCandidate[]
|
|
73
|
+
truncated: boolean
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** 恒空结果(gating / abort / 抛错兜底共用,避免每次新建)。 */
|
|
77
|
+
const EMPTY_RESULT: FileMentionResult = { items: [], truncated: false }
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 路径 → file 候选。label = 完整 path(与 data.path 一致——chip 的 renderHTML DOM 可见
|
|
81
|
+
* 文本 `@label` 与 renderText 模型可见文本 `@path` 不分叉,见 mention-trigger-source 衔接点)。
|
|
82
|
+
*/
|
|
83
|
+
function toFileCandidate(path: string, isDir: boolean): TriggerCandidate {
|
|
84
|
+
return {
|
|
85
|
+
id: `file:${path}`,
|
|
86
|
+
label: path,
|
|
87
|
+
kind: "file",
|
|
88
|
+
group: m.harness_mention_fileGroup(),
|
|
89
|
+
// 副文本置空(用户裁决 2026-11-20:副文本要真实描述)——label 即完整路径,
|
|
90
|
+
// 自描述;组名「文件与文件夹」复读是零信息噪音。MenuView 副文本空值不渲染
|
|
91
|
+
// (单行布局零噪音)。
|
|
92
|
+
subtext: undefined,
|
|
93
|
+
data: { path, isDir },
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* query → { dirPath, basename }(下钻拆分)。空 / 无 `/` → dirPath undefined(root)。
|
|
99
|
+
* 连续 `/` 已在调用前规范化,此处不再处理。
|
|
100
|
+
*/
|
|
101
|
+
function splitQuery(normalized: string): { dirPath: string | undefined; basename: string } {
|
|
102
|
+
const slashIndex = normalized.lastIndexOf("/")
|
|
103
|
+
if (slashIndex === -1) return { dirPath: undefined, basename: normalized }
|
|
104
|
+
return {
|
|
105
|
+
dirPath: normalized.slice(0, slashIndex) || undefined,
|
|
106
|
+
basename: normalized.slice(slashIndex + 1),
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 工作区文件提及候选(三模式 + dirname 边界 + gating + 抛错兜底)。返回 items(kind:'file')
|
|
112
|
+
* + truncated(透传 MenuView footer)。
|
|
113
|
+
*/
|
|
114
|
+
export async function fileMentionCandidates(
|
|
115
|
+
input: FileMentionCandidateInput,
|
|
116
|
+
): Promise<FileMentionResult> {
|
|
117
|
+
const { rawThreadId, query, signal, fetchDir } = input
|
|
118
|
+
|
|
119
|
+
// gating:空态(rawThreadId null)或 legacy 链(gate 关)→ 恒空,不发任何请求
|
|
120
|
+
if (rawThreadId == null || !isHarnessClientEnabled()) return EMPTY_RESULT
|
|
121
|
+
const threadId = rawThreadId
|
|
122
|
+
|
|
123
|
+
// 规范化:连续 `/` 折叠为单个(a//b → a/b)
|
|
124
|
+
const normalized = query.replace(/\/{2,}/g, "/")
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
// 模式 1:裸查询(不含 `/` 且非空)→ rg 文件名搜索
|
|
128
|
+
if (!normalized.includes("/") && normalized.trim() !== "") {
|
|
129
|
+
if (signal?.aborted) return EMPTY_RESULT
|
|
130
|
+
const result = await searchThreadWorkspaceFilesFn({
|
|
131
|
+
data: {
|
|
132
|
+
threadId,
|
|
133
|
+
query: normalized.trim(),
|
|
134
|
+
rules: [],
|
|
135
|
+
showHidden: false,
|
|
136
|
+
respectGitignore: true,
|
|
137
|
+
},
|
|
138
|
+
signal,
|
|
139
|
+
})
|
|
140
|
+
if (signal?.aborted) return EMPTY_RESULT
|
|
141
|
+
const items = (result.matches ?? []).map((match) => toFileCandidate(match.path, false))
|
|
142
|
+
return { items, truncated: result.truncated }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 模式 2/3:空查询(root 首屏)或含 `/`(目录下钻)
|
|
146
|
+
const { dirPath, basename } = splitQuery(normalized)
|
|
147
|
+
const listing = await fetchDir(threadId, dirPath)
|
|
148
|
+
let entries = listing.entries
|
|
149
|
+
// basename 空串全放行(下钻产物 src/ 必须出内容);非空按前缀过滤(大小写不敏感)
|
|
150
|
+
if (basename !== "") {
|
|
151
|
+
const lowerBase = basename.toLowerCase()
|
|
152
|
+
entries = entries.filter((entry) => entry.name.toLowerCase().startsWith(lowerBase))
|
|
153
|
+
}
|
|
154
|
+
const items = entries.map((entry) =>
|
|
155
|
+
toFileCandidate(dirPath ? `${dirPath}/${entry.name}` : entry.name, entry.isDir),
|
|
156
|
+
)
|
|
157
|
+
return { items, truncated: listing.truncated }
|
|
158
|
+
} catch {
|
|
159
|
+
// 插件对 items 抛错会派发空 items 清旧行——catch 返回空与之一致,不 rethrow
|
|
160
|
+
return EMPTY_RESULT
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -7,6 +7,12 @@ export interface MentionCandidate {
|
|
|
7
7
|
kbId?: string
|
|
8
8
|
/** 所属知识库名(kb-doc 专用,mention 菜单分组展示用,S29) */
|
|
9
9
|
kbName?: string
|
|
10
|
+
/**
|
|
11
|
+
* 加入的工作空间名(用户裁决 2026-11-21:kb 副文本=知识库名+工作空间、design 副文本=
|
|
12
|
+
* 工作空间,未加入则不显示)。kb 来自 workspace_knowledge_bases M2M;design 数据模型
|
|
13
|
+
* 暂无工作空间关联(恒缺省=不显示),显示通路先立。
|
|
14
|
+
*/
|
|
15
|
+
workspaceNames?: string[]
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
const GROUP_ORDER: MentionKind[] = ["file", "kb-doc", "design", "story", "plugin-tool", "thread"]
|