@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
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
* `+` 按钮重接命令菜单(任务 10,F3):PromptInputButton 包 Base UI Popover,
|
|
20
|
+
* PopoverContent 内 MenuView 渲染内置 client 命令面(与 '/' 菜单同一
|
|
21
|
+
* clientCommands 共享实例 + 同一门控过滤)。任务 7 收敛:plusMenuCommands 外层再包
|
|
22
|
+
* excludeComposerSeatCommands——「模型」「权限」两项从 `+` 菜单剔除(控制行有专钮、
|
|
23
|
+
* `/model` `/permission` 斜杠命令仍可达),仅剩 文件/清空输入(+ undo/plan 有通路时)。
|
|
24
|
+
*
|
|
25
|
+
* 五用例:
|
|
26
|
+
* 1. 点 `+` → Popover 菜单开:「文件」置顶(添加组)+ 清空输入在列,模型/权限
|
|
27
|
+
* **不在列**(席位收敛);点「文件」→ fileInput click spy + 菜单关 + 焦点回
|
|
28
|
+
* 编辑器(.tiptap.ProseMirror);
|
|
29
|
+
* 2. 点「清空输入」→ 编辑器清空 + 菜单关(`+` 入口的 draft.clear 执行通路;
|
|
30
|
+
* 收敛后 `+` 菜单无 popup 型命令——模型/权限入口已移除,popup 流程归 '/' 菜单,
|
|
31
|
+
* 见 command-popup.test);
|
|
32
|
+
* 3. localEngine(attachmentsEnabled=false)→ 菜单无「文件」,仅剩清空输入 +
|
|
33
|
+
* 隐藏 input 不渲染(模型/权限与引擎无关,恒被席位收敛剔除);
|
|
34
|
+
* 4. 流式期 `+` 菜单开着 Esc 只关菜单、不停生成——`+` Popover open 态并入
|
|
35
|
+
* onMenuOpenChange 通道(menuOpen=true 屏蔽 Esc-Esc 停止热键,第一击 Esc 不武装
|
|
36
|
+
* 序列),派发到**真实容器**(ref 指向含 composer 的元素,热键真实注册——传
|
|
37
|
+
* {current:null} 会跳过注册致平凡通过,T8 审查发现 1 同款手法);
|
|
38
|
+
* 5. 控制组:`+` 菜单未开 + isRunning=true → Esc-Esc 序列武装并触发 onStop(证明
|
|
39
|
+
* 热键真实注册、用例 4 的 onStop 未调非平凡成立)。
|
|
40
|
+
*
|
|
41
|
+
* 渲染 HarnessComposer(真实 TipTap)。permission-policy 整模块 mock(mock 链切断——
|
|
42
|
+
* 真模块顶层 import sandbox-policy serverFn → policy index,后者在本文件 throw 守卫)。
|
|
43
|
+
*/
|
|
44
|
+
import { afterEach, beforeEach, expect, it, vi } from "vitest"
|
|
45
|
+
import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react"
|
|
46
|
+
import { HarnessComposer } from "../conversation-panel/composer/harness-composer"
|
|
47
|
+
import { m } from "@/paraglide/messages.js"
|
|
48
|
+
|
|
49
|
+
vi.mock("@/server/serverFns/harness/media", () => ({ generatePrototypeFn: vi.fn(() => Promise.resolve({})) }))
|
|
50
|
+
vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
|
|
51
|
+
useMentionSources: () => ({ all: [], isLoading: false }),
|
|
52
|
+
}))
|
|
53
|
+
vi.mock("@/components/billing/use-feature", () => ({ useFeature: () => ({ enabled: true, loading: false }) }))
|
|
54
|
+
// bundle 守卫(T8/T9 立规,本任务沿用):composer 链路不得加载服务端沙箱 policy index
|
|
55
|
+
vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
|
|
56
|
+
// mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
|
|
57
|
+
// import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
|
|
58
|
+
vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
|
|
59
|
+
SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
|
|
60
|
+
getSandboxPolicy: vi.fn(),
|
|
61
|
+
setSandboxPolicy: vi.fn(),
|
|
62
|
+
}))
|
|
63
|
+
vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
|
|
64
|
+
vi.mock("@/components/harness/conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
|
|
65
|
+
|
|
66
|
+
beforeEach(() => {
|
|
67
|
+
sessionStorage.clear()
|
|
68
|
+
// harness 客户端门控开(vitest 默认 '0',config 注释钦定用例级 stubEnv 显式开)
|
|
69
|
+
vi.stubEnv("VITE_HARNESS_DEV", "1")
|
|
70
|
+
})
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
cleanup()
|
|
73
|
+
vi.unstubAllEnvs()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
/** 取 ProseMirror 编辑面(composer-send.test 同款定位) */
|
|
77
|
+
function getEditorDom(): HTMLElement {
|
|
78
|
+
const el = document.querySelector<HTMLElement>(".tiptap.ProseMirror")
|
|
79
|
+
if (!el) throw new Error("TipTap 编辑器 DOM 未挂载")
|
|
80
|
+
return el
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const MODELS = ["gpt-4o", "gpt-4o-mini", "claude-sonnet-4-5", "gemini-2-0-flash", "o3-mini"]
|
|
84
|
+
|
|
85
|
+
interface SetupOptions {
|
|
86
|
+
models?: string[]
|
|
87
|
+
model?: string
|
|
88
|
+
onModelChange?: (model: string) => void
|
|
89
|
+
onStop?: () => void
|
|
90
|
+
isRunning?: boolean
|
|
91
|
+
engine?: "cloud" | "local"
|
|
92
|
+
/** 编辑器预填文本(清空输入断言用,composer-send.test 同款 handoff 机制) */
|
|
93
|
+
prefill?: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 渲染进真实容器元素,`conversationRegionRef` 指向该容器——Esc-Esc 停止序列热键
|
|
98
|
+
* **真正注册**(command-popup.test 同款手法,传 {current:null} 会平凡通过)。
|
|
99
|
+
*/
|
|
100
|
+
function setup({ models = MODELS, model, onModelChange, onStop, isRunning = false, engine, prefill }: SetupOptions = {}) {
|
|
101
|
+
const container = document.createElement("div")
|
|
102
|
+
document.body.appendChild(container)
|
|
103
|
+
const regionRef = { current: container as HTMLDivElement | null }
|
|
104
|
+
render(
|
|
105
|
+
<HarnessComposer
|
|
106
|
+
threadId="t1"
|
|
107
|
+
isRunning={isRunning}
|
|
108
|
+
hasAiKey
|
|
109
|
+
busyPreference="queue"
|
|
110
|
+
onSend={vi.fn()}
|
|
111
|
+
onStop={onStop ?? vi.fn()}
|
|
112
|
+
conversationRegionRef={regionRef}
|
|
113
|
+
messages={[]}
|
|
114
|
+
handoffPrefillText={prefill}
|
|
115
|
+
models={models}
|
|
116
|
+
model={model}
|
|
117
|
+
onModelChange={onModelChange}
|
|
118
|
+
engine={engine}
|
|
119
|
+
/>,
|
|
120
|
+
{ container },
|
|
121
|
+
)
|
|
122
|
+
return { container }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** 点 `+` 触发钮 → Popover 命令菜单开(listbox) */
|
|
126
|
+
async function openPlusMenu(): Promise<HTMLElement> {
|
|
127
|
+
fireEvent.click(screen.getByLabelText(m.harness_command_plusMenu()))
|
|
128
|
+
const menu = await screen.findByRole("listbox", {}, { timeout: 3000 })
|
|
129
|
+
return menu
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
it("`+` 菜单收敛:文件置顶 + 清空输入在列,模型/权限被剔除 → 点文件 → fileInput click + 菜单关 + 焦点回编辑器", async () => {
|
|
133
|
+
setup()
|
|
134
|
+
const menu = await openPlusMenu()
|
|
135
|
+
// 席位收敛(任务 7):仅剩 文件/清空输入——模型/权限不在列(即便 models 非空 +
|
|
136
|
+
// sandboxExecution entitlement 开,控制行专钮替代 + 菜单席位)
|
|
137
|
+
await waitFor(() => {
|
|
138
|
+
expect(menu.textContent).toContain("文件")
|
|
139
|
+
expect(menu.textContent).toContain("清空输入")
|
|
140
|
+
})
|
|
141
|
+
expect(menu.textContent).not.toContain("模型")
|
|
142
|
+
expect(menu.textContent).not.toContain("权限")
|
|
143
|
+
// 「文件」置顶:首个 option 行即文件行(添加组在指令组之前)
|
|
144
|
+
const options = within(menu).getAllByRole("option")
|
|
145
|
+
expect(options[0].textContent).toContain("文件")
|
|
146
|
+
// 隐藏 file input 在位(附件门控开)
|
|
147
|
+
const fileInput = document.querySelector<HTMLInputElement>('input[type="file"]')
|
|
148
|
+
expect(fileInput).not.toBeNull()
|
|
149
|
+
const clickSpy = vi.spyOn(fileInput!, "click")
|
|
150
|
+
fireEvent.click(within(menu).getByText("文件"))
|
|
151
|
+
expect(clickSpy).toHaveBeenCalledTimes(1)
|
|
152
|
+
// 菜单关
|
|
153
|
+
await waitFor(() => expect(screen.queryByRole("listbox")).toBeNull())
|
|
154
|
+
// 焦点回编辑器
|
|
155
|
+
await waitFor(() => expect(getEditorDom()).toHaveFocus())
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
it("点「清空输入」→ 编辑器清空 + 菜单关(收敛后 + 菜单无 popup 型命令)", async () => {
|
|
159
|
+
setup({ prefill: "待清空文本" })
|
|
160
|
+
const textbox = getEditorDom()
|
|
161
|
+
await waitFor(() => expect(textbox.textContent).toBe("待清空文本"))
|
|
162
|
+
const menu = await openPlusMenu()
|
|
163
|
+
fireEvent.click(within(menu).getByText("清空输入"))
|
|
164
|
+
// 清空输入执行体:编辑器内容 + 草稿一并清(draft.clear)
|
|
165
|
+
await waitFor(() => expect(textbox.textContent).toBe(""))
|
|
166
|
+
// 菜单关
|
|
167
|
+
await waitFor(() => expect(screen.queryByRole("listbox")).toBeNull())
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it("localEngine(attachmentsEnabled=false)→ 菜单无「文件」,仅剩清空输入 + 隐藏 input 不渲染", async () => {
|
|
171
|
+
setup({ engine: "local" })
|
|
172
|
+
const menu = await openPlusMenu()
|
|
173
|
+
await waitFor(() => expect(menu.textContent).toContain("清空输入"))
|
|
174
|
+
// 门控关闭:/file 被过滤(隐藏 file input 随附件门控一并移除)
|
|
175
|
+
expect(menu.textContent).not.toContain("文件")
|
|
176
|
+
expect(document.querySelector('input[type="file"]')).toBeNull()
|
|
177
|
+
// 模型/权限与引擎无关:恒被席位收敛剔除(控制组——非门控缺位)
|
|
178
|
+
expect(menu.textContent).not.toContain("模型")
|
|
179
|
+
expect(menu.textContent).not.toContain("权限")
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
it("流式期 `+` 菜单开着 Esc 只关菜单——第一击不武装 Esc-Esc 停止序列(menuOpen 上报)", async () => {
|
|
183
|
+
const onStop = vi.fn()
|
|
184
|
+
const { container } = setup({ onStop, isRunning: true })
|
|
185
|
+
const menu = await openPlusMenu()
|
|
186
|
+
expect(menu.textContent).toContain("文件")
|
|
187
|
+
// 第一击 Esc:`+` 菜单关(menuOpen=true 期间停止热键 disabled——不武装)
|
|
188
|
+
fireEvent.keyDown(container, { key: "Escape" })
|
|
189
|
+
await waitFor(() => expect(screen.queryByRole("listbox")).toBeNull())
|
|
190
|
+
// 第二击 Esc:若第一击已武装序列,此击即完成 → onStop。未武装 → 仅重新武装。
|
|
191
|
+
fireEvent.keyDown(container, { key: "Escape" })
|
|
192
|
+
expect(onStop).not.toHaveBeenCalled()
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
it("控制组:`+` 菜单未开 + isRunning=true → Esc-Esc 序列武装并触发 onStop(热键真实注册)", async () => {
|
|
196
|
+
const onStop = vi.fn()
|
|
197
|
+
const { container } = setup({ onStop, isRunning: true })
|
|
198
|
+
// 菜单未开(menuOpen=false):两击 Esc 都抵达容器上的停止热键监听 → onStop
|
|
199
|
+
fireEvent.keyDown(container, { key: "Escape" })
|
|
200
|
+
fireEvent.keyDown(container, { key: "Escape" })
|
|
201
|
+
expect(onStop).toHaveBeenCalledTimes(1)
|
|
202
|
+
})
|
|
@@ -41,6 +41,13 @@ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
|
|
|
41
41
|
}),
|
|
42
42
|
}))
|
|
43
43
|
vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
|
|
44
|
+
// mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
|
|
45
|
+
// import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
|
|
46
|
+
vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
|
|
47
|
+
SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
|
|
48
|
+
getSandboxPolicy: vi.fn(),
|
|
49
|
+
setSandboxPolicy: vi.fn(),
|
|
50
|
+
}))
|
|
44
51
|
vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
|
|
45
52
|
vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
|
|
46
53
|
|
|
@@ -37,6 +37,13 @@ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
|
|
|
37
37
|
}),
|
|
38
38
|
}))
|
|
39
39
|
vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
|
|
40
|
+
// mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
|
|
41
|
+
// import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
|
|
42
|
+
vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
|
|
43
|
+
SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
|
|
44
|
+
getSandboxPolicy: vi.fn(),
|
|
45
|
+
setSandboxPolicy: vi.fn(),
|
|
46
|
+
}))
|
|
40
47
|
vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
|
|
41
48
|
vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
|
|
42
49
|
|
|
@@ -99,8 +106,9 @@ it("keeps Shift Enter for newlines", () => {
|
|
|
99
106
|
it("selects the first candidate with Enter while the @ menu is open and does not send (F5)", async () => {
|
|
100
107
|
const send = setup("t1", "@")
|
|
101
108
|
const textbox = getEditorDom()
|
|
102
|
-
// @
|
|
103
|
-
|
|
109
|
+
// @ 菜单候选已加载(真实 SuggestionMenu + 固定候选)。等 option 而非 listbox——
|
|
110
|
+
// 浮层容器 role=listbox 在 debounce 取数窗口内先出现(空候选),Enter 会穿透发送。
|
|
111
|
+
await screen.findAllByRole("option", {}, { timeout: 3000 })
|
|
104
112
|
fireEvent.keyDown(textbox, { key: "Enter" })
|
|
105
113
|
// F5:菜单打开时 Enter 只选中候选,不发送消息
|
|
106
114
|
expect(send).not.toHaveBeenCalled()
|
|
@@ -115,7 +123,7 @@ it("selects the first candidate with Enter while the @ menu is open and does not
|
|
|
115
123
|
it("confirms the highlighted candidate with Tab while the @ menu is open (A7)", async () => {
|
|
116
124
|
const send = setup("t1", "@")
|
|
117
125
|
const textbox = getEditorDom()
|
|
118
|
-
await screen.
|
|
126
|
+
await screen.findAllByRole("option", {}, { timeout: 3000 })
|
|
119
127
|
fireEvent.keyDown(textbox, { key: "Tab" })
|
|
120
128
|
expect(send).not.toHaveBeenCalled()
|
|
121
129
|
await waitFor(() => expect(textbox.textContent).toContain("@KB doc alpha"))
|
|
@@ -124,7 +132,7 @@ it("confirms the highlighted candidate with Tab while the @ menu is open (A7)",
|
|
|
124
132
|
it("closes the @ menu with Shift+Tab (A7: equivalent to Escape)", async () => {
|
|
125
133
|
setup("t1", "@")
|
|
126
134
|
const textbox = getEditorDom()
|
|
127
|
-
await screen.
|
|
135
|
+
await screen.findAllByRole("option", {}, { timeout: 3000 })
|
|
128
136
|
fireEvent.keyDown(textbox, { key: "Tab", shiftKey: true })
|
|
129
137
|
await waitFor(() => expect(screen.queryByRole("listbox")).toBeNull())
|
|
130
138
|
})
|
|
@@ -27,6 +27,13 @@ vi.mock("../conversation-panel/composer/mention/use-mention-sources", () => ({
|
|
|
27
27
|
useMentionSources: () => ({ all: [], isLoading: false }),
|
|
28
28
|
}))
|
|
29
29
|
vi.mock("@/server/ai-gateway/sandbox/policy", () => { throw new Error("Server sandbox policy must not be loaded by the composer") })
|
|
30
|
+
// mock 链切断(T9):command-popup 经 permission-policy 访问沙箱策略——真模块顶层
|
|
31
|
+
// import sandbox-policy serverFn → policy index(上方 throw 守卫),桩掉即断链
|
|
32
|
+
vi.mock("../conversation-panel/composer/permission/permission-policy", () => ({
|
|
33
|
+
SANDBOX_POLICY_LEVELS: ["readonly", "workspace-write", "full"],
|
|
34
|
+
getSandboxPolicy: vi.fn(),
|
|
35
|
+
setSandboxPolicy: vi.fn(),
|
|
36
|
+
}))
|
|
30
37
|
vi.mock("../conversation-panel/composer/voice-input-button", () => ({ VoiceInputButton: () => null }))
|
|
31
38
|
vi.mock("../conversation-panel/messages/approvals/interrupt-approval", () => ({ InterruptApproval: () => null }))
|
|
32
39
|
|
|
@@ -225,6 +225,9 @@ describe("closeTab 五规则副作用描述", () => {
|
|
|
225
225
|
const reg = createDockRegistry()
|
|
226
226
|
reg.registerKind(makeKind({ kind: "todo" }))
|
|
227
227
|
reg.switchThread("ct1")
|
|
228
|
+
// 规则③前提「展开态」显式置位:无存档 switchThread 保留当前展开态
|
|
229
|
+
// (2026-11-19 起初始默认收起),不再隐式假定展开
|
|
230
|
+
reg.setExpanded(true)
|
|
228
231
|
reg.openKind("todo")
|
|
229
232
|
const r = reg.closeTab(reg.activeTab()!.id)
|
|
230
233
|
expect(r.collapsePanel).toBe(true)
|
|
@@ -23,6 +23,8 @@ const h = vi.hoisted(() => ({
|
|
|
23
23
|
retryDismissed: false as boolean,
|
|
24
24
|
/** 缺陷 6 断言载体:捕获 HarnessComposer 收到的 props */
|
|
25
25
|
composerProps: {} as Record<string, unknown>,
|
|
26
|
+
/** /plan 接线回归(P2 任务 2 真机补线):活动会话 id(null = 无会话) */
|
|
27
|
+
activeConversationId: null as string | null,
|
|
26
28
|
}))
|
|
27
29
|
|
|
28
30
|
vi.mock("@/components/harness/workbench/workbench-context", () => ({
|
|
@@ -45,7 +47,7 @@ vi.mock("@/lib/auth/auth-client", () => ({
|
|
|
45
47
|
function bodyMock() {
|
|
46
48
|
return {
|
|
47
49
|
engine: h.engine,
|
|
48
|
-
activeConversationId:
|
|
50
|
+
activeConversationId: h.activeConversationId,
|
|
49
51
|
activeConversation: undefined,
|
|
50
52
|
activeIdRef: { current: null },
|
|
51
53
|
panelExpanded: false,
|
|
@@ -66,6 +68,8 @@ function bodyMock() {
|
|
|
66
68
|
localCwd: null,
|
|
67
69
|
localAgentId: null,
|
|
68
70
|
localAgentModel: null,
|
|
71
|
+
pendingSandboxPolicy: null,
|
|
72
|
+
setPendingSandboxPolicy: vi.fn(),
|
|
69
73
|
} as never
|
|
70
74
|
}
|
|
71
75
|
|
|
@@ -113,9 +117,6 @@ vi.mock("@/components/harness/extension-panel/dock/dock-surface", () => ({ DockS
|
|
|
113
117
|
vi.mock("@/components/harness/workbench/workbench-shell", () => ({
|
|
114
118
|
WorkbenchShell: ({ center }: { center: ReactNode }) => <div>{center}</div>,
|
|
115
119
|
}))
|
|
116
|
-
vi.mock("@/components/harness/conversation-panel/composer/extension/demo-story-reference", () => ({
|
|
117
|
-
DemoStoryReferenceExtensionRegistrar: () => null,
|
|
118
|
-
}))
|
|
119
120
|
vi.mock("@/components/confirm-dialog", () => ({ ConfirmDialog: () => null }))
|
|
120
121
|
vi.mock("@/components/harness/conversation-panel/connection-indicator", () => ({ ConnectionIndicator: () => null }))
|
|
121
122
|
// 工作区目录失效提示条(P1b-8)含 useQuery,本测试无 QueryClientProvider——叶子件 mock 成 null
|
|
@@ -127,6 +128,7 @@ beforeEach(() => {
|
|
|
127
128
|
h.chatError = undefined
|
|
128
129
|
h.retryDismissed = false
|
|
129
130
|
h.composerProps = {}
|
|
131
|
+
h.activeConversationId = null
|
|
130
132
|
})
|
|
131
133
|
|
|
132
134
|
afterEach(cleanup)
|
|
@@ -177,6 +179,42 @@ describe("HarnessWorkbenchPage 前置 banner → 后置提醒(用户裁决 202
|
|
|
177
179
|
})
|
|
178
180
|
})
|
|
179
181
|
|
|
182
|
+
describe("/plan 接线(P2 任务 2 真机补线)", () => {
|
|
183
|
+
afterEach(() => {
|
|
184
|
+
vi.unstubAllEnvs()
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it("活动会话下 HarnessComposer 必须收到 canPlan 布尔与 onPlanSubmit 通道", () => {
|
|
188
|
+
// 回归锁定:workbench-page 曾只计算 canPlan/onPlanSubmit(:190/:193)而 JSX 未透传
|
|
189
|
+
// ——计算点与接线断裂,单测直接喂 HarnessComposer props 掩盖了缺失,真机 /plan
|
|
190
|
+
// 菜单项恒隐藏。本例走真实 HarnessWorkbenchPage 渲染 + HarnessComposer mock 捕获
|
|
191
|
+
// props,锁死「计算必须到达接线」。
|
|
192
|
+
// vitest 确定性 env 门控恒 '0'(vitest.config.ts unit env)——harness 链用例显式开。
|
|
193
|
+
vi.stubEnv("VITE_HARNESS_DEV", "1")
|
|
194
|
+
h.activeConversationId = "thread-1"
|
|
195
|
+
h.hasAiKey = true
|
|
196
|
+
render(<HarnessWorkbenchPage />)
|
|
197
|
+
expect(h.composerProps.canPlan).toBe(true)
|
|
198
|
+
expect(typeof h.composerProps.onPlanSubmit).toBe("function")
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
it("无活动会话时 canPlan 仍 true(用户裁决 2026-11-20 对齐 DSH:空态走 pending 档)", () => {
|
|
202
|
+
// workbench-page canPlan 含 isHarnessClientEnabled()——vitest 确定性 env 门控恒
|
|
203
|
+
// '0',本用例显式开(与 /plan 接线用例同口径)
|
|
204
|
+
vi.stubEnv("VITE_HARNESS_DEV", "1")
|
|
205
|
+
h.activeConversationId = null
|
|
206
|
+
render(<HarnessWorkbenchPage />)
|
|
207
|
+
expect(h.composerProps.canPlan).toBe(true)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it("/permission 空态接线:onPendingPolicyLevel 通道必须到达 HarnessComposer(pending 槽 setter)", () => {
|
|
211
|
+
// 回归锁定(wiring 教训——「计算了≠接线了」):空态 /permission 选档经
|
|
212
|
+
// onPendingPolicyLevel 上报 workbench pendingSandboxPolicy 槽,建线落库。
|
|
213
|
+
render(<HarnessWorkbenchPage />)
|
|
214
|
+
expect(typeof h.composerProps.onPendingPolicyLevel).toBe("function")
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
|
|
180
218
|
describe("isAiAuthError(认证类错误识别)", () => {
|
|
181
219
|
it.each([
|
|
182
220
|
["Error: Sign in to openrouter first. Run /connect openrouter.", true],
|
|
@@ -26,6 +26,7 @@ import { Editor } from "@tiptap/core"
|
|
|
26
26
|
import type { JSONContent } from "@tiptap/core"
|
|
27
27
|
import StarterKit from "@tiptap/starter-kit"
|
|
28
28
|
import { MentionExtension } from "@/components/tiptap/node/mention-extension"
|
|
29
|
+
import { formatThreadReference } from "@/shared/harness/thread-reference-format"
|
|
29
30
|
import { insertMentionChip } from "../conversation-panel/composer/harness-composer"
|
|
30
31
|
import { collectMentionKbIds } from "../conversation-panel/composer/composer-editor"
|
|
31
32
|
|
|
@@ -91,4 +92,72 @@ describe("harness @知识库 chip 的 kbId(真实 Editor schema 往返)", ()
|
|
|
91
92
|
editor.destroy()
|
|
92
93
|
roundTripped.destroy()
|
|
93
94
|
})
|
|
95
|
+
|
|
96
|
+
it("file kind:path attr 往返(data-path render/parse 闭环)+ renderText 序列化 @path", () => {
|
|
97
|
+
const editor = makeEditor()
|
|
98
|
+
insertMentionChip(editor, { kind: "file", id: "f1", label: "src/app.ts", path: "src/app.ts" })
|
|
99
|
+
const html = editor.getHTML()
|
|
100
|
+
expect(html).toContain('data-path="src/app.ts"')
|
|
101
|
+
const roundTripped = makeEditor(html)
|
|
102
|
+
expect(findMentionNodes(roundTripped.getJSON())[0].attrs?.path).toBe("src/app.ts")
|
|
103
|
+
expect(editor.getText()).toContain("@src/app.ts")
|
|
104
|
+
editor.destroy()
|
|
105
|
+
roundTripped.destroy()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it("file kind:路径含空格时 renderText 输出 @\"path with space\"", () => {
|
|
109
|
+
const editor = makeEditor()
|
|
110
|
+
insertMentionChip(editor, {
|
|
111
|
+
kind: "file",
|
|
112
|
+
id: "f2",
|
|
113
|
+
label: "path with space",
|
|
114
|
+
path: "path with space",
|
|
115
|
+
})
|
|
116
|
+
expect(editor.getText()).toContain('@"path with space"')
|
|
117
|
+
editor.destroy()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it("file chip 不污染 knowledgeBaseIds:collectMentionKbIds 对 file chip 返回空", () => {
|
|
121
|
+
const editor = makeEditor()
|
|
122
|
+
insertMentionChip(editor, { kind: "file", id: "f3", label: "src/app.ts", path: "src/app.ts" })
|
|
123
|
+
expect(collectMentionKbIds(editor.getJSON())).toEqual([])
|
|
124
|
+
editor.destroy()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it("thread kind:threadId attr 往返(data-thread-id render/parse 闭环)", () => {
|
|
128
|
+
const editor = makeEditor()
|
|
129
|
+
// thread chip 直插 attrs(生产插入路径 insertMentionCandidateChip 由
|
|
130
|
+
// thread-mention.test.tsx 覆盖;此处锁 schema 面:threadId 声明 + 双向保留)
|
|
131
|
+
editor.commands.insertContent([
|
|
132
|
+
{
|
|
133
|
+
type: "mention",
|
|
134
|
+
attrs: { id: "th-1", label: "调试登录态", docType: "thread", docGroup: "", threadId: "th-1" },
|
|
135
|
+
},
|
|
136
|
+
{ type: "text", text: " " },
|
|
137
|
+
])
|
|
138
|
+
const html = editor.getHTML()
|
|
139
|
+
expect(html).toContain('data-thread-id="th-1"')
|
|
140
|
+
const roundTripped = makeEditor(html)
|
|
141
|
+
const attrs = findMentionNodes(roundTripped.getJSON())[0].attrs
|
|
142
|
+
expect(attrs?.threadId).toBe("th-1")
|
|
143
|
+
expect(attrs?.docType).toBe("thread")
|
|
144
|
+
expect(attrs?.id).toBe("th-1")
|
|
145
|
+
editor.destroy()
|
|
146
|
+
roundTripped.destroy()
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it("thread kind:renderText 序列化 canonical 标记 @[标题](allblue-thread:id)(Phase 2 wire 端)", () => {
|
|
150
|
+
const editor = makeEditor()
|
|
151
|
+
editor.commands.insertContent([
|
|
152
|
+
{
|
|
153
|
+
type: "mention",
|
|
154
|
+
attrs: { id: "th-2", label: "重构 prompt 输入", docType: "thread", docGroup: "", threadId: "th-2" },
|
|
155
|
+
},
|
|
156
|
+
])
|
|
157
|
+
expect(editor.getText()).toBe(
|
|
158
|
+
formatThreadReference({ id: "th-2", label: "重构 prompt 输入" }),
|
|
159
|
+
)
|
|
160
|
+
expect(editor.getText()).toBe("@[重构 prompt 输入](allblue-thread:th-2)")
|
|
161
|
+
editor.destroy()
|
|
162
|
+
})
|
|
94
163
|
})
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
* /undo 目标解析真值表(P1 任务 2 修复,审查裁决):
|
|
20
|
+
*
|
|
21
|
+
* revert 语义(ai-harness 0.3.0 session/state.js 已核实)=「保留目标消息、隐藏
|
|
22
|
+
* 其后内容」("Go back to the message messageId",commitRevert 落盘
|
|
23
|
+
* messages.slice(0, at + 1))。故「撤销最后一回合」的目标 = **最后一条 user 消息
|
|
24
|
+
* 的前一条消息**(revert 它 = 隐藏最后一轮 user+回复),而非最后一条 assistant
|
|
25
|
+
* (transcript 尾=最后 assistant,revert 它隐藏 0 条 = no-op)。
|
|
26
|
+
*
|
|
27
|
+
* - 目标选择:[user, assistant] → start=0 无前驱 → null(首回合不可撤销);
|
|
28
|
+
* [assistant1, user, assistant2] → 'assistant1';
|
|
29
|
+
* - notice 排除:notice id 是合成 id `notice-N`(view/reduce.js:108,不在
|
|
30
|
+
* transcript)→ revert 到它被 unknown_message 拒绝 → 向前跳过;
|
|
31
|
+
* - 门控:revert slot 缺席(legacy 链)/ server undo 在(桌面 snapshots 官方命令
|
|
32
|
+
* 让位,防 '/' 菜单双 undo)/ 运行中(与 agent 竞态)→ 一律 null(禁用)。
|
|
33
|
+
*/
|
|
34
|
+
import { describe, expect, it } from "vitest"
|
|
35
|
+
import { resolveUndoLastTurnTarget } from "../workbench/undo-last-turn"
|
|
36
|
+
|
|
37
|
+
const OPEN = { revertAvailable: true, hasServerUndo: false, isRunning: false }
|
|
38
|
+
|
|
39
|
+
function msg(id: string, role: string): { id: string; role: string } {
|
|
40
|
+
return { id, role }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe("resolveUndoLastTurnTarget(目标 = 最后 user 消息的前一条)", () => {
|
|
44
|
+
it("[user, assistant] → start=0 无前驱 → null(首回合不可撤销)", () => {
|
|
45
|
+
expect(
|
|
46
|
+
resolveUndoLastTurnTarget([msg("u1", "user"), msg("a1", "assistant")], OPEN),
|
|
47
|
+
).toBeNull()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("[assistant1, user, assistant2] → 目标 assistant1(保留其前文、隐藏最后一轮 QA)", () => {
|
|
51
|
+
expect(
|
|
52
|
+
resolveUndoLastTurnTarget(
|
|
53
|
+
[msg("assistant1", "assistant"), msg("u2", "user"), msg("assistant2", "assistant")],
|
|
54
|
+
OPEN,
|
|
55
|
+
),
|
|
56
|
+
).toBe("assistant1")
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it("user 是首条(无更早消息)→ 禁用:[user1, assistant1, user2, ...] 之外,末位 user 即首条", () => {
|
|
60
|
+
// 末位 user 就是整个 transcript 的首条(start=0)——revert 无可达前驱
|
|
61
|
+
expect(resolveUndoLastTurnTarget([msg("u1", "user")], OPEN)).toBeNull()
|
|
62
|
+
expect(
|
|
63
|
+
resolveUndoLastTurnTarget(
|
|
64
|
+
[msg("u1", "user"), msg("a1", "assistant"), msg("a2", "assistant")],
|
|
65
|
+
OPEN,
|
|
66
|
+
),
|
|
67
|
+
).toBeNull()
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it("无 user 消息 → 禁用(无处下手截断一轮 QA)", () => {
|
|
71
|
+
expect(resolveUndoLastTurnTarget([msg("a1", "assistant")], OPEN)).toBeNull()
|
|
72
|
+
expect(resolveUndoLastTurnTarget([], OPEN)).toBeNull()
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("中间回合多轮:目标取最后一条 user 的前一条(不取更早回合)", () => {
|
|
76
|
+
expect(
|
|
77
|
+
resolveUndoLastTurnTarget(
|
|
78
|
+
[
|
|
79
|
+
msg("u1", "user"),
|
|
80
|
+
msg("a1", "assistant"),
|
|
81
|
+
msg("u2", "user"),
|
|
82
|
+
msg("a2", "assistant"),
|
|
83
|
+
msg("u3", "user"),
|
|
84
|
+
msg("a3", "assistant"),
|
|
85
|
+
],
|
|
86
|
+
OPEN,
|
|
87
|
+
),
|
|
88
|
+
).toBe("a2")
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it("notice 排除:目标候选为合成 notice id 时向前跳过(revert 到 notice 被 unknown_message 拒)", () => {
|
|
92
|
+
// 前驱是 notice → 跳过取更早的真实消息
|
|
93
|
+
expect(
|
|
94
|
+
resolveUndoLastTurnTarget(
|
|
95
|
+
[msg("a1", "assistant"), msg("notice-2", "assistant"), msg("u3", "user"), msg("a3", "assistant")],
|
|
96
|
+
OPEN,
|
|
97
|
+
),
|
|
98
|
+
).toBe("a1")
|
|
99
|
+
// 前驱全是 notice(无真实消息)→ 禁用
|
|
100
|
+
expect(
|
|
101
|
+
resolveUndoLastTurnTarget(
|
|
102
|
+
[msg("notice-0", "assistant"), msg("u1", "user"), msg("a1", "assistant")],
|
|
103
|
+
OPEN,
|
|
104
|
+
),
|
|
105
|
+
).toBeNull()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it("门控:revert slot 缺席(legacy 链)→ null", () => {
|
|
109
|
+
expect(
|
|
110
|
+
resolveUndoLastTurnTarget(
|
|
111
|
+
[msg("a1", "assistant"), msg("u2", "user"), msg("a2", "assistant")],
|
|
112
|
+
{ revertAvailable: false, hasServerUndo: false, isRunning: false },
|
|
113
|
+
),
|
|
114
|
+
).toBeNull()
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it("门控:commands 含 server undo(桌面 snapshots 官方命令让位,防双 undo 条目)→ null", () => {
|
|
118
|
+
expect(
|
|
119
|
+
resolveUndoLastTurnTarget(
|
|
120
|
+
[msg("a1", "assistant"), msg("u2", "user"), msg("a2", "assistant")],
|
|
121
|
+
{ revertAvailable: true, hasServerUndo: true, isRunning: false },
|
|
122
|
+
),
|
|
123
|
+
).toBeNull()
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it("门控:isRunning(运行中撤销与 agent 竞态,裁决隐藏)→ null", () => {
|
|
127
|
+
expect(
|
|
128
|
+
resolveUndoLastTurnTarget(
|
|
129
|
+
[msg("a1", "assistant"), msg("u2", "user"), msg("a2", "assistant")],
|
|
130
|
+
{ revertAvailable: true, hasServerUndo: false, isRunning: true },
|
|
131
|
+
),
|
|
132
|
+
).toBeNull()
|
|
133
|
+
})
|
|
134
|
+
})
|
|
@@ -47,7 +47,7 @@ function makeSeatProps(overrides: Partial<ComposerSeatProps> = {}): ComposerSeat
|
|
|
47
47
|
draft: {
|
|
48
48
|
threadId: "t1",
|
|
49
49
|
store: { save: () => {}, load: () => null, clear: () => {} } as never,
|
|
50
|
-
editorHandle: { editor, clearAfterSend: () => {} },
|
|
50
|
+
editorHandle: { editor, clearAfterSend: () => {}, openPopup: () => {} },
|
|
51
51
|
text: "",
|
|
52
52
|
clear: () => {},
|
|
53
53
|
},
|
|
@@ -127,7 +127,7 @@ describe("语音 activity 席位迁移(F5-6 批 17)", () => {
|
|
|
127
127
|
draft: {
|
|
128
128
|
threadId: "t1",
|
|
129
129
|
store: { save: () => {}, load: () => null, clear: () => {} } as never,
|
|
130
|
-
editorHandle: { editor, clearAfterSend: () => {} },
|
|
130
|
+
editorHandle: { editor, clearAfterSend: () => {}, openPopup: () => {} },
|
|
131
131
|
text: "",
|
|
132
132
|
clear: () => {},
|
|
133
133
|
},
|