@allbluecn/web-app 0.27.40 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- 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 +3 -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-session-putmedia.test.tsx +17 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +26 -6
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +21 -3
- 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/dock-persist.ts +6 -4
- package/src/components/harness/extension-panel/dock/dock-registry.ts +35 -14
- package/src/components/harness/extension-panel/dock/dock-surface.tsx +2 -0
- package/src/components/harness/extension-panel/dock/guide-page.tsx +75 -45
- package/src/components/harness/extension-panel/panels/browser/__tests__/webview-frame.test.tsx +5 -2
- 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/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.ts +50 -0
- package/src/paraglide/messages/_index.js +1574 -311
- package/src/paraglide/messages/en.js +513 -103
- package/src/paraglide/messages/zh.js +514 -104
- package/src/routeTree.gen.ts +31 -0
- package/src/routes/_nav/harness/route.lazy.tsx +13 -0
- package/src/server/ai-gateway/sandbox/policy.ts +6 -6
- 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__/thread-reference.server.test.ts +258 -0
- package/src/server/harness/define.server.ts +21 -3
- package/src/server/harness/thread-reference.server.ts +446 -0
- 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
|
@@ -19,21 +19,23 @@
|
|
|
19
19
|
* MenuView 统一渲染骨架(E4,F5-6 批 18;DSH MenuView combobox 对标)。
|
|
20
20
|
*
|
|
21
21
|
* 提供:combobox 语义(role=listbox + aria-activedescendant 指向高亮 option,焦点
|
|
22
|
-
* 不离编辑器——SuggestionMenu onPointerDown preventDefault
|
|
23
|
-
*
|
|
22
|
+
* 不离编辑器——SuggestionMenu onPointerDown preventDefault 保证)、视口高度上限
|
|
23
|
+
* (min(400px, --suggestion-menu-max-height)——floating size middleware 提供视口防线,
|
|
24
|
+
* 无该 var 时回落 400)、顶部 header 槽(headerCompact 缺省套 84px 头部预留位)、
|
|
25
|
+
* 组头(指令/技能/本地命令…)、条目左侧图标槽(renderMedia)、条目后非交互提示行
|
|
26
|
+
* (footer)、无项两条骨架行。
|
|
24
27
|
*
|
|
25
28
|
* 键盘仲裁**不在**本组件(保持 SuggestionMenu / use-menu-navigation 现状,14 例
|
|
26
29
|
* keymap 语义不变)——本组件只消费 selectedIndex 做高亮与 aria,键盘流由上层驱动。
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* (MentionList)为另一实现,统一迁入留后续(避免本批触碰 @ 菜单基线)——E4「统一
|
|
30
|
-
* 骨架」的 @ 侧收敛记为本批部分交付(见 checklist 批 18 行注记)。
|
|
30
|
+
* 高亮行 scrollIntoView 与 mousemove 共享高亮(setSelectedIndex)在本组件行组件内
|
|
31
|
+
* 接线(option id 定位),两菜单('/' 命令 / @ 提及)共用同一渲染面(批 18 收敛)。
|
|
31
32
|
*/
|
|
32
|
-
import type
|
|
33
|
+
import { useEffect, useRef, type ReactNode } from "react"
|
|
33
34
|
import { cn } from "@/components/tiptap/lib/utils"
|
|
34
|
-
import {
|
|
35
|
+
import { getElementOverflowPosition } from "@/components/tiptap/lib/collab-utils"
|
|
36
|
+
import { Item, ItemContent, ItemGroup, ItemMedia, ItemTitle } from "@/components/ui/item"
|
|
35
37
|
|
|
36
|
-
/** DSH MenuView
|
|
38
|
+
/** DSH MenuView 高度上限基准(400px;实取 min(400px, --suggestion-menu-max-height),E4 批引入)。 */
|
|
37
39
|
export const MENU_VIEW_MAX_HEIGHT = 400
|
|
38
40
|
|
|
39
41
|
/** DSH MenuView 顶部头部预留高度(84px;header 槽最小占位,J 表参数)。 */
|
|
@@ -58,8 +60,10 @@ export interface MenuViewProps<T> {
|
|
|
58
60
|
onSelect: (item: T) => void
|
|
59
61
|
/** option id 前缀(aria-activedescendant 派生;同页多菜单需唯一) */
|
|
60
62
|
selector: string
|
|
61
|
-
/** 顶部 header
|
|
63
|
+
/** 顶部 header 槽(缺省不渲染头部,占位由内容自适应) */
|
|
62
64
|
header?: ReactNode
|
|
65
|
+
/** 紧凑头部(true → header 不套 84px 头部预留位;@ 菜单无大头部用紧凑排布) */
|
|
66
|
+
headerCompact?: boolean
|
|
63
67
|
/** 加载态:无 entries 且 loading=true → 两条骨架行(E4「无项两条骨架行」) */
|
|
64
68
|
loading?: boolean
|
|
65
69
|
/** 空态文案(无 entries 且非 loading 时显示;缺省不渲染) */
|
|
@@ -68,6 +72,28 @@ export interface MenuViewProps<T> {
|
|
|
68
72
|
renderTitle: (item: T) => ReactNode
|
|
69
73
|
/** 条目副文本(缺省不渲染) */
|
|
70
74
|
renderSubtext?: (item: T) => ReactNode
|
|
75
|
+
/** 条目右侧槽(选中 ✓/行内 spinner 等 trailing 图标;在副文本之后渲染,缺省不渲染) */
|
|
76
|
+
renderTrailing?: (item: T) => ReactNode
|
|
77
|
+
/** 条目左侧图标槽(ItemMedia icon variant;缺省不渲染图标) */
|
|
78
|
+
renderMedia?: (item: T) => ReactNode
|
|
79
|
+
/** 条目后的非交互提示行(pointer-events-none;如按键提示,缺省不渲染) */
|
|
80
|
+
footer?: ReactNode
|
|
81
|
+
/** 编程式设置高亮(mousemove 共享高亮;缺省则行不响应指针移动) */
|
|
82
|
+
setSelectedIndex?: (index: number) => void
|
|
83
|
+
/**
|
|
84
|
+
* 当前档判定(2026-11-20 任务 B 遗留清理 3,opt-in):命中行 aria-selected=true
|
|
85
|
+
* (与 isSelected 取或,不覆盖键盘高亮)。popup 型浮层(/model、/permission)
|
|
86
|
+
* 的键盘高亮恒 selectedIndex=-1,「当前档」此前只有 ✓ 图标 + font-semibold
|
|
87
|
+
* 视觉语义、无 aria——屏幕阅读器读不出当前档。缺省 undefined = 无当前档语义,
|
|
88
|
+
* 行为零变化('/' 菜单 / @ 菜单不传)。
|
|
89
|
+
*/
|
|
90
|
+
isCurrent?: (item: T) => boolean
|
|
91
|
+
/**
|
|
92
|
+
* 去外壳(2026-11-21 打磨,opt-in):外层容器去掉 rounded-xl/border——嵌在自承载
|
|
93
|
+
* chrome 的宿主面板内(ModelSelector Popover 面板根已有描边/圆角/裁切),避免
|
|
94
|
+
* 双层卡。bg-background 与滚动防线保留。
|
|
95
|
+
*/
|
|
96
|
+
unstyled?: boolean
|
|
71
97
|
}
|
|
72
98
|
|
|
73
99
|
/** option id(aria-activedescendant 指向;selector + 扁平索引)。 */
|
|
@@ -81,10 +107,17 @@ export function MenuView<T = unknown>({
|
|
|
81
107
|
onSelect,
|
|
82
108
|
selector,
|
|
83
109
|
header,
|
|
110
|
+
headerCompact = false,
|
|
84
111
|
loading = false,
|
|
85
112
|
emptyMessage,
|
|
86
113
|
renderTitle,
|
|
87
114
|
renderSubtext,
|
|
115
|
+
renderTrailing,
|
|
116
|
+
renderMedia,
|
|
117
|
+
footer,
|
|
118
|
+
setSelectedIndex,
|
|
119
|
+
isCurrent,
|
|
120
|
+
unstyled = false,
|
|
88
121
|
}: MenuViewProps<T>) {
|
|
89
122
|
// 无项:loading → 两条骨架行(E4);非 loading → 空态文案(可缺省)
|
|
90
123
|
if (entries.length === 0) {
|
|
@@ -118,57 +151,162 @@ export function MenuView<T = unknown>({
|
|
|
118
151
|
|
|
119
152
|
return (
|
|
120
153
|
<div
|
|
121
|
-
className=
|
|
122
|
-
|
|
154
|
+
className={cn(
|
|
155
|
+
"bg-background text-card-foreground",
|
|
156
|
+
!unstyled && "rounded-xl border",
|
|
157
|
+
)}
|
|
158
|
+
style={{
|
|
159
|
+
// 视口防线:floating size middleware 设 --suggestion-menu-max-height(@ 菜单
|
|
160
|
+
// 现状);'/' 菜单无该 var → 回落 400px。取 min 保证不超视口可用高。
|
|
161
|
+
maxHeight: `min(${MENU_VIEW_MAX_HEIGHT}px, var(--suggestion-menu-max-height, ${MENU_VIEW_MAX_HEIGHT}px))`,
|
|
162
|
+
overflow: "auto",
|
|
163
|
+
}}
|
|
123
164
|
data-menu-view=""
|
|
124
165
|
role="listbox"
|
|
125
166
|
aria-activedescendant={optionId(selector, selectedIndex)}
|
|
126
167
|
>
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
168
|
+
{/* 双层背景(用户裁决 2026-11-21:「透明背景」修正):外层实色 bg-background 遮住
|
|
169
|
+
浮层下内容;内层 dark:bg-input/30 与 PromptInput 的 InputGroup 同款半透明叠色
|
|
170
|
+
——合成 = 输入框视觉(输入框 = 不透明 composer 底 + 同款叠加),且浮层自身
|
|
171
|
+
不透底。单层半透明(上一版)直接叠在消息流上 = 透明观感,被否。 */}
|
|
172
|
+
<div className="dark:bg-input/30">
|
|
173
|
+
{header ? (
|
|
174
|
+
<div
|
|
175
|
+
className="px-2.5 pb-1 pt-2 text-xs font-medium text-muted-foreground"
|
|
176
|
+
style={headerCompact ? undefined : { minHeight: `${MENU_VIEW_HEADER_HEIGHT}px` }}
|
|
177
|
+
data-menu-view-header=""
|
|
178
|
+
>
|
|
179
|
+
{header}
|
|
180
|
+
</div>
|
|
181
|
+
) : null}
|
|
182
|
+
<div className="p-1.5">
|
|
183
|
+
{segments.map((segment) => (
|
|
184
|
+
<div key={segment.label} className="mb-0.5 last:mb-0">
|
|
185
|
+
<div className="px-2.5 py-0.5 text-xs font-medium text-muted-foreground">
|
|
186
|
+
{segment.label}
|
|
187
|
+
</div>
|
|
188
|
+
{/* 行距收紧(用户裁决 2026-11-21 对齐 DSH 紧凑行):xs 档默认 gap-2(8px)
|
|
189
|
+
过宽——twMerge 覆盖为 4px */}
|
|
190
|
+
<ItemGroup className="gap-1 has-data-[size=xs]:gap-1">
|
|
191
|
+
{segment.rows.map(({ entry, index }) => (
|
|
192
|
+
<MenuViewRow
|
|
193
|
+
key={entry.key}
|
|
194
|
+
selector={selector}
|
|
195
|
+
index={index}
|
|
196
|
+
entry={entry}
|
|
197
|
+
isSelected={index === selectedIndex}
|
|
198
|
+
isCurrent={isCurrent}
|
|
199
|
+
onSelect={onSelect}
|
|
200
|
+
renderTitle={renderTitle}
|
|
201
|
+
renderSubtext={renderSubtext}
|
|
202
|
+
renderTrailing={renderTrailing}
|
|
203
|
+
renderMedia={renderMedia}
|
|
204
|
+
setSelectedIndex={setSelectedIndex}
|
|
205
|
+
/>
|
|
206
|
+
))}
|
|
207
|
+
</ItemGroup>
|
|
141
208
|
</div>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
index === selectedIndex && "bg-accent outline -outline-offset-1 outline-ring",
|
|
151
|
-
)}
|
|
152
|
-
>
|
|
153
|
-
<ItemContent>
|
|
154
|
-
<ItemTitle className="text-left">{renderTitle(entry.item)}</ItemTitle>
|
|
155
|
-
{renderSubtext ? (
|
|
156
|
-
<span className="text-[10px] text-muted-foreground">
|
|
157
|
-
{renderSubtext(entry.item)}
|
|
158
|
-
</span>
|
|
159
|
-
) : null}
|
|
160
|
-
</ItemContent>
|
|
161
|
-
</Item>
|
|
162
|
-
</div>
|
|
163
|
-
))}
|
|
164
|
-
</ItemGroup>
|
|
209
|
+
))}
|
|
210
|
+
</div>
|
|
211
|
+
{footer ? (
|
|
212
|
+
<div
|
|
213
|
+
className="pointer-events-none border-t px-2.5 py-2 text-[10px] text-muted-foreground"
|
|
214
|
+
data-menu-view-footer=""
|
|
215
|
+
>
|
|
216
|
+
{footer}
|
|
165
217
|
</div>
|
|
166
|
-
)
|
|
218
|
+
) : null}
|
|
167
219
|
</div>
|
|
168
220
|
</div>
|
|
169
221
|
)
|
|
170
222
|
}
|
|
171
223
|
|
|
224
|
+
/**
|
|
225
|
+
* 菜单条目行(批 18 从 CommandItem/MentionItem 收敛):高亮行 scrollIntoView(以
|
|
226
|
+
* option id 所在行定位、data-menu-view 为滚动容器)+ mousemove 共享高亮(指针移入
|
|
227
|
+
* 行 → setSelectedIndex(flatIndex),与键盘导航同一 selectedIndex 单一高亮源)。
|
|
228
|
+
*/
|
|
229
|
+
function MenuViewRow<T>({
|
|
230
|
+
selector,
|
|
231
|
+
index,
|
|
232
|
+
entry,
|
|
233
|
+
isSelected,
|
|
234
|
+
isCurrent,
|
|
235
|
+
onSelect,
|
|
236
|
+
renderTitle,
|
|
237
|
+
renderSubtext,
|
|
238
|
+
renderTrailing,
|
|
239
|
+
renderMedia,
|
|
240
|
+
setSelectedIndex,
|
|
241
|
+
}: {
|
|
242
|
+
selector: string
|
|
243
|
+
index: number
|
|
244
|
+
entry: MenuViewEntry<T>
|
|
245
|
+
isSelected: boolean
|
|
246
|
+
/** 当前档判定(opt-in,见 MenuViewProps.isCurrent):仅并入 aria-selected,不参与高亮视觉/scrollIntoView */
|
|
247
|
+
isCurrent?: (item: T) => boolean
|
|
248
|
+
onSelect: (item: T) => void
|
|
249
|
+
renderTitle: (item: T) => ReactNode
|
|
250
|
+
renderSubtext?: (item: T) => ReactNode
|
|
251
|
+
renderTrailing?: (item: T) => ReactNode
|
|
252
|
+
renderMedia?: (item: T) => ReactNode
|
|
253
|
+
setSelectedIndex?: (index: number) => void
|
|
254
|
+
}) {
|
|
255
|
+
const rowRef = useRef<HTMLDivElement>(null)
|
|
256
|
+
|
|
257
|
+
// 键盘移动高亮 → 行滚入可视区(迁移自 CommandItem/MentionItem,容器改以
|
|
258
|
+
// data-menu-view 滚动面定位,取代旧的 [data-selector] 浮层查询)
|
|
259
|
+
useEffect(() => {
|
|
260
|
+
if (!isSelected) return
|
|
261
|
+
const el = rowRef.current
|
|
262
|
+
const menuEl = (el?.closest("[data-menu-view]") as HTMLElement | null) ?? null
|
|
263
|
+
if (!el || !menuEl) return
|
|
264
|
+
const overflow = getElementOverflowPosition(el, menuEl)
|
|
265
|
+
if (overflow === "top") el.scrollIntoView(true)
|
|
266
|
+
else if (overflow === "bottom") el.scrollIntoView(false)
|
|
267
|
+
}, [isSelected])
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<div
|
|
271
|
+
ref={rowRef}
|
|
272
|
+
id={optionId(selector, index)}
|
|
273
|
+
role="option"
|
|
274
|
+
aria-selected={isSelected || (isCurrent?.(entry.item) ?? false)}
|
|
275
|
+
onMouseMove={setSelectedIndex ? () => setSelectedIndex(index) : undefined}
|
|
276
|
+
>
|
|
277
|
+
<Item
|
|
278
|
+
size="xs"
|
|
279
|
+
onClick={() => onSelect(entry.item)}
|
|
280
|
+
className={cn(
|
|
281
|
+
"cursor-pointer py-1.5 hover:bg-accent",
|
|
282
|
+
isSelected && "bg-accent outline -outline-offset-1 outline-ring",
|
|
283
|
+
)}
|
|
284
|
+
>
|
|
285
|
+
{renderMedia ? <ItemMedia variant="icon">{renderMedia(entry.item)}</ItemMedia> : null}
|
|
286
|
+
{/* 单行布局(用户裁决 2026-11-20,对齐 DSH 菜单行):标题 truncate + 副文本
|
|
287
|
+
右侧 muted truncate——替代原两行堆叠(副文本多为组名复读,占高无信息)。
|
|
288
|
+
副文本空值不渲染(file 路径自描述等场景零噪音)。 */}
|
|
289
|
+
<ItemContent className="min-w-0">
|
|
290
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
291
|
+
<ItemTitle className="min-w-0 flex-1 truncate text-left">
|
|
292
|
+
{renderTitle(entry.item)}
|
|
293
|
+
</ItemTitle>
|
|
294
|
+
{renderSubtext ? (
|
|
295
|
+
<span className="max-w-[50%] shrink-0 truncate text-xs text-muted-foreground">
|
|
296
|
+
{renderSubtext(entry.item)}
|
|
297
|
+
</span>
|
|
298
|
+
) : null}
|
|
299
|
+
{renderTrailing ? (
|
|
300
|
+
// 右侧槽(2026-11-21 打磨):选中 ✓/行内 spinner 等 trailing 图标
|
|
301
|
+
<span className="flex shrink-0 items-center">{renderTrailing(entry.item)}</span>
|
|
302
|
+
) : null}
|
|
303
|
+
</div>
|
|
304
|
+
</ItemContent>
|
|
305
|
+
</Item>
|
|
306
|
+
</div>
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
|
|
172
310
|
/** 骨架行(E4「无项两条骨架行」;纯装饰,pointer-events-none)。 */
|
|
173
311
|
function SkeletonRow({ selector, index }: { selector: string; index: number }) {
|
|
174
312
|
return (
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
* popup 面板外壳(P2 任务 2 从 command-popup.tsx :107-160 整体迁出,行为零变化):
|
|
20
|
+
* /model、/permission 与 model-selector 三处复用——Esc/外点关闭监听 + 钉卡定位容器。
|
|
21
|
+
* Esc/外点 → onClose("cancel")(上层恢复触发词);面板内点选由各 popup 自行 settle。
|
|
22
|
+
* confirmOpen=true(AlertDialog 开启中)时抑制两监听——见 command-popup.tsx 头注释。
|
|
23
|
+
*
|
|
24
|
+
* onClose 类型从 command-popup 回引(CommandPopupCloseReason 单一来源,仅 type import
|
|
25
|
+
* 不构成运行时环)。
|
|
26
|
+
*/
|
|
27
|
+
import { useEffect, useRef, type ReactNode } from "react"
|
|
28
|
+
import type { CommandPopupCloseReason } from "./command-popup"
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* popup 面板外壳(/model 与 /permission 复用):Esc/外点关闭监听 + 钉卡定位容器。
|
|
32
|
+
* Esc/外点 → onClose("cancel")(上层恢复触发词);面板内点选由各 popup 自行 settle。
|
|
33
|
+
* confirmOpen=true(AlertDialog 开启中)时抑制两监听——见头注释。
|
|
34
|
+
*/
|
|
35
|
+
export function PopupPanel({
|
|
36
|
+
onClose,
|
|
37
|
+
confirmOpen = false,
|
|
38
|
+
children,
|
|
39
|
+
extraInsideSelector,
|
|
40
|
+
}: {
|
|
41
|
+
onClose: (reason: CommandPopupCloseReason) => void
|
|
42
|
+
confirmOpen?: boolean
|
|
43
|
+
children: ReactNode
|
|
44
|
+
/**
|
|
45
|
+
* 额外视为「面板内」的元素选择器(外点关闭豁免,任务 3):ModelSelector 的
|
|
46
|
+
* 触发钮 open 态再点 = toggle 关闭——若触发钮不在豁免域内,外点通道(capture
|
|
47
|
+
* pointerdown,先于 click)先关面板、随后的 click toggle 又立即重开(无法用
|
|
48
|
+
* 触发钮关闭 + onMenuOpenChange(false)→(true) 抖动,任务 2 审查 Minor 实证)。
|
|
49
|
+
* 缺省 undefined = 行为零变化(command-popup 两消费者不受影响)。
|
|
50
|
+
*/
|
|
51
|
+
extraInsideSelector?: string
|
|
52
|
+
}) {
|
|
53
|
+
const panelRef = useRef<HTMLDivElement>(null)
|
|
54
|
+
// confirmOpen 镜像 ref:监听器只在 mount/unmount 时订阅,开启态切换读最新值即可
|
|
55
|
+
// (不重订阅——effect deps 只留 onClose,回调身份稳定)。
|
|
56
|
+
const confirmOpenRef = useRef(confirmOpen)
|
|
57
|
+
confirmOpenRef.current = confirmOpen
|
|
58
|
+
|
|
59
|
+
// Esc / 外点关闭(监听挂面板生命周期内)。Escape stopPropagation 吃掉事件——流式期
|
|
60
|
+
// 屏蔽 Esc-Esc 停止序列第一击(审查重点#6)。confirmOpen 时不消费:Esc 由 Base UI
|
|
61
|
+
// AlertDialog 关弹窗(取消回 popup),事件放行不再抵达停止热键(popup open 态已并入
|
|
62
|
+
// onMenuOpenChange,menuOpen=true 屏蔽 Esc-Esc 序列)。
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
65
|
+
if (event.key !== "Escape") return
|
|
66
|
+
if (confirmOpenRef.current) return
|
|
67
|
+
event.preventDefault()
|
|
68
|
+
event.stopPropagation()
|
|
69
|
+
onClose("cancel")
|
|
70
|
+
}
|
|
71
|
+
// 外点:pointerdown capture,目标不在面板内即 cancel(AlertDialog 开启时面板外
|
|
72
|
+
// 点击归弹窗语义——Base UI 自行 dismiss,popup 不 cancel)
|
|
73
|
+
const onPointerDown = (event: PointerEvent) => {
|
|
74
|
+
if (confirmOpenRef.current) return
|
|
75
|
+
const panel = panelRef.current
|
|
76
|
+
if (!panel) return
|
|
77
|
+
if (panel.contains(event.target as Node)) return
|
|
78
|
+
// 豁免域(任务 3):目标命中 extraInsideSelector(如触发钮)不视为外点——
|
|
79
|
+
// 同一交互的 click toggle 接管开关语义
|
|
80
|
+
if (
|
|
81
|
+
extraInsideSelector &&
|
|
82
|
+
event.target instanceof Element &&
|
|
83
|
+
event.target.closest(extraInsideSelector)
|
|
84
|
+
) {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
onClose("cancel")
|
|
88
|
+
}
|
|
89
|
+
document.addEventListener("keydown", onKeyDown, { capture: true })
|
|
90
|
+
document.addEventListener("pointerdown", onPointerDown, { capture: true })
|
|
91
|
+
return () => {
|
|
92
|
+
document.removeEventListener("keydown", onKeyDown, { capture: true })
|
|
93
|
+
document.removeEventListener("pointerdown", onPointerDown, { capture: true })
|
|
94
|
+
}
|
|
95
|
+
}, [onClose, extraInsideSelector])
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div
|
|
99
|
+
ref={panelRef}
|
|
100
|
+
data-command-popup=""
|
|
101
|
+
className="absolute inset-x-0 bottom-full z-20 mb-1"
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</div>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
* '/' 菜单技能触发源(P1 任务 3,skills 第二源):把技能目录(用户技能列表)包装成
|
|
20
|
+
* InputTriggerSource(trigger '/',name 'skills'),经 CommandSuggestionMenu 组件侧
|
|
21
|
+
* mount 注册(id 'builtin/skills',照 MentionSuggestionMenu 范式——源对象稳定)。
|
|
22
|
+
* **数据面 = getQueryClient seam 自拉**(fetchSkillsViaQueryClient 缺省 getter,
|
|
23
|
+
* P0 file-mention 的 fetchDirFromQueryClient 同范式):不走 useQuery/props 注入,
|
|
24
|
+
* 避免 Provider 陷阱(P0 复审 B / 整页直渲测试无 QueryClientProvider 即爆——曾以
|
|
25
|
+
* workbench-page useQuery 注入引入过该回归,修复见 task-3-report)。
|
|
26
|
+
*
|
|
27
|
+
* **纯文本形态(官方 skillPrompt)**:选中技能**不插 chip、不执行命令**——把触发词
|
|
28
|
+
* 替换为 `Use the <name> skill: ` 纯文本(ai-skills harness.js:21-24 skillPrompt
|
|
29
|
+
* 同款:task 空 → `Use the ${name} skill.`、非空 → `Use the ${name} skill: ${task}`)。
|
|
30
|
+
* 模型目录(harness skills stack)只认这一句式(裸 `/skillname` 会被当普通文本——
|
|
31
|
+
* 目录无「/ 前缀=skill」指引),composer 侧在选中时点上不知道 task(用户选中后
|
|
32
|
+
* 续敲),故统一插入冒号尾随空格形态邀请续敲;参数已紧跟插入点时省略尾随空格
|
|
33
|
+
* (见 skillPromptText)——两种路径最终文本都收敛到官方 `Use the <name> skill: <task>`。
|
|
34
|
+
*
|
|
35
|
+
* **效果边界(如实标注)**:harness 链 skills stack 内置-only(define.server.ts
|
|
36
|
+
* buildSkillsStack({}) 无 userId——per-user 技能源在 host 构建期闭包装载,多用户
|
|
37
|
+
* host 无法 per-session 装配),本源的「Use the X skill」句式在 harness 链只对
|
|
38
|
+
* **内置 skill** 生效;legacy /api/chat 链 skills stack per-user(ai-gateway
|
|
39
|
+
* buildSkillsStack)则用户技能同样生效。用户技能进 harness 目录待 host per-user
|
|
40
|
+
* 装配(独立立项)。数据面(UserSkill 表 → listSkillsFn)不受此边界影响——
|
|
41
|
+
* 目录展示与句式生成在 composer 侧,与链上技能解析解耦。
|
|
42
|
+
*
|
|
43
|
+
* **onPick 落位锚定当前光标**(replaceCommandRange 同款修法,见 command-claim-editor.ts
|
|
44
|
+
* 头注释):'/' 菜单 command() 对非 mention 触发在 onSelect 前已 deleteRange 删掉
|
|
45
|
+
* '/xxx'(suggestion-menu.tsx),传入 range 是**已删除文本的旧区间**——不参与定位,
|
|
46
|
+
* 仅作类型面守卫。删除后光标恰落在原触发词处,锚光标插入即「替换触发词」;range
|
|
47
|
+
* 之后的已敲文本(光标回移触发词重开菜单的键盘路径)自然保留在插入文本之后。
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
import type { Editor, Range } from "@tiptap/react"
|
|
51
|
+
import type { InputTriggerPickContext, InputTriggerSource, TriggerCandidate } from "../extension"
|
|
52
|
+
import { fuzzyMatch } from "../fuzzy"
|
|
53
|
+
import { getQueryClient } from "@/lib/query-client-seam"
|
|
54
|
+
import { skillsQueryOptions } from "@/lib/queries/agents"
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 技能目录最小投影(源取数的数据形状)。来源 listSkillsFn 的 SkillDTO 结构子集
|
|
58
|
+
* (name=小写技能名即 load_skill 目录键;title=人读标题),seam fetchQuery 返回的
|
|
59
|
+
* DTO 数组结构兼容直接消费。
|
|
60
|
+
*/
|
|
61
|
+
export interface ComposerSkillRef {
|
|
62
|
+
/** 小写技能名(load_skill 目录键;prompt 句式用 name 非 title) */
|
|
63
|
+
name: string
|
|
64
|
+
/** 人读标题(菜单条目主文本) */
|
|
65
|
+
title: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 技能源分组头稳定 id(菜单侧 localizeGroup → harness_command_skillsGroup)。 */
|
|
69
|
+
export const SKILLS_TRIGGER_GROUP = "skills"
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 选中技能插入的 skillPrompt 文本(官方 ai-skills harness.js:21-24 skillPrompt
|
|
73
|
+
* composer 侧形态)。`followingWhitespace`:插入点后紧跟空白(参数已敲——光标回移
|
|
74
|
+
* 触发词重开菜单的键盘路径)时省略尾随空格,避免「: 写总结」双空格——已有空白
|
|
75
|
+
* 承担分隔,最终文本仍逐字等于官方 `Use the ${name} skill: ${task}`。
|
|
76
|
+
*/
|
|
77
|
+
export function skillPromptText(
|
|
78
|
+
name: string,
|
|
79
|
+
opts?: { followingWhitespace?: boolean },
|
|
80
|
+
): string {
|
|
81
|
+
const base = `Use the ${name} skill:`
|
|
82
|
+
return opts?.followingWhitespace ? base : `${base} `
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** 插入点后首字符为「分隔型空白」(空格/全角空格/不间断空格;换行不是参数分隔)。 */
|
|
86
|
+
function isSeparatorWhitespace(ch: string): boolean {
|
|
87
|
+
return ch === " " || ch === "\u3000" || ch === "\u00a0"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 默认技能目录取数(getQueryClient seam 模块级拉取,P0 file-mention 的
|
|
92
|
+
* fetchDirFromQueryClient 同范式):**不走 useQuery/props 注入**——useQuery 需要
|
|
93
|
+
* QueryClientProvider 上下文,整页直渲测试(harness-workbench-auth-error,无
|
|
94
|
+
* Provider、HarnessComposer mock 成 null)即爆「No QueryClient set」(P0 复审 B
|
|
95
|
+
* 警告过的 Provider 陷阱变体,T5 改 getQueryClient() seam 就是为避开它)。seam 的
|
|
96
|
+
* getQueryClient() 客户端/jsdom 懒创建兜底、SSR fail-fast;取数时点在用户敲 '/'
|
|
97
|
+
* 触发 candidates(纯客户端交互,SSR 不执行)。staleTime 走 skillsQueryOptions
|
|
98
|
+
* 默认(裁决:候选实时性要求不高,缓存语义可接受)。
|
|
99
|
+
*
|
|
100
|
+
* 错误 fail-closed:fetch 失败(401/网络/未装配)→ 空目录 → 菜单无「技能」组
|
|
101
|
+
* (与 legacy 无数据 gating 同形态),不阻塞菜单其余命令。
|
|
102
|
+
*
|
|
103
|
+
* **settle 超时守卫(真机 `/` 菜单骨架永挂修复)**:`/` 菜单 items 恒为 Promise
|
|
104
|
+
* (本源是唯一 async `/` trigger),而 tiptap suggestion 插件对 async items **无超时
|
|
105
|
+
* 兜底**——`await items()` 永挂则 loading 恒 true、骨架永挂(menu-view 的
|
|
106
|
+
* `loading={items.length===0}`)。真机实测 `fetchQuery(listSkillsFn)` 可能**既不
|
|
107
|
+
* resolve 也不 reject**(服务端 Prisma 已执行、客户端 promise 不 settle,try/catch
|
|
108
|
+
* 只能兜 reject 兜不住「永不 settle」)。故用 `withTimeout` 强制本 getter 必然在
|
|
109
|
+
* SKILLS_FETCH_TIMEOUT_MS 内 settle——超时回落 `[]`,菜单优雅降级(无「技能」组、
|
|
110
|
+
* 其余命令照常),绝不阻塞整个 `/` 菜单。
|
|
111
|
+
*/
|
|
112
|
+
/** skills 取数 settle 超时(ms):超过即回落空目录,防 async source 永挂骨架。 */
|
|
113
|
+
export const SKILLS_FETCH_TIMEOUT_MS = 2500
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 给 promise 加 settle 超时:ms 内 settle 则透传其值;超时**或 reject** 均 resolve 为
|
|
117
|
+
* `fallback`(永不 reject、永不挂起)。clearTimeout 防定时器泄漏。
|
|
118
|
+
*/
|
|
119
|
+
export function withTimeout<T>(
|
|
120
|
+
promise: Promise<T>,
|
|
121
|
+
ms: number,
|
|
122
|
+
fallback: T,
|
|
123
|
+
): Promise<T> {
|
|
124
|
+
return new Promise<T>((resolve) => {
|
|
125
|
+
const timer = setTimeout(() => resolve(fallback), ms)
|
|
126
|
+
promise.then(
|
|
127
|
+
(value) => {
|
|
128
|
+
clearTimeout(timer)
|
|
129
|
+
resolve(value)
|
|
130
|
+
},
|
|
131
|
+
() => {
|
|
132
|
+
clearTimeout(timer)
|
|
133
|
+
resolve(fallback)
|
|
134
|
+
},
|
|
135
|
+
)
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export async function fetchSkillsViaQueryClient(): Promise<readonly ComposerSkillRef[]> {
|
|
140
|
+
try {
|
|
141
|
+
return await withTimeout(
|
|
142
|
+
getQueryClient().fetchQuery(skillsQueryOptions()),
|
|
143
|
+
SKILLS_FETCH_TIMEOUT_MS,
|
|
144
|
+
[],
|
|
145
|
+
)
|
|
146
|
+
} catch {
|
|
147
|
+
return []
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 技能触发源工厂。`getSkills` 缺省 = fetchSkillsViaQueryClient(seam 自拉,组件侧
|
|
153
|
+
* 零 props 链);测试/未来 DI 可注入同步 getter(注入同步时 candidates 走菜单同步
|
|
154
|
+
* 路径)。空目录([]/取数失败)→ 候选恒空 → 菜单无「技能」组(自然 gating,无需
|
|
155
|
+
* 显式旗标)。
|
|
156
|
+
*/
|
|
157
|
+
export function createBuiltinSkillSource(
|
|
158
|
+
getSkills: () =>
|
|
159
|
+
| readonly ComposerSkillRef[]
|
|
160
|
+
| Promise<readonly ComposerSkillRef[]> = fetchSkillsViaQueryClient,
|
|
161
|
+
): InputTriggerSource {
|
|
162
|
+
return {
|
|
163
|
+
trigger: "/",
|
|
164
|
+
name: "skills",
|
|
165
|
+
candidates(query: string): TriggerCandidate[] | Promise<TriggerCandidate[]> {
|
|
166
|
+
const result = getSkills()
|
|
167
|
+
if (result instanceof Promise) {
|
|
168
|
+
return result.then((skills) => filterSkillCandidates(skills, query))
|
|
169
|
+
}
|
|
170
|
+
return filterSkillCandidates(result, query)
|
|
171
|
+
},
|
|
172
|
+
onPick(candidate: TriggerCandidate, ctx: InputTriggerPickContext): void {
|
|
173
|
+
const name = candidate.data?.name
|
|
174
|
+
if (typeof name !== "string" || !name) return
|
|
175
|
+
insertSkillPrompt(ctx.editor, ctx.range, name)
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 候选映射 + 查询过滤(sync/async 两路共用单一实现):fuzzy 子序列 ∪ includes,
|
|
182
|
+
* name+title 双字段,大小写不敏感;空 query 全量首屏——mention 源同口径。
|
|
183
|
+
*/
|
|
184
|
+
function filterSkillCandidates(
|
|
185
|
+
skills: readonly ComposerSkillRef[],
|
|
186
|
+
query: string,
|
|
187
|
+
): TriggerCandidate[] {
|
|
188
|
+
const q = query.trim().toLowerCase()
|
|
189
|
+
const matches = (s: ComposerSkillRef) =>
|
|
190
|
+
!q ||
|
|
191
|
+
fuzzyMatch(q, s.name) !== null ||
|
|
192
|
+
s.name.toLowerCase().includes(q) ||
|
|
193
|
+
fuzzyMatch(q, s.title) !== null ||
|
|
194
|
+
s.title.toLowerCase().includes(q)
|
|
195
|
+
return skills.filter(matches).map((s) => ({
|
|
196
|
+
// id 前缀 skill: 与命令/mention 候选隔离(菜单 key / 重开定位)
|
|
197
|
+
id: `skill:${s.name}`,
|
|
198
|
+
// 菜单展示 title 主文本(人读),小写名走副文本;prompt 句式用 name
|
|
199
|
+
// (load_skill 目录键是小写 name,模型按目录键匹配)
|
|
200
|
+
label: s.title,
|
|
201
|
+
kind: "skill",
|
|
202
|
+
group: SKILLS_TRIGGER_GROUP,
|
|
203
|
+
subtext: s.name,
|
|
204
|
+
data: { name: s.name, title: s.title },
|
|
205
|
+
}))
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* 选中技能的插入事务:触发词已被 '/' 菜单 deleteRange 删除(见头注释),锚当前
|
|
210
|
+
* 光标插入纯文本 prompt。`range` 入参仅作类型面守卫(与 replaceCommandRange 同款:
|
|
211
|
+
* 不参与定位)。插入用 text 节点数组(字符串会被 TipTap 按 HTML 解析,数组形式
|
|
212
|
+
* 零歧义)。
|
|
213
|
+
*/
|
|
214
|
+
export function insertSkillPrompt(editor: Editor, _range: Range, name: string): void {
|
|
215
|
+
if (!editor || editor.isDestroyed) return
|
|
216
|
+
const pos = editor.state.selection.from
|
|
217
|
+
// 插入点后首字符(pos 已 clamp 到内容终点内;空 doc / 插入点即末尾 → "")
|
|
218
|
+
const docSize = editor.state.doc.content.size
|
|
219
|
+
const following = editor.state.doc.textBetween(
|
|
220
|
+
Math.min(pos, docSize),
|
|
221
|
+
Math.min(pos + 1, docSize),
|
|
222
|
+
"\n",
|
|
223
|
+
"",
|
|
224
|
+
)
|
|
225
|
+
const prompt = skillPromptText(name, { followingWhitespace: isSeparatorWhitespace(following) })
|
|
226
|
+
editor
|
|
227
|
+
.chain()
|
|
228
|
+
.focus()
|
|
229
|
+
.insertContentAt(pos, [{ type: "text", text: prompt }])
|
|
230
|
+
.run()
|
|
231
|
+
}
|