@blade-hq/agent-react 2612.0.0-beta.5 → 2612.0.0-beta.50
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/README.md +20 -0
- package/dist/chat/AgentLoopBlock.d.ts +0 -2
- package/dist/chat/AskUserQuestionBlock.d.ts +3 -20
- package/dist/chat/AssistantTurnBlock.d.ts +1 -9
- package/dist/chat/AttachmentPreviewDialog.d.ts +0 -1
- package/dist/chat/ChatLoadingIndicator.d.ts +7 -0
- package/dist/chat/ChatPanel.d.ts +1 -3
- package/dist/chat/ContextAttachmentPills.d.ts +4 -0
- package/dist/chat/CurrentPlanPanel.d.ts +0 -3
- package/dist/chat/FileDeliveryCards.d.ts +0 -4
- package/dist/chat/FinalArtifactCards.d.ts +0 -1
- package/dist/chat/LightComposer.d.ts +1 -1
- package/dist/chat/LiteMessageList.d.ts +1 -3
- package/dist/chat/MessageFileAttachmentList.d.ts +0 -5
- package/dist/chat/QuestionnaireQuestionBlock.d.ts +11 -0
- package/dist/chat/SessionReplayBar.d.ts +0 -1
- package/dist/chat/TextAttachmentPills.d.ts +0 -3
- package/dist/chat/TurnNavRail.d.ts +0 -3
- package/dist/chat/WorkflowRunBlock.d.ts +21 -4
- package/dist/chat/ai-elements/reasoning.d.ts +4 -4
- package/dist/chat/ai-elements/shimmer.d.ts +0 -4
- package/dist/chat/customization.d.ts +1 -5
- package/dist/chat/index.d.ts +1 -4
- package/dist/chat/lib/citations.d.ts +5 -22
- package/dist/chat/markdown/ExternalAnchor.d.ts +2 -2
- package/dist/chat/markdown/MarkdownContent.d.ts +3 -0
- package/dist/chat/message-list-blocks.d.ts +0 -1
- package/dist/chat/runtime/actions.d.ts +3 -3
- package/dist/chat/runtime/background-task-dismissals.d.ts +0 -1
- package/dist/chat/runtime/composer-channels.d.ts +0 -3
- package/dist/chat/runtime/input-cache-reset.d.ts +1 -6
- package/dist/chat/runtime/input-history-storage.d.ts +2 -0
- package/dist/chat/runtime/input-services.d.ts +10 -6
- package/dist/chat/runtime/session-source.d.ts +0 -5
- package/dist/chat/runtime/use-chat-actions.d.ts +0 -4
- package/dist/{chat-OCLOVB3H.css → chat-IHPRU35X.css} +5 -18
- package/dist/chat.css +5 -18
- package/dist/{chunk-T5WGKZN4.js → chunk-7G3R7FAR.js} +4098 -12653
- package/dist/chunk-7G3R7FAR.js.map +1 -0
- package/dist/chunk-NPIUZZET.js +581 -0
- package/dist/chunk-NPIUZZET.js.map +1 -0
- package/dist/chunk-OQQCJD3L.js +9478 -0
- package/dist/chunk-OQQCJD3L.js.map +1 -0
- package/dist/chunk-VUDRKCD4.js +11664 -0
- package/dist/chunk-VUDRKCD4.js.map +1 -0
- package/dist/{chunk-XULCQP3Q.js → chunk-YP64AL24.js} +2245 -13440
- package/dist/chunk-YP64AL24.js.map +1 -0
- package/dist/components/AccountConnectors.d.ts +13 -0
- package/dist/components/BrowserConnectionDialog.d.ts +7 -0
- package/dist/components/ChatInput.d.ts +4 -16
- package/dist/components/ConnectorPanel.d.ts +3 -1
- package/dist/components/LlmAdvancedSettings.d.ts +0 -1
- package/dist/components/PlanUpdateBlock.d.ts +0 -1
- package/dist/components/SessionPluginConfigForm.d.ts +3 -1
- package/dist/components/plugin-connector.d.ts +2 -0
- package/dist/embed/blade-chat-element.d.ts +0 -8
- package/dist/embed/entry.d.ts +9 -19
- package/dist/hooks/use-message-pin.d.ts +1 -1
- package/dist/host.d.ts +0 -4
- package/dist/index.js +6 -3
- package/dist/internal.d.ts +4 -2
- package/dist/internal.js +31 -64
- package/dist/internal.js.map +1 -1
- package/dist/lib/message-shortcuts.d.ts +5 -0
- package/dist/questions.d.ts +7 -0
- package/dist/questions.js +907 -0
- package/dist/questions.js.map +1 -0
- package/dist/rich-input/ChatInput.d.ts +1 -1
- package/dist/rich-input/ConnectButton.d.ts +7 -5
- package/dist/rich-input/FileCompletionMenu.d.ts +6 -11
- package/dist/rich-input/InputActionSubmenu.d.ts +10 -0
- package/dist/rich-input/SkillActionMenu.d.ts +10 -0
- package/dist/rich-input/SkillStatusBar.d.ts +1 -9
- package/dist/rich-input/extensions/plugin-mention.d.ts +15 -0
- package/dist/rich-input/extensions/skill-mention.d.ts +3 -21
- package/dist/rich-input/index.d.ts +6 -3
- package/dist/rich-input/lib/composer-content.d.ts +11 -22
- package/dist/rich-input/lib/input-history-document.d.ts +3 -0
- package/dist/rich-input/lib/plugin-suggestions.d.ts +7 -0
- package/dist/rich-input/lib/reference-candidates.d.ts +26 -0
- package/dist/rich-input/lib/skill-suggestions.d.ts +1 -1
- package/dist/rich-input/lib/user-home.d.ts +0 -17
- package/dist/rich-input/services.d.ts +2 -3
- package/dist/rich-input/use-input-history.d.ts +8 -10
- package/dist/rich-input/use-reference-candidates.d.ts +8 -0
- package/dist/rich-input/voice/VoiceWaveform.d.ts +0 -3
- package/dist/rich-input.js +1228 -1509
- package/dist/rich-input.js.map +1 -1
- package/dist/style.css +16 -55
- package/dist/style.full.css +23 -77
- package/node_modules/@floating-ui/core/LICENSE +20 -0
- package/node_modules/@floating-ui/core/README.md +4 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs +1 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs +1184 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +531 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +531 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.esm.js +1058 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +1058 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.js +1203 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.min.js +1 -0
- package/node_modules/@floating-ui/core/package.json +63 -0
- package/node_modules/@floating-ui/dom/LICENSE +20 -0
- package/node_modules/@floating-ui/dom/README.md +4 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs +1 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs +956 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts +358 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.ts +358 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js +781 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +781 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.js +975 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.min.js +1 -0
- package/node_modules/@floating-ui/dom/package.json +71 -0
- package/node_modules/@floating-ui/utils/LICENSE +20 -0
- package/node_modules/@floating-ui/utils/README.md +4 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +103 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +103 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.esm.js +165 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +165 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.js +192 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js +1 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.esm.js +136 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +136 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.js +167 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.min.js +1 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.esm.js +165 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.umd.js +192 -0
- package/node_modules/@floating-ui/utils/dom/package.json +6 -0
- package/node_modules/@floating-ui/utils/package.json +70 -0
- package/node_modules/@radix-ui/primitive/LICENSE +21 -0
- package/node_modules/@radix-ui/primitive/README.md +3 -0
- package/node_modules/@radix-ui/primitive/dist/index.d.mts +20 -0
- package/node_modules/@radix-ui/primitive/dist/index.d.ts +20 -0
- package/node_modules/@radix-ui/primitive/dist/index.js +76 -0
- package/node_modules/@radix-ui/primitive/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/primitive/dist/index.mjs +53 -0
- package/node_modules/@radix-ui/primitive/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/primitive/package.json +47 -0
- package/node_modules/@radix-ui/react-collapsible/LICENSE +21 -0
- package/node_modules/@radix-ui/react-collapsible/README.md +3 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.d.mts +33 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.d.ts +33 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.js +187 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.mjs +155 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-collapsible/package.json +75 -0
- package/node_modules/@radix-ui/react-compose-refs/README.md +13 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts +15 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts +15 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.js +74 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +41 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-compose-refs/package.json +75 -0
- package/node_modules/@radix-ui/react-context/README.md +13 -0
- package/node_modules/@radix-ui/react-context/dist/index.d.mts +21 -0
- package/node_modules/@radix-ui/react-context/dist/index.d.ts +21 -0
- package/node_modules/@radix-ui/react-context/dist/index.js +114 -0
- package/node_modules/@radix-ui/react-context/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-context/dist/index.mjs +81 -0
- package/node_modules/@radix-ui/react-context/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-context/package.json +75 -0
- package/node_modules/@radix-ui/react-id/README.md +13 -0
- package/node_modules/@radix-ui/react-id/dist/index.d.mts +3 -0
- package/node_modules/@radix-ui/react-id/dist/index.d.ts +3 -0
- package/node_modules/@radix-ui/react-id/dist/index.js +49 -0
- package/node_modules/@radix-ui/react-id/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-id/dist/index.mjs +16 -0
- package/node_modules/@radix-ui/react-id/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-id/package.json +78 -0
- package/node_modules/@radix-ui/react-presence/LICENSE +21 -0
- package/node_modules/@radix-ui/react-presence/README.md +3 -0
- package/node_modules/@radix-ui/react-presence/dist/index.d.mts +12 -0
- package/node_modules/@radix-ui/react-presence/dist/index.d.ts +12 -0
- package/node_modules/@radix-ui/react-presence/dist/index.js +171 -0
- package/node_modules/@radix-ui/react-presence/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-presence/dist/index.mjs +139 -0
- package/node_modules/@radix-ui/react-presence/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-presence/package.json +69 -0
- package/node_modules/@radix-ui/react-primitive/LICENSE +21 -0
- package/node_modules/@radix-ui/react-primitive/README.md +3 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.d.mts +52 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.d.ts +52 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.js +80 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.mjs +47 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-primitive/package.json +68 -0
- package/node_modules/@radix-ui/react-slot/LICENSE +21 -0
- package/node_modules/@radix-ui/react-slot/README.md +3 -0
- package/node_modules/@radix-ui/react-slot/dist/index.d.mts +17 -0
- package/node_modules/@radix-ui/react-slot/dist/index.d.ts +17 -0
- package/node_modules/@radix-ui/react-slot/dist/index.js +138 -0
- package/node_modules/@radix-ui/react-slot/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-slot/dist/index.mjs +105 -0
- package/node_modules/@radix-ui/react-slot/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-slot/package.json +63 -0
- package/node_modules/@radix-ui/react-use-controllable-state/LICENSE +21 -0
- package/node_modules/@radix-ui/react-use-controllable-state/README.md +3 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.d.mts +40 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.d.ts +40 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +169 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +136 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-use-controllable-state/package.json +64 -0
- package/node_modules/@radix-ui/react-use-effect-event/LICENSE +21 -0
- package/node_modules/@radix-ui/react-use-effect-event/README.md +5 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.d.mts +8 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.d.ts +8 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.js +60 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs +27 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-use-effect-event/package.json +65 -0
- package/node_modules/@radix-ui/react-use-effect-event/src/index.ts +1 -0
- package/node_modules/@radix-ui/react-use-effect-event/src/use-effect-event.tsx +36 -0
- package/node_modules/@radix-ui/react-use-layout-effect/README.md +13 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.d.mts +12 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.d.ts +12 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +41 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +8 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-use-layout-effect/package.json +75 -0
- package/node_modules/@remirror/core-constants/LICENSE +21 -0
- package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.cts +612 -0
- package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.ts +612 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.cjs +314 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.cts +20 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.ts +20 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.js +269 -0
- package/node_modules/@remirror/core-constants/dist-types/core-constants.d.ts +431 -0
- package/node_modules/@remirror/core-constants/dist-types/error-constants.d.ts +119 -0
- package/node_modules/@remirror/core-constants/dist-types/index.d.ts +2 -0
- package/node_modules/@remirror/core-constants/dist-types/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@remirror/core-constants/package.json +45 -0
- package/node_modules/@remirror/core-constants/readme.md +17 -0
- package/node_modules/@tiptap/core/LICENSE.md +21 -0
- package/node_modules/@tiptap/core/README.md +18 -0
- package/node_modules/@tiptap/core/dist/index.cjs +7126 -0
- package/node_modules/@tiptap/core/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/core/dist/index.d.cts +4954 -0
- package/node_modules/@tiptap/core/dist/index.d.ts +4954 -0
- package/node_modules/@tiptap/core/dist/index.js +6992 -0
- package/node_modules/@tiptap/core/dist/index.js.map +1 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs +56 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs.map +1 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts +23 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts +23 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +26 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.cjs +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.cts +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.ts +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.js +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.cjs +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.d.cts +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.d.ts +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.js +1 -0
- package/node_modules/@tiptap/core/package.json +70 -0
- package/node_modules/@tiptap/core/src/CommandManager.ts +138 -0
- package/node_modules/@tiptap/core/src/Editor.ts +806 -0
- package/node_modules/@tiptap/core/src/EventEmitter.ts +58 -0
- package/node_modules/@tiptap/core/src/Extendable.ts +602 -0
- package/node_modules/@tiptap/core/src/Extension.ts +55 -0
- package/node_modules/@tiptap/core/src/ExtensionManager.ts +440 -0
- package/node_modules/@tiptap/core/src/InputRule.ts +290 -0
- package/node_modules/@tiptap/core/src/Mark.ts +211 -0
- package/node_modules/@tiptap/core/src/MarkView.ts +122 -0
- package/node_modules/@tiptap/core/src/Node.ts +377 -0
- package/node_modules/@tiptap/core/src/NodePos.ts +257 -0
- package/node_modules/@tiptap/core/src/NodeView.ts +339 -0
- package/node_modules/@tiptap/core/src/PasteRule.ts +373 -0
- package/node_modules/@tiptap/core/src/Tracker.ts +36 -0
- package/node_modules/@tiptap/core/src/__tests__/transformPastedHTML.test.ts +575 -0
- package/node_modules/@tiptap/core/src/commands/blur.ts +29 -0
- package/node_modules/@tiptap/core/src/commands/clearContent.ts +25 -0
- package/node_modules/@tiptap/core/src/commands/clearNodes.ts +57 -0
- package/node_modules/@tiptap/core/src/commands/command.ts +22 -0
- package/node_modules/@tiptap/core/src/commands/createParagraphNear.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/cut.ts +36 -0
- package/node_modules/@tiptap/core/src/commands/deleteCurrentNode.ts +44 -0
- package/node_modules/@tiptap/core/src/commands/deleteNode.ts +41 -0
- package/node_modules/@tiptap/core/src/commands/deleteRange.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/deleteSelection.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/enter.ts +19 -0
- package/node_modules/@tiptap/core/src/commands/exitCode.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/extendMarkRange.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/first.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/focus.ts +108 -0
- package/node_modules/@tiptap/core/src/commands/forEach.ts +24 -0
- package/node_modules/@tiptap/core/src/commands/index.ts +57 -0
- package/node_modules/@tiptap/core/src/commands/insertContent.ts +46 -0
- package/node_modules/@tiptap/core/src/commands/insertContentAt.ts +212 -0
- package/node_modules/@tiptap/core/src/commands/join.ts +69 -0
- package/node_modules/@tiptap/core/src/commands/joinItemBackward.ts +37 -0
- package/node_modules/@tiptap/core/src/commands/joinItemForward.ts +37 -0
- package/node_modules/@tiptap/core/src/commands/joinTextblockBackward.ts +20 -0
- package/node_modules/@tiptap/core/src/commands/joinTextblockForward.ts +20 -0
- package/node_modules/@tiptap/core/src/commands/keyboardShortcut.ts +100 -0
- package/node_modules/@tiptap/core/src/commands/lift.ts +34 -0
- package/node_modules/@tiptap/core/src/commands/liftEmptyBlock.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/liftListItem.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/newlineInCode.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/resetAttributes.ts +73 -0
- package/node_modules/@tiptap/core/src/commands/scrollIntoView.ts +23 -0
- package/node_modules/@tiptap/core/src/commands/selectAll.ts +27 -0
- package/node_modules/@tiptap/core/src/commands/selectNodeBackward.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/selectNodeForward.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/selectParentNode.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/selectTextblockEnd.ts +23 -0
- package/node_modules/@tiptap/core/src/commands/selectTextblockStart.ts +23 -0
- package/node_modules/@tiptap/core/src/commands/setContent.ts +76 -0
- package/node_modules/@tiptap/core/src/commands/setMark.ts +118 -0
- package/node_modules/@tiptap/core/src/commands/setMeta.ts +25 -0
- package/node_modules/@tiptap/core/src/commands/setNode.ts +57 -0
- package/node_modules/@tiptap/core/src/commands/setNodeSelection.ts +31 -0
- package/node_modules/@tiptap/core/src/commands/setTextDirection.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/setTextSelection.ts +35 -0
- package/node_modules/@tiptap/core/src/commands/sinkListItem.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/splitBlock.ts +115 -0
- package/node_modules/@tiptap/core/src/commands/splitListItem.ts +149 -0
- package/node_modules/@tiptap/core/src/commands/toggleList.ts +159 -0
- package/node_modules/@tiptap/core/src/commands/toggleMark.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/toggleNode.ts +47 -0
- package/node_modules/@tiptap/core/src/commands/toggleWrap.ts +32 -0
- package/node_modules/@tiptap/core/src/commands/undoInputRule.ts +49 -0
- package/node_modules/@tiptap/core/src/commands/unsetAllMarks.ts +32 -0
- package/node_modules/@tiptap/core/src/commands/unsetMark.ts +65 -0
- package/node_modules/@tiptap/core/src/commands/unsetTextDirection.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/updateAttributes.ts +150 -0
- package/node_modules/@tiptap/core/src/commands/wrapIn.ts +27 -0
- package/node_modules/@tiptap/core/src/commands/wrapInList.ts +27 -0
- package/node_modules/@tiptap/core/src/extensions/clipboardTextSerializer.ts +44 -0
- package/node_modules/@tiptap/core/src/extensions/commands.ts +14 -0
- package/node_modules/@tiptap/core/src/extensions/delete.ts +89 -0
- package/node_modules/@tiptap/core/src/extensions/drop.ts +26 -0
- package/node_modules/@tiptap/core/src/extensions/editable.ts +18 -0
- package/node_modules/@tiptap/core/src/extensions/focusEvents.ts +41 -0
- package/node_modules/@tiptap/core/src/extensions/index.ts +10 -0
- package/node_modules/@tiptap/core/src/extensions/keymap.ts +160 -0
- package/node_modules/@tiptap/core/src/extensions/paste.ts +25 -0
- package/node_modules/@tiptap/core/src/extensions/tabindex.ts +18 -0
- package/node_modules/@tiptap/core/src/extensions/textDirection.ts +86 -0
- package/node_modules/@tiptap/core/src/helpers/MappablePosition.ts +66 -0
- package/node_modules/@tiptap/core/src/helpers/combineTransactionSteps.ts +21 -0
- package/node_modules/@tiptap/core/src/helpers/createChainableState.ts +39 -0
- package/node_modules/@tiptap/core/src/helpers/createDocument.ts +24 -0
- package/node_modules/@tiptap/core/src/helpers/createNodeFromContent.ts +119 -0
- package/node_modules/@tiptap/core/src/helpers/defaultBlockAt.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/findChildren.ts +24 -0
- package/node_modules/@tiptap/core/src/helpers/findChildrenInRange.ts +36 -0
- package/node_modules/@tiptap/core/src/helpers/findParentNode.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/findParentNodeClosestToPos.ts +37 -0
- package/node_modules/@tiptap/core/src/helpers/flattenExtensions.ts +30 -0
- package/node_modules/@tiptap/core/src/helpers/generateHTML.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/generateJSON.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/generateText.ts +34 -0
- package/node_modules/@tiptap/core/src/helpers/getAttributes.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/getAttributesFromExtensions.ts +122 -0
- package/node_modules/@tiptap/core/src/helpers/getChangedRanges.ts +85 -0
- package/node_modules/@tiptap/core/src/helpers/getDebugJSON.ts +54 -0
- package/node_modules/@tiptap/core/src/helpers/getExtensionField.ts +32 -0
- package/node_modules/@tiptap/core/src/helpers/getHTMLFromFragment.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/getMarkAttributes.ts +30 -0
- package/node_modules/@tiptap/core/src/helpers/getMarkRange.ts +90 -0
- package/node_modules/@tiptap/core/src/helpers/getMarkType.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/getMarksBetween.ts +44 -0
- package/node_modules/@tiptap/core/src/helpers/getNodeAtPosition.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/getNodeAttributes.ts +22 -0
- package/node_modules/@tiptap/core/src/helpers/getNodeType.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/getRenderedAttributes.ts +23 -0
- package/node_modules/@tiptap/core/src/helpers/getSchema.ts +12 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaByResolvedExtensions.ts +183 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaTypeByName.ts +11 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaTypeNameByName.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/getSplittedAttributes.ts +28 -0
- package/node_modules/@tiptap/core/src/helpers/getText.ts +28 -0
- package/node_modules/@tiptap/core/src/helpers/getTextBetween.ts +52 -0
- package/node_modules/@tiptap/core/src/helpers/getTextContentFromNodes.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/getTextSerializersFromSchema.ts +16 -0
- package/node_modules/@tiptap/core/src/helpers/index.ts +55 -0
- package/node_modules/@tiptap/core/src/helpers/injectExtensionAttributesToParseRule.ts +47 -0
- package/node_modules/@tiptap/core/src/helpers/isActive.ts +23 -0
- package/node_modules/@tiptap/core/src/helpers/isAtEndOfNode.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/isAtStartOfNode.ts +11 -0
- package/node_modules/@tiptap/core/src/helpers/isExtensionRulesEnabled.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/isList.ts +27 -0
- package/node_modules/@tiptap/core/src/helpers/isMarkActive.ts +94 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeActive.ts +51 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeEmpty.ts +62 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeSelection.ts +5 -0
- package/node_modules/@tiptap/core/src/helpers/isTextSelection.ts +5 -0
- package/node_modules/@tiptap/core/src/helpers/posToDOMRect.ts +35 -0
- package/node_modules/@tiptap/core/src/helpers/resolveExtensions.ts +25 -0
- package/node_modules/@tiptap/core/src/helpers/resolveFocusPosition.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/rewriteUnknownContent.ts +149 -0
- package/node_modules/@tiptap/core/src/helpers/selectionToInsertionEnd.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/sortExtensions.ts +26 -0
- package/node_modules/@tiptap/core/src/helpers/splitExtensions.ts +16 -0
- package/node_modules/@tiptap/core/src/index.ts +28 -0
- package/node_modules/@tiptap/core/src/inputRules/index.ts +5 -0
- package/node_modules/@tiptap/core/src/inputRules/markInputRule.ts +68 -0
- package/node_modules/@tiptap/core/src/inputRules/nodeInputRule.ts +73 -0
- package/node_modules/@tiptap/core/src/inputRules/textInputRule.ts +35 -0
- package/node_modules/@tiptap/core/src/inputRules/textblockTypeInputRule.ts +35 -0
- package/node_modules/@tiptap/core/src/inputRules/wrappingInputRule.ts +82 -0
- package/node_modules/@tiptap/core/src/jsx-runtime.ts +65 -0
- package/node_modules/@tiptap/core/src/lib/ResizableNodeView.ts +1060 -0
- package/node_modules/@tiptap/core/src/lib/index.ts +1 -0
- package/node_modules/@tiptap/core/src/pasteRules/index.ts +3 -0
- package/node_modules/@tiptap/core/src/pasteRules/markPasteRule.ts +71 -0
- package/node_modules/@tiptap/core/src/pasteRules/nodePasteRule.ts +44 -0
- package/node_modules/@tiptap/core/src/pasteRules/textPasteRule.ts +34 -0
- package/node_modules/@tiptap/core/src/style.ts +71 -0
- package/node_modules/@tiptap/core/src/types.ts +1058 -0
- package/node_modules/@tiptap/core/src/utilities/callOrReturn.ts +21 -0
- package/node_modules/@tiptap/core/src/utilities/canInsertNode.ts +30 -0
- package/node_modules/@tiptap/core/src/utilities/createStyleTag.ts +21 -0
- package/node_modules/@tiptap/core/src/utilities/deleteProps.ts +16 -0
- package/node_modules/@tiptap/core/src/utilities/elementFromString.ts +27 -0
- package/node_modules/@tiptap/core/src/utilities/escapeForRegEx.ts +4 -0
- package/node_modules/@tiptap/core/src/utilities/findDuplicates.ts +8 -0
- package/node_modules/@tiptap/core/src/utilities/fromString.ts +19 -0
- package/node_modules/@tiptap/core/src/utilities/index.ts +26 -0
- package/node_modules/@tiptap/core/src/utilities/isAndroid.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isEmptyObject.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isFirefox.ts +11 -0
- package/node_modules/@tiptap/core/src/utilities/isFunction.ts +4 -0
- package/node_modules/@tiptap/core/src/utilities/isMacOS.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isNumber.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isPlainObject.ts +13 -0
- package/node_modules/@tiptap/core/src/utilities/isRegExp.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isSafari.ts +11 -0
- package/node_modules/@tiptap/core/src/utilities/isString.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isiOS.ts +7 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/attributeUtils.ts +130 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/createAtomBlockMarkdownSpec.ts +141 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/createBlockMarkdownSpec.ts +225 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/createInlineMarkdownSpec.ts +282 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/index.ts +13 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/parseIndentedBlocks.ts +194 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/renderNestedMarkdownContent.ts +96 -0
- package/node_modules/@tiptap/core/src/utilities/mergeAttributes.ts +109 -0
- package/node_modules/@tiptap/core/src/utilities/mergeDeep.ts +17 -0
- package/node_modules/@tiptap/core/src/utilities/minMax.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/objectIncludes.ts +30 -0
- package/node_modules/@tiptap/core/src/utilities/removeDuplicates.ts +13 -0
- package/node_modules/@tiptap/extension-bubble-menu/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-bubble-menu/README.md +18 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs +462 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts +169 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts +169 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js +443 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-bubble-menu/package.json +54 -0
- package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu-plugin.ts +650 -0
- package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu.ts +50 -0
- package/node_modules/@tiptap/extension-bubble-menu/src/index.ts +6 -0
- package/node_modules/@tiptap/extension-floating-menu/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-floating-menu/README.md +18 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs +380 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts +179 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts +179 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js +361 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-floating-menu/package.json +53 -0
- package/node_modules/@tiptap/extension-floating-menu/src/floating-menu-plugin.ts +525 -0
- package/node_modules/@tiptap/extension-floating-menu/src/floating-menu.ts +77 -0
- package/node_modules/@tiptap/extension-floating-menu/src/index.ts +6 -0
- package/node_modules/@tiptap/extension-mention/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-mention/README.md +18 -0
- package/node_modules/@tiptap/extension-mention/dist/index.cjs +277 -0
- package/node_modules/@tiptap/extension-mention/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-mention/dist/index.d.cts +93 -0
- package/node_modules/@tiptap/extension-mention/dist/index.d.ts +93 -0
- package/node_modules/@tiptap/extension-mention/dist/index.js +250 -0
- package/node_modules/@tiptap/extension-mention/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-mention/package.json +52 -0
- package/node_modules/@tiptap/extension-mention/src/index.ts +5 -0
- package/node_modules/@tiptap/extension-mention/src/mention.ts +357 -0
- package/node_modules/@tiptap/extension-mention/src/utils/get-default-suggestion-attributes.ts +89 -0
- package/node_modules/@tiptap/pm/LICENSE.md +21 -0
- package/node_modules/@tiptap/pm/README.md +22 -0
- package/node_modules/@tiptap/pm/changeset/index.ts +1 -0
- package/node_modules/@tiptap/pm/collab/index.ts +1 -0
- package/node_modules/@tiptap/pm/commands/index.ts +1 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.d.cts +18 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.d.ts +18 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/collab/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/collab/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/collab/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/collab/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/commands/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/commands/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/commands/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/commands/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/history/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/history/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/history/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/history/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/menu/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/menu/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/menu/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/menu/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/model/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/model/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/model/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/model/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/state/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/state/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/state/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/state/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/tables/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/tables/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/tables/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/tables/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/transform/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/transform/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/transform/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/transform/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/view/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/view/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/view/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/view/index.js +2 -0
- package/node_modules/@tiptap/pm/dropcursor/index.ts +1 -0
- package/node_modules/@tiptap/pm/gapcursor/index.ts +1 -0
- package/node_modules/@tiptap/pm/history/index.ts +1 -0
- package/node_modules/@tiptap/pm/inputrules/index.ts +1 -0
- package/node_modules/@tiptap/pm/keymap/index.ts +1 -0
- package/node_modules/@tiptap/pm/markdown/index.ts +1 -0
- package/node_modules/@tiptap/pm/menu/index.ts +1 -0
- package/node_modules/@tiptap/pm/model/index.ts +1 -0
- package/node_modules/@tiptap/pm/package.json +211 -0
- package/node_modules/@tiptap/pm/schema-basic/index.ts +1 -0
- package/node_modules/@tiptap/pm/schema-list/index.ts +1 -0
- package/node_modules/@tiptap/pm/state/index.ts +1 -0
- package/node_modules/@tiptap/pm/tables/index.ts +1 -0
- package/node_modules/@tiptap/pm/trailing-node/index.ts +1 -0
- package/node_modules/@tiptap/pm/transform/index.ts +1 -0
- package/node_modules/@tiptap/pm/view/index.ts +1 -0
- package/node_modules/@tiptap/react/LICENSE.md +21 -0
- package/node_modules/@tiptap/react/README.md +18 -0
- package/node_modules/@tiptap/react/dist/index.cjs +1195 -0
- package/node_modules/@tiptap/react/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/react/dist/index.d.cts +534 -0
- package/node_modules/@tiptap/react/dist/index.d.ts +534 -0
- package/node_modules/@tiptap/react/dist/index.js +1131 -0
- package/node_modules/@tiptap/react/dist/index.js.map +1 -0
- package/node_modules/@tiptap/react/dist/menus/index.cjs +499 -0
- package/node_modules/@tiptap/react/dist/menus/index.cjs.map +1 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.cts +19 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.ts +19 -0
- package/node_modules/@tiptap/react/dist/menus/index.js +461 -0
- package/node_modules/@tiptap/react/dist/menus/index.js.map +1 -0
- package/node_modules/@tiptap/react/package.json +76 -0
- package/node_modules/@tiptap/react/src/Context.tsx +60 -0
- package/node_modules/@tiptap/react/src/Editor.ts +13 -0
- package/node_modules/@tiptap/react/src/EditorContent.tsx +229 -0
- package/node_modules/@tiptap/react/src/NodeViewContent.tsx +30 -0
- package/node_modules/@tiptap/react/src/NodeViewWrapper.tsx +27 -0
- package/node_modules/@tiptap/react/src/ReactMarkViewRenderer.tsx +106 -0
- package/node_modules/@tiptap/react/src/ReactNodeViewRenderer.tsx +387 -0
- package/node_modules/@tiptap/react/src/ReactRenderer.tsx +282 -0
- package/node_modules/@tiptap/react/src/Tiptap.tsx +224 -0
- package/node_modules/@tiptap/react/src/index.ts +13 -0
- package/node_modules/@tiptap/react/src/menus/BubbleMenu.spec.ts +174 -0
- package/node_modules/@tiptap/react/src/menus/BubbleMenu.tsx +153 -0
- package/node_modules/@tiptap/react/src/menus/FloatingMenu.spec.ts +164 -0
- package/node_modules/@tiptap/react/src/menus/FloatingMenu.tsx +137 -0
- package/node_modules/@tiptap/react/src/menus/getAutoPluginKey.ts +5 -0
- package/node_modules/@tiptap/react/src/menus/index.ts +2 -0
- package/node_modules/@tiptap/react/src/menus/useMenuElementProps.ts +354 -0
- package/node_modules/@tiptap/react/src/types.ts +6 -0
- package/node_modules/@tiptap/react/src/useEditor.ts +382 -0
- package/node_modules/@tiptap/react/src/useEditorState.ts +173 -0
- package/node_modules/@tiptap/react/src/useReactNodeView.ts +28 -0
- package/node_modules/@tiptap/suggestion/LICENSE.md +21 -0
- package/node_modules/@tiptap/suggestion/README.md +18 -0
- package/node_modules/@tiptap/suggestion/dist/index.cjs +369 -0
- package/node_modules/@tiptap/suggestion/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.cts +213 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.ts +213 -0
- package/node_modules/@tiptap/suggestion/dist/index.js +339 -0
- package/node_modules/@tiptap/suggestion/dist/index.js.map +1 -0
- package/node_modules/@tiptap/suggestion/package.json +50 -0
- package/node_modules/@tiptap/suggestion/src/__tests__/suggestion.test.ts +127 -0
- package/node_modules/@tiptap/suggestion/src/findSuggestionMatch.ts +79 -0
- package/node_modules/@tiptap/suggestion/src/index.ts +8 -0
- package/node_modules/@tiptap/suggestion/src/suggestion.ts +585 -0
- package/node_modules/@types/linkify-it/LICENSE +21 -0
- package/node_modules/@types/linkify-it/README.md +15 -0
- package/node_modules/@types/linkify-it/build/index.cjs.d.ts +178 -0
- package/node_modules/@types/linkify-it/index.d.mts +174 -0
- package/node_modules/@types/linkify-it/index.d.ts +3 -0
- package/node_modules/@types/linkify-it/package.json +50 -0
- package/node_modules/@types/markdown-it/LICENSE +21 -0
- package/node_modules/@types/markdown-it/README.md +15 -0
- package/node_modules/@types/markdown-it/dist/index.cjs.d.ts +1236 -0
- package/node_modules/@types/markdown-it/dist/markdown-it.d.ts +5 -0
- package/node_modules/@types/markdown-it/dist/markdown-it.min.d.ts +5 -0
- package/node_modules/@types/markdown-it/index.d.mts +1 -0
- package/node_modules/@types/markdown-it/index.d.ts +3 -0
- package/node_modules/@types/markdown-it/lib/common/html_blocks.d.mts +7 -0
- package/node_modules/@types/markdown-it/lib/common/html_re.d.mts +2 -0
- package/node_modules/@types/markdown-it/lib/common/utils.d.mts +62 -0
- package/node_modules/@types/markdown-it/lib/helpers/index.d.mts +5 -0
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.mts +7 -0
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.mts +3 -0
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.mts +29 -0
- package/node_modules/@types/markdown-it/lib/index.d.mts +404 -0
- package/node_modules/@types/markdown-it/lib/parser_block.d.mts +25 -0
- package/node_modules/@types/markdown-it/lib/parser_core.d.mts +18 -0
- package/node_modules/@types/markdown-it/lib/parser_inline.d.mts +38 -0
- package/node_modules/@types/markdown-it/lib/renderer.d.mts +96 -0
- package/node_modules/@types/markdown-it/lib/ruler.d.mts +158 -0
- package/node_modules/@types/markdown-it/lib/rules_block/state_block.d.mts +124 -0
- package/node_modules/@types/markdown-it/lib/rules_core/state_core.d.mts +18 -0
- package/node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.mts +73 -0
- package/node_modules/@types/markdown-it/lib/token.d.mts +108 -0
- package/node_modules/@types/markdown-it/package.json +54 -0
- package/node_modules/@types/mdurl/LICENSE +21 -0
- package/node_modules/@types/mdurl/README.md +15 -0
- package/node_modules/@types/mdurl/build/index.cjs.d.ts +52 -0
- package/node_modules/@types/mdurl/index.d.mts +6 -0
- package/node_modules/@types/mdurl/index.d.ts +3 -0
- package/node_modules/@types/mdurl/lib/decode.d.mts +10 -0
- package/node_modules/@types/mdurl/lib/encode.d.mts +15 -0
- package/node_modules/@types/mdurl/lib/format.d.mts +3 -0
- package/node_modules/@types/mdurl/lib/parse.d.mts +18 -0
- package/node_modules/@types/mdurl/package.json +36 -0
- package/node_modules/@types/use-sync-external-store/LICENSE +21 -0
- package/node_modules/@types/use-sync-external-store/README.md +15 -0
- package/node_modules/@types/use-sync-external-store/index.d.ts +5 -0
- package/node_modules/@types/use-sync-external-store/package.json +30 -0
- package/node_modules/@types/use-sync-external-store/shim/index.d.ts +1 -0
- package/node_modules/@types/use-sync-external-store/shim/with-selector.d.ts +1 -0
- package/node_modules/@types/use-sync-external-store/with-selector.d.ts +7 -0
- package/node_modules/argparse/LICENSE +254 -0
- package/node_modules/argparse/README.md +84 -0
- package/node_modules/argparse/argparse.js +3707 -0
- package/node_modules/argparse/lib/sub.js +67 -0
- package/node_modules/argparse/lib/textwrap.js +440 -0
- package/node_modules/argparse/package.json +31 -0
- package/node_modules/crelt/LICENSE +19 -0
- package/node_modules/crelt/README.md +23 -0
- package/node_modules/crelt/dist/index.cjs +31 -0
- package/node_modules/crelt/dist/index.d.cts +4 -0
- package/node_modules/crelt/index.d.ts +4 -0
- package/node_modules/crelt/index.js +28 -0
- package/node_modules/crelt/package.json +35 -0
- package/node_modules/crelt/rollup.config.js +13 -0
- package/node_modules/entities/LICENSE +11 -0
- package/node_modules/entities/lib/decode.d.ts +211 -0
- package/node_modules/entities/lib/decode.d.ts.map +1 -0
- package/node_modules/entities/lib/decode.js +536 -0
- package/node_modules/entities/lib/decode.js.map +1 -0
- package/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
- package/node_modules/entities/lib/decode_codepoint.d.ts.map +1 -0
- package/node_modules/entities/lib/decode_codepoint.js +76 -0
- package/node_modules/entities/lib/decode_codepoint.js.map +1 -0
- package/node_modules/entities/lib/encode.d.ts +22 -0
- package/node_modules/entities/lib/encode.d.ts.map +1 -0
- package/node_modules/entities/lib/encode.js +77 -0
- package/node_modules/entities/lib/encode.js.map +1 -0
- package/node_modules/entities/lib/escape.d.ts +43 -0
- package/node_modules/entities/lib/escape.d.ts.map +1 -0
- package/node_modules/entities/lib/escape.js +122 -0
- package/node_modules/entities/lib/escape.js.map +1 -0
- package/node_modules/entities/lib/esm/decode.d.ts +211 -0
- package/node_modules/entities/lib/esm/decode.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/decode.js +496 -0
- package/node_modules/entities/lib/esm/decode.js.map +1 -0
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/decode_codepoint.js +71 -0
- package/node_modules/entities/lib/esm/decode_codepoint.js.map +1 -0
- package/node_modules/entities/lib/esm/encode.d.ts +22 -0
- package/node_modules/entities/lib/esm/encode.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/encode.js +69 -0
- package/node_modules/entities/lib/esm/encode.js.map +1 -0
- package/node_modules/entities/lib/esm/escape.d.ts +43 -0
- package/node_modules/entities/lib/esm/escape.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/escape.js +116 -0
- package/node_modules/entities/lib/esm/escape.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.js +7 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js +7 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/encode-html.js +10 -0
- package/node_modules/entities/lib/esm/generated/encode-html.js.map +1 -0
- package/node_modules/entities/lib/esm/index.d.ts +96 -0
- package/node_modules/entities/lib/esm/index.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/index.js +99 -0
- package/node_modules/entities/lib/esm/index.js.map +1 -0
- package/node_modules/entities/lib/esm/package.json +1 -0
- package/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
- package/node_modules/entities/lib/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-html.js +9 -0
- package/node_modules/entities/lib/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
- package/node_modules/entities/lib/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/lib/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/encode-html.js +12 -0
- package/node_modules/entities/lib/generated/encode-html.js.map +1 -0
- package/node_modules/entities/lib/index.d.ts +96 -0
- package/node_modules/entities/lib/index.d.ts.map +1 -0
- package/node_modules/entities/lib/index.js +126 -0
- package/node_modules/entities/lib/index.js.map +1 -0
- package/node_modules/entities/package.json +90 -0
- package/node_modules/entities/readme.md +122 -0
- package/node_modules/escape-string-regexp/index.d.ts +18 -0
- package/node_modules/escape-string-regexp/index.js +13 -0
- package/node_modules/escape-string-regexp/license +9 -0
- package/node_modules/escape-string-regexp/package.json +38 -0
- package/node_modules/escape-string-regexp/readme.md +34 -0
- package/node_modules/fast-equals/LICENSE +21 -0
- package/node_modules/fast-equals/README.md +477 -0
- package/node_modules/fast-equals/dist/cjs/comparator.d.cts +60 -0
- package/node_modules/fast-equals/dist/cjs/equals.d.cts +62 -0
- package/node_modules/fast-equals/dist/cjs/index.cjs +653 -0
- package/node_modules/fast-equals/dist/cjs/index.cjs.map +1 -0
- package/node_modules/fast-equals/dist/cjs/index.d.cts +66 -0
- package/node_modules/fast-equals/dist/cjs/internalTypes.d.cts +178 -0
- package/node_modules/fast-equals/dist/cjs/utils.d.cts +33 -0
- package/node_modules/fast-equals/dist/es/comparator.d.mts +60 -0
- package/node_modules/fast-equals/dist/es/equals.d.mts +62 -0
- package/node_modules/fast-equals/dist/es/index.d.mts +66 -0
- package/node_modules/fast-equals/dist/es/index.mjs +642 -0
- package/node_modules/fast-equals/dist/es/index.mjs.map +1 -0
- package/node_modules/fast-equals/dist/es/internalTypes.d.mts +178 -0
- package/node_modules/fast-equals/dist/es/utils.d.mts +33 -0
- package/node_modules/fast-equals/dist/umd/comparator.d.ts +26 -0
- package/node_modules/fast-equals/dist/umd/equals.d.ts +62 -0
- package/node_modules/fast-equals/dist/umd/index.d.ts +47 -0
- package/node_modules/fast-equals/dist/umd/index.js +659 -0
- package/node_modules/fast-equals/dist/umd/index.js.map +1 -0
- package/node_modules/fast-equals/dist/umd/internalTypes.d.ts +159 -0
- package/node_modules/fast-equals/dist/umd/utils.d.ts +28 -0
- package/node_modules/fast-equals/index.d.ts +260 -0
- package/node_modules/fast-equals/package.json +113 -0
- package/node_modules/linkify-it/LICENSE +22 -0
- package/node_modules/linkify-it/README.md +196 -0
- package/node_modules/linkify-it/build/index.cjs.js +832 -0
- package/node_modules/linkify-it/index.mjs +642 -0
- package/node_modules/linkify-it/lib/re.mjs +189 -0
- package/node_modules/linkify-it/package.json +58 -0
- package/node_modules/markdown-it/LICENSE +22 -0
- package/node_modules/markdown-it/README.md +324 -0
- package/node_modules/markdown-it/bin/markdown-it.mjs +107 -0
- package/node_modules/markdown-it/dist/index.cjs.js +5547 -0
- package/node_modules/markdown-it/dist/markdown-it.js +6969 -0
- package/node_modules/markdown-it/dist/markdown-it.min.js +2 -0
- package/node_modules/markdown-it/index.mjs +1 -0
- package/node_modules/markdown-it/lib/common/html_blocks.mjs +67 -0
- package/node_modules/markdown-it/lib/common/html_re.mjs +25 -0
- package/node_modules/markdown-it/lib/common/utils.mjs +304 -0
- package/node_modules/markdown-it/lib/helpers/index.mjs +11 -0
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +77 -0
- package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +49 -0
- package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +66 -0
- package/node_modules/markdown-it/lib/index.mjs +565 -0
- package/node_modules/markdown-it/lib/parser_block.mjs +134 -0
- package/node_modules/markdown-it/lib/parser_core.mjs +62 -0
- package/node_modules/markdown-it/lib/parser_inline.mjs +197 -0
- package/node_modules/markdown-it/lib/presets/commonmark.mjs +88 -0
- package/node_modules/markdown-it/lib/presets/default.mjs +47 -0
- package/node_modules/markdown-it/lib/presets/zero.mjs +70 -0
- package/node_modules/markdown-it/lib/renderer.mjs +322 -0
- package/node_modules/markdown-it/lib/ruler.mjs +340 -0
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +209 -0
- package/node_modules/markdown-it/lib/rules_block/code.mjs +30 -0
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +94 -0
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +51 -0
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +40 -0
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +69 -0
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +82 -0
- package/node_modules/markdown-it/lib/rules_block/list.mjs +331 -0
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +46 -0
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +212 -0
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +220 -0
- package/node_modules/markdown-it/lib/rules_block/table.mjs +228 -0
- package/node_modules/markdown-it/lib/rules_core/block.mjs +13 -0
- package/node_modules/markdown-it/lib/rules_core/inline.mjs +11 -0
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +134 -0
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +17 -0
- package/node_modules/markdown-it/lib/rules_core/replacements.mjs +101 -0
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +193 -0
- package/node_modules/markdown-it/lib/rules_core/state_core.mjs +17 -0
- package/node_modules/markdown-it/lib/rules_core/text_join.mjs +43 -0
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +72 -0
- package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +60 -0
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +124 -0
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +123 -0
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +51 -0
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +69 -0
- package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +38 -0
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +50 -0
- package/node_modules/markdown-it/lib/rules_inline/image.mjs +138 -0
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +139 -0
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +63 -0
- package/node_modules/markdown-it/lib/rules_inline/newline.mjs +42 -0
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +123 -0
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +127 -0
- package/node_modules/markdown-it/lib/rules_inline/text.mjs +86 -0
- package/node_modules/markdown-it/lib/token.mjs +191 -0
- package/node_modules/markdown-it/package.json +92 -0
- package/node_modules/mdurl/LICENSE +45 -0
- package/node_modules/mdurl/README.md +102 -0
- package/node_modules/mdurl/build/index.cjs.js +534 -0
- package/node_modules/mdurl/index.mjs +11 -0
- package/node_modules/mdurl/lib/decode.mjs +112 -0
- package/node_modules/mdurl/lib/encode.mjs +89 -0
- package/node_modules/mdurl/lib/format.mjs +21 -0
- package/node_modules/mdurl/lib/parse.mjs +308 -0
- package/node_modules/mdurl/package.json +37 -0
- package/node_modules/orderedmap/LICENSE +19 -0
- package/node_modules/orderedmap/README.md +69 -0
- package/node_modules/orderedmap/dist/index.cjs +139 -0
- package/node_modules/orderedmap/dist/index.d.cts +33 -0
- package/node_modules/orderedmap/dist/index.d.ts +33 -0
- package/node_modules/orderedmap/dist/index.js +137 -0
- package/node_modules/orderedmap/package.json +39 -0
- package/node_modules/prosemirror-changeset/CHANGELOG.md +147 -0
- package/node_modules/prosemirror-changeset/LICENSE +19 -0
- package/node_modules/prosemirror-changeset/README.md +175 -0
- package/node_modules/prosemirror-changeset/dist/index.cjs +585 -0
- package/node_modules/prosemirror-changeset/dist/index.d.cts +186 -0
- package/node_modules/prosemirror-changeset/dist/index.d.ts +186 -0
- package/node_modules/prosemirror-changeset/dist/index.js +715 -0
- package/node_modules/prosemirror-changeset/package.json +40 -0
- package/node_modules/prosemirror-changeset/src/README.md +32 -0
- package/node_modules/prosemirror-changeset/src/change.ts +189 -0
- package/node_modules/prosemirror-changeset/src/changeset.ts +212 -0
- package/node_modules/prosemirror-changeset/src/diff.ts +151 -0
- package/node_modules/prosemirror-changeset/src/simplify.ts +132 -0
- package/node_modules/prosemirror-changeset/test/test-changed-range.ts +48 -0
- package/node_modules/prosemirror-changeset/test/test-changes.ts +211 -0
- package/node_modules/prosemirror-changeset/test/test-diff.ts +69 -0
- package/node_modules/prosemirror-changeset/test/test-merge.ts +56 -0
- package/node_modules/prosemirror-changeset/test/test-simplify.ts +71 -0
- package/node_modules/prosemirror-collab/.tern-project +8 -0
- package/node_modules/prosemirror-collab/CHANGELOG.md +77 -0
- package/node_modules/prosemirror-collab/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-collab/LICENSE +19 -0
- package/node_modules/prosemirror-collab/README.md +28 -0
- package/node_modules/prosemirror-collab/dist/index.cjs +155 -0
- package/node_modules/prosemirror-collab/dist/index.d.cts +60 -0
- package/node_modules/prosemirror-collab/dist/index.d.ts +60 -0
- package/node_modules/prosemirror-collab/dist/index.js +156 -0
- package/node_modules/prosemirror-collab/package.json +40 -0
- package/node_modules/prosemirror-collab/src/README.md +11 -0
- package/node_modules/prosemirror-collab/src/collab.ts +184 -0
- package/node_modules/prosemirror-commands/.tern-project +8 -0
- package/node_modules/prosemirror-commands/CHANGELOG.md +322 -0
- package/node_modules/prosemirror-commands/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-commands/LICENSE +19 -0
- package/node_modules/prosemirror-commands/README.md +28 -0
- package/node_modules/prosemirror-commands/dist/index.cjs +687 -0
- package/node_modules/prosemirror-commands/dist/index.d.cts +215 -0
- package/node_modules/prosemirror-commands/dist/index.d.ts +215 -0
- package/node_modules/prosemirror-commands/dist/index.js +850 -0
- package/node_modules/prosemirror-commands/package.json +39 -0
- package/node_modules/prosemirror-commands/src/README.md +40 -0
- package/node_modules/prosemirror-commands/src/commands.ts +783 -0
- package/node_modules/prosemirror-dropcursor/CHANGELOG.md +137 -0
- package/node_modules/prosemirror-dropcursor/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-dropcursor/LICENSE +19 -0
- package/node_modules/prosemirror-dropcursor/README.md +50 -0
- package/node_modules/prosemirror-dropcursor/dist/index.cjs +185 -0
- package/node_modules/prosemirror-dropcursor/dist/index.d.cts +38 -0
- package/node_modules/prosemirror-dropcursor/dist/index.d.ts +38 -0
- package/node_modules/prosemirror-dropcursor/dist/index.js +146 -0
- package/node_modules/prosemirror-dropcursor/package.json +38 -0
- package/node_modules/prosemirror-dropcursor/src/dropcursor.ts +170 -0
- package/node_modules/prosemirror-gapcursor/CHANGELOG.md +122 -0
- package/node_modules/prosemirror-gapcursor/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-gapcursor/LICENSE +19 -0
- package/node_modules/prosemirror-gapcursor/README.md +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.cjs +239 -0
- package/node_modules/prosemirror-gapcursor/dist/index.d.cts +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.d.ts +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.js +239 -0
- package/node_modules/prosemirror-gapcursor/package.json +43 -0
- package/node_modules/prosemirror-gapcursor/src/README.md +21 -0
- package/node_modules/prosemirror-gapcursor/src/gapcursor.ts +141 -0
- package/node_modules/prosemirror-gapcursor/src/index.ts +91 -0
- package/node_modules/prosemirror-gapcursor/style/gapcursor.css +25 -0
- package/node_modules/prosemirror-history/.tern-project +8 -0
- package/node_modules/prosemirror-history/CHANGELOG.md +170 -0
- package/node_modules/prosemirror-history/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-history/LICENSE +19 -0
- package/node_modules/prosemirror-history/README.md +27 -0
- package/node_modules/prosemirror-history/dist/index.cjs +382 -0
- package/node_modules/prosemirror-history/dist/index.d.cts +64 -0
- package/node_modules/prosemirror-history/dist/index.d.ts +64 -0
- package/node_modules/prosemirror-history/dist/index.js +453 -0
- package/node_modules/prosemirror-history/package.json +40 -0
- package/node_modules/prosemirror-history/src/README.md +23 -0
- package/node_modules/prosemirror-history/src/history.ts +465 -0
- package/node_modules/prosemirror-inputrules/.tern-project +8 -0
- package/node_modules/prosemirror-inputrules/CHANGELOG.md +127 -0
- package/node_modules/prosemirror-inputrules/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-inputrules/LICENSE +19 -0
- package/node_modules/prosemirror-inputrules/README.md +29 -0
- package/node_modules/prosemirror-inputrules/dist/index.cjs +194 -0
- package/node_modules/prosemirror-inputrules/dist/index.d.cts +131 -0
- package/node_modules/prosemirror-inputrules/dist/index.d.ts +131 -0
- package/node_modules/prosemirror-inputrules/dist/index.js +239 -0
- package/node_modules/prosemirror-inputrules/package.json +36 -0
- package/node_modules/prosemirror-inputrules/src/README.md +23 -0
- package/node_modules/prosemirror-inputrules/src/index.ts +4 -0
- package/node_modules/prosemirror-inputrules/src/inputrules.ts +167 -0
- package/node_modules/prosemirror-inputrules/src/rulebuilders.ts +59 -0
- package/node_modules/prosemirror-inputrules/src/rules.ts +17 -0
- package/node_modules/prosemirror-keymap/.tern-project +8 -0
- package/node_modules/prosemirror-keymap/CHANGELOG.md +104 -0
- package/node_modules/prosemirror-keymap/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-keymap/LICENSE +19 -0
- package/node_modules/prosemirror-keymap/README.md +27 -0
- package/node_modules/prosemirror-keymap/dist/index.cjs +65 -0
- package/node_modules/prosemirror-keymap/dist/index.d.cts +47 -0
- package/node_modules/prosemirror-keymap/dist/index.d.ts +47 -0
- package/node_modules/prosemirror-keymap/dist/index.js +128 -0
- package/node_modules/prosemirror-keymap/package.json +38 -0
- package/node_modules/prosemirror-keymap/src/README.md +5 -0
- package/node_modules/prosemirror-keymap/src/keymap.ts +105 -0
- package/node_modules/prosemirror-markdown/.tern-project +8 -0
- package/node_modules/prosemirror-markdown/CHANGELOG.md +311 -0
- package/node_modules/prosemirror-markdown/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-markdown/LICENSE +19 -0
- package/node_modules/prosemirror-markdown/README.md +276 -0
- package/node_modules/prosemirror-markdown/dist/index.cjs +966 -0
- package/node_modules/prosemirror-markdown/dist/index.d.cts +335 -0
- package/node_modules/prosemirror-markdown/dist/index.d.ts +335 -0
- package/node_modules/prosemirror-markdown/dist/index.js +878 -0
- package/node_modules/prosemirror-markdown/package.json +40 -0
- package/node_modules/prosemirror-markdown/src/README.md +42 -0
- package/node_modules/prosemirror-markdown/src/from_markdown.ts +272 -0
- package/node_modules/prosemirror-markdown/src/index.ts +5 -0
- package/node_modules/prosemirror-markdown/src/schema.ts +156 -0
- package/node_modules/prosemirror-markdown/src/to_markdown.ts +483 -0
- package/node_modules/prosemirror-menu/.tern-project +8 -0
- package/node_modules/prosemirror-menu/CHANGELOG.md +107 -0
- package/node_modules/prosemirror-menu/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-menu/LICENSE +19 -0
- package/node_modules/prosemirror-menu/README.md +235 -0
- package/node_modules/prosemirror-menu/dist/index.cjs +798 -0
- package/node_modules/prosemirror-menu/dist/index.d.cts +281 -0
- package/node_modules/prosemirror-menu/dist/index.d.ts +281 -0
- package/node_modules/prosemirror-menu/dist/index.js +795 -0
- package/node_modules/prosemirror-menu/package.json +42 -0
- package/node_modules/prosemirror-menu/src/README.md +60 -0
- package/node_modules/prosemirror-menu/src/icons.ts +53 -0
- package/node_modules/prosemirror-menu/src/index.ts +4 -0
- package/node_modules/prosemirror-menu/src/menu.ts +628 -0
- package/node_modules/prosemirror-menu/src/menubar.ts +210 -0
- package/node_modules/prosemirror-menu/style/menu.css +169 -0
- package/node_modules/prosemirror-model/.tern-project +8 -0
- package/node_modules/prosemirror-model/CHANGELOG.md +730 -0
- package/node_modules/prosemirror-model/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-model/LICENSE +19 -0
- package/node_modules/prosemirror-model/README.md +29 -0
- package/node_modules/prosemirror-model/dist/index.cjs +2898 -0
- package/node_modules/prosemirror-model/dist/index.d.cts +1679 -0
- package/node_modules/prosemirror-model/dist/index.d.ts +1679 -0
- package/node_modules/prosemirror-model/dist/index.js +3464 -0
- package/node_modules/prosemirror-model/package.json +38 -0
- package/node_modules/prosemirror-model/src/README.md +62 -0
- package/node_modules/prosemirror-model/src/comparedeep.ts +15 -0
- package/node_modules/prosemirror-model/src/content.ts +413 -0
- package/node_modules/prosemirror-model/src/diff.ts +52 -0
- package/node_modules/prosemirror-model/src/dom.ts +1 -0
- package/node_modules/prosemirror-model/src/fragment.ts +268 -0
- package/node_modules/prosemirror-model/src/from_dom.ts +848 -0
- package/node_modules/prosemirror-model/src/index.ts +11 -0
- package/node_modules/prosemirror-model/src/mark.ts +111 -0
- package/node_modules/prosemirror-model/src/node.ts +402 -0
- package/node_modules/prosemirror-model/src/replace.ts +225 -0
- package/node_modules/prosemirror-model/src/resolvedpos.ts +289 -0
- package/node_modules/prosemirror-model/src/schema.ts +705 -0
- package/node_modules/prosemirror-model/src/to_dom.ts +238 -0
- package/node_modules/prosemirror-schema-basic/.tern-project +8 -0
- package/node_modules/prosemirror-schema-basic/CHANGELOG.md +81 -0
- package/node_modules/prosemirror-schema-basic/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-schema-basic/LICENSE +19 -0
- package/node_modules/prosemirror-schema-basic/README.md +28 -0
- package/node_modules/prosemirror-schema-basic/dist/index.cjs +246 -0
- package/node_modules/prosemirror-schema-basic/dist/index.d.cts +87 -0
- package/node_modules/prosemirror-schema-basic/dist/index.d.ts +87 -0
- package/node_modules/prosemirror-schema-basic/dist/index.js +183 -0
- package/node_modules/prosemirror-schema-basic/package.json +37 -0
- package/node_modules/prosemirror-schema-basic/src/README.md +8 -0
- package/node_modules/prosemirror-schema-basic/src/schema-basic.ts +166 -0
- package/node_modules/prosemirror-schema-list/.tern-project +8 -0
- package/node_modules/prosemirror-schema-list/CHANGELOG.md +140 -0
- package/node_modules/prosemirror-schema-list/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-schema-list/LICENSE +19 -0
- package/node_modules/prosemirror-schema-list/README.md +28 -0
- package/node_modules/prosemirror-schema-list/dist/index.cjs +253 -0
- package/node_modules/prosemirror-schema-list/dist/index.d.cts +71 -0
- package/node_modules/prosemirror-schema-list/dist/index.d.ts +71 -0
- package/node_modules/prosemirror-schema-list/dist/index.js +289 -0
- package/node_modules/prosemirror-schema-list/package.json +40 -0
- package/node_modules/prosemirror-schema-list/src/README.md +29 -0
- package/node_modules/prosemirror-schema-list/src/schema-list.ts +267 -0
- package/node_modules/prosemirror-state/.tern-project +8 -0
- package/node_modules/prosemirror-state/CHANGELOG.md +296 -0
- package/node_modules/prosemirror-state/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-state/LICENSE +19 -0
- package/node_modules/prosemirror-state/README.md +28 -0
- package/node_modules/prosemirror-state/dist/index.cjs +884 -0
- package/node_modules/prosemirror-state/dist/index.d.cts +709 -0
- package/node_modules/prosemirror-state/dist/index.d.ts +709 -0
- package/node_modules/prosemirror-state/dist/index.js +1002 -0
- package/node_modules/prosemirror-state/package.json +39 -0
- package/node_modules/prosemirror-state/src/README.md +42 -0
- package/node_modules/prosemirror-state/src/index.ts +7 -0
- package/node_modules/prosemirror-state/src/plugin.ts +142 -0
- package/node_modules/prosemirror-state/src/selection.ts +462 -0
- package/node_modules/prosemirror-state/src/state.ts +266 -0
- package/node_modules/prosemirror-state/src/transaction.ts +215 -0
- package/node_modules/prosemirror-tables/LICENSE +19 -0
- package/node_modules/prosemirror-tables/README.md +254 -0
- package/node_modules/prosemirror-tables/dist/index.cjs +2683 -0
- package/node_modules/prosemirror-tables/dist/index.d.cts +751 -0
- package/node_modules/prosemirror-tables/dist/index.d.cts.map +1 -0
- package/node_modules/prosemirror-tables/dist/index.d.ts +751 -0
- package/node_modules/prosemirror-tables/dist/index.d.ts.map +1 -0
- package/node_modules/prosemirror-tables/dist/index.js +2626 -0
- package/node_modules/prosemirror-tables/dist/index.js.map +1 -0
- package/node_modules/prosemirror-tables/package.json +80 -0
- package/node_modules/prosemirror-tables/style/tables.css +48 -0
- package/node_modules/prosemirror-trailing-node/LICENSE +21 -0
- package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.cts +41 -0
- package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.ts +41 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.cjs +70 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.cts +2 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.ts +2 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.js +43 -0
- package/node_modules/prosemirror-trailing-node/dist-types/index.d.ts +2 -0
- package/node_modules/prosemirror-trailing-node/dist-types/trailing-node-plugin.d.ts +33 -0
- package/node_modules/prosemirror-trailing-node/dist-types/tsconfig.tsbuildinfo +1 -0
- package/node_modules/prosemirror-trailing-node/package.json +57 -0
- package/node_modules/prosemirror-trailing-node/readme.md +55 -0
- package/node_modules/prosemirror-transform/.tern-project +8 -0
- package/node_modules/prosemirror-transform/CHANGELOG.md +502 -0
- package/node_modules/prosemirror-transform/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-transform/LICENSE +19 -0
- package/node_modules/prosemirror-transform/README.md +29 -0
- package/node_modules/prosemirror-transform/dist/index.cjs +1888 -0
- package/node_modules/prosemirror-transform/dist/index.d.cts +847 -0
- package/node_modules/prosemirror-transform/dist/index.d.ts +847 -0
- package/node_modules/prosemirror-transform/dist/index.js +2181 -0
- package/node_modules/prosemirror-transform/package.json +37 -0
- package/node_modules/prosemirror-transform/src/README.md +59 -0
- package/node_modules/prosemirror-transform/src/attr_step.ts +98 -0
- package/node_modules/prosemirror-transform/src/index.ts +11 -0
- package/node_modules/prosemirror-transform/src/map.ts +284 -0
- package/node_modules/prosemirror-transform/src/mark.ts +106 -0
- package/node_modules/prosemirror-transform/src/mark_step.ts +224 -0
- package/node_modules/prosemirror-transform/src/replace.ts +460 -0
- package/node_modules/prosemirror-transform/src/replace_step.ts +178 -0
- package/node_modules/prosemirror-transform/src/step.ts +97 -0
- package/node_modules/prosemirror-transform/src/structure.ts +349 -0
- package/node_modules/prosemirror-transform/src/transform.ts +271 -0
- package/node_modules/prosemirror-view/.tern-project +8 -0
- package/node_modules/prosemirror-view/CHANGELOG.md +2447 -0
- package/node_modules/prosemirror-view/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-view/LICENSE +19 -0
- package/node_modules/prosemirror-view/README.md +28 -0
- package/node_modules/prosemirror-view/dist/index.cjs +5381 -0
- package/node_modules/prosemirror-view/dist/index.d.cts +904 -0
- package/node_modules/prosemirror-view/dist/index.d.ts +904 -0
- package/node_modules/prosemirror-view/dist/index.js +5900 -0
- package/node_modules/prosemirror-view/package.json +43 -0
- package/node_modules/prosemirror-view/src/README.md +38 -0
- package/node_modules/prosemirror-view/src/browser.ts +24 -0
- package/node_modules/prosemirror-view/src/capturekeys.ts +345 -0
- package/node_modules/prosemirror-view/src/clipboard.ts +263 -0
- package/node_modules/prosemirror-view/src/decoration.ts +793 -0
- package/node_modules/prosemirror-view/src/dom.ts +159 -0
- package/node_modules/prosemirror-view/src/domchange.ts +383 -0
- package/node_modules/prosemirror-view/src/domcoords.ts +515 -0
- package/node_modules/prosemirror-view/src/domobserver.ts +392 -0
- package/node_modules/prosemirror-view/src/index.ts +825 -0
- package/node_modules/prosemirror-view/src/input.ts +830 -0
- package/node_modules/prosemirror-view/src/selection.ts +216 -0
- package/node_modules/prosemirror-view/src/viewdesc.ts +1590 -0
- package/node_modules/prosemirror-view/style/prosemirror.css +54 -0
- package/node_modules/punycode.js/LICENSE-MIT.txt +20 -0
- package/node_modules/punycode.js/README.md +148 -0
- package/node_modules/punycode.js/package.json +58 -0
- package/node_modules/punycode.js/punycode.es6.js +444 -0
- package/node_modules/punycode.js/punycode.js +443 -0
- package/node_modules/rope-sequence/LICENSE +19 -0
- package/node_modules/rope-sequence/README.md +63 -0
- package/node_modules/rope-sequence/dist/index.cjs +209 -0
- package/node_modules/rope-sequence/dist/index.d.cts +11 -0
- package/node_modules/rope-sequence/dist/index.d.ts +11 -0
- package/node_modules/rope-sequence/dist/index.js +207 -0
- package/node_modules/rope-sequence/index.js +190 -0
- package/node_modules/rope-sequence/package.json +34 -0
- package/node_modules/rope-sequence/test.js +78 -0
- package/node_modules/uc.micro/LICENSE.txt +20 -0
- package/node_modules/uc.micro/README.md +14 -0
- package/node_modules/uc.micro/build/index.cjs.js +20 -0
- package/node_modules/uc.micro/categories/Cc/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/Cf/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/P/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/S/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/Z/regex.mjs +1 -0
- package/node_modules/uc.micro/index.mjs +8 -0
- package/node_modules/uc.micro/package.json +37 -0
- package/node_modules/uc.micro/properties/Any/regex.mjs +1 -0
- package/node_modules/use-sync-external-store/LICENSE +21 -0
- package/node_modules/use-sync-external-store/README.md +5 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +97 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +85 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +95 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +88 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.js +59 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +66 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +96 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +84 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js +27 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.js +13 -0
- package/node_modules/use-sync-external-store/index.js +7 -0
- package/node_modules/use-sync-external-store/package.json +43 -0
- package/node_modules/use-sync-external-store/shim/index.js +7 -0
- package/node_modules/use-sync-external-store/shim/index.native.js +7 -0
- package/node_modules/use-sync-external-store/shim/with-selector.js +7 -0
- package/node_modules/use-sync-external-store/with-selector.js +7 -0
- package/node_modules/w3c-keyname/.tern-port +1 -0
- package/node_modules/w3c-keyname/LICENSE +19 -0
- package/node_modules/w3c-keyname/README.md +18 -0
- package/node_modules/w3c-keyname/index.cjs +127 -0
- package/node_modules/w3c-keyname/index.d.cts +5 -0
- package/node_modules/w3c-keyname/index.d.ts +5 -0
- package/node_modules/w3c-keyname/index.js +119 -0
- package/node_modules/w3c-keyname/package.json +37 -0
- package/package.json +124 -3
- package/public-api.md +3 -4
- package/dist/chat/tool-renderers/KbSearchRenderer.d.ts +0 -2
- package/dist/chat/tool-renderers/kb-search-result.d.ts +0 -19
- package/dist/chunk-7IPINZHT.js +0 -258
- package/dist/chunk-7IPINZHT.js.map +0 -1
- package/dist/chunk-T5WGKZN4.js.map +0 -1
- package/dist/chunk-XULCQP3Q.js.map +0 -1
- package/dist/lib/agent-computer-command.d.ts +0 -34
- package/dist/rich-input/extensions/kb-mention.d.ts +0 -18
- package/dist/rich-input/extensions/workflow-mention.d.ts +0 -10
- package/dist/rich-input/lib/kb-suggestions.d.ts +0 -37
package/dist/rich-input.js
CHANGED
|
@@ -3,7 +3,44 @@ import {
|
|
|
3
3
|
PluginTriggerStack,
|
|
4
4
|
selectionFromItem,
|
|
5
5
|
triggerSummary
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NPIUZZET.js";
|
|
7
|
+
import {
|
|
8
|
+
MODEL_REASONING_LEVELS_KEY,
|
|
9
|
+
PREFERRED_MODEL_KEY,
|
|
10
|
+
RichInputServicesProvider,
|
|
11
|
+
chatTone,
|
|
12
|
+
fetchClientQuery,
|
|
13
|
+
getInputHistoryGeneration,
|
|
14
|
+
getPluginSuggestionItems,
|
|
15
|
+
isQueueShortcut,
|
|
16
|
+
onInputCachesReset,
|
|
17
|
+
pluginRefsForSend,
|
|
18
|
+
queueShortcutLabel,
|
|
19
|
+
refreshClientQuery,
|
|
20
|
+
refreshClientSessionSkills,
|
|
21
|
+
sendToSession,
|
|
22
|
+
setClientQueryData,
|
|
23
|
+
useBackgroundTaskList,
|
|
24
|
+
useClientBackgroundTasks,
|
|
25
|
+
useClientContextStats,
|
|
26
|
+
useClientModelCatalog,
|
|
27
|
+
useClientModelPreferences,
|
|
28
|
+
useClientQuery,
|
|
29
|
+
useClientSessionModel,
|
|
30
|
+
useClientSessionSkills,
|
|
31
|
+
useClientSkillStats,
|
|
32
|
+
useComposerConnection,
|
|
33
|
+
useComposerConnectionInfo,
|
|
34
|
+
useContextStats,
|
|
35
|
+
useEffectEvent,
|
|
36
|
+
useModelCatalog,
|
|
37
|
+
useModelPreferences,
|
|
38
|
+
useRefreshWhenRunEnds,
|
|
39
|
+
useRichInputServices,
|
|
40
|
+
useSessionDataInvalidation,
|
|
41
|
+
useSessionSkills,
|
|
42
|
+
useSkillStats
|
|
43
|
+
} from "./chunk-YP64AL24.js";
|
|
7
44
|
import {
|
|
8
45
|
Archive,
|
|
9
46
|
BookOpen,
|
|
@@ -34,32 +71,29 @@ import {
|
|
|
34
71
|
Play,
|
|
35
72
|
Plug,
|
|
36
73
|
Plus,
|
|
37
|
-
RefreshCw,
|
|
38
74
|
Rocket,
|
|
39
75
|
RotateCcw,
|
|
40
76
|
Scissors,
|
|
77
|
+
Search,
|
|
41
78
|
Send,
|
|
42
79
|
Share2,
|
|
43
80
|
Sparkles,
|
|
44
81
|
Square,
|
|
45
82
|
Terminal,
|
|
46
83
|
X,
|
|
47
|
-
chatTone,
|
|
48
84
|
cn,
|
|
49
85
|
cn2,
|
|
50
86
|
dist_exports2 as dist_exports,
|
|
51
87
|
notifyChat,
|
|
52
|
-
sendToSession,
|
|
53
88
|
useBladeClient,
|
|
54
89
|
useChatEnvironment,
|
|
55
90
|
useChatRenderMode,
|
|
56
91
|
useChatSessionDetail,
|
|
57
92
|
useCurrentChatSessionId,
|
|
58
|
-
useEffectEvent,
|
|
59
93
|
usePortalContainer,
|
|
60
94
|
useSessionHandle,
|
|
61
|
-
|
|
62
|
-
} from "./chunk-
|
|
95
|
+
useSessionSource
|
|
96
|
+
} from "./chunk-VUDRKCD4.js";
|
|
63
97
|
import {
|
|
64
98
|
__commonJS,
|
|
65
99
|
__require,
|
|
@@ -85,11 +119,11 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
85
119
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
86
120
|
), didWarnUncachedGetSnapshot = true);
|
|
87
121
|
}
|
|
88
|
-
cachedValue =
|
|
122
|
+
cachedValue = useState13({
|
|
89
123
|
inst: { value, getSnapshot }
|
|
90
124
|
});
|
|
91
125
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
92
|
-
|
|
126
|
+
useLayoutEffect3(
|
|
93
127
|
function() {
|
|
94
128
|
inst.value = value;
|
|
95
129
|
inst.getSnapshot = getSnapshot;
|
|
@@ -123,7 +157,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
123
157
|
return getSnapshot();
|
|
124
158
|
}
|
|
125
159
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
126
|
-
var React2 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
160
|
+
var React2 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState13 = React2.useState, useEffect10 = React2.useEffect, useLayoutEffect3 = React2.useLayoutEffect, useDebugValue3 = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
127
161
|
exports.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim;
|
|
128
162
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
129
163
|
})();
|
|
@@ -151,14 +185,14 @@ var require_with_selector_development = __commonJS({
|
|
|
151
185
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
152
186
|
}
|
|
153
187
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
154
|
-
var React2 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore5 = shim.useSyncExternalStore,
|
|
188
|
+
var React2 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore5 = shim.useSyncExternalStore, useRef8 = React2.useRef, useEffect10 = React2.useEffect, useMemo8 = React2.useMemo, useDebugValue3 = React2.useDebugValue;
|
|
155
189
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
156
|
-
var instRef =
|
|
190
|
+
var instRef = useRef8(null);
|
|
157
191
|
if (null === instRef.current) {
|
|
158
192
|
var inst = { hasValue: false, value: null };
|
|
159
193
|
instRef.current = inst;
|
|
160
194
|
} else inst = instRef.current;
|
|
161
|
-
instRef =
|
|
195
|
+
instRef = useMemo8(
|
|
162
196
|
function() {
|
|
163
197
|
function memoizedSelector(nextSnapshot) {
|
|
164
198
|
if (!hasMemo) {
|
|
@@ -222,7 +256,7 @@ var require_with_selector = __commonJS({
|
|
|
222
256
|
});
|
|
223
257
|
|
|
224
258
|
// src/rich-input/BackgroundTasksPill.tsx
|
|
225
|
-
import { useMemo
|
|
259
|
+
import { useMemo, useState } from "react";
|
|
226
260
|
|
|
227
261
|
// src/chat/runtime/background-task-dismissals.ts
|
|
228
262
|
import { useSyncExternalStore } from "react";
|
|
@@ -246,7 +280,6 @@ var backgroundTaskDismissals = {
|
|
|
246
280
|
state = { ...state, [sessionId]: [...existing, taskId] };
|
|
247
281
|
emit();
|
|
248
282
|
},
|
|
249
|
-
/** 换身份:清空。 */
|
|
250
283
|
reset() {
|
|
251
284
|
state = {};
|
|
252
285
|
emit();
|
|
@@ -260,358 +293,6 @@ function useDismissedBackgroundTasks(sessionId) {
|
|
|
260
293
|
);
|
|
261
294
|
}
|
|
262
295
|
|
|
263
|
-
// src/rich-input/services.tsx
|
|
264
|
-
import { useMemo, useRef as useRef2 } from "react";
|
|
265
|
-
|
|
266
|
-
// src/chat/runtime/input-services.tsx
|
|
267
|
-
import { createContext, useContext } from "react";
|
|
268
|
-
import { jsx } from "react/jsx-runtime";
|
|
269
|
-
function parseModelReasoningLevels(value) {
|
|
270
|
-
if (!value) return {};
|
|
271
|
-
try {
|
|
272
|
-
const parsed = JSON.parse(value);
|
|
273
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
274
|
-
return Object.fromEntries(
|
|
275
|
-
Object.entries(parsed).filter(
|
|
276
|
-
(entry) => Boolean(entry[0]) && typeof entry[1] === "string" && Boolean(entry[1])
|
|
277
|
-
)
|
|
278
|
-
);
|
|
279
|
-
} catch {
|
|
280
|
-
return {};
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
var RichInputServicesContext = createContext({});
|
|
284
|
-
function RichInputServicesProvider({ value, children }) {
|
|
285
|
-
return /* @__PURE__ */ jsx(RichInputServicesContext.Provider, { value, children });
|
|
286
|
-
}
|
|
287
|
-
function useRichInputServices() {
|
|
288
|
-
return useContext(RichInputServicesContext);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// src/rich-input/lib/client-query.ts
|
|
292
|
-
import { useCallback, useEffect, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
293
|
-
|
|
294
|
-
// src/chat/runtime/input-cache-reset.ts
|
|
295
|
-
var resetters = /* @__PURE__ */ new WeakMap();
|
|
296
|
-
function onInputCachesReset(client, reset2) {
|
|
297
|
-
let set = resetters.get(client);
|
|
298
|
-
if (!set) {
|
|
299
|
-
set = /* @__PURE__ */ new Set();
|
|
300
|
-
resetters.set(client, set);
|
|
301
|
-
}
|
|
302
|
-
set.add(reset2);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// src/rich-input/lib/client-query.ts
|
|
306
|
-
var EMPTY = { data: void 0, error: null, isLoading: false, isFetching: false };
|
|
307
|
-
var caches = /* @__PURE__ */ new WeakMap();
|
|
308
|
-
function entryFor(client, key) {
|
|
309
|
-
let cache = caches.get(client);
|
|
310
|
-
if (!cache) {
|
|
311
|
-
const created = /* @__PURE__ */ new Map();
|
|
312
|
-
cache = created;
|
|
313
|
-
caches.set(client, created);
|
|
314
|
-
onInputCachesReset(client, () => {
|
|
315
|
-
for (const [key2, entry2] of created) {
|
|
316
|
-
entry2.request = null;
|
|
317
|
-
entry2.fetchedAt = 0;
|
|
318
|
-
update(entry2, EMPTY);
|
|
319
|
-
const load = loadersFor(client).get(key2);
|
|
320
|
-
if (load && entry2.listeners.size > 0) void fetchClientQuery(client, key2, load, { force: true }).catch(() => {
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
let entry = cache.get(key);
|
|
326
|
-
if (!entry) {
|
|
327
|
-
entry = { snapshot: EMPTY, fetchedAt: 0, request: null, listeners: /* @__PURE__ */ new Set() };
|
|
328
|
-
cache.set(key, entry);
|
|
329
|
-
}
|
|
330
|
-
return entry;
|
|
331
|
-
}
|
|
332
|
-
function update(entry, patch) {
|
|
333
|
-
entry.snapshot = { ...entry.snapshot, ...patch };
|
|
334
|
-
for (const listener of [...entry.listeners]) listener();
|
|
335
|
-
}
|
|
336
|
-
function fetchClientQuery(client, key, load, { staleMs = 3e4, force = false } = {}) {
|
|
337
|
-
const entry = entryFor(client, key);
|
|
338
|
-
if (entry.request) return entry.request;
|
|
339
|
-
if (!force && entry.snapshot.data !== void 0 && Date.now() - entry.fetchedAt < staleMs) {
|
|
340
|
-
return Promise.resolve(entry.snapshot.data);
|
|
341
|
-
}
|
|
342
|
-
const request = Promise.resolve().then(() => load(client));
|
|
343
|
-
entry.request = request;
|
|
344
|
-
update(entry, { isFetching: true, isLoading: entry.snapshot.data === void 0 });
|
|
345
|
-
request.then(
|
|
346
|
-
(data) => {
|
|
347
|
-
if (entry.request !== request) return;
|
|
348
|
-
entry.request = null;
|
|
349
|
-
entry.fetchedAt = Date.now();
|
|
350
|
-
update(entry, { data, error: null, isFetching: false, isLoading: false });
|
|
351
|
-
},
|
|
352
|
-
(error) => {
|
|
353
|
-
if (entry.request !== request) return;
|
|
354
|
-
entry.request = null;
|
|
355
|
-
update(entry, { error, isFetching: false, isLoading: false });
|
|
356
|
-
}
|
|
357
|
-
);
|
|
358
|
-
return request;
|
|
359
|
-
}
|
|
360
|
-
function setClientQueryData(client, key, updater) {
|
|
361
|
-
const entry = entryFor(client, key);
|
|
362
|
-
if (entry.snapshot.data === void 0) return;
|
|
363
|
-
update(entry, { data: updater(entry.snapshot.data) });
|
|
364
|
-
}
|
|
365
|
-
function useClientQuery(key, load, { staleMs = 3e4 } = {}) {
|
|
366
|
-
const client = useBladeClient();
|
|
367
|
-
const subscribe = useCallback(
|
|
368
|
-
(listener) => {
|
|
369
|
-
if (!key) return () => {
|
|
370
|
-
};
|
|
371
|
-
const entry = entryFor(client, key);
|
|
372
|
-
entry.listeners.add(listener);
|
|
373
|
-
return () => {
|
|
374
|
-
entry.listeners.delete(listener);
|
|
375
|
-
};
|
|
376
|
-
},
|
|
377
|
-
[client, key]
|
|
378
|
-
);
|
|
379
|
-
const snapshot = useSyncExternalStore2(
|
|
380
|
-
subscribe,
|
|
381
|
-
() => key ? entryFor(client, key).snapshot : EMPTY,
|
|
382
|
-
() => key ? entryFor(client, key).snapshot : EMPTY
|
|
383
|
-
);
|
|
384
|
-
if (key) loadersFor(client).set(key, load);
|
|
385
|
-
useEffect(() => {
|
|
386
|
-
if (!key) return;
|
|
387
|
-
const registered = loadersFor(client).get(key);
|
|
388
|
-
if (registered) void fetchClientQuery(client, key, registered, { staleMs }).catch(() => {
|
|
389
|
-
});
|
|
390
|
-
}, [client, key, staleMs]);
|
|
391
|
-
const refetch = useCallback(async () => {
|
|
392
|
-
if (!key) return void 0;
|
|
393
|
-
const registered = loadersFor(client).get(key);
|
|
394
|
-
if (!registered) return void 0;
|
|
395
|
-
return fetchClientQuery(client, key, registered, { force: true }).catch(() => void 0);
|
|
396
|
-
}, [client, key]);
|
|
397
|
-
return { ...snapshot, refetch };
|
|
398
|
-
}
|
|
399
|
-
var loaderRegistry = /* @__PURE__ */ new WeakMap();
|
|
400
|
-
function loadersFor(client) {
|
|
401
|
-
let loaders = loaderRegistry.get(client);
|
|
402
|
-
if (!loaders) {
|
|
403
|
-
loaders = /* @__PURE__ */ new Map();
|
|
404
|
-
loaderRegistry.set(client, loaders);
|
|
405
|
-
}
|
|
406
|
-
return loaders;
|
|
407
|
-
}
|
|
408
|
-
function refreshClientQuery(client, key) {
|
|
409
|
-
const entry = caches.get(client)?.get(key);
|
|
410
|
-
if (!entry) return;
|
|
411
|
-
entry.fetchedAt = 0;
|
|
412
|
-
const load = loadersFor(client).get(key);
|
|
413
|
-
if (load && entry.listeners.size > 0) void fetchClientQuery(client, key, load, { force: true }).catch(() => {
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// src/rich-input/lib/session-data.ts
|
|
418
|
-
import { useEffect as useEffect2, useRef } from "react";
|
|
419
|
-
var sessionPath = (sessionId, rest) => `/api/sessions/${encodeURIComponent(sessionId)}/${rest}`;
|
|
420
|
-
function useRefreshWhenRunEnds(sessionId, keys3) {
|
|
421
|
-
const client = useBladeClient();
|
|
422
|
-
const streaming = useSessionState(sessionId, (state3) => state3.isStreaming);
|
|
423
|
-
const wasStreaming = useRef(streaming);
|
|
424
|
-
useEffect2(() => {
|
|
425
|
-
if (wasStreaming.current && !streaming) {
|
|
426
|
-
for (const key of keys3) refreshClientQuery(client, key);
|
|
427
|
-
}
|
|
428
|
-
wasStreaming.current = streaming;
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
function useClientSessionSkills(sessionId) {
|
|
432
|
-
const key = sessionId ? `session-skills:${sessionId}` : null;
|
|
433
|
-
const query = useClientQuery(
|
|
434
|
-
key,
|
|
435
|
-
(client) => client.json("GET", sessionPath(sessionId ?? "", "skills"))
|
|
436
|
-
);
|
|
437
|
-
useRefreshWhenRunEnds(sessionId, key ? [key] : []);
|
|
438
|
-
return { data: query.data, loading: query.isLoading, error: query.error };
|
|
439
|
-
}
|
|
440
|
-
function useClientSkillStats(sessionId) {
|
|
441
|
-
const key = sessionId ? `skill-stats:${sessionId}` : null;
|
|
442
|
-
const query = useClientQuery(key, (client) => client.json("GET", sessionPath(sessionId ?? "", "skill-stats")), {
|
|
443
|
-
staleMs: 3e5
|
|
444
|
-
});
|
|
445
|
-
useRefreshWhenRunEnds(sessionId, key ? [key] : []);
|
|
446
|
-
return { data: query.data, loading: query.isLoading, error: query.error };
|
|
447
|
-
}
|
|
448
|
-
function useClientContextStats(sessionId) {
|
|
449
|
-
const key = sessionId ? `context-stats:${sessionId}` : null;
|
|
450
|
-
const query = useClientQuery(
|
|
451
|
-
key,
|
|
452
|
-
(client) => client.json("GET", sessionPath(sessionId ?? "", "context-stats"))
|
|
453
|
-
);
|
|
454
|
-
useRefreshWhenRunEnds(sessionId, key ? [key] : []);
|
|
455
|
-
return { data: query.data, loading: query.isLoading, error: query.error };
|
|
456
|
-
}
|
|
457
|
-
function useClientBackgroundTasks(sessionId) {
|
|
458
|
-
const client = useBladeClient();
|
|
459
|
-
const key = sessionId ? `background-tasks:${sessionId}` : null;
|
|
460
|
-
const query = useClientQuery(key, (c) => c.sessions.listBackgroundTasks(sessionId ?? ""));
|
|
461
|
-
const session = useSessionHandle(sessionId);
|
|
462
|
-
useEffect2(() => {
|
|
463
|
-
if (!session || !key) return;
|
|
464
|
-
return session.on("backgroundTask", () => refreshClientQuery(client, key));
|
|
465
|
-
}, [client, key, session]);
|
|
466
|
-
return { data: query.data, loading: query.isLoading, error: query.error };
|
|
467
|
-
}
|
|
468
|
-
function refreshClientSessionSkills(client, sessionId) {
|
|
469
|
-
refreshClientQuery(client, `session-skills:${sessionId}`);
|
|
470
|
-
refreshClientQuery(client, `skill-stats:${sessionId}`);
|
|
471
|
-
}
|
|
472
|
-
function useClientSessionModel(sessionId) {
|
|
473
|
-
const key = sessionId ? `session-detail:${sessionId}` : null;
|
|
474
|
-
const query = useClientQuery(key, (client) => client.sessions.getSession(sessionId ?? ""));
|
|
475
|
-
useRefreshWhenRunEnds(sessionId, key ? [key] : []);
|
|
476
|
-
return query.data?.model ?? null;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// src/rich-input/model/model-data.ts
|
|
480
|
-
var EMPTY_MODELS = [];
|
|
481
|
-
var EMPTY_IDS = [];
|
|
482
|
-
var CATALOG_KEY = "model-catalog";
|
|
483
|
-
function useClientModelCatalog() {
|
|
484
|
-
const { data, isLoading, isFetching, refetch } = useClientQuery(
|
|
485
|
-
CATALOG_KEY,
|
|
486
|
-
(client) => client.json("GET", "/api/config/models"),
|
|
487
|
-
// 模型服务在设置里随时可改:打开选择器时总是重新拉一次(见 ModelSelector)
|
|
488
|
-
{ staleMs: 0 }
|
|
489
|
-
);
|
|
490
|
-
return {
|
|
491
|
-
models: data?.models ?? EMPTY_MODELS,
|
|
492
|
-
defaultModel: data?.default ?? "",
|
|
493
|
-
thinkingAvailable: data?.thinkingAvailable ?? false,
|
|
494
|
-
unavailableProviderIds: data?.unavailableProviderIds ?? EMPTY_IDS,
|
|
495
|
-
unavailableModelIds: data?.unavailableModelIds ?? EMPTY_IDS,
|
|
496
|
-
isLoading,
|
|
497
|
-
isFetching,
|
|
498
|
-
refresh: async () => {
|
|
499
|
-
await refetch();
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
var PREFERRED_MODEL_KEY = "preferred_model";
|
|
504
|
-
var MODEL_REASONING_LEVELS_KEY = "llm.model_thinking_preferences";
|
|
505
|
-
var PREFERENCES_KEY = "model-preferences";
|
|
506
|
-
function loadPreferences(client) {
|
|
507
|
-
const query = new URLSearchParams();
|
|
508
|
-
query.append("key", PREFERRED_MODEL_KEY);
|
|
509
|
-
query.append("key", MODEL_REASONING_LEVELS_KEY);
|
|
510
|
-
return client.json("GET", `/api/user/preferences?${query.toString()}`).then((response) => response.values ?? {});
|
|
511
|
-
}
|
|
512
|
-
async function writePreference(client, key, value) {
|
|
513
|
-
const previous = await fetchClientQuery(client, PREFERENCES_KEY, loadPreferences, { staleMs: 6e4 }).catch(
|
|
514
|
-
() => ({})
|
|
515
|
-
);
|
|
516
|
-
setClientQueryData(client, PREFERENCES_KEY, (current) => ({ ...current, [key]: value }));
|
|
517
|
-
try {
|
|
518
|
-
await client.json("PUT", `/api/user/preferences/${encodeURIComponent(key)}`, { value });
|
|
519
|
-
} catch {
|
|
520
|
-
setClientQueryData(client, PREFERENCES_KEY, (current) => ({ ...current, [key]: previous[key] ?? null }));
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
var EMPTY_LEVELS = {};
|
|
524
|
-
function useClientModelPreferences() {
|
|
525
|
-
const client = useBladeClient();
|
|
526
|
-
const { data } = useClientQuery(PREFERENCES_KEY, loadPreferences, { staleMs: 6e4 });
|
|
527
|
-
const rawLevels = data?.[MODEL_REASONING_LEVELS_KEY] ?? null;
|
|
528
|
-
const reasoningLevels = rawLevels ? parseModelReasoningLevels(rawLevels) : EMPTY_LEVELS;
|
|
529
|
-
return {
|
|
530
|
-
preferredModel: data?.[PREFERRED_MODEL_KEY] ?? null,
|
|
531
|
-
setPreferredModel: (modelId) => void writePreference(client, PREFERRED_MODEL_KEY, modelId),
|
|
532
|
-
reasoningLevels,
|
|
533
|
-
setReasoningLevel: (modelId, level) => {
|
|
534
|
-
if (!modelId) return;
|
|
535
|
-
void writePreference(
|
|
536
|
-
client,
|
|
537
|
-
MODEL_REASONING_LEVELS_KEY,
|
|
538
|
-
JSON.stringify({ ...reasoningLevels, [modelId]: level })
|
|
539
|
-
);
|
|
540
|
-
}
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// src/rich-input/services.tsx
|
|
545
|
-
function useModelCatalog() {
|
|
546
|
-
const use = useRichInputServices().useModelCatalog ?? useClientModelCatalog;
|
|
547
|
-
return use();
|
|
548
|
-
}
|
|
549
|
-
function useModelPreferences() {
|
|
550
|
-
const use = useRichInputServices().useModelPreferences ?? useClientModelPreferences;
|
|
551
|
-
return use();
|
|
552
|
-
}
|
|
553
|
-
function loadKnowledgeBases(client) {
|
|
554
|
-
return client.json("GET", "/api/registry/kb").then(
|
|
555
|
-
(response) => (Array.isArray(response) ? response : response?.items ?? []).filter((item) => typeof item?.id === "number")
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
function useClientKnowledgeBaseLoader() {
|
|
559
|
-
const client = useBladeClient();
|
|
560
|
-
return useMemo(
|
|
561
|
-
() => () => fetchClientQuery(client, "knowledge-bases", loadKnowledgeBases, { staleMs: 6e4 }),
|
|
562
|
-
[client]
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
function useKnowledgeBaseLoader() {
|
|
566
|
-
const use = useRichInputServices().useKnowledgeBaseLoader ?? useClientKnowledgeBaseLoader;
|
|
567
|
-
return use();
|
|
568
|
-
}
|
|
569
|
-
function useSessionConnection(sessionId) {
|
|
570
|
-
const connection = useSessionState(sessionId, (state3) => state3.connection);
|
|
571
|
-
const status = sessionId ? connection : "connected";
|
|
572
|
-
const everConnected = useRef2(false);
|
|
573
|
-
if (status === "connected") everConnected.current = true;
|
|
574
|
-
return { status, reconnectAttempt: 0, hasEverConnected: everConnected.current };
|
|
575
|
-
}
|
|
576
|
-
function useComposerConnectionInfo(sessionId) {
|
|
577
|
-
const use = useRichInputServices().useConnection ?? useSessionConnection;
|
|
578
|
-
return use(sessionId);
|
|
579
|
-
}
|
|
580
|
-
function useComposerConnection(sessionId) {
|
|
581
|
-
return useComposerConnectionInfo(sessionId).status;
|
|
582
|
-
}
|
|
583
|
-
function useSessionSkills(sessionId) {
|
|
584
|
-
const use = useRichInputServices().useSessionSkills ?? useClientSessionSkills;
|
|
585
|
-
return use(sessionId);
|
|
586
|
-
}
|
|
587
|
-
function useSkillStats(sessionId) {
|
|
588
|
-
const use = useRichInputServices().useSkillStats ?? useClientSkillStats;
|
|
589
|
-
return use(sessionId);
|
|
590
|
-
}
|
|
591
|
-
function useContextStats(sessionId) {
|
|
592
|
-
const use = useRichInputServices().useContextStats ?? useClientContextStats;
|
|
593
|
-
return use(sessionId);
|
|
594
|
-
}
|
|
595
|
-
function useBackgroundTaskList(sessionId) {
|
|
596
|
-
const use = useRichInputServices().useBackgroundTasks ?? useClientBackgroundTasks;
|
|
597
|
-
return use(sessionId);
|
|
598
|
-
}
|
|
599
|
-
function useClientSessionDataInvalidation() {
|
|
600
|
-
const client = useBladeClient();
|
|
601
|
-
return useMemo(
|
|
602
|
-
() => ({
|
|
603
|
-
filesUploaded: (_sessionId) => {
|
|
604
|
-
},
|
|
605
|
-
pluginsChanged: (sessionId) => refreshClientSessionSkills(client, sessionId)
|
|
606
|
-
}),
|
|
607
|
-
[client]
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
function useSessionDataInvalidation() {
|
|
611
|
-
const use = useRichInputServices().useSessionDataInvalidation ?? useClientSessionDataInvalidation;
|
|
612
|
-
return use();
|
|
613
|
-
}
|
|
614
|
-
|
|
615
296
|
// src/rich-input/lib/background-tasks-view.ts
|
|
616
297
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["starting", "running", "cancelling"]);
|
|
617
298
|
var ATTENTION_STATUSES = /* @__PURE__ */ new Set(["failed", "lost"]);
|
|
@@ -623,7 +304,6 @@ var STATUS_LABELS = {
|
|
|
623
304
|
succeeded: "\u5DF2\u5B8C\u6210",
|
|
624
305
|
cancelled: "\u5DF2\u505C\u6B62",
|
|
625
306
|
failed: "\u5931\u8D25",
|
|
626
|
-
// 不是失败:平台只是不再能追踪这个进程,它可能还在跑。
|
|
627
307
|
lost: "\u72B6\u6001\u672A\u77E5"
|
|
628
308
|
};
|
|
629
309
|
function statusLabel(status) {
|
|
@@ -672,7 +352,7 @@ function formatStartedAt(value, now = /* @__PURE__ */ new Date()) {
|
|
|
672
352
|
}
|
|
673
353
|
|
|
674
354
|
// src/rich-input/BackgroundTasksPill.tsx
|
|
675
|
-
import { Fragment, jsx
|
|
355
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
676
356
|
var NO_TASKS = [];
|
|
677
357
|
function TaskCard({
|
|
678
358
|
task,
|
|
@@ -682,8 +362,8 @@ function TaskCard({
|
|
|
682
362
|
}) {
|
|
683
363
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-[hsl(var(--border))] p-2", children: [
|
|
684
364
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 break-words text-[hsl(var(--foreground))]", children: task.description || task.command }),
|
|
366
|
+
/* @__PURE__ */ jsx(
|
|
687
367
|
"span",
|
|
688
368
|
{
|
|
689
369
|
className: cn(
|
|
@@ -694,10 +374,10 @@ function TaskCard({
|
|
|
694
374
|
}
|
|
695
375
|
)
|
|
696
376
|
] }),
|
|
697
|
-
task.status === "lost" ? /* @__PURE__ */
|
|
377
|
+
task.status === "lost" ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-[11px] text-[hsl(var(--swf-warning))]", children: "\u5E73\u53F0\u91CD\u542F\u540E\u8DDF\u4E22\u4E86\uFF0C\u7A0B\u5E8F\u53EF\u80FD\u4ECD\u5728\u8FD0\u884C" }) : null,
|
|
698
378
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-1.5 text-[10px] text-[hsl(var(--muted-foreground))]/60", children: [
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ jsx("span", { children: formatStartedAt(task.started_at) }),
|
|
380
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-mono", children: task.id })
|
|
701
381
|
] }),
|
|
702
382
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-1.5", children: [
|
|
703
383
|
/* @__PURE__ */ jsxs(
|
|
@@ -707,7 +387,7 @@ function TaskCard({
|
|
|
707
387
|
onClick: onOpenLog,
|
|
708
388
|
className: "inline-flex h-6 items-center gap-1 rounded-md border border-[hsl(var(--border))] px-2 text-[11px] hover:bg-[hsl(var(--accent))]",
|
|
709
389
|
children: [
|
|
710
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ jsx(FileText, { size: 12 }),
|
|
711
391
|
"\u65E5\u5FD7"
|
|
712
392
|
]
|
|
713
393
|
}
|
|
@@ -719,7 +399,7 @@ function TaskCard({
|
|
|
719
399
|
onClick: onStop,
|
|
720
400
|
className: "inline-flex h-6 items-center gap-1 rounded-[6px] border border-[hsl(var(--swf-danger)/0.35)] px-2 text-[11px] text-[hsl(var(--swf-danger))] hover:bg-[hsl(var(--swf-danger-soft))]",
|
|
721
401
|
children: [
|
|
722
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsx(Square, { size: 10 }),
|
|
723
403
|
"\u505C\u6B62"
|
|
724
404
|
]
|
|
725
405
|
}
|
|
@@ -731,7 +411,7 @@ function TaskCard({
|
|
|
731
411
|
onClick: onDismiss,
|
|
732
412
|
className: "inline-flex h-6 items-center gap-1 rounded-md border border-[hsl(var(--border))] px-2 text-[11px] hover:bg-[hsl(var(--accent))]",
|
|
733
413
|
children: [
|
|
734
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ jsx(EyeOff, { size: 12 }),
|
|
735
415
|
"\u9690\u85CF"
|
|
736
416
|
]
|
|
737
417
|
}
|
|
@@ -748,7 +428,7 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
748
428
|
const [historyOverride, setHistoryOverride] = useState(null);
|
|
749
429
|
const [logTask, setLogTask] = useState(null);
|
|
750
430
|
const [logDialogOpen, setLogDialogOpen] = useState(false);
|
|
751
|
-
const { activeTasks, historyTasks, runningCount, attentionCount } =
|
|
431
|
+
const { activeTasks, historyTasks, runningCount, attentionCount } = useMemo(
|
|
752
432
|
() => splitTasks(tasks, dismissed),
|
|
753
433
|
[tasks, dismissed]
|
|
754
434
|
);
|
|
@@ -782,7 +462,6 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
782
462
|
title,
|
|
783
463
|
output: "",
|
|
784
464
|
loading: false,
|
|
785
|
-
// 跟丢或过期的任务,控制目录可能已经被回收,报错串对用户没有意义。
|
|
786
465
|
error: "\u65E5\u5FD7\u5DF2\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u53EF\u80FD\u5DF2\u88AB\u6E05\u7406"
|
|
787
466
|
});
|
|
788
467
|
}
|
|
@@ -795,7 +474,7 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
795
474
|
closePanel();
|
|
796
475
|
};
|
|
797
476
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
798
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ jsx(
|
|
799
478
|
Dialog,
|
|
800
479
|
{
|
|
801
480
|
open: logDialogOpen,
|
|
@@ -810,10 +489,10 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
810
489
|
children: [
|
|
811
490
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-3", children: [
|
|
812
491
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */
|
|
492
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: logTask?.title }),
|
|
493
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u540E\u53F0\u4EFB\u52A1\u65E5\u5FD7" })
|
|
815
494
|
] }),
|
|
816
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ jsx(
|
|
817
496
|
"button",
|
|
818
497
|
{
|
|
819
498
|
type: "button",
|
|
@@ -823,7 +502,7 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
823
502
|
}
|
|
824
503
|
)
|
|
825
504
|
] }),
|
|
826
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ jsx("pre", { className: "min-h-64 flex-1 overflow-auto whitespace-pre-wrap p-4 font-mono text-xs leading-5 text-[hsl(var(--foreground))]", children: logTask?.loading ? "\u52A0\u8F7D\u4E2D..." : logTask?.error || logTask?.output })
|
|
827
506
|
]
|
|
828
507
|
}
|
|
829
508
|
)
|
|
@@ -845,8 +524,8 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
845
524
|
title: summary,
|
|
846
525
|
className: "relative flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
847
526
|
children: [
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
runningCount > 0 ? /* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ jsx(Terminal, { size: 16 }),
|
|
528
|
+
runningCount > 0 ? /* @__PURE__ */ jsx("span", { className: "absolute right-1 top-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-[hsl(var(--muted))] px-1 text-[9px] font-medium leading-none text-[hsl(var(--muted-foreground))]", children: runningCount }) : attentionCount > 0 ? /* @__PURE__ */ jsx(
|
|
850
529
|
"span",
|
|
851
530
|
{
|
|
852
531
|
"data-attention-dot": "true",
|
|
@@ -856,64 +535,59 @@ function BackgroundTasksPill({ sessionId }) {
|
|
|
856
535
|
]
|
|
857
536
|
}
|
|
858
537
|
),
|
|
859
|
-
open ? (
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
538
|
+
open ? /* @__PURE__ */ jsx("div", { className: "absolute bottom-full left-0 z-40 mb-2 w-[min(24rem,calc(100vw-2rem))] rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-2 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)] before:absolute before:inset-x-0 before:top-full before:h-2 before:content-['']", children: /* @__PURE__ */ jsxs("div", { className: "max-h-72 space-y-2 overflow-y-auto", children: [
|
|
539
|
+
activeTasks.map((task) => /* @__PURE__ */ jsx(
|
|
540
|
+
TaskCard,
|
|
541
|
+
{
|
|
542
|
+
task,
|
|
543
|
+
onOpenLog: () => void openTaskLog(task),
|
|
544
|
+
onStop: () => requestStopTask(task),
|
|
545
|
+
onDismiss: ATTENTION_STATUSES.has(task.status) ? () => hideTask(task.id) : null
|
|
546
|
+
},
|
|
547
|
+
task.id
|
|
548
|
+
)),
|
|
549
|
+
historyTasks.length > 0 ? /* @__PURE__ */ jsxs(
|
|
550
|
+
"div",
|
|
551
|
+
{
|
|
552
|
+
className: cn(
|
|
553
|
+
activeTasks.length > 0 && "border-t border-[hsl(var(--border))] pt-2"
|
|
554
|
+
),
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ jsxs(
|
|
557
|
+
"button",
|
|
558
|
+
{
|
|
559
|
+
type: "button",
|
|
560
|
+
onClick: () => setHistoryOverride(!historyOpen),
|
|
561
|
+
"aria-expanded": historyOpen,
|
|
562
|
+
className: "flex w-full items-center gap-1 px-1 py-1 text-[11px] text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ jsx(
|
|
565
|
+
ChevronDown,
|
|
566
|
+
{
|
|
567
|
+
size: 12,
|
|
568
|
+
className: cn("transition-transform", historyOpen ? "" : "-rotate-90")
|
|
569
|
+
}
|
|
570
|
+
),
|
|
571
|
+
"\u5386\u53F2\u540E\u53F0\u4EFB\u52A1\uFF08",
|
|
572
|
+
historyTasks.length,
|
|
573
|
+
"\uFF09"
|
|
574
|
+
]
|
|
575
|
+
}
|
|
879
576
|
),
|
|
880
|
-
children:
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
}
|
|
895
|
-
),
|
|
896
|
-
"\u5386\u53F2\u540E\u53F0\u4EFB\u52A1\uFF08",
|
|
897
|
-
historyTasks.length,
|
|
898
|
-
"\uFF09"
|
|
899
|
-
]
|
|
900
|
-
}
|
|
901
|
-
),
|
|
902
|
-
historyOpen ? /* @__PURE__ */ jsx2("div", { className: "mt-2 space-y-2", children: historyTasks.map((task) => /* @__PURE__ */ jsx2(
|
|
903
|
-
TaskCard,
|
|
904
|
-
{
|
|
905
|
-
task,
|
|
906
|
-
onOpenLog: () => void openTaskLog(task),
|
|
907
|
-
onStop: () => requestStopTask(task),
|
|
908
|
-
onDismiss: null
|
|
909
|
-
},
|
|
910
|
-
task.id
|
|
911
|
-
)) }) : null
|
|
912
|
-
]
|
|
913
|
-
}
|
|
914
|
-
) : null
|
|
915
|
-
] }) })
|
|
916
|
-
) : null
|
|
577
|
+
historyOpen ? /* @__PURE__ */ jsx("div", { className: "mt-2 space-y-2", children: historyTasks.map((task) => /* @__PURE__ */ jsx(
|
|
578
|
+
TaskCard,
|
|
579
|
+
{
|
|
580
|
+
task,
|
|
581
|
+
onOpenLog: () => void openTaskLog(task),
|
|
582
|
+
onStop: () => requestStopTask(task),
|
|
583
|
+
onDismiss: null
|
|
584
|
+
},
|
|
585
|
+
task.id
|
|
586
|
+
)) }) : null
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
) : null
|
|
590
|
+
] }) }) : null
|
|
917
591
|
]
|
|
918
592
|
}
|
|
919
593
|
)
|
|
@@ -12278,7 +11952,7 @@ function resolveSelection(view, doc3, parsedSel) {
|
|
|
12278
11952
|
}
|
|
12279
11953
|
function isMarkChange(cur, prev) {
|
|
12280
11954
|
let curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;
|
|
12281
|
-
let added = curMarks, removed = prevMarks, type, mark,
|
|
11955
|
+
let added = curMarks, removed = prevMarks, type, mark, update;
|
|
12282
11956
|
for (let i = 0; i < prevMarks.length; i++)
|
|
12283
11957
|
added = prevMarks[i].removeFromSet(added);
|
|
12284
11958
|
for (let i = 0; i < curMarks.length; i++)
|
|
@@ -12286,17 +11960,17 @@ function isMarkChange(cur, prev) {
|
|
|
12286
11960
|
if (added.length == 1 && removed.length == 0) {
|
|
12287
11961
|
mark = added[0];
|
|
12288
11962
|
type = "add";
|
|
12289
|
-
|
|
11963
|
+
update = (node) => node.mark(mark.addToSet(node.marks));
|
|
12290
11964
|
} else if (added.length == 0 && removed.length == 1) {
|
|
12291
11965
|
mark = removed[0];
|
|
12292
11966
|
type = "remove";
|
|
12293
|
-
|
|
11967
|
+
update = (node) => node.mark(mark.removeFromSet(node.marks));
|
|
12294
11968
|
} else {
|
|
12295
11969
|
return null;
|
|
12296
11970
|
}
|
|
12297
11971
|
let updated = [];
|
|
12298
11972
|
for (let i = 0; i < prev.childCount; i++)
|
|
12299
|
-
updated.push(
|
|
11973
|
+
updated.push(update(prev.child(i)));
|
|
12300
11974
|
if (Fragment2.from(updated).eq(cur))
|
|
12301
11975
|
return { mark, type };
|
|
12302
11976
|
}
|
|
@@ -18931,72 +18605,252 @@ var Mention = Node3.create({
|
|
|
18931
18605
|
});
|
|
18932
18606
|
var index_default = Mention;
|
|
18933
18607
|
|
|
18934
|
-
// src/rich-input/extensions/
|
|
18935
|
-
function
|
|
18936
|
-
return typeof value === "object" && value
|
|
18608
|
+
// src/rich-input/extensions/plugin-mention.ts
|
|
18609
|
+
function isPluginSuggestionError(value) {
|
|
18610
|
+
return Boolean(value && typeof value === "object" && value.kind === "pluginError");
|
|
18937
18611
|
}
|
|
18938
|
-
function
|
|
18939
|
-
return typeof value === "object" && value
|
|
18612
|
+
function isPluginSuggestionItem(value) {
|
|
18613
|
+
return Boolean(value && typeof value === "object" && value.kind === "plugin");
|
|
18940
18614
|
}
|
|
18941
|
-
var
|
|
18942
|
-
name: "
|
|
18615
|
+
var PluginMention = index_default.extend({
|
|
18616
|
+
name: "pluginMention",
|
|
18943
18617
|
addOptions() {
|
|
18944
18618
|
return {
|
|
18945
18619
|
...this.parent?.(),
|
|
18946
|
-
HTMLAttributes: { class: "file-mention-pill topic-asset-mention-pill" },
|
|
18947
18620
|
deleteTriggerWithBackspace: true,
|
|
18948
18621
|
suggestions: this.parent?.().suggestions ?? [],
|
|
18949
18622
|
suggestion: { ...this.parent?.().suggestion, char: "@" },
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
class: "file-mention-pill topic-asset-mention-pill",
|
|
18954
|
-
"data-topic-id": node.attrs.topic_id,
|
|
18955
|
-
"data-path": node.attrs.path,
|
|
18956
|
-
title: `\u4E3B\u9898\u8D44\u4EA7\uFF1A${node.attrs.path}`
|
|
18957
|
-
}, `@${node.attrs.path}`]
|
|
18623
|
+
HTMLAttributes: { class: "file-mention-pill" },
|
|
18624
|
+
renderText: ({ node }) => `@${node.attrs.label}`,
|
|
18625
|
+
renderHTML: ({ node }) => ["span", { class: "file-mention-pill", "data-plugin-ref": JSON.stringify(node.attrs) }, `@${node.attrs.label}`]
|
|
18958
18626
|
};
|
|
18959
18627
|
},
|
|
18960
18628
|
addAttributes() {
|
|
18961
|
-
return {
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18629
|
+
return Object.fromEntries(["provider", "plugin", "server", "id", "label"].map((key) => [key, {
|
|
18630
|
+
default: key === "provider" ? "plugin" : "",
|
|
18631
|
+
parseHTML: (element) => {
|
|
18632
|
+
try {
|
|
18633
|
+
return JSON.parse(element.getAttribute("data-plugin-ref") ?? "{}")[key] ?? "";
|
|
18634
|
+
} catch {
|
|
18635
|
+
return "";
|
|
18636
|
+
}
|
|
18637
|
+
}
|
|
18638
|
+
}]));
|
|
18639
|
+
},
|
|
18640
|
+
parseHTML() {
|
|
18641
|
+
return [{ tag: "span[data-plugin-ref]" }];
|
|
18965
18642
|
},
|
|
18966
18643
|
addProseMirrorPlugins() {
|
|
18967
18644
|
return [];
|
|
18968
18645
|
}
|
|
18969
18646
|
});
|
|
18970
18647
|
|
|
18971
|
-
// src/
|
|
18972
|
-
import { normalizeTopicAssetRefs } from "@blade-hq/agent-client";
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
if (
|
|
18976
|
-
return
|
|
18648
|
+
// src/rich-input/lib/composer-content.ts
|
|
18649
|
+
import { normalizePluginRefs, normalizeMessageRefs, normalizeTopicAssetRefs } from "@blade-hq/agent-client";
|
|
18650
|
+
function serializeEditorContent(node) {
|
|
18651
|
+
if (!node) return "";
|
|
18652
|
+
if (node.type === "text") {
|
|
18653
|
+
return node.text ?? "";
|
|
18977
18654
|
}
|
|
18978
|
-
|
|
18655
|
+
if (node.type === "hardBreak") {
|
|
18656
|
+
return "\n";
|
|
18657
|
+
}
|
|
18658
|
+
if (node.type === "fileMention") {
|
|
18659
|
+
const path = typeof node.attrs?.path === "string" ? node.attrs.path : "";
|
|
18660
|
+
return path ? `\`${path}\`` : "";
|
|
18661
|
+
}
|
|
18662
|
+
if (node.type === "skillMention") {
|
|
18663
|
+
const skillId = typeof node.attrs?.skillId === "string" ? node.attrs.skillId : "";
|
|
18664
|
+
return skillId ? `@${node.attrs?.displayName || skillId}` : "";
|
|
18665
|
+
}
|
|
18666
|
+
if (node.type === "pluginMention") return `@${node.attrs?.label ?? ""}`;
|
|
18667
|
+
if (node.type === "topicAssetMention") {
|
|
18668
|
+
const path = typeof node.attrs?.path === "string" ? node.attrs.path : "";
|
|
18669
|
+
return path ? `@${path}` : "";
|
|
18670
|
+
}
|
|
18671
|
+
const children = (node.content ?? []).map((child) => serializeEditorContent(child));
|
|
18672
|
+
if (node.type === "doc") {
|
|
18673
|
+
return children.join("\n");
|
|
18674
|
+
}
|
|
18675
|
+
return children.join("");
|
|
18979
18676
|
}
|
|
18980
|
-
function
|
|
18981
|
-
if (!
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18677
|
+
function scanLeadingSkillMention(node, seenContent) {
|
|
18678
|
+
if (!node) {
|
|
18679
|
+
return { skill: null, seenContent };
|
|
18680
|
+
}
|
|
18681
|
+
if (node.type === "text") {
|
|
18682
|
+
return { skill: null, seenContent: seenContent || /\S/.test(node.text ?? "") };
|
|
18683
|
+
}
|
|
18684
|
+
if (node.type === "hardBreak" || node.type === "fileMention") {
|
|
18685
|
+
return { skill: null, seenContent: true };
|
|
18686
|
+
}
|
|
18687
|
+
if (node.type === "pluginMention") return { skill: null, seenContent };
|
|
18688
|
+
if (node.type === "topicAssetMention") return { skill: null, seenContent };
|
|
18689
|
+
if (node.type === "skillMention") {
|
|
18690
|
+
const skillId = typeof node.attrs?.skillId === "string" ? node.attrs.skillId : null;
|
|
18691
|
+
return {
|
|
18692
|
+
skill: seenContent || !skillId ? null : {
|
|
18693
|
+
skillId,
|
|
18694
|
+
local: node.attrs?.local !== false,
|
|
18695
|
+
installed: node.attrs?.installed !== false
|
|
18696
|
+
},
|
|
18697
|
+
seenContent: true
|
|
18698
|
+
};
|
|
18699
|
+
}
|
|
18700
|
+
let nextSeenContent = seenContent;
|
|
18701
|
+
for (const child of node.content ?? []) {
|
|
18702
|
+
const result = scanLeadingSkillMention(child, nextSeenContent);
|
|
18703
|
+
if (result.skill) {
|
|
18704
|
+
return result;
|
|
18705
|
+
}
|
|
18706
|
+
nextSeenContent = result.seenContent;
|
|
18707
|
+
}
|
|
18708
|
+
return { skill: null, seenContent: nextSeenContent };
|
|
18985
18709
|
}
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
18710
|
+
function findLeadingSkillMention(node) {
|
|
18711
|
+
return scanLeadingSkillMention(node, false).skill;
|
|
18712
|
+
}
|
|
18713
|
+
function collectTopicAssetMentions(node) {
|
|
18714
|
+
const refs = [];
|
|
18715
|
+
const visit = (current) => {
|
|
18716
|
+
if (!current) return;
|
|
18717
|
+
if (current.type === "topicAssetMention") refs.push(current.attrs);
|
|
18718
|
+
for (const child of current.content ?? []) visit(child);
|
|
18719
|
+
};
|
|
18720
|
+
visit(node);
|
|
18721
|
+
return normalizeTopicAssetRefs(refs);
|
|
18722
|
+
}
|
|
18723
|
+
function buildEditorDocumentWithMentions(text, topicAssetRefs = []) {
|
|
18724
|
+
const doc3 = buildEditorDocument(text);
|
|
18725
|
+
const replace2 = (node) => {
|
|
18726
|
+
if (node.type !== "text") return [{ ...node, ...node.content ? { content: node.content.flatMap(replace2) } : {} }];
|
|
18727
|
+
let nodes = [node];
|
|
18728
|
+
for (const ref of topicAssetRefs) {
|
|
18729
|
+
nodes = nodes.flatMap((part) => {
|
|
18730
|
+
if (part.type !== "text" || !part.text) return [part];
|
|
18731
|
+
const marker = `@${ref.path}`;
|
|
18732
|
+
const index = part.text.indexOf(marker);
|
|
18733
|
+
if (index < 0) return [part];
|
|
18734
|
+
return [
|
|
18735
|
+
...index ? [{ type: "text", text: part.text.slice(0, index) }] : [],
|
|
18736
|
+
{ type: "topicAssetMention", attrs: { topic_id: ref.topic_id, path: ref.path } },
|
|
18737
|
+
...index + marker.length < part.text.length ? [{ type: "text", text: part.text.slice(index + marker.length) }] : []
|
|
18738
|
+
];
|
|
18739
|
+
});
|
|
18740
|
+
}
|
|
18741
|
+
return nodes;
|
|
18742
|
+
};
|
|
18743
|
+
return replace2(doc3)[0];
|
|
18744
|
+
}
|
|
18745
|
+
function retainTopicAssetMentions(node, topicId) {
|
|
18746
|
+
return {
|
|
18747
|
+
...node,
|
|
18748
|
+
...node.content ? {
|
|
18749
|
+
content: node.content.filter((child) => child.type !== "topicAssetMention" || child.attrs?.topic_id === topicId).map((child) => retainTopicAssetMentions(child, topicId))
|
|
18750
|
+
} : {}
|
|
18751
|
+
};
|
|
18752
|
+
}
|
|
18753
|
+
function collectPluginMentions(node) {
|
|
18754
|
+
const refs = [];
|
|
18755
|
+
const visit = (current) => {
|
|
18756
|
+
if (!current) return;
|
|
18757
|
+
if (current.type === "pluginMention") refs.push(current.attrs);
|
|
18758
|
+
current.content?.forEach(visit);
|
|
18759
|
+
};
|
|
18760
|
+
visit(node);
|
|
18761
|
+
return normalizePluginRefs(refs);
|
|
18762
|
+
}
|
|
18763
|
+
function buildEditorDocument(text) {
|
|
18764
|
+
return { type: "doc", content: text.split("\n").map((line) => ({ type: "paragraph", content: line ? [{ type: "text", text: line }] : [] })) };
|
|
18765
|
+
}
|
|
18766
|
+
function collectMessageMentions(node) {
|
|
18767
|
+
const refs = [];
|
|
18768
|
+
const visit = (current) => {
|
|
18769
|
+
if (!current) return;
|
|
18770
|
+
if (current.type === "pluginMention") refs.push(current.attrs);
|
|
18771
|
+
if (current.type === "skillMention") refs.push({
|
|
18772
|
+
provider: "skill",
|
|
18773
|
+
id: current.attrs?.skillId,
|
|
18774
|
+
label: current.attrs?.displayName || current.attrs?.skillId
|
|
18775
|
+
});
|
|
18776
|
+
current.content?.forEach(visit);
|
|
18777
|
+
};
|
|
18778
|
+
visit(node);
|
|
18779
|
+
return normalizeMessageRefs(refs);
|
|
18780
|
+
}
|
|
18781
|
+
function buildPluginSelectionDocument(refs) {
|
|
18782
|
+
return { type: "doc", content: [{ type: "paragraph", content: normalizePluginRefs(refs).flatMap((ref) => [
|
|
18783
|
+
{ type: "pluginMention", attrs: { ...ref } },
|
|
18784
|
+
{ type: "text", text: " " }
|
|
18785
|
+
]) }] };
|
|
18786
|
+
}
|
|
18787
|
+
|
|
18788
|
+
// src/rich-input/extensions/topic-asset-mention.ts
|
|
18789
|
+
function isTopicAssetSuggestionItem(value) {
|
|
18790
|
+
return typeof value === "object" && value !== null && value.kind === "topicAsset";
|
|
18791
|
+
}
|
|
18792
|
+
function isTopicAssetSuggestionError(value) {
|
|
18793
|
+
return typeof value === "object" && value !== null && value.kind === "topicAssetError";
|
|
18794
|
+
}
|
|
18795
|
+
var TopicAssetMention = index_default.extend({
|
|
18796
|
+
name: "topicAssetMention",
|
|
18797
|
+
addOptions() {
|
|
18798
|
+
return {
|
|
18799
|
+
...this.parent?.(),
|
|
18800
|
+
HTMLAttributes: { class: "file-mention-pill topic-asset-mention-pill" },
|
|
18801
|
+
deleteTriggerWithBackspace: true,
|
|
18802
|
+
suggestions: this.parent?.().suggestions ?? [],
|
|
18803
|
+
suggestion: { ...this.parent?.().suggestion, char: "@" },
|
|
18804
|
+
renderText: ({ node }) => `@${node.attrs.path}`,
|
|
18805
|
+
renderHTML: ({ options, node }) => ["span", {
|
|
18806
|
+
...options.HTMLAttributes,
|
|
18807
|
+
class: "file-mention-pill topic-asset-mention-pill",
|
|
18808
|
+
"data-topic-id": node.attrs.topic_id,
|
|
18809
|
+
"data-path": node.attrs.path,
|
|
18810
|
+
title: `\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7\uFF1A${node.attrs.path}`
|
|
18811
|
+
}, `@${node.attrs.path}`]
|
|
18812
|
+
};
|
|
18813
|
+
},
|
|
18814
|
+
addAttributes() {
|
|
18815
|
+
return {
|
|
18816
|
+
topic_id: { default: "", parseHTML: (element) => element.getAttribute("data-topic-id") || "", renderHTML: (attrs) => ({ "data-topic-id": attrs.topic_id }) },
|
|
18817
|
+
path: { default: "", parseHTML: (element) => element.getAttribute("data-path") || "", renderHTML: (attrs) => ({ "data-path": attrs.path }) }
|
|
18818
|
+
};
|
|
18819
|
+
},
|
|
18820
|
+
addProseMirrorPlugins() {
|
|
18821
|
+
return [];
|
|
18822
|
+
}
|
|
18823
|
+
});
|
|
18824
|
+
|
|
18825
|
+
// src/chat/runtime/composer-channels.ts
|
|
18826
|
+
import { normalizeTopicAssetRefs as normalizeTopicAssetRefs2 } from "@blade-hq/agent-client";
|
|
18827
|
+
import { useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
18828
|
+
function buildSignalId() {
|
|
18829
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
18830
|
+
return crypto.randomUUID();
|
|
18831
|
+
}
|
|
18832
|
+
return `bridge-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
18833
|
+
}
|
|
18834
|
+
function withoutKey(record, key) {
|
|
18835
|
+
if (!(key in record)) return record;
|
|
18836
|
+
const next = { ...record };
|
|
18837
|
+
delete next[key];
|
|
18838
|
+
return next;
|
|
18839
|
+
}
|
|
18840
|
+
var state2 = {
|
|
18841
|
+
topicAssetReferences: {},
|
|
18842
|
+
pendingContexts: {},
|
|
18843
|
+
draftAppends: {},
|
|
18844
|
+
sendRequests: {},
|
|
18845
|
+
modelDrafts: {},
|
|
18846
|
+
rewindDrafts: {}
|
|
18847
|
+
};
|
|
18848
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
18849
|
+
function setState(update) {
|
|
18850
|
+
const next = update(state2);
|
|
18851
|
+
if (next === state2) return;
|
|
18852
|
+
state2 = next;
|
|
18853
|
+
for (const listener of [...listeners2]) listener();
|
|
19000
18854
|
}
|
|
19001
18855
|
function consume(key, sessionId) {
|
|
19002
18856
|
const signals = state2[key][sessionId] ?? [];
|
|
@@ -19007,7 +18861,7 @@ function consume(key, sessionId) {
|
|
|
19007
18861
|
var composerChannels = {
|
|
19008
18862
|
getState: () => state2,
|
|
19009
18863
|
addTopicAssetReference(sessionId, ref) {
|
|
19010
|
-
setState((current) => ({ ...current, topicAssetReferences: { ...current.topicAssetReferences, [sessionId]:
|
|
18864
|
+
setState((current) => ({ ...current, topicAssetReferences: { ...current.topicAssetReferences, [sessionId]: normalizeTopicAssetRefs2([...current.topicAssetReferences[sessionId] ?? [], ref]) } }));
|
|
19011
18865
|
},
|
|
19012
18866
|
consumeTopicAssetReferences: (sessionId) => consume("topicAssetReferences", sessionId),
|
|
19013
18867
|
subscribe(listener) {
|
|
@@ -19078,13 +18932,11 @@ var composerChannels = {
|
|
|
19078
18932
|
clearModelDraft(sessionId) {
|
|
19079
18933
|
setState((current) => ({ ...current, modelDrafts: withoutKey(current.modelDrafts, sessionId) }));
|
|
19080
18934
|
},
|
|
19081
|
-
/** 回退到某一步后,把那一步的用户原话放回输入框(null 清除)。 */
|
|
19082
18935
|
setRewindDraft(sessionId, text) {
|
|
19083
18936
|
setState(
|
|
19084
18937
|
(current) => text === null ? { ...current, rewindDrafts: withoutKey(current.rewindDrafts, sessionId) } : { ...current, rewindDrafts: { ...current.rewindDrafts, [sessionId]: text } }
|
|
19085
18938
|
);
|
|
19086
18939
|
},
|
|
19087
|
-
/** 会话被关闭 / 删除:清掉它还没被取走的信号。 */
|
|
19088
18940
|
clearSession(sessionId) {
|
|
19089
18941
|
setState((current) => ({
|
|
19090
18942
|
...current,
|
|
@@ -19094,13 +18946,12 @@ var composerChannels = {
|
|
|
19094
18946
|
sendRequests: withoutKey(current.sendRequests, sessionId)
|
|
19095
18947
|
}));
|
|
19096
18948
|
},
|
|
19097
|
-
/** 换身份:清空全部通道。 */
|
|
19098
18949
|
reset() {
|
|
19099
18950
|
setState(() => ({ topicAssetReferences: {}, pendingContexts: {}, draftAppends: {}, sendRequests: {}, modelDrafts: {}, rewindDrafts: {} }));
|
|
19100
18951
|
}
|
|
19101
18952
|
};
|
|
19102
18953
|
function useComposerChannels(selector) {
|
|
19103
|
-
return
|
|
18954
|
+
return useSyncExternalStore2(
|
|
19104
18955
|
composerChannels.subscribe,
|
|
19105
18956
|
() => selector(state2),
|
|
19106
18957
|
() => selector(state2)
|
|
@@ -19114,7 +18965,7 @@ async function getTopicAssetSuggestionItems(client, topicId, query) {
|
|
|
19114
18965
|
const result = await client.chatGroups.listAssets(topicId);
|
|
19115
18966
|
return result.items.filter((asset) => !asset.is_dir && asset.path.toLowerCase().includes(query.toLowerCase())).map((asset) => ({ kind: "topicAsset", topic_id: topicId, path: asset.path, name: asset.path }));
|
|
19116
18967
|
} catch {
|
|
19117
|
-
return [{ kind: "topicAssetError", message: "\
|
|
18968
|
+
return [{ kind: "topicAssetError", message: "\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165 @ \u91CD\u8BD5" }];
|
|
19118
18969
|
}
|
|
19119
18970
|
}
|
|
19120
18971
|
function queueTopicAssetReference(sessionId, ref) {
|
|
@@ -19122,30 +18973,9 @@ function queueTopicAssetReference(sessionId, ref) {
|
|
|
19122
18973
|
}
|
|
19123
18974
|
|
|
19124
18975
|
// src/rich-input/use-dismiss-skill-suggestions-on-mode-change.ts
|
|
19125
|
-
import { useEffect
|
|
18976
|
+
import { useEffect, useRef } from "react";
|
|
19126
18977
|
|
|
19127
18978
|
// src/rich-input/extensions/skill-mention.ts
|
|
19128
|
-
function workflowParamsTail(item) {
|
|
19129
|
-
const params = (item.inputs ?? []).filter((p) => p.name);
|
|
19130
|
-
if (params.length === 0) return " ";
|
|
19131
|
-
const filled = params.map((p) => {
|
|
19132
|
-
const hasDefault = p.default !== void 0 && p.default !== null;
|
|
19133
|
-
const value = hasDefault ? typeof p.default === "string" ? p.default : JSON.stringify(p.default) : `<${p.description || "\u586B\u503C"}>`;
|
|
19134
|
-
return `${p.name}=${value}`;
|
|
19135
|
-
}).join(" ");
|
|
19136
|
-
return ` ${filled} `;
|
|
19137
|
-
}
|
|
19138
|
-
function workflowRunText(item) {
|
|
19139
|
-
return `\u8FD0\u884C\u5DE5\u4F5C\u6D41 ${item.name}${workflowParamsTail(item)}`.trimEnd();
|
|
19140
|
-
}
|
|
19141
|
-
var COMMANDS = [
|
|
19142
|
-
{
|
|
19143
|
-
type: "command",
|
|
19144
|
-
id: "resync",
|
|
19145
|
-
label: "\u540C\u6B65\u6280\u80FD",
|
|
19146
|
-
description: "\u4ECE\u914D\u7F6E\u7684\u6280\u80FD\u76EE\u5F55\u62C9\u53D6\u6700\u65B0\u5185\u5BB9"
|
|
19147
|
-
}
|
|
19148
|
-
];
|
|
19149
18979
|
var skillMentionSuggestionKey = new PluginKey("skillMentionSuggestion");
|
|
19150
18980
|
function getSkillMentionName(attrs) {
|
|
19151
18981
|
return attrs.displayName || attrs.skillId || "";
|
|
@@ -19227,8 +19057,8 @@ var SkillMention = index_default.extend({
|
|
|
19227
19057
|
// src/rich-input/use-dismiss-skill-suggestions-on-mode-change.ts
|
|
19228
19058
|
function useDismissSkillSuggestionsOnModeChange(editor) {
|
|
19229
19059
|
const renderMode = useChatRenderMode();
|
|
19230
|
-
const previousRef =
|
|
19231
|
-
|
|
19060
|
+
const previousRef = useRef(renderMode);
|
|
19061
|
+
useEffect(() => {
|
|
19232
19062
|
if (previousRef.current === renderMode) return;
|
|
19233
19063
|
previousRef.current = renderMode;
|
|
19234
19064
|
if (editor && !editor.isDestroyed && skillMentionSuggestionKey.getState(editor.state)?.active) {
|
|
@@ -19239,12 +19069,12 @@ function useDismissSkillSuggestionsOnModeChange(editor) {
|
|
|
19239
19069
|
|
|
19240
19070
|
// ../../node_modules/.pnpm/@tiptap+react@3.20.4_@floating-ui+dom@1.7.6_@tiptap+core@3.20.4_@tiptap+pm@3.20.4__@tip_1ce9f35538141630e675758ebf46eb2f/node_modules/@tiptap/react/dist/index.js
|
|
19241
19071
|
var import_shim = __toESM(require_shim(), 1);
|
|
19242
|
-
import { createContext
|
|
19072
|
+
import { createContext, useContext, useMemo as useMemo2 } from "react";
|
|
19243
19073
|
import React, { forwardRef } from "react";
|
|
19244
19074
|
import ReactDOM from "react-dom";
|
|
19245
|
-
import { Fragment as Fragment3, jsx as
|
|
19075
|
+
import { Fragment as Fragment3, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
19246
19076
|
var import_shim2 = __toESM(require_shim(), 1);
|
|
19247
|
-
import { useDebugValue as useDebugValue2, useEffect as
|
|
19077
|
+
import { useDebugValue as useDebugValue2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
19248
19078
|
|
|
19249
19079
|
// ../../node_modules/.pnpm/fast-equals@5.4.0/node_modules/fast-equals/dist/es/index.mjs
|
|
19250
19080
|
var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
@@ -19686,10 +19516,10 @@ function createCustomEqual(options = {}) {
|
|
|
19686
19516
|
|
|
19687
19517
|
// ../../node_modules/.pnpm/@tiptap+react@3.20.4_@floating-ui+dom@1.7.6_@tiptap+core@3.20.4_@tiptap+pm@3.20.4__@tip_1ce9f35538141630e675758ebf46eb2f/node_modules/@tiptap/react/dist/index.js
|
|
19688
19518
|
var import_with_selector = __toESM(require_with_selector(), 1);
|
|
19689
|
-
import { useDebugValue, useEffect as
|
|
19519
|
+
import { useDebugValue, useEffect as useEffect3, useLayoutEffect, useState as useState3 } from "react";
|
|
19690
19520
|
import { jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
19691
|
-
import { createContext as
|
|
19692
|
-
import { jsx as
|
|
19521
|
+
import { createContext as createContext2, createElement, useContext as useContext2 } from "react";
|
|
19522
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
19693
19523
|
import React3 from "react";
|
|
19694
19524
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
19695
19525
|
import React4 from "react";
|
|
@@ -19719,7 +19549,7 @@ var Portals = ({ contentComponent }) => {
|
|
|
19719
19549
|
contentComponent.getSnapshot,
|
|
19720
19550
|
contentComponent.getServerSnapshot
|
|
19721
19551
|
);
|
|
19722
|
-
return /* @__PURE__ */
|
|
19552
|
+
return /* @__PURE__ */ jsx2(Fragment3, { children: Object.values(renderers) });
|
|
19723
19553
|
};
|
|
19724
19554
|
function getInstance() {
|
|
19725
19555
|
const subscribers = /* @__PURE__ */ new Set();
|
|
@@ -19840,8 +19670,8 @@ var PureEditorContent = class extends React.Component {
|
|
|
19840
19670
|
render() {
|
|
19841
19671
|
const { editor, innerRef, ...rest } = this.props;
|
|
19842
19672
|
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
19843
|
-
/* @__PURE__ */
|
|
19844
|
-
(editor == null ? void 0 : editor.contentComponent) && /* @__PURE__ */
|
|
19673
|
+
/* @__PURE__ */ jsx2("div", { ref: mergeRefs(innerRef, this.editorContentRef), ...rest }),
|
|
19674
|
+
(editor == null ? void 0 : editor.contentComponent) && /* @__PURE__ */ jsx2(Portals, { contentComponent: editor.contentComponent })
|
|
19845
19675
|
] });
|
|
19846
19676
|
}
|
|
19847
19677
|
};
|
|
@@ -19858,7 +19688,7 @@ var EditorContentWithKey = forwardRef(
|
|
|
19858
19688
|
}
|
|
19859
19689
|
);
|
|
19860
19690
|
var EditorContent = React.memo(EditorContentWithKey);
|
|
19861
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect :
|
|
19691
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect3;
|
|
19862
19692
|
var EditorStateManager = class {
|
|
19863
19693
|
constructor(initialEditor) {
|
|
19864
19694
|
this.transactionNumber = 0;
|
|
@@ -20166,7 +19996,7 @@ var EditorInstanceManager = class _EditorInstanceManager {
|
|
|
20166
19996
|
}
|
|
20167
19997
|
};
|
|
20168
19998
|
function useEditor(options = {}, deps = []) {
|
|
20169
|
-
const mostRecentOptions =
|
|
19999
|
+
const mostRecentOptions = useRef2(options);
|
|
20170
20000
|
mostRecentOptions.current = options;
|
|
20171
20001
|
const [instanceManager] = useState2(() => new EditorInstanceManager(mostRecentOptions));
|
|
20172
20002
|
const editor = (0, import_shim2.useSyncExternalStore)(
|
|
@@ -20175,7 +20005,7 @@ function useEditor(options = {}, deps = []) {
|
|
|
20175
20005
|
instanceManager.getServerSnapshot
|
|
20176
20006
|
);
|
|
20177
20007
|
useDebugValue2(editor);
|
|
20178
|
-
|
|
20008
|
+
useEffect2(instanceManager.onRender(deps));
|
|
20179
20009
|
useEditorState({
|
|
20180
20010
|
editor,
|
|
20181
20011
|
selector: ({ transactionNumber }) => {
|
|
@@ -20190,18 +20020,18 @@ function useEditor(options = {}, deps = []) {
|
|
|
20190
20020
|
});
|
|
20191
20021
|
return editor;
|
|
20192
20022
|
}
|
|
20193
|
-
var EditorContext =
|
|
20023
|
+
var EditorContext = createContext({
|
|
20194
20024
|
editor: null
|
|
20195
20025
|
});
|
|
20196
20026
|
var EditorConsumer = EditorContext.Consumer;
|
|
20197
|
-
var ReactNodeViewContext =
|
|
20027
|
+
var ReactNodeViewContext = createContext2({
|
|
20198
20028
|
onDragStart: () => {
|
|
20199
20029
|
},
|
|
20200
20030
|
nodeViewContentChildren: void 0,
|
|
20201
20031
|
nodeViewContentRef: () => {
|
|
20202
20032
|
}
|
|
20203
20033
|
});
|
|
20204
|
-
var useReactNodeView = () =>
|
|
20034
|
+
var useReactNodeView = () => useContext2(ReactNodeViewContext);
|
|
20205
20035
|
var NodeViewWrapper = React3.forwardRef((props, ref) => {
|
|
20206
20036
|
const { onDragStart } = useReactNodeView();
|
|
20207
20037
|
const Tag = props.as || "div";
|
|
@@ -25264,8 +25094,8 @@ var index_default2 = StarterKit;
|
|
|
25264
25094
|
|
|
25265
25095
|
// src/rich-input/ChatInput.tsx
|
|
25266
25096
|
import {
|
|
25267
|
-
useEffect as
|
|
25268
|
-
useRef as
|
|
25097
|
+
useEffect as useEffect8,
|
|
25098
|
+
useRef as useRef7,
|
|
25269
25099
|
useState as useState11
|
|
25270
25100
|
} from "react";
|
|
25271
25101
|
import { createRoot } from "react-dom/client";
|
|
@@ -25280,7 +25110,7 @@ function skillDisplayName(skill) {
|
|
|
25280
25110
|
}
|
|
25281
25111
|
|
|
25282
25112
|
// src/rich-input/voice/use-tiptap-voice-input.ts
|
|
25283
|
-
import { useCallback
|
|
25113
|
+
import { useCallback, useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
25284
25114
|
var IDLE_VOICE = {
|
|
25285
25115
|
status: "idle",
|
|
25286
25116
|
error: null,
|
|
@@ -25296,8 +25126,8 @@ function useNoVoiceInput() {
|
|
|
25296
25126
|
function useTiptapVoiceInput(options) {
|
|
25297
25127
|
const { editorRef, workletUrl, onError } = options;
|
|
25298
25128
|
const useVoiceInput2 = options.useVoiceInput ?? useNoVoiceInput;
|
|
25299
|
-
const partialRangeRef =
|
|
25300
|
-
const lastPartialLenRef =
|
|
25129
|
+
const partialRangeRef = useRef3(null);
|
|
25130
|
+
const lastPartialLenRef = useRef3(0);
|
|
25301
25131
|
const handlePartial = useEffectEvent((text) => {
|
|
25302
25132
|
const ed = editorRef.current;
|
|
25303
25133
|
if (!ed) return;
|
|
@@ -25347,18 +25177,18 @@ function useTiptapVoiceInput(options) {
|
|
|
25347
25177
|
onError: handleError
|
|
25348
25178
|
});
|
|
25349
25179
|
const isRecording = voice.status === "recording";
|
|
25350
|
-
|
|
25180
|
+
useEffect4(() => {
|
|
25351
25181
|
const ed = editorRef.current;
|
|
25352
25182
|
if (!ed) return;
|
|
25353
25183
|
ed.setEditable(!isRecording);
|
|
25354
25184
|
}, [isRecording, editorRef]);
|
|
25355
|
-
|
|
25185
|
+
useEffect4(() => {
|
|
25356
25186
|
if (voice.status === "idle" || voice.status === "error") {
|
|
25357
25187
|
partialRangeRef.current = null;
|
|
25358
25188
|
lastPartialLenRef.current = 0;
|
|
25359
25189
|
}
|
|
25360
25190
|
}, [voice.status]);
|
|
25361
|
-
const toggle =
|
|
25191
|
+
const toggle = useCallback(() => {
|
|
25362
25192
|
if (voice.status === "recording" || voice.status === "starting") {
|
|
25363
25193
|
void voice.stop();
|
|
25364
25194
|
} else {
|
|
@@ -25415,7 +25245,7 @@ function VoiceWaveform({ level, color = "currentColor", size = 16 }) {
|
|
|
25415
25245
|
}
|
|
25416
25246
|
|
|
25417
25247
|
// src/rich-input/model/resolve-model.ts
|
|
25418
|
-
import { useMemo as
|
|
25248
|
+
import { useMemo as useMemo3 } from "react";
|
|
25419
25249
|
var MODEL_LOADING_SEND_HINT = "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u914D\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u518D\u53D1\u9001";
|
|
25420
25250
|
function gateSendWhileModelLoading(isModelLoading, hasContent) {
|
|
25421
25251
|
if (!isModelLoading) return { blocked: false };
|
|
@@ -25484,7 +25314,7 @@ function resolveModelChoice({
|
|
|
25484
25314
|
function useResolvedModel(activeSessionModel) {
|
|
25485
25315
|
const { models, defaultModel, thinkingAvailable, isLoading, unavailableProviderIds, unavailableModelIds } = useModelCatalog();
|
|
25486
25316
|
const { preferredModel } = useModelPreferences();
|
|
25487
|
-
const resolved =
|
|
25317
|
+
const resolved = useMemo3(() => {
|
|
25488
25318
|
return resolveModelChoice({
|
|
25489
25319
|
activeSessionModel,
|
|
25490
25320
|
preferredModel,
|
|
@@ -25504,9 +25334,6 @@ function useResolvedModel(activeSessionModel) {
|
|
|
25504
25334
|
reasoningLevels: selectedModel?.reasoningLevels ?? [],
|
|
25505
25335
|
defaultReasoningLevel: selectedModel?.defaultReasoningLevel ?? "",
|
|
25506
25336
|
modelAvailabilityMessage,
|
|
25507
|
-
// Undefined means the catalog is still loading or the model does not
|
|
25508
|
-
// publish this optional capability. In either case keep existing upload
|
|
25509
|
-
// behavior until the server has explicitly said images are unsupported.
|
|
25510
25337
|
supportsImage: selectedModel?.supportsImage ?? selectedModel?.inputModalities?.includes("image")
|
|
25511
25338
|
};
|
|
25512
25339
|
}
|
|
@@ -25521,17 +25348,21 @@ function useReasoningLevelPreference(modelId) {
|
|
|
25521
25348
|
}
|
|
25522
25349
|
|
|
25523
25350
|
// src/rich-input/model/use-composer-model.ts
|
|
25524
|
-
import { useEffect as
|
|
25351
|
+
import { useEffect as useEffect5, useRef as useRef4, useState as useState4 } from "react";
|
|
25525
25352
|
function useInjectedSessionModel(sessionId) {
|
|
25526
25353
|
return useChatSessionDetail(sessionId)?.model ?? null;
|
|
25527
25354
|
}
|
|
25528
25355
|
function useComposerModel(activeSessionId) {
|
|
25529
25356
|
const [newSessionModelSelection, setNewSessionModelSelection] = useState4(null);
|
|
25530
|
-
const newSessionModelSelectionRef =
|
|
25357
|
+
const newSessionModelSelectionRef = useRef4(null);
|
|
25531
25358
|
const { setPreferredModel } = useModelPreferences();
|
|
25532
25359
|
const { models: modelCatalog } = useModelCatalog();
|
|
25533
25360
|
const useSessionModel = useChatEnvironment().useSessionDetail ? useInjectedSessionModel : useClientSessionModel;
|
|
25534
25361
|
const activeSessionModel = useSessionModel(activeSessionId);
|
|
25362
|
+
const session = useSessionHandle(activeSessionId);
|
|
25363
|
+
const source = useSessionSource();
|
|
25364
|
+
const [selectingSession, setSelectingSession] = useState4(null);
|
|
25365
|
+
const selectingRef = useRef4(null);
|
|
25535
25366
|
const sharedModelDraft = useComposerChannels(
|
|
25536
25367
|
(state3) => activeSessionId ? state3.modelDrafts[activeSessionId] : void 0
|
|
25537
25368
|
);
|
|
@@ -25546,18 +25377,18 @@ function useComposerModel(activeSessionId) {
|
|
|
25546
25377
|
isLoading
|
|
25547
25378
|
} = useResolvedModel(resolveComposerModel(activeSessionId, activeSessionModel, explicitModelSelection));
|
|
25548
25379
|
const { reasoningLevelPreference, setReasoningLevelPreference } = useReasoningLevelPreference(selectedModel);
|
|
25549
|
-
|
|
25380
|
+
useEffect5(() => {
|
|
25550
25381
|
if (!activeSessionId || !newSessionModelSelectionRef.current) return;
|
|
25551
25382
|
newSessionModelSelectionRef.current = null;
|
|
25552
25383
|
setNewSessionModelSelection(null);
|
|
25553
25384
|
}, [activeSessionId]);
|
|
25554
|
-
|
|
25385
|
+
useEffect5(() => {
|
|
25555
25386
|
if (!activeSessionId || !sharedModelDraft || isLoading || modelCatalog.length === 0) return;
|
|
25556
25387
|
if (!modelCatalog.some((model) => model.id === sharedModelDraft)) {
|
|
25557
25388
|
composerChannels.clearModelDraft(activeSessionId);
|
|
25558
25389
|
}
|
|
25559
25390
|
}, [activeSessionId, sharedModelDraft, isLoading, modelCatalog]);
|
|
25560
|
-
|
|
25391
|
+
useEffect5(() => {
|
|
25561
25392
|
if (!activeSessionId || sharedModelDraft !== activeSessionModel) return;
|
|
25562
25393
|
composerChannels.clearModelDraft(activeSessionId);
|
|
25563
25394
|
}, [activeSessionId, activeSessionModel, sharedModelDraft]);
|
|
@@ -25565,7 +25396,7 @@ function useComposerModel(activeSessionId) {
|
|
|
25565
25396
|
return {
|
|
25566
25397
|
selectedModel,
|
|
25567
25398
|
hasAvailableModel,
|
|
25568
|
-
isLoading,
|
|
25399
|
+
isLoading: isLoading || !!activeSessionId && (selectingSession === activeSessionId || !session),
|
|
25569
25400
|
availabilityMessage: modelAvailabilityMessage,
|
|
25570
25401
|
thinkingAvailable,
|
|
25571
25402
|
reasoningLevels,
|
|
@@ -25573,7 +25404,22 @@ function useComposerModel(activeSessionId) {
|
|
|
25573
25404
|
setReasoningLevel: setReasoningLevelPreference,
|
|
25574
25405
|
selectModel(model) {
|
|
25575
25406
|
if (activeSessionId) {
|
|
25407
|
+
if (selectingRef.current === activeSessionId) return;
|
|
25408
|
+
selectingRef.current = activeSessionId;
|
|
25409
|
+
setSelectingSession(activeSessionId);
|
|
25576
25410
|
composerChannels.setModelDraft(activeSessionId, model);
|
|
25411
|
+
const select = (ready) => ready.selectModel(model);
|
|
25412
|
+
const pending = source.whenReady ? source.whenReady(activeSessionId, select) : session ? select(session) : Promise.resolve(false);
|
|
25413
|
+
void pending.catch(() => false).then((ok) => {
|
|
25414
|
+
if (!ok && composerChannels.getState().modelDrafts[activeSessionId] === model) {
|
|
25415
|
+
composerChannels.clearModelDraft(activeSessionId);
|
|
25416
|
+
}
|
|
25417
|
+
}).finally(() => {
|
|
25418
|
+
if (selectingRef.current === activeSessionId) {
|
|
25419
|
+
selectingRef.current = null;
|
|
25420
|
+
setSelectingSession(null);
|
|
25421
|
+
}
|
|
25422
|
+
});
|
|
25577
25423
|
} else {
|
|
25578
25424
|
const selection = { sessionId: activeSessionId, model };
|
|
25579
25425
|
newSessionModelSelectionRef.current = selection;
|
|
@@ -25637,7 +25483,7 @@ function PopoverContent({
|
|
|
25637
25483
|
}
|
|
25638
25484
|
|
|
25639
25485
|
// src/rich-input/ModelSelector.tsx
|
|
25640
|
-
import { useMemo as
|
|
25486
|
+
import { useMemo as useMemo4, useState as useState5 } from "react";
|
|
25641
25487
|
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
25642
25488
|
var inputModalityLabels = {
|
|
25643
25489
|
text: "\u6587\u672C",
|
|
@@ -25679,7 +25525,7 @@ function ModelSelector({
|
|
|
25679
25525
|
}
|
|
25680
25526
|
void refresh();
|
|
25681
25527
|
}
|
|
25682
|
-
const filteredModels =
|
|
25528
|
+
const filteredModels = useMemo4(() => {
|
|
25683
25529
|
const normalized = query.trim().toLowerCase();
|
|
25684
25530
|
if (!normalized) return models;
|
|
25685
25531
|
return models.filter(
|
|
@@ -25706,10 +25552,7 @@ function ModelSelector({
|
|
|
25706
25552
|
className: `flex min-w-0 items-center gap-1 rounded-lg py-[5px] text-muted-foreground ${compact ? "ml-auto px-1.5" : "px-2.5"}`,
|
|
25707
25553
|
title: selectorTitle,
|
|
25708
25554
|
children: [
|
|
25709
|
-
isLoading ? /* @__PURE__ */ jsx12(LoaderCircle, { size: 14, className: "animate-spin", "aria-hidden": "true" }) : compact ? null : (
|
|
25710
|
-
// compact 用于「+」菜单的「模型」行,行首已有图标,触发器内不再重复。
|
|
25711
|
-
/* @__PURE__ */ jsx12(Sparkles, { size: 14, "aria-hidden": "true" })
|
|
25712
|
-
),
|
|
25555
|
+
isLoading ? /* @__PURE__ */ jsx12(LoaderCircle, { size: 14, className: "animate-spin", "aria-hidden": "true" }) : compact ? null : /* @__PURE__ */ jsx12(Sparkles, { size: 14, "aria-hidden": "true" }),
|
|
25713
25556
|
/* @__PURE__ */ jsx12(
|
|
25714
25557
|
"span",
|
|
25715
25558
|
{
|
|
@@ -25815,7 +25658,7 @@ function ModelSelector({
|
|
|
25815
25658
|
}
|
|
25816
25659
|
|
|
25817
25660
|
// src/rich-input/SkillStatusBar.tsx
|
|
25818
|
-
import { useMemo as
|
|
25661
|
+
import { useMemo as useMemo5 } from "react";
|
|
25819
25662
|
|
|
25820
25663
|
// src/chat/lib/skill-visibility.ts
|
|
25821
25664
|
function visibleSkills(skills, mode) {
|
|
@@ -25972,8 +25815,6 @@ function HoverPanel({
|
|
|
25972
25815
|
}
|
|
25973
25816
|
function SkillStatusBar({
|
|
25974
25817
|
sessionId,
|
|
25975
|
-
onResync,
|
|
25976
|
-
isResyncing = false,
|
|
25977
25818
|
vertical = false,
|
|
25978
25819
|
className,
|
|
25979
25820
|
innerClassName,
|
|
@@ -25995,7 +25836,7 @@ function SkillStatusBar({
|
|
|
25995
25836
|
const { status: connectionStatus, reconnectAttempt, hasEverConnected } = useComposerConnectionInfo(sessionId);
|
|
25996
25837
|
const statsReady = !loading && !error;
|
|
25997
25838
|
const skillStoreConnected = statsReady && skillStats.remote_connected;
|
|
25998
|
-
const connectionMeta =
|
|
25839
|
+
const connectionMeta = useMemo5(
|
|
25999
25840
|
() => getConnectionMeta(
|
|
26000
25841
|
connectionStatus,
|
|
26001
25842
|
reconnectAttempt,
|
|
@@ -26015,7 +25856,8 @@ function SkillStatusBar({
|
|
|
26015
25856
|
text: skillStoreConnected ? `\u5DF2\u5B89\u88C5 ${skillStats.installed_skill_count} \u4E2A\u6280\u80FD` : "\u5C1A\u672A\u767B\u5F55\u6280\u80FD\u5546\u5E97"
|
|
26016
25857
|
}
|
|
26017
25858
|
].filter((item) => item.key !== "total" || skillStats.remote_configured);
|
|
26018
|
-
const tokenSummary =
|
|
25859
|
+
const tokenSummary = useMemo5(() => {
|
|
25860
|
+
if (mode !== "developer") return null;
|
|
26019
25861
|
if (contextStatsLoading || contextStatsError || !contextStats) {
|
|
26020
25862
|
return {
|
|
26021
25863
|
detail: /* @__PURE__ */ jsx14("div", { className: "pt-1 text-[hsl(var(--muted-foreground))]", children: "\u4E0A\u4E0B\u6587\u7EDF\u8BA1\u4E0D\u53EF\u7528" }),
|
|
@@ -26041,7 +25883,7 @@ function SkillStatusBar({
|
|
|
26041
25883
|
label: contextStats.context_window > 0 ? `${formatTokensK(contextStats.tokens_used)} / ${formatTokensK(contextStats.context_window)} \u4F1A\u8BDD\u6D88\u606F\u4F30\u7B97` : `${formatTokensK(contextStats.tokens_used)} \u4F1A\u8BDD\u6D88\u606F\u4F30\u7B97`,
|
|
26042
25884
|
warn: tokenPressure.level === "critical"
|
|
26043
25885
|
};
|
|
26044
|
-
}, [contextStats, contextStatsError, contextStatsLoading, tokenPressure.level]);
|
|
25886
|
+
}, [mode, contextStats, contextStatsError, contextStatsLoading, tokenPressure.level]);
|
|
26045
25887
|
const containerClass = vertical ? "text-[11px] text-[hsl(var(--muted-foreground))]" : "bg-[hsl(var(--background))] px-5 pt-2";
|
|
26046
25888
|
const innerClass = vertical ? "" : "mx-auto max-w-3xl";
|
|
26047
25889
|
const listClass = vertical ? "flex flex-col items-stretch gap-1.5 text-[11px] text-[hsl(var(--muted-foreground))]" : "flex flex-wrap items-center gap-2 text-[10px] text-[hsl(var(--muted-foreground))]";
|
|
@@ -26080,35 +25922,20 @@ function SkillStatusBar({
|
|
|
26080
25922
|
/* @__PURE__ */ jsx14("span", { className: `inline-block h-1.5 w-1.5 rounded-full ${item.dotClass}` }),
|
|
26081
25923
|
item.key === "loaded" ? /* @__PURE__ */ jsxs5("div", { className: "group/skill relative flex items-center gap-1.5", children: [
|
|
26082
25924
|
/* @__PURE__ */ jsx14("span", { className: "font-mono", children: item.text }),
|
|
26083
|
-
onResync ? /* @__PURE__ */ jsx14(
|
|
26084
|
-
"button",
|
|
26085
|
-
{
|
|
26086
|
-
type: "button",
|
|
26087
|
-
onClick: onResync,
|
|
26088
|
-
disabled: isResyncing,
|
|
26089
|
-
"aria-label": "\u540C\u6B65\u6280\u80FD",
|
|
26090
|
-
className: "inline-flex h-5 w-5 items-center justify-center rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--background))] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))] disabled:cursor-not-allowed disabled:opacity-50",
|
|
26091
|
-
children: /* @__PURE__ */ jsx14(RefreshCw, { size: 12, className: isResyncing ? "animate-spin" : "" })
|
|
26092
|
-
}
|
|
26093
|
-
) : null,
|
|
26094
25925
|
loadedReady && sessionSkills.length > 0 ? /* @__PURE__ */ jsx14(HoverPanel, { title: "\u5DF2\u52A0\u8F7D\u6280\u80FD", children: sessionSkills.length > 0 ? /* @__PURE__ */ jsx14("div", { className: "max-h-40 overflow-y-auto", children: sessionSkills.map((skill) => /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-2 py-1 leading-relaxed", children: [
|
|
26095
25926
|
/* @__PURE__ */ jsx14("span", { className: "mt-1.5 inline-block h-2 w-2 shrink-0 rounded-full border border-[hsl(var(--swf-success))] bg-transparent" }),
|
|
26096
25927
|
/* @__PURE__ */ jsx14("span", { className: "break-words", children: skillDisplayName(skill) })
|
|
26097
25928
|
] }, skill.skill_id)) }) : null }) : null
|
|
26098
|
-
] }) : (
|
|
26099
|
-
|
|
26100
|
-
|
|
26101
|
-
|
|
26102
|
-
|
|
26103
|
-
|
|
26104
|
-
|
|
26105
|
-
|
|
26106
|
-
|
|
26107
|
-
|
|
26108
|
-
children: item.text
|
|
26109
|
-
}
|
|
26110
|
-
) : /* @__PURE__ */ jsx14("span", { className: "font-mono", children: item.text })
|
|
26111
|
-
)
|
|
25929
|
+
] }) : onOpenSkills ? /* @__PURE__ */ jsx14(
|
|
25930
|
+
"button",
|
|
25931
|
+
{
|
|
25932
|
+
type: "button",
|
|
25933
|
+
onClick: onOpenSkills,
|
|
25934
|
+
title: "\u67E5\u770B\u5DF2\u5B89\u88C5\u7684\u6280\u80FD",
|
|
25935
|
+
className: "cursor-pointer font-mono underline decoration-dotted underline-offset-2 transition-colors hover:text-[hsl(var(--foreground))]",
|
|
25936
|
+
children: item.text
|
|
25937
|
+
}
|
|
25938
|
+
) : /* @__PURE__ */ jsx14("span", { className: "font-mono", children: item.text })
|
|
26112
25939
|
]
|
|
26113
25940
|
},
|
|
26114
25941
|
item.key
|
|
@@ -26116,11 +25943,72 @@ function SkillStatusBar({
|
|
|
26116
25943
|
] }) }) });
|
|
26117
25944
|
}
|
|
26118
25945
|
|
|
25946
|
+
// src/rich-input/InputActionSubmenu.tsx
|
|
25947
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
25948
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
25949
|
+
var narrowQuery = "(max-width: 639px)";
|
|
25950
|
+
function subscribeToViewport(onChange) {
|
|
25951
|
+
const media = window.matchMedia(narrowQuery);
|
|
25952
|
+
media.addEventListener("change", onChange);
|
|
25953
|
+
return () => media.removeEventListener("change", onChange);
|
|
25954
|
+
}
|
|
25955
|
+
var isNarrowViewport = () => window.matchMedia(narrowQuery).matches;
|
|
25956
|
+
function InputActionSubmenu({ label, icon, open, onOpenChange, children, disabled = false }) {
|
|
25957
|
+
const narrow = useSyncExternalStore4(subscribeToViewport, isNarrowViewport, () => false);
|
|
25958
|
+
return /* @__PURE__ */ jsxs6(dist_exports.Root, { open, onOpenChange, children: [
|
|
25959
|
+
/* @__PURE__ */ jsx15(dist_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
|
|
25960
|
+
"button",
|
|
25961
|
+
{
|
|
25962
|
+
type: "button",
|
|
25963
|
+
disabled,
|
|
25964
|
+
onClick: (event) => {
|
|
25965
|
+
event.preventDefault();
|
|
25966
|
+
onOpenChange(true);
|
|
25967
|
+
},
|
|
25968
|
+
onPointerEnter: (event) => {
|
|
25969
|
+
if (event.pointerType === "mouse" && !disabled) onOpenChange(true);
|
|
25970
|
+
},
|
|
25971
|
+
onKeyDown: (event) => {
|
|
25972
|
+
if (event.key === "ArrowRight") {
|
|
25973
|
+
event.preventDefault();
|
|
25974
|
+
onOpenChange(true);
|
|
25975
|
+
}
|
|
25976
|
+
},
|
|
25977
|
+
className: "flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-sm text-[hsl(var(--popover-foreground))] outline-none hover:bg-[hsl(var(--accent))] focus-visible:bg-[hsl(var(--accent))] disabled:opacity-50 data-[state=open]:bg-[hsl(var(--accent))]",
|
|
25978
|
+
children: [
|
|
25979
|
+
icon,
|
|
25980
|
+
/* @__PURE__ */ jsx15("span", { children: label }),
|
|
25981
|
+
/* @__PURE__ */ jsx15(ChevronRight, { size: 14, className: "ml-auto", "aria-hidden": "true" })
|
|
25982
|
+
]
|
|
25983
|
+
}
|
|
25984
|
+
) }),
|
|
25985
|
+
/* @__PURE__ */ jsx15(dist_exports.Portal, { children: /* @__PURE__ */ jsx15(
|
|
25986
|
+
dist_exports.Content,
|
|
25987
|
+
{
|
|
25988
|
+
side: narrow ? "bottom" : "right",
|
|
25989
|
+
align: "start",
|
|
25990
|
+
sideOffset: 8,
|
|
25991
|
+
collisionPadding: 12,
|
|
25992
|
+
"aria-label": label,
|
|
25993
|
+
onEscapeKeyDown: (event) => event.stopPropagation(),
|
|
25994
|
+
onKeyDown: (event) => {
|
|
25995
|
+
if (event.key === "ArrowLeft" && !(event.target instanceof HTMLInputElement || event.target instanceof HTMLSelectElement)) {
|
|
25996
|
+
event.preventDefault();
|
|
25997
|
+
onOpenChange(false);
|
|
25998
|
+
}
|
|
25999
|
+
},
|
|
26000
|
+
className: "z-50 max-h-[min(70vh,var(--radix-popover-content-available-height))] w-[min(320px,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)] outline-none",
|
|
26001
|
+
children
|
|
26002
|
+
}
|
|
26003
|
+
) })
|
|
26004
|
+
] });
|
|
26005
|
+
}
|
|
26006
|
+
|
|
26119
26007
|
// src/rich-input/ConnectButton.tsx
|
|
26120
26008
|
import { useState as useState6 } from "react";
|
|
26121
26009
|
|
|
26122
26010
|
// src/rich-input/lib/skill-suggestions.ts
|
|
26123
|
-
var
|
|
26011
|
+
var sessionPath = (sessionId, rest) => `/api/sessions/${encodeURIComponent(sessionId)}/${rest}`;
|
|
26124
26012
|
function toItem(skill) {
|
|
26125
26013
|
return {
|
|
26126
26014
|
type: "skill",
|
|
@@ -26128,9 +26016,8 @@ function toItem(skill) {
|
|
|
26128
26016
|
displayName: skill.display_name,
|
|
26129
26017
|
description: skill.description,
|
|
26130
26018
|
local: skill.local,
|
|
26131
|
-
|
|
26132
|
-
|
|
26133
|
-
installed: "installed" in skill ? skill.installed : skill.local
|
|
26019
|
+
installed: "installed" in skill ? skill.installed : skill.local,
|
|
26020
|
+
hasFlow: skill.has_flow === true
|
|
26134
26021
|
};
|
|
26135
26022
|
}
|
|
26136
26023
|
var CACHE_TTL_MS = 15e3;
|
|
@@ -26138,19 +26025,12 @@ var cachesByClient = /* @__PURE__ */ new WeakMap();
|
|
|
26138
26025
|
function cachesFor(client) {
|
|
26139
26026
|
const existing = cachesByClient.get(client);
|
|
26140
26027
|
if (existing) return existing;
|
|
26141
|
-
const
|
|
26142
|
-
|
|
26143
|
-
workflows: /* @__PURE__ */ new Map(),
|
|
26144
|
-
workflowsRefreshedAt: /* @__PURE__ */ new Map(),
|
|
26145
|
-
workflowsAbort: null,
|
|
26146
|
-
searchSeq: 0
|
|
26147
|
-
};
|
|
26148
|
-
cachesByClient.set(client, caches2);
|
|
26028
|
+
const caches = { requests: /* @__PURE__ */ new Map(), searchSeq: 0 };
|
|
26029
|
+
cachesByClient.set(client, caches);
|
|
26149
26030
|
onInputCachesReset(client, () => {
|
|
26150
|
-
|
|
26151
|
-
if (cachesByClient.get(client) === caches2) cachesByClient.delete(client);
|
|
26031
|
+
if (cachesByClient.get(client) === caches) cachesByClient.delete(client);
|
|
26152
26032
|
});
|
|
26153
|
-
return
|
|
26033
|
+
return caches;
|
|
26154
26034
|
}
|
|
26155
26035
|
function cached(client, key, load) {
|
|
26156
26036
|
const { requests } = cachesFor(client);
|
|
@@ -26164,9 +26044,7 @@ function cached(client, key, load) {
|
|
|
26164
26044
|
return request;
|
|
26165
26045
|
}
|
|
26166
26046
|
function invalidateSlashSuggestions(client, sessionId) {
|
|
26167
|
-
|
|
26168
|
-
caches2.requests.delete(`session-skills:${sessionId ?? ""}`);
|
|
26169
|
-
caches2.workflows.delete(sessionId ?? "__home__");
|
|
26047
|
+
cachesFor(client).requests.delete(`session-skills:${sessionId ?? ""}`);
|
|
26170
26048
|
}
|
|
26171
26049
|
async function loadSessionSkills({ client, sessionId, renderMode }) {
|
|
26172
26050
|
if (!sessionId) return [];
|
|
@@ -26174,79 +26052,50 @@ async function loadSessionSkills({ client, sessionId, renderMode }) {
|
|
|
26174
26052
|
const skills = await cached(
|
|
26175
26053
|
client,
|
|
26176
26054
|
`session-skills:${sessionId}`,
|
|
26177
|
-
() => client.json("GET",
|
|
26055
|
+
() => client.json("GET", sessionPath(sessionId, "skills"))
|
|
26178
26056
|
);
|
|
26179
26057
|
return visibleSkills(skills, renderMode);
|
|
26180
26058
|
} catch {
|
|
26181
26059
|
return [];
|
|
26182
26060
|
}
|
|
26183
26061
|
}
|
|
26062
|
+
var HUB_WAIT_MS = 600;
|
|
26184
26063
|
var DEFAULT_SUGGESTION_LIMIT = 50;
|
|
26185
26064
|
async function getDefaultSuggestions(options) {
|
|
26186
26065
|
if (options.sessionId) {
|
|
26187
26066
|
return (await loadSessionSkills(options)).map(toItem);
|
|
26188
26067
|
}
|
|
26068
|
+
const { client, renderMode } = options;
|
|
26069
|
+
const installedRequest = cached(
|
|
26070
|
+
client,
|
|
26071
|
+
"installed-skills",
|
|
26072
|
+
() => client.json("GET", "/api/skills/installed").catch(() => [])
|
|
26073
|
+
);
|
|
26189
26074
|
try {
|
|
26190
|
-
const
|
|
26191
|
-
|
|
26075
|
+
const local = await cached(client, "skills", () => client.json("GET", "/api/skills"));
|
|
26076
|
+
const installed = await Promise.race([
|
|
26077
|
+
installedRequest,
|
|
26078
|
+
new Promise((resolve) => setTimeout(() => resolve([]), HUB_WAIT_MS))
|
|
26079
|
+
]);
|
|
26080
|
+
const seen = new Set(local.map((skill) => skill.skill_id));
|
|
26081
|
+
const hub = (Array.isArray(installed) ? installed : []).filter((skill) => skill.id && !seen.has(skill.id)).map((skill) => ({
|
|
26082
|
+
skill_id: skill.id,
|
|
26083
|
+
display_name: skill.display_name ?? "",
|
|
26084
|
+
description: skill.description ?? "",
|
|
26085
|
+
local: false,
|
|
26086
|
+
installed: true,
|
|
26087
|
+
has_flow: skill.has_flow
|
|
26088
|
+
}));
|
|
26089
|
+
return [
|
|
26090
|
+
...visibleSkills(local, renderMode).slice(0, DEFAULT_SUGGESTION_LIMIT),
|
|
26091
|
+
...visibleSkills(hub, renderMode).slice(0, DEFAULT_SUGGESTION_LIMIT)
|
|
26092
|
+
].map(toItem);
|
|
26192
26093
|
} catch {
|
|
26193
26094
|
return [];
|
|
26194
26095
|
}
|
|
26195
26096
|
}
|
|
26196
|
-
async function loadWorkflows(client, sessionId) {
|
|
26197
|
-
const caches2 = cachesFor(client);
|
|
26198
|
-
caches2.workflowsAbort?.abort();
|
|
26199
|
-
const ac = new AbortController();
|
|
26200
|
-
caches2.workflowsAbort = ac;
|
|
26201
|
-
let timedOut = false;
|
|
26202
|
-
const timer = setTimeout(() => {
|
|
26203
|
-
timedOut = true;
|
|
26204
|
-
ac.abort();
|
|
26205
|
-
}, 1500);
|
|
26206
|
-
try {
|
|
26207
|
-
const res = await client.jsonFromInit(
|
|
26208
|
-
sessionId ? sessionPath2(sessionId, "workflows") : "/api/workflows",
|
|
26209
|
-
{ signal: ac.signal }
|
|
26210
|
-
);
|
|
26211
|
-
const items = res.workflows.map((w) => ({
|
|
26212
|
-
type: "workflow",
|
|
26213
|
-
name: w.name,
|
|
26214
|
-
displayName: w.display_name || w.name,
|
|
26215
|
-
description: w.description || "",
|
|
26216
|
-
inputs: w.inputs ?? []
|
|
26217
|
-
}));
|
|
26218
|
-
caches2.workflows.set(sessionId ?? "__home__", items);
|
|
26219
|
-
caches2.workflowsRefreshedAt.set(sessionId ?? "__home__", Date.now());
|
|
26220
|
-
return items;
|
|
26221
|
-
} catch (err) {
|
|
26222
|
-
if (timedOut || err?.name !== "AbortError") {
|
|
26223
|
-
caches2.workflows.set(sessionId ?? "__home__", []);
|
|
26224
|
-
}
|
|
26225
|
-
return caches2.workflows.get(sessionId ?? "__home__") ?? [];
|
|
26226
|
-
} finally {
|
|
26227
|
-
clearTimeout(timer);
|
|
26228
|
-
if (caches2.workflowsAbort === ac) caches2.workflowsAbort = null;
|
|
26229
|
-
}
|
|
26230
|
-
}
|
|
26231
26097
|
async function getSlashSuggestions(query, options) {
|
|
26232
|
-
|
|
26233
|
-
const cacheKey = options.sessionId ?? "__home__";
|
|
26234
|
-
const caches2 = cachesFor(options.client);
|
|
26235
|
-
const cachedWorkflows = caches2.workflows.get(cacheKey);
|
|
26236
|
-
let workflowsP;
|
|
26237
|
-
if (cachedWorkflows) {
|
|
26238
|
-
if (Date.now() - (caches2.workflowsRefreshedAt.get(cacheKey) ?? 0) >= CACHE_TTL_MS) {
|
|
26239
|
-
void loadWorkflows(options.client, options.sessionId);
|
|
26240
|
-
}
|
|
26241
|
-
workflowsP = Promise.resolve(cachedWorkflows);
|
|
26242
|
-
} else {
|
|
26243
|
-
workflowsP = loadWorkflows(options.client, options.sessionId);
|
|
26244
|
-
}
|
|
26245
|
-
const [workflows, skills] = await Promise.all([workflowsP, getSkillSuggestions(query, options)]);
|
|
26246
|
-
const matched = workflows.filter(
|
|
26247
|
-
(w) => !q || w.name.toLowerCase().includes(q) || w.displayName.toLowerCase().includes(q) || w.description.toLowerCase().includes(q)
|
|
26248
|
-
);
|
|
26249
|
-
return [...matched, ...skills];
|
|
26098
|
+
return getSkillSuggestions(query, options);
|
|
26250
26099
|
}
|
|
26251
26100
|
var SEARCH_DEBOUNCE_MS = 150;
|
|
26252
26101
|
async function getSkillSuggestions(query, options) {
|
|
@@ -26254,14 +26103,14 @@ async function getSkillSuggestions(query, options) {
|
|
|
26254
26103
|
if (!trimmed) {
|
|
26255
26104
|
return getDefaultSuggestions(options);
|
|
26256
26105
|
}
|
|
26257
|
-
const
|
|
26258
|
-
const seq = ++
|
|
26106
|
+
const caches = cachesFor(options.client);
|
|
26107
|
+
const seq = ++caches.searchSeq;
|
|
26259
26108
|
const q = trimmed.toLowerCase();
|
|
26260
26109
|
const sessionMatches = (await loadSessionSkills(options)).filter(
|
|
26261
26110
|
(skill) => skill.skill_id.toLowerCase().includes(q) || skill.description.toLowerCase().includes(q)
|
|
26262
26111
|
).map(toItem);
|
|
26263
26112
|
await new Promise((resolve) => setTimeout(resolve, SEARCH_DEBOUNCE_MS));
|
|
26264
|
-
if (seq !==
|
|
26113
|
+
if (seq !== caches.searchSeq) return sessionMatches;
|
|
26265
26114
|
try {
|
|
26266
26115
|
const seen = new Set(sessionMatches.map((item) => item.skillId));
|
|
26267
26116
|
const { client, renderMode } = options;
|
|
@@ -26278,7 +26127,7 @@ async function getSkillSuggestions(query, options) {
|
|
|
26278
26127
|
}
|
|
26279
26128
|
|
|
26280
26129
|
// src/rich-input/ConnectButton.tsx
|
|
26281
|
-
import { jsx as
|
|
26130
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
26282
26131
|
function ConnectButton({
|
|
26283
26132
|
sessionId,
|
|
26284
26133
|
open,
|
|
@@ -26286,12 +26135,15 @@ function ConnectButton({
|
|
|
26286
26135
|
pendingPlugins,
|
|
26287
26136
|
onPendingPluginsChange,
|
|
26288
26137
|
pendingPluginsDisabledReason,
|
|
26289
|
-
|
|
26290
|
-
|
|
26291
|
-
|
|
26138
|
+
excludedComputers,
|
|
26139
|
+
onExcludedComputersChange,
|
|
26140
|
+
pendingPhones,
|
|
26141
|
+
onPendingPhonesChange,
|
|
26142
|
+
onPluginsChanged,
|
|
26143
|
+
variant = "icon"
|
|
26292
26144
|
}) {
|
|
26293
26145
|
const client = useBladeClient();
|
|
26294
|
-
const { ConnectorComputerSection, ConnectorAccountsSection } = useRichInputServices();
|
|
26146
|
+
const { ConnectorComputerSection, ConnectorPhoneSection, ConnectorAccountsSection } = useRichInputServices();
|
|
26295
26147
|
const invalidation = useSessionDataInvalidation();
|
|
26296
26148
|
const [uncontrolledOpen, setUncontrolledOpen] = useState6(false);
|
|
26297
26149
|
const isOpen = open ?? uncontrolledOpen;
|
|
@@ -26304,93 +26156,83 @@ function ConnectButton({
|
|
|
26304
26156
|
const summary = triggerSummary(triggerItems);
|
|
26305
26157
|
const triggerCls = summary.total === 0 ? "w-9 p-0 text-[hsl(var(--muted-foreground))]" : summary.total === 1 ? "w-9 p-0" : "px-1";
|
|
26306
26158
|
const selectedLabels = sessionId === null ? (pendingPlugins ?? []).map((item) => item.displayName?.trim() || item.name) : selectedItems.map((item) => item.display_name?.trim() || item.name);
|
|
26307
|
-
|
|
26308
|
-
|
|
26159
|
+
const panel = /* @__PURE__ */ jsx16(
|
|
26160
|
+
ConnectorPanel,
|
|
26161
|
+
{
|
|
26162
|
+
client,
|
|
26163
|
+
sessionId,
|
|
26164
|
+
pendingPlugins,
|
|
26165
|
+
onPendingPluginsChange,
|
|
26166
|
+
pendingDisabledReason: pendingPluginsDisabledReason,
|
|
26167
|
+
onPluginsChanged: () => {
|
|
26168
|
+
if (sessionId) {
|
|
26169
|
+
invalidateSlashSuggestions(client, sessionId);
|
|
26170
|
+
invalidation.pluginsChanged(sessionId);
|
|
26171
|
+
}
|
|
26172
|
+
onPluginsChanged?.();
|
|
26173
|
+
},
|
|
26174
|
+
onSelectedChange: setSelectedItems,
|
|
26175
|
+
renderComputerSection: ConnectorComputerSection ? (query) => /* @__PURE__ */ jsx16(
|
|
26176
|
+
ConnectorComputerSection,
|
|
26177
|
+
{
|
|
26178
|
+
sessionId,
|
|
26179
|
+
query,
|
|
26180
|
+
excludedSelection: excludedComputers,
|
|
26181
|
+
onExcludedSelectionChange: onExcludedComputersChange,
|
|
26182
|
+
closePanel: () => setOpen(false)
|
|
26183
|
+
}
|
|
26184
|
+
) : void 0,
|
|
26185
|
+
renderPhoneSection: ConnectorPhoneSection ? (query) => /* @__PURE__ */ jsx16(
|
|
26186
|
+
ConnectorPhoneSection,
|
|
26187
|
+
{
|
|
26188
|
+
sessionId,
|
|
26189
|
+
query,
|
|
26190
|
+
pendingSelection: pendingPhones,
|
|
26191
|
+
onPendingSelectionChange: onPendingPhonesChange,
|
|
26192
|
+
closePanel: () => setOpen(false)
|
|
26193
|
+
}
|
|
26194
|
+
) : void 0,
|
|
26195
|
+
renderExternalAccounts: ConnectorAccountsSection ? (query) => /* @__PURE__ */ jsx16(ConnectorAccountsSection, { query, closePanel: () => setOpen(false) }) : void 0
|
|
26196
|
+
}
|
|
26197
|
+
);
|
|
26198
|
+
if (variant === "submenu") {
|
|
26199
|
+
return /* @__PURE__ */ jsx16(
|
|
26200
|
+
InputActionSubmenu,
|
|
26201
|
+
{
|
|
26202
|
+
label: summary.total ? `\u8FDE\u63A5\u5668 \xB7 \u5DF2\u9009 ${summary.total}` : "\u8FDE\u63A5\u5668",
|
|
26203
|
+
icon: /* @__PURE__ */ jsx16(Plug, { size: 16, "aria-hidden": "true" }),
|
|
26204
|
+
open: isOpen,
|
|
26205
|
+
onOpenChange: setOpen,
|
|
26206
|
+
children: panel
|
|
26207
|
+
}
|
|
26208
|
+
);
|
|
26209
|
+
}
|
|
26210
|
+
return /* @__PURE__ */ jsxs7(dist_exports.Root, { open: isOpen, onOpenChange: setOpen, children: [
|
|
26211
|
+
/* @__PURE__ */ jsx16(dist_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx16(
|
|
26309
26212
|
"button",
|
|
26310
26213
|
{
|
|
26311
26214
|
type: "button",
|
|
26312
26215
|
"aria-label": summary.total > 0 ? `\u8FDE\u63A5\u5668\uFF1A\u5DF2\u9009 ${summary.total} \u4E2A\u63D2\u4EF6` : "\u8FDE\u63A5\u5668",
|
|
26313
26216
|
title: selectedLabels.length > 0 ? `\u8FDE\u63A5\u5668\uFF1A${selectedLabels.join("\u3001")}` : "\u8FDE\u63A5\u5668",
|
|
26314
26217
|
className: `flex h-9 shrink-0 cursor-pointer items-center justify-center rounded-full border border-[hsl(var(--border))] transition-colors hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))] ${triggerCls}`,
|
|
26315
|
-
children: summary.total === 0 ? /* @__PURE__ */
|
|
26218
|
+
children: summary.total === 0 ? /* @__PURE__ */ jsx16(Plug, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsx16(PluginTriggerStack, { client, sessionId, summary })
|
|
26316
26219
|
}
|
|
26317
26220
|
) }),
|
|
26318
|
-
/* @__PURE__ */
|
|
26221
|
+
/* @__PURE__ */ jsx16(dist_exports.Portal, { children: /* @__PURE__ */ jsx16(
|
|
26319
26222
|
dist_exports.Content,
|
|
26320
26223
|
{
|
|
26321
26224
|
side: "top",
|
|
26322
26225
|
align: "start",
|
|
26323
26226
|
sideOffset: 8,
|
|
26324
26227
|
className: "z-50 w-[min(320px,calc(100vw-2rem))] origin-(--radix-popover-content-transform-origin) overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] text-[11px] text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)] outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
26325
|
-
children: /* @__PURE__ */
|
|
26326
|
-
ConnectorPanel,
|
|
26327
|
-
{
|
|
26328
|
-
client,
|
|
26329
|
-
sessionId,
|
|
26330
|
-
pendingPlugins,
|
|
26331
|
-
onPendingPluginsChange,
|
|
26332
|
-
pendingDisabledReason: pendingPluginsDisabledReason,
|
|
26333
|
-
onPluginsChanged: () => {
|
|
26334
|
-
if (sessionId) {
|
|
26335
|
-
invalidateSlashSuggestions(client, sessionId);
|
|
26336
|
-
invalidation.pluginsChanged(sessionId);
|
|
26337
|
-
}
|
|
26338
|
-
onPluginsChanged?.();
|
|
26339
|
-
},
|
|
26340
|
-
onSelectedChange: setSelectedItems,
|
|
26341
|
-
renderComputerSection: ConnectorComputerSection ? (query) => /* @__PURE__ */ jsx15(
|
|
26342
|
-
ConnectorComputerSection,
|
|
26343
|
-
{
|
|
26344
|
-
sessionId,
|
|
26345
|
-
query,
|
|
26346
|
-
pendingSelection: pendingComputers,
|
|
26347
|
-
onPendingSelectionChange: onPendingComputersChange,
|
|
26348
|
-
closePanel: () => setOpen(false)
|
|
26349
|
-
}
|
|
26350
|
-
) : void 0,
|
|
26351
|
-
renderExternalAccounts: ConnectorAccountsSection ? (query) => /* @__PURE__ */ jsx15(ConnectorAccountsSection, { query, closePanel: () => setOpen(false) }) : void 0
|
|
26352
|
-
}
|
|
26353
|
-
) })
|
|
26228
|
+
children: /* @__PURE__ */ jsx16("div", { className: "max-h-[min(70vh,32rem)] overflow-y-auto", children: panel })
|
|
26354
26229
|
}
|
|
26355
26230
|
) })
|
|
26356
26231
|
] });
|
|
26357
26232
|
}
|
|
26358
26233
|
|
|
26359
|
-
// src/rich-input/lib/kb-suggestions.ts
|
|
26360
|
-
function toKbSuggestionItems(knowledgeBases) {
|
|
26361
|
-
return knowledgeBases.map((kb) => ({
|
|
26362
|
-
kind: "kb",
|
|
26363
|
-
kbId: kb.id,
|
|
26364
|
-
name: kb.name,
|
|
26365
|
-
description: kb.description ?? ""
|
|
26366
|
-
}));
|
|
26367
|
-
}
|
|
26368
|
-
var KB_SUGGESTION_TIMEOUT_MS = 300;
|
|
26369
|
-
function withKbSuggestionTimeout(promise, timeoutMs = KB_SUGGESTION_TIMEOUT_MS) {
|
|
26370
|
-
return Promise.race([
|
|
26371
|
-
promise,
|
|
26372
|
-
new Promise((resolve) => {
|
|
26373
|
-
setTimeout(() => resolve([]), timeoutMs);
|
|
26374
|
-
})
|
|
26375
|
-
]);
|
|
26376
|
-
}
|
|
26377
|
-
function notifyWhenKbSuggestionsArriveLate(kbPromise, raced, onLate) {
|
|
26378
|
-
if (raced.length > 0) return;
|
|
26379
|
-
void kbPromise.then((lateItems) => {
|
|
26380
|
-
if (lateItems.length > 0) onLate(lateItems);
|
|
26381
|
-
});
|
|
26382
|
-
}
|
|
26383
|
-
function filterKbSuggestions(items, query) {
|
|
26384
|
-
if (query.includes("/") || query.includes("\\")) return [];
|
|
26385
|
-
const normalized = query.trim().toLowerCase();
|
|
26386
|
-
if (!normalized) return [...items];
|
|
26387
|
-
return items.filter(
|
|
26388
|
-
(item) => item.name.toLowerCase().includes(normalized) || item.description.toLowerCase().includes(normalized)
|
|
26389
|
-
);
|
|
26390
|
-
}
|
|
26391
|
-
|
|
26392
26234
|
// src/rich-input/voice/use-voice-input.ts
|
|
26393
|
-
import { useCallback as
|
|
26235
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef5, useState as useState7 } from "react";
|
|
26394
26236
|
|
|
26395
26237
|
// src/rich-input/voice/voice-input-support.ts
|
|
26396
26238
|
function isIpHost(hostname) {
|
|
@@ -26438,25 +26280,25 @@ function matchesRequest(data, requestId) {
|
|
|
26438
26280
|
}
|
|
26439
26281
|
function useVoiceInput(options) {
|
|
26440
26282
|
const client = useBladeClient();
|
|
26441
|
-
const clientRef =
|
|
26283
|
+
const clientRef = useRef5(client);
|
|
26442
26284
|
clientRef.current = client;
|
|
26443
|
-
const getSocket =
|
|
26285
|
+
const getSocket = useCallback2(() => clientRef.current.socket(), []);
|
|
26444
26286
|
const [status, setStatus] = useState7("idle");
|
|
26445
26287
|
const [error, setError] = useState7(null);
|
|
26446
26288
|
const [level, setLevel] = useState7(0);
|
|
26447
|
-
const sessionRef =
|
|
26448
|
-
const stoppingRef =
|
|
26449
|
-
const startAbortRef =
|
|
26450
|
-
const optionsRef =
|
|
26289
|
+
const sessionRef = useRef5(null);
|
|
26290
|
+
const stoppingRef = useRef5(false);
|
|
26291
|
+
const startAbortRef = useRef5(null);
|
|
26292
|
+
const optionsRef = useRef5(options);
|
|
26451
26293
|
optionsRef.current = options;
|
|
26452
|
-
const reportError =
|
|
26294
|
+
const reportError = useCallback2((err) => {
|
|
26453
26295
|
const payload = typeof err === "string" ? { title: err } : err;
|
|
26454
26296
|
setError(payload.title);
|
|
26455
26297
|
setStatus("error");
|
|
26456
26298
|
setLevel(0);
|
|
26457
26299
|
optionsRef.current.onError?.(payload);
|
|
26458
26300
|
}, []);
|
|
26459
|
-
const disposeSession =
|
|
26301
|
+
const disposeSession = useCallback2((s) => {
|
|
26460
26302
|
if (s.disposed) return;
|
|
26461
26303
|
s.disposed = true;
|
|
26462
26304
|
const socket = getSocket();
|
|
@@ -26481,7 +26323,7 @@ function useVoiceInput(options) {
|
|
|
26481
26323
|
} catch {
|
|
26482
26324
|
}
|
|
26483
26325
|
}, [getSocket]);
|
|
26484
|
-
const stop =
|
|
26326
|
+
const stop = useCallback2(async () => {
|
|
26485
26327
|
startAbortRef.current?.abort();
|
|
26486
26328
|
const s = sessionRef.current;
|
|
26487
26329
|
if (!s || stoppingRef.current) {
|
|
@@ -26528,7 +26370,7 @@ function useVoiceInput(options) {
|
|
|
26528
26370
|
setLevel(0);
|
|
26529
26371
|
setStatus((prev) => prev === "error" ? "error" : "idle");
|
|
26530
26372
|
}, [disposeSession, getSocket]);
|
|
26531
|
-
const start =
|
|
26373
|
+
const start = useCallback2(async () => {
|
|
26532
26374
|
if (sessionRef.current || startAbortRef.current && !startAbortRef.current.signal.aborted || stoppingRef.current) {
|
|
26533
26375
|
return;
|
|
26534
26376
|
}
|
|
@@ -26702,7 +26544,7 @@ function useVoiceInput(options) {
|
|
|
26702
26544
|
if (startAbortRef.current === abort) startAbortRef.current = null;
|
|
26703
26545
|
}
|
|
26704
26546
|
}, [reportError, disposeSession, getSocket]);
|
|
26705
|
-
|
|
26547
|
+
useEffect6(() => {
|
|
26706
26548
|
return () => {
|
|
26707
26549
|
startAbortRef.current?.abort();
|
|
26708
26550
|
const s = sessionRef.current;
|
|
@@ -26719,200 +26561,181 @@ function useVoiceInput(options) {
|
|
|
26719
26561
|
return { status, error, level, start, stop };
|
|
26720
26562
|
}
|
|
26721
26563
|
|
|
26722
|
-
// src/rich-input/
|
|
26723
|
-
import {
|
|
26724
|
-
|
|
26725
|
-
|
|
26726
|
-
|
|
26727
|
-
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
|
|
26731
|
-
|
|
26732
|
-
|
|
26733
|
-
|
|
26734
|
-
|
|
26735
|
-
|
|
26736
|
-
|
|
26737
|
-
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
|
|
26766
|
-
|
|
26767
|
-
|
|
26768
|
-
|
|
26769
|
-
|
|
26770
|
-
|
|
26771
|
-
|
|
26772
|
-
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
}
|
|
26780
|
-
|
|
26781
|
-
|
|
26782
|
-
|
|
26783
|
-
|
|
26784
|
-
|
|
26785
|
-
|
|
26786
|
-
|
|
26564
|
+
// src/rich-input/use-reference-candidates.ts
|
|
26565
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef6 } from "react";
|
|
26566
|
+
|
|
26567
|
+
// src/rich-input/lib/reference-candidates.ts
|
|
26568
|
+
function createReferenceCandidateController(getScope, sources, timeoutMs = 300) {
|
|
26569
|
+
const requests = /* @__PURE__ */ new WeakMap();
|
|
26570
|
+
let current;
|
|
26571
|
+
const isCurrent = (request) => {
|
|
26572
|
+
const scope = getScope();
|
|
26573
|
+
return current === request && request.scope.length === scope.length && request.scope.every((part, index) => Object.is(part, scope[index]));
|
|
26574
|
+
};
|
|
26575
|
+
const cancel = () => {
|
|
26576
|
+
const previous = current;
|
|
26577
|
+
current = void 0;
|
|
26578
|
+
previous?.finish();
|
|
26579
|
+
previous?.listener?.({
|
|
26580
|
+
groups: { plugins: [], topics: [], files: [] },
|
|
26581
|
+
items: [],
|
|
26582
|
+
loading: { plugins: false, topics: false, files: false },
|
|
26583
|
+
errors: {}
|
|
26584
|
+
});
|
|
26585
|
+
if (previous) previous.listener = void 0;
|
|
26586
|
+
};
|
|
26587
|
+
return {
|
|
26588
|
+
cancel,
|
|
26589
|
+
query(query) {
|
|
26590
|
+
cancel();
|
|
26591
|
+
const snapshot = {
|
|
26592
|
+
groups: { plugins: [], topics: [], files: [] },
|
|
26593
|
+
items: [],
|
|
26594
|
+
loading: { plugins: Boolean(sources.plugins), topics: true, files: true },
|
|
26595
|
+
errors: {}
|
|
26596
|
+
};
|
|
26597
|
+
let resolve;
|
|
26598
|
+
let finished = false;
|
|
26599
|
+
const result = new Promise((done) => {
|
|
26600
|
+
resolve = done;
|
|
26601
|
+
});
|
|
26602
|
+
const request = {
|
|
26603
|
+
scope: [...getScope()],
|
|
26604
|
+
snapshot,
|
|
26605
|
+
finish: () => {
|
|
26606
|
+
if (finished) return;
|
|
26607
|
+
finished = true;
|
|
26608
|
+
clearTimeout(timer);
|
|
26609
|
+
const items = isCurrent(request) ? snapshot.items : [];
|
|
26610
|
+
requests.set(items, request);
|
|
26611
|
+
resolve(items);
|
|
26612
|
+
}
|
|
26613
|
+
};
|
|
26614
|
+
current = request;
|
|
26615
|
+
const timer = setTimeout(request.finish, timeoutMs);
|
|
26616
|
+
const publish = () => {
|
|
26617
|
+
if (!isCurrent(request)) return;
|
|
26618
|
+
snapshot.items = [...snapshot.groups.plugins, ...snapshot.groups.topics, ...snapshot.groups.files];
|
|
26619
|
+
request.listener?.(snapshot);
|
|
26620
|
+
if (!Object.values(snapshot.loading).some(Boolean)) request.finish();
|
|
26621
|
+
};
|
|
26622
|
+
for (const key of ["plugins", "topics", "files"]) {
|
|
26623
|
+
void Promise.resolve().then(async () => {
|
|
26624
|
+
if (key === "plugins") await new Promise((done) => setTimeout(done, 150));
|
|
26625
|
+
return isCurrent(request) ? sources[key]?.(query) ?? [] : [];
|
|
26626
|
+
}).then((items) => {
|
|
26627
|
+
if (!isCurrent(request)) return;
|
|
26628
|
+
Object.assign(snapshot.groups, { [key]: items });
|
|
26629
|
+
snapshot.loading[key] = false;
|
|
26630
|
+
publish();
|
|
26631
|
+
}, (error) => {
|
|
26632
|
+
if (!isCurrent(request)) return;
|
|
26633
|
+
snapshot.errors[key] = error;
|
|
26634
|
+
snapshot.loading[key] = false;
|
|
26635
|
+
publish();
|
|
26636
|
+
});
|
|
26637
|
+
}
|
|
26787
26638
|
return result;
|
|
26788
|
-
}
|
|
26789
|
-
|
|
26790
|
-
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
|
|
26795
|
-
}
|
|
26796
|
-
|
|
26797
|
-
|
|
26798
|
-
|
|
26799
|
-
const kbId = node.attrs?.kbId;
|
|
26800
|
-
return typeof kbId === "number" && kbId > 0 ? `\u77E5\u8BC6\u5E93 #${kbId}` : "";
|
|
26801
|
-
}
|
|
26802
|
-
function collectKbMentions(node) {
|
|
26803
|
-
const result = [];
|
|
26804
|
-
const seen = /* @__PURE__ */ new Set();
|
|
26805
|
-
const visit = (current) => {
|
|
26806
|
-
if (!current) return;
|
|
26807
|
-
if (current.type === "kbMention") {
|
|
26808
|
-
const kbId = current.attrs?.kbId;
|
|
26809
|
-
if (typeof kbId === "number" && Number.isInteger(kbId) && kbId > 0 && !seen.has(kbId)) {
|
|
26810
|
-
seen.add(kbId);
|
|
26811
|
-
result.push({ kbId, name: kbMentionName(current) });
|
|
26639
|
+
},
|
|
26640
|
+
observe(items, listener) {
|
|
26641
|
+
const request = requests.get(items);
|
|
26642
|
+
if (!request || !isCurrent(request)) {
|
|
26643
|
+
listener({
|
|
26644
|
+
groups: { plugins: [], topics: [], files: [] },
|
|
26645
|
+
items: [],
|
|
26646
|
+
loading: { plugins: false, topics: false, files: false },
|
|
26647
|
+
errors: {}
|
|
26648
|
+
});
|
|
26649
|
+
return;
|
|
26812
26650
|
}
|
|
26813
|
-
|
|
26651
|
+
request.listener = listener;
|
|
26652
|
+
listener(request.snapshot);
|
|
26814
26653
|
}
|
|
26815
|
-
for (const child of current.content ?? []) visit(child);
|
|
26816
|
-
};
|
|
26817
|
-
visit(node);
|
|
26818
|
-
return result;
|
|
26819
|
-
}
|
|
26820
|
-
function buildEditorDocumentWithKbMentions(text, kbMentions) {
|
|
26821
|
-
return {
|
|
26822
|
-
type: "doc",
|
|
26823
|
-
content: text.split("\n").map((line) => ({
|
|
26824
|
-
type: "paragraph",
|
|
26825
|
-
content: line ? buildLineContentWithKbMentions(line, kbMentions) : []
|
|
26826
|
-
}))
|
|
26827
26654
|
};
|
|
26828
26655
|
}
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
const
|
|
26834
|
-
|
|
26835
|
-
|
|
26836
|
-
|
|
26837
|
-
|
|
26838
|
-
|
|
26839
|
-
|
|
26840
|
-
|
|
26841
|
-
|
|
26842
|
-
|
|
26843
|
-
return [{ type: "text", text: line }];
|
|
26844
|
-
}
|
|
26845
|
-
matches2.sort((a, b) => a.start - b.start);
|
|
26846
|
-
const content = [];
|
|
26847
|
-
let cursor = 0;
|
|
26848
|
-
for (const match of matches2) {
|
|
26849
|
-
if (match.start > cursor) {
|
|
26850
|
-
content.push({ type: "text", text: line.slice(cursor, match.start) });
|
|
26851
|
-
}
|
|
26852
|
-
content.push({ type: "kbMention", attrs: { kbId: match.kbId, name: match.name } });
|
|
26853
|
-
cursor = match.end;
|
|
26854
|
-
}
|
|
26855
|
-
if (cursor < line.length) {
|
|
26856
|
-
content.push({ type: "text", text: line.slice(cursor) });
|
|
26857
|
-
}
|
|
26858
|
-
return content;
|
|
26859
|
-
}
|
|
26860
|
-
function collectTopicAssetMentions(node) {
|
|
26861
|
-
const refs = [];
|
|
26862
|
-
const visit = (current) => {
|
|
26863
|
-
if (!current) return;
|
|
26864
|
-
if (current.type === "topicAssetMention") refs.push(current.attrs);
|
|
26865
|
-
for (const child of current.content ?? []) visit(child);
|
|
26866
|
-
};
|
|
26867
|
-
visit(node);
|
|
26868
|
-
return normalizeTopicAssetRefs2(refs);
|
|
26656
|
+
|
|
26657
|
+
// src/rich-input/use-reference-candidates.ts
|
|
26658
|
+
function useReferenceCandidates(getScope, sources) {
|
|
26659
|
+
const readScope = useEffectEvent(getScope);
|
|
26660
|
+
const plugins = useEffectEvent((query) => sources.plugins?.(query) ?? Promise.resolve([]));
|
|
26661
|
+
const topics = useEffectEvent(sources.topics);
|
|
26662
|
+
const files = useEffectEvent(sources.files);
|
|
26663
|
+
const ref = useRef6(null);
|
|
26664
|
+
if (!ref.current) ref.current = createReferenceCandidateController(readScope, { plugins, topics, files });
|
|
26665
|
+
const controller = ref.current;
|
|
26666
|
+
const [client, identity, session, topic] = getScope();
|
|
26667
|
+
useLayoutEffect2(() => onInputCachesReset(client, controller.cancel), [client, controller]);
|
|
26668
|
+
useLayoutEffect2(() => () => controller.cancel(), [controller, client, identity, session, topic]);
|
|
26669
|
+
return controller;
|
|
26869
26670
|
}
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
...index ? [{ type: "text", text: part.text.slice(0, index) }] : [],
|
|
26883
|
-
{ type: "topicAssetMention", attrs: { topic_id: ref.topic_id, path: ref.path } },
|
|
26884
|
-
...index + marker.length < part.text.length ? [{ type: "text", text: part.text.slice(index + marker.length) }] : []
|
|
26885
|
-
];
|
|
26886
|
-
});
|
|
26887
|
-
}
|
|
26888
|
-
return nodes;
|
|
26671
|
+
|
|
26672
|
+
// src/rich-input/use-input-history.ts
|
|
26673
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo6, useState as useState8 } from "react";
|
|
26674
|
+
|
|
26675
|
+
// src/rich-input/lib/input-history-document.ts
|
|
26676
|
+
import { normalizeTopicAssetRefs as normalizeTopicAssetRefs3 } from "@blade-hq/agent-client";
|
|
26677
|
+
function copyEditorDocument(value) {
|
|
26678
|
+
const attributes = {
|
|
26679
|
+
pluginMention: { provider: "string", plugin: "string", server: "string", id: "string", label: "string" },
|
|
26680
|
+
fileMention: { path: "string", name: "string" },
|
|
26681
|
+
topicAssetMention: { topic_id: "string", path: "string" },
|
|
26682
|
+
skillMention: { skillId: "string", displayName: "string", description: "string", local: "boolean", installed: "boolean" }
|
|
26889
26683
|
};
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
|
|
26893
|
-
|
|
26894
|
-
...
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
26684
|
+
const copy2 = (input, parent) => {
|
|
26685
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
26686
|
+
const node = input;
|
|
26687
|
+
const type = node.type;
|
|
26688
|
+
if (!type || (parent === null ? type !== "doc" : parent === "doc" ? type !== "paragraph" : !["text", "hardBreak", ...Object.keys(attributes)].includes(type))) return null;
|
|
26689
|
+
if (type === "doc" || type === "paragraph") {
|
|
26690
|
+
if (!Array.isArray(node.content) && node.content !== void 0) return null;
|
|
26691
|
+
const content = [];
|
|
26692
|
+
for (const child of node.content ?? []) {
|
|
26693
|
+
const copied = copy2(child, type);
|
|
26694
|
+
if (!copied) return null;
|
|
26695
|
+
content.push(copied);
|
|
26696
|
+
}
|
|
26697
|
+
return { type, content };
|
|
26698
|
+
}
|
|
26699
|
+
if (node.content !== void 0) return null;
|
|
26700
|
+
if (type === "text") {
|
|
26701
|
+
if (typeof node.text !== "string" || !node.text) return null;
|
|
26702
|
+
const marks = node.marks?.filter((mark) => ["bold", "italic", "strike", "code", "underline"].includes(mark.type)).map((mark) => ({ type: mark.type }));
|
|
26703
|
+
return { type, text: node.text, ...marks?.length ? { marks } : {} };
|
|
26704
|
+
}
|
|
26705
|
+
if (type === "hardBreak") return { type };
|
|
26706
|
+
const attrs = {};
|
|
26707
|
+
if (!node.attrs || typeof node.attrs !== "object" || Array.isArray(node.attrs)) return null;
|
|
26708
|
+
for (const [key, expected] of Object.entries(attributes[type])) {
|
|
26709
|
+
const attr = node.attrs[key];
|
|
26710
|
+
if (attr === void 0) continue;
|
|
26711
|
+
if (expected === "string" && typeof attr !== "string" || expected === "number" && typeof attr !== "number" || expected === "boolean" && typeof attr !== "boolean") return null;
|
|
26712
|
+
attrs[key] = attr;
|
|
26713
|
+
}
|
|
26714
|
+
if (type === "topicAssetMention" && normalizeTopicAssetRefs3([attrs]).length !== 1) return null;
|
|
26715
|
+
return { type, attrs };
|
|
26898
26716
|
};
|
|
26717
|
+
try {
|
|
26718
|
+
return copy2(value, null);
|
|
26719
|
+
} catch {
|
|
26720
|
+
return null;
|
|
26721
|
+
}
|
|
26899
26722
|
}
|
|
26900
26723
|
|
|
26901
26724
|
// src/rich-input/use-input-history.ts
|
|
26902
|
-
import { normalizeTopicAssetRefs as normalizeTopicAssetRefs3 } from "@blade-hq/agent-client";
|
|
26903
|
-
import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo7, useState as useState8 } from "react";
|
|
26904
26725
|
var MAX_HISTORY_ENTRIES = 50;
|
|
26726
|
+
var HISTORY_VERSION = 2;
|
|
26905
26727
|
function getStorageKey(sessionId) {
|
|
26906
26728
|
return sessionId ? `input-history:${sessionId}` : null;
|
|
26907
26729
|
}
|
|
26908
|
-
function
|
|
26909
|
-
|
|
26730
|
+
function copyEntry(value) {
|
|
26731
|
+
if (!value || typeof value !== "object") return null;
|
|
26732
|
+
const entry = value;
|
|
26733
|
+
if (entry.version !== HISTORY_VERSION) return null;
|
|
26734
|
+
const document2 = copyEditorDocument(entry.document);
|
|
26735
|
+
return document2 ? { version: HISTORY_VERSION, document: document2 } : null;
|
|
26910
26736
|
}
|
|
26911
|
-
function
|
|
26912
|
-
|
|
26913
|
-
const candidate = value;
|
|
26914
|
-
if (typeof candidate.text !== "string") return false;
|
|
26915
|
-
return candidate.kbMentions === void 0 || Array.isArray(candidate.kbMentions) && candidate.kbMentions.every(isKbMentionRef);
|
|
26737
|
+
function emptyEntry() {
|
|
26738
|
+
return { version: HISTORY_VERSION, document: { type: "doc", content: [{ type: "paragraph", content: [] }] } };
|
|
26916
26739
|
}
|
|
26917
26740
|
function readEntries(storageKey) {
|
|
26918
26741
|
if (typeof window === "undefined" || !storageKey) {
|
|
@@ -26927,24 +26750,38 @@ function readEntries(storageKey) {
|
|
|
26927
26750
|
if (!Array.isArray(parsed)) {
|
|
26928
26751
|
return [];
|
|
26929
26752
|
}
|
|
26930
|
-
return parsed.
|
|
26753
|
+
return parsed.flatMap((value) => {
|
|
26754
|
+
const entry = copyEntry(value);
|
|
26755
|
+
return entry ? [entry] : [];
|
|
26756
|
+
}).slice(0, MAX_HISTORY_ENTRIES);
|
|
26931
26757
|
} catch {
|
|
26932
26758
|
return [];
|
|
26933
26759
|
}
|
|
26934
26760
|
}
|
|
26935
|
-
function useInputHistory(sessionId) {
|
|
26936
|
-
const
|
|
26761
|
+
function useInputHistory(sessionId, client) {
|
|
26762
|
+
const [generation, setGeneration] = useState8(getInputHistoryGeneration);
|
|
26763
|
+
const storageKey = useMemo6(() => getStorageKey(sessionId), [sessionId]);
|
|
26937
26764
|
const [entries, setEntries] = useState8([]);
|
|
26938
26765
|
const [cursor, setCursor] = useState8(null);
|
|
26939
|
-
const [draft, setDraft] = useState8(
|
|
26940
|
-
|
|
26766
|
+
const [draft, setDraft] = useState8(emptyEntry);
|
|
26767
|
+
useEffect7(() => {
|
|
26768
|
+
setGeneration(getInputHistoryGeneration());
|
|
26941
26769
|
setEntries(readEntries(storageKey));
|
|
26942
26770
|
setCursor(null);
|
|
26943
|
-
setDraft(
|
|
26944
|
-
}, [storageKey]);
|
|
26945
|
-
|
|
26771
|
+
setDraft(emptyEntry());
|
|
26772
|
+
}, [storageKey, client]);
|
|
26773
|
+
useEffect7(() => {
|
|
26774
|
+
if (!client) return;
|
|
26775
|
+
return onInputCachesReset(client, () => {
|
|
26776
|
+
setGeneration(getInputHistoryGeneration());
|
|
26777
|
+
setEntries([]);
|
|
26778
|
+
setCursor(null);
|
|
26779
|
+
setDraft(emptyEntry());
|
|
26780
|
+
});
|
|
26781
|
+
}, [client]);
|
|
26782
|
+
const persistEntries = useCallback3(
|
|
26946
26783
|
(nextEntries) => {
|
|
26947
|
-
if (typeof window === "undefined" || !storageKey) {
|
|
26784
|
+
if (generation !== getInputHistoryGeneration() || typeof window === "undefined" || !storageKey) {
|
|
26948
26785
|
return;
|
|
26949
26786
|
}
|
|
26950
26787
|
try {
|
|
@@ -26952,50 +26789,51 @@ function useInputHistory(sessionId) {
|
|
|
26952
26789
|
} catch {
|
|
26953
26790
|
}
|
|
26954
26791
|
},
|
|
26955
|
-
[storageKey]
|
|
26792
|
+
[storageKey, generation]
|
|
26956
26793
|
);
|
|
26957
|
-
const addEntry =
|
|
26958
|
-
(value
|
|
26959
|
-
if (
|
|
26960
|
-
|
|
26961
|
-
|
|
26794
|
+
const addEntry = useCallback3(
|
|
26795
|
+
(value) => {
|
|
26796
|
+
if (generation !== getInputHistoryGeneration()) return;
|
|
26797
|
+
const document2 = copyEditorDocument(value);
|
|
26798
|
+
if (!document2 || !serializeEditorContent(document2).trim()) return;
|
|
26962
26799
|
setEntries((prev) => {
|
|
26963
|
-
|
|
26800
|
+
if (generation !== getInputHistoryGeneration()) return prev;
|
|
26801
|
+
const nextEntries = [{ version: HISTORY_VERSION, document: document2 }, ...prev].slice(0, MAX_HISTORY_ENTRIES);
|
|
26964
26802
|
persistEntries(nextEntries);
|
|
26965
26803
|
return nextEntries;
|
|
26966
26804
|
});
|
|
26967
26805
|
setCursor(null);
|
|
26968
|
-
setDraft(
|
|
26806
|
+
setDraft(emptyEntry());
|
|
26969
26807
|
},
|
|
26970
|
-
[persistEntries]
|
|
26808
|
+
[persistEntries, generation]
|
|
26971
26809
|
);
|
|
26972
|
-
const navigateUp =
|
|
26973
|
-
(currentDraft =
|
|
26974
|
-
if (entries.length === 0) {
|
|
26810
|
+
const navigateUp = useCallback3(
|
|
26811
|
+
(currentDraft = emptyEntry().document) => {
|
|
26812
|
+
if (generation !== getInputHistoryGeneration() || entries.length === 0) {
|
|
26975
26813
|
return null;
|
|
26976
26814
|
}
|
|
26977
26815
|
if (cursor == null) {
|
|
26978
|
-
setDraft(currentDraft);
|
|
26816
|
+
setDraft(copyEntry({ version: HISTORY_VERSION, document: currentDraft }) ?? emptyEntry());
|
|
26979
26817
|
}
|
|
26980
26818
|
const nextCursor = cursor == null ? 0 : Math.min(cursor + 1, entries.length - 1);
|
|
26981
26819
|
setCursor(nextCursor);
|
|
26982
|
-
return entries[nextCursor]
|
|
26820
|
+
return copyEntry(entries[nextCursor]);
|
|
26983
26821
|
},
|
|
26984
|
-
[cursor, entries]
|
|
26822
|
+
[cursor, entries, generation]
|
|
26985
26823
|
);
|
|
26986
|
-
const navigateDown =
|
|
26987
|
-
if (cursor == null) {
|
|
26824
|
+
const navigateDown = useCallback3(() => {
|
|
26825
|
+
if (generation !== getInputHistoryGeneration() || cursor == null) {
|
|
26988
26826
|
return null;
|
|
26989
26827
|
}
|
|
26990
26828
|
if (cursor <= 0) {
|
|
26991
26829
|
setCursor(null);
|
|
26992
|
-
return
|
|
26830
|
+
return copyEntry(draft);
|
|
26993
26831
|
}
|
|
26994
26832
|
const nextCursor = cursor - 1;
|
|
26995
26833
|
setCursor(nextCursor);
|
|
26996
|
-
return entries[nextCursor] ??
|
|
26997
|
-
}, [cursor, draft, entries]);
|
|
26998
|
-
const currentEntry = cursor == null ?
|
|
26834
|
+
return copyEntry(entries[nextCursor]) ?? copyEntry(draft);
|
|
26835
|
+
}, [cursor, draft, entries, generation]);
|
|
26836
|
+
const currentEntry = cursor == null ? copyEntry(draft) : copyEntry(entries[cursor]) ?? copyEntry(draft);
|
|
26999
26837
|
return {
|
|
27000
26838
|
addEntry,
|
|
27001
26839
|
navigateUp,
|
|
@@ -27034,8 +26872,7 @@ function splitFilesBySize(files, limitBytes = ATTACHMENT_SIZE_LIMIT_BYTES) {
|
|
|
27034
26872
|
|
|
27035
26873
|
// src/rich-input/ChatInput.tsx
|
|
27036
26874
|
import {
|
|
27037
|
-
buildMessageContent
|
|
27038
|
-
transformSlashCommand
|
|
26875
|
+
buildMessageContent
|
|
27039
26876
|
} from "@blade-hq/agent-client/internal";
|
|
27040
26877
|
|
|
27041
26878
|
// src/rich-input/lib/upload-results.ts
|
|
@@ -27066,47 +26903,20 @@ function getUnsupportedImageFiles(files, supportsImage) {
|
|
|
27066
26903
|
}
|
|
27067
26904
|
|
|
27068
26905
|
// src/rich-input/FileCompletionMenu.tsx
|
|
27069
|
-
import { forwardRef as forwardRef2, useCallback as
|
|
26906
|
+
import { forwardRef as forwardRef2, useCallback as useCallback4, useImperativeHandle, useMemo as useMemo7, useState as useState9 } from "react";
|
|
27070
26907
|
|
|
27071
26908
|
// src/rich-input/lib/user-home.ts
|
|
27072
|
-
var SANDBOX_HOME_ROOT = "/root";
|
|
27073
|
-
var SANDBOX_RUNTIME = { homePath: SANDBOX_HOME_ROOT, separator: "/" };
|
|
27074
26909
|
var CACHE_TTL_MS2 = 15e3;
|
|
27075
26910
|
var cachesByClient2 = /* @__PURE__ */ new WeakMap();
|
|
27076
|
-
var lastResolvedRuntime = SANDBOX_RUNTIME;
|
|
27077
26911
|
function cachesFor2(client) {
|
|
27078
26912
|
const existing = cachesByClient2.get(client);
|
|
27079
26913
|
if (existing) return existing;
|
|
27080
|
-
const
|
|
27081
|
-
cachesByClient2.set(client,
|
|
26914
|
+
const caches = { dirs: /* @__PURE__ */ new Map() };
|
|
26915
|
+
cachesByClient2.set(client, caches);
|
|
27082
26916
|
onInputCachesReset(client, () => {
|
|
27083
|
-
if (cachesByClient2.get(client) ===
|
|
27084
|
-
lastResolvedRuntime = SANDBOX_RUNTIME;
|
|
26917
|
+
if (cachesByClient2.get(client) === caches) cachesByClient2.delete(client);
|
|
27085
26918
|
});
|
|
27086
|
-
return
|
|
27087
|
-
}
|
|
27088
|
-
function getUserHomeRuntime(client) {
|
|
27089
|
-
const caches2 = cachesFor2(client);
|
|
27090
|
-
if (caches2.runtime && Date.now() - caches2.runtime.at < CACHE_TTL_MS2) {
|
|
27091
|
-
return caches2.runtime.request;
|
|
27092
|
-
}
|
|
27093
|
-
const request = client.json("GET", "/api/agent-board/workspace-runtime").then((runtime) => {
|
|
27094
|
-
const homePath = (runtime.home_path ?? "").trim() || SANDBOX_HOME_ROOT;
|
|
27095
|
-
const resolved = {
|
|
27096
|
-
homePath,
|
|
27097
|
-
separator: (runtime.os ?? "").toLowerCase().startsWith("windows") ? "\\" : "/"
|
|
27098
|
-
};
|
|
27099
|
-
lastResolvedRuntime = resolved;
|
|
27100
|
-
return resolved;
|
|
27101
|
-
}).catch(() => {
|
|
27102
|
-
if (caches2.runtime?.request === request) caches2.runtime = null;
|
|
27103
|
-
return SANDBOX_RUNTIME;
|
|
27104
|
-
});
|
|
27105
|
-
caches2.runtime = { at: Date.now(), request };
|
|
27106
|
-
return request;
|
|
27107
|
-
}
|
|
27108
|
-
function getLastUserHomeRuntime() {
|
|
27109
|
-
return lastResolvedRuntime;
|
|
26919
|
+
return caches;
|
|
27110
26920
|
}
|
|
27111
26921
|
function listUserHomeDir(client, dirPath) {
|
|
27112
26922
|
const { dirs } = cachesFor2(client);
|
|
@@ -27120,61 +26930,8 @@ function listUserHomeDir(client, dirPath) {
|
|
|
27120
26930
|
return entries;
|
|
27121
26931
|
}
|
|
27122
26932
|
|
|
27123
|
-
// src/rich-input/extensions/kb-mention.ts
|
|
27124
|
-
function isKbSuggestionItem(value) {
|
|
27125
|
-
return typeof value === "object" && value !== null && value.kind === "kb" && typeof value.kbId === "number";
|
|
27126
|
-
}
|
|
27127
|
-
function getKbMentionName(attrs) {
|
|
27128
|
-
return attrs.name || (attrs.kbId != null ? `\u77E5\u8BC6\u5E93 #${attrs.kbId}` : "");
|
|
27129
|
-
}
|
|
27130
|
-
var KbMention = index_default.extend({
|
|
27131
|
-
name: "kbMention",
|
|
27132
|
-
addOptions() {
|
|
27133
|
-
const parentOptions = this.parent?.();
|
|
27134
|
-
return {
|
|
27135
|
-
...parentOptions,
|
|
27136
|
-
HTMLAttributes: {
|
|
27137
|
-
...parentOptions?.HTMLAttributes ?? {},
|
|
27138
|
-
class: "kb-mention-pill"
|
|
27139
|
-
},
|
|
27140
|
-
deleteTriggerWithBackspace: true,
|
|
27141
|
-
// 只为满足 Mention 的选项类型;下面 addProseMirrorPlugins 返回空,不会真的装上。
|
|
27142
|
-
suggestion: { ...parentOptions?.suggestion ?? {}, char: "@" },
|
|
27143
|
-
suggestions: parentOptions?.suggestions ?? [],
|
|
27144
|
-
renderText: ({ node }) => `@${getKbMentionName(node.attrs)}`,
|
|
27145
|
-
renderHTML: ({ options, node }) => [
|
|
27146
|
-
"span",
|
|
27147
|
-
{
|
|
27148
|
-
...options.HTMLAttributes ?? {},
|
|
27149
|
-
class: "kb-mention-pill",
|
|
27150
|
-
"data-kb-id": String(node.attrs.kbId ?? ""),
|
|
27151
|
-
"data-name": node.attrs.name
|
|
27152
|
-
},
|
|
27153
|
-
`@${getKbMentionName(node.attrs)}`
|
|
27154
|
-
]
|
|
27155
|
-
};
|
|
27156
|
-
},
|
|
27157
|
-
addAttributes() {
|
|
27158
|
-
return {
|
|
27159
|
-
kbId: {
|
|
27160
|
-
default: 0,
|
|
27161
|
-
parseHTML: (element) => Number(element.getAttribute("data-kb-id") || 0),
|
|
27162
|
-
renderHTML: (attributes) => ({ "data-kb-id": String(attributes.kbId) })
|
|
27163
|
-
},
|
|
27164
|
-
name: {
|
|
27165
|
-
default: "",
|
|
27166
|
-
parseHTML: (element) => element.getAttribute("data-name") || "",
|
|
27167
|
-
renderHTML: (attributes) => ({ "data-name": attributes.name })
|
|
27168
|
-
}
|
|
27169
|
-
};
|
|
27170
|
-
},
|
|
27171
|
-
addProseMirrorPlugins() {
|
|
27172
|
-
return [];
|
|
27173
|
-
}
|
|
27174
|
-
});
|
|
27175
|
-
|
|
27176
26933
|
// src/rich-input/FileCompletionMenu.tsx
|
|
27177
|
-
import { Fragment as Fragment4, jsx as
|
|
26934
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
27178
26935
|
var ROOT_DIR = ".";
|
|
27179
26936
|
function installSuggestionOutsideDismiss(container, onDismiss) {
|
|
27180
26937
|
const onPointerDown = (event) => {
|
|
@@ -27271,7 +27028,9 @@ async function getFileSuggestionItems(client, sessionId, query) {
|
|
|
27271
27028
|
const entries = await listDirectory(client, sessionId, dirPath);
|
|
27272
27029
|
return filterEntries(entries, filterQuery);
|
|
27273
27030
|
}
|
|
27274
|
-
function parseUserHomeQuery(query
|
|
27031
|
+
function parseUserHomeQuery(query) {
|
|
27032
|
+
const homePath = "/root";
|
|
27033
|
+
const separator = "/";
|
|
27275
27034
|
if (!query.startsWith(homePath)) {
|
|
27276
27035
|
return { dirPath: homePath, filterQuery: query };
|
|
27277
27036
|
}
|
|
@@ -27285,8 +27044,7 @@ function parseUserHomeQuery(query, { homePath, separator }) {
|
|
|
27285
27044
|
};
|
|
27286
27045
|
}
|
|
27287
27046
|
async function getUserHomeSuggestionItems(client, query) {
|
|
27288
|
-
const
|
|
27289
|
-
const { dirPath, filterQuery } = parseUserHomeQuery(query, runtime);
|
|
27047
|
+
const { dirPath, filterQuery } = parseUserHomeQuery(query);
|
|
27290
27048
|
let entries;
|
|
27291
27049
|
try {
|
|
27292
27050
|
entries = (await listUserHomeDir(client, dirPath)).map((entry) => ({
|
|
@@ -27301,24 +27059,26 @@ async function getUserHomeSuggestionItems(client, query) {
|
|
|
27301
27059
|
var FileCompletionMenu = forwardRef2(
|
|
27302
27060
|
function FileCompletionMenu2({ command: command2, editor, items, onExit, query, range, scope = "session", sessionId: sessionIdProp }, ref) {
|
|
27303
27061
|
const sessionId = sessionIdProp ?? null;
|
|
27304
|
-
const { dirPath, filterQuery } =
|
|
27062
|
+
const { dirPath, filterQuery } = useMemo7(
|
|
27305
27063
|
() => scope === "userHome" ? { dirPath: query, filterQuery: "" } : parseSuggestionQuery(query),
|
|
27306
27064
|
[query, scope]
|
|
27307
27065
|
);
|
|
27308
|
-
const {
|
|
27309
|
-
|
|
27066
|
+
const { pluginItems, pluginError, fileItems, topicItems, topicError } = useMemo7(() => {
|
|
27067
|
+
let pluginError2;
|
|
27068
|
+
const pluginItems2 = [];
|
|
27310
27069
|
const files = [];
|
|
27311
27070
|
const topicItems2 = [];
|
|
27312
27071
|
let topicError2;
|
|
27313
27072
|
for (const item of items) {
|
|
27314
|
-
if (
|
|
27073
|
+
if (isPluginSuggestionError(item)) pluginError2 = item.message;
|
|
27074
|
+
else if (isPluginSuggestionItem(item)) pluginItems2.push(item);
|
|
27075
|
+
else if (isTopicAssetSuggestionItem(item)) topicItems2.push(item);
|
|
27315
27076
|
else if (isTopicAssetSuggestionError(item)) topicError2 = item.message;
|
|
27316
|
-
else if (isKbSuggestionItem(item)) kbs.push(item);
|
|
27317
27077
|
else files.push(item);
|
|
27318
27078
|
}
|
|
27319
|
-
return {
|
|
27320
|
-
}, [items
|
|
27321
|
-
return /* @__PURE__ */
|
|
27079
|
+
return { pluginItems: pluginItems2, pluginError: pluginError2, fileItems: files, topicItems: topicItems2, topicError: topicError2 };
|
|
27080
|
+
}, [items]);
|
|
27081
|
+
return /* @__PURE__ */ jsx17(
|
|
27322
27082
|
FileCompletionMenuContent,
|
|
27323
27083
|
{
|
|
27324
27084
|
ref,
|
|
@@ -27326,7 +27086,8 @@ var FileCompletionMenu = forwardRef2(
|
|
|
27326
27086
|
editor,
|
|
27327
27087
|
filterQuery,
|
|
27328
27088
|
items: fileItems,
|
|
27329
|
-
|
|
27089
|
+
pluginError,
|
|
27090
|
+
pluginItems,
|
|
27330
27091
|
topicItems,
|
|
27331
27092
|
topicError,
|
|
27332
27093
|
onExit,
|
|
@@ -27334,27 +27095,26 @@ var FileCompletionMenu = forwardRef2(
|
|
|
27334
27095
|
scope,
|
|
27335
27096
|
sessionId
|
|
27336
27097
|
},
|
|
27337
|
-
`${scope}:${sessionId ?? "none"}:${dirPath}:${filterQuery}
|
|
27098
|
+
`${scope}:${sessionId ?? "none"}:${dirPath}:${filterQuery}`
|
|
27338
27099
|
);
|
|
27339
27100
|
}
|
|
27340
27101
|
);
|
|
27341
|
-
var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2({ command: command2, editor, filterQuery, items,
|
|
27102
|
+
var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2({ command: command2, editor, filterQuery, items, pluginItems, pluginError, topicItems, topicError, onExit, range, scope, sessionId }, ref) {
|
|
27342
27103
|
const [rawSelectedIndex, setRawSelectedIndex] = useState9(0);
|
|
27343
|
-
const filteredEntries =
|
|
27344
|
-
const navigableItems =
|
|
27345
|
-
() => [...
|
|
27346
|
-
[filteredEntries,
|
|
27104
|
+
const filteredEntries = useMemo7(() => filterEntries(items, filterQuery), [filterQuery, items]);
|
|
27105
|
+
const navigableItems = useMemo7(
|
|
27106
|
+
() => [...pluginItems, ...topicItems, ...filteredEntries],
|
|
27107
|
+
[filteredEntries, pluginItems, topicItems]
|
|
27347
27108
|
);
|
|
27348
27109
|
const selectedIndex = navigableItems.length === 0 ? 0 : Math.min(rawSelectedIndex, navigableItems.length - 1);
|
|
27349
|
-
const handleSelect =
|
|
27110
|
+
const handleSelect = useCallback4(
|
|
27350
27111
|
(entry) => {
|
|
27351
|
-
if (
|
|
27112
|
+
if (isPluginSuggestionItem(entry) || isTopicAssetSuggestionItem(entry)) {
|
|
27352
27113
|
command2(entry);
|
|
27353
27114
|
return;
|
|
27354
27115
|
}
|
|
27355
27116
|
if (entry.is_dir) {
|
|
27356
|
-
const
|
|
27357
|
-
const nextValue = entry.path === ROOT_DIR ? "@" : `@${entry.path}${separator}`;
|
|
27117
|
+
const nextValue = entry.path === ROOT_DIR ? "@" : `@${entry.path}/`;
|
|
27358
27118
|
editor.chain().focus().insertContentAt(range, nextValue).run();
|
|
27359
27119
|
return;
|
|
27360
27120
|
}
|
|
@@ -27364,7 +27124,7 @@ var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2(
|
|
|
27364
27124
|
path: entry.path
|
|
27365
27125
|
});
|
|
27366
27126
|
},
|
|
27367
|
-
[command2, editor, range
|
|
27127
|
+
[command2, editor, range]
|
|
27368
27128
|
);
|
|
27369
27129
|
useImperativeHandle(
|
|
27370
27130
|
ref,
|
|
@@ -27410,48 +27170,46 @@ var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2(
|
|
|
27410
27170
|
element.scrollIntoView({ block: "nearest" });
|
|
27411
27171
|
}
|
|
27412
27172
|
};
|
|
27413
|
-
const showGroupLabels =
|
|
27173
|
+
const showGroupLabels = pluginItems.length > 0 || topicItems.length > 0 || Boolean(topicError);
|
|
27414
27174
|
const fileEmptyLabel = scope === "session" && !sessionId ? "\u6682\u65E0\u4F1A\u8BDD" : filteredEntries.length === 0 ? "\u6CA1\u6709\u6587\u4EF6" : null;
|
|
27415
|
-
return /* @__PURE__ */
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27422
|
-
|
|
27423
|
-
|
|
27424
|
-
|
|
27425
|
-
|
|
27426
|
-
},
|
|
27427
|
-
className: rowClassName(index),
|
|
27428
|
-
children: [
|
|
27429
|
-
/* @__PURE__ */ jsx16(BookOpen, { size: 14, className: "shrink-0 text-[hsl(var(--primary))]" }),
|
|
27430
|
-
/* @__PURE__ */ jsx16("span", { className: "truncate", children: item.name }),
|
|
27431
|
-
item.description ? /* @__PURE__ */ jsx16("span", { className: "ml-auto max-w-[50%] truncate text-xs text-[hsl(var(--muted-foreground))]", children: item.description }) : null
|
|
27432
|
-
]
|
|
27175
|
+
return /* @__PURE__ */ jsxs8("div", { className: "max-h-64 overflow-y-auto rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] py-1 shadow-[var(--swf-shadow-overlay)]", children: [
|
|
27176
|
+
pluginError ? /* @__PURE__ */ jsx17("output", { className: "block px-3 py-2 text-xs text-muted-foreground", children: pluginError }) : null,
|
|
27177
|
+
pluginItems.map((item, index) => /* @__PURE__ */ jsxs8(
|
|
27178
|
+
"button",
|
|
27179
|
+
{
|
|
27180
|
+
ref: selectedRef(index),
|
|
27181
|
+
type: "button",
|
|
27182
|
+
className: rowClassName(index),
|
|
27183
|
+
onMouseDown: (event) => {
|
|
27184
|
+
event.preventDefault();
|
|
27185
|
+
handleSelect(item);
|
|
27433
27186
|
},
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
|
|
27187
|
+
children: [
|
|
27188
|
+
item.icon ? /* @__PURE__ */ jsx17("img", { src: item.icon, alt: "", width: 16, height: 16, className: "shrink-0" }) : /* @__PURE__ */ jsx17(BookOpen, { size: 14 }),
|
|
27189
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate", children: item.label }),
|
|
27190
|
+
/* @__PURE__ */ jsx17("span", { className: "ml-auto truncate text-xs text-muted-foreground", children: item.display_name })
|
|
27191
|
+
]
|
|
27192
|
+
},
|
|
27193
|
+
`${item.plugin}:${item.server}:${item.id}`
|
|
27194
|
+
)),
|
|
27195
|
+
topicItems.length > 0 || topicError ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
27196
|
+
/* @__PURE__ */ jsx17("div", { className: "px-3 pt-1 pb-0.5 text-xs font-medium text-muted-foreground", children: "\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7" }),
|
|
27197
|
+
topicError ? /* @__PURE__ */ jsx17("output", { className: "block px-3 py-2 text-xs text-muted-foreground", children: topicError }) : null,
|
|
27440
27198
|
topicItems.map((item, topicIndex) => {
|
|
27441
|
-
const index =
|
|
27442
|
-
return /* @__PURE__ */
|
|
27199
|
+
const index = pluginItems.length + topicIndex;
|
|
27200
|
+
return /* @__PURE__ */ jsxs8("button", { ref: selectedRef(index), type: "button", title: item.path, className: rowClassName(index), onMouseDown: (event) => {
|
|
27443
27201
|
event.preventDefault();
|
|
27444
27202
|
handleSelect(item);
|
|
27445
27203
|
}, children: [
|
|
27446
|
-
/* @__PURE__ */
|
|
27447
|
-
/* @__PURE__ */
|
|
27204
|
+
/* @__PURE__ */ jsx17(File, { size: 14, className: "shrink-0 text-muted-foreground" }),
|
|
27205
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate", children: item.path })
|
|
27448
27206
|
] }, `${item.topic_id}:${item.path}`);
|
|
27449
27207
|
})
|
|
27450
27208
|
] }) : null,
|
|
27451
|
-
showGroupLabels ? /* @__PURE__ */
|
|
27452
|
-
fileEmptyLabel ? /* @__PURE__ */
|
|
27453
|
-
const index =
|
|
27454
|
-
return /* @__PURE__ */
|
|
27209
|
+
showGroupLabels ? /* @__PURE__ */ jsx17("div", { className: "px-3 pt-1 pb-0.5 text-[10px] font-medium uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u6587\u4EF6" }) : null,
|
|
27210
|
+
fileEmptyLabel ? /* @__PURE__ */ jsx17("div", { className: "px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: fileEmptyLabel }) : filteredEntries.map((entry, fileIndex) => {
|
|
27211
|
+
const index = pluginItems.length + topicItems.length + fileIndex;
|
|
27212
|
+
return /* @__PURE__ */ jsxs8(
|
|
27455
27213
|
"button",
|
|
27456
27214
|
{
|
|
27457
27215
|
ref: selectedRef(index),
|
|
@@ -27462,9 +27220,9 @@ var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2(
|
|
|
27462
27220
|
},
|
|
27463
27221
|
className: rowClassName(index),
|
|
27464
27222
|
children: [
|
|
27465
|
-
entry.is_dir ? /* @__PURE__ */
|
|
27466
|
-
/* @__PURE__ */
|
|
27467
|
-
entry.is_dir && /* @__PURE__ */
|
|
27223
|
+
entry.is_dir ? /* @__PURE__ */ jsx17(Folder, { size: 14, className: "shrink-0 text-[hsl(var(--primary))]" }) : /* @__PURE__ */ jsx17(File, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
27224
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate", children: entry.name }),
|
|
27225
|
+
entry.is_dir && /* @__PURE__ */ jsx17(ChevronRight, { size: 12, className: "ml-auto shrink-0 opacity-40" })
|
|
27468
27226
|
]
|
|
27469
27227
|
},
|
|
27470
27228
|
entry.path
|
|
@@ -27474,13 +27232,13 @@ var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2(
|
|
|
27474
27232
|
});
|
|
27475
27233
|
|
|
27476
27234
|
// src/rich-input/SkillCompletionMenu.tsx
|
|
27477
|
-
import { forwardRef as forwardRef3, useCallback as
|
|
27478
|
-
import { jsx as
|
|
27235
|
+
import { forwardRef as forwardRef3, useCallback as useCallback5, useImperativeHandle as useImperativeHandle2, useState as useState10 } from "react";
|
|
27236
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
27479
27237
|
var SkillCompletionMenu = forwardRef3(
|
|
27480
27238
|
function SkillCompletionMenu2({ command: command2, items }, ref) {
|
|
27481
27239
|
const [rawSelectedIndex, setRawSelectedIndex] = useState10(0);
|
|
27482
27240
|
const selectedIndex = items.length === 0 ? 0 : Math.min(rawSelectedIndex, items.length - 1);
|
|
27483
|
-
const handleSelect =
|
|
27241
|
+
const handleSelect = useCallback5(
|
|
27484
27242
|
(item) => {
|
|
27485
27243
|
command2(item);
|
|
27486
27244
|
},
|
|
@@ -27521,12 +27279,11 @@ var SkillCompletionMenu = forwardRef3(
|
|
|
27521
27279
|
[handleSelect, items, selectedIndex]
|
|
27522
27280
|
);
|
|
27523
27281
|
const commandItems = items.filter((item) => item.type === "command");
|
|
27524
|
-
const workflowItems = items.filter((item) => item.type === "workflow");
|
|
27525
27282
|
const skillItems = items.filter((item) => item.type === "skill");
|
|
27526
|
-
return /* @__PURE__ */
|
|
27527
|
-
commandItems.length > 0 ? /* @__PURE__ */
|
|
27528
|
-
/* @__PURE__ */
|
|
27529
|
-
commandItems.map((item, index) => /* @__PURE__ */
|
|
27283
|
+
return /* @__PURE__ */ jsx18("div", { className: "max-h-64 overflow-y-auto rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] py-1 shadow-[var(--swf-shadow-overlay)]", children: items.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: "\u6CA1\u6709\u5339\u914D\u7684\u547D\u4EE4\u6216\u6280\u80FD" }) : /* @__PURE__ */ jsxs9("div", { children: [
|
|
27284
|
+
commandItems.length > 0 ? /* @__PURE__ */ jsxs9("div", { className: "px-2 pb-1 pt-1", children: [
|
|
27285
|
+
/* @__PURE__ */ jsx18("div", { className: "px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-[hsl(var(--muted-foreground))]", children: "\u547D\u4EE4" }),
|
|
27286
|
+
commandItems.map((item, index) => /* @__PURE__ */ jsxs9(
|
|
27530
27287
|
"button",
|
|
27531
27288
|
{
|
|
27532
27289
|
ref: (element) => {
|
|
@@ -27541,51 +27298,21 @@ var SkillCompletionMenu = forwardRef3(
|
|
|
27541
27298
|
},
|
|
27542
27299
|
className: `flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${index === selectedIndex ? "bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]" : "text-[hsl(var(--popover-foreground))] hover:bg-[hsl(var(--accent))]"}`,
|
|
27543
27300
|
children: [
|
|
27544
|
-
/* @__PURE__ */
|
|
27545
|
-
/* @__PURE__ */
|
|
27546
|
-
/* @__PURE__ */
|
|
27547
|
-
/* @__PURE__ */
|
|
27301
|
+
/* @__PURE__ */ jsx18("span", { className: "pt-0.5 text-sm", children: "\u21BB" }),
|
|
27302
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
27303
|
+
/* @__PURE__ */ jsx18("span", { className: "text-sm font-medium", children: item.label }),
|
|
27304
|
+
/* @__PURE__ */ jsx18("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: item.description })
|
|
27548
27305
|
] })
|
|
27549
27306
|
]
|
|
27550
27307
|
},
|
|
27551
27308
|
item.id
|
|
27552
27309
|
))
|
|
27553
27310
|
] }) : null,
|
|
27554
|
-
|
|
27555
|
-
/* @__PURE__ */
|
|
27556
|
-
workflowItems.map((item, wfIndex) => {
|
|
27557
|
-
const index = commandItems.length + wfIndex;
|
|
27558
|
-
return /* @__PURE__ */ jsxs8(
|
|
27559
|
-
"button",
|
|
27560
|
-
{
|
|
27561
|
-
ref: (element) => {
|
|
27562
|
-
if (element && index === selectedIndex) {
|
|
27563
|
-
element.scrollIntoView({ block: "nearest" });
|
|
27564
|
-
}
|
|
27565
|
-
},
|
|
27566
|
-
type: "button",
|
|
27567
|
-
onMouseDown: (event) => {
|
|
27568
|
-
event.preventDefault();
|
|
27569
|
-
handleSelect(item);
|
|
27570
|
-
},
|
|
27571
|
-
className: `flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${index === selectedIndex ? "bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]" : "text-[hsl(var(--popover-foreground))] hover:bg-[hsl(var(--accent))]"}`,
|
|
27572
|
-
children: [
|
|
27573
|
-
/* @__PURE__ */ jsx17("span", { className: "pt-0.5 text-sm", children: "\u2699" }),
|
|
27574
|
-
/* @__PURE__ */ jsxs8("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
27575
|
-
/* @__PURE__ */ jsx17("span", { className: "text-sm font-medium", children: item.displayName }),
|
|
27576
|
-
/* @__PURE__ */ jsx17("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: item.description || "\u8FD0\u884C\u8FD9\u4E2A\u5DE5\u4F5C\u6D41" })
|
|
27577
|
-
] })
|
|
27578
|
-
]
|
|
27579
|
-
},
|
|
27580
|
-
`wf:${item.name}`
|
|
27581
|
-
);
|
|
27582
|
-
})
|
|
27583
|
-
] }) : null,
|
|
27584
|
-
skillItems.length > 0 ? /* @__PURE__ */ jsxs8("div", { className: "px-2 pb-1 pt-1", children: [
|
|
27585
|
-
/* @__PURE__ */ jsx17("div", { className: "px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-[hsl(var(--muted-foreground))]", children: "\u6280\u80FD" }),
|
|
27311
|
+
skillItems.length > 0 ? /* @__PURE__ */ jsxs9("div", { className: "px-2 pb-1 pt-1", children: [
|
|
27312
|
+
/* @__PURE__ */ jsx18("div", { className: "px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-[hsl(var(--muted-foreground))]", children: "\u6280\u80FD" }),
|
|
27586
27313
|
skillItems.map((item, skillIndex) => {
|
|
27587
|
-
const index = commandItems.length +
|
|
27588
|
-
return /* @__PURE__ */
|
|
27314
|
+
const index = commandItems.length + skillIndex;
|
|
27315
|
+
return /* @__PURE__ */ jsxs9(
|
|
27589
27316
|
"button",
|
|
27590
27317
|
{
|
|
27591
27318
|
ref: (element) => {
|
|
@@ -27600,11 +27327,19 @@ var SkillCompletionMenu = forwardRef3(
|
|
|
27600
27327
|
},
|
|
27601
27328
|
className: `flex w-full flex-col gap-0.5 rounded-lg px-2 py-1.5 text-left transition-colors ${index === selectedIndex ? "bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]" : "text-[hsl(var(--popover-foreground))] hover:bg-[hsl(var(--accent))]"}`,
|
|
27602
27329
|
children: [
|
|
27603
|
-
/* @__PURE__ */
|
|
27604
|
-
/* @__PURE__ */
|
|
27605
|
-
item.
|
|
27330
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-1.5", children: [
|
|
27331
|
+
/* @__PURE__ */ jsx18("span", { className: "text-sm font-medium", children: skillDisplayName(item) }),
|
|
27332
|
+
item.hasFlow ? /* @__PURE__ */ jsx18(
|
|
27333
|
+
"span",
|
|
27334
|
+
{
|
|
27335
|
+
title: "\u8FD9\u4E2A\u6280\u80FD\u6309\u56FA\u5B9A\u6D41\u7A0B\u6267\u884C:\u6B65\u9AA4\u4E8B\u5148\u7F16\u6392\u597D,\u8FD0\u884C\u4E2D\u4E0D\u4F1A\u5373\u5174\u53D1\u6325,\u4E5F\u4E0D\u4F1A\u4E2D\u9014\u95EE\u4F60",
|
|
27336
|
+
className: "shrink-0 rounded-full bg-violet-500/10 px-1.5 py-px text-[10px] font-medium text-violet-600",
|
|
27337
|
+
children: "\u26A1 \u56FA\u5B9A\u6D41\u7A0B"
|
|
27338
|
+
}
|
|
27339
|
+
) : null,
|
|
27340
|
+
item.installed === false ? /* @__PURE__ */ jsx18("span", { className: "shrink-0 rounded-full bg-[hsl(var(--muted))] px-1.5 py-px text-[10px] text-[hsl(var(--muted-foreground))]", children: "\u672A\u5B89\u88C5" }) : null
|
|
27606
27341
|
] }),
|
|
27607
|
-
/* @__PURE__ */
|
|
27342
|
+
/* @__PURE__ */ jsx18("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: item.description })
|
|
27608
27343
|
]
|
|
27609
27344
|
},
|
|
27610
27345
|
item.skillId
|
|
@@ -27616,7 +27351,7 @@ var SkillCompletionMenu = forwardRef3(
|
|
|
27616
27351
|
);
|
|
27617
27352
|
|
|
27618
27353
|
// src/rich-input/FileSizeLimitDialog.tsx
|
|
27619
|
-
import { jsx as
|
|
27354
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
27620
27355
|
function FileSizeLimitDialog({
|
|
27621
27356
|
open,
|
|
27622
27357
|
onOpenChange,
|
|
@@ -27627,37 +27362,37 @@ function FileSizeLimitDialog({
|
|
|
27627
27362
|
return null;
|
|
27628
27363
|
}
|
|
27629
27364
|
const limitText = formatFileSize(limitBytes);
|
|
27630
|
-
return /* @__PURE__ */
|
|
27631
|
-
/* @__PURE__ */
|
|
27632
|
-
/* @__PURE__ */
|
|
27633
|
-
/* @__PURE__ */
|
|
27634
|
-
/* @__PURE__ */
|
|
27365
|
+
return /* @__PURE__ */ jsx19(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs10(DialogContent, { showCloseButton: false, className: "w-full max-w-lg gap-0 p-0", children: [
|
|
27366
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
|
|
27367
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
27368
|
+
/* @__PURE__ */ jsx19(DialogTitle, { className: "text-sm font-semibold text-[hsl(var(--foreground))]", children: "\u9644\u4EF6\u8D85\u8FC7\u5927\u5C0F\u9650\u5236" }),
|
|
27369
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
27635
27370
|
"\u5355\u4E2A\u9644\u4EF6\u6700\u5927\u652F\u6301 ",
|
|
27636
27371
|
limitText,
|
|
27637
27372
|
"\u3002\u4EE5\u4E0B\u6587\u4EF6\u672A\u52A0\u5165\u9644\u4EF6\u5217\u8868\u3002"
|
|
27638
27373
|
] })
|
|
27639
27374
|
] }),
|
|
27640
|
-
/* @__PURE__ */
|
|
27375
|
+
/* @__PURE__ */ jsx19(
|
|
27641
27376
|
DialogClose,
|
|
27642
27377
|
{
|
|
27643
27378
|
title: "\u5173\u95ED",
|
|
27644
27379
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
27645
|
-
children: /* @__PURE__ */
|
|
27380
|
+
children: /* @__PURE__ */ jsx19(X, { size: 14 })
|
|
27646
27381
|
}
|
|
27647
27382
|
)
|
|
27648
27383
|
] }),
|
|
27649
|
-
/* @__PURE__ */
|
|
27384
|
+
/* @__PURE__ */ jsx19("div", { className: "max-h-[min(50vh,24rem)] overflow-auto px-4 py-3", children: /* @__PURE__ */ jsx19("div", { className: "flex flex-col gap-2", children: files.map((file) => /* @__PURE__ */ jsxs10(
|
|
27650
27385
|
"div",
|
|
27651
27386
|
{
|
|
27652
27387
|
className: "flex items-center justify-between gap-3 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--accent))] px-3 py-2",
|
|
27653
27388
|
children: [
|
|
27654
|
-
/* @__PURE__ */
|
|
27655
|
-
/* @__PURE__ */
|
|
27389
|
+
/* @__PURE__ */ jsx19("span", { className: "min-w-0 truncate text-sm text-[hsl(var(--foreground))]", children: file.name }),
|
|
27390
|
+
/* @__PURE__ */ jsx19("span", { className: "shrink-0 text-xs text-[hsl(var(--muted-foreground))]", children: formatFileSize(file.size) })
|
|
27656
27391
|
]
|
|
27657
27392
|
},
|
|
27658
27393
|
`${file.name}:${file.size}`
|
|
27659
27394
|
)) }) }),
|
|
27660
|
-
/* @__PURE__ */
|
|
27395
|
+
/* @__PURE__ */ jsx19("div", { className: "flex justify-end border-t border-[hsl(var(--border))] px-4 py-3", children: /* @__PURE__ */ jsx19(
|
|
27661
27396
|
"button",
|
|
27662
27397
|
{
|
|
27663
27398
|
type: "button",
|
|
@@ -27720,41 +27455,6 @@ var FileMention = index_default.extend({
|
|
|
27720
27455
|
}
|
|
27721
27456
|
});
|
|
27722
27457
|
|
|
27723
|
-
// src/rich-input/extensions/workflow-mention.ts
|
|
27724
|
-
var WorkflowMention = Node3.create({
|
|
27725
|
-
name: "workflowMention",
|
|
27726
|
-
group: "inline",
|
|
27727
|
-
inline: true,
|
|
27728
|
-
atom: true,
|
|
27729
|
-
selectable: false,
|
|
27730
|
-
addAttributes() {
|
|
27731
|
-
return {
|
|
27732
|
-
name: {
|
|
27733
|
-
default: "",
|
|
27734
|
-
parseHTML: (element) => element.getAttribute("data-workflow") || "",
|
|
27735
|
-
renderHTML: (attributes) => ({ "data-workflow": attributes.name })
|
|
27736
|
-
}
|
|
27737
|
-
};
|
|
27738
|
-
},
|
|
27739
|
-
parseHTML() {
|
|
27740
|
-
return [{ tag: "span[data-workflow]" }];
|
|
27741
|
-
},
|
|
27742
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
27743
|
-
return [
|
|
27744
|
-
"span",
|
|
27745
|
-
mergeAttributes(HTMLAttributes, {
|
|
27746
|
-
// 复用技能胶囊的现成样式(两个输入框的容器 class 都已带它的规则)
|
|
27747
|
-
class: "skill-mention-pill",
|
|
27748
|
-
"data-workflow": node.attrs.name
|
|
27749
|
-
}),
|
|
27750
|
-
`\u8FD0\u884C\u5DE5\u4F5C\u6D41 ${node.attrs.name}`
|
|
27751
|
-
];
|
|
27752
|
-
},
|
|
27753
|
-
renderText({ node }) {
|
|
27754
|
-
return `\u8FD0\u884C\u5DE5\u4F5C\u6D41 ${node.attrs.name}`;
|
|
27755
|
-
}
|
|
27756
|
-
});
|
|
27757
|
-
|
|
27758
27458
|
// src/rich-input/lib/reasoning-levels.ts
|
|
27759
27459
|
var REASONING_LEVEL_LABELS = {
|
|
27760
27460
|
off: "\u5173",
|
|
@@ -27770,7 +27470,7 @@ function reasoningLevelLabel(level) {
|
|
|
27770
27470
|
}
|
|
27771
27471
|
|
|
27772
27472
|
// src/rich-input/ReasoningModeSelect.tsx
|
|
27773
|
-
import { jsx as
|
|
27473
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
27774
27474
|
function ReasoningModeSelect({
|
|
27775
27475
|
level,
|
|
27776
27476
|
levels,
|
|
@@ -27778,11 +27478,11 @@ function ReasoningModeSelect({
|
|
|
27778
27478
|
disabledReason,
|
|
27779
27479
|
onChange
|
|
27780
27480
|
}) {
|
|
27781
|
-
return /* @__PURE__ */
|
|
27782
|
-
/* @__PURE__ */
|
|
27783
|
-
/* @__PURE__ */
|
|
27784
|
-
/* @__PURE__ */
|
|
27785
|
-
/* @__PURE__ */
|
|
27481
|
+
return /* @__PURE__ */ jsxs11("label", { className: "flex w-full flex-col gap-1 px-3 py-2", children: [
|
|
27482
|
+
/* @__PURE__ */ jsxs11("span", { className: "flex w-full items-center gap-2", children: [
|
|
27483
|
+
/* @__PURE__ */ jsx20(Brain, { size: 14, className: `shrink-0 ${chatTone("reasoning").text}`, "aria-hidden": "true" }),
|
|
27484
|
+
/* @__PURE__ */ jsx20("span", { className: "shrink-0", children: "\u601D\u8003\u6A21\u5F0F" }),
|
|
27485
|
+
/* @__PURE__ */ jsx20(
|
|
27786
27486
|
"select",
|
|
27787
27487
|
{
|
|
27788
27488
|
value: level,
|
|
@@ -27791,18 +27491,18 @@ function ReasoningModeSelect({
|
|
|
27791
27491
|
"aria-label": "\u601D\u8003\u6A21\u5F0F",
|
|
27792
27492
|
title: "\u9009\u62E9\u601D\u8003\u6863\u4F4D\u3002\u6863\u4F4D\u8D8A\u9AD8\uFF0C\u6A21\u578B\u601D\u8003\u8D8A\u6DF1\u5165\uFF0C\u4F46\u54CD\u5E94\u53EF\u80FD\u66F4\u6162",
|
|
27793
27493
|
className: "ml-auto h-6 min-w-20 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--background))] px-1.5 disabled:cursor-not-allowed disabled:opacity-50",
|
|
27794
|
-
children: levels.map((item) => /* @__PURE__ */
|
|
27494
|
+
children: levels.map((item) => /* @__PURE__ */ jsx20("option", { value: item, children: reasoningLevelLabel(item) }, item))
|
|
27795
27495
|
}
|
|
27796
27496
|
)
|
|
27797
27497
|
] }),
|
|
27798
|
-
disabled && disabledReason ? /* @__PURE__ */
|
|
27498
|
+
disabled && disabledReason ? /* @__PURE__ */ jsx20("span", { className: "pl-[22px] text-xs text-[hsl(var(--muted-foreground))]", children: disabledReason }) : null
|
|
27799
27499
|
] });
|
|
27800
27500
|
}
|
|
27801
27501
|
|
|
27802
27502
|
// src/rich-input/PlanningToggle.tsx
|
|
27803
|
-
import { jsx as
|
|
27503
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
27804
27504
|
function PlanningToggle({ enabled, onChange, disabled }) {
|
|
27805
|
-
return /* @__PURE__ */
|
|
27505
|
+
return /* @__PURE__ */ jsxs12(
|
|
27806
27506
|
"button",
|
|
27807
27507
|
{
|
|
27808
27508
|
type: "button",
|
|
@@ -27814,18 +27514,18 @@ function PlanningToggle({ enabled, onChange, disabled }) {
|
|
|
27814
27514
|
disabled,
|
|
27815
27515
|
className: "flex w-full items-center justify-between gap-3 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))] disabled:cursor-not-allowed disabled:opacity-50",
|
|
27816
27516
|
children: [
|
|
27817
|
-
/* @__PURE__ */
|
|
27818
|
-
/* @__PURE__ */
|
|
27517
|
+
/* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-2", children: [
|
|
27518
|
+
/* @__PURE__ */ jsx21(Lightbulb, { size: 14, className: "text-[#F97316]", "aria-hidden": "true" }),
|
|
27819
27519
|
"\u89C4\u5212\u6A21\u5F0F"
|
|
27820
27520
|
] }),
|
|
27821
|
-
/* @__PURE__ */
|
|
27822
|
-
/* @__PURE__ */
|
|
27823
|
-
/* @__PURE__ */
|
|
27521
|
+
/* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-2", children: [
|
|
27522
|
+
/* @__PURE__ */ jsx21("span", { className: "text-[hsl(var(--muted-foreground))]", children: enabled ? "\u5F00" : "\u5173" }),
|
|
27523
|
+
/* @__PURE__ */ jsx21(
|
|
27824
27524
|
"span",
|
|
27825
27525
|
{
|
|
27826
27526
|
className: `flex h-4 w-7 items-center rounded-full p-0.5 transition-colors ${enabled ? "justify-end bg-[hsl(var(--primary))]" : "justify-start bg-[hsl(var(--muted))]"}`,
|
|
27827
27527
|
"aria-hidden": "true",
|
|
27828
|
-
children: /* @__PURE__ */
|
|
27528
|
+
children: /* @__PURE__ */ jsx21("span", { className: "h-3 w-3 rounded-full bg-[hsl(var(--background))]" })
|
|
27829
27529
|
}
|
|
27830
27530
|
)
|
|
27831
27531
|
] })
|
|
@@ -27846,12 +27546,12 @@ function shouldHandleHistoryKey(event, menuOpen) {
|
|
|
27846
27546
|
}
|
|
27847
27547
|
|
|
27848
27548
|
// src/rich-input/ComposerAttachmentViewport.tsx
|
|
27849
|
-
import { jsx as
|
|
27549
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
27850
27550
|
function ComposerAttachmentViewport({
|
|
27851
27551
|
className,
|
|
27852
27552
|
...props
|
|
27853
27553
|
}) {
|
|
27854
|
-
return /* @__PURE__ */
|
|
27554
|
+
return /* @__PURE__ */ jsx23(
|
|
27855
27555
|
"div",
|
|
27856
27556
|
{
|
|
27857
27557
|
className: cn("min-h-0 max-h-40 overflow-y-auto overscroll-contain", className),
|
|
@@ -27861,13 +27561,13 @@ function ComposerAttachmentViewport({
|
|
|
27861
27561
|
}
|
|
27862
27562
|
|
|
27863
27563
|
// src/rich-input/ChatInput.tsx
|
|
27864
|
-
import { Fragment as Fragment5, jsx as
|
|
27564
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
27865
27565
|
var RECENT_SESSION_LIMIT = 50;
|
|
27866
27566
|
var DOUBLE_ESCAPE_MS = 450;
|
|
27867
27567
|
function getEditorText(editor) {
|
|
27868
27568
|
return editor?.getText({ blockSeparator: "\n" }) ?? "";
|
|
27869
27569
|
}
|
|
27870
|
-
function replaceEditorText(editor, text
|
|
27570
|
+
function replaceEditorText(editor, text) {
|
|
27871
27571
|
if (!editor) {
|
|
27872
27572
|
return;
|
|
27873
27573
|
}
|
|
@@ -27876,7 +27576,7 @@ function replaceEditorText(editor, text, kbMentions = [], topicAssetRefs = []) {
|
|
|
27876
27576
|
editor.commands.focus("end");
|
|
27877
27577
|
return;
|
|
27878
27578
|
}
|
|
27879
|
-
editor.commands.setContent(
|
|
27579
|
+
editor.commands.setContent(buildEditorDocument(text));
|
|
27880
27580
|
editor.commands.focus("end");
|
|
27881
27581
|
}
|
|
27882
27582
|
function getFileCardIcon(attachment) {
|
|
@@ -28032,31 +27732,31 @@ function ComposerFilePill({
|
|
|
28032
27732
|
const isFailed = isFile && attachment.status === "failed";
|
|
28033
27733
|
const isUploading = isFile && attachment.status === "uploading";
|
|
28034
27734
|
const uploadPercent = isUploading && typeof attachment.uploadProgress === "number" ? Math.max(0, Math.min(100, Math.round(attachment.uploadProgress * 100))) : null;
|
|
28035
|
-
return /* @__PURE__ */
|
|
27735
|
+
return /* @__PURE__ */ jsxs13(
|
|
28036
27736
|
"div",
|
|
28037
27737
|
{
|
|
28038
27738
|
className: `relative flex shrink-0 items-center gap-1.5 overflow-hidden rounded-full border px-2.5 py-1 text-[11px] ${isFailed ? "border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] text-[hsl(var(--swf-danger))]" : "border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--foreground))]"}`,
|
|
28039
27739
|
children: [
|
|
28040
|
-
uploadPercent !== null ? /* @__PURE__ */
|
|
27740
|
+
uploadPercent !== null ? /* @__PURE__ */ jsx24(
|
|
28041
27741
|
"span",
|
|
28042
27742
|
{
|
|
28043
27743
|
className: "absolute inset-y-0 left-0 bg-[hsl(var(--primary))]/10 transition-[width]",
|
|
28044
27744
|
style: { width: `${uploadPercent}%` }
|
|
28045
27745
|
}
|
|
28046
27746
|
) : null,
|
|
28047
|
-
isUploading ? /* @__PURE__ */
|
|
27747
|
+
isUploading ? /* @__PURE__ */ jsx24(
|
|
28048
27748
|
LoaderCircle,
|
|
28049
27749
|
{
|
|
28050
27750
|
size: 12,
|
|
28051
27751
|
className: "relative z-10 shrink-0 animate-spin text-[hsl(var(--muted-foreground))]"
|
|
28052
27752
|
}
|
|
28053
|
-
) : /* @__PURE__ */
|
|
28054
|
-
/* @__PURE__ */
|
|
28055
|
-
uploadPercent !== null ? /* @__PURE__ */
|
|
27753
|
+
) : /* @__PURE__ */ jsx24(Icon, { size: 12, className: "relative z-10 shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
27754
|
+
/* @__PURE__ */ jsx24("span", { className: "relative z-10 max-w-32 truncate", children: attachment.name }),
|
|
27755
|
+
uploadPercent !== null ? /* @__PURE__ */ jsxs13("span", { className: "relative z-10 font-mono text-[10px] tabular-nums text-[hsl(var(--muted-foreground))]", children: [
|
|
28056
27756
|
uploadPercent,
|
|
28057
27757
|
"%"
|
|
28058
27758
|
] }) : null,
|
|
28059
|
-
/* @__PURE__ */
|
|
27759
|
+
/* @__PURE__ */ jsx24(
|
|
28060
27760
|
"button",
|
|
28061
27761
|
{
|
|
28062
27762
|
type: "button",
|
|
@@ -28064,7 +27764,7 @@ function ComposerFilePill({
|
|
|
28064
27764
|
"aria-label": `\u79FB\u9664 ${attachment.name}`,
|
|
28065
27765
|
title: "\u79FB\u9664",
|
|
28066
27766
|
className: "relative z-10 ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full text-[hsl(var(--muted-foreground))] transition hover:text-[hsl(var(--swf-danger))]",
|
|
28067
|
-
children: /* @__PURE__ */
|
|
27767
|
+
children: /* @__PURE__ */ jsx24(X, { size: 10 })
|
|
28068
27768
|
}
|
|
28069
27769
|
)
|
|
28070
27770
|
]
|
|
@@ -28187,7 +27887,7 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
28187
27887
|
setImportingId(null);
|
|
28188
27888
|
}
|
|
28189
27889
|
};
|
|
28190
|
-
return /* @__PURE__ */
|
|
27890
|
+
return /* @__PURE__ */ jsx24(
|
|
28191
27891
|
"div",
|
|
28192
27892
|
{
|
|
28193
27893
|
className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4",
|
|
@@ -28195,44 +27895,44 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
28195
27895
|
onKeyDown: (e) => {
|
|
28196
27896
|
if (e.key === "Escape") onClose();
|
|
28197
27897
|
},
|
|
28198
|
-
children: /* @__PURE__ */
|
|
27898
|
+
children: /* @__PURE__ */ jsxs13(
|
|
28199
27899
|
"div",
|
|
28200
27900
|
{
|
|
28201
27901
|
className: "w-full max-w-lg flex flex-col rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-[var(--swf-shadow-overlay)]",
|
|
28202
27902
|
onClick: (e) => e.stopPropagation(),
|
|
28203
27903
|
onKeyDown: (e) => e.stopPropagation(),
|
|
28204
27904
|
children: [
|
|
28205
|
-
/* @__PURE__ */
|
|
28206
|
-
/* @__PURE__ */
|
|
28207
|
-
/* @__PURE__ */
|
|
27905
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-5 py-3", children: [
|
|
27906
|
+
/* @__PURE__ */ jsx24("h4", { className: "text-sm font-semibold text-[hsl(var(--foreground))]", children: "\u6DFB\u52A0\u4E0A\u4E0B\u6587" }),
|
|
27907
|
+
/* @__PURE__ */ jsx24(
|
|
28208
27908
|
"button",
|
|
28209
27909
|
{
|
|
28210
27910
|
type: "button",
|
|
28211
27911
|
onClick: onClose,
|
|
28212
27912
|
className: "rounded-md p-1 text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
28213
|
-
children: /* @__PURE__ */
|
|
27913
|
+
children: /* @__PURE__ */ jsx24(X, { size: 14 })
|
|
28214
27914
|
}
|
|
28215
27915
|
)
|
|
28216
27916
|
] }),
|
|
28217
|
-
/* @__PURE__ */
|
|
28218
|
-
/* @__PURE__ */
|
|
28219
|
-
/* @__PURE__ */
|
|
27917
|
+
/* @__PURE__ */ jsxs13("div", { className: "px-5 py-4 space-y-3", children: [
|
|
27918
|
+
/* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
27919
|
+
/* @__PURE__ */ jsxs13(
|
|
28220
27920
|
"button",
|
|
28221
27921
|
{
|
|
28222
27922
|
type: "button",
|
|
28223
27923
|
onClick: handleLoadSessions,
|
|
28224
27924
|
className: "inline-flex items-center gap-1.5 rounded-md border border-[hsl(var(--border))] px-2.5 py-1.5 text-xs text-[hsl(var(--foreground))] transition-colors hover:bg-[hsl(var(--accent))]",
|
|
28225
27925
|
children: [
|
|
28226
|
-
/* @__PURE__ */
|
|
27926
|
+
/* @__PURE__ */ jsx24(Import, { size: 12 }),
|
|
28227
27927
|
"\u4ECE\u5176\u4ED6\u4F1A\u8BDD\u5BFC\u5165",
|
|
28228
|
-
/* @__PURE__ */
|
|
27928
|
+
/* @__PURE__ */ jsx24(ChevronDown, { size: 10, className: `transition-transform ${showSessionPicker ? "rotate-180" : ""}` })
|
|
28229
27929
|
]
|
|
28230
27930
|
}
|
|
28231
27931
|
),
|
|
28232
|
-
showSessionPicker && /* @__PURE__ */
|
|
28233
|
-
/* @__PURE__ */
|
|
27932
|
+
showSessionPicker && /* @__PURE__ */ jsx24("div", { className: "absolute left-0 top-full z-10 mt-1 max-h-48 w-full overflow-y-auto rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-[var(--swf-shadow-overlay)]", children: loadingSessions ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 px-3 py-2.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
27933
|
+
/* @__PURE__ */ jsx24(LoaderCircle, { size: 12, className: "animate-spin" }),
|
|
28234
27934
|
"\u52A0\u8F7D\u4F1A\u8BDD\u5217\u8868\u2026"
|
|
28235
|
-
] }) : sessions.length === 0 ? /* @__PURE__ */
|
|
27935
|
+
] }) : sessions.length === 0 ? /* @__PURE__ */ jsx24("div", { className: "px-3 py-2.5 text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u5176\u4ED6\u4F1A\u8BDD" }) : sessions.map((s) => /* @__PURE__ */ jsxs13(
|
|
28236
27936
|
"button",
|
|
28237
27937
|
{
|
|
28238
27938
|
type: "button",
|
|
@@ -28240,16 +27940,16 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
28240
27940
|
onClick: () => handleImportSession(s.id),
|
|
28241
27941
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-[hsl(var(--foreground))] transition-colors hover:bg-[hsl(var(--accent))] disabled:opacity-50",
|
|
28242
27942
|
children: [
|
|
28243
|
-
importingId === s.id && /* @__PURE__ */
|
|
28244
|
-
/* @__PURE__ */
|
|
27943
|
+
importingId === s.id && /* @__PURE__ */ jsx24(LoaderCircle, { size: 10, className: "shrink-0 animate-spin" }),
|
|
27944
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate", children: s.intent })
|
|
28245
27945
|
]
|
|
28246
27946
|
},
|
|
28247
27947
|
s.id
|
|
28248
27948
|
)) })
|
|
28249
27949
|
] }),
|
|
28250
|
-
/* @__PURE__ */
|
|
28251
|
-
/* @__PURE__ */
|
|
28252
|
-
/* @__PURE__ */
|
|
27950
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
27951
|
+
/* @__PURE__ */ jsx24("label", { htmlFor: "ctx-label", className: "block text-xs font-medium text-[hsl(var(--foreground))] mb-1", children: "\u6807\u7B7E" }),
|
|
27952
|
+
/* @__PURE__ */ jsx24(
|
|
28253
27953
|
"input",
|
|
28254
27954
|
{
|
|
28255
27955
|
id: "ctx-label",
|
|
@@ -28260,13 +27960,13 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
28260
27960
|
}
|
|
28261
27961
|
)
|
|
28262
27962
|
] }),
|
|
28263
|
-
/* @__PURE__ */
|
|
28264
|
-
/* @__PURE__ */
|
|
28265
|
-
isImportProcessing && /* @__PURE__ */
|
|
28266
|
-
/* @__PURE__ */
|
|
27963
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
27964
|
+
/* @__PURE__ */ jsx24("label", { htmlFor: "ctx-content", className: "block text-xs font-medium text-[hsl(var(--foreground))] mb-1", children: "\u5185\u5BB9" }),
|
|
27965
|
+
isImportProcessing && /* @__PURE__ */ jsxs13("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
27966
|
+
/* @__PURE__ */ jsx24(LoaderCircle, { size: 12, className: "animate-spin" }),
|
|
28267
27967
|
"\u6B63\u5728\u5904\u7406\u5BFC\u5165\u5185\u5BB9\u5E76\u5199\u5165 workspace/context\uFF0C\u5B8C\u6210\u540E\u53EF\u70B9\u51FB\u201C\u786E\u5B9A\u201D"
|
|
28268
27968
|
] }),
|
|
28269
|
-
/* @__PURE__ */
|
|
27969
|
+
/* @__PURE__ */ jsx24(
|
|
28270
27970
|
"textarea",
|
|
28271
27971
|
{
|
|
28272
27972
|
id: "ctx-content",
|
|
@@ -28279,8 +27979,8 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
28279
27979
|
)
|
|
28280
27980
|
] })
|
|
28281
27981
|
] }),
|
|
28282
|
-
/* @__PURE__ */
|
|
28283
|
-
/* @__PURE__ */
|
|
27982
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2 border-t border-[hsl(var(--border))] px-5 py-3", children: [
|
|
27983
|
+
/* @__PURE__ */ jsx24(
|
|
28284
27984
|
"button",
|
|
28285
27985
|
{
|
|
28286
27986
|
type: "button",
|
|
@@ -28289,7 +27989,7 @@ ${upload.rawResultStr.slice(0, CONTEXT_INLINE_THRESHOLD)}...`
|
|
|
28289
27989
|
children: "\u53D6\u6D88"
|
|
28290
27990
|
}
|
|
28291
27991
|
),
|
|
28292
|
-
/* @__PURE__ */
|
|
27992
|
+
/* @__PURE__ */ jsx24(
|
|
28293
27993
|
"button",
|
|
28294
27994
|
{
|
|
28295
27995
|
type: "button",
|
|
@@ -28320,19 +28020,19 @@ function ComposerContextPill({
|
|
|
28320
28020
|
}) {
|
|
28321
28021
|
const [showDetail, setShowDetail] = useState11(false);
|
|
28322
28022
|
const tokenK = formatTokenK(content);
|
|
28323
|
-
return /* @__PURE__ */
|
|
28324
|
-
/* @__PURE__ */
|
|
28325
|
-
imageUrl ? /* @__PURE__ */
|
|
28023
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
28024
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--accent))] px-2.5 py-1 text-[11px] text-[hsl(var(--foreground))]", children: [
|
|
28025
|
+
imageUrl ? /* @__PURE__ */ jsx24(
|
|
28326
28026
|
"button",
|
|
28327
28027
|
{
|
|
28328
28028
|
type: "button",
|
|
28329
28029
|
onClick: () => setShowDetail(true),
|
|
28330
28030
|
className: "h-6 w-6 overflow-hidden rounded-md border border-[hsl(var(--border))] bg-white",
|
|
28331
28031
|
title: "\u67E5\u770B\u9009\u4E2D\u533A\u57DF\u622A\u56FE",
|
|
28332
|
-
children: /* @__PURE__ */
|
|
28032
|
+
children: /* @__PURE__ */ jsx24("img", { src: imageUrl, alt: "\u9009\u4E2D\u533A\u57DF\u622A\u56FE", className: "h-full w-full object-cover" })
|
|
28333
28033
|
}
|
|
28334
28034
|
) : null,
|
|
28335
|
-
/* @__PURE__ */
|
|
28035
|
+
/* @__PURE__ */ jsx24(
|
|
28336
28036
|
"button",
|
|
28337
28037
|
{
|
|
28338
28038
|
type: "button",
|
|
@@ -28342,7 +28042,7 @@ function ComposerContextPill({
|
|
|
28342
28042
|
children: label
|
|
28343
28043
|
}
|
|
28344
28044
|
),
|
|
28345
|
-
/* @__PURE__ */
|
|
28045
|
+
/* @__PURE__ */ jsx24(
|
|
28346
28046
|
"span",
|
|
28347
28047
|
{
|
|
28348
28048
|
className: "shrink-0 rounded bg-[hsl(var(--background))] px-1.5 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]",
|
|
@@ -28350,7 +28050,7 @@ function ComposerContextPill({
|
|
|
28350
28050
|
children: tokenK
|
|
28351
28051
|
}
|
|
28352
28052
|
),
|
|
28353
|
-
/* @__PURE__ */
|
|
28053
|
+
/* @__PURE__ */ jsx24(
|
|
28354
28054
|
"button",
|
|
28355
28055
|
{
|
|
28356
28056
|
type: "button",
|
|
@@ -28358,11 +28058,11 @@ function ComposerContextPill({
|
|
|
28358
28058
|
"aria-label": `\u79FB\u9664\u4E0A\u4E0B\u6587 ${label}`,
|
|
28359
28059
|
title: "\u79FB\u9664",
|
|
28360
28060
|
className: "ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full text-[hsl(var(--muted-foreground))] transition hover:text-[hsl(var(--swf-danger))]",
|
|
28361
|
-
children: /* @__PURE__ */
|
|
28061
|
+
children: /* @__PURE__ */ jsx24(X, { size: 10 })
|
|
28362
28062
|
}
|
|
28363
28063
|
)
|
|
28364
28064
|
] }),
|
|
28365
|
-
showDetail && /* @__PURE__ */
|
|
28065
|
+
showDetail && /* @__PURE__ */ jsx24(
|
|
28366
28066
|
"div",
|
|
28367
28067
|
{
|
|
28368
28068
|
className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-6",
|
|
@@ -28370,31 +28070,31 @@ function ComposerContextPill({
|
|
|
28370
28070
|
onKeyDown: (e) => {
|
|
28371
28071
|
if (e.key === "Escape") setShowDetail(false);
|
|
28372
28072
|
},
|
|
28373
|
-
children: /* @__PURE__ */
|
|
28073
|
+
children: /* @__PURE__ */ jsxs13(
|
|
28374
28074
|
"div",
|
|
28375
28075
|
{
|
|
28376
28076
|
className: "w-full max-w-4xl max-h-[85vh] flex flex-col rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-[var(--swf-shadow-overlay)]",
|
|
28377
28077
|
onClick: (e) => e.stopPropagation(),
|
|
28378
28078
|
onKeyDown: (e) => e.stopPropagation(),
|
|
28379
28079
|
children: [
|
|
28380
|
-
/* @__PURE__ */
|
|
28381
|
-
/* @__PURE__ */
|
|
28382
|
-
/* @__PURE__ */
|
|
28383
|
-
imageUrl ? /* @__PURE__ */
|
|
28080
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-6 py-3", children: [
|
|
28081
|
+
/* @__PURE__ */ jsxs13("div", { className: "min-w-0", children: [
|
|
28082
|
+
/* @__PURE__ */ jsx24("h4", { className: "truncate text-xs font-semibold text-[hsl(var(--foreground))]", children: label }),
|
|
28083
|
+
imageUrl ? /* @__PURE__ */ jsx24("p", { className: "mt-0.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u5DF2\u9644\u52A0\u9009\u4E2D\u533A\u57DF\u622A\u56FE\uFF0C\u975E\u591A\u6A21\u6001\u6A21\u578B\u4F1A\u81EA\u52A8\u5FFD\u7565\u56FE\u7247\u3002" }) : null
|
|
28384
28084
|
] }),
|
|
28385
|
-
/* @__PURE__ */
|
|
28085
|
+
/* @__PURE__ */ jsx24(
|
|
28386
28086
|
"button",
|
|
28387
28087
|
{
|
|
28388
28088
|
type: "button",
|
|
28389
28089
|
onClick: () => setShowDetail(false),
|
|
28390
28090
|
className: "rounded-md p-1 text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
28391
|
-
children: /* @__PURE__ */
|
|
28091
|
+
children: /* @__PURE__ */ jsx24(X, { size: 14 })
|
|
28392
28092
|
}
|
|
28393
28093
|
)
|
|
28394
28094
|
] }),
|
|
28395
|
-
/* @__PURE__ */
|
|
28396
|
-
imageUrl ? /* @__PURE__ */
|
|
28397
|
-
/* @__PURE__ */
|
|
28095
|
+
/* @__PURE__ */ jsxs13("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: [
|
|
28096
|
+
imageUrl ? /* @__PURE__ */ jsx24("div", { className: "mb-4 rounded-xl border border-[hsl(var(--border))] bg-white p-2", children: /* @__PURE__ */ jsx24("img", { src: imageUrl, alt: "\u9009\u4E2D\u533A\u57DF\u622A\u56FE", className: "max-h-72 max-w-full rounded-lg object-contain" }) }) : null,
|
|
28097
|
+
/* @__PURE__ */ jsx24("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] leading-[1.6] text-[hsl(var(--foreground)/0.85)]", children: content })
|
|
28398
28098
|
] })
|
|
28399
28099
|
]
|
|
28400
28100
|
}
|
|
@@ -28454,8 +28154,6 @@ function ChatInput({
|
|
|
28454
28154
|
SkillStatusBarComponent: SkillStatusBarOverride,
|
|
28455
28155
|
skillStatusBarClassName,
|
|
28456
28156
|
skillStatusBarInnerClassName,
|
|
28457
|
-
onResyncSkills,
|
|
28458
|
-
isResyncingSkills = false,
|
|
28459
28157
|
onOpenSkills,
|
|
28460
28158
|
inputLabel = "\u8F93\u5165\u6D88\u606F",
|
|
28461
28159
|
placeholderText,
|
|
@@ -28469,6 +28167,7 @@ function ChatInput({
|
|
|
28469
28167
|
lite = false,
|
|
28470
28168
|
canCreateBoardTask = false
|
|
28471
28169
|
}) {
|
|
28170
|
+
const developer = useChatRenderMode() === "developer";
|
|
28472
28171
|
const isBusy = isStreaming || isCompacting;
|
|
28473
28172
|
const resolvedInputLabel = inputLabel?.trim() || "\u8F93\u5165\u6D88\u606F";
|
|
28474
28173
|
const initialInput = externalDraft?.value ?? initialDraft ?? "";
|
|
@@ -28478,10 +28177,11 @@ function ChatInput({
|
|
|
28478
28177
|
externalDraft?.setValue(value);
|
|
28479
28178
|
});
|
|
28480
28179
|
const externalDraftValue = externalDraft?.value;
|
|
28481
|
-
const inputRef =
|
|
28180
|
+
const inputRef = useRef7(input);
|
|
28482
28181
|
inputRef.current = input;
|
|
28483
|
-
const appliedInitialDraftKeyRef =
|
|
28484
|
-
|
|
28182
|
+
const appliedInitialDraftKeyRef = useRef7(null);
|
|
28183
|
+
const appliedInitialDraftRef = useRef7(null);
|
|
28184
|
+
useEffect8(() => {
|
|
28485
28185
|
if (externalDraftValue == null) return;
|
|
28486
28186
|
if (inputRef.current === externalDraftValue) return;
|
|
28487
28187
|
if (editorRef.current) {
|
|
@@ -28489,16 +28189,18 @@ function ChatInput({
|
|
|
28489
28189
|
}
|
|
28490
28190
|
setInputInternal(externalDraftValue);
|
|
28491
28191
|
}, [externalDraftValue]);
|
|
28492
|
-
|
|
28192
|
+
useEffect8(() => {
|
|
28493
28193
|
const key = initialDraftKey ?? initialDraft ?? "";
|
|
28494
28194
|
if (!initialDraft || !key || appliedInitialDraftKeyRef.current === key) return;
|
|
28495
|
-
if (inputRef.current
|
|
28195
|
+
if (inputRef.current === initialDraft) appliedInitialDraftRef.current = initialDraft;
|
|
28196
|
+
if (inputRef.current.trim() && inputRef.current !== appliedInitialDraftRef.current) {
|
|
28496
28197
|
appliedInitialDraftKeyRef.current = key;
|
|
28497
28198
|
return;
|
|
28498
28199
|
}
|
|
28499
28200
|
replaceEditorText(editorRef.current, initialDraft);
|
|
28500
28201
|
setInput(initialDraft);
|
|
28501
28202
|
appliedInitialDraftKeyRef.current = key;
|
|
28203
|
+
appliedInitialDraftRef.current = initialDraft;
|
|
28502
28204
|
}, [initialDraft, initialDraftKey, setInput]);
|
|
28503
28205
|
const [composerAttachments, setComposerAttachmentsInternal] = useState11(
|
|
28504
28206
|
externalAttachments?.value ?? []
|
|
@@ -28513,9 +28215,9 @@ function ChatInput({
|
|
|
28513
28215
|
}
|
|
28514
28216
|
);
|
|
28515
28217
|
const externalAttachmentsValue = externalAttachments?.value;
|
|
28516
|
-
const composerAttachmentsRef =
|
|
28218
|
+
const composerAttachmentsRef = useRef7(composerAttachments);
|
|
28517
28219
|
composerAttachmentsRef.current = composerAttachments;
|
|
28518
|
-
|
|
28220
|
+
useEffect8(() => {
|
|
28519
28221
|
if (externalAttachmentsValue == null) return;
|
|
28520
28222
|
if (composerAttachmentsRef.current === externalAttachmentsValue) return;
|
|
28521
28223
|
setComposerAttachmentsInternal(externalAttachmentsValue);
|
|
@@ -28529,16 +28231,16 @@ function ChatInput({
|
|
|
28529
28231
|
const invalidation = useSessionDataInvalidation();
|
|
28530
28232
|
const SkillStatusBarComponent = SkillStatusBarOverride ?? SkillStatusBar;
|
|
28531
28233
|
const [actionMenuOpen, setActionMenuOpen] = useState11(false);
|
|
28532
|
-
const actionMenuOpenRef =
|
|
28533
|
-
|
|
28234
|
+
const actionMenuOpenRef = useRef7(false);
|
|
28235
|
+
useEffect8(() => {
|
|
28534
28236
|
actionMenuOpenRef.current = actionMenuOpen;
|
|
28535
28237
|
}, [actionMenuOpen]);
|
|
28536
28238
|
const [connectMenuOpen, setConnectMenuOpen] = useState11(false);
|
|
28537
|
-
const fileInputRef =
|
|
28538
|
-
const folderInputRef =
|
|
28539
|
-
const editorRef =
|
|
28540
|
-
const lastEscapeAtRef =
|
|
28541
|
-
const localImageUrlsRef =
|
|
28239
|
+
const fileInputRef = useRef7(null);
|
|
28240
|
+
const folderInputRef = useRef7(null);
|
|
28241
|
+
const editorRef = useRef7(null);
|
|
28242
|
+
const lastEscapeAtRef = useRef7(0);
|
|
28243
|
+
const localImageUrlsRef = useRef7(/* @__PURE__ */ new Map());
|
|
28542
28244
|
const currentChatSessionId = useCurrentChatSessionId();
|
|
28543
28245
|
const activeSessionId = sessionIdProp ?? currentChatSessionId;
|
|
28544
28246
|
const currentSession = useChatSessionDetail(activeSessionId);
|
|
@@ -28565,44 +28267,36 @@ function ChatInput({
|
|
|
28565
28267
|
(state3) => activeSessionId ? state3.sendRequests[activeSessionId] : void 0
|
|
28566
28268
|
);
|
|
28567
28269
|
const connectionStatus = useComposerConnection(activeSessionId);
|
|
28568
|
-
const
|
|
28569
|
-
const inputHistory = useInputHistory(activeSessionId);
|
|
28270
|
+
const inputHistory = useInputHistory(activeSessionId, client);
|
|
28570
28271
|
const queuedTopicRefs = useComposerChannels((state3) => activeSessionId ? state3.topicAssetReferences[activeSessionId] : void 0);
|
|
28571
28272
|
const getTopicSuggestions = useEffectEvent(async (query) => {
|
|
28572
28273
|
if (!activeSessionId) return [];
|
|
28573
28274
|
try {
|
|
28574
28275
|
const detail = await client.sessions.getSession(activeSessionId);
|
|
28575
|
-
return
|
|
28276
|
+
return getTopicAssetSuggestionItems(client, detail.chat_group_id, query);
|
|
28576
28277
|
} catch {
|
|
28577
|
-
return [{ kind: "topicAssetError", message: "\
|
|
28278
|
+
return [{ kind: "topicAssetError", message: "\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165 @ \u91CD\u8BD5" }];
|
|
28578
28279
|
}
|
|
28579
28280
|
});
|
|
28580
28281
|
const getSessionId = useEffectEvent(() => activeSessionId);
|
|
28581
28282
|
const handleSlashCommand = useEffectEvent((commandId) => onCommand?.(commandId));
|
|
28582
|
-
const
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
|
|
28586
|
-
|
|
28283
|
+
const referenceCandidates = useReferenceCandidates(
|
|
28284
|
+
() => [client, client.token, activeSessionId, currentSession?.chat_group_id],
|
|
28285
|
+
{
|
|
28286
|
+
plugins: (query) => getPluginSuggestionItems(client, getSessionId(), query),
|
|
28287
|
+
topics: getTopicSuggestions,
|
|
28288
|
+
files: (query) => getFileSuggestionItems(client, getSessionId(), query)
|
|
28587
28289
|
}
|
|
28588
|
-
|
|
28589
|
-
const pendingKbRefreshRef = useRef8(null);
|
|
28290
|
+
);
|
|
28590
28291
|
const [localImageUrls, setLocalImageUrls] = useState11({});
|
|
28591
28292
|
const getMentionSuggestionItems = useEffectEvent(
|
|
28592
28293
|
async (query) => {
|
|
28593
|
-
const normalizedQuery = query.trim().toLowerCase();
|
|
28594
|
-
const commandItems = COMMANDS.filter((item) => {
|
|
28595
|
-
if (!normalizedQuery) {
|
|
28596
|
-
return true;
|
|
28597
|
-
}
|
|
28598
|
-
return item.id.toLowerCase().startsWith(normalizedQuery) || item.label.toLowerCase().startsWith(normalizedQuery);
|
|
28599
|
-
});
|
|
28600
28294
|
const skillItems = await getSlashSuggestions(query, {
|
|
28601
28295
|
client,
|
|
28602
28296
|
sessionId: getSessionId(),
|
|
28603
28297
|
renderMode: environment.renderMode ?? "normal"
|
|
28604
28298
|
}).catch(() => []);
|
|
28605
|
-
return
|
|
28299
|
+
return skillItems;
|
|
28606
28300
|
}
|
|
28607
28301
|
);
|
|
28608
28302
|
const appendFiles = async (files) => {
|
|
@@ -28634,10 +28328,11 @@ function ChatInput({
|
|
|
28634
28328
|
}
|
|
28635
28329
|
};
|
|
28636
28330
|
const stableAppendFiles = useEffectEvent((files) => appendFiles(files));
|
|
28637
|
-
const stableHandleSubmit = useEffectEvent(() => handleSubmit());
|
|
28331
|
+
const stableHandleSubmit = useEffectEvent((queueWhenRunning = false) => handleSubmit(queueWhenRunning));
|
|
28638
28332
|
const getEditorState = useEffectEvent(() => ({
|
|
28639
28333
|
input,
|
|
28640
28334
|
connectionStatus,
|
|
28335
|
+
topicId: currentSession?.chat_group_id ?? null,
|
|
28641
28336
|
navigateUp: inputHistory.navigateUp,
|
|
28642
28337
|
navigateDown: inputHistory.navigateDown,
|
|
28643
28338
|
isNavigatingHistory: inputHistory.isNavigating,
|
|
@@ -28664,7 +28359,6 @@ function ChatInput({
|
|
|
28664
28359
|
gapcursor: false,
|
|
28665
28360
|
heading: false,
|
|
28666
28361
|
horizontalRule: false,
|
|
28667
|
-
// 输入框是纯文本输入区,关掉自动识别链接,避免点击输入的网址直接跳转
|
|
28668
28362
|
link: false,
|
|
28669
28363
|
orderedList: false
|
|
28670
28364
|
}),
|
|
@@ -28672,29 +28366,11 @@ function ChatInput({
|
|
|
28672
28366
|
suggestion: {
|
|
28673
28367
|
char: "@",
|
|
28674
28368
|
pluginKey: fileMentionSuggestionKey,
|
|
28675
|
-
|
|
28676
|
-
// 限了个短超时(withKbSuggestionTimeout),Hub 慢或不可达时不拖着本来
|
|
28677
|
-
// 秒回的文件候选一起等它。超时只是"这次先不等了",不是"没有知识库"——
|
|
28678
|
-
// 真结果迟到后如果菜单还开在同一个 query 上,靠 pendingKbRefreshRef
|
|
28679
|
-
// (render() 那边挂的)把知识库分组补进去,不然用户输入 @ 之后不再
|
|
28680
|
-
// 打字,菜单就永远空着知识库那组,得关掉重开或改查询词才能看见。
|
|
28681
|
-
items: async ({ query }) => {
|
|
28682
|
-
const kbPromise = getKbSuggestionItems();
|
|
28683
|
-
const topicsPromise = getTopicSuggestions(query);
|
|
28684
|
-
const filesPromise = getFileSuggestionItems(client, getSessionId(), query).catch(() => []);
|
|
28685
|
-
const kbs = await withKbSuggestionTimeout(kbPromise);
|
|
28686
|
-
notifyWhenKbSuggestionsArriveLate(kbPromise, kbs, (lateKbs) => {
|
|
28687
|
-
if (pendingKbRefreshRef.current?.query === query) {
|
|
28688
|
-
pendingKbRefreshRef.current.applyLateKbs(lateKbs);
|
|
28689
|
-
}
|
|
28690
|
-
});
|
|
28691
|
-
const files = await filesPromise;
|
|
28692
|
-
return [...kbs, ...await topicsPromise, ...files];
|
|
28693
|
-
},
|
|
28369
|
+
items: ({ query }) => referenceCandidates.query(query),
|
|
28694
28370
|
command: ({ editor: suggestionEditor, props, range }) => {
|
|
28695
28371
|
const item = props;
|
|
28696
28372
|
suggestionEditor.chain().focus().insertContentAt(range, [
|
|
28697
|
-
|
|
28373
|
+
isPluginSuggestionItem(item) ? { type: "pluginMention", attrs: { provider: item.provider, plugin: item.plugin, server: item.server, id: item.id, label: item.label } } : isTopicAssetSuggestionItem(item) ? { type: "topicAssetMention", attrs: { topic_id: item.topic_id, path: item.path } } : { type: "fileMention", attrs: { name: item.name, path: item.path } },
|
|
28698
28374
|
{
|
|
28699
28375
|
type: "text",
|
|
28700
28376
|
text: " "
|
|
@@ -28712,11 +28388,11 @@ function ChatInput({
|
|
|
28712
28388
|
exitSuggestion(view, fileMentionSuggestionKey);
|
|
28713
28389
|
}
|
|
28714
28390
|
};
|
|
28715
|
-
const
|
|
28391
|
+
const paintMenu = (props) => {
|
|
28716
28392
|
if (!container || !root) return;
|
|
28717
28393
|
updateSuggestionPosition(container, props.clientRect);
|
|
28718
28394
|
root.render(
|
|
28719
|
-
/* @__PURE__ */
|
|
28395
|
+
/* @__PURE__ */ jsx24(
|
|
28720
28396
|
FileCompletionMenu,
|
|
28721
28397
|
{
|
|
28722
28398
|
ref: (instance) => {
|
|
@@ -28728,13 +28404,11 @@ function ChatInput({
|
|
|
28728
28404
|
}
|
|
28729
28405
|
)
|
|
28730
28406
|
);
|
|
28731
|
-
|
|
28732
|
-
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
}
|
|
28737
|
-
};
|
|
28407
|
+
};
|
|
28408
|
+
const renderMenu = (props) => {
|
|
28409
|
+
referenceCandidates.observe(props.items, (snapshot) => {
|
|
28410
|
+
paintMenu({ ...props, items: snapshot.items });
|
|
28411
|
+
});
|
|
28738
28412
|
};
|
|
28739
28413
|
return {
|
|
28740
28414
|
onStart: (props) => {
|
|
@@ -28758,7 +28432,7 @@ function ChatInput({
|
|
|
28758
28432
|
container?.remove();
|
|
28759
28433
|
root = null;
|
|
28760
28434
|
container = null;
|
|
28761
|
-
|
|
28435
|
+
referenceCandidates.cancel();
|
|
28762
28436
|
},
|
|
28763
28437
|
onKeyDown: ({ event, view }) => {
|
|
28764
28438
|
if (event.key === "Escape") {
|
|
@@ -28772,8 +28446,7 @@ function ChatInput({
|
|
|
28772
28446
|
}
|
|
28773
28447
|
}
|
|
28774
28448
|
}),
|
|
28775
|
-
|
|
28776
|
-
KbMention,
|
|
28449
|
+
PluginMention,
|
|
28777
28450
|
TopicAssetMention,
|
|
28778
28451
|
SkillMention.configure({
|
|
28779
28452
|
suggestion: {
|
|
@@ -28787,13 +28460,6 @@ function ChatInput({
|
|
|
28787
28460
|
void handleSlashCommand(item.id);
|
|
28788
28461
|
return;
|
|
28789
28462
|
}
|
|
28790
|
-
if (item.type === "workflow") {
|
|
28791
|
-
suggestionEditor.chain().focus().insertContentAt(range, [
|
|
28792
|
-
{ type: "workflowMention", attrs: { name: item.name } },
|
|
28793
|
-
{ type: "text", text: workflowParamsTail(item) }
|
|
28794
|
-
]).run();
|
|
28795
|
-
return;
|
|
28796
|
-
}
|
|
28797
28463
|
suggestionEditor.chain().focus().insertContentAt(range, [
|
|
28798
28464
|
{
|
|
28799
28465
|
type: "skillMention",
|
|
@@ -28819,7 +28485,7 @@ function ChatInput({
|
|
|
28819
28485
|
if (!container || !root) return;
|
|
28820
28486
|
updateSuggestionPosition(container, props.clientRect);
|
|
28821
28487
|
root.render(
|
|
28822
|
-
/* @__PURE__ */
|
|
28488
|
+
/* @__PURE__ */ jsx24(
|
|
28823
28489
|
SkillCompletionMenu,
|
|
28824
28490
|
{
|
|
28825
28491
|
ref: (instance) => {
|
|
@@ -28861,7 +28527,7 @@ function ChatInput({
|
|
|
28861
28527
|
}
|
|
28862
28528
|
})
|
|
28863
28529
|
],
|
|
28864
|
-
content:
|
|
28530
|
+
content: buildEditorDocument(initialInput),
|
|
28865
28531
|
onCreate: ({ editor: editorInstance }) => {
|
|
28866
28532
|
editorRef.current = editorInstance;
|
|
28867
28533
|
syncEditorState(editorInstance);
|
|
@@ -28878,7 +28544,7 @@ function ChatInput({
|
|
|
28878
28544
|
"aria-label": resolvedInputLabel,
|
|
28879
28545
|
"data-testid": "chat-message-input",
|
|
28880
28546
|
"data-blade-input-label": resolvedInputLabel,
|
|
28881
|
-
class: "min-h-[34px] max-h-[240px] overflow-y-auto px-5 py-3 text-sm leading-relaxed text-[hsl(var(--foreground))] focus:outline-none [&_.file-mention-pill]:inline-flex [&_.file-mention-pill]:items-center [&_.file-mention-pill]:rounded-full [&_.file-mention-pill]:bg-[hsl(var(--accent))] [&_.file-mention-pill]:px-2 [&_.file-mention-pill]:py-0.5 [&_.file-mention-pill]:font-medium [&_.file-mention-pill]:text-[hsl(var(--primary))] [&_.file-mention-pill]:select-none [&_.file-mention-pill]:whitespace-nowrap [&_.skill-mention-pill]:inline-flex [&_.skill-mention-pill]:items-center [&_.skill-mention-pill]:rounded-full [&_.skill-mention-pill]:bg-[hsl(var(--primary)/0.15)] [&_.skill-mention-pill]:px-2 [&_.skill-mention-pill]:py-0.5 [&_.skill-mention-pill]:font-medium [&_.skill-mention-pill]:text-[hsl(var(--primary))] [&_.skill-mention-pill]:select-none [&_.skill-mention-pill]:whitespace-nowrap [&
|
|
28547
|
+
class: "min-h-[34px] max-h-[240px] overflow-y-auto px-5 py-3 text-sm leading-relaxed text-[hsl(var(--foreground))] focus:outline-none [&_.file-mention-pill]:inline-flex [&_.file-mention-pill]:items-center [&_.file-mention-pill]:rounded-full [&_.file-mention-pill]:bg-[hsl(var(--accent))] [&_.file-mention-pill]:px-2 [&_.file-mention-pill]:py-0.5 [&_.file-mention-pill]:font-medium [&_.file-mention-pill]:text-[hsl(var(--primary))] [&_.file-mention-pill]:select-none [&_.file-mention-pill]:whitespace-nowrap [&_.skill-mention-pill]:inline-flex [&_.skill-mention-pill]:items-center [&_.skill-mention-pill]:rounded-full [&_.skill-mention-pill]:bg-[hsl(var(--primary)/0.15)] [&_.skill-mention-pill]:px-2 [&_.skill-mention-pill]:py-0.5 [&_.skill-mention-pill]:font-medium [&_.skill-mention-pill]:text-[hsl(var(--primary))] [&_.skill-mention-pill]:select-none [&_.skill-mention-pill]:whitespace-nowrap [&_p:first-child]:mt-0 [&_p:last-child]:mb-0"
|
|
28882
28548
|
},
|
|
28883
28549
|
handleDOMEvents: {
|
|
28884
28550
|
focus: () => {
|
|
@@ -28901,12 +28567,13 @@ function ChatInput({
|
|
|
28901
28567
|
}
|
|
28902
28568
|
const actionMenuOpen2 = actionMenuOpenRef.current;
|
|
28903
28569
|
if (shouldHandleHistoryKey(event, actionMenuOpen2) && event.key === "ArrowUp" && (state3.input.trim().length === 0 || state3.isNavigatingHistory)) {
|
|
28904
|
-
const previousEntry = state3.navigateUp(
|
|
28570
|
+
const previousEntry = state3.navigateUp(editorRef.current?.getJSON());
|
|
28905
28571
|
if (!previousEntry) {
|
|
28906
28572
|
return false;
|
|
28907
28573
|
}
|
|
28908
28574
|
event.preventDefault();
|
|
28909
|
-
|
|
28575
|
+
editorRef.current?.commands.setContent(retainTopicAssetMentions(previousEntry.document, state3.topicId));
|
|
28576
|
+
editorRef.current?.commands.focus("end");
|
|
28910
28577
|
return true;
|
|
28911
28578
|
}
|
|
28912
28579
|
if (shouldHandleHistoryKey(event, actionMenuOpen2) && event.key === "ArrowDown") {
|
|
@@ -28915,7 +28582,8 @@ function ChatInput({
|
|
|
28915
28582
|
return false;
|
|
28916
28583
|
}
|
|
28917
28584
|
event.preventDefault();
|
|
28918
|
-
|
|
28585
|
+
editorRef.current?.commands.setContent(retainTopicAssetMentions(nextEntry.document, state3.topicId));
|
|
28586
|
+
editorRef.current?.commands.focus("end");
|
|
28919
28587
|
return true;
|
|
28920
28588
|
}
|
|
28921
28589
|
if (state3.onDoubleEscape && event.key === "Escape" && !isImeCompositionKey(event) && !event.repeat) {
|
|
@@ -28935,7 +28603,7 @@ function ChatInput({
|
|
|
28935
28603
|
if (state3.connectionStatus !== "connected") {
|
|
28936
28604
|
return true;
|
|
28937
28605
|
}
|
|
28938
|
-
void state3.handleSubmit();
|
|
28606
|
+
void state3.handleSubmit(isQueueShortcut(event));
|
|
28939
28607
|
return true;
|
|
28940
28608
|
}
|
|
28941
28609
|
return false;
|
|
@@ -28952,13 +28620,13 @@ function ChatInput({
|
|
|
28952
28620
|
}
|
|
28953
28621
|
});
|
|
28954
28622
|
useDismissSkillSuggestionsOnModeChange(editor);
|
|
28955
|
-
|
|
28623
|
+
useEffect8(() => {
|
|
28956
28624
|
const dom = editor?.view.dom;
|
|
28957
28625
|
if (!dom) return;
|
|
28958
28626
|
dom.setAttribute("aria-label", resolvedInputLabel);
|
|
28959
28627
|
dom.setAttribute("data-blade-input-label", resolvedInputLabel);
|
|
28960
28628
|
}, [editor, resolvedInputLabel]);
|
|
28961
|
-
|
|
28629
|
+
useEffect8(() => {
|
|
28962
28630
|
if (!editor || !activeSessionId || rewindDraft == null) {
|
|
28963
28631
|
return;
|
|
28964
28632
|
}
|
|
@@ -28969,9 +28637,9 @@ function ChatInput({
|
|
|
28969
28637
|
editor.commands.focus("end");
|
|
28970
28638
|
composerChannels.setRewindDraft(activeSessionId, null);
|
|
28971
28639
|
}, [activeSessionId, editor, rewindDraft]);
|
|
28972
|
-
const submittingRef =
|
|
28640
|
+
const submittingRef = useRef7(false);
|
|
28973
28641
|
const [isSubmitting, setIsSubmitting] = useState11(false);
|
|
28974
|
-
|
|
28642
|
+
useEffect8(() => {
|
|
28975
28643
|
let changed = false;
|
|
28976
28644
|
const nextLocalIds = /* @__PURE__ */ new Set();
|
|
28977
28645
|
for (const attachment of composerAttachments) {
|
|
@@ -28996,7 +28664,7 @@ function ChatInput({
|
|
|
28996
28664
|
setLocalImageUrls(Object.fromEntries(localImageUrlsRef.current));
|
|
28997
28665
|
}
|
|
28998
28666
|
}, [composerAttachments]);
|
|
28999
|
-
|
|
28667
|
+
useEffect8(() => {
|
|
29000
28668
|
return () => {
|
|
29001
28669
|
for (const url of localImageUrlsRef.current.values()) {
|
|
29002
28670
|
URL.revokeObjectURL(url);
|
|
@@ -29005,7 +28673,23 @@ function ChatInput({
|
|
|
29005
28673
|
};
|
|
29006
28674
|
}, []);
|
|
29007
28675
|
const sessionHandle = useSessionHandle(activeSessionId);
|
|
29008
|
-
|
|
28676
|
+
const restoredPluginSelection = useRef7(null);
|
|
28677
|
+
useEffect8(() => {
|
|
28678
|
+
if (!sessionHandle || !activeSessionId || !editor) return;
|
|
28679
|
+
const restore = () => {
|
|
28680
|
+
if (restoredPluginSelection.current === activeSessionId) return;
|
|
28681
|
+
const turns = sessionHandle.getState().turns;
|
|
28682
|
+
const latest = [...turns].reverse().find((turn) => turn.role === "user");
|
|
28683
|
+
if (!latest || latest.turn_id.startsWith("local-user-")) return;
|
|
28684
|
+
restoredPluginSelection.current = activeSessionId;
|
|
28685
|
+
if (!getEditorText(editor).trim() && latest.refs?.length) {
|
|
28686
|
+
editor.commands.setContent(buildPluginSelectionDocument(latest.refs));
|
|
28687
|
+
}
|
|
28688
|
+
};
|
|
28689
|
+
restore();
|
|
28690
|
+
return sessionHandle.subscribe(restore);
|
|
28691
|
+
}, [sessionHandle, activeSessionId, editor]);
|
|
28692
|
+
useEffect8(() => {
|
|
29009
28693
|
if (!sessionHandle || !activeSessionId) return;
|
|
29010
28694
|
const offInsert = sessionHandle.on("insertTextRequested", ({ text }) => {
|
|
29011
28695
|
const separate = /^\n/.test(text);
|
|
@@ -29040,7 +28724,7 @@ ${append2.text}` : append2.text;
|
|
|
29040
28724
|
editor.chain().focus("end").insertContent(text).run();
|
|
29041
28725
|
});
|
|
29042
28726
|
const editorReady = editor != null;
|
|
29043
|
-
|
|
28727
|
+
useEffect8(() => {
|
|
29044
28728
|
if (!editorReady || !draftAppends?.length) {
|
|
29045
28729
|
return;
|
|
29046
28730
|
}
|
|
@@ -29056,7 +28740,7 @@ ${append2.text}` : append2.text;
|
|
|
29056
28740
|
}
|
|
29057
28741
|
void stableHandleSubmit();
|
|
29058
28742
|
});
|
|
29059
|
-
|
|
28743
|
+
useEffect8(() => {
|
|
29060
28744
|
if (!sendRequests?.length) {
|
|
29061
28745
|
return;
|
|
29062
28746
|
}
|
|
@@ -29071,10 +28755,10 @@ ${append2.text}` : append2.text;
|
|
|
29071
28755
|
});
|
|
29072
28756
|
const { isRecording, level: voiceLevel } = voice;
|
|
29073
28757
|
const isVoiceStarting = voice.status === "starting";
|
|
29074
|
-
const voiceStopRef =
|
|
28758
|
+
const voiceStopRef = useRef7(voice.stop);
|
|
29075
28759
|
voiceStopRef.current = voice.stop;
|
|
29076
|
-
const prevSessionIdRef =
|
|
29077
|
-
|
|
28760
|
+
const prevSessionIdRef = useRef7(activeSessionId);
|
|
28761
|
+
useEffect8(() => {
|
|
29078
28762
|
if (prevSessionIdRef.current !== activeSessionId) {
|
|
29079
28763
|
prevSessionIdRef.current = activeSessionId;
|
|
29080
28764
|
if (isRecording) {
|
|
@@ -29082,12 +28766,16 @@ ${append2.text}` : append2.text;
|
|
|
29082
28766
|
}
|
|
29083
28767
|
}
|
|
29084
28768
|
}, [activeSessionId, isRecording]);
|
|
29085
|
-
const
|
|
28769
|
+
const hasRunningSendBlockers = () => {
|
|
28770
|
+
const json = editor?.getJSON();
|
|
28771
|
+
return composerAttachments.length > 0 || collectMessageMentions(json).length > 0 || collectTopicAssetMentions(json).length > 0;
|
|
28772
|
+
};
|
|
28773
|
+
const handleSubmit = async (queueWhenRunning = false) => {
|
|
29086
28774
|
if (connectionStatus !== "connected") {
|
|
29087
28775
|
return;
|
|
29088
28776
|
}
|
|
29089
28777
|
if (isCompacting) {
|
|
29090
|
-
notifyChat(environment, "info", "\u5BF9\u8BDD\u6B63\u5728\u6574\u7406\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u518D\u53D1\u9001");
|
|
28778
|
+
notifyChat(environment, "info", developer ? "\u5BF9\u8BDD\u6B63\u5728\u6574\u7406\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u518D\u53D1\u9001" : "\u6B63\u5728\u5904\u7406\uFF0C\u8BF7\u7A0D\u540E\u518D\u53D1\u9001");
|
|
29091
28779
|
return;
|
|
29092
28780
|
}
|
|
29093
28781
|
if (isStopping) {
|
|
@@ -29097,12 +28785,9 @@ ${append2.text}` : append2.text;
|
|
|
29097
28785
|
notifyChat(environment, "info", "\u5F53\u524D\u56DE\u590D\u5C1A\u672A\u7ED3\u675F\uFF0C\u8BF7\u7B49\u5F85\u672C\u8F6E\u7ED3\u675F\u540E\u518D\u53D1\u9001");
|
|
29098
28786
|
return;
|
|
29099
28787
|
}
|
|
29100
|
-
if (isStreaming) {
|
|
29101
|
-
|
|
29102
|
-
|
|
29103
|
-
notifyChat(environment, "info", "\u5F53\u524D\u56DE\u590D\u5C1A\u672A\u7ED3\u675F\uFF0C\u5E26\u9644\u4EF6\u6216\u5F15\u7528\u7684\u6D88\u606F\u8BF7\u7B49\u5F85\u672C\u8F6E\u7ED3\u675F\u540E\u518D\u53D1\u9001");
|
|
29104
|
-
return;
|
|
29105
|
-
}
|
|
28788
|
+
if (isStreaming && hasRunningSendBlockers()) {
|
|
28789
|
+
notifyChat(environment, "info", "\u5F53\u524D\u56DE\u590D\u5C1A\u672A\u7ED3\u675F\uFF0C\u5E26\u9644\u4EF6\u6216\u5F15\u7528\u7684\u6D88\u606F\u8BF7\u7B49\u5F85\u672C\u8F6E\u7ED3\u675F\u540E\u518D\u53D1\u9001");
|
|
28790
|
+
return;
|
|
29106
28791
|
}
|
|
29107
28792
|
if (!isStreaming) {
|
|
29108
28793
|
const modelGate = gateSendWhileModelLoading(isModelLoading, hasComposerContent);
|
|
@@ -29131,18 +28816,17 @@ ${append2.text}` : append2.text;
|
|
|
29131
28816
|
const rawText = serializeEditorContent(json);
|
|
29132
28817
|
let submittedSessionId = activeSessionId;
|
|
29133
28818
|
const submittedAttachmentIds = composerAttachments.map((attachment) => attachment.id);
|
|
29134
|
-
const
|
|
29135
|
-
|
|
29136
|
-
|
|
28819
|
+
const refs = collectMessageMentions(json);
|
|
28820
|
+
if (refs.length > 20) {
|
|
28821
|
+
notifyChat(environment, "error", "\u6BCF\u6761\u6D88\u606F\u6700\u591A\u9009\u62E9 20 \u4E2A\u5F15\u7528");
|
|
28822
|
+
return;
|
|
28823
|
+
}
|
|
29137
28824
|
const topicAssetRefs = collectTopicAssetMentions(json);
|
|
29138
28825
|
if (topicAssetRefs.length > 20) {
|
|
29139
|
-
notifyChat(environment, "error", "\u6BCF\u6761\u6D88\u606F\u6700\u591A\u5F15\u7528 20 \u4E2A\
|
|
28826
|
+
notifyChat(environment, "error", "\u6BCF\u6761\u6D88\u606F\u6700\u591A\u5F15\u7528 20 \u4E2A\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7");
|
|
29140
28827
|
return;
|
|
29141
28828
|
}
|
|
29142
|
-
const text =
|
|
29143
|
-
local: skill.local,
|
|
29144
|
-
installed: skill.installed
|
|
29145
|
-
}) : rawText;
|
|
28829
|
+
const text = rawText;
|
|
29146
28830
|
const pendingFiles = composerAttachments.filter(
|
|
29147
28831
|
(a) => a.kind === "file" && a.status === "pending" && !!a.file
|
|
29148
28832
|
);
|
|
@@ -29274,11 +28958,11 @@ ${append2.text}` : append2.text;
|
|
|
29274
28958
|
try {
|
|
29275
28959
|
accepted = await onSend(nextPayload, {
|
|
29276
28960
|
targetSessionId: uploadTargetSessionId,
|
|
28961
|
+
queueWhenRunning,
|
|
29277
28962
|
model: submitModels.sendModel,
|
|
29278
28963
|
thinkingOverride: thinkingAvailable && selectedReasoningLevel ? true : void 0,
|
|
29279
28964
|
reasoningLevel: thinkingAvailable ? selectedReasoningLevel || void 0 : void 0,
|
|
29280
|
-
|
|
29281
|
-
kbIds: kbIds.length > 0 ? kbIds : void 0,
|
|
28965
|
+
refs: pluginRefsForSend(refs, sessionHandle?.getState().turns),
|
|
29282
28966
|
topicAssetRefs: topicAssetRefs.length > 0 ? topicAssetRefs : void 0
|
|
29283
28967
|
});
|
|
29284
28968
|
} catch (error) {
|
|
@@ -29294,18 +28978,21 @@ ${append2.text}` : append2.text;
|
|
|
29294
28978
|
}
|
|
29295
28979
|
return;
|
|
29296
28980
|
}
|
|
28981
|
+
if (refs.length && editor && !getEditorText(editor).trim()) {
|
|
28982
|
+
editor.commands.setContent(buildPluginSelectionDocument(refs));
|
|
28983
|
+
}
|
|
29297
28984
|
if (activeSessionId && activePendingContexts.length > 0) {
|
|
29298
28985
|
composerChannels.consumePendingContexts(activeSessionId);
|
|
29299
28986
|
}
|
|
29300
28987
|
if (text.trim()) {
|
|
29301
|
-
inputHistory.addEntry(
|
|
28988
|
+
inputHistory.addEntry(json);
|
|
29302
28989
|
}
|
|
29303
28990
|
} finally {
|
|
29304
28991
|
submittingRef.current = false;
|
|
29305
28992
|
setIsSubmitting(false);
|
|
29306
28993
|
}
|
|
29307
28994
|
};
|
|
29308
|
-
|
|
28995
|
+
useEffect8(() => {
|
|
29309
28996
|
if (!editor || !activeSessionId || !queuedTopicRefs?.length) return;
|
|
29310
28997
|
const existing = collectTopicAssetMentions(editor.getJSON());
|
|
29311
28998
|
const refs = composerChannels.consumeTopicAssetReferences(activeSessionId).filter((ref) => !existing.some((item) => item.topic_id === ref.topic_id && item.path === ref.path));
|
|
@@ -29325,9 +29012,9 @@ ${append2.text}` : append2.text;
|
|
|
29325
29012
|
const reduceMotion = typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
29326
29013
|
return reduceMotion ? fullPlaceholder : "";
|
|
29327
29014
|
});
|
|
29328
|
-
const typewriterPlayedRef =
|
|
29329
|
-
const isTypingRef =
|
|
29330
|
-
|
|
29015
|
+
const typewriterPlayedRef = useRef7(false);
|
|
29016
|
+
const isTypingRef = useRef7(false);
|
|
29017
|
+
useEffect8(() => {
|
|
29331
29018
|
if (!typewriterPlaceholder || typewriterPlayedRef.current) return;
|
|
29332
29019
|
typewriterPlayedRef.current = true;
|
|
29333
29020
|
const reduceMotion = typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -29348,7 +29035,7 @@ ${append2.text}` : append2.text;
|
|
|
29348
29035
|
isTypingRef.current = false;
|
|
29349
29036
|
};
|
|
29350
29037
|
}, [typewriterPlaceholder]);
|
|
29351
|
-
|
|
29038
|
+
useEffect8(() => {
|
|
29352
29039
|
if (isTypingRef.current) return;
|
|
29353
29040
|
setTypedPlaceholder(fullPlaceholder);
|
|
29354
29041
|
}, [fullPlaceholder]);
|
|
@@ -29356,7 +29043,7 @@ ${append2.text}` : append2.text;
|
|
|
29356
29043
|
const attachments = renderAttachments?.() ?? null;
|
|
29357
29044
|
const hasRenderedAttachments = attachments !== null;
|
|
29358
29045
|
const hasPendingContexts = (pendingContexts?.length ?? 0) > 0;
|
|
29359
|
-
const isSkillEditor = currentSession?.solution_id === "skill_editor"
|
|
29046
|
+
const isSkillEditor = currentSession?.solution_id === "skill_editor";
|
|
29360
29047
|
const imageAttachments = composerAttachments.filter(isImageAttachment);
|
|
29361
29048
|
const fileAttachments = composerAttachments.filter(
|
|
29362
29049
|
(attachment) => !isImageAttachment(attachment)
|
|
@@ -29368,11 +29055,12 @@ ${append2.text}` : append2.text;
|
|
|
29368
29055
|
const submitWhileRunning = isStreaming && !isStopping && queueWhileRunning;
|
|
29369
29056
|
const hasComposerContent = Boolean(input.trim()) || hasValidAttachments || hasRenderedAttachments || hasPendingContexts;
|
|
29370
29057
|
const isSendDisabled = connectionStatus !== "connected" || isCompacting || !submitWhileRunning && isModelLoading || !submitWhileRunning && !hasAvailableModel || isSubmitting || hasUploadingFiles || !input.trim() && !hasValidAttachments && !hasRenderedAttachments && !hasPendingContexts;
|
|
29371
|
-
|
|
29372
|
-
|
|
29373
|
-
|
|
29374
|
-
|
|
29375
|
-
/* @__PURE__ */
|
|
29058
|
+
const showQueueShortcut = Boolean(input.trim()) && !isSendDisabled && !isStopping && !isRecording && (!isStreaming || queueWhileRunning && !hasRunningSendBlockers());
|
|
29059
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
29060
|
+
/* @__PURE__ */ jsx24("div", { className: `px-5 pb-3 pt-0 ${className ?? ""}`, children: /* @__PURE__ */ jsxs13("div", { className: `mx-auto ${maxWidthClassName} ${innerClassName ?? ""}`, children: [
|
|
29061
|
+
statusBarAddon ? /* @__PURE__ */ jsx24("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: statusBarAddon }) : null,
|
|
29062
|
+
!isModelLoading && !hasAvailableModel ? /* @__PURE__ */ jsx24("div", { className: "mb-2 rounded-lg border border-[hsl(var(--destructive))]/30 bg-[hsl(var(--destructive))]/8 px-3 py-2 text-xs text-[hsl(var(--destructive))]", children: modelAvailabilityMessage }) : null,
|
|
29063
|
+
/* @__PURE__ */ jsx24(
|
|
29376
29064
|
"div",
|
|
29377
29065
|
{
|
|
29378
29066
|
className: "relative",
|
|
@@ -29406,22 +29094,20 @@ ${append2.text}` : append2.text;
|
|
|
29406
29094
|
if (files.length > 0) void stableAppendFiles(files);
|
|
29407
29095
|
});
|
|
29408
29096
|
},
|
|
29409
|
-
children: /* @__PURE__ */
|
|
29097
|
+
children: /* @__PURE__ */ jsxs13(
|
|
29410
29098
|
"div",
|
|
29411
29099
|
{
|
|
29412
|
-
className: `overflow-visible border bg-[hsl(var(--card))] transition-[box-shadow,border-color] duration-300 ${
|
|
29413
|
-
// 22px 圆弧的话,这两段弧会从面板两侧露出来,就是截图里的尖角。
|
|
29414
|
-
mergesWithPanelAbove ? "rounded-b-[22px]" : "rounded-[22px]"} ${isRecording ? "border-[hsl(var(--swf-success))]!" : isPlanning ? dragging || isEditorFocused ? "border-[hsl(var(--swf-warning)/0.6)]" : "border-[hsl(var(--swf-warning)/0.3)]" : dragging || isEditorFocused ? "border-[hsl(213_94%_60%/0.55)] shadow-[0_0_0_3px_hsl(213_94%_60%/0.16),0_8px_24px_-6px_hsl(213_94%_60%/0.3)]" : "border-[hsl(213_94%_60%/0.28)] shadow-[0_0_0_2px_hsl(213_94%_60%/0.08),0_4px_14px_-6px_hsl(213_94%_60%/0.16)]"}`,
|
|
29100
|
+
className: `overflow-visible border bg-[hsl(var(--card))] transition-[box-shadow,border-color] duration-300 ${mergesWithPanelAbove ? "rounded-b-[22px]" : "rounded-[22px]"} ${isRecording ? "border-[hsl(var(--swf-success))]!" : isPlanning ? dragging || isEditorFocused ? "border-[hsl(var(--swf-warning)/0.6)]" : "border-[hsl(var(--swf-warning)/0.3)]" : dragging || isEditorFocused ? "border-[hsl(213_94%_60%/0.55)] shadow-[0_0_0_3px_hsl(213_94%_60%/0.16),0_8px_24px_-6px_hsl(213_94%_60%/0.3)]" : "border-[hsl(213_94%_60%/0.28)] shadow-[0_0_0_2px_hsl(213_94%_60%/0.08),0_4px_14px_-6px_hsl(213_94%_60%/0.16)]"}`,
|
|
29415
29101
|
children: [
|
|
29416
|
-
dragging && /* @__PURE__ */
|
|
29102
|
+
dragging && /* @__PURE__ */ jsx24("div", { className: `pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-[hsl(var(--primary)/0.06)] ${mergesWithPanelAbove ? "rounded-b-[22px]" : "rounded-2xl"}`, children: /* @__PURE__ */ jsx24("span", { className: "rounded-full bg-[hsl(var(--primary)/0.12)] px-4 py-2 text-sm font-medium text-[hsl(var(--primary))]", children: "\u677E\u624B\u5F15\u7528\u6587\u4EF6" }) }),
|
|
29417
29103
|
planPanel,
|
|
29418
|
-
composerAttachments.length > 0 && /* @__PURE__ */
|
|
29419
|
-
imageAttachments.length > 0 && /* @__PURE__ */
|
|
29104
|
+
composerAttachments.length > 0 && /* @__PURE__ */ jsxs13(ComposerAttachmentViewport, { className: "flex flex-col gap-2 border-b border-[hsl(var(--border))] px-4 py-2", children: [
|
|
29105
|
+
imageAttachments.length > 0 && /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-3 gap-2", children: imageAttachments.map((attachment) => /* @__PURE__ */ jsxs13(
|
|
29420
29106
|
"div",
|
|
29421
29107
|
{
|
|
29422
29108
|
className: "relative overflow-hidden rounded-xl border border-[hsl(var(--border))]",
|
|
29423
29109
|
children: [
|
|
29424
|
-
/* @__PURE__ */
|
|
29110
|
+
/* @__PURE__ */ jsx24(
|
|
29425
29111
|
"img",
|
|
29426
29112
|
{
|
|
29427
29113
|
src: getImagePreviewUrl(client, attachment, activeSessionId, localImageUrls),
|
|
@@ -29429,7 +29115,7 @@ ${append2.text}` : append2.text;
|
|
|
29429
29115
|
className: "h-24 w-full object-cover"
|
|
29430
29116
|
}
|
|
29431
29117
|
),
|
|
29432
|
-
/* @__PURE__ */
|
|
29118
|
+
/* @__PURE__ */ jsx24(
|
|
29433
29119
|
"button",
|
|
29434
29120
|
{
|
|
29435
29121
|
type: "button",
|
|
@@ -29437,14 +29123,14 @@ ${append2.text}` : append2.text;
|
|
|
29437
29123
|
"aria-label": `\u79FB\u9664 ${attachment.name || "\u56FE\u7247"}`,
|
|
29438
29124
|
title: "\u79FB\u9664",
|
|
29439
29125
|
className: "absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-full bg-[hsl(var(--background)/0.85)] text-[hsl(var(--foreground))]",
|
|
29440
|
-
children: /* @__PURE__ */
|
|
29126
|
+
children: /* @__PURE__ */ jsx24(X, { size: 12 })
|
|
29441
29127
|
}
|
|
29442
29128
|
)
|
|
29443
29129
|
]
|
|
29444
29130
|
},
|
|
29445
29131
|
attachment.id
|
|
29446
29132
|
)) }),
|
|
29447
|
-
fileAttachments.length > 0 && /* @__PURE__ */
|
|
29133
|
+
fileAttachments.length > 0 && /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-1.5", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx24(
|
|
29448
29134
|
ComposerFilePill,
|
|
29449
29135
|
{
|
|
29450
29136
|
attachment,
|
|
@@ -29453,8 +29139,8 @@ ${append2.text}` : append2.text;
|
|
|
29453
29139
|
attachment.id
|
|
29454
29140
|
)) })
|
|
29455
29141
|
] }),
|
|
29456
|
-
hasPendingContexts || isSkillEditor ? /* @__PURE__ */
|
|
29457
|
-
pendingContexts?.map((context) => /* @__PURE__ */
|
|
29142
|
+
hasPendingContexts || isSkillEditor ? /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1.5 border-b border-[hsl(var(--border))] px-4 py-2", children: [
|
|
29143
|
+
pendingContexts?.map((context) => /* @__PURE__ */ jsx24(
|
|
29458
29144
|
ComposerContextPill,
|
|
29459
29145
|
{
|
|
29460
29146
|
id: context.id,
|
|
@@ -29470,18 +29156,18 @@ ${append2.text}` : append2.text;
|
|
|
29470
29156
|
},
|
|
29471
29157
|
context.id
|
|
29472
29158
|
)),
|
|
29473
|
-
isSkillEditor && /* @__PURE__ */
|
|
29159
|
+
isSkillEditor && /* @__PURE__ */ jsx24(
|
|
29474
29160
|
"button",
|
|
29475
29161
|
{
|
|
29476
29162
|
type: "button",
|
|
29477
29163
|
onClick: () => setShowAddContext(true),
|
|
29478
29164
|
title: "\u6DFB\u52A0\u4E0A\u4E0B\u6587",
|
|
29479
29165
|
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-dashed border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))]",
|
|
29480
|
-
children: /* @__PURE__ */
|
|
29166
|
+
children: /* @__PURE__ */ jsx24(Plus, { size: 12 })
|
|
29481
29167
|
}
|
|
29482
29168
|
)
|
|
29483
29169
|
] }) : null,
|
|
29484
|
-
showAddContext && activeSessionId && /* @__PURE__ */
|
|
29170
|
+
showAddContext && activeSessionId && /* @__PURE__ */ jsx24(
|
|
29485
29171
|
AddContextDialog,
|
|
29486
29172
|
{
|
|
29487
29173
|
sessionId: activeSessionId,
|
|
@@ -29493,15 +29179,15 @@ ${append2.text}` : append2.text;
|
|
|
29493
29179
|
}
|
|
29494
29180
|
}
|
|
29495
29181
|
),
|
|
29496
|
-
attachments ? /* @__PURE__ */
|
|
29497
|
-
slotAboveTextarea ? /* @__PURE__ */
|
|
29498
|
-
/* @__PURE__ */
|
|
29499
|
-
input.length === 0 && /* @__PURE__ */
|
|
29500
|
-
/* @__PURE__ */
|
|
29182
|
+
attachments ? /* @__PURE__ */ jsx24("div", { className: "border-b border-[hsl(var(--border))] px-4 py-3", children: attachments }) : null,
|
|
29183
|
+
slotAboveTextarea ? /* @__PURE__ */ jsx24("div", { className: "border-b border-[hsl(var(--border))] px-4 py-2", children: slotAboveTextarea }) : null,
|
|
29184
|
+
/* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
29185
|
+
input.length === 0 && /* @__PURE__ */ jsx24("div", { className: "pointer-events-none absolute left-5 top-3 text-sm leading-relaxed text-[hsl(var(--muted-foreground)/0.6)]", children: placeholder }),
|
|
29186
|
+
/* @__PURE__ */ jsx24(EditorContent, { editor })
|
|
29501
29187
|
] }),
|
|
29502
|
-
/* @__PURE__ */
|
|
29503
|
-
/* @__PURE__ */
|
|
29504
|
-
/* @__PURE__ */
|
|
29188
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between px-4 pb-3 pt-1", children: [
|
|
29189
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
29190
|
+
/* @__PURE__ */ jsx24(
|
|
29505
29191
|
"input",
|
|
29506
29192
|
{
|
|
29507
29193
|
ref: fileInputRef,
|
|
@@ -29517,7 +29203,7 @@ ${append2.text}` : append2.text;
|
|
|
29517
29203
|
className: "hidden"
|
|
29518
29204
|
}
|
|
29519
29205
|
),
|
|
29520
|
-
/* @__PURE__ */
|
|
29206
|
+
/* @__PURE__ */ jsx24(
|
|
29521
29207
|
"input",
|
|
29522
29208
|
{
|
|
29523
29209
|
ref: folderInputRef,
|
|
@@ -29533,7 +29219,7 @@ ${append2.text}` : append2.text;
|
|
|
29533
29219
|
...{ webkitdirectory: "" }
|
|
29534
29220
|
}
|
|
29535
29221
|
),
|
|
29536
|
-
/* @__PURE__ */
|
|
29222
|
+
/* @__PURE__ */ jsxs13(
|
|
29537
29223
|
dist_exports.Root,
|
|
29538
29224
|
{
|
|
29539
29225
|
open: actionMenuOpen,
|
|
@@ -29542,17 +29228,17 @@ ${append2.text}` : append2.text;
|
|
|
29542
29228
|
if (open) setConnectMenuOpen(false);
|
|
29543
29229
|
},
|
|
29544
29230
|
children: [
|
|
29545
|
-
/* @__PURE__ */
|
|
29231
|
+
/* @__PURE__ */ jsx24(dist_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
29546
29232
|
"button",
|
|
29547
29233
|
{
|
|
29548
29234
|
type: "button",
|
|
29549
29235
|
"aria-label": "\u6DFB\u52A0\u5185\u5BB9",
|
|
29550
29236
|
title: "\u6DFB\u52A0\u5185\u5BB9",
|
|
29551
29237
|
className: "flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center rounded-full border border-[hsl(var(--border))] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring))] hover:text-[hsl(var(--foreground))]",
|
|
29552
|
-
children: /* @__PURE__ */
|
|
29238
|
+
children: /* @__PURE__ */ jsx24(Plus, { size: 14 })
|
|
29553
29239
|
}
|
|
29554
29240
|
) }),
|
|
29555
|
-
/* @__PURE__ */
|
|
29241
|
+
/* @__PURE__ */ jsx24(dist_exports.Portal, { children: /* @__PURE__ */ jsxs13(
|
|
29556
29242
|
dist_exports.Content,
|
|
29557
29243
|
{
|
|
29558
29244
|
side: "top",
|
|
@@ -29560,7 +29246,7 @@ ${append2.text}` : append2.text;
|
|
|
29560
29246
|
sideOffset: 8,
|
|
29561
29247
|
className: "z-30 w-[min(380px,calc(100vw-2rem))] origin-(--radix-popover-content-transform-origin) overflow-visible rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] py-1 text-[11px] text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)] outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
29562
29248
|
children: [
|
|
29563
|
-
/* @__PURE__ */
|
|
29249
|
+
/* @__PURE__ */ jsxs13(
|
|
29564
29250
|
"button",
|
|
29565
29251
|
{
|
|
29566
29252
|
type: "button",
|
|
@@ -29570,12 +29256,12 @@ ${append2.text}` : append2.text;
|
|
|
29570
29256
|
},
|
|
29571
29257
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29572
29258
|
children: [
|
|
29573
|
-
/* @__PURE__ */
|
|
29259
|
+
/* @__PURE__ */ jsx24(Paperclip, { size: 14 }),
|
|
29574
29260
|
"\u4E0A\u4F20\u6587\u4EF6"
|
|
29575
29261
|
]
|
|
29576
29262
|
}
|
|
29577
29263
|
),
|
|
29578
|
-
/* @__PURE__ */
|
|
29264
|
+
/* @__PURE__ */ jsxs13(
|
|
29579
29265
|
"button",
|
|
29580
29266
|
{
|
|
29581
29267
|
type: "button",
|
|
@@ -29585,12 +29271,12 @@ ${append2.text}` : append2.text;
|
|
|
29585
29271
|
},
|
|
29586
29272
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29587
29273
|
children: [
|
|
29588
|
-
/* @__PURE__ */
|
|
29274
|
+
/* @__PURE__ */ jsx24(FolderUp, { size: 14 }),
|
|
29589
29275
|
"\u4E0A\u4F20\u6587\u4EF6\u5939"
|
|
29590
29276
|
]
|
|
29591
29277
|
}
|
|
29592
29278
|
),
|
|
29593
|
-
onCommand && canCreateBoardTask && !lite ? /* @__PURE__ */
|
|
29279
|
+
onCommand && canCreateBoardTask && !lite ? /* @__PURE__ */ jsxs13(
|
|
29594
29280
|
"button",
|
|
29595
29281
|
{
|
|
29596
29282
|
type: "button",
|
|
@@ -29600,12 +29286,12 @@ ${append2.text}` : append2.text;
|
|
|
29600
29286
|
},
|
|
29601
29287
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29602
29288
|
children: [
|
|
29603
|
-
/* @__PURE__ */
|
|
29289
|
+
/* @__PURE__ */ jsx24(ListPlus, { size: 14 }),
|
|
29604
29290
|
"\u521B\u5EFA\u540E\u53F0\u4EFB\u52A1"
|
|
29605
29291
|
]
|
|
29606
29292
|
}
|
|
29607
29293
|
) : null,
|
|
29608
|
-
onDoubleEscape ? /* @__PURE__ */
|
|
29294
|
+
onDoubleEscape ? /* @__PURE__ */ jsxs13(
|
|
29609
29295
|
"button",
|
|
29610
29296
|
{
|
|
29611
29297
|
type: "button",
|
|
@@ -29617,13 +29303,13 @@ ${append2.text}` : append2.text;
|
|
|
29617
29303
|
},
|
|
29618
29304
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29619
29305
|
children: [
|
|
29620
|
-
/* @__PURE__ */
|
|
29306
|
+
/* @__PURE__ */ jsx24(RotateCcw, { size: 14 }),
|
|
29621
29307
|
"\u56DE\u5230\u4E4B\u524D\u7684\u67D0\u4E00\u6B65"
|
|
29622
29308
|
]
|
|
29623
29309
|
}
|
|
29624
29310
|
) : null,
|
|
29625
|
-
onCommand && !lite ? /* @__PURE__ */
|
|
29626
|
-
/* @__PURE__ */
|
|
29311
|
+
onCommand && !lite ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
29312
|
+
developer ? /* @__PURE__ */ jsxs13(
|
|
29627
29313
|
"button",
|
|
29628
29314
|
{
|
|
29629
29315
|
type: "button",
|
|
@@ -29634,12 +29320,12 @@ ${append2.text}` : append2.text;
|
|
|
29634
29320
|
disabled: isBusy,
|
|
29635
29321
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))] disabled:cursor-not-allowed disabled:opacity-50",
|
|
29636
29322
|
children: [
|
|
29637
|
-
isCompacting ? /* @__PURE__ */
|
|
29323
|
+
isCompacting ? /* @__PURE__ */ jsx24(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx24(Scissors, { size: 14 }),
|
|
29638
29324
|
"\u6574\u7406\u5BF9\u8BDD"
|
|
29639
29325
|
]
|
|
29640
29326
|
}
|
|
29641
|
-
),
|
|
29642
|
-
/* @__PURE__ */
|
|
29327
|
+
) : null,
|
|
29328
|
+
/* @__PURE__ */ jsxs13(
|
|
29643
29329
|
"button",
|
|
29644
29330
|
{
|
|
29645
29331
|
type: "button",
|
|
@@ -29649,12 +29335,12 @@ ${append2.text}` : append2.text;
|
|
|
29649
29335
|
},
|
|
29650
29336
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29651
29337
|
children: [
|
|
29652
|
-
/* @__PURE__ */
|
|
29338
|
+
/* @__PURE__ */ jsx24(Download, { size: 14 }),
|
|
29653
29339
|
"\u5BFC\u51FA\u4F1A\u8BDD"
|
|
29654
29340
|
]
|
|
29655
29341
|
}
|
|
29656
29342
|
),
|
|
29657
|
-
/* @__PURE__ */
|
|
29343
|
+
/* @__PURE__ */ jsxs13(
|
|
29658
29344
|
"button",
|
|
29659
29345
|
{
|
|
29660
29346
|
type: "button",
|
|
@@ -29664,12 +29350,12 @@ ${append2.text}` : append2.text;
|
|
|
29664
29350
|
},
|
|
29665
29351
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29666
29352
|
children: [
|
|
29667
|
-
/* @__PURE__ */
|
|
29353
|
+
/* @__PURE__ */ jsx24(Play, { size: 14 }),
|
|
29668
29354
|
"\u56DE\u653E\u8FD9\u4E2A\u5BF9\u8BDD"
|
|
29669
29355
|
]
|
|
29670
29356
|
}
|
|
29671
29357
|
),
|
|
29672
|
-
canShareSession ? /* @__PURE__ */
|
|
29358
|
+
canShareSession ? /* @__PURE__ */ jsxs13(
|
|
29673
29359
|
"button",
|
|
29674
29360
|
{
|
|
29675
29361
|
type: "button",
|
|
@@ -29679,12 +29365,12 @@ ${append2.text}` : append2.text;
|
|
|
29679
29365
|
},
|
|
29680
29366
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29681
29367
|
children: [
|
|
29682
|
-
/* @__PURE__ */
|
|
29368
|
+
/* @__PURE__ */ jsx24(Share2, { size: 14 }),
|
|
29683
29369
|
"\u5206\u4EAB\u4F1A\u8BDD"
|
|
29684
29370
|
]
|
|
29685
29371
|
}
|
|
29686
29372
|
) : null,
|
|
29687
|
-
/* @__PURE__ */
|
|
29373
|
+
/* @__PURE__ */ jsxs13(
|
|
29688
29374
|
"button",
|
|
29689
29375
|
{
|
|
29690
29376
|
type: "button",
|
|
@@ -29694,12 +29380,12 @@ ${append2.text}` : append2.text;
|
|
|
29694
29380
|
},
|
|
29695
29381
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29696
29382
|
children: [
|
|
29697
|
-
/* @__PURE__ */
|
|
29383
|
+
/* @__PURE__ */ jsx24(FlaskConical, { size: 14 }),
|
|
29698
29384
|
"\u63D0\u53D6\u6280\u80FD"
|
|
29699
29385
|
]
|
|
29700
29386
|
}
|
|
29701
29387
|
),
|
|
29702
|
-
/* @__PURE__ */
|
|
29388
|
+
/* @__PURE__ */ jsxs13(
|
|
29703
29389
|
"button",
|
|
29704
29390
|
{
|
|
29705
29391
|
type: "button",
|
|
@@ -29709,13 +29395,13 @@ ${append2.text}` : append2.text;
|
|
|
29709
29395
|
},
|
|
29710
29396
|
className: "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--accent))]",
|
|
29711
29397
|
children: [
|
|
29712
|
-
/* @__PURE__ */
|
|
29398
|
+
/* @__PURE__ */ jsx24(Rocket, { size: 14 }),
|
|
29713
29399
|
"\u751F\u6210\u5E94\u7528"
|
|
29714
29400
|
]
|
|
29715
29401
|
}
|
|
29716
29402
|
)
|
|
29717
29403
|
] }) : null,
|
|
29718
|
-
onToggleMode && !lite ? /* @__PURE__ */
|
|
29404
|
+
onToggleMode && !lite ? /* @__PURE__ */ jsx24(
|
|
29719
29405
|
PlanningToggle,
|
|
29720
29406
|
{
|
|
29721
29407
|
enabled: isPlanning,
|
|
@@ -29726,22 +29412,23 @@ ${append2.text}` : append2.text;
|
|
|
29726
29412
|
disabled: isBusy
|
|
29727
29413
|
}
|
|
29728
29414
|
) : null,
|
|
29729
|
-
!lite && thinkingAvailable && reasoningLevels.length > 0 ? /* @__PURE__ */
|
|
29415
|
+
!lite && thinkingAvailable && reasoningLevels.length > 0 ? /* @__PURE__ */ jsx24(
|
|
29730
29416
|
ReasoningModeSelect,
|
|
29731
29417
|
{
|
|
29732
29418
|
level: selectedReasoningLevel,
|
|
29733
29419
|
levels: reasoningLevels,
|
|
29734
29420
|
disabled: isCompacting,
|
|
29735
|
-
disabledReason: "\u5BF9\u8BDD\u6574\u7406\u5B8C\u6210\u540E\u53EF\u8C03\u6574",
|
|
29421
|
+
disabledReason: developer ? "\u5BF9\u8BDD\u6574\u7406\u5B8C\u6210\u540E\u53EF\u8C03\u6574" : "\u5904\u7406\u5B8C\u6210\u540E\u53EF\u8C03\u6574",
|
|
29736
29422
|
onChange: model.setReasoningLevel
|
|
29737
29423
|
}
|
|
29738
29424
|
) : null,
|
|
29739
|
-
!lite ? /* @__PURE__ */
|
|
29740
|
-
/* @__PURE__ */
|
|
29741
|
-
/* @__PURE__ */
|
|
29742
|
-
/* @__PURE__ */
|
|
29425
|
+
!lite ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 px-3 py-2", children: [
|
|
29426
|
+
/* @__PURE__ */ jsx24(Sparkles, { size: 14, className: "shrink-0", "aria-hidden": "true" }),
|
|
29427
|
+
/* @__PURE__ */ jsx24("span", { className: "shrink-0", children: "\u6A21\u578B" }),
|
|
29428
|
+
/* @__PURE__ */ jsx24(
|
|
29743
29429
|
ModelSelector,
|
|
29744
29430
|
{
|
|
29431
|
+
disabled: isModelLoading,
|
|
29745
29432
|
value: selectedModel,
|
|
29746
29433
|
onValueChange: model.selectModel,
|
|
29747
29434
|
compact: true,
|
|
@@ -29749,20 +29436,18 @@ ${append2.text}` : append2.text;
|
|
|
29749
29436
|
}
|
|
29750
29437
|
)
|
|
29751
29438
|
] }) : null,
|
|
29752
|
-
!lite && activeSessionId && actionMenuOpen ? /* @__PURE__ */
|
|
29753
|
-
/* @__PURE__ */
|
|
29439
|
+
!lite && activeSessionId && actionMenuOpen ? /* @__PURE__ */ jsxs13("div", { className: "border-t border-[hsl(var(--border))] px-3 py-2.5", children: [
|
|
29440
|
+
/* @__PURE__ */ jsx24(
|
|
29754
29441
|
SkillStatusBarComponent,
|
|
29755
29442
|
{
|
|
29756
29443
|
sessionId: activeSessionId,
|
|
29757
|
-
onResync: onResyncSkills,
|
|
29758
|
-
isResyncing: isResyncingSkills,
|
|
29759
29444
|
onOpenSkills,
|
|
29760
29445
|
vertical: true,
|
|
29761
29446
|
className: skillStatusBarClassName,
|
|
29762
29447
|
innerClassName: skillStatusBarInnerClassName
|
|
29763
29448
|
}
|
|
29764
29449
|
),
|
|
29765
|
-
composerHint ? /* @__PURE__ */
|
|
29450
|
+
composerHint ? /* @__PURE__ */ jsx24("div", { className: "mt-2 border-t border-[hsl(var(--border))] pt-2 text-[hsl(var(--muted-foreground))]", children: composerHint }) : null
|
|
29766
29451
|
] }) : null
|
|
29767
29452
|
]
|
|
29768
29453
|
}
|
|
@@ -29770,7 +29455,7 @@ ${append2.text}` : append2.text;
|
|
|
29770
29455
|
]
|
|
29771
29456
|
}
|
|
29772
29457
|
),
|
|
29773
|
-
/* @__PURE__ */
|
|
29458
|
+
/* @__PURE__ */ jsx24(
|
|
29774
29459
|
ConnectButton,
|
|
29775
29460
|
{
|
|
29776
29461
|
sessionId: activeSessionId,
|
|
@@ -29783,11 +29468,15 @@ ${append2.text}` : append2.text;
|
|
|
29783
29468
|
}
|
|
29784
29469
|
}
|
|
29785
29470
|
),
|
|
29786
|
-
!lite && activeSessionId ? /* @__PURE__ */
|
|
29471
|
+
!lite && activeSessionId ? /* @__PURE__ */ jsx24(BackgroundTasksPill, { sessionId: activeSessionId }) : null
|
|
29787
29472
|
] }),
|
|
29788
|
-
/* @__PURE__ */
|
|
29473
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-h-10 items-center gap-1.5", children: [
|
|
29474
|
+
showQueueShortcut && /* @__PURE__ */ jsxs13("span", { className: "mr-1 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
29475
|
+
queueShortcutLabel(),
|
|
29476
|
+
" \xB7 \u6392\u961F\u6D88\u606F"
|
|
29477
|
+
] }),
|
|
29789
29478
|
slotBeforeSend,
|
|
29790
|
-
!isStreaming && !isCompacting && asrEnabled && (isRecording || isVoiceStarting || !hasComposerContent) ? /* @__PURE__ */
|
|
29479
|
+
!isStreaming && !isCompacting && asrEnabled && (isRecording || isVoiceStarting || !hasComposerContent) ? /* @__PURE__ */ jsx24(
|
|
29791
29480
|
"button",
|
|
29792
29481
|
{
|
|
29793
29482
|
type: "button",
|
|
@@ -29795,23 +29484,23 @@ ${append2.text}` : append2.text;
|
|
|
29795
29484
|
"aria-label": isRecording || isVoiceStarting ? "\u505C\u6B62\u8BED\u97F3\u8F93\u5165" : "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165",
|
|
29796
29485
|
title: isVoiceStarting ? "\u6B63\u5728\u8FDE\u63A5\u8BED\u97F3\u8F93\u5165\uFF0C\u70B9\u51FB\u53D6\u6D88" : isRecording ? "\u505C\u6B62\u8BED\u97F3\u8F93\u5165" : "\u8BED\u97F3\u8F93\u5165",
|
|
29797
29486
|
className: `flex items-center justify-center rounded-full transition-[width,height,background-color,color,box-shadow] duration-300 disabled:opacity-40 ${isRecording ? "h-10 w-10 bg-[hsl(var(--swf-success-soft))] text-[hsl(var(--swf-success))]" : "h-10 w-10 bg-[hsl(213_94%_60%/0.10)] text-[hsl(213_94%_45%)] hover:bg-[hsl(213_94%_60%/0.18)]"}`,
|
|
29798
|
-
children: isVoiceStarting ? /* @__PURE__ */
|
|
29487
|
+
children: isVoiceStarting ? /* @__PURE__ */ jsx24(LoaderCircle, { size: 20, className: "animate-spin" }) : isRecording ? /* @__PURE__ */ jsx24(VoiceWaveform, { level: voiceLevel, size: 20 }) : /* @__PURE__ */ jsx24(Mic, { size: 20 })
|
|
29799
29488
|
}
|
|
29800
29489
|
) : null,
|
|
29801
|
-
isStreaming ? /* @__PURE__ */
|
|
29802
|
-
submitWhileRunning ? /* @__PURE__ */
|
|
29490
|
+
isStreaming ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
29491
|
+
submitWhileRunning ? /* @__PURE__ */ jsx24(
|
|
29803
29492
|
"button",
|
|
29804
29493
|
{
|
|
29805
29494
|
type: "button",
|
|
29806
|
-
onClick: handleSubmit,
|
|
29495
|
+
onClick: () => void handleSubmit(),
|
|
29807
29496
|
disabled: isSendDisabled || isRecording,
|
|
29808
|
-
"aria-label": "\
|
|
29809
|
-
title: "\
|
|
29497
|
+
"aria-label": "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F",
|
|
29498
|
+
title: "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F",
|
|
29810
29499
|
className: "flex h-10 w-10 items-center justify-center rounded-full bg-[hsl(213_94%_55%)] text-white disabled:opacity-25",
|
|
29811
|
-
children: isSubmitting ? /* @__PURE__ */
|
|
29500
|
+
children: isSubmitting ? /* @__PURE__ */ jsx24(LoaderCircle, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx24(Send, { size: 16 })
|
|
29812
29501
|
}
|
|
29813
29502
|
) : null,
|
|
29814
|
-
/* @__PURE__ */
|
|
29503
|
+
/* @__PURE__ */ jsx24(
|
|
29815
29504
|
"button",
|
|
29816
29505
|
{
|
|
29817
29506
|
type: "button",
|
|
@@ -29820,41 +29509,41 @@ ${append2.text}` : append2.text;
|
|
|
29820
29509
|
"aria-label": isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u751F\u6210",
|
|
29821
29510
|
title: isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u751F\u6210",
|
|
29822
29511
|
className: "flex h-10 w-10 items-center justify-center rounded-full bg-[hsl(var(--destructive))] text-[hsl(var(--destructive-foreground))] transition-opacity hover:opacity-80 disabled:cursor-wait disabled:opacity-70",
|
|
29823
|
-
children: isStopping ? /* @__PURE__ */
|
|
29512
|
+
children: isStopping ? /* @__PURE__ */ jsx24(LoaderCircle, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx24(Square, { size: 16 })
|
|
29824
29513
|
}
|
|
29825
29514
|
)
|
|
29826
|
-
] }) : isCompacting ? /* @__PURE__ */
|
|
29515
|
+
] }) : isCompacting ? /* @__PURE__ */ jsx24(
|
|
29827
29516
|
"button",
|
|
29828
29517
|
{
|
|
29829
29518
|
type: "button",
|
|
29830
29519
|
disabled: true,
|
|
29831
|
-
"aria-label": "\u6B63\u5728\u6574\u7406\u5BF9\u8BDD",
|
|
29832
|
-
title: "\u6B63\u5728\u6574\u7406\u5BF9\u8BDD",
|
|
29520
|
+
"aria-label": developer ? "\u6B63\u5728\u6574\u7406\u5BF9\u8BDD" : "\u6B63\u5728\u5904\u7406",
|
|
29521
|
+
title: developer ? "\u6B63\u5728\u6574\u7406\u5BF9\u8BDD" : "\u6B63\u5728\u5904\u7406",
|
|
29833
29522
|
className: "flex h-10 w-10 items-center justify-center rounded-full bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] opacity-50",
|
|
29834
|
-
children: /* @__PURE__ */
|
|
29523
|
+
children: /* @__PURE__ */ jsx24(LoaderCircle, { size: 16, className: "animate-spin" })
|
|
29835
29524
|
}
|
|
29836
|
-
) : !isRecording && hasComposerContent ? /* @__PURE__ */
|
|
29525
|
+
) : !isRecording && hasComposerContent ? /* @__PURE__ */ jsx24(
|
|
29837
29526
|
"button",
|
|
29838
29527
|
{
|
|
29839
29528
|
type: "button",
|
|
29840
|
-
onClick: handleSubmit,
|
|
29529
|
+
onClick: () => void handleSubmit(),
|
|
29841
29530
|
disabled: isSendDisabled,
|
|
29842
|
-
"aria-label": "\u53D1\u9001\u6D88\u606F",
|
|
29843
|
-
title: isModelLoading ? "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u914D\u7F6E" : !hasAvailableModel ? modelAvailabilityMessage : "\u53D1\u9001\u6D88\u606F",
|
|
29531
|
+
"aria-label": "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F",
|
|
29532
|
+
title: isModelLoading ? "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u914D\u7F6E" : !hasAvailableModel ? modelAvailabilityMessage : "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F",
|
|
29844
29533
|
className: "flex h-10 w-10 items-center justify-center rounded-full bg-[hsl(213_94%_55%)] text-white transition-colors duration-[120ms] ease-out hover:bg-[hsl(213_94%_48%)] disabled:opacity-25",
|
|
29845
|
-
children: isSubmitting ? /* @__PURE__ */
|
|
29534
|
+
children: isSubmitting ? /* @__PURE__ */ jsx24(LoaderCircle, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx24(Send, { size: 16 })
|
|
29846
29535
|
}
|
|
29847
29536
|
) : null
|
|
29848
29537
|
] })
|
|
29849
29538
|
] }),
|
|
29850
|
-
slotBelowActions ? /* @__PURE__ */
|
|
29539
|
+
slotBelowActions ? /* @__PURE__ */ jsx24("div", { className: "border-t border-[hsl(var(--border))] px-4 py-1.5", children: slotBelowActions }) : null
|
|
29851
29540
|
]
|
|
29852
29541
|
}
|
|
29853
29542
|
)
|
|
29854
29543
|
}
|
|
29855
29544
|
)
|
|
29856
29545
|
] }) }),
|
|
29857
|
-
/* @__PURE__ */
|
|
29546
|
+
/* @__PURE__ */ jsx24(
|
|
29858
29547
|
FileSizeLimitDialog,
|
|
29859
29548
|
{
|
|
29860
29549
|
open: oversizedFiles.length > 0,
|
|
@@ -29869,11 +29558,46 @@ ${append2.text}` : append2.text;
|
|
|
29869
29558
|
)
|
|
29870
29559
|
] });
|
|
29871
29560
|
}
|
|
29561
|
+
|
|
29562
|
+
// src/rich-input/SkillActionMenu.tsx
|
|
29563
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
29564
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
29565
|
+
function SkillActionMenu({ open, onOpenChange, renderMode, onSelect, onManage, disabled }) {
|
|
29566
|
+
return /* @__PURE__ */ jsx25(InputActionSubmenu, { label: "\u6280\u80FD", icon: /* @__PURE__ */ jsx25(Sparkles, { size: 16, "aria-hidden": "true" }), open, onOpenChange, disabled, children: /* @__PURE__ */ jsx25(SkillPicker, { renderMode, onSelect, onManage }) });
|
|
29567
|
+
}
|
|
29568
|
+
function SkillPicker({ renderMode, onSelect, onManage }) {
|
|
29569
|
+
const client = useBladeClient();
|
|
29570
|
+
const [query, setQuery] = useState12("");
|
|
29571
|
+
const [skills, setSkills] = useState12(null);
|
|
29572
|
+
useEffect9(() => {
|
|
29573
|
+
let active = true;
|
|
29574
|
+
setSkills(null);
|
|
29575
|
+
getSlashSuggestions(query, { client, sessionId: null, renderMode }).then((items) => {
|
|
29576
|
+
if (active) setSkills(items);
|
|
29577
|
+
}).catch(() => {
|
|
29578
|
+
if (active) setSkills([]);
|
|
29579
|
+
});
|
|
29580
|
+
return () => {
|
|
29581
|
+
active = false;
|
|
29582
|
+
};
|
|
29583
|
+
}, [client, renderMode, query]);
|
|
29584
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
29585
|
+
/* @__PURE__ */ jsxs14("label", { className: "m-1 flex items-center gap-2 rounded-lg bg-[hsl(var(--muted))] px-3 py-2", children: [
|
|
29586
|
+
/* @__PURE__ */ jsx25(Search, { size: 14, "aria-hidden": "true" }),
|
|
29587
|
+
/* @__PURE__ */ jsx25("input", { "aria-label": "\u641C\u7D22\u6280\u80FD", placeholder: "\u641C\u7D22\u6280\u80FD", value: query, onChange: (event) => setQuery(event.target.value), className: "min-w-0 flex-1 bg-transparent outline-none" })
|
|
29588
|
+
] }),
|
|
29589
|
+
/* @__PURE__ */ jsx25("div", { className: "max-h-60 overflow-y-auto", children: skills === null ? /* @__PURE__ */ jsx25("p", { className: "px-3 py-2 text-[hsl(var(--muted-foreground))]", children: "\u52A0\u8F7D\u6280\u80FD\u4E2D\u2026" }) : skills.length ? skills.map((skill) => skill.type === "skill" ? /* @__PURE__ */ jsxs14("button", { type: "button", onClick: () => onSelect(skill), className: "flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left hover:bg-[hsl(var(--accent))] focus-visible:bg-[hsl(var(--accent))]", children: [
|
|
29590
|
+
/* @__PURE__ */ jsx25("span", { children: skillDisplayName(skill) }),
|
|
29591
|
+
/* @__PURE__ */ jsx25("span", { className: "line-clamp-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: skill.description })
|
|
29592
|
+
] }, skill.skillId) : null) : /* @__PURE__ */ jsx25("p", { className: "px-3 py-2 text-[hsl(var(--muted-foreground))]", children: "\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD" }) }),
|
|
29593
|
+
/* @__PURE__ */ jsx25("div", { className: "my-1 border-t border-[hsl(var(--border))]" }),
|
|
29594
|
+
/* @__PURE__ */ jsx25("button", { type: "button", onClick: onManage, className: "w-full rounded-lg px-3 py-2 text-left hover:bg-[hsl(var(--accent))]", children: "\u7BA1\u7406\u6280\u80FD \u2192" })
|
|
29595
|
+
] });
|
|
29596
|
+
}
|
|
29872
29597
|
export {
|
|
29873
29598
|
ATTACHMENT_SIZE_LIMIT_BYTES,
|
|
29874
29599
|
ATTENTION_STATUSES,
|
|
29875
29600
|
BackgroundTasksPill,
|
|
29876
|
-
COMMANDS,
|
|
29877
29601
|
ChatInput,
|
|
29878
29602
|
ComposerAttachmentViewport,
|
|
29879
29603
|
ConnectButton,
|
|
@@ -29881,60 +29605,59 @@ export {
|
|
|
29881
29605
|
FileMention,
|
|
29882
29606
|
FileSizeLimitDialog,
|
|
29883
29607
|
IMAGE_INPUT_UNSUPPORTED_MESSAGE,
|
|
29884
|
-
|
|
29885
|
-
KbMention,
|
|
29608
|
+
InputActionSubmenu,
|
|
29886
29609
|
LIVE_STATUSES,
|
|
29887
29610
|
MODEL_LOADING_SEND_HINT,
|
|
29888
29611
|
MODEL_REASONING_LEVELS_KEY,
|
|
29889
29612
|
ModelSelector,
|
|
29890
29613
|
PREFERRED_MODEL_KEY,
|
|
29891
29614
|
PlanningToggle,
|
|
29615
|
+
PluginMention,
|
|
29892
29616
|
ProgressCircle,
|
|
29893
29617
|
ReasoningModeSelect,
|
|
29894
29618
|
RichInputServicesProvider,
|
|
29895
29619
|
STATUS_LABELS,
|
|
29896
29620
|
STOPPABLE_STATUSES,
|
|
29621
|
+
SkillActionMenu,
|
|
29897
29622
|
SkillCompletionMenu,
|
|
29898
29623
|
SkillMention,
|
|
29899
29624
|
SkillStatusBar,
|
|
29900
29625
|
TopicAssetMention,
|
|
29901
29626
|
VoiceWaveform,
|
|
29902
|
-
|
|
29903
|
-
buildEditorDocumentWithKbMentions,
|
|
29627
|
+
buildEditorDocument,
|
|
29904
29628
|
buildEditorDocumentWithMentions,
|
|
29629
|
+
buildPluginSelectionDocument,
|
|
29905
29630
|
buildSubmitPayload,
|
|
29906
29631
|
buildVoiceInputUnavailableError,
|
|
29907
|
-
|
|
29632
|
+
collectMessageMentions,
|
|
29633
|
+
collectPluginMentions,
|
|
29908
29634
|
collectTopicAssetMentions,
|
|
29909
29635
|
entryLabel,
|
|
29910
29636
|
estimateTokenCount,
|
|
29911
29637
|
fetchClientQuery,
|
|
29912
29638
|
fileMentionSuggestionKey,
|
|
29913
|
-
filterKbSuggestions,
|
|
29914
29639
|
findLeadingSkillMention,
|
|
29915
29640
|
formatFileSize,
|
|
29916
29641
|
formatStartedAt,
|
|
29917
29642
|
gateSendWhileModelLoading,
|
|
29918
29643
|
getFileSuggestionItems,
|
|
29919
29644
|
getInputModalities,
|
|
29920
|
-
|
|
29645
|
+
getPluginSuggestionItems,
|
|
29921
29646
|
getSkillSuggestions,
|
|
29922
29647
|
getSlashSuggestions,
|
|
29923
29648
|
getTopicAssetSuggestionItems,
|
|
29924
29649
|
getUnsupportedImageFiles,
|
|
29925
|
-
getUserHomeRuntime,
|
|
29926
29650
|
getUserHomeSuggestionItems,
|
|
29927
29651
|
installSuggestionOutsideDismiss,
|
|
29928
29652
|
invalidateSlashSuggestions,
|
|
29929
29653
|
isImageFile,
|
|
29930
29654
|
isImeCompositionKey,
|
|
29931
|
-
|
|
29655
|
+
isPluginSuggestionItem,
|
|
29932
29656
|
isSubmittedComposerStillCurrent,
|
|
29933
29657
|
isTopicAssetSuggestionError,
|
|
29934
29658
|
isTopicAssetSuggestionItem,
|
|
29935
29659
|
listUserHomeDir,
|
|
29936
29660
|
mergeSubmittedAttachmentUpdates,
|
|
29937
|
-
notifyWhenKbSuggestionsArriveLate,
|
|
29938
29661
|
parseUserHomeQuery,
|
|
29939
29662
|
queueTopicAssetReference,
|
|
29940
29663
|
reasoningLevelLabel,
|
|
@@ -29952,7 +29675,6 @@ export {
|
|
|
29952
29675
|
splitTasks,
|
|
29953
29676
|
statusClass,
|
|
29954
29677
|
statusLabel,
|
|
29955
|
-
toKbSuggestionItems,
|
|
29956
29678
|
tokenPressureOf,
|
|
29957
29679
|
uploadedPathsById,
|
|
29958
29680
|
useBackgroundTaskList,
|
|
@@ -29970,10 +29692,10 @@ export {
|
|
|
29970
29692
|
useContextStats,
|
|
29971
29693
|
useDismissSkillSuggestionsOnModeChange,
|
|
29972
29694
|
useInputHistory,
|
|
29973
|
-
useKnowledgeBaseLoader,
|
|
29974
29695
|
useModelCatalog,
|
|
29975
29696
|
useModelPreferences,
|
|
29976
29697
|
useReasoningLevelPreference,
|
|
29698
|
+
useReferenceCandidates,
|
|
29977
29699
|
useRefreshWhenRunEnds,
|
|
29978
29700
|
useResolvedModel,
|
|
29979
29701
|
useRichInputServices,
|
|
@@ -29981,10 +29703,7 @@ export {
|
|
|
29981
29703
|
useSessionSkills,
|
|
29982
29704
|
useSkillStats,
|
|
29983
29705
|
useTiptapVoiceInput,
|
|
29984
|
-
useVoiceInput
|
|
29985
|
-
withKbSuggestionTimeout,
|
|
29986
|
-
workflowParamsTail,
|
|
29987
|
-
workflowRunText
|
|
29706
|
+
useVoiceInput
|
|
29988
29707
|
};
|
|
29989
29708
|
/*! Bundled license information:
|
|
29990
29709
|
|