@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,1259 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Primitives
|
|
3
|
-
description: Composable terminal components for building chat UIs with Ink.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Primitives are thin wrappers around Ink components (`Box`, `Text`) that integrate with the assistant-ui runtime. They accept all standard Ink props and add runtime-aware behavior.
|
|
7
|
-
|
|
8
|
-
Primitives use namespace imports, the same pattern as the web package (e.g. `ThreadPrimitive.Root`, `ComposerPrimitive.Input`).
|
|
9
|
-
|
|
10
|
-
Many primitives share their core logic with `@assistant-ui/react` via `@assistant-ui/core/react` — only the UI layer (Ink vs DOM) differs.
|
|
11
|
-
|
|
12
|
-
## Thread
|
|
13
|
-
|
|
14
|
-
```tsx
|
|
15
|
-
import { ThreadPrimitive } from "@assistant-ui/react-ink";
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Root
|
|
19
|
-
|
|
20
|
-
Container `Box` for the thread area.
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
<ThreadPrimitive.Root>
|
|
24
|
-
{children}
|
|
25
|
-
</ThreadPrimitive.Root>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
| Prop | Type | Description |
|
|
29
|
-
|------|------|-------------|
|
|
30
|
-
| `...rest` | `BoxProps` | Standard Ink Box props |
|
|
31
|
-
|
|
32
|
-
### Messages
|
|
33
|
-
|
|
34
|
-
Renders the message list with automatic runtime integration. Each message is wrapped in a scoped context so that `useAuiState((s) => s.message)` works inside the message component.
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
<ThreadPrimitive.Messages>
|
|
38
|
-
{() => <MyMessage />}
|
|
39
|
-
</ThreadPrimitive.Messages>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
| Prop | Type | Description |
|
|
43
|
-
|------|------|-------------|
|
|
44
|
-
| `components` | `MessageComponents` | Component map with `Message`, `UserMessage`, `AssistantMessage`, `SystemMessage`, and edit composer variants |
|
|
45
|
-
|
|
46
|
-
### AuiIf
|
|
47
|
-
|
|
48
|
-
Conditional rendering based on assistant state. Replaces the deprecated `ThreadPrimitive.Empty`, `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If`.
|
|
49
|
-
|
|
50
|
-
```tsx
|
|
51
|
-
import { AuiIf } from "@assistant-ui/react-ink";
|
|
52
|
-
|
|
53
|
-
<AuiIf condition={(s) => s.thread.isEmpty}>
|
|
54
|
-
<Text dimColor>Send a message to get started</Text>
|
|
55
|
-
</AuiIf>
|
|
56
|
-
|
|
57
|
-
<AuiIf condition={(s) => s.thread.isRunning}>
|
|
58
|
-
<Text color="yellow">Generating...</Text>
|
|
59
|
-
</AuiIf>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
| Prop | Type | Description |
|
|
63
|
-
|------|------|-------------|
|
|
64
|
-
| `condition` | `(state) => boolean` | Selector that determines whether children are rendered |
|
|
65
|
-
|
|
66
|
-
### Empty (deprecated)
|
|
67
|
-
|
|
68
|
-
<Callout type="warn">
|
|
69
|
-
Deprecated. Use `AuiIf` with `condition={(s) => s.thread.isEmpty}` instead.
|
|
70
|
-
</Callout>
|
|
71
|
-
|
|
72
|
-
Renders children only when the thread has no messages.
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
<ThreadPrimitive.Empty>
|
|
76
|
-
<Text dimColor>Send a message to get started</Text>
|
|
77
|
-
</ThreadPrimitive.Empty>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### If (deprecated)
|
|
81
|
-
|
|
82
|
-
<Callout type="warn">
|
|
83
|
-
Deprecated. Use `AuiIf` instead.
|
|
84
|
-
</Callout>
|
|
85
|
-
|
|
86
|
-
Conditional rendering based on thread state.
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
<ThreadPrimitive.If empty>
|
|
90
|
-
<Text>No messages yet</Text>
|
|
91
|
-
</ThreadPrimitive.If>
|
|
92
|
-
|
|
93
|
-
<ThreadPrimitive.If running>
|
|
94
|
-
<Text color="yellow">Generating...</Text>
|
|
95
|
-
</ThreadPrimitive.If>
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
| Prop | Type | Description |
|
|
99
|
-
|------|------|-------------|
|
|
100
|
-
| `empty` | `boolean` | Render when thread is empty |
|
|
101
|
-
| `running` | `boolean` | Render when thread is running |
|
|
102
|
-
|
|
103
|
-
### MessageByIndex
|
|
104
|
-
|
|
105
|
-
Low-level provider that sets up the message context for a specific message by index. Used internally by `ThreadPrimitive.Messages`.
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
<ThreadPrimitive.MessageByIndex index={0}>
|
|
109
|
-
{/* content rendered with message context */}
|
|
110
|
-
</ThreadPrimitive.MessageByIndex>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
| Prop | Type | Description |
|
|
114
|
-
|------|------|-------------|
|
|
115
|
-
| `index` | `number` | Zero-based message index |
|
|
116
|
-
|
|
117
|
-
### Suggestions
|
|
118
|
-
|
|
119
|
-
Renders all thread suggestions using a provided component. Each suggestion is wrapped in a `SuggestionByIndexProvider` context.
|
|
120
|
-
|
|
121
|
-
```tsx
|
|
122
|
-
<ThreadPrimitive.Suggestions>
|
|
123
|
-
{() => <MySuggestion />}
|
|
124
|
-
</ThreadPrimitive.Suggestions>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
| Prop | Type | Description |
|
|
128
|
-
|------|------|-------------|
|
|
129
|
-
| `children` | `() => ReactElement` | Render function for each suggestion |
|
|
130
|
-
|
|
131
|
-
### SuggestionByIndex
|
|
132
|
-
|
|
133
|
-
Low-level provider that sets up the suggestion context for a specific suggestion by index. Used internally by `ThreadPrimitive.Suggestions`.
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
<ThreadPrimitive.SuggestionByIndex index={0}>
|
|
137
|
-
<SuggestionPrimitive.Title />
|
|
138
|
-
</ThreadPrimitive.SuggestionByIndex>
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
| Prop | Type | Description |
|
|
142
|
-
|------|------|-------------|
|
|
143
|
-
| `index` | `number` | Zero-based suggestion index |
|
|
144
|
-
|
|
145
|
-
### Suggestion
|
|
146
|
-
|
|
147
|
-
Renders a suggestion button. Uses Ink `Box` + `Text`.
|
|
148
|
-
|
|
149
|
-
```tsx
|
|
150
|
-
<ThreadPrimitive.Suggestion
|
|
151
|
-
prompt="What is the weather?"
|
|
152
|
-
send
|
|
153
|
-
/>
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
| Prop | Type | Description |
|
|
157
|
-
|------|------|-------------|
|
|
158
|
-
| `prompt` | `string` | The suggestion text |
|
|
159
|
-
| `send` | `boolean` | When true, automatically sends the message |
|
|
160
|
-
| `clearComposer` | `boolean` | When true (default), replaces composer text; when false, appends |
|
|
161
|
-
|
|
162
|
-
## Loading
|
|
163
|
-
|
|
164
|
-
```tsx
|
|
165
|
-
import { LoadingPrimitive } from "@assistant-ui/react-ink";
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
Composable loading UI for active runs. `LoadingPrimitive.Root` only renders
|
|
169
|
-
while the current thread is running, so it pairs naturally with status rows in
|
|
170
|
-
terminal chat layouts.
|
|
171
|
-
|
|
172
|
-
```tsx
|
|
173
|
-
<LoadingPrimitive.Root gap={1}>
|
|
174
|
-
<LoadingPrimitive.Spinner variant="bar" />
|
|
175
|
-
<LoadingPrimitive.Text>Analyzing codebase...</LoadingPrimitive.Text>
|
|
176
|
-
<LoadingPrimitive.ElapsedTime />
|
|
177
|
-
</LoadingPrimitive.Root>
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
This renders a compact status line such as `[=== ] Analyzing codebase... (3s)`
|
|
181
|
-
while the assistant is streaming.
|
|
182
|
-
|
|
183
|
-
### Root
|
|
184
|
-
|
|
185
|
-
Runtime-aware `Box` container that renders children only while
|
|
186
|
-
`s.thread.isRunning` is true.
|
|
187
|
-
|
|
188
|
-
| Prop | Type | Description |
|
|
189
|
-
|------|------|-------------|
|
|
190
|
-
| `children` | `ReactNode` | Status row content |
|
|
191
|
-
| `...rest` | `BoxProps` | Standard Ink Box props |
|
|
192
|
-
|
|
193
|
-
### Spinner
|
|
194
|
-
|
|
195
|
-
Animated loader indicator. Supports the existing `ink-spinner` path plus a few
|
|
196
|
-
built-in text-based variants for more terminal-native styles.
|
|
197
|
-
|
|
198
|
-
| Prop | Type | Description |
|
|
199
|
-
|------|------|-------------|
|
|
200
|
-
| `variant` | `"spinner" \| "dots" \| "pulse" \| "bar" \| "bounce"` | Loader style (default: `"spinner"`) |
|
|
201
|
-
| `type` | `ink-spinner` type | Spinner preset used when `variant="spinner"` |
|
|
202
|
-
| `intervalMs` | `number` | Animation speed for non-spinner variants (default: `120`) |
|
|
203
|
-
| `...rest` | `TextProps` | Standard Ink Text props |
|
|
204
|
-
|
|
205
|
-
### Text
|
|
206
|
-
|
|
207
|
-
Status label rendered as Ink `Text`.
|
|
208
|
-
|
|
209
|
-
| Prop | Type | Description |
|
|
210
|
-
|------|------|-------------|
|
|
211
|
-
| `children` | `ReactNode` | Message text (default: `"Thinking..."`) |
|
|
212
|
-
| `...rest` | `TextProps` | Standard Ink Text props |
|
|
213
|
-
|
|
214
|
-
### ElapsedTime
|
|
215
|
-
|
|
216
|
-
Elapsed time indicator for the current run. Uses message timing metadata when
|
|
217
|
-
available and falls back to a local timer so it still works during manual
|
|
218
|
-
testing.
|
|
219
|
-
|
|
220
|
-
| Prop | Type | Description |
|
|
221
|
-
|------|------|-------------|
|
|
222
|
-
| `format` | `(seconds: number) => string` | Custom formatter for the elapsed time label |
|
|
223
|
-
| `...rest` | `TextProps` | Standard Ink Text props |
|
|
224
|
-
|
|
225
|
-
## Composer
|
|
226
|
-
|
|
227
|
-
```tsx
|
|
228
|
-
import { ComposerPrimitive } from "@assistant-ui/react-ink";
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Root
|
|
232
|
-
|
|
233
|
-
Container `Box` for the composer area.
|
|
234
|
-
|
|
235
|
-
```tsx
|
|
236
|
-
<ComposerPrimitive.Root>
|
|
237
|
-
{children}
|
|
238
|
-
</ComposerPrimitive.Root>
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### Input
|
|
242
|
-
|
|
243
|
-
Terminal line editor wired to the composer runtime. Value is managed automatically and supports cursor-aware editing.
|
|
244
|
-
|
|
245
|
-
```tsx
|
|
246
|
-
<ComposerPrimitive.Input
|
|
247
|
-
submitOnEnter
|
|
248
|
-
multiLine
|
|
249
|
-
placeholder="Type a message..."
|
|
250
|
-
autoFocus
|
|
251
|
-
/>
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
| Prop | Type | Description |
|
|
255
|
-
|------|------|-------------|
|
|
256
|
-
| `submitOnEnter` | `boolean` | Whether Enter sends the message (default: `false`) |
|
|
257
|
-
| `placeholder` | `string` | Placeholder text when empty |
|
|
258
|
-
| `autoFocus` | `boolean` | Auto-focus on mount |
|
|
259
|
-
| `multiLine` | `boolean` | When true, Enter inserts a newline unless `submitOnEnter` is enabled |
|
|
260
|
-
| `onSubmit` | `(text: string) => void` | Overrides the default send behavior and receives the current composer text |
|
|
261
|
-
|
|
262
|
-
Supported keyboard bindings:
|
|
263
|
-
|
|
264
|
-
| Key | Action | Context |
|
|
265
|
-
|-----|--------|---------|
|
|
266
|
-
| `Left` / `Right` | Move cursor by one grapheme | Always |
|
|
267
|
-
| `Backspace` / `Delete` | Remove the grapheme before / after the cursor | Always |
|
|
268
|
-
| `Home` / `End` | Jump to buffer or line boundary | Buffer in single-line, line in multi-line |
|
|
269
|
-
| `Up` / `Down` | Move between lines, preserving column when possible | Multi-line only |
|
|
270
|
-
| `Ctrl+A` / `Ctrl+E` | Move to line start / end | Always |
|
|
271
|
-
| `Ctrl+W` | Kill the word before the cursor | Always |
|
|
272
|
-
| `Ctrl+D` | Delete the grapheme after the cursor | Always |
|
|
273
|
-
| `Ctrl+U` / `Ctrl+K` | Kill from cursor to line start / end; in multi-line, `Ctrl+K` at end-of-line joins the next line | Always |
|
|
274
|
-
| `Ctrl+J` | Insert a newline | Multi-line only; swallowed in single-line so it never submits |
|
|
275
|
-
| `Alt+B` / `Alt+F` | Move by word backward / forward | Terminals that emit meta-key sequences |
|
|
276
|
-
| `Alt+D` | Kill the word after the cursor | Terminals that emit meta-key sequences |
|
|
277
|
-
| `Shift+Enter` | Insert a newline | Multi-line submit mode, terminals that distinguish it |
|
|
278
|
-
|
|
279
|
-
Word boundaries and grapheme stepping use `Intl.Segmenter`, so emoji, accented letters, skin-tone modifiers, ZWJ sequences, and CJK ideographs each move and delete as a single character.
|
|
280
|
-
|
|
281
|
-
Some bindings depend on terminal capabilities. iTerm2, Windows Terminal, and most Linux terminals emit `Alt`-letter combinations as `Esc`-prefixed sequences that Ink decodes as meta-key input; macOS Terminal.app requires enabling "Use Option as Meta key" in its preferences before `Alt+B` / `Alt+F` / `Alt+D` work as expected. `Shift+Enter` requires a terminal that supports the CSI-u protocol (iTerm2 3.4+, kitty, foot, and similar) — terminals that conflate it with `Enter` will fall back to the `submitOnEnter` behaviour.
|
|
282
|
-
|
|
283
|
-
Example with custom submit handling:
|
|
284
|
-
|
|
285
|
-
```tsx
|
|
286
|
-
<ComposerPrimitive.Input
|
|
287
|
-
multiLine
|
|
288
|
-
submitOnEnter
|
|
289
|
-
onSubmit={(text) => {
|
|
290
|
-
console.log("submit", text);
|
|
291
|
-
}}
|
|
292
|
-
/>
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### Send
|
|
296
|
-
|
|
297
|
-
`Box` that triggers sending the current message. Typically used with a button-like UI.
|
|
298
|
-
|
|
299
|
-
```tsx
|
|
300
|
-
<ComposerPrimitive.Send>
|
|
301
|
-
<Text color="green">[Send]</Text>
|
|
302
|
-
</ComposerPrimitive.Send>
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### Cancel
|
|
306
|
-
|
|
307
|
-
`Box` that cancels the current run.
|
|
308
|
-
|
|
309
|
-
```tsx
|
|
310
|
-
<ComposerPrimitive.Cancel>
|
|
311
|
-
<Text color="red">[Stop]</Text>
|
|
312
|
-
</ComposerPrimitive.Cancel>
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### Attachments
|
|
316
|
-
|
|
317
|
-
Renders composer attachments using the provided component configuration.
|
|
318
|
-
|
|
319
|
-
```tsx
|
|
320
|
-
<ComposerPrimitive.Attachments>
|
|
321
|
-
{() => <MyAttachment />}
|
|
322
|
-
</ComposerPrimitive.Attachments>
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
| Prop | Type | Description |
|
|
326
|
-
|------|------|-------------|
|
|
327
|
-
| `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
|
|
328
|
-
|
|
329
|
-
### AddAttachment
|
|
330
|
-
|
|
331
|
-
Triggers attachment addition.
|
|
332
|
-
|
|
333
|
-
```tsx
|
|
334
|
-
<ComposerPrimitive.AddAttachment>
|
|
335
|
-
<Text>[Attach]</Text>
|
|
336
|
-
</ComposerPrimitive.AddAttachment>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Queue
|
|
340
|
-
|
|
341
|
-
Renders all queued composer items. Each item is wrapped in a `QueueItemByIndexProvider`, so `QueueItemPrimitive.*` can read item state and call queue actions inside the render prop. Backed by the shared `ComposerPrimitiveQueue` from `@assistant-ui/core/react`.
|
|
342
|
-
|
|
343
|
-
```tsx
|
|
344
|
-
<ComposerPrimitive.Queue>
|
|
345
|
-
{({ queueItem }) => (
|
|
346
|
-
<Box>
|
|
347
|
-
<QueueItemPrimitive.Text />
|
|
348
|
-
<QueueItemPrimitive.Steer>
|
|
349
|
-
<Text color="cyan">[Run Now]</Text>
|
|
350
|
-
</QueueItemPrimitive.Steer>
|
|
351
|
-
<QueueItemPrimitive.Remove>
|
|
352
|
-
<Text color="red">[x]</Text>
|
|
353
|
-
</QueueItemPrimitive.Remove>
|
|
354
|
-
</Box>
|
|
355
|
-
)}
|
|
356
|
-
</ComposerPrimitive.Queue>
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
| Prop | Type | Description |
|
|
360
|
-
|------|------|-------------|
|
|
361
|
-
| `children` | `(value: { queueItem: QueueItemState }) => ReactNode` | Render function called for each queue item |
|
|
362
|
-
|
|
363
|
-
### Quote
|
|
364
|
-
|
|
365
|
-
Renders the active composer quote preview. Children are only rendered while `s.composer.quote` is set, so this acts as both a container and a gate.
|
|
366
|
-
|
|
367
|
-
```tsx
|
|
368
|
-
<ComposerPrimitive.Quote>
|
|
369
|
-
<Box>
|
|
370
|
-
<Text dimColor>Quoting:</Text>
|
|
371
|
-
<ComposerPrimitive.QuoteText color="gray" />
|
|
372
|
-
<ComposerPrimitive.QuoteDismiss>
|
|
373
|
-
<Text color="red">[x]</Text>
|
|
374
|
-
</ComposerPrimitive.QuoteDismiss>
|
|
375
|
-
</Box>
|
|
376
|
-
</ComposerPrimitive.Quote>
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
| Prop | Type | Description |
|
|
380
|
-
|------|------|-------------|
|
|
381
|
-
| `children` | `ReactNode` | Quote preview content; only rendered when a quote is set |
|
|
382
|
-
| `...rest` | `BoxProps` | Standard Ink Box props |
|
|
383
|
-
|
|
384
|
-
### QuoteText
|
|
385
|
-
|
|
386
|
-
Renders the quoted text from `s.composer.quote?.text`. Pass `children` to override the displayed value.
|
|
387
|
-
|
|
388
|
-
```tsx
|
|
389
|
-
<ComposerPrimitive.QuoteText color="gray" />
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
| Prop | Type | Description |
|
|
393
|
-
|------|------|-------------|
|
|
394
|
-
| `children` | `ReactNode` | Override content; defaults to `s.composer.quote?.text` |
|
|
395
|
-
| `...rest` | `TextProps` | Standard Ink Text props |
|
|
396
|
-
|
|
397
|
-
### QuoteDismiss
|
|
398
|
-
|
|
399
|
-
Pressable that clears the active quote by calling `aui.composer.setQuote(undefined)`.
|
|
400
|
-
|
|
401
|
-
```tsx
|
|
402
|
-
<ComposerPrimitive.QuoteDismiss>
|
|
403
|
-
<Text color="red">[x]</Text>
|
|
404
|
-
</ComposerPrimitive.QuoteDismiss>
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
| Prop | Type | Description |
|
|
408
|
-
|------|------|-------------|
|
|
409
|
-
| `children` | `ReactNode` | Button content |
|
|
410
|
-
| `disabled` | `boolean` | Disable Enter activation and focus |
|
|
411
|
-
| `...rest` | `BoxProps` | Standard Ink Box props |
|
|
412
|
-
|
|
413
|
-
### Conditional Rendering (Composer)
|
|
414
|
-
|
|
415
|
-
Use `AuiIf` for conditional rendering based on composer state:
|
|
416
|
-
|
|
417
|
-
```tsx
|
|
418
|
-
<AuiIf condition={(s) => s.composer.isEditing}>
|
|
419
|
-
<Text>Currently editing</Text>
|
|
420
|
-
</AuiIf>
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
### AttachmentByIndex
|
|
424
|
-
|
|
425
|
-
Low-level provider that sets up the attachment context for a specific attachment by index. Used internally by `ComposerPrimitive.Attachments`.
|
|
426
|
-
|
|
427
|
-
```tsx
|
|
428
|
-
<ComposerPrimitive.AttachmentByIndex index={0}>
|
|
429
|
-
<AttachmentPrimitive.Name />
|
|
430
|
-
</ComposerPrimitive.AttachmentByIndex>
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
| Prop | Type | Description |
|
|
434
|
-
|------|------|-------------|
|
|
435
|
-
| `index` | `number` | Zero-based attachment index |
|
|
436
|
-
|
|
437
|
-
### If (deprecated)
|
|
438
|
-
|
|
439
|
-
<Callout type="warn">
|
|
440
|
-
Deprecated. Use `AuiIf` instead.
|
|
441
|
-
</Callout>
|
|
442
|
-
|
|
443
|
-
Conditional rendering based on composer state. Shared from `@assistant-ui/core/react`.
|
|
444
|
-
|
|
445
|
-
```tsx
|
|
446
|
-
<ComposerPrimitive.If editing>
|
|
447
|
-
<Text>Currently editing</Text>
|
|
448
|
-
</ComposerPrimitive.If>
|
|
449
|
-
|
|
450
|
-
<ComposerPrimitive.If dictation>
|
|
451
|
-
<Text>Dictating...</Text>
|
|
452
|
-
</ComposerPrimitive.If>
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
| Prop | Type | Description |
|
|
456
|
-
|------|------|-------------|
|
|
457
|
-
| `editing` | `boolean` | Render when composer is in editing mode |
|
|
458
|
-
| `dictation` | `boolean` | Render when dictation is currently active |
|
|
459
|
-
|
|
460
|
-
## Message
|
|
461
|
-
|
|
462
|
-
```tsx
|
|
463
|
-
import { MessagePartPrimitive, MessagePrimitive } from "@assistant-ui/react-ink";
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
### Root
|
|
467
|
-
|
|
468
|
-
Container `Box` for a single message.
|
|
469
|
-
|
|
470
|
-
```tsx
|
|
471
|
-
<MessagePrimitive.Root>
|
|
472
|
-
{children}
|
|
473
|
-
</MessagePrimitive.Root>
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
### Parts
|
|
477
|
-
|
|
478
|
-
Renders message content parts via a `components` prop. Tool call and data parts automatically render registered toolkit renderers and data UIs (via `useAssistantDataUI`), falling back to components provided here. Default terminal-safe renderers are provided for text, reasoning, source, image, file, and data parts.
|
|
479
|
-
|
|
480
|
-
```tsx
|
|
481
|
-
<MessagePrimitive.Parts>
|
|
482
|
-
{({ part }) => {
|
|
483
|
-
if (part.type === "text") return <Text>{part.text}</Text>;
|
|
484
|
-
if (part.type === "tool-call") return <Text dimColor>[Tool: {part.toolName}]</Text>;
|
|
485
|
-
return null;
|
|
486
|
-
}}
|
|
487
|
-
</MessagePrimitive.Parts>
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
Override part rendering with app-owned components when you need richer terminal UI:
|
|
491
|
-
|
|
492
|
-
```tsx
|
|
493
|
-
<MessagePrimitive.Parts
|
|
494
|
-
components={{
|
|
495
|
-
Image: () => <Text color="cyan">image available</Text>,
|
|
496
|
-
Reasoning: () => null,
|
|
497
|
-
data: {
|
|
498
|
-
by_name: {
|
|
499
|
-
weather_card: ({ data }) => <Text>{data.city}: {data.temperature}</Text>,
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
}}
|
|
503
|
-
/>
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
### Content (deprecated)
|
|
507
|
-
|
|
508
|
-
<Callout type="warn">
|
|
509
|
-
Deprecated. Use `MessagePrimitive.Parts` instead. See the [v0.11 migration guide](/docs/migrations/v0-11) for details.
|
|
510
|
-
</Callout>
|
|
511
|
-
|
|
512
|
-
Renders message content parts using render props. Tool call and data parts automatically render registered toolkit renderers and data UIs (via `useAssistantDataUI`), falling back to render props if provided.
|
|
513
|
-
|
|
514
|
-
```tsx
|
|
515
|
-
<MessagePrimitive.Content
|
|
516
|
-
renderText={({ part }) => <Text>{part.text}</Text>}
|
|
517
|
-
renderToolCall={({ part }) => <Text dimColor>[Tool: {part.toolName}]</Text>}
|
|
518
|
-
/>
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
| Prop | Type | Description |
|
|
522
|
-
|------|------|-------------|
|
|
523
|
-
| `renderText` | `(props: { part; index }) => ReactElement` | Text part renderer |
|
|
524
|
-
| `renderToolCall` | `(props: { part; index }) => ReactElement` | Tool call fallback |
|
|
525
|
-
| `renderImage` | `(props: { part; index }) => ReactElement` | Image part renderer |
|
|
526
|
-
| `renderReasoning` | `(props: { part; index }) => ReactElement` | Reasoning part renderer |
|
|
527
|
-
| `renderSource` | `(props: { part; index }) => ReactElement` | Source part renderer |
|
|
528
|
-
| `renderFile` | `(props: { part; index }) => ReactElement` | File part renderer |
|
|
529
|
-
| `renderData` | `(props: { part; index }) => ReactElement` | Data part fallback |
|
|
530
|
-
|
|
531
|
-
## MessagePartPrimitive
|
|
532
|
-
|
|
533
|
-
Composable primitives for rendering the current message part inside part context from `MessagePrimitive.Parts`, `MessagePrimitive.PartByIndex`, or `PartByIndexProvider`.
|
|
534
|
-
|
|
535
|
-
```tsx
|
|
536
|
-
<MessagePrimitive.Parts
|
|
537
|
-
components={{
|
|
538
|
-
Text: () => (
|
|
539
|
-
<>
|
|
540
|
-
<MessagePartPrimitive.Text />
|
|
541
|
-
<MessagePartPrimitive.InProgress>
|
|
542
|
-
<Text color="yellow"> ...</Text>
|
|
543
|
-
</MessagePartPrimitive.InProgress>
|
|
544
|
-
</>
|
|
545
|
-
),
|
|
546
|
-
File: () => <MessagePartPrimitive.File dimColor />,
|
|
547
|
-
}}
|
|
548
|
-
/>
|
|
549
|
-
```
|
|
550
|
-
|
|
551
|
-
| Primitive | Default terminal behavior |
|
|
552
|
-
|-----------|---------------------------|
|
|
553
|
-
| `MessagePartPrimitive.Text` | Renders text with Ink `<Text>` |
|
|
554
|
-
| `MessagePartPrimitive.InProgress` | Renders children only while the current part status is `running` |
|
|
555
|
-
| `MessagePartPrimitive.Image` | Renders `[image: filename]` or `[image]`; never emits image data or terminal image protocols |
|
|
556
|
-
| `MessagePartPrimitive.File` | Renders `[file: filename mimeType]` or `[file: mimeType]`; never prints file data |
|
|
557
|
-
| `MessagePartPrimitive.Source` | Renders source title and/or URL metadata |
|
|
558
|
-
| `MessagePartPrimitive.Reasoning` | Renders conservative reasoning text by default; override or return `null` to suppress |
|
|
559
|
-
| `MessagePartPrimitive.Data` | Renders `[data: name]` when no registered data renderer is available |
|
|
560
|
-
|
|
561
|
-
### PartByIndex
|
|
562
|
-
|
|
563
|
-
Low-level provider that sets up the part context for a specific message part by index. Used internally by `MessagePrimitive.Parts`.
|
|
564
|
-
|
|
565
|
-
```tsx
|
|
566
|
-
<MessagePrimitive.PartByIndex index={0}>
|
|
567
|
-
{/* content rendered with part context */}
|
|
568
|
-
</MessagePrimitive.PartByIndex>
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
| Prop | Type | Description |
|
|
572
|
-
|------|------|-------------|
|
|
573
|
-
| `index` | `number` | Zero-based part index |
|
|
574
|
-
|
|
575
|
-
### AttachmentByIndex
|
|
576
|
-
|
|
577
|
-
Low-level provider that sets up the attachment context for a specific message attachment by index. Used internally by `MessagePrimitive.Attachments`.
|
|
578
|
-
|
|
579
|
-
```tsx
|
|
580
|
-
<MessagePrimitive.AttachmentByIndex index={0}>
|
|
581
|
-
<AttachmentPrimitive.Name />
|
|
582
|
-
</MessagePrimitive.AttachmentByIndex>
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
| Prop | Type | Description |
|
|
586
|
-
|------|------|-------------|
|
|
587
|
-
| `index` | `number` | Zero-based attachment index |
|
|
588
|
-
|
|
589
|
-
### Conditional Rendering (Message)
|
|
590
|
-
|
|
591
|
-
Use `AuiIf` for conditional rendering based on message properties:
|
|
592
|
-
|
|
593
|
-
```tsx
|
|
594
|
-
<AuiIf condition={(s) => s.message.role === "user"}>
|
|
595
|
-
<Text bold color="green">You:</Text>
|
|
596
|
-
</AuiIf>
|
|
597
|
-
|
|
598
|
-
<AuiIf condition={(s) => s.message.role === "assistant" && s.message.isLast}>
|
|
599
|
-
<Text color="yellow">Thinking...</Text>
|
|
600
|
-
</AuiIf>
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
### If (deprecated)
|
|
604
|
-
|
|
605
|
-
<Callout type="warn">
|
|
606
|
-
Deprecated. Use `AuiIf` instead.
|
|
607
|
-
</Callout>
|
|
608
|
-
|
|
609
|
-
Conditional rendering based on message properties.
|
|
610
|
-
|
|
611
|
-
```tsx
|
|
612
|
-
<MessagePrimitive.If user>
|
|
613
|
-
<Text bold color="green">You:</Text>
|
|
614
|
-
</MessagePrimitive.If>
|
|
615
|
-
|
|
616
|
-
<MessagePrimitive.If assistant last>
|
|
617
|
-
<Text color="yellow">Thinking...</Text>
|
|
618
|
-
</MessagePrimitive.If>
|
|
619
|
-
```
|
|
620
|
-
|
|
621
|
-
| Prop | Type | Description |
|
|
622
|
-
|------|------|-------------|
|
|
623
|
-
| `user` | `boolean` | Render for user messages |
|
|
624
|
-
| `assistant` | `boolean` | Render for assistant messages |
|
|
625
|
-
| `running` | `boolean` | Render when message is being generated |
|
|
626
|
-
| `last` | `boolean` | Render for the last message |
|
|
627
|
-
|
|
628
|
-
### Attachments
|
|
629
|
-
|
|
630
|
-
Renders user message attachments using the provided component configuration.
|
|
631
|
-
|
|
632
|
-
```tsx
|
|
633
|
-
<MessagePrimitive.Attachments>
|
|
634
|
-
{() => <Text>[attachment]</Text>}
|
|
635
|
-
</MessagePrimitive.Attachments>
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
| Prop | Type | Description |
|
|
639
|
-
|------|------|-------------|
|
|
640
|
-
| `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
|
|
641
|
-
|
|
642
|
-
## Attachment
|
|
643
|
-
|
|
644
|
-
```tsx
|
|
645
|
-
import { AttachmentPrimitive } from "@assistant-ui/react-ink";
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
Primitives for rendering individual attachments. Each primitive reads from the current attachment context (provided by `ComposerPrimitive.Attachments`, `ComposerPrimitive.AttachmentByIndex`, `MessagePrimitive.Attachments`, or `MessagePrimitive.AttachmentByIndex`).
|
|
649
|
-
|
|
650
|
-
### Root
|
|
651
|
-
|
|
652
|
-
Container `Box` for an attachment. Forwards all `Box` props.
|
|
653
|
-
|
|
654
|
-
| Prop | Type | Description |
|
|
655
|
-
|------|------|-------------|
|
|
656
|
-
| `children` | `ReactNode` | Attachment sub-components |
|
|
657
|
-
| `...rest` | `ComponentProps<typeof Box>` | Forwarded to the underlying Ink `Box` |
|
|
658
|
-
|
|
659
|
-
### Name
|
|
660
|
-
|
|
661
|
-
`Text` component displaying `s.attachment.name`.
|
|
662
|
-
|
|
663
|
-
| Prop | Type | Description |
|
|
664
|
-
|------|------|-------------|
|
|
665
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
666
|
-
|
|
667
|
-
### Thumb
|
|
668
|
-
|
|
669
|
-
`Text` component displaying a short identifier for the attachment. Renders the file extension (`.pdf`, `.png`, …) when the name has one. Falls back to the attachment `type` (e.g. `image`, `document`) otherwise, and finally to `file`. Passing `children` overrides the automatic label.
|
|
670
|
-
|
|
671
|
-
| Prop | Type | Description |
|
|
672
|
-
|------|------|-------------|
|
|
673
|
-
| `children` | `ReactNode` | Overrides the automatic extension/type label |
|
|
674
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
675
|
-
|
|
676
|
-
### Status
|
|
677
|
-
|
|
678
|
-
`Text` component rendering the current attachment status from `s.attachment.status`. Uses the same visual vocabulary as `ToolFallback`: spinner = uploading, `?` = pending action, `x` = error, `||` = paused. By default, completed attachments render nothing.
|
|
679
|
-
|
|
680
|
-
| Prop | Type | Description |
|
|
681
|
-
|------|------|-------------|
|
|
682
|
-
| `showComplete` | `boolean` | When `true`, completed attachments render `+ ready` instead of `null` |
|
|
683
|
-
| `...rest` | `Omit<ComponentProps<typeof Text>, "children">` | Forwarded to the underlying Ink `Text`. Caller-supplied `color` overrides the per-status default. `children` is not accepted; `Status` always renders its own content. |
|
|
684
|
-
|
|
685
|
-
### Remove
|
|
686
|
-
|
|
687
|
-
`Pressable` that calls `aui.attachment.remove()` when activated (Enter while focused). Disabled when not focused or when the `disabled` prop is set.
|
|
688
|
-
|
|
689
|
-
| Prop | Type | Description |
|
|
690
|
-
|------|------|-------------|
|
|
691
|
-
| `children` | `ReactNode` | Visual content for the button |
|
|
692
|
-
| `disabled` | `boolean` | Skip focus registration and ignore Enter |
|
|
693
|
-
| `...rest` | `ComponentProps<typeof Box>` | Forwarded to the underlying Pressable's `Box` |
|
|
694
|
-
|
|
695
|
-
```tsx
|
|
696
|
-
<AttachmentPrimitive.Root>
|
|
697
|
-
<AttachmentPrimitive.Thumb />
|
|
698
|
-
<AttachmentPrimitive.Name />
|
|
699
|
-
<AttachmentPrimitive.Status />
|
|
700
|
-
<AttachmentPrimitive.Remove>
|
|
701
|
-
<Text color="red">[x]</Text>
|
|
702
|
-
</AttachmentPrimitive.Remove>
|
|
703
|
-
</AttachmentPrimitive.Root>
|
|
704
|
-
```
|
|
705
|
-
|
|
706
|
-
## QueueItem
|
|
707
|
-
|
|
708
|
-
```tsx
|
|
709
|
-
import { QueueItemPrimitive } from "@assistant-ui/react-ink";
|
|
710
|
-
```
|
|
711
|
-
|
|
712
|
-
Primitives for rendering individual queued composer items. Use inside a `ComposerPrimitive.Queue` render prop, where the queue item context is set up by `QueueItemByIndexProvider`.
|
|
713
|
-
|
|
714
|
-
### Text
|
|
715
|
-
|
|
716
|
-
Renders the queue item's text with Ink `<Text>`. Pass `children` to override the displayed value.
|
|
717
|
-
|
|
718
|
-
```tsx
|
|
719
|
-
<QueueItemPrimitive.Text color="gray" />
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
| Prop | Type | Description |
|
|
723
|
-
|------|------|-------------|
|
|
724
|
-
| `children` | `ReactNode` | Override content; defaults to the text parts of `s.queueItem.parts` |
|
|
725
|
-
| `...rest` | `TextProps` | Standard Ink Text props |
|
|
726
|
-
|
|
727
|
-
### Remove
|
|
728
|
-
|
|
729
|
-
Pressable that removes the queue item by calling `aui.queueItem.remove()`.
|
|
730
|
-
|
|
731
|
-
```tsx
|
|
732
|
-
<QueueItemPrimitive.Remove>
|
|
733
|
-
<Text color="red">[x]</Text>
|
|
734
|
-
</QueueItemPrimitive.Remove>
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
| Prop | Type | Description |
|
|
738
|
-
|------|------|-------------|
|
|
739
|
-
| `children` | `ReactNode` | Button content |
|
|
740
|
-
| `disabled` | `boolean` | Disable Enter activation and focus |
|
|
741
|
-
|
|
742
|
-
Remaining props are forwarded to the underlying `Pressable` (Ink `Box` props).
|
|
743
|
-
|
|
744
|
-
### Steer
|
|
745
|
-
|
|
746
|
-
Pressable that promotes the queue item to run next by calling `aui.queueItem.steer()`.
|
|
747
|
-
|
|
748
|
-
```tsx
|
|
749
|
-
<QueueItemPrimitive.Steer>
|
|
750
|
-
<Text color="cyan">[Run Now]</Text>
|
|
751
|
-
</QueueItemPrimitive.Steer>
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
| Prop | Type | Description |
|
|
755
|
-
|------|------|-------------|
|
|
756
|
-
| `children` | `ReactNode` | Button content |
|
|
757
|
-
| `disabled` | `boolean` | Disable Enter activation and focus |
|
|
758
|
-
|
|
759
|
-
Remaining props are forwarded to the underlying `Pressable` (Ink `Box` props).
|
|
760
|
-
|
|
761
|
-
## ActionBar
|
|
762
|
-
|
|
763
|
-
```tsx
|
|
764
|
-
import { ActionBarPrimitive } from "@assistant-ui/react-ink";
|
|
765
|
-
```
|
|
766
|
-
|
|
767
|
-
### Copy
|
|
768
|
-
|
|
769
|
-
Pressable that copies the message content. Pass a platform clipboard writer through `copyToClipboard`. Supports function-as-children for copy state feedback.
|
|
770
|
-
|
|
771
|
-
<InstallCommand npm={["clipboardy"]} />
|
|
772
|
-
|
|
773
|
-
```tsx
|
|
774
|
-
import clipboard from "clipboardy";
|
|
775
|
-
|
|
776
|
-
<ActionBarPrimitive.Copy
|
|
777
|
-
copiedDuration={3000}
|
|
778
|
-
copyToClipboard={clipboard.write}
|
|
779
|
-
>
|
|
780
|
-
{({ isCopied }) => <Text>{isCopied ? "[Copied!]" : "[Copy]"}</Text>}
|
|
781
|
-
</ActionBarPrimitive.Copy>
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
| Prop | Type | Description |
|
|
785
|
-
|------|------|-------------|
|
|
786
|
-
| `copiedDuration` | `number` | Duration in ms to show "copied" state (default: 3000) |
|
|
787
|
-
| `copyToClipboard` | `(text: string) => void \| Promise<void>` | Platform clipboard writer |
|
|
788
|
-
|
|
789
|
-
### Edit
|
|
790
|
-
|
|
791
|
-
Pressable that enters edit mode for a message.
|
|
792
|
-
|
|
793
|
-
```tsx
|
|
794
|
-
<ActionBarPrimitive.Edit>
|
|
795
|
-
<Text>[Edit]</Text>
|
|
796
|
-
</ActionBarPrimitive.Edit>
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
### Reload
|
|
800
|
-
|
|
801
|
-
Pressable that regenerates an assistant message.
|
|
802
|
-
|
|
803
|
-
```tsx
|
|
804
|
-
<ActionBarPrimitive.Reload>
|
|
805
|
-
<Text>[Retry]</Text>
|
|
806
|
-
</ActionBarPrimitive.Reload>
|
|
807
|
-
```
|
|
808
|
-
|
|
809
|
-
### FeedbackPositive / FeedbackNegative
|
|
810
|
-
|
|
811
|
-
Pressable buttons for submitting message feedback.
|
|
812
|
-
|
|
813
|
-
```tsx
|
|
814
|
-
<ActionBarPrimitive.FeedbackPositive>
|
|
815
|
-
{({ isSubmitted }) => <Text>{isSubmitted ? "[Liked]" : "[Like]"}</Text>}
|
|
816
|
-
</ActionBarPrimitive.FeedbackPositive>
|
|
817
|
-
|
|
818
|
-
<ActionBarPrimitive.FeedbackNegative>
|
|
819
|
-
{({ isSubmitted }) => <Text>{isSubmitted ? "[Disliked]" : "[Dislike]"}</Text>}
|
|
820
|
-
</ActionBarPrimitive.FeedbackNegative>
|
|
821
|
-
```
|
|
822
|
-
|
|
823
|
-
## BranchPicker
|
|
824
|
-
|
|
825
|
-
```tsx
|
|
826
|
-
import { BranchPickerPrimitive } from "@assistant-ui/react-ink";
|
|
827
|
-
```
|
|
828
|
-
|
|
829
|
-
### Previous / Next
|
|
830
|
-
|
|
831
|
-
Pressable buttons to navigate between message branches.
|
|
832
|
-
|
|
833
|
-
```tsx
|
|
834
|
-
<Box>
|
|
835
|
-
<BranchPickerPrimitive.Previous>
|
|
836
|
-
<Text>{"<"}</Text>
|
|
837
|
-
</BranchPickerPrimitive.Previous>
|
|
838
|
-
<BranchPickerPrimitive.Number />
|
|
839
|
-
<Text>/</Text>
|
|
840
|
-
<BranchPickerPrimitive.Count />
|
|
841
|
-
<BranchPickerPrimitive.Next>
|
|
842
|
-
<Text>{">"}</Text>
|
|
843
|
-
</BranchPickerPrimitive.Next>
|
|
844
|
-
</Box>
|
|
845
|
-
```
|
|
846
|
-
|
|
847
|
-
### Number / Count
|
|
848
|
-
|
|
849
|
-
`Text` components displaying the current branch number and total count.
|
|
850
|
-
|
|
851
|
-
## ThreadList
|
|
852
|
-
|
|
853
|
-
```tsx
|
|
854
|
-
import { ThreadListPrimitive } from "@assistant-ui/react-ink";
|
|
855
|
-
```
|
|
856
|
-
|
|
857
|
-
### Root
|
|
858
|
-
|
|
859
|
-
Container `Box` for the thread list.
|
|
860
|
-
|
|
861
|
-
### Items
|
|
862
|
-
|
|
863
|
-
Renders thread list items with runtime integration.
|
|
864
|
-
|
|
865
|
-
```tsx
|
|
866
|
-
<ThreadListPrimitive.Items
|
|
867
|
-
renderItem={({ threadId }) => (
|
|
868
|
-
<ThreadEntry threadId={threadId} />
|
|
869
|
-
)}
|
|
870
|
-
/>
|
|
871
|
-
```
|
|
872
|
-
|
|
873
|
-
| Prop | Type | Description |
|
|
874
|
-
|------|------|-------------|
|
|
875
|
-
| `renderItem` | `(props: { threadId: string; index: number }) => ReactElement` | Thread item renderer |
|
|
876
|
-
|
|
877
|
-
### New
|
|
878
|
-
|
|
879
|
-
Pressable that creates a new thread.
|
|
880
|
-
|
|
881
|
-
```tsx
|
|
882
|
-
<ThreadListPrimitive.New>
|
|
883
|
-
<Text color="green">[New Chat]</Text>
|
|
884
|
-
</ThreadListPrimitive.New>
|
|
885
|
-
```
|
|
886
|
-
|
|
887
|
-
## ThreadListItem
|
|
888
|
-
|
|
889
|
-
```tsx
|
|
890
|
-
import { ThreadListItemPrimitive } from "@assistant-ui/react-ink";
|
|
891
|
-
```
|
|
892
|
-
|
|
893
|
-
### Root
|
|
894
|
-
|
|
895
|
-
Container `Box` for a thread list item.
|
|
896
|
-
|
|
897
|
-
### Title
|
|
898
|
-
|
|
899
|
-
`Text` component displaying the thread list item title. Shared from `@assistant-ui/core/react`.
|
|
900
|
-
|
|
901
|
-
### Trigger
|
|
902
|
-
|
|
903
|
-
Pressable that switches to the thread.
|
|
904
|
-
|
|
905
|
-
### Delete
|
|
906
|
-
|
|
907
|
-
Pressable that deletes the thread.
|
|
908
|
-
|
|
909
|
-
### Archive / Unarchive
|
|
910
|
-
|
|
911
|
-
Pressable buttons that archive or unarchive the thread.
|
|
912
|
-
|
|
913
|
-
```tsx
|
|
914
|
-
<ThreadListItemPrimitive.Root>
|
|
915
|
-
<ThreadListItemPrimitive.Trigger>
|
|
916
|
-
<ThreadListItemPrimitive.Title />
|
|
917
|
-
</ThreadListItemPrimitive.Trigger>
|
|
918
|
-
<ThreadListItemPrimitive.Delete>
|
|
919
|
-
<Text color="red">[x]</Text>
|
|
920
|
-
</ThreadListItemPrimitive.Delete>
|
|
921
|
-
</ThreadListItemPrimitive.Root>
|
|
922
|
-
```
|
|
923
|
-
|
|
924
|
-
## Suggestion
|
|
925
|
-
|
|
926
|
-
```tsx
|
|
927
|
-
import { SuggestionPrimitive } from "@assistant-ui/react-ink";
|
|
928
|
-
```
|
|
929
|
-
|
|
930
|
-
### Title
|
|
931
|
-
|
|
932
|
-
`Text` component displaying the suggestion title.
|
|
933
|
-
|
|
934
|
-
### Description
|
|
935
|
-
|
|
936
|
-
`Text` component displaying the suggestion label. Despite the component name, this reads from the `label` field of the suggestion state (not a separate `description` field).
|
|
937
|
-
|
|
938
|
-
### Trigger
|
|
939
|
-
|
|
940
|
-
Pressable that triggers the suggestion action.
|
|
941
|
-
|
|
942
|
-
```tsx
|
|
943
|
-
<SuggestionPrimitive.Trigger send>
|
|
944
|
-
<SuggestionPrimitive.Title />
|
|
945
|
-
</SuggestionPrimitive.Trigger>
|
|
946
|
-
```
|
|
947
|
-
|
|
948
|
-
| Prop | Type | Description |
|
|
949
|
-
|------|------|-------------|
|
|
950
|
-
| `send` | `boolean` | When true, sends immediately; when false, inserts into composer |
|
|
951
|
-
| `clearComposer` | `boolean` | Whether to clear/replace composer text (default: true) |
|
|
952
|
-
|
|
953
|
-
## ChainOfThought
|
|
954
|
-
|
|
955
|
-
```tsx
|
|
956
|
-
import { ChainOfThoughtPrimitive } from "@assistant-ui/react-ink";
|
|
957
|
-
```
|
|
958
|
-
|
|
959
|
-
### Root
|
|
960
|
-
|
|
961
|
-
Container `Box` for chain of thought content.
|
|
962
|
-
|
|
963
|
-
### AccordionTrigger
|
|
964
|
-
|
|
965
|
-
Pressable that toggles the collapsed state of the chain of thought.
|
|
966
|
-
|
|
967
|
-
### Parts
|
|
968
|
-
|
|
969
|
-
Renders the individual parts of a chain of thought using a provided components map. Shared from `@assistant-ui/core/react`.
|
|
970
|
-
|
|
971
|
-
```tsx
|
|
972
|
-
<ChainOfThoughtPrimitive.Root>
|
|
973
|
-
<ChainOfThoughtPrimitive.AccordionTrigger>
|
|
974
|
-
<Text dimColor>[Toggle reasoning]</Text>
|
|
975
|
-
</ChainOfThoughtPrimitive.AccordionTrigger>
|
|
976
|
-
<ChainOfThoughtPrimitive.Parts>
|
|
977
|
-
{({ part }) => part.type === "text" ? <Text dimColor>{part.text}</Text> : null}
|
|
978
|
-
</ChainOfThoughtPrimitive.Parts>
|
|
979
|
-
</ChainOfThoughtPrimitive.Root>
|
|
980
|
-
```
|
|
981
|
-
|
|
982
|
-
## ToolCall
|
|
983
|
-
|
|
984
|
-
```tsx
|
|
985
|
-
import { ToolCallPrimitive } from "@assistant-ui/react-ink";
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
### Fallback
|
|
989
|
-
|
|
990
|
-
A built-in component for rendering tool calls with expandable/collapsible output. Includes a spinner for running tools, formatted JSON args and result output, and status icons for completed, errored, or interrupted calls.
|
|
991
|
-
|
|
992
|
-
```tsx
|
|
993
|
-
<MessagePrimitive.Parts>
|
|
994
|
-
{({ part }) => {
|
|
995
|
-
if (part.type === "tool-call") return <ToolCallPrimitive.Fallback part={part} />;
|
|
996
|
-
return null;
|
|
997
|
-
}}
|
|
998
|
-
</MessagePrimitive.Parts>
|
|
999
|
-
```
|
|
1000
|
-
|
|
1001
|
-
| Prop | Type | Description |
|
|
1002
|
-
|------|------|-------------|
|
|
1003
|
-
| `part` | `ToolCallMessagePartProps` | The tool call message part (pass the component prop directly) |
|
|
1004
|
-
| `expanded` | `boolean` | Force expanded or collapsed. When unset, auto-expands while running, awaiting action, or errored |
|
|
1005
|
-
| `maxArgLines` | `number` | Maximum lines to show for args when expanded (default: 20) |
|
|
1006
|
-
| `maxResultLines` | `number` | Maximum lines to show for result when expanded (default: 20) |
|
|
1007
|
-
| `maxResultPreviewLines` | `number` | Maximum lines to show for result preview when collapsed (default: 1) |
|
|
1008
|
-
| `renderHeader` | `(props: { toolName, status, expanded }) => ReactNode` | Custom header renderer |
|
|
1009
|
-
| `renderArgs` | `(props: { args, argsText }) => ReactNode` | Custom args renderer |
|
|
1010
|
-
| `renderResult` | `(props: { result, isError }) => ReactNode` | Custom result renderer |
|
|
1011
|
-
|
|
1012
|
-
## Diff
|
|
1013
|
-
|
|
1014
|
-
```tsx
|
|
1015
|
-
import { DiffPrimitive, DiffView } from "@assistant-ui/react-ink";
|
|
1016
|
-
```
|
|
1017
|
-
|
|
1018
|
-
Components for rendering code diffs in the terminal.
|
|
1019
|
-
|
|
1020
|
-
### DiffView
|
|
1021
|
-
|
|
1022
|
-
Pre-composed component that combines all diff primitives for easy diff rendering. Accepts either a unified diff patch string or old/new file content for inline comparison.
|
|
1023
|
-
|
|
1024
|
-
When a replacement is rendered as an equal-length adjacent `-`/`+` run, `DiffView` also highlights the changed word spans inside those lines. The existing prefixes, line numbers, folding, and primitive API surface stay the same. This intra-line behavior is internal to `DiffView`; `DiffPrimitive.Line` remains a line-level primitive.
|
|
1025
|
-
|
|
1026
|
-
```tsx
|
|
1027
|
-
// From a patch string
|
|
1028
|
-
<DiffView
|
|
1029
|
-
patch={unifiedDiffString}
|
|
1030
|
-
showLineNumbers
|
|
1031
|
-
contextLines={3}
|
|
1032
|
-
maxLines={50}
|
|
1033
|
-
/>
|
|
1034
|
-
|
|
1035
|
-
// From file contents
|
|
1036
|
-
<DiffView
|
|
1037
|
-
oldFile={{ content: "old text", name: "file.txt" }}
|
|
1038
|
-
newFile={{ content: "new text", name: "file.txt" }}
|
|
1039
|
-
showLineNumbers
|
|
1040
|
-
/>
|
|
1041
|
-
```
|
|
1042
|
-
|
|
1043
|
-
| Prop | Type | Description |
|
|
1044
|
-
|------|------|-------------|
|
|
1045
|
-
| `patch` | `string` | Unified diff patch string to parse and display |
|
|
1046
|
-
| `oldFile` | `{ content: string; name?: string }` | Old file content for inline comparison |
|
|
1047
|
-
| `newFile` | `{ content: string; name?: string }` | New file content for inline comparison |
|
|
1048
|
-
| `showLineNumbers` | `boolean` | Whether to show line numbers (default: true) |
|
|
1049
|
-
| `contextLines` | `number` | Number of context lines to show around changes |
|
|
1050
|
-
| `maxLines` | `number` | Maximum number of lines to display |
|
|
1051
|
-
|
|
1052
|
-
### Root
|
|
1053
|
-
|
|
1054
|
-
Container `Box` that provides diff context to child components. Parses the patch or computes the diff from old/new file content.
|
|
1055
|
-
|
|
1056
|
-
```tsx
|
|
1057
|
-
<DiffPrimitive.Root
|
|
1058
|
-
patch={patchString}
|
|
1059
|
-
oldFile={{ content: oldContent, name: "file.txt" }}
|
|
1060
|
-
newFile={{ content: newContent, name: "file.txt" }}
|
|
1061
|
-
>
|
|
1062
|
-
{children}
|
|
1063
|
-
</DiffPrimitive.Root>
|
|
1064
|
-
```
|
|
1065
|
-
|
|
1066
|
-
| Prop | Type | Description |
|
|
1067
|
-
|------|------|-------------|
|
|
1068
|
-
| `patch` | `string` | Unified diff patch string |
|
|
1069
|
-
| `oldFile` | `{ content: string; name?: string }` | Old file for inline diff |
|
|
1070
|
-
| `newFile` | `{ content: string; name?: string }` | New file for inline diff |
|
|
1071
|
-
|
|
1072
|
-
### Header
|
|
1073
|
-
|
|
1074
|
-
Displays file header information including filename(s) and change statistics.
|
|
1075
|
-
|
|
1076
|
-
```tsx
|
|
1077
|
-
<DiffPrimitive.Header fileIndex={0} />
|
|
1078
|
-
```
|
|
1079
|
-
|
|
1080
|
-
| Prop | Type | Description |
|
|
1081
|
-
|------|------|-------------|
|
|
1082
|
-
| `fileIndex` | `number` | Index of file to display header for (default: 0) |
|
|
1083
|
-
|
|
1084
|
-
### Content
|
|
1085
|
-
|
|
1086
|
-
Renders the diff content with lines. Supports context folding and line truncation.
|
|
1087
|
-
|
|
1088
|
-
```tsx
|
|
1089
|
-
<DiffPrimitive.Content
|
|
1090
|
-
fileIndex={0}
|
|
1091
|
-
showLineNumbers
|
|
1092
|
-
contextLines={3}
|
|
1093
|
-
maxLines={100}
|
|
1094
|
-
renderLine={({ line, index }) => <CustomLine line={line} />}
|
|
1095
|
-
renderFold={({ region, index }) => <CustomFold region={region} />}
|
|
1096
|
-
/>
|
|
1097
|
-
```
|
|
1098
|
-
|
|
1099
|
-
| Prop | Type | Description |
|
|
1100
|
-
|------|------|-------------|
|
|
1101
|
-
| `fileIndex` | `number` | Index of file to display (default: 0) |
|
|
1102
|
-
| `showLineNumbers` | `boolean` | Show line numbers (default: true) |
|
|
1103
|
-
| `contextLines` | `number` | Number of context lines around changes |
|
|
1104
|
-
| `maxLines` | `number` | Maximum lines to display |
|
|
1105
|
-
| `renderLine` | `(props: { line; index }) => ReactNode` | Custom line renderer |
|
|
1106
|
-
| `renderFold` | `(props: { region; index }) => ReactNode` | Custom fold region renderer |
|
|
1107
|
-
|
|
1108
|
-
### Line
|
|
1109
|
-
|
|
1110
|
-
Renders an individual diff line with appropriate coloring and indicators.
|
|
1111
|
-
|
|
1112
|
-
```tsx
|
|
1113
|
-
<DiffPrimitive.Line
|
|
1114
|
-
line={parsedLine}
|
|
1115
|
-
showLineNumbers
|
|
1116
|
-
lineNumberWidth={4}
|
|
1117
|
-
/>
|
|
1118
|
-
```
|
|
1119
|
-
|
|
1120
|
-
| Prop | Type | Description |
|
|
1121
|
-
|------|------|-------------|
|
|
1122
|
-
| `line` | `ParsedLine` | The parsed line object to render |
|
|
1123
|
-
| `showLineNumbers` | `boolean` | Show line numbers (default: true) |
|
|
1124
|
-
| `lineNumberWidth` | `number` | Width for line number padding (default: 4) |
|
|
1125
|
-
|
|
1126
|
-
### Stats
|
|
1127
|
-
|
|
1128
|
-
Displays diff statistics (additions and deletions count).
|
|
1129
|
-
|
|
1130
|
-
```tsx
|
|
1131
|
-
<DiffPrimitive.Stats fileIndex={0} />
|
|
1132
|
-
```
|
|
1133
|
-
|
|
1134
|
-
| Prop | Type | Description |
|
|
1135
|
-
|------|------|-------------|
|
|
1136
|
-
| `fileIndex` | `number` | Index of file to display stats for (default: 0) |
|
|
1137
|
-
|
|
1138
|
-
### Composing with Primitives
|
|
1139
|
-
|
|
1140
|
-
For custom layouts, use the primitives directly:
|
|
1141
|
-
|
|
1142
|
-
```tsx
|
|
1143
|
-
<DiffPrimitive.Root patch={patchString}>
|
|
1144
|
-
<Box flexDirection="column">
|
|
1145
|
-
<DiffPrimitive.Header />
|
|
1146
|
-
<DiffPrimitive.Stats />
|
|
1147
|
-
<DiffPrimitive.Content
|
|
1148
|
-
showLineNumbers
|
|
1149
|
-
contextLines={2}
|
|
1150
|
-
/>
|
|
1151
|
-
</Box>
|
|
1152
|
-
</DiffPrimitive.Root>
|
|
1153
|
-
```
|
|
1154
|
-
|
|
1155
|
-
## StatusBar
|
|
1156
|
-
|
|
1157
|
-
```tsx
|
|
1158
|
-
import { StatusBarPrimitive } from "@assistant-ui/react-ink";
|
|
1159
|
-
```
|
|
1160
|
-
|
|
1161
|
-
Primitives for rendering a compact terminal status bar showing run state, model, message count, token usage, and latency. All sub-components read directly from the active thread state.
|
|
1162
|
-
|
|
1163
|
-
### Root
|
|
1164
|
-
|
|
1165
|
-
Container `Box` for the status bar. Forwards all `Box` props; pass `gap` to space its children.
|
|
1166
|
-
|
|
1167
|
-
| Prop | Type | Description |
|
|
1168
|
-
|------|------|-------------|
|
|
1169
|
-
| `children` | `ReactNode` | Status bar sub-components |
|
|
1170
|
-
| `...rest` | `ComponentProps<typeof Box>` | Forwarded to the underlying Ink `Box` |
|
|
1171
|
-
|
|
1172
|
-
### ModelName
|
|
1173
|
-
|
|
1174
|
-
`Text` component displaying the current model name. The name is supplied as a prop — the primitive does not infer it from state.
|
|
1175
|
-
|
|
1176
|
-
| Prop | Type | Description |
|
|
1177
|
-
|------|------|-------------|
|
|
1178
|
-
| `name` | `ReactNode` | Model label to render (default: `"unknown"`) |
|
|
1179
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
1180
|
-
|
|
1181
|
-
### MessageCount
|
|
1182
|
-
|
|
1183
|
-
`Text` component displaying the number of messages on the current thread, formatted as `N msgs` by default. Renders nothing when the thread is empty.
|
|
1184
|
-
|
|
1185
|
-
| Prop | Type | Description |
|
|
1186
|
-
|------|------|-------------|
|
|
1187
|
-
| `format` | `(count: number) => string` | Custom formatter for the count (default: `` `${count} msgs` ``) |
|
|
1188
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
1189
|
-
|
|
1190
|
-
### TokenCount
|
|
1191
|
-
|
|
1192
|
-
`Text` component summing `metadata.timing.tokenCount` across all assistant messages on the thread, formatted with `toLocaleString()` + `" tokens"` by default. Renders nothing when the total is `0`.
|
|
1193
|
-
|
|
1194
|
-
| Prop | Type | Description |
|
|
1195
|
-
|------|------|-------------|
|
|
1196
|
-
| `format` | `(tokens: number) => string` | Custom formatter for the total (default: `` `${tokens.toLocaleString()} tokens` ``) |
|
|
1197
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
1198
|
-
|
|
1199
|
-
### Latency
|
|
1200
|
-
|
|
1201
|
-
`Text` component displaying `metadata.timing.tokensPerSecond` from the most recent assistant message, formatted as `N tok/s` (rounded) by default. Renders nothing when the field is missing.
|
|
1202
|
-
|
|
1203
|
-
| Prop | Type | Description |
|
|
1204
|
-
|------|------|-------------|
|
|
1205
|
-
| `format` | `(tokensPerSecond: number) => string` | Custom formatter (default: `` `${Math.round(tokensPerSecond)} tok/s` ``) |
|
|
1206
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
1207
|
-
|
|
1208
|
-
### Status
|
|
1209
|
-
|
|
1210
|
-
`Text` component reporting the thread's run state. Resolves to `"running"` while `s.thread.isRunning`, otherwise inspects the most recent assistant message: `"error"` when its status is `incomplete` with reason `error`, `"cancelled"` when reason is `cancelled`, and `"idle"` for every other case. Pass `color` (or any `Text` prop) to style the label.
|
|
1211
|
-
|
|
1212
|
-
| Prop | Type | Description |
|
|
1213
|
-
|------|------|-------------|
|
|
1214
|
-
| `format` | `(status: "idle" \| "running" \| "error" \| "cancelled") => string` | Custom label formatter (default: returns the state string verbatim) |
|
|
1215
|
-
| `...rest` | `ComponentProps<typeof Text>` | Forwarded to the underlying Ink `Text` |
|
|
1216
|
-
|
|
1217
|
-
```tsx
|
|
1218
|
-
<StatusBarPrimitive.Root gap={1}>
|
|
1219
|
-
<StatusBarPrimitive.Status />
|
|
1220
|
-
<StatusBarPrimitive.ModelName name="gpt-5.6-luna" />
|
|
1221
|
-
<StatusBarPrimitive.MessageCount />
|
|
1222
|
-
<StatusBarPrimitive.TokenCount />
|
|
1223
|
-
<StatusBarPrimitive.Latency />
|
|
1224
|
-
</StatusBarPrimitive.Root>
|
|
1225
|
-
```
|
|
1226
|
-
|
|
1227
|
-
## TextInput
|
|
1228
|
-
|
|
1229
|
-
```tsx
|
|
1230
|
-
import { TextInput } from "@assistant-ui/react-ink";
|
|
1231
|
-
```
|
|
1232
|
-
|
|
1233
|
-
Store-free, controlled single/multi-line text field. Ink ships no native text input, so this is the terminal equivalent of the DOM `<textarea>` or React Native's `<TextInput>` — the editing engine (buffer, grapheme-aware cursor, and the full emacs/arrow keymap) without any runtime or composer coupling. `ComposerPrimitive.Input` is a thin adapter that wraps `TextInput` and binds it to the composer store; reach for `TextInput` directly when you need an editable field outside the thread composer (for example, editing a value before confirming an action).
|
|
1234
|
-
|
|
1235
|
-
It is controlled on `value`/`onChange`, so an external owner can override the text at any time (the buffer absorbs the echo without thrashing the cursor). An owner may also transform the emitted text in `onChange` (uppercase, mask, reject); the buffer applies the corrected value while keeping the cursor at the edit position, snapped to a grapheme boundary. A replacement that does not respond to an edit (a programmatic set while idle) still places the cursor at the end:
|
|
1236
|
-
|
|
1237
|
-
```tsx
|
|
1238
|
-
const [command, setCommand] = useState(approval.action.command);
|
|
1239
|
-
|
|
1240
|
-
<TextInput
|
|
1241
|
-
value={command}
|
|
1242
|
-
onChange={setCommand}
|
|
1243
|
-
submitOnEnter
|
|
1244
|
-
onSubmit={(text) => runEdited(text)}
|
|
1245
|
-
/>
|
|
1246
|
-
```
|
|
1247
|
-
|
|
1248
|
-
| Prop | Type | Description |
|
|
1249
|
-
|------|------|-------------|
|
|
1250
|
-
| `value` | `string` | Current text (controlled) |
|
|
1251
|
-
| `onChange` | `(text: string) => void` | Called with the next text whenever the buffer changes |
|
|
1252
|
-
| `onSubmit` | `(text: string) => void` | Called on Enter when `submitOnEnter` is set, with the text as displayed; owners that validate in `onChange` should validate again in `onSubmit` |
|
|
1253
|
-
| `submitOnEnter` | `boolean` | Whether Enter calls `onSubmit` (default: `false`) |
|
|
1254
|
-
| `placeholder` | `string` | Placeholder text when empty (default: `""`) |
|
|
1255
|
-
| `autoFocus` | `boolean` | Auto-focus on mount (default: `true`) |
|
|
1256
|
-
| `multiLine` | `boolean` | When true, Enter inserts a newline unless `submitOnEnter` is enabled |
|
|
1257
|
-
| `...rest` | `ComponentProps<typeof Box>` | Forwarded to the underlying Ink `Box` |
|
|
1258
|
-
|
|
1259
|
-
Keyboard bindings, grapheme handling, and terminal-capability caveats are identical to [`ComposerPrimitive.Input`](#input).
|