@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
|
@@ -33,6 +33,10 @@ import { Button } from '@/components/ui/button'
|
|
|
33
33
|
import { toast } from '@/components/ui/toast'
|
|
34
34
|
import { useSession } from '@/lib/auth/auth-client'
|
|
35
35
|
import { m } from '@/paraglide/messages.js'
|
|
36
|
+
import { toastError } from '@/lib/toast-error'
|
|
37
|
+
import { getQueryClient } from '@/lib/query-client-seam'
|
|
38
|
+
import { updateConversationFn } from '@/server/serverFns/chat/conversations'
|
|
39
|
+
import { HARNESS_WORKSPACES_QUERY_KEY } from '@/lib/queries/harness'
|
|
36
40
|
import { useSelectedModel } from '@/lib/ai/use-selected-model'
|
|
37
41
|
import { WorkbenchShell } from '@/components/harness/workbench/workbench-shell'
|
|
38
42
|
import { useTrackColumns } from '@/components/harness/workbench/use-track-columns'
|
|
@@ -54,15 +58,23 @@ import { WorkbenchChatConnection, useWorkbenchLiveStatus } from './workbench-con
|
|
|
54
58
|
import { isAiAuthError } from '@/components/harness/shared/ai-auth-error'
|
|
55
59
|
import {
|
|
56
60
|
clearHarnessForkTurnHandler,
|
|
61
|
+
getHarnessRevert,
|
|
57
62
|
registerHarnessForkTurnHandler,
|
|
58
63
|
} from '@/components/harness/shared/harness-chat-slots'
|
|
59
64
|
import { openPlanResource } from '@/components/harness/extension-panel/dock/plan-resource'
|
|
65
|
+
import { resolveUndoLastTurnTarget } from './undo-last-turn'
|
|
66
|
+
import { isHarnessClientEnabled } from '@/lib/harness-gate'
|
|
67
|
+
import { setSandboxPolicy } from '@/components/harness/conversation-panel/composer/permission/permission-policy'
|
|
60
68
|
|
|
61
69
|
export type { HarnessInitialConversation, AttachmentRef } from './workbench-context'
|
|
62
70
|
|
|
63
71
|
function WorkbenchCenter() {
|
|
64
72
|
const body = useWorkbenchBody()
|
|
65
73
|
const chat = useWorkbenchChat()
|
|
74
|
+
// 工作区切换的聚合投影失效(任务 5):经 query-client-seam 单例(router.tsx 装配
|
|
75
|
+
// 的同一 client)——本层无 QueryClientProvider 约束(auth-error 等测试裸渲染
|
|
76
|
+
// WorkbenchCenter),context 形式的 useQueryClient 会抛 No QueryClient set
|
|
77
|
+
const queryClient = getQueryClient()
|
|
66
78
|
const { data: session } = useSession()
|
|
67
79
|
const hasAiKey = session?.user?.hasAiKey
|
|
68
80
|
// 官方 Model Selector pill(base/model-selector):模块级单例模型选择
|
|
@@ -126,6 +138,86 @@ function WorkbenchCenter() {
|
|
|
126
138
|
const chatMessagesRef = useRef(chat.messages)
|
|
127
139
|
chatMessagesRef.current = chat.messages
|
|
128
140
|
|
|
141
|
+
// /undo(P1 任务 2):撤销最后一回合——client 命令接 checkpoint revert。执行通路
|
|
142
|
+
// 与门控都在本层接(props 注入纪律:composer 不读 view store)。目标解析与门控
|
|
143
|
+
// 收敛在纯函数 resolveUndoLastTurnTarget(./undo-last-turn,真值表单测锁定):
|
|
144
|
+
// - revert 通道 = getHarnessRevert()(HarnessSessionAppChat mount 注册的 view.revert
|
|
145
|
+
// slot;harness 链专属,legacy 链 null → 门控禁用 → 命令不出现。render 期读取
|
|
146
|
+
// 不响应式,但 slot 注册先于任何消息到达(mount effect)且消息到达必触发重渲染,
|
|
147
|
+
// 用户可开菜单前门控已取到真值);
|
|
148
|
+
// - revert 语义(ai-harness 0.3.0 session/state.js 已核实)=「保留目标消息、隐藏
|
|
149
|
+
// 其后内容」("Go back to the message messageId",commitRevert 落盘
|
|
150
|
+
// slice(0, at+1))——目标 = 最后一条 user 消息的前一条真实消息 = 隐藏最后一轮
|
|
151
|
+
// user+回复(撤销最后一回合、不续跑);
|
|
152
|
+
// - 桌面去重(审查发现 2):桌面链挂 snapshots 官方 server 命令 `undo`(文件级
|
|
153
|
+
// 恢复 + transcript 清理,比 client 通路完整)——commands 含 name==='undo' 时
|
|
154
|
+
// client undo 让位(门控禁用,防 '/' 菜单同屏双 undo 条目);云端链无 snapshots
|
|
155
|
+
// 插件,client undo 有价值。
|
|
156
|
+
const undoTargetId = resolveUndoLastTurnTarget(chat.messages, {
|
|
157
|
+
revertAvailable: getHarnessRevert() != null,
|
|
158
|
+
hasServerUndo: (chat.commands ?? []).some((cmd) => cmd.name === 'undo'),
|
|
159
|
+
isRunning: chat.isLoading,
|
|
160
|
+
})
|
|
161
|
+
const canRevertLastTurn = undoTargetId != null
|
|
162
|
+
// 调用时点重算目标与门控(undoGateRef 保新值——菜单开着期间消息/命令/运行态可能
|
|
163
|
+
// 已变,回调身份稳定);revert 是异步操作(服务端往返),错误经 view 'error' 事件
|
|
164
|
+
// 回流(adapter 已订阅 → chat.error → 重试条),此处仅兜底 console.error 防
|
|
165
|
+
// unhandled rejection。
|
|
166
|
+
const undoGateRef = useRef({
|
|
167
|
+
messages: chat.messages,
|
|
168
|
+
commands: chat.commands,
|
|
169
|
+
isRunning: chat.isLoading,
|
|
170
|
+
})
|
|
171
|
+
undoGateRef.current = {
|
|
172
|
+
messages: chat.messages,
|
|
173
|
+
commands: chat.commands,
|
|
174
|
+
isRunning: chat.isLoading,
|
|
175
|
+
}
|
|
176
|
+
const onRevertLastTurn = useCallback(() => {
|
|
177
|
+
const revert = getHarnessRevert()
|
|
178
|
+
if (!revert) return
|
|
179
|
+
const gate = undoGateRef.current
|
|
180
|
+
const targetId = resolveUndoLastTurnTarget(gate.messages, {
|
|
181
|
+
revertAvailable: true,
|
|
182
|
+
hasServerUndo: (gate.commands ?? []).some((cmd) => cmd.name === 'undo'),
|
|
183
|
+
isRunning: gate.isRunning,
|
|
184
|
+
})
|
|
185
|
+
if (!targetId) return
|
|
186
|
+
void revert(targetId).catch((error: unknown) => {
|
|
187
|
+
console.error('[harness-workbench] /undo revert 失败:', error)
|
|
188
|
+
})
|
|
189
|
+
}, [])
|
|
190
|
+
|
|
191
|
+
// /plan(P2 任务 2,切档型 claim 全链):Enter 结算 = 切 readonly/plan 档 + 发送任务文本。
|
|
192
|
+
// plan 档 = readonly 映射(sandboxPolicyToPermissionMode readonly→'plan'),切档复用
|
|
193
|
+
// setSandboxPolicy(permission-policy 封装,readonly 档无需 confirmFull;serverFn 内含
|
|
194
|
+
// syncHarnessPermissionMode 同步施加 + trustedAcceptInput 每回合对账双保险)。审查重点 3:
|
|
195
|
+
// 必须 await 切档成功后再发送——切档失败 fail-closed(不发送、草稿保留 chip),rethrow 由
|
|
196
|
+
// composer claim 结算层 toast + console.error。
|
|
197
|
+
// 门控 canPlan = harness 链 && !isRunning(运行中切档会与本回合竞态)。空态可用
|
|
198
|
+
// (用户裁决 2026-11-20 对齐 DSH:blank 会话 /plan 无可用性门)——无 threadId 时
|
|
199
|
+
// 走 pending 档随建线落库。
|
|
200
|
+
const canPlan = isHarnessClientEnabled() && !chat.isLoading
|
|
201
|
+
const planGateRef = useRef({ threadId: body.activeConversationId, canSend: !chat.isLoading })
|
|
202
|
+
planGateRef.current = { threadId: body.activeConversationId, canSend: !chat.isLoading }
|
|
203
|
+
const onPlanSubmit = useCallback(
|
|
204
|
+
async (args: string) => {
|
|
205
|
+
const { threadId, canSend } = planGateRef.current
|
|
206
|
+
if (!canSend) return
|
|
207
|
+
if (threadId) {
|
|
208
|
+
// 有线程:切档 serverFn 直改(内含 syncHarnessPermissionMode 同步施加)
|
|
209
|
+
await setSandboxPolicy({ threadId, level: 'readonly' })
|
|
210
|
+
} else {
|
|
211
|
+
// 空态:记 pending 档,建线(handleSend 空态分支)随 createConversationFn
|
|
212
|
+
// 落库 sandboxPolicy='readonly'——首回合前 trustedAcceptInput 对账自动施加
|
|
213
|
+
// (对齐 DSH blank 会话播种语义)。
|
|
214
|
+
body.setPendingSandboxPolicy('readonly')
|
|
215
|
+
}
|
|
216
|
+
await body.handleSend(args)
|
|
217
|
+
},
|
|
218
|
+
[body.handleSend],
|
|
219
|
+
)
|
|
220
|
+
|
|
129
221
|
// 「Fork 此轮」slot(P2-3d):HarnessMessage 经模块级 slot 拿 fork 通道(无 workbench
|
|
130
222
|
// body 访问权)。同 ref 模式:注册一次、闭包读 ref 保新值;无活动会话 no-op。
|
|
131
223
|
const forkSlotRef = useRef({ handleFork: body.handleFork, threadId: body.activeConversationId })
|
|
@@ -160,18 +252,56 @@ function WorkbenchCenter() {
|
|
|
160
252
|
|
|
161
253
|
// F5-4 runCommand 通路:'/' 菜单 server 命令 → harness client.runCommand。错误面
|
|
162
254
|
// 在接线层 toast(禁 alert);结果经 harness.command.result 事件回流(现有管道)。
|
|
255
|
+
// E2 claim(P2 任务 1):input 型 server 命令 claim.submit(args) 结算经此透传 args——
|
|
256
|
+
// args 为 chip 之后的参数文本,下游 adapter/session 传给 client.runCommand 的 input。
|
|
163
257
|
// 旧链(chat.runCommand undefined)兜底 resolve——旧链 commands 亦为 undefined,
|
|
164
258
|
// 菜单不会产出 server 项,此分支仅防御。
|
|
165
259
|
const onRunCommand = useCallback(
|
|
166
|
-
(name: string) => {
|
|
260
|
+
(name: string, args?: string) => {
|
|
167
261
|
if (!chat.runCommand) return Promise.resolve()
|
|
168
|
-
return chat.runCommand(name).catch(() => {
|
|
262
|
+
return chat.runCommand(name, args).catch(() => {
|
|
169
263
|
toast.error(m.harness_command_runFailed())
|
|
170
264
|
})
|
|
171
265
|
},
|
|
172
266
|
[chat.runCommand],
|
|
173
267
|
)
|
|
174
268
|
|
|
269
|
+
// 工作区选择按钮(任务 5):onSwitchWorkspace / onSelectLocalCwd 组装——写 serverFn
|
|
270
|
+
// + 本地 conversations/state 同步 + 左面板聚合投影 invalidate。threadId 经
|
|
271
|
+
// activeIdRef 读调用时点真值(回调身份稳定,switchThread 期间无 stale id)。
|
|
272
|
+
const onSwitchWorkspace = useCallback(
|
|
273
|
+
(workspaceId: string) => {
|
|
274
|
+
const id = body.activeIdRef.current
|
|
275
|
+
if (!id) return
|
|
276
|
+
void updateConversationFn({ data: { id, workspaceId } })
|
|
277
|
+
.then(() => {
|
|
278
|
+
// 本地 conversations 同步(body 既有动作——body.setConversations 即
|
|
279
|
+
// Provider 的 useState setter,可写投影);失败 toast 由 catch 兜底
|
|
280
|
+
body.setConversations((prev) =>
|
|
281
|
+
prev.map((c) => (c.id === id ? { ...c, workspaceId } : c)),
|
|
282
|
+
)
|
|
283
|
+
// 左面板聚合投影同步(分组即时反映,handleArchive 等同款)
|
|
284
|
+
void queryClient.invalidateQueries({ queryKey: HARNESS_WORKSPACES_QUERY_KEY })
|
|
285
|
+
})
|
|
286
|
+
.catch((e) => toastError(e, m.common_operationFailed()))
|
|
287
|
+
},
|
|
288
|
+
[body.activeIdRef, body.setConversations, queryClient],
|
|
289
|
+
)
|
|
290
|
+
const onSelectLocalCwd = useCallback(
|
|
291
|
+
(path: string) => {
|
|
292
|
+
// 客户端即时回显;落库走空线程守卫的 updateConversationFn(已有消息被按钮
|
|
293
|
+
// disabled 挡在入口,服务端守卫兜底)。空态(无 threadId)仅记客户端态——
|
|
294
|
+
// 建线时经 forwardedProps.cwd 随 createConversationFn 落库。
|
|
295
|
+
body.setLocalCwd(path)
|
|
296
|
+
const id = body.activeIdRef.current
|
|
297
|
+
if (!id) return
|
|
298
|
+
void updateConversationFn({ data: { id, localCwd: path } }).catch((e) =>
|
|
299
|
+
toastError(e, m.common_operationFailed()),
|
|
300
|
+
)
|
|
301
|
+
},
|
|
302
|
+
[body.activeIdRef, body.setLocalCwd],
|
|
303
|
+
)
|
|
304
|
+
|
|
175
305
|
const centerContent = (
|
|
176
306
|
// 会话区域根:Esc Esc 停止序列监听在此元素冒泡阶段(ref 传给 HarnessComposer)
|
|
177
307
|
<div ref={conversationRegionRef} className="flex h-full flex-col">
|
|
@@ -331,6 +461,15 @@ function WorkbenchCenter() {
|
|
|
331
461
|
models={body.availableModels}
|
|
332
462
|
model={selectedModel}
|
|
333
463
|
onModelChange={setSelectedModel}
|
|
464
|
+
// 模型+思考强度合并面板接线(P2 任务 3):分组目录(body 任务 1 派生)+
|
|
465
|
+
// 线程设置回显/写通道/会话用量(chat 任务 1 WorkbenchChat 三字段)——
|
|
466
|
+
// 后三者仅 harness 链有值(旧链 undefined,composer 降级只选模型);
|
|
467
|
+
// sessionUsage 本任务仅透传(composer 接口位,dock 行消费在任务 6)。
|
|
468
|
+
providerModelGroups={body.providerModelGroups}
|
|
469
|
+
acpAgents={body.localAgents}
|
|
470
|
+
threadSettings={chat.threadSettings}
|
|
471
|
+
onThreadSettingsChange={chat.updateThreadSettings}
|
|
472
|
+
sessionUsage={chat.sessionUsage}
|
|
334
473
|
conversationRegionRef={conversationRegionRef}
|
|
335
474
|
messages={chat.messages}
|
|
336
475
|
scrollContainerRef={scrollRef}
|
|
@@ -340,6 +479,22 @@ function WorkbenchCenter() {
|
|
|
340
479
|
localCwd={body.localCwd}
|
|
341
480
|
commands={chat.commands}
|
|
342
481
|
onRunCommand={onRunCommand}
|
|
482
|
+
// /plan(P2 任务 2 真机补线):canPlan/onPlanSubmit 此前只计算未透传(:190/:193
|
|
483
|
+
// 计算点与 JSX 断裂——单测直接喂 HarnessComposer props 掩盖了接线缺失,真机
|
|
484
|
+
// /plan 菜单项恒隐藏),补上透传,接法与 canRevertLastTurn 同款。
|
|
485
|
+
canPlan={canPlan}
|
|
486
|
+
onPlanSubmit={onPlanSubmit}
|
|
487
|
+
// /permission 空态选档(用户裁决 2026-11-20 对齐 DSH):空态 popup 选档
|
|
488
|
+
// 上报 pending 槽(setPendingSandboxPolicy),建线时随 createConversationFn
|
|
489
|
+
// 落库;有线程时 popup 走 setSandboxPolicy 不经此回调。
|
|
490
|
+
onPendingPolicyLevel={body.setPendingSandboxPolicy}
|
|
491
|
+
// 工作区选择按钮(任务 5):当前挂靠投影(body.activeConversation =
|
|
492
|
+
// conversations.find)+ 云端切换 / 本地目录 / 左面板展开三条通路组装
|
|
493
|
+
//(见上方 onSwitchWorkspace / onSelectLocalCwd)。
|
|
494
|
+
threadWorkspaceId={body.activeConversation?.workspaceId ?? null}
|
|
495
|
+
onSwitchWorkspace={onSwitchWorkspace}
|
|
496
|
+
onSelectLocalCwd={onSelectLocalCwd}
|
|
497
|
+
onOpenWorkspacePanel={() => sidebarTrack.setManualCollapse(false)}
|
|
343
498
|
onContinueWithoutMessage={chat.continueWithoutMessage}
|
|
344
499
|
// B8(F5-6 批 3):continue 态语义归属裁决——消息流 retry-countdown-bar
|
|
345
500
|
// 是自动重试(同 payload 重发),主按钮 continue 是 retry 条被用户取消后
|
|
@@ -351,6 +506,13 @@ function WorkbenchCenter() {
|
|
|
351
506
|
!chat.isLoading && !!chat.error && body.retryDismissed && !authError
|
|
352
507
|
}
|
|
353
508
|
queuedTurns={chat.queuedTurns}
|
|
509
|
+
// /undo(P1 任务 2):撤销最后一回合——client 命令接 checkpoint revert。
|
|
510
|
+
// canRevertLastTurn=false(legacy 链 slot 缺席 / 无可达目标:末位 user 即
|
|
511
|
+
// 首条或无 user / 桌面链 server undo 让位 / 运行中)时 undoEnabled=false
|
|
512
|
+
// 把 /undo 挡在 '/' 与 `+` 菜单外(fail-closed);命令集形状(ctx.undo
|
|
513
|
+
// 注入)与门控(undoEnabled 旗标)的分界见 extension/command-menu.ts。
|
|
514
|
+
onRevertLastTurn={onRevertLastTurn}
|
|
515
|
+
canRevertLastTurn={canRevertLastTurn}
|
|
354
516
|
/>
|
|
355
517
|
<ConnectionIndicator
|
|
356
518
|
status={
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// 模型分组派生纯函数(P2 composer 控制,任务 1):listAiProvidersFn 返回元素投影
|
|
6
|
+
// → 分组模型目录(ProviderModelGroup)。模型面板分组展示与 dock 行用量分母查表
|
|
7
|
+
// (findModelEntry)的数据面,无 UI、无副作用。
|
|
8
|
+
//
|
|
9
|
+
// 过滤口径与 workbench-context.tsx 的 availableModels 逐字一致:
|
|
10
|
+
// enabled && (hasKey || isLocal);cfgModels.length > 0 ? cfgModels : presetIds。
|
|
11
|
+
//
|
|
12
|
+
// writeKey 语义(harness 写入键):种子 preset(meta.models)内的模型 id →
|
|
13
|
+
// `${providerId}/${id}` 别名,用户自定义 id → 裸 id(服务端目录按裸 id 解析)。
|
|
14
|
+
// 判定只看 meta.models(种子 preset),不看用户勾选列表。
|
|
15
|
+
|
|
16
|
+
import type { AiProviderMeta } from '@allbluecn/kernel'
|
|
17
|
+
|
|
18
|
+
/** 分组内的单模型条目。 */
|
|
19
|
+
export interface ProviderModelEntry {
|
|
20
|
+
/** 裸模型 id(单例/旧链/显示域) */
|
|
21
|
+
id: string
|
|
22
|
+
displayName?: string
|
|
23
|
+
/** 模型级图标 slug(种子 preset 透传;触发钮/行图标回显与列表同源) */
|
|
24
|
+
iconSlug?: string
|
|
25
|
+
contextWindow?: number
|
|
26
|
+
capabilities?: ReadonlyArray<string>
|
|
27
|
+
/** 该 provider 的适配器是否消费 reasoning 参数(R5-A 诚实白名单,按 adapterKind 判定) */
|
|
28
|
+
reasoningSupported: boolean
|
|
29
|
+
/** harness 写入键:preset 内 = `${providerId}/${id}`,否则裸 id */
|
|
30
|
+
writeKey: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 模型条目 + 所属分组(触发钮图标回显需要 provider 域:iconSlug/brandColor)。 */
|
|
34
|
+
export interface ProviderModelRow {
|
|
35
|
+
group: ProviderModelGroup
|
|
36
|
+
entry: ProviderModelEntry
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** 分组 = 一个可用 provider 的模型目录(顺序 = 输入顺序)。 */
|
|
40
|
+
export interface ProviderModelGroup {
|
|
41
|
+
providerId: string
|
|
42
|
+
displayName: string
|
|
43
|
+
iconSlug?: string
|
|
44
|
+
brandColor?: string
|
|
45
|
+
isLocal?: boolean
|
|
46
|
+
models: ReadonlyArray<ProviderModelEntry>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** R5-A 诚实白名单:仅这三 kind 的适配器消费 reasoning 参数(复审 P0-2) */
|
|
50
|
+
export const REASONING_ADAPTER_KINDS: ReadonlySet<string> = new Set(['openai', 'anthropic', 'openrouter'])
|
|
51
|
+
|
|
52
|
+
/** 输入 = listAiProvidersFn 返回元素投影(workbench-context 现有 ai-providers 查询形状) */
|
|
53
|
+
export function buildProviderModelGroups(
|
|
54
|
+
providers: ReadonlyArray<{
|
|
55
|
+
meta: Pick<AiProviderMeta, 'providerId' | 'displayName' | 'iconSlug' | 'brandColor' | 'isLocal' | 'adapterKind' | 'models'>
|
|
56
|
+
config: { enabled: boolean; hasKey?: boolean | null; models?: string[] | null }
|
|
57
|
+
}>,
|
|
58
|
+
): ProviderModelGroup[] {
|
|
59
|
+
const groups: ProviderModelGroup[] = []
|
|
60
|
+
for (const p of providers) {
|
|
61
|
+
// 过滤口径与 workbench-context availableModels 逐字一致
|
|
62
|
+
if (!p.config.enabled || (!p.config.hasKey && !p.meta.isLocal)) continue
|
|
63
|
+
const cfgModels = p.config.models ?? []
|
|
64
|
+
const preset = Array.isArray(p.meta.models)
|
|
65
|
+
? p.meta.models.map((x) => (typeof x === 'string' ? x : x.id))
|
|
66
|
+
: []
|
|
67
|
+
// 种子 preset 元数据表(writeKey 别名判定 + displayName/contextWindow/capabilities 透传)
|
|
68
|
+
const presetIds = new Set<string>(preset)
|
|
69
|
+
const presetById = new Map<string, AiProviderMeta['models'][number]>()
|
|
70
|
+
if (Array.isArray(p.meta.models)) {
|
|
71
|
+
for (const x of p.meta.models) {
|
|
72
|
+
if (x && typeof x === 'object' && typeof x.id === 'string') presetById.set(x.id, x)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// 与设置页口径一致:用户勾选列表为空则回退平台预置
|
|
76
|
+
const all = cfgModels.length > 0 ? cfgModels : preset
|
|
77
|
+
const reasoningSupported = REASONING_ADAPTER_KINDS.has(p.meta.adapterKind)
|
|
78
|
+
const byId = new Map<string, ProviderModelEntry>()
|
|
79
|
+
for (const id of all) {
|
|
80
|
+
if (typeof id !== 'string' || byId.has(id)) continue
|
|
81
|
+
const presetMeta = presetById.get(id)
|
|
82
|
+
byId.set(id, {
|
|
83
|
+
id,
|
|
84
|
+
displayName: presetMeta?.displayName,
|
|
85
|
+
iconSlug: presetMeta?.iconSlug,
|
|
86
|
+
contextWindow: presetMeta?.contextWindow,
|
|
87
|
+
capabilities: presetMeta?.capabilities,
|
|
88
|
+
reasoningSupported,
|
|
89
|
+
writeKey: presetIds.has(id) ? `${p.meta.providerId}/${id}` : id,
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
groups.push({
|
|
93
|
+
providerId: p.meta.providerId,
|
|
94
|
+
displayName: p.meta.displayName,
|
|
95
|
+
iconSlug: p.meta.iconSlug,
|
|
96
|
+
brandColor: p.meta.brandColor,
|
|
97
|
+
isLocal: p.meta.isLocal,
|
|
98
|
+
models: [...byId.values()],
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
return groups
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** dock 行分母查表:当前模型(裸 id 或别名形)→ contextWindow;未命中 undefined(消费方回落 200k) */
|
|
105
|
+
export function findModelEntry(
|
|
106
|
+
groups: ReadonlyArray<ProviderModelGroup>,
|
|
107
|
+
model: string | undefined,
|
|
108
|
+
): ProviderModelEntry | undefined {
|
|
109
|
+
return findModelRow(groups, model)?.entry
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** 触发钮图标回显(2026-11-21 打磨):条目 + 所属分组一起取——ModelBrandIcon 需要
|
|
113
|
+
* providerId(LOBE_ICON_MAP 键)与条目 iconSlug 才能与列表行图标逐像素同源。 */
|
|
114
|
+
export function findModelRow(
|
|
115
|
+
groups: ReadonlyArray<ProviderModelGroup>,
|
|
116
|
+
model: string | undefined,
|
|
117
|
+
): ProviderModelRow | undefined {
|
|
118
|
+
if (!model) return undefined
|
|
119
|
+
for (const group of groups) {
|
|
120
|
+
for (const entry of group.models) {
|
|
121
|
+
if (entry.id === model || entry.writeKey === model) return { group, entry }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return undefined
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Context 计量窗口缺省值:无模型上下文窗口元数据,取主流 200k(原 harness-composer 私有常量,随 contextWindowOf 收编单点)。 */
|
|
128
|
+
export const HARNESS_DEFAULT_CONTEXT_WINDOW = 200_000
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* dock 行分母(任务 6):命中模型条目用其 contextWindow,未命中(无目录/无模型/
|
|
132
|
+
* 无元数据)回落 HARNESS_DEFAULT_CONTEXT_WINDOW。composer dock 行
|
|
133
|
+
* `maxTokens={contextWindowOf(providerModelGroups ?? [], currentModel)}` 单点消费。
|
|
134
|
+
*/
|
|
135
|
+
export function contextWindowOf(
|
|
136
|
+
groups: ReadonlyArray<ProviderModelGroup>,
|
|
137
|
+
model: string | undefined,
|
|
138
|
+
): number {
|
|
139
|
+
return findModelEntry(groups, model)?.contextWindow ?? HARNESS_DEFAULT_CONTEXT_WINDOW
|
|
140
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// This program is free software: you can redistribute it and/or modify
|
|
6
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
// (at your option) any later version.
|
|
9
|
+
//
|
|
10
|
+
// This program is distributed in the hope that it will be useful,
|
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
// GNU Affero General Public License for more details.
|
|
14
|
+
//
|
|
15
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* /undo「撤销最后一回合」的目标解析与门控(P1 任务 2,纯函数——真值表单测锁定,
|
|
20
|
+
* 见 harness/__tests__/undo-last-turn.test.ts;workbench-page 消费,composer 只收
|
|
21
|
+
* props——props 注入纪律)。
|
|
22
|
+
*
|
|
23
|
+
* **revert 语义(ai-harness 0.3.0 session/state.js 已核实,审查发现 1)**:
|
|
24
|
+
* `revert({ messageId })` = "Go back to the message messageId"——**保留目标消息、
|
|
25
|
+
* 隐藏其后内容**(commitRevert 落盘 `messages.slice(0, at + 1)`;目标 id 不在
|
|
26
|
+
* transcript 时服务端拒绝 `'unknown_message'`)。因此「撤销最后一回合」的目标
|
|
27
|
+
* **不是**最后一条 assistant 消息——回合完成后 transcript 尾=最后一条 assistant,
|
|
28
|
+
* revert 它隐藏 0 条 = no-op——而是**最后一条 user 消息的前一条消息**:revert 它
|
|
29
|
+
* = 保留其前文、隐藏最后一轮 user+回复 = 删掉最后一轮 QA(不续跑,与消息流 Retry
|
|
30
|
+
* 的 revert+continue 组合零重叠)。
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** 门控入参(任一不满足 → 返回 null,命令禁用)。 */
|
|
34
|
+
export interface UndoLastTurnGates {
|
|
35
|
+
/** harness 链 revert slot 在(getHarnessRevert() != null;legacy 链恒 false) */
|
|
36
|
+
revertAvailable: boolean
|
|
37
|
+
/**
|
|
38
|
+
* server 命令里已有名为 `undo` 的命令(桌面链挂 snapshots 官方命令——first-party/
|
|
39
|
+
* coding/snapshots.js `commands: { undo: defineCommand(...) }`,经 define.server.ts
|
|
40
|
+
* 的 `cloud === undefined` 分支挂载;文件级恢复 + transcript 清理,比 client 通路
|
|
41
|
+
* 完整)→ client「撤销上一回合」让位,防 '/' 菜单同屏双 undo 条目(审查发现 2)。
|
|
42
|
+
* 云端链无 snapshots 插件 → client undo 有价值。
|
|
43
|
+
*/
|
|
44
|
+
hasServerUndo: boolean
|
|
45
|
+
/** 运行中(chat.isLoading;撤销与 agent 竞态——裁决 isRunning 时隐藏) */
|
|
46
|
+
isRunning: boolean
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 解析 /undo 的 revert 目标消息 id;null = 不可撤销(门控不通过或无可达目标),
|
|
51
|
+
* workbench-page 据此置 canRevertLastTurn=false(/undo 不进 '/' 与 `+` 菜单)。
|
|
52
|
+
*
|
|
53
|
+
* 目标选择:`start = 最后一条 role==='user'` 的下标——
|
|
54
|
+
* - `start <= 0`(无 user 消息,或末位 user 就是 transcript 首条)→ 无前驱目标,
|
|
55
|
+
* null(首回合不可撤销:revert 需要一个真实存在的前驱消息);
|
|
56
|
+
* - 否则从 `start - 1` 向前取最近一条真实消息:**跳过 notice**(notice id 是合成
|
|
57
|
+
* id `notice-N`,view/reduce.js 生成、不在 transcript,revert 到它会被
|
|
58
|
+
* unknown_message 拒绝——审查发现 1 的连带排除)。
|
|
59
|
+
*/
|
|
60
|
+
export function resolveUndoLastTurnTarget(
|
|
61
|
+
messages: ReadonlyArray<{ id: string; role: string }>,
|
|
62
|
+
gates: UndoLastTurnGates,
|
|
63
|
+
): string | null {
|
|
64
|
+
if (!gates.revertAvailable || gates.hasServerUndo || gates.isRunning) return null
|
|
65
|
+
let start = -1
|
|
66
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
67
|
+
if (messages[i]?.role === "user") {
|
|
68
|
+
start = i
|
|
69
|
+
break
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// 无 user 消息(start=-1)或末位 user 即首条(start=0)→ 无可达前驱
|
|
73
|
+
if (start <= 0) return null
|
|
74
|
+
for (let i = start - 1; i >= 0; i--) {
|
|
75
|
+
const candidate = messages[i]
|
|
76
|
+
if (candidate && !candidate.id.startsWith("notice-")) return candidate.id
|
|
77
|
+
}
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
@@ -73,6 +73,7 @@ import { listAiProvidersFn } from '@/server/serverFns/design/ai/providers'
|
|
|
73
73
|
import { localAgentsQueryOptions } from '@/lib/queries/local-agents'
|
|
74
74
|
import { useWorkspace } from '@/components/harness/extension-panel/panels/code/workspace-context'
|
|
75
75
|
import { resolveMountEffectPath } from '@/components/harness/workbench/harness-workbench-mount'
|
|
76
|
+
import { buildProviderModelGroups, type ProviderModelGroup } from '@/components/harness/workbench/provider-model-groups'
|
|
76
77
|
import {
|
|
77
78
|
consumeHandoffContext,
|
|
78
79
|
consumePendingWorkspaceMessage,
|
|
@@ -129,10 +130,11 @@ export interface WorkbenchChat {
|
|
|
129
130
|
*/
|
|
130
131
|
commands?: ReadonlyArray<{ name: string; description: string }>
|
|
131
132
|
/**
|
|
132
|
-
* 服务端命令执行(F5-4 runCommand 通路):harness client.runCommand({ name })
|
|
133
|
-
*
|
|
133
|
+
* 服务端命令执行(F5-4 runCommand 通路):harness client.runCommand({ name, input })
|
|
134
|
+
* 透传。input 为 claim 结算参数(E2,P2 任务 1:input 型 server 命令 claim.submit(args)
|
|
135
|
+
* 经此透传,缺省 undefined)。仅 harness 路径有值;旧链 undefined → onRunCommand 兜底 resolve。
|
|
134
136
|
*/
|
|
135
|
-
runCommand?: (name: string) => Promise<unknown>
|
|
137
|
+
runCommand?: (name: string, input?: unknown) => Promise<unknown>
|
|
136
138
|
/**
|
|
137
139
|
* 继续生成(A5/B8,F5-6 批 2):view.continueWithoutMessage——无新消息、从已存
|
|
138
140
|
* transcript 续跑一回合。steerQueue 快捷键(空草稿+Cmd/Ctrl+Enter)与主按钮
|
|
@@ -144,6 +146,25 @@ export interface WorkbenchChat {
|
|
|
144
146
|
* 队列驱动的判定源。仅 harness 路径有值;旧链 undefined → composer 按 0 处理。
|
|
145
147
|
*/
|
|
146
148
|
queuedTurns?: number
|
|
149
|
+
/**
|
|
150
|
+
* 线程持久化设置切片(P2 composer 控制,任务 1):view state 顶层 settings
|
|
151
|
+
* (ThreadSettings:model/reasoning/instructions/...)。仅 harness 路径有值
|
|
152
|
+
* (adapter 透传);旧链 undefined → composer 显示回落值。
|
|
153
|
+
*/
|
|
154
|
+
threadSettings?: import('@tanstack/ai-harness').ThreadSettings
|
|
155
|
+
/**
|
|
156
|
+
* 线程设置写入(P2 composer 控制,任务 1):view.updateThreadSettings(configure
|
|
157
|
+
* op,服务端 expose.settings 白名单逐 key 校验)透传。仅 harness 路径有值;旧链
|
|
158
|
+
* undefined。Receipt 收窄为 unknown 防包类型穿透。
|
|
159
|
+
*/
|
|
160
|
+
updateThreadSettings?: (
|
|
161
|
+
settings: import('@tanstack/ai-harness').ThreadSettingsChange,
|
|
162
|
+
) => Promise<unknown> | undefined
|
|
163
|
+
/**
|
|
164
|
+
* 会话用量四桶(P2-3d,SessionUsage):运行时 adapter 已返回、类型此前未声明——
|
|
165
|
+
* 本次补上。仅 harness 路径有值;旧链 undefined(用量 pill 不渲染)。
|
|
166
|
+
*/
|
|
167
|
+
sessionUsage?: import('@tanstack/ai-harness').SessionUsage
|
|
147
168
|
}
|
|
148
169
|
|
|
149
170
|
export interface HarnessInitialConversation {
|
|
@@ -205,6 +226,8 @@ export interface WorkbenchBodyContextValue extends WorkbenchProps {
|
|
|
205
226
|
// 引擎 / 工作区
|
|
206
227
|
engine: 'cloud' | 'local'
|
|
207
228
|
localCwd: string | null
|
|
229
|
+
/** 本地授权目录写通道(任务 5 工作区选择按钮:page 组装 onSelectLocalCwd 消费) */
|
|
230
|
+
setLocalCwd: (cwd: string | null) => void
|
|
208
231
|
localAgentId: string | null
|
|
209
232
|
setLocalAgentId: (id: string | null) => void
|
|
210
233
|
localAgents: LocalAgentOption[]
|
|
@@ -212,6 +235,8 @@ export interface WorkbenchBodyContextValue extends WorkbenchProps {
|
|
|
212
235
|
selectedModel: string
|
|
213
236
|
effectiveModel: string | undefined
|
|
214
237
|
availableModels: string[]
|
|
238
|
+
/** 模型分组派生(R5-A,P2 composer 控制):模型面板分组展示 + 用量分母查表(findModelEntry)数据源。 */
|
|
239
|
+
providerModelGroups: ProviderModelGroup[]
|
|
215
240
|
adapterKind: string | undefined
|
|
216
241
|
webSearchEnabled: boolean
|
|
217
242
|
setWebSearchEnabled: (v: boolean) => void
|
|
@@ -256,6 +281,13 @@ export interface WorkbenchBodyContextValue extends WorkbenchProps {
|
|
|
256
281
|
pendingSend: PendingThreadSend | null
|
|
257
282
|
setPendingSend: (p: PendingThreadSend | null) => void
|
|
258
283
|
creatingConversationRef: React.MutableRefObject<boolean>
|
|
284
|
+
/**
|
|
285
|
+
* 空态选档槽(用户裁决 2026-11-20 对齐 DSH blank 会话播种):thread 未建时
|
|
286
|
+
* /permission /plan 选档先存此处,建线(handleSend 空态分支)随 createConversationFn
|
|
287
|
+
* 落库 sandboxPolicy,成功后清零。有线程时不消费(选档走 setSandboxPolicy 直改)。
|
|
288
|
+
*/
|
|
289
|
+
pendingSandboxPolicy: string | null
|
|
290
|
+
setPendingSandboxPolicy: (level: string | null) => void
|
|
259
291
|
// 派生 / computed
|
|
260
292
|
forwardedProps: Record<string, unknown>
|
|
261
293
|
threadId: string
|
|
@@ -396,6 +428,10 @@ export function WorkbenchProvider({
|
|
|
396
428
|
return [...ids]
|
|
397
429
|
}, [aiProviders])
|
|
398
430
|
|
|
431
|
+
// 模型分组派生(R5-A,P2 composer 控制):供模型面板分组展示与 dock 行用量分母
|
|
432
|
+
// 查表(findModelEntry)。过滤口径与上方 availableModels 逐字一致(纯函数内部实现)。
|
|
433
|
+
const providerModelGroups = useMemo(() => buildProviderModelGroups(aiProviders ?? []), [aiProviders])
|
|
434
|
+
|
|
399
435
|
const effectiveModel = selectedModel
|
|
400
436
|
|
|
401
437
|
// effectiveModel 校验(缺陷 3,设计 §7-3):selectedModel 配置漂移后可能不在可用
|
|
@@ -468,6 +504,11 @@ export function WorkbenchProvider({
|
|
|
468
504
|
activeIdRef.current = activeConversationId
|
|
469
505
|
const [pendingSend, setPendingSend] = useState<PendingThreadSend | null>(null)
|
|
470
506
|
const creatingConversationRef = useRef(false)
|
|
507
|
+
// 空态选档槽(interface 注释见 WorkbenchBodyValue):ref 镜像供 handleSend 闭包读
|
|
508
|
+
// 最新值(handleSend deps [engine, localCwd],state 直读是旧值——activeIdRef 同款)。
|
|
509
|
+
const [pendingSandboxPolicy, setPendingSandboxPolicy] = useState<string | null>(null)
|
|
510
|
+
const pendingSandboxPolicyRef = useRef<string | null>(null)
|
|
511
|
+
pendingSandboxPolicyRef.current = pendingSandboxPolicy
|
|
471
512
|
|
|
472
513
|
const loadConversations = useCallback(() => {
|
|
473
514
|
void listConversationsFn().then(setConversations)
|
|
@@ -749,12 +790,17 @@ export function WorkbenchProvider({
|
|
|
749
790
|
if (creatingConversationRef.current) return
|
|
750
791
|
creatingConversationRef.current = true
|
|
751
792
|
try {
|
|
793
|
+
// 空态选档(/permission /plan):pending 档随建线落库(ref 镜像读最新值),
|
|
794
|
+
// 成功即清零——首回合前 trustedAcceptInput 对账自动施加。
|
|
795
|
+
const initialPolicy = pendingSandboxPolicyRef.current
|
|
752
796
|
const conv = await createConversationFn({
|
|
753
797
|
data: {
|
|
754
798
|
engine,
|
|
755
799
|
localCwd: engine === 'local' ? (localCwd ?? undefined) : undefined,
|
|
800
|
+
sandboxPolicy: initialPolicy ?? undefined,
|
|
756
801
|
},
|
|
757
802
|
})
|
|
803
|
+
if (initialPolicy) setPendingSandboxPolicy(null)
|
|
758
804
|
setConversations((prev) => [conv, ...prev])
|
|
759
805
|
setActiveConversationId(conv.id)
|
|
760
806
|
activeIdRef.current = conv.id
|
|
@@ -795,12 +841,14 @@ export function WorkbenchProvider({
|
|
|
795
841
|
activeIdRef,
|
|
796
842
|
engine,
|
|
797
843
|
localCwd,
|
|
844
|
+
setLocalCwd,
|
|
798
845
|
localAgentId,
|
|
799
846
|
setLocalAgentId,
|
|
800
847
|
localAgents,
|
|
801
848
|
selectedModel,
|
|
802
849
|
effectiveModel,
|
|
803
850
|
availableModels,
|
|
851
|
+
providerModelGroups,
|
|
804
852
|
adapterKind,
|
|
805
853
|
webSearchEnabled,
|
|
806
854
|
setWebSearchEnabled,
|
|
@@ -819,6 +867,8 @@ export function WorkbenchProvider({
|
|
|
819
867
|
pendingSend,
|
|
820
868
|
setPendingSend,
|
|
821
869
|
creatingConversationRef,
|
|
870
|
+
pendingSandboxPolicy,
|
|
871
|
+
setPendingSandboxPolicy,
|
|
822
872
|
forwardedProps,
|
|
823
873
|
threadId,
|
|
824
874
|
fallbackThreadIdRef,
|