@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,740 +0,0 @@
|
|
|
1
|
-
# Example: with-react-ink-web
|
|
2
|
-
|
|
3
|
-
## app/globals.css
|
|
4
|
-
|
|
5
|
-
```css
|
|
6
|
-
* {
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
html,
|
|
11
|
-
body {
|
|
12
|
-
height: 100%;
|
|
13
|
-
margin: 0;
|
|
14
|
-
background: #1a1a1a;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.terminal-center {
|
|
18
|
-
display: flex;
|
|
19
|
-
height: 100vh;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.terminal-host {
|
|
25
|
-
width: 100%;
|
|
26
|
-
max-width: 960px;
|
|
27
|
-
height: min(100%, 560px);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.terminal-host .wterm {
|
|
31
|
-
height: 100%;
|
|
32
|
-
border-radius: 0;
|
|
33
|
-
box-shadow: none;
|
|
34
|
-
background: #1a1a1a;
|
|
35
|
-
--term-bg: #1a1a1a;
|
|
36
|
-
--term-fg: #e0e0e0;
|
|
37
|
-
--term-cursor: #34d399;
|
|
38
|
-
--term-font-family: Menlo, Monaco, "Courier New", monospace;
|
|
39
|
-
--term-font-size: 13px;
|
|
40
|
-
--term-line-height: 1.3;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.terminal-loading {
|
|
44
|
-
display: flex;
|
|
45
|
-
height: 100vh;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
font-family: ui-monospace, Menlo, Monaco, monospace;
|
|
49
|
-
font-size: 14px;
|
|
50
|
-
color: #6b7280;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## app/ink-app.tsx
|
|
56
|
-
|
|
57
|
-
```tsx
|
|
58
|
-
"use client";
|
|
59
|
-
|
|
60
|
-
// Mirrors examples/with-react-ink/src/app.tsx; keep in sync.
|
|
61
|
-
import { useMemo } from "react";
|
|
62
|
-
import { Box, Text } from "ink";
|
|
63
|
-
import {
|
|
64
|
-
AssistantRuntimeProvider,
|
|
65
|
-
StatusBarPrimitive,
|
|
66
|
-
useAui,
|
|
67
|
-
} from "@assistant-ui/react-ink";
|
|
68
|
-
import { useChatRuntime, AssistantChatTransport } from "@assistant-ui/ai-sdk";
|
|
69
|
-
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
|
|
70
|
-
import { Thread } from "./thread";
|
|
71
|
-
|
|
72
|
-
const CHAT_API =
|
|
73
|
-
process.env.NEXT_PUBLIC_CHAT_ENDPOINT_URL ??
|
|
74
|
-
(process.env.NODE_ENV === "development"
|
|
75
|
-
? "http://localhost:3000/api/chat"
|
|
76
|
-
: "https://www.assistant-ui.com/api/chat");
|
|
77
|
-
|
|
78
|
-
const MODEL_NAME = "assistant-ui";
|
|
79
|
-
const ANONYMOUS_SESSION_HEADER = "x-assistant-ui-anonymous-session";
|
|
80
|
-
|
|
81
|
-
// Mirrors examples/with-expo/hooks/anonymous-session-fetch.ts; keep in sync.
|
|
82
|
-
function createAnonymousSessionFetch(chatApi: string): typeof fetch {
|
|
83
|
-
let tokenPromise: Promise<string | null> | null = null;
|
|
84
|
-
|
|
85
|
-
const getToken = () => {
|
|
86
|
-
tokenPromise ??= (async () => {
|
|
87
|
-
const endpoint = new URL(chatApi, window.location.origin);
|
|
88
|
-
endpoint.pathname = "/api/anonymous-session";
|
|
89
|
-
endpoint.search = "";
|
|
90
|
-
const response = await fetch(endpoint, { credentials: "same-origin" });
|
|
91
|
-
if (!response.ok) {
|
|
92
|
-
throw new Error("Unable to start an anonymous session");
|
|
93
|
-
}
|
|
94
|
-
if (response.status === 204) return null;
|
|
95
|
-
const payload = (await response.json()) as { token?: unknown };
|
|
96
|
-
if (typeof payload.token !== "string" || !payload.token) {
|
|
97
|
-
throw new Error("Anonymous session token is missing");
|
|
98
|
-
}
|
|
99
|
-
return payload.token;
|
|
100
|
-
})().catch(() => {
|
|
101
|
-
tokenPromise = null;
|
|
102
|
-
return null;
|
|
103
|
-
});
|
|
104
|
-
return tokenPromise;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
return async (input, init) => {
|
|
108
|
-
const requestTemplate =
|
|
109
|
-
input instanceof Request ? new Request(input, init) : null;
|
|
110
|
-
|
|
111
|
-
const send = async () => {
|
|
112
|
-
const headers = new Headers(requestTemplate?.headers ?? init?.headers);
|
|
113
|
-
const token = await getToken();
|
|
114
|
-
if (token) headers.set(ANONYMOUS_SESSION_HEADER, token);
|
|
115
|
-
if (requestTemplate) {
|
|
116
|
-
return fetch(requestTemplate.clone(), { headers });
|
|
117
|
-
}
|
|
118
|
-
return fetch(input, { ...init, headers });
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const response = await send();
|
|
122
|
-
if (response.status !== 401) return response;
|
|
123
|
-
tokenPromise = null;
|
|
124
|
-
return send();
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export const InkApp = () => {
|
|
129
|
-
const transport = useMemo(
|
|
130
|
-
() =>
|
|
131
|
-
new AssistantChatTransport({
|
|
132
|
-
api: CHAT_API,
|
|
133
|
-
fetch: createAnonymousSessionFetch(CHAT_API),
|
|
134
|
-
}),
|
|
135
|
-
[],
|
|
136
|
-
);
|
|
137
|
-
const runtime = useChatRuntime({
|
|
138
|
-
transport,
|
|
139
|
-
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
140
|
-
});
|
|
141
|
-
const aui = useAui();
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<AssistantRuntimeProvider aui={aui} runtime={runtime}>
|
|
145
|
-
<Box flexDirection="column" padding={1}>
|
|
146
|
-
<Box>
|
|
147
|
-
<Text bold color="cyan">
|
|
148
|
-
{MODEL_NAME}
|
|
149
|
-
</Text>
|
|
150
|
-
<Text dimColor>{" ~/assistant-ui"}</Text>
|
|
151
|
-
</Box>
|
|
152
|
-
<StatusBarPrimitive.Root>
|
|
153
|
-
<Text dimColor>
|
|
154
|
-
model: <StatusBarPrimitive.ModelName name={MODEL_NAME} /> ·{" "}
|
|
155
|
-
<StatusBarPrimitive.MessageCount /> · <StatusBarPrimitive.Status />
|
|
156
|
-
</Text>
|
|
157
|
-
</StatusBarPrimitive.Root>
|
|
158
|
-
<Box marginTop={1}>
|
|
159
|
-
<Thread />
|
|
160
|
-
</Box>
|
|
161
|
-
</Box>
|
|
162
|
-
</AssistantRuntimeProvider>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## app/ink-streams.ts
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
type Listener = (...args: unknown[]) => void;
|
|
172
|
-
|
|
173
|
-
class MiniEmitter {
|
|
174
|
-
private listeners = new Map<string, Set<Listener>>();
|
|
175
|
-
|
|
176
|
-
on(event: string, fn: Listener) {
|
|
177
|
-
let set = this.listeners.get(event);
|
|
178
|
-
if (!set) {
|
|
179
|
-
set = new Set();
|
|
180
|
-
this.listeners.set(event, set);
|
|
181
|
-
}
|
|
182
|
-
set.add(fn);
|
|
183
|
-
return this;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
off(event: string, fn: Listener) {
|
|
187
|
-
this.listeners.get(event)?.delete(fn);
|
|
188
|
-
return this;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
addListener(event: string, fn: Listener) {
|
|
192
|
-
return this.on(event, fn);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
removeListener(event: string, fn: Listener) {
|
|
196
|
-
return this.off(event, fn);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
emit(event: string, ...args: unknown[]) {
|
|
200
|
-
const set = this.listeners.get(event);
|
|
201
|
-
if (!set) return false;
|
|
202
|
-
for (const fn of [...set]) fn(...args);
|
|
203
|
-
return set.size > 0;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export type InkStreams = {
|
|
208
|
-
stdout: NodeJS.WriteStream;
|
|
209
|
-
stdin: NodeJS.ReadStream;
|
|
210
|
-
pushInput: (data: string) => void;
|
|
211
|
-
setSize: (cols: number, rows: number) => void;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// Fake streams implementing the subset of the Node stream API that ink 6
|
|
215
|
-
// touches (see ink's Ink/App classes). The writer receives ink's ANSI output
|
|
216
|
-
// with bare \n rewritten to \r\n (wterm does not emulate ONLCR). Ink's
|
|
217
|
-
// clear-terminal sequence passes through: its 3J resets wterm's scrollback on
|
|
218
|
-
// every overflow repaint, leaving only the final frame's overflow scrollable.
|
|
219
|
-
export function createInkStreams(
|
|
220
|
-
writeToTerminal: (data: string) => void,
|
|
221
|
-
): InkStreams {
|
|
222
|
-
const stdoutBase = new MiniEmitter() as MiniEmitter & Record<string, unknown>;
|
|
223
|
-
Object.assign(stdoutBase, {
|
|
224
|
-
columns: 80,
|
|
225
|
-
rows: 24,
|
|
226
|
-
isTTY: true,
|
|
227
|
-
writable: true,
|
|
228
|
-
setDefaultEncoding: () => stdoutBase,
|
|
229
|
-
cork: () => {},
|
|
230
|
-
uncork: () => {},
|
|
231
|
-
write: (chunk: unknown, encoding?: unknown, cb?: () => void) => {
|
|
232
|
-
const str = typeof chunk === "string" ? chunk : String(chunk);
|
|
233
|
-
if (str.length > 0) {
|
|
234
|
-
writeToTerminal(str.replace(/\r?\n/g, "\r\n"));
|
|
235
|
-
}
|
|
236
|
-
if (typeof encoding === "function") (encoding as () => void)();
|
|
237
|
-
else cb?.();
|
|
238
|
-
return true;
|
|
239
|
-
},
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
const inputBuffer: string[] = [];
|
|
243
|
-
const stdinBase = new MiniEmitter() as MiniEmitter & Record<string, unknown>;
|
|
244
|
-
Object.assign(stdinBase, {
|
|
245
|
-
columns: 80,
|
|
246
|
-
rows: 24,
|
|
247
|
-
isTTY: true,
|
|
248
|
-
readable: true,
|
|
249
|
-
setEncoding: () => stdinBase,
|
|
250
|
-
setRawMode: () => stdinBase,
|
|
251
|
-
resume: () => stdinBase,
|
|
252
|
-
pause: () => stdinBase,
|
|
253
|
-
ref: () => stdinBase,
|
|
254
|
-
unref: () => stdinBase,
|
|
255
|
-
read: () => (inputBuffer.length > 0 ? inputBuffer.shift()! : null),
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
stdout: stdoutBase as unknown as NodeJS.WriteStream,
|
|
260
|
-
stdin: stdinBase as unknown as NodeJS.ReadStream,
|
|
261
|
-
pushInput: (data: string) => {
|
|
262
|
-
inputBuffer.push(data);
|
|
263
|
-
stdinBase.emit("readable");
|
|
264
|
-
},
|
|
265
|
-
setSize: (cols: number, rows: number) => {
|
|
266
|
-
const changed =
|
|
267
|
-
stdoutBase["columns"] !== cols || stdoutBase["rows"] !== rows;
|
|
268
|
-
stdoutBase["columns"] = cols;
|
|
269
|
-
stdoutBase["rows"] = rows;
|
|
270
|
-
stdinBase["columns"] = cols;
|
|
271
|
-
stdinBase["rows"] = rows;
|
|
272
|
-
if (changed) stdoutBase.emit("resize");
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## app/layout.tsx
|
|
280
|
-
|
|
281
|
-
```tsx
|
|
282
|
-
import type { Metadata } from "next";
|
|
283
|
-
import type { ReactNode } from "react";
|
|
284
|
-
import "./globals.css";
|
|
285
|
-
|
|
286
|
-
export const metadata: Metadata = {
|
|
287
|
-
title: "assistant-ui ink demo",
|
|
288
|
-
description: "The with-react-ink example running in the browser via ink-web.",
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
292
|
-
return (
|
|
293
|
-
<html lang="en">
|
|
294
|
-
<body>{children}</body>
|
|
295
|
-
</html>
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
## app/page.tsx
|
|
302
|
-
|
|
303
|
-
```tsx
|
|
304
|
-
"use client";
|
|
305
|
-
|
|
306
|
-
import dynamic from "next/dynamic";
|
|
307
|
-
|
|
308
|
-
const Terminal = dynamic(() => import("./terminal"), {
|
|
309
|
-
ssr: false,
|
|
310
|
-
loading: () => <div className="terminal-loading">starting terminal...</div>,
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
export default function Home() {
|
|
314
|
-
return <Terminal />;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
## app/terminal.tsx
|
|
320
|
-
|
|
321
|
-
```tsx
|
|
322
|
-
"use client";
|
|
323
|
-
|
|
324
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
325
|
-
import { Terminal, useTerminal, type WTerm } from "@wterm/react";
|
|
326
|
-
import { render, type Instance } from "ink";
|
|
327
|
-
import { waitForYogaInit } from "ink-web";
|
|
328
|
-
import { createInkStreams, type InkStreams } from "./ink-streams";
|
|
329
|
-
import { InkApp } from "./ink-app";
|
|
330
|
-
import "@wterm/dom/src/terminal.css";
|
|
331
|
-
|
|
332
|
-
const inkApp = <InkApp />;
|
|
333
|
-
|
|
334
|
-
export default function InkTerminal() {
|
|
335
|
-
const { ref, write } = useTerminal();
|
|
336
|
-
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
337
|
-
const streamsRef = useRef<InkStreams | null>(null);
|
|
338
|
-
const instanceRef = useRef<Instance | null>(null);
|
|
339
|
-
const startedRef = useRef(false);
|
|
340
|
-
const disposedRef = useRef(false);
|
|
341
|
-
const colsRef = useRef(0);
|
|
342
|
-
const scrollPendingRef = useRef(false);
|
|
343
|
-
|
|
344
|
-
const writeRef = useRef(write);
|
|
345
|
-
writeRef.current = write;
|
|
346
|
-
|
|
347
|
-
// wterm does not auto-scroll on new output (vercel-labs/wterm#61); follow
|
|
348
|
-
// the tail after its coalesced write -> setTimeout(0) -> rAF render pass.
|
|
349
|
-
// Skipped while the visitor has scrolled up to read scrollback.
|
|
350
|
-
const scheduleScroll = useCallback(() => {
|
|
351
|
-
if (scrollPendingRef.current) return;
|
|
352
|
-
const el = wrapperRef.current?.querySelector(".wterm");
|
|
353
|
-
if (el && el.scrollHeight - el.scrollTop - el.clientHeight > 100) return;
|
|
354
|
-
scrollPendingRef.current = true;
|
|
355
|
-
setTimeout(() => {
|
|
356
|
-
requestAnimationFrame(() => {
|
|
357
|
-
scrollPendingRef.current = false;
|
|
358
|
-
const target = wrapperRef.current?.querySelector(".wterm");
|
|
359
|
-
if (target) target.scrollTop = target.scrollHeight;
|
|
360
|
-
});
|
|
361
|
-
}, 0);
|
|
362
|
-
}, []);
|
|
363
|
-
|
|
364
|
-
const getStreams = useCallback(() => {
|
|
365
|
-
streamsRef.current ??= createInkStreams((data) => {
|
|
366
|
-
writeRef.current(data);
|
|
367
|
-
scheduleScroll();
|
|
368
|
-
});
|
|
369
|
-
return streamsRef.current;
|
|
370
|
-
}, [scheduleScroll]);
|
|
371
|
-
|
|
372
|
-
const handleReady = useCallback(
|
|
373
|
-
(wt: WTerm) => {
|
|
374
|
-
const streams = getStreams();
|
|
375
|
-
colsRef.current = wt.cols;
|
|
376
|
-
streams.setSize(wt.cols, wt.rows);
|
|
377
|
-
// ink components draw their own cursor; the bundled ink's cli-cursor
|
|
378
|
-
// shim is a no-op, so hide wterm's grid cursor here.
|
|
379
|
-
wt.write("\x1b[?25l");
|
|
380
|
-
|
|
381
|
-
if (!startedRef.current) {
|
|
382
|
-
startedRef.current = true;
|
|
383
|
-
void waitForYogaInit().then(() => {
|
|
384
|
-
if (disposedRef.current) return;
|
|
385
|
-
instanceRef.current = render(inkApp, {
|
|
386
|
-
stdout: streams.stdout,
|
|
387
|
-
stderr: streams.stdout,
|
|
388
|
-
stdin: streams.stdin,
|
|
389
|
-
patchConsole: false,
|
|
390
|
-
exitOnCtrlC: false,
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
} else if (instanceRef.current) {
|
|
394
|
-
instanceRef.current.clear();
|
|
395
|
-
instanceRef.current.rerender(inkApp);
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
[getStreams],
|
|
399
|
-
);
|
|
400
|
-
|
|
401
|
-
// wterm encodes the Backspace key as \x7f, which the bundled ink 6 parses
|
|
402
|
-
// as key.delete (forward delete); rewrite to \x08, which it parses as
|
|
403
|
-
// backspace. \x03 (Ctrl+C) is dropped so it stays free for copy.
|
|
404
|
-
const handleData = useCallback(
|
|
405
|
-
(data: string) => {
|
|
406
|
-
const mapped = data.replaceAll("\x7f", "\x08").replaceAll("\x03", "");
|
|
407
|
-
if (mapped.length === 0) return;
|
|
408
|
-
getStreams().pushInput(mapped);
|
|
409
|
-
},
|
|
410
|
-
[getStreams],
|
|
411
|
-
);
|
|
412
|
-
|
|
413
|
-
const handleResize = useCallback(
|
|
414
|
-
(cols: number, rows: number) => {
|
|
415
|
-
if (cols < colsRef.current && instanceRef.current) {
|
|
416
|
-
instanceRef.current.clear();
|
|
417
|
-
writeRef.current("\x1b[2J\x1b[3J\x1b[H");
|
|
418
|
-
}
|
|
419
|
-
colsRef.current = cols;
|
|
420
|
-
getStreams().setSize(cols, rows);
|
|
421
|
-
},
|
|
422
|
-
[getStreams],
|
|
423
|
-
);
|
|
424
|
-
|
|
425
|
-
useEffect(() => {
|
|
426
|
-
disposedRef.current = false;
|
|
427
|
-
return () => {
|
|
428
|
-
disposedRef.current = true;
|
|
429
|
-
instanceRef.current?.unmount();
|
|
430
|
-
instanceRef.current = null;
|
|
431
|
-
startedRef.current = false;
|
|
432
|
-
};
|
|
433
|
-
}, []);
|
|
434
|
-
|
|
435
|
-
return (
|
|
436
|
-
<div className="terminal-center">
|
|
437
|
-
<div ref={wrapperRef} className="terminal-host">
|
|
438
|
-
<Terminal
|
|
439
|
-
ref={ref}
|
|
440
|
-
autoResize
|
|
441
|
-
onReady={handleReady}
|
|
442
|
-
onData={handleData}
|
|
443
|
-
onResize={handleResize}
|
|
444
|
-
/>
|
|
445
|
-
</div>
|
|
446
|
-
</div>
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
## app/thread.tsx
|
|
453
|
-
|
|
454
|
-
```tsx
|
|
455
|
-
// Mirrors examples/with-react-ink/src/components/thread.tsx; keep in sync.
|
|
456
|
-
import { Box, Text, useStdout } from "ink";
|
|
457
|
-
import {
|
|
458
|
-
AuiIf,
|
|
459
|
-
ThreadPrimitive,
|
|
460
|
-
ComposerPrimitive,
|
|
461
|
-
MessagePrimitive,
|
|
462
|
-
ErrorPrimitive,
|
|
463
|
-
LoadingPrimitive,
|
|
464
|
-
LiveChecklist,
|
|
465
|
-
} from "@assistant-ui/react-ink";
|
|
466
|
-
import { MarkdownText } from "@assistant-ui/react-ink-markdown";
|
|
467
|
-
|
|
468
|
-
// markdansi defaults width and color from process.stdout, which does not
|
|
469
|
-
// exist in the browser bundle; pass both explicitly so it never reads it.
|
|
470
|
-
const BrowserMarkdownText = ({ text }: { text: string }) => {
|
|
471
|
-
const { stdout } = useStdout();
|
|
472
|
-
return (
|
|
473
|
-
<MarkdownText
|
|
474
|
-
text={text}
|
|
475
|
-
width={(stdout?.columns ?? 80) - 4}
|
|
476
|
-
hyperlinks={false}
|
|
477
|
-
color
|
|
478
|
-
/>
|
|
479
|
-
);
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
const UserMessage = () => (
|
|
483
|
-
<MessagePrimitive.Root>
|
|
484
|
-
<Box marginBottom={1}>
|
|
485
|
-
<Text bold color="green">
|
|
486
|
-
You:{" "}
|
|
487
|
-
</Text>
|
|
488
|
-
<MessagePrimitive.Content
|
|
489
|
-
renderText={({ part }) => <Text wrap="wrap">{part.text}</Text>}
|
|
490
|
-
/>
|
|
491
|
-
</Box>
|
|
492
|
-
</MessagePrimitive.Root>
|
|
493
|
-
);
|
|
494
|
-
|
|
495
|
-
const AssistantMessage = () => (
|
|
496
|
-
<MessagePrimitive.Root>
|
|
497
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
498
|
-
<Text bold color="blue">
|
|
499
|
-
AI:
|
|
500
|
-
</Text>
|
|
501
|
-
<MessagePrimitive.Content
|
|
502
|
-
renderText={({ part }) => <BrowserMarkdownText text={part.text} />}
|
|
503
|
-
renderReasoning={({ part }) => (
|
|
504
|
-
<Text dimColor italic>
|
|
505
|
-
{part.text}
|
|
506
|
-
</Text>
|
|
507
|
-
)}
|
|
508
|
-
/>
|
|
509
|
-
<LiveChecklist title="Plan" showProgress marginTop={1} />
|
|
510
|
-
<ErrorPrimitive.Root>
|
|
511
|
-
<ErrorPrimitive.Message />
|
|
512
|
-
</ErrorPrimitive.Root>
|
|
513
|
-
</Box>
|
|
514
|
-
</MessagePrimitive.Root>
|
|
515
|
-
);
|
|
516
|
-
|
|
517
|
-
const Loading = () => (
|
|
518
|
-
<LoadingPrimitive.Root marginBottom={1}>
|
|
519
|
-
<LoadingPrimitive.Spinner />
|
|
520
|
-
<Text> </Text>
|
|
521
|
-
<LoadingPrimitive.Text>Working</LoadingPrimitive.Text>
|
|
522
|
-
<Text> </Text>
|
|
523
|
-
<LoadingPrimitive.ElapsedTime />
|
|
524
|
-
</LoadingPrimitive.Root>
|
|
525
|
-
);
|
|
526
|
-
|
|
527
|
-
export const Thread = () => {
|
|
528
|
-
return (
|
|
529
|
-
<ThreadPrimitive.Root>
|
|
530
|
-
<AuiIf condition={(s) => s.thread.isEmpty}>
|
|
531
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
532
|
-
<Text>
|
|
533
|
-
A real LLM streaming into a real Ink render loop in your browser.
|
|
534
|
-
</Text>
|
|
535
|
-
<Text dimColor>
|
|
536
|
-
{' try: "what is assistant-ui?" or "how do I render markdown?"'}
|
|
537
|
-
</Text>
|
|
538
|
-
</Box>
|
|
539
|
-
</AuiIf>
|
|
540
|
-
|
|
541
|
-
<ThreadPrimitive.Messages>
|
|
542
|
-
{({ message }) =>
|
|
543
|
-
message.role === "user" ? <UserMessage /> : <AssistantMessage />
|
|
544
|
-
}
|
|
545
|
-
</ThreadPrimitive.Messages>
|
|
546
|
-
|
|
547
|
-
<Loading />
|
|
548
|
-
|
|
549
|
-
<Box borderStyle="round" borderColor="gray" paddingX={1}>
|
|
550
|
-
<Text color="gray">{"> "}</Text>
|
|
551
|
-
<ComposerPrimitive.Input
|
|
552
|
-
submitOnEnter
|
|
553
|
-
multiLine
|
|
554
|
-
placeholder="Type a message... (Enter to send)"
|
|
555
|
-
autoFocus
|
|
556
|
-
/>
|
|
557
|
-
</Box>
|
|
558
|
-
</ThreadPrimitive.Root>
|
|
559
|
-
);
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
## next.config.ts
|
|
565
|
-
|
|
566
|
-
```typescript
|
|
567
|
-
import path from "node:path";
|
|
568
|
-
import type { NextConfig } from "next";
|
|
569
|
-
|
|
570
|
-
const config: NextConfig = {
|
|
571
|
-
output: "export",
|
|
572
|
-
transpilePackages: ["ink-web"],
|
|
573
|
-
turbopack: {
|
|
574
|
-
// Pin the workspace root; vercel build's environment makes Turbopack's
|
|
575
|
-
// lockfile-based inference resolve to the app directory instead of the
|
|
576
|
-
// monorepo root, which breaks resolution of pnpm-symlinked packages.
|
|
577
|
-
root: path.join(__dirname, "../.."),
|
|
578
|
-
resolveAlias: {
|
|
579
|
-
ink: "ink-web",
|
|
580
|
-
"supports-hyperlinks": {
|
|
581
|
-
browser: "./shims/supports-hyperlinks.ts",
|
|
582
|
-
},
|
|
583
|
-
},
|
|
584
|
-
},
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
export default config;
|
|
588
|
-
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
## package.json
|
|
592
|
-
|
|
593
|
-
```json
|
|
594
|
-
{
|
|
595
|
-
"name": "with-react-ink-web",
|
|
596
|
-
"version": "0.0.0",
|
|
597
|
-
"private": true,
|
|
598
|
-
"scripts": {
|
|
599
|
-
"dev": "next dev -p 8081",
|
|
600
|
-
"build": "next build",
|
|
601
|
-
"start": "next start"
|
|
602
|
-
},
|
|
603
|
-
"dependencies": {
|
|
604
|
-
"@assistant-ui/ai-sdk": "workspace:*",
|
|
605
|
-
"@assistant-ui/react-ink": "workspace:*",
|
|
606
|
-
"@assistant-ui/react-ink-markdown": "workspace:*",
|
|
607
|
-
"@wterm/dom": "^0.3.4",
|
|
608
|
-
"@wterm/react": "^0.3.4",
|
|
609
|
-
"ai": "^7.0.77",
|
|
610
|
-
"ink": "^7.1.1",
|
|
611
|
-
"ink-web": "^0.2.0",
|
|
612
|
-
"next": "^16.3.2",
|
|
613
|
-
"react": "^19.2.8",
|
|
614
|
-
"react-dom": "^19.2.8",
|
|
615
|
-
"react-reconciler": "^0.33.0",
|
|
616
|
-
"scheduler": "^0.27.0"
|
|
617
|
-
},
|
|
618
|
-
"devDependencies": {
|
|
619
|
-
"@types/node": "^26.2.0",
|
|
620
|
-
"@types/react": "^19.2.18",
|
|
621
|
-
"typescript": "^7.0.2"
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
```
|
|
626
|
-
|
|
627
|
-
## README.md
|
|
628
|
-
|
|
629
|
-
```markdown
|
|
630
|
-
# Welcome to the assistant-ui ink web demo 👋
|
|
631
|
-
|
|
632
|
-
This app runs the [`@assistant-ui/react-ink`](https://www.assistant-ui.com/docs/ink) terminal chat in the browser against a real LLM. It powers the live demo embedded at [assistant-ui.com/ink](https://www.assistant-ui.com/ink) and is deployed at [assistant-ui-ink.vercel.app](https://assistant-ui-ink.vercel.app).
|
|
633
|
-
|
|
634
|
-
## Get started
|
|
635
|
-
|
|
636
|
-
1. Install dependencies
|
|
637
|
-
|
|
638
|
-
```bash
|
|
639
|
-
pnpm install
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
2. Start the docs app, which serves the chat endpoint on [localhost:3000](http://localhost:3000)
|
|
643
|
-
|
|
644
|
-
```bash
|
|
645
|
-
pnpm --filter @assistant-ui/docs dev
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
3. Start the app
|
|
649
|
-
|
|
650
|
-
```bash
|
|
651
|
-
pnpm dev
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
The terminal opens on [localhost:8081](http://localhost:8081), and the docs app embeds this URL on its `/ink` page in development.
|
|
655
|
-
|
|
656
|
-
## How it works
|
|
657
|
-
|
|
658
|
-
Ink has no official web target, so this app renders the real `@assistant-ui/react-ink` component tree through [ink-web](https://github.com/cjroth/ink-web)'s browser build of Ink, bridged to a [wterm](https://github.com/vercel-labs/wterm) terminal. wterm renders to the DOM, so text selection, copy, find, and screen readers work natively.
|
|
659
|
-
|
|
660
|
-
Chat requests go to the assistant-ui docs site's `/api/chat`, the same pattern as the React Native demo at [assistant-ui-expo.vercel.app](https://assistant-ui-expo.vercel.app). The app obtains a signed anonymous session when the backend supports it and holds no API keys; custom backends without the session route continue to receive normal chat requests.
|
|
661
|
-
|
|
662
|
-
## Learn more
|
|
663
|
-
|
|
664
|
-
- [assistant-ui ink documentation](https://www.assistant-ui.com/docs/ink): primitives, hooks, and adapters for terminal UIs.
|
|
665
|
-
- [with-react-ink](../with-react-ink): the real terminal version of this example. Start there if you are building an Ink app.
|
|
666
|
-
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
## shims/supports-hyperlinks.ts
|
|
670
|
-
|
|
671
|
-
```typescript
|
|
672
|
-
const supportsHyperlinks = {
|
|
673
|
-
stdout: false,
|
|
674
|
-
stderr: false,
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
export default supportsHyperlinks;
|
|
678
|
-
|
|
679
|
-
```
|
|
680
|
-
|
|
681
|
-
## tsconfig.json
|
|
682
|
-
|
|
683
|
-
```json
|
|
684
|
-
{
|
|
685
|
-
"compilerOptions": {
|
|
686
|
-
"target": "ES2022",
|
|
687
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
688
|
-
"allowJs": false,
|
|
689
|
-
"skipLibCheck": true,
|
|
690
|
-
"strict": true,
|
|
691
|
-
"noEmit": true,
|
|
692
|
-
"esModuleInterop": true,
|
|
693
|
-
"module": "esnext",
|
|
694
|
-
"moduleResolution": "bundler",
|
|
695
|
-
"resolveJsonModule": true,
|
|
696
|
-
"isolatedModules": true,
|
|
697
|
-
"jsx": "react-jsx",
|
|
698
|
-
"incremental": true,
|
|
699
|
-
"plugins": [
|
|
700
|
-
{
|
|
701
|
-
"name": "next"
|
|
702
|
-
}
|
|
703
|
-
]
|
|
704
|
-
},
|
|
705
|
-
"include": [
|
|
706
|
-
"next-env.d.ts",
|
|
707
|
-
"**/*.ts",
|
|
708
|
-
"**/*.tsx",
|
|
709
|
-
".next/types/**/*.ts",
|
|
710
|
-
".next/dev/types/**/*.ts"
|
|
711
|
-
],
|
|
712
|
-
"exclude": ["node_modules"]
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
```
|
|
716
|
-
|
|
717
|
-
## vercel.json
|
|
718
|
-
|
|
719
|
-
```json
|
|
720
|
-
{
|
|
721
|
-
"$schema": "https://openapi.vercel.sh/vercel.json",
|
|
722
|
-
"ignoreCommand": "bash ../../scripts/vercel-ignore-changeset-release.sh",
|
|
723
|
-
"buildCommand": "cd ../.. && pnpm turbo build --filter=@assistant-ui/react-ink --filter=@assistant-ui/react-ink-markdown --filter=@assistant-ui/ai-sdk && cd examples/with-react-ink-web && pnpm run build",
|
|
724
|
-
"outputDirectory": "out",
|
|
725
|
-
"framework": null,
|
|
726
|
-
"headers": [
|
|
727
|
-
{
|
|
728
|
-
"source": "/(.*)",
|
|
729
|
-
"headers": [
|
|
730
|
-
{
|
|
731
|
-
"key": "Content-Security-Policy",
|
|
732
|
-
"value": "frame-ancestors 'self' https://*.assistant-ui.com https://*.vercel.app http://localhost:*;"
|
|
733
|
-
}
|
|
734
|
-
]
|
|
735
|
-
}
|
|
736
|
-
]
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
```
|
|
740
|
-
|