@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/mention-suggestion-menu.tsx
CHANGED
|
@@ -15,20 +15,22 @@
|
|
|
15
15
|
// You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
import { BookOpen, FileText } from "lucide-react"
|
|
21
|
-
import { cn } from "@/components/tiptap/lib/utils"
|
|
22
|
-
import { getElementOverflowPosition } from "@/components/tiptap/lib/collab-utils"
|
|
18
|
+
import { useCallback, useEffect, useRef, useState } from "react"
|
|
19
|
+
import { BookOpen, FileText, Folder, MessagesSquare, Quote } from "lucide-react"
|
|
23
20
|
import { SuggestionMenu } from "@/components/tiptap/ui/suggestion-menu/index"
|
|
24
21
|
import { createFullWidthFindSuggestionMatch } from "@/components/tiptap/ui/suggestion-menu/suggestion-menu-fullwidth"
|
|
25
22
|
import type {
|
|
26
23
|
SuggestionItem,
|
|
27
24
|
SuggestionMenuRenderProps,
|
|
28
25
|
} from "@/components/tiptap/ui/suggestion-menu/index"
|
|
29
|
-
import {
|
|
26
|
+
import { MenuView } from "../command/menu-view"
|
|
27
|
+
import { getQueryClient } from "@/lib/query-client-seam"
|
|
28
|
+
import { threadWorkspaceDirQueryOptions } from "@/lib/queries/harness"
|
|
30
29
|
import { useMentionSources } from "./use-mention-sources"
|
|
31
|
-
import { createBuiltinMentionSource } from "./mention-trigger-source"
|
|
30
|
+
import { createBuiltinMentionSource, insertMentionCandidateChip } from "./mention-trigger-source"
|
|
31
|
+
import { fileMentionCandidates } from "./file-mention"
|
|
32
|
+
import { threadMentionCandidates } from "./thread-mention"
|
|
33
|
+
import { storyMentionCandidates } from "./story-mention"
|
|
32
34
|
import {
|
|
33
35
|
registerComposerExtension,
|
|
34
36
|
getComposerInputTriggers,
|
|
@@ -36,10 +38,22 @@ import {
|
|
|
36
38
|
import type { InputTriggerSource, TriggerCandidate } from "../extension"
|
|
37
39
|
import { m } from "@/paraglide/messages.js"
|
|
38
40
|
|
|
41
|
+
/**
|
|
42
|
+
* attachMode / anchorElement(DSH 对标,任务 A)经 Omit 保留 + 末尾 {...props}
|
|
43
|
+
* 整体透传给 SuggestionMenu(composer 传 attachMode="card-top" + anchorElement=
|
|
44
|
+
* InputGroup 根——菜单钉输入框卡片上沿弹出),无需在此单独声明。
|
|
45
|
+
*/
|
|
39
46
|
type MentionSuggestionMenuProps = Omit<
|
|
40
47
|
React.ComponentProps<typeof SuggestionMenu>,
|
|
41
48
|
"items" | "children" | "char" | "pluginKey" | "selector" | "findSuggestionMatch"
|
|
42
49
|
> & {
|
|
50
|
+
/**
|
|
51
|
+
* 未兜底的 threadId(null = 会话未建立空态):file 源 gating 用(rawThreadId null →
|
|
52
|
+
* 文件候选恒空)。区别于 ComposerEditor 的 threadId ?? "default" 兜底值——兜底值会让
|
|
53
|
+
* 空态误发工作区查询。经 props→ref 透传,getItems 查询期读取(items 闭包在插件创建时
|
|
54
|
+
* 固化,可变量一律走 ref)。
|
|
55
|
+
*/
|
|
56
|
+
rawThreadId?: string | null
|
|
43
57
|
/**
|
|
44
58
|
* 菜单开合回调:MentionList 挂载(开)/ 卸载(关)时触发。
|
|
45
59
|
* Esc Esc 停止序列以此屏蔽「关菜单的那次 Esc」(composer 上报 menuOpen)。
|
|
@@ -48,8 +62,30 @@ type MentionSuggestionMenuProps = Omit<
|
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
65
|
+
* 生产 fetchDir:getQueryClient 包装 threadWorkspaceDirQueryOptions(复用 files panel
|
|
66
|
+
* 目录缓存 staleTime 30s、无 signal)。映射 server 的 kind:"dir"|"file" → isDir boolean。
|
|
67
|
+
* 模块级稳定(getQueryClient/setQueryClient 单例),getItems 闭包固化也可安全引用。
|
|
68
|
+
*/
|
|
69
|
+
async function fetchDirFromQueryClient(
|
|
70
|
+
threadId: string,
|
|
71
|
+
dirPath?: string,
|
|
72
|
+
): Promise<{ entries: Array<{ name: string; isDir: boolean }>; truncated: boolean }> {
|
|
73
|
+
const result = await getQueryClient().fetchQuery(
|
|
74
|
+
threadWorkspaceDirQueryOptions(threadId, dirPath),
|
|
75
|
+
)
|
|
76
|
+
return {
|
|
77
|
+
entries: (result.entries ?? []).map((e) => ({ name: e.name, isDir: e.kind === "dir" })),
|
|
78
|
+
truncated: result.truncated ?? false,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @ 引用菜单(F5-3 源注册化 + 任务 5 @file 源 + P1 任务 4 @thread 源 + P1 任务 5
|
|
84
|
+
* @story 需求源):候选不再内联取自 useMentionSources,而是消费 registry 聚合的全部
|
|
85
|
+
* '@' 触发源(getComposerInputTriggers)+ 异步聚合 file / thread / story 三个硬编码
|
|
86
|
+
* 候选源(fileMentionCandidates 置顶、threadMentionCandidates 第二、
|
|
87
|
+
* storyMentionCandidates 第三,单 Promise.all 并行;组序 file → thread → story →
|
|
88
|
+
* kb/design)。
|
|
53
89
|
*
|
|
54
90
|
* **内置源注册取舍**('builtin/mention'):useMentionSources 是 react-query hook,
|
|
55
91
|
* 不能在模块级注册(无 Provider/非组件上下文不可调);故采用**组件侧 mount 注册**——
|
|
@@ -60,10 +96,27 @@ type MentionSuggestionMenuProps = Omit<
|
|
|
60
96
|
* 与触发面严格一致。数据经 allRef live getter 传入源工厂——源对象稳定,react-query
|
|
61
97
|
* 数据更新不重注册。
|
|
62
98
|
*
|
|
99
|
+
* **file 源接线**(任务 5):getItems 改 async({query, signal})——内置源同步候选 +
|
|
100
|
+
* fileMentionCandidates 异步候选,**file 组置顶**(先于 kb-doc/design)。可变量
|
|
101
|
+
* (rawThreadId)走 ref;fetchDir/setDrillStack 为模块级/稳定 setState,闭包固化安全。
|
|
102
|
+
* debounce=200(输入节流,避免每键发 rg 查询)。
|
|
103
|
+
*
|
|
104
|
+
* **drill(目录下钻)**:目录行(data.isDir)选中 → 不插 chip,改 insertContentAt 把触发
|
|
105
|
+
* 范围替换为 `@path/`(菜单不关,插件对 doc 变更事务 re-track,`/` 进 query → 列新目录)。
|
|
106
|
+
* children onSelect 包装拦截目录行(mouse 路径,跳过 closePopup 保持菜单开);键盘 Enter
|
|
107
|
+
* 走 item.onSelect 同一 drill(不 closePopup 的差异由插件 onUpdate 留屏兜底,见报告)。
|
|
108
|
+
* 面包屑:drillStack state(仅 drill 产生),MenuView header + headerCompact。
|
|
109
|
+
* truncated 透传 MenuView footer(非交互提示行)。
|
|
110
|
+
*
|
|
63
111
|
* 交互零变化:autoSelectFirstItem / maxHeight=384 / createFullWidthFindSuggestionMatch
|
|
64
|
-
* /
|
|
112
|
+
* / Esc-Esc 屏蔽 / F5 Enter 选中不发送,全部保持(基线 keymap+send 全绿)。渲染面批 18
|
|
113
|
+
* 迁入 MenuView 统一骨架(分组/图标/高亮 scrollIntoView 由 MenuView 承接,见 MentionList)。
|
|
65
114
|
*/
|
|
66
|
-
export function MentionSuggestionMenu({
|
|
115
|
+
export function MentionSuggestionMenu({
|
|
116
|
+
rawThreadId,
|
|
117
|
+
onOpenChange,
|
|
118
|
+
...props
|
|
119
|
+
}: MentionSuggestionMenuProps) {
|
|
67
120
|
const { all } = useMentionSources()
|
|
68
121
|
|
|
69
122
|
// 内置 '@' 源(稳定对象 + live 数据 getter):mount 注册 / unmount dispose
|
|
@@ -79,25 +132,98 @@ export function MentionSuggestionMenu({ onOpenChange, ...props }: MentionSuggest
|
|
|
79
132
|
return registerComposerExtension({ id: "builtin/mention", inputTriggers: [source] })
|
|
80
133
|
}, [])
|
|
81
134
|
|
|
82
|
-
|
|
135
|
+
// 可变量走 ref(items 闭包在插件创建时固化,effect 依赖仅 [editor, pluginKey, closePopup])
|
|
136
|
+
const rawThreadIdRef = useRef(rawThreadId)
|
|
137
|
+
rawThreadIdRef.current = rawThreadId
|
|
138
|
+
// drill 面包屑栈(仅 drill 产生;push basename 段,reset 于菜单关)
|
|
139
|
+
const [drillStack, setDrillStack] = useState<string[]>([])
|
|
140
|
+
// file 搜索截断(透传 MenuView footer)
|
|
141
|
+
const [truncated, setTruncated] = useState(false)
|
|
142
|
+
|
|
143
|
+
// drill:目录行 → 替换触发范围为 @path/(不插 chip)。item.onSelect 通道(mouse 与
|
|
144
|
+
// keyboard Enter 共用),range 由 suggestion 插件提供(触发词 @query 精确范围)。
|
|
145
|
+
// 两阶段插入强制插件 restart(clear 触发词 → onExit;再插 @path/ → onStart → setShow(true)),
|
|
146
|
+
// 抵消 onSelect 里 closePopup 的 show=false——否则 onUpdate 不 setShow、菜单不重开。
|
|
147
|
+
const drillTo = useCallback((path: string, editor: import("@tiptap/react").Editor, range: { from: number; to: number }) => {
|
|
148
|
+
editor.chain().focus().insertContentAt(range, "").run()
|
|
149
|
+
editor.chain().focus().insertContentAt(range.from, `@${path}/`).run()
|
|
150
|
+
const seg = path.split("/").filter(Boolean).pop() ?? path
|
|
151
|
+
setDrillStack((prev) => [...prev, seg])
|
|
152
|
+
}, [])
|
|
153
|
+
|
|
154
|
+
const getItems = async ({
|
|
83
155
|
query,
|
|
156
|
+
signal,
|
|
84
157
|
}: {
|
|
85
158
|
query: string
|
|
86
|
-
|
|
87
|
-
|
|
159
|
+
signal?: AbortSignal
|
|
160
|
+
}): Promise<SuggestionItem<TriggerCandidate>[]> => {
|
|
161
|
+
// 面包屑跟随查询回退(2026-11-20 任务 B 遗留清理 5):query 不含 '/' = 非目录
|
|
162
|
+
// 模式(root 首屏 / rg 搜索)→ 面包屑清空(header 移除)。下钻 query="src/"
|
|
163
|
+
// 含 '/' 保留栈;手动输入 a/b 无栈可清(DSH「仅 drill 产生」语义)。函数式
|
|
164
|
+
// 更新:栈已空时返回原引用 bail-out,不触发额外渲染。
|
|
165
|
+
if (!query.includes("/")) setDrillStack((prev) => (prev.length ? [] : prev))
|
|
88
166
|
const sources = getComposerInputTriggers("@")
|
|
167
|
+
// 候选列表先同步启动(candidates 可能为同步实现——同步抛发生在 file promise
|
|
168
|
+
// 创建之前,杜绝 unhandled rejection 理论边界),再与 file 源(异步,置顶)在
|
|
169
|
+
// 单点汇合(2026-11-20 遗留清理 4:形状收敛——原实现 candidates 同步启动在
|
|
170
|
+
// 前、两路本已并发,总时延恒为 max,非时延优化);signal 透传保留。
|
|
89
171
|
const candidateLists = sources.map((source) => source.candidates(query))
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
172
|
+
// thread 源(P1 任务 4)与 story 需求源(P1 任务 5):与 file 源同级并行 await
|
|
173
|
+
// (thread seam 自拉会话目录 / story serverFn 直调独立项目需求),组序
|
|
174
|
+
// file → thread → story → kb/design(file 置顶不变)。rawThreadId 仅用于 thread
|
|
175
|
+
// 源排除当前线程——thread/story 源均不受空态 gating(rawThreadId null 时两组
|
|
176
|
+
// 仍出现;story 无 threadId 依赖、用户级 serverFn 双链可用)。
|
|
177
|
+
const [fileResult, threadItems, storyItems, resolvedLists] = await Promise.all([
|
|
178
|
+
fileMentionCandidates({
|
|
179
|
+
rawThreadId: rawThreadIdRef.current,
|
|
180
|
+
query,
|
|
181
|
+
signal,
|
|
182
|
+
fetchDir: fetchDirFromQueryClient,
|
|
183
|
+
}),
|
|
184
|
+
threadMentionCandidates({ rawThreadId: rawThreadIdRef.current, query }),
|
|
185
|
+
storyMentionCandidates({ query, signal }),
|
|
186
|
+
Promise.all(candidateLists) as Promise<TriggerCandidate[][]>,
|
|
187
|
+
])
|
|
188
|
+
setTruncated(fileResult.truncated)
|
|
189
|
+
const fileItems: SuggestionItem<TriggerCandidate>[] = fileResult.items.map((candidate) => ({
|
|
190
|
+
title: candidate.label,
|
|
191
|
+
context: candidate,
|
|
192
|
+
group: candidate.group ?? "file",
|
|
193
|
+
onSelect: ({ editor, range }) => {
|
|
194
|
+
// 目录行 → drill(不插 chip);文件行 → 插 chip
|
|
195
|
+
if (candidate.data?.isDir === true && typeof candidate.data?.path === "string") {
|
|
196
|
+
drillTo(candidate.data.path, editor, range)
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
insertMentionCandidateChip(editor, range, candidate)
|
|
200
|
+
},
|
|
201
|
+
}))
|
|
202
|
+
const threadMenuItems: SuggestionItem<TriggerCandidate>[] = threadItems.map((candidate) => ({
|
|
203
|
+
title: candidate.label,
|
|
204
|
+
context: candidate,
|
|
205
|
+
group: candidate.group ?? "thread",
|
|
206
|
+
onSelect: ({ editor, range }) => insertMentionCandidateChip(editor, range, candidate),
|
|
207
|
+
}))
|
|
208
|
+
const storyMenuItems: SuggestionItem<TriggerCandidate>[] = storyItems.map((candidate) => ({
|
|
209
|
+
title: candidate.label,
|
|
210
|
+
context: candidate,
|
|
211
|
+
group: candidate.group ?? "story",
|
|
212
|
+
onSelect: ({ editor, range }) => insertMentionCandidateChip(editor, range, candidate),
|
|
213
|
+
}))
|
|
214
|
+
const kbDesignItems = flattenItems(sources, resolvedLists)
|
|
215
|
+
return [...fileItems, ...threadMenuItems, ...storyMenuItems, ...kbDesignItems]
|
|
99
216
|
}
|
|
100
217
|
|
|
218
|
+
// 菜单关 → reset 面包屑(下次开回 root)
|
|
219
|
+
const handleOpenChange = useCallback(
|
|
220
|
+
(open: boolean) => {
|
|
221
|
+
if (!open) setDrillStack([])
|
|
222
|
+
onOpenChange?.(open)
|
|
223
|
+
},
|
|
224
|
+
[onOpenChange],
|
|
225
|
+
)
|
|
226
|
+
|
|
101
227
|
return (
|
|
102
228
|
<SuggestionMenu
|
|
103
229
|
char="@"
|
|
@@ -110,13 +236,22 @@ export function MentionSuggestionMenu({ onOpenChange, ...props }: MentionSuggest
|
|
|
110
236
|
// Enter 穿透到提交 keymap 照常发送
|
|
111
237
|
autoSelectFirstItem={true}
|
|
112
238
|
// A7/X5(F5-6 批 7):Tab=确认高亮候选、Shift+Tab=关菜单(DSH keymap 语义,
|
|
113
|
-
// 原为移动高亮)。'/'
|
|
239
|
+
// 原为移动高亮)。'/' 命令菜单已同步 tabSelects(批 18 两菜单统一)。
|
|
114
240
|
tabSelects
|
|
115
241
|
maxHeight={384}
|
|
242
|
+
// 任务 5:输入节流 200ms(避免每键发 rg / 目录查询)
|
|
243
|
+
debounce={200}
|
|
116
244
|
findSuggestionMatch={createFullWidthFindSuggestionMatch("@")}
|
|
117
245
|
{...props}
|
|
118
246
|
>
|
|
119
|
-
{(renderProps) =>
|
|
247
|
+
{(renderProps) => (
|
|
248
|
+
<MentionList
|
|
249
|
+
{...renderProps}
|
|
250
|
+
drillStack={drillStack}
|
|
251
|
+
truncated={truncated}
|
|
252
|
+
onOpenChange={handleOpenChange}
|
|
253
|
+
/>
|
|
254
|
+
)}
|
|
120
255
|
</SuggestionMenu>
|
|
121
256
|
)
|
|
122
257
|
}
|
|
@@ -140,61 +275,40 @@ function flattenItems(
|
|
|
140
275
|
return items
|
|
141
276
|
}
|
|
142
277
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}) => {
|
|
152
|
-
const itemRef = useRef<HTMLDivElement>(null)
|
|
153
|
-
const ctx = item.context
|
|
154
|
-
const isKbDoc = ctx?.kind === "kb-doc"
|
|
155
|
-
|
|
156
|
-
useEffect(() => {
|
|
157
|
-
const menuEl = document.querySelector(
|
|
158
|
-
'[data-selector="tiptap-mention-suggestion-menu"]',
|
|
159
|
-
) as HTMLElement
|
|
160
|
-
if (!itemRef.current || !isSelected || !menuEl) return
|
|
161
|
-
const overflow = getElementOverflowPosition(itemRef.current, menuEl)
|
|
162
|
-
if (overflow === "top") itemRef.current.scrollIntoView(true)
|
|
163
|
-
else if (overflow === "bottom") itemRef.current.scrollIntoView(false)
|
|
164
|
-
}, [isSelected])
|
|
165
|
-
|
|
166
|
-
return (
|
|
167
|
-
<div ref={itemRef}>
|
|
168
|
-
<Item
|
|
169
|
-
size="xs"
|
|
170
|
-
onClick={onSelect}
|
|
171
|
-
className={cn(
|
|
172
|
-
"cursor-pointer hover:bg-accent",
|
|
173
|
-
isSelected && "bg-accent outline -outline-offset-1 outline-ring",
|
|
174
|
-
)}
|
|
175
|
-
>
|
|
176
|
-
<ItemMedia variant="icon">
|
|
177
|
-
{isKbDoc ? (
|
|
178
|
-
<BookOpen className="size-4" />
|
|
179
|
-
) : (
|
|
180
|
-
<FileText className="size-4" />
|
|
181
|
-
)}
|
|
182
|
-
</ItemMedia>
|
|
183
|
-
<ItemContent>
|
|
184
|
-
<ItemTitle className="text-left">{item.title}</ItemTitle>
|
|
185
|
-
<span className="text-[10px] text-muted-foreground">{ctx?.subtext ?? ""}</span>
|
|
186
|
-
</ItemContent>
|
|
187
|
-
</Item>
|
|
188
|
-
</div>
|
|
189
|
-
)
|
|
278
|
+
/** 条目图标(按候选 kind 映射):kb-doc → BookOpen、design → Folder、file 目录 → Folder、thread → MessagesSquare、story → Quote(demo 需求引用同款)、其余 FileText。 */
|
|
279
|
+
function renderMentionIcon(kind?: string, isDir?: boolean) {
|
|
280
|
+
if (kind === "kb-doc") return <BookOpen className="size-4" />
|
|
281
|
+
if (kind === "design") return <Folder className="size-4" />
|
|
282
|
+
if (kind === "file" && isDir) return <Folder className="size-4" />
|
|
283
|
+
if (kind === "thread") return <MessagesSquare className="size-4" />
|
|
284
|
+
if (kind === "story") return <Quote className="size-4" />
|
|
285
|
+
return <FileText className="size-4" />
|
|
190
286
|
}
|
|
191
287
|
|
|
288
|
+
/**
|
|
289
|
+
* 分组渲染(批 18 迁入 MenuView 统一骨架):entries 由 items 扁平化(groupLabel 取
|
|
290
|
+
* item.group 缺省回落「其他」),MenuView 相邻同组聚合为段带组头;combobox 语义
|
|
291
|
+
* (aria-activedescendant / role=option)、条目图标(renderMedia 按 kind 映射)、
|
|
292
|
+
* 高亮行 scrollIntoView 与 mousemove 共享高亮全部由 MenuView 行组件承接。容器高度
|
|
293
|
+
* 口径删直传 --suggestion-menu-max-height(MenuView 内已消费该 var)。菜单开合信号:
|
|
294
|
+
* SuggestionMenu 仅在浮层挂载期渲染 children,MentionList 挂载/卸载即开/关(稳定回调)。
|
|
295
|
+
*
|
|
296
|
+
* 任务 5 增量:① children onSelect 包装拦截目录行(data.isDir)走 drill(不 closePopup,
|
|
297
|
+
* 菜单保持开)——mouse 点击路径;键盘 Enter 走 item.onSelect 同一 drill。② 面包屑
|
|
298
|
+
* (drillStack 非空时)经 MenuView header + headerCompact 渲染(仅 drill 产生)。
|
|
299
|
+
* ③ truncated → MenuView footer 非交互提示行。
|
|
300
|
+
*/
|
|
192
301
|
const MentionList = ({
|
|
193
302
|
items,
|
|
194
303
|
selectedIndex,
|
|
195
304
|
onSelect,
|
|
305
|
+
setSelectedIndex,
|
|
306
|
+
drillStack,
|
|
307
|
+
truncated,
|
|
196
308
|
onOpenChange,
|
|
197
309
|
}: SuggestionMenuRenderProps<TriggerCandidate> & {
|
|
310
|
+
drillStack: string[]
|
|
311
|
+
truncated: boolean
|
|
198
312
|
onOpenChange?: (open: boolean) => void
|
|
199
313
|
}) => {
|
|
200
314
|
// 菜单开合信号:SuggestionMenu 仅在浮层挂载期渲染 children,MentionList 的
|
|
@@ -206,43 +320,34 @@ const MentionList = ({
|
|
|
206
320
|
|
|
207
321
|
if (!items.length) return null
|
|
208
322
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
-
{},
|
|
217
|
-
)
|
|
323
|
+
// 扁平 entries(顺序即展示顺序;groupLabel = 组文本,相邻同 label 由 MenuView 聚合)
|
|
324
|
+
const entries = items.map((suggestion, index) => ({
|
|
325
|
+
key: suggestion.context?.id ?? `${suggestion.title}:${index}`,
|
|
326
|
+
groupLabel: suggestion.group || m.harness_mention_other(),
|
|
327
|
+
item: suggestion,
|
|
328
|
+
}))
|
|
218
329
|
|
|
219
|
-
|
|
330
|
+
// drill 面包屑(仅 drill 产生):工作区 › seg1 › seg2…
|
|
331
|
+
const breadcrumb =
|
|
332
|
+
drillStack.length > 0
|
|
333
|
+
? [m.harness_mention_crumbRoot(), ...drillStack].join(" › ")
|
|
334
|
+
: undefined
|
|
220
335
|
|
|
221
336
|
return (
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
item={item}
|
|
238
|
-
isSelected={globalIndex === selectedIndex}
|
|
239
|
-
onSelect={() => onSelect(item)}
|
|
240
|
-
/>
|
|
241
|
-
)
|
|
242
|
-
})}
|
|
243
|
-
</ItemGroup>
|
|
244
|
-
</div>
|
|
245
|
-
))}
|
|
246
|
-
</div>
|
|
337
|
+
<MenuView
|
|
338
|
+
entries={entries}
|
|
339
|
+
selectedIndex={selectedIndex ?? 0}
|
|
340
|
+
onSelect={(suggestion) => onSelect(suggestion)}
|
|
341
|
+
selector="tiptap-mention-suggestion-menu"
|
|
342
|
+
setSelectedIndex={setSelectedIndex}
|
|
343
|
+
header={breadcrumb}
|
|
344
|
+
headerCompact
|
|
345
|
+
footer={truncated ? m.harness_mention_truncated() : undefined}
|
|
346
|
+
renderMedia={(suggestion) =>
|
|
347
|
+
renderMentionIcon(suggestion.context?.kind, suggestion.context?.data?.isDir === true)
|
|
348
|
+
}
|
|
349
|
+
renderTitle={(suggestion) => suggestion.title}
|
|
350
|
+
renderSubtext={(suggestion) => suggestion.context?.subtext ?? ""}
|
|
351
|
+
/>
|
|
247
352
|
)
|
|
248
353
|
}
|
package/src/components/harness/conversation-panel/composer/mention/mention-trigger-source.ts
CHANGED
|
@@ -22,8 +22,11 @@
|
|
|
22
22
|
*
|
|
23
23
|
* 行为迁移对照(原 mention-suggestion-menu.getItems 内联逻辑,逐条保持):
|
|
24
24
|
* - 查询过滤:`!q || label.toLowerCase().includes(q)`(与 groupMentionCandidates 同口径);
|
|
25
|
-
* - 只放行可插入类型 kb-doc / design(file/
|
|
26
|
-
* 菜单过滤,此处收进源内——数据源本就不产出这些 kind
|
|
25
|
+
* - 只放行可插入类型 kb-doc / design / thread / story(file/plugin-tool 分组原本就被
|
|
26
|
+
* 菜单过滤,此处收进源内——数据源本就不产出这些 kind,防御口径一并保留;
|
|
27
|
+
* P1 任务 4 起 thread 为可插入 chip,mention 数据面仍无 thread 生产者——本源
|
|
28
|
+
* 的 thread 放行是防御面,生产 thread 候选来自 thread-mention.ts 菜单层聚合;
|
|
29
|
+
* P1 任务 5 起 story 同款——生产 story 候选来自 story-mention.ts 菜单层聚合);
|
|
27
30
|
* - 顺序:kb-doc(`all` 内原序)在前、design 在后(与原 GROUP_ORDER flatMap 等价);
|
|
28
31
|
* - 分组标签:kb-doc 按所属知识库名(S29,无名兜底 kind 标签),design 用稳定
|
|
29
32
|
* kind 语义标签;
|
|
@@ -33,16 +36,21 @@
|
|
|
33
36
|
|
|
34
37
|
import type { Editor, Range } from "@tiptap/react"
|
|
35
38
|
import type { InputTriggerPickContext, InputTriggerSource, TriggerCandidate } from "../extension"
|
|
39
|
+
import { fuzzyMatch } from "../fuzzy"
|
|
36
40
|
import { m } from "@/paraglide/messages.js"
|
|
37
41
|
import type { MentionCandidate } from "./mention-resolvers"
|
|
38
42
|
|
|
39
43
|
/** @ chip 注入的 attrs(mention-extension schema 级键)。 */
|
|
40
|
-
interface MentionChipAttrs {
|
|
44
|
+
export interface MentionChipAttrs {
|
|
41
45
|
id: string
|
|
42
46
|
label: string
|
|
43
47
|
docType: string
|
|
44
48
|
docGroup: string
|
|
45
49
|
kbId?: string
|
|
50
|
+
/** @文件 chip 的工作区文件相对路径(任务 5 接入 file 候选源) */
|
|
51
|
+
path?: string
|
|
52
|
+
/** @会话 chip 携带的会话 id(P1 任务 4 接入 thread 候选源) */
|
|
53
|
+
threadId?: string
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
/**
|
|
@@ -59,28 +67,63 @@ export function createBuiltinMentionSource(
|
|
|
59
67
|
candidates(query: string): TriggerCandidate[] {
|
|
60
68
|
const all = getAll()
|
|
61
69
|
const q = query.trim().toLowerCase()
|
|
62
|
-
const matches = (c: MentionCandidate) =>
|
|
70
|
+
const matches = (c: MentionCandidate) =>
|
|
71
|
+
!q || fuzzyMatch(q, c.label) !== null || c.label.toLowerCase().includes(q)
|
|
63
72
|
const out: TriggerCandidate[] = []
|
|
64
|
-
// kb-doc 在前、design 在后(与原 GROUP_ORDER flatMap
|
|
73
|
+
// kb-doc 在前、design 在后(与原 GROUP_ORDER flatMap 顺序等价)。
|
|
74
|
+
// 分组/副文本口径(用户裁决 2026-11-21):kb 以「知识库文档」为分组、副文本=
|
|
75
|
+
// 知识库名+加入的工作空间(未加入不显示);design 以「设计」为分组、副文本=
|
|
76
|
+
// 工作空间(数据模型暂无关联 → 恒不显示,显示通路先立)。
|
|
65
77
|
for (const c of all) {
|
|
66
78
|
if (c.kind !== "kb-doc" || !matches(c)) continue
|
|
79
|
+
const subtext = [c.kbName, ...(c.workspaceNames ?? [])].filter(Boolean).join(" · ")
|
|
67
80
|
out.push({
|
|
68
81
|
id: c.id,
|
|
69
82
|
label: c.label,
|
|
70
83
|
kind: c.kind,
|
|
71
|
-
group:
|
|
72
|
-
subtext:
|
|
84
|
+
group: m.harness_mention_kb_doc(),
|
|
85
|
+
subtext: subtext || undefined,
|
|
73
86
|
data: { kbId: c.kbId, kbName: c.kbName },
|
|
74
87
|
})
|
|
75
88
|
}
|
|
76
89
|
for (const c of all) {
|
|
77
90
|
if (c.kind !== "design" || !matches(c)) continue
|
|
91
|
+
const subtext = (c.workspaceNames ?? []).join(" · ")
|
|
78
92
|
out.push({
|
|
79
93
|
id: c.id,
|
|
80
94
|
label: c.label,
|
|
81
95
|
kind: c.kind,
|
|
82
96
|
group: m.harness_mention_prd(),
|
|
83
|
-
subtext:
|
|
97
|
+
subtext: subtext || undefined,
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
// thread 放行(P1 任务 4):mention 数据面无 thread 生产者(use-mention-sources
|
|
101
|
+
// 只产 kb-doc/design),此分支是防御面——若未来数据面产出 thread 候选则经此
|
|
102
|
+
// 透传;生产 thread 候选来自 thread-mention.ts(菜单层聚合,file 源同款)。
|
|
103
|
+
for (const c of all) {
|
|
104
|
+
if (c.kind !== "thread" || !matches(c)) continue
|
|
105
|
+
out.push({
|
|
106
|
+
id: c.id,
|
|
107
|
+
label: c.label,
|
|
108
|
+
kind: c.kind,
|
|
109
|
+
group: m.harness_mention_threadGroup(),
|
|
110
|
+
subtext: m.harness_mention_threadGroup(),
|
|
111
|
+
data: { threadId: c.id },
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
// story 放行(P1 任务 5):mention 数据面无 story 生产者,此分支是防御面——
|
|
115
|
+
// 若未来数据面产出 story 候选则经此透传;生产 story 候选来自 story-mention.ts
|
|
116
|
+
// (菜单层聚合,file/thread 源同款)。data.id 承载 story 主键(onPick →
|
|
117
|
+
// insertMentionCandidateChip 的 story 分支读它写 attrs.id)。
|
|
118
|
+
for (const c of all) {
|
|
119
|
+
if (c.kind !== "story" || !matches(c)) continue
|
|
120
|
+
out.push({
|
|
121
|
+
id: c.id,
|
|
122
|
+
label: c.label,
|
|
123
|
+
kind: c.kind,
|
|
124
|
+
group: m.harness_mention_storyGroup(),
|
|
125
|
+
subtext: m.harness_mention_storyGroup(),
|
|
126
|
+
data: { id: c.id },
|
|
84
127
|
})
|
|
85
128
|
}
|
|
86
129
|
return out
|
|
@@ -114,6 +157,26 @@ export function insertMentionCandidateChip(
|
|
|
114
157
|
if (typeof kbId === "string" && kbId) {
|
|
115
158
|
attrs.kbId = kbId
|
|
116
159
|
}
|
|
160
|
+
const path = candidate.data?.path
|
|
161
|
+
if (typeof path === "string" && path) {
|
|
162
|
+
attrs.path = path
|
|
163
|
+
}
|
|
164
|
+
// @会话 chip(P1 任务 4):attrs.id = threadId 本身(裁决:thread 主键即 id,
|
|
165
|
+
// candidate.id 的 'thread:' 前缀只是菜单候选键隔离,与 file:/skill: 同款,不进
|
|
166
|
+
// attrs.id);docType='thread' 走上方 ternary(kind 原样)
|
|
167
|
+
const threadId = candidate.data?.threadId
|
|
168
|
+
if (typeof threadId === "string" && threadId) {
|
|
169
|
+
attrs.threadId = threadId
|
|
170
|
+
attrs.id = threadId
|
|
171
|
+
}
|
|
172
|
+
// @需求 chip(P1 任务 5):attrs.id = story 主键本身(candidate.id 的 'story:'
|
|
173
|
+
// 前缀只是菜单候选键隔离,与 thread: 同款,不进 attrs.id);docType='story' 走
|
|
174
|
+
// 上方 ternary(kind 原样)。不加新 schema attr——story 引用无结构化数据要往返
|
|
175
|
+
// (id 已在 attrs.id 往返),renderText 落兜底 `@${label}` 字面。
|
|
176
|
+
const storyId = candidate.data?.id
|
|
177
|
+
if (candidate.kind === "story" && typeof storyId === "string" && storyId) {
|
|
178
|
+
attrs.id = storyId
|
|
179
|
+
}
|
|
117
180
|
editor
|
|
118
181
|
.chain()
|
|
119
182
|
.focus()
|