@assistant-ui/mcp-docs-server 0.2.3 → 0.3.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 +16 -43
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -91
- package/dist/index.js.map +1 -1
- package/dist/proxy.d.ts +9 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +76 -0
- package/dist/proxy.js.map +1 -0
- package/package.json +8 -12
- package/src/index.ts +3 -115
- package/src/proxy.test.ts +250 -0
- package/src/proxy.ts +111 -0
- package/.docs/organized/code-examples/waterfall.md +0 -807
- package/.docs/organized/code-examples/with-a2a.md +0 -675
- package/.docs/organized/code-examples/with-ag-ui.md +0 -553
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +0 -466
- package/.docs/organized/code-examples/with-artifacts.md +0 -815
- package/.docs/organized/code-examples/with-assistant-transport.md +0 -576
- package/.docs/organized/code-examples/with-browser-extension.md +0 -371
- package/.docs/organized/code-examples/with-chain-of-thought.md +0 -962
- package/.docs/organized/code-examples/with-cloud-standalone.md +0 -681
- package/.docs/organized/code-examples/with-cloud.md +0 -439
- package/.docs/organized/code-examples/with-custom-thread-list.md +0 -569
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +0 -527
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +0 -697
- package/.docs/organized/code-examples/with-eve.md +0 -405
- package/.docs/organized/code-examples/with-expo.md +0 -2246
- package/.docs/organized/code-examples/with-external-store.md +0 -421
- package/.docs/organized/code-examples/with-ffmpeg.md +0 -829
- package/.docs/organized/code-examples/with-generative-ui.md +0 -1810
- package/.docs/organized/code-examples/with-google-adk.md +0 -368
- package/.docs/organized/code-examples/with-heat-graph.md +0 -304
- package/.docs/organized/code-examples/with-image-generation.md +0 -463
- package/.docs/organized/code-examples/with-interactables.md +0 -733
- package/.docs/organized/code-examples/with-langchain.md +0 -446
- package/.docs/organized/code-examples/with-langgraph.md +0 -855
- package/.docs/organized/code-examples/with-livekit.md +0 -643
- package/.docs/organized/code-examples/with-mcp.md +0 -782
- package/.docs/organized/code-examples/with-nuxt.md +0 -2428
- package/.docs/organized/code-examples/with-opencode.md +0 -1974
- package/.docs/organized/code-examples/with-openui.md +0 -450
- package/.docs/organized/code-examples/with-pi.md +0 -2084
- package/.docs/organized/code-examples/with-react-hook-form.md +0 -727
- package/.docs/organized/code-examples/with-react-ink-web.md +0 -740
- package/.docs/organized/code-examples/with-react-ink.md +0 -473
- package/.docs/organized/code-examples/with-react-router.md +0 -936
- package/.docs/organized/code-examples/with-resumable-stream.md +0 -668
- package/.docs/organized/code-examples/with-store.md +0 -679
- package/.docs/organized/code-examples/with-svelte.md +0 -415
- package/.docs/organized/code-examples/with-sveltekit.md +0 -1061
- package/.docs/organized/code-examples/with-tanstack.md +0 -812
- package/.docs/organized/code-examples/with-tap-runtime.md +0 -813
- package/.docs/organized/code-examples/with-virtualized-thread.md +0 -681
- package/.docs/organized/code-examples/with-vue.md +0 -408
- package/.docs/raw/docs/(getting-started)/architecture.mdx +0 -146
- package/.docs/raw/docs/(getting-started)/base-ui.mdx +0 -39
- package/.docs/raw/docs/(getting-started)/cli.mdx +0 -542
- package/.docs/raw/docs/(getting-started)/devtools.mdx +0 -79
- package/.docs/raw/docs/(getting-started)/index.mdx +0 -23
- package/.docs/raw/docs/(getting-started)/installation.mdx +0 -483
- package/.docs/raw/docs/(getting-started)/llm.mdx +0 -211
- package/.docs/raw/docs/(getting-started)/rtl.mdx +0 -78
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +0 -36
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +0 -34
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +0 -44
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +0 -59
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +0 -26
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -84
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +0 -64
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +0 -57
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +0 -49
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/a2ui.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/actions.mdx +0 -56
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/components.mdx +0 -86
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +0 -39
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/json-generative-ui.mdx +0 -42
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +0 -84
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +0 -85
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +0 -45
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +0 -93
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/tokens.mdx +0 -62
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +0 -129
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +0 -31
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +0 -34
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +0 -350
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +0 -28
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +0 -97
- package/.docs/raw/docs/(reference)/api-reference/integrations/ai-sdk.mdx +0 -200
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +0 -118
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +0 -28
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -37
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +0 -50
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +0 -566
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +0 -152
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +0 -239
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +0 -208
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +0 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -99
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -145
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +0 -82
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +0 -637
- package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -65
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +0 -73
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +0 -117
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -339
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +0 -77
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +0 -88
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +0 -81
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -129
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +0 -138
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +0 -122
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +0 -289
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +0 -32
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +0 -43
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +0 -43
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +0 -36
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +0 -85
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +0 -45
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables-legacy.mdx +0 -55
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +0 -151
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +0 -106
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +0 -62
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +0 -178
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +0 -48
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +0 -62
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +0 -19
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +0 -152
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +0 -54
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +0 -36
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +0 -527
- package/.docs/raw/docs/cloud/ai-sdk.mdx +0 -604
- package/.docs/raw/docs/cloud/authorization.mdx +0 -252
- package/.docs/raw/docs/cloud/index.mdx +0 -46
- package/.docs/raw/docs/cloud/langgraph.mdx +0 -554
- package/.docs/raw/docs/copilots/assistant-frame.mdx +0 -411
- package/.docs/raw/docs/copilots/make-assistant-visible.mdx +0 -82
- package/.docs/raw/docs/copilots/model-context.mdx +0 -156
- package/.docs/raw/docs/copilots/motivation.mdx +0 -202
- package/.docs/raw/docs/copilots/use-assistant-instructions.mdx +0 -64
- package/.docs/raw/docs/guides/attachments.mdx +0 -619
- package/.docs/raw/docs/guides/branching.mdx +0 -76
- package/.docs/raw/docs/guides/chain-of-thought.mdx +0 -164
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +0 -108
- package/.docs/raw/docs/guides/context-api.mdx +0 -619
- package/.docs/raw/docs/guides/dictation.mdx +0 -298
- package/.docs/raw/docs/guides/editing.mdx +0 -102
- package/.docs/raw/docs/guides/electron.mdx +0 -369
- package/.docs/raw/docs/guides/headless-composer-input.mdx +0 -113
- package/.docs/raw/docs/guides/image-generation.mdx +0 -74
- package/.docs/raw/docs/guides/index.mdx +0 -117
- package/.docs/raw/docs/guides/input-history.mdx +0 -55
- package/.docs/raw/docs/guides/latex.mdx +0 -158
- package/.docs/raw/docs/guides/mentions.mdx +0 -575
- package/.docs/raw/docs/guides/message-timing.mdx +0 -215
- package/.docs/raw/docs/guides/quoting.mdx +0 -169
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +0 -212
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +0 -152
- package/.docs/raw/docs/guides/resumable-streams.mdx +0 -292
- package/.docs/raw/docs/guides/slash-commands.mdx +0 -358
- package/.docs/raw/docs/guides/speech.mdx +0 -172
- package/.docs/raw/docs/guides/suggestions.mdx +0 -384
- package/.docs/raw/docs/guides/virtualization.mdx +0 -133
- package/.docs/raw/docs/guides/voice.mdx +0 -310
- package/.docs/raw/docs/ink/adapters.mdx +0 -99
- package/.docs/raw/docs/ink/custom-backend.mdx +0 -254
- package/.docs/raw/docs/ink/hooks.mdx +0 -469
- package/.docs/raw/docs/ink/index.mdx +0 -237
- package/.docs/raw/docs/ink/migration.mdx +0 -138
- package/.docs/raw/docs/ink/primitives.mdx +0 -1259
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +0 -528
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +0 -188
- package/.docs/raw/docs/integrations/auth/clerk.mdx +0 -166
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +0 -191
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +0 -88
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents.mdx +0 -283
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +0 -188
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +0 -57
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +0 -201
- package/.docs/raw/docs/integrations/gateways/index.mdx +0 -162
- package/.docs/raw/docs/integrations/index.mdx +0 -178
- package/.docs/raw/docs/integrations/observability/helicone.mdx +0 -129
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +0 -161
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +0 -151
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +0 -773
- package/.docs/raw/docs/migrations/deprecation-policy.mdx +0 -42
- package/.docs/raw/docs/migrations/index.mdx +0 -50
- package/.docs/raw/docs/migrations/react-compatibility.mdx +0 -74
- package/.docs/raw/docs/migrations/react-langgraph-v0-7.mdx +0 -328
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +0 -236
- package/.docs/raw/docs/migrations/v0-11.mdx +0 -172
- package/.docs/raw/docs/migrations/v0-12.mdx +0 -302
- package/.docs/raw/docs/migrations/v0-14.mdx +0 -297
- package/.docs/raw/docs/migrations/v0-15.mdx +0 -270
- package/.docs/raw/docs/primitives/action-bar.mdx +0 -352
- package/.docs/raw/docs/primitives/assistant-modal.mdx +0 -216
- package/.docs/raw/docs/primitives/attachment.mdx +0 -217
- package/.docs/raw/docs/primitives/branch-picker.mdx +0 -222
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +0 -315
- package/.docs/raw/docs/primitives/composer.mdx +0 -659
- package/.docs/raw/docs/primitives/error.mdx +0 -142
- package/.docs/raw/docs/primitives/index.mdx +0 -99
- package/.docs/raw/docs/primitives/message.mdx +0 -618
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +0 -191
- package/.docs/raw/docs/primitives/suggestion.mdx +0 -254
- package/.docs/raw/docs/primitives/thread-list.mdx +0 -467
- package/.docs/raw/docs/primitives/thread.mdx +0 -509
- package/.docs/raw/docs/react-native/adapters.mdx +0 -94
- package/.docs/raw/docs/react-native/custom-backend.mdx +0 -207
- package/.docs/raw/docs/react-native/hooks.mdx +0 -339
- package/.docs/raw/docs/react-native/index.mdx +0 -289
- package/.docs/raw/docs/react-native/migration.mdx +0 -142
- package/.docs/raw/docs/react-native/primitives.mdx +0 -976
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +0 -399
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +0 -60
- package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +0 -216
- package/.docs/raw/docs/runtimes/ag-ui/agent-state.mdx +0 -124
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +0 -70
- package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +0 -243
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +0 -267
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +0 -61
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -122
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +0 -135
- package/.docs/raw/docs/runtimes/ai-sdk/v6-legacy.mdx +0 -636
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +0 -731
- package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +0 -118
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +0 -265
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +0 -167
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +0 -68
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +0 -513
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +0 -763
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +0 -339
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +0 -957
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +0 -902
- package/.docs/raw/docs/runtimes/custom/overview.mdx +0 -71
- package/.docs/raw/docs/runtimes/eve/overview.mdx +0 -151
- package/.docs/raw/docs/runtimes/eve/quickstart.mdx +0 -192
- package/.docs/raw/docs/runtimes/google-adk/api.mdx +0 -256
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +0 -784
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +0 -69
- package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +0 -229
- package/.docs/raw/docs/runtimes/langchain.mdx +0 -901
- package/.docs/raw/docs/runtimes/langgraph/agent-state.mdx +0 -181
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +0 -305
- package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +0 -104
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +0 -84
- package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +0 -496
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +0 -144
- package/.docs/raw/docs/runtimes/langgraph/threads.mdx +0 -113
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +0 -29
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -93
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +0 -347
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -393
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +0 -194
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +0 -58
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +0 -119
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +0 -133
- package/.docs/raw/docs/tools/a2ui.mdx +0 -107
- package/.docs/raw/docs/tools/backend.mdx +0 -147
- package/.docs/raw/docs/tools/defining-tools.mdx +0 -574
- package/.docs/raw/docs/tools/dynamic-tools.mdx +0 -112
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +0 -180
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +0 -167
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +0 -160
- package/.docs/raw/docs/tools/generative-ui.mdx +0 -322
- package/.docs/raw/docs/tools/index.mdx +0 -72
- package/.docs/raw/docs/tools/interactables.mdx +0 -1084
- package/.docs/raw/docs/tools/mcp-apps.mdx +0 -363
- package/.docs/raw/docs/tools/mcp.mdx +0 -466
- package/.docs/raw/docs/tools/multi-agent.mdx +0 -237
- package/.docs/raw/docs/tools/openui.mdx +0 -175
- package/.docs/raw/docs/tools/tool-ui.mdx +0 -1020
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +0 -428
- package/.docs/raw/docs/ui/assistant-modal.mdx +0 -166
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +0 -89
- package/.docs/raw/docs/ui/attachment.mdx +0 -279
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +0 -247
- package/.docs/raw/docs/ui/context-display.mdx +0 -148
- package/.docs/raw/docs/ui/directive-text.mdx +0 -114
- package/.docs/raw/docs/ui/file.mdx +0 -159
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +0 -82
- package/.docs/raw/docs/ui/image.mdx +0 -102
- package/.docs/raw/docs/ui/markdown.mdx +0 -103
- package/.docs/raw/docs/ui/mcp-config.mdx +0 -107
- package/.docs/raw/docs/ui/mermaid.mdx +0 -92
- package/.docs/raw/docs/ui/message-timing.mdx +0 -93
- package/.docs/raw/docs/ui/model-selector.mdx +0 -455
- package/.docs/raw/docs/ui/part-grouping.mdx +0 -614
- package/.docs/raw/docs/ui/quote.mdx +0 -211
- package/.docs/raw/docs/ui/reasoning.mdx +0 -214
- package/.docs/raw/docs/ui/scrollbar.mdx +0 -77
- package/.docs/raw/docs/ui/sources.mdx +0 -186
- package/.docs/raw/docs/ui/streamdown.mdx +0 -392
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +0 -205
- package/.docs/raw/docs/ui/thread-list.mdx +0 -411
- package/.docs/raw/docs/ui/thread.mdx +0 -559
- package/.docs/raw/docs/ui/tool-fallback.mdx +0 -141
- package/.docs/raw/docs/ui/tool-group.mdx +0 -240
- package/.docs/raw/docs/ui/voice.mdx +0 -173
- package/.docs/raw/docs/utilities/heat-graph.mdx +0 -237
- package/.docs/raw/docs/utilities/react-o11y.mdx +0 -362
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +0 -212
- package/dist/constants.d.ts +0 -14
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -19
- package/dist/constants.js.map +0 -1
- package/dist/prepare-docs/code-examples.d.ts +0 -5
- package/dist/prepare-docs/code-examples.d.ts.map +0 -1
- package/dist/prepare-docs/code-examples.js +0 -117
- package/dist/prepare-docs/code-examples.js.map +0 -1
- package/dist/prepare-docs/copy-raw.d.ts +0 -5
- package/dist/prepare-docs/copy-raw.d.ts.map +0 -1
- package/dist/prepare-docs/copy-raw.js +0 -49
- package/dist/prepare-docs/copy-raw.js.map +0 -1
- package/dist/prepare-docs/prepare.d.ts +0 -1
- package/dist/prepare-docs/prepare.js +0 -22
- package/dist/prepare-docs/prepare.js.map +0 -1
- package/dist/prompts/xulux-playground.d.ts +0 -12
- package/dist/prompts/xulux-playground.d.ts.map +0 -1
- package/dist/prompts/xulux-playground.js +0 -33
- package/dist/prompts/xulux-playground.js.map +0 -1
- package/dist/tools/docs.d.ts +0 -22
- package/dist/tools/docs.d.ts.map +0 -1
- package/dist/tools/docs.js +0 -177
- package/dist/tools/docs.js.map +0 -1
- package/dist/tools/examples.d.ts +0 -24
- package/dist/tools/examples.d.ts.map +0 -1
- package/dist/tools/examples.js +0 -87
- package/dist/tools/examples.js.map +0 -1
- package/dist/tools/resources.d.ts +0 -6
- package/dist/tools/resources.d.ts.map +0 -1
- package/dist/tools/resources.js +0 -75
- package/dist/tools/resources.js.map +0 -1
- package/dist/tools/search.d.ts +0 -24
- package/dist/tools/search.d.ts.map +0 -1
- package/dist/tools/search.js +0 -39
- package/dist/tools/search.js.map +0 -1
- package/dist/tools/tests/mcp-test-client.d.ts +0 -15
- package/dist/tools/tests/mcp-test-client.d.ts.map +0 -1
- package/dist/tools/tests/mcp-test-client.js +0 -68
- package/dist/tools/tests/mcp-test-client.js.map +0 -1
- package/dist/tools/tests/test-setup.d.ts +0 -7
- package/dist/tools/tests/test-setup.d.ts.map +0 -1
- package/dist/tools/tests/test-setup.js +0 -36
- package/dist/tools/tests/test-setup.js.map +0 -1
- package/dist/tools/xulux-templates.d.ts +0 -58
- package/dist/tools/xulux-templates.d.ts.map +0 -1
- package/dist/tools/xulux-templates.js +0 -84
- package/dist/tools/xulux-templates.js.map +0 -1
- package/dist/utils/cache.d.ts +0 -5
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js +0 -18
- package/dist/utils/cache.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -10
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -20
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/mcp-format.d.ts +0 -11
- package/dist/utils/mcp-format.d.ts.map +0 -1
- package/dist/utils/mcp-format.js +0 -14
- package/dist/utils/mcp-format.js.map +0 -1
- package/dist/utils/mdx.d.ts +0 -12
- package/dist/utils/mdx.d.ts.map +0 -1
- package/dist/utils/mdx.js +0 -45
- package/dist/utils/mdx.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -12
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js +0 -93
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/search.d.ts +0 -10
- package/dist/utils/search.d.ts.map +0 -1
- package/dist/utils/search.js +0 -97
- package/dist/utils/search.js.map +0 -1
- package/dist/utils/security.d.ts +0 -5
- package/dist/utils/security.d.ts.map +0 -1
- package/dist/utils/security.js +0 -22
- package/dist/utils/security.js.map +0 -1
- package/dist/xulux/catalog-client.d.ts +0 -14
- package/dist/xulux/catalog-client.d.ts.map +0 -1
- package/dist/xulux/catalog-client.js +0 -112
- package/dist/xulux/catalog-client.js.map +0 -1
- package/dist/xulux/fallback-catalog.d.ts +0 -7
- package/dist/xulux/fallback-catalog.d.ts.map +0 -1
- package/dist/xulux/fallback-catalog.js +0 -47
- package/dist/xulux/fallback-catalog.js.map +0 -1
- package/dist/xulux/fetch-sandbox.d.ts +0 -5
- package/dist/xulux/fetch-sandbox.d.ts.map +0 -1
- package/dist/xulux/fetch-sandbox.js +0 -40
- package/dist/xulux/fetch-sandbox.js.map +0 -1
- package/dist/xulux/template-service.d.ts +0 -84
- package/dist/xulux/template-service.d.ts.map +0 -1
- package/dist/xulux/template-service.js +0 -223
- package/dist/xulux/template-service.js.map +0 -1
- package/dist/xulux/types.d.ts +0 -55
- package/dist/xulux/types.d.ts.map +0 -1
- package/dist/xulux/types.js +0 -6
- package/dist/xulux/types.js.map +0 -1
- package/src/constants.ts +0 -24
- package/src/prepare-docs/code-examples.ts +0 -158
- package/src/prepare-docs/copy-raw.ts +0 -50
- package/src/prepare-docs/prepare.ts +0 -24
- package/src/prompts/xulux-playground.ts +0 -36
- package/src/tools/docs.ts +0 -255
- package/src/tools/examples.ts +0 -114
- package/src/tools/resources.ts +0 -111
- package/src/tools/search.ts +0 -46
- package/src/tools/tests/completions.test.ts +0 -60
- package/src/tools/tests/directory-size-cap.test.ts +0 -50
- package/src/tools/tests/docs.test.ts +0 -147
- package/src/tools/tests/examples.test.ts +0 -94
- package/src/tools/tests/integration.test.ts +0 -45
- package/src/tools/tests/json-parsing.test.ts +0 -23
- package/src/tools/tests/listings-cache.test.ts +0 -19
- package/src/tools/tests/mcp-protocol.test.ts +0 -216
- package/src/tools/tests/mcp-test-client.ts +0 -111
- package/src/tools/tests/path-traversal.test.ts +0 -84
- package/src/tools/tests/resources.test.ts +0 -133
- package/src/tools/tests/search.test.ts +0 -37
- package/src/tools/tests/test-setup.ts +0 -50
- package/src/tools/tests/xulux-templates.test.ts +0 -325
- package/src/tools/xulux-templates.ts +0 -141
- package/src/utils/cache.ts +0 -20
- package/src/utils/logger.ts +0 -20
- package/src/utils/mcp-format.ts +0 -14
- package/src/utils/mdx.ts +0 -59
- package/src/utils/paths.ts +0 -139
- package/src/utils/search.ts +0 -131
- package/src/utils/security.ts +0 -52
- package/src/utils/tests/cache.test.ts +0 -51
- package/src/utils/tests/mcp-format.test.ts +0 -22
- package/src/utils/tests/security.test.ts +0 -119
- package/src/xulux/catalog-client.ts +0 -150
- package/src/xulux/fallback-catalog.ts +0 -63
- package/src/xulux/fetch-sandbox.ts +0 -56
- package/src/xulux/template-service.ts +0 -406
- package/src/xulux/types.ts +0 -64
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { EXAMPLES_PATH, ROOT_DIR } from "../constants.js";
|
|
2
|
-
import { logger } from "../utils/logger.js";
|
|
3
|
-
import { extname, join, relative } from "node:path";
|
|
4
|
-
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
5
|
-
//#region src/prepare-docs/code-examples.ts
|
|
6
|
-
const OUTPUT_DIR = join(ROOT_DIR, "packages/mcp-docs-server/.docs/organized/code-examples");
|
|
7
|
-
const MAX_LINES = 1e4;
|
|
8
|
-
async function scanDirectory(dir, baseDir) {
|
|
9
|
-
const files = [];
|
|
10
|
-
try {
|
|
11
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
12
|
-
for (const entry of entries) {
|
|
13
|
-
const fullPath = join(dir, entry.name);
|
|
14
|
-
if (entry.isDirectory()) {
|
|
15
|
-
if (![
|
|
16
|
-
"node_modules",
|
|
17
|
-
"dist",
|
|
18
|
-
"build",
|
|
19
|
-
".next",
|
|
20
|
-
".git",
|
|
21
|
-
".turbo"
|
|
22
|
-
].includes(entry.name)) {
|
|
23
|
-
const subFiles = await scanDirectory(fullPath, baseDir);
|
|
24
|
-
files.push(...subFiles);
|
|
25
|
-
}
|
|
26
|
-
} else if (entry.isFile()) {
|
|
27
|
-
const includeExts = [
|
|
28
|
-
".ts",
|
|
29
|
-
".tsx",
|
|
30
|
-
".js",
|
|
31
|
-
".jsx",
|
|
32
|
-
".json",
|
|
33
|
-
".css",
|
|
34
|
-
".md",
|
|
35
|
-
".mdx"
|
|
36
|
-
];
|
|
37
|
-
const ext = extname(entry.name).toLowerCase();
|
|
38
|
-
if (includeExts.includes(ext) || entry.name === "package.json" || entry.name === "tsconfig.json") try {
|
|
39
|
-
const content = await readFile(fullPath, "utf-8");
|
|
40
|
-
const relativePath = relative(baseDir, fullPath);
|
|
41
|
-
files.push({
|
|
42
|
-
path: relativePath,
|
|
43
|
-
content
|
|
44
|
-
});
|
|
45
|
-
} catch (error) {
|
|
46
|
-
logger.warn(`Failed to read file: ${fullPath}`, error);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
} catch (error) {
|
|
51
|
-
logger.error(`Failed to scan directory: ${dir}`, error);
|
|
52
|
-
}
|
|
53
|
-
return files;
|
|
54
|
-
}
|
|
55
|
-
function getFileType(filename) {
|
|
56
|
-
return {
|
|
57
|
-
".ts": "typescript",
|
|
58
|
-
".tsx": "tsx",
|
|
59
|
-
".js": "javascript",
|
|
60
|
-
".jsx": "jsx",
|
|
61
|
-
".json": "json",
|
|
62
|
-
".css": "css",
|
|
63
|
-
".md": "markdown",
|
|
64
|
-
".mdx": "mdx"
|
|
65
|
-
}[extname(filename).toLowerCase()] || "text";
|
|
66
|
-
}
|
|
67
|
-
async function prepareCodeExamples() {
|
|
68
|
-
logger.info("Preparing code examples...");
|
|
69
|
-
try {
|
|
70
|
-
await rm(OUTPUT_DIR, {
|
|
71
|
-
recursive: true,
|
|
72
|
-
force: true
|
|
73
|
-
});
|
|
74
|
-
await mkdir(OUTPUT_DIR, { recursive: true });
|
|
75
|
-
const exampleDirs = await readdir(EXAMPLES_PATH, { withFileTypes: true });
|
|
76
|
-
for (const dir of exampleDirs) if (dir.isDirectory() && !dir.name.startsWith(".")) {
|
|
77
|
-
const examplePath = join(EXAMPLES_PATH, dir.name);
|
|
78
|
-
logger.info(`Processing example: ${dir.name}`);
|
|
79
|
-
let description = "";
|
|
80
|
-
try {
|
|
81
|
-
const packageJsonPath = join(examplePath, "package.json");
|
|
82
|
-
description = JSON.parse(await readFile(packageJsonPath, "utf-8")).description || "";
|
|
83
|
-
} catch (error) {
|
|
84
|
-
if (error?.code !== "ENOENT") logger.warn(`Failed to read package.json for ${dir.name}:`, error);
|
|
85
|
-
else logger.debug(`No package.json found for example: ${dir.name}`);
|
|
86
|
-
}
|
|
87
|
-
const files = await scanDirectory(examplePath, examplePath);
|
|
88
|
-
files.sort((a, b) => a.path.localeCompare(b.path));
|
|
89
|
-
let markdown = `# Example: ${dir.name}\n\n`;
|
|
90
|
-
if (description) markdown += `${description}\n\n`;
|
|
91
|
-
let totalLines = 0;
|
|
92
|
-
for (const file of files) {
|
|
93
|
-
const lines = file.content.split("\n").length;
|
|
94
|
-
if (totalLines + lines > MAX_LINES) {
|
|
95
|
-
markdown += `\n_Note: Additional files truncated due to size limits_\n`;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
markdown += `## ${file.path.replace(/\\/g, "/")}\n\n`;
|
|
99
|
-
markdown += `\`\`\`${getFileType(file.path)}\n`;
|
|
100
|
-
markdown += file.content;
|
|
101
|
-
markdown += `\n\`\`\`\n\n`;
|
|
102
|
-
totalLines += lines;
|
|
103
|
-
}
|
|
104
|
-
const outputPath = join(OUTPUT_DIR, `${dir.name}.md`);
|
|
105
|
-
await writeFile(outputPath, markdown, "utf-8");
|
|
106
|
-
logger.debug(`Created example: ${outputPath}`);
|
|
107
|
-
}
|
|
108
|
-
logger.info("Code examples preparation complete");
|
|
109
|
-
} catch (error) {
|
|
110
|
-
logger.error("Failed to prepare code examples", error);
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
export { prepareCodeExamples };
|
|
116
|
-
|
|
117
|
-
//# sourceMappingURL=code-examples.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-examples.js","names":[],"sources":["../../src/prepare-docs/code-examples.ts"],"sourcesContent":["import { rm, mkdir, readdir, readFile, writeFile } from \"node:fs/promises\";\nimport { join, relative, extname } from \"node:path\";\nimport { logger } from \"../utils/logger.js\";\nimport { ROOT_DIR, EXAMPLES_PATH } from \"../constants.js\";\n\nconst OUTPUT_DIR = join(\n ROOT_DIR,\n \"packages/mcp-docs-server/.docs/organized/code-examples\",\n);\nconst MAX_LINES = 10000;\n\ninterface FileContent {\n path: string;\n content: string;\n}\n\nasync function scanDirectory(\n dir: string,\n baseDir: string,\n): Promise<FileContent[]> {\n const files: FileContent[] = [];\n\n try {\n const entries = await readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n\n if (entry.isDirectory()) {\n const skipDirs = [\n \"node_modules\",\n \"dist\",\n \"build\",\n \".next\",\n \".git\",\n \".turbo\",\n ];\n if (!skipDirs.includes(entry.name)) {\n const subFiles = await scanDirectory(fullPath, baseDir);\n files.push(...subFiles);\n }\n } else if (entry.isFile()) {\n const includeExts = [\n \".ts\",\n \".tsx\",\n \".js\",\n \".jsx\",\n \".json\",\n \".css\",\n \".md\",\n \".mdx\",\n ];\n const ext = extname(entry.name).toLowerCase();\n\n if (\n includeExts.includes(ext) ||\n entry.name === \"package.json\" ||\n entry.name === \"tsconfig.json\"\n ) {\n try {\n const content = await readFile(fullPath, \"utf-8\");\n const relativePath = relative(baseDir, fullPath);\n files.push({ path: relativePath, content });\n } catch (error) {\n logger.warn(`Failed to read file: ${fullPath}`, error);\n }\n }\n }\n }\n } catch (error) {\n logger.error(`Failed to scan directory: ${dir}`, error);\n }\n\n return files;\n}\n\nfunction getFileType(filename: string): string {\n const ext = extname(filename).toLowerCase();\n const extMap: Record<string, string> = {\n \".ts\": \"typescript\",\n \".tsx\": \"tsx\",\n \".js\": \"javascript\",\n \".jsx\": \"jsx\",\n \".json\": \"json\",\n \".css\": \"css\",\n \".md\": \"markdown\",\n \".mdx\": \"mdx\",\n };\n return extMap[ext] || \"text\";\n}\n\nexport async function prepareCodeExamples(): Promise<void> {\n logger.info(\"Preparing code examples...\");\n\n try {\n await rm(OUTPUT_DIR, { recursive: true, force: true });\n await mkdir(OUTPUT_DIR, { recursive: true });\n\n const exampleDirs = await readdir(EXAMPLES_PATH, { withFileTypes: true });\n\n for (const dir of exampleDirs) {\n if (dir.isDirectory() && !dir.name.startsWith(\".\")) {\n const examplePath = join(EXAMPLES_PATH, dir.name);\n logger.info(`Processing example: ${dir.name}`);\n\n let description = \"\";\n try {\n const packageJsonPath = join(examplePath, \"package.json\");\n const packageJson = JSON.parse(\n await readFile(packageJsonPath, \"utf-8\"),\n );\n description = packageJson.description || \"\";\n } catch (error: any) {\n if (error?.code !== \"ENOENT\") {\n logger.warn(`Failed to read package.json for ${dir.name}:`, error);\n } else {\n logger.debug(`No package.json found for example: ${dir.name}`);\n }\n }\n\n const files = await scanDirectory(examplePath, examplePath);\n\n files.sort((a, b) => a.path.localeCompare(b.path));\n\n let markdown = `# Example: ${dir.name}\\n\\n`;\n if (description) {\n markdown += `${description}\\n\\n`;\n }\n\n let totalLines = 0;\n for (const file of files) {\n const lines = file.content.split(\"\\n\").length;\n if (totalLines + lines > MAX_LINES) {\n markdown += `\\n_Note: Additional files truncated due to size limits_\\n`;\n break;\n }\n\n // Normalize Windows backslashes to forward slashes for consistent markdown output\n markdown += `## ${file.path.replace(/\\\\/g, \"/\")}\\n\\n`;\n markdown += `\\`\\`\\`${getFileType(file.path)}\\n`;\n markdown += file.content;\n markdown += `\\n\\`\\`\\`\\n\\n`;\n\n totalLines += lines;\n }\n\n const outputPath = join(OUTPUT_DIR, `${dir.name}.md`);\n await writeFile(outputPath, markdown, \"utf-8\");\n logger.debug(`Created example: ${outputPath}`);\n }\n }\n\n logger.info(\"Code examples preparation complete\");\n } catch (error) {\n logger.error(\"Failed to prepare code examples\", error);\n throw error;\n }\n}\n"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-raw.d.ts","names":[],"sources":["../../src/prepare-docs/copy-raw.ts"],"mappings":";iBAiCsB,WAAW"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ROOT_DIR } from "../constants.js";
|
|
2
|
-
import { logger } from "../utils/logger.js";
|
|
3
|
-
import { extname, join } from "node:path";
|
|
4
|
-
import { copyFile, mkdir, readdir, rm } from "node:fs/promises";
|
|
5
|
-
//#region src/prepare-docs/copy-raw.ts
|
|
6
|
-
const DOCS_SOURCE = join(ROOT_DIR, "apps/docs/content/docs");
|
|
7
|
-
const DOCS_DEST = join(ROOT_DIR, "packages/mcp-docs-server/.docs/raw");
|
|
8
|
-
async function copyDir(src, dest) {
|
|
9
|
-
try {
|
|
10
|
-
await mkdir(dest, { recursive: true });
|
|
11
|
-
const entries = await readdir(src, { withFileTypes: true });
|
|
12
|
-
for (const entry of entries) {
|
|
13
|
-
const srcPath = join(src, entry.name);
|
|
14
|
-
const destPath = join(dest, entry.name);
|
|
15
|
-
if (entry.isDirectory()) await copyDir(srcPath, destPath);
|
|
16
|
-
else if (entry.isFile()) {
|
|
17
|
-
const ext = extname(entry.name).toLowerCase();
|
|
18
|
-
if (ext === ".mdx" || ext === ".md") {
|
|
19
|
-
await copyFile(srcPath, destPath);
|
|
20
|
-
logger.debug(`Copied: ${srcPath} -> ${destPath}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} catch (error) {
|
|
25
|
-
logger.error(`Failed to copy directory: ${src}`, error);
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
async function copyRaw() {
|
|
30
|
-
logger.info("Copying raw documentation files...");
|
|
31
|
-
try {
|
|
32
|
-
await rm(DOCS_DEST, {
|
|
33
|
-
recursive: true,
|
|
34
|
-
force: true
|
|
35
|
-
});
|
|
36
|
-
await mkdir(DOCS_DEST, { recursive: true });
|
|
37
|
-
const docsPath = join(DOCS_DEST, "docs");
|
|
38
|
-
await copyDir(DOCS_SOURCE, docsPath);
|
|
39
|
-
logger.info(`Copied documentation to ${docsPath}`);
|
|
40
|
-
logger.info("Raw documentation copy complete");
|
|
41
|
-
} catch (error) {
|
|
42
|
-
logger.error("Failed to copy raw documentation", error);
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
export { copyRaw };
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=copy-raw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-raw.js","names":[],"sources":["../../src/prepare-docs/copy-raw.ts"],"sourcesContent":["import { rm, mkdir, readdir, copyFile } from \"node:fs/promises\";\nimport { join, extname } from \"node:path\";\nimport { logger } from \"../utils/logger.js\";\nimport { ROOT_DIR } from \"../constants.js\";\n\nconst DOCS_SOURCE = join(ROOT_DIR, \"apps/docs/content/docs\");\nconst DOCS_DEST = join(ROOT_DIR, \"packages/mcp-docs-server/.docs/raw\");\n\nasync function copyDir(src: string, dest: string): Promise<void> {\n try {\n await mkdir(dest, { recursive: true });\n const entries = await readdir(src, { withFileTypes: true });\n\n for (const entry of entries) {\n const srcPath = join(src, entry.name);\n const destPath = join(dest, entry.name);\n\n if (entry.isDirectory()) {\n await copyDir(srcPath, destPath);\n } else if (entry.isFile()) {\n const ext = extname(entry.name).toLowerCase();\n if (ext === \".mdx\" || ext === \".md\") {\n await copyFile(srcPath, destPath);\n logger.debug(`Copied: ${srcPath} -> ${destPath}`);\n }\n }\n }\n } catch (error) {\n logger.error(`Failed to copy directory: ${src}`, error);\n throw error;\n }\n}\n\nexport async function copyRaw(): Promise<void> {\n logger.info(\"Copying raw documentation files...\");\n\n try {\n await rm(DOCS_DEST, { recursive: true, force: true });\n await mkdir(DOCS_DEST, { recursive: true });\n\n const docsPath = join(DOCS_DEST, \"docs\");\n await copyDir(DOCS_SOURCE, docsPath);\n logger.info(`Copied documentation to ${docsPath}`);\n\n logger.info(\"Raw documentation copy complete\");\n } catch (error) {\n logger.error(\"Failed to copy raw documentation\", error);\n throw error;\n }\n}\n"],"mappings":";;;;;AAKA,MAAM,cAAc,KAAK,UAAU,wBAAwB;AAC3D,MAAM,YAAY,KAAK,UAAU,oCAAoC;AAErE,eAAe,QAAQ,KAAa,MAA6B;CAC/D,IAAI;EACF,MAAM,MAAM,MAAM,EAAE,WAAW,KAAK,CAAC;EACrC,MAAM,UAAU,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;EAE1D,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,UAAU,KAAK,KAAK,MAAM,IAAI;GACpC,MAAM,WAAW,KAAK,MAAM,MAAM,IAAI;GAEtC,IAAI,MAAM,YAAY,GACpB,MAAM,QAAQ,SAAS,QAAQ;QAC1B,IAAI,MAAM,OAAO,GAAG;IACzB,MAAM,MAAM,QAAQ,MAAM,IAAI,CAAC,CAAC,YAAY;IAC5C,IAAI,QAAQ,UAAU,QAAQ,OAAO;KACnC,MAAM,SAAS,SAAS,QAAQ;KAChC,OAAO,MAAM,WAAW,QAAQ,MAAM,UAAU;IAClD;GACF;EACF;CACF,SAAS,OAAO;EACd,OAAO,MAAM,6BAA6B,OAAO,KAAK;EACtD,MAAM;CACR;AACF;AAEA,eAAsB,UAAyB;CAC7C,OAAO,KAAK,oCAAoC;CAEhD,IAAI;EACF,MAAM,GAAG,WAAW;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACpD,MAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;EAE1C,MAAM,WAAW,KAAK,WAAW,MAAM;EACvC,MAAM,QAAQ,aAAa,QAAQ;EACnC,OAAO,KAAK,2BAA2B,UAAU;EAEjD,OAAO,KAAK,iCAAiC;CAC/C,SAAS,OAAO;EACd,OAAO,MAAM,oCAAoC,KAAK;EACtD,MAAM;CACR;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { logger } from "../utils/logger.js";
|
|
2
|
-
import { prepareCodeExamples } from "./code-examples.js";
|
|
3
|
-
import { copyRaw } from "./copy-raw.js";
|
|
4
|
-
//#region src/prepare-docs/prepare.ts
|
|
5
|
-
async function prepare() {
|
|
6
|
-
logger.info("Starting documentation preparation...");
|
|
7
|
-
try {
|
|
8
|
-
await copyRaw();
|
|
9
|
-
await prepareCodeExamples();
|
|
10
|
-
logger.info("Documentation preparation complete");
|
|
11
|
-
} catch (error) {
|
|
12
|
-
logger.error("Documentation preparation failed", error);
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (import.meta.url === `file://${process.argv[1]}`) prepare().catch((error) => {
|
|
17
|
-
logger.error("Preparation failed", error);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
});
|
|
20
|
-
//#endregion
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=prepare.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","names":[],"sources":["../../src/prepare-docs/prepare.ts"],"sourcesContent":["import { logger } from \"../utils/logger.js\";\nimport { copyRaw } from \"./copy-raw.js\";\nimport { prepareCodeExamples } from \"./code-examples.js\";\n\nasync function prepare(): Promise<void> {\n logger.info(\"Starting documentation preparation...\");\n\n try {\n await copyRaw();\n await prepareCodeExamples();\n\n logger.info(\"Documentation preparation complete\");\n } catch (error) {\n logger.error(\"Documentation preparation failed\", error);\n throw error;\n }\n}\n\nif (import.meta.url === `file://${process.argv[1]}`) {\n prepare().catch((error) => {\n logger.error(\"Preparation failed\", error);\n process.exit(1);\n });\n}\n"],"mappings":";;;;AAIA,eAAe,UAAyB;CACtC,OAAO,KAAK,uCAAuC;CAEnD,IAAI;EACF,MAAM,QAAQ;EACd,MAAM,oBAAoB;EAE1B,OAAO,KAAK,oCAAoC;CAClD,SAAS,OAAO;EACd,OAAO,MAAM,oCAAoC,KAAK;EACtD,MAAM;CACR;AACF;AAEA,IAAI,YAAY,QAAQ,UAAU,QAAQ,KAAK,MAC7C,QAAQ,CAAC,CAAC,OAAO,UAAU;CACzB,OAAO,MAAM,sBAAsB,KAAK;CACxC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/prompts/xulux-playground.d.ts
|
|
2
|
-
declare const XULUX_PLAYGROUND_PROMPT_NAME = "assistant-ui-template-workflow";
|
|
3
|
-
declare const XULUX_PLAYGROUND_PROMPT_DESCRIPTION = "How to use the assistant-ui template tools to discover hosted templates, inspect their customization contracts, and retrieve preview/download URLs.";
|
|
4
|
-
declare const XULUX_PLAYGROUND_PROMPT = "You have access to assistant-ui template tools for hosted app templates.\n\n<workflow>\nFollow this template-first workflow for any assistant-ui app-building request:\n\n1. Call **assistantUITemplates** FIRST. Never decide on a template or claim one exists without listing.\n2. Call **assistantUITemplateDetails** on any candidate template before deciding whether it fits.\n - Review the whole template shape: features, assistantPlacement, configRoots schemas, rules, built-in tools, renderers, and exampleConfig.\n - If `customizable` is empty, the entry is a fixed demo. Use it as-is; never pass a config for it.\n3. Decide one of three paths:\n - The template fits as-is: call **assistantUITemplatePreview** with templateId and optional versionId.\n - The template fits with supported customization: author a config using the configRoots schemas and rules from assistantUITemplateDetails, then call **assistantUITemplatePreview** with that config.\n - No template fits: do NOT call assistantUITemplatePreview. Do not force the request into a template or fake domain content with mock config. Instead, ground yourself in the assistant-ui docs (assistantUIDocs, assistantUISearch, assistantUIExamples) and produce an honest, docs-grounded build guide or prompt for the user.\n</workflow>\n\n<important_constraints>\n- Only use URLs copied exactly from tool results. Never guess, fabricate, or use placeholder URLs.\n- If assistantUITemplatePreview returns validationWarnings or an error, call assistantUITemplateDetails again and correct the config against configRoots. Pass only the documented top-level config roots.\n- Customization is for supported adaptation within a template's shape, not for turning it into a completely different kind of product.\n- Responses may include `catalogDegraded: true` when the live template catalog is unreachable. In that mode, template details and preview URLs may be unavailable; tell the user rather than improvising.\n</important_constraints>";
|
|
5
|
-
declare const xuluxPlaygroundPrompt: {
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
text: string;
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { XULUX_PLAYGROUND_PROMPT, XULUX_PLAYGROUND_PROMPT_DESCRIPTION, XULUX_PLAYGROUND_PROMPT_NAME, xuluxPlaygroundPrompt };
|
|
12
|
-
//# sourceMappingURL=xulux-playground.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xulux-playground.d.ts","names":[],"sources":["../../src/prompts/xulux-playground.ts"],"mappings":";cAIa;cAEA;cAGA;cAsBA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//#region src/prompts/xulux-playground.ts
|
|
2
|
-
const XULUX_PLAYGROUND_PROMPT_NAME = "assistant-ui-template-workflow";
|
|
3
|
-
const XULUX_PLAYGROUND_PROMPT_DESCRIPTION = "How to use the assistant-ui template tools to discover hosted templates, inspect their customization contracts, and retrieve preview/download URLs.";
|
|
4
|
-
const XULUX_PLAYGROUND_PROMPT = `You have access to assistant-ui template tools for hosted app templates.
|
|
5
|
-
|
|
6
|
-
<workflow>
|
|
7
|
-
Follow this template-first workflow for any assistant-ui app-building request:
|
|
8
|
-
|
|
9
|
-
1. Call **assistantUITemplates** FIRST. Never decide on a template or claim one exists without listing.
|
|
10
|
-
2. Call **assistantUITemplateDetails** on any candidate template before deciding whether it fits.
|
|
11
|
-
- Review the whole template shape: features, assistantPlacement, configRoots schemas, rules, built-in tools, renderers, and exampleConfig.
|
|
12
|
-
- If \`customizable\` is empty, the entry is a fixed demo. Use it as-is; never pass a config for it.
|
|
13
|
-
3. Decide one of three paths:
|
|
14
|
-
- The template fits as-is: call **assistantUITemplatePreview** with templateId and optional versionId.
|
|
15
|
-
- The template fits with supported customization: author a config using the configRoots schemas and rules from assistantUITemplateDetails, then call **assistantUITemplatePreview** with that config.
|
|
16
|
-
- No template fits: do NOT call assistantUITemplatePreview. Do not force the request into a template or fake domain content with mock config. Instead, ground yourself in the assistant-ui docs (assistantUIDocs, assistantUISearch, assistantUIExamples) and produce an honest, docs-grounded build guide or prompt for the user.
|
|
17
|
-
</workflow>
|
|
18
|
-
|
|
19
|
-
<important_constraints>
|
|
20
|
-
- Only use URLs copied exactly from tool results. Never guess, fabricate, or use placeholder URLs.
|
|
21
|
-
- If assistantUITemplatePreview returns validationWarnings or an error, call assistantUITemplateDetails again and correct the config against configRoots. Pass only the documented top-level config roots.
|
|
22
|
-
- Customization is for supported adaptation within a template's shape, not for turning it into a completely different kind of product.
|
|
23
|
-
- Responses may include \`catalogDegraded: true\` when the live template catalog is unreachable. In that mode, template details and preview URLs may be unavailable; tell the user rather than improvising.
|
|
24
|
-
</important_constraints>`;
|
|
25
|
-
const xuluxPlaygroundPrompt = {
|
|
26
|
-
name: XULUX_PLAYGROUND_PROMPT_NAME,
|
|
27
|
-
description: XULUX_PLAYGROUND_PROMPT_DESCRIPTION,
|
|
28
|
-
text: XULUX_PLAYGROUND_PROMPT
|
|
29
|
-
};
|
|
30
|
-
//#endregion
|
|
31
|
-
export { XULUX_PLAYGROUND_PROMPT, XULUX_PLAYGROUND_PROMPT_DESCRIPTION, XULUX_PLAYGROUND_PROMPT_NAME, xuluxPlaygroundPrompt };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=xulux-playground.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xulux-playground.js","names":[],"sources":["../../src/prompts/xulux-playground.ts"],"sourcesContent":["// Skill-style MCP prompt teaching agents the assistant-ui template workflow.\n// Adapted for MCP clients: tools return URLs and data only; there is no\n// browser canvas UI here.\n\nexport const XULUX_PLAYGROUND_PROMPT_NAME = \"assistant-ui-template-workflow\";\n\nexport const XULUX_PLAYGROUND_PROMPT_DESCRIPTION =\n \"How to use the assistant-ui template tools to discover hosted templates, inspect their customization contracts, and retrieve preview/download URLs.\";\n\nexport const XULUX_PLAYGROUND_PROMPT = `You have access to assistant-ui template tools for hosted app templates.\n\n<workflow>\nFollow this template-first workflow for any assistant-ui app-building request:\n\n1. Call **assistantUITemplates** FIRST. Never decide on a template or claim one exists without listing.\n2. Call **assistantUITemplateDetails** on any candidate template before deciding whether it fits.\n - Review the whole template shape: features, assistantPlacement, configRoots schemas, rules, built-in tools, renderers, and exampleConfig.\n - If \\`customizable\\` is empty, the entry is a fixed demo. Use it as-is; never pass a config for it.\n3. Decide one of three paths:\n - The template fits as-is: call **assistantUITemplatePreview** with templateId and optional versionId.\n - The template fits with supported customization: author a config using the configRoots schemas and rules from assistantUITemplateDetails, then call **assistantUITemplatePreview** with that config.\n - No template fits: do NOT call assistantUITemplatePreview. Do not force the request into a template or fake domain content with mock config. Instead, ground yourself in the assistant-ui docs (assistantUIDocs, assistantUISearch, assistantUIExamples) and produce an honest, docs-grounded build guide or prompt for the user.\n</workflow>\n\n<important_constraints>\n- Only use URLs copied exactly from tool results. Never guess, fabricate, or use placeholder URLs.\n- If assistantUITemplatePreview returns validationWarnings or an error, call assistantUITemplateDetails again and correct the config against configRoots. Pass only the documented top-level config roots.\n- Customization is for supported adaptation within a template's shape, not for turning it into a completely different kind of product.\n- Responses may include \\`catalogDegraded: true\\` when the live template catalog is unreachable. In that mode, template details and preview URLs may be unavailable; tell the user rather than improvising.\n</important_constraints>`;\n\nexport const xuluxPlaygroundPrompt = {\n name: XULUX_PLAYGROUND_PROMPT_NAME,\n description: XULUX_PLAYGROUND_PROMPT_DESCRIPTION,\n text: XULUX_PLAYGROUND_PROMPT,\n};\n"],"mappings":";AAIA,MAAa,+BAA+B;AAE5C,MAAa,sCACX;AAEF,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;AAsBvC,MAAa,wBAAwB;CACnC,MAAM;CACN,aAAa;CACb,MAAM;AACR"}
|
package/dist/tools/docs.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/tools/docs.d.ts
|
|
3
|
-
declare const docsInputSchema: z.ZodObject<{
|
|
4
|
-
paths: z.ZodArray<z.ZodString>;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
declare const docsTools: {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
parameters: z.ZodObject<{
|
|
10
|
-
paths: z.ZodArray<z.ZodString>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
execute: ({ paths }: z.infer<typeof docsInputSchema>) => Promise<{
|
|
13
|
-
content: Array<{
|
|
14
|
-
type: "text";
|
|
15
|
-
text: string;
|
|
16
|
-
}>;
|
|
17
|
-
structuredContent?: Record<string, unknown>;
|
|
18
|
-
}>;
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { docsTools };
|
|
22
|
-
//# sourceMappingURL=docs.d.ts.map
|
package/dist/tools/docs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","names":[],"sources":["../../src/tools/docs.ts"],"mappings":";;cAoBM,iBAAe,EAAA;;GAOnB,EAAA,KAAA;cAwLW;;;;;;EAKgB,YAAA,SAAA,EAAE,aAAa,qBAAgB"}
|
package/dist/tools/docs.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { DOCS_PATH, MAX_FILE_SIZE, MDX_EXTENSION } from "../constants.js";
|
|
2
|
-
import { logger } from "../utils/logger.js";
|
|
3
|
-
import { findNearestPaths, getAvailablePaths, listDirContents, pathExists } from "../utils/paths.js";
|
|
4
|
-
import { formatMDXContent, readMDXFile } from "../utils/mdx.js";
|
|
5
|
-
import { formatMCPResponse } from "../utils/mcp-format.js";
|
|
6
|
-
import { sanitizePath } from "../utils/security.js";
|
|
7
|
-
import { extname, join } from "node:path";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
import { lstat, stat } from "node:fs/promises";
|
|
10
|
-
//#region src/tools/docs.ts
|
|
11
|
-
const docsInputSchema = z.object({ paths: z.array(z.string()).min(1).describe("Documentation paths to retrieve (e.g., [\"getting-started\", \"api-reference/primitives/thread\"])") });
|
|
12
|
-
async function readDocumentation(docPath) {
|
|
13
|
-
logger.debug(`Reading documentation for path: ${docPath}`);
|
|
14
|
-
if (docPath === "/" || docPath === "") {
|
|
15
|
-
const { directories, files } = await listDirContents(DOCS_PATH);
|
|
16
|
-
return {
|
|
17
|
-
path: "/",
|
|
18
|
-
found: true,
|
|
19
|
-
type: "directory",
|
|
20
|
-
directories,
|
|
21
|
-
files: files.map((f) => f.replace(MDX_EXTENSION, ""))
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const sanitized = sanitizePath(docPath);
|
|
26
|
-
const fullPath = join(DOCS_PATH, sanitized);
|
|
27
|
-
try {
|
|
28
|
-
if ((await lstat(fullPath)).isSymbolicLink()) {
|
|
29
|
-
logger.warn(`Symlink detected at path: ${fullPath}`);
|
|
30
|
-
return {
|
|
31
|
-
path: docPath,
|
|
32
|
-
found: false,
|
|
33
|
-
error: "Symlinks are not allowed for security reasons"
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
} catch {}
|
|
37
|
-
if (await pathExists(fullPath)) {
|
|
38
|
-
const stats = await stat(fullPath);
|
|
39
|
-
if (stats.isFile() && stats.size > 10485760) {
|
|
40
|
-
logger.warn(`File too large: ${fullPath} (${stats.size} bytes)`);
|
|
41
|
-
return {
|
|
42
|
-
path: docPath,
|
|
43
|
-
found: false,
|
|
44
|
-
error: `File size exceeds maximum allowed size of ${MAX_FILE_SIZE} bytes`
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
if (stats.isDirectory()) {
|
|
48
|
-
const { directories, files } = await listDirContents(fullPath);
|
|
49
|
-
const contents = {};
|
|
50
|
-
const summaries = [];
|
|
51
|
-
let aggregateSize = 0;
|
|
52
|
-
let truncated = false;
|
|
53
|
-
for (const file of files) {
|
|
54
|
-
let fileSize;
|
|
55
|
-
try {
|
|
56
|
-
fileSize = (await stat(join(fullPath, file))).size;
|
|
57
|
-
} catch (error) {
|
|
58
|
-
logger.warn(`Failed to stat MDX file: ${join(fullPath, file)}`, error);
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
aggregateSize += fileSize;
|
|
62
|
-
if (aggregateSize > 1048576) {
|
|
63
|
-
truncated = true;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
const mdxContent = await readMDXFile(join(fullPath, file));
|
|
67
|
-
if (mdxContent) {
|
|
68
|
-
const name = file.replace(MDX_EXTENSION, "");
|
|
69
|
-
contents[name] = formatMDXContent(mdxContent);
|
|
70
|
-
const title = mdxContent.frontmatter["title"];
|
|
71
|
-
summaries.push({
|
|
72
|
-
name,
|
|
73
|
-
...typeof title === "string" && { title },
|
|
74
|
-
...mdxContent.excerpt !== void 0 && { excerpt: mdxContent.excerpt }
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const content = !truncated && Object.keys(contents).length > 0 ? JSON.stringify(contents, null, 2) : void 0;
|
|
79
|
-
return {
|
|
80
|
-
path: docPath,
|
|
81
|
-
found: true,
|
|
82
|
-
type: "directory",
|
|
83
|
-
directories,
|
|
84
|
-
files: files.map((f) => f.replace(MDX_EXTENSION, "")),
|
|
85
|
-
...summaries.length > 0 && { summaries },
|
|
86
|
-
...content !== void 0 && { content },
|
|
87
|
-
...truncated && { hint: `Directory content exceeds 1048576 bytes and was omitted; summaries cover only the files read before the limit. Request individual files by path to retrieve their content.` }
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const mdxPath = extname(fullPath) === ".mdx" ? fullPath : `${fullPath}${MDX_EXTENSION}`;
|
|
92
|
-
try {
|
|
93
|
-
const mdxLstats = await lstat(mdxPath);
|
|
94
|
-
if (mdxLstats.isSymbolicLink()) {
|
|
95
|
-
logger.warn(`Symlink detected at MDX path: ${mdxPath}`);
|
|
96
|
-
return {
|
|
97
|
-
path: docPath,
|
|
98
|
-
found: false,
|
|
99
|
-
error: "Symlinks are not allowed for security reasons"
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
if (mdxLstats.size > 10485760) {
|
|
103
|
-
logger.warn(`MDX file too large: ${mdxPath} (${mdxLstats.size} bytes)`);
|
|
104
|
-
return {
|
|
105
|
-
path: docPath,
|
|
106
|
-
found: false,
|
|
107
|
-
error: `File size exceeds maximum allowed size of ${MAX_FILE_SIZE} bytes`
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
} catch {}
|
|
111
|
-
if (await pathExists(mdxPath)) {
|
|
112
|
-
const mdxContent = await readMDXFile(mdxPath);
|
|
113
|
-
if (mdxContent) {
|
|
114
|
-
const title = mdxContent.frontmatter["title"];
|
|
115
|
-
return {
|
|
116
|
-
path: docPath,
|
|
117
|
-
found: true,
|
|
118
|
-
type: "file",
|
|
119
|
-
content: formatMDXContent(mdxContent),
|
|
120
|
-
...typeof title === "string" && { title },
|
|
121
|
-
...mdxContent.excerpt !== void 0 && { excerpt: mdxContent.excerpt }
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const availablePaths = await getAvailablePaths();
|
|
126
|
-
return {
|
|
127
|
-
path: docPath,
|
|
128
|
-
found: false,
|
|
129
|
-
suggestions: findNearestPaths(docPath, availablePaths)
|
|
130
|
-
};
|
|
131
|
-
} catch (error) {
|
|
132
|
-
if (error instanceof Error && error.message.includes("Invalid path")) return {
|
|
133
|
-
path: docPath,
|
|
134
|
-
found: false,
|
|
135
|
-
error: error.message
|
|
136
|
-
};
|
|
137
|
-
throw error;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
const docsTools = {
|
|
141
|
-
name: "assistantUIDocs",
|
|
142
|
-
description: "Retrieve assistant-ui documentation by path. Use \"/\" to list all sections. Supports multiple paths in a single request.",
|
|
143
|
-
parameters: docsInputSchema,
|
|
144
|
-
execute: async ({ paths }) => {
|
|
145
|
-
logger.info(`Retrieving documentation for paths: ${paths.join(", ")}`);
|
|
146
|
-
try {
|
|
147
|
-
const results = await Promise.all(paths.map((path) => readDocumentation(path)));
|
|
148
|
-
if (results.length === 1) {
|
|
149
|
-
const result = results[0];
|
|
150
|
-
if (result.error) return formatMCPResponse({
|
|
151
|
-
error: result.error,
|
|
152
|
-
path: result.path
|
|
153
|
-
});
|
|
154
|
-
if (!result.found) return formatMCPResponse({
|
|
155
|
-
error: `Documentation not found for path: ${result.path}`,
|
|
156
|
-
suggestions: result.suggestions,
|
|
157
|
-
hint: "Use \"/\" to list all available documentation sections"
|
|
158
|
-
});
|
|
159
|
-
return formatMCPResponse(result);
|
|
160
|
-
}
|
|
161
|
-
return formatMCPResponse({
|
|
162
|
-
results,
|
|
163
|
-
summary: `Retrieved ${results.filter((r) => r.found).length} of ${results.length} requested paths`
|
|
164
|
-
});
|
|
165
|
-
} catch (error) {
|
|
166
|
-
logger.error("Failed to retrieve documentation", error);
|
|
167
|
-
return formatMCPResponse({
|
|
168
|
-
error: "Failed to retrieve documentation",
|
|
169
|
-
message: error instanceof Error ? error.message : String(error)
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
//#endregion
|
|
175
|
-
export { docsTools };
|
|
176
|
-
|
|
177
|
-
//# sourceMappingURL=docs.js.map
|
package/dist/tools/docs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","names":[],"sources":["../../src/tools/docs.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { stat, lstat } from \"node:fs/promises\";\nimport { join, extname } from \"node:path\";\nimport {\n DOCS_PATH,\n MDX_EXTENSION,\n MAX_FILE_SIZE,\n MAX_DIRECTORY_CONTENT_SIZE,\n} from \"../constants.js\";\nimport { logger } from \"../utils/logger.js\";\nimport {\n listDirContents,\n getAvailablePaths,\n findNearestPaths,\n pathExists,\n} from \"../utils/paths.js\";\nimport { readMDXFile, formatMDXContent } from \"../utils/mdx.js\";\nimport { formatMCPResponse } from \"../utils/mcp-format.js\";\nimport { sanitizePath } from \"../utils/security.js\";\n\nconst docsInputSchema = z.object({\n paths: z\n .array(z.string())\n .min(1)\n .describe(\n 'Documentation paths to retrieve (e.g., [\"getting-started\", \"api-reference/primitives/thread\"])',\n ),\n});\n\ninterface DocResult {\n path: string;\n found: boolean;\n type?: \"file\" | \"directory\";\n content?: string;\n files?: string[];\n directories?: string[];\n summaries?: Array<{ name: string; title?: string; excerpt?: string }>;\n title?: string;\n excerpt?: string;\n suggestions?: string[];\n hint?: string;\n error?: string;\n}\n\nasync function readDocumentation(docPath: string): Promise<DocResult> {\n logger.debug(`Reading documentation for path: ${docPath}`);\n\n if (docPath === \"/\" || docPath === \"\") {\n const { directories, files } = await listDirContents(DOCS_PATH);\n return {\n path: \"/\",\n found: true,\n type: \"directory\",\n directories,\n files: files.map((f) => f.replace(MDX_EXTENSION, \"\")),\n };\n }\n\n try {\n const sanitized = sanitizePath(docPath);\n const fullPath = join(DOCS_PATH, sanitized);\n\n try {\n const lstats = await lstat(fullPath);\n if (lstats.isSymbolicLink()) {\n logger.warn(`Symlink detected at path: ${fullPath}`);\n return {\n path: docPath,\n found: false,\n error: \"Symlinks are not allowed for security reasons\",\n };\n }\n } catch {}\n\n if (await pathExists(fullPath)) {\n const stats = await stat(fullPath);\n\n if (stats.isFile() && stats.size > MAX_FILE_SIZE) {\n logger.warn(`File too large: ${fullPath} (${stats.size} bytes)`);\n return {\n path: docPath,\n found: false,\n error: `File size exceeds maximum allowed size of ${MAX_FILE_SIZE} bytes`,\n };\n }\n\n if (stats.isDirectory()) {\n const { directories, files } = await listDirContents(fullPath);\n\n const contents: Record<string, string> = {};\n const summaries: Array<{\n name: string;\n title?: string;\n excerpt?: string;\n }> = [];\n let aggregateSize = 0;\n let truncated = false;\n for (const file of files) {\n let fileSize: number;\n try {\n fileSize = (await stat(join(fullPath, file))).size;\n } catch (error) {\n logger.warn(\n `Failed to stat MDX file: ${join(fullPath, file)}`,\n error,\n );\n continue;\n }\n aggregateSize += fileSize;\n if (aggregateSize > MAX_DIRECTORY_CONTENT_SIZE) {\n truncated = true;\n break;\n }\n const mdxContent = await readMDXFile(join(fullPath, file));\n if (mdxContent) {\n const name = file.replace(MDX_EXTENSION, \"\");\n contents[name] = formatMDXContent(mdxContent);\n const title = mdxContent.frontmatter[\"title\"];\n summaries.push({\n name,\n ...(typeof title === \"string\" && { title }),\n ...(mdxContent.excerpt !== undefined && {\n excerpt: mdxContent.excerpt,\n }),\n });\n }\n }\n\n const content =\n !truncated && Object.keys(contents).length > 0\n ? JSON.stringify(contents, null, 2)\n : undefined;\n return {\n path: docPath,\n found: true,\n type: \"directory\",\n directories,\n files: files.map((f) => f.replace(MDX_EXTENSION, \"\")),\n ...(summaries.length > 0 && { summaries }),\n ...(content !== undefined && { content }),\n ...(truncated && {\n hint: `Directory content exceeds ${MAX_DIRECTORY_CONTENT_SIZE} bytes and was omitted; summaries cover only the files read before the limit. Request individual files by path to retrieve their content.`,\n }),\n };\n }\n }\n\n const mdxPath =\n extname(fullPath) === MDX_EXTENSION\n ? fullPath\n : `${fullPath}${MDX_EXTENSION}`;\n\n try {\n const mdxLstats = await lstat(mdxPath);\n if (mdxLstats.isSymbolicLink()) {\n logger.warn(`Symlink detected at MDX path: ${mdxPath}`);\n return {\n path: docPath,\n found: false,\n error: \"Symlinks are not allowed for security reasons\",\n };\n }\n\n if (mdxLstats.size > MAX_FILE_SIZE) {\n logger.warn(`MDX file too large: ${mdxPath} (${mdxLstats.size} bytes)`);\n return {\n path: docPath,\n found: false,\n error: `File size exceeds maximum allowed size of ${MAX_FILE_SIZE} bytes`,\n };\n }\n } catch {}\n\n if (await pathExists(mdxPath)) {\n const mdxContent = await readMDXFile(mdxPath);\n\n if (mdxContent) {\n const title = mdxContent.frontmatter[\"title\"];\n return {\n path: docPath,\n found: true,\n type: \"file\",\n content: formatMDXContent(mdxContent),\n ...(typeof title === \"string\" && { title }),\n ...(mdxContent.excerpt !== undefined && {\n excerpt: mdxContent.excerpt,\n }),\n };\n }\n }\n\n const availablePaths = await getAvailablePaths();\n const suggestions = findNearestPaths(docPath, availablePaths);\n\n return {\n path: docPath,\n found: false,\n suggestions,\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"Invalid path\")) {\n return {\n path: docPath,\n found: false,\n error: error.message,\n };\n }\n throw error;\n }\n}\n\nexport const docsTools = {\n name: \"assistantUIDocs\",\n description:\n 'Retrieve assistant-ui documentation by path. Use \"/\" to list all sections. Supports multiple paths in a single request.',\n parameters: docsInputSchema,\n execute: async ({ paths }: z.infer<typeof docsInputSchema>) => {\n logger.info(`Retrieving documentation for paths: ${paths.join(\", \")}`);\n\n try {\n const results = await Promise.all(\n paths.map((path) => readDocumentation(path)),\n );\n\n if (results.length === 1) {\n const result = results[0]!;\n if (result.error) {\n return formatMCPResponse({\n error: result.error,\n path: result.path,\n });\n }\n if (!result.found) {\n return formatMCPResponse({\n error: `Documentation not found for path: ${result.path}`,\n suggestions: result.suggestions,\n hint: 'Use \"/\" to list all available documentation sections',\n });\n }\n return formatMCPResponse(result);\n }\n\n return formatMCPResponse({\n results,\n summary: `Retrieved ${results.filter((r) => r.found).length} of ${results.length} requested paths`,\n });\n } catch (error) {\n logger.error(\"Failed to retrieve documentation\", error);\n return formatMCPResponse({\n error: \"Failed to retrieve documentation\",\n message: error instanceof Error ? error.message : String(error),\n });\n }\n },\n};\n"],"mappings":"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"}
|
package/dist/tools/examples.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/tools/examples.d.ts
|
|
3
|
-
declare const examplesInputSchema: z.ZodObject<{
|
|
4
|
-
example: z.ZodOptional<z.ZodString>;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
declare function listCodeExamples(): Promise<string[]>;
|
|
7
|
-
declare function readCodeExample(exampleName: string): Promise<string | null>;
|
|
8
|
-
declare const examplesTools: {
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
parameters: z.ZodObject<{
|
|
12
|
-
example: z.ZodOptional<z.ZodString>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
execute: ({ example }: z.infer<typeof examplesInputSchema>) => Promise<{
|
|
15
|
-
content: Array<{
|
|
16
|
-
type: "text";
|
|
17
|
-
text: string;
|
|
18
|
-
}>;
|
|
19
|
-
structuredContent?: Record<string, unknown>;
|
|
20
|
-
}>;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { examplesTools, listCodeExamples, readCodeExample };
|
|
24
|
-
//# sourceMappingURL=examples.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"examples.d.ts","names":[],"sources":["../../src/tools/examples.ts"],"mappings":";;cASM,qBAAmB,EAAA;;GAOvB,EAAA,KAAA;iBAIc,oBAAoB;iBAed,gBACpB,sBACC;cAwBU;;;;;;EAKkB,YAAA,WAAA,EAAE,aAAa,yBAAoB"}
|
package/dist/tools/examples.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { CODE_EXAMPLES_PATH } from "../constants.js";
|
|
2
|
-
import { logger } from "../utils/logger.js";
|
|
3
|
-
import { cacheListing } from "../utils/cache.js";
|
|
4
|
-
import { formatMCPResponse } from "../utils/mcp-format.js";
|
|
5
|
-
import { sanitizePath } from "../utils/security.js";
|
|
6
|
-
import { extname, join } from "node:path";
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
import { lstat, readFile, readdir } from "node:fs/promises";
|
|
9
|
-
//#region src/tools/examples.ts
|
|
10
|
-
const examplesInputSchema = z.object({ example: z.string().optional().describe("Example name (e.g., \"with-ai-sdk-v7\"). Leave empty to list all examples.") });
|
|
11
|
-
const loadCodeExamples = cacheListing(scanCodeExamples);
|
|
12
|
-
function listCodeExamples() {
|
|
13
|
-
return loadCodeExamples().catch((error) => {
|
|
14
|
-
logger.error("Failed to list code examples", error);
|
|
15
|
-
return [];
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
async function scanCodeExamples() {
|
|
19
|
-
return (await readdir(CODE_EXAMPLES_PATH)).filter((file) => extname(file) === ".md").map((file) => file.replace(".md", "")).sort();
|
|
20
|
-
}
|
|
21
|
-
async function readCodeExample(exampleName) {
|
|
22
|
-
try {
|
|
23
|
-
const sanitized = sanitizePath(exampleName);
|
|
24
|
-
const filePath = join(CODE_EXAMPLES_PATH, `${sanitized}.md`);
|
|
25
|
-
const stats = await lstat(filePath);
|
|
26
|
-
if (stats.isSymbolicLink()) {
|
|
27
|
-
logger.warn(`Attempted to read symlink: ${filePath}`);
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
if (stats.size > 10485760) {
|
|
31
|
-
logger.warn(`File size exceeds limit: ${filePath} (${stats.size} bytes)`);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return await readFile(filePath, "utf-8");
|
|
35
|
-
} catch (error) {
|
|
36
|
-
logger.error(`Failed to read example: ${exampleName}`, error);
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const examplesTools = {
|
|
41
|
-
name: "assistantUIExamples",
|
|
42
|
-
description: "List available examples or retrieve complete code for a specific example",
|
|
43
|
-
parameters: examplesInputSchema,
|
|
44
|
-
execute: async ({ example }) => {
|
|
45
|
-
try {
|
|
46
|
-
if (!example) {
|
|
47
|
-
logger.info("Listing all available examples");
|
|
48
|
-
const examples = await listCodeExamples();
|
|
49
|
-
if (examples.length === 0) return formatMCPResponse({
|
|
50
|
-
error: "No examples found. Please run documentation preparation first.",
|
|
51
|
-
hint: "Run: pnpm prepare-docs"
|
|
52
|
-
});
|
|
53
|
-
return formatMCPResponse({
|
|
54
|
-
type: "list",
|
|
55
|
-
examples,
|
|
56
|
-
total: examples.length,
|
|
57
|
-
hint: "Use example parameter to get complete code for any example"
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
logger.info(`Retrieving example: ${example}`);
|
|
61
|
-
const content = await readCodeExample(example);
|
|
62
|
-
if (!content) {
|
|
63
|
-
const availableExamples = await listCodeExamples();
|
|
64
|
-
return formatMCPResponse({
|
|
65
|
-
error: `Example not found: ${example}`,
|
|
66
|
-
availableExamples,
|
|
67
|
-
hint: "Use without example parameter to list all available examples"
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return formatMCPResponse({
|
|
71
|
-
type: "example",
|
|
72
|
-
name: example,
|
|
73
|
-
content
|
|
74
|
-
});
|
|
75
|
-
} catch (error) {
|
|
76
|
-
logger.error("Failed to retrieve examples", error);
|
|
77
|
-
return formatMCPResponse({
|
|
78
|
-
error: "Failed to retrieve examples",
|
|
79
|
-
message: error instanceof Error ? error.message : String(error)
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
//#endregion
|
|
85
|
-
export { examplesTools, listCodeExamples, readCodeExample };
|
|
86
|
-
|
|
87
|
-
//# sourceMappingURL=examples.js.map
|