@allbluecn/web-app 0.27.40 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/public/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/public/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/public/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/public/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/public/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/public/pdfjs/cmaps/LICENSE +36 -0
- package/public/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/public/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/public/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Roman.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/V.bcmap +0 -0
- package/public/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/src/components/ai/ai-prompt-input/index.tsx +3 -87
- package/src/components/ai-elements/__tests__/context.test.tsx +167 -0
- package/src/components/ai-elements/context.tsx +182 -94
- package/src/components/ai-elements/prompt-input.tsx +6 -104
- package/src/components/harness/__tests__/composer-attachments.test.tsx +17 -9
- package/src/components/harness/__tests__/composer-click-focus.test.tsx +175 -0
- package/src/components/harness/__tests__/composer-focus.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-keymap.test.ts +57 -0
- package/src/components/harness/__tests__/composer-paste.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-pending-guard.test.tsx +207 -0
- package/src/components/harness/__tests__/composer-placeholder.test.ts +7 -6
- package/src/components/harness/__tests__/composer-plus-menu.test.tsx +202 -0
- package/src/components/harness/__tests__/composer-primary-button.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-send.test.tsx +12 -4
- package/src/components/harness/__tests__/composer-undo.test.tsx +7 -0
- package/src/components/harness/__tests__/dock-registry.test.ts +3 -0
- package/src/components/harness/__tests__/harness-workbench-auth-error.test.tsx +42 -4
- package/src/components/harness/__tests__/mention-kbid.test.ts +69 -0
- package/src/components/harness/__tests__/undo-last-turn.test.ts +134 -0
- package/src/components/harness/__tests__/voice-activity.test.tsx +2 -2
- package/src/components/harness/conversation-panel/composer/__tests__/file-chip-open.test.tsx +195 -0
- package/src/components/harness/conversation-panel/composer/__tests__/menu-view.test.tsx +107 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-attachments.test.tsx +271 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-client-submit.test.tsx +291 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-guard.test.tsx +275 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-permission.test.tsx +286 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-plan.test.tsx +344 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-popup.test.tsx +193 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-server-source.test.tsx +235 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-suggestion-menu.test.tsx +151 -1
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-undo.test.tsx +168 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/exclude-composer-seat.test.ts +106 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/menu-view.test.tsx +55 -2
- package/src/components/harness/conversation-panel/composer/command/__tests__/skill-source.test.tsx +336 -0
- package/src/components/harness/conversation-panel/composer/command/claim.ts +7 -1
- package/src/components/harness/conversation-panel/composer/command/command-popup.tsx +140 -0
- package/src/components/harness/conversation-panel/composer/command/command-suggestion-menu.tsx +261 -75
- package/src/components/harness/conversation-panel/composer/command/menu-view.tsx +188 -50
- package/src/components/harness/conversation-panel/composer/command/popup-panel.tsx +106 -0
- package/src/components/harness/conversation-panel/composer/command/skill-source.ts +231 -0
- package/src/components/harness/conversation-panel/composer/composer-editor.tsx +216 -14
- package/src/components/harness/conversation-panel/composer/composer-keymap.ts +26 -0
- package/src/components/harness/conversation-panel/composer/extension/__tests__/command-menu.test.ts +128 -12
- package/src/components/harness/conversation-panel/composer/extension/command-menu.ts +303 -44
- package/src/components/harness/conversation-panel/composer/extension/index.ts +8 -0
- package/src/components/harness/conversation-panel/composer/harness-composer.tsx +551 -83
- package/src/components/harness/conversation-panel/composer/mention/__tests__/file-mention.test.tsx +517 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-source-registration.test.tsx +5 -2
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-suggestion-menu.test.tsx +120 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-trigger-source.test.ts +52 -9
- package/src/components/harness/conversation-panel/composer/mention/__tests__/story-mention.test.tsx +356 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/thread-mention.test.tsx +377 -0
- package/src/components/harness/conversation-panel/composer/mention/file-mention.ts +162 -0
- package/src/components/harness/conversation-panel/composer/mention/mention-resolvers.ts +6 -0
- package/src/components/harness/conversation-panel/composer/mention/mention-suggestion-menu.tsx +212 -107
- package/src/components/harness/conversation-panel/composer/mention/mention-trigger-source.ts +71 -8
- package/src/components/harness/conversation-panel/composer/mention/story-mention.ts +131 -0
- package/src/components/harness/conversation-panel/composer/mention/thread-mention.ts +159 -0
- package/src/components/harness/conversation-panel/composer/mention/use-mention-sources.ts +9 -1
- package/src/components/harness/conversation-panel/composer/model-selector/__tests__/model-selector.test.tsx +401 -0
- package/src/components/harness/conversation-panel/composer/model-selector/__tests__/wiring.test.ts +117 -0
- package/src/components/harness/conversation-panel/composer/model-selector/model-selector-panel.tsx +411 -0
- package/src/components/harness/conversation-panel/composer/model-selector/model-selector-trigger.tsx +254 -0
- package/src/components/harness/conversation-panel/composer/model-selector/wiring.ts +112 -0
- package/src/components/harness/conversation-panel/composer/permission/__tests__/permission-select.test.tsx +264 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-policy.ts +76 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-popup.tsx +302 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-select-button.tsx +140 -0
- package/src/components/harness/conversation-panel/composer/workspace/__tests__/workspace-select.test.tsx +390 -0
- package/src/components/harness/conversation-panel/composer/workspace/workspace-select-button.tsx +367 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/__tests__/use-harness-session-putmedia.test.tsx +17 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +26 -6
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +21 -3
- package/src/components/harness/extension-panel/dock/__tests__/dock-persist.test.ts +2 -1
- package/src/components/harness/extension-panel/dock/__tests__/guide-page.test.tsx +44 -3
- package/src/components/harness/extension-panel/dock/dock-persist.ts +6 -4
- package/src/components/harness/extension-panel/dock/dock-registry.ts +35 -14
- package/src/components/harness/extension-panel/dock/dock-surface.tsx +2 -0
- package/src/components/harness/extension-panel/dock/guide-page.tsx +75 -45
- package/src/components/harness/extension-panel/panels/browser/__tests__/webview-frame.test.tsx +5 -2
- package/src/components/harness/extension-panel/panels/plugin/__tests__/install-dialog.test.tsx +260 -0
- package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-page.test.tsx +912 -0
- package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-row.test.tsx +215 -0
- package/src/components/harness/extension-panel/panels/plugin/builtin-section.tsx +204 -0
- package/src/components/harness/extension-panel/panels/plugin/install-dialog.tsx +195 -0
- package/src/components/harness/extension-panel/panels/plugin/installed-section.tsx +378 -0
- package/src/components/harness/extension-panel/panels/plugin/kind.tsx +17 -4
- package/src/components/harness/extension-panel/panels/plugin/pending-builds-block.tsx +49 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-page.tsx +257 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-row.tsx +206 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-types.ts +13 -0
- package/src/components/harness/extension-panel/panels/plugin/worker-section.tsx +322 -0
- package/src/components/harness/workbench/__tests__/provider-model-groups.test.ts +301 -0
- package/src/components/harness/workbench/harness-workbench-page.tsx +164 -2
- package/src/components/harness/workbench/provider-model-groups.ts +140 -0
- package/src/components/harness/workbench/undo-last-turn.ts +79 -0
- package/src/components/harness/workbench/workbench-context.tsx +53 -3
- package/src/components/tiptap/hooks/__tests__/use-floating-element.test.tsx +131 -0
- package/src/components/tiptap/hooks/use-floating-element.ts +15 -2
- package/src/components/tiptap/hooks/use-menu-navigation.ts +5 -0
- package/src/components/tiptap/node/mention-extension.ts +33 -0
- package/src/components/tiptap/ui/suggestion-menu/__tests__/suggestion-menu.test.tsx +366 -0
- package/src/components/tiptap/ui/suggestion-menu/suggestion-menu-types.ts +54 -0
- package/src/components/tiptap/ui/suggestion-menu/suggestion-menu.tsx +176 -45
- package/src/lib/changelog/sdk-versions.ts +2 -2
- package/src/lib/queries/__tests__/harness-plugin-queries.test.ts +49 -0
- package/src/lib/queries/harness.ts +50 -0
- package/src/paraglide/messages/_index.js +1574 -311
- package/src/paraglide/messages/en.js +513 -103
- package/src/paraglide/messages/zh.js +514 -104
- package/src/routeTree.gen.ts +31 -0
- package/src/routes/_nav/harness/route.lazy.tsx +13 -0
- package/src/server/ai-gateway/sandbox/policy.ts +6 -6
- package/src/server/harness/__tests__/compact-plugin.server.test.ts +46 -0
- package/src/server/harness/__tests__/define-expose.test.ts +17 -0
- package/src/server/harness/__tests__/thread-reference.server.test.ts +258 -0
- package/src/server/harness/define.server.ts +21 -3
- package/src/server/harness/thread-reference.server.ts +446 -0
- package/src/server/serverFns/chat/__tests__/conversations-sandbox-default.test.ts +23 -0
- package/src/server/serverFns/chat/conversations.ts +18 -3
- package/src/server/serverFns/harness/search-mention-candidates.ts +14 -1
- package/src/shared/harness/__tests__/thread-reference-format.test.ts +128 -0
- package/src/shared/harness/thread-reference-format.ts +98 -0
- package/LICENSE +0 -661
- package/src/components/agents/slash-skill-menu.tsx +0 -75
- package/src/components/harness/conversation-panel/composer/extension/__tests__/demo-story-reference.test.tsx +0 -177
- package/src/components/harness/conversation-panel/composer/extension/demo-story-reference.tsx +0 -227
- package/src/components/harness/conversation-panel/composer/plugin-mention-menu.tsx +0 -109
- package/src/components/harness/extension-panel/panels/plugin-panel.tsx +0 -1021
|
@@ -1,1021 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
// 插件面板三 tab(F2-4,设计 §4.2.3):内置(活,读 AssemblyReport 诊断)/ DSH 兼容
|
|
19
|
-
// (F3-6 占位)/ 用户 Worker(原单列表迁入)。dock tab `plugin` 挂载点与 onClose 不变。
|
|
20
|
-
//
|
|
21
|
-
// ⚠ 客户端禁值 import `@allbluecn/dsh-compat`:内置 tab 的 AssemblyReport 经
|
|
22
|
-
// getHarnessPluginReportFn 的 RPC DTO 下发(纯数据 JSON),类型从 serverFn 返回值派生,
|
|
23
|
-
// 不从包运行时导入。
|
|
24
|
-
|
|
25
|
-
import { useState } from "react";
|
|
26
|
-
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
27
|
-
import {
|
|
28
|
-
AlertCircle,
|
|
29
|
-
ArrowUpCircle,
|
|
30
|
-
CheckCircle2,
|
|
31
|
-
ChevronDown,
|
|
32
|
-
Download,
|
|
33
|
-
Layers,
|
|
34
|
-
MinusCircle,
|
|
35
|
-
Play,
|
|
36
|
-
Puzzle,
|
|
37
|
-
ShieldAlert,
|
|
38
|
-
Square,
|
|
39
|
-
Trash2,
|
|
40
|
-
XCircle,
|
|
41
|
-
} from "lucide-react";
|
|
42
|
-
import {
|
|
43
|
-
AlertDialog,
|
|
44
|
-
AlertDialogAction,
|
|
45
|
-
AlertDialogCancel,
|
|
46
|
-
AlertDialogContent,
|
|
47
|
-
AlertDialogDescription,
|
|
48
|
-
AlertDialogFooter,
|
|
49
|
-
AlertDialogHeader,
|
|
50
|
-
AlertDialogTitle,
|
|
51
|
-
} from "@/components/ui/alert-dialog";
|
|
52
|
-
import { Badge } from "@/components/ui/badge";
|
|
53
|
-
import { Button } from "@/components/ui/button"
|
|
54
|
-
import {
|
|
55
|
-
Tooltip,
|
|
56
|
-
TooltipContent,
|
|
57
|
-
TooltipTrigger,
|
|
58
|
-
} from "@/components/ui/tooltip";
|
|
59
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
|
60
|
-
import { Input } from "@/components/ui/input";
|
|
61
|
-
import { Switch } from "@/components/ui/switch";
|
|
62
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
63
|
-
import { listPluginsFn, setPluginStatusFn, deletePluginFn } from "@/server/serverFns/plugins/harness-plugins";
|
|
64
|
-
import { getHarnessPluginReportFn, setBuiltinPluginEnabledFn } from "@/server/serverFns/harness/plugins";
|
|
65
|
-
import {
|
|
66
|
-
approveDshBuildsFn,
|
|
67
|
-
getDshInstalledFn,
|
|
68
|
-
getDshPendingBuildsFn,
|
|
69
|
-
installDshPluginFn,
|
|
70
|
-
removeDshPluginFn,
|
|
71
|
-
setDshPluginEnabledFn,
|
|
72
|
-
updateDshPluginFn,
|
|
73
|
-
} from "@/server/serverFns/harness/dsh-plugins";
|
|
74
|
-
import { stopPlugin } from "@/lib/plugin-runtime/plugin-client";
|
|
75
|
-
import { m } from "@/paraglide/messages.js";
|
|
76
|
-
|
|
77
|
-
// 状态徽标 label 用惰性函数:避免模块求值时固化语言,运行时切语言后仍能更新
|
|
78
|
-
const STATUS_CONFIG = {
|
|
79
|
-
defined: { label: () => m.harness_plugin_status_defined(), color: "bg-muted text-muted-foreground" },
|
|
80
|
-
running: { label: () => m.harness_plugin_status_running(), color: "bg-green-500/20 text-green-500" },
|
|
81
|
-
stopped: { label: () => m.harness_plugin_status_stopped(), color: "bg-orange-500/20 text-orange-500" },
|
|
82
|
-
error: { label: () => m.harness_plugin_status_error(), color: "bg-red-500/20 text-red-500" },
|
|
83
|
-
} as const;
|
|
84
|
-
|
|
85
|
-
interface PluginTool {
|
|
86
|
-
name: string;
|
|
87
|
-
description?: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** serverFn 返回行类型(tools 为 Json 载荷)派生,避免手写漂移 */
|
|
91
|
-
type Plugin = Omit<Awaited<ReturnType<typeof listPluginsFn>>[number], "tools"> & {
|
|
92
|
-
tools: PluginTool[];
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/** tools 落库为 Json:逐项收窄为 PluginTool,异常形状直接丢弃 */
|
|
96
|
-
function toPluginTools(value: unknown): PluginTool[] {
|
|
97
|
-
if (!Array.isArray(value)) return [];
|
|
98
|
-
return value.filter(
|
|
99
|
-
(t): t is PluginTool =>
|
|
100
|
-
typeof t === "object" &&
|
|
101
|
-
t !== null &&
|
|
102
|
-
typeof (t as { name?: unknown }).name === "string",
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** 内置 tab:AssemblyReport 诊断(纯数据 DTO,类型自 serverFn 返回值派生) */
|
|
107
|
-
type HarnessReport = Awaited<ReturnType<typeof getHarnessPluginReportFn>>["report"];
|
|
108
|
-
|
|
109
|
-
/** 内置域 patch id(base-patch 七域),面板 toggle 的域清单单一来源。 */
|
|
110
|
-
const BUILTIN_DOMAIN_IDS = [
|
|
111
|
-
"allblue/knowledge",
|
|
112
|
-
"allblue/project",
|
|
113
|
-
"allblue/story",
|
|
114
|
-
"allblue/bug",
|
|
115
|
-
"allblue/testcase",
|
|
116
|
-
"allblue/design",
|
|
117
|
-
"allblue/task",
|
|
118
|
-
] as const;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 内置域启停清单(F2-5 域级 toggle)。
|
|
122
|
-
*
|
|
123
|
-
* 每域 enabled 判定:不在 report.disabled 即启用(activated=真激活;deactivated/failed
|
|
124
|
-
* 属注入/激活异常但未被判停用——re-enable 语义仍成立,故都视为可启)。canManage=false
|
|
125
|
-
* 时 Switch 禁用(只读诊断)。
|
|
126
|
-
*/
|
|
127
|
-
function BuiltinDomainToggles({
|
|
128
|
-
report,
|
|
129
|
-
canManage,
|
|
130
|
-
onToggle,
|
|
131
|
-
pending,
|
|
132
|
-
}: {
|
|
133
|
-
report: HarnessReport;
|
|
134
|
-
canManage: boolean;
|
|
135
|
-
onToggle: (domain: string, enabled: boolean) => void;
|
|
136
|
-
pending: boolean;
|
|
137
|
-
}) {
|
|
138
|
-
const disabledIds = new Set(report.disabled.map((p) => p.id));
|
|
139
|
-
const domains = BUILTIN_DOMAIN_IDS.map((id) => ({
|
|
140
|
-
id,
|
|
141
|
-
label: id.split("/")[1] ?? id,
|
|
142
|
-
enabled: !disabledIds.has(id),
|
|
143
|
-
}));
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<section>
|
|
147
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
148
|
-
{m.harness_plugin_builtinTitle()}
|
|
149
|
-
</p>
|
|
150
|
-
<ul className="space-y-1">
|
|
151
|
-
{domains.map((d) => (
|
|
152
|
-
<li
|
|
153
|
-
key={d.id}
|
|
154
|
-
className="flex items-center justify-between gap-2 rounded-md border bg-background px-2 py-1.5"
|
|
155
|
-
>
|
|
156
|
-
<span className="truncate font-mono text-xs">{d.label}</span>
|
|
157
|
-
<Switch
|
|
158
|
-
size="sm"
|
|
159
|
-
checked={d.enabled}
|
|
160
|
-
disabled={!canManage || pending}
|
|
161
|
-
aria-label={`${d.label}`}
|
|
162
|
-
onCheckedChange={(checked) => onToggle(d.id, checked === true)}
|
|
163
|
-
/>
|
|
164
|
-
</li>
|
|
165
|
-
))}
|
|
166
|
-
</ul>
|
|
167
|
-
</section>
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function BuiltinTab() {
|
|
172
|
-
const { data, isLoading } = useQuery({
|
|
173
|
-
queryKey: ["harness-plugin-report"],
|
|
174
|
-
queryFn: () => getHarnessPluginReportFn(),
|
|
175
|
-
refetchOnMount: true,
|
|
176
|
-
});
|
|
177
|
-
const queryClient = useQueryClient();
|
|
178
|
-
// 待确认的启停操作(AlertDialog):域 id + 目标态
|
|
179
|
-
const [pendingToggle, setPendingToggle] = useState<{ domain: string; enabled: boolean } | null>(
|
|
180
|
-
null,
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
const toggleMutation = useMutation({
|
|
184
|
-
mutationFn: (input: { domain: string; enabled: boolean }) =>
|
|
185
|
-
setBuiltinPluginEnabledFn({ data: input }),
|
|
186
|
-
onSuccess: () => {
|
|
187
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugin-report"] });
|
|
188
|
-
setPendingToggle(null);
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
if (isLoading) {
|
|
193
|
-
return (
|
|
194
|
-
<div className="flex items-center justify-center py-8 text-muted-foreground">
|
|
195
|
-
<p className="text-xs">{m.common_loading()}</p>
|
|
196
|
-
</div>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (!data) {
|
|
201
|
-
return (
|
|
202
|
-
<div className="flex flex-col items-center gap-2 py-8 text-center">
|
|
203
|
-
<Puzzle className="size-8 text-muted-foreground/50" />
|
|
204
|
-
<p className="text-xs text-muted-foreground">{m.harness_plugin_empty()}</p>
|
|
205
|
-
</div>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const { report, canManage } = data;
|
|
210
|
-
const total =
|
|
211
|
-
report.activated.length +
|
|
212
|
-
report.deactivated.length +
|
|
213
|
-
report.failed.length +
|
|
214
|
-
report.disabled.length;
|
|
215
|
-
const isToggling = toggleMutation.isPending;
|
|
216
|
-
|
|
217
|
-
return (
|
|
218
|
-
<div className="space-y-3">
|
|
219
|
-
<div className="flex items-center justify-between gap-2">
|
|
220
|
-
<p className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
|
|
221
|
-
<Layers className="size-3.5" />
|
|
222
|
-
{m.harness_plugin_surfaceVersion({ version: report.surfaceVersion })}
|
|
223
|
-
</p>
|
|
224
|
-
{!canManage && (
|
|
225
|
-
<Badge variant="outline" className="px-1.5 py-0 text-[10px]">
|
|
226
|
-
{/* text-[10px] 保留:徽标「只读」密度对齐小字,标准 text-xs 偏大(F2-4 minor justification) */}
|
|
227
|
-
{m.harness_plugin_readOnly()}
|
|
228
|
-
</Badge>
|
|
229
|
-
)}
|
|
230
|
-
</div>
|
|
231
|
-
|
|
232
|
-
{canManage && (
|
|
233
|
-
<BuiltinDomainToggles
|
|
234
|
-
report={report}
|
|
235
|
-
canManage={canManage}
|
|
236
|
-
pending={isToggling}
|
|
237
|
-
onToggle={(domain, enabled) => setPendingToggle({ domain, enabled })}
|
|
238
|
-
/>
|
|
239
|
-
)}
|
|
240
|
-
|
|
241
|
-
{total === 0 ? (
|
|
242
|
-
<div className="flex flex-col items-center gap-2 py-6 text-center">
|
|
243
|
-
<Puzzle className="size-8 text-muted-foreground/50" />
|
|
244
|
-
<p className="text-xs text-muted-foreground">{m.harness_plugin_builtinEmpty()}</p>
|
|
245
|
-
</div>
|
|
246
|
-
) : (
|
|
247
|
-
<>
|
|
248
|
-
{/* 已激活 */}
|
|
249
|
-
{report.activated.length > 0 && (
|
|
250
|
-
<section>
|
|
251
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
252
|
-
{m.harness_plugin_activated()} · {report.activated.length}
|
|
253
|
-
</p>
|
|
254
|
-
<ul className="space-y-0.5">
|
|
255
|
-
{report.activated.map((p) => (
|
|
256
|
-
<li key={p.id} className="flex items-center gap-1.5 text-xs">
|
|
257
|
-
<CheckCircle2 className="size-3 shrink-0 text-green-500" />
|
|
258
|
-
<span className="font-mono">{p.name || p.id}</span>
|
|
259
|
-
</li>
|
|
260
|
-
))}
|
|
261
|
-
</ul>
|
|
262
|
-
</section>
|
|
263
|
-
)}
|
|
264
|
-
|
|
265
|
-
{/* 未激活(inject 缺服务) */}
|
|
266
|
-
{report.deactivated.length > 0 && (
|
|
267
|
-
<section>
|
|
268
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
269
|
-
{m.harness_plugin_deactivated()} · {report.deactivated.length}
|
|
270
|
-
</p>
|
|
271
|
-
<ul className="space-y-1">
|
|
272
|
-
{report.deactivated.map((p) => (
|
|
273
|
-
<li key={p.id} className="flex items-start gap-1.5 text-xs">
|
|
274
|
-
<AlertCircle className="mt-0.5 size-3 shrink-0 text-orange-500" />
|
|
275
|
-
<div className="min-w-0">
|
|
276
|
-
<span className="font-mono">{p.name ?? p.id}</span>
|
|
277
|
-
<p className="break-all text-muted-foreground">
|
|
278
|
-
{m.harness_plugin_missingServices({ services: p.missing.join(", ") })}
|
|
279
|
-
</p>
|
|
280
|
-
</div>
|
|
281
|
-
</li>
|
|
282
|
-
))}
|
|
283
|
-
</ul>
|
|
284
|
-
</section>
|
|
285
|
-
)}
|
|
286
|
-
|
|
287
|
-
{/* 激活失败 */}
|
|
288
|
-
{report.failed.length > 0 && (
|
|
289
|
-
<section>
|
|
290
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
291
|
-
{m.harness_plugin_failed()} · {report.failed.length}
|
|
292
|
-
</p>
|
|
293
|
-
<ul className="space-y-1">
|
|
294
|
-
{report.failed.map((p) => (
|
|
295
|
-
<li key={p.id} className="flex items-start gap-1.5 text-xs">
|
|
296
|
-
<XCircle className="mt-0.5 size-3 shrink-0 text-red-500" />
|
|
297
|
-
<div className="min-w-0">
|
|
298
|
-
<span className="font-mono">{p.name || p.id}</span>
|
|
299
|
-
<p className="break-all text-red-500">
|
|
300
|
-
{m.harness_plugin_errorLabel({ error: p.error })}
|
|
301
|
-
</p>
|
|
302
|
-
</div>
|
|
303
|
-
</li>
|
|
304
|
-
))}
|
|
305
|
-
</ul>
|
|
306
|
-
</section>
|
|
307
|
-
)}
|
|
308
|
-
|
|
309
|
-
{/* 已停用 */}
|
|
310
|
-
{report.disabled.length > 0 && (
|
|
311
|
-
<section>
|
|
312
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
313
|
-
{m.harness_plugin_disabled()} · {report.disabled.length}
|
|
314
|
-
</p>
|
|
315
|
-
<ul className="space-y-0.5">
|
|
316
|
-
{report.disabled.map((p) => (
|
|
317
|
-
<li key={p.id} className="flex items-center gap-1.5 text-xs">
|
|
318
|
-
<MinusCircle className="size-3 shrink-0 text-muted-foreground" />
|
|
319
|
-
<span className="font-mono">{p.id}</span>
|
|
320
|
-
</li>
|
|
321
|
-
))}
|
|
322
|
-
</ul>
|
|
323
|
-
</section>
|
|
324
|
-
)}
|
|
325
|
-
</>
|
|
326
|
-
)}
|
|
327
|
-
|
|
328
|
-
{/* 启停确认(禁原生 confirm):提示重建会中断进行中回合(规格 §4.2.2) */}
|
|
329
|
-
<AlertDialog
|
|
330
|
-
open={pendingToggle !== null}
|
|
331
|
-
onOpenChange={(open) => {
|
|
332
|
-
if (!open) setPendingToggle(null);
|
|
333
|
-
}}
|
|
334
|
-
>
|
|
335
|
-
<AlertDialogContent>
|
|
336
|
-
<AlertDialogHeader>
|
|
337
|
-
<AlertDialogTitle>{m.harness_plugin_builtinToggleTitle()}</AlertDialogTitle>
|
|
338
|
-
<AlertDialogDescription>
|
|
339
|
-
{m.harness_plugin_restartConfirmDescription()}
|
|
340
|
-
</AlertDialogDescription>
|
|
341
|
-
</AlertDialogHeader>
|
|
342
|
-
<AlertDialogFooter>
|
|
343
|
-
<AlertDialogCancel onClick={() => setPendingToggle(null)}>
|
|
344
|
-
{m.harness_plugin_restartConfirmCancel()}
|
|
345
|
-
</AlertDialogCancel>
|
|
346
|
-
<AlertDialogAction
|
|
347
|
-
onClick={() => {
|
|
348
|
-
if (pendingToggle) toggleMutation.mutate(pendingToggle);
|
|
349
|
-
}}
|
|
350
|
-
>
|
|
351
|
-
{m.harness_plugin_restartConfirmAction()}
|
|
352
|
-
</AlertDialogAction>
|
|
353
|
-
</AlertDialogFooter>
|
|
354
|
-
</AlertDialogContent>
|
|
355
|
-
</AlertDialog>
|
|
356
|
-
</div>
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* 安装来源形态标签(对齐 installer specKind 判定:git+ / .tgz / 路径 / registry)。
|
|
362
|
-
* 纯字符串判定,无运行时依赖,客户端安全。
|
|
363
|
-
*/
|
|
364
|
-
function installSourceLabel(spec: string | undefined): string {
|
|
365
|
-
const s = (spec ?? "").trim();
|
|
366
|
-
if (s.startsWith("git+") || s.startsWith("git://")) {
|
|
367
|
-
return m.harness_plugin_dshSourceGit();
|
|
368
|
-
}
|
|
369
|
-
if (s.endsWith(".tgz")) {
|
|
370
|
-
return m.harness_plugin_dshSourceTarball();
|
|
371
|
-
}
|
|
372
|
-
if (s.startsWith("/") || s.startsWith("./") || s.startsWith("../")) {
|
|
373
|
-
return m.harness_plugin_dshSourcePath();
|
|
374
|
-
}
|
|
375
|
-
return m.harness_plugin_dshSourceRegistry();
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* 单个已装 bundle 的激活诊断(把 AssemblyReport 四桶归到该 bundle 名下)。
|
|
380
|
-
* id/name 命中即归桶:activated > failed > disabled > deactivated(inject 缺服务);
|
|
381
|
-
* 四桶都未命中 = 组装期未见该 bundle(如 patch 文件读失败被隔离跳过)→ unknown。
|
|
382
|
-
*/
|
|
383
|
-
function dshActivationStatus(
|
|
384
|
-
report: HarnessReport,
|
|
385
|
-
name: string,
|
|
386
|
-
): {
|
|
387
|
-
key: "activated" | "deactivated" | "failed" | "disabled" | "unknown";
|
|
388
|
-
missing: string[];
|
|
389
|
-
error: string;
|
|
390
|
-
} {
|
|
391
|
-
if (report.activated.some((p) => p.id === name || p.name === name)) {
|
|
392
|
-
return { key: "activated", missing: [], error: "" };
|
|
393
|
-
}
|
|
394
|
-
const failed = report.failed.find((p) => p.id === name || p.name === name);
|
|
395
|
-
if (failed) {
|
|
396
|
-
return { key: "failed", missing: [], error: failed.error };
|
|
397
|
-
}
|
|
398
|
-
if (report.disabled.some((p) => p.id === name)) {
|
|
399
|
-
return { key: "disabled", missing: [], error: "" };
|
|
400
|
-
}
|
|
401
|
-
const deactivated = report.deactivated.find((p) => p.id === name || p.name === name);
|
|
402
|
-
if (deactivated) {
|
|
403
|
-
return { key: "deactivated", missing: [...deactivated.missing], error: "" };
|
|
404
|
-
}
|
|
405
|
-
return { key: "unknown", missing: [], error: "" };
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/** DSH tab 激活诊断状态徽标(label 惰性求值,避免模块求值固化语言)。 */
|
|
409
|
-
const DSH_STATUS_CONFIG = {
|
|
410
|
-
activated: { label: () => m.harness_plugin_dshStatusActivated(), color: "bg-green-500/20 text-green-500" },
|
|
411
|
-
deactivated: { label: () => m.harness_plugin_dshStatusDeactivated(), color: "bg-orange-500/20 text-orange-500" },
|
|
412
|
-
failed: { label: () => m.harness_plugin_dshStatusFailed(), color: "bg-red-500/20 text-red-500" },
|
|
413
|
-
disabled: { label: () => m.harness_plugin_dshStatusDisabled(), color: "bg-muted text-muted-foreground" },
|
|
414
|
-
unknown: { label: () => m.harness_plugin_dshStatusUnknown(), color: "bg-muted text-muted-foreground" },
|
|
415
|
-
} as const;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* DSH 兼容 tab(F3-4a 面板通道:install/remove/启停最小入口 + PRE-5 安装审批 + PRE-3 构建脚本审批)。
|
|
419
|
-
*
|
|
420
|
-
* F3-6 完整化:已装列表(name/version/source/激活状态/inject 满足态)+ 激活诊断逐条
|
|
421
|
-
* (deactivated missing / failed error / disabled)+ 更新入口(updateDshPluginFn,canManage 门控)
|
|
422
|
-
* + dsh.client 半体文案(「服务端半体已激活;UI 半体不支持」,规格 §4.2.3 / §8 差异 1)。
|
|
423
|
-
*
|
|
424
|
-
* 消费 dsh-plugins serverFn + getHarnessPluginReportFn(激活诊断报告)。canManage=false(云端非
|
|
425
|
-
* 管理员,经 getDshInstalledFn 下发)只读:安装/移除/启停/更新/批准入口隐藏,仅诊断展示。
|
|
426
|
-
*/
|
|
427
|
-
function DshTab() {
|
|
428
|
-
const queryClient = useQueryClient();
|
|
429
|
-
const [installSpec, setInstallSpec] = useState("");
|
|
430
|
-
const [consentOpen, setConsentOpen] = useState(false);
|
|
431
|
-
const [removeTarget, setRemoveTarget] = useState<string | null>(null);
|
|
432
|
-
const [updateTarget, setUpdateTarget] = useState<string | null>(null);
|
|
433
|
-
// 安装返回的非空 blockedBuilds → 二次批准 AlertDialog(PRE-3)
|
|
434
|
-
const [pendingApproval, setPendingApproval] = useState<string[] | null>(null);
|
|
435
|
-
|
|
436
|
-
const { data: reportData } = useQuery({
|
|
437
|
-
queryKey: ["harness-plugin-report"],
|
|
438
|
-
queryFn: () => getHarnessPluginReportFn(),
|
|
439
|
-
refetchOnMount: true,
|
|
440
|
-
});
|
|
441
|
-
const { data: pendingBuilds } = useQuery({
|
|
442
|
-
queryKey: ["harness-dsh-pending-builds"],
|
|
443
|
-
queryFn: () => getDshPendingBuildsFn(),
|
|
444
|
-
refetchOnMount: true,
|
|
445
|
-
});
|
|
446
|
-
const { data: installedData } = useQuery({
|
|
447
|
-
queryKey: ["harness-dsh-installed"],
|
|
448
|
-
queryFn: () => getDshInstalledFn(),
|
|
449
|
-
refetchOnMount: true,
|
|
450
|
-
});
|
|
451
|
-
const installed = installedData?.installed ?? [];
|
|
452
|
-
const canManage = installedData?.canManage ?? false;
|
|
453
|
-
const report = reportData?.report;
|
|
454
|
-
|
|
455
|
-
const installMutation = useMutation({
|
|
456
|
-
mutationFn: (spec: string) => installDshPluginFn({ data: { spec } }),
|
|
457
|
-
onSuccess: (result) => {
|
|
458
|
-
setInstallSpec("");
|
|
459
|
-
if (result.ok && result.blockedBuilds.length > 0) {
|
|
460
|
-
setPendingApproval(result.blockedBuilds);
|
|
461
|
-
}
|
|
462
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugin-report"] });
|
|
463
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-pending-builds"] });
|
|
464
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-installed"] });
|
|
465
|
-
},
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
const removeMutation = useMutation({
|
|
469
|
-
mutationFn: (name: string) => removeDshPluginFn({ data: { name } }),
|
|
470
|
-
onSuccess: () => {
|
|
471
|
-
setRemoveTarget(null);
|
|
472
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugin-report"] });
|
|
473
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-installed"] });
|
|
474
|
-
},
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
const updateMutation = useMutation({
|
|
478
|
-
mutationFn: (name: string) => updateDshPluginFn({ data: { name } }),
|
|
479
|
-
onSuccess: (result) => {
|
|
480
|
-
setUpdateTarget(null);
|
|
481
|
-
if (result.ok && result.blockedBuilds.length > 0) {
|
|
482
|
-
setPendingApproval(result.blockedBuilds);
|
|
483
|
-
}
|
|
484
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugin-report"] });
|
|
485
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-installed"] });
|
|
486
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-pending-builds"] });
|
|
487
|
-
},
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
const toggleMutation = useMutation({
|
|
491
|
-
mutationFn: (input: { name: string; enabled: boolean }) =>
|
|
492
|
-
setDshPluginEnabledFn({ data: input }),
|
|
493
|
-
onSuccess: () => {
|
|
494
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-installed"] });
|
|
495
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugin-report"] });
|
|
496
|
-
},
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
const approveMutation = useMutation({
|
|
500
|
-
mutationFn: (names: string[]) => approveDshBuildsFn({ data: { names } }),
|
|
501
|
-
onSuccess: () => {
|
|
502
|
-
setPendingApproval(null);
|
|
503
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugin-report"] });
|
|
504
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-pending-builds"] });
|
|
505
|
-
queryClient.invalidateQueries({ queryKey: ["harness-dsh-installed"] });
|
|
506
|
-
},
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
return (
|
|
510
|
-
<div className="space-y-3">
|
|
511
|
-
{!canManage && (
|
|
512
|
-
<Badge variant="outline" className="px-1.5 py-0 text-[10px]">
|
|
513
|
-
{m.harness_plugin_dshReadOnly()}
|
|
514
|
-
</Badge>
|
|
515
|
-
)}
|
|
516
|
-
|
|
517
|
-
{/* 安装入口(canManage 才显示) */}
|
|
518
|
-
{canManage && (
|
|
519
|
-
<section>
|
|
520
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
521
|
-
{m.harness_plugin_dshInstallTitle()}
|
|
522
|
-
</p>
|
|
523
|
-
<div className="flex gap-2">
|
|
524
|
-
<Input
|
|
525
|
-
value={installSpec}
|
|
526
|
-
onChange={(e) => setInstallSpec(e.target.value)}
|
|
527
|
-
placeholder={m.harness_plugin_dshInstallPlaceholder()}
|
|
528
|
-
className="h-8 text-xs"
|
|
529
|
-
/>
|
|
530
|
-
<Button
|
|
531
|
-
size="sm"
|
|
532
|
-
className="h-8 shrink-0"
|
|
533
|
-
disabled={installSpec.trim().length === 0 || installMutation.isPending}
|
|
534
|
-
onClick={() => setConsentOpen(true)}
|
|
535
|
-
>
|
|
536
|
-
<Download className="size-3.5" />
|
|
537
|
-
{m.harness_plugin_dshInstallAction()}
|
|
538
|
-
</Button>
|
|
539
|
-
</div>
|
|
540
|
-
{installMutation.isError && (
|
|
541
|
-
<p className="mt-1 break-all text-xs text-red-500">
|
|
542
|
-
{m.harness_plugin_dshInstallFailed({ reason: String(installMutation.error) })}
|
|
543
|
-
</p>
|
|
544
|
-
)}
|
|
545
|
-
{updateMutation.isError && (
|
|
546
|
-
<p className="mt-1 break-all text-xs text-red-500">
|
|
547
|
-
{m.harness_plugin_dshUpdateFailed({ reason: String(updateMutation.error) })}
|
|
548
|
-
</p>
|
|
549
|
-
)}
|
|
550
|
-
</section>
|
|
551
|
-
)}
|
|
552
|
-
|
|
553
|
-
{/* 已装 DSH 插件(完整列表:来源/版本/激活状态/inject 满足态 + dsh.client 半体文案 + 启停/更新/移除) */}
|
|
554
|
-
{installed.length > 0 && (
|
|
555
|
-
<section>
|
|
556
|
-
<p className="mb-1 text-xs font-medium uppercase text-muted-foreground">
|
|
557
|
-
{m.harness_plugin_dshInstalledTitle()} · {installed.length}
|
|
558
|
-
</p>
|
|
559
|
-
<ul className="space-y-1.5">
|
|
560
|
-
{installed.map((p) => {
|
|
561
|
-
const status = report
|
|
562
|
-
? dshActivationStatus(report, p.name)
|
|
563
|
-
: ({ key: "unknown", missing: [], error: "" } as const);
|
|
564
|
-
const statusConfig = DSH_STATUS_CONFIG[status.key];
|
|
565
|
-
const updating = updateMutation.isPending && updateTarget === p.name;
|
|
566
|
-
return (
|
|
567
|
-
<li key={p.name} className="rounded-md border bg-background px-2 py-1.5">
|
|
568
|
-
{/* 行 1:名称 + 版本 + 激活状态徽标 + 操作 */}
|
|
569
|
-
<div className="flex items-center gap-1.5">
|
|
570
|
-
<span className="min-w-0 flex-1 truncate font-mono text-xs">{p.name}</span>
|
|
571
|
-
{p.version && (
|
|
572
|
-
<span className="shrink-0 text-[10px] text-muted-foreground">
|
|
573
|
-
{m.harness_plugin_version({ version: p.version })}
|
|
574
|
-
</span>
|
|
575
|
-
)}
|
|
576
|
-
<Badge variant="outline" className={`shrink-0 px-1.5 py-0 text-[10px] ${statusConfig.color}`}>
|
|
577
|
-
{statusConfig.label()}
|
|
578
|
-
</Badge>
|
|
579
|
-
{canManage && (
|
|
580
|
-
<Switch
|
|
581
|
-
size="sm"
|
|
582
|
-
checked={!p.disabled}
|
|
583
|
-
disabled={toggleMutation.isPending}
|
|
584
|
-
aria-label={p.name}
|
|
585
|
-
onCheckedChange={(checked) =>
|
|
586
|
-
toggleMutation.mutate({ name: p.name, enabled: checked === true })
|
|
587
|
-
}
|
|
588
|
-
/>
|
|
589
|
-
)}
|
|
590
|
-
{canManage && (
|
|
591
|
-
<Button
|
|
592
|
-
size="icon"
|
|
593
|
-
variant="ghost"
|
|
594
|
-
className="size-6"
|
|
595
|
-
disabled={updating}
|
|
596
|
-
aria-label={m.harness_plugin_dshUpdateAction()}
|
|
597
|
-
onClick={() => setUpdateTarget(p.name)}
|
|
598
|
-
>
|
|
599
|
-
<ArrowUpCircle className="size-3" />
|
|
600
|
-
</Button>
|
|
601
|
-
)}
|
|
602
|
-
{canManage && (
|
|
603
|
-
<Button
|
|
604
|
-
size="icon"
|
|
605
|
-
variant="ghost"
|
|
606
|
-
className="size-6 text-red-500 hover:text-red-600"
|
|
607
|
-
disabled={removeMutation.isPending}
|
|
608
|
-
aria-label={m.harness_plugin_dshRemoveConfirm()}
|
|
609
|
-
onClick={() => setRemoveTarget(p.name)}
|
|
610
|
-
>
|
|
611
|
-
<Trash2 className="size-3" />
|
|
612
|
-
</Button>
|
|
613
|
-
)}
|
|
614
|
-
</div>
|
|
615
|
-
|
|
616
|
-
{/* 行 2:来源 + dsh.client 半体文案 */}
|
|
617
|
-
<div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-muted-foreground">
|
|
618
|
-
<span>
|
|
619
|
-
{m.harness_plugin_dshSource()}: {installSourceLabel(p.spec)}
|
|
620
|
-
</span>
|
|
621
|
-
{p.hasClientHalf && (
|
|
622
|
-
<span className="inline-flex items-center gap-1 text-orange-600">
|
|
623
|
-
<AlertCircle className="size-3 shrink-0" />
|
|
624
|
-
{m.harness_plugin_dshClientHalf()}
|
|
625
|
-
</span>
|
|
626
|
-
)}
|
|
627
|
-
</div>
|
|
628
|
-
|
|
629
|
-
{/* 行 3:激活诊断逐条(inject 缺服务 / apply 抛错 / 用户停用) */}
|
|
630
|
-
{status.key === "deactivated" && status.missing.length > 0 && (
|
|
631
|
-
<p className="mt-1 break-all text-[11px] text-orange-500">
|
|
632
|
-
{m.harness_plugin_missingServices({ services: status.missing.join(", ") })}
|
|
633
|
-
</p>
|
|
634
|
-
)}
|
|
635
|
-
{status.key === "failed" && status.error && (
|
|
636
|
-
<p className="mt-1 break-all text-[11px] text-red-500">
|
|
637
|
-
{m.harness_plugin_errorLabel({ error: status.error })}
|
|
638
|
-
</p>
|
|
639
|
-
)}
|
|
640
|
-
{status.key === "disabled" && (
|
|
641
|
-
<p className="mt-1 text-[11px] text-muted-foreground">
|
|
642
|
-
{m.harness_plugin_dshDisabledReason()}
|
|
643
|
-
</p>
|
|
644
|
-
)}
|
|
645
|
-
</li>
|
|
646
|
-
);
|
|
647
|
-
})}
|
|
648
|
-
</ul>
|
|
649
|
-
</section>
|
|
650
|
-
)}
|
|
651
|
-
|
|
652
|
-
{installed.length === 0 && (
|
|
653
|
-
<div className="flex flex-col items-center gap-2 py-6 text-center">
|
|
654
|
-
<Puzzle className="size-8 text-muted-foreground/50" />
|
|
655
|
-
<p className="text-xs text-muted-foreground">{m.harness_plugin_dshEmpty()}</p>
|
|
656
|
-
</div>
|
|
657
|
-
)}
|
|
658
|
-
|
|
659
|
-
{/* 待批准构建脚本提示(常驻 pending,非管理员也可看待决策集) */}
|
|
660
|
-
{pendingBuilds && pendingBuilds.pending.length > 0 && (
|
|
661
|
-
<section className="rounded-md border border-orange-500/40 bg-orange-500/5 p-2">
|
|
662
|
-
<p className="mb-1 flex items-center gap-1.5 text-xs font-medium text-orange-600">
|
|
663
|
-
<ShieldAlert className="size-3.5 shrink-0" />
|
|
664
|
-
{m.harness_plugin_dshPendingTitle()}
|
|
665
|
-
</p>
|
|
666
|
-
<p className="mb-1.5 break-all font-mono text-[11px] text-muted-foreground">
|
|
667
|
-
{pendingBuilds.pending.join(", ")}
|
|
668
|
-
</p>
|
|
669
|
-
<p className="mb-2 text-[11px] text-muted-foreground">
|
|
670
|
-
{m.harness_plugin_dshPendingDescription()}
|
|
671
|
-
</p>
|
|
672
|
-
{canManage && (
|
|
673
|
-
<Button
|
|
674
|
-
size="sm"
|
|
675
|
-
variant="outline"
|
|
676
|
-
className="h-7"
|
|
677
|
-
disabled={approveMutation.isPending}
|
|
678
|
-
onClick={() => setPendingApproval(pendingBuilds.pending)}
|
|
679
|
-
>
|
|
680
|
-
{m.harness_plugin_dshApproveAction()}
|
|
681
|
-
</Button>
|
|
682
|
-
)}
|
|
683
|
-
</section>
|
|
684
|
-
)}
|
|
685
|
-
|
|
686
|
-
{/* PRE-5 安装审批(安全句,禁原生 confirm)。**点击确认后不自动关闭**(用户要求
|
|
687
|
-
2026-11-14):本仓 AlertDialogAction 是纯 Button(非 Close 包装),弹窗保持
|
|
688
|
-
打开;安装进行中/结果在弹窗内就地反馈(pending 置灰 + ok:false 原因 / 成功 /
|
|
689
|
-
异常),取消按钮承担关闭职责。 */}
|
|
690
|
-
<AlertDialog open={consentOpen} onOpenChange={setConsentOpen}>
|
|
691
|
-
<AlertDialogContent>
|
|
692
|
-
<AlertDialogHeader>
|
|
693
|
-
<AlertDialogTitle>{m.harness_plugin_dshInstallConsentTitle()}</AlertDialogTitle>
|
|
694
|
-
<AlertDialogDescription>
|
|
695
|
-
{m.harness_plugin_dshInstallConsentBody()}
|
|
696
|
-
</AlertDialogDescription>
|
|
697
|
-
</AlertDialogHeader>
|
|
698
|
-
{/* 弹窗内就地结果(弹窗不自动关闭,反馈必须在这里可见) */}
|
|
699
|
-
{installMutation.isError && (
|
|
700
|
-
<p className="break-all text-xs text-red-500">
|
|
701
|
-
{m.harness_plugin_dshInstallFailed({ reason: String(installMutation.error) })}
|
|
702
|
-
</p>
|
|
703
|
-
)}
|
|
704
|
-
{installMutation.isSuccess && installMutation.data && !installMutation.data.ok && (
|
|
705
|
-
<p className="break-all text-xs text-red-500">
|
|
706
|
-
{m.harness_plugin_dshInstallFailed({ reason: installMutation.data.reason })}
|
|
707
|
-
</p>
|
|
708
|
-
)}
|
|
709
|
-
{installMutation.isSuccess && installMutation.data?.ok && (
|
|
710
|
-
<p className="text-xs text-emerald-600">
|
|
711
|
-
{m.harness_plugin_dshInstallSucceeded()}
|
|
712
|
-
</p>
|
|
713
|
-
)}
|
|
714
|
-
<AlertDialogFooter>
|
|
715
|
-
<AlertDialogCancel>{m.harness_plugin_dshInstallCancel()}</AlertDialogCancel>
|
|
716
|
-
<AlertDialogAction
|
|
717
|
-
disabled={installMutation.isPending}
|
|
718
|
-
onClick={() => installMutation.mutate(installSpec.trim())}
|
|
719
|
-
>
|
|
720
|
-
{installMutation.isPending
|
|
721
|
-
? m.harness_plugin_dshInstalling()
|
|
722
|
-
: m.harness_plugin_dshInstallConfirm()}
|
|
723
|
-
</AlertDialogAction>
|
|
724
|
-
</AlertDialogFooter>
|
|
725
|
-
</AlertDialogContent>
|
|
726
|
-
</AlertDialog>
|
|
727
|
-
|
|
728
|
-
{/* PRE-3 构建脚本二次批准(安装返回 blockedBuilds / 常驻 pending 触发) */}
|
|
729
|
-
<AlertDialog
|
|
730
|
-
open={pendingApproval !== null}
|
|
731
|
-
onOpenChange={(open) => {
|
|
732
|
-
if (!open) setPendingApproval(null);
|
|
733
|
-
}}
|
|
734
|
-
>
|
|
735
|
-
<AlertDialogContent>
|
|
736
|
-
<AlertDialogHeader>
|
|
737
|
-
<AlertDialogTitle>{m.harness_plugin_dshApproveTitle()}</AlertDialogTitle>
|
|
738
|
-
<AlertDialogDescription>
|
|
739
|
-
{m.harness_plugin_dshPendingDescription()}
|
|
740
|
-
</AlertDialogDescription>
|
|
741
|
-
</AlertDialogHeader>
|
|
742
|
-
<ul className="mb-2 max-h-32 space-y-0.5 overflow-y-auto">
|
|
743
|
-
{(pendingApproval ?? []).map((name) => (
|
|
744
|
-
<li key={name} className="font-mono text-xs">
|
|
745
|
-
{name}
|
|
746
|
-
</li>
|
|
747
|
-
))}
|
|
748
|
-
</ul>
|
|
749
|
-
<AlertDialogFooter>
|
|
750
|
-
<AlertDialogCancel onClick={() => setPendingApproval(null)}>
|
|
751
|
-
{m.harness_plugin_dshApproveCancel()}
|
|
752
|
-
</AlertDialogCancel>
|
|
753
|
-
<AlertDialogAction onClick={() => approveMutation.mutate(pendingApproval ?? [])}>
|
|
754
|
-
{m.harness_plugin_dshApproveAction()}
|
|
755
|
-
</AlertDialogAction>
|
|
756
|
-
</AlertDialogFooter>
|
|
757
|
-
</AlertDialogContent>
|
|
758
|
-
</AlertDialog>
|
|
759
|
-
|
|
760
|
-
{/* 更新确认(禁原生 confirm):五步更新含移旧/装新/回滚,提示中断回合 */}
|
|
761
|
-
<AlertDialog
|
|
762
|
-
open={updateTarget !== null}
|
|
763
|
-
onOpenChange={(open) => {
|
|
764
|
-
if (!open) setUpdateTarget(null);
|
|
765
|
-
}}
|
|
766
|
-
>
|
|
767
|
-
<AlertDialogContent>
|
|
768
|
-
<AlertDialogHeader>
|
|
769
|
-
<AlertDialogTitle>{m.harness_plugin_dshUpdateTitle()}</AlertDialogTitle>
|
|
770
|
-
<AlertDialogDescription>
|
|
771
|
-
{m.harness_plugin_dshUpdateBody({ name: updateTarget ?? "" })}
|
|
772
|
-
</AlertDialogDescription>
|
|
773
|
-
</AlertDialogHeader>
|
|
774
|
-
<AlertDialogFooter>
|
|
775
|
-
<AlertDialogCancel onClick={() => setUpdateTarget(null)}>
|
|
776
|
-
{m.harness_plugin_dshUpdateCancel()}
|
|
777
|
-
</AlertDialogCancel>
|
|
778
|
-
<AlertDialogAction
|
|
779
|
-
onClick={() => {
|
|
780
|
-
if (updateTarget) updateMutation.mutate(updateTarget);
|
|
781
|
-
}}
|
|
782
|
-
>
|
|
783
|
-
{m.harness_plugin_dshUpdateConfirm()}
|
|
784
|
-
</AlertDialogAction>
|
|
785
|
-
</AlertDialogFooter>
|
|
786
|
-
</AlertDialogContent>
|
|
787
|
-
</AlertDialog>
|
|
788
|
-
|
|
789
|
-
{/* 移除确认(禁原生 confirm) */}
|
|
790
|
-
<AlertDialog
|
|
791
|
-
open={removeTarget !== null}
|
|
792
|
-
onOpenChange={(open) => {
|
|
793
|
-
if (!open) setRemoveTarget(null);
|
|
794
|
-
}}
|
|
795
|
-
>
|
|
796
|
-
<AlertDialogContent>
|
|
797
|
-
<AlertDialogHeader>
|
|
798
|
-
<AlertDialogTitle>{m.harness_plugin_dshRemoveTitle()}</AlertDialogTitle>
|
|
799
|
-
<AlertDialogDescription>
|
|
800
|
-
{m.harness_plugin_dshRemoveBody({ name: removeTarget ?? "" })}
|
|
801
|
-
</AlertDialogDescription>
|
|
802
|
-
</AlertDialogHeader>
|
|
803
|
-
<AlertDialogFooter>
|
|
804
|
-
<AlertDialogCancel onClick={() => setRemoveTarget(null)}>
|
|
805
|
-
{m.harness_plugin_dshRemoveCancel()}
|
|
806
|
-
</AlertDialogCancel>
|
|
807
|
-
<AlertDialogAction
|
|
808
|
-
onClick={() => {
|
|
809
|
-
if (removeTarget) removeMutation.mutate(removeTarget);
|
|
810
|
-
}}
|
|
811
|
-
>
|
|
812
|
-
{m.harness_plugin_dshRemoveConfirm()}
|
|
813
|
-
</AlertDialogAction>
|
|
814
|
-
</AlertDialogFooter>
|
|
815
|
-
</AlertDialogContent>
|
|
816
|
-
</AlertDialog>
|
|
817
|
-
</div>
|
|
818
|
-
);
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
export function PluginPanel({ onClose }: { onClose: () => void }) {
|
|
822
|
-
const queryClient = useQueryClient();
|
|
823
|
-
const [expandedPlugin, setExpandedPlugin] = useState<string | null>(null);
|
|
824
|
-
const [actionLoading, setActionLoading] = useState<string | null>(null);
|
|
825
|
-
|
|
826
|
-
const { data: plugins, isLoading } = useQuery({
|
|
827
|
-
queryKey: ["harness-plugins"],
|
|
828
|
-
queryFn: async () => {
|
|
829
|
-
const result = await listPluginsFn();
|
|
830
|
-
return result.map((p) => ({
|
|
831
|
-
...p,
|
|
832
|
-
tools: toPluginTools(p.tools),
|
|
833
|
-
}));
|
|
834
|
-
},
|
|
835
|
-
refetchOnMount: true,
|
|
836
|
-
});
|
|
837
|
-
|
|
838
|
-
const refreshPlugins = () => {
|
|
839
|
-
queryClient.invalidateQueries({ queryKey: ["harness-plugins"] });
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
const handleRun = async (plugin: Plugin) => {
|
|
843
|
-
setActionLoading(plugin.id);
|
|
844
|
-
try {
|
|
845
|
-
await setPluginStatusFn({ data: { id: plugin.id, status: "running" } });
|
|
846
|
-
refreshPlugins();
|
|
847
|
-
} catch (e) {
|
|
848
|
-
console.error("Failed to run plugin:", e);
|
|
849
|
-
} finally {
|
|
850
|
-
setActionLoading(null);
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
const handleStop = async (plugin: Plugin) => {
|
|
855
|
-
setActionLoading(plugin.id);
|
|
856
|
-
try {
|
|
857
|
-
stopPlugin(plugin.id);
|
|
858
|
-
await setPluginStatusFn({ data: { id: plugin.id, status: "stopped" } });
|
|
859
|
-
refreshPlugins();
|
|
860
|
-
} catch (e) {
|
|
861
|
-
console.error("Failed to stop plugin:", e);
|
|
862
|
-
} finally {
|
|
863
|
-
setActionLoading(null);
|
|
864
|
-
}
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
const handleDelete = async (plugin: Plugin) => {
|
|
868
|
-
setActionLoading(plugin.id);
|
|
869
|
-
try {
|
|
870
|
-
await deletePluginFn({ data: { id: plugin.id } });
|
|
871
|
-
refreshPlugins();
|
|
872
|
-
} catch (e) {
|
|
873
|
-
console.error("Failed to delete plugin:", e);
|
|
874
|
-
} finally {
|
|
875
|
-
setActionLoading(null);
|
|
876
|
-
}
|
|
877
|
-
};
|
|
878
|
-
|
|
879
|
-
return (
|
|
880
|
-
<div className="flex h-full w-72 flex-col border-l bg-card">
|
|
881
|
-
<div className="flex items-center justify-between border-b p-3">
|
|
882
|
-
<h2 className="flex items-center gap-2 text-sm font-semibold">
|
|
883
|
-
<Puzzle className="size-4" />
|
|
884
|
-
{m.harness_plugin_panelTitle()}
|
|
885
|
-
</h2>
|
|
886
|
-
<Button size="icon" variant="ghost" className="size-7" onClick={onClose}>
|
|
887
|
-
<ChevronDown className="size-4" />
|
|
888
|
-
</Button>
|
|
889
|
-
</div>
|
|
890
|
-
|
|
891
|
-
<Tabs defaultValue="builtin" className="flex min-h-0 flex-1 flex-col">
|
|
892
|
-
<TabsList className="mx-2 mt-2 w-auto shrink-0">
|
|
893
|
-
<TabsTrigger value="builtin" className="flex-1">{m.harness_plugin_tabBuiltin()}</TabsTrigger>
|
|
894
|
-
<TabsTrigger value="dsh" className="flex-1">{m.harness_plugin_tabDsh()}</TabsTrigger>
|
|
895
|
-
<TabsTrigger value="worker" className="flex-1">{m.harness_plugin_tabWorker()}</TabsTrigger>
|
|
896
|
-
</TabsList>
|
|
897
|
-
|
|
898
|
-
{/* 内置(活):读 AssemblyReport 诊断,只读(启停写路径 F2-5) */}
|
|
899
|
-
<TabsContent value="builtin" className="min-h-0 flex-1 overflow-y-auto p-2">
|
|
900
|
-
<BuiltinTab />
|
|
901
|
-
</TabsContent>
|
|
902
|
-
|
|
903
|
-
{/* DSH 兼容:install/remove/启停最小入口 + PRE-5/PRE-3 审批(完整诊断 F3-6) */}
|
|
904
|
-
<TabsContent value="dsh" className="min-h-0 flex-1 overflow-y-auto p-2">
|
|
905
|
-
<DshTab />
|
|
906
|
-
</TabsContent>
|
|
907
|
-
|
|
908
|
-
{/* 用户 Worker:原单列表逻辑迁入(run/stop/delete + tools/lastError) */}
|
|
909
|
-
<TabsContent value="worker" className="min-h-0 flex-1 overflow-y-auto p-2">
|
|
910
|
-
{isLoading ? (
|
|
911
|
-
<div className="flex items-center justify-center py-8 text-muted-foreground">
|
|
912
|
-
<p className="text-xs">{m.common_loading()}</p>
|
|
913
|
-
</div>
|
|
914
|
-
) : plugins && plugins.length > 0 ? (
|
|
915
|
-
<div className="space-y-2">
|
|
916
|
-
{plugins.map((plugin) => {
|
|
917
|
-
const statusConfig = STATUS_CONFIG[plugin.status as keyof typeof STATUS_CONFIG] ?? STATUS_CONFIG.defined;
|
|
918
|
-
const isExpanded = expandedPlugin === plugin.id;
|
|
919
|
-
const isLoadingAction = actionLoading === plugin.id;
|
|
920
|
-
|
|
921
|
-
return (
|
|
922
|
-
<Collapsible key={plugin.id} open={isExpanded} onOpenChange={(open) => setExpandedPlugin(open ? plugin.id : null)}>
|
|
923
|
-
<div className="rounded-lg border bg-background p-2.5">
|
|
924
|
-
<div className="flex items-start gap-2">
|
|
925
|
-
<CollapsibleTrigger className="flex-1 text-left">
|
|
926
|
-
<div className="flex items-center gap-1.5">
|
|
927
|
-
<span className="font-medium text-sm">{plugin.name}</span>
|
|
928
|
-
<Badge variant="outline" className={`text-[10px] px-1.5 py-0 ${statusConfig.color}`}>
|
|
929
|
-
{statusConfig.label()}
|
|
930
|
-
</Badge>
|
|
931
|
-
<span className="text-[10px] text-muted-foreground">{m.harness_plugin_version({ version: plugin.version })}</span>
|
|
932
|
-
</div>
|
|
933
|
-
<p className="mt-0.5 line-clamp-1 text-xs text-muted-foreground">{plugin.purpose}</p>
|
|
934
|
-
</CollapsibleTrigger>
|
|
935
|
-
<div className="flex shrink-0 items-center gap-1">
|
|
936
|
-
{plugin.status === "defined" && (
|
|
937
|
-
// 缺陷 8 诚实化(设计 §7):改状态字段非真执行——文案标注(L-06 真执行记账)
|
|
938
|
-
<Tooltip>
|
|
939
|
-
<TooltipTrigger
|
|
940
|
-
render={
|
|
941
|
-
<Button
|
|
942
|
-
size="icon"
|
|
943
|
-
variant="ghost"
|
|
944
|
-
className="size-6"
|
|
945
|
-
disabled={isLoadingAction}
|
|
946
|
-
aria-label={m.harness_plugin_markRun()}
|
|
947
|
-
onClick={() => handleRun(plugin)}
|
|
948
|
-
/>
|
|
949
|
-
}
|
|
950
|
-
>
|
|
951
|
-
<Play className="size-3" />
|
|
952
|
-
</TooltipTrigger>
|
|
953
|
-
<TooltipContent>{m.harness_plugin_markRun()}</TooltipContent>
|
|
954
|
-
</Tooltip>
|
|
955
|
-
)}
|
|
956
|
-
{plugin.status === "running" && (
|
|
957
|
-
<Tooltip>
|
|
958
|
-
<TooltipTrigger
|
|
959
|
-
render={
|
|
960
|
-
<Button
|
|
961
|
-
size="icon"
|
|
962
|
-
variant="ghost"
|
|
963
|
-
className="size-6"
|
|
964
|
-
disabled={isLoadingAction}
|
|
965
|
-
aria-label={m.harness_plugin_markStop()}
|
|
966
|
-
onClick={() => handleStop(plugin)}
|
|
967
|
-
/>
|
|
968
|
-
}
|
|
969
|
-
>
|
|
970
|
-
<Square className="size-3" />
|
|
971
|
-
</TooltipTrigger>
|
|
972
|
-
<TooltipContent>{m.harness_plugin_markStop()}</TooltipContent>
|
|
973
|
-
</Tooltip>
|
|
974
|
-
)}
|
|
975
|
-
<Button size="icon" variant="ghost" className="size-6 text-red-500 hover:text-red-600" disabled={isLoadingAction} onClick={() => handleDelete(plugin)}>
|
|
976
|
-
<Trash2 className="size-3" />
|
|
977
|
-
</Button>
|
|
978
|
-
</div>
|
|
979
|
-
</div>
|
|
980
|
-
|
|
981
|
-
{isExpanded && (
|
|
982
|
-
<CollapsibleContent>
|
|
983
|
-
<div className="mt-2 space-y-2 border-t pt-2">
|
|
984
|
-
{plugin.tools && plugin.tools.length > 0 && (
|
|
985
|
-
<div>
|
|
986
|
-
<p className="text-[10px] font-medium text-muted-foreground uppercase">Tools</p>
|
|
987
|
-
<ul className="mt-1 space-y-0.5">
|
|
988
|
-
{plugin.tools.map((tool, i: number) => (
|
|
989
|
-
<li key={i} className="flex items-center gap-1 text-xs">
|
|
990
|
-
<span className="text-muted-foreground">{plugin.name}/</span>
|
|
991
|
-
<span className="font-mono">{tool.name}</span>
|
|
992
|
-
</li>
|
|
993
|
-
))}
|
|
994
|
-
</ul>
|
|
995
|
-
</div>
|
|
996
|
-
)}
|
|
997
|
-
{plugin.lastError && (
|
|
998
|
-
<div className="flex items-start gap-1 text-xs text-red-500">
|
|
999
|
-
<AlertCircle className="size-3 shrink-0 mt-0.5" />
|
|
1000
|
-
<span className="break-all">{plugin.lastError}</span>
|
|
1001
|
-
</div>
|
|
1002
|
-
)}
|
|
1003
|
-
</div>
|
|
1004
|
-
</CollapsibleContent>
|
|
1005
|
-
)}
|
|
1006
|
-
</div>
|
|
1007
|
-
</Collapsible>
|
|
1008
|
-
);
|
|
1009
|
-
})}
|
|
1010
|
-
</div>
|
|
1011
|
-
) : (
|
|
1012
|
-
<div className="flex flex-col items-center gap-2 py-8 text-center">
|
|
1013
|
-
<Puzzle className="size-8 text-muted-foreground/50" />
|
|
1014
|
-
<p className="text-xs text-muted-foreground">{m.harness_plugin_empty()}</p>
|
|
1015
|
-
</div>
|
|
1016
|
-
)}
|
|
1017
|
-
</TabsContent>
|
|
1018
|
-
</Tabs>
|
|
1019
|
-
</div>
|
|
1020
|
-
);
|
|
1021
|
-
}
|