@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
|
@@ -25,15 +25,19 @@ import StarterKit from "@tiptap/starter-kit"
|
|
|
25
25
|
import Placeholder from "@tiptap/extension-placeholder"
|
|
26
26
|
import { history } from "@tiptap/pm/history"
|
|
27
27
|
import { MentionExtension } from "@/components/tiptap/node/mention-extension"
|
|
28
|
+
import { dockRegistry } from "@/components/harness/extension-panel/dock/dock-registry"
|
|
29
|
+
import { buildThreadFileUri } from "@/components/harness/extension-panel/dock/resource-uri"
|
|
28
30
|
import { CommandChip } from "./command/command-chip"
|
|
29
31
|
import { adjudicateSpaceClaim } from "./command/command-claim-editor"
|
|
32
|
+
import { CommandPopup, type CommandPopupCloseReason } from "./command/command-popup"
|
|
33
|
+
import { PermissionPopup } from "./permission/permission-popup"
|
|
30
34
|
import { MentionSuggestionMenu } from "./mention/mention-suggestion-menu"
|
|
31
35
|
import { CommandSuggestionMenu } from "./command/command-suggestion-menu"
|
|
32
36
|
import { draftsStore } from "./use-drafts"
|
|
33
37
|
import { useDebouncer } from "@/lib/pacer"
|
|
34
38
|
import { createComposerKeyDownHandler, createCompositionGuard } from "./composer-keymap"
|
|
35
39
|
import { m } from "@/paraglide/messages.js"
|
|
36
|
-
import type { ComposerDraftApi, ComposerServerCommand } from "./extension"
|
|
40
|
+
import type { ComposerClientCommand, ComposerDraftApi, ComposerServerCommand } from "./extension"
|
|
37
41
|
|
|
38
42
|
const DRAFT_KEY_PREFIX = "draft"
|
|
39
43
|
|
|
@@ -133,10 +137,22 @@ export interface ComposerEditorHandle {
|
|
|
133
137
|
* + draftsStore.clear
|
|
134
138
|
*/
|
|
135
139
|
clearAfterSend: () => void
|
|
140
|
+
/**
|
|
141
|
+
* 打开 popup 型命令浮层(任务 10 `+` 菜单入口):**复用 '/' 菜单的同一 popup
|
|
142
|
+
* state**(/model、/permission 共享单例)。restoreToken 由调用方给出——`/` 菜单
|
|
143
|
+
* 传规范触发词(取消路径恢复),`+` 菜单入口恒 null(无触发词可恢复,取消零插入)。
|
|
144
|
+
*/
|
|
145
|
+
openPopup: (kind: "model" | "permission", restoreToken: string | null) => void
|
|
136
146
|
}
|
|
137
147
|
|
|
138
148
|
export interface ComposerEditorProps {
|
|
139
149
|
threadId: string
|
|
150
|
+
/**
|
|
151
|
+
* 未兜底的 threadId(null = 会话未建立空态):透传给 @ 菜单 file 源 gating
|
|
152
|
+
* (rawThreadId null → 工作区文件候选恒空,不发工作区查询)。区别于 threadId 的
|
|
153
|
+
* ?? "default" 兜底值——兜底值会让空态误用 "default" 去查工作区。
|
|
154
|
+
*/
|
|
155
|
+
rawThreadId?: string | null
|
|
140
156
|
editable: boolean
|
|
141
157
|
onTextChange: (isEmpty: boolean) => void
|
|
142
158
|
editorRef?: (editor: ReturnType<typeof useEditor>) => void
|
|
@@ -166,10 +182,56 @@ export interface ComposerEditorProps {
|
|
|
166
182
|
/** draft 域('/' 菜单 client 命令执行上下文;缺省不挂 '/' 菜单——非工作台
|
|
167
183
|
* 消费方零变化) */
|
|
168
184
|
draft?: ComposerDraftApi
|
|
185
|
+
/** 打开系统文件选择器('/' 菜单 /file 命令执行体;harness-composer 的隐藏
|
|
186
|
+
* input[type=file].click) */
|
|
187
|
+
openFilePicker?: () => void
|
|
188
|
+
/** 附件能力开关(= !localEngine;false 时 '/' 菜单 /file 门控关闭、不进菜单) */
|
|
189
|
+
attachmentsEnabled?: boolean
|
|
190
|
+
/** 模型目录(/model popup 门控 + 数据源;空 = /model 不进菜单) */
|
|
191
|
+
models?: ReadonlyArray<string>
|
|
192
|
+
/** 当前会话模型(popup 高亮当前项) */
|
|
193
|
+
model?: string
|
|
194
|
+
/** 切换当前会话模型(popup 点选 settle 路径) */
|
|
195
|
+
onModelChange?: (model: string) => void
|
|
196
|
+
/** /permission 门控(任务 9):harness 客户端启用 + threadId 非空 + 沙箱 entitlement
|
|
197
|
+
* 放行——false 时 /permission 不进菜单(fail-closed 缺省,非 harness 消费方零变化) */
|
|
198
|
+
permissionEnabled?: boolean
|
|
199
|
+
/**
|
|
200
|
+
* /undo 门控(P1 任务 2):canRevertLastTurn(harness-composer 透传 workbench-page
|
|
201
|
+
* 判定)→ '/' 菜单 canRevertLastTurn prop(undoEnabled 旗标)。执行通路本体在
|
|
202
|
+
* clientCommands(harness-composer 的 ctx.undo 装入 run),本组件只透传门控布尔。
|
|
203
|
+
*/
|
|
204
|
+
canRevertLastTurn?: boolean
|
|
205
|
+
/**
|
|
206
|
+
* /plan 门控(P2 任务 2):canPlan(harness-composer 透传 workbench-page 判定)→
|
|
207
|
+
* '/' 菜单 canPlan prop(planEnabled 旗标)。执行通路本体在 clientCommands
|
|
208
|
+
* (harness-composer 的 ctx.plan 装入 run),本组件只透传门控布尔。
|
|
209
|
+
*/
|
|
210
|
+
canPlan?: boolean
|
|
211
|
+
/**
|
|
212
|
+
* /permission 空态选档回调(用户裁决 2026-11-20 对齐 DSH blank 会话):threadId 为空
|
|
213
|
+
* 时 PermissionPopup 选档不走 setSandboxPolicy,改上报 pending 档(harness-composer
|
|
214
|
+
* 透传 workbench 记槽、建线落库)。本组件只透传。
|
|
215
|
+
*/
|
|
216
|
+
onPendingPolicyLevel?: (level: string) => void
|
|
217
|
+
/**
|
|
218
|
+
* 内置客户端命令(任务 10 提升共享):harness-composer useMemo 构造的共享实例,
|
|
219
|
+
* 透传给 '/' 菜单(与 `+` 菜单同一份——label i18n 求值时点不分叉)。缺省回落
|
|
220
|
+
* 菜单内本地构造(非工作台消费方零变化)。
|
|
221
|
+
*/
|
|
222
|
+
clientCommands?: ComposerClientCommand[]
|
|
223
|
+
/**
|
|
224
|
+
* frozen 守卫(任务 11):true = @ / '/' 两 suggestion 菜单全禁(T2 的 disabled
|
|
225
|
+
* 机制:立即关闭 + 不再触发)。由 harness-composer 计算
|
|
226
|
+
* `frozen = sending === true || takeover !== null` 传入。缺省 undefined =
|
|
227
|
+
* 恒不禁用,非 harness 消费方零变化。
|
|
228
|
+
*/
|
|
229
|
+
frozen?: boolean
|
|
169
230
|
}
|
|
170
231
|
|
|
171
232
|
export function ComposerEditor({
|
|
172
233
|
threadId,
|
|
234
|
+
rawThreadId,
|
|
173
235
|
editable,
|
|
174
236
|
onTextChange,
|
|
175
237
|
editorRef,
|
|
@@ -184,6 +246,17 @@ export function ComposerEditor({
|
|
|
184
246
|
commands,
|
|
185
247
|
onRunCommand,
|
|
186
248
|
draft,
|
|
249
|
+
openFilePicker,
|
|
250
|
+
attachmentsEnabled,
|
|
251
|
+
models,
|
|
252
|
+
model,
|
|
253
|
+
onModelChange,
|
|
254
|
+
permissionEnabled,
|
|
255
|
+
canRevertLastTurn,
|
|
256
|
+
canPlan,
|
|
257
|
+
onPendingPolicyLevel,
|
|
258
|
+
clientCommands,
|
|
259
|
+
frozen,
|
|
187
260
|
}: ComposerEditorProps) {
|
|
188
261
|
const draftKey = `${DRAFT_KEY_PREFIX}:${threadId}`
|
|
189
262
|
// 草稿落盘防抖(pacer,禁止手写 setTimeout):避免逐键全量重写 sessionStorage。
|
|
@@ -208,14 +281,28 @@ export function ComposerEditor({
|
|
|
208
281
|
// 前固化,ref 保证裁定读最新 commands prop(服务端命令到位后 Space 生效)。
|
|
209
282
|
const commandsRef = useRef(commands)
|
|
210
283
|
commandsRef.current = commands
|
|
284
|
+
// client 命令集镜像(P2 任务 1,Space 裁定并入 client input 命令):同 commandsRef
|
|
285
|
+
// 口径——keymap 固化早于 editor 就绪,ref 保证裁定读最新 clientCommands prop。
|
|
286
|
+
const clientCommandsRef = useRef(clientCommands)
|
|
287
|
+
clientCommandsRef.current = clientCommands
|
|
211
288
|
// Space 裁定回调经 ref 间接(keymap deps 固化早于 editor 就绪),stable wrapper 读 ref。
|
|
212
289
|
const spaceAdjudicateRef = useRef<(view: EditorView) => boolean>(() => false)
|
|
290
|
+
// pending 守卫镜像(审查 finding 1):@ / '/' 菜单取数窗口 ref——SuggestionMenu
|
|
291
|
+
// 经 onPendingChange 在插件派发时点(onStart/onUpdate/onExit/注销 cleanup)同步
|
|
292
|
+
// 写入,keymap keydown 时刻读 ref(不经 React 渲染,时效满足「插件派发与
|
|
293
|
+
// keydown 之间可见」)。两菜单共用一个 ref:触发词互斥(@ 与 '/' 不同时激活),
|
|
294
|
+
// 退出路径(onExit/cleanup)双复位不搁浅。
|
|
295
|
+
const pendingRef = useRef(false)
|
|
296
|
+
const handlePendingChange = useCallback((pending: boolean) => {
|
|
297
|
+
pendingRef.current = pending
|
|
298
|
+
}, [])
|
|
213
299
|
const handleKeyDown = useMemo(
|
|
214
300
|
() =>
|
|
215
301
|
createComposerKeyDownHandler({
|
|
216
302
|
onSubmit: (modifierKey) => onSubmitRef.current?.(modifierKey),
|
|
217
303
|
compositionGuard,
|
|
218
304
|
onSpaceAdjudicate: (view) => spaceAdjudicateRef.current(view),
|
|
305
|
+
isPending: () => pendingRef.current,
|
|
219
306
|
}),
|
|
220
307
|
[compositionGuard],
|
|
221
308
|
)
|
|
@@ -258,11 +345,28 @@ export function ComposerEditor({
|
|
|
258
345
|
content: resolvedDraft,
|
|
259
346
|
editorProps: {
|
|
260
347
|
attributes: {
|
|
348
|
+
// min-h-12(3rem = 容器 min-h-18(72px) − p-3 上下(24px),2026-11-20 任务 B
|
|
349
|
+
// 需求 3):contenteditable 覆盖容器整个内容区——无内容时下方区域点击也落在
|
|
350
|
+
// contenteditable 上(cursor 天生 text),不再出现「只有第一行有点击光标」。
|
|
261
351
|
class:
|
|
262
|
-
"focus:outline-none max-h-[calc(14*1.625rem)] overflow-y-auto text-sm",
|
|
352
|
+
"focus:outline-none min-h-12 max-h-[calc(14*1.625rem)] overflow-y-auto text-sm",
|
|
263
353
|
"aria-label": m.harness_composer_ariaLabel(),
|
|
264
354
|
},
|
|
265
355
|
handleKeyDown,
|
|
356
|
+
// file chip 点击(任务 6):点 @工作区文件 chip(span[data-type=mention][data-path])
|
|
357
|
+
// 在右侧 files dock 打开对应文件。返回 false 不消费事件——让浏览器照常把光标落到
|
|
358
|
+
// chip 处,打开 dock 是附带副作用(dockRegistry.openResource 模块单例,客户端安全)。
|
|
359
|
+
// rawThreadId 缺失(会话未建立空态)或 chip 无 path 时直接放行,不触发。
|
|
360
|
+
handleClick: (view, _pos, event) => {
|
|
361
|
+
const el = (event.target as HTMLElement).closest(
|
|
362
|
+
'span[data-type="mention"][data-path]',
|
|
363
|
+
)
|
|
364
|
+
if (!el) return false
|
|
365
|
+
const path = el.getAttribute("data-path")
|
|
366
|
+
if (!path || !rawThreadId) return false
|
|
367
|
+
dockRegistry.openResource(buildThreadFileUri(rawThreadId, path))
|
|
368
|
+
return false
|
|
369
|
+
},
|
|
266
370
|
// T6 三入口之二:剪贴板带文件(截图/复制图片)→ 交给 onPasteFiles 走
|
|
267
371
|
// 附件引用管道并 return true 消费(阻止 ProseMirror 默认插入);纯文本
|
|
268
372
|
// 无文件 → false 照常粘贴。白名单校验收敛在 useAttachments(fail-closed)
|
|
@@ -308,21 +412,62 @@ export function ComposerEditor({
|
|
|
308
412
|
})
|
|
309
413
|
const editorRefHolder = useRef(editor)
|
|
310
414
|
editorRefHolder.current = editor
|
|
311
|
-
//
|
|
312
|
-
//
|
|
313
|
-
//
|
|
415
|
+
// popup 型命令浮层状态(/model,任务 8):{ kind, restoreToken } | null。restoreToken
|
|
416
|
+
// 为选中 popup 命令的规范触发词(`/model `)——取消路径(Esc/外点,非 settle)经
|
|
417
|
+
// editor.insertContent 恢复触发词;选中 settle 不恢复。
|
|
418
|
+
const [popup, setPopup] = useState<{ kind: "model" | "permission"; restoreToken: string | null } | null>(null)
|
|
419
|
+
// popup state 镜像 ref:closePopup 在 setState **外**读当前值执行恢复副作用(updater 保持
|
|
420
|
+
// 纯函数——未来启用 React StrictMode 不会双插触发词)。
|
|
421
|
+
const popupRef = useRef<{ kind: "model" | "permission"; restoreToken: string | null } | null>(null)
|
|
422
|
+
popupRef.current = popup
|
|
423
|
+
// popup open 态并入 onMenuOpenChange 通道(审查重点#6):与 @ 菜单 / '/' 菜单共用同一
|
|
424
|
+
// menuOpen 信号——popup 开 → onMenuOpenChange(true),关 → (false)。流式期(isRunning)
|
|
425
|
+
// 用户开 popup 按 Esc 时,Esc-Esc 停止序列(harness-composer,enabled: isRunning &&
|
|
426
|
+
// !menuOpen)因 menuOpen=true 被屏蔽;且 popup 面板自身 Escape capture stopPropagation
|
|
427
|
+
// 让第一击 Esc 不抵达停止热键监听(序列不武装),Esc 只关 popup、不误停生成。
|
|
428
|
+
const openPopup = useCallback(
|
|
429
|
+
(kind: "model" | "permission", restoreToken: string | null) => {
|
|
430
|
+
setPopup({ kind, restoreToken })
|
|
431
|
+
onMenuOpenChange?.(true)
|
|
432
|
+
},
|
|
433
|
+
[onMenuOpenChange],
|
|
434
|
+
)
|
|
435
|
+
const closePopup = useCallback(
|
|
436
|
+
(reason: CommandPopupCloseReason) => {
|
|
437
|
+
// 取消路径恢复触发词(settle 不恢复)。副作用在 setState 外——updater 保持纯函数。
|
|
438
|
+
// insertContent 走 onUpdate → 草稿防抖保存。
|
|
439
|
+
const restoreToken = popupRef.current?.restoreToken
|
|
440
|
+
if (reason === "cancel" && restoreToken) {
|
|
441
|
+
editorRefHolder.current?.commands.insertContent(restoreToken)
|
|
442
|
+
}
|
|
443
|
+
setPopup(null)
|
|
444
|
+
editorRefHolder.current?.commands.focus()
|
|
445
|
+
onMenuOpenChange?.(false)
|
|
446
|
+
},
|
|
447
|
+
[onMenuOpenChange],
|
|
448
|
+
)
|
|
449
|
+
// Space 裁定实现(A6,F5-6 批 18;P2 任务 1 并入 client input 命令):从 commands
|
|
450
|
+
// (server)+ clientCommands(client)两源提取 input 型命令的 name/hint/label 查表,
|
|
451
|
+
// 交 adjudicateSpaceClaim 判定 + 落 chip。server input 命令到位(input:true)或 client
|
|
452
|
+
// input 命令在集(T2 /plan 起)后生效;两源皆无 input 命令 → names 空 → 恒 false
|
|
453
|
+
// (空格照常输入)。label 取值:server=description(缺省 name)、client=label。
|
|
314
454
|
spaceAdjudicateRef.current = (view: EditorView): boolean => {
|
|
315
455
|
const ed = editorRefHolder.current
|
|
316
456
|
if (!ed || ed.isDestroyed) return false
|
|
317
|
-
const
|
|
318
|
-
if (inputCmds.length === 0) return false
|
|
319
|
-
const names = inputCmds.map((c) => c.name)
|
|
457
|
+
const names: string[] = []
|
|
320
458
|
const hints: Record<string, string> = {}
|
|
321
459
|
const labels: Record<string, string> = {}
|
|
322
|
-
for (const c of
|
|
460
|
+
for (const c of [
|
|
461
|
+
...(commandsRef.current ?? []),
|
|
462
|
+
...(clientCommandsRef.current ?? []),
|
|
463
|
+
]) {
|
|
464
|
+
if (c.input !== true || names.includes(c.name)) continue
|
|
465
|
+
names.push(c.name)
|
|
323
466
|
if (c.hint) hints[c.name] = c.hint
|
|
324
|
-
labels[c.name] =
|
|
467
|
+
labels[c.name] =
|
|
468
|
+
("description" in c && c.description) || ("label" in c && c.label) || c.name
|
|
325
469
|
}
|
|
470
|
+
if (names.length === 0) return false
|
|
326
471
|
// adjudicateSpaceClaim 用 TipTap editor(.chain()),view 仅作触发源标识(同一 editor)
|
|
327
472
|
void view
|
|
328
473
|
return adjudicateSpaceClaim(ed, names, hints, labels)
|
|
@@ -356,8 +501,11 @@ export function ComposerEditor({
|
|
|
356
501
|
}, [editor, editorRef])
|
|
357
502
|
useEffect(() => {
|
|
358
503
|
if (!editor) return
|
|
359
|
-
|
|
360
|
-
|
|
504
|
+
// openPopup 在句柄上暴露(任务 10 `+` 菜单入口):harness-composer 经
|
|
505
|
+
// composerHandleRef 复用 '/' 菜单的同一 popup state。身份稳定(onMenuOpenChange
|
|
506
|
+
// 为 setState 稳定引用),effect 不重跑。
|
|
507
|
+
onReady?.({ editor, clearAfterSend, openPopup })
|
|
508
|
+
}, [editor, onReady, clearAfterSend, openPopup])
|
|
361
509
|
// 草稿恢复路径的 chip 状态重算(T3 计划外修复,见 task-3-report):onUpdate 只在
|
|
362
510
|
// 编辑事务触发,初始 content(含切会话后恢复的草稿)不上报——恢复含 @chip 的草稿
|
|
363
511
|
// 后直接发送会丢 kbId。挂载即从恢复后的 doc 重算上报;空 doc / 无 chip 草稿自然
|
|
@@ -368,13 +516,34 @@ export function ComposerEditor({
|
|
|
368
516
|
const doc = editor.getJSON()
|
|
369
517
|
onMentionKbIdsRef.current?.(collectMentionKbIds(doc))
|
|
370
518
|
}, [editor])
|
|
519
|
+
// 菜单锚卡片(DSH 对标,2026-11-20 任务 A):@ / '/' 两 suggestion 菜单钉在输入框
|
|
520
|
+
// 卡片(InputGroup)上沿弹出、与卡片同宽,不再锚光标 decoration 节点。锚 =
|
|
521
|
+
// editor.view.dom 向上 closest 的 [data-slot="input-group"](InputGroup 根带
|
|
522
|
+
// relative,floating-ui absolute 定位经 offsetParent 换算落位卡上沿)。editor
|
|
523
|
+
// 重建(ComposerEditor key=aiReady 重挂)→ effect 依赖 [editor] 重算随新实例刷新;
|
|
524
|
+
// null(editor 未就绪/宿主无卡片,如测试探针)→ SuggestionMenu 回落 caret 定位。
|
|
525
|
+
const [cardAnchor, setCardAnchor] = useState<HTMLElement | null>(null)
|
|
526
|
+
useEffect(() => {
|
|
527
|
+
if (!editor || editor.isDestroyed) {
|
|
528
|
+
setCardAnchor(null)
|
|
529
|
+
return
|
|
530
|
+
}
|
|
531
|
+
setCardAnchor(editor.view.dom.closest<HTMLElement>('[data-slot="input-group"]'))
|
|
532
|
+
}, [editor])
|
|
371
533
|
if (!editor) return null
|
|
372
534
|
return (
|
|
373
535
|
<div className="harness-composer-editor relative">
|
|
374
536
|
<EditorContent editor={editor} />
|
|
375
|
-
|
|
537
|
+
{/* frozen 守卫(任务 11):两菜单 disabled 透传——sending/接管期全禁(T2 机制,
|
|
538
|
+
菜单立即关闭 + allow 合成 false 不再触发)。@ 菜单不接 claimed 守卫(claim
|
|
539
|
+
参数区仍可 @ 引用文件,设计承诺),只接 frozen。 */}
|
|
540
|
+
<MentionSuggestionMenu editor={editor} rawThreadId={rawThreadId} onOpenChange={onMenuOpenChange} disabled={frozen}
|
|
541
|
+
onPendingChange={handlePendingChange} noOpSelectWhilePending
|
|
542
|
+
attachMode="card-top" anchorElement={cardAnchor} />
|
|
376
543
|
{/* '/' 命令菜单(F5-4):SuggestionMenu 第二实例(char='/'),与 @ 菜单
|
|
377
|
-
同款键盘仲裁;draft
|
|
544
|
+
同款键盘仲裁;draft 缺省不挂(非工作台消费方零变化)。pending 守卫与
|
|
545
|
+
@ 菜单同接(shared pendingRef → keymap isPending;noOpSelect 旧行短路)。
|
|
546
|
+
卡片锚定与 @ 菜单同款(DSH 对标,任务 A)。 */}
|
|
378
547
|
{draft && (
|
|
379
548
|
<CommandSuggestionMenu
|
|
380
549
|
editor={editor}
|
|
@@ -382,6 +551,39 @@ export function ComposerEditor({
|
|
|
382
551
|
onRunCommand={onRunCommand}
|
|
383
552
|
draft={draft}
|
|
384
553
|
onOpenChange={onMenuOpenChange}
|
|
554
|
+
openFilePicker={openFilePicker}
|
|
555
|
+
attachmentsEnabled={attachmentsEnabled}
|
|
556
|
+
models={models}
|
|
557
|
+
permissionEnabled={permissionEnabled}
|
|
558
|
+
canRevertLastTurn={canRevertLastTurn}
|
|
559
|
+
canPlan={canPlan}
|
|
560
|
+
onOpenPopup={openPopup}
|
|
561
|
+
clientCommands={clientCommands}
|
|
562
|
+
disabled={frozen}
|
|
563
|
+
onPendingChange={handlePendingChange}
|
|
564
|
+
noOpSelectWhilePending
|
|
565
|
+
attachMode="card-top"
|
|
566
|
+
anchorElement={cardAnchor}
|
|
567
|
+
/>
|
|
568
|
+
)}
|
|
569
|
+
{/* popup 型命令浮层(/model 任务 8、/permission 任务 9):钉卡上沿(InputGroup
|
|
570
|
+
内 absolute bottom-full,见 command-popup.tsx 头注释)。open 态已并入
|
|
571
|
+
onMenuOpenChange 通道——流式期 Esc 只关 popup、不误停生成。/permission 以
|
|
572
|
+
可空 rawThreadId 渲染(空态选档走 onPendingPolicyLevel,用户裁决 2026-11-20
|
|
573
|
+
对齐 DSH blank 会话——此前门控已保证非空,现空态也可开 popup)。 */}
|
|
574
|
+
{popup?.kind === "model" && (
|
|
575
|
+
<CommandPopup
|
|
576
|
+
models={models ?? []}
|
|
577
|
+
model={model}
|
|
578
|
+
onModelChange={(next) => onModelChange?.(next)}
|
|
579
|
+
onClose={closePopup}
|
|
580
|
+
/>
|
|
581
|
+
)}
|
|
582
|
+
{popup?.kind === "permission" && (
|
|
583
|
+
<PermissionPopup
|
|
584
|
+
threadId={rawThreadId ?? null}
|
|
585
|
+
onClose={closePopup}
|
|
586
|
+
onPendingLevel={onPendingPolicyLevel}
|
|
385
587
|
/>
|
|
386
588
|
)}
|
|
387
589
|
</div>
|
|
@@ -70,6 +70,15 @@ export interface ComposerKeymapDeps {
|
|
|
70
70
|
* 恒不裁定、空格放行——新增分支不翻既有断言。
|
|
71
71
|
*/
|
|
72
72
|
onSpaceAdjudicate?: (view: EditorView) => boolean
|
|
73
|
+
/**
|
|
74
|
+
* pending 守卫(整分支审查 finding 1 兑现,设计 §5.2「pending 期 Enter/Tab 显式
|
|
75
|
+
* no-op(防误发,最高优先)」):@ / '/' 菜单异步取数窗口判定(SuggestionMenu
|
|
76
|
+
* onPendingChange → composer pendingRef 镜像)。窗口内 Enter/Tab 吞掉
|
|
77
|
+
* (preventDefault + return true:不提交、不选中、不换行)——防半截查询误发。
|
|
78
|
+
* 窄域守卫:pending=false(含 settle 后无候选)行为完全不变,「无候选 Enter
|
|
79
|
+
* 透传发送」既有基线不触碰。缺省不传 = 恒放行(14 例 keymap 语义不变)。
|
|
80
|
+
*/
|
|
81
|
+
isPending?: () => boolean
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
export type ComposerKeyDownHandler = (view: EditorView, event: KeyboardEvent) => boolean
|
|
@@ -94,6 +103,23 @@ export function createComposerKeyDownHandler(deps: ComposerKeymapDeps): Composer
|
|
|
94
103
|
}
|
|
95
104
|
return false
|
|
96
105
|
}
|
|
106
|
+
// 2.6 pending 守卫(审查 finding 1):@ / '/' 菜单取数窗口(isPending=true)内
|
|
107
|
+
// Enter/Tab 显式 no-op——吞掉(不提交、不选中、不换行),防半截查询误发。
|
|
108
|
+
// 窄域:pending=false 行为完全不变(无候选 settle 后 Enter 照常提交)。
|
|
109
|
+
// 分层说明:pending 有旧行时 Enter 在本 keymap 之前已被 useMenuNavigation
|
|
110
|
+
// 捕获消费(选中短路由 SuggestionMenu noOpSelectWhilePending 承担,事件到
|
|
111
|
+
// 不了这里)——本层兜住的是「空候选穿透」(useMenuNavigation 对空 items
|
|
112
|
+
// 放行、事件直达提交 keymap)。两层合成「pending 期 Enter/Tab 无论 items
|
|
113
|
+
// 空不空都拦截」。IME 组合期 Enter 仍走第 1 步放行(守卫在其后);
|
|
114
|
+
// Shift+Enter 换行不拦(非提交意图);Shift+Tab 关菜单语义不变。
|
|
115
|
+
if (
|
|
116
|
+
(event.key === "Enter" || event.key === "Tab") &&
|
|
117
|
+
!event.shiftKey &&
|
|
118
|
+
deps.isPending?.()
|
|
119
|
+
) {
|
|
120
|
+
event.preventDefault()
|
|
121
|
+
return true
|
|
122
|
+
}
|
|
97
123
|
// 3. 只消费 Enter:PM 的 editHandlers.keydown 对「每一个」到达 view 的 keydown
|
|
98
124
|
// 都调用 handleKeyDown(prosemirror-view index.cjs:3033),缺此守卫时字母、
|
|
99
125
|
// 方向键、Esc 等全部落入提交分支——非空草稿下按任意字母键即发送消息、
|
package/src/components/harness/conversation-panel/composer/extension/__tests__/command-menu.test.ts
CHANGED
|
@@ -20,13 +20,17 @@
|
|
|
20
20
|
* 以及内置客户端命令与触发源候选解析辅助。纯 TS,无 React 渲染('/' 菜单 UI
|
|
21
21
|
* 挂真实 composer 的交互面见 command/command-suggestion-menu.test.tsx)。
|
|
22
22
|
*/
|
|
23
|
-
import { describe, expect, it, vi } from "vitest"
|
|
23
|
+
import { afterEach, describe, expect, it, vi } from "vitest"
|
|
24
24
|
import type { Editor, Range } from "@tiptap/react"
|
|
25
|
+
import { m } from "@/paraglide/messages.js"
|
|
25
26
|
|
|
26
27
|
import {
|
|
27
28
|
BUILTIN_CLIENT_COMMAND_CLEAR_INPUT,
|
|
29
|
+
BUILTIN_CLIENT_COMMAND_MODEL,
|
|
30
|
+
BUILTIN_CLIENT_COMMAND_PERMISSION,
|
|
28
31
|
createBuiltinClientCommands,
|
|
29
32
|
resolveCommandTriggerCandidates,
|
|
33
|
+
safeRunCommand,
|
|
30
34
|
unifyCommandItems,
|
|
31
35
|
} from "../command-menu"
|
|
32
36
|
import type { ComposerDraftApi, InputTriggerSource, TriggerCandidate } from "../types"
|
|
@@ -89,6 +93,27 @@ describe("unifyCommandItems 真值表", () => {
|
|
|
89
93
|
expect(items[0].label).toBe("mode")
|
|
90
94
|
})
|
|
91
95
|
|
|
96
|
+
it("server 类:已知命令 label 本地化映射(compact → harness_command_compact),description 原文不上屏", () => {
|
|
97
|
+
// 官方 compact 命令投影(插件 setup 贡献,description 为英文原文)——label 走
|
|
98
|
+
// KNOWN_SERVER_COMMAND_LABELS 映射,断言与 paraglide 消息函数同值(locale 无关)。
|
|
99
|
+
const items = unifyCommandItems({
|
|
100
|
+
serverCommands: [
|
|
101
|
+
{ name: "compact", description: "Summarize the conversation to save tokens" },
|
|
102
|
+
],
|
|
103
|
+
onRunCommand: vi.fn(),
|
|
104
|
+
})
|
|
105
|
+
expect(items[0].label).toBe(m.harness_command_compact())
|
|
106
|
+
expect(items[0].label).not.toContain("Summarize")
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it("server 类:未知命令回落 description 原文(新命令先行,映射随后补)", () => {
|
|
110
|
+
const items = unifyCommandItems({
|
|
111
|
+
serverCommands: [{ name: "future-cmd", description: "Future command" }],
|
|
112
|
+
onRunCommand: vi.fn(),
|
|
113
|
+
})
|
|
114
|
+
expect(items[0].label).toBe("Future command")
|
|
115
|
+
})
|
|
116
|
+
|
|
92
117
|
it("server 类:onRunCommand 缺省 → 不展示(无执行通路不出死条目)", () => {
|
|
93
118
|
expect(
|
|
94
119
|
unifyCommandItems({ serverCommands: [{ name: "mode", description: "切换模式" }] }),
|
|
@@ -145,7 +170,7 @@ describe("unifyCommandItems 真值表", () => {
|
|
|
145
170
|
expect(run).toHaveBeenCalledExactlyOnceWith(ctx)
|
|
146
171
|
})
|
|
147
172
|
|
|
148
|
-
it("三类并存:顺序
|
|
173
|
+
it("三类并存:顺序 client → trigger → server(本地命令最前,批 18 重排)", () => {
|
|
149
174
|
const source = makeSource({ candidates: () => [{ id: "s", label: "Skill", kind: "skill" }] })
|
|
150
175
|
const items = unifyCommandItems({
|
|
151
176
|
serverCommands: [{ name: "mode", description: "切换模式" }],
|
|
@@ -153,7 +178,7 @@ describe("unifyCommandItems 真值表", () => {
|
|
|
153
178
|
triggerSources: [source],
|
|
154
179
|
clientCommands: [{ name: "clear-input", label: "清空输入", run: vi.fn() }],
|
|
155
180
|
})
|
|
156
|
-
expect(items.map((i) => i.kind)).toEqual(["
|
|
181
|
+
expect(items.map((i) => i.kind)).toEqual(["client", "trigger", "server"])
|
|
157
182
|
})
|
|
158
183
|
|
|
159
184
|
it("查询过滤:name/label includes 大小写不敏感;空词全量", () => {
|
|
@@ -181,6 +206,24 @@ describe("unifyCommandItems 真值表", () => {
|
|
|
181
206
|
})
|
|
182
207
|
})
|
|
183
208
|
|
|
209
|
+
describe("unifyCommandItems fuzzy 过滤(子序列打分)", () => {
|
|
210
|
+
it("子序列命中:query 'mdel' 命中 name 'model'(m→d→e→l 按序)", () => {
|
|
211
|
+
const items = unifyCommandItems({
|
|
212
|
+
query: "mdel",
|
|
213
|
+
clientCommands: [{ name: "model", label: "模型", run: vi.fn() }],
|
|
214
|
+
})
|
|
215
|
+
expect(items.map((i) => i.name)).toEqual(["model"])
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
it("子序列不命中:query 'mdx' 不命中 name 'model'(无 x)", () => {
|
|
219
|
+
const items = unifyCommandItems({
|
|
220
|
+
query: "mdx",
|
|
221
|
+
clientCommands: [{ name: "model", label: "模型", run: vi.fn() }],
|
|
222
|
+
})
|
|
223
|
+
expect(items).toEqual([])
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
|
|
184
227
|
describe("resolveCommandTriggerCandidates", () => {
|
|
185
228
|
it("全同步源 → 同步返回候选矩阵(保持源顺序)", () => {
|
|
186
229
|
const a = makeSource({ candidates: () => [{ id: "a", label: "A", kind: "skill" }] })
|
|
@@ -203,18 +246,91 @@ describe("resolveCommandTriggerCandidates", () => {
|
|
|
203
246
|
})
|
|
204
247
|
})
|
|
205
248
|
|
|
206
|
-
describe("createBuiltinClientCommands
|
|
207
|
-
it("
|
|
208
|
-
const commands = createBuiltinClientCommands()
|
|
209
|
-
expect(commands).toHaveLength(
|
|
210
|
-
expect(commands[0].name).toBe(
|
|
211
|
-
expect(commands[0].
|
|
249
|
+
describe("createBuiltinClientCommands(内置「文件」+「模型」+「权限」+「清空输入」)", () => {
|
|
250
|
+
it("返回全集四条:file(group=add)+ model(group=add, popup)+ permission(group=add, popup)+ clear-input(group=client),label 本地化非空", () => {
|
|
251
|
+
const commands = createBuiltinClientCommands({ openFilePicker: vi.fn(() => {}) })
|
|
252
|
+
expect(commands).toHaveLength(4)
|
|
253
|
+
expect(commands[0].name).toBe("file")
|
|
254
|
+
expect(commands[0].group).toBe("add")
|
|
255
|
+
expect(commands[1].name).toBe(BUILTIN_CLIENT_COMMAND_MODEL)
|
|
256
|
+
expect(commands[1].group).toBe("add")
|
|
257
|
+
// popup 型命令:选中不执行 run,由上层弹模型目录 popup
|
|
258
|
+
expect(commands[1].popup).toBe("model")
|
|
259
|
+
expect(commands[2].name).toBe(BUILTIN_CLIENT_COMMAND_PERMISSION)
|
|
260
|
+
expect(commands[2].group).toBe("add")
|
|
261
|
+
// popup 型命令:选中不执行 run,由上层弹沙箱三档 popup(任务 9)
|
|
262
|
+
expect(commands[2].popup).toBe("permission")
|
|
263
|
+
expect(commands[3].name).toBe(BUILTIN_CLIENT_COMMAND_CLEAR_INPUT)
|
|
264
|
+
// 清空输入属 client 组(任务 1 起 group id 'commands' 语义收窄为 server 命令组——
|
|
265
|
+
// 组头「服务端命令」;client 本地命令归 'client' 组,组头「指令」)
|
|
266
|
+
expect(commands[3].group).toBe("client")
|
|
267
|
+
for (const command of commands) {
|
|
268
|
+
expect(command.label.length).toBeGreaterThan(0)
|
|
269
|
+
}
|
|
212
270
|
})
|
|
213
271
|
|
|
214
|
-
it("run 执行 ctx.draft.clear(
|
|
215
|
-
const
|
|
272
|
+
it("file.run 执行 ctx.openFilePicker;clear-input.run 执行 ctx.draft.clear;model/permission.run 为 no-op(popup 型不执行)", () => {
|
|
273
|
+
const openFilePicker = vi.fn(() => {})
|
|
274
|
+
const [file, modelCmd, permissionCmd, clearInput] = createBuiltinClientCommands({ openFilePicker })
|
|
275
|
+
file.run({ draft: makeDraft(), editor: editorStub, range: rangeStub })
|
|
276
|
+
expect(openFilePicker).toHaveBeenCalledExactlyOnceWith()
|
|
216
277
|
const clear = vi.fn(() => {})
|
|
217
|
-
|
|
278
|
+
clearInput.run({ draft: makeDraft(clear), editor: editorStub, range: rangeStub })
|
|
218
279
|
expect(clear).toHaveBeenCalledExactlyOnceWith()
|
|
280
|
+
// popup 型命令 run 不被菜单调用(形状一致性仍必填),直接调用亦为 no-op
|
|
281
|
+
expect(() =>
|
|
282
|
+
modelCmd.run({ draft: makeDraft(), editor: editorStub, range: rangeStub }),
|
|
283
|
+
).not.toThrow()
|
|
284
|
+
expect(() =>
|
|
285
|
+
permissionCmd.run({ draft: makeDraft(), editor: editorStub, range: rangeStub }),
|
|
286
|
+
).not.toThrow()
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
describe("safeRunCommand(任务 B 遗留清理 2:run 执行兜底单点)", () => {
|
|
291
|
+
let errorSpy: ReturnType<typeof vi.spyOn>
|
|
292
|
+
|
|
293
|
+
afterEach(() => {
|
|
294
|
+
errorSpy?.mockRestore()
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
it("run 同步抛 → console.error 记录 [composer-command] 前缀文案 + 错误,不 rethrow", () => {
|
|
298
|
+
errorSpy = vi.spyOn(console, "error").mockImplementation(() => {})
|
|
299
|
+
const boom = new Error("sync boom")
|
|
300
|
+
expect(() =>
|
|
301
|
+
safeRunCommand("demo-sync", () => {
|
|
302
|
+
throw boom
|
|
303
|
+
}, { draft: makeDraft(), editor: editorStub, range: rangeStub }),
|
|
304
|
+
).not.toThrow()
|
|
305
|
+
expect(errorSpy).toHaveBeenCalledExactlyOnceWith("[composer-command] 命令执行失败: demo-sync", boom)
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
it("run 返回拒绝的 Promise → console.error 记录(微任务后),不 unhandled", async () => {
|
|
309
|
+
errorSpy = vi.spyOn(console, "error").mockImplementation(() => {})
|
|
310
|
+
const boom = new Error("async boom")
|
|
311
|
+
safeRunCommand("demo-async", () => Promise.reject(boom), {
|
|
312
|
+
draft: makeDraft(),
|
|
313
|
+
editor: editorStub,
|
|
314
|
+
range: rangeStub,
|
|
315
|
+
})
|
|
316
|
+
// Promise.catch 兜底在微任务链上执行
|
|
317
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
318
|
+
expect(errorSpy).toHaveBeenCalledExactlyOnceWith("[composer-command] 命令执行失败: demo-async", boom)
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it("run 成功(同步 / Promise)→ console.error 不被调", async () => {
|
|
322
|
+
errorSpy = vi.spyOn(console, "error").mockImplementation(() => {})
|
|
323
|
+
const runs: Array<unknown> = []
|
|
324
|
+
safeRunCommand("demo-ok", (ctx) => {
|
|
325
|
+
runs.push(ctx.draft.threadId)
|
|
326
|
+
}, { draft: makeDraft(), editor: editorStub, range: rangeStub })
|
|
327
|
+
safeRunCommand("demo-ok-async", () => Promise.resolve("receipt"), {
|
|
328
|
+
draft: makeDraft(),
|
|
329
|
+
editor: editorStub,
|
|
330
|
+
range: rangeStub,
|
|
331
|
+
})
|
|
332
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
333
|
+
expect(errorSpy).not.toHaveBeenCalled()
|
|
334
|
+
expect(runs).toEqual(["t1"])
|
|
219
335
|
})
|
|
220
336
|
})
|