@assistant-ui/mcp-docs-server 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/waterfall.md +8 -8
- package/.docs/organized/code-examples/with-a2a.md +10 -10
- package/.docs/organized/code-examples/with-ag-ui.md +12 -12
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +14 -14
- package/.docs/organized/code-examples/with-artifacts.md +14 -14
- package/.docs/organized/code-examples/with-assistant-transport.md +11 -11
- package/.docs/organized/code-examples/with-browser-extension.md +345 -0
- package/.docs/organized/code-examples/with-chain-of-thought.md +129 -63
- package/.docs/organized/code-examples/with-cloud-standalone.md +13 -13
- package/.docs/organized/code-examples/with-cloud.md +13 -13
- package/.docs/organized/code-examples/with-custom-thread-list.md +65 -20
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +18 -17
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +18 -17
- package/.docs/organized/code-examples/with-expo.md +25 -25
- package/.docs/organized/code-examples/with-external-store.md +10 -10
- package/.docs/organized/code-examples/with-ffmpeg.md +14 -14
- package/.docs/organized/code-examples/with-generative-ui.md +211 -14
- package/.docs/organized/code-examples/with-google-adk.md +12 -12
- package/.docs/organized/code-examples/with-heat-graph.md +8 -8
- package/.docs/organized/code-examples/with-image-generation.md +454 -0
- package/.docs/organized/code-examples/with-interactables.md +14 -14
- package/.docs/organized/code-examples/with-langchain.md +12 -12
- package/.docs/organized/code-examples/with-langgraph.md +15 -12
- package/.docs/organized/code-examples/with-livekit.md +19 -18
- package/.docs/organized/code-examples/with-mcp.md +748 -0
- package/.docs/organized/code-examples/with-opencode.md +107 -62
- package/.docs/organized/code-examples/with-parent-id-grouping.md +12 -12
- package/.docs/organized/code-examples/with-react-hook-form.md +14 -14
- package/.docs/organized/code-examples/with-react-ink.md +4 -4
- package/.docs/organized/code-examples/with-react-router.md +16 -16
- package/.docs/organized/code-examples/with-resumable-stream.md +660 -0
- package/.docs/organized/code-examples/with-store.md +8 -8
- package/.docs/organized/code-examples/with-tanstack.md +14 -14
- package/.docs/organized/code-examples/with-tap-runtime.md +11 -10
- package/.docs/raw/docs/(docs)/cli.mdx +3 -1
- package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
- package/.docs/raw/docs/(docs)/index.mdx +3 -2
- package/.docs/raw/docs/(docs)/installation.mdx +2 -1
- package/.docs/raw/docs/(docs)/rtl.mdx +1 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +36 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +34 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +55 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +36 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +31 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +33 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +28 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +94 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +464 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +79 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +125 -125
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +46 -20
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +70 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +182 -554
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +82 -86
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -314
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +43 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -42
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +68 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +79 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +92 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +131 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +230 -2
- package/.docs/raw/docs/cloud/ai-sdk.mdx +222 -4
- package/.docs/raw/docs/cloud/index.mdx +2 -2
- package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
- package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +45 -40
- package/.docs/raw/docs/guides/branching.mdx +76 -0
- package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +54 -26
- package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +3 -1
- package/.docs/raw/docs/guides/editing.mdx +102 -0
- package/.docs/raw/docs/guides/generative-ui.mdx +142 -0
- package/.docs/raw/docs/guides/image-generation.mdx +74 -0
- package/.docs/raw/docs/guides/index.mdx +103 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +51 -2
- package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +53 -10
- package/.docs/raw/docs/guides/mcp-apps.mdx +231 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/mentions.mdx +63 -88
- package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +45 -6
- package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +66 -6
- package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +11 -18
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
- package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/slash-commands.mdx +104 -38
- package/.docs/raw/docs/guides/speech.mdx +156 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +91 -69
- package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +110 -38
- package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +197 -40
- package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +41 -2
- package/.docs/raw/docs/ink/adapters.mdx +37 -1
- package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
- package/.docs/raw/docs/ink/index.mdx +11 -14
- package/.docs/raw/docs/ink/migration.mdx +1 -3
- package/.docs/raw/docs/ink/primitives.mdx +386 -9
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
- package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
- package/.docs/raw/docs/integrations/gateways/index.mdx +162 -0
- package/.docs/raw/docs/integrations/index.mdx +185 -0
- package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +163 -0
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +150 -0
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
- package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
- package/.docs/raw/docs/integrations/tools/react-mcp.mdx +337 -0
- package/.docs/raw/docs/migrations/v0-14.mdx +297 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
- package/.docs/raw/docs/primitives/attachment.mdx +1 -0
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
- package/.docs/raw/docs/primitives/composer.mdx +55 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -0
- package/.docs/raw/docs/primitives/index.mdx +4 -3
- package/.docs/raw/docs/primitives/message.mdx +68 -5
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
- package/.docs/raw/docs/primitives/suggestion.mdx +10 -0
- package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
- package/.docs/raw/docs/primitives/thread.mdx +16 -13
- package/.docs/raw/docs/react-native/hooks.mdx +2 -2
- package/.docs/raw/docs/react-native/index.mdx +5 -7
- package/.docs/raw/docs/react-native/migration.mdx +1 -3
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
- package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
- package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +154 -0
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +73 -128
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +70 -64
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +337 -123
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +348 -0
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +261 -1236
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
- package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
- package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
- package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
- package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
- package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
- package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
- package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +78 -203
- package/.docs/raw/docs/ui/accordion.mdx +1 -0
- package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
- package/.docs/raw/docs/ui/attachment.mdx +1 -0
- package/.docs/raw/docs/ui/badge.mdx +1 -0
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +12 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -0
- package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
- package/.docs/raw/docs/ui/directive-text.mdx +1 -0
- package/.docs/raw/docs/ui/file.mdx +1 -0
- package/.docs/raw/docs/ui/image.mdx +1 -0
- package/.docs/raw/docs/ui/markdown.mdx +2 -14
- package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
- package/.docs/raw/docs/ui/mermaid.mdx +1 -0
- package/.docs/raw/docs/ui/message-timing.mdx +3 -2
- package/.docs/raw/docs/ui/model-selector.mdx +9 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
- package/.docs/raw/docs/ui/quote.mdx +1 -0
- package/.docs/raw/docs/ui/reasoning.mdx +66 -33
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
- package/.docs/raw/docs/ui/select.mdx +1 -0
- package/.docs/raw/docs/ui/sources.mdx +18 -0
- package/.docs/raw/docs/ui/streamdown.mdx +35 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
- package/.docs/raw/docs/ui/tabs.mdx +1 -0
- package/.docs/raw/docs/ui/thread-list.mdx +19 -2
- package/.docs/raw/docs/ui/thread.mdx +58 -3
- package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
- package/.docs/raw/docs/ui/tool-group.mdx +39 -11
- package/.docs/raw/docs/ui/voice.mdx +1 -0
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
- package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
- package/README.md +14 -72
- package/dist/constants.d.ts +12 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -9
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts +4 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.js +109 -121
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts +4 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.js +45 -42
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -2
- package/dist/prepare-docs/prepare.js +17 -17
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.d.ts +1 -3
- package/dist/stdio.js +6 -3
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.d.ts +20 -15
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +140 -161
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +20 -15
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +74 -86
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.d.ts +5 -2
- package/dist/tools/tests/test-setup.d.ts.map +1 -1
- package/dist/tools/tests/test-setup.js +21 -28
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +17 -17
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp-format.d.ts +8 -5
- package/dist/utils/mcp-format.d.ts.map +1 -1
- package/dist/utils/mcp-format.js +9 -9
- package/dist/utils/mcp-format.js.map +1 -1
- package/dist/utils/mdx.d.ts +8 -6
- package/dist/utils/mdx.d.ts.map +1 -1
- package/dist/utils/mdx.js +22 -22
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.d.ts +9 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +66 -76
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/security.d.ts +4 -1
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js +19 -40
- package/dist/utils/security.js.map +1 -1
- package/package.json +6 -6
- package/src/tools/tests/path-traversal.test.ts +1 -1
- package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
- package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
- package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
- package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +0 -159
- package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -314
- package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
- package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
- package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
- package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
- package/.docs/raw/docs/runtimes/langchain/comparison.mdx +0 -60
- package/.docs/raw/docs/runtimes/langchain/index.mdx +0 -210
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -699
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
- package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
- package/dist/prepare-docs/prepare.d.ts.map +0 -1
- package/dist/stdio.d.ts.map +0 -1
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
- /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Threads
|
|
3
|
+
description: Basic thread support, AssistantCloud, and custom thread list adapter.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`useLangGraphRuntime` supports the same three-path thread model documented in [threads](/docs/runtimes/concepts/threads), tailored for LangGraph thread ids. This page covers the LangGraph-specific wiring.
|
|
7
|
+
|
|
8
|
+
## Basic thread support
|
|
9
|
+
|
|
10
|
+
`useLangGraphRuntime` includes built-in thread management:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const runtime = useLangGraphRuntime({
|
|
14
|
+
stream: async (messages, { initialize, ...config }) => {
|
|
15
|
+
// initialize() creates or loads a thread and returns its IDs
|
|
16
|
+
const { remoteId, externalId } = await initialize();
|
|
17
|
+
// Use externalId (your backend's thread ID) for API calls
|
|
18
|
+
return sendMessage({ threadId: externalId, messages, config });
|
|
19
|
+
},
|
|
20
|
+
create: async () => {
|
|
21
|
+
// Called when creating a new thread
|
|
22
|
+
const { thread_id } = await createThread();
|
|
23
|
+
return { externalId: thread_id };
|
|
24
|
+
},
|
|
25
|
+
load: async (externalId) => {
|
|
26
|
+
// Called when loading an existing thread
|
|
27
|
+
const state = await getThreadState(externalId);
|
|
28
|
+
return {
|
|
29
|
+
messages: state.values.messages,
|
|
30
|
+
interrupts: state.tasks[0]?.interrupts,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Cloud persistence
|
|
37
|
+
|
|
38
|
+
For managed multi-thread support, persistence, sync, and titles, pass an `AssistantCloud` instance:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const runtime = useLangGraphRuntime({
|
|
42
|
+
cloud, // see "AssistantCloud" in /docs/runtimes/concepts/threads
|
|
43
|
+
// ... stream, create, load functions
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
See the [cloud persistence guide](/docs/cloud/langgraph) for setup details.
|
|
48
|
+
|
|
49
|
+
## Custom thread list
|
|
50
|
+
|
|
51
|
+
To surface pre-existing LangGraph `thread_id`s in the thread picker without running assistant-cloud, pass a `RemoteThreadListAdapter` via `unstable_threadListAdapter`. A common implementation backs `list()` with `client.threads.search()` and `initialize()` with `client.threads.create()`.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import type { RemoteThreadListAdapter } from "@assistant-ui/react";
|
|
55
|
+
import { Client } from "@langchain/langgraph-sdk";
|
|
56
|
+
|
|
57
|
+
const client = new Client({
|
|
58
|
+
apiUrl: process.env.NEXT_PUBLIC_LANGGRAPH_API_URL,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const threadListAdapter: RemoteThreadListAdapter = {
|
|
62
|
+
async list() {
|
|
63
|
+
const threads = await client.threads.search({ limit: 50 });
|
|
64
|
+
return {
|
|
65
|
+
threads: threads.map((t) => ({
|
|
66
|
+
status: "regular",
|
|
67
|
+
remoteId: t.thread_id,
|
|
68
|
+
externalId: t.thread_id,
|
|
69
|
+
title: (t.metadata as { title?: string } | undefined)?.title,
|
|
70
|
+
})),
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
async initialize() {
|
|
74
|
+
const t = await client.threads.create();
|
|
75
|
+
return { remoteId: t.thread_id, externalId: t.thread_id };
|
|
76
|
+
},
|
|
77
|
+
async delete(remoteId) {
|
|
78
|
+
await client.threads.delete(remoteId);
|
|
79
|
+
},
|
|
80
|
+
// rename, archive, unarchive, fetch, generateTitle — see the threads concept page
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const runtime = useLangGraphRuntime({
|
|
84
|
+
stream: async function* (messages, { initialize }) {
|
|
85
|
+
/* ... */
|
|
86
|
+
},
|
|
87
|
+
load: async (externalId) => {
|
|
88
|
+
/* ... */
|
|
89
|
+
},
|
|
90
|
+
unstable_threadListAdapter: threadListAdapter,
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Setting `remoteId === externalId` keeps the ids assistant-ui stores aligned with the LangGraph thread ids your `load` and `stream` callbacks receive. See [threads](/docs/runtimes/concepts/threads) for the full adapter contract.
|
|
95
|
+
|
|
96
|
+
<Callout type="info">
|
|
97
|
+
When `unstable_threadListAdapter` is provided, the `cloud`, `create`, and `delete` options are ignored; the adapter owns the full thread-list lifecycle.
|
|
98
|
+
</Callout>
|
|
99
|
+
|
|
100
|
+
## Next
|
|
101
|
+
|
|
102
|
+
<Cards>
|
|
103
|
+
<Card
|
|
104
|
+
title="Streaming"
|
|
105
|
+
description="Event handlers, message metadata, generative UI."
|
|
106
|
+
href="/docs/runtimes/langgraph/streaming"
|
|
107
|
+
/>
|
|
108
|
+
<Card
|
|
109
|
+
title="Threads (concept)"
|
|
110
|
+
description="General multi-thread model across runtimes."
|
|
111
|
+
href="/docs/runtimes/concepts/threads"
|
|
112
|
+
/>
|
|
113
|
+
</Cards>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Introduction
|
|
3
3
|
description: Build a stockbroker assistant with LangGraph and assistant-ui.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -19,11 +19,11 @@ This agent leverages the following features:
|
|
|
19
19
|
|
|
20
20
|
- Node.js 24 or higher
|
|
21
21
|
|
|
22
|
-
## Final
|
|
22
|
+
## Final result
|
|
23
23
|
|
|
24
24
|
- Demo: https://assistant-ui-stockbroker.vercel.app/
|
|
25
25
|
- Source Code: https://github.com/assistant-ui/assistant-ui-stockbroker
|
|
26
26
|
|
|
27
|
-
## Get
|
|
27
|
+
## Get started
|
|
28
28
|
|
|
29
29
|
Begin Part 1 of the tutorial by [setting up the frontend](/docs/runtimes/langgraph/tutorial/part-1).
|
|
@@ -91,26 +91,3 @@ This means you'll see tokens appear smoothly as they're generated by the LLM, wi
|
|
|
91
91
|
|
|
92
92
|
Rich text rendering using Markdown is enabled by default.
|
|
93
93
|
|
|
94
|
-
## Add conversation starter messages
|
|
95
|
-
|
|
96
|
-
In order to help users understand what the assistant can do, we can add some conversation starter messages.
|
|
97
|
-
|
|
98
|
-
import Image from "next/image";
|
|
99
|
-
import starter from "./images/conversation-starters.png";
|
|
100
|
-
|
|
101
|
-
<Image
|
|
102
|
-
src={starter}
|
|
103
|
-
alt="Conversation starters"
|
|
104
|
-
width={600}
|
|
105
|
-
className="mx-auto rounded-lg border shadow"
|
|
106
|
-
/>
|
|
107
|
-
|
|
108
|
-
```tsx title="@/app/page.tsx"
|
|
109
|
-
export default function Home() {
|
|
110
|
-
return (
|
|
111
|
-
<div className="flex h-full flex-col">
|
|
112
|
-
<Thread />
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
```
|
|
@@ -17,7 +17,7 @@ import price from "./images/acme-price.png";
|
|
|
17
17
|
className="mx-auto rounded-lg border shadow"
|
|
18
18
|
/>
|
|
19
19
|
|
|
20
|
-
For reference, this the corresponding code in the backend:
|
|
20
|
+
For reference, this is the corresponding code in the backend:
|
|
21
21
|
|
|
22
22
|
https://github.com/assistant-ui/assistant-ui-stockbroker/blob/main/backend/src/tools.ts#L193C1-L216C3
|
|
23
23
|
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hooks
|
|
3
|
+
description: Permissions, questions, session state, runtime extras.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { OpenCodeIcon } from "@/components/icons/opencode";
|
|
7
|
+
|
|
8
|
+
OpenCode-specific React hooks for interacting with the running session. All hooks must be used inside the runtime context (a tree wrapped in `AssistantRuntimeProvider` from a `useOpenCodeRuntime` setup).
|
|
9
|
+
|
|
10
|
+
## Permissions
|
|
11
|
+
|
|
12
|
+
OpenCode pauses tool execution to ask the user for permission (e.g. running shell commands, writing files). `useOpenCodePermissions` returns the pending permission requests and a reply function:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { useOpenCodePermissions } from "@assistant-ui/react-opencode";
|
|
16
|
+
|
|
17
|
+
function PermissionPrompt() {
|
|
18
|
+
const { pending, reply } = useOpenCodePermissions();
|
|
19
|
+
|
|
20
|
+
return pending.map((req) => (
|
|
21
|
+
<div key={req.id}>
|
|
22
|
+
<p>
|
|
23
|
+
Allow <code>{req.toolName}</code>: {req.title ?? req.permission}?
|
|
24
|
+
</p>
|
|
25
|
+
<button onClick={() => reply(req.id, "once")}>Allow once</button>
|
|
26
|
+
<button onClick={() => reply(req.id, "always")}>Always allow</button>
|
|
27
|
+
<button onClick={() => reply(req.id, "reject")}>Reject</button>
|
|
28
|
+
</div>
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Return shape:
|
|
34
|
+
|
|
35
|
+
| Field | Type | Description |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `pending` | `OpenCodePermissionRequest[]` | Permission requests waiting for a reply. |
|
|
38
|
+
| `reply` | `(id, response) => Promise<void>` | Send a reply for a pending permission. |
|
|
39
|
+
|
|
40
|
+
Reply values:
|
|
41
|
+
|
|
42
|
+
| Reply | Meaning |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `"once"` | Approve this single permission request. |
|
|
45
|
+
| `"always"` | Approve this permission and remember the choice. |
|
|
46
|
+
| `"reject"` | Deny the permission; the tool call is cancelled. |
|
|
47
|
+
|
|
48
|
+
## Questions
|
|
49
|
+
|
|
50
|
+
OpenCode can ask interactive questions during a run. `useOpenCodeQuestions` returns the pending questions as an array:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import {
|
|
54
|
+
useOpenCodeQuestions,
|
|
55
|
+
useOpenCodeRuntimeExtras,
|
|
56
|
+
} from "@assistant-ui/react-opencode";
|
|
57
|
+
|
|
58
|
+
function QuestionPrompt() {
|
|
59
|
+
const questions = useOpenCodeQuestions();
|
|
60
|
+
const { replyToQuestion, rejectQuestion } = useOpenCodeRuntimeExtras();
|
|
61
|
+
|
|
62
|
+
return questions.map((req) => (
|
|
63
|
+
<div key={req.id}>
|
|
64
|
+
<p>{req.text}</p>
|
|
65
|
+
<button
|
|
66
|
+
onClick={() =>
|
|
67
|
+
replyToQuestion(req.id, [
|
|
68
|
+
/* QuestionAnswer[] from @opencode-ai/sdk */
|
|
69
|
+
])
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
Answer
|
|
73
|
+
</button>
|
|
74
|
+
<button onClick={() => rejectQuestion(req.id)}>Skip</button>
|
|
75
|
+
</div>
|
|
76
|
+
));
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
To reply, use `replyToQuestion(id, answers)` or `rejectQuestion(id)` from [`useOpenCodeRuntimeExtras`](#runtime-extras).
|
|
81
|
+
|
|
82
|
+
## Session
|
|
83
|
+
|
|
84
|
+
`useOpenCodeSession` returns the current OpenCode `Session` object (server-side session metadata):
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { useOpenCodeSession } from "@assistant-ui/react-opencode";
|
|
88
|
+
|
|
89
|
+
function SessionInfo() {
|
|
90
|
+
const session = useOpenCodeSession();
|
|
91
|
+
if (!session) return null;
|
|
92
|
+
return <div>Session: {session.id}</div>;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Thread state
|
|
97
|
+
|
|
98
|
+
`useOpenCodeThreadState` returns the full projected thread state (messages, run state, interactions, sync metadata). Use it for advanced custom views; most apps don't need it.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { useOpenCodeThreadState } from "@assistant-ui/react-opencode";
|
|
102
|
+
|
|
103
|
+
function RunStatus() {
|
|
104
|
+
const state = useOpenCodeThreadState();
|
|
105
|
+
return <div>Run: {state.runState.type}</div>;
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The returned `OpenCodeThreadState` includes:
|
|
110
|
+
|
|
111
|
+
- `sessionId`, `session`, `sessionStatus`, `loadState`, `runState`
|
|
112
|
+
- `messageOrder`, `messagesById`, `pendingUserMessages`
|
|
113
|
+
- `interactions.permissions` (pending + resolved), `interactions.questions` (pending + answered + rejected)
|
|
114
|
+
- `unhandledEvents`, `sync` timestamps
|
|
115
|
+
|
|
116
|
+
You can also pass a selector to read a specific slice:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
const isStreaming = useOpenCodeThreadState((s) => s.runState.type === "streaming");
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Runtime extras
|
|
123
|
+
|
|
124
|
+
`useOpenCodeRuntimeExtras` exposes session-level imperative actions:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { useOpenCodeRuntimeExtras } from "@assistant-ui/react-opencode";
|
|
128
|
+
|
|
129
|
+
function SessionActions() {
|
|
130
|
+
const {
|
|
131
|
+
fork,
|
|
132
|
+
revert,
|
|
133
|
+
unrevert,
|
|
134
|
+
cancel,
|
|
135
|
+
refresh,
|
|
136
|
+
replyToPermission,
|
|
137
|
+
replyToQuestion,
|
|
138
|
+
rejectQuestion,
|
|
139
|
+
} = useOpenCodeRuntimeExtras();
|
|
140
|
+
// ...
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
| Action | Description |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `fork(messageId)` | Create a new session forked from the given message; returns the new session id. |
|
|
147
|
+
| `revert(messageId)` | Revert the session to the state at the given message. |
|
|
148
|
+
| `unrevert()` | Undo the last revert. |
|
|
149
|
+
| `cancel()` | Cancel an in-flight run. |
|
|
150
|
+
| `refresh()` | Force re-fetch of session messages. |
|
|
151
|
+
| `replyToPermission(id, response)` | Reply to a permission request (`"once"`, `"always"`, `"reject"`). |
|
|
152
|
+
| `replyToQuestion(id, answers)` | Answer a pending question. |
|
|
153
|
+
| `rejectQuestion(id)` | Reject a pending question. |
|
|
154
|
+
|
|
155
|
+
`useOpenCodePermissions` and `useOpenCodeQuestions` are sugar over `replyToPermission` / `replyToQuestion` / `rejectQuestion` plus the `pending` slices of state.
|
|
156
|
+
|
|
157
|
+
## Lower-level building blocks
|
|
158
|
+
|
|
159
|
+
For custom integrations that bypass `useOpenCodeRuntime`:
|
|
160
|
+
|
|
161
|
+
| Export | Purpose |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| `OpenCodeEventSource` | Wraps the OpenCode server's event stream into a typed subscription. |
|
|
164
|
+
| `OpenCodeThreadController` | Per-session controller managing message state. |
|
|
165
|
+
| `createOpenCodeThreadState`, `reduceOpenCodeThreadState` | Pure state reducers if you want to drive the state machine yourself. |
|
|
166
|
+
| `projectOpenCodeThreadMessages` | Project raw OpenCode messages into assistant-ui thread messages. |
|
|
167
|
+
| `createOpencodeClient` (re-exported from `@opencode-ai/sdk`) | Build a client with custom config. |
|
|
168
|
+
|
|
169
|
+
These are only needed for advanced cases; most apps should use `useOpenCodeRuntime` directly.
|
|
170
|
+
|
|
171
|
+
## Related
|
|
172
|
+
|
|
173
|
+
<Cards>
|
|
174
|
+
<Card
|
|
175
|
+
icon={<OpenCodeIcon width={20} height={20} />}
|
|
176
|
+
title="OpenCode overview"
|
|
177
|
+
description="What OpenCode is and when to pick it."
|
|
178
|
+
href="/docs/runtimes/opencode"
|
|
179
|
+
/>
|
|
180
|
+
<Card
|
|
181
|
+
title="Quickstart"
|
|
182
|
+
description="Minimal runtime + Thread setup."
|
|
183
|
+
href="/docs/runtimes/opencode/quickstart"
|
|
184
|
+
/>
|
|
185
|
+
<Card
|
|
186
|
+
icon={<OpenCodeIcon width={20} height={20} />}
|
|
187
|
+
title="OpenCode docs"
|
|
188
|
+
description="The OpenCode server itself."
|
|
189
|
+
href="https://opencode.ai/"
|
|
190
|
+
/>
|
|
191
|
+
</Cards>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: OpenCode Runtime
|
|
3
|
+
description: Build a React chat UI for OpenCode coding agents with assistant-ui — streaming, tool calls, file edits, and terminal output rendered in chat.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`@assistant-ui/react-opencode` is a runtime adapter for [OpenCode](https://opencode.ai/), an open-source AI coding agent. It wires the OpenCode server's session and event APIs into an assistant-ui thread, including tool permissions, interactive questions, and session state.
|
|
7
|
+
|
|
8
|
+
<Callout type="warn">
|
|
9
|
+
This adapter is at v0.0.3 and is experimental. The runtime API and exported hooks may change without notice.
|
|
10
|
+
</Callout>
|
|
11
|
+
|
|
12
|
+
## When to use it
|
|
13
|
+
|
|
14
|
+
Pick the OpenCode runtime when:
|
|
15
|
+
|
|
16
|
+
- You are building a UI on top of an OpenCode agent server.
|
|
17
|
+
- You need first-class support for OpenCode's permission and question flows.
|
|
18
|
+
- You want session-aware features: fork, revert, unrevert, refresh.
|
|
19
|
+
|
|
20
|
+
If your backend is not OpenCode-based, see [picking a runtime](/docs/runtimes/pick-a-runtime) for alternatives.
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
`@assistant-ui/react-opencode` is layered on `ExternalStoreRuntime` plus a `RemoteThreadList` for session-backed thread management (see [architecture](/docs/runtimes/concepts/architecture)). OpenCode sessions map to assistant-ui threads; the runtime subscribes to a server-sent event stream and projects messages into the thread.
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- A running [OpenCode](https://opencode.ai/) server (defaults to `http://localhost:4096`).
|
|
29
|
+
- React 18 or 19.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-opencode", "@opencode-ai/sdk"]} />
|
|
34
|
+
|
|
35
|
+
## Next
|
|
36
|
+
|
|
37
|
+
<Cards>
|
|
38
|
+
<Card
|
|
39
|
+
title="Quickstart"
|
|
40
|
+
description="Minimal useOpenCodeRuntime setup against a local OpenCode server."
|
|
41
|
+
href="/docs/runtimes/opencode/quickstart"
|
|
42
|
+
/>
|
|
43
|
+
<Card
|
|
44
|
+
title="Hooks"
|
|
45
|
+
description="Permissions, questions, session state, runtime extras."
|
|
46
|
+
href="/docs/runtimes/opencode/hooks"
|
|
47
|
+
/>
|
|
48
|
+
</Cards>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Quickstart
|
|
3
|
+
description: Minimal useOpenCodeRuntime setup against a local OpenCode server.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Three steps to a working chat against a local OpenCode server. Assumes you have OpenCode running; if not, follow [opencode.ai](https://opencode.ai/) to install and start the server first.
|
|
7
|
+
|
|
8
|
+
<Steps>
|
|
9
|
+
<Step>
|
|
10
|
+
|
|
11
|
+
### Wire up the runtime provider
|
|
12
|
+
|
|
13
|
+
```tsx title="app/MyRuntimeProvider.tsx"
|
|
14
|
+
"use client";
|
|
15
|
+
|
|
16
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
17
|
+
import { useOpenCodeRuntime } from "@assistant-ui/react-opencode";
|
|
18
|
+
|
|
19
|
+
export function MyRuntimeProvider({
|
|
20
|
+
children,
|
|
21
|
+
}: {
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
}) {
|
|
24
|
+
const runtime = useOpenCodeRuntime({
|
|
25
|
+
baseUrl: "http://localhost:4096",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
30
|
+
{children}
|
|
31
|
+
</AssistantRuntimeProvider>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`baseUrl` defaults to `http://localhost:4096` if omitted.
|
|
37
|
+
|
|
38
|
+
</Step>
|
|
39
|
+
<Step>
|
|
40
|
+
|
|
41
|
+
### Render the Thread
|
|
42
|
+
|
|
43
|
+
```tsx title="app/page.tsx"
|
|
44
|
+
import { Thread } from "@assistant-ui/react";
|
|
45
|
+
import { MyRuntimeProvider } from "./MyRuntimeProvider";
|
|
46
|
+
|
|
47
|
+
export default function Page() {
|
|
48
|
+
return (
|
|
49
|
+
<MyRuntimeProvider>
|
|
50
|
+
<Thread />
|
|
51
|
+
</MyRuntimeProvider>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
</Step>
|
|
57
|
+
<Step>
|
|
58
|
+
|
|
59
|
+
### Set up UI components
|
|
60
|
+
|
|
61
|
+
Follow the [UI Components guide](/docs/ui/thread) to wire up the Thread, composer, and supporting primitives.
|
|
62
|
+
|
|
63
|
+
</Step>
|
|
64
|
+
</Steps>
|
|
65
|
+
|
|
66
|
+
The runtime opens an SSE event stream against the OpenCode server, listens for session and message events, and projects them into the thread. Each OpenCode session corresponds to one thread; the thread list reflects sessions on the server.
|
|
67
|
+
|
|
68
|
+
## Default model and agent
|
|
69
|
+
|
|
70
|
+
Pin a default model or agent when starting new sessions:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
const runtime = useOpenCodeRuntime({
|
|
74
|
+
baseUrl: "http://localhost:4096",
|
|
75
|
+
defaultModel: { providerID: "anthropic", modelID: "claude-sonnet-4-6" },
|
|
76
|
+
defaultAgent: "coder",
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Bring your own client
|
|
81
|
+
|
|
82
|
+
If you need a pre-configured `OpencodeClient` (e.g. for auth headers), pass it directly:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { createOpencodeClient } from "@assistant-ui/react-opencode";
|
|
86
|
+
|
|
87
|
+
const client = createOpencodeClient({
|
|
88
|
+
baseUrl: "http://localhost:4096",
|
|
89
|
+
// additional client config...
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const runtime = useOpenCodeRuntime({ client });
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Resuming a session
|
|
96
|
+
|
|
97
|
+
Pass `initialSessionId` to open the runtime against an existing session on first load:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
const runtime = useOpenCodeRuntime({
|
|
101
|
+
baseUrl: "http://localhost:4096",
|
|
102
|
+
initialSessionId: "ses_abc123",
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Next
|
|
107
|
+
|
|
108
|
+
<Cards>
|
|
109
|
+
<Card
|
|
110
|
+
title="Hooks"
|
|
111
|
+
description="Permissions, questions, session state, runtime extras."
|
|
112
|
+
href="/docs/runtimes/opencode/hooks"
|
|
113
|
+
/>
|
|
114
|
+
<Card
|
|
115
|
+
title="Pick a runtime"
|
|
116
|
+
description="Compare OpenCode to other runtime options."
|
|
117
|
+
href="/docs/runtimes/pick-a-runtime"
|
|
118
|
+
/>
|
|
119
|
+
</Cards>
|