@kitn.ai/ui 0.25.1 → 0.26.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 +5 -7
- package/dist/components/attachment-types.d.ts +46 -1
- package/dist/components/attachments.d.ts +31 -0
- package/dist/components/audio-visualizer/fit-scale.d.ts +50 -0
- package/dist/components/audio-visualizer/index.d.ts +15 -1
- package/dist/components/audio-visualizer/variant-bar.d.ts +24 -1
- package/dist/components/chat-thread.d.ts +3 -41
- package/dist/components/code-block.d.ts +22 -0
- package/dist/components/conversation-item.d.ts +54 -1
- package/dist/components/conversation-list.d.ts +65 -0
- package/dist/components/form.d.ts +42 -0
- package/dist/components/message.d.ts +7 -0
- package/dist/components/toast.d.ts +2 -1
- package/dist/components/voice-input.d.ts +8 -0
- package/dist/components/voice-output.d.ts +12 -1
- package/dist/components/workspace-shell.d.ts +87 -0
- package/dist/{create-tween-B5Y4Im8G.js → create-tween-BFT6c-Y8.js} +1 -1
- package/dist/{create-tween-4z1XYLkR.js → create-tween-CJNlzoaO.js} +1 -1
- package/dist/{create-tween-CUzOlaMS.js → create-tween-CQED4T0g.js} +1 -1
- package/dist/custom-elements.json +2931 -2572
- package/dist/diagnostics/hook.d.ts +81 -0
- package/dist/diagnostics/index.d.ts +7 -0
- package/dist/diagnostics/report-request.d.ts +61 -0
- package/dist/diagnostics.d.ts +5 -0
- package/dist/diagnostics.js +209 -0
- 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/autoloader.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-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-b5A8hlHs.js → Icon--Y8vsFal.js} +1 -1
- package/dist/elements/chunks/action-icons-D9u3OzYW.js +1 -0
- package/dist/elements/chunks/arrow-left-CVh1TeN7.js +1 -0
- package/dist/elements/chunks/{artifact-BSuPYFHY.js → artifact-BkYcfIlZ.js} +1 -1
- package/dist/elements/chunks/attachments-DwfNlubq.js +1 -0
- package/dist/elements/chunks/audio-visualizer-D7lB6mvR.js +1 -0
- package/dist/elements/chunks/{badge-TIMiJFKc.js → badge-Q0-Cmwzz.js} +1 -1
- package/dist/elements/chunks/{button-B9okqG73.js → button-flUbeufF.js} +1 -1
- package/dist/elements/chunks/{card-renderer-CSoTL_e1.js → card-renderer-3Dyl-FpN.js} +1 -1
- package/dist/elements/chunks/check-B5kBPKeo.js +1 -0
- package/dist/elements/chunks/chevron-down-DZ1GS39h.js +1 -0
- package/dist/elements/chunks/chevron-right-CvP7OUd2.js +1 -0
- package/dist/elements/chunks/{choice-card-CGMc3kek.js → choice-card-D4QUIOWZ.js} +1 -1
- package/dist/elements/chunks/circle-CDf9g6MQ.js +1 -0
- package/dist/elements/chunks/circle-check-CA47Nqbz.js +1 -0
- package/dist/elements/chunks/{circle-x-mhH7pOK2.js → circle-x-CJ_HVbC8.js} +1 -1
- package/dist/elements/chunks/code-block-BdLiTitd.js +1 -0
- package/dist/elements/chunks/collapsible-BzbXpPzr.js +1 -0
- package/dist/elements/chunks/{composer-CZZmtYOT.js → composer-Byve-n8K.js} +2 -2
- package/dist/elements/chunks/{confirm-card-BWjf2-xo.js → confirm-card-B0flE3MN.js} +1 -1
- package/dist/elements/chunks/context-VLIL3sJ-.js +1 -0
- package/dist/elements/chunks/controllable-DTwTIlwp.js +1 -0
- package/dist/elements/chunks/conversation-item-BDztezOG.js +1 -0
- package/dist/elements/chunks/copy-Nf-kqxXH.js +1 -0
- package/dist/elements/chunks/{create-tween-CUrM6D_o.js → create-tween-c4Z8TDYz.js} +2 -2
- package/dist/elements/chunks/default-input-C2iLFq0b.js +1 -0
- package/dist/elements/chunks/define-wjHR1MkU.js +1 -0
- package/dist/elements/chunks/disclosure-CcNbyLy0.js +1 -0
- package/dist/elements/chunks/{download-DnCyWFJE.js → download-C4V7tBdb.js} +1 -1
- package/dist/elements/chunks/dropdown-BgWTthUx.js +1 -0
- package/dist/elements/chunks/{ellipsis-CVxqfsDZ.js → ellipsis-7gU33mL2.js} +1 -1
- package/dist/elements/chunks/embed-D3KewsIJ.js +1 -0
- package/dist/elements/chunks/{external-link-DG2sRdQL.js → external-link-CSOEsNlx.js} +1 -1
- package/dist/elements/chunks/{file-text-D0J9F6M7.js → file-text-D1G8khle.js} +1 -1
- package/dist/elements/chunks/{file-tree-yGWNK0Js.js → file-tree-zvB2i7P9.js} +1 -1
- package/dist/elements/chunks/{folder-NV1pi_ud.js → folder-WW2LGLid.js} +1 -1
- package/dist/elements/chunks/form-CQirdC4W.js +1 -0
- package/dist/elements/chunks/hover-card-CJJkfHTK.js +1 -0
- package/dist/elements/chunks/icon-Cfgmf4fa.js +1 -0
- package/dist/elements/chunks/{info-C8r5Q6cc.js → info-DX3YMOt6.js} +1 -1
- package/dist/elements/chunks/input-BtW9U6Sq.js +1 -0
- package/dist/elements/chunks/{kbd-OGJDUT-O.js → kbd-LGXwuT_V.js} +1 -1
- package/dist/elements/chunks/{link-BdsfLB7b.js → link-2My69BqT.js} +1 -1
- package/dist/elements/chunks/{link-preview-Cf5KOP-i.js → link-preview-OQ9IEq0f.js} +1 -1
- package/dist/elements/chunks/{loader-B5QzK_8_.js → loader-iOxc_Tu-.js} +1 -1
- package/dist/elements/chunks/{markdown-DbozyYqa.js → markdown-DgBFaGAz.js} +1 -1
- package/dist/elements/chunks/{message-DtXKPqiR.js → message-VMZohrXx.js} +1 -1
- package/dist/elements/chunks/message-circle-CpXMM-_n.js +1 -0
- package/dist/elements/chunks/message-square-DxcWtETQ.js +1 -0
- package/dist/elements/chunks/message-tZmV2A3p.js +1 -0
- package/dist/elements/chunks/{minimize-2-SegJ_oku.js → minimize-2-DPIUKTrT.js} +1 -1
- package/dist/elements/chunks/{model-switcher-D7JrFFHp.js → model-switcher-DsT8tFB0.js} +1 -1
- package/dist/elements/chunks/{overlay-CV7z2YuX.js → overlay-DuiwdXjm.js} +1 -1
- package/dist/elements/chunks/{paperclip-Bg0ITU3b.js → paperclip-CRZVp4z_.js} +1 -1
- package/dist/elements/chunks/{progress-bar-D1_rzt6N.js → progress-bar-DNy66e_E.js} +1 -1
- package/dist/elements/chunks/{prompt-suggestion-D5Sm8xF1.js → prompt-suggestion-Bn64Nl7L.js} +1 -1
- package/dist/elements/chunks/reasoning-Emn9N4-T.js +1 -0
- package/dist/elements/chunks/{resizable-Dpzjlvp4.js → resizable-D181b4fM.js} +1 -1
- package/dist/elements/chunks/{rotate-cw-DzVDJOA1.js → rotate-cw-CPWe37D9.js} +1 -1
- package/dist/elements/chunks/{scroll-area-93A1bbeG.js → scroll-area-ClZkZxIk.js} +1 -1
- package/dist/elements/chunks/scroll-button-DPE-t3x_.js +1 -0
- package/dist/elements/chunks/{separator-DH2r_ZSZ.js → separator-CeJHQqLW.js} +1 -1
- package/dist/elements/chunks/{settings-BFMOd6yB.js → settings-CqaHgJF9.js} +1 -1
- package/dist/elements/chunks/{settings-group-B3VZKIcz.js → settings-group-CjqjLCOn.js} +1 -1
- package/dist/elements/chunks/share-CyfnNEqp.js +1 -0
- package/dist/elements/chunks/{skeleton-N8BuWYmf.js → skeleton-D8akBnKS.js} +1 -1
- package/dist/elements/chunks/slots-DaNjX0rc.js +1 -0
- package/dist/elements/chunks/{source-w9V0NnBn.js → source-UWCvmVak.js} +1 -1
- package/dist/elements/chunks/{star-DHvACxtm.js → star-DoHFAikQ.js} +1 -1
- package/dist/elements/chunks/store-Cjq0qwYN.js +1 -0
- package/dist/elements/chunks/{tasks-card-lPxoodlA.js → tasks-card-CmZ5xh6v.js} +1 -1
- package/dist/elements/chunks/{text-shimmer-BY_rI3s5.js → text-shimmer-DYn09zrz.js} +1 -1
- package/dist/elements/chunks/textarea-skiGHURM.js +1 -0
- package/dist/elements/chunks/{thumbs-up-DQe0hvkZ.js → thumbs-up-DX2Ijk3H.js} +1 -1
- package/dist/elements/chunks/{toast-store-VUZZBhzH.js → toast-store-CFnQpThX.js} +1 -1
- package/dist/elements/chunks/{tool-C1YtxwPu.js → tool-DKQ2D1DP.js} +1 -1
- package/dist/elements/chunks/{tooltip-BqwnFWhn.js → tooltip-B0G99y8w.js} +1 -1
- package/dist/elements/chunks/{triangle-alert-B6or7F5u.js → triangle-alert-F9cyUEyy.js} +1 -1
- package/dist/elements/chunks/{use-card-resolution-DJg32jGH.js → use-card-resolution-DoA2f_EU.js} +1 -1
- package/dist/elements/chunks/{variant-aurora-QXTZPyST.js → variant-aurora-qt6Zct8M.js} +2 -2
- package/dist/elements/chunks/variant-custom-tJp22_BQ.js +1 -0
- package/dist/{variant-wave-BwzrHD1s.js → elements/chunks/variant-wave-CaQ5ti39.js} +2 -2
- package/dist/elements/chunks/x-B6UnOiLw.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-item.d.ts +1 -0
- package/dist/elements/conversation-item.js +1 -0
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/default-input.d.ts +3 -3
- package/dist/elements/define.d.ts +27 -0
- package/dist/elements/diagnostic-events.d.ts +74 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/dock.d.ts +1 -0
- package/dist/elements/dock.js +149 -0
- package/dist/elements/dropdown.d.ts +1 -0
- package/dist/elements/dropdown.js +1 -0
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-diagnostics.d.ts +81 -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 +2 -0
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +3 -3
- 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/slots.d.ts +35 -3
- 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/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +232 -148
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5456 -4931
- package/dist/index.server.js +4142 -3669
- package/dist/kai-provider.es.js +40 -40
- package/dist/kai.es.js +1 -1
- package/dist/llms/llms-full.txt +184 -69
- package/dist/llms/llms.txt +3 -3
- package/dist/mcp.es.js +2669 -546
- package/dist/primitives/use-resize-observer.d.ts +23 -0
- package/dist/primitives/use-speech-recognition.d.ts +8 -0
- package/dist/primitives/use-text-stream.d.ts +5 -0
- package/dist/react/index.d.ts +115 -266
- package/dist/react.js +247 -221
- package/dist/register-impl-DpE7icIb.js +293 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/tool-defs.d.ts +35 -0
- package/dist/schemas.js +403 -310
- package/dist/{solid-BMuDmFo_.js → solid-BtdqNZI7.js} +8435 -7394
- package/dist/{solid-CGYNdLRR.js → solid-CnavwBye.js} +5987 -5035
- package/dist/solid.d.ts +5 -0
- package/dist/solid.js +210 -203
- package/dist/solid.server.js +210 -203
- package/dist/state/index.d.ts +4 -0
- package/dist/state/persistence.d.ts +51 -0
- package/dist/state/stream.d.ts +50 -0
- package/dist/state/threads.d.ts +71 -0
- package/dist/state.js +269 -169
- package/dist/types.d.ts +4 -2
- package/dist/ui/dock.d.ts +109 -0
- package/dist/ui/hover-card.d.ts +44 -0
- package/dist/{variant-aurora-DwSOfraQ.js → variant-aurora-B8II3-I1.js} +27 -27
- package/dist/{variant-aurora-wKvAQ5wp.js → variant-aurora-CMNWOSJR.js} +28 -28
- package/dist/{variant-aurora-XEkPT0_z.js → variant-aurora-CcuDMWwQ.js} +2 -2
- package/dist/{variant-custom-eFIg2XWQ.js → variant-custom-BdvYC7af.js} +40 -40
- package/dist/{variant-custom-BhS9wIpU.js → variant-custom-C714mqKl.js} +65 -65
- package/dist/variant-custom-L16JLLZy.js +1 -0
- package/dist/{elements/chunks/variant-wave-DDCwhLas.js → variant-wave-2S4La2Ka.js} +2 -2
- package/dist/{variant-wave-CbVsmgwT.js → variant-wave-D7ruiA1W.js} +25 -25
- package/dist/{variant-wave-CUWGx9Bn.js → variant-wave-ecwykeyL.js} +21 -21
- package/dist/wire/chunk.d.ts +47 -0
- package/dist/wire/diagnostics.d.ts +575 -0
- package/dist/wire/encode-probe.d.ts +70 -0
- package/dist/wire/encode.d.ts +24 -0
- package/dist/wire/index.d.ts +2 -0
- package/dist/wire/sse.d.ts +10 -2
- package/dist/wire.js +917 -480
- package/frameworks/react/index.tsx +132 -93
- package/llms-full.txt +184 -69
- package/llms.txt +3 -3
- package/package.json +27 -7
- package/src/agent-tooling/archetypes.ts +41 -9
- package/src/agent-tooling/catalog/README.md +676 -0
- package/src/agent-tooling/catalog/catalog-types.ts +231 -0
- package/src/agent-tooling/catalog/fabrications.ts +96 -0
- package/src/agent-tooling/catalog/invariants.ts +284 -0
- package/src/agent-tooling/catalog/labs-titles.ts +114 -0
- package/src/agent-tooling/catalog/scenarios.ts +87 -0
- package/src/agent-tooling/catalog/surfaces.ts +275 -0
- package/src/agent-tooling/integrations/anthropic.ts +7 -1
- package/src/agent-tooling/integrations/cloudflare.ts +43 -2
- package/src/agent-tooling/integrations/langgraph.ts +7 -1
- package/src/agent-tooling/integrations/mastra.ts +7 -1
- package/src/agent-tooling/integrations/mock.ts +92 -17
- package/src/agent-tooling/integrations/ollama.ts +7 -1
- package/src/agent-tooling/integrations/openai.ts +7 -1
- package/src/agent-tooling/integrations/openrouter.ts +7 -1
- package/src/agent-tooling/integrations/pi.ts +56 -1
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +7 -1
- package/src/agent-tooling/mcp/css-raw.d.ts +12 -0
- package/src/agent-tooling/mcp/manifest.ts +100 -1
- package/src/agent-tooling/mcp/server.ts +61 -5
- package/src/agent-tooling/mcp/tools/reference.ts +440 -4
- package/src/agent-tooling/mcp/tools/scaffold.ts +1834 -307
- package/src/agent-tooling/mcp/tools/theme.ts +146 -30
- package/src/agent-tooling/mcp/validate-args.ts +141 -0
- package/src/agent-tooling/registry.ts +19 -7
- package/src/agent-tooling/route-emit.ts +26 -2
- package/src/components/attachment-types.ts +47 -1
- package/src/components/attachments.tsx +169 -22
- package/src/components/audio-visualizer/fit-scale.ts +112 -0
- package/src/components/audio-visualizer/index.tsx +80 -3
- package/src/components/audio-visualizer/variant-aurora.tsx +10 -4
- package/src/components/audio-visualizer/variant-bar.tsx +38 -6
- package/src/components/audio-visualizer/variant-custom.tsx +8 -2
- package/src/components/audio-visualizer/variant-grid.tsx +16 -11
- package/src/components/audio-visualizer/variant-radial.tsx +15 -10
- package/src/components/audio-visualizer/variant-wave.tsx +7 -2
- package/src/components/chat-container.tsx +4 -1
- package/src/components/chat-thread.tsx +36 -7
- package/src/components/code-block.tsx +79 -3
- package/src/components/composer.tsx +8 -1
- package/src/components/conversation-item.tsx +114 -4
- package/src/components/conversation-list.tsx +212 -12
- package/src/components/embed.tsx +4 -0
- package/src/components/form.tsx +41 -14
- package/src/components/message.tsx +75 -5
- package/src/components/response-stream.tsx +13 -7
- package/src/components/screen.tsx +5 -0
- package/src/components/scroll-button.tsx +7 -0
- package/src/components/toast.tsx +11 -5
- package/src/components/voice-input.tsx +35 -3
- package/src/components/voice-output.tsx +46 -6
- package/src/components/workspace-shell.tsx +285 -0
- package/src/diagnostics/hook.ts +352 -0
- package/src/diagnostics/index.ts +82 -0
- package/src/diagnostics/report-request.ts +296 -0
- package/src/elements/attachments.tsx +6 -7
- package/src/elements/audio-visualizer.tsx +48 -4
- package/src/elements/chat-workspace.tsx +159 -287
- package/src/elements/chat.tsx +12 -9
- package/src/elements/code-block.tsx +19 -1
- package/src/elements/command.tsx +4 -1
- package/src/elements/compiled.css +1 -1
- package/src/elements/conversation-item.tsx +80 -0
- package/src/elements/conversation-list.tsx +60 -11
- package/src/elements/default-input.tsx +5 -5
- package/src/elements/define.tsx +168 -8
- package/src/elements/diagnostic-events.ts +114 -0
- package/src/elements/dialog.tsx +47 -0
- package/src/elements/disclosure.ts +34 -12
- package/src/elements/dock.tsx +204 -0
- package/src/elements/dropdown.tsx +123 -0
- package/src/elements/element-diagnostics.ts +392 -0
- package/src/elements/element-manifest.json +12 -0
- package/src/elements/element-meta.json +672 -439
- package/src/elements/element-nonscalar.json +170 -0
- package/src/elements/element-types.d.ts +232 -148
- package/src/elements/menu.tsx +13 -0
- package/src/elements/prompt-dock.tsx +2 -1
- package/src/elements/prompt-input.tsx +8 -8
- package/src/elements/register-impl.ts +46 -0
- package/src/elements/register.ts +28 -0
- package/src/elements/resizable.tsx +52 -25
- package/src/elements/scroll-button.tsx +5 -0
- package/src/elements/slots.ts +107 -12
- package/src/elements/styles.css +30 -6
- package/src/elements/thinking-bar.tsx +16 -7
- package/src/elements/toast.tsx +3 -0
- package/src/elements/tool.tsx +26 -5
- package/src/elements/voice-input.tsx +11 -2
- package/src/elements/voice-output.tsx +16 -3
- package/src/index.ts +2 -0
- package/src/primitives/use-resize-observer.ts +33 -0
- package/src/primitives/use-speech-recognition.ts +12 -1
- package/src/primitives/use-stick-to-bottom.ts +34 -2
- package/src/primitives/use-text-stream.ts +33 -2
- package/src/remote/provider-runtime.ts +6 -3
- package/src/schemas/index.ts +1 -0
- package/src/schemas/tool-defs.ts +297 -6
- package/src/solid.ts +5 -0
- package/src/state/index.ts +12 -0
- package/src/state/persistence.ts +180 -0
- package/src/state/stream.ts +71 -4
- package/src/state/threads.ts +142 -0
- package/src/types.ts +4 -2
- package/src/ui/dialog.tsx +6 -0
- package/src/ui/dock.tsx +445 -0
- package/src/ui/dropdown.tsx +67 -23
- package/src/ui/hover-card.tsx +156 -6
- package/src/ui/input.tsx +29 -10
- package/src/ui/resizable.tsx +11 -0
- package/src/wire/chunk.ts +47 -0
- package/src/wire/consume.ts +185 -26
- package/src/wire/diagnostics.ts +727 -0
- package/src/wire/encode-probe.ts +214 -0
- package/src/wire/encode.ts +267 -14
- package/src/wire/formats/anthropic.ts +8 -1
- package/src/wire/formats/openai.ts +5 -0
- package/src/wire/index.ts +22 -0
- package/src/wire/read.ts +250 -6
- package/src/wire/sse.ts +16 -3
- package/dist/elements/chunks/action-icons-DW9muWrY.js +0 -1
- package/dist/elements/chunks/arrow-left-iJVnQmxA.js +0 -1
- package/dist/elements/chunks/attachments-CL6TaqIb.js +0 -1
- package/dist/elements/chunks/audio-visualizer-BuUqQmaO.js +0 -1
- package/dist/elements/chunks/chat-thread-DxoKaStk.js +0 -1
- package/dist/elements/chunks/check-MdLzbxrm.js +0 -1
- package/dist/elements/chunks/chevron-down-MK7IzDqe.js +0 -1
- package/dist/elements/chunks/chevron-right-C5jXhmtV.js +0 -1
- package/dist/elements/chunks/circle-BG7VkPep.js +0 -1
- package/dist/elements/chunks/circle-check-GqvO2UBs.js +0 -1
- package/dist/elements/chunks/code-block-ClhQO9RW.js +0 -1
- package/dist/elements/chunks/collapsible-DBcBkFPh.js +0 -1
- package/dist/elements/chunks/context-hKjNqiyQ.js +0 -1
- package/dist/elements/chunks/conversation-list-CsGJjSKG.js +0 -1
- package/dist/elements/chunks/default-input-B1Mem5wu.js +0 -1
- package/dist/elements/chunks/define-B_tXMYRm.js +0 -1
- package/dist/elements/chunks/disclosure-DAoYOKew.js +0 -1
- package/dist/elements/chunks/dropdown-CmNna5lT.js +0 -1
- package/dist/elements/chunks/embed-CjAD2jSi.js +0 -1
- package/dist/elements/chunks/form-Cp8Y00Wn.js +0 -1
- package/dist/elements/chunks/hover-card-6KtXpLwT.js +0 -1
- package/dist/elements/chunks/icon-97R8SR2p.js +0 -1
- package/dist/elements/chunks/input-DrseEjhp.js +0 -1
- package/dist/elements/chunks/message-CE4k-qaj.js +0 -1
- package/dist/elements/chunks/message-square-C9ovmtOo.js +0 -1
- package/dist/elements/chunks/reasoning-BrxQfpfI.js +0 -1
- package/dist/elements/chunks/scroll-button-CrTo7wm4.js +0 -1
- package/dist/elements/chunks/share-DgNbkJKY.js +0 -1
- package/dist/elements/chunks/slots-CIw9RlAe.js +0 -1
- package/dist/elements/chunks/store-HIPGhNz9.js +0 -1
- package/dist/elements/chunks/textarea-DPfuhswM.js +0 -1
- package/dist/elements/chunks/variant-custom-D5ZlmziF.js +0 -1
- package/dist/elements/chunks/video-Bb86fVYI.js +0 -1
- package/dist/elements/chunks/x-BOhjBeOd.js +0 -1
- package/dist/primitives/card-validate-generator.testlib.d.ts +0 -20
- package/dist/register-impl-DGmGzrEM.js +0 -145
- package/dist/variant-custom-MkTNTycd.js +0 -1
- package/src/primitives/card-validate-generator.testlib.ts +0 -38
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// Element-layer observability: the OTHER half of "why isn't it updating".
|
|
2
|
+
//
|
|
3
|
+
// The wire diagnostics answer "did the data arrive". Everything here answers the
|
|
4
|
+
// question a developer asks NEXT, after they have confirmed in the console that
|
|
5
|
+
// `el.messages` holds exactly what they expect and the screen still shows the
|
|
6
|
+
// old thing. All three causes are contract violations documented in root
|
|
7
|
+
// CLAUDE.md, and all three are silent by construction rather than by oversight.
|
|
8
|
+
// See `./diagnostic-events.ts` for what each one is and why it is detectable.
|
|
9
|
+
//
|
|
10
|
+
// WHERE THIS HOOKS, AND WHY THERE. `defineWebComponent` is the single choke
|
|
11
|
+
// point -- every `kai-*` element registers through it, and `elements/slots.test.ts`
|
|
12
|
+
// already fails the build if a registered tag has no `defineWebComponent` call.
|
|
13
|
+
// So one install site covers all 79 registered elements with no per-element
|
|
14
|
+
// work and no list to keep in step.
|
|
15
|
+
//
|
|
16
|
+
// OBSERVE-ONLY, AND STRUCTURALLY SO. Two of the three hooks are wrappers around
|
|
17
|
+
// prototype methods, which is the risky shape, so the discipline is fixed:
|
|
18
|
+
//
|
|
19
|
+
// * the inner method is ALWAYS called, exactly once, with the arguments
|
|
20
|
+
// untouched, and no branch can skip it;
|
|
21
|
+
// * its return value is passed straight back;
|
|
22
|
+
// * everything else this file does is a read.
|
|
23
|
+
//
|
|
24
|
+
// The ORDER of the observation relative to the delegation differs between the
|
|
25
|
+
// two, and each site says why. `connectedCallback` observes after, because the
|
|
26
|
+
// channel it registers on does not exist until the inner call has run.
|
|
27
|
+
// `attributeChangedCallback` observes BEFORE, because the inner call is what
|
|
28
|
+
// throws on the very input being reported, and a report after it would go
|
|
29
|
+
// missing in exactly the case it exists to explain.
|
|
30
|
+
//
|
|
31
|
+
// The third hook is not a wrapper at all: `addPropertyChangedCallback` is
|
|
32
|
+
// component-register's own public observation channel -- solid-element itself
|
|
33
|
+
// uses it to bridge props into signals -- so a second listener is purely
|
|
34
|
+
// additive and cannot alter a value or an ordering.
|
|
35
|
+
//
|
|
36
|
+
// EVERY observation is wrapped in a try/catch, for the same reason
|
|
37
|
+
// `emitWireDiagnostic` swallows a subscriber's throw: a diagnostic that breaks
|
|
38
|
+
// the element it is watching is worse than no diagnostic. A bug in this file
|
|
39
|
+
// must cost a missing event, never a dead component.
|
|
40
|
+
//
|
|
41
|
+
// ZERO COST WHEN NOBODY IS SUBSCRIBED. This runs on the hottest path in the kit
|
|
42
|
+
// -- every prop set on every element, which during streaming is every chunk --
|
|
43
|
+
// so the ordering of the guards is load-bearing:
|
|
44
|
+
//
|
|
45
|
+
// 1. AT REGISTRATION: an element with no non-scalar prop (37 of the 80 in
|
|
46
|
+
// `element-nonscalar.json`) installs NOTHING. No wrapper, no closure, no
|
|
47
|
+
// per-instance cost, ever.
|
|
48
|
+
// 2. ON EVERY CALL: `wireDiagnosticsActive()` is checked BEFORE constructing
|
|
49
|
+
// an event, building a string, or touching an attribute -- one symbol read
|
|
50
|
+
// on `globalThis` plus an array-length compare, allocating nothing.
|
|
51
|
+
//
|
|
52
|
+
// SSR-SAFE: no `window`, `document` or `customElements` at module scope. The
|
|
53
|
+
// registry snapshot touches `customElements` only inside its function body, and
|
|
54
|
+
// returns undefined where there is none.
|
|
55
|
+
import {
|
|
56
|
+
emitWireDiagnostic,
|
|
57
|
+
wireDiagnosticsActive,
|
|
58
|
+
} from '../wire/diagnostics';
|
|
59
|
+
import type {
|
|
60
|
+
ElementRegistryEvent,
|
|
61
|
+
ElementViolationEvent,
|
|
62
|
+
ElementViolationKind,
|
|
63
|
+
} from './diagnostic-events';
|
|
64
|
+
import NON_SCALAR from './element-nonscalar.json';
|
|
65
|
+
// NAMED import, and it is worth 2.2 KB. `element-manifest.json` holds two maps:
|
|
66
|
+
// `tags` (tag -> module) and `files` (module -> tags), the reverse index the
|
|
67
|
+
// elements build uses to pick its entry points. Only `tags` is wanted here, and
|
|
68
|
+
// a DEFAULT import inlines both into the register-all bundle -- measured at
|
|
69
|
+
// +2224 bytes raw / +624 gzip for a map this file never reads. Rollup emits a
|
|
70
|
+
// named export per top-level JSON key, so naming `tags` lets `files` be shaken.
|
|
71
|
+
import { tags as MANIFEST_TAG_MAP } from './element-manifest.json';
|
|
72
|
+
|
|
73
|
+
/** tag -> the names of its props that CANNOT be carried by an attribute.
|
|
74
|
+
*
|
|
75
|
+
* Generated, never hand-written: `gen-element-nonscalar.mjs` derives it from
|
|
76
|
+
* the per-prop `scalar` bit that `gen-element-api.mjs` already reads off the TS
|
|
77
|
+
* checker into `element-meta.json`. That 390 KB file must never reach a
|
|
78
|
+
* runtime path; this is the ~2 KB of it that ships.
|
|
79
|
+
*
|
|
80
|
+
* NOTE FOR ANYONE READING THE DEVTOOLS SPEC: it claims `defineWebComponent`
|
|
81
|
+
* "already receives a `propDefaults` object that declares each prop's expected
|
|
82
|
+
* shape". It does not. `propDefaults` is a plain object of default VALUES and
|
|
83
|
+
* roughly half of them are `undefined`, which declares nothing at runtime --
|
|
84
|
+
* `<kai-cards>` defaults every prop that matters to `undefined`. Deriving the
|
|
85
|
+
* check from `propDefaults` would guard 2 props on 3 elements. This map guards
|
|
86
|
+
* 94 props on 43. */
|
|
87
|
+
const NON_SCALAR_PROPS: Record<string, string[]> = NON_SCALAR;
|
|
88
|
+
|
|
89
|
+
/** camelCase prop name -> kebab-case attribute. The SAME derivation
|
|
90
|
+
* component-register applies (`toAttribute`), because the attribute name it
|
|
91
|
+
* reports to `attributeChangedCallback` is the one it derived. */
|
|
92
|
+
function toAttr(name: string): string {
|
|
93
|
+
return name.replace(/\.?([A-Z]+)/g, (_x, y: string) => '-' + y.toLowerCase()).replace('_', '-').replace(/^-/, '');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* What SHAPE arrived in the attribute -- or `undefined` when the attribute is
|
|
98
|
+
* fine and nothing should be reported.
|
|
99
|
+
*
|
|
100
|
+
* An attribute is NOT automatically a violation on a non-scalar prop. A literal
|
|
101
|
+
* `conversations='[{"id":"a"}]'` is valid JSON, `JSON.parse` succeeds, and the
|
|
102
|
+
* property really does receive an array: that works, and reporting it would be
|
|
103
|
+
* reporting correct code. The violation is precisely the case where the value
|
|
104
|
+
* that reaches the property is not an object -- either because `JSON.parse`
|
|
105
|
+
* threw and component-register's `catch` handed back the raw string, or because
|
|
106
|
+
* the JSON was valid but scalar.
|
|
107
|
+
*
|
|
108
|
+
* EVERY RETURN IS A SHAPE, NEVER CONTENT. The vocabulary is closed and small:
|
|
109
|
+
* two fixed markers, a type name, and a LENGTH. The raw text is never returned,
|
|
110
|
+
* never interpolated, and never measured for anything but its length -- which
|
|
111
|
+
* is what lets this run with no payload gate at all. Pinned with sentinels by
|
|
112
|
+
* `element-diagnostics-payload.test.ts`.
|
|
113
|
+
*/
|
|
114
|
+
export function classifyAttributeValue(raw: string): string | undefined {
|
|
115
|
+
// component-register's parseAttributeValue starts `if (!value) return;`, so a
|
|
116
|
+
// bare attribute yields `undefined` on a prop that needs a real value.
|
|
117
|
+
if (raw === '') return 'empty-attribute';
|
|
118
|
+
|
|
119
|
+
// The signature case, and the reason this capability exists: `String(obj)`.
|
|
120
|
+
if (raw === '[object Object]') return '[object Object]';
|
|
121
|
+
|
|
122
|
+
// `String([{}, {}])` -- an ARRAY of objects, which is what `messages`,
|
|
123
|
+
// `conversations` and `suggestions` actually produce. Reported with its
|
|
124
|
+
// element count, which is a length and therefore metadata.
|
|
125
|
+
if (raw.includes(',')) {
|
|
126
|
+
const parts = raw.split(',');
|
|
127
|
+
if (parts.every((p) => p === '[object Object]')) return `[object Object] x ${parts.length}`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
const parsed: unknown = JSON.parse(raw);
|
|
132
|
+
// A real array or object got through. Unusual, but correct -- say nothing.
|
|
133
|
+
if (parsed !== null && typeof parsed === 'object') return undefined;
|
|
134
|
+
if (parsed === null) return 'json:null';
|
|
135
|
+
return `json:${typeof parsed}`;
|
|
136
|
+
} catch {
|
|
137
|
+
// JSON.parse threw, so component-register assigned the raw STRING to the
|
|
138
|
+
// property. Length only.
|
|
139
|
+
return `string(len=${raw.length})`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Build and deliver one violation. Callers gate on `wireDiagnosticsActive()`
|
|
144
|
+
* BEFORE calling, so nothing here is allocated on the inactive path. */
|
|
145
|
+
function emitViolation(
|
|
146
|
+
kind: ElementViolationKind,
|
|
147
|
+
tag: string,
|
|
148
|
+
prop: string,
|
|
149
|
+
extra?: { valuePreview?: string; length?: number },
|
|
150
|
+
): void {
|
|
151
|
+
const event: ElementViolationEvent = {
|
|
152
|
+
type: 'element.violation',
|
|
153
|
+
t: Date.now(),
|
|
154
|
+
kind,
|
|
155
|
+
tag,
|
|
156
|
+
prop,
|
|
157
|
+
...extra,
|
|
158
|
+
};
|
|
159
|
+
emitWireDiagnostic(event);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Shape of the element class component-register builds, as far as this file
|
|
163
|
+
* needs to know it. Declared rather than imported: `component-register` is not
|
|
164
|
+
* a declared dependency of this package (see the note in `define.tsx`). */
|
|
165
|
+
interface RegisterProto {
|
|
166
|
+
connectedCallback?: (this: RegisterInstance) => void;
|
|
167
|
+
attributeChangedCallback?: (
|
|
168
|
+
this: RegisterInstance,
|
|
169
|
+
name: string,
|
|
170
|
+
oldVal: string | null,
|
|
171
|
+
newVal: string | null,
|
|
172
|
+
) => void;
|
|
173
|
+
}
|
|
174
|
+
interface RegisterInstance {
|
|
175
|
+
addPropertyChangedCallback?: (fn: (key: string, val: unknown, oldValue: unknown) => void) => void;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Marks a prototype this file has already wrapped, so a re-registration can
|
|
179
|
+
* never stack two wrappers and double every event. */
|
|
180
|
+
const INSTALLED = Symbol.for('kai.element.diagnostics.installed.v1');
|
|
181
|
+
|
|
182
|
+
/** Whether this tag has anything to watch at all. `defineWebComponent` asks
|
|
183
|
+
* BEFORE it decides whether it needs to intercept the registry, so a tag with
|
|
184
|
+
* no non-scalar prop pays not even the interception. */
|
|
185
|
+
export function elementDiagnosticsWanted(tag: string): boolean {
|
|
186
|
+
const props = NON_SCALAR_PROPS[tag];
|
|
187
|
+
return props !== undefined && props.length > 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Install the contract checks onto one element class's PROTOTYPE.
|
|
192
|
+
*
|
|
193
|
+
* MUST BE CALLED BEFORE `customElements.define()` SEES THE CLASS.
|
|
194
|
+
*
|
|
195
|
+
* This is not a preference, it is the platform: `define()` snapshots the
|
|
196
|
+
* lifecycle callbacks -- `connectedCallback`, `attributeChangedCallback` and
|
|
197
|
+
* the rest -- off the prototype into the custom-element definition at
|
|
198
|
+
* definition time, and the browser invokes THOSE. Replacing a prototype method
|
|
199
|
+
* afterwards changes an object nothing reads: the wrapper installs perfectly,
|
|
200
|
+
* `hasOwnProperty` confirms it is there, and it is never called once. (Measured
|
|
201
|
+
* exactly that way in jsdom before this comment existed.) It is the same trap,
|
|
202
|
+
* for the same reason, that `defineWithNonReflectingProps` in `define.tsx` was
|
|
203
|
+
* built to get around -- so this rides through that same seam.
|
|
204
|
+
*
|
|
205
|
+
* Returns without touching anything when the tag has no non-scalar prop, which
|
|
206
|
+
* is 37 of the 80 elements: for those this capability has no runtime presence
|
|
207
|
+
* whatsoever.
|
|
208
|
+
*/
|
|
209
|
+
export function installElementDiagnostics(tag: string, proto: object): void {
|
|
210
|
+
const props = NON_SCALAR_PROPS[tag];
|
|
211
|
+
if (!props || props.length === 0) return;
|
|
212
|
+
|
|
213
|
+
const marker = proto as unknown as Record<symbol, unknown>;
|
|
214
|
+
if (marker[INSTALLED]) return;
|
|
215
|
+
marker[INSTALLED] = true;
|
|
216
|
+
|
|
217
|
+
const target = proto as RegisterProto;
|
|
218
|
+
|
|
219
|
+
// attribute name -> camelCase prop name, built ONCE per tag rather than per
|
|
220
|
+
// call. Only the non-scalar props are in here, so an attribute set on a
|
|
221
|
+
// scalar prop -- the supported way to use one -- misses the map and costs a
|
|
222
|
+
// single failed lookup.
|
|
223
|
+
const attrToProp = new Map<string, string>();
|
|
224
|
+
for (const p of props) attrToProp.set(toAttr(p), p);
|
|
225
|
+
|
|
226
|
+
// ---- Capability 1: an array/object prop set as an HTML attribute ---------
|
|
227
|
+
const innerAttributeChanged = target.attributeChangedCallback;
|
|
228
|
+
target.attributeChangedCallback = function (name, oldVal, newVal) {
|
|
229
|
+
// REPORTED BEFORE DELEGATING, and this one is the exception to the
|
|
230
|
+
// call-through-first rule for a reason worth stating.
|
|
231
|
+
//
|
|
232
|
+
// Delegating first looks safer and is strictly worse here, because the
|
|
233
|
+
// inner call is exactly what CRASHES on the input being reported. Assigning
|
|
234
|
+
// `"[object Object]"` to `conversations` pushes that string into the Solid
|
|
235
|
+
// signal, and the facade dies with `(props.conversations ?? []) is not
|
|
236
|
+
// iterable` from inside a computation -- an uncaught TypeError with no
|
|
237
|
+
// attribution to the consumer's actual mistake. That throw propagates out of
|
|
238
|
+
// `innerAttributeChanged.call(...)`, so a report placed after it never runs:
|
|
239
|
+
// the diagnostic would go missing in precisely the case it exists to
|
|
240
|
+
// explain. (Observed exactly that way -- the neutrality suite caught it.)
|
|
241
|
+
//
|
|
242
|
+
// Neutrality is untouched. The element still receives the identical call
|
|
243
|
+
// with identical arguments; only the ORDER of an observation relative to it
|
|
244
|
+
// moved, and there is no `return` between here and the delegation that could
|
|
245
|
+
// skip it. Emission is synchronous, so a subscriber runs before the element
|
|
246
|
+
// does -- the same property the wire emitter already has.
|
|
247
|
+
if (newVal !== null && wireDiagnosticsActive()) {
|
|
248
|
+
// `newVal === null` is an attribute REMOVAL, which is not a misuse.
|
|
249
|
+
// `wireDiagnosticsActive()` is the zero-cost gate, ahead of any work.
|
|
250
|
+
try {
|
|
251
|
+
const prop = attrToProp.get(name);
|
|
252
|
+
// A prop absent from the map is a SCALAR one, where an attribute is the
|
|
253
|
+
// supported way to set it, so this costs one failed lookup and stops.
|
|
254
|
+
if (prop !== undefined) {
|
|
255
|
+
const valuePreview = classifyAttributeValue(newVal);
|
|
256
|
+
// `undefined` means the attribute held valid JSON for an object or an
|
|
257
|
+
// array and the property really will receive it. That works;
|
|
258
|
+
// reporting it would be reporting correct code.
|
|
259
|
+
if (valuePreview !== undefined) {
|
|
260
|
+
emitViolation('array-prop-as-attribute', tag, prop, { valuePreview });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} catch {
|
|
264
|
+
// a broken diagnostic must never break the element
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
innerAttributeChanged?.call(this, name, oldVal, newVal);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// ---- Capability 2: the same reference handed back -----------------------
|
|
272
|
+
const innerConnected = target.connectedCallback;
|
|
273
|
+
target.connectedCallback = function () {
|
|
274
|
+
// Call through FIRST. This is what runs `initializeProps` (which installs
|
|
275
|
+
// the per-instance accessors) and the facade, so the observation channel
|
|
276
|
+
// below does not exist until it has returned.
|
|
277
|
+
innerConnected?.call(this);
|
|
278
|
+
|
|
279
|
+
// NOT gated on `wireDiagnosticsActive()`. Registration has to happen even
|
|
280
|
+
// when nothing is listening yet, because a panel attaches LATE by design --
|
|
281
|
+
// that is the whole premise of the devtools hook's buffer. The gate lives
|
|
282
|
+
// inside the callback instead, where the hot path actually is. The cost
|
|
283
|
+
// here is one closure per connected element of the 43 tags that have a
|
|
284
|
+
// non-scalar prop, paid once, next to mounting a whole Solid facade.
|
|
285
|
+
try {
|
|
286
|
+
// component-register clears `__propertyChangedCallbacks` on every
|
|
287
|
+
// connect, so this re-registers naturally on a re-insertion and cannot
|
|
288
|
+
// accumulate. It is a PUBLIC method -- solid-element bridges props into
|
|
289
|
+
// signals through this exact channel -- and it is invoked AFTER the value
|
|
290
|
+
// is already stored, so a listener here cannot influence anything.
|
|
291
|
+
this.addPropertyChangedCallback?.((key, val, oldValue) => {
|
|
292
|
+
if (!wireDiagnosticsActive()) return; // the hot-path gate, first thing
|
|
293
|
+
try {
|
|
294
|
+
// Arrays only. A string prop re-set to an equal string is `===` too,
|
|
295
|
+
// and reporting that as a no-op update would be noise about a value
|
|
296
|
+
// that never had reference semantics in the first place.
|
|
297
|
+
if (!Array.isArray(val)) return;
|
|
298
|
+
|
|
299
|
+
if (val === oldValue) {
|
|
300
|
+
// The array reference is what NOTIFIES; Solid's default equality is
|
|
301
|
+
// `===`, so this write reached the signal and did nothing at all.
|
|
302
|
+
emitViolation('same-array-reference', tag, key, { length: val.length });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// A NEW array whose every item is the previous array's item object.
|
|
307
|
+
// The list notified, but every row's identity is unchanged, so a
|
|
308
|
+
// reference-keyed <For> re-invokes none of them: an update that
|
|
309
|
+
// cannot render.
|
|
310
|
+
//
|
|
311
|
+
// `length > 0` is required, and not for performance: two empty arrays
|
|
312
|
+
// satisfy "every item identical" VACUOUSLY. Setting `[]` over `[]` is
|
|
313
|
+
// genuinely a no-op, but it carries no information about what the
|
|
314
|
+
// consumer was trying to change, and it is what a default-valued prop
|
|
315
|
+
// does on a perfectly ordinary first render.
|
|
316
|
+
if (!Array.isArray(oldValue)) return;
|
|
317
|
+
if (val.length === 0 || oldValue.length !== val.length) return;
|
|
318
|
+
for (let i = 0; i < val.length; i++) if (val[i] !== oldValue[i]) return;
|
|
319
|
+
|
|
320
|
+
emitViolation('mutated-in-place', tag, key, { length: val.length });
|
|
321
|
+
} catch {
|
|
322
|
+
// see above: never break the element
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
} catch {
|
|
326
|
+
// an element type without the channel: nothing to observe, carry on
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// ---- Capability 3: which kai-* elements are DEFINED ------------------------
|
|
332
|
+
|
|
333
|
+
/** Every tag the manifest knows about. See `emitElementRegistry` for why this
|
|
334
|
+
* is the manifest and not `element-meta.json`. */
|
|
335
|
+
const MANIFEST_TAGS: string[] = Object.keys(MANIFEST_TAG_MAP as Record<string, string>);
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Snapshot which `kai-*` elements are defined in THIS realm, and emit it.
|
|
339
|
+
*
|
|
340
|
+
* The question is hydration. An undefined custom element is a perfectly valid,
|
|
341
|
+
* perfectly inert `HTMLElement`: an SSR page whose markup contains `<kai-chat>`
|
|
342
|
+
* but whose element bundle never loaded renders empty boxes, throws nothing and
|
|
343
|
+
* logs nothing. The SSR starters already answer this by hand for a hard-coded
|
|
344
|
+
* handful (`HydrationBadge.tsx` in the nextjs and tanstack-start starters); this
|
|
345
|
+
* is the same answer, derived, over every tag.
|
|
346
|
+
*
|
|
347
|
+
* WHY THE MANIFEST AND NOT `element-meta.json`. The two generated artifacts
|
|
348
|
+
* disagree -- 79 tags against 80 entries -- and the manifest is the one that
|
|
349
|
+
* answers THIS question. `kai-remote` is in the meta file because
|
|
350
|
+
* `gen-element-api.mjs` scans the `src/elements` directory listing, and absent
|
|
351
|
+
* from the manifest because `gen-elements-manifest.mjs` reads the import list in
|
|
352
|
+
* `register-impl.ts`, which does not import `remote.tsx`.
|
|
353
|
+
*
|
|
354
|
+
* AND THAT IS DELIBERATE, not a generator bug -- `vite.config.elements.ts:44-50`
|
|
355
|
+
* says so at the site: `<kai-remote>` mounts a sandboxed cross-origin iframe and
|
|
356
|
+
* is opt-in, reachable only through `@kitn.ai/ui/elements/remote` or the React
|
|
357
|
+
* `Remote` wrapper, and intentionally kept out of the register-all bundle. So
|
|
358
|
+
* the honest universe for "did the element bundle load" is the 79 that bundle
|
|
359
|
+
* registers. Listing `kai-remote` beside them would report a permanent "not
|
|
360
|
+
* defined" against an element almost no app is missing, and adding it to the
|
|
361
|
+
* manifest -- the obvious "fix" -- would hand an opt-in cross-origin iframe
|
|
362
|
+
* element to the autoloader's lazy-load set, which is a behaviour change wearing
|
|
363
|
+
* the costume of a data fix.
|
|
364
|
+
*
|
|
365
|
+
* The cost is stated rather than hidden: a consumer who HAS opted into
|
|
366
|
+
* `kai-remote` sees it in neither list. `element-artifact-divergence.test.ts`
|
|
367
|
+
* pins the divergence at exactly this one tag, so it stays a known exception and
|
|
368
|
+
* a NEW one fails.
|
|
369
|
+
*
|
|
370
|
+
* Returns the event it emitted, or `undefined` where there is no custom-element
|
|
371
|
+
* registry (SSR) or nobody is listening.
|
|
372
|
+
*/
|
|
373
|
+
export function emitElementRegistry(): ElementRegistryEvent | undefined {
|
|
374
|
+
if (typeof customElements === 'undefined') return undefined;
|
|
375
|
+
if (!wireDiagnosticsActive()) return undefined;
|
|
376
|
+
|
|
377
|
+
const defined: string[] = [];
|
|
378
|
+
const notDefined: string[] = [];
|
|
379
|
+
for (const tag of MANIFEST_TAGS) {
|
|
380
|
+
(customElements.get(tag) ? defined : notDefined).push(tag);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const event: ElementRegistryEvent = {
|
|
384
|
+
type: 'element.registry',
|
|
385
|
+
t: Date.now(),
|
|
386
|
+
defined,
|
|
387
|
+
notDefined,
|
|
388
|
+
total: MANIFEST_TAGS.length,
|
|
389
|
+
};
|
|
390
|
+
emitWireDiagnostic(event);
|
|
391
|
+
return event;
|
|
392
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"tags": {
|
|
3
3
|
"kai-conversations": "conversation-list",
|
|
4
|
+
"kai-conversation-item": "conversation-item",
|
|
4
5
|
"kai-prompt-input": "prompt-input",
|
|
5
6
|
"kai-chat": "chat",
|
|
6
7
|
"kai-workspace": "chat-workspace",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"kai-compare": "compare",
|
|
67
68
|
"kai-composer": "composer",
|
|
68
69
|
"kai-menu": "menu",
|
|
70
|
+
"kai-dropdown": "dropdown",
|
|
69
71
|
"kai-command": "command",
|
|
70
72
|
"kai-prompt-dock": "prompt-dock",
|
|
71
73
|
"kai-segmented": "segmented",
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
"kai-pane-group": "pane-group",
|
|
76
78
|
"kai-agent-card": "agent-card",
|
|
77
79
|
"kai-dialog": "dialog",
|
|
80
|
+
"kai-dock": "dock",
|
|
78
81
|
"kai-input": "input",
|
|
79
82
|
"kai-search": "search",
|
|
80
83
|
"kai-kbd": "kbd",
|
|
@@ -84,6 +87,9 @@
|
|
|
84
87
|
"conversation-list": [
|
|
85
88
|
"kai-conversations"
|
|
86
89
|
],
|
|
90
|
+
"conversation-item": [
|
|
91
|
+
"kai-conversation-item"
|
|
92
|
+
],
|
|
87
93
|
"prompt-input": [
|
|
88
94
|
"kai-prompt-input"
|
|
89
95
|
],
|
|
@@ -275,6 +281,9 @@
|
|
|
275
281
|
"menu": [
|
|
276
282
|
"kai-menu"
|
|
277
283
|
],
|
|
284
|
+
"dropdown": [
|
|
285
|
+
"kai-dropdown"
|
|
286
|
+
],
|
|
278
287
|
"command": [
|
|
279
288
|
"kai-command"
|
|
280
289
|
],
|
|
@@ -302,6 +311,9 @@
|
|
|
302
311
|
"dialog": [
|
|
303
312
|
"kai-dialog"
|
|
304
313
|
],
|
|
314
|
+
"dock": [
|
|
315
|
+
"kai-dock"
|
|
316
|
+
],
|
|
305
317
|
"input": [
|
|
306
318
|
"kai-input"
|
|
307
319
|
],
|