@allbluecn/web-app 0.27.41 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78-V.bcmap +0 -0
- package/public/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/public/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/public/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/public/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/public/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/public/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/public/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/public/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/public/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/public/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/public/pdfjs/cmaps/LICENSE +36 -0
- package/public/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/public/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/public/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/public/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/public/pdfjs/cmaps/Roman.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/public/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/public/pdfjs/cmaps/V.bcmap +0 -0
- package/public/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/src/components/ai/ai-prompt-input/index.tsx +3 -87
- package/src/components/ai-elements/__tests__/context.test.tsx +167 -0
- package/src/components/ai-elements/context.tsx +182 -94
- package/src/components/ai-elements/prompt-input.tsx +6 -104
- package/src/components/harness/__tests__/composer-attachments.test.tsx +17 -9
- package/src/components/harness/__tests__/composer-click-focus.test.tsx +175 -0
- package/src/components/harness/__tests__/composer-focus.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-keymap.test.ts +57 -0
- package/src/components/harness/__tests__/composer-paste.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-pending-guard.test.tsx +207 -0
- package/src/components/harness/__tests__/composer-placeholder.test.ts +7 -6
- package/src/components/harness/__tests__/composer-plus-menu.test.tsx +202 -0
- package/src/components/harness/__tests__/composer-primary-button.test.tsx +7 -0
- package/src/components/harness/__tests__/composer-send.test.tsx +12 -4
- package/src/components/harness/__tests__/composer-undo.test.tsx +7 -0
- package/src/components/harness/__tests__/dock-registry.test.ts +3 -0
- package/src/components/harness/__tests__/harness-workbench-auth-error.test.tsx +42 -4
- package/src/components/harness/__tests__/mention-kbid.test.ts +69 -0
- package/src/components/harness/__tests__/undo-last-turn.test.ts +134 -0
- package/src/components/harness/__tests__/voice-activity.test.tsx +2 -2
- package/src/components/harness/conversation-panel/composer/__tests__/file-chip-open.test.tsx +195 -0
- package/src/components/harness/conversation-panel/composer/__tests__/menu-view.test.tsx +107 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-attachments.test.tsx +271 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-client-submit.test.tsx +291 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/claim-guard.test.tsx +275 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-permission.test.tsx +286 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-plan.test.tsx +344 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-popup.test.tsx +193 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-server-source.test.tsx +235 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-suggestion-menu.test.tsx +151 -1
- package/src/components/harness/conversation-panel/composer/command/__tests__/command-undo.test.tsx +168 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/exclude-composer-seat.test.ts +106 -0
- package/src/components/harness/conversation-panel/composer/command/__tests__/menu-view.test.tsx +55 -2
- package/src/components/harness/conversation-panel/composer/command/__tests__/skill-source.test.tsx +336 -0
- package/src/components/harness/conversation-panel/composer/command/claim.ts +7 -1
- package/src/components/harness/conversation-panel/composer/command/command-popup.tsx +140 -0
- package/src/components/harness/conversation-panel/composer/command/command-suggestion-menu.tsx +261 -75
- package/src/components/harness/conversation-panel/composer/command/menu-view.tsx +188 -50
- package/src/components/harness/conversation-panel/composer/command/popup-panel.tsx +106 -0
- package/src/components/harness/conversation-panel/composer/command/skill-source.ts +231 -0
- package/src/components/harness/conversation-panel/composer/composer-editor.tsx +216 -14
- package/src/components/harness/conversation-panel/composer/composer-keymap.ts +26 -0
- package/src/components/harness/conversation-panel/composer/extension/__tests__/command-menu.test.ts +128 -12
- package/src/components/harness/conversation-panel/composer/extension/command-menu.ts +303 -44
- package/src/components/harness/conversation-panel/composer/extension/index.ts +8 -0
- package/src/components/harness/conversation-panel/composer/harness-composer.tsx +551 -83
- package/src/components/harness/conversation-panel/composer/mention/__tests__/file-mention.test.tsx +517 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-source-registration.test.tsx +5 -2
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-suggestion-menu.test.tsx +120 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/mention-trigger-source.test.ts +52 -9
- package/src/components/harness/conversation-panel/composer/mention/__tests__/story-mention.test.tsx +356 -0
- package/src/components/harness/conversation-panel/composer/mention/__tests__/thread-mention.test.tsx +377 -0
- package/src/components/harness/conversation-panel/composer/mention/file-mention.ts +162 -0
- package/src/components/harness/conversation-panel/composer/mention/mention-resolvers.ts +6 -0
- package/src/components/harness/conversation-panel/composer/mention/mention-suggestion-menu.tsx +212 -107
- package/src/components/harness/conversation-panel/composer/mention/mention-trigger-source.ts +71 -8
- package/src/components/harness/conversation-panel/composer/mention/story-mention.ts +131 -0
- package/src/components/harness/conversation-panel/composer/mention/thread-mention.ts +159 -0
- package/src/components/harness/conversation-panel/composer/mention/use-mention-sources.ts +9 -1
- package/src/components/harness/conversation-panel/composer/model-selector/__tests__/model-selector.test.tsx +401 -0
- package/src/components/harness/conversation-panel/composer/model-selector/__tests__/wiring.test.ts +117 -0
- package/src/components/harness/conversation-panel/composer/model-selector/model-selector-panel.tsx +411 -0
- package/src/components/harness/conversation-panel/composer/model-selector/model-selector-trigger.tsx +254 -0
- package/src/components/harness/conversation-panel/composer/model-selector/wiring.ts +112 -0
- package/src/components/harness/conversation-panel/composer/permission/__tests__/permission-select.test.tsx +264 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-policy.ts +76 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-popup.tsx +302 -0
- package/src/components/harness/conversation-panel/composer/permission/permission-select-button.tsx +140 -0
- package/src/components/harness/conversation-panel/composer/workspace/__tests__/workspace-select.test.tsx +390 -0
- package/src/components/harness/conversation-panel/composer/workspace/workspace-select-button.tsx +367 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/__tests__/use-harness-session-putmedia.test.tsx +17 -0
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts +26 -6
- package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts +21 -3
- package/src/components/harness/extension-panel/dock/__tests__/dock-persist.test.ts +2 -1
- package/src/components/harness/extension-panel/dock/__tests__/guide-page.test.tsx +44 -3
- package/src/components/harness/extension-panel/dock/dock-persist.ts +6 -4
- package/src/components/harness/extension-panel/dock/dock-registry.ts +35 -14
- package/src/components/harness/extension-panel/dock/dock-surface.tsx +2 -0
- package/src/components/harness/extension-panel/dock/guide-page.tsx +75 -45
- package/src/components/harness/extension-panel/panels/plugin/__tests__/install-dialog.test.tsx +260 -0
- package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-page.test.tsx +912 -0
- package/src/components/harness/extension-panel/panels/plugin/__tests__/plugin-row.test.tsx +215 -0
- package/src/components/harness/extension-panel/panels/plugin/builtin-section.tsx +204 -0
- package/src/components/harness/extension-panel/panels/plugin/install-dialog.tsx +195 -0
- package/src/components/harness/extension-panel/panels/plugin/installed-section.tsx +378 -0
- package/src/components/harness/extension-panel/panels/plugin/kind.tsx +17 -4
- package/src/components/harness/extension-panel/panels/plugin/pending-builds-block.tsx +49 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-page.tsx +257 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-row.tsx +206 -0
- package/src/components/harness/extension-panel/panels/plugin/plugin-types.ts +13 -0
- package/src/components/harness/extension-panel/panels/plugin/worker-section.tsx +322 -0
- package/src/components/harness/workbench/__tests__/provider-model-groups.test.ts +301 -0
- package/src/components/harness/workbench/harness-workbench-page.tsx +164 -2
- package/src/components/harness/workbench/provider-model-groups.ts +140 -0
- package/src/components/harness/workbench/undo-last-turn.ts +79 -0
- package/src/components/harness/workbench/workbench-context.tsx +53 -3
- package/src/components/tiptap/hooks/__tests__/use-floating-element.test.tsx +131 -0
- package/src/components/tiptap/hooks/use-floating-element.ts +15 -2
- package/src/components/tiptap/hooks/use-menu-navigation.ts +5 -0
- package/src/components/tiptap/node/mention-extension.ts +33 -0
- package/src/components/tiptap/ui/suggestion-menu/__tests__/suggestion-menu.test.tsx +366 -0
- package/src/components/tiptap/ui/suggestion-menu/suggestion-menu-types.ts +54 -0
- package/src/components/tiptap/ui/suggestion-menu/suggestion-menu.tsx +176 -45
- package/src/lib/changelog/sdk-versions.ts +2 -2
- package/src/lib/queries/__tests__/harness-plugin-queries.test.ts +49 -0
- package/src/lib/queries/harness.ts +50 -0
- package/src/paraglide/messages/_index.js +1574 -311
- package/src/paraglide/messages/en.js +513 -103
- package/src/paraglide/messages/zh.js +514 -104
- package/src/routes/_nav/harness/route.lazy.tsx +13 -0
- package/src/server/ai-gateway/sandbox/policy.ts +6 -6
- package/src/server/harness/__tests__/compact-plugin.server.test.ts +46 -0
- package/src/server/harness/__tests__/define-expose.test.ts +17 -0
- package/src/server/harness/__tests__/thread-reference.server.test.ts +258 -0
- package/src/server/harness/define.server.ts +21 -3
- package/src/server/harness/thread-reference.server.ts +446 -0
- package/src/server/serverFns/chat/__tests__/conversations-sandbox-default.test.ts +23 -0
- package/src/server/serverFns/chat/conversations.ts +18 -3
- package/src/server/serverFns/harness/search-mention-candidates.ts +14 -1
- package/src/shared/harness/__tests__/thread-reference-format.test.ts +128 -0
- package/src/shared/harness/thread-reference-format.ts +98 -0
- package/LICENSE +0 -661
- package/src/components/agents/slash-skill-menu.tsx +0 -75
- package/src/components/harness/conversation-panel/composer/extension/__tests__/demo-story-reference.test.tsx +0 -177
- package/src/components/harness/conversation-panel/composer/extension/demo-story-reference.tsx +0 -227
- package/src/components/harness/conversation-panel/composer/plugin-mention-menu.tsx +0 -109
- package/src/components/harness/extension-panel/panels/plugin-panel.tsx +0 -1021
package/src/components/harness/conversation-panel/composer/workspace/workspace-select-button.tsx
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// This program is free software: you can redistribute it and/or modify
|
|
6
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
// (at your option) any later version.
|
|
9
|
+
//
|
|
10
|
+
// This program is distributed in the hope that it will be useful,
|
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
// GNU Affero General Public License for more details.
|
|
14
|
+
//
|
|
15
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 控制行工作区选择按钮(任务 5):`+` 钮与权限钮之间的工作区入口(DSH 控制行
|
|
20
|
+
* 次序)。两种数据面:
|
|
21
|
+
* - cloud:切换线程挂靠的云端工作区(列表自取 harnessWorkspacesQueryOptions 既有
|
|
22
|
+
* 工厂——复用 key ['harness-workspaces'],与左面板 WorkspaceBrowser 共享缓存,
|
|
23
|
+
* 禁止新建工厂;kind === 'cloud' 为可选行,mirrorOfName 非空的镜像行不重复列出,
|
|
24
|
+
* local-meta 行不进云端列表)。选择经 onSwitchWorkspace 上抛(page 组装
|
|
25
|
+
* updateConversationFn({ workspaceId }) + conversations 同步)。**已有消息的线程
|
|
26
|
+
* 锁定切换**(2026-11-21 打磨裁决:工作区仅新会话可选——会话开始后不可再选,云端与
|
|
27
|
+
* 本地同口径;服务端 workspaceId 切换守卫仍独立在位)。
|
|
28
|
+
* - local:选本地授权目录(desktopAgentWorkspacesQueryOptions 清单 +
|
|
29
|
+
* getDesktopBridge().pickDirectory 原生对话框,AgentWorkspaceCard.addMutation
|
|
30
|
+
* 同款 mutation,成功 invalidate DESKTOP_AGENT_QUERY_KEY;取消 null 不调)。
|
|
31
|
+
* 选择经 onSelectLocalCwd 上抛(page 组装 setLocalCwd + updateConversationFn)。
|
|
32
|
+
* 已有消息的线程锁定(服务端引擎块要求空线程才可写,客户端 disabled 同口径)。
|
|
33
|
+
*
|
|
34
|
+
* 无 threadId 空态与本地锁定态:触发钮 disabled + Tooltip 说明(不渲染浮层)。
|
|
35
|
+
* open 态统一经 changeOpen 同步上报 onMenuOpenChange(与 @ / `+` 菜单 /
|
|
36
|
+
* PermissionSelectButton / ModelSelector 同款——menuOpen=true 屏蔽 Esc-Esc 停止
|
|
37
|
+
* 序列);Popover 走 ui/popover(Base UI portal,Esc 走 document 冒泡,本通道已
|
|
38
|
+
* 屏蔽停止热键,`+` 菜单任务 10 同构)。
|
|
39
|
+
*
|
|
40
|
+
* react-query 经 query-client-seam 显式直连(useQuery/useMutation 的可选 client
|
|
41
|
+
* 形参——mention-suggestion-menu fetchDir 同款):composer 树无 QueryClientProvider
|
|
42
|
+
* (既有 27 处 composer 渲染测试裸渲染),context 形式的 useQueryClient 会抛
|
|
43
|
+
* "No QueryClient set";seam 单例即 router.tsx 装配的同一 client(单实例纪律),
|
|
44
|
+
* 测试环境懒创建兜底。
|
|
45
|
+
*/
|
|
46
|
+
import { useCallback, useMemo, useState } from "react"
|
|
47
|
+
import { useMutation, useQuery } from "@tanstack/react-query"
|
|
48
|
+
import { Check, ChevronDown, Folder, FolderOpen, FolderPlus, Loader2, Settings2 } from "lucide-react"
|
|
49
|
+
import { cn } from "cn"
|
|
50
|
+
import { PromptInputButton } from "@/components/ai-elements/prompt-input"
|
|
51
|
+
import { Button } from "@/components/ui/button"
|
|
52
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
|
|
53
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
|
|
54
|
+
import { toast } from "@/components/ui/toast"
|
|
55
|
+
import { getDesktopBridge } from "@/lib/desktop-bridge-types"
|
|
56
|
+
import { getQueryClient } from "@/lib/query-client-seam"
|
|
57
|
+
import {
|
|
58
|
+
DESKTOP_AGENT_QUERY_KEY,
|
|
59
|
+
desktopAgentWorkspacesQueryOptions,
|
|
60
|
+
} from "@/lib/queries/desktop-agent"
|
|
61
|
+
import { harnessWorkspacesQueryOptions } from "@/lib/queries/harness"
|
|
62
|
+
import { m } from "@/paraglide/messages.js"
|
|
63
|
+
|
|
64
|
+
export interface WorkspaceSelectButtonProps {
|
|
65
|
+
/** 执行引擎:cloud=服务端模型(选云端工作区);local=本地 ACP agent(选授权目录) */
|
|
66
|
+
engine: "cloud" | "local"
|
|
67
|
+
/** 目标线程 id;null = 空态(首条消息后建线),触发钮 disabled */
|
|
68
|
+
threadId: string | null
|
|
69
|
+
/** 当前线程挂靠的云端工作区 id(conversations.find 投影;null=未挂靠) */
|
|
70
|
+
threadWorkspaceId: string | null
|
|
71
|
+
/** 本地 Agent 的授权工作目录(engine=local 显示尾段;null=未选) */
|
|
72
|
+
localCwd: string | null
|
|
73
|
+
/** 已有消息(全引擎锁定工作区切换——打磨裁决:工作区仅新会话可选) */
|
|
74
|
+
hasMessages: boolean
|
|
75
|
+
/** cloud 切换(page 组装 updateConversationFn({ workspaceId }) + conversations 同步) */
|
|
76
|
+
onSwitchWorkspace?: (workspaceId: string) => Promise<void> | void
|
|
77
|
+
/** 本地目录选择(page 组装 setLocalCwd + updateConversationFn({ localCwd })) */
|
|
78
|
+
onSelectLocalCwd?: (path: string) => void
|
|
79
|
+
/** 打开左侧工作空间面板(云端菜单空态新建/管理入口通路;缺省 toast 引导) */
|
|
80
|
+
onOpenWorkspacePanel?: () => void
|
|
81
|
+
/** open 态上报(composer 的 setMenuOpen——Esc-Esc 停止序列屏蔽通道) */
|
|
82
|
+
onMenuOpenChange: (open: boolean) => void
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** 路径末段作为目录显示名(POSIX / Windows 分隔符均可;agent-workspace-card 同款复制,
|
|
86
|
+
* 不改既有文件导出面) */
|
|
87
|
+
function folderNameOf(path: string): string {
|
|
88
|
+
return path.split(/[\\/]/).filter(Boolean).at(-1) ?? path
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function WorkspaceSelectButton({
|
|
92
|
+
engine,
|
|
93
|
+
threadId,
|
|
94
|
+
threadWorkspaceId,
|
|
95
|
+
localCwd,
|
|
96
|
+
hasMessages,
|
|
97
|
+
onSwitchWorkspace,
|
|
98
|
+
onSelectLocalCwd,
|
|
99
|
+
onOpenWorkspacePanel,
|
|
100
|
+
onMenuOpenChange,
|
|
101
|
+
}: WorkspaceSelectButtonProps) {
|
|
102
|
+
const [open, setOpen] = useState(false)
|
|
103
|
+
// open 变化统一经此(点钮开 / Esc 外点关)——同步上报 onMenuOpenChange
|
|
104
|
+
const changeOpen = useCallback(
|
|
105
|
+
(next: boolean) => {
|
|
106
|
+
setOpen(next)
|
|
107
|
+
onMenuOpenChange(next)
|
|
108
|
+
},
|
|
109
|
+
[onMenuOpenChange],
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
// 锁定判定:空态(无线程可写)或已有消息(打磨裁决 2026-11-21:工作区仅新会话可选,
|
|
113
|
+
// 云端与本地同口径;服务端守卫仍为最后防线)
|
|
114
|
+
const locked = threadId == null || hasMessages
|
|
115
|
+
|
|
116
|
+
const queryClient = getQueryClient()
|
|
117
|
+
// 云端列表(复用既有工厂与 key ['harness-workspaces'],与左面板共享缓存);
|
|
118
|
+
// local 引擎不取(引擎互斥)。**enabled 附加 open**(简报字面为 engine !== 'local',
|
|
119
|
+
// 实测差异见下):composer 27 处既有渲染测试裸渲染无 QueryClientProvider,挂载即
|
|
120
|
+
// 取数会真实发起 serverFn RPC(thread-mention 的「legacy gating 不发
|
|
121
|
+
// harness-workspaces 请求」哨兵断言直接红)。open 门控后:关闭态名称回显仍生效
|
|
122
|
+
// ——TanStack Query enabled:false 的 observer 依旧订阅缓存(左面板 WorkspaceBrowser
|
|
123
|
+
// 挂载即取同一工厂,缓存恒有值;测试环境用 setQueryData 预置同形缓存)。
|
|
124
|
+
const cloudQuery = useQuery(
|
|
125
|
+
{ ...harnessWorkspacesQueryOptions(), enabled: open && engine !== "local" },
|
|
126
|
+
queryClient,
|
|
127
|
+
)
|
|
128
|
+
// 本地授权目录清单;cloud 引擎不取(同 open 门控——菜单不打开不跑桥 IPC)
|
|
129
|
+
const localQuery = useQuery(
|
|
130
|
+
{ ...desktopAgentWorkspacesQueryOptions(), enabled: open && engine === "local" },
|
|
131
|
+
queryClient,
|
|
132
|
+
)
|
|
133
|
+
// 添加目录(AgentWorkspaceCard.addMutation 同款:pickDirectory 成功写入清单并
|
|
134
|
+
// 返回规范化绝对路径,取消返回 null;成功后按前缀 invalidate 清单)
|
|
135
|
+
const addMutation = useMutation(
|
|
136
|
+
{
|
|
137
|
+
mutationFn: async () => (await getDesktopBridge()?.pickDirectory?.()) ?? null,
|
|
138
|
+
onSuccess: async (picked) => {
|
|
139
|
+
if (!picked) return // 用户取消对话框:不调不关菜单
|
|
140
|
+
await queryClient.invalidateQueries({ queryKey: DESKTOP_AGENT_QUERY_KEY })
|
|
141
|
+
onSelectLocalCwd?.(picked)
|
|
142
|
+
changeOpen(false)
|
|
143
|
+
},
|
|
144
|
+
onError: () => {
|
|
145
|
+
toast.error(m.agent_desktop_workspaceAddFailed())
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
queryClient,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
const cloudWorkspaces = cloudQuery.data?.workspaces ?? []
|
|
152
|
+
// 触发钮云端名称:全量行里找当前挂靠(镜像行不进可选列表但名称仍可回显)
|
|
153
|
+
const cloudCurrentName = threadWorkspaceId
|
|
154
|
+
? (cloudWorkspaces.find((w) => w.id === threadWorkspaceId)?.name ?? null)
|
|
155
|
+
: null
|
|
156
|
+
// 可选云端行:kind === 'cloud'(local-meta 是本地挂载元数据行)+ 镜像行
|
|
157
|
+
// (mirrorOfName 非空 = 已有本地镜像承载)不重复列出
|
|
158
|
+
const cloudOptions = useMemo(
|
|
159
|
+
() => cloudWorkspaces.filter((w) => w.kind === "cloud" && w.mirrorOfName == null),
|
|
160
|
+
[cloudWorkspaces],
|
|
161
|
+
)
|
|
162
|
+
const localDirs = localQuery.data ?? []
|
|
163
|
+
|
|
164
|
+
// 触发钮图标/名称:已选 FolderOpen(cloud=挂靠名 / local=目录尾段),未选 Folder + 占位
|
|
165
|
+
const isSelected =
|
|
166
|
+
(engine === "cloud" && threadWorkspaceId != null) ||
|
|
167
|
+
(engine === "local" && localCwd != null)
|
|
168
|
+
const SelectedIcon = isSelected ? FolderOpen : Folder
|
|
169
|
+
const label =
|
|
170
|
+
engine === "cloud"
|
|
171
|
+
? threadWorkspaceId != null
|
|
172
|
+
? (cloudCurrentName ?? m.harness_workspace_selectPlaceholder())
|
|
173
|
+
: m.harness_workspace_selectPlaceholder()
|
|
174
|
+
: localCwd != null
|
|
175
|
+
? folderNameOf(localCwd)
|
|
176
|
+
: m.harness_workspace_selectPlaceholder()
|
|
177
|
+
|
|
178
|
+
// 空态/锁定态:disabled 触发钮 + Tooltip 说明(disabled 钮不接收指针事件,
|
|
179
|
+
// tooltip trigger 包一层 span 承接 hover——design-share-panel 同款配方)
|
|
180
|
+
const lockTooltip =
|
|
181
|
+
threadId == null
|
|
182
|
+
? m.harness_workspace_emptyTooltip()
|
|
183
|
+
: m.harness_workspace_lockedTooltip()
|
|
184
|
+
|
|
185
|
+
const triggerButton = (
|
|
186
|
+
<PromptInputButton
|
|
187
|
+
size="sm"
|
|
188
|
+
variant="outline"
|
|
189
|
+
className="rounded-full"
|
|
190
|
+
data-workspace-select-trigger=""
|
|
191
|
+
aria-label={m.harness_workspace_aria({ name: label })}
|
|
192
|
+
disabled={locked}
|
|
193
|
+
>
|
|
194
|
+
<SelectedIcon aria-hidden className="size-3.5 shrink-0" />
|
|
195
|
+
<span className="max-w-28 truncate text-xs">{label}</span>
|
|
196
|
+
<ChevronDown
|
|
197
|
+
aria-hidden
|
|
198
|
+
className={cn(
|
|
199
|
+
"size-3.5 shrink-0 text-muted-foreground transition-transform",
|
|
200
|
+
open && "rotate-180",
|
|
201
|
+
)}
|
|
202
|
+
/>
|
|
203
|
+
</PromptInputButton>
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
// 打开左面板工作区通路(新建/管理入口);通道缺省(非 workbench 装配点)toast 引导
|
|
207
|
+
const handleOpenPanel = useCallback(() => {
|
|
208
|
+
if (onOpenWorkspacePanel) {
|
|
209
|
+
onOpenWorkspacePanel()
|
|
210
|
+
} else {
|
|
211
|
+
toast.info(m.harness_workspace_openPanelHint())
|
|
212
|
+
}
|
|
213
|
+
changeOpen(false)
|
|
214
|
+
}, [onOpenWorkspacePanel, changeOpen])
|
|
215
|
+
|
|
216
|
+
if (locked) {
|
|
217
|
+
return (
|
|
218
|
+
<Tooltip>
|
|
219
|
+
<TooltipTrigger render={<span className="inline-flex cursor-not-allowed" />}>
|
|
220
|
+
{triggerButton}
|
|
221
|
+
</TooltipTrigger>
|
|
222
|
+
<TooltipContent>{lockTooltip}</TooltipContent>
|
|
223
|
+
</Tooltip>
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<Popover open={open} onOpenChange={changeOpen}>
|
|
229
|
+
<PopoverTrigger render={triggerButton} />
|
|
230
|
+
{open && (
|
|
231
|
+
<PopoverContent align="start" className="w-64 gap-0 p-1">
|
|
232
|
+
{engine === "cloud" ? (
|
|
233
|
+
<div className="flex flex-col">
|
|
234
|
+
<div className="px-2 py-1.5 text-xs text-muted-foreground">
|
|
235
|
+
{m.harness_workspace_switchHint()}
|
|
236
|
+
</div>
|
|
237
|
+
{cloudQuery.isPending ? (
|
|
238
|
+
<div className="flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground">
|
|
239
|
+
<Loader2 aria-hidden className="size-3.5 animate-spin" />
|
|
240
|
+
{m.harness_workspace_loading()}
|
|
241
|
+
</div>
|
|
242
|
+
) : cloudOptions.length === 0 ? (
|
|
243
|
+
<div className="flex flex-col">
|
|
244
|
+
<div className="px-2 py-3 text-center text-sm text-muted-foreground">
|
|
245
|
+
{m.harness_workspace_emptyList()}
|
|
246
|
+
</div>
|
|
247
|
+
<MenuRow
|
|
248
|
+
icon={<FolderPlus aria-hidden className="size-3.5" />}
|
|
249
|
+
label={m.harness_workspace_createEntry()}
|
|
250
|
+
onClick={handleOpenPanel}
|
|
251
|
+
/>
|
|
252
|
+
<MenuRow
|
|
253
|
+
icon={<Settings2 aria-hidden className="size-3.5" />}
|
|
254
|
+
label={m.harness_workspace_manageEntry()}
|
|
255
|
+
onClick={handleOpenPanel}
|
|
256
|
+
/>
|
|
257
|
+
</div>
|
|
258
|
+
) : (
|
|
259
|
+
<div className="max-h-64 overflow-y-auto">
|
|
260
|
+
{cloudOptions.map((w) => {
|
|
261
|
+
const current = w.id === threadWorkspaceId
|
|
262
|
+
return (
|
|
263
|
+
<MenuRow
|
|
264
|
+
key={w.id}
|
|
265
|
+
icon={
|
|
266
|
+
<FolderOpen aria-hidden className="size-3.5 text-muted-foreground" />
|
|
267
|
+
}
|
|
268
|
+
label={w.name}
|
|
269
|
+
checked={current}
|
|
270
|
+
onClick={() => {
|
|
271
|
+
void onSwitchWorkspace?.(w.id)
|
|
272
|
+
changeOpen(false)
|
|
273
|
+
}}
|
|
274
|
+
/>
|
|
275
|
+
)
|
|
276
|
+
})}
|
|
277
|
+
</div>
|
|
278
|
+
)}
|
|
279
|
+
</div>
|
|
280
|
+
) : (
|
|
281
|
+
<div className="flex flex-col">
|
|
282
|
+
<div className="max-h-64 overflow-y-auto">
|
|
283
|
+
{localDirs.map((path) => {
|
|
284
|
+
const current = path === localCwd
|
|
285
|
+
return (
|
|
286
|
+
<MenuRow
|
|
287
|
+
key={path}
|
|
288
|
+
icon={
|
|
289
|
+
<FolderOpen aria-hidden className="size-3.5 text-muted-foreground" />
|
|
290
|
+
}
|
|
291
|
+
label={folderNameOf(path)}
|
|
292
|
+
checked={current}
|
|
293
|
+
onClick={() => {
|
|
294
|
+
onSelectLocalCwd?.(path)
|
|
295
|
+
changeOpen(false)
|
|
296
|
+
}}
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
})}
|
|
300
|
+
{localDirs.length === 0 && !localQuery.isPending && (
|
|
301
|
+
<div className="px-2 py-3 text-center text-sm text-muted-foreground">
|
|
302
|
+
{m.agent_desktop_workspaceEmpty()}
|
|
303
|
+
</div>
|
|
304
|
+
)}
|
|
305
|
+
{localQuery.isPending && (
|
|
306
|
+
<div className="flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground">
|
|
307
|
+
<Loader2 aria-hidden className="size-3.5 animate-spin" />
|
|
308
|
+
{m.harness_workspace_loading()}
|
|
309
|
+
</div>
|
|
310
|
+
)}
|
|
311
|
+
</div>
|
|
312
|
+
<div className="my-1 border-t" />
|
|
313
|
+
<MenuRow
|
|
314
|
+
icon={
|
|
315
|
+
addMutation.isPending ? (
|
|
316
|
+
<Loader2 aria-hidden className="size-3.5 animate-spin" />
|
|
317
|
+
) : (
|
|
318
|
+
<FolderPlus aria-hidden className="size-3.5" />
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
label={m.agent_desktop_workspaceAdd()}
|
|
322
|
+
disabled={addMutation.isPending}
|
|
323
|
+
onClick={() => addMutation.mutate()}
|
|
324
|
+
/>
|
|
325
|
+
</div>
|
|
326
|
+
)}
|
|
327
|
+
</PopoverContent>
|
|
328
|
+
)}
|
|
329
|
+
</Popover>
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** 菜单行(云端工作区 / 本地目录 / 入口项共用):icon + label + 当前行 ✓。用
|
|
334
|
+
* ui/button ghost 承载(AGENTS.md 选型④禁手写原生按钮;ghost 基类自带
|
|
335
|
+
* focus-visible 焦点环,修复原生实现的键盘焦点不可见)。className 覆盖项:
|
|
336
|
+
* justify-start/text-left(按钮默认居中)、px-2(size sm 的 2.5 收窄回原行距)、
|
|
337
|
+
* gap-2、font-normal(基类 font-medium 回常规字重);高度 h-8 与原 py-1.5 自然行高
|
|
338
|
+
* 等值,选中语义(checked ✓ / sr-only)不变。 */
|
|
339
|
+
function MenuRow({
|
|
340
|
+
icon,
|
|
341
|
+
label,
|
|
342
|
+
checked = false,
|
|
343
|
+
disabled = false,
|
|
344
|
+
onClick,
|
|
345
|
+
}: {
|
|
346
|
+
icon: React.ReactNode
|
|
347
|
+
label: string
|
|
348
|
+
checked?: boolean
|
|
349
|
+
disabled?: boolean
|
|
350
|
+
onClick: () => void
|
|
351
|
+
}) {
|
|
352
|
+
return (
|
|
353
|
+
<Button
|
|
354
|
+
type="button"
|
|
355
|
+
variant="ghost"
|
|
356
|
+
size="sm"
|
|
357
|
+
className="w-full justify-start gap-2 px-2 text-left font-normal"
|
|
358
|
+
disabled={disabled}
|
|
359
|
+
onClick={onClick}
|
|
360
|
+
>
|
|
361
|
+
{icon}
|
|
362
|
+
<span className="min-w-0 flex-1 truncate">{label}</span>
|
|
363
|
+
{checked && <Check aria-hidden className="size-3.5 shrink-0" />}
|
|
364
|
+
{checked && <span className="sr-only">✓</span>}
|
|
365
|
+
</Button>
|
|
366
|
+
)
|
|
367
|
+
}
|
|
@@ -11,11 +11,13 @@ import { renderHook, act } from '@testing-library/react'
|
|
|
11
11
|
import { createStore } from '@tanstack/store'
|
|
12
12
|
|
|
13
13
|
const putMediaMock = vi.fn()
|
|
14
|
+
const runCommandMock = vi.fn()
|
|
14
15
|
const sendViewMock = vi.fn()
|
|
15
16
|
|
|
16
17
|
vi.mock('@tanstack/ai-harness/client', () => ({
|
|
17
18
|
createHarnessClient: () => ({
|
|
18
19
|
putMedia: putMediaMock,
|
|
20
|
+
runCommand: runCommandMock,
|
|
19
21
|
}),
|
|
20
22
|
}))
|
|
21
23
|
|
|
@@ -46,6 +48,8 @@ import { useHarnessSession } from '../use-harness-session'
|
|
|
46
48
|
|
|
47
49
|
beforeEach(() => {
|
|
48
50
|
putMediaMock.mockReset()
|
|
51
|
+
runCommandMock.mockReset()
|
|
52
|
+
runCommandMock.mockResolvedValue({ ok: true })
|
|
49
53
|
putMediaMock.mockResolvedValue({
|
|
50
54
|
id: 'm1',
|
|
51
55
|
threadId: 't1',
|
|
@@ -79,4 +83,17 @@ describe('useHarnessSession putMedia 接线(T2.11 ④)', () => {
|
|
|
79
83
|
const { result } = renderHook(() => useHarnessSession({ threadId: 't1' }))
|
|
80
84
|
expect(result.current.client).toBeDefined()
|
|
81
85
|
})
|
|
86
|
+
|
|
87
|
+
it('暴露的 runCommand 透传 (name, input) 到 client.runCommand({ name, input })(P2 任务 1 断点③最深跳)', async () => {
|
|
88
|
+
const { result } = renderHook(() => useHarnessSession({ threadId: 't1' }))
|
|
89
|
+
const runCommand = result.current.runCommand
|
|
90
|
+
expect(typeof runCommand).toBe('function')
|
|
91
|
+
|
|
92
|
+
await act(async () => {
|
|
93
|
+
await runCommand?.('export', '每周汇总')
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// args 经 input 透传(修复前仅 client.runCommand({ name })、input 丢弃)
|
|
97
|
+
expect(runCommandMock).toHaveBeenCalledWith({ name: 'export', input: '每周汇总' })
|
|
98
|
+
})
|
|
82
99
|
})
|
package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-chat-adapter.ts
CHANGED
|
@@ -33,7 +33,7 @@ import type {
|
|
|
33
33
|
ViewPart,
|
|
34
34
|
} from '@tanstack/ai-harness/view'
|
|
35
35
|
import type { MediaRecord } from '@tanstack/ai-harness/client'
|
|
36
|
-
import type { SessionUsage } from '@tanstack/ai-harness'
|
|
36
|
+
import type { SessionUsage, ThreadSettings, ThreadSettingsChange } from '@tanstack/ai-harness'
|
|
37
37
|
import type { TerminalEntry } from './terminal-entries'
|
|
38
38
|
import { HarnessSessionAppChat } from './harness-session-appchat'
|
|
39
39
|
import type { HarnessSession } from './use-harness-session'
|
|
@@ -77,6 +77,18 @@ export interface HarnessChatLike {
|
|
|
77
77
|
* (total/byModel/bySender/bySource)。undefined = 尚无模型调用(用量 pill 不渲染)。
|
|
78
78
|
*/
|
|
79
79
|
sessionUsage?: SessionUsage
|
|
80
|
+
/**
|
|
81
|
+
* 线程持久化设置切片(P2 composer 控制,任务 1):view state 顶层 settings
|
|
82
|
+
* (ThreadSettings:model/reasoning/instructions/...,服务端 configure op 写入后
|
|
83
|
+
* 经 settingsChanged 事件回流)。undefined = 尚无 settings 或旧链(消费方显示回落值)。
|
|
84
|
+
*/
|
|
85
|
+
threadSettings?: ThreadSettings
|
|
86
|
+
/**
|
|
87
|
+
* 线程设置写入(P2 composer 控制,任务 1):view.updateThreadSettings(configure
|
|
88
|
+
* op,服务端 expose.settings 白名单逐 key 校验)透传。空态无 view → undefined。
|
|
89
|
+
* Receipt 收窄为 unknown 防包类型穿透(消费方无需感知 ai-harness Receipt 形状)。
|
|
90
|
+
*/
|
|
91
|
+
updateThreadSettings?: (settings: ThreadSettingsChange) => Promise<unknown> | undefined
|
|
80
92
|
/** 沙箱终端 bash 调用序列(P3-5,transcript 聚合;空 = 无 bash 调用) */
|
|
81
93
|
terminalEntries: TerminalEntry[]
|
|
82
94
|
interrupts: TakeoverInterruptLike[]
|
|
@@ -107,11 +119,12 @@ export interface HarnessChatLike {
|
|
|
107
119
|
*/
|
|
108
120
|
commands: ReadonlyArray<{ name: string; description: string }>
|
|
109
121
|
/**
|
|
110
|
-
* 服务端命令执行(F5-4 runCommand 通路):harness client.runCommand({ name })
|
|
111
|
-
* 透传,结果经 harness.command.result
|
|
112
|
-
*
|
|
122
|
+
* 服务端命令执行(F5-4 runCommand 通路):harness client.runCommand({ name, input })
|
|
123
|
+
* 透传,结果经 harness.command.result 事件回流。input 为 claim 结算参数(E2,P2 任务 1:
|
|
124
|
+
* input 型 server 命令 claim.submit(args) 经此透传,缺省 undefined=非 claim 调用)。
|
|
125
|
+
* 空态无 client → undefined。旧链无此能力(undefined → workbench-page onRunCommand 兜底 resolve)。
|
|
113
126
|
*/
|
|
114
|
-
runCommand?: (name: string) => Promise<unknown>
|
|
127
|
+
runCommand?: (name: string, input?: unknown) => Promise<unknown>
|
|
115
128
|
/**
|
|
116
129
|
* 继续生成(A5/B8,F5-6 批 2):view.continueWithoutMessage——无新消息、从已存
|
|
117
130
|
* transcript 续跑一回合。steerQueue 快捷键(空草稿+Cmd/Ctrl+Enter)与主按钮
|
|
@@ -336,7 +349,7 @@ function singleSourceFromArgs(args: unknown): Array<{ title: string; url: string
|
|
|
336
349
|
* 调用方经 options.harnessAttachments 透传,见 tie-up 3)。
|
|
337
350
|
*/
|
|
338
351
|
export function useHarnessChatAdapter(session: HarnessSession): HarnessChatLike {
|
|
339
|
-
const { view, messages: viewMessages, status, connection, approvals, interrupts: viewInterrupts, questions, send, followUp, continueWithoutMessage, queuedTurns, cancel, putMedia, contextTokens, sessionUsage, terminalEntries, commands: sessionCommands, runCommand: sessionRunCommand } = session
|
|
352
|
+
const { view, messages: viewMessages, status, connection, approvals, interrupts: viewInterrupts, questions, send, followUp, continueWithoutMessage, queuedTurns, cancel, putMedia, contextTokens, sessionUsage, threadSettings, updateThreadSettings, terminalEntries, commands: sessionCommands, runCommand: sessionRunCommand } = session
|
|
340
353
|
|
|
341
354
|
const [error, setError] = useState<Error | null>(null)
|
|
342
355
|
|
|
@@ -367,6 +380,11 @@ export function useHarnessChatAdapter(session: HarnessSession): HarnessChatLike
|
|
|
367
380
|
|
|
368
381
|
// 服务端命令投影(F5-4):ViewCommand → '/' 菜单 server 类最小形状(name+
|
|
369
382
|
// description;owner 不进菜单)。现状 view.commands 空(内置插件零注册)→ []。
|
|
383
|
+
// ⚠ input 旗标翻译边界(P2 任务 1):上游 ViewCommand.input 是 JSON Schema(非
|
|
384
|
+
// 布尔),composer 的 ComposerServerCommand.input 是布尔旗标——本投影**不做**翻译,
|
|
385
|
+
// 故 server input 型命令即使存在也不会被 claim 通路认作 input 型(零消费者:expose
|
|
386
|
+
// .commands 现无 input 型命令)。留待真实 server input 命令出现时在此定
|
|
387
|
+
// 「JSON Schema → 布尔旗标」翻译层(届时一并补 claim 用例)。
|
|
370
388
|
const commands = useMemo(
|
|
371
389
|
() => sessionCommands.map((c) => ({ name: c.name, description: c.description })),
|
|
372
390
|
[sessionCommands],
|
|
@@ -459,6 +477,8 @@ export function useHarnessChatAdapter(session: HarnessSession): HarnessChatLike
|
|
|
459
477
|
runId: null,
|
|
460
478
|
contextTokens,
|
|
461
479
|
sessionUsage,
|
|
480
|
+
threadSettings,
|
|
481
|
+
updateThreadSettings,
|
|
462
482
|
terminalEntries,
|
|
463
483
|
interrupts,
|
|
464
484
|
sendMessage,
|
package/src/components/harness/conversation-panel/messages/harness-chain/use-harness-session.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { createSessionView } from '@tanstack/ai-harness/view'
|
|
|
25
25
|
import type { AnyHarness } from '@tanstack/ai-harness'
|
|
26
26
|
import type { MediaRecord } from '@tanstack/ai-harness/client'
|
|
27
27
|
import type { SessionViewState, ViewMessage } from '@tanstack/ai-harness/view'
|
|
28
|
-
import type {
|
|
28
|
+
import type { ThreadSettings, ThreadSettingsChange } from '@tanstack/ai-harness'
|
|
29
29
|
|
|
30
30
|
import { clearCompactionNotices, useCompactionNotices, wrapClientWithCompactionNotices } from './use-compaction-notices'
|
|
31
31
|
import { collectTerminalEntries } from './terminal-entries'
|
|
@@ -176,6 +176,10 @@ export function useHarnessSession({ threadId }: UseHarnessSessionOptions) {
|
|
|
176
176
|
// 用量四桶(P2-3d,设计 §5.3):view state 顶层 usage 切片(SessionUsage:
|
|
177
177
|
// total/byModel/bySender/bySource)。undefined = 尚无模型调用(用量 pill 不渲染)。
|
|
178
178
|
const sessionUsage = useStore(store, (s) => s.usage)
|
|
179
|
+
// 线程持久化设置切片(P2 composer 控制,任务 1):view state 顶层 settings
|
|
180
|
+
// (ThreadSettings:model/reasoning/instructions/...,服务端 configure op 写入后经
|
|
181
|
+
// settingsChanged 事件回流)。undefined = 尚无 settings(composer 显示回落值)。
|
|
182
|
+
const threadSettings: ThreadSettings | undefined = useStore(store, (s) => s.settings)
|
|
179
183
|
// 沙箱终端聚合(P3-5,复审改口径):transcript bash 调用序列客户端聚合
|
|
180
184
|
// (adapter UIMessage 投影丢 output,须在原始 ViewMessage 层做——messages 即
|
|
181
185
|
// view state 原始 ViewMessage[],与上方投影订阅同源)。
|
|
@@ -213,6 +217,14 @@ export function useHarnessSession({ threadId }: UseHarnessSessionOptions) {
|
|
|
213
217
|
}, [view])
|
|
214
218
|
const cancel = useCallback(() => view?.cancel(), [view])
|
|
215
219
|
|
|
220
|
+
// 线程设置写入(P2 composer 控制,任务 1):view.updateThreadSettings(configure
|
|
221
|
+
// op,服务端 expose.settings 白名单逐 key 校验)。可选方法守卫——view 无此能力
|
|
222
|
+
// (旧 view 版本/空态)返回 undefined,消费方以 undefined 识别「无写入通道」。
|
|
223
|
+
const updateThreadSettings = useCallback(
|
|
224
|
+
(settings: ThreadSettingsChange) => view?.updateThreadSettings?.({ settings }),
|
|
225
|
+
[view],
|
|
226
|
+
)
|
|
227
|
+
|
|
216
228
|
// 附件上传器(T2.11 ④):harness client.putMedia 暴露给 composer 的 useAttachments。
|
|
217
229
|
// 用 client.putMedia(接受 Blob)而非 view.putMedia(MediaBody 仅 ArrayBuffer|Uint8Array,
|
|
218
230
|
// 见 view/index.d.ts:101),与 use-attachments 的 File/Blob 通道类型对齐。
|
|
@@ -227,12 +239,14 @@ export function useHarnessSession({ threadId }: UseHarnessSessionOptions) {
|
|
|
227
239
|
|
|
228
240
|
// F5-4 runCommand 通路:服务端命令执行('/' 菜单 server 类的执行出口)。结果
|
|
229
241
|
// 经 harness.command.result 事件回流(client 现有事件管道,view store 消费),
|
|
230
|
-
//
|
|
242
|
+
// 此处只透传调用。E2 claim(P2 任务 1):input 型 server 命令 claim.submit(args) 结算
|
|
243
|
+
// 经此透传 input(chip 后参数文本)——上游 CommandOptions 本支持 { name, input }。
|
|
244
|
+
// 空态无 client → undefined(与 putMedia 同款守卫;空态 commands
|
|
231
245
|
// 恒空,菜单不会产出 server 项,此 undefined 仅防御)。
|
|
232
246
|
const runCommand = useMemo(
|
|
233
247
|
() =>
|
|
234
248
|
client
|
|
235
|
-
? (name: string) => client.runCommand({ name })
|
|
249
|
+
? (name: string, input?: unknown) => client.runCommand({ name, input })
|
|
236
250
|
: undefined,
|
|
237
251
|
[client],
|
|
238
252
|
)
|
|
@@ -265,6 +279,10 @@ export function useHarnessSession({ threadId }: UseHarnessSessionOptions) {
|
|
|
265
279
|
contextTokens,
|
|
266
280
|
/** 会话用量四桶(P2-3d,SessionUsage;undefined = 尚无模型调用) */
|
|
267
281
|
sessionUsage,
|
|
282
|
+
/** 线程持久化设置切片(P2 composer 控制,ThreadSettings;undefined = 尚无 settings) */
|
|
283
|
+
threadSettings,
|
|
284
|
+
/** 线程设置写入(P2 composer 控制:configure op 透传;空态/无能力 undefined) */
|
|
285
|
+
updateThreadSettings,
|
|
268
286
|
/** 沙箱终端 bash 调用序列(P3-5,transcript 聚合;空 = 无 bash 调用) */
|
|
269
287
|
terminalEntries,
|
|
270
288
|
send,
|
|
@@ -304,7 +304,8 @@ describe("defaultDockLayout", () => {
|
|
|
304
304
|
expect(d.tabs[root.tabIds[0]].kind).toBe("guide")
|
|
305
305
|
expect(d.floats).toEqual([])
|
|
306
306
|
expect(d.activePaneId).toBe("root")
|
|
307
|
-
|
|
307
|
+
// 进入 Harness 右侧面板默认收起(2026-11-19 用户裁决)
|
|
308
|
+
expect(d.expanded).toBe(false)
|
|
308
309
|
})
|
|
309
310
|
|
|
310
311
|
it("loadDockState 回落场景返回 null(默认布局由调用方经 defaultDockLayout 提供)", () => {
|
|
@@ -74,10 +74,18 @@ describe("collectGuideEntries(卡序 + 显隐 + availability)", () => {
|
|
|
74
74
|
makeGuideKind("terminal", 20),
|
|
75
75
|
// 无 guide 字段 → 不上卡(More 菜单行)
|
|
76
76
|
{ kind: "changes", title: "changes", icon: null, render: () => null },
|
|
77
|
+
// 第五卡:plugin(order 50)
|
|
78
|
+
{ kind: "plugin", title: "plugin", icon: null, render: () => null, guide: { order: 50, title: "plugin title", icon: null } },
|
|
77
79
|
])
|
|
78
80
|
try {
|
|
79
81
|
const entries = collectGuideEntries(dockRegistry.listKinds())
|
|
80
|
-
expect(entries.map((e) => e.kind)).toEqual([
|
|
82
|
+
expect(entries.map((e) => e.kind)).toEqual([
|
|
83
|
+
"files",
|
|
84
|
+
"terminal",
|
|
85
|
+
"browser",
|
|
86
|
+
"media",
|
|
87
|
+
"plugin",
|
|
88
|
+
])
|
|
81
89
|
} finally {
|
|
82
90
|
dispose()
|
|
83
91
|
}
|
|
@@ -153,7 +161,7 @@ describe("GuidePage 渲染", () => {
|
|
|
153
161
|
}
|
|
154
162
|
})
|
|
155
163
|
|
|
156
|
-
it("
|
|
164
|
+
it("5 卡(含 order 50 第五卡)仍显描述", () => {
|
|
157
165
|
const dispose = registerAll([
|
|
158
166
|
makeGuideKind("a", 10),
|
|
159
167
|
makeGuideKind("b", 20),
|
|
@@ -161,10 +169,31 @@ describe("GuidePage 渲染", () => {
|
|
|
161
169
|
makeGuideKind("d", 40),
|
|
162
170
|
makeGuideKind("e", 50),
|
|
163
171
|
])
|
|
172
|
+
try {
|
|
173
|
+
render(<GuidePage />)
|
|
174
|
+
expect(screen.getByText("a desc")).toBeTruthy()
|
|
175
|
+
expect(screen.getByText("b desc")).toBeTruthy()
|
|
176
|
+
expect(screen.getByText("c desc")).toBeTruthy()
|
|
177
|
+
expect(screen.getByText("d desc")).toBeTruthy()
|
|
178
|
+
expect(screen.getByText("e desc")).toBeTruthy()
|
|
179
|
+
} finally {
|
|
180
|
+
dispose()
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it(">5 卡隐描述:描述行不渲染(保持轻量)", () => {
|
|
185
|
+
const dispose = registerAll([
|
|
186
|
+
makeGuideKind("a", 10),
|
|
187
|
+
makeGuideKind("b", 20),
|
|
188
|
+
makeGuideKind("c", 30),
|
|
189
|
+
makeGuideKind("d", 40),
|
|
190
|
+
makeGuideKind("e", 50),
|
|
191
|
+
makeGuideKind("f", 60),
|
|
192
|
+
])
|
|
164
193
|
try {
|
|
165
194
|
render(<GuidePage />)
|
|
166
195
|
expect(screen.queryByText("a desc")).toBeNull()
|
|
167
|
-
expect(screen.queryByText("
|
|
196
|
+
expect(screen.queryByText("f desc")).toBeNull()
|
|
168
197
|
// 标题仍在
|
|
169
198
|
expect(screen.getByText("a title")).toBeTruthy()
|
|
170
199
|
} finally {
|
|
@@ -172,6 +201,18 @@ describe("GuidePage 渲染", () => {
|
|
|
172
201
|
}
|
|
173
202
|
})
|
|
174
203
|
|
|
204
|
+
it("Guide 滚动根可滚动", () => {
|
|
205
|
+
const dispose = registerAll([makeGuideKind("files", 10)])
|
|
206
|
+
try {
|
|
207
|
+
render(<GuidePage />)
|
|
208
|
+
const root = screen.getByTestId("dock-guide-page")
|
|
209
|
+
expect(root.className).toContain("h-full")
|
|
210
|
+
expect(root.className).toContain("overflow-y-auto")
|
|
211
|
+
} finally {
|
|
212
|
+
dispose()
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
175
216
|
it("availability disabled 卡:置灰不可点 + tooltip「当前部署形态不支持」", async () => {
|
|
176
217
|
const openSpy = vi.spyOn(dockRegistry, "openKind")
|
|
177
218
|
const dispose = registerAll([
|