@assistant-ui/mcp-docs-server 0.2.3 → 0.3.1
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 +91 -0
- package/dist/proxy.js.map +1 -0
- package/package.json +8 -12
- package/src/index.ts +3 -115
- package/src/proxy.test.ts +385 -0
- package/src/proxy.ts +126 -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 +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"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { XuluxCatalog, XuluxCatalogTemplate, XuluxCatalogVersion } from "./types.js";
|
|
2
|
-
//#region src/xulux/template-service.d.ts
|
|
3
|
-
interface ResolvedTemplate {
|
|
4
|
-
template: XuluxCatalogTemplate;
|
|
5
|
-
version: XuluxCatalogVersion | null;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Resolves a template by id, preserving the app-route semantics:
|
|
9
|
-
* - exact `templateId` match wins
|
|
10
|
-
* - version-specific entry ids (e.g. `webpage-assistant-product-docs`)
|
|
11
|
-
* remain valid inputs
|
|
12
|
-
* - explicit `versionId` wins when provided
|
|
13
|
-
* - otherwise the template's default version is used
|
|
14
|
-
*/
|
|
15
|
-
declare function resolveTemplate(catalog: XuluxCatalog, templateId: string, versionId?: string | undefined): ResolvedTemplate | null;
|
|
16
|
-
interface TemplateListItem {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
summary: string;
|
|
20
|
-
assistantPlacement: string;
|
|
21
|
-
features: string[];
|
|
22
|
-
customizable: string[];
|
|
23
|
-
versions: Array<{
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
description: string;
|
|
27
|
-
}>;
|
|
28
|
-
kind: "template" | "example";
|
|
29
|
-
}
|
|
30
|
-
declare function listTemplates(catalog: XuluxCatalog): {
|
|
31
|
-
templates: TemplateListItem[];
|
|
32
|
-
};
|
|
33
|
-
interface TemplateDetails {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
selectedVersionId: string | null;
|
|
37
|
-
summary: string;
|
|
38
|
-
assistantPlacement: string;
|
|
39
|
-
configRoots?: Record<string, unknown>;
|
|
40
|
-
rules: {
|
|
41
|
-
required: string[];
|
|
42
|
-
unsupported?: string[];
|
|
43
|
-
};
|
|
44
|
-
tools: {
|
|
45
|
-
builtIn: unknown[];
|
|
46
|
-
customToolSupported: boolean;
|
|
47
|
-
renderers: unknown[];
|
|
48
|
-
};
|
|
49
|
-
exampleConfig: Record<string, unknown> | null;
|
|
50
|
-
previewUrl?: string;
|
|
51
|
-
downloadUrl?: string;
|
|
52
|
-
warnings?: string[];
|
|
53
|
-
exampleConfigNote?: string;
|
|
54
|
-
}
|
|
55
|
-
interface TemplateError {
|
|
56
|
-
error: string;
|
|
57
|
-
retryHint?: string;
|
|
58
|
-
}
|
|
59
|
-
declare function getTemplateDetails(catalog: XuluxCatalog, input: {
|
|
60
|
-
templateId: string;
|
|
61
|
-
versionId?: string | undefined;
|
|
62
|
-
}): Promise<TemplateDetails | TemplateError>;
|
|
63
|
-
interface TemplatePreviewResult {
|
|
64
|
-
success: boolean;
|
|
65
|
-
templateId: string;
|
|
66
|
-
versionId: string | null;
|
|
67
|
-
previewUrl?: string;
|
|
68
|
-
downloadUrl?: string;
|
|
69
|
-
title?: string;
|
|
70
|
-
customized?: boolean;
|
|
71
|
-
validationWarnings?: unknown[];
|
|
72
|
-
error?: string;
|
|
73
|
-
retryHint?: string;
|
|
74
|
-
details?: string;
|
|
75
|
-
summary?: string;
|
|
76
|
-
}
|
|
77
|
-
declare function createTemplatePreview(catalog: XuluxCatalog, input: {
|
|
78
|
-
templateId: string;
|
|
79
|
-
versionId?: string | undefined;
|
|
80
|
-
config?: Record<string, unknown> | undefined;
|
|
81
|
-
}): Promise<TemplatePreviewResult>;
|
|
82
|
-
//#endregion
|
|
83
|
-
export { ResolvedTemplate, TemplateDetails, TemplateError, TemplateListItem, TemplatePreviewResult, createTemplatePreview, getTemplateDetails, listTemplates, resolveTemplate };
|
|
84
|
-
//# sourceMappingURL=template-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template-service.d.ts","names":[],"sources":["../../src/xulux/template-service.ts"],"mappings":";;UAYiB;EACf,UAAU;EACV,SAAS;;;;;;;;;;iBAWK,gBACd,SAAS,cACT,oBACA,iCACC;UA6Bc;EACf;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;IAAQ;IAAY;IAAc;;EAC5C;;iBAGc,cAAc,SAAS;EACrC,WAAW;;UAmCI;EACf;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF,eAAe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;iBAGoB,mBACpB,SAAS,cACT;EAAS;EAAoB;IAC5B,QAAQ,kBAAkB;UAqGZ;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGoB,sBACpB,SAAS,cACT;EACE;EACA;EACA,SAAS;IAEV,QAAQ"}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { fetchSandboxResource } from "./fetch-sandbox.js";
|
|
2
|
-
//#region src/xulux/template-service.ts
|
|
3
|
-
/**
|
|
4
|
-
* Resolves a template by id, preserving the app-route semantics:
|
|
5
|
-
* - exact `templateId` match wins
|
|
6
|
-
* - version-specific entry ids (e.g. `webpage-assistant-product-docs`)
|
|
7
|
-
* remain valid inputs
|
|
8
|
-
* - explicit `versionId` wins when provided
|
|
9
|
-
* - otherwise the template's default version is used
|
|
10
|
-
*/
|
|
11
|
-
function resolveTemplate(catalog, templateId, versionId) {
|
|
12
|
-
let template = catalog.templates.find((t) => t.templateId === templateId || t.id === templateId);
|
|
13
|
-
let impliedVersionId;
|
|
14
|
-
if (!template) {
|
|
15
|
-
template = catalog.templates.find((t) => t.versions.some((v) => v.entryId === templateId));
|
|
16
|
-
if (template) impliedVersionId = template.versions.find((v) => v.entryId === templateId)?.id;
|
|
17
|
-
}
|
|
18
|
-
if (!template) return null;
|
|
19
|
-
const effectiveVersionId = versionId ?? impliedVersionId ?? template.versionId;
|
|
20
|
-
const version = effectiveVersionId ? template.versions.find((v) => v.id === effectiveVersionId) ?? null : null;
|
|
21
|
-
return {
|
|
22
|
-
template,
|
|
23
|
-
version
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function listTemplates(catalog) {
|
|
27
|
-
return { templates: catalog.templates.map((t) => ({
|
|
28
|
-
id: t.templateId,
|
|
29
|
-
name: t.name,
|
|
30
|
-
summary: t.summary,
|
|
31
|
-
assistantPlacement: t.assistantPlacement,
|
|
32
|
-
features: t.features,
|
|
33
|
-
customizable: t.customizable,
|
|
34
|
-
versions: t.versions.map((v) => ({
|
|
35
|
-
id: v.id,
|
|
36
|
-
name: v.name,
|
|
37
|
-
description: v.description
|
|
38
|
-
})),
|
|
39
|
-
kind: t.kind
|
|
40
|
-
})) };
|
|
41
|
-
}
|
|
42
|
-
async function fetchTemplateContract(sandboxBaseUrl, versionId) {
|
|
43
|
-
try {
|
|
44
|
-
const url = new URL("/api/template/contract", sandboxBaseUrl);
|
|
45
|
-
if (versionId) url.searchParams.set("v", versionId);
|
|
46
|
-
const res = await fetchSandboxResource(url.toString());
|
|
47
|
-
if (!res.ok) return null;
|
|
48
|
-
return await res.json();
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function getTemplateDetails(catalog, input) {
|
|
54
|
-
const resolved = resolveTemplate(catalog, input.templateId, input.versionId);
|
|
55
|
-
if (!resolved) return {
|
|
56
|
-
error: `Template "${input.templateId}" not found.`,
|
|
57
|
-
retryHint: "Call assistantUITemplates and use one of the returned template ids."
|
|
58
|
-
};
|
|
59
|
-
const { template, version } = resolved;
|
|
60
|
-
if (template.kind === "example") return {
|
|
61
|
-
id: template.templateId,
|
|
62
|
-
name: template.name,
|
|
63
|
-
selectedVersionId: null,
|
|
64
|
-
summary: template.summary,
|
|
65
|
-
assistantPlacement: template.assistantPlacement,
|
|
66
|
-
rules: template.rules ?? { required: ["This entry is a fixed demo and is not schema-customizable.", "Preview and download it as-is. Do not pass a config for this entry."] },
|
|
67
|
-
tools: {
|
|
68
|
-
builtIn: [],
|
|
69
|
-
customToolSupported: false,
|
|
70
|
-
renderers: []
|
|
71
|
-
},
|
|
72
|
-
exampleConfig: null,
|
|
73
|
-
...template.previewUrl ? { previewUrl: template.previewUrl } : {},
|
|
74
|
-
...template.downloadUrl ? { downloadUrl: template.downloadUrl } : {}
|
|
75
|
-
};
|
|
76
|
-
const selectedVersionId = version?.id ?? template.versionId;
|
|
77
|
-
if (!template.configRoots || !template.tools) return {
|
|
78
|
-
error: `No authoring schema found for template "${template.templateId}".`,
|
|
79
|
-
retryHint: "The catalog may be in degraded fallback mode. Retry when live catalog access is restored."
|
|
80
|
-
};
|
|
81
|
-
let exampleConfig = null;
|
|
82
|
-
let exampleConfigNote;
|
|
83
|
-
if (template.sandboxBaseUrl) {
|
|
84
|
-
exampleConfig = (await fetchTemplateContract(template.sandboxBaseUrl, selectedVersionId))?.exampleCompleteConfig ?? null;
|
|
85
|
-
exampleConfigNote = exampleConfig ? `Resolved defaults for version "${selectedVersionId}". Use as a complete working starting point.` : "Could not reach the template sandbox to resolve exampleConfig. Use configRoots schemas and defaults to author config manually.";
|
|
86
|
-
} else exampleConfigNote = "This template has no sandbox URL in the catalog, so exampleConfig is unavailable. Use configRoots schemas and defaults.";
|
|
87
|
-
return {
|
|
88
|
-
id: template.templateId,
|
|
89
|
-
name: template.name,
|
|
90
|
-
selectedVersionId,
|
|
91
|
-
summary: template.summary,
|
|
92
|
-
assistantPlacement: template.assistantPlacement,
|
|
93
|
-
configRoots: template.configRoots,
|
|
94
|
-
rules: template.rules ?? { required: [] },
|
|
95
|
-
tools: template.tools,
|
|
96
|
-
exampleConfig,
|
|
97
|
-
exampleConfigNote,
|
|
98
|
-
...version?.previewUrl ? { previewUrl: version.previewUrl } : template.previewUrl ? { previewUrl: template.previewUrl } : {},
|
|
99
|
-
...version?.downloadUrl ? { downloadUrl: version.downloadUrl } : template.downloadUrl ? { downloadUrl: template.downloadUrl } : {}
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function toAbsolute(baseUrl, url) {
|
|
103
|
-
if (/^https?:\/\//.test(url)) return url;
|
|
104
|
-
return `${baseUrl}${url.startsWith("/") ? "" : "/"}${url}`;
|
|
105
|
-
}
|
|
106
|
-
function withVersion(url, versionId) {
|
|
107
|
-
if (!versionId) return url;
|
|
108
|
-
const [path, query = ""] = url.split("?");
|
|
109
|
-
const params = new URLSearchParams(query);
|
|
110
|
-
if (!params.has("v")) params.set("v", versionId);
|
|
111
|
-
return `${path}?${params.toString()}`;
|
|
112
|
-
}
|
|
113
|
-
function hasConfig(config) {
|
|
114
|
-
return !!config && Object.keys(config).length > 0;
|
|
115
|
-
}
|
|
116
|
-
async function createTemplatePreview(catalog, input) {
|
|
117
|
-
const resolved = resolveTemplate(catalog, input.templateId, input.versionId);
|
|
118
|
-
if (!resolved) return {
|
|
119
|
-
success: false,
|
|
120
|
-
templateId: input.templateId,
|
|
121
|
-
versionId: input.versionId ?? null,
|
|
122
|
-
error: `Template "${input.templateId}" not found.`,
|
|
123
|
-
retryHint: "Call assistantUITemplates and use one of the returned template ids."
|
|
124
|
-
};
|
|
125
|
-
const { template, version } = resolved;
|
|
126
|
-
const tid = template.templateId;
|
|
127
|
-
if (template.kind === "example") {
|
|
128
|
-
if (hasConfig(input.config)) return {
|
|
129
|
-
success: false,
|
|
130
|
-
templateId: tid,
|
|
131
|
-
versionId: null,
|
|
132
|
-
error: `Template "${tid}" is a fixed demo and does not support config.`,
|
|
133
|
-
retryHint: "Call assistantUITemplateDetails for this template. If no configRoots are returned, call assistantUITemplatePreview again without config or choose a configurable hosted template."
|
|
134
|
-
};
|
|
135
|
-
if (!template.previewUrl) return {
|
|
136
|
-
success: false,
|
|
137
|
-
templateId: tid,
|
|
138
|
-
versionId: null,
|
|
139
|
-
error: `Fixed demo "${tid}" has no preview URL in the catalog.`,
|
|
140
|
-
retryHint: "The catalog may be in degraded fallback mode. Retry when live catalog access is restored."
|
|
141
|
-
};
|
|
142
|
-
return {
|
|
143
|
-
success: true,
|
|
144
|
-
templateId: tid,
|
|
145
|
-
versionId: null,
|
|
146
|
-
previewUrl: template.previewUrl,
|
|
147
|
-
...template.downloadUrl ? { downloadUrl: template.downloadUrl } : {},
|
|
148
|
-
title: template.name,
|
|
149
|
-
customized: false,
|
|
150
|
-
summary: `Resolved ${template.name} as a fixed demo. Preview and download URLs point at hosted resources; nothing was opened in any UI.`
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
const baseUrl = template.sandboxBaseUrl;
|
|
154
|
-
if (!baseUrl) return {
|
|
155
|
-
success: false,
|
|
156
|
-
templateId: tid,
|
|
157
|
-
versionId: version?.id ?? template.versionId,
|
|
158
|
-
error: `Template "${tid}" has no sandbox URL in the catalog.`,
|
|
159
|
-
retryHint: "The catalog may be in degraded fallback mode. Retry when live catalog access is restored."
|
|
160
|
-
};
|
|
161
|
-
const effectiveVersionId = version?.id ?? template.versionId;
|
|
162
|
-
if (hasConfig(input.config)) try {
|
|
163
|
-
const sessionUrl = new URL("/api/preview/session", baseUrl);
|
|
164
|
-
if (effectiveVersionId) sessionUrl.searchParams.set("v", effectiveVersionId);
|
|
165
|
-
const res = await fetchSandboxResource(sessionUrl.toString(), {
|
|
166
|
-
method: "POST",
|
|
167
|
-
headers: { "Content-Type": "application/json" },
|
|
168
|
-
body: JSON.stringify(input.config)
|
|
169
|
-
});
|
|
170
|
-
if (!res.ok) {
|
|
171
|
-
const details = await res.text();
|
|
172
|
-
return {
|
|
173
|
-
success: false,
|
|
174
|
-
templateId: tid,
|
|
175
|
-
versionId: effectiveVersionId,
|
|
176
|
-
error: `Preview session failed: HTTP ${res.status}`,
|
|
177
|
-
details,
|
|
178
|
-
retryHint: "Check validationWarnings for the specific fields that failed. Call assistantUITemplateDetails for this template and use configRoots schemas to correct the config. Pass only hostUi, assistant, and brandTheme at the top level."
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
const data = await res.json();
|
|
182
|
-
if (!data.previewUrl) return {
|
|
183
|
-
success: false,
|
|
184
|
-
templateId: tid,
|
|
185
|
-
versionId: effectiveVersionId,
|
|
186
|
-
error: "Session endpoint did not return a previewUrl."
|
|
187
|
-
};
|
|
188
|
-
return {
|
|
189
|
-
success: true,
|
|
190
|
-
templateId: tid,
|
|
191
|
-
versionId: effectiveVersionId,
|
|
192
|
-
previewUrl: toAbsolute(baseUrl, withVersion(data.previewUrl, effectiveVersionId ?? void 0)),
|
|
193
|
-
downloadUrl: toAbsolute(baseUrl, withVersion(data.downloadUrl ?? "/api/download", effectiveVersionId ?? void 0)),
|
|
194
|
-
title: version?.name ?? template.name,
|
|
195
|
-
customized: true,
|
|
196
|
-
summary: `Created a configured preview session for ${template.name}. URLs point at the hosted sandbox; nothing was opened in any UI.`,
|
|
197
|
-
validationWarnings: data.validationWarnings ?? []
|
|
198
|
-
};
|
|
199
|
-
} catch (err) {
|
|
200
|
-
return {
|
|
201
|
-
success: false,
|
|
202
|
-
templateId: tid,
|
|
203
|
-
versionId: effectiveVersionId,
|
|
204
|
-
error: err instanceof Error ? err.message : String(err)
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
const previewUrl = version?.previewUrl ?? template.previewUrl;
|
|
208
|
-
const downloadUrl = version?.downloadUrl ?? template.downloadUrl ?? `${baseUrl}/api/download`;
|
|
209
|
-
return {
|
|
210
|
-
success: true,
|
|
211
|
-
templateId: tid,
|
|
212
|
-
versionId: effectiveVersionId,
|
|
213
|
-
previewUrl: previewUrl ?? baseUrl,
|
|
214
|
-
downloadUrl,
|
|
215
|
-
title: version?.name ?? template.name,
|
|
216
|
-
customized: false,
|
|
217
|
-
summary: `Resolved preview and download URLs for ${template.name}. Nothing was opened in any UI.`
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
//#endregion
|
|
221
|
-
export { createTemplatePreview, getTemplateDetails, listTemplates, resolveTemplate };
|
|
222
|
-
|
|
223
|
-
//# sourceMappingURL=template-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template-service.js","names":[],"sources":["../../src/xulux/template-service.ts"],"sourcesContent":["import { fetchSandboxResource } from \"./fetch-sandbox.js\";\nimport type {\n XuluxCatalog,\n XuluxCatalogTemplate,\n XuluxCatalogVersion,\n} from \"./types.js\";\n\n// ---------------------------------------------------------------------------\n// Local, catalog-backed template operations for the assistant-ui template MCP tools.\n// These functions never mutate any UI. Preview operations only return URLs.\n// ---------------------------------------------------------------------------\n\nexport interface ResolvedTemplate {\n template: XuluxCatalogTemplate;\n version: XuluxCatalogVersion | null;\n}\n\n/**\n * Resolves a template by id, preserving the app-route semantics:\n * - exact `templateId` match wins\n * - version-specific entry ids (e.g. `webpage-assistant-product-docs`)\n * remain valid inputs\n * - explicit `versionId` wins when provided\n * - otherwise the template's default version is used\n */\nexport function resolveTemplate(\n catalog: XuluxCatalog,\n templateId: string,\n versionId?: string | undefined,\n): ResolvedTemplate | null {\n let template = catalog.templates.find(\n (t) => t.templateId === templateId || t.id === templateId,\n );\n let impliedVersionId: string | undefined;\n\n if (!template) {\n // Version-specific entry id such as `webpage-assistant-product-docs`.\n template = catalog.templates.find((t) =>\n t.versions.some((v) => v.entryId === templateId),\n );\n if (template) {\n impliedVersionId = template.versions.find(\n (v) => v.entryId === templateId,\n )?.id;\n }\n }\n\n if (!template) return null;\n\n const effectiveVersionId =\n versionId ?? impliedVersionId ?? template.versionId;\n const version = effectiveVersionId\n ? (template.versions.find((v) => v.id === effectiveVersionId) ?? null)\n : null;\n\n return { template, version };\n}\n\nexport interface TemplateListItem {\n id: string;\n name: string;\n summary: string;\n assistantPlacement: string;\n features: string[];\n customizable: string[];\n versions: Array<{ id: string; name: string; description: string }>;\n kind: \"template\" | \"example\";\n}\n\nexport function listTemplates(catalog: XuluxCatalog): {\n templates: TemplateListItem[];\n} {\n return {\n templates: catalog.templates.map((t) => ({\n id: t.templateId,\n name: t.name,\n summary: t.summary,\n assistantPlacement: t.assistantPlacement,\n features: t.features,\n customizable: t.customizable,\n versions: t.versions.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n })),\n kind: t.kind,\n })),\n };\n}\n\nasync function fetchTemplateContract(\n sandboxBaseUrl: string,\n versionId: string | null,\n): Promise<Record<string, unknown> | null> {\n try {\n const url = new URL(\"/api/template/contract\", sandboxBaseUrl);\n if (versionId) url.searchParams.set(\"v\", versionId);\n const res = await fetchSandboxResource(url.toString());\n if (!res.ok) return null;\n return (await res.json()) as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\nexport interface TemplateDetails {\n id: string;\n name: string;\n selectedVersionId: string | null;\n summary: string;\n assistantPlacement: string;\n configRoots?: Record<string, unknown>;\n rules: {\n required: string[];\n unsupported?: string[];\n };\n tools: {\n builtIn: unknown[];\n customToolSupported: boolean;\n renderers: unknown[];\n };\n exampleConfig: Record<string, unknown> | null;\n previewUrl?: string;\n downloadUrl?: string;\n warnings?: string[];\n exampleConfigNote?: string;\n}\n\nexport interface TemplateError {\n error: string;\n retryHint?: string;\n}\n\nexport async function getTemplateDetails(\n catalog: XuluxCatalog,\n input: { templateId: string; versionId?: string | undefined },\n): Promise<TemplateDetails | TemplateError> {\n const resolved = resolveTemplate(catalog, input.templateId, input.versionId);\n if (!resolved) {\n return {\n error: `Template \"${input.templateId}\" not found.`,\n retryHint:\n \"Call assistantUITemplates and use one of the returned template ids.\",\n };\n }\n\n const { template, version } = resolved;\n\n if (template.kind === \"example\") {\n return {\n id: template.templateId,\n name: template.name,\n selectedVersionId: null,\n summary: template.summary,\n assistantPlacement: template.assistantPlacement,\n rules: template.rules ?? {\n required: [\n \"This entry is a fixed demo and is not schema-customizable.\",\n \"Preview and download it as-is. Do not pass a config for this entry.\",\n ],\n },\n tools: { builtIn: [], customToolSupported: false, renderers: [] },\n exampleConfig: null,\n ...(template.previewUrl ? { previewUrl: template.previewUrl } : {}),\n ...(template.downloadUrl ? { downloadUrl: template.downloadUrl } : {}),\n };\n }\n\n const selectedVersionId = version?.id ?? template.versionId;\n\n if (!template.configRoots || !template.tools) {\n return {\n error: `No authoring schema found for template \"${template.templateId}\".`,\n retryHint:\n \"The catalog may be in degraded fallback mode. Retry when live catalog access is restored.\",\n };\n }\n\n let exampleConfig: Record<string, unknown> | null = null;\n let exampleConfigNote: string;\n if (template.sandboxBaseUrl) {\n const contract = await fetchTemplateContract(\n template.sandboxBaseUrl,\n selectedVersionId,\n );\n exampleConfig =\n (contract?.exampleCompleteConfig as Record<string, unknown> | null) ??\n null;\n exampleConfigNote = exampleConfig\n ? `Resolved defaults for version \"${selectedVersionId}\". Use as a complete working starting point.`\n : \"Could not reach the template sandbox to resolve exampleConfig. Use configRoots schemas and defaults to author config manually.\";\n } else {\n exampleConfigNote =\n \"This template has no sandbox URL in the catalog, so exampleConfig is unavailable. Use configRoots schemas and defaults.\";\n }\n\n return {\n id: template.templateId,\n name: template.name,\n selectedVersionId,\n summary: template.summary,\n assistantPlacement: template.assistantPlacement,\n configRoots: template.configRoots,\n rules: template.rules ?? { required: [] },\n tools: template.tools,\n exampleConfig,\n exampleConfigNote,\n ...(version?.previewUrl\n ? { previewUrl: version.previewUrl }\n : template.previewUrl\n ? { previewUrl: template.previewUrl }\n : {}),\n ...(version?.downloadUrl\n ? { downloadUrl: version.downloadUrl }\n : template.downloadUrl\n ? { downloadUrl: template.downloadUrl }\n : {}),\n };\n}\n\nfunction toAbsolute(baseUrl: string, url: string): string {\n if (/^https?:\\/\\//.test(url)) return url;\n return `${baseUrl}${url.startsWith(\"/\") ? \"\" : \"/\"}${url}`;\n}\n\nfunction withVersion(url: string, versionId: string | undefined): string {\n if (!versionId) return url;\n const [path, query = \"\"] = url.split(\"?\");\n const params = new URLSearchParams(query);\n if (!params.has(\"v\")) params.set(\"v\", versionId);\n return `${path}?${params.toString()}`;\n}\n\nfunction hasConfig(config: Record<string, unknown> | undefined): boolean {\n return !!config && Object.keys(config).length > 0;\n}\n\nexport interface TemplatePreviewResult {\n success: boolean;\n templateId: string;\n versionId: string | null;\n previewUrl?: string;\n downloadUrl?: string;\n title?: string;\n customized?: boolean;\n validationWarnings?: unknown[];\n error?: string;\n retryHint?: string;\n details?: string;\n summary?: string;\n}\n\nexport async function createTemplatePreview(\n catalog: XuluxCatalog,\n input: {\n templateId: string;\n versionId?: string | undefined;\n config?: Record<string, unknown> | undefined;\n },\n): Promise<TemplatePreviewResult> {\n const resolved = resolveTemplate(catalog, input.templateId, input.versionId);\n if (!resolved) {\n return {\n success: false,\n templateId: input.templateId,\n versionId: input.versionId ?? null,\n error: `Template \"${input.templateId}\" not found.`,\n retryHint:\n \"Call assistantUITemplates and use one of the returned template ids.\",\n };\n }\n\n const { template, version } = resolved;\n const tid = template.templateId;\n\n if (template.kind === \"example\") {\n if (hasConfig(input.config)) {\n return {\n success: false,\n templateId: tid,\n versionId: null,\n error: `Template \"${tid}\" is a fixed demo and does not support config.`,\n retryHint:\n \"Call assistantUITemplateDetails for this template. If no configRoots are returned, call assistantUITemplatePreview again without config or choose a configurable hosted template.\",\n };\n }\n\n if (!template.previewUrl) {\n return {\n success: false,\n templateId: tid,\n versionId: null,\n error: `Fixed demo \"${tid}\" has no preview URL in the catalog.`,\n retryHint:\n \"The catalog may be in degraded fallback mode. Retry when live catalog access is restored.\",\n };\n }\n\n return {\n success: true,\n templateId: tid,\n versionId: null,\n previewUrl: template.previewUrl,\n ...(template.downloadUrl ? { downloadUrl: template.downloadUrl } : {}),\n title: template.name,\n customized: false,\n summary: `Resolved ${template.name} as a fixed demo. Preview and download URLs point at hosted resources; nothing was opened in any UI.`,\n };\n }\n\n const baseUrl = template.sandboxBaseUrl;\n if (!baseUrl) {\n return {\n success: false,\n templateId: tid,\n versionId: version?.id ?? template.versionId,\n error: `Template \"${tid}\" has no sandbox URL in the catalog.`,\n retryHint:\n \"The catalog may be in degraded fallback mode. Retry when live catalog access is restored.\",\n };\n }\n\n const effectiveVersionId = version?.id ?? template.versionId;\n\n if (hasConfig(input.config)) {\n try {\n const sessionUrl = new URL(\"/api/preview/session\", baseUrl);\n if (effectiveVersionId)\n sessionUrl.searchParams.set(\"v\", effectiveVersionId);\n const res = await fetchSandboxResource(sessionUrl.toString(), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(input.config),\n });\n if (!res.ok) {\n const details = await res.text();\n return {\n success: false,\n templateId: tid,\n versionId: effectiveVersionId,\n error: `Preview session failed: HTTP ${res.status}`,\n details,\n retryHint:\n \"Check validationWarnings for the specific fields that failed. \" +\n \"Call assistantUITemplateDetails for this template and use configRoots schemas to correct the config. \" +\n \"Pass only hostUi, assistant, and brandTheme at the top level.\",\n };\n }\n const data = (await res.json()) as {\n previewUrl?: string;\n downloadUrl?: string;\n validationWarnings?: unknown[];\n };\n if (!data.previewUrl) {\n return {\n success: false,\n templateId: tid,\n versionId: effectiveVersionId,\n error: \"Session endpoint did not return a previewUrl.\",\n };\n }\n return {\n success: true,\n templateId: tid,\n versionId: effectiveVersionId,\n previewUrl: toAbsolute(\n baseUrl,\n withVersion(data.previewUrl, effectiveVersionId ?? undefined),\n ),\n downloadUrl: toAbsolute(\n baseUrl,\n withVersion(\n data.downloadUrl ?? \"/api/download\",\n effectiveVersionId ?? undefined,\n ),\n ),\n title: version?.name ?? template.name,\n customized: true,\n summary: `Created a configured preview session for ${template.name}. URLs point at the hosted sandbox; nothing was opened in any UI.`,\n validationWarnings: data.validationWarnings ?? [],\n };\n } catch (err) {\n return {\n success: false,\n templateId: tid,\n versionId: effectiveVersionId,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n }\n\n const previewUrl = version?.previewUrl ?? template.previewUrl;\n const downloadUrl =\n version?.downloadUrl ?? template.downloadUrl ?? `${baseUrl}/api/download`;\n\n return {\n success: true,\n templateId: tid,\n versionId: effectiveVersionId,\n previewUrl: previewUrl ?? baseUrl,\n downloadUrl,\n title: version?.name ?? template.name,\n customized: false,\n summary: `Resolved preview and download URLs for ${template.name}. Nothing was opened in any UI.`,\n };\n}\n"],"mappings":"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"}
|
package/dist/xulux/types.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region src/xulux/types.d.ts
|
|
2
|
-
declare const XULUX_MCP_CATALOG_VERSION = 1;
|
|
3
|
-
interface XuluxCatalogVersion {
|
|
4
|
-
id: string;
|
|
5
|
-
entryId: string;
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
previewUrl: string;
|
|
9
|
-
downloadUrl: string;
|
|
10
|
-
}
|
|
11
|
-
interface XuluxCatalogTemplate {
|
|
12
|
-
id: string;
|
|
13
|
-
templateId: string;
|
|
14
|
-
versionId: string | null;
|
|
15
|
-
kind: "template" | "example";
|
|
16
|
-
name: string;
|
|
17
|
-
summary: string;
|
|
18
|
-
assistantPlacement: string;
|
|
19
|
-
features: string[];
|
|
20
|
-
customizable: string[];
|
|
21
|
-
versions: XuluxCatalogVersion[];
|
|
22
|
-
previewUrl?: string | undefined;
|
|
23
|
-
downloadUrl?: string | undefined;
|
|
24
|
-
sandboxBaseUrl?: string | undefined;
|
|
25
|
-
configRoots?: Record<string, unknown> | undefined;
|
|
26
|
-
rules?: {
|
|
27
|
-
required: string[];
|
|
28
|
-
unsupported?: string[] | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
tools?: {
|
|
31
|
-
builtIn: unknown[];
|
|
32
|
-
customToolSupported: boolean;
|
|
33
|
-
renderers: unknown[];
|
|
34
|
-
} | undefined;
|
|
35
|
-
}
|
|
36
|
-
interface XuluxCatalog {
|
|
37
|
-
version: number;
|
|
38
|
-
generatedAt: string;
|
|
39
|
-
docsOrigin: string;
|
|
40
|
-
templates: XuluxCatalogTemplate[];
|
|
41
|
-
}
|
|
42
|
-
interface XuluxCatalogResult {
|
|
43
|
-
catalog: XuluxCatalog;
|
|
44
|
-
/** True when the bundled fallback catalog was used instead of live data. */
|
|
45
|
-
degraded: boolean;
|
|
46
|
-
/** Present when the live fetch failed and the fallback was used. */
|
|
47
|
-
degradedReason?: string;
|
|
48
|
-
}
|
|
49
|
-
interface XuluxCatalogError {
|
|
50
|
-
error: string;
|
|
51
|
-
hint?: string;
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
54
|
-
export { XULUX_MCP_CATALOG_VERSION, XuluxCatalog, XuluxCatalogError, XuluxCatalogResult, XuluxCatalogTemplate, XuluxCatalogVersion };
|
|
55
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/xulux/types.ts"],"mappings":";cAIa;UAEI;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA,cAAc;EACd;IAEM;IACA;;EAGN;IAEM;IACA;IACA;;;UAKS;EACf;EACA;EACA;EACA,WAAW;;UAGI;EACf,SAAS;;EAET;;EAEA;;UAGe;EACf;EACA"}
|
package/dist/xulux/types.js
DELETED
package/dist/xulux/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/xulux/types.ts"],"sourcesContent":["// MCP-safe assistant-ui template catalog types. These mirror the payload served by the docs\n// app at GET /api/xulux/mcp-catalog. The MCP package never imports docs-app\n// internals; the endpoint payload is the contract.\n\nexport const XULUX_MCP_CATALOG_VERSION = 1;\n\nexport interface XuluxCatalogVersion {\n id: string;\n entryId: string;\n name: string;\n description: string;\n previewUrl: string;\n downloadUrl: string;\n}\n\nexport interface XuluxCatalogTemplate {\n id: string;\n templateId: string;\n versionId: string | null;\n kind: \"template\" | \"example\";\n name: string;\n summary: string;\n assistantPlacement: string;\n features: string[];\n customizable: string[];\n versions: XuluxCatalogVersion[];\n previewUrl?: string | undefined;\n downloadUrl?: string | undefined;\n sandboxBaseUrl?: string | undefined;\n configRoots?: Record<string, unknown> | undefined;\n rules?:\n | {\n required: string[];\n unsupported?: string[] | undefined;\n }\n | undefined;\n tools?:\n | {\n builtIn: unknown[];\n customToolSupported: boolean;\n renderers: unknown[];\n }\n | undefined;\n}\n\nexport interface XuluxCatalog {\n version: number;\n generatedAt: string;\n docsOrigin: string;\n templates: XuluxCatalogTemplate[];\n}\n\nexport interface XuluxCatalogResult {\n catalog: XuluxCatalog;\n /** True when the bundled fallback catalog was used instead of live data. */\n degraded: boolean;\n /** Present when the live fetch failed and the fallback was used. */\n degradedReason?: string;\n}\n\nexport interface XuluxCatalogError {\n error: string;\n hint?: string;\n}\n"],"mappings":";AAIA,MAAa,4BAA4B"}
|
package/src/constants.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from "node:url";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
|
|
4
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
|
|
6
|
-
export const ROOT_DIR = join(__dirname, "../../../");
|
|
7
|
-
export const PACKAGE_DIR = join(__dirname, "../");
|
|
8
|
-
|
|
9
|
-
export const EXAMPLES_PATH = join(ROOT_DIR, "examples");
|
|
10
|
-
|
|
11
|
-
const DOCS_BASE = join(PACKAGE_DIR, ".docs");
|
|
12
|
-
export const DOCS_PATH = join(DOCS_BASE, "raw/docs");
|
|
13
|
-
export const CODE_EXAMPLES_PATH = join(DOCS_BASE, "organized/code-examples");
|
|
14
|
-
|
|
15
|
-
export const MDX_EXTENSION = ".mdx";
|
|
16
|
-
export const MD_EXTENSION = ".md";
|
|
17
|
-
|
|
18
|
-
export const MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
19
|
-
|
|
20
|
-
export const MAX_DIRECTORY_CONTENT_SIZE = 1024 * 1024;
|
|
21
|
-
|
|
22
|
-
export const IS_PREPARE_MODE = process.argv[1]?.includes(
|
|
23
|
-
"prepare-docs/prepare",
|
|
24
|
-
);
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { rm, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join, relative, extname } from "node:path";
|
|
3
|
-
import { logger } from "../utils/logger.js";
|
|
4
|
-
import { ROOT_DIR, EXAMPLES_PATH } from "../constants.js";
|
|
5
|
-
|
|
6
|
-
const OUTPUT_DIR = join(
|
|
7
|
-
ROOT_DIR,
|
|
8
|
-
"packages/mcp-docs-server/.docs/organized/code-examples",
|
|
9
|
-
);
|
|
10
|
-
const MAX_LINES = 10000;
|
|
11
|
-
|
|
12
|
-
interface FileContent {
|
|
13
|
-
path: string;
|
|
14
|
-
content: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function scanDirectory(
|
|
18
|
-
dir: string,
|
|
19
|
-
baseDir: string,
|
|
20
|
-
): Promise<FileContent[]> {
|
|
21
|
-
const files: FileContent[] = [];
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
25
|
-
|
|
26
|
-
for (const entry of entries) {
|
|
27
|
-
const fullPath = join(dir, entry.name);
|
|
28
|
-
|
|
29
|
-
if (entry.isDirectory()) {
|
|
30
|
-
const skipDirs = [
|
|
31
|
-
"node_modules",
|
|
32
|
-
"dist",
|
|
33
|
-
"build",
|
|
34
|
-
".next",
|
|
35
|
-
".git",
|
|
36
|
-
".turbo",
|
|
37
|
-
];
|
|
38
|
-
if (!skipDirs.includes(entry.name)) {
|
|
39
|
-
const subFiles = await scanDirectory(fullPath, baseDir);
|
|
40
|
-
files.push(...subFiles);
|
|
41
|
-
}
|
|
42
|
-
} else if (entry.isFile()) {
|
|
43
|
-
const includeExts = [
|
|
44
|
-
".ts",
|
|
45
|
-
".tsx",
|
|
46
|
-
".js",
|
|
47
|
-
".jsx",
|
|
48
|
-
".json",
|
|
49
|
-
".css",
|
|
50
|
-
".md",
|
|
51
|
-
".mdx",
|
|
52
|
-
];
|
|
53
|
-
const ext = extname(entry.name).toLowerCase();
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
includeExts.includes(ext) ||
|
|
57
|
-
entry.name === "package.json" ||
|
|
58
|
-
entry.name === "tsconfig.json"
|
|
59
|
-
) {
|
|
60
|
-
try {
|
|
61
|
-
const content = await readFile(fullPath, "utf-8");
|
|
62
|
-
const relativePath = relative(baseDir, fullPath);
|
|
63
|
-
files.push({ path: relativePath, content });
|
|
64
|
-
} catch (error) {
|
|
65
|
-
logger.warn(`Failed to read file: ${fullPath}`, error);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} catch (error) {
|
|
71
|
-
logger.error(`Failed to scan directory: ${dir}`, error);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return files;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function getFileType(filename: string): string {
|
|
78
|
-
const ext = extname(filename).toLowerCase();
|
|
79
|
-
const extMap: Record<string, string> = {
|
|
80
|
-
".ts": "typescript",
|
|
81
|
-
".tsx": "tsx",
|
|
82
|
-
".js": "javascript",
|
|
83
|
-
".jsx": "jsx",
|
|
84
|
-
".json": "json",
|
|
85
|
-
".css": "css",
|
|
86
|
-
".md": "markdown",
|
|
87
|
-
".mdx": "mdx",
|
|
88
|
-
};
|
|
89
|
-
return extMap[ext] || "text";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export async function prepareCodeExamples(): Promise<void> {
|
|
93
|
-
logger.info("Preparing code examples...");
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
await rm(OUTPUT_DIR, { recursive: true, force: true });
|
|
97
|
-
await mkdir(OUTPUT_DIR, { recursive: true });
|
|
98
|
-
|
|
99
|
-
const exampleDirs = await readdir(EXAMPLES_PATH, { withFileTypes: true });
|
|
100
|
-
|
|
101
|
-
for (const dir of exampleDirs) {
|
|
102
|
-
if (dir.isDirectory() && !dir.name.startsWith(".")) {
|
|
103
|
-
const examplePath = join(EXAMPLES_PATH, dir.name);
|
|
104
|
-
logger.info(`Processing example: ${dir.name}`);
|
|
105
|
-
|
|
106
|
-
let description = "";
|
|
107
|
-
try {
|
|
108
|
-
const packageJsonPath = join(examplePath, "package.json");
|
|
109
|
-
const packageJson = JSON.parse(
|
|
110
|
-
await readFile(packageJsonPath, "utf-8"),
|
|
111
|
-
);
|
|
112
|
-
description = packageJson.description || "";
|
|
113
|
-
} catch (error: any) {
|
|
114
|
-
if (error?.code !== "ENOENT") {
|
|
115
|
-
logger.warn(`Failed to read package.json for ${dir.name}:`, error);
|
|
116
|
-
} else {
|
|
117
|
-
logger.debug(`No package.json found for example: ${dir.name}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const files = await scanDirectory(examplePath, examplePath);
|
|
122
|
-
|
|
123
|
-
files.sort((a, b) => a.path.localeCompare(b.path));
|
|
124
|
-
|
|
125
|
-
let markdown = `# Example: ${dir.name}\n\n`;
|
|
126
|
-
if (description) {
|
|
127
|
-
markdown += `${description}\n\n`;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
let totalLines = 0;
|
|
131
|
-
for (const file of files) {
|
|
132
|
-
const lines = file.content.split("\n").length;
|
|
133
|
-
if (totalLines + lines > MAX_LINES) {
|
|
134
|
-
markdown += `\n_Note: Additional files truncated due to size limits_\n`;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Normalize Windows backslashes to forward slashes for consistent markdown output
|
|
139
|
-
markdown += `## ${file.path.replace(/\\/g, "/")}\n\n`;
|
|
140
|
-
markdown += `\`\`\`${getFileType(file.path)}\n`;
|
|
141
|
-
markdown += file.content;
|
|
142
|
-
markdown += `\n\`\`\`\n\n`;
|
|
143
|
-
|
|
144
|
-
totalLines += lines;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const outputPath = join(OUTPUT_DIR, `${dir.name}.md`);
|
|
148
|
-
await writeFile(outputPath, markdown, "utf-8");
|
|
149
|
-
logger.debug(`Created example: ${outputPath}`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
logger.info("Code examples preparation complete");
|
|
154
|
-
} catch (error) {
|
|
155
|
-
logger.error("Failed to prepare code examples", error);
|
|
156
|
-
throw error;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { rm, mkdir, readdir, copyFile } from "node:fs/promises";
|
|
2
|
-
import { join, extname } from "node:path";
|
|
3
|
-
import { logger } from "../utils/logger.js";
|
|
4
|
-
import { ROOT_DIR } from "../constants.js";
|
|
5
|
-
|
|
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
|
-
|
|
9
|
-
async function copyDir(src: string, dest: string): Promise<void> {
|
|
10
|
-
try {
|
|
11
|
-
await mkdir(dest, { recursive: true });
|
|
12
|
-
const entries = await readdir(src, { withFileTypes: true });
|
|
13
|
-
|
|
14
|
-
for (const entry of entries) {
|
|
15
|
-
const srcPath = join(src, entry.name);
|
|
16
|
-
const destPath = join(dest, entry.name);
|
|
17
|
-
|
|
18
|
-
if (entry.isDirectory()) {
|
|
19
|
-
await copyDir(srcPath, destPath);
|
|
20
|
-
} else if (entry.isFile()) {
|
|
21
|
-
const ext = extname(entry.name).toLowerCase();
|
|
22
|
-
if (ext === ".mdx" || ext === ".md") {
|
|
23
|
-
await copyFile(srcPath, destPath);
|
|
24
|
-
logger.debug(`Copied: ${srcPath} -> ${destPath}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
} catch (error) {
|
|
29
|
-
logger.error(`Failed to copy directory: ${src}`, error);
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function copyRaw(): Promise<void> {
|
|
35
|
-
logger.info("Copying raw documentation files...");
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
await rm(DOCS_DEST, { recursive: true, force: true });
|
|
39
|
-
await mkdir(DOCS_DEST, { recursive: true });
|
|
40
|
-
|
|
41
|
-
const docsPath = join(DOCS_DEST, "docs");
|
|
42
|
-
await copyDir(DOCS_SOURCE, docsPath);
|
|
43
|
-
logger.info(`Copied documentation to ${docsPath}`);
|
|
44
|
-
|
|
45
|
-
logger.info("Raw documentation copy complete");
|
|
46
|
-
} catch (error) {
|
|
47
|
-
logger.error("Failed to copy raw documentation", error);
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
}
|