@allbluecn/web-app 0.27.41 → 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/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/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,322 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
|
|
5
|
+
// WorkerSection(Section C:用户 Worker 插件——任务 6 真实化,设计 §3.5)。含 PluginTool /
|
|
6
|
+
// WorkerPlugin 类型 + toPluginTools 收窄 + WORKER_STATUS_CONFIG 四态徽标(均仅本 Section
|
|
7
|
+
// 消费,随之迁出)。由 PluginPage 装配;本 Section 是 worker 查询的次级观察者(见组件内注释)。
|
|
8
|
+
|
|
9
|
+
import { useState } from "react"
|
|
10
|
+
import type { ReactElement, ReactNode } from "react"
|
|
11
|
+
import { AlertCircle, Hammer, MoreHorizontal, Play, Square, Trash2 } from "lucide-react"
|
|
12
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query"
|
|
13
|
+
import {
|
|
14
|
+
AlertDialog,
|
|
15
|
+
AlertDialogAction,
|
|
16
|
+
AlertDialogCancel,
|
|
17
|
+
AlertDialogContent,
|
|
18
|
+
AlertDialogDescription,
|
|
19
|
+
AlertDialogFooter,
|
|
20
|
+
AlertDialogHeader,
|
|
21
|
+
AlertDialogTitle,
|
|
22
|
+
} from "@/components/ui/alert-dialog"
|
|
23
|
+
import { Badge } from "@/components/ui/badge"
|
|
24
|
+
import { Button } from "@/components/ui/button"
|
|
25
|
+
import {
|
|
26
|
+
DropdownMenu,
|
|
27
|
+
DropdownMenuContent,
|
|
28
|
+
DropdownMenuItem,
|
|
29
|
+
DropdownMenuTrigger,
|
|
30
|
+
} from "@/components/ui/dropdown-menu"
|
|
31
|
+
import {
|
|
32
|
+
HARNESS_WORKER_PLUGINS_QUERY_KEY,
|
|
33
|
+
harnessWorkerPluginsQueryOptions,
|
|
34
|
+
} from "@/lib/queries/harness"
|
|
35
|
+
import {
|
|
36
|
+
deletePluginFn,
|
|
37
|
+
listPluginsFn,
|
|
38
|
+
setPluginStatusFn,
|
|
39
|
+
} from "@/server/serverFns/plugins/harness-plugins"
|
|
40
|
+
import { stopPlugin } from "@/lib/plugin-runtime/plugin-client"
|
|
41
|
+
import { PluginRow } from "./plugin-row"
|
|
42
|
+
import { m } from "@/paraglide/messages.js"
|
|
43
|
+
|
|
44
|
+
interface PluginTool {
|
|
45
|
+
name: string
|
|
46
|
+
description?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** serverFn 返回行类型(tools 为 Json 载荷)派生,避免手写漂移(迁旧面板 L91-93 原样) */
|
|
50
|
+
type WorkerPlugin = Omit<Awaited<ReturnType<typeof listPluginsFn>>[number], "tools"> & {
|
|
51
|
+
tools: PluginTool[]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** tools 落库为 Json:逐项收窄为 PluginTool,异常形状直接丢弃(迁旧面板 L96-104 原样) */
|
|
55
|
+
function toPluginTools(value: unknown): PluginTool[] {
|
|
56
|
+
if (!Array.isArray(value)) return []
|
|
57
|
+
return value.filter(
|
|
58
|
+
(t): t is PluginTool =>
|
|
59
|
+
typeof t === "object" &&
|
|
60
|
+
t !== null &&
|
|
61
|
+
typeof (t as { name?: unknown }).name === "string",
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Worker 插件四态状态徽标(迁旧面板 STATUS_CONFIG L78-83 原样):label 惰性函数防模块
|
|
67
|
+
* 求值时固化语言;色类系迁移豁免——bg-green-500/20 等非语义刻度为旧面板状态徽标既有
|
|
68
|
+
* 用色,按任务纪律原样保留(类名字面量在源码内,Tailwind 扫描可生成)。
|
|
69
|
+
*/
|
|
70
|
+
const WORKER_STATUS_CONFIG = {
|
|
71
|
+
defined: {
|
|
72
|
+
label: () => m.harness_plugin_status_defined(),
|
|
73
|
+
color: "bg-muted text-muted-foreground",
|
|
74
|
+
},
|
|
75
|
+
running: { label: () => m.harness_plugin_status_running(), color: "bg-green-500/20 text-green-500" },
|
|
76
|
+
stopped: { label: () => m.harness_plugin_status_stopped(), color: "bg-orange-500/20 text-orange-500" },
|
|
77
|
+
error: { label: () => m.harness_plugin_status_error(), color: "bg-red-500/20 text-red-500" },
|
|
78
|
+
} as const
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Section C:Worker 插件(用户自建,Prisma;设计 §3.5)。数据自取 harnessWorkerPlugins
|
|
82
|
+
* QueryOptions(与页级 workerQuery 同键共享缓存,任务 7 接线前为受控死代码),行内
|
|
83
|
+
* toPluginTools 收窄(queryFn 不收窄,收窄随消费方——工厂注释口径)。行结构经 PluginRow:
|
|
84
|
+
* icon=Hammer / badges=状态徽标(四键 label + 色点,色点 bg-current 继承旧状态色映射)/
|
|
85
|
+
* description=purpose / menu=⋯(标记运行[defined 态]/停止[running 态]/删除)/
|
|
86
|
+
* detail=tools 清单(name+description)+ lastError 红字。
|
|
87
|
+
*
|
|
88
|
+
* 动作链(迁旧面板 L838-877 逻辑照搬 + 两处增强):actionLoading 模式持在途插件 id,
|
|
89
|
+
* 该行菜单触发器与菜单项禁用;标记运行=改状态字段非真执行(设计 §7 缺陷 8 诚实化,
|
|
90
|
+
* L-06 真执行记账)→ invalidate worker 键;停止=先客户端 stopPlugin 再 serverFn 置
|
|
91
|
+
* stopped(顺序保证 worker 先停);删除=本任务新增确认 AlertDialog(旧面板 L975 直删
|
|
92
|
+
* 无确认),确认后才调 deletePluginFn。增强二(AGENTS PII 红线):catch 块不再输出
|
|
93
|
+
* 完整错误对象,只输出 message。
|
|
94
|
+
*/
|
|
95
|
+
export function WorkerSection(): ReactElement {
|
|
96
|
+
const queryClient = useQueryClient()
|
|
97
|
+
const [expandedId, setExpandedId] = useState<string | null>(null)
|
|
98
|
+
// 行级进行态(迁旧面板 actionLoading 模式):持在途操作插件 id,该行控件禁用
|
|
99
|
+
const [actionLoading, setActionLoading] = useState<string | null>(null)
|
|
100
|
+
// 待确认的删除操作(AlertDialog):本任务新增确认链
|
|
101
|
+
const [deleteTarget, setDeleteTarget] = useState<string | null>(null)
|
|
102
|
+
|
|
103
|
+
// WorkerSection 是 worker 查询(键 ['harness-plugins'])的**次级观察者**:页级 PluginPage
|
|
104
|
+
// 已用同一 factory 建观察者并据其聚合 loading/error/refresh(页级为查询生命周期归属方)。
|
|
105
|
+
// 次级观察者默认 retryOnMount/refetchOnMount=true,会在查询 error 后于挂载期重新拉取,
|
|
106
|
+
// 与页级观察者叠加成无限 refetch 循环、错误态永不收敛(实测 workerFn reject 时 workerFn
|
|
107
|
+
// 被反复调用、error 卡不出现)。故此处显式关闭挂载期重拉,查询生命周期(首次拉取/重试/
|
|
108
|
+
// invalidate 刷新)全权交由页级观察者驱动——本 Section 仅消费共享缓存数据。
|
|
109
|
+
const workerQuery = useQuery({
|
|
110
|
+
...harnessWorkerPluginsQueryOptions(),
|
|
111
|
+
retryOnMount: false,
|
|
112
|
+
refetchOnMount: false,
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
// 刷新(迁旧面板 refreshPlugins:invalidate worker 键,键走 queryOptions 工厂 T11)
|
|
116
|
+
const refreshPlugins = () => {
|
|
117
|
+
queryClient.invalidateQueries({ queryKey: HARNESS_WORKER_PLUGINS_QUERY_KEY })
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 标记运行(迁旧面板 handleRun L842-852)
|
|
121
|
+
const handleRun = async (plugin: WorkerPlugin) => {
|
|
122
|
+
setActionLoading(plugin.id)
|
|
123
|
+
try {
|
|
124
|
+
await setPluginStatusFn({ data: { id: plugin.id, status: "running" } })
|
|
125
|
+
refreshPlugins()
|
|
126
|
+
} catch (e) {
|
|
127
|
+
// PII 红线(任务增强二):只输出 message,不输出完整错误对象
|
|
128
|
+
console.error("Failed to run plugin:", e instanceof Error ? e.message : "unknown")
|
|
129
|
+
} finally {
|
|
130
|
+
setActionLoading(null)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 停止(迁旧面板 handleStop L854-865):先客户端 stopPlugin 再 serverFn 置 stopped
|
|
135
|
+
const handleStop = async (plugin: WorkerPlugin) => {
|
|
136
|
+
setActionLoading(plugin.id)
|
|
137
|
+
try {
|
|
138
|
+
stopPlugin(plugin.id)
|
|
139
|
+
await setPluginStatusFn({ data: { id: plugin.id, status: "stopped" } })
|
|
140
|
+
refreshPlugins()
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.error("Failed to stop plugin:", e instanceof Error ? e.message : "unknown")
|
|
143
|
+
} finally {
|
|
144
|
+
setActionLoading(null)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 删除(迁旧面板 handleDelete L867-877 + 本任务增强:入口先过确认 AlertDialog)
|
|
149
|
+
const handleDelete = async (plugin: WorkerPlugin) => {
|
|
150
|
+
setActionLoading(plugin.id)
|
|
151
|
+
try {
|
|
152
|
+
await deletePluginFn({ data: { id: plugin.id } })
|
|
153
|
+
setDeleteTarget(null)
|
|
154
|
+
refreshPlugins()
|
|
155
|
+
} catch (e) {
|
|
156
|
+
console.error("Failed to delete plugin:", e instanceof Error ? e.message : "unknown")
|
|
157
|
+
} finally {
|
|
158
|
+
setActionLoading(null)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// queryFn 返回原始列表(tools 为 Json),收窄在消费方(工厂注释口径)
|
|
163
|
+
const plugins: WorkerPlugin[] = (workerQuery.data ?? []).map((p) => ({
|
|
164
|
+
...p,
|
|
165
|
+
tools: toPluginTools(p.tools),
|
|
166
|
+
}))
|
|
167
|
+
const deleteTargetPlugin = plugins.find((p) => p.id === deleteTarget) ?? null
|
|
168
|
+
|
|
169
|
+
if (plugins.length === 0) {
|
|
170
|
+
return (
|
|
171
|
+
<section className="space-y-1">
|
|
172
|
+
<h3 className="text-sm font-semibold">{m.harness_panel_plugin_worker_title()}</h3>
|
|
173
|
+
<p className="text-xs text-muted-foreground">{m.harness_panel_plugin_worker_empty()}</p>
|
|
174
|
+
</section>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<section className="space-y-1">
|
|
180
|
+
<h3 className="text-sm font-semibold">{m.harness_panel_plugin_worker_title()}</h3>
|
|
181
|
+
<div className="space-y-1">
|
|
182
|
+
{plugins.map((p) => {
|
|
183
|
+
const statusConfig =
|
|
184
|
+
WORKER_STATUS_CONFIG[p.status as keyof typeof WORKER_STATUS_CONFIG] ??
|
|
185
|
+
WORKER_STATUS_CONFIG.defined
|
|
186
|
+
const rowPending = actionLoading === p.id
|
|
187
|
+
// detail:tools 清单 + lastError;两者皆空则不给展开(PluginRow 不渲染 chevron)
|
|
188
|
+
const detail: ReactNode =
|
|
189
|
+
p.tools.length > 0 || p.lastError ? (
|
|
190
|
+
<div className="space-y-1">
|
|
191
|
+
{p.tools.length > 0 && (
|
|
192
|
+
<div>
|
|
193
|
+
{/* "Tools" 小标题系迁旧面板原样(L986 硬编码英文,迁移豁免;简报仅批 4 删除键,无新 tools 键) */}
|
|
194
|
+
<p className="text-[10px] font-medium uppercase text-muted-foreground">Tools</p>
|
|
195
|
+
<ul className="mt-1 space-y-0.5">
|
|
196
|
+
{p.tools.map((tool, i: number) => (
|
|
197
|
+
<li key={i} className="text-xs">
|
|
198
|
+
<span className="text-muted-foreground">{p.name}/</span>
|
|
199
|
+
<span className="font-mono">{tool.name}</span>
|
|
200
|
+
{tool.description && (
|
|
201
|
+
<span className="ml-1 text-muted-foreground">{tool.description}</span>
|
|
202
|
+
)}
|
|
203
|
+
</li>
|
|
204
|
+
))}
|
|
205
|
+
</ul>
|
|
206
|
+
</div>
|
|
207
|
+
)}
|
|
208
|
+
{p.lastError && (
|
|
209
|
+
<div className="flex items-start gap-1 text-xs text-destructive">
|
|
210
|
+
<AlertCircle className="mt-0.5 size-3 shrink-0" />
|
|
211
|
+
{/* 红字落在文本节点自身(text-destructive),断言钉 lastError span 含该类 */}
|
|
212
|
+
<span className="break-all text-destructive">{p.lastError}</span>
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
) : null
|
|
217
|
+
return (
|
|
218
|
+
<PluginRow
|
|
219
|
+
key={p.id}
|
|
220
|
+
testId={`worker-row-${p.id}`}
|
|
221
|
+
icon={<Hammer className="size-6 text-muted-foreground" />}
|
|
222
|
+
title={p.name}
|
|
223
|
+
badges={
|
|
224
|
+
<Badge
|
|
225
|
+
variant="outline"
|
|
226
|
+
className={`px-1.5 py-0 text-[10px] ${statusConfig.color}`}
|
|
227
|
+
>
|
|
228
|
+
{/* 色点取徽标文字色(bg-current 继承旧状态色映射,设计 §3.5 徽标含色点) */}
|
|
229
|
+
<span className="size-1.5 rounded-full bg-current" />
|
|
230
|
+
{statusConfig.label()}
|
|
231
|
+
</Badge>
|
|
232
|
+
}
|
|
233
|
+
description={p.purpose}
|
|
234
|
+
detail={detail}
|
|
235
|
+
expanded={expandedId === p.id}
|
|
236
|
+
onExpandedChange={(v) => setExpandedId(v ? p.id : null)}
|
|
237
|
+
menu={
|
|
238
|
+
<DropdownMenu>
|
|
239
|
+
<DropdownMenuTrigger
|
|
240
|
+
render={
|
|
241
|
+
<Button
|
|
242
|
+
variant="ghost"
|
|
243
|
+
size="icon"
|
|
244
|
+
className="size-6"
|
|
245
|
+
disabled={rowPending}
|
|
246
|
+
aria-label={m.harness_workspace_moreActions()}
|
|
247
|
+
/>
|
|
248
|
+
}
|
|
249
|
+
>
|
|
250
|
+
<MoreHorizontal className="size-3.5 text-muted-foreground" />
|
|
251
|
+
</DropdownMenuTrigger>
|
|
252
|
+
<DropdownMenuContent align="end">
|
|
253
|
+
{p.status === "defined" && (
|
|
254
|
+
// 标记运行=改状态字段非真执行(设计 §7 缺陷 8 诚实化,文案已标注)
|
|
255
|
+
<DropdownMenuItem
|
|
256
|
+
disabled={rowPending}
|
|
257
|
+
onClick={() => void handleRun(p)}
|
|
258
|
+
>
|
|
259
|
+
<Play />
|
|
260
|
+
{m.harness_plugin_markRun()}
|
|
261
|
+
</DropdownMenuItem>
|
|
262
|
+
)}
|
|
263
|
+
{p.status === "running" && (
|
|
264
|
+
<DropdownMenuItem
|
|
265
|
+
disabled={rowPending}
|
|
266
|
+
onClick={() => void handleStop(p)}
|
|
267
|
+
>
|
|
268
|
+
<Square />
|
|
269
|
+
{m.harness_plugin_markStop()}
|
|
270
|
+
</DropdownMenuItem>
|
|
271
|
+
)}
|
|
272
|
+
<DropdownMenuItem
|
|
273
|
+
variant="destructive"
|
|
274
|
+
disabled={rowPending}
|
|
275
|
+
onClick={() => setDeleteTarget(p.id)}
|
|
276
|
+
>
|
|
277
|
+
<Trash2 />
|
|
278
|
+
{m.harness_panel_plugin_worker_delete_confirm()}
|
|
279
|
+
</DropdownMenuItem>
|
|
280
|
+
</DropdownMenuContent>
|
|
281
|
+
</DropdownMenu>
|
|
282
|
+
}
|
|
283
|
+
/>
|
|
284
|
+
)
|
|
285
|
+
})}
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
{/* 删除确认(本任务新增:旧面板 L975 直删无确认,规格补齐;禁原生 confirm)。
|
|
289
|
+
菜单项与确认钮共用 delete_confirm 键(「删除」),同旧面板 dshRemoveConfirm
|
|
290
|
+
菜单/确认同键先例 */}
|
|
291
|
+
<AlertDialog
|
|
292
|
+
open={deleteTarget !== null}
|
|
293
|
+
onOpenChange={(open) => {
|
|
294
|
+
if (!open) setDeleteTarget(null)
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
<AlertDialogContent>
|
|
298
|
+
<AlertDialogHeader>
|
|
299
|
+
<AlertDialogTitle>{m.harness_panel_plugin_worker_delete_title()}</AlertDialogTitle>
|
|
300
|
+
<AlertDialogDescription>
|
|
301
|
+
{m.harness_panel_plugin_worker_delete_body({
|
|
302
|
+
name: deleteTargetPlugin?.name ?? "",
|
|
303
|
+
})}
|
|
304
|
+
</AlertDialogDescription>
|
|
305
|
+
</AlertDialogHeader>
|
|
306
|
+
<AlertDialogFooter>
|
|
307
|
+
<AlertDialogCancel onClick={() => setDeleteTarget(null)}>
|
|
308
|
+
{m.harness_panel_plugin_worker_delete_cancel()}
|
|
309
|
+
</AlertDialogCancel>
|
|
310
|
+
<AlertDialogAction
|
|
311
|
+
onClick={() => {
|
|
312
|
+
if (deleteTargetPlugin) void handleDelete(deleteTargetPlugin)
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
{m.harness_panel_plugin_worker_delete_confirm()}
|
|
316
|
+
</AlertDialogAction>
|
|
317
|
+
</AlertDialogFooter>
|
|
318
|
+
</AlertDialogContent>
|
|
319
|
+
</AlertDialog>
|
|
320
|
+
</section>
|
|
321
|
+
)
|
|
322
|
+
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// 模型分组派生纯函数测试(P2 composer 控制,任务 1)。fixture 覆盖:
|
|
6
|
+
// seed 内模型(别名 writeKey)/ 自定义 id(裸 id)/ reasoningSupported 按
|
|
7
|
+
// adapterKind / 禁用 provider 被滤 / 能力与 contextWindow 透传 /
|
|
8
|
+
// id 并集 = availableModels(既有压扁口径)。过滤口径与 workbench-context.tsx
|
|
9
|
+
// availableModels(enabled && (hasKey || isLocal);cfgModels.length > 0 ?
|
|
10
|
+
// cfgModels : preset)逐字一致。
|
|
11
|
+
|
|
12
|
+
import { expect, test } from 'vitest'
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
buildProviderModelGroups,
|
|
16
|
+
findModelRow,
|
|
17
|
+
findModelEntry,
|
|
18
|
+
REASONING_ADAPTER_KINDS,
|
|
19
|
+
} from '../provider-model-groups'
|
|
20
|
+
|
|
21
|
+
/** listAiProvidersFn 返回元素投影(与 buildProviderModelGroups 入参同型)。 */
|
|
22
|
+
type ProviderInput = Parameters<typeof buildProviderModelGroups>[0][number]
|
|
23
|
+
|
|
24
|
+
// seed preset 内模型 + 用户自定义 id 混合勾选(writeKey 别名 vs 裸 id)
|
|
25
|
+
const openaiProvider: ProviderInput = {
|
|
26
|
+
meta: {
|
|
27
|
+
providerId: 'openai',
|
|
28
|
+
displayName: 'OpenAI',
|
|
29
|
+
iconSlug: 'openai',
|
|
30
|
+
brandColor: '#10A37F',
|
|
31
|
+
isLocal: false,
|
|
32
|
+
adapterKind: 'openai',
|
|
33
|
+
models: [
|
|
34
|
+
{
|
|
35
|
+
id: 'gpt-4o',
|
|
36
|
+
displayName: 'GPT-4o',
|
|
37
|
+
contextWindow: 128000,
|
|
38
|
+
capabilities: ['text', 'vision', 'tools'],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'o3-mini',
|
|
42
|
+
displayName: 'o3-mini',
|
|
43
|
+
contextWindow: 200000,
|
|
44
|
+
capabilities: ['text', 'reasoning', 'tools'],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
config: { enabled: true, hasKey: true, models: ['gpt-4o', 'my-custom-model'] },
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const anthropicProvider: ProviderInput = {
|
|
52
|
+
meta: {
|
|
53
|
+
providerId: 'anthropic',
|
|
54
|
+
displayName: 'Anthropic',
|
|
55
|
+
iconSlug: 'anthropic',
|
|
56
|
+
brandColor: '#D97757',
|
|
57
|
+
adapterKind: 'anthropic',
|
|
58
|
+
models: [
|
|
59
|
+
{
|
|
60
|
+
id: 'claude-sonnet-4-5',
|
|
61
|
+
displayName: 'Claude Sonnet 4.5',
|
|
62
|
+
contextWindow: 200000,
|
|
63
|
+
capabilities: ['text', 'reasoning'],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
config: { enabled: true, hasKey: true, models: [] },
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const openrouterProvider: ProviderInput = {
|
|
71
|
+
meta: {
|
|
72
|
+
providerId: 'openrouter',
|
|
73
|
+
displayName: 'OpenRouter',
|
|
74
|
+
iconSlug: 'openrouter',
|
|
75
|
+
brandColor: '#6467F2',
|
|
76
|
+
adapterKind: 'openrouter',
|
|
77
|
+
models: [
|
|
78
|
+
{
|
|
79
|
+
id: 'vendor/model',
|
|
80
|
+
displayName: 'Vendor Model',
|
|
81
|
+
contextWindow: 1000000,
|
|
82
|
+
capabilities: ['text'],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
config: { enabled: true, hasKey: true, models: [] },
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// seed 标注 reasoning 能力,但 gemini 适配器不消费 reasoning 参数(诚实白名单按 kind)
|
|
90
|
+
const geminiProvider: ProviderInput = {
|
|
91
|
+
meta: {
|
|
92
|
+
providerId: 'gemini',
|
|
93
|
+
displayName: 'Google Gemini',
|
|
94
|
+
iconSlug: 'gemini',
|
|
95
|
+
brandColor: '#4285F4',
|
|
96
|
+
adapterKind: 'gemini',
|
|
97
|
+
models: [
|
|
98
|
+
{
|
|
99
|
+
id: 'gemini-2.5-pro',
|
|
100
|
+
displayName: 'Gemini 2.5 Pro',
|
|
101
|
+
contextWindow: 2000000,
|
|
102
|
+
capabilities: ['text', 'reasoning'],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
config: { enabled: true, hasKey: true, models: ['gemini-2.5-pro'] },
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 自定义 OpenAI 兼容服务商:模型 id 自含斜杠且不在种子 preset → 裸 id writeKey
|
|
110
|
+
const customCompatibleProvider: ProviderInput = {
|
|
111
|
+
meta: {
|
|
112
|
+
providerId: 'custom-x',
|
|
113
|
+
displayName: '自定义服务商',
|
|
114
|
+
iconSlug: 'custom',
|
|
115
|
+
brandColor: '#6467F2',
|
|
116
|
+
adapterKind: 'openai-compatible',
|
|
117
|
+
models: [],
|
|
118
|
+
},
|
|
119
|
+
config: { enabled: true, hasKey: true, models: ['deepseek/deepseek-chat'] },
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const ollamaProvider: ProviderInput = {
|
|
123
|
+
meta: {
|
|
124
|
+
providerId: 'ollama',
|
|
125
|
+
displayName: 'Ollama',
|
|
126
|
+
iconSlug: 'ollama',
|
|
127
|
+
brandColor: '#000000',
|
|
128
|
+
isLocal: true,
|
|
129
|
+
adapterKind: 'ollama',
|
|
130
|
+
models: [{ id: 'llama3', displayName: 'Llama 3' }],
|
|
131
|
+
},
|
|
132
|
+
config: { enabled: true, hasKey: false, models: [] },
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const disabledProvider: ProviderInput = {
|
|
136
|
+
meta: {
|
|
137
|
+
providerId: 'disabled-p',
|
|
138
|
+
displayName: '停用服务商',
|
|
139
|
+
iconSlug: 'x',
|
|
140
|
+
brandColor: '#000000',
|
|
141
|
+
adapterKind: 'openai',
|
|
142
|
+
models: [{ id: 'm-a', displayName: 'M A' }],
|
|
143
|
+
},
|
|
144
|
+
config: { enabled: false, hasKey: true, models: ['m-a'] },
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const noKeyRemoteProvider: ProviderInput = {
|
|
148
|
+
meta: {
|
|
149
|
+
providerId: 'nokey-p',
|
|
150
|
+
displayName: '无Key远程',
|
|
151
|
+
iconSlug: 'x',
|
|
152
|
+
brandColor: '#000000',
|
|
153
|
+
adapterKind: 'openai',
|
|
154
|
+
models: [{ id: 'm-b', displayName: 'M B' }],
|
|
155
|
+
},
|
|
156
|
+
config: { enabled: true, hasKey: false, models: ['m-b'] },
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// hasKey=null(未配置容错口径):远程视同无 key,整组滤除
|
|
160
|
+
const nullKeyRemoteProvider: ProviderInput = {
|
|
161
|
+
meta: {
|
|
162
|
+
providerId: 'nullkey-p',
|
|
163
|
+
displayName: 'NullKey远程',
|
|
164
|
+
iconSlug: 'x',
|
|
165
|
+
brandColor: '#000000',
|
|
166
|
+
adapterKind: 'openai',
|
|
167
|
+
models: [{ id: 'm-c', displayName: 'M C' }],
|
|
168
|
+
},
|
|
169
|
+
config: { enabled: true, hasKey: null, models: ['m-c'] },
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
test('seed preset 内模型 writeKey 为 providerId/modelId 别名,用户自定义 id 为裸 id', () => {
|
|
173
|
+
const groups = buildProviderModelGroups([openaiProvider])
|
|
174
|
+
expect(groups).toHaveLength(1)
|
|
175
|
+
const group = groups[0]
|
|
176
|
+
expect(group.providerId).toBe('openai')
|
|
177
|
+
expect(group.displayName).toBe('OpenAI')
|
|
178
|
+
expect(group.iconSlug).toBe('openai')
|
|
179
|
+
expect(group.brandColor).toBe('#10A37F')
|
|
180
|
+
expect(group.isLocal).toBe(false)
|
|
181
|
+
|
|
182
|
+
const gpt4o = group.models.find((e) => e.id === 'gpt-4o')
|
|
183
|
+
const custom = group.models.find((e) => e.id === 'my-custom-model')
|
|
184
|
+
expect(gpt4o).toBeDefined()
|
|
185
|
+
expect(custom).toBeDefined()
|
|
186
|
+
|
|
187
|
+
// preset 内 → 别名 writeKey(harness 写入键)
|
|
188
|
+
expect(gpt4o!.writeKey).toBe('openai/gpt-4o')
|
|
189
|
+
// 自定义 id → 裸 id writeKey
|
|
190
|
+
expect(custom!.writeKey).toBe('my-custom-model')
|
|
191
|
+
|
|
192
|
+
// preset 元数据透传:displayName / contextWindow / capabilities
|
|
193
|
+
expect(gpt4o!.displayName).toBe('GPT-4o')
|
|
194
|
+
expect(gpt4o!.contextWindow).toBe(128000)
|
|
195
|
+
expect(gpt4o!.capabilities).toEqual(['text', 'vision', 'tools'])
|
|
196
|
+
// 自定义 id 无 preset 元数据
|
|
197
|
+
expect(custom!.displayName).toBeUndefined()
|
|
198
|
+
expect(custom!.contextWindow).toBeUndefined()
|
|
199
|
+
expect(custom!.capabilities).toBeUndefined()
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
test('reasoningSupported 仅 openai/anthropic/openrouter 三 kind 为 true', () => {
|
|
203
|
+
const groups = buildProviderModelGroups([
|
|
204
|
+
openaiProvider,
|
|
205
|
+
anthropicProvider,
|
|
206
|
+
openrouterProvider,
|
|
207
|
+
geminiProvider,
|
|
208
|
+
customCompatibleProvider,
|
|
209
|
+
ollamaProvider,
|
|
210
|
+
])
|
|
211
|
+
const reasoningByProvider = new Map(
|
|
212
|
+
groups.map((g) => [g.providerId, g.models.map((m) => m.reasoningSupported)]),
|
|
213
|
+
)
|
|
214
|
+
expect(reasoningByProvider.get('openai')).toEqual([true, true])
|
|
215
|
+
expect(reasoningByProvider.get('anthropic')).toEqual([true])
|
|
216
|
+
expect(reasoningByProvider.get('openrouter')).toEqual([true])
|
|
217
|
+
// gemini seed 标注 reasoning 能力也判 false(诚实白名单按 kind,不看 capability 标签)
|
|
218
|
+
expect(reasoningByProvider.get('gemini')).toEqual([false])
|
|
219
|
+
expect(reasoningByProvider.get('custom-x')).toEqual([false])
|
|
220
|
+
expect(reasoningByProvider.get('ollama')).toEqual([false])
|
|
221
|
+
expect(REASONING_ADAPTER_KINDS).toEqual(new Set(['openai', 'anthropic', 'openrouter']))
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
test('enabled=false 或 (无 key 且非本地) 的 provider 整组滤除', () => {
|
|
225
|
+
const groups = buildProviderModelGroups([
|
|
226
|
+
openaiProvider,
|
|
227
|
+
disabledProvider,
|
|
228
|
+
noKeyRemoteProvider,
|
|
229
|
+
nullKeyRemoteProvider,
|
|
230
|
+
ollamaProvider,
|
|
231
|
+
])
|
|
232
|
+
expect(groups.map((g) => g.providerId)).toEqual(['openai', 'ollama'])
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
test('groups 的模型 id 并集与 availableModels(既有压扁口径)逐元素一致', () => {
|
|
236
|
+
const providers = [
|
|
237
|
+
openaiProvider,
|
|
238
|
+
anthropicProvider,
|
|
239
|
+
openrouterProvider,
|
|
240
|
+
geminiProvider,
|
|
241
|
+
customCompatibleProvider,
|
|
242
|
+
ollamaProvider,
|
|
243
|
+
disabledProvider,
|
|
244
|
+
noKeyRemoteProvider,
|
|
245
|
+
nullKeyRemoteProvider,
|
|
246
|
+
]
|
|
247
|
+
// 既有压扁口径(workbench-context.tsx availableModels 原样复制)
|
|
248
|
+
const ids = new Set<string>()
|
|
249
|
+
for (const p of providers) {
|
|
250
|
+
if (!p.config.enabled || (!p.config.hasKey && !p.meta.isLocal)) continue
|
|
251
|
+
const cfgModels = p.config.models ?? []
|
|
252
|
+
const preset = Array.isArray(p.meta.models)
|
|
253
|
+
? p.meta.models.map((x) => (typeof x === 'string' ? x : x.id))
|
|
254
|
+
: []
|
|
255
|
+
// 与设置页口径一致:用户勾选列表为空则回退平台预置
|
|
256
|
+
const all = cfgModels.length > 0 ? cfgModels : preset
|
|
257
|
+
all.forEach((id) => ids.add(id))
|
|
258
|
+
}
|
|
259
|
+
const availableModels = [...ids]
|
|
260
|
+
|
|
261
|
+
const groups = buildProviderModelGroups(providers)
|
|
262
|
+
const groupIds = [...new Set(groups.flatMap((g) => g.models.map((m) => m.id)))]
|
|
263
|
+
expect(groupIds.sort()).toEqual(availableModels.slice().sort())
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
test('findModelEntry:裸 id / 别名形均命中,未命中返回 undefined', () => {
|
|
267
|
+
const groups = buildProviderModelGroups([openaiProvider, ollamaProvider])
|
|
268
|
+
// 别名形(harness settings.model 写入键回读)→ contextWindow 分母
|
|
269
|
+
expect(findModelEntry(groups, 'openai/gpt-4o')?.contextWindow).toBe(128000)
|
|
270
|
+
// 裸 id(单例/旧链/显示域)
|
|
271
|
+
expect(findModelEntry(groups, 'my-custom-model')?.id).toBe('my-custom-model')
|
|
272
|
+
expect(findModelEntry(groups, 'llama3')?.id).toBe('llama3')
|
|
273
|
+
// 未命中 / 空 → undefined(消费方回落 200k)
|
|
274
|
+
expect(findModelEntry(groups, 'unknown-model')).toBeUndefined()
|
|
275
|
+
expect(findModelEntry(groups, undefined)).toBeUndefined()
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
// 2026-11-21 打磨:条目 iconSlug 透传(触发钮/行图标与列表同源)+ findModelRow 返回分组域
|
|
279
|
+
it("iconSlug 自种子 preset 透传到条目;findModelRow 返回 { group, entry } 且裸 id/别名形都命中", () => {
|
|
280
|
+
const groups = buildProviderModelGroups([
|
|
281
|
+
{
|
|
282
|
+
meta: {
|
|
283
|
+
providerId: "openai",
|
|
284
|
+
displayName: "OpenAI",
|
|
285
|
+
iconSlug: "Openai",
|
|
286
|
+
brandColor: "",
|
|
287
|
+
adapterKind: "openai",
|
|
288
|
+
models: [{ id: "o1", displayName: "o1", iconSlug: "Openai" }],
|
|
289
|
+
},
|
|
290
|
+
config: { enabled: true, hasKey: true, models: ["o1"] },
|
|
291
|
+
},
|
|
292
|
+
])
|
|
293
|
+
expect(groups[0].models[0].iconSlug).toBe("Openai")
|
|
294
|
+
const byBare = findModelRow(groups, "o1")
|
|
295
|
+
expect(byBare?.group.providerId).toBe("openai")
|
|
296
|
+
expect(byBare?.entry.id).toBe("o1")
|
|
297
|
+
const byAlias = findModelRow(groups, "openai/o1")
|
|
298
|
+
expect(byAlias?.entry.id).toBe("o1")
|
|
299
|
+
expect(findModelRow(groups, undefined)).toBeUndefined()
|
|
300
|
+
expect(findModelRow(groups, "missing")).toBeUndefined()
|
|
301
|
+
})
|