@assistant-ui/mcp-docs-server 0.2.2 → 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 +9 -13
- 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 -674
- package/.docs/organized/code-examples/with-ag-ui.md +0 -552
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +0 -465
- package/.docs/organized/code-examples/with-artifacts.md +0 -814
- package/.docs/organized/code-examples/with-assistant-transport.md +0 -575
- package/.docs/organized/code-examples/with-browser-extension.md +0 -371
- package/.docs/organized/code-examples/with-chain-of-thought.md +0 -960
- package/.docs/organized/code-examples/with-cloud-standalone.md +0 -681
- package/.docs/organized/code-examples/with-cloud.md +0 -438
- package/.docs/organized/code-examples/with-custom-thread-list.md +0 -568
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +0 -526
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +0 -696
- package/.docs/organized/code-examples/with-eve.md +0 -404
- package/.docs/organized/code-examples/with-expo.md +0 -2063
- package/.docs/organized/code-examples/with-external-store.md +0 -420
- package/.docs/organized/code-examples/with-ffmpeg.md +0 -828
- package/.docs/organized/code-examples/with-generative-ui.md +0 -1812
- package/.docs/organized/code-examples/with-google-adk.md +0 -367
- package/.docs/organized/code-examples/with-heat-graph.md +0 -304
- package/.docs/organized/code-examples/with-image-generation.md +0 -462
- package/.docs/organized/code-examples/with-interactables.md +0 -732
- package/.docs/organized/code-examples/with-langchain.md +0 -445
- package/.docs/organized/code-examples/with-langgraph.md +0 -854
- package/.docs/organized/code-examples/with-livekit.md +0 -642
- package/.docs/organized/code-examples/with-mcp.md +0 -780
- 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 -449
- package/.docs/organized/code-examples/with-pi.md +0 -2083
- package/.docs/organized/code-examples/with-react-hook-form.md +0 -724
- package/.docs/organized/code-examples/with-react-ink-web.md +0 -690
- package/.docs/organized/code-examples/with-react-ink.md +0 -472
- package/.docs/organized/code-examples/with-react-router.md +0 -935
- package/.docs/organized/code-examples/with-resumable-stream.md +0 -667
- 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 -811
- package/.docs/organized/code-examples/with-tap-runtime.md +0 -812
- package/.docs/organized/code-examples/with-virtualized-thread.md +0 -680
- package/.docs/organized/code-examples/with-vue.md +0 -408
- package/.docs/raw/docs/(docs)/architecture.mdx +0 -146
- package/.docs/raw/docs/(docs)/base-ui.mdx +0 -39
- package/.docs/raw/docs/(docs)/cli.mdx +0 -542
- package/.docs/raw/docs/(docs)/devtools.mdx +0 -79
- package/.docs/raw/docs/(docs)/index.mdx +0 -21
- package/.docs/raw/docs/(docs)/installation.mdx +0 -483
- package/.docs/raw/docs/(docs)/llm.mdx +0 -211
- package/.docs/raw/docs/(docs)/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 -20
- 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 -52
- 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/cloud-ai-sdk.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +0 -97
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +0 -28
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +0 -200
- 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 -619
- 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 -149
- 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 -602
- 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 -400
- 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 -209
- 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 -236
- 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/overview.mdx +0 -282
- 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 -839
- 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 -255
- 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 -716
- 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 -346
- 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 -1008
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +0 -428
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- 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 -259
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +0 -212
- package/.docs/raw/docs/ui/context-display.mdx +0 -148
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/directive-text.mdx +0 -114
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- 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 -64
- 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/number-roll.mdx +0 -154
- 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 -186
- package/.docs/raw/docs/ui/scrollbar.mdx +0 -77
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/sources.mdx +0 -177
- package/.docs/raw/docs/ui/streamdown.mdx +0 -392
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +0 -205
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- package/.docs/raw/docs/ui/thread-list.mdx +0 -372
- package/.docs/raw/docs/ui/thread.mdx +0 -512
- package/.docs/raw/docs/ui/tool-fallback.mdx +0 -127
- 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 -67
- 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 -144
- 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 -81
- 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 -262
- 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 -105
- 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 -60
package/dist/utils/mdx.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/utils/mdx.d.ts
|
|
2
|
-
interface MDXContent {
|
|
3
|
-
content: string;
|
|
4
|
-
frontmatter: Record<string, any>;
|
|
5
|
-
excerpt?: string;
|
|
6
|
-
}
|
|
7
|
-
declare function readMDXFile(filePath: string): Promise<MDXContent | null>;
|
|
8
|
-
declare function readMDXFileSafe(filePath: string): Promise<MDXContent | null>;
|
|
9
|
-
declare function formatMDXContent(mdxContent: MDXContent): string;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { formatMDXContent, readMDXFile, readMDXFileSafe };
|
|
12
|
-
//# sourceMappingURL=mdx.d.ts.map
|
package/dist/utils/mdx.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","names":[],"sources":["../../src/utils/mdx.ts"],"mappings":";UAKU;EACR;EACA,aAAa;EACb;;iBAGoB,YACpB,mBACC,QAAQ;iBAsBW,gBACpB,mBACC,QAAQ;iBAiBK,iBAAiB,YAAY"}
|
package/dist/utils/mdx.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "../constants.js";
|
|
2
|
-
import { logger } from "./logger.js";
|
|
3
|
-
import { lstat, readFile } from "node:fs/promises";
|
|
4
|
-
import matter from "gray-matter";
|
|
5
|
-
//#region src/utils/mdx.ts
|
|
6
|
-
async function readMDXFile(filePath) {
|
|
7
|
-
try {
|
|
8
|
-
const fileContent = await readFile(filePath, "utf-8");
|
|
9
|
-
const { content, data } = matter(fileContent);
|
|
10
|
-
const excerptMatch = content.match(/^(.+?)(?:\n\n|$)/);
|
|
11
|
-
const excerpt = excerptMatch?.[1] !== void 0 ? excerptMatch[1].replace(/^#+ /, "") : void 0;
|
|
12
|
-
return {
|
|
13
|
-
content,
|
|
14
|
-
frontmatter: data,
|
|
15
|
-
...excerpt !== void 0 && { excerpt }
|
|
16
|
-
};
|
|
17
|
-
} catch (error) {
|
|
18
|
-
logger.error(`Failed to read MDX file: ${filePath}`, error);
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async function readMDXFileSafe(filePath) {
|
|
23
|
-
try {
|
|
24
|
-
const stats = await lstat(filePath);
|
|
25
|
-
if (stats.isSymbolicLink()) {
|
|
26
|
-
logger.warn(`Attempted to read symlink: ${filePath}`);
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
if (stats.size > 10485760) {
|
|
30
|
-
logger.warn(`File size exceeds limit: ${filePath} (${stats.size} bytes)`);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
} catch {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
return readMDXFile(filePath);
|
|
37
|
-
}
|
|
38
|
-
function formatMDXContent(mdxContent) {
|
|
39
|
-
const { content, frontmatter } = mdxContent;
|
|
40
|
-
return matter.stringify(content, frontmatter);
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
export { formatMDXContent, readMDXFile, readMDXFileSafe };
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=mdx.js.map
|
package/dist/utils/mdx.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.js","names":[],"sources":["../../src/utils/mdx.ts"],"sourcesContent":["import { readFile, lstat } from \"node:fs/promises\";\nimport matter from \"gray-matter\";\nimport { MAX_FILE_SIZE } from \"../constants.js\";\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 async function readMDXFileSafe(\n filePath: string,\n): Promise<MDXContent | null> {\n try {\n const stats = await lstat(filePath);\n if (stats.isSymbolicLink()) {\n logger.warn(`Attempted to read symlink: ${filePath}`);\n return null;\n }\n if (stats.size > MAX_FILE_SIZE) {\n logger.warn(`File size exceeds limit: ${filePath} (${stats.size} bytes)`);\n return null;\n }\n } catch {\n return null;\n }\n return readMDXFile(filePath);\n}\n\nexport function formatMDXContent(mdxContent: MDXContent): string {\n const { content, frontmatter } = mdxContent;\n\n return matter.stringify(content, frontmatter);\n}\n"],"mappings":";;;;;AAWA,eAAsB,YACpB,UAC4B;CAC5B,IAAI;EACF,MAAM,cAAc,MAAM,SAAS,UAAU,OAAO;EACpD,MAAM,EAAE,SAAS,SAAS,OAAO,WAAW;EAE5C,MAAM,eAAe,QAAQ,MAAM,kBAAkB;EACrD,MAAM,UACJ,eAAe,OAAO,KAAA,IAClB,aAAa,EAAE,CAAC,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,eAAsB,gBACpB,UAC4B;CAC5B,IAAI;EACF,MAAM,QAAQ,MAAM,MAAM,QAAQ;EAClC,IAAI,MAAM,eAAe,GAAG;GAC1B,OAAO,KAAK,8BAA8B,UAAU;GACpD,OAAO;EACT;EACA,IAAI,MAAM,OAAA,UAAsB;GAC9B,OAAO,KAAK,4BAA4B,SAAS,IAAI,MAAM,KAAK,QAAQ;GACxE,OAAO;EACT;CACF,QAAQ;EACN,OAAO;CACT;CACA,OAAO,YAAY,QAAQ;AAC7B;AAEA,SAAgB,iBAAiB,YAAgC;CAC/D,MAAM,EAAE,SAAS,gBAAgB;CAEjC,OAAO,OAAO,UAAU,SAAS,WAAW;AAC9C"}
|
package/dist/utils/paths.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/utils/paths.d.ts
|
|
2
|
-
declare function listDirContents(dirPath: string): Promise<{
|
|
3
|
-
directories: string[];
|
|
4
|
-
files: string[];
|
|
5
|
-
}>;
|
|
6
|
-
declare function getAvailablePaths(): Promise<string[]>;
|
|
7
|
-
declare const getAvailableDocFiles: () => Promise<string[]>;
|
|
8
|
-
declare function findNearestPaths(requestedPath: string, availablePaths: string[]): string[];
|
|
9
|
-
declare function pathExists(path: string): Promise<boolean>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { findNearestPaths, getAvailableDocFiles, getAvailablePaths, listDirContents, pathExists };
|
|
12
|
-
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","names":[],"sources":["../../src/utils/paths.ts"],"mappings":";iBAasB,gBAAgB,kBAAkB;EACtD;EACA;;iBA4BoB,qBAAqB;cA0B9B,4BAAoB;iBAwBjB,iBACd,uBACA;iBAoCoB,WAAW,eAAe"}
|
package/dist/utils/paths.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { DOCS_PATH, MDX_EXTENSION } from "../constants.js";
|
|
2
|
-
import { logger } from "./logger.js";
|
|
3
|
-
import { cacheListing } from "./cache.js";
|
|
4
|
-
import { extname, join } from "node:path";
|
|
5
|
-
import { readdir, stat } from "node:fs/promises";
|
|
6
|
-
//#region src/utils/paths.ts
|
|
7
|
-
const SIMILARITY_THRESHOLDS = {
|
|
8
|
-
EXACT_MATCH: 1,
|
|
9
|
-
CONTAINS_MATCH: .8,
|
|
10
|
-
PARTIAL_MATCH: .5,
|
|
11
|
-
MIN_SUGGESTION: .3
|
|
12
|
-
};
|
|
13
|
-
async function listDirContents(dirPath) {
|
|
14
|
-
try {
|
|
15
|
-
const items = await readdir(dirPath, { withFileTypes: true });
|
|
16
|
-
return {
|
|
17
|
-
directories: items.filter((item) => item.isDirectory()).map((item) => item.name).filter((name) => !name.startsWith(".")).sort(),
|
|
18
|
-
files: items.filter((item) => item.isFile() && (extname(item.name) === ".mdx" || extname(item.name) === ".md")).map((item) => item.name).sort()
|
|
19
|
-
};
|
|
20
|
-
} catch (error) {
|
|
21
|
-
logger.error(`Failed to list directory contents: ${dirPath}`, error);
|
|
22
|
-
return {
|
|
23
|
-
directories: [],
|
|
24
|
-
files: []
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async function getAvailablePaths() {
|
|
29
|
-
const paths = [];
|
|
30
|
-
async function scanDirectory(dir, prefix = "") {
|
|
31
|
-
const { directories, files } = await listDirContents(dir);
|
|
32
|
-
for (const file of files) {
|
|
33
|
-
const name = file.replace(MDX_EXTENSION, "").replace(".md", "");
|
|
34
|
-
paths.push(prefix ? `${prefix}/${name}` : name);
|
|
35
|
-
}
|
|
36
|
-
for (const subdir of directories) {
|
|
37
|
-
const subdirPath = join(dir, subdir);
|
|
38
|
-
const newPrefix = prefix ? `${prefix}/${subdir}` : subdir;
|
|
39
|
-
paths.push(newPrefix);
|
|
40
|
-
await scanDirectory(subdirPath, newPrefix);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
await scanDirectory(DOCS_PATH);
|
|
44
|
-
return paths.sort();
|
|
45
|
-
}
|
|
46
|
-
const getAvailableDocFiles = cacheListing(scanDocFiles);
|
|
47
|
-
async function scanDocFiles() {
|
|
48
|
-
const files = [];
|
|
49
|
-
async function scanDirectory(dir, prefix = "") {
|
|
50
|
-
const { directories, files: dirFiles } = await listDirContents(dir);
|
|
51
|
-
for (const file of dirFiles) {
|
|
52
|
-
if (extname(file) !== ".mdx") continue;
|
|
53
|
-
const name = file.replace(MDX_EXTENSION, "");
|
|
54
|
-
files.push(prefix ? `${prefix}/${name}` : name);
|
|
55
|
-
}
|
|
56
|
-
for (const subdir of directories) {
|
|
57
|
-
const newPrefix = prefix ? `${prefix}/${subdir}` : subdir;
|
|
58
|
-
await scanDirectory(join(dir, subdir), newPrefix);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
await scanDirectory(DOCS_PATH);
|
|
62
|
-
return files.sort();
|
|
63
|
-
}
|
|
64
|
-
function findNearestPaths(requestedPath, availablePaths) {
|
|
65
|
-
const normalizedRequest = requestedPath.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
66
|
-
return availablePaths.map((path) => {
|
|
67
|
-
const normalizedPath = path.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
68
|
-
if (normalizedPath.includes(normalizedRequest)) return {
|
|
69
|
-
path,
|
|
70
|
-
score: SIMILARITY_THRESHOLDS.EXACT_MATCH
|
|
71
|
-
};
|
|
72
|
-
if (normalizedRequest.includes(normalizedPath)) return {
|
|
73
|
-
path,
|
|
74
|
-
score: SIMILARITY_THRESHOLDS.CONTAINS_MATCH
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
path,
|
|
78
|
-
score: [...normalizedRequest].filter((char) => normalizedPath.includes(char)).length / normalizedRequest.length * SIMILARITY_THRESHOLDS.PARTIAL_MATCH
|
|
79
|
-
};
|
|
80
|
-
}).filter((item) => item.score > SIMILARITY_THRESHOLDS.MIN_SUGGESTION).sort((a, b) => b.score - a.score).slice(0, 3).map((item) => item.path);
|
|
81
|
-
}
|
|
82
|
-
async function pathExists(path) {
|
|
83
|
-
try {
|
|
84
|
-
await stat(path);
|
|
85
|
-
return true;
|
|
86
|
-
} catch {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
export { findNearestPaths, getAvailableDocFiles, getAvailablePaths, listDirContents, pathExists };
|
|
92
|
-
|
|
93
|
-
//# sourceMappingURL=paths.js.map
|
package/dist/utils/paths.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 { cacheListing } from \"./cache.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 const getAvailableDocFiles = cacheListing(scanDocFiles);\n\nasync function scanDocFiles(): Promise<string[]> {\n const files: string[] = [];\n\n async function scanDirectory(dir: string, prefix = \"\"): Promise<void> {\n const { directories, files: dirFiles } = await listDirContents(dir);\n\n for (const file of dirFiles) {\n if (extname(file) !== MDX_EXTENSION) continue;\n const name = file.replace(MDX_EXTENSION, \"\");\n files.push(prefix ? `${prefix}/${name}` : name);\n }\n\n for (const subdir of directories) {\n const newPrefix = prefix ? `${prefix}/${subdir}` : subdir;\n await scanDirectory(join(dir, subdir), newPrefix);\n }\n }\n\n await scanDirectory(DOCS_PATH);\n return files.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":"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"}
|
package/dist/utils/search.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/utils/search.d.ts
|
|
2
|
-
interface SearchResult {
|
|
3
|
-
path: string;
|
|
4
|
-
title: string;
|
|
5
|
-
snippet: string;
|
|
6
|
-
}
|
|
7
|
-
declare function searchDocs(query: string, limit?: number): Promise<SearchResult[]>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { SearchResult, searchDocs };
|
|
10
|
-
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","names":[],"sources":["../../src/utils/search.ts"],"mappings":";UAkBiB;EACf;EACA;EACA;;iBA0FoB,WACpB,eACA,iBACC,QAAQ"}
|
package/dist/utils/search.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { DOCS_PATH, MDX_EXTENSION } from "../constants.js";
|
|
2
|
-
import { getAvailablePaths, pathExists } from "./paths.js";
|
|
3
|
-
import { readMDXFile } from "./mdx.js";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
//#region src/utils/search.ts
|
|
6
|
-
const SCORE_WEIGHTS = {
|
|
7
|
-
FULL_QUERY: {
|
|
8
|
-
title: 10,
|
|
9
|
-
path: 8,
|
|
10
|
-
description: 5
|
|
11
|
-
},
|
|
12
|
-
TOKEN: {
|
|
13
|
-
title: 3,
|
|
14
|
-
path: 2,
|
|
15
|
-
description: 1,
|
|
16
|
-
content: .5
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
let indexPromise = null;
|
|
20
|
-
function deriveTitle(path, frontmatter) {
|
|
21
|
-
const fmTitle = frontmatter["title"];
|
|
22
|
-
if (typeof fmTitle === "string" && fmTitle.trim()) return fmTitle;
|
|
23
|
-
return path.split("/").pop() ?? path;
|
|
24
|
-
}
|
|
25
|
-
async function buildIndex() {
|
|
26
|
-
const paths = await getAvailablePaths();
|
|
27
|
-
return (await Promise.all(paths.map(async (path) => {
|
|
28
|
-
const filePath = join(DOCS_PATH, `${path}${MDX_EXTENSION}`);
|
|
29
|
-
if (!await pathExists(filePath)) return null;
|
|
30
|
-
const mdx = await readMDXFile(filePath);
|
|
31
|
-
if (!mdx) return null;
|
|
32
|
-
const description = mdx.frontmatter["description"];
|
|
33
|
-
return {
|
|
34
|
-
path,
|
|
35
|
-
title: deriveTitle(path, mdx.frontmatter),
|
|
36
|
-
description: typeof description === "string" ? description : "",
|
|
37
|
-
content: mdx.content,
|
|
38
|
-
excerpt: mdx.excerpt ?? ""
|
|
39
|
-
};
|
|
40
|
-
}))).filter((entry) => entry !== null);
|
|
41
|
-
}
|
|
42
|
-
function getIndex() {
|
|
43
|
-
if (!indexPromise) indexPromise = buildIndex().catch((error) => {
|
|
44
|
-
indexPromise = null;
|
|
45
|
-
throw error;
|
|
46
|
-
});
|
|
47
|
-
return indexPromise;
|
|
48
|
-
}
|
|
49
|
-
function makeSnippet(content, tokens, excerpt) {
|
|
50
|
-
const lower = content.toLowerCase();
|
|
51
|
-
for (const token of tokens) {
|
|
52
|
-
const idx = lower.indexOf(token);
|
|
53
|
-
if (idx >= 0) {
|
|
54
|
-
const start = Math.max(0, idx - 60);
|
|
55
|
-
const end = Math.min(content.length, idx + token.length + 100);
|
|
56
|
-
const slice = content.slice(start, end).replace(/\s+/g, " ").trim();
|
|
57
|
-
return `${start > 0 ? "…" : ""}${slice}${end < content.length ? "…" : ""}`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (excerpt) return excerpt.slice(0, 160);
|
|
61
|
-
const firstLine = content.split("\n").find((line) => line.trim());
|
|
62
|
-
return firstLine ? firstLine.replace(/^#+\s*/, "").slice(0, 160) : "";
|
|
63
|
-
}
|
|
64
|
-
function scoreEntry(entry, query, tokens) {
|
|
65
|
-
const title = entry.title.toLowerCase();
|
|
66
|
-
const path = entry.path.toLowerCase();
|
|
67
|
-
const description = entry.description.toLowerCase();
|
|
68
|
-
const content = entry.content.toLowerCase();
|
|
69
|
-
let score = 0;
|
|
70
|
-
if (title.includes(query)) score += SCORE_WEIGHTS.FULL_QUERY.title;
|
|
71
|
-
if (path.includes(query)) score += SCORE_WEIGHTS.FULL_QUERY.path;
|
|
72
|
-
if (description.includes(query)) score += SCORE_WEIGHTS.FULL_QUERY.description;
|
|
73
|
-
for (const token of tokens) {
|
|
74
|
-
if (title.includes(token)) score += SCORE_WEIGHTS.TOKEN.title;
|
|
75
|
-
if (path.includes(token)) score += SCORE_WEIGHTS.TOKEN.path;
|
|
76
|
-
if (description.includes(token)) score += SCORE_WEIGHTS.TOKEN.description;
|
|
77
|
-
if (content.includes(token)) score += SCORE_WEIGHTS.TOKEN.content;
|
|
78
|
-
}
|
|
79
|
-
return score;
|
|
80
|
-
}
|
|
81
|
-
async function searchDocs(query, limit = 10) {
|
|
82
|
-
const normalized = query.trim().toLowerCase();
|
|
83
|
-
if (!normalized) return [];
|
|
84
|
-
const tokens = normalized.split(/\s+/).filter(Boolean);
|
|
85
|
-
return (await getIndex()).map((entry) => ({
|
|
86
|
-
entry,
|
|
87
|
-
score: scoreEntry(entry, normalized, tokens)
|
|
88
|
-
})).filter((scored) => scored.score > 0).sort((a, b) => b.score - a.score).slice(0, limit).map(({ entry }) => ({
|
|
89
|
-
path: entry.path,
|
|
90
|
-
title: entry.title,
|
|
91
|
-
snippet: makeSnippet(entry.content, tokens, entry.excerpt)
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
export { searchDocs };
|
|
96
|
-
|
|
97
|
-
//# sourceMappingURL=search.js.map
|
package/dist/utils/search.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","names":[],"sources":["../../src/utils/search.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { DOCS_PATH, MDX_EXTENSION } from \"../constants.js\";\nimport { getAvailablePaths, pathExists } from \"./paths.js\";\nimport { readMDXFile } from \"./mdx.js\";\n\nconst SCORE_WEIGHTS = {\n FULL_QUERY: { title: 10, path: 8, description: 5 },\n TOKEN: { title: 3, path: 2, description: 1, content: 0.5 },\n} as const;\n\ninterface IndexEntry {\n path: string;\n title: string;\n description: string;\n content: string;\n excerpt: string;\n}\n\nexport interface SearchResult {\n path: string;\n title: string;\n snippet: string;\n}\n\nlet indexPromise: Promise<IndexEntry[]> | null = null;\n\nfunction deriveTitle(\n path: string,\n frontmatter: Record<string, unknown>,\n): string {\n const fmTitle = frontmatter[\"title\"];\n if (typeof fmTitle === \"string\" && fmTitle.trim()) return fmTitle;\n return path.split(\"/\").pop() ?? path;\n}\n\nasync function buildIndex(): Promise<IndexEntry[]> {\n const paths = await getAvailablePaths();\n const entries = await Promise.all(\n paths.map(async (path): Promise<IndexEntry | null> => {\n const filePath = join(DOCS_PATH, `${path}${MDX_EXTENSION}`);\n if (!(await pathExists(filePath))) return null;\n const mdx = await readMDXFile(filePath);\n if (!mdx) return null;\n const description = mdx.frontmatter[\"description\"];\n return {\n path,\n title: deriveTitle(path, mdx.frontmatter),\n description: typeof description === \"string\" ? description : \"\",\n content: mdx.content,\n excerpt: mdx.excerpt ?? \"\",\n };\n }),\n );\n return entries.filter((entry): entry is IndexEntry => entry !== null);\n}\n\nfunction getIndex(): Promise<IndexEntry[]> {\n if (!indexPromise) {\n indexPromise = buildIndex().catch((error) => {\n indexPromise = null;\n throw error;\n });\n }\n return indexPromise;\n}\n\nfunction makeSnippet(\n content: string,\n tokens: string[],\n excerpt: string,\n): string {\n const lower = content.toLowerCase();\n for (const token of tokens) {\n const idx = lower.indexOf(token);\n if (idx >= 0) {\n const start = Math.max(0, idx - 60);\n const end = Math.min(content.length, idx + token.length + 100);\n const slice = content.slice(start, end).replace(/\\s+/g, \" \").trim();\n return `${start > 0 ? \"…\" : \"\"}${slice}${end < content.length ? \"…\" : \"\"}`;\n }\n }\n if (excerpt) return excerpt.slice(0, 160);\n const firstLine = content.split(\"\\n\").find((line) => line.trim());\n return firstLine ? firstLine.replace(/^#+\\s*/, \"\").slice(0, 160) : \"\";\n}\n\nfunction scoreEntry(\n entry: IndexEntry,\n query: string,\n tokens: string[],\n): number {\n const title = entry.title.toLowerCase();\n const path = entry.path.toLowerCase();\n const description = entry.description.toLowerCase();\n const content = entry.content.toLowerCase();\n\n let score = 0;\n if (title.includes(query)) score += SCORE_WEIGHTS.FULL_QUERY.title;\n if (path.includes(query)) score += SCORE_WEIGHTS.FULL_QUERY.path;\n if (description.includes(query))\n score += SCORE_WEIGHTS.FULL_QUERY.description;\n\n for (const token of tokens) {\n if (title.includes(token)) score += SCORE_WEIGHTS.TOKEN.title;\n if (path.includes(token)) score += SCORE_WEIGHTS.TOKEN.path;\n if (description.includes(token)) score += SCORE_WEIGHTS.TOKEN.description;\n if (content.includes(token)) score += SCORE_WEIGHTS.TOKEN.content;\n }\n return score;\n}\n\nexport async function searchDocs(\n query: string,\n limit = 10,\n): Promise<SearchResult[]> {\n const normalized = query.trim().toLowerCase();\n if (!normalized) return [];\n const tokens = normalized.split(/\\s+/).filter(Boolean);\n\n const index = await getIndex();\n return index\n .map((entry) => ({ entry, score: scoreEntry(entry, normalized, tokens) }))\n .filter((scored) => scored.score > 0)\n .sort((a, b) => b.score - a.score)\n .slice(0, limit)\n .map(({ entry }) => ({\n path: entry.path,\n title: entry.title,\n snippet: makeSnippet(entry.content, tokens, entry.excerpt),\n }));\n}\n"],"mappings":"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"}
|
package/dist/utils/security.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","names":[],"sources":["../../src/utils/security.ts"],"mappings":";iBAEgB,aAAa"}
|
package/dist/utils/security.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
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, "/");
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { sanitizePath };
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=security.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,SACnB;MAAA,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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { XuluxCatalogResult } from "./types.js";
|
|
2
|
-
//#region src/xulux/catalog-client.d.ts
|
|
3
|
-
declare const DEFAULT_CATALOG_URL = "https://www.assistant-ui.com/api/xulux/mcp-catalog";
|
|
4
|
-
declare function getCatalogUrl(): string;
|
|
5
|
-
declare function clearCatalogCache(): void;
|
|
6
|
-
/**
|
|
7
|
-
* Returns the assistant-ui template catalog. Uses an in-memory five-minute cache, and falls
|
|
8
|
-
* back to a minimal bundled catalog (marked degraded) when the live fetch
|
|
9
|
-
* fails and no cached copy exists.
|
|
10
|
-
*/
|
|
11
|
-
declare function getXuluxCatalog(): Promise<XuluxCatalogResult>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { DEFAULT_CATALOG_URL, clearCatalogCache, getCatalogUrl, getXuluxCatalog };
|
|
14
|
-
//# sourceMappingURL=catalog-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-client.d.ts","names":[],"sources":["../../src/xulux/catalog-client.ts"],"mappings":";;cAIa;iBAKG;iBA0CA;;;;;;iBAoBM,mBAAmB,QAAQ"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { logger } from "../utils/logger.js";
|
|
2
|
-
import { FALLBACK_CATALOG, FALLBACK_NOTE } from "./fallback-catalog.js";
|
|
3
|
-
//#region src/xulux/catalog-client.ts
|
|
4
|
-
const DEFAULT_CATALOG_URL = "https://www.assistant-ui.com/api/xulux/mcp-catalog";
|
|
5
|
-
const CATALOG_TTL_MS = 3e5;
|
|
6
|
-
function getCatalogUrl() {
|
|
7
|
-
return process.env.XULUX_CATALOG_URL?.trim() || "https://www.assistant-ui.com/api/xulux/mcp-catalog";
|
|
8
|
-
}
|
|
9
|
-
function validateCatalog(data) {
|
|
10
|
-
if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("Catalog response is not a JSON object.");
|
|
11
|
-
const catalog = data;
|
|
12
|
-
if (catalog.version !== 1) throw new Error(`Unsupported catalog version: ${String(catalog.version)}. Expected 1.`);
|
|
13
|
-
if (!Array.isArray(catalog.templates)) throw new Error("Catalog response has no templates array.");
|
|
14
|
-
for (const template of catalog.templates) if (!template || typeof template !== "object" || typeof template.id !== "string" || typeof template.templateId !== "string" || template.kind !== "template" && template.kind !== "example") throw new Error("Catalog response contains a malformed template entry (missing id/templateId/kind).");
|
|
15
|
-
return catalog;
|
|
16
|
-
}
|
|
17
|
-
let cache = null;
|
|
18
|
-
function clearCatalogCache() {
|
|
19
|
-
cache = null;
|
|
20
|
-
}
|
|
21
|
-
async function fetchCatalog(url) {
|
|
22
|
-
const res = await fetch(url, { headers: { Accept: "application/json" } });
|
|
23
|
-
if (!res.ok) throw new Error(`Catalog fetch failed: HTTP ${res.status}`);
|
|
24
|
-
return validateCatalog(await res.json());
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns the assistant-ui template catalog. Uses an in-memory five-minute cache, and falls
|
|
28
|
-
* back to a minimal bundled catalog (marked degraded) when the live fetch
|
|
29
|
-
* fails and no cached copy exists.
|
|
30
|
-
*/
|
|
31
|
-
async function getXuluxCatalog() {
|
|
32
|
-
const url = getCatalogUrl();
|
|
33
|
-
const now = Date.now();
|
|
34
|
-
if (cache && cache.url === url && now - cache.fetchedAt < CATALOG_TTL_MS) return {
|
|
35
|
-
catalog: cache.catalog,
|
|
36
|
-
degraded: false
|
|
37
|
-
};
|
|
38
|
-
try {
|
|
39
|
-
const catalog = await fetchCatalog(url);
|
|
40
|
-
cache = {
|
|
41
|
-
catalog,
|
|
42
|
-
fetchedAt: now,
|
|
43
|
-
url
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
catalog,
|
|
47
|
-
degraded: false
|
|
48
|
-
};
|
|
49
|
-
} catch (error) {
|
|
50
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
-
logger.warn(`assistant-ui template catalog fetch failed (${url}): ${message}`);
|
|
52
|
-
if (cache && cache.url === url) return {
|
|
53
|
-
catalog: cache.catalog,
|
|
54
|
-
degraded: true,
|
|
55
|
-
degradedReason: `Live catalog refresh failed (${message}); using previously fetched catalog.`
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
catalog: FALLBACK_CATALOG,
|
|
59
|
-
degraded: true,
|
|
60
|
-
degradedReason: `${message} ${FALLBACK_NOTE}`
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
//#endregion
|
|
65
|
-
export { DEFAULT_CATALOG_URL, clearCatalogCache, getCatalogUrl, getXuluxCatalog };
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=catalog-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-client.js","names":[],"sources":["../../src/xulux/catalog-client.ts"],"sourcesContent":["import { logger } from \"../utils/logger.js\";\nimport { FALLBACK_CATALOG, FALLBACK_NOTE } from \"./fallback-catalog.js\";\nimport type { XuluxCatalog, XuluxCatalogResult } from \"./types.js\";\n\nexport const DEFAULT_CATALOG_URL =\n \"https://www.assistant-ui.com/api/xulux/mcp-catalog\";\n\nconst CATALOG_TTL_MS = 5 * 60 * 1000;\n\nexport function getCatalogUrl(): string {\n const override = process.env.XULUX_CATALOG_URL?.trim();\n return override || DEFAULT_CATALOG_URL;\n}\n\nfunction validateCatalog(data: unknown): XuluxCatalog {\n if (!data || typeof data !== \"object\" || Array.isArray(data)) {\n throw new Error(\"Catalog response is not a JSON object.\");\n }\n const catalog = data as XuluxCatalog;\n if (catalog.version !== 1) {\n throw new Error(\n `Unsupported catalog version: ${String(catalog.version)}. Expected 1.`,\n );\n }\n if (!Array.isArray(catalog.templates)) {\n throw new Error(\"Catalog response has no templates array.\");\n }\n for (const template of catalog.templates) {\n if (\n !template ||\n typeof template !== \"object\" ||\n typeof template.id !== \"string\" ||\n typeof template.templateId !== \"string\" ||\n (template.kind !== \"template\" && template.kind !== \"example\")\n ) {\n throw new Error(\n \"Catalog response contains a malformed template entry (missing id/templateId/kind).\",\n );\n }\n }\n return catalog;\n}\n\ninterface CacheEntry {\n catalog: XuluxCatalog;\n fetchedAt: number;\n url: string;\n}\n\nlet cache: CacheEntry | null = null;\n\nexport function clearCatalogCache(): void {\n cache = null;\n}\n\nasync function fetchCatalog(url: string): Promise<XuluxCatalog> {\n const res = await fetch(url, {\n headers: { Accept: \"application/json\" },\n });\n if (!res.ok) {\n throw new Error(`Catalog fetch failed: HTTP ${res.status}`);\n }\n const data: unknown = await res.json();\n return validateCatalog(data);\n}\n\n/**\n * Returns the assistant-ui template catalog. Uses an in-memory five-minute cache, and falls\n * back to a minimal bundled catalog (marked degraded) when the live fetch\n * fails and no cached copy exists.\n */\nexport async function getXuluxCatalog(): Promise<XuluxCatalogResult> {\n const url = getCatalogUrl();\n const now = Date.now();\n\n if (cache && cache.url === url && now - cache.fetchedAt < CATALOG_TTL_MS) {\n return { catalog: cache.catalog, degraded: false };\n }\n\n try {\n const catalog = await fetchCatalog(url);\n cache = { catalog, fetchedAt: now, url };\n return { catalog, degraded: false };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.warn(\n `assistant-ui template catalog fetch failed (${url}): ${message}`,\n );\n\n // Prefer a stale cached copy over the minimal fallback.\n if (cache && cache.url === url) {\n return {\n catalog: cache.catalog,\n degraded: true,\n degradedReason: `Live catalog refresh failed (${message}); using previously fetched catalog.`,\n };\n }\n\n return {\n catalog: FALLBACK_CATALOG,\n degraded: true,\n degradedReason: `${message} ${FALLBACK_NOTE}`,\n };\n }\n}\n"],"mappings":";;;AAIA,MAAa,sBACX;AAEF,MAAM,iBAAiB;AAEvB,SAAgB,gBAAwB;CAEtC,OADiB,QAAQ,IAAI,mBAAmB,KAAK,KAAA;AAEvD;AAEA,SAAS,gBAAgB,MAA6B;CACpD,IAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GACzD,MAAM,IAAI,MAAM,wCAAwC;CAE1D,MAAM,UAAU;CAChB,IAAI,QAAQ,YAAY,GACtB,MAAM,IAAI,MACR,gCAAgC,OAAO,QAAQ,OAAO,EAAE,cAC1D;CAEF,IAAI,CAAC,MAAM,QAAQ,QAAQ,SAAS,GAClC,MAAM,IAAI,MAAM,0CAA0C;CAE5D,KAAK,MAAM,YAAY,QAAQ,WAC7B,IACE,CAAC,YACD,OAAO,aAAa,YACpB,OAAO,SAAS,OAAO,YACvB,OAAO,SAAS,eAAe,YAC9B,SAAS,SAAS,cAAc,SAAS,SAAS,WAEnD,MAAM,IAAI,MACR,oFACF;CAGJ,OAAO;AACT;AAQA,IAAI,QAA2B;AAE/B,SAAgB,oBAA0B;CACxC,QAAQ;AACV;AAEA,eAAe,aAAa,KAAoC;CAC9D,MAAM,MAAM,MAAM,MAAM,KAAK,EAC3B,SAAS,EAAE,QAAQ,mBAAmB,EACxC,CAAC;CACD,IAAI,CAAC,IAAI,IACP,MAAM,IAAI,MAAM,8BAA8B,IAAI,QAAQ;CAG5D,OAAO,gBAAgB,MADK,IAAI,KAAK,CACV;AAC7B;;;;;;AAOA,eAAsB,kBAA+C;CACnE,MAAM,MAAM,cAAc;CAC1B,MAAM,MAAM,KAAK,IAAI;CAErB,IAAI,SAAS,MAAM,QAAQ,OAAO,MAAM,MAAM,YAAY,gBACxD,OAAO;EAAE,SAAS,MAAM;EAAS,UAAU;CAAM;CAGnD,IAAI;EACF,MAAM,UAAU,MAAM,aAAa,GAAG;EACtC,QAAQ;GAAE;GAAS,WAAW;GAAK;EAAI;EACvC,OAAO;GAAE;GAAS,UAAU;EAAM;CACpC,SAAS,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,OAAO,KACL,+CAA+C,IAAI,KAAK,SAC1D;EAGA,IAAI,SAAS,MAAM,QAAQ,KACzB,OAAO;GACL,SAAS,MAAM;GACf,UAAU;GACV,gBAAgB,gCAAgC,QAAQ;EAC1D;EAGF,OAAO;GACL,SAAS;GACT,UAAU;GACV,gBAAgB,GAAG,QAAQ,GAAG;EAChC;CACF;AACF"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { XuluxCatalog } from "./types.js";
|
|
2
|
-
//#region src/xulux/fallback-catalog.d.ts
|
|
3
|
-
declare const FALLBACK_NOTE: string;
|
|
4
|
-
declare const FALLBACK_CATALOG: XuluxCatalog;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { FALLBACK_CATALOG, FALLBACK_NOTE };
|
|
7
|
-
//# sourceMappingURL=fallback-catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-catalog.d.ts","names":[],"sources":["../../src/xulux/fallback-catalog.ts"],"mappings":";;cAWa;cAiBA,kBAAkB"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import "./types.js";
|
|
2
|
-
//#region src/xulux/fallback-catalog.ts
|
|
3
|
-
const FALLBACK_NOTE = "The live assistant-ui template catalog could not be fetched, so this is minimal bundled fallback data. Template details, previews, and downloads require live catalog access. Check network access to the docs site or set XULUX_CATALOG_URL to a reachable catalog endpoint.";
|
|
4
|
-
const fallbackTemplate = (overrides) => ({
|
|
5
|
-
templateId: overrides.id,
|
|
6
|
-
versionId: null,
|
|
7
|
-
assistantPlacement: "unavailable in fallback mode",
|
|
8
|
-
features: [],
|
|
9
|
-
customizable: [],
|
|
10
|
-
versions: [],
|
|
11
|
-
...overrides
|
|
12
|
-
});
|
|
13
|
-
const FALLBACK_CATALOG = {
|
|
14
|
-
version: 1,
|
|
15
|
-
generatedAt: "fallback",
|
|
16
|
-
docsOrigin: "https://www.assistant-ui.com",
|
|
17
|
-
templates: [
|
|
18
|
-
fallbackTemplate({
|
|
19
|
-
id: "base-assistant-ui",
|
|
20
|
-
kind: "template",
|
|
21
|
-
name: "Configurable Base Assistant UI",
|
|
22
|
-
summary: "Hosted configurable assistant-ui Base chat template with threads, composer, suggestions, and no-key demo flows."
|
|
23
|
-
}),
|
|
24
|
-
fallbackTemplate({
|
|
25
|
-
id: "webpage-assistant",
|
|
26
|
-
kind: "template",
|
|
27
|
-
name: "Webpage with Assistant",
|
|
28
|
-
summary: "Docs/website layout with a sidebar or modal assistant grounded in configurable pages."
|
|
29
|
-
}),
|
|
30
|
-
fallbackTemplate({
|
|
31
|
-
id: "product-page-assistant",
|
|
32
|
-
kind: "template",
|
|
33
|
-
name: "Product Page with Floating Assistant",
|
|
34
|
-
summary: "Mock product dashboard with a floating modal support assistant and analyze-then-handoff flow."
|
|
35
|
-
}),
|
|
36
|
-
fallbackTemplate({
|
|
37
|
-
id: "expo-react-native",
|
|
38
|
-
kind: "example",
|
|
39
|
-
name: "Expo React Native Assistant",
|
|
40
|
-
summary: "Mobile AI chat app built with Expo and assistant-ui React Native primitives."
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { FALLBACK_CATALOG, FALLBACK_NOTE };
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=fallback-catalog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-catalog.js","names":[],"sources":["../../src/xulux/fallback-catalog.ts"],"sourcesContent":["import {\n XULUX_MCP_CATALOG_VERSION,\n type XuluxCatalog,\n type XuluxCatalogTemplate,\n} from \"./types.js\";\n\n// Minimal bundled fallback catalog for degraded mode. It supports discovery\n// (ids + names) only. Full authoring details and preview/download URLs\n// require the live catalog endpoint. Do NOT grow this into a copy of the\n// full template knowledge base — the docs endpoint owns freshness.\n\nexport const FALLBACK_NOTE =\n \"The live assistant-ui template catalog could not be fetched, so this is minimal bundled fallback data. \" +\n \"Template details, previews, and downloads require live catalog access. \" +\n \"Check network access to the docs site or set XULUX_CATALOG_URL to a reachable catalog endpoint.\";\n\nconst fallbackTemplate = (\n overrides: Pick<XuluxCatalogTemplate, \"id\" | \"kind\" | \"name\" | \"summary\">,\n): XuluxCatalogTemplate => ({\n templateId: overrides.id,\n versionId: null,\n assistantPlacement: \"unavailable in fallback mode\",\n features: [],\n customizable: [],\n versions: [],\n ...overrides,\n});\n\nexport const FALLBACK_CATALOG: XuluxCatalog = {\n version: XULUX_MCP_CATALOG_VERSION,\n generatedAt: \"fallback\",\n docsOrigin: \"https://www.assistant-ui.com\",\n templates: [\n fallbackTemplate({\n id: \"base-assistant-ui\",\n kind: \"template\",\n name: \"Configurable Base Assistant UI\",\n summary:\n \"Hosted configurable assistant-ui Base chat template with threads, composer, suggestions, and no-key demo flows.\",\n }),\n fallbackTemplate({\n id: \"webpage-assistant\",\n kind: \"template\",\n name: \"Webpage with Assistant\",\n summary:\n \"Docs/website layout with a sidebar or modal assistant grounded in configurable pages.\",\n }),\n fallbackTemplate({\n id: \"product-page-assistant\",\n kind: \"template\",\n name: \"Product Page with Floating Assistant\",\n summary:\n \"Mock product dashboard with a floating modal support assistant and analyze-then-handoff flow.\",\n }),\n fallbackTemplate({\n id: \"expo-react-native\",\n kind: \"example\",\n name: \"Expo React Native Assistant\",\n summary:\n \"Mobile AI chat app built with Expo and assistant-ui React Native primitives.\",\n }),\n ],\n};\n"],"mappings":";;AAWA,MAAa,gBACX;AAIF,MAAM,oBACJ,eAC0B;CAC1B,YAAY,UAAU;CACtB,WAAW;CACX,oBAAoB;CACpB,UAAU,CAAC;CACX,cAAc,CAAC;CACf,UAAU,CAAC;CACX,GAAG;AACL;AAEA,MAAa,mBAAiC;CAC5C,SAAA;CACA,aAAa;CACb,YAAY;CACZ,WAAW;EACT,iBAAiB;GACf,IAAI;GACJ,MAAM;GACN,MAAM;GACN,SACE;EACJ,CAAC;EACD,iBAAiB;GACf,IAAI;GACJ,MAAM;GACN,MAAM;GACN,SACE;EACJ,CAAC;EACD,iBAAiB;GACf,IAAI;GACJ,MAAM;GACN,MAAM;GACN,SACE;EACJ,CAAC;EACD,iBAAiB;GACf,IAAI;GACJ,MAAM;GACN,MAAM;GACN,SACE;EACJ,CAAC;CACH;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-sandbox.d.ts","names":[],"sources":["../../src/xulux/fetch-sandbox.ts"],"mappings":";iBAgCsB,qBACpB,cAAc,KACd,OAAO,cACN,QAAQ"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//#region src/xulux/fetch-sandbox.ts
|
|
2
|
-
const SANDBOX_FETCH_HEADERS = {
|
|
3
|
-
Accept: "application/json, application/zip, application/octet-stream, */*",
|
|
4
|
-
"User-Agent": "curl/8.7.1"
|
|
5
|
-
};
|
|
6
|
-
const MAX_ATTEMPTS = 3;
|
|
7
|
-
const RETRY_DELAY_MS = 300;
|
|
8
|
-
function isRetryableFetchError(error) {
|
|
9
|
-
if (!(error instanceof Error)) return false;
|
|
10
|
-
const code = error.cause?.code ?? error.message;
|
|
11
|
-
return code === "ECONNRESET" || code === "ETIMEDOUT" || code === "ECONNREFUSED" || code === "fetch failed";
|
|
12
|
-
}
|
|
13
|
-
function sleep(ms) {
|
|
14
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
15
|
-
}
|
|
16
|
-
function mergeHeaders(headers) {
|
|
17
|
-
const merged = new Headers(SANDBOX_FETCH_HEADERS);
|
|
18
|
-
if (!headers) return merged;
|
|
19
|
-
new Headers(headers).forEach((value, key) => merged.set(key, value));
|
|
20
|
-
return merged;
|
|
21
|
-
}
|
|
22
|
-
async function fetchSandboxResource(url, init) {
|
|
23
|
-
let lastError;
|
|
24
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt += 1) try {
|
|
25
|
-
return await fetch(url, {
|
|
26
|
-
...init,
|
|
27
|
-
cache: "no-store",
|
|
28
|
-
headers: mergeHeaders(init?.headers)
|
|
29
|
-
});
|
|
30
|
-
} catch (error) {
|
|
31
|
-
lastError = error;
|
|
32
|
-
if (!isRetryableFetchError(error) || attempt === MAX_ATTEMPTS) throw error;
|
|
33
|
-
await sleep(RETRY_DELAY_MS * attempt);
|
|
34
|
-
}
|
|
35
|
-
throw lastError;
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { fetchSandboxResource };
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=fetch-sandbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-sandbox.js","names":[],"sources":["../../src/xulux/fetch-sandbox.ts"],"sourcesContent":["const SANDBOX_FETCH_HEADERS = {\n Accept: \"application/json, application/zip, application/octet-stream, */*\",\n // Blaxel preview hosts intermittently reset Node's default fetch path.\n \"User-Agent\": \"curl/8.7.1\",\n};\n\nconst MAX_ATTEMPTS = 3;\nconst RETRY_DELAY_MS = 300;\n\nfunction isRetryableFetchError(error: unknown) {\n if (!(error instanceof Error)) return false;\n const cause = error.cause as { code?: string } | undefined;\n const code = cause?.code ?? error.message;\n return (\n code === \"ECONNRESET\" ||\n code === \"ETIMEDOUT\" ||\n code === \"ECONNREFUSED\" ||\n code === \"fetch failed\"\n );\n}\n\nfunction sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction mergeHeaders(headers?: HeadersInit): Headers {\n const merged = new Headers(SANDBOX_FETCH_HEADERS);\n if (!headers) return merged;\n new Headers(headers).forEach((value, key) => merged.set(key, value));\n return merged;\n}\n\nexport async function fetchSandboxResource(\n url: string | URL,\n init?: RequestInit,\n): Promise<Response> {\n let lastError: unknown;\n\n for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt += 1) {\n try {\n return await fetch(url, {\n ...init,\n cache: \"no-store\",\n headers: mergeHeaders(init?.headers),\n });\n } catch (error) {\n lastError = error;\n if (!isRetryableFetchError(error) || attempt === MAX_ATTEMPTS) {\n throw error;\n }\n await sleep(RETRY_DELAY_MS * attempt);\n }\n }\n\n throw lastError;\n}\n"],"mappings":";AAAA,MAAM,wBAAwB;CAC5B,QAAQ;CAER,cAAc;AAChB;AAEA,MAAM,eAAe;AACrB,MAAM,iBAAiB;AAEvB,SAAS,sBAAsB,OAAgB;CAC7C,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CAEtC,MAAM,OADQ,MAAM,OACA,QAAQ,MAAM;CAClC,OACE,SAAS,gBACT,SAAS,eACT,SAAS,kBACT,SAAS;AAEb;AAEA,SAAS,MAAM,IAAY;CACzB,OAAO,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;AAEA,SAAS,aAAa,SAAgC;CACpD,MAAM,SAAS,IAAI,QAAQ,qBAAqB;CAChD,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI,QAAQ,OAAO,CAAC,CAAC,SAAS,OAAO,QAAQ,OAAO,IAAI,KAAK,KAAK,CAAC;CACnE,OAAO;AACT;AAEA,eAAsB,qBACpB,KACA,MACmB;CACnB,IAAI;CAEJ,KAAK,IAAI,UAAU,GAAG,WAAW,cAAc,WAAW,GACxD,IAAI;EACF,OAAO,MAAM,MAAM,KAAK;GACtB,GAAG;GACH,OAAO;GACP,SAAS,aAAa,MAAM,OAAO;EACrC,CAAC;CACH,SAAS,OAAO;EACd,YAAY;EACZ,IAAI,CAAC,sBAAsB,KAAK,KAAK,YAAY,cAC/C,MAAM;EAER,MAAM,MAAM,iBAAiB,OAAO;CACtC;CAGF,MAAM;AACR"}
|