@allbluecn/web-app 0.27.41 → 0.28.1
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 +4 -3
- 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 +46 -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-chat-adapter.test.ts +20 -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-agent-terminals.ts +116 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +43 -11
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +25 -4
- package/src/components/harness/conversation-panel/messages/tools/__tests__/tool-run.test.ts +26 -1
- package/src/components/harness/conversation-panel/messages/tools/tool-run.ts +11 -0
- 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/__tests__/tab-strip.test.tsx +45 -0
- package/src/components/harness/extension-panel/dock/dock-persist.ts +6 -4
- package/src/components/harness/extension-panel/dock/dock-registry.ts +69 -14
- package/src/components/harness/extension-panel/dock/dock-surface.tsx +35 -0
- package/src/components/harness/extension-panel/dock/guide-page.tsx +78 -45
- package/src/components/harness/extension-panel/dock/tab-strip.tsx +9 -1
- 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/extension-panel/panels/terminal/__tests__/kind.test.tsx +219 -2
- package/src/components/harness/extension-panel/panels/terminal/__tests__/terminal-instance.test.tsx +322 -19
- package/src/components/harness/extension-panel/panels/terminal/__tests__/use-agent-terminal-roster.test.tsx +393 -0
- package/src/components/harness/extension-panel/panels/terminal/__tests__/ws-transport.test.ts +25 -0
- package/src/components/harness/extension-panel/panels/terminal/kind.tsx +55 -1
- package/src/components/harness/extension-panel/panels/terminal/shell-pref.ts +7 -4
- package/src/components/harness/extension-panel/panels/terminal/sse-transport.ts +26 -6
- package/src/components/harness/extension-panel/panels/terminal/tab-control-state.tsx +114 -0
- package/src/components/harness/extension-panel/panels/terminal/terminal-instance.tsx +190 -96
- package/src/components/harness/extension-panel/panels/terminal/terminal-theme.ts +113 -0
- package/src/components/harness/extension-panel/panels/terminal/transport.ts +28 -6
- package/src/components/harness/extension-panel/panels/terminal/use-agent-terminal-roster.ts +107 -0
- package/src/components/harness/extension-panel/panels/terminal/ws-transport.ts +7 -5
- package/src/components/harness/extension-panel/panels/terminal/xterm-terminal.tsx +5 -67
- 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-terminal.ts +77 -0
- package/src/lib/queries/harness.ts +50 -0
- package/src/paraglide/messages/_index.js +1622 -311
- package/src/paraglide/messages/en.js +528 -103
- package/src/paraglide/messages/zh.js +529 -104
- package/src/routes/_nav/harness/route.lazy.tsx +13 -0
- package/src/routes/api/harness/$.ts +19 -2
- package/src/routes/api/harness/terminal/$.ts +37 -6
- package/src/routes/api/harness/terminal/__tests__/route.test.ts +120 -0
- package/src/server/ai-gateway/sandbox/policy.ts +6 -6
- package/src/server/harness/__tests__/agent-terminal.server.test.ts +448 -0
- package/src/server/harness/__tests__/builtin-tools-invariant.test.ts +22 -12
- 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__/first-contact-fakes.test.ts +103 -3
- package/src/server/harness/__tests__/terminal-manager.server.test.ts +761 -2
- package/src/server/harness/__tests__/thread-reference.server.test.ts +258 -0
- package/src/server/harness/agent-terminal.server.ts +631 -0
- package/src/server/harness/define.server.ts +21 -3
- package/src/server/harness/first-contact-fakes.ts +115 -4
- package/src/server/harness/host.server.ts +28 -1
- package/src/server/harness/persistence/__tests__/session-index-store.server.test.ts +83 -0
- package/src/server/harness/persistence/prisma-persistence.server.ts +12 -3
- package/src/server/harness/persistence/session-index-store.server.ts +26 -0
- package/src/server/harness/plugins/__tests__/assemble-disable.test.ts +25 -17
- package/src/server/harness/plugins/__tests__/tool-risk-audit.test.ts +16 -6
- package/src/server/harness/plugins/assemble-app.ts +12 -0
- package/src/server/harness/plugins/base-patch.ts +9 -2
- package/src/server/harness/plugins/builtin/__tests__/agent-terminal.plugin.test.ts +702 -0
- package/src/server/harness/plugins/builtin/agent-terminal.plugin.ts +518 -0
- package/src/server/harness/terminal-frame-builder.server.ts +5 -3
- package/src/server/harness/terminal-manager.server.ts +772 -35
- package/src/server/harness/terminal-ws-handler.server.ts +8 -2
- package/src/server/harness/thread-reference.server.ts +446 -0
- package/src/server/harness/tool-risk.ts +20 -4
- 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
- package/src/components/harness/extension-panel/panels/terminal/__tests__/xterm-webgl.test.ts +0 -68
|
@@ -26,11 +26,23 @@
|
|
|
26
26
|
//
|
|
27
27
|
// P6d-2 将加 `ws-transport.ts` 实现(kind: 'ws'),工厂按 kind 分派。
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* 终端归属/控制权主体(T14):服务端 terminal-manager.server 的 TerminalOrigin /
|
|
31
|
+
* TerminalControl 的客户端镜像——客户端禁 import server 模块,故本地声明同字面量联合。
|
|
32
|
+
*/
|
|
33
|
+
export type TerminalControlParty = "user" | "agent"
|
|
34
|
+
|
|
35
|
+
/** state 帧控制权快照(TerminalInstance → tab 标题徽章 / 接管 toast 的判定源,T14)。 */
|
|
36
|
+
export interface TerminalControlSnapshot {
|
|
37
|
+
origin: TerminalControlParty
|
|
38
|
+
control: TerminalControlParty
|
|
39
|
+
}
|
|
40
|
+
|
|
29
41
|
/** 下行帧(对齐 routes/api/harness/terminal/$ 的 SSE 帧型 + 服务端 TerminalDownFrame)。 */
|
|
30
42
|
export type DownFrame =
|
|
31
|
-
| { type: "snapshot"; connectionId: string; sequence: number; screen: string; info: { cols: number; rows: number; shell: string }; writable: boolean }
|
|
43
|
+
| { type: "snapshot"; connectionId: string; sequence: number; screen: string; info: { cols: number; rows: number; shell: string }; writable: boolean; serverEpoch?: string }
|
|
32
44
|
| { type: "output"; sequence: number; data: string }
|
|
33
|
-
| { type: "state"; sequence: number; cols: number; rows: number }
|
|
45
|
+
| { type: "state"; sequence: number; cols: number; rows: number; origin: TerminalControlParty; control: TerminalControlParty }
|
|
34
46
|
| { type: "exit"; sequence: number; code: number }
|
|
35
47
|
| { type: "slow"; reason: string; reconnect: boolean }
|
|
36
48
|
|
|
@@ -41,11 +53,18 @@ export interface TerminalTransportCmd {
|
|
|
41
53
|
data?: string
|
|
42
54
|
cols?: number
|
|
43
55
|
rows?: number
|
|
56
|
+
/**
|
|
57
|
+
* agent 终端接管手势标记(仅 write 有意义):true = 服务端在写生效前把 control 翻转
|
|
58
|
+
* 为 'user' 并广播 state 帧(origin/control)。本任务仅做透传管道——手势识别(何时
|
|
59
|
+
* 打 typed 标)在 T12 客户端实现,此处不提前引入任何识别逻辑。
|
|
60
|
+
*/
|
|
61
|
+
typed?: boolean
|
|
44
62
|
}
|
|
45
63
|
|
|
46
|
-
/** create 端点结果:成功返回 terminalId + shell
|
|
64
|
+
/** create 端点结果:成功返回 terminalId + shell + serverEpoch(方案 C 写入 binding 供重连
|
|
65
|
+
* 比对),失败返回 error(null = 无服务端消息)+ 可选错误码(P6e-1 降级态判定用)。 */
|
|
47
66
|
export type TerminalCreateResult =
|
|
48
|
-
| { ok: true; terminalId: string; shell: string }
|
|
67
|
+
| { ok: true; terminalId: string; shell: string; serverEpoch?: string }
|
|
49
68
|
| { ok: false; error: string | null; errorCode?: string }
|
|
50
69
|
|
|
51
70
|
/** 传输层接口(P6d-1 SSE 实现 + P6d-2 WS 实现共用契约)。 */
|
|
@@ -54,8 +73,11 @@ export interface TerminalTransport {
|
|
|
54
73
|
readonly kind: "sse" | "ws"
|
|
55
74
|
/** POST create 新建终端(成功返回 terminalId + shell,失败返回 error)。 */
|
|
56
75
|
create(opts: { cols: number; rows: number; shell?: string }): Promise<TerminalCreateResult>
|
|
57
|
-
/** attach:开 EventSource 下行(snapshot → output → state → exit)。
|
|
58
|
-
|
|
76
|
+
/** attach:开 EventSource 下行(snapshot → output → state → exit)。SSE 实现返回连接结果——
|
|
77
|
+
* notFound=true 表示服务端已无此终端(dev/host 重启、idle 回收后 binding 存活死 id),
|
|
78
|
+
* 调用方应清 terminalId 并走 create 重建(DSH missingTerminal 语义),而非永久 404 循环。
|
|
79
|
+
* WS 实现同步 connect(非 101 走 onFallback),返回恒 ok。 */
|
|
80
|
+
connect(termId: string): Promise<{ ok: boolean; notFound?: boolean; serverEpoch?: string }>
|
|
59
81
|
/** 注册下行帧回调(snapshot/output/state/slow/exit)。 */
|
|
60
82
|
onFrame(cb: (f: DownFrame) => void): void
|
|
61
83
|
/** 注册连接错误回调(EventSource onerror)。 */
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
// T13 roster 消费 hook + tab reconcile 纯函数(设计 §7.2)。
|
|
19
|
+
//
|
|
20
|
+
// useAgentTerminalRoster:消费 harnessTerminalRosterQueryOptions(10s 轮询 +
|
|
21
|
+
// AgentTerminalOpened/Closed 旁路事件 invalidate,见 harness-chain/use-agent-terminals)。
|
|
22
|
+
// 数据面(terminals 数组)供 DockSurface 的 reconcile effect 消费——query 失败静默
|
|
23
|
+
// (data undefined → effect 早退,gate 关 404 不刷错误)。
|
|
24
|
+
//
|
|
25
|
+
// reconcileAgentTerminalTabs:roster × dock tabs → 开/关指令(纯函数,单测锁定)。
|
|
26
|
+
// 规则(§7.2 逐字):
|
|
27
|
+
// - open:roster 中 origin==='agent' ∧ state==='running' 且无对应 tab(按
|
|
28
|
+
// DockTab.instanceId 匹配)→ { instanceId, title }(title 用 roster entry title,
|
|
29
|
+
// 调用方 dockRegistry.openKind('terminal', { instanceId, title })——openTab 需完整
|
|
30
|
+
// DockTab 含自增 id,不是正确入口)。
|
|
31
|
+
// - close:terminal kind 且有 instanceId 的 tab,其终端若「不在 roster」或「在册但
|
|
32
|
+
// 已退出」→ 关(kill/exit 后 manager 从实例表移除 = roster 消失;在册 exited 是
|
|
33
|
+
// 移除前的瞬态,同语义)。此前有 tab 的 agent 终端才可能命中——用户 tab 无
|
|
34
|
+
// instanceId(openKind 不传),天然不参与。
|
|
35
|
+
// - control 翻转(接管)不关 tab:规则只看 origin+state+存在性,不看 control——
|
|
36
|
+
// 接管后 origin 仍 'agent'、state 仍 'running',零指令。
|
|
37
|
+
// - 用户终端(origin='user')完全不参与 reconcile:不 open、在册时不 close。
|
|
38
|
+
|
|
39
|
+
import { useQuery } from '@tanstack/react-query'
|
|
40
|
+
import {
|
|
41
|
+
harnessTerminalRosterQueryOptions,
|
|
42
|
+
type HarnessTerminalRosterEntry,
|
|
43
|
+
} from '@/lib/queries/harness-terminal'
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 线程 agent 终端 roster 消费(refetchInterval 10s + 事件 invalidate)。threadId
|
|
47
|
+
* 空态(无活动会话 / 非工作台挂载)→ query 不启用,data undefined。
|
|
48
|
+
*/
|
|
49
|
+
export function useAgentTerminalRoster(threadId: string | null | undefined) {
|
|
50
|
+
return useQuery(harnessTerminalRosterQueryOptions(threadId ?? ''))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** reconcile 产出的「开 tab」指令(openKind 的 instanceId/title 载荷)。 */
|
|
54
|
+
export interface ReconcileOpenCmd {
|
|
55
|
+
instanceId: string
|
|
56
|
+
title: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** reconcile 计划:open 指令列表 + 待关 tabId 列表。 */
|
|
60
|
+
export interface ReconcilePlan {
|
|
61
|
+
open: ReconcileOpenCmd[]
|
|
62
|
+
close: string[]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** reconcile 输入的 tab 形状(DockTab 的结构子集,纯函数不依赖 dock 模块)。 */
|
|
66
|
+
export interface ReconcileTabLike {
|
|
67
|
+
id: string
|
|
68
|
+
kind: string
|
|
69
|
+
title: string
|
|
70
|
+
instanceId?: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** 「reconcile 开集合」谓词:agent 出生 ∧ running(control 不参与判定)。 */
|
|
74
|
+
function isAgentRunning(t: HarnessTerminalRosterEntry): boolean {
|
|
75
|
+
return t.origin === 'agent' && t.state === 'running'
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* roster × tabs → 开/关指令(纯函数)。开按 instanceId 去重(已有 tab 不再开);
|
|
80
|
+
* 关只命中 terminal kind 且带 instanceId 的 tab(用户 tab 无 instanceId 天然豁免;
|
|
81
|
+
* 在册 user origin 终端即使 tab 带 instanceId 也不关——用户终端不参与 reconcile)。
|
|
82
|
+
*/
|
|
83
|
+
export function reconcileAgentTerminalTabs(
|
|
84
|
+
roster: readonly HarnessTerminalRosterEntry[],
|
|
85
|
+
tabs: readonly ReconcileTabLike[],
|
|
86
|
+
): ReconcilePlan {
|
|
87
|
+
const rosterById = new Map(roster.map((t) => [t.id, t]))
|
|
88
|
+
|
|
89
|
+
const open: ReconcileOpenCmd[] = []
|
|
90
|
+
for (const t of roster) {
|
|
91
|
+
if (!isAgentRunning(t)) continue
|
|
92
|
+
const hasTab = tabs.some((tab) => tab.kind === 'terminal' && tab.instanceId === t.id)
|
|
93
|
+
if (!hasTab) open.push({ instanceId: t.id, title: t.title })
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const close: string[] = []
|
|
97
|
+
for (const tab of tabs) {
|
|
98
|
+
if (tab.kind !== 'terminal' || tab.instanceId == null) continue
|
|
99
|
+
const entry = rosterById.get(tab.instanceId)
|
|
100
|
+
// 在册:仅 agent 终端参与(user origin 不参与;agent running 保持——含被接管态)
|
|
101
|
+
if (entry && (entry.origin !== 'agent' || isAgentRunning(entry))) continue
|
|
102
|
+
// 不在 roster(kill/exit 移除)或 agent 终端已 exited → 关
|
|
103
|
+
close.push(tab.id)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return { open, close }
|
|
107
|
+
}
|
|
@@ -126,14 +126,14 @@ export function createWsTransport(options: TerminalTransportOptions): TerminalTr
|
|
|
126
126
|
const errBody = (await res.json().catch(() => null)) as { message?: string } | null
|
|
127
127
|
return { ok: false, error: errBody?.message ?? null }
|
|
128
128
|
}
|
|
129
|
-
const data = (await res.json()) as { terminalId: string; shell: string }
|
|
130
|
-
return { ok: true, terminalId: data.terminalId, shell: data.shell }
|
|
129
|
+
const data = (await res.json()) as { terminalId: string; shell: string; serverEpoch?: string }
|
|
130
|
+
return { ok: true, terminalId: data.terminalId, shell: data.shell, serverEpoch: data.serverEpoch }
|
|
131
131
|
} catch {
|
|
132
132
|
return { ok: false, error: null }
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
|
|
136
|
-
connect(termId):
|
|
136
|
+
async connect(termId): Promise<{ ok: boolean; notFound?: boolean; serverEpoch?: string }> {
|
|
137
137
|
terminalId = termId
|
|
138
138
|
closeWs() // 防重复 connect 泄漏旧连接
|
|
139
139
|
|
|
@@ -181,6 +181,7 @@ export function createWsTransport(options: TerminalTransportOptions): TerminalTr
|
|
|
181
181
|
errorCb?.()
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
+
return { ok: true }
|
|
184
185
|
},
|
|
185
186
|
|
|
186
187
|
onFrame(cb): void {
|
|
@@ -197,9 +198,10 @@ export function createWsTransport(options: TerminalTransportOptions): TerminalTr
|
|
|
197
198
|
|
|
198
199
|
send(cmd: TerminalTransportCmd): void {
|
|
199
200
|
if (!ws || ws.readyState !== WebSocket.OPEN || !terminalId) return
|
|
200
|
-
// WS 上行帧格式:{ type: 'write', seq, data
|
|
201
|
+
// WS 上行帧格式:{ type: 'write', seq, data, typed? }(typed 缺省不发键,wire 精简)
|
|
202
|
+
// / { type: 'resize', seq, cols, rows }
|
|
201
203
|
const frame = cmd.type === "write"
|
|
202
|
-
? { type: "write" as const, seq: cmd.sequence, data: cmd.data }
|
|
204
|
+
? { type: "write" as const, seq: cmd.sequence, data: cmd.data, ...(cmd.typed !== undefined ? { typed: cmd.typed } : {}) }
|
|
203
205
|
: { type: "resize" as const, seq: cmd.sequence, cols: cmd.cols!, rows: cmd.rows! }
|
|
204
206
|
ws.send(JSON.stringify(frame))
|
|
205
207
|
},
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react"
|
|
30
30
|
import { Terminal } from "@xterm/xterm"
|
|
31
31
|
import { FitAddon } from "@xterm/addon-fit"
|
|
32
|
-
import { WebglAddon } from "@xterm/addon-webgl"
|
|
33
32
|
// xterm 必需样式(光标/选区/滚动条);惰性 chunk 内 import,随 chunk 加载注入。
|
|
34
33
|
import "@xterm/xterm/css/xterm.css"
|
|
35
34
|
|
|
@@ -61,24 +60,6 @@ export interface XtermTerminalProps {
|
|
|
61
60
|
onReady: () => void
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
/**
|
|
65
|
-
* WebGL2 特性检测(设计 §3.3):临时 canvas 探测 `webgl2` 上下文,成功即释放。
|
|
66
|
-
* 纯函数(抽离便于单测 mock getContext);探测失败 / 抛错一律返回 false(走默认 DOM 渲染器)。
|
|
67
|
-
*/
|
|
68
|
-
export function supportsWebgl2(): boolean {
|
|
69
|
-
try {
|
|
70
|
-
const canvas = document.createElement("canvas")
|
|
71
|
-
const gl = canvas.getContext("webgl2")
|
|
72
|
-
const ok = gl !== null
|
|
73
|
-
// 立即释放(探测上下文不残留;webgl addon 自建上下文)
|
|
74
|
-
const lose = gl?.getExtension("WEBGL_lose_context")
|
|
75
|
-
lose?.loseContext()
|
|
76
|
-
return ok
|
|
77
|
-
} catch {
|
|
78
|
-
return false
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
63
|
/**
|
|
83
64
|
* xterm 宿主(惰性 chunk 默认导出)。命令式 handle 经 React.lazy 透传 ref 到
|
|
84
65
|
* terminal-instance。scrollback 1000 行对齐服务端 ring 上限(设计 §4.2)。
|
|
@@ -88,44 +69,8 @@ export const XtermTerminal = forwardRef<XtermHandle, XtermTerminalProps>(
|
|
|
88
69
|
const containerRef = useRef<HTMLDivElement>(null)
|
|
89
70
|
const termRef = useRef<Terminal | null>(null)
|
|
90
71
|
const fitRef = useRef<FitAddon | null>(null)
|
|
91
|
-
// webgl
|
|
92
|
-
//
|
|
93
|
-
const webglRef = useRef<WebglAddon | null>(null)
|
|
94
|
-
|
|
95
|
-
/** load webgl addon(特性检测 + 静默降级)。已加载则幂等返回。 */
|
|
96
|
-
const loadWebgl = () => {
|
|
97
|
-
const term = termRef.current
|
|
98
|
-
if (!term || webglRef.current) return
|
|
99
|
-
if (!supportsWebgl2()) return // 无 webgl2 → 默认 DOM 渲染器
|
|
100
|
-
try {
|
|
101
|
-
const addon = new WebglAddon()
|
|
102
|
-
// contextlost → dispose 静默降级(GPU 上下文丢失后 webgl 不可恢复渲染)
|
|
103
|
-
addon.onContextLoss(() => {
|
|
104
|
-
try {
|
|
105
|
-
addon.dispose()
|
|
106
|
-
} catch {
|
|
107
|
-
/* 已 dispose */
|
|
108
|
-
}
|
|
109
|
-
if (webglRef.current === addon) webglRef.current = null
|
|
110
|
-
})
|
|
111
|
-
term.loadAddon(addon)
|
|
112
|
-
webglRef.current = addon
|
|
113
|
-
} catch {
|
|
114
|
-
// loadAddon 抛错(极端环境)→ 静默降级默认渲染器
|
|
115
|
-
webglRef.current = null
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** dispose webgl addon(主题不跟随重建 / 清理链共用)。 */
|
|
120
|
-
const disposeWebgl = () => {
|
|
121
|
-
const addon = webglRef.current
|
|
122
|
-
webglRef.current = null
|
|
123
|
-
try {
|
|
124
|
-
addon?.dispose()
|
|
125
|
-
} catch {
|
|
126
|
-
/* 已 dispose */
|
|
127
|
-
}
|
|
128
|
-
}
|
|
72
|
+
// 默认 DOM 渲染器(对齐 DSH:无 webgl addon)。主题切换只 term.options.theme= 热更新,
|
|
73
|
+
// 不 dispose+重建任何渲染器——消除切主题的 canvas 重启延迟(webgl 需重建 GPU 上下文)。
|
|
129
74
|
// 回调经 ref 保新值:xterm 监听器在 init 时绑定一次,闭包读 ref 恒取最新 prop。
|
|
130
75
|
const onDataRef = useRef(onData)
|
|
131
76
|
onDataRef.current = onData
|
|
@@ -141,6 +86,8 @@ export const XtermTerminal = forwardRef<XtermHandle, XtermTerminalProps>(
|
|
|
141
86
|
scrollback: 1000,
|
|
142
87
|
cursorBlink: true,
|
|
143
88
|
fontSize: 13,
|
|
89
|
+
// 背景不透明(terminal-theme.ts computeXtermTheme 取 --background 计算值):
|
|
90
|
+
// webgl 上下文以 alpha:false 创建,透明背景会被合成成黑色——禁用透明。
|
|
144
91
|
// PTY 下行已是 \r\n,convertEol 保持 false(默认)以免双换行。
|
|
145
92
|
convertEol: false,
|
|
146
93
|
})
|
|
@@ -157,8 +104,6 @@ export const XtermTerminal = forwardRef<XtermHandle, XtermTerminalProps>(
|
|
|
157
104
|
}
|
|
158
105
|
termRef.current = term
|
|
159
106
|
fitRef.current = fit
|
|
160
|
-
// webgl 渲染加速:term.open() 后特性检测(webgl2)通过才 load(设计 §3.3)
|
|
161
|
-
loadWebgl()
|
|
162
107
|
|
|
163
108
|
// 容器尺寸变化 → fit(仅可见 + 非零尺寸)。keepMounted 隐藏态(visibility:hidden
|
|
164
109
|
// 或 0 尺寸)跳过 → 不产出 onResize → terminal-instance 不发 resize POST。
|
|
@@ -178,7 +123,6 @@ export const XtermTerminal = forwardRef<XtermHandle, XtermTerminalProps>(
|
|
|
178
123
|
onReadyRef.current()
|
|
179
124
|
return () => {
|
|
180
125
|
ro.disconnect()
|
|
181
|
-
disposeWebgl() // webgl addon 并入清理链(先于 term.dispose)
|
|
182
126
|
term.dispose()
|
|
183
127
|
termRef.current = null
|
|
184
128
|
fitRef.current = null
|
|
@@ -188,8 +132,7 @@ export const XtermTerminal = forwardRef<XtermHandle, XtermTerminalProps>(
|
|
|
188
132
|
}, [])
|
|
189
133
|
|
|
190
134
|
// 主题跟随 resolved(light/dark 色板由 terminal-instance 解析成具体色值传入)。
|
|
191
|
-
//
|
|
192
|
-
// (局部一次性操作,设计 §3.3)。首帧(webglRef 已在 init load)跳过重建。
|
|
135
|
+
// 默认 DOM 渲染器(对齐 DSH):主题变化只热更新 term.options.theme,不重建渲染器。
|
|
193
136
|
const themeInitializedRef = useRef(false)
|
|
194
137
|
useEffect(() => {
|
|
195
138
|
const term = termRef.current
|
|
@@ -197,11 +140,6 @@ export const XtermTerminal = forwardRef<XtermHandle, XtermTerminalProps>(
|
|
|
197
140
|
term.options.theme = theme
|
|
198
141
|
if (!themeInitializedRef.current) {
|
|
199
142
|
themeInitializedRef.current = true
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
if (webglRef.current) {
|
|
203
|
-
disposeWebgl()
|
|
204
|
-
loadWebgl()
|
|
205
143
|
}
|
|
206
144
|
}, [theme])
|
|
207
145
|
|
|
@@ -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
|
+
})
|