@kitn.ai/ui 0.20.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -45
- package/dist/components/artifact-card.d.ts +51 -0
- package/dist/components/artifact.d.ts +1 -1
- package/dist/components/attachments.d.ts +2 -2
- package/dist/components/audio-visualizer/index.d.ts +3 -3
- package/dist/components/audio-visualizer/labs/lab-choreography.d.ts +59 -0
- package/dist/components/audio-visualizer/labs/lab-shaders.d.ts +22 -0
- package/dist/components/audio-visualizer/labs/lab-visualizer.d.ts +18 -0
- package/dist/components/audio-visualizer/variant-aurora.d.ts +2 -2
- package/dist/components/audio-visualizer/variant-bar.d.ts +2 -2
- package/dist/components/audio-visualizer/variant-custom.d.ts +2 -2
- package/dist/components/audio-visualizer/variant-grid.d.ts +1 -1
- package/dist/components/audio-visualizer/variant-radial.d.ts +1 -1
- package/dist/components/audio-visualizer/variant-wave.d.ts +1 -1
- package/dist/components/card-fallback.d.ts +12 -2
- package/dist/components/card-renderer.d.ts +63 -2
- package/dist/components/chat-container.d.ts +3 -0
- package/dist/components/chat-scope-picker.d.ts +2 -2
- package/dist/components/chat-thread.d.ts +77 -18
- package/dist/components/choice-card.d.ts +3 -28
- package/dist/components/composer-dom.d.ts +1 -1
- package/dist/components/composer-highlight.d.ts +1 -1
- package/dist/components/composer-history.d.ts +1 -1
- package/dist/components/composer.d.ts +1 -1
- package/dist/components/confirm-card.d.ts +3 -18
- package/dist/components/context.d.ts +8 -4
- package/dist/components/conversation-item.d.ts +1 -1
- package/dist/components/conversation-list.d.ts +4 -3
- package/dist/components/embed.d.ts +3 -3
- package/dist/components/file-tree.d.ts +11 -22
- package/dist/components/form-widgets.d.ts +1 -1
- package/dist/components/form.d.ts +3 -44
- package/dist/components/link-preview.d.ts +3 -3
- package/dist/components/loader.d.ts +30 -48
- package/dist/components/message-skills.d.ts +4 -0
- package/dist/components/message.d.ts +84 -21
- package/dist/components/model-switcher.d.ts +2 -2
- package/dist/components/prompt-input.d.ts +2 -2
- package/dist/components/response-compare-types.d.ts +11 -2
- package/dist/components/response-compare.d.ts +3 -3
- package/dist/components/source.d.ts +12 -3
- package/dist/components/tasks-card.d.ts +3 -31
- package/dist/components/thread.d.ts +17 -5
- package/dist/components/toast.d.ts +2 -2
- package/dist/components/tool-classify.d.ts +8 -0
- package/dist/components/tool-types.d.ts +29 -1
- package/dist/components/tool.d.ts +3 -3
- package/dist/components/use-card-resolution.d.ts +1 -1
- package/dist/create-tween-COnPwAQN.js +338 -0
- package/dist/create-tween-DmTUaXWE.js +341 -0
- package/dist/create-tween-qs-jjvNA.js +7 -0
- package/dist/custom-elements.json +1726 -463
- package/dist/elements/agent-card.js +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/audio-visualizer.js +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/badge.js +1 -1
- package/dist/elements/button.js +1 -1
- package/dist/elements/card.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chain-of-thought.js +1 -1
- package/dist/elements/chat-scope-picker.js +1 -1
- package/dist/elements/chat-types.d.ts +70 -10
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkpoint.js +1 -1
- package/dist/elements/choice.js +1 -1
- package/dist/elements/chunks/{Icon-Tj58ES_d.js → Icon-CHG5z5L7.js} +1 -1
- package/dist/elements/chunks/{action-icons-ns1Fnedj.js → action-icons-BAtCEEgg.js} +1 -1
- package/dist/elements/chunks/arrow-left-CFPTeL1Y.js +1 -0
- package/dist/elements/chunks/artifact-fBZOE4SO.js +1 -0
- package/dist/elements/chunks/{attachments-mCB5F1Fq.js → attachments-DpYMe5VQ.js} +1 -1
- package/dist/elements/chunks/audio-visualizer-DFwzAcuL.js +1 -0
- package/dist/elements/chunks/{badge-B4Zuajl2.js → badge-D6zodm6E.js} +1 -1
- package/dist/elements/chunks/{button-ZWNif3--.js → button-C42vrGvO.js} +1 -1
- package/dist/elements/chunks/card-renderer-DMZsSuvU.js +1 -0
- package/dist/elements/chunks/card-tags-D8lZ-C_U.js +1 -0
- package/dist/elements/chunks/chat-thread-CNNEhol-.js +1 -0
- package/dist/elements/chunks/check-7Q3K-iXE.js +1 -0
- package/dist/elements/chunks/chevron-down-CpNYLn7E.js +1 -0
- package/dist/elements/chunks/chevron-right-DrH85Fha.js +1 -0
- package/dist/elements/chunks/choice-card-YoWjpsFV.js +1 -0
- package/dist/elements/chunks/circle-C9KRjKYv.js +1 -0
- package/dist/elements/chunks/circle-check-Dmi7Y4zw.js +1 -0
- package/dist/elements/chunks/{circle-x-B7faJFlY.js → circle-x-QIxXda6k.js} +1 -1
- package/dist/elements/chunks/code-block-CqeugReY.js +1 -0
- package/dist/elements/chunks/{collapsible-DM1Ckd4e.js → collapsible-sTv-_5lF.js} +1 -1
- package/dist/elements/chunks/{composer-BguS0QL_.js → composer-ldQyeVEB.js} +2 -2
- package/dist/elements/chunks/confirm-card-C0RNOwfn.js +1 -0
- package/dist/elements/chunks/context-5qgypNHC.js +1 -0
- package/dist/elements/chunks/conversation-list-DLzOacXz.js +1 -0
- package/dist/elements/chunks/create-tween-V4TXZ93X.js +7 -0
- package/dist/elements/chunks/default-input-DeeRSDHc.js +1 -0
- package/dist/elements/chunks/define-lE-QvQFn.js +1 -0
- package/dist/elements/chunks/{disclosure-CIZ5c8nO.js → disclosure-DZSa9jog.js} +1 -1
- package/dist/elements/chunks/{download-Dsbg3ste.js → download-B2ZmnGqW.js} +1 -1
- package/dist/elements/chunks/{dropdown-BDd1-Zgi.js → dropdown-R3B7cSRE.js} +1 -1
- package/dist/elements/chunks/{ellipsis-Dw6qrss-.js → ellipsis-BmxceY4l.js} +1 -1
- package/dist/elements/chunks/embed-BVrtTZPo.js +1 -0
- package/dist/elements/chunks/{external-link-Vt74zAoL.js → external-link-BbdR7YO7.js} +1 -1
- package/dist/elements/chunks/{file-text-CZrZF6_v.js → file-text-D7dijo1A.js} +1 -1
- package/dist/elements/chunks/{file-tree-DF4okKyo.js → file-tree-0upJ5jeb.js} +1 -1
- package/dist/elements/chunks/{folder-glP5rha4.js → folder-D8z58t7B.js} +1 -1
- package/dist/elements/chunks/form-p5BKJNw5.js +1 -0
- package/dist/elements/chunks/hover-card-CN9s2md5.js +1 -0
- package/dist/elements/chunks/{icon-BLb8beoi.js → icon-CNiKP37E.js} +1 -1
- package/dist/elements/chunks/{info-CIsv92JK.js → info-BSnuJiHI.js} +1 -1
- package/dist/elements/chunks/{input-Dds1kFyt.js → input-BauDmzxX.js} +1 -1
- package/dist/elements/chunks/{kbd-De_xbgi9.js → kbd-BlHJaP9b.js} +1 -1
- package/dist/elements/chunks/{link-i4r_k7z4.js → link-DEi5iUWC.js} +1 -1
- package/dist/elements/chunks/link-preview-BaHyM6W4.js +1 -0
- package/dist/elements/chunks/{loader-BmQH4s3V.js → loader-CmJG_Fkq.js} +1 -1
- package/dist/elements/chunks/{markdown-Zi21WhUz.js → markdown-D2jaMpCN.js} +1 -1
- package/dist/elements/chunks/message-C5UfXZ2Z.js +1 -0
- package/dist/elements/chunks/message-CXWLmmLn.js +1 -0
- package/dist/elements/chunks/message-square-hXylwsy0.js +1 -0
- package/dist/elements/chunks/{minimize-2--ifeCGrl.js → minimize-2-C9ytZFMU.js} +1 -1
- package/dist/elements/chunks/model-switcher-CivGfD7-.js +1 -0
- package/dist/elements/chunks/{overlay-kD8dwRv_.js → overlay-DJL_sbOm.js} +1 -1
- package/dist/elements/chunks/{paperclip-q21dYOSK.js → paperclip-CFaB8naM.js} +1 -1
- package/dist/elements/chunks/{progress-bar-BrAIIaaJ.js → progress-bar-Br5SksfR.js} +1 -1
- package/dist/elements/chunks/{prompt-suggestion-Bjn2K-fR.js → prompt-suggestion-CMIvtAhU.js} +1 -1
- package/dist/elements/chunks/reasoning-DpZcNzLq.js +1 -0
- package/dist/elements/chunks/{resizable-Dp4JExql.js → resizable-Q8i3T9a_.js} +1 -1
- package/dist/elements/chunks/{rotate-cw-CFWWkpj2.js → rotate-cw-B5IHCBFV.js} +1 -1
- package/dist/elements/chunks/{scroll-area-Bb0kHH1j.js → scroll-area-eLeydBje.js} +1 -1
- package/dist/elements/chunks/scroll-button-DWbz0yA1.js +1 -0
- package/dist/elements/chunks/{separator-9kRgr1X9.js → separator-Xic78AD_.js} +1 -1
- package/dist/elements/chunks/{settings-B8lmec4D.js → settings-B8H51pAx.js} +1 -1
- package/dist/elements/chunks/{settings-group-I0hEuXiN.js → settings-group-CsG9eYLe.js} +1 -1
- package/dist/elements/chunks/{share-C3lTiYGt.js → share-CNTx0z__.js} +1 -1
- package/dist/elements/chunks/skeleton-CLlHTcMI.js +1 -0
- package/dist/elements/chunks/slots-CIw9RlAe.js +1 -0
- package/dist/elements/chunks/source-BoVcU5ok.js +1 -0
- package/dist/elements/chunks/{star-CSJtGxgv.js → star-CxQVTVhI.js} +1 -1
- package/dist/elements/chunks/{store-CHyW95TP.js → store-CLtS5CUG.js} +1 -1
- package/dist/elements/chunks/tasks-card-CzlkLmUt.js +1 -0
- package/dist/elements/chunks/{text-shimmer-Cn9TmNpI.js → text-shimmer-D5NhpIQ1.js} +1 -1
- package/dist/elements/chunks/textarea-x5Uxsmtm.js +1 -0
- package/dist/elements/chunks/{thumbs-up-PNVVThEF.js → thumbs-up-UobcJnx9.js} +1 -1
- package/dist/elements/chunks/{toast-store-DKbQn3Wn.js → toast-store-BOfs9eXq.js} +1 -1
- package/dist/elements/chunks/{tool-DjTRpIpl.js → tool-Be6Dh_dt.js} +1 -1
- package/dist/elements/chunks/tooltip-RxMxyCLF.js +1 -0
- package/dist/elements/chunks/{triangle-alert-DsHTHCPm.js → triangle-alert-C4yxH2XN.js} +1 -1
- package/dist/elements/chunks/use-card-resolution-jva9ehH6.js +1 -0
- package/dist/elements/chunks/{variant-aurora-Dc4nQUia.js → variant-aurora-Dx4VRcjS.js} +2 -2
- package/dist/elements/chunks/{variant-custom-y_3kVQhS.js → variant-custom-Y1ZTWgEa.js} +1 -1
- package/dist/elements/chunks/{variant-wave-D5OR1-9Z.js → variant-wave-B9gml9Cg.js} +2 -2
- package/dist/elements/chunks/{video-B7vmenoC.js → video-CrPHsytT.js} +1 -1
- package/dist/elements/chunks/x-_-OPHept.js +1 -0
- package/dist/elements/coachmark.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command.js +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/composer.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/context-meter.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/default-input.d.ts +34 -7
- package/dist/elements/define.d.ts +1 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/disclosure.d.ts +1 -1
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-data-types.d.ts +107 -0
- package/dist/elements/embed.js +1 -1
- package/dist/elements/empty.js +1 -1
- package/dist/elements/feedback-bar.js +1 -1
- package/dist/elements/file-tree.js +1 -1
- package/dist/elements/file-upload.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/icon.js +1 -1
- package/dist/elements/image.js +1 -1
- package/dist/elements/input.js +1 -1
- package/dist/elements/kbd.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/loader.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/menu.js +1 -1
- package/dist/elements/message-skills.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/model-switcher.js +1 -1
- package/dist/elements/nav.js +1 -1
- package/dist/elements/notice.js +1 -1
- package/dist/elements/pane-group.js +1 -1
- package/dist/elements/pane.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/progress-bar.js +1 -1
- package/dist/elements/prompt-dock.js +1 -1
- package/dist/elements/prompt-input.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/register.d.ts +8 -6
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +1 -1
- package/dist/elements/screen.js +1 -1
- package/dist/elements/scroll-area.js +1 -1
- package/dist/elements/scroll-button.js +1 -1
- package/dist/elements/search.js +1 -1
- package/dist/elements/segmented.js +1 -1
- package/dist/elements/separator.js +1 -1
- package/dist/elements/setting-item.js +1 -1
- package/dist/elements/settings-group.js +1 -1
- package/dist/elements/skeleton.js +1 -1
- package/dist/elements/slot-text.d.ts +51 -0
- package/dist/elements/slots.d.ts +21 -0
- package/dist/elements/source.js +1 -1
- package/dist/elements/status.js +1 -1
- package/dist/elements/switch.js +1 -1
- package/dist/elements/tabs.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/text-shimmer.js +1 -1
- package/dist/elements/thinking-bar.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/elements/toast.js +1 -1
- package/dist/elements/tool.js +1 -1
- package/dist/elements/tooltip.js +1 -1
- package/dist/elements/validate-messages.d.ts +25 -0
- package/dist/elements/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +2734 -217
- package/dist/index.d.ts +163 -125
- package/dist/index.js +6572 -5990
- package/dist/index.server.d.ts +5 -0
- package/dist/index.server.js +5403 -4860
- package/dist/kai-provider.es.d.ts +5 -0
- package/dist/kai-provider.es.js +79 -77
- package/dist/kai.es.d.ts +5 -0
- package/dist/kai.es.js +1 -1
- package/dist/llms/llms-full.txt +774 -151
- package/dist/llms/llms.txt +57 -5
- package/dist/mcp.es.js +4756 -782
- package/dist/primitives/card-component-types.d.ts +11 -0
- package/dist/primitives/card-data-types.d.ts +196 -0
- package/dist/primitives/card-host.d.ts +1 -1
- package/dist/primitives/card-recovery.d.ts +3 -3
- package/dist/primitives/card-registry.d.ts +4 -14
- package/dist/primitives/card-resolution.d.ts +1 -1
- package/dist/primitives/card-routing.d.ts +1 -1
- package/dist/primitives/card-tags.d.ts +11 -0
- package/dist/primitives/card-validate-cards.d.ts +57 -0
- package/dist/primitives/card-validate-generator.testlib.d.ts +20 -0
- package/dist/primitives/card-validate-schemas.d.ts +17 -0
- package/dist/primitives/card-validate.d.ts +24 -0
- package/dist/primitives/create-kai-chat.d.ts +3 -3
- package/dist/primitives/embed-providers.d.ts +1 -1
- package/dist/primitives/link-preview.d.ts +1 -1
- package/dist/primitives/message-feedback.d.ts +2 -2
- package/dist/primitives/toast-store.d.ts +1 -1
- package/dist/react/index.d.ts +730 -302
- package/dist/react/use-kai-chat.d.ts +8 -4
- package/dist/react.d.ts +5 -0
- package/dist/react.js +418 -317
- package/dist/register-impl-AxIlqjo7.js +145 -0
- package/dist/remote/host-embed.d.ts +1 -1
- package/dist/remote/index.d.ts +2 -2
- package/dist/remote/provider-runtime.d.ts +2 -2
- package/dist/remote/provider.d.ts +2 -2
- package/dist/remote/validate.d.ts +1 -1
- package/dist/remote/wire.d.ts +1 -1
- package/dist/schemas/artifact.schema.json +92 -0
- package/dist/schemas/embed.schema.json +0 -2
- package/dist/schemas/from-tool-call.d.ts +48 -0
- package/dist/schemas/index.d.ts +48 -0
- package/dist/schemas/link.schema.json +0 -2
- package/dist/schemas/provider-subsets.d.ts +136 -0
- package/dist/schemas/registry.d.ts +140 -0
- package/dist/schemas/tool-defs.d.ts +121 -0
- package/dist/schemas.d.ts +5 -0
- package/dist/schemas.js +717 -0
- package/dist/solid-BGYSJyHG.js +22960 -0
- package/dist/solid-Dt2nEwfl.js +20194 -0
- package/dist/solid.d.ts +66 -0
- package/dist/solid.js +261 -0
- package/dist/solid.server.d.ts +5 -0
- package/dist/solid.server.js +261 -0
- package/dist/state/index.d.ts +14 -4
- package/dist/state/messages.d.ts +8 -3
- package/dist/state/mock.d.ts +46 -0
- package/dist/state/parts.d.ts +85 -0
- package/dist/state/stream.d.ts +15 -9
- package/dist/state.d.ts +5 -0
- package/dist/state.js +253 -84
- package/dist/ui/action-icons.d.ts +1 -1
- package/dist/ui/collapsible.d.ts +11 -6
- package/dist/ui/dropdown.d.ts +47 -42
- package/dist/ui/pane-group.d.ts +1 -1
- package/dist/{variant-aurora-DVtGqVH6.js → variant-aurora-B44X69AG.js} +1 -1
- package/dist/variant-aurora-BRhV8Flk.js +391 -0
- package/dist/variant-aurora-Ds5ou9BH.js +381 -0
- package/dist/variant-custom-B20FhtYj.js +170 -0
- package/dist/{variant-custom-Dif-IV4u.js → variant-custom-BvA1Schl.js} +1 -1
- package/dist/variant-custom-D6Rtvneb.js +200 -0
- package/dist/{variant-wave-DbfNdvSi.js → variant-wave-BUQtkryq.js} +1 -1
- package/dist/variant-wave-BVYnqy9L.js +218 -0
- package/dist/variant-wave-DXC6_LcH.js +208 -0
- package/dist/wire/chunk.d.ts +171 -0
- package/dist/wire/consume.d.ts +26 -0
- package/dist/wire/encode.d.ts +221 -0
- package/dist/wire/files.d.ts +116 -0
- package/dist/wire/formats/anthropic.d.ts +2 -0
- package/dist/wire/formats/openai.d.ts +5 -0
- package/dist/wire/index.d.ts +16 -0
- package/dist/wire/media-types.d.ts +106 -0
- package/dist/wire/read.d.ts +26 -0
- package/dist/wire/sink-helpers.d.ts +21 -0
- package/dist/wire/sse.d.ts +33 -0
- package/dist/wire.d.ts +5 -53
- package/dist/wire.js +1126 -0
- package/frameworks/react/index.tsx +191 -158
- package/frameworks/react/runtime.tsx +21 -1
- package/frameworks/react/use-kai-chat.tsx +11 -1
- package/llms-full.txt +774 -151
- package/llms.txt +57 -5
- package/package.json +62 -8
- package/src/agent-tooling/archetypes.ts +127 -0
- package/src/agent-tooling/integrations/anthropic.ts +436 -0
- package/src/agent-tooling/integrations/cloudflare.ts +141 -52
- package/src/agent-tooling/integrations/langgraph.ts +80 -13
- package/src/agent-tooling/integrations/mastra.ts +161 -12
- package/src/agent-tooling/integrations/mock.ts +47 -8
- package/src/agent-tooling/integrations/ollama.ts +68 -24
- package/src/agent-tooling/integrations/openai.ts +89 -0
- package/src/agent-tooling/integrations/openrouter.ts +58 -8
- package/src/agent-tooling/integrations/pi.ts +104 -23
- package/src/agent-tooling/integrations/pydantic-ai.ts +61 -5
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +120 -13
- package/src/agent-tooling/mcp/manifest.ts +206 -25
- package/src/agent-tooling/mcp/tools/debug.ts +13 -7
- package/src/agent-tooling/mcp/tools/reference.ts +285 -6
- package/src/agent-tooling/mcp/tools/scaffold.ts +4152 -661
- package/src/agent-tooling/registry.ts +74 -0
- package/src/agent-tooling/types.ts +361 -1
- package/src/components/artifact-card.tsx +120 -0
- package/src/components/audio-visualizer/index.tsx +9 -0
- package/src/components/audio-visualizer/labs/lab-choreography.ts +187 -0
- package/src/components/audio-visualizer/labs/lab-shaders.ts +363 -0
- package/src/components/audio-visualizer/labs/lab-visualizer.tsx +102 -0
- package/src/components/audio-visualizer/shader-canvas.tsx +31 -1
- package/src/components/card-fallback.tsx +42 -10
- package/src/components/card-renderer.tsx +146 -9
- package/src/components/chat-container.tsx +4 -0
- package/src/components/chat-thread.tsx +128 -52
- package/src/components/choice-card.tsx +17 -29
- package/src/components/composer.tsx +12 -2
- package/src/components/confirm-card.tsx +24 -20
- package/src/components/context.tsx +30 -16
- package/src/components/conversation-item.tsx +6 -0
- package/src/components/conversation-list.tsx +18 -2
- package/src/components/file-tree.tsx +11 -22
- package/src/components/file-upload.tsx +14 -8
- package/src/components/form.tsx +14 -47
- package/src/components/loader.tsx +39 -12
- package/src/components/message-skills.tsx +4 -0
- package/src/components/message.tsx +294 -46
- package/src/components/model-switcher.tsx +38 -8
- package/src/components/reasoning.tsx +92 -5
- package/src/components/response-compare-types.ts +25 -0
- package/src/components/response-compare.tsx +4 -9
- package/src/components/source.tsx +50 -24
- package/src/components/tasks-card.tsx +10 -33
- package/src/components/thread.tsx +84 -42
- package/src/components/toast.tsx +17 -6
- package/src/components/tool-classify.ts +26 -0
- package/src/components/tool-types.ts +31 -1
- package/src/elements/agent-card.tsx +11 -11
- package/src/elements/artifact.tsx +15 -7
- package/src/elements/attachments.tsx +6 -4
- package/src/elements/avatar.tsx +1 -1
- package/src/elements/button.tsx +29 -6
- package/src/elements/card.tsx +2 -2
- package/src/elements/cards.tsx +109 -14
- package/src/elements/chain-of-thought.tsx +14 -10
- package/src/elements/chat-scope-picker.tsx +9 -7
- package/src/elements/chat-types.ts +59 -6
- package/src/elements/chat-workspace.tsx +50 -9
- package/src/elements/chat.tsx +90 -3
- package/src/elements/choice.tsx +8 -8
- package/src/elements/coachmark.tsx +1 -1
- package/src/elements/command.tsx +8 -23
- package/src/elements/compare.tsx +7 -6
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +8 -8
- package/src/elements/confirm-card.tsx +9 -9
- package/src/elements/context-meter.tsx +4 -18
- package/src/elements/conversation-list.tsx +14 -9
- package/src/elements/default-input.tsx +131 -8
- package/src/elements/define.tsx +178 -43
- package/src/elements/editable-label.tsx +17 -2
- package/src/elements/element-data-types.ts +112 -0
- package/src/elements/element-meta.json +1624 -306
- package/src/elements/element-types.d.ts +2645 -214
- package/src/elements/feedback-bar.tsx +1 -1
- package/src/elements/file-tree.tsx +1 -1
- package/src/elements/file-upload.tsx +1 -1
- package/src/elements/form.tsx +14 -6
- package/src/elements/input.tsx +1 -1
- package/src/elements/kbd.tsx +1 -1
- package/src/elements/menu.tsx +40 -32
- package/src/elements/message-skills.tsx +7 -9
- package/src/elements/message.tsx +200 -32
- package/src/elements/model-switcher.tsx +5 -3
- package/src/elements/pane.tsx +1 -1
- package/src/elements/prompt-dock.tsx +8 -8
- package/src/elements/prompt-input.tsx +10 -10
- package/src/elements/prompt-suggestions.tsx +7 -4
- package/src/elements/reasoning.tsx +1 -1
- package/src/elements/register.ts +9 -0
- package/src/elements/resizable.globals.d.ts +36 -0
- package/src/elements/resizable.tsx +24 -13
- package/src/elements/response-stream.tsx +1 -1
- package/src/elements/scroll-button.tsx +1 -1
- package/src/elements/search.tsx +6 -1
- package/src/elements/segmented.tsx +5 -11
- package/src/elements/separator.tsx +1 -1
- package/src/elements/slot-text.ts +73 -0
- package/src/elements/slots.ts +67 -24
- package/src/elements/source.tsx +21 -22
- package/src/elements/switch.tsx +3 -3
- package/src/elements/tasks.tsx +5 -4
- package/src/elements/thread.tsx +36 -4
- package/src/elements/toast.tsx +3 -2
- package/src/elements/tool.tsx +1 -1
- package/src/elements/validate-messages.ts +76 -0
- package/src/elements/voice-input.tsx +7 -7
- package/src/elements/voice-output.tsx +4 -4
- package/src/index.ts +145 -6
- package/src/primitives/card-component-types.ts +63 -0
- package/src/primitives/card-data-types.ts +312 -0
- package/src/primitives/card-recovery.ts +13 -2
- package/src/primitives/card-registry.tsx +34 -23
- package/src/primitives/card-schemas/artifact.schema.json +92 -0
- package/src/primitives/card-schemas/embed.schema.json +0 -2
- package/src/primitives/card-schemas/link.schema.json +0 -2
- package/src/primitives/card-tags.ts +61 -0
- package/src/primitives/card-validate-cards.ts +255 -0
- package/src/primitives/card-validate-generator.testlib.ts +38 -0
- package/src/primitives/card-validate-schemas.ts +58 -0
- package/src/primitives/card-validate.ts +48 -20
- package/src/primitives/create-tween.ts +54 -2
- package/src/primitives/message-feedback.ts +3 -2
- package/src/primitives/use-audio-analysis.ts +20 -1
- package/src/primitives/use-sequencer.ts +20 -1
- package/src/schemas/from-tool-call.ts +151 -0
- package/src/schemas/index.ts +340 -0
- package/src/schemas/provider-subsets.ts +538 -0
- package/src/schemas/registry.ts +355 -0
- package/src/schemas/tool-defs.ts +492 -0
- package/src/solid.ts +150 -0
- package/src/state/index.ts +27 -1
- package/src/state/messages.ts +21 -4
- package/src/state/mock.ts +211 -0
- package/src/state/parts.ts +295 -0
- package/src/state/stream.ts +56 -58
- package/src/ui/collapsible.tsx +17 -5
- package/src/ui/dropdown.tsx +46 -12
- package/src/ui/overlay.tsx +10 -4
- package/src/wire/chunk.ts +201 -0
- package/src/wire/consume.ts +440 -0
- package/src/wire/encode.ts +689 -0
- package/src/wire/files.ts +342 -0
- package/src/wire/formats/anthropic.ts +267 -0
- package/src/wire/formats/openai.ts +187 -0
- package/src/wire/index.ts +73 -0
- package/src/wire/media-types.ts +344 -0
- package/src/wire/read.ts +152 -0
- package/src/wire/sink-helpers.ts +50 -0
- package/src/wire/sse.ts +140 -0
- package/dist/create-tween-hvpmSuwW.js +0 -7
- package/dist/elements/chunks/arrow-left-DQocUFvy.js +0 -1
- package/dist/elements/chunks/audio-visualizer-BqNy7dfm.js +0 -1
- package/dist/elements/chunks/card-BkHbp4BA.js +0 -1
- package/dist/elements/chunks/chat-thread-CkRN6pZ7.js +0 -1
- package/dist/elements/chunks/check-B9-gn6SS.js +0 -1
- package/dist/elements/chunks/chevron-down-BNsxc2hk.js +0 -1
- package/dist/elements/chunks/chevron-right-Hv00StBO.js +0 -1
- package/dist/elements/chunks/circle-0e3KJTDr.js +0 -1
- package/dist/elements/chunks/circle-check-BNAS0JEy.js +0 -1
- package/dist/elements/chunks/code-block-BFUHn6Va.js +0 -1
- package/dist/elements/chunks/context-Cb7k4F-v.js +0 -1
- package/dist/elements/chunks/conversation-list-CvoAkWhN.js +0 -1
- package/dist/elements/chunks/create-tween-oVvAIG8r.js +0 -7
- package/dist/elements/chunks/default-input-Cqqilg9t.js +0 -1
- package/dist/elements/chunks/define-D1din7Ld.js +0 -1
- package/dist/elements/chunks/hover-card-Cmm6Q53m.js +0 -1
- package/dist/elements/chunks/message-BqyXDN3-.js +0 -1
- package/dist/elements/chunks/message-feedback-Djr3z6Yb.js +0 -1
- package/dist/elements/chunks/message-square-vFAgbDaX.js +0 -1
- package/dist/elements/chunks/model-switcher-B94YAKsM.js +0 -1
- package/dist/elements/chunks/reasoning-DTpCGtnY.js +0 -1
- package/dist/elements/chunks/scroll-button-B0cH5fXf.js +0 -1
- package/dist/elements/chunks/skeleton-DSXW5Yya.js +0 -1
- package/dist/elements/chunks/slots--V19HwUb.js +0 -1
- package/dist/elements/chunks/textarea-CUwqAX0G.js +0 -1
- package/dist/elements/chunks/tooltip-CgBZCVKp.js +0 -1
- package/dist/elements/chunks/use-card-resolution-BSu_XHjH.js +0 -1
- package/dist/elements/chunks/x-GRUeeQFT.js +0 -1
- package/dist/host-embed.d.ts +0 -33
- package/dist/kai-provider.d.ts +0 -2
- package/dist/origin.d.ts +0 -5
- package/dist/provider-runtime.d.ts +0 -27
- package/dist/register-impl-DQyejdfb.js +0 -145
- package/dist/validate.d.ts +0 -4
- package/dist/version.d.ts +0 -4
- package/src/components/component-meta.json +0 -4550
- package/src/elements/card-media.jpg +0 -0
- package/src/elements/resizable.d.ts +0 -27
- package/src/elements/video-poster.jpg +0 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
// Card schemas -> provider tool definitions.
|
|
2
|
+
//
|
|
3
|
+
// THE PROBLEM THIS SOLVES
|
|
4
|
+
// -----------------------
|
|
5
|
+
// A developer who wants a model to produce a `confirm` card today hand-writes a tool
|
|
6
|
+
// definition that approximates a schema they cannot import, then hand-writes a mapper
|
|
7
|
+
// from the model's arguments back to a CardEnvelope. This repo's own reference
|
|
8
|
+
// harness does exactly that and says so in a comment
|
|
9
|
+
// (examples/internal/openrouter-spike/src/tools.ts). That is the same shape written
|
|
10
|
+
// in five places. This file removes two of them: the tool definition is GENERATED
|
|
11
|
+
// from the schema the card already validates against, so it cannot drift.
|
|
12
|
+
//
|
|
13
|
+
// WHAT THIS FILE IS NOT
|
|
14
|
+
// ---------------------
|
|
15
|
+
// It is not a provider client and it never becomes one. No `openai`, no
|
|
16
|
+
// `@anthropic-ai/sdk`, no `fetch`. The provider envelope shapes below are declared
|
|
17
|
+
// here as plain structural types, which is what lets `@kitn.ai/ui` keep its rule that
|
|
18
|
+
// nothing under `src/` depends on a provider SDK. The kit PARSES and PROJECTS; the
|
|
19
|
+
// consumer FETCHES.
|
|
20
|
+
//
|
|
21
|
+
// THE HEADLINE, MEASURED, NOT RECALLED
|
|
22
|
+
// ------------------------------------
|
|
23
|
+
// `strict: true` currently throws for EVERY built-in card on BOTH providers. That is
|
|
24
|
+
// not a bug in this file, it is what the schemas say when you hold them against the
|
|
25
|
+
// two documented subsets (see provider-subsets.ts for the two source docs). The
|
|
26
|
+
// authored schemas use `minLength` (confirm/choice/tasks), `maxLength` +
|
|
27
|
+
// `format: "uri"` (link/embed/artifact), `minimum` (tasks/embed/artifact),
|
|
28
|
+
// `maxItems` (confirm/artifact), `pattern` (embed), `if`/`then` (embed), `oneOf`
|
|
29
|
+
// (artifact), a free-form object (form) and untyped `payload`/`allowOther` members
|
|
30
|
+
// (confirm/choice). Non-strict is therefore not merely the default, it is currently
|
|
31
|
+
// the only working mode, and it is also the mode the five-configuration conformance
|
|
32
|
+
// spike actually proved cards in.
|
|
33
|
+
//
|
|
34
|
+
// The alternative was to silently drop the offending keywords. That is rejected for
|
|
35
|
+
// the reason the plan gives: a dropped `maxItems: 4` means the model emits six
|
|
36
|
+
// actions and the card renders six buttons, with nothing anywhere saying the contract
|
|
37
|
+
// was quietly loosened. A throw that NAMES the card, the path and the keyword is a
|
|
38
|
+
// signal on the developer's own machine, which is the whole point.
|
|
39
|
+
|
|
40
|
+
import { toolNameForCardType } from './from-tool-call';
|
|
41
|
+
import { cardSchemas } from './index';
|
|
42
|
+
import type { CardSchema, CardSchemaName } from './index';
|
|
43
|
+
import {
|
|
44
|
+
ANTHROPIC_STRICT,
|
|
45
|
+
OPENAI_STRICT,
|
|
46
|
+
checkProviderSubset,
|
|
47
|
+
type ProviderSubset,
|
|
48
|
+
type StrictProviderId,
|
|
49
|
+
type SubsetViolation,
|
|
50
|
+
} from './provider-subsets';
|
|
51
|
+
|
|
52
|
+
// THE TOOL NAME IS NOT SPELLED HERE
|
|
53
|
+
// ---------------------------------
|
|
54
|
+
// `kai_confirm` is produced by `toolNameForCardType()` in ./from-tool-call, which
|
|
55
|
+
// also owns the inverse (`cardTypeFromToolName`). Both directions come off one
|
|
56
|
+
// string in one module on purpose. If this file wrote `'kai_' + type` instead, the
|
|
57
|
+
// two halves could drift, and the symptom would be a model dutifully calling
|
|
58
|
+
// `kai_confirm` while the loop's parser looks for something else and routes it to
|
|
59
|
+
// `runTool`, where it disappears with no error anywhere.
|
|
60
|
+
//
|
|
61
|
+
// A `toolPrefix` OVERRIDE IS NOT SHIPPED, AND THAT IS A DECISION.
|
|
62
|
+
// The plan reserves `createCardRegistry({ toolPrefix })` for Phase 2. It is
|
|
63
|
+
// deliberately NOT stubbed in here, because the inverse hard-codes the `kai_` prefix:
|
|
64
|
+
// a `toolPrefix` honoured on this side alone would generate tools the parser cannot
|
|
65
|
+
// recognise, which is a worse failure than not having the option. The seam is the
|
|
66
|
+
// `CardToolSource` interface below; the override lands in both directions in one
|
|
67
|
+
// change, or not at all.
|
|
68
|
+
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
// Provider envelope shapes, declared here rather than imported from an SDK
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
/** A projected schema. Deliberately loose: `type` may become `['string','null']`. */
|
|
74
|
+
export type ToolParameters = Readonly<Record<string, unknown>>;
|
|
75
|
+
|
|
76
|
+
/** `POST /v1/chat/completions` and `/v1/responses` tool entries. */
|
|
77
|
+
export interface OpenAIToolDef {
|
|
78
|
+
readonly type: 'function';
|
|
79
|
+
readonly function: {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly description: string;
|
|
82
|
+
readonly parameters: ToolParameters;
|
|
83
|
+
readonly strict?: true;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `POST /v1/messages` tool entries. Note `input_schema`, NOT `function.parameters`. */
|
|
88
|
+
export interface AnthropicToolDef {
|
|
89
|
+
readonly name: string;
|
|
90
|
+
readonly description: string;
|
|
91
|
+
readonly input_schema: ToolParameters;
|
|
92
|
+
readonly strict?: true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The bare form, for the Vercel AI SDK and anything else that wants the schema
|
|
97
|
+
* without a provider envelope: `tool({ inputSchema: jsonSchema(def.schema) })`.
|
|
98
|
+
*
|
|
99
|
+
* First-class, not a fallback. A developer on `ai@7` defines tools with Zod, and
|
|
100
|
+
* handing them an OpenAI-shaped envelope they have to unwrap makes our JSON Schema an
|
|
101
|
+
* awkward second source of truth instead of the one they use.
|
|
102
|
+
*/
|
|
103
|
+
export interface JsonSchemaToolDef {
|
|
104
|
+
readonly name: string;
|
|
105
|
+
readonly description: string;
|
|
106
|
+
readonly schema: ToolParameters;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type ToolProvider = 'openai' | 'anthropic' | 'jsonschema';
|
|
110
|
+
|
|
111
|
+
export type ToolDefFor<P extends ToolProvider> = P extends 'openai'
|
|
112
|
+
? OpenAIToolDef
|
|
113
|
+
: P extends 'anthropic'
|
|
114
|
+
? AnthropicToolDef
|
|
115
|
+
: JsonSchemaToolDef;
|
|
116
|
+
|
|
117
|
+
export type ToolDef = OpenAIToolDef | AnthropicToolDef | JsonSchemaToolDef;
|
|
118
|
+
|
|
119
|
+
export interface CardToolOptions<P extends ToolProvider = ToolProvider> {
|
|
120
|
+
readonly provider: P;
|
|
121
|
+
/**
|
|
122
|
+
* Opt in to the provider's grammar-constrained mode.
|
|
123
|
+
*
|
|
124
|
+
* Default `false`, because that is the mode the conformance sweep proved cards in
|
|
125
|
+
* and because, today, `true` throws for every built-in card on both providers.
|
|
126
|
+
* When it throws it names the card, the path and the keyword.
|
|
127
|
+
*/
|
|
128
|
+
readonly strict?: boolean;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Where the card types come from.
|
|
133
|
+
*
|
|
134
|
+
* Phase 1 hands this the built-in `cardSchemas` map directly. Phase 2's
|
|
135
|
+
* `createCardRegistry()` returns an object that is structurally a `CardToolSource`,
|
|
136
|
+
* so `cardTools(registry, opts)` starts working on custom card types without this
|
|
137
|
+
* signature changing. That is the seam, left open on purpose and not built yet.
|
|
138
|
+
*/
|
|
139
|
+
export interface CardToolSource {
|
|
140
|
+
readonly schemas: Readonly<Record<string, CardSchema>>;
|
|
141
|
+
/** Tool descriptions by card type. Falls back to the built-in copy, then the schema's own. */
|
|
142
|
+
readonly descriptions?: Readonly<Record<string, string>>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type CardToolInput = CardToolSource | Readonly<Record<string, CardSchema>>;
|
|
146
|
+
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// Tool descriptions
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* What each card is FOR, addressed to a model.
|
|
153
|
+
*
|
|
154
|
+
* This is not a sixth copy of a shape. The shape stays in the JSON Schema and is
|
|
155
|
+
* never restated here; these are one sentence each of purpose, which exists nowhere
|
|
156
|
+
* else, and which a schema's own `description` ("Data payload for a `confirm` card")
|
|
157
|
+
* does not provide because it is written for a developer reading the contract.
|
|
158
|
+
*
|
|
159
|
+
* Typed as an exhaustive `Record<CardSchemaName, string>`, so adding an eighth card
|
|
160
|
+
* type fails `tsc` here rather than silently shipping a tool with no description.
|
|
161
|
+
*/
|
|
162
|
+
export const CARD_TOOL_DESCRIPTIONS: Readonly<Record<CardSchemaName, string>> = Object.freeze({
|
|
163
|
+
confirm:
|
|
164
|
+
'Show the user an approval card and wait for their decision before you act. Use this whenever you are about to do something consequential, destructive or irreversible.',
|
|
165
|
+
choice:
|
|
166
|
+
'Ask the user to pick exactly one option from a list of rich choices. Use this instead of asking in prose when the options are known and finite.',
|
|
167
|
+
tasks:
|
|
168
|
+
'Show the user a checklist they can tick, either to select several items for you to act on or to track progress through a sequence of steps.',
|
|
169
|
+
form: 'Ask the user for structured input by rendering a form. The data is itself a JSON Schema describing the fields to collect.',
|
|
170
|
+
link: 'Show a rich preview of a web page: title, description, image and domain. The card renders what you supply and never fetches the page itself.',
|
|
171
|
+
embed: 'Embed a video player (YouTube, Vimeo, or a direct player URL) inline in the conversation.',
|
|
172
|
+
artifact:
|
|
173
|
+
'Show something you built (a page, an app, a set of files) in a framed preview with its source alongside, so the user can look at both.',
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// The error
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
export interface UnsupportedCardTool {
|
|
181
|
+
readonly cardType: string;
|
|
182
|
+
readonly toolName: string;
|
|
183
|
+
readonly violations: readonly SubsetViolation[];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Thrown by `cardTools(..., { strict: true })` when a card cannot be expressed in the
|
|
188
|
+
* provider's strict subset.
|
|
189
|
+
*
|
|
190
|
+
* Carries the structured detail as well as the message, so a build script can render
|
|
191
|
+
* it however it likes rather than parsing prose.
|
|
192
|
+
*/
|
|
193
|
+
export class UnsupportedCardToolSchemaError extends Error {
|
|
194
|
+
override readonly name = 'UnsupportedCardToolSchemaError';
|
|
195
|
+
readonly provider: StrictProviderId;
|
|
196
|
+
readonly source: string;
|
|
197
|
+
readonly cards: readonly UnsupportedCardTool[];
|
|
198
|
+
|
|
199
|
+
constructor(subset: ProviderSubset, cards: readonly UnsupportedCardTool[]) {
|
|
200
|
+
super(formatUnsupported(subset, cards));
|
|
201
|
+
this.provider = subset.id;
|
|
202
|
+
this.source = subset.source;
|
|
203
|
+
this.cards = cards;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Every distinct keyword named across every failing card, deduped, in order. */
|
|
207
|
+
get keywords(): string[] {
|
|
208
|
+
const seen = new Set<string>();
|
|
209
|
+
for (const card of this.cards) for (const v of card.violations) seen.add(v.keyword);
|
|
210
|
+
return [...seen];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function formatUnsupported(subset: ProviderSubset, cards: readonly UnsupportedCardTool[]): string {
|
|
215
|
+
const lines: string[] = [];
|
|
216
|
+
const plural = cards.length === 1 ? 'card type' : 'card types';
|
|
217
|
+
lines.push(`${cards.length} ${plural} cannot be a STRICT tool definition under ${subset.label}:`);
|
|
218
|
+
for (const card of cards) {
|
|
219
|
+
lines.push('');
|
|
220
|
+
lines.push(` ${card.toolName} (card type "${card.cardType}") — ${card.violations.length} problem(s):`);
|
|
221
|
+
for (const v of card.violations) {
|
|
222
|
+
lines.push(` ${v.path}: \`${v.keyword}\` — ${v.reason}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
lines.push('');
|
|
226
|
+
lines.push(` subset source: ${subset.source} (read ${subset.checkedOn})`);
|
|
227
|
+
lines.push(
|
|
228
|
+
' Fix: drop `strict: true`. Non-strict is the default and is the mode the kit\'s cards are proven in; both providers accept a loose schema there and ignore what they do not compile. Rewriting a built-in card schema to fit a strict subset would change what a valid card IS, which is a card-contract change, not a projection setting.',
|
|
229
|
+
);
|
|
230
|
+
return lines.join('\n');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
// The projection
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
|
|
237
|
+
const isRecord = (v: unknown): v is Record<string, unknown> =>
|
|
238
|
+
typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Keywords stripped from every projection, strict or not.
|
|
242
|
+
*
|
|
243
|
+
* `$schema` and `$id` are meta: they address the document, they do not describe the
|
|
244
|
+
* instance, and neither provider's subset lists them. `x-kai-*` are our own UI hints
|
|
245
|
+
* (`x-kai-control: "tone"` tells a renderer to draw a tone picker); a model has no
|
|
246
|
+
* use for them, they cost tokens in every request, and under strict they are an
|
|
247
|
+
* unlisted keyword. Stripping them is not a downgrade of the contract, because they
|
|
248
|
+
* never constrained an instance in the first place.
|
|
249
|
+
*/
|
|
250
|
+
function isStrippedKeyword(key: string): boolean {
|
|
251
|
+
return key === '$schema' || key === '$id' || key.startsWith('x-');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const SUBSCHEMA_KEYS = ['items', 'if', 'then', 'else', 'not', 'contains', 'propertyNames', 'unevaluatedItems', 'additionalItems'];
|
|
255
|
+
const SUBSCHEMA_MAP_KEYS = ['properties', 'patternProperties', '$defs', 'definitions', 'dependentSchemas'];
|
|
256
|
+
const SUBSCHEMA_LIST_KEYS = ['allOf', 'anyOf', 'oneOf', 'prefixItems'];
|
|
257
|
+
|
|
258
|
+
interface ProjectOptions {
|
|
259
|
+
/** Force `additionalProperties: false` on every object. Both strict subsets demand it. */
|
|
260
|
+
readonly closeObjects: boolean;
|
|
261
|
+
/** Put every property in `required`, widening the newly-required ones with `null`. OpenAI only. */
|
|
262
|
+
readonly requireEveryProperty: boolean;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Rewrite a schema for the wire.
|
|
267
|
+
*
|
|
268
|
+
* Only ever REMOVES metadata or ADDS what a provider mandates. It never drops a
|
|
269
|
+
* constraint, which is the invariant that keeps a projected tool definition and the
|
|
270
|
+
* card's own validator describing the same set of valid cards.
|
|
271
|
+
*/
|
|
272
|
+
function project(node: unknown, opts: ProjectOptions): unknown {
|
|
273
|
+
if (!isRecord(node)) return node;
|
|
274
|
+
|
|
275
|
+
const out: Record<string, unknown> = {};
|
|
276
|
+
for (const [key, value] of Object.entries(node)) {
|
|
277
|
+
if (isStrippedKeyword(key)) continue;
|
|
278
|
+
out[key] = value;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Recurse. `properties` KEYS are arbitrary names, not keywords: form.schema.json
|
|
282
|
+
// has properties literally called `properties` and `x-kai-order`, and stripping
|
|
283
|
+
// those would delete real fields rather than metadata.
|
|
284
|
+
for (const key of SUBSCHEMA_MAP_KEYS) {
|
|
285
|
+
const map = out[key];
|
|
286
|
+
if (!isRecord(map)) continue;
|
|
287
|
+
const next: Record<string, unknown> = {};
|
|
288
|
+
for (const [name, child] of Object.entries(map)) next[name] = project(child, opts);
|
|
289
|
+
out[key] = next;
|
|
290
|
+
}
|
|
291
|
+
for (const key of SUBSCHEMA_KEYS) {
|
|
292
|
+
if (!(key in out) || typeof out[key] === 'boolean') continue;
|
|
293
|
+
out[key] = project(out[key], opts);
|
|
294
|
+
}
|
|
295
|
+
if (isRecord(out.additionalProperties)) out.additionalProperties = project(out.additionalProperties, opts);
|
|
296
|
+
for (const key of SUBSCHEMA_LIST_KEYS) {
|
|
297
|
+
const list = out[key];
|
|
298
|
+
if (!Array.isArray(list)) continue;
|
|
299
|
+
out[key] = list.map((child) => project(child, opts));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const props = isRecord(out.properties) ? out.properties : undefined;
|
|
303
|
+
const looksLikeObject = out.type === 'object' || props !== undefined;
|
|
304
|
+
|
|
305
|
+
if (looksLikeObject && opts.closeObjects && !('additionalProperties' in out)) {
|
|
306
|
+
out.additionalProperties = false;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (looksLikeObject && opts.requireEveryProperty && props) {
|
|
310
|
+
const originallyRequired = Array.isArray(out.required) ? out.required.map(String) : [];
|
|
311
|
+
const all = Object.keys(props);
|
|
312
|
+
for (const name of all) {
|
|
313
|
+
if (originallyRequired.includes(name)) continue;
|
|
314
|
+
props[name] = widenWithNull(props[name]);
|
|
315
|
+
}
|
|
316
|
+
out.required = all;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return out;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* OpenAI's documented emulation of an optional field: keep it in `required` and let
|
|
324
|
+
* its type admit `null`.
|
|
325
|
+
*
|
|
326
|
+
* The `enum` half matters. `{ type: ['string','null'], enum: ['a','b'] }` admits
|
|
327
|
+
* nothing new, because the enum still excludes null, so the field would be required
|
|
328
|
+
* AND unsatisfiable-as-absent. `null` therefore joins the enum too.
|
|
329
|
+
*
|
|
330
|
+
* A subschema with nothing to widen (no `type`, no `anyOf`) is returned untouched.
|
|
331
|
+
* That is not a silent pass: `checkProviderSubset` reports it as an untyped
|
|
332
|
+
* subschema, which is the real problem and a truer message than "could not widen".
|
|
333
|
+
*/
|
|
334
|
+
function widenWithNull(sub: unknown): unknown {
|
|
335
|
+
if (!isRecord(sub)) return sub;
|
|
336
|
+
const out: Record<string, unknown> = { ...sub };
|
|
337
|
+
|
|
338
|
+
if ('type' in out) {
|
|
339
|
+
const declared = Array.isArray(out.type) ? out.type.map(String) : [String(out.type)];
|
|
340
|
+
if (!declared.includes('null')) out.type = [...declared, 'null'];
|
|
341
|
+
} else if (Array.isArray(out.anyOf)) {
|
|
342
|
+
if (!out.anyOf.some((b) => isRecord(b) && b.type === 'null')) out.anyOf = [...out.anyOf, { type: 'null' }];
|
|
343
|
+
} else {
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (Array.isArray(out.enum) && !out.enum.includes(null)) out.enum = [...out.enum, null];
|
|
348
|
+
return out;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ---------------------------------------------------------------------------
|
|
352
|
+
// cardTools
|
|
353
|
+
// ---------------------------------------------------------------------------
|
|
354
|
+
|
|
355
|
+
function normalizeSource(input: CardToolInput): {
|
|
356
|
+
schemas: Readonly<Record<string, CardSchema>>;
|
|
357
|
+
descriptions: Readonly<Record<string, string>>;
|
|
358
|
+
} {
|
|
359
|
+
// A `CardToolSource` is recognised by carrying a `schemas` map. A bare
|
|
360
|
+
// `Record<type, CardSchema>` cannot collide with that unless someone names a card
|
|
361
|
+
// type "schemas" AND its schema document is itself a map of schema documents,
|
|
362
|
+
// which is not a shape the card contract can produce.
|
|
363
|
+
const maybe = input as Partial<CardToolSource>;
|
|
364
|
+
if (isRecord(maybe.schemas)) {
|
|
365
|
+
return { schemas: maybe.schemas, descriptions: maybe.descriptions ?? {} };
|
|
366
|
+
}
|
|
367
|
+
return { schemas: input as Readonly<Record<string, CardSchema>>, descriptions: {} };
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function describe(cardType: string, schema: CardSchema, overrides: Readonly<Record<string, string>>): string {
|
|
371
|
+
const custom = overrides[cardType];
|
|
372
|
+
if (typeof custom === 'string' && custom.length > 0) return custom;
|
|
373
|
+
const builtIn = (CARD_TOOL_DESCRIPTIONS as Readonly<Record<string, string>>)[cardType];
|
|
374
|
+
if (typeof builtIn === 'string' && builtIn.length > 0) return builtIn;
|
|
375
|
+
// Last resort for a custom card type registered without a description. The schema's
|
|
376
|
+
// own prose is worse guidance than a purpose sentence, but it beats an empty string,
|
|
377
|
+
// and Phase 2's registry warns when a type arrives with neither.
|
|
378
|
+
const own = schema.description;
|
|
379
|
+
return typeof own === 'string' && own.length > 0 ? own : `Render a \`${cardType}\` card.`;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Project the card schemas into tool definitions for one provider.
|
|
384
|
+
*
|
|
385
|
+
* ```ts
|
|
386
|
+
* const tools = [...myTools, ...cardTools({ provider: 'openai' })];
|
|
387
|
+
* const tools = cardTools(cards, { provider: 'anthropic' });
|
|
388
|
+
* const tools = cardTools({ provider: 'jsonschema' }).map((t) =>
|
|
389
|
+
* tool({ description: t.description, inputSchema: jsonSchema(t.schema) }));
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @throws {UnsupportedCardToolSchemaError} with `strict: true`, naming every card,
|
|
393
|
+
* path and keyword the provider cannot express. See the file header: today that is
|
|
394
|
+
* every built-in card on both providers.
|
|
395
|
+
*/
|
|
396
|
+
export function cardTools<P extends ToolProvider>(opts: CardToolOptions<P>): ToolDefFor<P>[];
|
|
397
|
+
export function cardTools<P extends ToolProvider>(registry: CardToolInput, opts: CardToolOptions<P>): ToolDefFor<P>[];
|
|
398
|
+
export function cardTools(a: CardToolInput | CardToolOptions, b?: CardToolOptions): ToolDef[] {
|
|
399
|
+
// Single-argument form: `cardTools({ provider: 'openai' })` defaults the registry
|
|
400
|
+
// to the built-ins, which is the shape the developer-facing docs lead with.
|
|
401
|
+
const optionsOnly = b === undefined;
|
|
402
|
+
const opts = (optionsOnly ? (a as CardToolOptions) : (b as CardToolOptions));
|
|
403
|
+
if (!isRecord(opts) || typeof opts.provider !== 'string') {
|
|
404
|
+
throw new TypeError('cardTools: an options object with a `provider` is required, e.g. cardTools({ provider: "openai" })');
|
|
405
|
+
}
|
|
406
|
+
const { schemas, descriptions } = normalizeSource(
|
|
407
|
+
optionsOnly ? (builtInSchemas() as CardToolInput) : (a as CardToolInput),
|
|
408
|
+
);
|
|
409
|
+
const strict = opts.strict === true;
|
|
410
|
+
|
|
411
|
+
if (opts.provider === 'jsonschema' && strict) {
|
|
412
|
+
throw new TypeError(
|
|
413
|
+
'cardTools: `strict: true` is provider-specific and cannot be checked for `provider: "jsonschema"`, ' +
|
|
414
|
+
'because the two documented strict subsets differ (see @kitn.ai/ui/schemas provider-subsets). ' +
|
|
415
|
+
'Pass provider "openai" or "anthropic" to project and check strictly, or drop `strict`.',
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const subset: ProviderSubset | null = strict
|
|
420
|
+
? opts.provider === 'openai'
|
|
421
|
+
? OPENAI_STRICT
|
|
422
|
+
: ANTHROPIC_STRICT
|
|
423
|
+
: null;
|
|
424
|
+
|
|
425
|
+
const projectOptions: ProjectOptions = {
|
|
426
|
+
closeObjects: subset !== null,
|
|
427
|
+
requireEveryProperty: subset !== null && subset.requireAllPropertiesRequired,
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const defs: ToolDef[] = [];
|
|
431
|
+
const failures: UnsupportedCardTool[] = [];
|
|
432
|
+
|
|
433
|
+
for (const [cardType, schema] of Object.entries(schemas)) {
|
|
434
|
+
const name = toolNameForCardType(cardType);
|
|
435
|
+
const description = describe(cardType, schema, descriptions);
|
|
436
|
+
const parameters = project(schema, projectOptions) as ToolParameters;
|
|
437
|
+
|
|
438
|
+
if (subset) {
|
|
439
|
+
const violations = checkProviderSubset(parameters, subset);
|
|
440
|
+
if (violations.length > 0) {
|
|
441
|
+
failures.push({ cardType, toolName: name, violations });
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (opts.provider === 'openai') {
|
|
447
|
+
defs.push({ type: 'function', function: { name, description, parameters, ...(strict ? { strict: true as const } : {}) } });
|
|
448
|
+
} else if (opts.provider === 'anthropic') {
|
|
449
|
+
defs.push({ name, description, input_schema: parameters, ...(strict ? { strict: true as const } : {}) });
|
|
450
|
+
} else {
|
|
451
|
+
defs.push({ name, description, schema: parameters });
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (subset && failures.length > 0) throw new UnsupportedCardToolSchemaError(subset, failures);
|
|
456
|
+
return defs;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* The built-in map, read at CALL time.
|
|
461
|
+
*
|
|
462
|
+
* `./index` re-exports this module, and this module imports `cardSchemas` back out
|
|
463
|
+
* of it, which is a genuine ESM import cycle. It is safe because the value is only
|
|
464
|
+
* ever read inside a function body: by the time anyone calls `cardTools()`, both
|
|
465
|
+
* module bodies have finished evaluating and the live binding is populated. Reading
|
|
466
|
+
* it at TOP level here would be a temporal-dead-zone crash, so do not hoist it into
|
|
467
|
+
* a `const`.
|
|
468
|
+
*/
|
|
469
|
+
function builtInSchemas(): Readonly<Record<string, CardSchema>> {
|
|
470
|
+
return cardSchemas;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** `cardTools(registry, { provider: 'openai' })`, spelled out. */
|
|
474
|
+
export function toOpenAITools(registry?: CardToolInput, opts?: { strict?: boolean }): OpenAIToolDef[] {
|
|
475
|
+
return registry === undefined
|
|
476
|
+
? cardTools({ provider: 'openai', strict: opts?.strict })
|
|
477
|
+
: cardTools(registry, { provider: 'openai', strict: opts?.strict });
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** `cardTools(registry, { provider: 'anthropic' })`, spelled out. */
|
|
481
|
+
export function toAnthropicTools(registry?: CardToolInput, opts?: { strict?: boolean }): AnthropicToolDef[] {
|
|
482
|
+
return registry === undefined
|
|
483
|
+
? cardTools({ provider: 'anthropic', strict: opts?.strict })
|
|
484
|
+
: cardTools(registry, { provider: 'anthropic', strict: opts?.strict });
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** `cardTools(registry, { provider: 'jsonschema' })`, spelled out. */
|
|
488
|
+
export function toJsonSchemaTools(registry?: CardToolInput): JsonSchemaToolDef[] {
|
|
489
|
+
return registry === undefined
|
|
490
|
+
? cardTools({ provider: 'jsonschema' })
|
|
491
|
+
: cardTools(registry, { provider: 'jsonschema' });
|
|
492
|
+
}
|
package/src/solid.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// `@kitn.ai/ui/solid` — the COMPLETE SolidJS surface.
|
|
2
|
+
//
|
|
3
|
+
// WHY THIS EXISTS
|
|
4
|
+
// ---------------
|
|
5
|
+
// Solid is this kit's authored layer, so every registered `kai-*` element must be
|
|
6
|
+
// writable as a Solid component (`verify:solid-coverage` enforces 79/79 plus a
|
|
7
|
+
// `<Name>Props` type for every public component). But the root entry "." is what
|
|
8
|
+
// EVERY consumer resolves, including the React/Vue/Svelte/vanilla majority who
|
|
9
|
+
// only ever touch the web components. Growing "." to full Solid coverage cost
|
|
10
|
+
// them 591,359 -> 705,031 bytes (+113,672, +19.2%; +23,160 gzipped) for a surface
|
|
11
|
+
// four of the five supported frameworks cannot even call.
|
|
12
|
+
//
|
|
13
|
+
// So the full Solid catalog lives here instead, and this file is compiled as its
|
|
14
|
+
// OWN build target (vite.config.solid.ts -> dist/solid.js, plus the SSR twin
|
|
15
|
+
// vite.config.solid.server.ts -> dist/solid.server.js, mirroring "."). Nothing
|
|
16
|
+
// below is reachable from dist/index.js, which is the entire point: a React
|
|
17
|
+
// consumer's bundle never sees it.
|
|
18
|
+
//
|
|
19
|
+
// WHY IT COMPOSES "." INSTEAD OF RESTATING IT
|
|
20
|
+
// -------------------------------------------
|
|
21
|
+
// `export * from './index'` makes "./solid is a superset of ." a COMPILER
|
|
22
|
+
// invariant rather than a promise two hand-maintained lists have to keep. This
|
|
23
|
+
// repo has been bitten repeatedly by copied lists that no compiler watches; a
|
|
24
|
+
// restated 400-line barrel would be exactly that, and the failure mode is silent
|
|
25
|
+
// (an export lands on "." only, and Solid consumers never learn it exists).
|
|
26
|
+
//
|
|
27
|
+
// This costs nothing at the package boundary. The composition is resolved at
|
|
28
|
+
// SOURCE level and bundled away: dist/solid.js is a standalone artifact with no
|
|
29
|
+
// runtime dependency on dist/index.js, so importing "./solid" does not drag in a
|
|
30
|
+
// second entry, and importing "." does not drag in any of this.
|
|
31
|
+
//
|
|
32
|
+
// A Solid consumer therefore needs exactly one import:
|
|
33
|
+
// import { Thread, Dialog, Message, type ThreadProps } from '@kitn.ai/ui/solid';
|
|
34
|
+
export * from './index';
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Layer 2 additions: UI primitives the coarse elements render.
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
export { HoverCardRoot, HoverCardTrigger, HoverCardContent } from './ui/hover-card';
|
|
40
|
+
export type {
|
|
41
|
+
HoverCardRootProps, HoverCardTriggerProps, HoverCardContentProps,
|
|
42
|
+
} from './ui/hover-card';
|
|
43
|
+
export {
|
|
44
|
+
DropdownSeparator, DropdownLabel, DropdownCheckboxItem, DropdownRadioItem,
|
|
45
|
+
DropdownSub, DropdownSubTrigger, DropdownSubContent,
|
|
46
|
+
} from './ui/dropdown';
|
|
47
|
+
export type {
|
|
48
|
+
DropdownSeparatorProps, DropdownLabelProps, DropdownCheckboxItemProps, DropdownRadioItemProps,
|
|
49
|
+
DropdownSubProps, DropdownSubTriggerProps, DropdownSubContentProps,
|
|
50
|
+
} from './ui/dropdown';
|
|
51
|
+
export { clampBasis } from './ui/resizable';
|
|
52
|
+
export { Input } from './ui/input';
|
|
53
|
+
export type { InputProps } from './ui/input';
|
|
54
|
+
export { Kbd } from './ui/kbd';
|
|
55
|
+
export type { KbdProps, KbdPlatform } from './ui/kbd';
|
|
56
|
+
export { Switch } from './ui/switch';
|
|
57
|
+
export type { SwitchProps } from './ui/switch';
|
|
58
|
+
export { Tabs } from './ui/tabs';
|
|
59
|
+
export type { TabsProps, TabsVariant, KaiTabItem } from './ui/tabs';
|
|
60
|
+
export { Segmented } from './ui/segmented';
|
|
61
|
+
export type { SegmentedProps, SegmentedOption } from './ui/segmented';
|
|
62
|
+
export { Status } from './ui/status';
|
|
63
|
+
export type { StatusProps, StatusKind } from './ui/status';
|
|
64
|
+
export { ProgressBar } from './ui/progress-bar';
|
|
65
|
+
export type { ProgressBarProps, ProgressTone } from './ui/progress-bar';
|
|
66
|
+
export { Notice } from './ui/notice';
|
|
67
|
+
export type { NoticeProps, NoticeSeverity } from './ui/notice';
|
|
68
|
+
export { EditableLabel } from './ui/editable-label';
|
|
69
|
+
export type { EditableLabelProps } from './ui/editable-label';
|
|
70
|
+
export { Dialog } from './ui/dialog';
|
|
71
|
+
export type { DialogProps, DialogController } from './ui/dialog';
|
|
72
|
+
export { Popover } from './ui/popover';
|
|
73
|
+
export type { PopoverProps, PopoverController } from './ui/popover';
|
|
74
|
+
export { Nav } from './ui/nav';
|
|
75
|
+
export type { NavProps, KaiNavItem, NavItemStatus, NavStatusTone } from './ui/nav';
|
|
76
|
+
export { CommandList } from './ui/command';
|
|
77
|
+
export type { CommandListProps, CommandRow, CommandGroup } from './ui/command';
|
|
78
|
+
export { AgentCard } from './ui/agent-card';
|
|
79
|
+
export type { AgentCardProps, AgentStatus, AgentStatusTone } from './ui/agent-card';
|
|
80
|
+
export { Pane } from './ui/pane';
|
|
81
|
+
export type { PaneProps, PaneStatus, PaneStatusTone } from './ui/pane';
|
|
82
|
+
export { PaneGroup } from './ui/pane-group';
|
|
83
|
+
export type { PaneGroupProps, PaneTab, PaneTabStatus } from './ui/pane-group';
|
|
84
|
+
// PaneGrid and the three overlay primitives have Storybook pages that tell a
|
|
85
|
+
// consumer to `import { … } from '@kitn.ai/ui'` — and were exported from NEITHER
|
|
86
|
+
// entry, so those snippets named symbols nobody could import. They belong on
|
|
87
|
+
// ./solid (Solid-only building blocks, and the overlay trio is what you compose a
|
|
88
|
+
// custom popover/tooltip out of).
|
|
89
|
+
export { PaneGrid } from './ui/pane-grid';
|
|
90
|
+
export type { PaneGridProps } from './ui/pane-grid';
|
|
91
|
+
export { createPresence, usePosition, useDismiss } from './ui/overlay';
|
|
92
|
+
export type { UsePositionOptions, UseDismissOptions, DismissReason } from './ui/overlay';
|
|
93
|
+
export { PromptDock } from './ui/prompt-dock';
|
|
94
|
+
export type { PromptDockProps, PromptDockFrame, PromptDockAppearance } from './ui/prompt-dock';
|
|
95
|
+
export { SettingsGroup, SettingItem } from './ui/settings-group';
|
|
96
|
+
export type { SettingsGroupProps, SettingItemProps } from './ui/settings-group';
|
|
97
|
+
// `kai-icon` renders no kit component — it calls this. Solid consumers resolving
|
|
98
|
+
// the same `icon` strings (named icon | URL | text fallback) need it too.
|
|
99
|
+
export { renderIcon } from './ui/icon';
|
|
100
|
+
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Layer 3 additions: AI/feature components.
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
export { ChainOfThoughtAccordion } from './components/chain-of-thought';
|
|
105
|
+
export type { ChainOfThoughtAccordionProps } from './components/chain-of-thought';
|
|
106
|
+
export { VoiceOutput } from './components/voice-output';
|
|
107
|
+
export type { VoiceOutputProps, VoiceOutputController } from './components/voice-output';
|
|
108
|
+
export { CollapsedRail } from './components/conversation-list';
|
|
109
|
+
export type { CollapsedRailProps } from './components/conversation-list';
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Layer 3b: the composed thread/shell components the coarse elements wrap.
|
|
113
|
+
// These are what `<kai-thread>`, `<kai-chat>`, `<kai-screen>`, `<kai-coachmark>` and
|
|
114
|
+
// `<kai-composer>` render, so a Solid consumer writes one component for one element
|
|
115
|
+
// instead of re-deriving the scroll/feedback/staging behaviour by hand.
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
export { Thread } from './components/thread';
|
|
118
|
+
export type { ThreadProps, ThreadController } from './components/thread';
|
|
119
|
+
// ChatThread — the component behind `<kai-chat>`. VERIFIED standalone: rendered in
|
|
120
|
+
// a plain Vite+Solid app (no custom element, no shadow root) it draws its header,
|
|
121
|
+
// the full message list and its BUILT-IN composer; typing into that composer and
|
|
122
|
+
// pressing Send fires `onSubmit` with the typed text and the thread updates, with
|
|
123
|
+
// no console errors.
|
|
124
|
+
//
|
|
125
|
+
// It does emit 5 `<slot>` elements — header-start, header-end, input-top,
|
|
126
|
+
// toolbar-start, toolbar-end. Those are OPTIONAL INJECT points with no assigned
|
|
127
|
+
// nodes outside the facade, so they render nothing; they are only fillable from
|
|
128
|
+
// `<kai-chat>`'s light DOM. The REPLACE/INJECT props (`sidebar`, `empty`,
|
|
129
|
+
// `composer`, `headerFull`, `footer`, `composerActions`) are opt-in switches that
|
|
130
|
+
// the FACADE sets when a host slots content — left at their default they emit no
|
|
131
|
+
// slot at all and the built-in UI renders. So a Solid consumer can ignore all of
|
|
132
|
+
// it; they just cannot project content into those five points without the element.
|
|
133
|
+
export { ChatThread } from './components/chat-thread';
|
|
134
|
+
export type { ChatThreadProps, ChatThreadController, ChatThreadContextUsage } from './components/chat-thread';
|
|
135
|
+
export { Screen } from './components/screen';
|
|
136
|
+
export type { ScreenProps, ScreenController } from './components/screen';
|
|
137
|
+
export { Coachmark } from './components/coachmark';
|
|
138
|
+
export type { CoachmarkProps, CoachmarkController } from './components/coachmark';
|
|
139
|
+
export { Composer } from './components/composer';
|
|
140
|
+
export type {
|
|
141
|
+
ComposerProps, ComposerController, ComposerChange, TriggerDef, TriggerItem, HighlightRule,
|
|
142
|
+
} from './components/composer';
|
|
143
|
+
// AudioVisualizer — the component behind `<kai-audio-visualizer>`. It arrived on
|
|
144
|
+
// main after this entry was written, and the coverage guard caught it as the one
|
|
145
|
+
// element with no writable SolidJS equivalent, which is exactly the job.
|
|
146
|
+
export { AudioVisualizer } from './components/audio-visualizer';
|
|
147
|
+
export type {
|
|
148
|
+
AudioVisualizerProps, VisualizerVariant, ShaderSpec, ShaderVariantProps,
|
|
149
|
+
} from './components/audio-visualizer';
|
|
150
|
+
export type { VisualizerSize } from './components/audio-visualizer/sizes';
|