@assistant-ui/mcp-docs-server 0.1.30 → 0.1.32
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/.docs/organized/code-examples/waterfall.md +8 -8
- package/.docs/organized/code-examples/with-a2a.md +10 -10
- package/.docs/organized/code-examples/with-ag-ui.md +12 -12
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +14 -14
- package/.docs/organized/code-examples/with-artifacts.md +14 -14
- package/.docs/organized/code-examples/with-assistant-transport.md +11 -11
- package/.docs/organized/code-examples/with-browser-extension.md +345 -0
- package/.docs/organized/code-examples/with-chain-of-thought.md +129 -63
- package/.docs/organized/code-examples/with-cloud-standalone.md +13 -13
- package/.docs/organized/code-examples/with-cloud.md +13 -13
- package/.docs/organized/code-examples/with-custom-thread-list.md +65 -20
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +18 -17
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +18 -17
- package/.docs/organized/code-examples/with-expo.md +25 -25
- package/.docs/organized/code-examples/with-external-store.md +10 -10
- package/.docs/organized/code-examples/with-ffmpeg.md +14 -14
- package/.docs/organized/code-examples/with-generative-ui.md +211 -14
- package/.docs/organized/code-examples/with-google-adk.md +12 -12
- package/.docs/organized/code-examples/with-heat-graph.md +8 -8
- package/.docs/organized/code-examples/with-image-generation.md +454 -0
- package/.docs/organized/code-examples/with-interactables.md +14 -14
- package/.docs/organized/code-examples/with-langchain.md +12 -12
- package/.docs/organized/code-examples/with-langgraph.md +15 -12
- package/.docs/organized/code-examples/with-livekit.md +19 -18
- package/.docs/organized/code-examples/with-mcp.md +748 -0
- package/.docs/organized/code-examples/with-opencode.md +107 -62
- package/.docs/organized/code-examples/with-parent-id-grouping.md +12 -12
- package/.docs/organized/code-examples/with-react-hook-form.md +14 -14
- package/.docs/organized/code-examples/with-react-ink.md +4 -4
- package/.docs/organized/code-examples/with-react-router.md +16 -16
- package/.docs/organized/code-examples/with-resumable-stream.md +660 -0
- package/.docs/organized/code-examples/with-store.md +8 -8
- package/.docs/organized/code-examples/with-tanstack.md +14 -14
- package/.docs/organized/code-examples/with-tap-runtime.md +11 -10
- package/.docs/raw/docs/(docs)/cli.mdx +3 -1
- package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
- package/.docs/raw/docs/(docs)/index.mdx +3 -2
- package/.docs/raw/docs/(docs)/installation.mdx +2 -1
- package/.docs/raw/docs/(docs)/rtl.mdx +1 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +36 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +34 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +55 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +36 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +31 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +33 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +28 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +94 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +464 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +79 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +125 -125
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +46 -20
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +70 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +182 -554
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +82 -86
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -314
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +43 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -42
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +68 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +79 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +92 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +131 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +230 -2
- package/.docs/raw/docs/cloud/ai-sdk.mdx +222 -4
- package/.docs/raw/docs/cloud/index.mdx +2 -2
- package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
- package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +45 -40
- package/.docs/raw/docs/guides/branching.mdx +76 -0
- package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +54 -26
- package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +3 -1
- package/.docs/raw/docs/guides/editing.mdx +102 -0
- package/.docs/raw/docs/guides/generative-ui.mdx +142 -0
- package/.docs/raw/docs/guides/image-generation.mdx +74 -0
- package/.docs/raw/docs/guides/index.mdx +103 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +51 -2
- package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +53 -10
- package/.docs/raw/docs/guides/mcp-apps.mdx +231 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/mentions.mdx +63 -88
- package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +45 -6
- package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +66 -6
- package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +11 -18
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
- package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/slash-commands.mdx +104 -38
- package/.docs/raw/docs/guides/speech.mdx +156 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +91 -69
- package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +110 -38
- package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +197 -40
- package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +41 -2
- package/.docs/raw/docs/ink/adapters.mdx +37 -1
- package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
- package/.docs/raw/docs/ink/index.mdx +11 -14
- package/.docs/raw/docs/ink/migration.mdx +1 -3
- package/.docs/raw/docs/ink/primitives.mdx +386 -9
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
- package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
- package/.docs/raw/docs/integrations/gateways/index.mdx +162 -0
- package/.docs/raw/docs/integrations/index.mdx +185 -0
- package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +163 -0
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +150 -0
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
- package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
- package/.docs/raw/docs/integrations/tools/react-mcp.mdx +337 -0
- package/.docs/raw/docs/migrations/v0-14.mdx +297 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
- package/.docs/raw/docs/primitives/attachment.mdx +1 -0
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
- package/.docs/raw/docs/primitives/composer.mdx +55 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -0
- package/.docs/raw/docs/primitives/index.mdx +4 -3
- package/.docs/raw/docs/primitives/message.mdx +68 -5
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
- package/.docs/raw/docs/primitives/suggestion.mdx +10 -0
- package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
- package/.docs/raw/docs/primitives/thread.mdx +16 -13
- package/.docs/raw/docs/react-native/hooks.mdx +2 -2
- package/.docs/raw/docs/react-native/index.mdx +5 -7
- package/.docs/raw/docs/react-native/migration.mdx +1 -3
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
- package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
- package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +154 -0
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +73 -128
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +70 -64
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +337 -123
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +348 -0
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +261 -1236
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
- package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
- package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
- package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
- package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
- package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
- package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
- package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +78 -203
- package/.docs/raw/docs/ui/accordion.mdx +1 -0
- package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
- package/.docs/raw/docs/ui/attachment.mdx +1 -0
- package/.docs/raw/docs/ui/badge.mdx +1 -0
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +12 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -0
- package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
- package/.docs/raw/docs/ui/directive-text.mdx +1 -0
- package/.docs/raw/docs/ui/file.mdx +1 -0
- package/.docs/raw/docs/ui/image.mdx +1 -0
- package/.docs/raw/docs/ui/markdown.mdx +2 -14
- package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
- package/.docs/raw/docs/ui/mermaid.mdx +1 -0
- package/.docs/raw/docs/ui/message-timing.mdx +3 -2
- package/.docs/raw/docs/ui/model-selector.mdx +9 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
- package/.docs/raw/docs/ui/quote.mdx +1 -0
- package/.docs/raw/docs/ui/reasoning.mdx +66 -33
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
- package/.docs/raw/docs/ui/select.mdx +1 -0
- package/.docs/raw/docs/ui/sources.mdx +18 -0
- package/.docs/raw/docs/ui/streamdown.mdx +35 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
- package/.docs/raw/docs/ui/tabs.mdx +1 -0
- package/.docs/raw/docs/ui/thread-list.mdx +19 -2
- package/.docs/raw/docs/ui/thread.mdx +58 -3
- package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
- package/.docs/raw/docs/ui/tool-group.mdx +39 -11
- package/.docs/raw/docs/ui/voice.mdx +1 -0
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
- package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
- package/README.md +14 -72
- package/dist/constants.d.ts +12 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -9
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts +4 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.js +109 -121
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts +4 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.js +45 -42
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -2
- package/dist/prepare-docs/prepare.js +17 -17
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.d.ts +1 -3
- package/dist/stdio.js +6 -3
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.d.ts +20 -15
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +140 -161
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +20 -15
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +74 -86
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.d.ts +5 -2
- package/dist/tools/tests/test-setup.d.ts.map +1 -1
- package/dist/tools/tests/test-setup.js +21 -28
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +17 -17
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp-format.d.ts +8 -5
- package/dist/utils/mcp-format.d.ts.map +1 -1
- package/dist/utils/mcp-format.js +9 -9
- package/dist/utils/mcp-format.js.map +1 -1
- package/dist/utils/mdx.d.ts +8 -6
- package/dist/utils/mdx.d.ts.map +1 -1
- package/dist/utils/mdx.js +22 -22
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.d.ts +9 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +66 -76
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/security.d.ts +4 -1
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js +19 -40
- package/dist/utils/security.js.map +1 -1
- package/package.json +6 -6
- package/src/tools/tests/path-traversal.test.ts +1 -1
- package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
- package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
- package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
- package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +0 -159
- package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -314
- package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
- package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
- package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
- package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
- package/.docs/raw/docs/runtimes/langchain/comparison.mdx +0 -60
- package/.docs/raw/docs/runtimes/langchain/index.mdx +0 -210
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -699
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
- package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
- package/dist/prepare-docs/prepare.d.ts.map +0 -1
- package/dist/stdio.d.ts.map +0 -1
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
- /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-setup.d.ts","
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","names":[],"sources":["../../../src/tools/tests/test-setup.ts"],"mappings":";cAYa,WAAA;2BACkB,IAAA,UAAW,OAAA;AAAA"}
|
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
import { beforeAll } from "vitest";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
1
|
import { PACKAGE_DIR } from "../../constants.js";
|
|
5
2
|
import { docsTools } from "../docs.js";
|
|
6
3
|
import { examplesTools } from "../examples.js";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { beforeAll } from "vitest";
|
|
7
|
+
//#region src/tools/tests/test-setup.ts
|
|
7
8
|
const tools = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export const testContext = {
|
|
12
|
-
callTool: async (name, args) => {
|
|
13
|
-
const tool = tools[name];
|
|
14
|
-
if (!tool) {
|
|
15
|
-
throw new Error(`Tool ${name} not found`);
|
|
16
|
-
}
|
|
17
|
-
const result = await tool.execute(args);
|
|
18
|
-
const text = result.content?.[0]?.text;
|
|
19
|
-
if (text === undefined) {
|
|
20
|
-
throw new Error(`Tool ${name} returned no content`);
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
return JSON.parse(text);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
throw new Error(`Tool ${name} returned invalid JSON. Output: ${text}\nParse error: ${error instanceof Error ? error.message : String(error)}`);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
9
|
+
assistantUIDocs: docsTools,
|
|
10
|
+
assistantUIExamples: examplesTools
|
|
29
11
|
};
|
|
12
|
+
const testContext = { callTool: async (name, args) => {
|
|
13
|
+
const tool = tools[name];
|
|
14
|
+
if (!tool) throw new Error(`Tool ${name} not found`);
|
|
15
|
+
const text = (await tool.execute(args)).content?.[0]?.text;
|
|
16
|
+
if (text === void 0) throw new Error(`Tool ${name} returned no content`);
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(text);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
throw new Error(`Tool ${name} returned invalid JSON. Output: ${text}\nParse error: ${error instanceof Error ? error.message : String(error)}`);
|
|
21
|
+
}
|
|
22
|
+
} };
|
|
30
23
|
beforeAll(() => {
|
|
31
|
-
|
|
32
|
-
if (!existsSync(docsPath)) {
|
|
33
|
-
throw new Error("Documentation not prepared. Run: pnpm build");
|
|
34
|
-
}
|
|
24
|
+
if (!existsSync(join(PACKAGE_DIR, ".docs"))) throw new Error("Documentation not prepared. Run: pnpm build");
|
|
35
25
|
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { testContext };
|
|
28
|
+
|
|
36
29
|
//# sourceMappingURL=test-setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-setup.js","
|
|
1
|
+
{"version":3,"file":"test-setup.js","names":[],"sources":["../../../src/tools/tests/test-setup.ts"],"sourcesContent":["import { beforeAll } from \"vitest\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { PACKAGE_DIR } from \"../../constants.js\";\nimport { docsTools } from \"../docs.js\";\nimport { examplesTools } from \"../examples.js\";\n\nconst tools = {\n assistantUIDocs: docsTools,\n assistantUIExamples: examplesTools,\n};\n\nexport const testContext = {\n callTool: async (name: string, args: any) => {\n const tool = tools[name as keyof typeof tools];\n if (!tool) {\n throw new Error(`Tool ${name} not found`);\n }\n const result = await tool.execute(args);\n\n const text = result.content?.[0]?.text;\n if (text === undefined) {\n throw new Error(`Tool ${name} returned no content`);\n }\n try {\n return JSON.parse(text);\n } catch (error) {\n throw new Error(\n `Tool ${name} returned invalid JSON. Output: ${text}\\nParse error: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n};\n\nbeforeAll(() => {\n const docsPath = join(PACKAGE_DIR, \".docs\");\n if (!existsSync(docsPath)) {\n throw new Error(\"Documentation not prepared. Run: pnpm build\");\n }\n});\n"],"mappings":";;;;;;;AAOA,MAAM,QAAQ;CACZ,iBAAiB;CACjB,qBAAqB;AACvB;AAEA,MAAa,cAAc,EACzB,UAAU,OAAO,MAAc,SAAc;CAC3C,MAAM,OAAO,MAAM;CACnB,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,QAAQ,KAAK,WAAW;CAI1C,MAAM,QAAO,MAFQ,KAAK,QAAQ,IAAI,GAElB,UAAU,IAAI;CAClC,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,MAAM,QAAQ,KAAK,qBAAqB;CAEpD,IAAI;EACF,OAAO,KAAK,MAAM,IAAI;CACxB,SAAS,OAAO;EACd,MAAM,IAAI,MACR,QAAQ,KAAK,kCAAkC,KAAK,iBAAiB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAC5H;CACF;AACF,EACF;AAEA,gBAAgB;CAEd,IAAI,CAAC,WADY,KAAK,aAAa,OACZ,CAAC,GACtB,MAAM,IAAI,MAAM,6CAA6C;AAEjE,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/utils/logger.d.ts
|
|
2
|
+
declare const logger: {
|
|
3
|
+
debug: (message: string, ...args: any[]) => void;
|
|
4
|
+
info: (message: string, ...args: any[]) => void;
|
|
5
|
+
error: (message: string, ...args: any[]) => void;
|
|
6
|
+
warn: (message: string, ...args: any[]) => void;
|
|
6
7
|
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { logger };
|
|
7
10
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","
|
|
1
|
+
{"version":3,"file":"logger.d.ts","names":[],"sources":["../../src/utils/logger.ts"],"mappings":";cAEa,MAAA;8BACY,IAAA;6BAKD,IAAA;8BAKC,IAAA;6BAGD,IAAA;AAAA"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { IS_PREPARE_MODE } from "../constants.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
warn: (message, ...args) => {
|
|
17
|
-
console.warn(`[WARN] ${message}`, ...args);
|
|
18
|
-
},
|
|
2
|
+
//#region src/utils/logger.ts
|
|
3
|
+
const logger = {
|
|
4
|
+
debug: (message, ...args) => {
|
|
5
|
+
if (process.env.DEBUG) console.debug(`[DEBUG] ${message}`, ...args);
|
|
6
|
+
},
|
|
7
|
+
info: (message, ...args) => {
|
|
8
|
+
if (IS_PREPARE_MODE) console.log(`[INFO] ${message}`, ...args);
|
|
9
|
+
},
|
|
10
|
+
error: (message, ...args) => {
|
|
11
|
+
console.error(`[ERROR] ${message}`, ...args);
|
|
12
|
+
},
|
|
13
|
+
warn: (message, ...args) => {
|
|
14
|
+
console.warn(`[WARN] ${message}`, ...args);
|
|
15
|
+
}
|
|
19
16
|
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { logger };
|
|
19
|
+
|
|
20
20
|
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","
|
|
1
|
+
{"version":3,"file":"logger.js","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":["import { IS_PREPARE_MODE } from \"../constants.js\";\n\nexport const logger = {\n debug: (message: string, ...args: any[]) => {\n if (process.env.DEBUG) {\n console.debug(`[DEBUG] ${message}`, ...args);\n }\n },\n info: (message: string, ...args: any[]) => {\n if (IS_PREPARE_MODE) {\n console.log(`[INFO] ${message}`, ...args);\n }\n },\n error: (message: string, ...args: any[]) => {\n console.error(`[ERROR] ${message}`, ...args);\n },\n warn: (message: string, ...args: any[]) => {\n console.warn(`[WARN] ${message}`, ...args);\n },\n};\n"],"mappings":";;AAEA,MAAa,SAAS;CACpB,QAAQ,SAAiB,GAAG,SAAgB;EAC1C,IAAI,QAAQ,IAAI,OACd,QAAQ,MAAM,WAAW,WAAW,GAAG,IAAI;CAE/C;CACA,OAAO,SAAiB,GAAG,SAAgB;EACzC,IAAI,iBACF,QAAQ,IAAI,UAAU,WAAW,GAAG,IAAI;CAE5C;CACA,QAAQ,SAAiB,GAAG,SAAgB;EAC1C,QAAQ,MAAM,WAAW,WAAW,GAAG,IAAI;CAC7C;CACA,OAAO,SAAiB,GAAG,SAAgB;EACzC,QAAQ,KAAK,UAAU,WAAW,GAAG,IAAI;CAC3C;AACF"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/utils/mcp-format.d.ts
|
|
2
|
+
declare function formatMCPResponse(data: any): {
|
|
3
|
+
content: Array<{
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}>;
|
|
6
7
|
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { formatMCPResponse };
|
|
7
10
|
//# sourceMappingURL=mcp-format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-format.d.ts","
|
|
1
|
+
{"version":3,"file":"mcp-format.d.ts","names":[],"sources":["../../src/utils/mcp-format.ts"],"mappings":";iBAAgB,iBAAA,CAAkB,IAAA;EAChC,OAAA,EAAS,KAAK;IAAG,IAAA;IAAc,IAAA;EAAA;AAAA"}
|
package/dist/utils/mcp-format.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
],
|
|
9
|
-
};
|
|
1
|
+
//#region src/utils/mcp-format.ts
|
|
2
|
+
function formatMCPResponse(data) {
|
|
3
|
+
return { content: [{
|
|
4
|
+
type: "text",
|
|
5
|
+
text: typeof data === "string" ? data : JSON.stringify(data, null, 2)
|
|
6
|
+
}] };
|
|
10
7
|
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { formatMCPResponse };
|
|
10
|
+
|
|
11
11
|
//# sourceMappingURL=mcp-format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-format.js","
|
|
1
|
+
{"version":3,"file":"mcp-format.js","names":[],"sources":["../../src/utils/mcp-format.ts"],"sourcesContent":["export function formatMCPResponse(data: any): {\n content: Array<{ type: \"text\"; text: string }>;\n} {\n return {\n content: [\n {\n type: \"text\",\n text: typeof data === \"string\" ? data : JSON.stringify(data, null, 2),\n },\n ],\n };\n}\n"],"mappings":";AAAA,SAAgB,kBAAkB,MAEhC;CACA,OAAO,EACL,SAAS,CACP;EACE,MAAM;EACN,MAAM,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC;CACtE,CACF,EACF;AACF"}
|
package/dist/utils/mdx.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
//#region src/utils/mdx.d.ts
|
|
1
2
|
interface MDXContent {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
content: string;
|
|
4
|
+
frontmatter: Record<string, any>;
|
|
5
|
+
excerpt?: string;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
declare function readMDXFile(filePath: string): Promise<MDXContent | null>;
|
|
8
|
+
declare function formatMDXContent(mdxContent: MDXContent): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { formatMDXContent, readMDXFile };
|
|
9
11
|
//# sourceMappingURL=mdx.d.ts.map
|
package/dist/utils/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","names":[],"sources":["../../src/utils/mdx.ts"],"mappings":";UAIU,UAAA;EACR,OAAA;EACA,WAAA,EAAa,MAAM;EACnB,OAAA;AAAA;AAAA,iBAGoB,WAAA,CACpB,QAAA,WACC,OAAO,CAAC,UAAA;AAAA,iBAsBK,gBAAA,CAAiB,UAAsB,EAAV,UAAU"}
|
package/dist/utils/mdx.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
+
import { logger } from "./logger.js";
|
|
1
2
|
import { readFile } from "node:fs/promises";
|
|
2
3
|
import matter from "gray-matter";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
catch (error) {
|
|
19
|
-
logger.error(`Failed to read MDX file: ${filePath}`, error);
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
4
|
+
//#region src/utils/mdx.ts
|
|
5
|
+
async function readMDXFile(filePath) {
|
|
6
|
+
try {
|
|
7
|
+
const { content, data } = matter(await readFile(filePath, "utf-8"));
|
|
8
|
+
const excerptMatch = content.match(/^(.+?)(?:\n\n|$)/);
|
|
9
|
+
const excerpt = excerptMatch?.[1] !== void 0 ? excerptMatch[1].replace(/^#+ /, "") : void 0;
|
|
10
|
+
return {
|
|
11
|
+
content,
|
|
12
|
+
frontmatter: data,
|
|
13
|
+
...excerpt !== void 0 && { excerpt }
|
|
14
|
+
};
|
|
15
|
+
} catch (error) {
|
|
16
|
+
logger.error(`Failed to read MDX file: ${filePath}`, error);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function formatMDXContent(mdxContent) {
|
|
21
|
+
const { content, frontmatter } = mdxContent;
|
|
22
|
+
return matter.stringify(content, frontmatter);
|
|
26
23
|
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { formatMDXContent, readMDXFile };
|
|
26
|
+
|
|
27
27
|
//# sourceMappingURL=mdx.js.map
|
package/dist/utils/mdx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.js","
|
|
1
|
+
{"version":3,"file":"mdx.js","names":[],"sources":["../../src/utils/mdx.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport matter from \"gray-matter\";\nimport { logger } from \"./logger.js\";\n\ninterface MDXContent {\n content: string;\n frontmatter: Record<string, any>;\n excerpt?: string;\n}\n\nexport async function readMDXFile(\n filePath: string,\n): Promise<MDXContent | null> {\n try {\n const fileContent = await readFile(filePath, \"utf-8\");\n const { content, data } = matter(fileContent);\n\n const excerptMatch = content.match(/^(.+?)(?:\\n\\n|$)/);\n const excerpt =\n excerptMatch?.[1] !== undefined\n ? excerptMatch[1].replace(/^#+ /, \"\")\n : undefined;\n\n return {\n content,\n frontmatter: data,\n ...(excerpt !== undefined && { excerpt }),\n };\n } catch (error) {\n logger.error(`Failed to read MDX file: ${filePath}`, error);\n return null;\n }\n}\n\nexport function formatMDXContent(mdxContent: MDXContent): string {\n const { content, frontmatter } = mdxContent;\n\n return matter.stringify(content, frontmatter);\n}\n"],"mappings":";;;;AAUA,eAAsB,YACpB,UAC4B;CAC5B,IAAI;EAEF,MAAM,EAAE,SAAS,SAAS,OAAO,MADP,SAAS,UAAU,OAAO,CACR;EAE5C,MAAM,eAAe,QAAQ,MAAM,kBAAkB;EACrD,MAAM,UACJ,eAAe,OAAO,KAAA,IAClB,aAAa,GAAG,QAAQ,QAAQ,EAAE,IAClC,KAAA;EAEN,OAAO;GACL;GACA,aAAa;GACb,GAAI,YAAY,KAAA,KAAa,EAAE,QAAQ;EACzC;CACF,SAAS,OAAO;EACd,OAAO,MAAM,4BAA4B,YAAY,KAAK;EAC1D,OAAO;CACT;AACF;AAEA,SAAgB,iBAAiB,YAAgC;CAC/D,MAAM,EAAE,SAAS,gBAAgB;CAEjC,OAAO,OAAO,UAAU,SAAS,WAAW;AAC9C"}
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/utils/paths.d.ts
|
|
2
|
+
declare function listDirContents(dirPath: string): Promise<{
|
|
3
|
+
directories: string[];
|
|
4
|
+
files: string[];
|
|
4
5
|
}>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare function getAvailablePaths(): Promise<string[]>;
|
|
7
|
+
declare function findNearestPaths(requestedPath: string, availablePaths: string[]): string[];
|
|
8
|
+
declare function pathExists(path: string): Promise<boolean>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { findNearestPaths, getAvailablePaths, listDirContents, pathExists };
|
|
8
11
|
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","
|
|
1
|
+
{"version":3,"file":"paths.d.ts","names":[],"sources":["../../src/utils/paths.ts"],"mappings":";iBAYsB,eAAA,CAAgB,OAAA,WAAkB,OAAO;EAC7D,WAAA;EACA,KAAA;AAAA;AAAA,iBA4BoB,iBAAA,CAAA,GAAqB,OAAO;AAAA,iBA0BlC,gBAAA,CACd,aAAA,UACA,cAAwB;AAAA,iBAoCJ,UAAA,CAAW,IAAA,WAAe,OAAO"}
|
package/dist/utils/paths.js
CHANGED
|
@@ -1,84 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join, extname } from "node:path";
|
|
3
|
-
import { DOCS_PATH, MDX_EXTENSION, MD_EXTENSION } from "../constants.js";
|
|
1
|
+
import { DOCS_PATH, MDX_EXTENSION } from "../constants.js";
|
|
4
2
|
import { logger } from "./logger.js";
|
|
3
|
+
import { extname, join } from "node:path";
|
|
4
|
+
import { readdir, stat } from "node:fs/promises";
|
|
5
|
+
//#region src/utils/paths.ts
|
|
5
6
|
const SIMILARITY_THRESHOLDS = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
EXACT_MATCH: 1,
|
|
8
|
+
CONTAINS_MATCH: .8,
|
|
9
|
+
PARTIAL_MATCH: .5,
|
|
10
|
+
MIN_SUGGESTION: .3
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return { directories, files };
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
logger.error(`Failed to list directory contents: ${dirPath}`, error);
|
|
29
|
-
return { directories: [], files: [] };
|
|
30
|
-
}
|
|
12
|
+
async function listDirContents(dirPath) {
|
|
13
|
+
try {
|
|
14
|
+
const items = await readdir(dirPath, { withFileTypes: true });
|
|
15
|
+
return {
|
|
16
|
+
directories: items.filter((item) => item.isDirectory()).map((item) => item.name).filter((name) => !name.startsWith(".")).sort(),
|
|
17
|
+
files: items.filter((item) => item.isFile() && (extname(item.name) === ".mdx" || extname(item.name) === ".md")).map((item) => item.name).sort()
|
|
18
|
+
};
|
|
19
|
+
} catch (error) {
|
|
20
|
+
logger.error(`Failed to list directory contents: ${dirPath}`, error);
|
|
21
|
+
return {
|
|
22
|
+
directories: [],
|
|
23
|
+
files: []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
async function getAvailablePaths() {
|
|
28
|
+
const paths = [];
|
|
29
|
+
async function scanDirectory(dir, prefix = "") {
|
|
30
|
+
const { directories, files } = await listDirContents(dir);
|
|
31
|
+
for (const file of files) {
|
|
32
|
+
const name = file.replace(MDX_EXTENSION, "").replace(".md", "");
|
|
33
|
+
paths.push(prefix ? `${prefix}/${name}` : name);
|
|
34
|
+
}
|
|
35
|
+
for (const subdir of directories) {
|
|
36
|
+
const subdirPath = join(dir, subdir);
|
|
37
|
+
const newPrefix = prefix ? `${prefix}/${subdir}` : subdir;
|
|
38
|
+
paths.push(newPrefix);
|
|
39
|
+
await scanDirectory(subdirPath, newPrefix);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await scanDirectory(DOCS_PATH);
|
|
43
|
+
return paths.sort();
|
|
49
44
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
return scored
|
|
70
|
-
.filter((item) => item.score > SIMILARITY_THRESHOLDS.MIN_SUGGESTION)
|
|
71
|
-
.sort((a, b) => b.score - a.score)
|
|
72
|
-
.slice(0, 3)
|
|
73
|
-
.map((item) => item.path);
|
|
45
|
+
function findNearestPaths(requestedPath, availablePaths) {
|
|
46
|
+
const normalizedRequest = requestedPath.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
47
|
+
return availablePaths.map((path) => {
|
|
48
|
+
const normalizedPath = path.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
49
|
+
if (normalizedPath.includes(normalizedRequest)) return {
|
|
50
|
+
path,
|
|
51
|
+
score: SIMILARITY_THRESHOLDS.EXACT_MATCH
|
|
52
|
+
};
|
|
53
|
+
if (normalizedRequest.includes(normalizedPath)) return {
|
|
54
|
+
path,
|
|
55
|
+
score: SIMILARITY_THRESHOLDS.CONTAINS_MATCH
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
path,
|
|
59
|
+
score: [...normalizedRequest].filter((char) => normalizedPath.includes(char)).length / normalizedRequest.length * SIMILARITY_THRESHOLDS.PARTIAL_MATCH
|
|
60
|
+
};
|
|
61
|
+
}).filter((item) => item.score > SIMILARITY_THRESHOLDS.MIN_SUGGESTION).sort((a, b) => b.score - a.score).slice(0, 3).map((item) => item.path);
|
|
74
62
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
63
|
+
async function pathExists(path) {
|
|
64
|
+
try {
|
|
65
|
+
await stat(path);
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
83
70
|
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { findNearestPaths, getAvailablePaths, listDirContents, pathExists };
|
|
73
|
+
|
|
84
74
|
//# sourceMappingURL=paths.js.map
|
package/dist/utils/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","
|
|
1
|
+
{"version":3,"file":"paths.js","names":[],"sources":["../../src/utils/paths.ts"],"sourcesContent":["import { readdir, stat } from \"node:fs/promises\";\nimport { join, extname } from \"node:path\";\nimport { DOCS_PATH, MDX_EXTENSION, MD_EXTENSION } from \"../constants.js\";\nimport { logger } from \"./logger.js\";\n\nconst SIMILARITY_THRESHOLDS = {\n EXACT_MATCH: 1,\n CONTAINS_MATCH: 0.8,\n PARTIAL_MATCH: 0.5,\n MIN_SUGGESTION: 0.3,\n} as const;\n\nexport async function listDirContents(dirPath: string): Promise<{\n directories: string[];\n files: string[];\n}> {\n try {\n const items = await readdir(dirPath, { withFileTypes: true });\n\n const directories = items\n .filter((item) => item.isDirectory())\n .map((item) => item.name)\n .filter((name) => !name.startsWith(\".\"))\n .sort();\n\n const files = items\n .filter(\n (item) =>\n item.isFile() &&\n (extname(item.name) === MDX_EXTENSION ||\n extname(item.name) === MD_EXTENSION),\n )\n .map((item) => item.name)\n .sort();\n\n return { directories, files };\n } catch (error) {\n logger.error(`Failed to list directory contents: ${dirPath}`, error);\n return { directories: [], files: [] };\n }\n}\n\nexport async function getAvailablePaths(): Promise<string[]> {\n const paths: string[] = [];\n\n async function scanDirectory(\n dir: string,\n prefix: string = \"\",\n ): Promise<void> {\n const { directories, files } = await listDirContents(dir);\n\n for (const file of files) {\n const name = file.replace(MDX_EXTENSION, \"\").replace(MD_EXTENSION, \"\");\n paths.push(prefix ? `${prefix}/${name}` : name);\n }\n\n for (const subdir of directories) {\n const subdirPath = join(dir, subdir);\n const newPrefix = prefix ? `${prefix}/${subdir}` : subdir;\n paths.push(newPrefix);\n await scanDirectory(subdirPath, newPrefix);\n }\n }\n\n await scanDirectory(DOCS_PATH);\n return paths.sort();\n}\n\nexport function findNearestPaths(\n requestedPath: string,\n availablePaths: string[],\n): string[] {\n const normalizedRequest = requestedPath\n .toLowerCase()\n .replace(/[^a-z0-9]/g, \"\");\n\n const scored = availablePaths.map((path) => {\n const normalizedPath = path.toLowerCase().replace(/[^a-z0-9]/g, \"\");\n\n if (normalizedPath.includes(normalizedRequest)) {\n return { path, score: SIMILARITY_THRESHOLDS.EXACT_MATCH };\n }\n\n if (normalizedRequest.includes(normalizedPath)) {\n return { path, score: SIMILARITY_THRESHOLDS.CONTAINS_MATCH };\n }\n\n const overlap = [...normalizedRequest].filter((char) =>\n normalizedPath.includes(char),\n ).length;\n\n return {\n path,\n score:\n (overlap / normalizedRequest.length) *\n SIMILARITY_THRESHOLDS.PARTIAL_MATCH,\n };\n });\n\n return scored\n .filter((item) => item.score > SIMILARITY_THRESHOLDS.MIN_SUGGESTION)\n .sort((a, b) => b.score - a.score)\n .slice(0, 3)\n .map((item) => item.path);\n}\n\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;AAKA,MAAM,wBAAwB;CAC5B,aAAa;CACb,gBAAgB;CAChB,eAAe;CACf,gBAAgB;AAClB;AAEA,eAAsB,gBAAgB,SAGnC;CACD,IAAI;EACF,MAAM,QAAQ,MAAM,QAAQ,SAAS,EAAE,eAAe,KAAK,CAAC;EAkB5D,OAAO;GAAE,aAhBW,MACjB,QAAQ,SAAS,KAAK,YAAY,CAAC,EACnC,KAAK,SAAS,KAAK,IAAI,EACvB,QAAQ,SAAS,CAAC,KAAK,WAAW,GAAG,CAAC,EACtC,KAYgB;GAAG,OAVR,MACX,QACE,SACC,KAAK,OAAO,MACX,QAAQ,KAAK,IAAI,MAAA,UAChB,QAAQ,KAAK,IAAI,MAAA,MACvB,EACC,KAAK,SAAS,KAAK,IAAI,EACvB,KAEuB;EAAE;CAC9B,SAAS,OAAO;EACd,OAAO,MAAM,sCAAsC,WAAW,KAAK;EACnE,OAAO;GAAE,aAAa,CAAC;GAAG,OAAO,CAAC;EAAE;CACtC;AACF;AAEA,eAAsB,oBAAuC;CAC3D,MAAM,QAAkB,CAAC;CAEzB,eAAe,cACb,KACA,SAAiB,IACF;EACf,MAAM,EAAE,aAAa,UAAU,MAAM,gBAAgB,GAAG;EAExD,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,OAAO,KAAK,QAAQ,eAAe,EAAE,EAAE,QAAA,OAAsB,EAAE;GACrE,MAAM,KAAK,SAAS,GAAG,OAAO,GAAG,SAAS,IAAI;EAChD;EAEA,KAAK,MAAM,UAAU,aAAa;GAChC,MAAM,aAAa,KAAK,KAAK,MAAM;GACnC,MAAM,YAAY,SAAS,GAAG,OAAO,GAAG,WAAW;GACnD,MAAM,KAAK,SAAS;GACpB,MAAM,cAAc,YAAY,SAAS;EAC3C;CACF;CAEA,MAAM,cAAc,SAAS;CAC7B,OAAO,MAAM,KAAK;AACpB;AAEA,SAAgB,iBACd,eACA,gBACU;CACV,MAAM,oBAAoB,cACvB,YAAY,EACZ,QAAQ,cAAc,EAAE;CAyB3B,OAvBe,eAAe,KAAK,SAAS;EAC1C,MAAM,iBAAiB,KAAK,YAAY,EAAE,QAAQ,cAAc,EAAE;EAElE,IAAI,eAAe,SAAS,iBAAiB,GAC3C,OAAO;GAAE;GAAM,OAAO,sBAAsB;EAAY;EAG1D,IAAI,kBAAkB,SAAS,cAAc,GAC3C,OAAO;GAAE;GAAM,OAAO,sBAAsB;EAAe;EAO7D,OAAO;GACL;GACA,OANc,CAAC,GAAG,iBAAiB,EAAE,QAAQ,SAC7C,eAAe,SAAS,IAAI,CAC9B,EAAE,SAKa,kBAAkB,SAC7B,sBAAsB;EAC1B;CACF,CAEY,EACT,QAAQ,SAAS,KAAK,QAAQ,sBAAsB,cAAc,EAClE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAChC,MAAM,GAAG,CAAC,EACV,KAAK,SAAS,KAAK,IAAI;AAC5B;AAEA,eAAsB,WAAW,MAAgC;CAC/D,IAAI;EACF,MAAM,KAAK,IAAI;EACf,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF"}
|
package/dist/utils/security.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","
|
|
1
|
+
{"version":3,"file":"security.d.ts","names":[],"sources":["../../src/utils/security.ts"],"mappings":";iBAEgB,YAAA,CAAa,QAAgB"}
|
package/dist/utils/security.js
CHANGED
|
@@ -1,43 +1,22 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (relativePath.includes("..")) {
|
|
19
|
-
throw new Error("Invalid path: Path contains invalid traversal sequences");
|
|
20
|
-
}
|
|
21
|
-
if (relativePath.includes("\0")) {
|
|
22
|
-
throw new Error("Invalid path: Path contains null bytes");
|
|
23
|
-
}
|
|
24
|
-
if (process.platform !== "win32") {
|
|
25
|
-
if (normalized.includes("\\")) {
|
|
26
|
-
throw new Error("Invalid path: Backslashes not allowed");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
if (normalized.includes(":") || normalized.startsWith("\\\\")) {
|
|
31
|
-
throw new Error("Invalid path: Path contains invalid Windows characters");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const segments = relativePath.split(path.sep);
|
|
35
|
-
for (const segment of segments) {
|
|
36
|
-
if (segment.startsWith(".") && segment !== ".") {
|
|
37
|
-
throw new Error("Invalid path: Hidden files are not allowed");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Always return Unix-style paths for consistency across platforms
|
|
41
|
-
return relativePath.replace(/\\/g, "/");
|
|
2
|
+
//#region src/utils/security.ts
|
|
3
|
+
function sanitizePath(userPath) {
|
|
4
|
+
if (!userPath || typeof userPath !== "string") throw new Error("Invalid path: Path must be a non-empty string");
|
|
5
|
+
if (userPath.includes("../") || userPath.includes("..\\")) throw new Error("Invalid path: Directory traversal attempt detected");
|
|
6
|
+
const normalized = path.normalize(userPath);
|
|
7
|
+
if (path.isAbsolute(normalized)) throw new Error("Invalid path: Absolute paths are not allowed");
|
|
8
|
+
const relativePath = path.relative("", normalized);
|
|
9
|
+
if (relativePath.startsWith("..")) throw new Error("Invalid path: Directory traversal attempt detected");
|
|
10
|
+
if (relativePath.includes("..")) throw new Error("Invalid path: Path contains invalid traversal sequences");
|
|
11
|
+
if (relativePath.includes("\0")) throw new Error("Invalid path: Path contains null bytes");
|
|
12
|
+
if (process.platform !== "win32") {
|
|
13
|
+
if (normalized.includes("\\")) throw new Error("Invalid path: Backslashes not allowed");
|
|
14
|
+
} else if (normalized.includes(":") || normalized.startsWith("\\\\")) throw new Error("Invalid path: Path contains invalid Windows characters");
|
|
15
|
+
const segments = relativePath.split(path.sep);
|
|
16
|
+
for (const segment of segments) if (segment.startsWith(".") && segment !== ".") throw new Error("Invalid path: Hidden files are not allowed");
|
|
17
|
+
return relativePath.replace(/\\/g, "/");
|
|
42
18
|
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { sanitizePath };
|
|
21
|
+
|
|
43
22
|
//# sourceMappingURL=security.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","
|
|
1
|
+
{"version":3,"file":"security.js","names":[],"sources":["../../src/utils/security.ts"],"sourcesContent":["import path from \"node:path\";\n\nexport function sanitizePath(userPath: string): string {\n if (!userPath || typeof userPath !== \"string\") {\n throw new Error(\"Invalid path: Path must be a non-empty string\");\n }\n\n // Check for traversal patterns before normalization - defense in depth\n if (userPath.includes(\"../\") || userPath.includes(\"..\\\\\")) {\n throw new Error(\"Invalid path: Directory traversal attempt detected\");\n }\n\n const normalized = path.normalize(userPath);\n\n if (path.isAbsolute(normalized)) {\n throw new Error(\"Invalid path: Absolute paths are not allowed\");\n }\n\n const relativePath = path.relative(\"\", normalized);\n\n if (relativePath.startsWith(\"..\")) {\n throw new Error(\"Invalid path: Directory traversal attempt detected\");\n }\n\n if (relativePath.includes(\"..\")) {\n throw new Error(\"Invalid path: Path contains invalid traversal sequences\");\n }\n\n if (relativePath.includes(\"\\0\")) {\n throw new Error(\"Invalid path: Path contains null bytes\");\n }\n\n if (process.platform !== \"win32\") {\n if (normalized.includes(\"\\\\\")) {\n throw new Error(\"Invalid path: Backslashes not allowed\");\n }\n } else {\n if (normalized.includes(\":\") || normalized.startsWith(\"\\\\\\\\\")) {\n throw new Error(\"Invalid path: Path contains invalid Windows characters\");\n }\n }\n\n const segments = relativePath.split(path.sep);\n for (const segment of segments) {\n if (segment.startsWith(\".\") && segment !== \".\") {\n throw new Error(\"Invalid path: Hidden files are not allowed\");\n }\n }\n\n // Always return Unix-style paths for consistency across platforms\n return relativePath.replace(/\\\\/g, \"/\");\n}\n"],"mappings":";;AAEA,SAAgB,aAAa,UAA0B;CACrD,IAAI,CAAC,YAAY,OAAO,aAAa,UACnC,MAAM,IAAI,MAAM,+CAA+C;CAIjE,IAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,MAAM,GACtD,MAAM,IAAI,MAAM,oDAAoD;CAGtE,MAAM,aAAa,KAAK,UAAU,QAAQ;CAE1C,IAAI,KAAK,WAAW,UAAU,GAC5B,MAAM,IAAI,MAAM,8CAA8C;CAGhE,MAAM,eAAe,KAAK,SAAS,IAAI,UAAU;CAEjD,IAAI,aAAa,WAAW,IAAI,GAC9B,MAAM,IAAI,MAAM,oDAAoD;CAGtE,IAAI,aAAa,SAAS,IAAI,GAC5B,MAAM,IAAI,MAAM,yDAAyD;CAG3E,IAAI,aAAa,SAAS,IAAI,GAC5B,MAAM,IAAI,MAAM,wCAAwC;CAG1D,IAAI,QAAQ,aAAa;MACnB,WAAW,SAAS,IAAI,GAC1B,MAAM,IAAI,MAAM,uCAAuC;CAAA,OAGzD,IAAI,WAAW,SAAS,GAAG,KAAK,WAAW,WAAW,MAAM,GAC1D,MAAM,IAAI,MAAM,wDAAwD;CAI5E,MAAM,WAAW,aAAa,MAAM,KAAK,GAAG;CAC5C,KAAK,MAAM,WAAW,UACpB,IAAI,QAAQ,WAAW,GAAG,KAAK,YAAY,KACzC,MAAM,IAAI,MAAM,4CAA4C;CAKhE,OAAO,aAAa,QAAQ,OAAO,GAAG;AACxC"}
|