@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
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
// You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
+
import { useEffect } from "react"
|
|
18
19
|
import { createLazyFileRoute, Outlet, useLocation } from "@tanstack/react-router"
|
|
19
20
|
import HarnessWorkbenchPage from "@/components/harness/workbench/harness-workbench-page"
|
|
21
|
+
import { dockRegistry } from "@/components/harness/extension-panel/dock/dock-registry"
|
|
20
22
|
|
|
21
23
|
export const Route = createLazyFileRoute('/_nav/harness')({
|
|
22
24
|
component: HarnessPage,
|
|
@@ -24,5 +26,16 @@ export const Route = createLazyFileRoute('/_nav/harness')({
|
|
|
24
26
|
|
|
25
27
|
function HarnessPage() {
|
|
26
28
|
const pathname = useLocation({ select: (location) => location.pathname })
|
|
29
|
+
|
|
30
|
+
// 进入 harness 模块(本 layout 挂载 = 自其他模块/页面切入)→ 右侧面板强制收起
|
|
31
|
+
// (2026-11-19 用户裁决:进入 Harness 右侧面板默认关闭,打开见开始页)。
|
|
32
|
+
// 放 layout 层而非 WorkbenchCenter:$threadId 以 key={threadId} 强制重建页面,模块内
|
|
33
|
+
// 切线程会重跑页面级 effect 而误收起刚展开的面板;index ↔ $threadId ↔ gallery 互切
|
|
34
|
+
// 本 layout 恒挂载,effect 不重跑。时序:子路由 switchThread 先恢复线程存档 expanded,
|
|
35
|
+
// 本 effect 后跑 → 进入模块最终态恒收起。
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
dockRegistry.setExpanded(false)
|
|
38
|
+
}, [])
|
|
39
|
+
|
|
27
40
|
return pathname.replace(/\/$/, "") === "/harness" ? <HarnessWorkbenchPage /> : <Outlet />
|
|
28
41
|
}
|
|
@@ -24,13 +24,13 @@ export { SANDBOX_POLICY_LEVELS, type SandboxPolicyLevel } from "./policy-levels"
|
|
|
24
24
|
* 「full」档需用户显式确认(serverFn 要求 confirmFull: true)——装配侧统一走
|
|
25
25
|
* SANDBOX_DEFAULT_POLICY_LEVEL 兜底。
|
|
26
26
|
*
|
|
27
|
-
* 默认档 =
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* 默认档 = **readonly**(用户裁决 2026-11-21:新会话默认只读权限,写盘/命令需用户
|
|
28
|
+
* 显式切档):映射 harness permissions mode 'plan'(edit/execute/ask 全拒)。
|
|
29
|
+
* 全部建线路径显式写本常量落库(conversations / fork-thread / chat-handler /
|
|
30
|
+
* persistence stores);DB 列默认 'readonly' 与本常量同值(schema.prisma
|
|
31
|
+
* ChatThread.sandboxPolicy)。历史:F4-7 曾对齐 DSH 出厂值 workspace-write。
|
|
32
32
|
*/
|
|
33
|
-
export const SANDBOX_DEFAULT_POLICY_LEVEL: SandboxPolicyLevel = "
|
|
33
|
+
export const SANDBOX_DEFAULT_POLICY_LEVEL: SandboxPolicyLevel = "readonly"
|
|
34
34
|
|
|
35
35
|
export function isSandboxPolicyLevel(v: unknown): v is SandboxPolicyLevel {
|
|
36
36
|
return typeof v === "string" && (SANDBOX_POLICY_LEVELS as readonly string[]).includes(v)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// /compact 手动压缩装配测试(任务 1:server 命令源首条真实命令):
|
|
6
|
+
// 官方 first-party session-tools 的 compact() 插件挂入 harnessPlugins 工厂 +
|
|
7
|
+
// expose.commands 白名单放行 'compact'。断言读 buildHarnessDefinition 返回的
|
|
8
|
+
// 定义对象(Readonly<HarnessConfig>):plugins 是工厂(调用取插件数组,插件
|
|
9
|
+
// name 单一来源)、expose.commands 是白名单只读数组。compact 的命令定义由插件
|
|
10
|
+
// setup 贡献(无 input schema,回合外 command control op),命令 run 的执行
|
|
11
|
+
// 体(transcript 摘要 + replaceTranscript)属官方插件行为,不在本层重复覆盖。
|
|
12
|
+
|
|
13
|
+
import { describe, expect, it } from 'vitest'
|
|
14
|
+
|
|
15
|
+
import { buildHarnessDefinition } from '../define.server'
|
|
16
|
+
|
|
17
|
+
/** 插件名集合(plugins 工厂调用产物;HarnessPlugin.name 单一来源)。 */
|
|
18
|
+
function mountedPluginNames(): string[] {
|
|
19
|
+
const harness = buildHarnessDefinition()
|
|
20
|
+
const plugins = harness.plugins?.() ?? []
|
|
21
|
+
return plugins.map((p) => p.name)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('/compact 官方插件装配(任务 1:server 命令源首条真实命令)', () => {
|
|
25
|
+
it('expose.commands 白名单含 compact(客户端可调面)', () => {
|
|
26
|
+
const harness = buildHarnessDefinition()
|
|
27
|
+
const commands = harness.expose?.commands ?? []
|
|
28
|
+
expect(commands).toContain('compact')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('plugins 工厂含 tanstack/compact(官方 first-party session-tools)', () => {
|
|
32
|
+
expect(mountedPluginNames()).toContain('tanstack/compact')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('undo 通行证保留(Checkpoint Restore / Retry 依赖,官方 protocol 校验)', () => {
|
|
36
|
+
const harness = buildHarnessDefinition()
|
|
37
|
+
expect(harness.expose?.commands ?? []).toContain('undo')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('compact 与既有系统插件并存(permissions/todos/usage 等零丢失)', () => {
|
|
41
|
+
const names = mountedPluginNames()
|
|
42
|
+
for (const expected of ['tanstack/permissions', 'tanstack/todos', 'tanstack/usage']) {
|
|
43
|
+
expect(names).toContain(expected)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// harness expose 白名单断言(P2 composer 控制,任务 1 / P0-1):configure op 逐
|
|
6
|
+
// key 校验 expose.settings,settings 白名单必须同时覆盖 model 与 reasoning——
|
|
7
|
+
// 缺 'reasoning' 时 composer reasoning 档位写入被 not_exposed 拒绝。
|
|
8
|
+
// 复审 P2-3:buildHarnessDefinition 已导出且测试可直连 import(先例
|
|
9
|
+
// define-registry-subagents.test.ts,unit project 无需 mock)。
|
|
10
|
+
|
|
11
|
+
import { expect, test } from 'vitest'
|
|
12
|
+
|
|
13
|
+
import { buildHarnessDefinition } from '../define.server'
|
|
14
|
+
|
|
15
|
+
test('expose.settings 覆盖 model 与 reasoning(P0-1:configure op 每 key 校验白名单)', () => {
|
|
16
|
+
expect(buildHarnessDefinition().expose?.settings).toEqual(expect.arrayContaining(['model', 'reasoning']))
|
|
17
|
+
})
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// @thread host 注入 middleware(P2 任务 4)单测。
|
|
6
|
+
//
|
|
7
|
+
// 以 transform 纯函数 `threadReferenceTransform(messages, deps)` 为主(deps mock
|
|
8
|
+
// 注入 IO:requireOwned / resolveTranscript / loadLegacyMessages / 可读引文格式化),
|
|
9
|
+
// 不依赖真实 host / prisma / paraglide。覆盖:标记替换、多引用、超 3 拒、自引用拒、
|
|
10
|
+
// 跨用户拒、字节预算截断、双通路(transcript 空 → legacy)、都空降级(仅标题)、
|
|
11
|
+
// 幂等重入(已注入特征的消息表再跑一遍不变)、JSON 无裸 `<`(stringifySafe)。
|
|
12
|
+
// 另含 define 层挂载断言(照 compact-plugin.server.test 模式)。
|
|
13
|
+
|
|
14
|
+
import { describe, expect, it } from 'vitest'
|
|
15
|
+
import type { ModelMessage } from '@tanstack/ai'
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
THREAD_REFERENCE_MAX_BYTES,
|
|
19
|
+
REFERENCED_THREADS_SENTINEL,
|
|
20
|
+
threadReferenceTransform,
|
|
21
|
+
stringifySafe,
|
|
22
|
+
type ThreadReferenceDeps,
|
|
23
|
+
} from '../thread-reference.server'
|
|
24
|
+
|
|
25
|
+
/** 可读引文格式化 fake(生产用 paraglide m.harness_mention_threadRef)。 */
|
|
26
|
+
const readable = (title: string) => `参考会话《${title}》`
|
|
27
|
+
|
|
28
|
+
/** 构造 deps(可逐字段覆盖)。 */
|
|
29
|
+
function makeDeps(over: Partial<ThreadReferenceDeps> = {}): ThreadReferenceDeps {
|
|
30
|
+
return {
|
|
31
|
+
userId: 'u1',
|
|
32
|
+
currentThreadId: 't-current',
|
|
33
|
+
requireOwned: async () => ({}),
|
|
34
|
+
resolveTranscript: async () => [],
|
|
35
|
+
loadLegacyMessages: async () => [],
|
|
36
|
+
formatThreadRefReadable: readable,
|
|
37
|
+
...over,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function userMsg(text: string, id = 'm-user'): ModelMessage {
|
|
42
|
+
return { id, role: 'user', content: text }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 含某 marker 的 user 消息文本。 */
|
|
46
|
+
const marker = (label: string, id: string) => `@[${label}](allblue-thread:${id})`
|
|
47
|
+
|
|
48
|
+
/** 取全部含注入特征的 recall 消息。 */
|
|
49
|
+
function recallMessages(msgs: ModelMessage[]): ModelMessage[] {
|
|
50
|
+
return msgs.filter(
|
|
51
|
+
(m) => typeof m.content === 'string' && m.content.includes(REFERENCED_THREADS_SENTINEL),
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('threadReferenceTransform(纯函数,deps 注入)', () => {
|
|
56
|
+
it('标记替换:accepted 引用改写为可读文本 + 紧随注入 recall', async () => {
|
|
57
|
+
const deps = makeDeps({
|
|
58
|
+
resolveTranscript: async () => [
|
|
59
|
+
{ role: 'user', content: '你好' },
|
|
60
|
+
{ role: 'assistant', content: '世界' },
|
|
61
|
+
],
|
|
62
|
+
})
|
|
63
|
+
const input = [userMsg(`看看 ${marker('会话甲', 't-acc')} 的内容`)]
|
|
64
|
+
const out = await threadReferenceTransform(input, deps)
|
|
65
|
+
|
|
66
|
+
// 改写:标记消失、可读引文出现
|
|
67
|
+
const rewritten = out[0]
|
|
68
|
+
expect(rewritten.role).toBe('user')
|
|
69
|
+
expect(String(rewritten.content)).toContain(readable('会话甲'))
|
|
70
|
+
expect(String(rewritten.content)).not.toContain('allblue-thread:')
|
|
71
|
+
|
|
72
|
+
// 注入:紧随其后的 recall 消息
|
|
73
|
+
const recalls = recallMessages(out)
|
|
74
|
+
expect(recalls).toHaveLength(1)
|
|
75
|
+
expect(out.indexOf(recalls[0]!)).toBe(1)
|
|
76
|
+
const recallText = String(recalls[0]!.content)
|
|
77
|
+
expect(recallText).toContain(REFERENCED_THREADS_SENTINEL)
|
|
78
|
+
expect(recallText).toContain('t-acc')
|
|
79
|
+
// 投影:user/assistant 文本进入 JSON
|
|
80
|
+
expect(recallText).toContain('你好')
|
|
81
|
+
expect(recallText).toContain('世界')
|
|
82
|
+
// 不可信警告
|
|
83
|
+
expect(recallText).toContain('只读快照')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('多引用:两个 accepted 引用都改写 + 单条 recall 含两个 thread', async () => {
|
|
87
|
+
const deps = makeDeps({
|
|
88
|
+
resolveTranscript: async (tid) => [{ role: 'user', content: `内容-${tid}` }],
|
|
89
|
+
})
|
|
90
|
+
const input = [userMsg(`${marker('甲', 't-a')} 和 ${marker('乙', 't-b')}`)]
|
|
91
|
+
const out = await threadReferenceTransform(input, deps)
|
|
92
|
+
|
|
93
|
+
expect(String(out[0]!.content)).toContain(readable('甲'))
|
|
94
|
+
expect(String(out[0]!.content)).toContain(readable('乙'))
|
|
95
|
+
const recalls = recallMessages(out)
|
|
96
|
+
expect(recalls).toHaveLength(1)
|
|
97
|
+
expect(String(recalls[0]!.content)).toContain('t-a')
|
|
98
|
+
expect(String(recalls[0]!.content)).toContain('t-b')
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('超 3 拒:第 4 个引用保留标记原文 + omission 说明', async () => {
|
|
102
|
+
const deps = makeDeps({
|
|
103
|
+
resolveTranscript: async (tid) => [{ role: 'user', content: `c-${tid}` }],
|
|
104
|
+
})
|
|
105
|
+
const text = [1, 2, 3, 4].map((i) => marker(`会话${i}`, `t-${i}`)).join(' ')
|
|
106
|
+
const out = await threadReferenceTransform([userMsg(text)], deps)
|
|
107
|
+
|
|
108
|
+
// 前 3 改写,第 4 保留标记
|
|
109
|
+
const rewritten = String(out[0]!.content)
|
|
110
|
+
expect(rewritten).toContain(readable('会话1'))
|
|
111
|
+
expect(rewritten).toContain(readable('会话2'))
|
|
112
|
+
expect(rewritten).toContain(readable('会话3'))
|
|
113
|
+
expect(rewritten).toContain(marker('会话4', 't-4'))
|
|
114
|
+
// omission 说明(recall 内)
|
|
115
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
116
|
+
expect(recallText).toContain('t-4')
|
|
117
|
+
expect(recallText).toContain('3')
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('自引用拒:threadId == 当前线程 → 保留标记 + omission', async () => {
|
|
121
|
+
const deps = makeDeps()
|
|
122
|
+
const input = [userMsg(`self ${marker('当前', 't-current')}`)]
|
|
123
|
+
const out = await threadReferenceTransform(input, deps)
|
|
124
|
+
|
|
125
|
+
expect(String(out[0]!.content)).toContain(marker('当前', 't-current'))
|
|
126
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
127
|
+
expect(recallText).toContain('t-current')
|
|
128
|
+
// 无 accepted thread 注入
|
|
129
|
+
expect(recallText).not.toContain('"messages":[{"role"')
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('跨用户拒:requireOwned 抛 → 保留标记 + omission', async () => {
|
|
133
|
+
const deps = makeDeps({
|
|
134
|
+
requireOwned: async (tid) => {
|
|
135
|
+
if (tid === 't-other') throw new Error('Unauthorized')
|
|
136
|
+
return {}
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
const input = [userMsg(`x ${marker('他人', 't-other')}`)]
|
|
140
|
+
const out = await threadReferenceTransform(input, deps)
|
|
141
|
+
|
|
142
|
+
expect(String(out[0]!.content)).toContain(marker('他人', 't-other'))
|
|
143
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
144
|
+
expect(recallText).toContain('t-other')
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('双通路:transcript 空 → legacy chat_messages', async () => {
|
|
148
|
+
const deps = makeDeps({
|
|
149
|
+
resolveTranscript: async () => [],
|
|
150
|
+
loadLegacyMessages: async () => [{ role: 'user', content: 'legacy内容' }],
|
|
151
|
+
})
|
|
152
|
+
const out = await threadReferenceTransform([userMsg(marker('旧', 't-old'))], deps)
|
|
153
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
154
|
+
expect(recallText).toContain('legacy内容')
|
|
155
|
+
expect(recallText).toContain('legacy')
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
it('都空降级:仅标题(threads 内 messages 为空)', async () => {
|
|
159
|
+
const deps = makeDeps()
|
|
160
|
+
const out = await threadReferenceTransform([userMsg(marker('空会话', 't-empty'))], deps)
|
|
161
|
+
// 标记仍改写为可读引文(accepted,只是内容降级为仅标题)
|
|
162
|
+
expect(String(out[0]!.content)).toContain(readable('空会话'))
|
|
163
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
164
|
+
expect(recallText).toContain('t-empty')
|
|
165
|
+
expect(recallText).toContain('空会话')
|
|
166
|
+
// 无投影正文
|
|
167
|
+
expect(recallText).toContain('"messages":[]')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('预算截断:>64KiB 单条投影被 head/tail 截断并标注', async () => {
|
|
171
|
+
const big = 'A'.repeat(THREAD_REFERENCE_MAX_BYTES + 40_000)
|
|
172
|
+
const deps = makeDeps({
|
|
173
|
+
resolveTranscript: async () => [{ role: 'assistant', content: big }],
|
|
174
|
+
})
|
|
175
|
+
const out = await threadReferenceTransform([userMsg(marker('大', 't-big'))], deps)
|
|
176
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
177
|
+
// recall 总体不超预算(留出 envelope 余量)
|
|
178
|
+
expect(Buffer.byteLength(recallText, 'utf8')).toBeLessThan(THREAD_REFERENCE_MAX_BYTES + 4096)
|
|
179
|
+
// 截断标注
|
|
180
|
+
expect(recallText).toContain('省略')
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
it('notice(notice-N id 前缀)排除、tool 角色排除', async () => {
|
|
184
|
+
const deps = makeDeps({
|
|
185
|
+
resolveTranscript: async () => [
|
|
186
|
+
{ id: 'notice-1', role: 'user', content: 'notice正文' },
|
|
187
|
+
{ role: 'tool', content: 'tool正文' },
|
|
188
|
+
{ role: 'assistant', content: '可见正文' },
|
|
189
|
+
],
|
|
190
|
+
})
|
|
191
|
+
const out = await threadReferenceTransform([userMsg(marker('n', 't-n'))], deps)
|
|
192
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
193
|
+
expect(recallText).toContain('可见正文')
|
|
194
|
+
expect(recallText).not.toContain('notice正文')
|
|
195
|
+
expect(recallText).not.toContain('tool正文')
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it('幂等重入:已注入特征的消息表再跑一遍不变(迭代重入守卫)', async () => {
|
|
199
|
+
const deps = makeDeps({
|
|
200
|
+
resolveTranscript: async () => [{ role: 'user', content: '你好' }],
|
|
201
|
+
})
|
|
202
|
+
// 第一遍
|
|
203
|
+
const first = await threadReferenceTransform([userMsg(marker('甲', 't-a'))], deps)
|
|
204
|
+
expect(recallMessages(first)).toHaveLength(1)
|
|
205
|
+
// 第二遍:把第一遍产物(已改写、已含 recall)再喂回去
|
|
206
|
+
const second = await threadReferenceTransform(first, deps)
|
|
207
|
+
expect(second).toBe(first) // 无变化返回同一引用(no-op)
|
|
208
|
+
expect(recallMessages(second)).toHaveLength(1) // 未重复追加
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
it('幂等:标记与 sentinel 并存的病态输入不重复追加 recall', async () => {
|
|
212
|
+
const deps = makeDeps({
|
|
213
|
+
resolveTranscript: async () => [{ role: 'user', content: 'c' }],
|
|
214
|
+
})
|
|
215
|
+
const withSentinel: ModelMessage = {
|
|
216
|
+
role: 'user',
|
|
217
|
+
content: `x\n${REFERENCED_THREADS_SENTINEL}\n`,
|
|
218
|
+
}
|
|
219
|
+
const input = [userMsg(marker('甲', 't-a'), 'm2'), withSentinel]
|
|
220
|
+
const out = await threadReferenceTransform(input, deps)
|
|
221
|
+
expect(recallMessages(out)).toHaveLength(1)
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
it('无标记:原样返回(no-op,返回同一引用)', async () => {
|
|
225
|
+
const deps = makeDeps()
|
|
226
|
+
const input = [userMsg('普通消息,无标记')]
|
|
227
|
+
const out = await threadReferenceTransform(input, deps)
|
|
228
|
+
expect(out).toBe(input)
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
describe('stringifySafe(防伪造标签注入)', () => {
|
|
233
|
+
it('< 转义为 \\u003c,无裸 <', () => {
|
|
234
|
+
const s = stringifySafe({ x: '<script>alert(1)</script>' })
|
|
235
|
+
expect(s).not.toContain('<')
|
|
236
|
+
expect(s).toContain('\\u003c')
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
it('注入 recall 内投影正文含 < 时被转义(仅 envelope 标签保留尖括号)', async () => {
|
|
240
|
+
const deps = makeDeps({
|
|
241
|
+
resolveTranscript: async () => [{ role: 'assistant', content: '<b>hi</b>' }],
|
|
242
|
+
})
|
|
243
|
+
const out = await threadReferenceTransform([userMsg(marker('x', 't-x'))], deps)
|
|
244
|
+
const recallText = String(recallMessages(out)[0]!.content)
|
|
245
|
+
expect(recallText).not.toContain('<b>')
|
|
246
|
+
expect(recallText).not.toContain('</b>')
|
|
247
|
+
expect(recallText).toContain('\\u003cb\\u003e')
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
describe('define 层挂载(thread-reference middleware 进 harnessMiddleware)', () => {
|
|
252
|
+
it('middleware 数组含 allblue/thread-reference', async () => {
|
|
253
|
+
const { buildHarnessDefinition } = await import('../define.server')
|
|
254
|
+
const harness = buildHarnessDefinition()
|
|
255
|
+
const names = (harness.middleware ?? []).map((mw) => (mw as { name?: string }).name)
|
|
256
|
+
expect(names).toContain('allblue/thread-reference')
|
|
257
|
+
})
|
|
258
|
+
})
|
|
@@ -27,6 +27,7 @@ import { otelMiddleware } from '@tanstack/ai/middlewares/otel'
|
|
|
27
27
|
import { trace } from '@opentelemetry/api'
|
|
28
28
|
import { defineHarness, type AnyHarness, type HarnessPlugin } from '@tanstack/ai-harness'
|
|
29
29
|
import {
|
|
30
|
+
compact,
|
|
30
31
|
permissions,
|
|
31
32
|
todos,
|
|
32
33
|
question,
|
|
@@ -40,6 +41,7 @@ import path from 'node:path'
|
|
|
40
41
|
import { createAiOutputGuardMiddleware } from '@/server/ai-gateway/ai-output-guard'
|
|
41
42
|
import { createToolBudgetMiddleware } from '@/server/ai-gateway/middlewares/tool-budget'
|
|
42
43
|
import { createUsageLogMiddleware } from '@/server/ai-gateway/middlewares/usage-log'
|
|
44
|
+
import { createThreadReferenceMiddleware } from '@/server/harness/thread-reference.server'
|
|
43
45
|
import { getIdentityFromContext } from '@/server/agents/context.server'
|
|
44
46
|
import { chatSubagentsBag } from '@/server/ai-gateway/chat-subagents.server'
|
|
45
47
|
import { assembleAppPlugins } from '@/server/harness/plugins/assemble-app'
|
|
@@ -133,6 +135,11 @@ function harnessMiddleware(
|
|
|
133
135
|
otelMiddleware({ tracer, captureContent: false }),
|
|
134
136
|
createAiOutputGuardMiddleware(),
|
|
135
137
|
createToolBudgetMiddleware(),
|
|
138
|
+
// @thread host 注入(P2 任务 4):onConfig beforeModel 扫描 config.messages 中的
|
|
139
|
+
// `allblue-thread:` 标记 → 就地改写为可读引文 + 紧随注入 recall 快照(入转录、字节
|
|
140
|
+
// 预算投影、双通路读取)。置于 compaction 之前,使注入的 recall 参与压缩计数
|
|
141
|
+
// (已知边界 #4)。无标记时 onConfig 快速返回 undefined(hot path 零开销)。
|
|
142
|
+
createThreadReferenceMiddleware(),
|
|
136
143
|
// Phase 3 compaction 调优(T3.5):clearToolResults → summarizeOldest +
|
|
137
144
|
// countTokens:'usage'。装配细节(含 env-key 摘要 adapter 与回落)见
|
|
138
145
|
// compaction.server.ts。
|
|
@@ -271,6 +278,12 @@ function harnessPlugins(
|
|
|
271
278
|
// 时正常挂载,行为与改动前一致。
|
|
272
279
|
...(titleAdapter ? [title({ adapter: titleAdapter })] : []),
|
|
273
280
|
usage(),
|
|
281
|
+
// /compact(任务 1,P1):官方 first-party session-tools 插件——手动压缩上下文
|
|
282
|
+
// 命令(server 命令源首条真实命令)。命令 run 执行体 = transcript 摘要(经
|
|
283
|
+
// adapter 发模型)→ replaceTranscript,属官方插件行为。adapter 与 title 同源
|
|
284
|
+
// (defaultAdapter 用户路由门面,命令 run 的身份经 ALS/chat context 解析
|
|
285
|
+
// per-user key),挂载守卫同 title:无 adapter 时命令无从摘要,跳过挂载。
|
|
286
|
+
...(titleAdapter ? [compact({ adapter: titleAdapter })] : []),
|
|
274
287
|
boundToolOutput({ retentionDays: 7 }),
|
|
275
288
|
// 撤销/快照(D10,T2.6):仅 git 探测通过时加入(桌面;云端沙箱文件系统非
|
|
276
289
|
// 本机 git 仓库,MVP 不挂——D10 降级 UI 明示)。snapshots 置于 workspaceTools
|
|
@@ -378,11 +391,16 @@ export function buildHarnessDefinition(overrides?: {
|
|
|
378
391
|
// 只能经模型 turn 调用。businessTools F2-2b 起退役为插件贡献后即退出 expose.tools
|
|
379
392
|
// 可及范围(如需客户端直调某业务工具,须显式挂回顶层 tools 面)。
|
|
380
393
|
expose: {
|
|
381
|
-
|
|
394
|
+
// P0-1(任务 1):configure op 逐 key 校验白名单——composer reasoning 档位经
|
|
395
|
+
// settings.reasoning 写入,缺 'reasoning' 即 not_exposed 拒绝(R5-A 诚实
|
|
396
|
+
// 白名单:仅 openai/anthropic/openrouter 三 kind 适配器消费该参数)。
|
|
397
|
+
settings: ['model', 'reasoning'],
|
|
382
398
|
// undo 是 revert/unrevert control op 的通行证(官方 protocol.js 校验
|
|
383
399
|
// expose.commands 含 "undo",缺即 not_exposed 拒绝——Checkpoint Restore/
|
|
384
|
-
// Retry
|
|
385
|
-
|
|
400
|
+
// Retry 依赖)。compact(任务 1,P1):官方 tanstack/compact 插件贡献的
|
|
401
|
+
// 手动压缩命令('/' 菜单 server 源首条真实命令)。插件贡献的命令名与其
|
|
402
|
+
// 合并去重。
|
|
403
|
+
commands: [...new Set([...commandNames, 'compact', 'undo'])],
|
|
386
404
|
},
|
|
387
405
|
})
|
|
388
406
|
}
|