@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
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
2
|
-
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
|
3
|
-
import { ScrollText, Wand2 } from 'lucide-react'
|
|
4
|
-
import { skillsQueryOptions } from '@/lib/queries/agents'
|
|
5
|
-
import { m } from "@/paraglide/messages.js";
|
|
6
|
-
|
|
7
|
-
export interface SlashSkillMenuProps {
|
|
8
|
-
open: boolean
|
|
9
|
-
onOpenChange: (open: boolean) => void
|
|
10
|
-
trigger: React.ReactNode
|
|
11
|
-
applyTemplate: (template: string) => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface SlashSkillItem {
|
|
15
|
-
id: string
|
|
16
|
-
name: string
|
|
17
|
-
title: string
|
|
18
|
-
template: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function SlashSkillMenu({
|
|
22
|
-
open,
|
|
23
|
-
onOpenChange,
|
|
24
|
-
trigger,
|
|
25
|
-
applyTemplate,
|
|
26
|
-
}: SlashSkillMenuProps) {const { data: skills, isLoading } = useQuery({
|
|
27
|
-
...skillsQueryOptions(),
|
|
28
|
-
enabled: open,
|
|
29
|
-
staleTime: 30_000,
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Popover open={open} onOpenChange={onOpenChange}>
|
|
34
|
-
<PopoverTrigger render={trigger as React.ReactElement} />
|
|
35
|
-
<PopoverContent className="w-[240px] p-0" align="start" side="top">
|
|
36
|
-
{isLoading ? (
|
|
37
|
-
<div className="p-3 text-center text-xs text-muted-foreground">
|
|
38
|
-
{m.chat_slashCommands_loading()}
|
|
39
|
-
</div>
|
|
40
|
-
) : skills && skills.length > 0 ? (
|
|
41
|
-
<div className="flex flex-col">
|
|
42
|
-
<div className="flex flex-col max-h-60 overflow-y-auto">
|
|
43
|
-
{skills.map((skill: SlashSkillItem) => (
|
|
44
|
-
<button
|
|
45
|
-
key={skill.id}
|
|
46
|
-
type="button"
|
|
47
|
-
className="flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent transition-colors"
|
|
48
|
-
onClick={() => {
|
|
49
|
-
applyTemplate(skill.template)
|
|
50
|
-
onOpenChange(false)
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<ScrollText className="size-3.5 shrink-0 text-muted-foreground" />
|
|
54
|
-
<span className="flex-1 truncate">{skill.title}</span>
|
|
55
|
-
</button>
|
|
56
|
-
))}
|
|
57
|
-
</div>
|
|
58
|
-
<div className="border-t px-3 py-2">
|
|
59
|
-
<p className="text-xs leading-snug text-muted-foreground">
|
|
60
|
-
{m.agents_skills_menuHint()}
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
) : (
|
|
65
|
-
<div className="flex flex-col items-center gap-1 p-4 text-center">
|
|
66
|
-
<Wand2 className="size-4 text-muted-foreground" />
|
|
67
|
-
<p className="text-xs text-muted-foreground">
|
|
68
|
-
{m.chat_slashCommands_noSkills()}
|
|
69
|
-
</p>
|
|
70
|
-
</div>
|
|
71
|
-
)}
|
|
72
|
-
</PopoverContent>
|
|
73
|
-
</Popover>
|
|
74
|
-
)
|
|
75
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
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
|
-
* demo 扩展「插入需求引用」(F5-7)自证测试:
|
|
20
|
-
* - Registrar mount → controlLeft 席位注册 DemoStoryReferenceButton;unmount → 复位;
|
|
21
|
-
* - 触发按钮渲染(title/aria-label「插入需求引用」);
|
|
22
|
-
* - 交互(真实 TipTap schema):开 popover → 搜索(mock searchStoriesFn)→ 选需求 →
|
|
23
|
-
* insertMentionChip 注入 story chip(docType=story)+ ui.focus 调用;
|
|
24
|
-
* - 「引用并提问」次级动作:dispatch.send 派发提问;session 门控(本地引擎或有 key 才显示)。
|
|
25
|
-
*/
|
|
26
|
-
import { afterEach, describe, expect, it, vi } from "vitest"
|
|
27
|
-
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"
|
|
28
|
-
import { Editor } from "@tiptap/core"
|
|
29
|
-
import type { JSONContent } from "@tiptap/core"
|
|
30
|
-
import StarterKit from "@tiptap/starter-kit"
|
|
31
|
-
import {
|
|
32
|
-
DemoStoryReferenceButton,
|
|
33
|
-
DemoStoryReferenceExtensionRegistrar,
|
|
34
|
-
DEMO_STORY_REFERENCE_EXTENSION_ID,
|
|
35
|
-
} from "../demo-story-reference"
|
|
36
|
-
import { clearComposerExtensions, getComposerExtensions, getComposerSeatComponents } from "../registry"
|
|
37
|
-
import { MentionExtension } from "@/components/tiptap/node/mention-extension"
|
|
38
|
-
import type { ComposerSeatProps } from "../types"
|
|
39
|
-
|
|
40
|
-
const searchStoriesFn = vi.hoisted(() => vi.fn())
|
|
41
|
-
|
|
42
|
-
vi.mock("@/server/serverFns/story", () => ({
|
|
43
|
-
searchStoriesFn: (args: unknown) => searchStoriesFn(args),
|
|
44
|
-
}))
|
|
45
|
-
|
|
46
|
-
function makeEditor(): Editor {
|
|
47
|
-
return new Editor({ extensions: [StarterKit, MentionExtension], content: "" })
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function makeSeatProps(overrides: Partial<ComposerSeatProps> = {}): ComposerSeatProps {
|
|
51
|
-
const editor = makeEditor()
|
|
52
|
-
return {
|
|
53
|
-
draft: {
|
|
54
|
-
threadId: "t1",
|
|
55
|
-
store: { save: () => {}, load: () => null, clear: () => {} } as never,
|
|
56
|
-
editorHandle: { editor, clearAfterSend: () => {} },
|
|
57
|
-
text: "",
|
|
58
|
-
clear: () => {},
|
|
59
|
-
},
|
|
60
|
-
busy: {
|
|
61
|
-
isRunning: false,
|
|
62
|
-
sending: false,
|
|
63
|
-
busyPreference: "queue",
|
|
64
|
-
decision: { action: "send" } as never,
|
|
65
|
-
decideSubmit: () => ({ action: "send" } as never),
|
|
66
|
-
takeover: null,
|
|
67
|
-
},
|
|
68
|
-
dispatch: { send: () => {}, stop: () => {} },
|
|
69
|
-
session: {
|
|
70
|
-
threadId: "t1",
|
|
71
|
-
messages: [],
|
|
72
|
-
hasAiKey: true,
|
|
73
|
-
engine: "cloud",
|
|
74
|
-
},
|
|
75
|
-
ui: {
|
|
76
|
-
menuOpen: false,
|
|
77
|
-
placeholder: "",
|
|
78
|
-
focus: () => {},
|
|
79
|
-
setActivityActive: () => {},
|
|
80
|
-
},
|
|
81
|
-
...overrides,
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function findMentionNodes(doc: JSONContent): JSONContent[] {
|
|
86
|
-
const found: JSONContent[] = []
|
|
87
|
-
const walk = (nodes: JSONContent[] | undefined) => {
|
|
88
|
-
for (const node of nodes ?? []) {
|
|
89
|
-
if (node.type === "mention") found.push(node)
|
|
90
|
-
if (Array.isArray(node.content)) walk(node.content)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
walk(doc.content)
|
|
94
|
-
return found
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
afterEach(() => {
|
|
98
|
-
cleanup()
|
|
99
|
-
clearComposerExtensions()
|
|
100
|
-
searchStoriesFn.mockReset()
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
describe("demo 扩展「插入需求引用」注册(F5-7)", () => {
|
|
104
|
-
it("Registrar mount → controlLeft 席位注册;unmount → 复位", () => {
|
|
105
|
-
const { unmount } = render(<DemoStoryReferenceExtensionRegistrar />)
|
|
106
|
-
const ext = getComposerExtensions().find((e) => e.id === DEMO_STORY_REFERENCE_EXTENSION_ID)
|
|
107
|
-
expect(ext).toBeDefined()
|
|
108
|
-
expect(getComposerSeatComponents("controlLeft")).toContain(DemoStoryReferenceButton)
|
|
109
|
-
unmount()
|
|
110
|
-
expect(getComposerExtensions().find((e) => e.id === DEMO_STORY_REFERENCE_EXTENSION_ID)).toBeUndefined()
|
|
111
|
-
expect(getComposerSeatComponents("controlLeft")).not.toContain(DemoStoryReferenceButton)
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
describe("DemoStoryReferenceButton(seat props 四域消费)", () => {
|
|
116
|
-
it("渲染触发按钮(title/aria-label「插入需求引用」)", () => {
|
|
117
|
-
render(<DemoStoryReferenceButton {...makeSeatProps()} />)
|
|
118
|
-
expect(screen.getByRole("button", { name: "插入需求引用" })).toBeTruthy()
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it("开搜索 → 选需求 → insertMentionChip 注入 story chip + ui.focus", async () => {
|
|
122
|
-
searchStoriesFn.mockResolvedValue([
|
|
123
|
-
{ id: "st-1", title: "登录页", identifier: "STORY-1" },
|
|
124
|
-
])
|
|
125
|
-
const focus = vi.fn()
|
|
126
|
-
const props = makeSeatProps({ ui: { menuOpen: false, placeholder: "", focus, setActivityActive: () => {} } })
|
|
127
|
-
render(<DemoStoryReferenceButton {...props} />)
|
|
128
|
-
|
|
129
|
-
// 开 popover
|
|
130
|
-
fireEvent.click(screen.getByRole("button", { name: "插入需求引用" }))
|
|
131
|
-
const input = await waitFor(() => screen.getByPlaceholderText("搜索需求…"))
|
|
132
|
-
fireEvent.change(input, { target: { value: "登录" } })
|
|
133
|
-
|
|
134
|
-
// 结果出现(mock serverFn 返回)
|
|
135
|
-
const hit = await waitFor(() => screen.getByRole("button", { name: "插入引用:STORY-1" }))
|
|
136
|
-
expect(searchStoriesFn).toHaveBeenCalledWith({ data: { query: "登录" } })
|
|
137
|
-
|
|
138
|
-
// 选中 → 编辑器注入 story chip
|
|
139
|
-
const editor = props.draft.editorHandle?.editor
|
|
140
|
-
fireEvent.click(hit)
|
|
141
|
-
const mentions = findMentionNodes(editor!.getJSON())
|
|
142
|
-
expect(mentions).toHaveLength(1)
|
|
143
|
-
expect(mentions[0].attrs?.id).toBe("st-1")
|
|
144
|
-
expect(mentions[0].attrs?.docType).toBe("story")
|
|
145
|
-
expect(focus).toHaveBeenCalledTimes(1)
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
it("「引用并提问」→ dispatch.send 派发提问(云端有 key 可见)", async () => {
|
|
149
|
-
searchStoriesFn.mockResolvedValue([
|
|
150
|
-
{ id: "st-1", title: "登录页", identifier: "STORY-1" },
|
|
151
|
-
])
|
|
152
|
-
const send = vi.fn()
|
|
153
|
-
render(<DemoStoryReferenceButton {...makeSeatProps({ dispatch: { send, stop: () => {} } })} />)
|
|
154
|
-
fireEvent.click(screen.getByRole("button", { name: "插入需求引用" }))
|
|
155
|
-
await waitFor(() => screen.getByPlaceholderText("搜索需求…"))
|
|
156
|
-
const input = screen.getByPlaceholderText("搜索需求…")
|
|
157
|
-
fireEvent.change(input, { target: { value: "登录" } })
|
|
158
|
-
const ask = await waitFor(() => screen.getByRole("button", { name: "引用并提问:STORY-1" }))
|
|
159
|
-
fireEvent.click(ask)
|
|
160
|
-
expect(send).toHaveBeenCalledWith(expect.stringContaining("STORY-1"))
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
it("session 门控:云端无 key → 无「引用并提问」(插入引用仍可用)", async () => {
|
|
164
|
-
searchStoriesFn.mockResolvedValue([
|
|
165
|
-
{ id: "st-1", title: "登录页", identifier: "STORY-1" },
|
|
166
|
-
])
|
|
167
|
-
render(<DemoStoryReferenceButton {...makeSeatProps({
|
|
168
|
-
session: { threadId: "t1", messages: [], hasAiKey: false, engine: "cloud" },
|
|
169
|
-
})} />)
|
|
170
|
-
fireEvent.click(screen.getByRole("button", { name: "插入需求引用" }))
|
|
171
|
-
await waitFor(() => screen.getByPlaceholderText("搜索需求…"))
|
|
172
|
-
const input = screen.getByPlaceholderText("搜索需求…")
|
|
173
|
-
fireEvent.change(input, { target: { value: "登录" } })
|
|
174
|
-
await waitFor(() => screen.getByRole("button", { name: "插入引用:STORY-1" }))
|
|
175
|
-
expect(screen.queryByRole("button", { name: "引用并提问:STORY-1" })).toBeNull()
|
|
176
|
-
})
|
|
177
|
-
})
|
package/src/components/harness/conversation-panel/composer/extension/demo-story-reference.tsx
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
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
|
-
* Demo 扩展「插入需求引用」(F5-7,规格 §4.4 扩展体系 API 完备性自证)。
|
|
20
|
-
*
|
|
21
|
-
* **dogfood 自证**:本扩展**不改 composer 本体**,纯经
|
|
22
|
-
* `registerComposerExtension({ seats: { controlLeft: [...] } })` 挂入——证明 F5-1
|
|
23
|
-
* 席位 API 完备到「平台能力以扩展形态接入」即可交付一个用户可见功能。
|
|
24
|
-
*
|
|
25
|
-
* **消费 ComposerSeatProps 四域**(验证 API 完备性,逐域说明):
|
|
26
|
-
* - draft:经 `draft.editorHandle.editor`(live getter)拿 TipTap 实例,复用
|
|
27
|
-
* harness-composer 的 `insertMentionChip` 注入 story 原子 chip(API 边界:
|
|
28
|
-
* insertMentionChip 是本体导出的纯函数,席位组件可直接 import 调用;本扩展
|
|
29
|
-
* 经 workbench-page 挂 Registrar,与 harness-composer 单向依赖、无环)。
|
|
30
|
-
* - ui:插入后 `ui.focus()` 焦点回编辑器 + 关闭本扩展自己的 popover。
|
|
31
|
-
* - session:读 `session.engine` / `session.hasAiKey` 判断「引用并提问」次级
|
|
32
|
-
* 动作是否可用(有 AI 应答通道 = 本地 ACP 引擎 或 云端已配 key)。
|
|
33
|
-
* - dispatch:次级动作「引用并提问」经 `dispatch.send(text)` 走 composer 发送
|
|
34
|
-
* 管线(与主按钮/键路径同入口)派发一个引用该需求的提问。
|
|
35
|
-
*
|
|
36
|
-
* 搜索复用 story 域既有 `searchStoriesFn`(serverFn,与 bug 关联需求选择器 /
|
|
37
|
-
* story search-popover 同源)。为最小实现,本 demo 直接每次输入触发查询(未接
|
|
38
|
-
* pacer 防抖)——生产化时应改 `useDebouncedCallback`(demo 不引入额外复杂度)。
|
|
39
|
-
*
|
|
40
|
-
* 注册形态沿用 builtin/voice 先例(组件侧 mount 注册 / unmount dispose,见
|
|
41
|
-
* voice-activity.tsx):Registrar 在 harness-workbench-page 挂载点渲染,mount 注册
|
|
42
|
-
* controlLeft 席、unmount dispose;注册表 module-level、render 期读最新注册。
|
|
43
|
-
*/
|
|
44
|
-
import { useCallback, useEffect, useState } from "react"
|
|
45
|
-
import { Quote, Sparkles } from "lucide-react"
|
|
46
|
-
import { Button } from "@/components/ui/button"
|
|
47
|
-
import { Input } from "@/components/ui/input"
|
|
48
|
-
import {
|
|
49
|
-
Popover,
|
|
50
|
-
PopoverContent,
|
|
51
|
-
PopoverTrigger,
|
|
52
|
-
} from "@/components/ui/popover"
|
|
53
|
-
import { searchStoriesFn } from "@/server/serverFns/story"
|
|
54
|
-
import { insertMentionChip } from "../harness-composer"
|
|
55
|
-
import type { ComposerExtension, ComposerSeatProps } from "./types"
|
|
56
|
-
import type { PrefillMentionEntity } from "../harness-composer"
|
|
57
|
-
import { registerComposerExtension } from "./registry"
|
|
58
|
-
|
|
59
|
-
/** demo 扩展稳定 id(诊断 / 测试断言用) */
|
|
60
|
-
export const DEMO_STORY_REFERENCE_EXTENSION_ID = "demo/story-reference"
|
|
61
|
-
|
|
62
|
-
/** searchStoriesFn 返回的需求条目(id/title/identifier) */
|
|
63
|
-
interface StoryHit {
|
|
64
|
-
id: string
|
|
65
|
-
title: string
|
|
66
|
-
identifier: string
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* controlLeft 席位组件:引用按钮 → 轻量 story 搜索 popover → 选中插入引用 chip。
|
|
71
|
-
* 消费 draft / ui / session / dispatch 四域(见文件头逐域说明)。
|
|
72
|
-
*/
|
|
73
|
-
export function DemoStoryReferenceButton(props: ComposerSeatProps) {
|
|
74
|
-
const { draft, dispatch, session, ui } = props
|
|
75
|
-
const [open, setOpen] = useState(false)
|
|
76
|
-
const [query, setQuery] = useState("")
|
|
77
|
-
const [results, setResults] = useState<StoryHit[]>([])
|
|
78
|
-
const [loading, setLoading] = useState(false)
|
|
79
|
-
|
|
80
|
-
// session 域消费:有 AI 应答通道(本地 ACP 或云端已配 key)才提供「引用并提问」;
|
|
81
|
-
// 「插入引用」是纯客户端 chip 注入,不依赖 AI,恒可用。
|
|
82
|
-
const canAsk = session.engine === "local" || session.hasAiKey
|
|
83
|
-
|
|
84
|
-
const runSearch = useCallback(async (q: string) => {
|
|
85
|
-
const trimmed = q.trim()
|
|
86
|
-
if (!trimmed) {
|
|
87
|
-
setResults([])
|
|
88
|
-
setLoading(false)
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
setLoading(true)
|
|
92
|
-
try {
|
|
93
|
-
const items = await searchStoriesFn({ data: { query: trimmed } })
|
|
94
|
-
setResults(items)
|
|
95
|
-
} catch {
|
|
96
|
-
setResults([])
|
|
97
|
-
} finally {
|
|
98
|
-
setLoading(false)
|
|
99
|
-
}
|
|
100
|
-
}, [])
|
|
101
|
-
|
|
102
|
-
const handleQueryChange = (value: string) => {
|
|
103
|
-
setQuery(value)
|
|
104
|
-
void runSearch(value)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const close = useCallback(() => {
|
|
108
|
-
setOpen(false)
|
|
109
|
-
setQuery("")
|
|
110
|
-
setResults([])
|
|
111
|
-
setLoading(false)
|
|
112
|
-
}, [])
|
|
113
|
-
|
|
114
|
-
// draft + ui 域消费:复用本体 insertMentionChip 注入 story 原子 chip + 焦点回编辑器。
|
|
115
|
-
const insertReference = (story: StoryHit) => {
|
|
116
|
-
const editor = draft.editorHandle?.editor
|
|
117
|
-
if (!editor || editor.isDestroyed) return
|
|
118
|
-
const entity: PrefillMentionEntity = {
|
|
119
|
-
kind: "story",
|
|
120
|
-
id: story.id,
|
|
121
|
-
label: `${story.identifier} ${story.title}`,
|
|
122
|
-
}
|
|
123
|
-
insertMentionChip(editor, entity)
|
|
124
|
-
ui.focus()
|
|
125
|
-
close()
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// dispatch 域消费:经 composer 发送管线派发一个引用该需求的提问。
|
|
129
|
-
const askAbout = (story: StoryHit) => {
|
|
130
|
-
dispatch.send(`请结合需求 ${story.identifier}(${story.title})帮我分析:`)
|
|
131
|
-
close()
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<Popover open={open} onOpenChange={setOpen}>
|
|
136
|
-
<PopoverTrigger
|
|
137
|
-
render={
|
|
138
|
-
<Button
|
|
139
|
-
type="button"
|
|
140
|
-
variant="ghost"
|
|
141
|
-
size="icon"
|
|
142
|
-
title="插入需求引用"
|
|
143
|
-
aria-label="插入需求引用"
|
|
144
|
-
>
|
|
145
|
-
<Quote className="size-4" />
|
|
146
|
-
</Button>
|
|
147
|
-
}
|
|
148
|
-
/>
|
|
149
|
-
<PopoverContent className="w-80 p-0" align="start">
|
|
150
|
-
<div className="flex items-center gap-2 border-b px-3 py-2">
|
|
151
|
-
<Quote className="size-4 shrink-0 opacity-50" />
|
|
152
|
-
<Input
|
|
153
|
-
placeholder="搜索需求…"
|
|
154
|
-
value={query}
|
|
155
|
-
onChange={(e) => handleQueryChange(e.target.value)}
|
|
156
|
-
className="h-8 border-none bg-transparent text-sm shadow-none focus-visible:ring-0"
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
<div className="max-h-64 overflow-y-auto p-1">
|
|
160
|
-
{loading ? (
|
|
161
|
-
<div className="px-3 py-4 text-center text-sm text-muted-foreground">
|
|
162
|
-
搜索中…
|
|
163
|
-
</div>
|
|
164
|
-
) : results.length > 0 ? (
|
|
165
|
-
results.map((story) => (
|
|
166
|
-
<div key={story.id} className="flex items-center gap-1">
|
|
167
|
-
<Button
|
|
168
|
-
type="button"
|
|
169
|
-
variant="ghost"
|
|
170
|
-
className="flex-1 justify-start gap-2 px-2 font-normal"
|
|
171
|
-
aria-label={`插入引用:${story.identifier}`}
|
|
172
|
-
onClick={() => insertReference(story)}
|
|
173
|
-
>
|
|
174
|
-
<span className="font-mono text-xs text-muted-foreground">
|
|
175
|
-
{story.identifier}
|
|
176
|
-
</span>
|
|
177
|
-
<span className="truncate">{story.title}</span>
|
|
178
|
-
</Button>
|
|
179
|
-
{canAsk && (
|
|
180
|
-
<Button
|
|
181
|
-
type="button"
|
|
182
|
-
variant="ghost"
|
|
183
|
-
size="icon"
|
|
184
|
-
title={`引用并提问:${story.identifier}`}
|
|
185
|
-
aria-label={`引用并提问:${story.identifier}`}
|
|
186
|
-
onClick={() => askAbout(story)}
|
|
187
|
-
>
|
|
188
|
-
<Sparkles className="size-4" />
|
|
189
|
-
</Button>
|
|
190
|
-
)}
|
|
191
|
-
</div>
|
|
192
|
-
))
|
|
193
|
-
) : (
|
|
194
|
-
<div className="px-3 py-4 text-center text-sm text-muted-foreground">
|
|
195
|
-
{query.trim() ? "没有匹配的需求" : "输入关键词搜索需求"}
|
|
196
|
-
</div>
|
|
197
|
-
)}
|
|
198
|
-
</div>
|
|
199
|
-
</PopoverContent>
|
|
200
|
-
</Popover>
|
|
201
|
-
)
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/** demo 扩展(controlLeft 席位注册体) */
|
|
205
|
-
const demoStoryReferenceExtension: ComposerExtension = {
|
|
206
|
-
id: DEMO_STORY_REFERENCE_EXTENSION_ID,
|
|
207
|
-
seats: { controlLeft: [DemoStoryReferenceButton] },
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export { demoStoryReferenceExtension }
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* demo 扩展注册器:harness-workbench-page 挂载点。mount 注册 / unmount dispose
|
|
214
|
-
* (StrictMode 双挂载安全——dispose 幂等,重复注册同 id 前先卸载);注册后
|
|
215
|
-
* setState 触发再渲染,让 controlLeft 席位首帧后即读得注册(registry 是
|
|
216
|
-
* module-level 可变数组,注册本身不触发渲染)。与 builtin/voice 的
|
|
217
|
-
* BuiltinVoiceExtensionRegistrar 同款。
|
|
218
|
-
*/
|
|
219
|
-
export function DemoStoryReferenceExtensionRegistrar() {
|
|
220
|
-
const [, setRegistered] = useState(false)
|
|
221
|
-
useEffect(() => {
|
|
222
|
-
const dispose = registerComposerExtension(demoStoryReferenceExtension)
|
|
223
|
-
setRegistered(true)
|
|
224
|
-
return dispose
|
|
225
|
-
}, [])
|
|
226
|
-
return null
|
|
227
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
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
|
-
import { useState, useEffect } from "react";
|
|
20
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
|
21
|
-
import { Puzzle, Package } from "lucide-react";
|
|
22
|
-
import { getLoadedPlugins } from "@/lib/plugin-runtime/plugin-client";
|
|
23
|
-
import { m } from "@/paraglide/messages.js";
|
|
24
|
-
|
|
25
|
-
export interface PluginMentionMenuProps {
|
|
26
|
-
open: boolean;
|
|
27
|
-
onOpenChange: (open: boolean) => void;
|
|
28
|
-
/** PopoverTrigger render 的宿主元素(通常是 textarea 容器) */
|
|
29
|
-
trigger: React.ReactElement;
|
|
30
|
-
applyMention: (toolName: string) => void;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface PluginToolItem {
|
|
34
|
-
pluginId: string;
|
|
35
|
-
toolName: string;
|
|
36
|
-
description: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function PluginMentionMenu({
|
|
40
|
-
open,
|
|
41
|
-
onOpenChange,
|
|
42
|
-
trigger,
|
|
43
|
-
applyMention,
|
|
44
|
-
}: PluginMentionMenuProps) {
|
|
45
|
-
const [plugins, setPlugins] = useState<PluginToolItem[]>([]);
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (!open) return;
|
|
49
|
-
const loadedPlugins = getLoadedPlugins();
|
|
50
|
-
const tools: PluginToolItem[] = [];
|
|
51
|
-
for (const plugin of loadedPlugins) {
|
|
52
|
-
for (const tool of plugin.tools) {
|
|
53
|
-
tools.push({
|
|
54
|
-
pluginId: plugin.pluginId,
|
|
55
|
-
toolName: tool.name,
|
|
56
|
-
description: tool.description,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
setPlugins(tools);
|
|
61
|
-
}, [open]);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<Popover open={open} onOpenChange={onOpenChange}>
|
|
65
|
-
<PopoverTrigger render={trigger} />
|
|
66
|
-
<PopoverContent className="w-[280px] p-0" align="start" side="top">
|
|
67
|
-
<div className="flex items-center gap-2 border-b px-3 py-2">
|
|
68
|
-
<Puzzle className="size-3.5 text-muted-foreground" />
|
|
69
|
-
<span className="text-xs font-medium">{m.harness_plugin_mentionTitle()}</span>
|
|
70
|
-
</div>
|
|
71
|
-
{plugins.length === 0 ? (
|
|
72
|
-
<div className="flex flex-col items-center gap-1 p-4 text-center">
|
|
73
|
-
<Package className="size-4 text-muted-foreground" />
|
|
74
|
-
<p className="text-xs text-muted-foreground">
|
|
75
|
-
{m.harness_plugin_mentionEmpty()}
|
|
76
|
-
</p>
|
|
77
|
-
</div>
|
|
78
|
-
) : (
|
|
79
|
-
<div className="flex flex-col max-h-60 overflow-y-auto">
|
|
80
|
-
{plugins.map((tool) => (
|
|
81
|
-
<button
|
|
82
|
-
key={`${tool.pluginId}-${tool.toolName}`}
|
|
83
|
-
type="button"
|
|
84
|
-
className="flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent transition-colors"
|
|
85
|
-
onClick={() => {
|
|
86
|
-
applyMention(tool.toolName);
|
|
87
|
-
onOpenChange(false);
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
<Puzzle className="size-3.5 shrink-0 text-muted-foreground" />
|
|
91
|
-
<div className="flex-1 min-w-0">
|
|
92
|
-
<div className="truncate font-medium">{tool.toolName}</div>
|
|
93
|
-
{tool.description && (
|
|
94
|
-
<div className="truncate text-xs text-muted-foreground">
|
|
95
|
-
{tool.description}
|
|
96
|
-
</div>
|
|
97
|
-
)}
|
|
98
|
-
</div>
|
|
99
|
-
<span className="shrink-0 text-[10px] text-muted-foreground">
|
|
100
|
-
@{tool.pluginId}
|
|
101
|
-
</span>
|
|
102
|
-
</button>
|
|
103
|
-
))}
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
</PopoverContent>
|
|
107
|
-
</Popover>
|
|
108
|
-
);
|
|
109
|
-
}
|