@blade-hq/agent-react 2612.0.0-beta.98 → 2612.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/McpAppCard-NJEKKEEN.js +171 -0
- package/dist/McpAppCard-NJEKKEEN.js.map +1 -0
- package/dist/McpAppFrame-IQK5AOMD.js +9 -0
- package/dist/PlanGraph-WTXKSHID.js +217 -0
- package/dist/PlanGraph-WTXKSHID.js.map +1 -0
- package/dist/{chunk-FTBMG7TK.js → SessionPluginConfigForm-VXONUDM4.js} +2 -3
- package/dist/chat/AskUserQuestionBlock.d.ts +4 -2
- package/dist/chat/AssistantTurnBlock.d.ts +3 -2
- package/dist/chat/AttachmentPreviewDialog.d.ts +1 -6
- package/dist/chat/ChatLoadingIndicator.d.ts +2 -1
- package/dist/chat/ChatPanel.d.ts +5 -3
- package/dist/chat/CurrentPlanPanel.d.ts +2 -1
- package/dist/chat/LightComposer.d.ts +1 -1
- package/dist/chat/MessageList.d.ts +2 -2
- package/dist/chat/RelatedWork.d.ts +24 -0
- package/dist/chat/ToolCallBlock.d.ts +6 -11
- package/dist/chat/chat-run.d.ts +4 -0
- package/dist/chat/customization.d.ts +5 -5
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/message-list-blocks.d.ts +1 -0
- package/dist/chat/plan/PlanGraph.d.ts +27 -0
- package/dist/chat/plan/PlanSurface.d.ts +9 -0
- package/dist/chat/plan/presentation.d.ts +18 -0
- package/dist/chat/runtime/actions.d.ts +3 -4
- package/dist/chat/runtime/environment.d.ts +8 -3
- package/dist/chat/runtime/session-source.d.ts +2 -0
- package/dist/chat.css +292 -1
- package/dist/{chunk-CJQINCIP.js → chunk-34YJQXTM.js} +56 -72
- package/dist/chunk-34YJQXTM.js.map +1 -0
- package/dist/{chunk-IOKIQSWP.js → chunk-3KJJIH5K.js} +37 -53
- package/dist/chunk-3KJJIH5K.js.map +1 -0
- package/dist/{chunk-RHUJ77ZZ.js → chunk-4WFRH7FG.js} +62 -1572
- package/dist/chunk-4WFRH7FG.js.map +1 -0
- package/dist/{chunk-FXTAY3LE.js → chunk-63G66FWM.js} +21 -17
- package/dist/{chunk-FXTAY3LE.js.map → chunk-63G66FWM.js.map} +1 -1
- package/dist/{chunk-KJDDAZZY.js → chunk-7DG4JFRS.js} +175 -35
- package/dist/chunk-7DG4JFRS.js.map +1 -0
- package/dist/chunk-7WR2KG5O.js +50 -0
- package/dist/chunk-7WR2KG5O.js.map +1 -0
- package/dist/chunk-DNND32V4.js +1404 -0
- package/dist/chunk-DNND32V4.js.map +1 -0
- package/dist/chunk-FR3ON5R4.js +30 -0
- package/dist/chunk-FR3ON5R4.js.map +1 -0
- package/dist/chunk-GRUDJLWG.js +8 -0
- package/dist/chunk-GRUDJLWG.js.map +1 -0
- package/dist/{chunk-Q5NLUZAK.js → chunk-LFC3UTIJ.js} +14 -16
- package/dist/chunk-LFC3UTIJ.js.map +1 -0
- package/dist/{chunk-AGCHJFE7.js → chunk-NPDS3EEK.js} +4 -4
- package/dist/{chunk-AGCHJFE7.js.map → chunk-NPDS3EEK.js.map} +1 -1
- package/dist/{chunk-RULD2XDA.js → chunk-VUUX2BIU.js} +9694 -9467
- package/dist/chunk-VUUX2BIU.js.map +1 -0
- package/dist/{chunk-6Z7T6BOB.js → chunk-XCASYOA6.js} +7 -5
- package/dist/{chunk-6Z7T6BOB.js.map → chunk-XCASYOA6.js.map} +1 -1
- package/dist/components/AgentChat.d.ts +3 -0
- package/dist/components/ChatInput.d.ts +2 -1
- package/dist/components/McpAppCard.d.ts +1 -7
- package/dist/components/McpAppFrame.d.ts +2 -0
- package/dist/components/ReplayBar.d.ts +7 -1
- package/dist/components/lazy-mcp-app-card.d.ts +1 -0
- package/dist/components/lazy-mcp-app-frame.d.ts +1 -0
- package/dist/components/lazy-session-plugin-config-form.d.ts +1 -0
- package/dist/components/mcp-app-context.d.ts +7 -0
- package/dist/components/use-session-plugin-activation.d.ts +3 -1
- package/dist/connectors.js +3 -3
- package/dist/embed/entry.d.ts +9 -0
- package/dist/embed/load-plan-graph.d.ts +2 -0
- package/dist/embed/plan-graph-chunk.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -9
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +211 -28
- package/dist/internal.js.map +1 -1
- package/dist/questions.js +5 -4
- package/dist/questions.js.map +1 -1
- package/dist/rich-input/ChatInput.d.ts +3 -1
- package/dist/rich-input/ComposerControls.d.ts +36 -0
- package/dist/rich-input/index.d.ts +1 -0
- package/dist/rich-input.js +6750 -6437
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +293 -2
- package/dist/tool-details.js +6 -5
- package/dist/tool-details.js.map +1 -1
- package/node_modules/@tiptap/core/dist/index.cjs +7679 -6763
- package/node_modules/@tiptap/core/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/core/dist/index.d.cts +4468 -3614
- package/node_modules/@tiptap/core/dist/index.d.cts.map +1 -0
- package/node_modules/@tiptap/core/dist/index.d.ts +4467 -3614
- package/node_modules/@tiptap/core/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/core/dist/index.js +7508 -6632
- package/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs +66 -52
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs.map +1 -1
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts +17 -12
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts.map +1 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts +17 -12
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts.map +1 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +60 -22
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -1
- package/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/node_modules/@tiptap/core/package.json +27 -24
- package/node_modules/@tiptap/core/src/CommandManager.ts +72 -2
- package/node_modules/@tiptap/core/src/Editor.ts +108 -26
- package/node_modules/@tiptap/core/src/EventEmitter.ts +20 -7
- package/node_modules/@tiptap/core/src/Extendable.ts +52 -7
- package/node_modules/@tiptap/core/src/Extension.ts +7 -3
- package/node_modules/@tiptap/core/src/ExtensionManager.ts +158 -15
- package/node_modules/@tiptap/core/src/InputRule.ts +30 -3
- package/node_modules/@tiptap/core/src/Mark.ts +26 -6
- package/node_modules/@tiptap/core/src/MarkView.ts +13 -3
- package/node_modules/@tiptap/core/src/Node.ts +19 -6
- package/node_modules/@tiptap/core/src/NodePos.ts +17 -4
- package/node_modules/@tiptap/core/src/NodeView.ts +31 -9
- package/node_modules/@tiptap/core/src/PasteRule.ts +17 -4
- package/node_modules/@tiptap/core/src/Tracker.ts +9 -7
- package/node_modules/@tiptap/core/src/__tests__/Editor.spec.ts +73 -0
- package/node_modules/@tiptap/core/src/__tests__/htmlEntities.test.ts +55 -0
- package/node_modules/@tiptap/core/src/__tests__/inputRuleInlineAtoms.test.ts +111 -0
- package/node_modules/@tiptap/core/src/__tests__/isAndroid.test.ts +28 -0
- package/node_modules/@tiptap/core/src/__tests__/rewriteUnknownContent.test.ts +51 -0
- package/node_modules/@tiptap/core/src/__tests__/transformPastedHTML.test.ts +10 -4
- package/node_modules/@tiptap/core/src/commands/deleteSelection.ts +90 -2
- package/node_modules/@tiptap/core/src/commands/extendMarkRange.ts +3 -2
- package/node_modules/@tiptap/core/src/commands/index.ts +2 -0
- package/node_modules/@tiptap/core/src/commands/insertContent.ts +5 -1
- package/node_modules/@tiptap/core/src/commands/insertContentAt.ts +17 -21
- package/node_modules/@tiptap/core/src/commands/insertDefaultBlock.ts +97 -0
- package/node_modules/@tiptap/core/src/commands/resetAttributes.ts +9 -2
- package/node_modules/@tiptap/core/src/commands/setContent.ts +4 -1
- package/node_modules/@tiptap/core/src/commands/setMark.ts +7 -3
- package/node_modules/@tiptap/core/src/commands/setTextSelection.ts +2 -1
- package/node_modules/@tiptap/core/src/commands/splitBlock.ts +16 -4
- package/node_modules/@tiptap/core/src/commands/splitListItem.ts +14 -6
- package/node_modules/@tiptap/core/src/commands/toggleList.ts +106 -7
- package/node_modules/@tiptap/core/src/commands/undoInputRule.ts +1 -1
- package/node_modules/@tiptap/core/src/commands/unsetAllMarks.ts +17 -5
- package/node_modules/@tiptap/core/src/commands/updateDecorations.ts +28 -0
- package/node_modules/@tiptap/core/src/decorations/Decoration.ts +177 -0
- package/node_modules/@tiptap/core/src/decorations/DecorationManager.ts +440 -0
- package/node_modules/@tiptap/core/src/decorations/__tests__/DecorationManager.test.ts +821 -0
- package/node_modules/@tiptap/core/src/decorations/constants.ts +7 -0
- package/node_modules/@tiptap/core/src/decorations/createWidgetDecoration.ts +221 -0
- package/node_modules/@tiptap/core/src/decorations/decorationApplyScope.ts +45 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/__tests__/getRebuildRanges.test.ts +147 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/buildDecorationSet.ts +25 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/decorationsToPMDecorations.ts +36 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/filterOutOfRangeDecorations.ts +52 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/findDuplicateWidgetKeys.ts +37 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/getRebuildRanges.ts +96 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/hasResolvableChangedRange.ts +24 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/isAttrStep.ts +21 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/mapDecorationSet.ts +31 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/mapDecorations.ts +26 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/mergeDecorationSets.ts +16 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/rangeOwnsPosition.ts +38 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/shouldRecomputeDecoration.ts +24 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/unionWidgetKeys.ts +15 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/validateDecorationSpec.ts +49 -0
- package/node_modules/@tiptap/core/src/decorations/helpers/widgetKeyOf.ts +11 -0
- package/node_modules/@tiptap/core/src/decorations/index.ts +28 -0
- package/node_modules/@tiptap/core/src/decorations/types.ts +87 -0
- package/node_modules/@tiptap/core/src/extensions/clipboardTextSerializer.ts +17 -8
- package/node_modules/@tiptap/core/src/extensions/delete.ts +33 -21
- package/node_modules/@tiptap/core/src/extensions/focusEvents.ts +6 -2
- package/node_modules/@tiptap/core/src/extensions/keymap.ts +8 -3
- package/node_modules/@tiptap/core/src/extensions/tabindex.ts +42 -2
- package/node_modules/@tiptap/core/src/extensions/textDirection.ts +3 -1
- package/node_modules/@tiptap/core/src/helpers/MappablePosition.ts +4 -1
- package/node_modules/@tiptap/core/src/helpers/__tests__/getChangedRanges.test.ts +48 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorAddMarkStep.test.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorAddNodeMarkStep.test.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorAttrStep.test.ts +17 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorCellSelection.test.ts +17 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorDocAttrStep.test.ts +17 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorFragment.test.ts +27 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorNodeSelection.test.ts +35 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorRemoveMarkStep.test.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorRemoveNodeMarkStep.test.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorReplaceAroundStep.test.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorReplaceStep.test.ts +17 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorSlice.test.ts +16 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorStep.test.ts +30 -0
- package/node_modules/@tiptap/core/src/helpers/__tests__/isProseMirrorStepResult.test.ts +17 -0
- package/node_modules/@tiptap/core/src/helpers/combineTransactionSteps.ts +4 -1
- package/node_modules/@tiptap/core/src/helpers/createChainableState.ts +4 -1
- package/node_modules/@tiptap/core/src/helpers/createNodeFromContent.ts +15 -6
- package/node_modules/@tiptap/core/src/helpers/findChildrenInRange.ts +5 -1
- package/node_modules/@tiptap/core/src/helpers/flattenExtensions.ts +5 -1
- package/node_modules/@tiptap/core/src/helpers/getAttributes.ts +4 -1
- package/node_modules/@tiptap/core/src/helpers/getAttributesFromExtensions.ts +3 -5
- package/node_modules/@tiptap/core/src/helpers/getMarkAttributes.ts +4 -1
- package/node_modules/@tiptap/core/src/helpers/getMarkRange.ts +20 -5
- package/node_modules/@tiptap/core/src/helpers/getMarkType.ts +3 -1
- package/node_modules/@tiptap/core/src/helpers/getNodeAtPosition.ts +6 -1
- package/node_modules/@tiptap/core/src/helpers/getNodeAttributes.ts +4 -1
- package/node_modules/@tiptap/core/src/helpers/getNodeType.ts +3 -1
- package/node_modules/@tiptap/core/src/helpers/getPreviousBlockSibling.ts +36 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaByResolvedExtensions.ts +73 -20
- package/node_modules/@tiptap/core/src/helpers/getTextBetween.ts +1 -1
- package/node_modules/@tiptap/core/src/helpers/getTextContentFromNodes.ts +17 -12
- package/node_modules/@tiptap/core/src/helpers/index.ts +16 -0
- package/node_modules/@tiptap/core/src/helpers/isActive.ts +5 -1
- package/node_modules/@tiptap/core/src/helpers/isFragment.ts +14 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeViewSelected.ts +42 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorAddMarkStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorAddNodeMarkStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorAttrStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorCellSelection.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorContent.ts +14 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorDocAttrStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorFragment.ts +34 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorNodeSelection.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorRemoveMarkStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorRemoveNodeMarkStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorReplaceAroundStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorReplaceStep.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorSlice.ts +43 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorStep.ts +30 -0
- package/node_modules/@tiptap/core/src/helpers/isProseMirrorStepResult.ts +26 -0
- package/node_modules/@tiptap/core/src/helpers/resolveFocusPosition.ts +14 -3
- package/node_modules/@tiptap/core/src/helpers/rewriteUnknownContent.ts +19 -10
- package/node_modules/@tiptap/core/src/helpers/splitExtensions.ts +3 -1
- package/node_modules/@tiptap/core/src/helpers/warnOnDuplicatedProseMirrorModel.ts +40 -0
- package/node_modules/@tiptap/core/src/index.ts +1 -6
- package/node_modules/@tiptap/core/src/inputRules/markInputRule.ts +5 -1
- package/node_modules/@tiptap/core/src/inputRules/nodeInputRule.ts +9 -2
- package/node_modules/@tiptap/core/src/inputRules/textInputRule.ts +5 -1
- package/node_modules/@tiptap/core/src/inputRules/textblockTypeInputRule.ts +8 -2
- package/node_modules/@tiptap/core/src/inputRules/wrappingInputRule.ts +8 -2
- package/node_modules/@tiptap/core/src/jsx-runtime.ts +91 -11
- package/node_modules/@tiptap/core/src/lib/ResizableNodeView.ts +25 -6
- package/node_modules/@tiptap/core/src/pasteRules/markPasteRule.ts +12 -1
- package/node_modules/@tiptap/core/src/types.ts +65 -18
- package/node_modules/@tiptap/core/src/utilities/attrsEqual.ts +27 -0
- package/node_modules/@tiptap/core/src/utilities/callOrReturn.ts +5 -1
- package/node_modules/@tiptap/core/src/utilities/deleteProps.ts +4 -1
- package/node_modules/@tiptap/core/src/utilities/elementFromString.ts +3 -1
- package/node_modules/@tiptap/core/src/utilities/getStyleProperty.ts +52 -0
- package/node_modules/@tiptap/core/src/utilities/htmlEntities.ts +26 -0
- package/node_modules/@tiptap/core/src/utilities/index.ts +4 -0
- package/node_modules/@tiptap/core/src/utilities/isAndroid.ts +1 -1
- package/node_modules/@tiptap/core/src/utilities/isDev.ts +12 -0
- package/node_modules/@tiptap/core/src/utilities/isFunction.ts +1 -1
- package/node_modules/@tiptap/core/src/utilities/isSafari.ts +3 -1
- package/node_modules/@tiptap/core/src/utilities/isiOS.ts +3 -1
- package/node_modules/@tiptap/core/src/utilities/markdown/createAtomBlockMarkdownSpec.ts +2 -4
- package/node_modules/@tiptap/core/src/utilities/markdown/createBlockMarkdownSpec.ts +10 -6
- package/node_modules/@tiptap/core/src/utilities/markdown/createInlineMarkdownSpec.ts +4 -24
- package/node_modules/@tiptap/core/src/utilities/markdown/index.ts +2 -1
- package/node_modules/@tiptap/core/src/utilities/markdown/parseAttributes.ts +48 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/parseShortcodeAttributes.ts +13 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/renderNestedMarkdownContent.ts +2 -1
- package/node_modules/@tiptap/core/src/utilities/markdown/serializeAttributes.ts +42 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/tokenizeAttributes.ts +163 -0
- package/node_modules/@tiptap/core/src/utilities/marksEqual.ts +44 -0
- package/node_modules/@tiptap/core/src/utilities/mergeAttributes.ts +22 -3
- package/node_modules/@tiptap/core/src/utilities/mergeDeep.ts +4 -1
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs +324 -453
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts +152 -151
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts.map +1 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts +152 -151
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js +316 -433
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js.map +1 -1
- package/node_modules/@tiptap/extension-bubble-menu/package.json +25 -23
- package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu-plugin.ts +73 -13
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs +265 -373
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts +161 -160
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts.map +1 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts +161 -160
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js +258 -354
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js.map +1 -1
- package/node_modules/@tiptap/extension-floating-menu/package.json +23 -21
- package/node_modules/@tiptap/extension-floating-menu/src/floating-menu-plugin.ts +66 -11
- package/node_modules/@tiptap/extension-mention/dist/index.cjs +232 -268
- package/node_modules/@tiptap/extension-mention/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/extension-mention/dist/index.d.cts +85 -84
- package/node_modules/@tiptap/extension-mention/dist/index.d.cts.map +1 -0
- package/node_modules/@tiptap/extension-mention/dist/index.d.ts +85 -84
- package/node_modules/@tiptap/extension-mention/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-mention/dist/index.js +226 -240
- package/node_modules/@tiptap/extension-mention/dist/index.js.map +1 -1
- package/node_modules/@tiptap/extension-mention/package.json +24 -22
- package/node_modules/@tiptap/extension-mention/src/mention.ts +23 -13
- package/node_modules/@tiptap/pm/README.md +1 -1
- package/node_modules/{prosemirror-markdown/LICENSE → @tiptap/pm/THIRD_PARTY_LICENSES.md} +28 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/changeset/index.d.cts +1 -18
- package/node_modules/@tiptap/pm/dist/changeset/index.d.ts +1 -18
- package/node_modules/@tiptap/pm/dist/changeset/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/commands/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/commands/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/commands/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/commands/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/dropcursor/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/dropcursor/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/gapcursor/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/gapcursor/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/history/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/history/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/history/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/history/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/inputrules/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/inputrules/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/keymap/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/keymap/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/keymap/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/keymap/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/model/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/model/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/model/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/model/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/schema-list/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/schema-list/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/state/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/state/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/state/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/state/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/tables/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/tables/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/tables/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/tables/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/transform/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/transform/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/transform/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/transform/index.js +1 -1
- package/node_modules/@tiptap/pm/dist/view/index.cjs +9 -2
- package/node_modules/@tiptap/pm/dist/view/index.d.cts +1 -1
- package/node_modules/@tiptap/pm/dist/view/index.d.ts +1 -1
- package/node_modules/@tiptap/pm/dist/view/index.js +1 -1
- package/node_modules/@tiptap/pm/package.json +54 -99
- package/node_modules/@tiptap/react/dist/index.cjs +1243 -1141
- package/node_modules/@tiptap/react/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/react/dist/index.d.cts +396 -294
- package/node_modules/@tiptap/react/dist/index.d.cts.map +1 -0
- package/node_modules/@tiptap/react/dist/index.d.ts +396 -294
- package/node_modules/@tiptap/react/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/react/dist/index.js +1188 -1081
- package/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/node_modules/@tiptap/react/dist/menus/index.cjs +420 -450
- package/node_modules/@tiptap/react/dist/menus/index.cjs.map +1 -1
- package/node_modules/@tiptap/react/dist/menus/index.d.cts +13 -11
- package/node_modules/@tiptap/react/dist/menus/index.d.cts.map +1 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.ts +13 -11
- package/node_modules/@tiptap/react/dist/menus/index.d.ts.map +1 -0
- package/node_modules/@tiptap/react/dist/menus/index.js +399 -416
- package/node_modules/@tiptap/react/dist/menus/index.js.map +1 -1
- package/node_modules/@tiptap/react/package.json +29 -27
- package/node_modules/@tiptap/react/src/Context.tsx +3 -1
- package/node_modules/@tiptap/react/src/Editor.ts +4 -1
- package/node_modules/@tiptap/react/src/EditorContent.spec.ts +39 -0
- package/node_modules/@tiptap/react/src/EditorContent.tsx +26 -41
- package/node_modules/@tiptap/react/src/ReactMarkViewRenderer.tsx +18 -10
- package/node_modules/@tiptap/react/src/ReactNodeViewRenderer.spec.ts +415 -0
- package/node_modules/@tiptap/react/src/ReactNodeViewRenderer.tsx +126 -24
- package/node_modules/@tiptap/react/src/ReactRenderer.tsx +30 -8
- package/node_modules/@tiptap/react/src/ReactWidgetRenderer.spec.ts +448 -0
- package/node_modules/@tiptap/react/src/ReactWidgetRenderer.tsx +97 -0
- package/node_modules/@tiptap/react/src/Tiptap.tsx +22 -15
- package/node_modules/@tiptap/react/src/captureDOMSelection.spec.ts +76 -0
- package/node_modules/@tiptap/react/src/captureDOMSelection.ts +35 -0
- package/node_modules/@tiptap/react/src/index.ts +3 -0
- package/node_modules/@tiptap/react/src/menus/BubbleMenu.spec.ts +7 -3
- package/node_modules/@tiptap/react/src/menus/BubbleMenu.tsx +10 -3
- package/node_modules/@tiptap/react/src/menus/FloatingMenu.spec.ts +7 -3
- package/node_modules/@tiptap/react/src/menus/FloatingMenu.tsx +28 -4
- package/node_modules/@tiptap/react/src/menus/index.ts +2 -0
- package/node_modules/@tiptap/react/src/menus/useMenuElementProps.ts +18 -3
- package/node_modules/@tiptap/react/src/use-client.spec.ts +26 -0
- package/node_modules/@tiptap/react/src/useEditor.ts +30 -33
- package/node_modules/@tiptap/react/src/useEditorState.spec.ts +121 -0
- package/node_modules/@tiptap/react/src/useEditorState.ts +17 -3
- package/node_modules/@tiptap/react/src/useReactNodeView.ts +12 -2
- package/node_modules/@tiptap/suggestion/dist/index.cjs +657 -361
- package/node_modules/@tiptap/suggestion/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/suggestion/dist/index.d.cts +395 -189
- package/node_modules/@tiptap/suggestion/dist/index.d.cts.map +1 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.ts +395 -189
- package/node_modules/@tiptap/suggestion/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/suggestion/dist/index.js +648 -330
- package/node_modules/@tiptap/suggestion/dist/index.js.map +1 -1
- package/node_modules/@tiptap/suggestion/package.json +25 -21
- package/node_modules/@tiptap/suggestion/src/__tests__/suggestion.test.ts +1123 -2
- package/node_modules/@tiptap/suggestion/src/findSuggestionMatch.ts +8 -1
- package/node_modules/@tiptap/suggestion/src/helpers.ts +129 -0
- package/node_modules/@tiptap/suggestion/src/plugin/async.ts +89 -0
- package/node_modules/@tiptap/suggestion/src/plugin/floating-ui.ts +204 -0
- package/node_modules/@tiptap/suggestion/src/plugin/props.ts +94 -0
- package/node_modules/@tiptap/suggestion/src/plugin/state.ts +182 -0
- package/node_modules/@tiptap/suggestion/src/plugin/view.ts +236 -0
- package/node_modules/@tiptap/suggestion/src/suggestion.ts +101 -535
- package/node_modules/@tiptap/suggestion/src/types.ts +439 -0
- package/node_modules/prosemirror-changeset/CHANGELOG.md +36 -0
- package/node_modules/prosemirror-changeset/README.md +1 -1
- package/node_modules/prosemirror-changeset/dist/index.cjs +35 -24
- package/node_modules/prosemirror-changeset/dist/index.d.cts +2 -1
- package/node_modules/prosemirror-changeset/dist/index.d.ts +2 -1
- package/node_modules/prosemirror-changeset/dist/index.js +23 -8
- package/node_modules/prosemirror-changeset/package.json +2 -2
- package/node_modules/prosemirror-changeset/src/README.md +1 -1
- package/node_modules/prosemirror-changeset/src/diff.ts +21 -8
- package/node_modules/prosemirror-changeset/src/simplify.ts +1 -1
- package/node_modules/prosemirror-changeset/test/test-diff.ts +26 -0
- package/node_modules/prosemirror-changeset/test/test-simplify.ts +3 -0
- package/node_modules/prosemirror-commands/CHANGELOG.md +6 -0
- package/node_modules/prosemirror-commands/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-commands/README.md +3 -3
- package/node_modules/prosemirror-commands/dist/index.cjs +23 -22
- package/node_modules/prosemirror-commands/dist/index.js +11 -9
- package/node_modules/prosemirror-commands/package.json +2 -2
- package/node_modules/prosemirror-commands/src/commands.ts +11 -8
- package/node_modules/prosemirror-dropcursor/CHANGELOG.md +12 -0
- package/node_modules/prosemirror-dropcursor/CONTRIBUTING.md +22 -18
- package/node_modules/prosemirror-dropcursor/README.md +3 -3
- package/node_modules/prosemirror-dropcursor/dist/index.cjs +25 -10
- package/node_modules/prosemirror-dropcursor/dist/index.js +30 -13
- package/node_modules/prosemirror-dropcursor/package.json +2 -2
- package/node_modules/prosemirror-dropcursor/src/dropcursor.ts +26 -10
- package/node_modules/prosemirror-history/CHANGELOG.md +12 -0
- package/node_modules/prosemirror-history/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-history/README.md +3 -3
- package/node_modules/prosemirror-history/dist/index.cjs +32 -11
- package/node_modules/prosemirror-history/dist/index.js +21 -4
- package/node_modules/prosemirror-history/package.json +2 -2
- package/node_modules/prosemirror-history/src/history.ts +24 -5
- package/node_modules/prosemirror-model/CHANGELOG.md +58 -0
- package/node_modules/prosemirror-model/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-model/README.md +3 -3
- package/node_modules/prosemirror-model/dist/index.cjs +117 -110
- package/node_modules/prosemirror-model/dist/index.d.cts +36 -30
- package/node_modules/prosemirror-model/dist/index.d.ts +36 -30
- package/node_modules/prosemirror-model/dist/index.js +67 -56
- package/node_modules/prosemirror-model/package.json +2 -2
- package/node_modules/prosemirror-model/src/diff.ts +10 -5
- package/node_modules/prosemirror-model/src/fragment.ts +1 -1
- package/node_modules/prosemirror-model/src/from_dom.ts +5 -2
- package/node_modules/prosemirror-model/src/mark.ts +0 -1
- package/node_modules/prosemirror-model/src/node.ts +30 -10
- package/node_modules/prosemirror-model/src/replace.ts +8 -16
- package/node_modules/prosemirror-model/src/schema.ts +15 -28
- package/node_modules/prosemirror-model/src/to_dom.ts +24 -20
- package/node_modules/prosemirror-transform/CHANGELOG.md +56 -0
- package/node_modules/prosemirror-transform/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-transform/README.md +3 -3
- package/node_modules/prosemirror-transform/dist/index.cjs +288 -176
- package/node_modules/prosemirror-transform/dist/index.d.cts +14 -4
- package/node_modules/prosemirror-transform/dist/index.d.ts +14 -4
- package/node_modules/prosemirror-transform/dist/index.js +156 -55
- package/node_modules/prosemirror-transform/package.json +2 -2
- package/node_modules/prosemirror-transform/src/attr_step.ts +1 -1
- package/node_modules/prosemirror-transform/src/map.ts +11 -6
- package/node_modules/prosemirror-transform/src/mark.ts +4 -21
- package/node_modules/prosemirror-transform/src/mark_step.ts +81 -10
- package/node_modules/prosemirror-transform/src/replace.ts +31 -9
- package/node_modules/prosemirror-transform/src/replace_step.ts +11 -2
- package/node_modules/prosemirror-transform/src/structure.ts +15 -9
- package/node_modules/prosemirror-view/CHANGELOG.md +52 -2
- package/node_modules/prosemirror-view/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-view/README.md +3 -3
- package/node_modules/prosemirror-view/dist/index.cjs +287 -183
- package/node_modules/prosemirror-view/dist/index.d.cts +10 -2
- package/node_modules/prosemirror-view/dist/index.d.ts +10 -2
- package/node_modules/prosemirror-view/dist/index.js +180 -93
- package/node_modules/prosemirror-view/package.json +3 -3
- package/node_modules/prosemirror-view/src/clipboard.ts +21 -5
- package/node_modules/prosemirror-view/src/domchange.ts +8 -18
- package/node_modules/prosemirror-view/src/domcoords.ts +4 -1
- package/node_modules/prosemirror-view/src/domobserver.ts +4 -1
- package/node_modules/prosemirror-view/src/index.ts +4 -3
- package/node_modules/prosemirror-view/src/input.ts +96 -41
- package/node_modules/prosemirror-view/src/selection.ts +6 -6
- package/node_modules/prosemirror-view/src/viewdesc.ts +48 -23
- package/node_modules/prosemirror-view/style/prosemirror.css +1 -1
- package/package.json +19 -55
- package/public-api.md +64 -2
- package/dist/SessionPluginConfigForm-DWLJEYBY.js +0 -9
- package/dist/chat/LiteMessageList.d.ts +0 -84
- package/dist/chunk-CJQINCIP.js.map +0 -1
- package/dist/chunk-IOKIQSWP.js.map +0 -1
- package/dist/chunk-KJDDAZZY.js.map +0 -1
- package/dist/chunk-Q5NLUZAK.js.map +0 -1
- package/dist/chunk-RHUJ77ZZ.js.map +0 -1
- package/dist/chunk-RULD2XDA.js.map +0 -1
- package/node_modules/@remirror/core-constants/LICENSE +0 -21
- package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.cts +0 -612
- package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.ts +0 -612
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.cjs +0 -314
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.cts +0 -20
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.ts +0 -20
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.js +0 -269
- package/node_modules/@remirror/core-constants/dist-types/core-constants.d.ts +0 -431
- package/node_modules/@remirror/core-constants/dist-types/error-constants.d.ts +0 -119
- package/node_modules/@remirror/core-constants/dist-types/index.d.ts +0 -2
- package/node_modules/@remirror/core-constants/dist-types/tsconfig.tsbuildinfo +0 -1
- package/node_modules/@remirror/core-constants/package.json +0 -45
- package/node_modules/@remirror/core-constants/readme.md +0 -17
- package/node_modules/@tiptap/core/src/utilities/markdown/attributeUtils.ts +0 -130
- package/node_modules/@tiptap/pm/collab/index.ts +0 -1
- package/node_modules/@tiptap/pm/dist/collab/index.cjs +0 -2
- package/node_modules/@tiptap/pm/dist/collab/index.d.cts +0 -1
- package/node_modules/@tiptap/pm/dist/collab/index.d.ts +0 -1
- package/node_modules/@tiptap/pm/dist/collab/index.js +0 -2
- package/node_modules/@tiptap/pm/dist/markdown/index.cjs +0 -2
- package/node_modules/@tiptap/pm/dist/markdown/index.d.cts +0 -1
- package/node_modules/@tiptap/pm/dist/markdown/index.d.ts +0 -1
- package/node_modules/@tiptap/pm/dist/markdown/index.js +0 -2
- package/node_modules/@tiptap/pm/dist/menu/index.cjs +0 -2
- package/node_modules/@tiptap/pm/dist/menu/index.d.cts +0 -1
- package/node_modules/@tiptap/pm/dist/menu/index.d.ts +0 -1
- package/node_modules/@tiptap/pm/dist/menu/index.js +0 -2
- package/node_modules/@tiptap/pm/dist/schema-basic/index.cjs +0 -2
- package/node_modules/@tiptap/pm/dist/schema-basic/index.d.cts +0 -1
- package/node_modules/@tiptap/pm/dist/schema-basic/index.d.ts +0 -1
- package/node_modules/@tiptap/pm/dist/schema-basic/index.js +0 -2
- package/node_modules/@tiptap/pm/dist/trailing-node/index.cjs +0 -2
- package/node_modules/@tiptap/pm/dist/trailing-node/index.d.cts +0 -1
- package/node_modules/@tiptap/pm/dist/trailing-node/index.d.ts +0 -1
- package/node_modules/@tiptap/pm/dist/trailing-node/index.js +0 -2
- package/node_modules/@tiptap/pm/markdown/index.ts +0 -1
- package/node_modules/@tiptap/pm/menu/index.ts +0 -1
- package/node_modules/@tiptap/pm/schema-basic/index.ts +0 -1
- package/node_modules/@tiptap/pm/trailing-node/index.ts +0 -1
- package/node_modules/@types/linkify-it/LICENSE +0 -21
- package/node_modules/@types/linkify-it/README.md +0 -15
- package/node_modules/@types/linkify-it/build/index.cjs.d.ts +0 -178
- package/node_modules/@types/linkify-it/index.d.mts +0 -174
- package/node_modules/@types/linkify-it/index.d.ts +0 -3
- package/node_modules/@types/linkify-it/package.json +0 -50
- package/node_modules/@types/markdown-it/LICENSE +0 -21
- package/node_modules/@types/markdown-it/README.md +0 -15
- package/node_modules/@types/markdown-it/dist/index.cjs.d.ts +0 -1236
- package/node_modules/@types/markdown-it/dist/markdown-it.d.ts +0 -5
- package/node_modules/@types/markdown-it/dist/markdown-it.min.d.ts +0 -5
- package/node_modules/@types/markdown-it/index.d.mts +0 -1
- package/node_modules/@types/markdown-it/index.d.ts +0 -3
- package/node_modules/@types/markdown-it/lib/common/html_blocks.d.mts +0 -7
- package/node_modules/@types/markdown-it/lib/common/html_re.d.mts +0 -2
- package/node_modules/@types/markdown-it/lib/common/utils.d.mts +0 -62
- package/node_modules/@types/markdown-it/lib/helpers/index.d.mts +0 -5
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.mts +0 -7
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.mts +0 -3
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.mts +0 -29
- package/node_modules/@types/markdown-it/lib/index.d.mts +0 -404
- package/node_modules/@types/markdown-it/lib/parser_block.d.mts +0 -25
- package/node_modules/@types/markdown-it/lib/parser_core.d.mts +0 -18
- package/node_modules/@types/markdown-it/lib/parser_inline.d.mts +0 -38
- package/node_modules/@types/markdown-it/lib/renderer.d.mts +0 -96
- package/node_modules/@types/markdown-it/lib/ruler.d.mts +0 -158
- package/node_modules/@types/markdown-it/lib/rules_block/state_block.d.mts +0 -124
- package/node_modules/@types/markdown-it/lib/rules_core/state_core.d.mts +0 -18
- package/node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.mts +0 -73
- package/node_modules/@types/markdown-it/lib/token.d.mts +0 -108
- package/node_modules/@types/markdown-it/package.json +0 -54
- package/node_modules/@types/mdurl/LICENSE +0 -21
- package/node_modules/@types/mdurl/README.md +0 -15
- package/node_modules/@types/mdurl/build/index.cjs.d.ts +0 -52
- package/node_modules/@types/mdurl/index.d.mts +0 -6
- package/node_modules/@types/mdurl/index.d.ts +0 -3
- package/node_modules/@types/mdurl/lib/decode.d.mts +0 -10
- package/node_modules/@types/mdurl/lib/encode.d.mts +0 -15
- package/node_modules/@types/mdurl/lib/format.d.mts +0 -3
- package/node_modules/@types/mdurl/lib/parse.d.mts +0 -18
- package/node_modules/@types/mdurl/package.json +0 -36
- package/node_modules/argparse/LICENSE +0 -254
- package/node_modules/argparse/README.md +0 -84
- package/node_modules/argparse/argparse.js +0 -3707
- package/node_modules/argparse/lib/sub.js +0 -67
- package/node_modules/argparse/lib/textwrap.js +0 -440
- package/node_modules/argparse/package.json +0 -31
- package/node_modules/crelt/LICENSE +0 -19
- package/node_modules/crelt/README.md +0 -23
- package/node_modules/crelt/dist/index.cjs +0 -31
- package/node_modules/crelt/dist/index.d.cts +0 -4
- package/node_modules/crelt/index.d.ts +0 -4
- package/node_modules/crelt/index.js +0 -28
- package/node_modules/crelt/package.json +0 -35
- package/node_modules/crelt/rollup.config.js +0 -13
- package/node_modules/entities/LICENSE +0 -11
- package/node_modules/entities/lib/decode.d.ts +0 -211
- package/node_modules/entities/lib/decode.d.ts.map +0 -1
- package/node_modules/entities/lib/decode.js +0 -536
- package/node_modules/entities/lib/decode.js.map +0 -1
- package/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
- package/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
- package/node_modules/entities/lib/decode_codepoint.js +0 -76
- package/node_modules/entities/lib/decode_codepoint.js.map +0 -1
- package/node_modules/entities/lib/encode.d.ts +0 -22
- package/node_modules/entities/lib/encode.d.ts.map +0 -1
- package/node_modules/entities/lib/encode.js +0 -77
- package/node_modules/entities/lib/encode.js.map +0 -1
- package/node_modules/entities/lib/escape.d.ts +0 -43
- package/node_modules/entities/lib/escape.d.ts.map +0 -1
- package/node_modules/entities/lib/escape.js +0 -122
- package/node_modules/entities/lib/escape.js.map +0 -1
- package/node_modules/entities/lib/esm/decode.d.ts +0 -211
- package/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/decode.js +0 -496
- package/node_modules/entities/lib/esm/decode.js.map +0 -1
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
- package/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
- package/node_modules/entities/lib/esm/encode.d.ts +0 -22
- package/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/encode.js +0 -69
- package/node_modules/entities/lib/esm/encode.js.map +0 -1
- package/node_modules/entities/lib/esm/escape.d.ts +0 -43
- package/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/escape.js +0 -116
- package/node_modules/entities/lib/esm/escape.js.map +0 -1
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
- package/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
- package/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
- package/node_modules/entities/lib/esm/index.d.ts +0 -96
- package/node_modules/entities/lib/esm/index.d.ts.map +0 -1
- package/node_modules/entities/lib/esm/index.js +0 -99
- package/node_modules/entities/lib/esm/index.js.map +0 -1
- package/node_modules/entities/lib/esm/package.json +0 -1
- package/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
- package/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/entities/lib/generated/decode-data-html.js +0 -9
- package/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
- package/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
- package/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
- package/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
- package/node_modules/entities/lib/generated/encode-html.js +0 -12
- package/node_modules/entities/lib/generated/encode-html.js.map +0 -1
- package/node_modules/entities/lib/index.d.ts +0 -96
- package/node_modules/entities/lib/index.d.ts.map +0 -1
- package/node_modules/entities/lib/index.js +0 -126
- package/node_modules/entities/lib/index.js.map +0 -1
- package/node_modules/entities/package.json +0 -90
- package/node_modules/entities/readme.md +0 -122
- package/node_modules/escape-string-regexp/index.d.ts +0 -18
- package/node_modules/escape-string-regexp/index.js +0 -13
- package/node_modules/escape-string-regexp/license +0 -9
- package/node_modules/escape-string-regexp/package.json +0 -38
- package/node_modules/escape-string-regexp/readme.md +0 -34
- package/node_modules/linkify-it/LICENSE +0 -22
- package/node_modules/linkify-it/README.md +0 -196
- package/node_modules/linkify-it/build/index.cjs.js +0 -832
- package/node_modules/linkify-it/index.mjs +0 -642
- package/node_modules/linkify-it/lib/re.mjs +0 -189
- package/node_modules/linkify-it/package.json +0 -58
- package/node_modules/markdown-it/LICENSE +0 -22
- package/node_modules/markdown-it/README.md +0 -324
- package/node_modules/markdown-it/bin/markdown-it.mjs +0 -107
- package/node_modules/markdown-it/dist/index.cjs.js +0 -5547
- package/node_modules/markdown-it/dist/markdown-it.js +0 -6969
- package/node_modules/markdown-it/dist/markdown-it.min.js +0 -2
- package/node_modules/markdown-it/index.mjs +0 -1
- package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
- package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
- package/node_modules/markdown-it/lib/common/utils.mjs +0 -304
- package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
- package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
- package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
- package/node_modules/markdown-it/lib/index.mjs +0 -565
- package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
- package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
- package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
- package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
- package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
- package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
- package/node_modules/markdown-it/lib/renderer.mjs +0 -322
- package/node_modules/markdown-it/lib/ruler.mjs +0 -340
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -69
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -82
- package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -46
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
- package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
- package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
- package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -193
- package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
- package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -69
- package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
- package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
- package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -123
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
- package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
- package/node_modules/markdown-it/lib/token.mjs +0 -191
- package/node_modules/markdown-it/package.json +0 -92
- package/node_modules/mdurl/LICENSE +0 -45
- package/node_modules/mdurl/README.md +0 -102
- package/node_modules/mdurl/build/index.cjs.js +0 -534
- package/node_modules/mdurl/index.mjs +0 -11
- package/node_modules/mdurl/lib/decode.mjs +0 -112
- package/node_modules/mdurl/lib/encode.mjs +0 -89
- package/node_modules/mdurl/lib/format.mjs +0 -21
- package/node_modules/mdurl/lib/parse.mjs +0 -308
- package/node_modules/mdurl/package.json +0 -37
- package/node_modules/prosemirror-collab/.tern-project +0 -8
- package/node_modules/prosemirror-collab/CHANGELOG.md +0 -77
- package/node_modules/prosemirror-collab/CONTRIBUTING.md +0 -104
- package/node_modules/prosemirror-collab/LICENSE +0 -19
- package/node_modules/prosemirror-collab/README.md +0 -28
- package/node_modules/prosemirror-collab/dist/index.cjs +0 -155
- package/node_modules/prosemirror-collab/dist/index.d.cts +0 -60
- package/node_modules/prosemirror-collab/dist/index.d.ts +0 -60
- package/node_modules/prosemirror-collab/dist/index.js +0 -156
- package/node_modules/prosemirror-collab/package.json +0 -40
- package/node_modules/prosemirror-collab/src/README.md +0 -11
- package/node_modules/prosemirror-collab/src/collab.ts +0 -184
- package/node_modules/prosemirror-markdown/.tern-project +0 -8
- package/node_modules/prosemirror-markdown/CHANGELOG.md +0 -311
- package/node_modules/prosemirror-markdown/CONTRIBUTING.md +0 -100
- package/node_modules/prosemirror-markdown/README.md +0 -276
- package/node_modules/prosemirror-markdown/dist/index.cjs +0 -966
- package/node_modules/prosemirror-markdown/dist/index.d.cts +0 -335
- package/node_modules/prosemirror-markdown/dist/index.d.ts +0 -335
- package/node_modules/prosemirror-markdown/dist/index.js +0 -878
- package/node_modules/prosemirror-markdown/package.json +0 -40
- package/node_modules/prosemirror-markdown/src/README.md +0 -42
- package/node_modules/prosemirror-markdown/src/from_markdown.ts +0 -272
- package/node_modules/prosemirror-markdown/src/index.ts +0 -5
- package/node_modules/prosemirror-markdown/src/schema.ts +0 -156
- package/node_modules/prosemirror-markdown/src/to_markdown.ts +0 -483
- package/node_modules/prosemirror-menu/.tern-project +0 -8
- package/node_modules/prosemirror-menu/CHANGELOG.md +0 -107
- package/node_modules/prosemirror-menu/CONTRIBUTING.md +0 -100
- package/node_modules/prosemirror-menu/LICENSE +0 -19
- package/node_modules/prosemirror-menu/README.md +0 -235
- package/node_modules/prosemirror-menu/dist/index.cjs +0 -798
- package/node_modules/prosemirror-menu/dist/index.d.cts +0 -281
- package/node_modules/prosemirror-menu/dist/index.d.ts +0 -281
- package/node_modules/prosemirror-menu/dist/index.js +0 -795
- package/node_modules/prosemirror-menu/package.json +0 -42
- package/node_modules/prosemirror-menu/src/README.md +0 -60
- package/node_modules/prosemirror-menu/src/icons.ts +0 -53
- package/node_modules/prosemirror-menu/src/index.ts +0 -4
- package/node_modules/prosemirror-menu/src/menu.ts +0 -628
- package/node_modules/prosemirror-menu/src/menubar.ts +0 -210
- package/node_modules/prosemirror-menu/style/menu.css +0 -169
- package/node_modules/prosemirror-schema-basic/.tern-project +0 -8
- package/node_modules/prosemirror-schema-basic/CHANGELOG.md +0 -81
- package/node_modules/prosemirror-schema-basic/CONTRIBUTING.md +0 -100
- package/node_modules/prosemirror-schema-basic/LICENSE +0 -19
- package/node_modules/prosemirror-schema-basic/README.md +0 -28
- package/node_modules/prosemirror-schema-basic/dist/index.cjs +0 -246
- package/node_modules/prosemirror-schema-basic/dist/index.d.cts +0 -87
- package/node_modules/prosemirror-schema-basic/dist/index.d.ts +0 -87
- package/node_modules/prosemirror-schema-basic/dist/index.js +0 -183
- package/node_modules/prosemirror-schema-basic/package.json +0 -37
- package/node_modules/prosemirror-schema-basic/src/README.md +0 -8
- package/node_modules/prosemirror-schema-basic/src/schema-basic.ts +0 -166
- package/node_modules/prosemirror-trailing-node/LICENSE +0 -21
- package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.cts +0 -41
- package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.ts +0 -41
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.cjs +0 -70
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.cts +0 -2
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.ts +0 -2
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.js +0 -43
- package/node_modules/prosemirror-trailing-node/dist-types/index.d.ts +0 -2
- package/node_modules/prosemirror-trailing-node/dist-types/trailing-node-plugin.d.ts +0 -33
- package/node_modules/prosemirror-trailing-node/dist-types/tsconfig.tsbuildinfo +0 -1
- package/node_modules/prosemirror-trailing-node/package.json +0 -57
- package/node_modules/prosemirror-trailing-node/readme.md +0 -55
- package/node_modules/punycode.js/LICENSE-MIT.txt +0 -20
- package/node_modules/punycode.js/README.md +0 -148
- package/node_modules/punycode.js/package.json +0 -58
- package/node_modules/punycode.js/punycode.es6.js +0 -444
- package/node_modules/punycode.js/punycode.js +0 -443
- package/node_modules/uc.micro/LICENSE.txt +0 -20
- package/node_modules/uc.micro/README.md +0 -14
- package/node_modules/uc.micro/build/index.cjs.js +0 -20
- package/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
- package/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
- package/node_modules/uc.micro/categories/P/regex.mjs +0 -1
- package/node_modules/uc.micro/categories/S/regex.mjs +0 -1
- package/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
- package/node_modules/uc.micro/index.mjs +0 -8
- package/node_modules/uc.micro/package.json +0 -37
- package/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
- /package/dist/{SessionPluginConfigForm-DWLJEYBY.js.map → McpAppFrame-IQK5AOMD.js.map} +0 -0
- /package/dist/{chunk-FTBMG7TK.js.map → SessionPluginConfigForm-VXONUDM4.js.map} +0 -0
- /package/node_modules/@tiptap/pm/{LICENSE.md → LICENSE} +0 -0
|
@@ -0,0 +1,1404 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MarkdownContent
|
|
3
|
+
} from "./chunk-XCASYOA6.js";
|
|
4
|
+
import {
|
|
5
|
+
cn,
|
|
6
|
+
extractToolFilePath,
|
|
7
|
+
formatToolFileName,
|
|
8
|
+
formatToolName,
|
|
9
|
+
useHighlightedCode
|
|
10
|
+
} from "./chunk-34YJQXTM.js";
|
|
11
|
+
import {
|
|
12
|
+
useBladeClient,
|
|
13
|
+
useOptionalBladeClient
|
|
14
|
+
} from "./chunk-FR3ON5R4.js";
|
|
15
|
+
import {
|
|
16
|
+
dist_exports2 as dist_exports
|
|
17
|
+
} from "./chunk-63G66FWM.js";
|
|
18
|
+
import {
|
|
19
|
+
ChevronLeft,
|
|
20
|
+
ChevronRight,
|
|
21
|
+
CircleAlert,
|
|
22
|
+
CircleCheck,
|
|
23
|
+
Download,
|
|
24
|
+
Earth,
|
|
25
|
+
ExternalLink,
|
|
26
|
+
FileText,
|
|
27
|
+
Folder,
|
|
28
|
+
Minus,
|
|
29
|
+
Plus,
|
|
30
|
+
RotateCcw,
|
|
31
|
+
X
|
|
32
|
+
} from "./chunk-3KJJIH5K.js";
|
|
33
|
+
|
|
34
|
+
// src/components/MessageImage.tsx
|
|
35
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
36
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
var assetPattern = /^\/api\/(sessions|share)\/([^/]+)\/media\/([a-f0-9]{64})$/;
|
|
38
|
+
var MessageImage = forwardRef(function MessageImage2({ client: suppliedClient, src, original = false, alt, style, ...props }, ref) {
|
|
39
|
+
const contextClient = useOptionalBladeClient();
|
|
40
|
+
const client = suppliedClient ?? contextClient;
|
|
41
|
+
const element = useRef(null);
|
|
42
|
+
useImperativeHandle(ref, () => element.current);
|
|
43
|
+
const [visible, setVisible] = useState(false);
|
|
44
|
+
const [result, setResult] = useState(null);
|
|
45
|
+
const match = src?.match(assetPattern);
|
|
46
|
+
const scope = match?.[1];
|
|
47
|
+
const sessionId = match?.[2];
|
|
48
|
+
const assetId = match?.[3];
|
|
49
|
+
const identity = assetId && client ? client.buildAuthedUrl(src) : "";
|
|
50
|
+
const source = `${src}:${original}:${identity}`;
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const node = element.current;
|
|
53
|
+
if (!node || !assetId) return;
|
|
54
|
+
if (original || typeof IntersectionObserver === "undefined") {
|
|
55
|
+
setVisible(true);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const observer = new IntersectionObserver((entries) => {
|
|
59
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
60
|
+
setVisible(true);
|
|
61
|
+
observer.disconnect();
|
|
62
|
+
}
|
|
63
|
+
}, { rootMargin: "200px" });
|
|
64
|
+
observer.observe(node);
|
|
65
|
+
return () => observer.disconnect();
|
|
66
|
+
}, [assetId, original]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!visible || !client || !sessionId || !assetId) return;
|
|
69
|
+
let alive = true;
|
|
70
|
+
let objectUrl = null;
|
|
71
|
+
const pending = scope === "share" ? client.sessions.fetchSharedImage(sessionId, assetId, !original) : client.sessions.fetchImage(sessionId, assetId, !original);
|
|
72
|
+
void pending.then((blob) => {
|
|
73
|
+
if (!alive) return;
|
|
74
|
+
objectUrl = URL.createObjectURL(blob);
|
|
75
|
+
setResult({ source, client, url: objectUrl });
|
|
76
|
+
}).catch(() => {
|
|
77
|
+
if (alive) setResult({ source, client, url: null });
|
|
78
|
+
});
|
|
79
|
+
return () => {
|
|
80
|
+
alive = false;
|
|
81
|
+
if (objectUrl) URL.revokeObjectURL(objectUrl);
|
|
82
|
+
};
|
|
83
|
+
}, [visible, client, scope, sessionId, assetId, original, source]);
|
|
84
|
+
const current = result?.source === source && result.client === client ? result : null;
|
|
85
|
+
const imageStyle = { aspectRatio: props.width && props.height ? `${props.width}/${props.height}` : void 0, ...style };
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
"img",
|
|
88
|
+
{
|
|
89
|
+
...props,
|
|
90
|
+
ref: element,
|
|
91
|
+
src: assetId ? current?.url ?? void 0 : src,
|
|
92
|
+
alt: assetId && current?.url === null ? "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25" : alt,
|
|
93
|
+
loading: original ? "eager" : "lazy",
|
|
94
|
+
style: assetId && !current?.url && !props.height ? { minHeight: 64, ...imageStyle } : imageStyle
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// src/components/lazy-mcp-app-card.ts
|
|
100
|
+
import { lazy } from "react";
|
|
101
|
+
var McpAppCard = lazy(async () => ({
|
|
102
|
+
default: (await import("./McpAppCard-NJEKKEEN.js")).McpAppCard
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
// src/components/ToolUiCardView.tsx
|
|
106
|
+
import { resolveToolUiCardContent } from "@blade-hq/agent-client/internal";
|
|
107
|
+
import { Suspense, useEffect as useEffect2, useState as useState2 } from "react";
|
|
108
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
109
|
+
function ToolUiCardView({ card, sessionId }) {
|
|
110
|
+
if (card.mcpApp) return sessionId ? /* @__PURE__ */ jsx2(Suspense, { fallback: null, children: /* @__PURE__ */ jsx2(McpAppCard, { sessionId, sourceId: card.mcpApp.sourceId }) }) : null;
|
|
111
|
+
const resolved = resolveToolUiCardContent(card);
|
|
112
|
+
if (!resolved) return null;
|
|
113
|
+
if (resolved.type === "resource-file") {
|
|
114
|
+
return sessionId ? /* @__PURE__ */ jsx2(FileCard, { card, sessionId, path: resolved.content }, `${sessionId}:${resolved.content}`) : null;
|
|
115
|
+
}
|
|
116
|
+
const sandbox = resolved.type === "resource-uri" ? "allow-scripts allow-same-origin" : "allow-scripts";
|
|
117
|
+
return /* @__PURE__ */ jsx2(
|
|
118
|
+
"iframe",
|
|
119
|
+
{
|
|
120
|
+
title: card.title ?? "\u5DE5\u5177\u754C\u9762",
|
|
121
|
+
src: resolved.type === "resource-uri" ? resolved.content : void 0,
|
|
122
|
+
srcDoc: resolved.type === "resource-html" ? injectBaseTag(resolved.content) : void 0,
|
|
123
|
+
sandbox,
|
|
124
|
+
loading: "lazy",
|
|
125
|
+
scrolling: "no",
|
|
126
|
+
className: "w-full rounded-xl border border-[hsl(var(--border))] bg-white",
|
|
127
|
+
referrerPolicy: "no-referrer",
|
|
128
|
+
style: { height: card.height }
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function FileCard({ card, sessionId, path }) {
|
|
133
|
+
const client = useBladeClient();
|
|
134
|
+
const [html, setHtml] = useState2(null);
|
|
135
|
+
const [failed, setFailed] = useState2(false);
|
|
136
|
+
const [refreshVersion, setRefreshVersion] = useState2(0);
|
|
137
|
+
useEffect2(() => {
|
|
138
|
+
const abort = new AbortController();
|
|
139
|
+
setHtml(null);
|
|
140
|
+
setFailed(false);
|
|
141
|
+
void client.textFromInit(
|
|
142
|
+
`/api/sessions/${encodeURIComponent(sessionId)}/files/${encodeURIComponent(path)}`,
|
|
143
|
+
{ signal: abort.signal }
|
|
144
|
+
).then((content) => {
|
|
145
|
+
if (!abort.signal.aborted) setHtml(content);
|
|
146
|
+
}).catch(() => {
|
|
147
|
+
if (!abort.signal.aborted) setFailed(true);
|
|
148
|
+
});
|
|
149
|
+
return () => abort.abort();
|
|
150
|
+
}, [client, sessionId, path, refreshVersion]);
|
|
151
|
+
const filePath = path.split("/").map(encodeURIComponent).join("/").replace(/^\//, "%2F");
|
|
152
|
+
const baseUrl = new URL(
|
|
153
|
+
`api/sessions/${encodeURIComponent(sessionId)}/serve/${filePath}`,
|
|
154
|
+
`${client.options.baseUrl.replace(/\/$/, "")}/`
|
|
155
|
+
).href;
|
|
156
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
157
|
+
/* @__PURE__ */ jsx2("div", { className: "flex justify-end py-2", children: /* @__PURE__ */ jsx2(
|
|
158
|
+
"button",
|
|
159
|
+
{
|
|
160
|
+
type: "button",
|
|
161
|
+
disabled: html === null && !failed,
|
|
162
|
+
onClick: () => setRefreshVersion((value) => value + 1),
|
|
163
|
+
className: "rounded-md bg-[hsl(var(--primary))] px-3 py-1 text-sm text-[hsl(var(--primary-foreground))]",
|
|
164
|
+
children: "\u5237\u65B0"
|
|
165
|
+
}
|
|
166
|
+
) }),
|
|
167
|
+
failed ? /* @__PURE__ */ jsx2("p", { role: "alert", children: "\u65E0\u6CD5\u6253\u5F00\u6587\u4EF6\uFF0C\u6587\u4EF6\u53EF\u80FD\u5DF2\u79FB\u52A8\u6216\u5220\u9664\u3002" }) : html === null ? /* @__PURE__ */ jsx2("p", { children: "\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u2026" }) : /* @__PURE__ */ jsx2(
|
|
168
|
+
"iframe",
|
|
169
|
+
{
|
|
170
|
+
title: card.title ?? "\u6587\u4EF6\u9884\u89C8",
|
|
171
|
+
srcDoc: injectBaseTag(html, baseUrl),
|
|
172
|
+
sandbox: "allow-scripts",
|
|
173
|
+
loading: "lazy",
|
|
174
|
+
referrerPolicy: "no-referrer",
|
|
175
|
+
className: "w-full rounded-xl border border-[hsl(var(--border))] bg-white",
|
|
176
|
+
style: { height: card.height }
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
] });
|
|
180
|
+
}
|
|
181
|
+
function injectBaseTag(html, baseUrl = `${window.location.origin}/`) {
|
|
182
|
+
const base = `<base href="${baseUrl.replaceAll("&", "&").replaceAll('"', """)}">`;
|
|
183
|
+
const headIdx = html.toLowerCase().indexOf("<head");
|
|
184
|
+
if (headIdx >= 0) {
|
|
185
|
+
const closeIdx = html.indexOf(">", headIdx);
|
|
186
|
+
if (closeIdx >= 0) {
|
|
187
|
+
return `${html.slice(0, closeIdx + 1)}
|
|
188
|
+
${base}
|
|
189
|
+
${html.slice(closeIdx + 1)}`;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return `${base}
|
|
193
|
+
${html}`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/chat/lib/code-language.ts
|
|
197
|
+
var SUPPORTED_LANGUAGES = [
|
|
198
|
+
"python",
|
|
199
|
+
"javascript",
|
|
200
|
+
"typescript",
|
|
201
|
+
"tsx",
|
|
202
|
+
"jsx",
|
|
203
|
+
"yaml",
|
|
204
|
+
"markdown",
|
|
205
|
+
"bash",
|
|
206
|
+
"json",
|
|
207
|
+
"go",
|
|
208
|
+
"rust",
|
|
209
|
+
"css",
|
|
210
|
+
"html"
|
|
211
|
+
];
|
|
212
|
+
var LANGUAGE_ALIASES = {
|
|
213
|
+
bash: "bash",
|
|
214
|
+
css: "css",
|
|
215
|
+
go: "go",
|
|
216
|
+
golang: "go",
|
|
217
|
+
htm: "html",
|
|
218
|
+
html: "html",
|
|
219
|
+
javascript: "javascript",
|
|
220
|
+
js: "javascript",
|
|
221
|
+
json: "json",
|
|
222
|
+
jsonc: "json",
|
|
223
|
+
jsx: "jsx",
|
|
224
|
+
markdown: "markdown",
|
|
225
|
+
md: "markdown",
|
|
226
|
+
py: "python",
|
|
227
|
+
python: "python",
|
|
228
|
+
rs: "rust",
|
|
229
|
+
rust: "rust",
|
|
230
|
+
scss: "css",
|
|
231
|
+
sh: "bash",
|
|
232
|
+
shell: "bash",
|
|
233
|
+
ts: "typescript",
|
|
234
|
+
tsx: "tsx",
|
|
235
|
+
typescript: "typescript",
|
|
236
|
+
yaml: "yaml",
|
|
237
|
+
yml: "yaml",
|
|
238
|
+
zsh: "bash"
|
|
239
|
+
};
|
|
240
|
+
var FILE_EXTENSION_ALIASES = {
|
|
241
|
+
".bash": "bash",
|
|
242
|
+
".css": "css",
|
|
243
|
+
".go": "go",
|
|
244
|
+
".htm": "html",
|
|
245
|
+
".html": "html",
|
|
246
|
+
".js": "javascript",
|
|
247
|
+
".json": "json",
|
|
248
|
+
".jsonc": "json",
|
|
249
|
+
".jsx": "jsx",
|
|
250
|
+
".md": "markdown",
|
|
251
|
+
".mdx": "markdown",
|
|
252
|
+
".py": "python",
|
|
253
|
+
".rs": "rust",
|
|
254
|
+
".scss": "css",
|
|
255
|
+
".sh": "bash",
|
|
256
|
+
".ts": "typescript",
|
|
257
|
+
".tsx": "tsx",
|
|
258
|
+
".yaml": "yaml",
|
|
259
|
+
".yml": "yaml",
|
|
260
|
+
".zsh": "bash"
|
|
261
|
+
};
|
|
262
|
+
function normalizeCodeLanguage(language) {
|
|
263
|
+
if (!language) return null;
|
|
264
|
+
return LANGUAGE_ALIASES[language.trim().toLowerCase()] ?? null;
|
|
265
|
+
}
|
|
266
|
+
function getCodeLanguageFromFilename(filePath) {
|
|
267
|
+
if (!filePath) return null;
|
|
268
|
+
const dotIndex = filePath.lastIndexOf(".");
|
|
269
|
+
if (dotIndex < 0) return null;
|
|
270
|
+
return FILE_EXTENSION_ALIASES[filePath.slice(dotIndex).toLowerCase()] ?? null;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// src/chat/tool-renderers/shared.tsx
|
|
274
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
275
|
+
function getResultText(result) {
|
|
276
|
+
if (typeof result === "string") return result;
|
|
277
|
+
if (Array.isArray(result)) {
|
|
278
|
+
const texts = result.filter(
|
|
279
|
+
(p) => typeof p === "object" && p !== null && p.type === "text" && typeof p.text === "string"
|
|
280
|
+
).map((p) => p.text);
|
|
281
|
+
return texts.length > 0 ? texts.join("\n") : null;
|
|
282
|
+
}
|
|
283
|
+
return result != null ? String(result) : null;
|
|
284
|
+
}
|
|
285
|
+
function getResultImages(result) {
|
|
286
|
+
if (!Array.isArray(result)) return [];
|
|
287
|
+
return result.filter(
|
|
288
|
+
(p) => typeof p === "object" && p !== null && p.type === "image_url" && typeof p.image_url?.url === "string"
|
|
289
|
+
).map((p) => p.image_url);
|
|
290
|
+
}
|
|
291
|
+
function parseJsonValue(value) {
|
|
292
|
+
if (!value) return null;
|
|
293
|
+
try {
|
|
294
|
+
return JSON.parse(value);
|
|
295
|
+
} catch {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function isPlainObject(value) {
|
|
300
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
301
|
+
}
|
|
302
|
+
function getStringValue(data, key) {
|
|
303
|
+
const value = data?.[key];
|
|
304
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
305
|
+
}
|
|
306
|
+
function getNumberValue(data, key) {
|
|
307
|
+
const value = data?.[key];
|
|
308
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
309
|
+
}
|
|
310
|
+
function getBooleanValue(data, key) {
|
|
311
|
+
return data?.[key] === true;
|
|
312
|
+
}
|
|
313
|
+
function extractErrorMessage(value) {
|
|
314
|
+
const text = typeof value === "string" ? value : getResultText(value);
|
|
315
|
+
if (!text?.trim()) return null;
|
|
316
|
+
const parsed = parseJsonValue(text);
|
|
317
|
+
if (!isPlainObject(parsed)) return null;
|
|
318
|
+
return typeof parsed.error === "string" && parsed.error.trim() ? parsed.error.trim() : null;
|
|
319
|
+
}
|
|
320
|
+
function getFileName(filePath) {
|
|
321
|
+
if (!filePath) return "\u672A\u547D\u540D\u6587\u4EF6";
|
|
322
|
+
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
323
|
+
}
|
|
324
|
+
function getCodeLanguage(filePath) {
|
|
325
|
+
return getCodeLanguageFromFilename(filePath);
|
|
326
|
+
}
|
|
327
|
+
function formatBytes(size) {
|
|
328
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size < 0) return null;
|
|
329
|
+
if (size < 1024) return `${size} B`;
|
|
330
|
+
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`;
|
|
331
|
+
return `${(size / (1024 * 1024)).toFixed(1)} MB`;
|
|
332
|
+
}
|
|
333
|
+
function CodePreview({
|
|
334
|
+
content,
|
|
335
|
+
filePath,
|
|
336
|
+
emptyLabel = "\uFF08\u6682\u65E0\u5185\u5BB9\uFF09",
|
|
337
|
+
className
|
|
338
|
+
}) {
|
|
339
|
+
const { highlightedHtml } = useHighlightedCode(content, getCodeLanguage(filePath));
|
|
340
|
+
if (!content.trim()) {
|
|
341
|
+
return /* @__PURE__ */ jsx3(
|
|
342
|
+
"pre",
|
|
343
|
+
{
|
|
344
|
+
className: cn(
|
|
345
|
+
"overflow-auto rounded-lg border border-[hsl(var(--border))]",
|
|
346
|
+
"bg-[hsl(var(--muted))]/35 p-3 font-mono text-[11px] text-[hsl(var(--muted-foreground))]",
|
|
347
|
+
className
|
|
348
|
+
),
|
|
349
|
+
children: /* @__PURE__ */ jsx3("code", { children: emptyLabel })
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
return /* @__PURE__ */ jsx3(
|
|
354
|
+
"pre",
|
|
355
|
+
{
|
|
356
|
+
className: cn(
|
|
357
|
+
"overflow-auto rounded-lg border border-[hsl(var(--border))]",
|
|
358
|
+
"bg-[hsl(var(--muted))]/35 p-3 text-[11px]",
|
|
359
|
+
className
|
|
360
|
+
),
|
|
361
|
+
children: highlightedHtml ? /* @__PURE__ */ jsx3(
|
|
362
|
+
"code",
|
|
363
|
+
{
|
|
364
|
+
className: "font-mono",
|
|
365
|
+
dangerouslySetInnerHTML: { __html: highlightedHtml }
|
|
366
|
+
}
|
|
367
|
+
) : /* @__PURE__ */ jsx3("code", { className: "whitespace-pre-wrap break-words font-mono text-[hsl(var(--foreground))]", children: content })
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// src/chat/tool-renderers/BashRenderer.tsx
|
|
373
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
374
|
+
function pickOutputField(data) {
|
|
375
|
+
if (!data) return null;
|
|
376
|
+
for (const key of ["output", "stdout", "stderr"]) {
|
|
377
|
+
const value = data[key];
|
|
378
|
+
if (typeof value === "string") return value;
|
|
379
|
+
}
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
function MetaPill({ label }) {
|
|
383
|
+
return /* @__PURE__ */ jsx4("span", { className: "rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-secondary-foreground", children: label });
|
|
384
|
+
}
|
|
385
|
+
function BashRenderer({ toolCall }) {
|
|
386
|
+
const argsValue = parseJsonValue(toolCall.arguments);
|
|
387
|
+
const rawText = getResultText(toolCall.result);
|
|
388
|
+
const resultStr = typeof rawText === "string" && rawText.trim().length > 0 ? rawText : null;
|
|
389
|
+
const resultValue = parseJsonValue(resultStr);
|
|
390
|
+
const args = isPlainObject(argsValue) ? argsValue : null;
|
|
391
|
+
const result = isPlainObject(resultValue) ? resultValue : null;
|
|
392
|
+
const normalizedName = formatToolName(toolCall.name);
|
|
393
|
+
const command = getStringValue(result, "command") ?? getStringValue(args, "command") ?? "";
|
|
394
|
+
const taskId = getStringValue(result, "task_id");
|
|
395
|
+
const exitCode = getNumberValue(result, "exit_code");
|
|
396
|
+
const timedOut = getBooleanValue(result, "timed_out");
|
|
397
|
+
const truncated = getBooleanValue(result, "truncated");
|
|
398
|
+
const cwdResetNote = getStringValue(result, "cwd_reset_note");
|
|
399
|
+
const errorMessage = extractErrorMessage(toolCall.result) ?? (toolCall.status === "error" ? resultStr?.trim() ?? null : null);
|
|
400
|
+
const structuredOutput = pickOutputField(result);
|
|
401
|
+
const rawFallbackOutput = result === null && typeof resultStr === "string" && resultStr.trim().length > 0 ? resultStr : null;
|
|
402
|
+
const output = structuredOutput !== null ? structuredOutput : errorMessage ?? rawFallbackOutput ?? (normalizedName === "BgBash" ? "" : null);
|
|
403
|
+
const hasFailure = toolCall.status === "error" || timedOut || exitCode !== null && exitCode !== 0;
|
|
404
|
+
return /* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
|
|
405
|
+
/* @__PURE__ */ jsxs2("div", { className: "overflow-hidden rounded-lg border border-border bg-card", children: [
|
|
406
|
+
/* @__PURE__ */ jsx4("div", { className: "border-b border-border px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u547D\u4EE4" }),
|
|
407
|
+
/* @__PURE__ */ jsx4("pre", { className: "overflow-x-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx4("code", { children: `$ ${command || "\uFF08\u672A\u63D0\u4F9B\u547D\u4EE4\uFF09"}` }) })
|
|
408
|
+
] }),
|
|
409
|
+
/* @__PURE__ */ jsxs2(
|
|
410
|
+
"div",
|
|
411
|
+
{
|
|
412
|
+
className: cn(
|
|
413
|
+
"overflow-hidden rounded-lg border bg-muted/50",
|
|
414
|
+
hasFailure ? "border-[hsl(var(--swf-danger)/0.5)]" : "border-border"
|
|
415
|
+
),
|
|
416
|
+
children: [
|
|
417
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
|
|
418
|
+
/* @__PURE__ */ jsx4("div", { className: "text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u8F93\u51FA" }),
|
|
419
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
420
|
+
taskId ? /* @__PURE__ */ jsx4(MetaPill, { label: `\u4EFB\u52A1 ${taskId}` }) : null,
|
|
421
|
+
exitCode !== null ? /* @__PURE__ */ jsx4(MetaPill, { label: `\u9000\u51FA\u7801 ${exitCode}` }) : null,
|
|
422
|
+
timedOut ? /* @__PURE__ */ jsx4(MetaPill, { label: "\u5DF2\u8D85\u65F6" }) : null,
|
|
423
|
+
truncated ? /* @__PURE__ */ jsx4(MetaPill, { label: "\u8F93\u51FA\u5DF2\u622A\u65AD" }) : null,
|
|
424
|
+
normalizedName === "BgBash" && !taskId ? /* @__PURE__ */ jsx4(MetaPill, { label: "\u540E\u53F0\u4EFB\u52A1" }) : null
|
|
425
|
+
] })
|
|
426
|
+
] }),
|
|
427
|
+
/* @__PURE__ */ jsx4("pre", { className: "max-h-[280px] overflow-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx4("code", { className: "whitespace-pre-wrap break-words", children: output !== null && output.trim().length > 0 ? output : normalizedName === "BgBash" ? "\u4EFB\u52A1\u5DF2\u8FDB\u5165\u540E\u53F0\u6267\u884C\uFF0C\u8F93\u51FA\u4F1A\u5728\u540E\u53F0\u4EFB\u52A1\u9762\u677F\u4E2D\u7EE7\u7EED\u66F4\u65B0\u3002" : output !== null && output.trim().length === 0 && hasFailure ? "\u547D\u4EE4\u5DF2\u7ED3\u675F\uFF0C\u4F46\u672A\u6355\u83B7\u5230\u7EC8\u7AEF\u8F93\u51FA\uFF08\u8BF7\u67E5\u770B\u9000\u51FA\u7801\uFF09\u3002" : "\u547D\u4EE4\u672A\u8FD4\u56DE\u8F93\u51FA\u3002" }) })
|
|
428
|
+
]
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
cwdResetNote ? /* @__PURE__ */ jsx4("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: cwdResetNote }) : null
|
|
432
|
+
] });
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/chat/tool-renderers/write-preview-scroll.ts
|
|
436
|
+
function shouldFollowWritePreview(toolName, status) {
|
|
437
|
+
return toolName === "Write" && status === "pending";
|
|
438
|
+
}
|
|
439
|
+
function scrollWritePreviewToLatest(preview) {
|
|
440
|
+
preview.scrollTop = preview.scrollHeight;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// src/chat/tool-renderers/FileEditRenderer.tsx
|
|
444
|
+
import { useLayoutEffect, useRef as useRef2 } from "react";
|
|
445
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
446
|
+
var MAX_DIFF_LINES = 200;
|
|
447
|
+
var FILE_PATH_FIELDS = ["file_path", "path"];
|
|
448
|
+
var PATH_SEPARATOR = String.raw`[/\\]`;
|
|
449
|
+
var PATH_WORD = String.raw`(?:[^\s/\\::"'“”‘’<>,,。;;!?!?()[\]{}=]|['’](?=[^\s/\\::"'“”‘’]))+`;
|
|
450
|
+
var PATH_PART = `${PATH_WORD}(?:[ \\t]+${PATH_WORD})*`;
|
|
451
|
+
var ERROR_PATH = new RegExp(
|
|
452
|
+
[
|
|
453
|
+
String.raw`(^|[\s::"'“”‘’<>,,。;;!?!?()[\]{}=])`,
|
|
454
|
+
// Keep the syscall name when its argument is a relative path with spaces.
|
|
455
|
+
String.raw`((?:(?:open|stat|lstat|mkdir|remove|unlink|rename|readlink)[ \t]+)?)`,
|
|
456
|
+
`((?:(?:[A-Za-z]:|~)?${PATH_SEPARATOR}{1,2}(?:${PATH_PART}${PATH_SEPARATOR})*|(?:${PATH_PART}${PATH_SEPARATOR})+)${PATH_PART})`
|
|
457
|
+
].join(""),
|
|
458
|
+
"g"
|
|
459
|
+
);
|
|
460
|
+
function hideErrorPathDirectories(message) {
|
|
461
|
+
return message.replace(
|
|
462
|
+
ERROR_PATH,
|
|
463
|
+
(_match, boundary, action, path) => `${boundary}${action}${getFileName(path)}`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
function computeDiff(oldText, newText) {
|
|
467
|
+
const oldLines = oldText.split("\n");
|
|
468
|
+
const newLines = newText.split("\n");
|
|
469
|
+
if (oldLines.length > MAX_DIFF_LINES || newLines.length > MAX_DIFF_LINES) {
|
|
470
|
+
return [
|
|
471
|
+
...oldLines.slice(0, MAX_DIFF_LINES).map((line) => ({
|
|
472
|
+
type: "removed",
|
|
473
|
+
value: line,
|
|
474
|
+
line: null
|
|
475
|
+
})),
|
|
476
|
+
...newLines.slice(0, MAX_DIFF_LINES).map((line, i) => ({
|
|
477
|
+
type: "added",
|
|
478
|
+
value: line,
|
|
479
|
+
line: i + 1
|
|
480
|
+
}))
|
|
481
|
+
];
|
|
482
|
+
}
|
|
483
|
+
const rows = oldLines.length;
|
|
484
|
+
const cols = newLines.length;
|
|
485
|
+
const lcs = Array.from({ length: rows + 1 }, () => Array(cols + 1).fill(0));
|
|
486
|
+
for (let row2 = 1; row2 <= rows; row2 += 1) {
|
|
487
|
+
for (let col2 = 1; col2 <= cols; col2 += 1) {
|
|
488
|
+
lcs[row2][col2] = oldLines[row2 - 1] === newLines[col2 - 1] ? lcs[row2 - 1][col2 - 1] + 1 : Math.max(lcs[row2 - 1][col2], lcs[row2][col2 - 1]);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const diff = [];
|
|
492
|
+
let row = rows;
|
|
493
|
+
let col = cols;
|
|
494
|
+
while (row > 0 || col > 0) {
|
|
495
|
+
if (row > 0 && col > 0 && oldLines[row - 1] === newLines[col - 1]) {
|
|
496
|
+
diff.push({ type: "unchanged", value: oldLines[row - 1] });
|
|
497
|
+
row -= 1;
|
|
498
|
+
col -= 1;
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
if (col > 0 && (row === 0 || lcs[row][col - 1] >= lcs[row - 1][col])) {
|
|
502
|
+
diff.push({ type: "added", value: newLines[col - 1] });
|
|
503
|
+
col -= 1;
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
if (row > 0) {
|
|
507
|
+
diff.push({ type: "removed", value: oldLines[row - 1] });
|
|
508
|
+
row -= 1;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const numbered = [];
|
|
512
|
+
let lineNumber = 0;
|
|
513
|
+
for (const line of diff.reverse()) {
|
|
514
|
+
if (line.type === "removed") {
|
|
515
|
+
numbered.push({ ...line, line: null });
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
lineNumber += 1;
|
|
519
|
+
numbered.push({ ...line, line: lineNumber });
|
|
520
|
+
}
|
|
521
|
+
return numbered;
|
|
522
|
+
}
|
|
523
|
+
function buildWritePreview(content) {
|
|
524
|
+
return content.split("\n").map((line, index) => ({
|
|
525
|
+
type: "added",
|
|
526
|
+
value: line,
|
|
527
|
+
line: index + 1
|
|
528
|
+
}));
|
|
529
|
+
}
|
|
530
|
+
function buildEditPreview(args, rawArguments) {
|
|
531
|
+
const edits = Array.isArray(args?.edits) ? args.edits : null;
|
|
532
|
+
if (edits) {
|
|
533
|
+
return edits.flatMap((rawEdit, index) => {
|
|
534
|
+
if (!isPlainObject(rawEdit)) {
|
|
535
|
+
return [];
|
|
536
|
+
}
|
|
537
|
+
const oldText = getStringValue(rawEdit, "old_text") ?? "";
|
|
538
|
+
const newText = getStringValue(rawEdit, "new_text") ?? "";
|
|
539
|
+
const lines = computeDiff(oldText, newText);
|
|
540
|
+
return index === 0 ? lines : [
|
|
541
|
+
{ type: "unchanged", value: "", line: null },
|
|
542
|
+
...lines
|
|
543
|
+
];
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
const oldString = getStringValue(args, "old_string") ?? "";
|
|
547
|
+
const newString = getStringValue(args, "new_string") ?? "";
|
|
548
|
+
if (!oldString && !newString && !args) {
|
|
549
|
+
return buildPartialEditPreview(rawArguments);
|
|
550
|
+
}
|
|
551
|
+
return computeDiff(oldString, newString);
|
|
552
|
+
}
|
|
553
|
+
function buildPartialEditPreview(rawArguments) {
|
|
554
|
+
const oldValues = extractAllJsonStringFieldPartials(rawArguments, "old_text");
|
|
555
|
+
const newValues = extractAllJsonStringFieldPartials(rawArguments, "new_text");
|
|
556
|
+
if (!oldValues.length && !newValues.length) return [];
|
|
557
|
+
const rows = [];
|
|
558
|
+
for (let index = 0; index < Math.max(oldValues.length, newValues.length); index += 1) {
|
|
559
|
+
if (index > 0) {
|
|
560
|
+
rows.push({ type: "unchanged", value: "", line: null });
|
|
561
|
+
}
|
|
562
|
+
const oldText = oldValues[index] ?? "";
|
|
563
|
+
const newText = newValues[index] ?? "";
|
|
564
|
+
rows.push(...computeDiff(oldText, newText));
|
|
565
|
+
}
|
|
566
|
+
return rows;
|
|
567
|
+
}
|
|
568
|
+
function extractChecksum(result) {
|
|
569
|
+
const text = typeof result === "string" ? result : null;
|
|
570
|
+
const match = text?.match(/\[checksum:\s*([^\]]+)\]/);
|
|
571
|
+
return match?.[1]?.trim() ?? null;
|
|
572
|
+
}
|
|
573
|
+
function getRawStringValue(data, key) {
|
|
574
|
+
const value = data?.[key];
|
|
575
|
+
return typeof value === "string" ? value : null;
|
|
576
|
+
}
|
|
577
|
+
function extractJsonStringFieldPartial(raw, names) {
|
|
578
|
+
for (const name of names) {
|
|
579
|
+
const values = extractAllJsonStringFieldPartials(raw, name);
|
|
580
|
+
if (values.length > 0) return values[values.length - 1] ?? "";
|
|
581
|
+
}
|
|
582
|
+
return "";
|
|
583
|
+
}
|
|
584
|
+
function extractAllJsonStringFieldPartials(raw, name) {
|
|
585
|
+
return extractAllJsonStringFields(raw, name, false);
|
|
586
|
+
}
|
|
587
|
+
function extractAllJsonStringFields(raw, name, requireClosed) {
|
|
588
|
+
const marker = `"${name}"`;
|
|
589
|
+
const values = [];
|
|
590
|
+
let searchFrom = 0;
|
|
591
|
+
while (true) {
|
|
592
|
+
const markerIndex = raw.indexOf(marker, searchFrom);
|
|
593
|
+
if (markerIndex < 0) return values;
|
|
594
|
+
const colonIndex = raw.indexOf(":", markerIndex + marker.length);
|
|
595
|
+
if (colonIndex < 0) return values;
|
|
596
|
+
const quoteIndex = raw.indexOf('"', colonIndex + 1);
|
|
597
|
+
if (quoteIndex < 0) return values;
|
|
598
|
+
const { value, closed } = readJsonString(raw, quoteIndex + 1);
|
|
599
|
+
if (closed || !requireClosed) {
|
|
600
|
+
values.push(value);
|
|
601
|
+
}
|
|
602
|
+
searchFrom = quoteIndex + 1;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function readJsonString(raw, start) {
|
|
606
|
+
const chars = [];
|
|
607
|
+
let index = start;
|
|
608
|
+
while (index < raw.length) {
|
|
609
|
+
const char = raw[index];
|
|
610
|
+
if (char === '"') {
|
|
611
|
+
return { value: chars.join(""), closed: true };
|
|
612
|
+
}
|
|
613
|
+
if (char !== "\\") {
|
|
614
|
+
chars.push(char);
|
|
615
|
+
index += 1;
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
if (index + 1 >= raw.length) {
|
|
619
|
+
return { value: chars.join(""), closed: false };
|
|
620
|
+
}
|
|
621
|
+
const escaped = raw[index + 1];
|
|
622
|
+
if (escaped === "n") {
|
|
623
|
+
chars.push("\n");
|
|
624
|
+
} else if (escaped === "r") {
|
|
625
|
+
chars.push("\r");
|
|
626
|
+
} else if (escaped === "t") {
|
|
627
|
+
chars.push(" ");
|
|
628
|
+
} else if (escaped === '"' || escaped === "\\" || escaped === "/") {
|
|
629
|
+
chars.push(escaped);
|
|
630
|
+
} else if (escaped === "u" && index + 5 < raw.length) {
|
|
631
|
+
const code = raw.slice(index + 2, index + 6);
|
|
632
|
+
const parsed = Number.parseInt(code, 16);
|
|
633
|
+
if (Number.isFinite(parsed)) {
|
|
634
|
+
chars.push(String.fromCharCode(parsed));
|
|
635
|
+
}
|
|
636
|
+
index += 4;
|
|
637
|
+
} else {
|
|
638
|
+
chars.push(escaped ?? "");
|
|
639
|
+
}
|
|
640
|
+
index += 2;
|
|
641
|
+
}
|
|
642
|
+
return { value: chars.join(""), closed: false };
|
|
643
|
+
}
|
|
644
|
+
function FileEditRenderer({ toolCall }) {
|
|
645
|
+
const previewRef = useRef2(null);
|
|
646
|
+
const rawArguments = toolCall.arguments ?? "";
|
|
647
|
+
const argsValue = parseJsonValue(toolCall.arguments);
|
|
648
|
+
const args = isPlainObject(argsValue) ? argsValue : null;
|
|
649
|
+
const normalizedName = formatToolName(toolCall.name);
|
|
650
|
+
const partialFilePath = extractJsonStringFieldPartial(rawArguments, FILE_PATH_FIELDS);
|
|
651
|
+
const filePath = extractToolFilePath(toolCall) ?? partialFilePath;
|
|
652
|
+
const fileName = getFileName(filePath);
|
|
653
|
+
const errorMessage = extractErrorMessage(toolCall.result);
|
|
654
|
+
const displayErrorMessage = errorMessage ? hideErrorPathDirectories(errorMessage) : toolCall.status === "error" ? "\u6587\u4EF6\u64CD\u4F5C\u5931\u8D25" : null;
|
|
655
|
+
const checksum = extractChecksum(toolCall.result);
|
|
656
|
+
const description = getStringValue(args, "description") ?? extractJsonStringFieldPartial(rawArguments, ["description"]);
|
|
657
|
+
const writeContent = getRawStringValue(args, "content") ?? extractJsonStringFieldPartial(rawArguments, ["content"]);
|
|
658
|
+
const diffLines = normalizedName === "Write" ? buildWritePreview(writeContent) : buildEditPreview(args, rawArguments);
|
|
659
|
+
const resultStr = typeof toolCall.result === "string" ? toolCall.result : null;
|
|
660
|
+
const summaryText = resultStr?.trim() && !errorMessage ? resultStr.trim() : null;
|
|
661
|
+
const displaySummaryText = summaryText && toolCall.status !== "error" && toolCall.status !== "cancelled" ? normalizedName === "Write" ? "\u6587\u4EF6\u5DF2\u5199\u5165" : "\u6587\u4EF6\u5DF2\u66F4\u65B0" : null;
|
|
662
|
+
const followLatest = shouldFollowWritePreview(normalizedName, toolCall.status);
|
|
663
|
+
useLayoutEffect(() => {
|
|
664
|
+
const preview = previewRef.current;
|
|
665
|
+
if (!preview || !followLatest || writeContent.length === 0) return;
|
|
666
|
+
scrollWritePreviewToLatest(preview);
|
|
667
|
+
}, [followLatest, writeContent]);
|
|
668
|
+
return /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
|
|
669
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-start justify-between gap-3", children: [
|
|
670
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
|
|
671
|
+
/* @__PURE__ */ jsx5("div", { className: "text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5199\u5165\u6587\u4EF6" : "\u7F16\u8F91\u6587\u4EF6" }),
|
|
672
|
+
/* @__PURE__ */ jsx5("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: fileName })
|
|
673
|
+
] }),
|
|
674
|
+
checksum ? /* @__PURE__ */ jsx5("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
675
|
+
] }),
|
|
676
|
+
description ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
677
|
+
displayErrorMessage ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: displayErrorMessage }) : null,
|
|
678
|
+
/* @__PURE__ */ jsxs3("div", { className: "file-edit-preview overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20", children: [
|
|
679
|
+
/* @__PURE__ */ jsx5("div", { className: "border-b border-[hsl(var(--border))] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5185\u5BB9\u9884\u89C8" : "\u53D8\u66F4\u9884\u89C8" }),
|
|
680
|
+
/* @__PURE__ */ jsx5(
|
|
681
|
+
"pre",
|
|
682
|
+
{
|
|
683
|
+
ref: previewRef,
|
|
684
|
+
className: "max-h-[320px] overflow-auto p-0 font-mono text-[11px] leading-5",
|
|
685
|
+
children: diffLines.length > 0 ? diffLines.map((line, index) => {
|
|
686
|
+
const prefix = line.type === "added" ? "+ " : line.type === "removed" ? "- " : " ";
|
|
687
|
+
return /* @__PURE__ */ jsxs3(
|
|
688
|
+
"div",
|
|
689
|
+
{
|
|
690
|
+
className: cn(
|
|
691
|
+
"grid grid-cols-[2.25rem_minmax(0,1fr)] gap-0 px-2",
|
|
692
|
+
line.type === "added" && "bg-[hsl(var(--swf-success-soft))] text-[hsl(var(--swf-success))]",
|
|
693
|
+
line.type === "removed" && "bg-[hsl(var(--swf-danger-soft))] text-[hsl(var(--swf-danger))]",
|
|
694
|
+
line.type === "unchanged" && "text-[hsl(var(--foreground))]"
|
|
695
|
+
),
|
|
696
|
+
children: [
|
|
697
|
+
/* @__PURE__ */ jsx5("span", { className: "select-none py-0.5 text-right text-[10px] text-[hsl(var(--muted-foreground))]", children: line.line ?? "" }),
|
|
698
|
+
/* @__PURE__ */ jsxs3("span", { className: "min-w-0 whitespace-pre-wrap break-words py-0.5", children: [
|
|
699
|
+
prefix,
|
|
700
|
+
line.value
|
|
701
|
+
] })
|
|
702
|
+
]
|
|
703
|
+
},
|
|
704
|
+
`${line.type}-${line.line}-${index}`
|
|
705
|
+
);
|
|
706
|
+
}) : /* @__PURE__ */ jsx5("div", { className: "px-3 py-4 text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u672A\u68C0\u6D4B\u5230\u53EF\u9884\u89C8\u7684\u53D8\u66F4\u3002" })
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
] }),
|
|
710
|
+
displaySummaryText ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: displaySummaryText }) : null
|
|
711
|
+
] });
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/chat/ImageLightbox.tsx
|
|
715
|
+
import { useCallback, useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
716
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
717
|
+
function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
718
|
+
const [currentIndex, setCurrentIndex] = useState3(initialIndex);
|
|
719
|
+
const [scale, setScale] = useState3(1);
|
|
720
|
+
const [translate, setTranslate] = useState3({ x: 0, y: 0 });
|
|
721
|
+
const dragging = useRef3(false);
|
|
722
|
+
const dragStart = useRef3({ x: 0, y: 0 });
|
|
723
|
+
const translateStart = useRef3({ x: 0, y: 0 });
|
|
724
|
+
const imgRef = useRef3(null);
|
|
725
|
+
const [loadedSource, setLoadedSource] = useState3(null);
|
|
726
|
+
const reset = useCallback(() => {
|
|
727
|
+
setScale(1);
|
|
728
|
+
setTranslate({ x: 0, y: 0 });
|
|
729
|
+
}, []);
|
|
730
|
+
const close = useCallback(() => {
|
|
731
|
+
reset();
|
|
732
|
+
onOpenChange(false);
|
|
733
|
+
}, [onOpenChange, reset]);
|
|
734
|
+
const zoomIn = useCallback(() => setScale((s) => Math.min(s + 0.5, 5)), []);
|
|
735
|
+
const zoomOut = useCallback(() => setScale((s) => Math.max(s - 0.5, 0.5)), []);
|
|
736
|
+
const goPrev = useCallback(() => {
|
|
737
|
+
setLoadedSource(null);
|
|
738
|
+
setCurrentIndex((i) => Math.max(0, i - 1));
|
|
739
|
+
reset();
|
|
740
|
+
}, [reset]);
|
|
741
|
+
const goNext = useCallback(() => {
|
|
742
|
+
setLoadedSource(null);
|
|
743
|
+
setCurrentIndex((i) => Math.min(images.length - 1, i + 1));
|
|
744
|
+
reset();
|
|
745
|
+
}, [images.length, reset]);
|
|
746
|
+
const prevOpenRef = useRef3(false);
|
|
747
|
+
useEffect3(() => {
|
|
748
|
+
if (open && !prevOpenRef.current) {
|
|
749
|
+
setLoadedSource(null);
|
|
750
|
+
setCurrentIndex(initialIndex);
|
|
751
|
+
reset();
|
|
752
|
+
}
|
|
753
|
+
prevOpenRef.current = open;
|
|
754
|
+
}, [open, initialIndex, reset]);
|
|
755
|
+
const handleWheel = useCallback((e) => {
|
|
756
|
+
e.preventDefault();
|
|
757
|
+
setScale((s) => {
|
|
758
|
+
const delta = e.deltaY > 0 ? -0.2 : 0.2;
|
|
759
|
+
return Math.min(Math.max(s + delta, 0.5), 5);
|
|
760
|
+
});
|
|
761
|
+
}, []);
|
|
762
|
+
const handleMouseDown = useCallback(
|
|
763
|
+
(e) => {
|
|
764
|
+
if (scale <= 1) return;
|
|
765
|
+
e.preventDefault();
|
|
766
|
+
dragging.current = true;
|
|
767
|
+
dragStart.current = { x: e.clientX, y: e.clientY };
|
|
768
|
+
translateStart.current = { ...translate };
|
|
769
|
+
},
|
|
770
|
+
[scale, translate]
|
|
771
|
+
);
|
|
772
|
+
const handleMouseMove = useCallback((e) => {
|
|
773
|
+
if (!dragging.current) return;
|
|
774
|
+
setTranslate({
|
|
775
|
+
x: translateStart.current.x + e.clientX - dragStart.current.x,
|
|
776
|
+
y: translateStart.current.y + e.clientY - dragStart.current.y
|
|
777
|
+
});
|
|
778
|
+
}, []);
|
|
779
|
+
const handleMouseUp = useCallback(() => {
|
|
780
|
+
dragging.current = false;
|
|
781
|
+
}, []);
|
|
782
|
+
const handleDoubleClick = useCallback(() => {
|
|
783
|
+
reset();
|
|
784
|
+
}, [reset]);
|
|
785
|
+
const handleAreaClick = useCallback(
|
|
786
|
+
(e) => {
|
|
787
|
+
if (imgRef.current && !imgRef.current.contains(e.target)) {
|
|
788
|
+
close();
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
[close]
|
|
792
|
+
);
|
|
793
|
+
const handleDownload = useCallback(() => {
|
|
794
|
+
const img = images[currentIndex] ?? images[0];
|
|
795
|
+
const source = imgRef.current?.getAttribute("src");
|
|
796
|
+
if (!img || !source) return;
|
|
797
|
+
const a = document.createElement("a");
|
|
798
|
+
a.href = source;
|
|
799
|
+
a.download = img.alt || "image.png";
|
|
800
|
+
a.click();
|
|
801
|
+
}, [images, currentIndex]);
|
|
802
|
+
const handleOpenInNewTab = useCallback(() => {
|
|
803
|
+
const source = imgRef.current?.getAttribute("src");
|
|
804
|
+
if (source) window.open(source, "_blank", "noopener,noreferrer");
|
|
805
|
+
}, []);
|
|
806
|
+
if (!open) return null;
|
|
807
|
+
if (images.length === 0) {
|
|
808
|
+
return /* @__PURE__ */ jsxs4(
|
|
809
|
+
LightboxDialog,
|
|
810
|
+
{
|
|
811
|
+
onClose: close,
|
|
812
|
+
className: "fixed inset-0 z-50 flex animate-in items-center justify-center bg-black/80 fade-in-0 duration-(--motion-duration-fast)",
|
|
813
|
+
onClick: close,
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ jsx6(
|
|
816
|
+
"button",
|
|
817
|
+
{
|
|
818
|
+
type: "button",
|
|
819
|
+
onClick: close,
|
|
820
|
+
"aria-label": "\u5173\u95ED\u56FE\u7247\u9884\u89C8",
|
|
821
|
+
className: "absolute right-4 top-4 z-10 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
822
|
+
children: /* @__PURE__ */ jsx6(X, { size: 20 })
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm text-white/60", children: "\u52A0\u8F7D\u4E2D..." })
|
|
826
|
+
]
|
|
827
|
+
}
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
const current = images[currentIndex] ?? images[0];
|
|
831
|
+
const showNav = images.length > 1;
|
|
832
|
+
return /* @__PURE__ */ jsxs4(
|
|
833
|
+
LightboxDialog,
|
|
834
|
+
{
|
|
835
|
+
onClose: close,
|
|
836
|
+
onKeyDown: (event) => {
|
|
837
|
+
if (images.length > 1) {
|
|
838
|
+
if (event.key === "ArrowLeft") goPrev();
|
|
839
|
+
if (event.key === "ArrowRight") goNext();
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
className: "fixed inset-0 z-50 animate-in bg-black/80 fade-in-0 duration-(--motion-duration-fast)",
|
|
843
|
+
onClick: handleAreaClick,
|
|
844
|
+
children: [
|
|
845
|
+
/* @__PURE__ */ jsxs4(
|
|
846
|
+
"div",
|
|
847
|
+
{
|
|
848
|
+
className: "absolute right-4 top-4 z-10 flex items-center gap-1.5",
|
|
849
|
+
onClick: (e) => e.stopPropagation(),
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ jsx6(
|
|
852
|
+
"button",
|
|
853
|
+
{
|
|
854
|
+
type: "button",
|
|
855
|
+
onClick: handleDownload,
|
|
856
|
+
disabled: loadedSource !== current.src,
|
|
857
|
+
title: loadedSource === current.src ? "\u4E0B\u8F7D\u56FE\u7247" : "\u539F\u56FE\u52A0\u8F7D\u4E2D",
|
|
858
|
+
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
859
|
+
children: /* @__PURE__ */ jsx6(Download, { size: 18 })
|
|
860
|
+
}
|
|
861
|
+
),
|
|
862
|
+
/* @__PURE__ */ jsx6(
|
|
863
|
+
"button",
|
|
864
|
+
{
|
|
865
|
+
type: "button",
|
|
866
|
+
onClick: handleOpenInNewTab,
|
|
867
|
+
disabled: loadedSource !== current.src,
|
|
868
|
+
title: loadedSource === current.src ? "\u65B0\u6807\u7B7E\u9875\u6253\u5F00" : "\u539F\u56FE\u52A0\u8F7D\u4E2D",
|
|
869
|
+
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
870
|
+
children: /* @__PURE__ */ jsx6(ExternalLink, { size: 18 })
|
|
871
|
+
}
|
|
872
|
+
),
|
|
873
|
+
/* @__PURE__ */ jsx6(
|
|
874
|
+
"button",
|
|
875
|
+
{
|
|
876
|
+
type: "button",
|
|
877
|
+
onClick: close,
|
|
878
|
+
"aria-label": "\u5173\u95ED\u56FE\u7247\u9884\u89C8",
|
|
879
|
+
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
880
|
+
children: /* @__PURE__ */ jsx6(X, { size: 20 })
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
showNav && currentIndex > 0 && /* @__PURE__ */ jsx6(
|
|
887
|
+
"button",
|
|
888
|
+
{
|
|
889
|
+
type: "button",
|
|
890
|
+
onClick: (e) => {
|
|
891
|
+
e.stopPropagation();
|
|
892
|
+
goPrev();
|
|
893
|
+
},
|
|
894
|
+
className: "absolute left-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
895
|
+
children: /* @__PURE__ */ jsx6(ChevronLeft, { size: 24 })
|
|
896
|
+
}
|
|
897
|
+
),
|
|
898
|
+
showNav && currentIndex < images.length - 1 && /* @__PURE__ */ jsx6(
|
|
899
|
+
"button",
|
|
900
|
+
{
|
|
901
|
+
type: "button",
|
|
902
|
+
onClick: (e) => {
|
|
903
|
+
e.stopPropagation();
|
|
904
|
+
goNext();
|
|
905
|
+
},
|
|
906
|
+
className: "absolute right-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
907
|
+
children: /* @__PURE__ */ jsx6(ChevronRight, { size: 24 })
|
|
908
|
+
}
|
|
909
|
+
),
|
|
910
|
+
/* @__PURE__ */ jsxs4("div", { className: "absolute bottom-6 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-full bg-black/50 px-2 py-1", onClick: (event) => event.stopPropagation(), children: [
|
|
911
|
+
/* @__PURE__ */ jsx6(
|
|
912
|
+
"button",
|
|
913
|
+
{
|
|
914
|
+
type: "button",
|
|
915
|
+
onClick: zoomOut,
|
|
916
|
+
"aria-label": "\u7F29\u5C0F\u56FE\u7247",
|
|
917
|
+
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
918
|
+
children: /* @__PURE__ */ jsx6(Minus, { size: 16 })
|
|
919
|
+
}
|
|
920
|
+
),
|
|
921
|
+
/* @__PURE__ */ jsxs4("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
922
|
+
Math.round(scale * 100),
|
|
923
|
+
"%"
|
|
924
|
+
] }),
|
|
925
|
+
/* @__PURE__ */ jsx6(
|
|
926
|
+
"button",
|
|
927
|
+
{
|
|
928
|
+
type: "button",
|
|
929
|
+
onClick: zoomIn,
|
|
930
|
+
"aria-label": "\u653E\u5927\u56FE\u7247",
|
|
931
|
+
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
932
|
+
children: /* @__PURE__ */ jsx6(Plus, { size: 16 })
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
/* @__PURE__ */ jsx6(
|
|
936
|
+
"button",
|
|
937
|
+
{
|
|
938
|
+
type: "button",
|
|
939
|
+
onClick: reset,
|
|
940
|
+
"aria-label": "\u6062\u590D\u56FE\u7247\u5927\u5C0F",
|
|
941
|
+
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
942
|
+
children: /* @__PURE__ */ jsx6(RotateCcw, { size: 16 })
|
|
943
|
+
}
|
|
944
|
+
),
|
|
945
|
+
showNav && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
946
|
+
/* @__PURE__ */ jsx6("div", { className: "mx-1 h-4 w-px bg-white/20" }),
|
|
947
|
+
/* @__PURE__ */ jsxs4("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
948
|
+
currentIndex + 1,
|
|
949
|
+
" / ",
|
|
950
|
+
images.length
|
|
951
|
+
] })
|
|
952
|
+
] })
|
|
953
|
+
] }),
|
|
954
|
+
/* @__PURE__ */ jsx6(
|
|
955
|
+
"div",
|
|
956
|
+
{
|
|
957
|
+
className: "flex h-full w-full items-center justify-center overflow-hidden p-12",
|
|
958
|
+
style: { cursor: scale > 1 ? "grab" : "default" },
|
|
959
|
+
onWheel: handleWheel,
|
|
960
|
+
onMouseDown: handleMouseDown,
|
|
961
|
+
onMouseMove: handleMouseMove,
|
|
962
|
+
onMouseUp: handleMouseUp,
|
|
963
|
+
onMouseLeave: handleMouseUp,
|
|
964
|
+
onDoubleClick: handleDoubleClick,
|
|
965
|
+
children: /* @__PURE__ */ jsx6(
|
|
966
|
+
MessageImage,
|
|
967
|
+
{
|
|
968
|
+
original: true,
|
|
969
|
+
ref: imgRef,
|
|
970
|
+
src: current.src,
|
|
971
|
+
onLoad: () => setLoadedSource(current.src),
|
|
972
|
+
alt: current.alt,
|
|
973
|
+
draggable: false,
|
|
974
|
+
className: "max-h-full max-w-full select-none object-contain",
|
|
975
|
+
style: {
|
|
976
|
+
transform: `scale(${scale}) translate(${translate.x / scale}px, ${translate.y / scale}px)`,
|
|
977
|
+
transition: dragging.current ? "none" : "transform 0.2s ease"
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
)
|
|
981
|
+
}
|
|
982
|
+
)
|
|
983
|
+
]
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
function LightboxDialog({ children, className, onClose, onClick, onKeyDown }) {
|
|
988
|
+
const [opener] = useState3(() => document.activeElement);
|
|
989
|
+
return /* @__PURE__ */ jsx6(dist_exports.Root, { open: true, onOpenChange: (open) => {
|
|
990
|
+
if (!open) onClose();
|
|
991
|
+
}, children: /* @__PURE__ */ jsxs4(dist_exports.Portal, { children: [
|
|
992
|
+
/* @__PURE__ */ jsx6(dist_exports.Overlay, { className: "fixed inset-0 z-50" }),
|
|
993
|
+
/* @__PURE__ */ jsxs4(
|
|
994
|
+
dist_exports.Content,
|
|
995
|
+
{
|
|
996
|
+
className,
|
|
997
|
+
"aria-describedby": void 0,
|
|
998
|
+
onClick,
|
|
999
|
+
onKeyDown,
|
|
1000
|
+
onCloseAutoFocus: (event) => {
|
|
1001
|
+
event.preventDefault();
|
|
1002
|
+
if (opener?.isConnected) opener.focus({ preventScroll: true });
|
|
1003
|
+
},
|
|
1004
|
+
children: [
|
|
1005
|
+
/* @__PURE__ */ jsx6(dist_exports.Title, { className: "sr-only", children: "\u56FE\u7247\u9884\u89C8" }),
|
|
1006
|
+
children
|
|
1007
|
+
]
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
] }) });
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// src/chat/tool-renderers/FileReadRenderer.tsx
|
|
1014
|
+
import { useState as useState4 } from "react";
|
|
1015
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1016
|
+
var NUMBERED_LINE_RE = /^(\s*\d+)\t([\s\S]*)$/;
|
|
1017
|
+
function parseReadResult(result) {
|
|
1018
|
+
if (!result) {
|
|
1019
|
+
return {
|
|
1020
|
+
checksum: null,
|
|
1021
|
+
content: "",
|
|
1022
|
+
endLine: null,
|
|
1023
|
+
note: null,
|
|
1024
|
+
startLine: null
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
let body = result.trimEnd();
|
|
1028
|
+
const checksumMatch = body.match(/\n\n\[checksum:\s*([^\]]+)\]\s*$/);
|
|
1029
|
+
const checksum = checksumMatch?.[1]?.trim() ?? null;
|
|
1030
|
+
if (checksumMatch?.index !== void 0) {
|
|
1031
|
+
body = body.slice(0, checksumMatch.index).trimEnd();
|
|
1032
|
+
}
|
|
1033
|
+
const noteMatch = body.match(/\n\n(文件共[\s\S]*?)\s*$/);
|
|
1034
|
+
const note = noteMatch?.[0]?.trim() ?? null;
|
|
1035
|
+
if (noteMatch?.index !== void 0) {
|
|
1036
|
+
body = body.slice(0, noteMatch.index).trimEnd();
|
|
1037
|
+
}
|
|
1038
|
+
const numberedLines = body.split("\n").map((line) => {
|
|
1039
|
+
const match = line.match(NUMBERED_LINE_RE);
|
|
1040
|
+
if (!match) return null;
|
|
1041
|
+
return {
|
|
1042
|
+
number: Number(match[1].trim()),
|
|
1043
|
+
text: match[2]
|
|
1044
|
+
};
|
|
1045
|
+
}).filter((line) => Boolean(line));
|
|
1046
|
+
return {
|
|
1047
|
+
checksum,
|
|
1048
|
+
content: numberedLines.length > 0 ? numberedLines.map((line) => line.text).join("\n") : body,
|
|
1049
|
+
endLine: numberedLines.length > 0 ? numberedLines[numberedLines.length - 1].number : null,
|
|
1050
|
+
note,
|
|
1051
|
+
startLine: numberedLines.length > 0 ? numberedLines[0].number : null
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
function formatLineRange(startLine, endLine) {
|
|
1055
|
+
if (startLine === null || endLine === null) return null;
|
|
1056
|
+
return startLine === endLine ? `\u7B2C ${startLine} \u884C` : `\u7B2C ${startLine}-${endLine} \u884C`;
|
|
1057
|
+
}
|
|
1058
|
+
function FileReadRenderer({ toolCall }) {
|
|
1059
|
+
const [lightboxIndex, setLightboxIndex] = useState4(null);
|
|
1060
|
+
const argsValue = parseJsonValue(toolCall.arguments);
|
|
1061
|
+
const args = isPlainObject(argsValue) ? argsValue : null;
|
|
1062
|
+
const filePath = extractToolFilePath(toolCall);
|
|
1063
|
+
const fileName = getFileName(filePath);
|
|
1064
|
+
const displayName = filePath ? formatToolFileName(filePath) : fileName;
|
|
1065
|
+
const description = getStringValue(args, "description");
|
|
1066
|
+
const resultText = getResultText(toolCall.result);
|
|
1067
|
+
const images = getResultImages(toolCall.result);
|
|
1068
|
+
const imageUrls = images.map((image) => image.url);
|
|
1069
|
+
const isImageResult = imageUrls.length > 0;
|
|
1070
|
+
const errorMessage = extractErrorMessage(resultText);
|
|
1071
|
+
const { checksum, content, note, startLine, endLine } = parseReadResult(resultText);
|
|
1072
|
+
const fallbackStart = getNumberValue(args, "offset") ?? 1;
|
|
1073
|
+
const lineCount = content ? content.split("\n").length : 0;
|
|
1074
|
+
const resolvedStartLine = startLine ?? (lineCount > 0 ? fallbackStart : null);
|
|
1075
|
+
const resolvedEndLine = endLine ?? (resolvedStartLine !== null && lineCount > 0 ? resolvedStartLine + lineCount - 1 : null);
|
|
1076
|
+
const lineRange = formatLineRange(resolvedStartLine, resolvedEndLine);
|
|
1077
|
+
return /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
|
|
1078
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1079
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
|
|
1080
|
+
/* @__PURE__ */ jsx7("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: displayName }),
|
|
1081
|
+
filePath ? /* @__PURE__ */ jsx7("div", { className: "truncate text-[10px] text-[hsl(var(--muted-foreground))]", children: filePath }) : null
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center justify-end gap-1.5", children: [
|
|
1084
|
+
lineRange ? /* @__PURE__ */ jsx7("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: lineRange }) : null,
|
|
1085
|
+
checksum ? /* @__PURE__ */ jsx7("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
1086
|
+
] })
|
|
1087
|
+
] }),
|
|
1088
|
+
description ? /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
1089
|
+
errorMessage ? /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: errorMessage }) : null,
|
|
1090
|
+
isImageResult ? /* @__PURE__ */ jsxs5("div", { className: "grid gap-2", children: [
|
|
1091
|
+
imageUrls.map((url, idx) => /* @__PURE__ */ jsx7(
|
|
1092
|
+
"button",
|
|
1093
|
+
{
|
|
1094
|
+
type: "button",
|
|
1095
|
+
onClick: () => setLightboxIndex(idx),
|
|
1096
|
+
className: "cursor-zoom-in",
|
|
1097
|
+
title: "\u67E5\u770B\u5927\u56FE",
|
|
1098
|
+
children: /* @__PURE__ */ jsx7(
|
|
1099
|
+
MessageImage,
|
|
1100
|
+
{
|
|
1101
|
+
src: url,
|
|
1102
|
+
width: images[idx].width,
|
|
1103
|
+
height: images[idx].height,
|
|
1104
|
+
alt: fileName,
|
|
1105
|
+
className: "max-h-64 rounded-lg border border-[hsl(var(--border))] object-contain"
|
|
1106
|
+
}
|
|
1107
|
+
)
|
|
1108
|
+
},
|
|
1109
|
+
url.slice(0, 64)
|
|
1110
|
+
)),
|
|
1111
|
+
/* @__PURE__ */ jsx7(
|
|
1112
|
+
ImageLightbox,
|
|
1113
|
+
{
|
|
1114
|
+
open: lightboxIndex != null,
|
|
1115
|
+
onOpenChange: (open) => {
|
|
1116
|
+
if (!open) setLightboxIndex(null);
|
|
1117
|
+
},
|
|
1118
|
+
images: imageUrls.map((url) => ({ src: url, alt: fileName })),
|
|
1119
|
+
initialIndex: lightboxIndex ?? 0
|
|
1120
|
+
}
|
|
1121
|
+
),
|
|
1122
|
+
content ? /* @__PURE__ */ jsx7("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: content }) : null
|
|
1123
|
+
] }) : !errorMessage ? /* @__PURE__ */ jsx7(CodePreview, { content, filePath, className: "max-h-[360px]" }) : null,
|
|
1124
|
+
note ? /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: note }) : null
|
|
1125
|
+
] });
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// src/chat/tool-renderers/SearchRenderer.tsx
|
|
1129
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1130
|
+
function toRecordArray(value) {
|
|
1131
|
+
return Array.isArray(value) ? value.filter(isPlainObject) : [];
|
|
1132
|
+
}
|
|
1133
|
+
function parseDirectoryItems(result) {
|
|
1134
|
+
const value = parseJsonValue(result);
|
|
1135
|
+
if (!Array.isArray(value)) {
|
|
1136
|
+
return [];
|
|
1137
|
+
}
|
|
1138
|
+
return value.map((item) => {
|
|
1139
|
+
if (typeof item === "string") {
|
|
1140
|
+
return {
|
|
1141
|
+
isDir: item.endsWith("/"),
|
|
1142
|
+
name: item,
|
|
1143
|
+
size: null
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
if (!isPlainObject(item)) {
|
|
1147
|
+
return null;
|
|
1148
|
+
}
|
|
1149
|
+
return {
|
|
1150
|
+
isDir: item.is_dir === true,
|
|
1151
|
+
name: typeof item.name === "string" ? item.name : "\u672A\u547D\u540D",
|
|
1152
|
+
size: typeof item.size === "number" ? item.size : null
|
|
1153
|
+
};
|
|
1154
|
+
}).filter((item) => Boolean(item));
|
|
1155
|
+
}
|
|
1156
|
+
function parseGrepResult(result) {
|
|
1157
|
+
if (!result?.trim()) {
|
|
1158
|
+
return { matches: [], searchPath: null };
|
|
1159
|
+
}
|
|
1160
|
+
const [header, ...rest] = result.split("\n");
|
|
1161
|
+
const searchPath = header.startsWith("\u641C\u7D22\u8DEF\u5F84:") ? header.replace("\u641C\u7D22\u8DEF\u5F84:", "").trim() : null;
|
|
1162
|
+
const matches = toRecordArray(parseJsonValue(rest.join("\n"))).map((item) => ({
|
|
1163
|
+
line: typeof item.line === "string" ? item.line : "",
|
|
1164
|
+
lineNumber: typeof item.line_number === "number" ? item.line_number : null,
|
|
1165
|
+
path: typeof item.path === "string" ? item.path : "\u672A\u77E5\u8DEF\u5F84"
|
|
1166
|
+
}));
|
|
1167
|
+
return { matches, searchPath };
|
|
1168
|
+
}
|
|
1169
|
+
function parseWebResults(result) {
|
|
1170
|
+
const value = parseJsonValue(result);
|
|
1171
|
+
const items = isPlainObject(value) ? toRecordArray(value.results) : toRecordArray(value);
|
|
1172
|
+
return items.map((item) => ({
|
|
1173
|
+
description: typeof item.text === "string" ? item.text : typeof item.description === "string" ? item.description : null,
|
|
1174
|
+
publishedDate: typeof item.published_date === "string" ? item.published_date : null,
|
|
1175
|
+
title: typeof item.title === "string" ? item.title : null,
|
|
1176
|
+
url: typeof item.url === "string" ? item.url : null
|
|
1177
|
+
}));
|
|
1178
|
+
}
|
|
1179
|
+
function renderEmptyState(label) {
|
|
1180
|
+
return /* @__PURE__ */ jsx8("div", { className: "rounded-lg border border-dashed border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-4 text-[11px] text-[hsl(var(--muted-foreground))]", children: label });
|
|
1181
|
+
}
|
|
1182
|
+
function SearchRenderer({ toolCall }) {
|
|
1183
|
+
const normalizedName = formatToolName(toolCall.name);
|
|
1184
|
+
const argsValue = parseJsonValue(toolCall.arguments);
|
|
1185
|
+
const args = isPlainObject(argsValue) ? argsValue : null;
|
|
1186
|
+
const resultStr = getResultText(toolCall.result);
|
|
1187
|
+
const errorMessage = extractErrorMessage(resultStr);
|
|
1188
|
+
if (errorMessage) {
|
|
1189
|
+
return /* @__PURE__ */ jsx8("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: errorMessage });
|
|
1190
|
+
}
|
|
1191
|
+
if (normalizedName === "Ls" || normalizedName === "Glob") {
|
|
1192
|
+
const items = parseDirectoryItems(resultStr);
|
|
1193
|
+
const path = getStringValue(args, "path");
|
|
1194
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
1195
|
+
path ? /* @__PURE__ */ jsxs6("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
1196
|
+
"\u76EE\u5F55\uFF1A",
|
|
1197
|
+
path
|
|
1198
|
+
] }) : null,
|
|
1199
|
+
items.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "grid gap-2", children: items.map((item) => /* @__PURE__ */ jsxs6(
|
|
1200
|
+
"div",
|
|
1201
|
+
{
|
|
1202
|
+
className: "flex items-center justify-between gap-3 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
1203
|
+
children: [
|
|
1204
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1205
|
+
item.isDir ? /* @__PURE__ */ jsx8(Folder, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }) : /* @__PURE__ */ jsx8(FileText, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
1206
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: item.name })
|
|
1207
|
+
] }),
|
|
1208
|
+
/* @__PURE__ */ jsx8("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: item.isDir ? "\u76EE\u5F55" : formatBytes(item.size) ?? "\u6587\u4EF6" })
|
|
1209
|
+
]
|
|
1210
|
+
},
|
|
1211
|
+
`${item.name}-${item.size}-${item.isDir}`
|
|
1212
|
+
)) }) : renderEmptyState("\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u6587\u4EF6\u7ED3\u679C\u3002")
|
|
1213
|
+
] });
|
|
1214
|
+
}
|
|
1215
|
+
if (normalizedName === "Grep") {
|
|
1216
|
+
const { matches, searchPath } = parseGrepResult(resultStr);
|
|
1217
|
+
const pattern = getStringValue(args, "pattern");
|
|
1218
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
1219
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
1220
|
+
pattern ? /* @__PURE__ */ jsx8("span", { className: "rounded-full bg-[hsl(var(--muted))] px-2 py-0.5 font-mono", children: pattern }) : null,
|
|
1221
|
+
searchPath ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1222
|
+
"\u8303\u56F4\uFF1A",
|
|
1223
|
+
searchPath
|
|
1224
|
+
] }) : null
|
|
1225
|
+
] }),
|
|
1226
|
+
matches.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "grid gap-2", children: matches.map((match) => /* @__PURE__ */ jsxs6(
|
|
1227
|
+
"div",
|
|
1228
|
+
{
|
|
1229
|
+
className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1232
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: match.path }),
|
|
1233
|
+
match.lineNumber !== null ? /* @__PURE__ */ jsxs6("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
1234
|
+
"\u7B2C ",
|
|
1235
|
+
match.lineNumber,
|
|
1236
|
+
" \u884C"
|
|
1237
|
+
] }) : null
|
|
1238
|
+
] }),
|
|
1239
|
+
/* @__PURE__ */ jsx8("pre", { className: "mt-2 overflow-x-auto whitespace-pre-wrap font-mono text-[11px] text-[hsl(var(--muted-foreground))]", children: /* @__PURE__ */ jsx8("code", { children: match.line }) })
|
|
1240
|
+
]
|
|
1241
|
+
},
|
|
1242
|
+
`${match.path}-${match.lineNumber}-${match.line}`
|
|
1243
|
+
)) }) : renderEmptyState("\u6CA1\u6709\u627E\u5230\u5339\u914D\u7ED3\u679C\u3002")
|
|
1244
|
+
] });
|
|
1245
|
+
}
|
|
1246
|
+
if (normalizedName === "WebFetch") {
|
|
1247
|
+
const url = getStringValue(args, "url");
|
|
1248
|
+
const text = resultStr?.trim();
|
|
1249
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
1250
|
+
url ? /* @__PURE__ */ jsxs6(
|
|
1251
|
+
"a",
|
|
1252
|
+
{
|
|
1253
|
+
href: url,
|
|
1254
|
+
target: "_blank",
|
|
1255
|
+
rel: "noreferrer",
|
|
1256
|
+
className: "flex items-center gap-2 truncate font-mono text-[10px] text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))]",
|
|
1257
|
+
children: [
|
|
1258
|
+
/* @__PURE__ */ jsx8(Earth, { size: 12, className: "shrink-0" }),
|
|
1259
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate", children: url }),
|
|
1260
|
+
/* @__PURE__ */ jsx8(ExternalLink, { size: 11, className: "shrink-0" })
|
|
1261
|
+
]
|
|
1262
|
+
}
|
|
1263
|
+
) : null,
|
|
1264
|
+
text ? /* @__PURE__ */ jsx8("div", { className: "max-h-80 overflow-y-auto rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-3", children: /* @__PURE__ */ jsx8("p", { className: "whitespace-pre-wrap text-[11px] leading-5 text-[hsl(var(--foreground))]", children: text }) }) : renderEmptyState("\u8FD9\u4E2A\u7F51\u9875\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u6B63\u6587\u3002")
|
|
1265
|
+
] });
|
|
1266
|
+
}
|
|
1267
|
+
const results = parseWebResults(resultStr);
|
|
1268
|
+
const query = getStringValue(args, "query");
|
|
1269
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
1270
|
+
query ? /* @__PURE__ */ jsxs6("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
1271
|
+
"\u67E5\u8BE2\uFF1A",
|
|
1272
|
+
query
|
|
1273
|
+
] }) : null,
|
|
1274
|
+
results.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "grid gap-2", children: results.map((item, index) => /* @__PURE__ */ jsx8(
|
|
1275
|
+
"a",
|
|
1276
|
+
{
|
|
1277
|
+
href: item.url ?? void 0,
|
|
1278
|
+
target: "_blank",
|
|
1279
|
+
rel: "noreferrer",
|
|
1280
|
+
className: cn(
|
|
1281
|
+
"rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-3 transition-colors",
|
|
1282
|
+
item.url && "hover:border-[hsl(var(--ring))] hover:bg-[hsl(var(--muted))]/35"
|
|
1283
|
+
),
|
|
1284
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-3", children: [
|
|
1285
|
+
/* @__PURE__ */ jsx8(Earth, { size: 16, className: "mt-0.5 shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
1286
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0 flex-1", children: [
|
|
1287
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1288
|
+
/* @__PURE__ */ jsx8("span", { className: "line-clamp-2 text-[11px] font-medium text-[hsl(var(--foreground))]", children: item.title ?? item.url ?? "\u672A\u547D\u540D\u7ED3\u679C" }),
|
|
1289
|
+
item.url ? /* @__PURE__ */ jsx8(
|
|
1290
|
+
ExternalLink,
|
|
1291
|
+
{
|
|
1292
|
+
size: 12,
|
|
1293
|
+
className: "mt-0.5 shrink-0 text-[hsl(var(--muted-foreground))]"
|
|
1294
|
+
}
|
|
1295
|
+
) : null
|
|
1296
|
+
] }),
|
|
1297
|
+
item.url ? /* @__PURE__ */ jsx8("div", { className: "mt-1 truncate font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.url }) : null,
|
|
1298
|
+
item.publishedDate ? /* @__PURE__ */ jsxs6("div", { className: "mt-1 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
1299
|
+
"\u53D1\u5E03\u4E8E ",
|
|
1300
|
+
item.publishedDate.slice(0, 10)
|
|
1301
|
+
] }) : null,
|
|
1302
|
+
item.description ? /* @__PURE__ */ jsx8("p", { className: "mt-2 line-clamp-3 text-[11px] leading-5 text-[hsl(var(--muted-foreground))]", children: item.description }) : null
|
|
1303
|
+
] })
|
|
1304
|
+
] })
|
|
1305
|
+
},
|
|
1306
|
+
`${item.url ?? item.title ?? "result"}-${index}`
|
|
1307
|
+
)) }) : renderEmptyState("\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u641C\u7D22\u7ED3\u679C\u3002")
|
|
1308
|
+
] });
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// src/chat/tool-renderers/SubmitResultRenderer.tsx
|
|
1312
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1313
|
+
function extractText(value, key) {
|
|
1314
|
+
if (!isPlainObject(value)) return null;
|
|
1315
|
+
const field = value[key];
|
|
1316
|
+
return typeof field === "string" && field.trim() ? field.trim() : null;
|
|
1317
|
+
}
|
|
1318
|
+
function parsePayload(toolCall) {
|
|
1319
|
+
const resultText = getResultText(toolCall.result);
|
|
1320
|
+
const parsedResult = parseJsonValue(resultText);
|
|
1321
|
+
const parsedArgs = parseJsonValue(toolCall.arguments);
|
|
1322
|
+
const description = extractText(parsedArgs, "description") ?? extractText(parsedResult, "description");
|
|
1323
|
+
const result = extractText(parsedArgs, "result") ?? extractText(parsedResult, "result") ?? (!isPlainObject(parsedResult) ? resultText?.trim() ?? null : null);
|
|
1324
|
+
const error = extractText(parsedArgs, "err_msg") ?? extractText(parsedResult, "err_msg") ?? extractText(parsedResult, "error");
|
|
1325
|
+
const rawStatus = extractText(parsedResult, "status");
|
|
1326
|
+
const status = rawStatus === "submitted" ? null : rawStatus;
|
|
1327
|
+
return { description, result, error, status };
|
|
1328
|
+
}
|
|
1329
|
+
function SubmitResultRenderer({ toolCall }) {
|
|
1330
|
+
const { description, result, error, status } = parsePayload(toolCall);
|
|
1331
|
+
const isError = toolCall.status === "error" || Boolean(error);
|
|
1332
|
+
const Icon = isError ? CircleAlert : CircleCheck;
|
|
1333
|
+
return /* @__PURE__ */ jsxs7("div", { className: "overflow-hidden rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]", children: [
|
|
1334
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/25 px-4 py-3", children: [
|
|
1335
|
+
/* @__PURE__ */ jsx9("div", { className: isError ? "text-[hsl(var(--swf-danger))]" : "text-[hsl(var(--swf-success))]", children: /* @__PURE__ */ jsx9(Icon, { size: 18 }) }),
|
|
1336
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1", children: [
|
|
1337
|
+
/* @__PURE__ */ jsx9("div", { className: "font-medium text-[hsl(var(--foreground))]", children: description || (isError ? "\u4EFB\u52A1\u672A\u5B8C\u6210" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4") }),
|
|
1338
|
+
description ? /* @__PURE__ */ jsx9("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: isError ? "\u4EFB\u52A1\u672A\u5B8C\u6210" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4" }) : null,
|
|
1339
|
+
status ? /* @__PURE__ */ jsxs7("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
1340
|
+
"\u72B6\u6001\uFF1A",
|
|
1341
|
+
status
|
|
1342
|
+
] }) : null
|
|
1343
|
+
] })
|
|
1344
|
+
] }),
|
|
1345
|
+
/* @__PURE__ */ jsxs7("div", { className: "space-y-3 px-4 py-4 text-sm leading-6 text-[hsl(var(--foreground))]", children: [
|
|
1346
|
+
result ? /* @__PURE__ */ jsx9(MarkdownContent, { mode: "static", children: result }) : null,
|
|
1347
|
+
error ? /* @__PURE__ */ jsxs7("div", { className: "rounded-xl border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-sm text-[hsl(var(--swf-danger))]", children: [
|
|
1348
|
+
/* @__PURE__ */ jsx9("div", { className: "mb-1 font-medium", children: "\u672A\u5B8C\u6210\u539F\u56E0" }),
|
|
1349
|
+
/* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap", children: error })
|
|
1350
|
+
] }) : null,
|
|
1351
|
+
!result && !error ? /* @__PURE__ */ jsx9("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u667A\u80FD\u4F53\u5DF2\u7ED3\u675F\u672C\u8F6E\u4EFB\u52A1\u3002" }) : null
|
|
1352
|
+
] })
|
|
1353
|
+
] });
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// src/chat/tool-renderers/registry.ts
|
|
1357
|
+
var RENDERERS = /* @__PURE__ */ new Map([
|
|
1358
|
+
["Bash", BashRenderer],
|
|
1359
|
+
["BgBash", BashRenderer],
|
|
1360
|
+
["Edit", FileEditRenderer],
|
|
1361
|
+
["MultiEdit", FileEditRenderer],
|
|
1362
|
+
["Grep", SearchRenderer],
|
|
1363
|
+
["Glob", SearchRenderer],
|
|
1364
|
+
["Ls", SearchRenderer],
|
|
1365
|
+
["Read", FileReadRenderer],
|
|
1366
|
+
["WebFetch", SearchRenderer],
|
|
1367
|
+
["WebSearch", SearchRenderer],
|
|
1368
|
+
["Write", FileEditRenderer],
|
|
1369
|
+
["submit_result", SubmitResultRenderer]
|
|
1370
|
+
]);
|
|
1371
|
+
function getRenderer(toolName) {
|
|
1372
|
+
return RENDERERS.get(formatToolName(toolName)) ?? null;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
export {
|
|
1376
|
+
MessageImage,
|
|
1377
|
+
McpAppCard,
|
|
1378
|
+
ToolUiCardView,
|
|
1379
|
+
SUPPORTED_LANGUAGES,
|
|
1380
|
+
normalizeCodeLanguage,
|
|
1381
|
+
getCodeLanguageFromFilename,
|
|
1382
|
+
getResultText,
|
|
1383
|
+
getResultImages,
|
|
1384
|
+
parseJsonValue,
|
|
1385
|
+
isPlainObject,
|
|
1386
|
+
getStringValue,
|
|
1387
|
+
getNumberValue,
|
|
1388
|
+
getBooleanValue,
|
|
1389
|
+
extractErrorMessage,
|
|
1390
|
+
getFileName,
|
|
1391
|
+
getCodeLanguage,
|
|
1392
|
+
formatBytes,
|
|
1393
|
+
CodePreview,
|
|
1394
|
+
BashRenderer,
|
|
1395
|
+
shouldFollowWritePreview,
|
|
1396
|
+
scrollWritePreviewToLatest,
|
|
1397
|
+
FileEditRenderer,
|
|
1398
|
+
ImageLightbox,
|
|
1399
|
+
FileReadRenderer,
|
|
1400
|
+
SearchRenderer,
|
|
1401
|
+
SubmitResultRenderer,
|
|
1402
|
+
getRenderer
|
|
1403
|
+
};
|
|
1404
|
+
//# sourceMappingURL=chunk-DNND32V4.js.map
|