@kitn.ai/ui 0.15.1 → 0.17.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 +37 -13
- package/bin/mcp.js +22 -0
- package/dist/bash-InADTalH.js +6 -1
- package/dist/components/artifact.d.ts +58 -0
- package/dist/components/attachments.d.ts +67 -0
- package/dist/components/card-fallback.d.ts +10 -0
- package/dist/components/card-renderer.d.ts +13 -0
- package/dist/components/card.d.ts +28 -0
- package/dist/components/chain-of-thought.d.ts +29 -0
- package/dist/components/chat-container.d.ts +19 -0
- package/dist/components/chat-scope-picker.d.ts +9 -0
- package/dist/components/chat-thread.d.ts +91 -0
- package/dist/components/checkpoint.d.ts +20 -0
- package/dist/components/choice-card.d.ts +78 -0
- package/dist/components/code-block.d.ts +16 -0
- package/dist/components/confirm-card.d.ts +57 -0
- package/dist/components/context.d.ts +65 -0
- package/dist/components/conversation-item.d.ts +8 -0
- package/dist/components/conversation-list.d.ts +11 -0
- package/dist/components/dismissed-stub.d.ts +22 -0
- package/dist/components/embed.d.ts +21 -0
- package/dist/components/empty.d.ts +43 -0
- package/dist/components/feedback-bar.d.ts +45 -0
- package/dist/components/file-tree.d.ts +57 -0
- package/dist/components/file-upload.d.ts +16 -0
- package/dist/components/form-widgets.d.ts +31 -0
- package/dist/components/form.d.ts +103 -0
- package/dist/components/image.d.ts +12 -0
- package/dist/components/link-preview.d.ts +23 -0
- package/dist/components/loader.d.ts +60 -0
- package/dist/components/markdown.d.ts +8 -0
- package/dist/components/message-skills.d.ts +15 -0
- package/dist/components/message.d.ts +111 -0
- package/dist/components/model-switcher.d.ts +8 -0
- package/dist/components/prompt-input.d.ts +38 -0
- package/dist/components/prompt-suggestion.d.ts +13 -0
- package/dist/components/reasoning.d.ts +20 -0
- package/dist/components/response-compare-types.d.ts +66 -0
- package/dist/components/response-compare.d.ts +51 -0
- package/dist/components/response-stream.d.ts +14 -0
- package/dist/components/scroll-button.d.ts +7 -0
- package/dist/components/slash-command.d.ts +15 -0
- package/dist/components/source.d.ts +23 -0
- package/dist/components/tasks-card.d.ts +72 -0
- package/dist/components/text-shimmer.d.ts +9 -0
- package/dist/components/thinking-bar.d.ts +10 -0
- package/dist/components/toast.d.ts +48 -0
- package/dist/components/tool.d.ts +16 -0
- package/dist/components/use-card-resolution.d.ts +16 -0
- package/dist/components/voice-input.d.ts +7 -0
- package/dist/core-AYMC6_lb.js +5874 -12
- package/dist/css-M7EaDHN_.js +6 -1
- package/dist/custom-elements.json +260 -11
- package/dist/elements/artifact.d.ts +1 -0
- package/dist/elements/artifact.js +1 -0
- package/dist/elements/attachments.d.ts +1 -0
- package/dist/elements/attachments.js +1 -0
- package/dist/elements/autoloader.d.ts +2 -0
- package/dist/elements/autoloader.js +1 -0
- package/dist/elements/card.d.ts +1 -0
- package/dist/elements/card.js +1 -0
- package/dist/elements/cards.d.ts +1 -0
- package/dist/elements/cards.js +1 -0
- package/dist/elements/chain-of-thought.d.ts +1 -0
- package/dist/elements/chain-of-thought.js +1 -0
- package/dist/elements/chat-scope-picker.d.ts +1 -0
- package/dist/elements/chat-scope-picker.js +1 -0
- package/dist/elements/chat-workspace.d.ts +1 -0
- package/dist/elements/chat-workspace.js +1 -0
- package/dist/elements/chat.d.ts +1 -0
- package/dist/elements/chat.js +1 -0
- package/dist/elements/checkpoint.d.ts +1 -0
- package/dist/elements/checkpoint.js +1 -0
- package/dist/elements/choice.d.ts +1 -0
- package/dist/elements/choice.js +1 -0
- package/dist/elements/chunks/Icon-D_Zmwmwh.js +1 -0
- package/dist/elements/chunks/action-icons-PVfIvcuG.js +1 -0
- package/dist/elements/chunks/attachments-Dp6vqtrc.js +1 -0
- package/dist/elements/chunks/bash-InADTalH.js +1 -0
- package/dist/elements/chunks/button-CKyYD9G4.js +1 -0
- package/dist/elements/chunks/card-Cjho-PYk.js +1 -0
- package/dist/elements/chunks/card-routing-C986KuUA.js +1 -0
- package/dist/elements/chunks/chat-thread-RT808iPf.js +1 -0
- package/dist/elements/chunks/check-CDYaMYrM.js +1 -0
- package/dist/elements/chunks/chevron-down-3SBiq8HF.js +1 -0
- package/dist/elements/chunks/chevron-right-k2UFlIVK.js +1 -0
- package/dist/elements/chunks/cn-Dogu6PbV.js +1 -0
- package/dist/elements/chunks/code-block-BYUmfFSd.js +1 -0
- package/dist/elements/chunks/collapsible-BiNwdOn6.js +1 -0
- package/dist/elements/chunks/context-18g6oi4J.js +1 -0
- package/dist/elements/chunks/conversation-list-D9Y0NVdo.js +1 -0
- package/dist/elements/chunks/core-AYMC6_lb.js +12 -0
- package/dist/elements/chunks/css-M7EaDHN_.js +1 -0
- package/dist/elements/chunks/default-input-CSAoYYMd.js +1 -0
- package/dist/elements/chunks/download-D8K0Je8r.js +1 -0
- package/dist/elements/chunks/dropdown-bUs2iTia.js +1 -0
- package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +141 -0
- package/dist/elements/chunks/external-link-6mA0wxab.js +1 -0
- package/dist/elements/chunks/file-text-DnaYk3Dm.js +1 -0
- package/dist/elements/chunks/file-tree-CgtRLlxK.js +1 -0
- package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +1 -0
- package/dist/elements/chunks/github-light-JYsPkUQd.js +1 -0
- package/dist/elements/chunks/hover-card-CIGw62gP.js +1 -0
- package/dist/elements/chunks/html-CPZ3oZQ7.js +1 -0
- package/dist/elements/chunks/index-CTBEJeo6.js +1 -0
- package/dist/elements/chunks/javascript-C25yR2R2.js +1 -0
- package/dist/elements/chunks/json-DxJze_jm.js +1 -0
- package/dist/elements/chunks/link-BlGSeoPy.js +1 -0
- package/dist/elements/chunks/loader-DvhR4qa0.js +1 -0
- package/dist/elements/chunks/markdown-CMTGx9r8.js +64 -0
- package/dist/elements/chunks/message-CDZwXjhL.js +1 -0
- package/dist/elements/chunks/message-feedback-CYx81QiA.js +1 -0
- package/dist/elements/chunks/model-switcher-O_tUhoOT.js +1 -0
- package/dist/elements/chunks/overlay-DydXYMQW.js +1 -0
- package/dist/elements/chunks/prompt-suggestion-ldlWV5kd.js +1 -0
- package/dist/elements/chunks/reasoning-2PUnHlmr.js +1 -0
- package/dist/elements/chunks/resizable-B5WNbSeb.js +1 -0
- package/dist/elements/chunks/star-t9tI-P0q.js +1 -0
- package/dist/elements/chunks/store-C6rIooZz.js +1 -0
- package/dist/elements/chunks/svelte--5p79yCD.js +1 -0
- package/dist/elements/chunks/text-shimmer-uh9V_KUh.js +1 -0
- package/dist/elements/chunks/textarea-3nm6Ia9U.js +1 -0
- package/dist/elements/chunks/thumbs-up-BBtguGld.js +1 -0
- package/dist/elements/chunks/toast-store-D8cL3fWl.js +1 -0
- package/dist/elements/chunks/tool-GJ3vwp1U.js +1 -0
- package/dist/elements/chunks/tooltip-DwKAz4XR.js +1 -0
- package/dist/elements/chunks/triangle-alert-Ct1zt2JL.js +1 -0
- package/dist/elements/chunks/tsx-B8rCNbgL.js +1 -0
- package/dist/elements/chunks/typescript-RycA9KXf.js +1 -0
- package/dist/elements/chunks/use-card-resolution-D-_0Alzy.js +1 -0
- package/dist/elements/chunks/video-mVYiM99-.js +1 -0
- package/dist/elements/chunks/vue-BmIZj4XD.js +1 -0
- package/dist/elements/chunks/x-CzxL27Ch.js +1 -0
- package/dist/elements/code-block.d.ts +1 -0
- package/dist/elements/code-block.js +1 -0
- package/dist/elements/compare.d.ts +1 -0
- package/dist/elements/compare.js +1 -0
- package/dist/elements/confirm-card.d.ts +1 -0
- package/dist/elements/confirm-card.js +1 -0
- package/dist/elements/context-meter.d.ts +1 -0
- package/dist/elements/context-meter.js +1 -0
- package/dist/elements/conversation-list.d.ts +1 -0
- package/dist/elements/conversation-list.js +1 -0
- package/dist/elements/embed.d.ts +1 -0
- package/dist/elements/embed.js +1 -0
- package/dist/elements/empty.d.ts +1 -0
- package/dist/elements/empty.js +1 -0
- package/dist/elements/feedback-bar.d.ts +1 -0
- package/dist/elements/feedback-bar.js +1 -0
- package/dist/elements/file-tree.d.ts +1 -0
- package/dist/elements/file-tree.js +1 -0
- package/dist/elements/file-upload.d.ts +1 -0
- package/dist/elements/file-upload.js +1 -0
- package/dist/elements/form.d.ts +1 -0
- package/dist/elements/form.js +1 -0
- package/dist/elements/image.d.ts +1 -0
- package/dist/elements/image.js +1 -0
- package/dist/elements/link-preview.d.ts +1 -0
- package/dist/elements/link-preview.js +1 -0
- package/dist/elements/loader.d.ts +1 -0
- package/dist/elements/loader.js +1 -0
- package/dist/elements/markdown.d.ts +1 -0
- package/dist/elements/markdown.js +1 -0
- package/dist/elements/message-skills.d.ts +1 -0
- package/dist/elements/message-skills.js +1 -0
- package/dist/elements/message.d.ts +1 -0
- package/dist/elements/message.js +1 -0
- package/dist/elements/model-switcher.d.ts +1 -0
- package/dist/elements/model-switcher.js +1 -0
- package/dist/elements/popover.d.ts +1 -0
- package/dist/elements/popover.js +1 -0
- package/dist/elements/prompt-input.d.ts +1 -0
- package/dist/elements/prompt-input.js +1 -0
- package/dist/elements/prompt-suggestions.d.ts +1 -0
- package/dist/elements/prompt-suggestions.js +1 -0
- package/dist/elements/reasoning.d.ts +1 -0
- package/dist/elements/reasoning.js +1 -0
- package/dist/elements/resizable.d.ts +1 -0
- package/dist/elements/resizable.js +1 -0
- package/dist/elements/response-stream.d.ts +1 -0
- package/dist/elements/response-stream.js +14 -0
- package/dist/elements/scroll-button.d.ts +1 -0
- package/dist/elements/scroll-button.js +1 -0
- package/dist/elements/source.d.ts +1 -0
- package/dist/elements/source.js +1 -0
- package/dist/elements/switch.d.ts +1 -0
- package/dist/elements/switch.js +1 -0
- package/dist/elements/tasks.d.ts +1 -0
- package/dist/elements/tasks.js +1 -0
- package/dist/elements/text-shimmer.d.ts +1 -0
- package/dist/elements/text-shimmer.js +1 -0
- package/dist/elements/thinking-bar.d.ts +1 -0
- package/dist/elements/thinking-bar.js +1 -0
- package/dist/elements/toast.d.ts +1 -0
- package/dist/elements/toast.js +1 -0
- package/dist/elements/tool.d.ts +1 -0
- package/dist/elements/tool.js +1 -0
- package/dist/elements/voice-input.d.ts +1 -0
- package/dist/elements/voice-input.js +1 -0
- package/dist/elements.d.ts +768 -0
- package/dist/engine-javascript-vq0WuIJl.js +2516 -14
- package/dist/github-dark-dimmed-DUshB20C.js +4 -1
- package/dist/github-light-JYsPkUQd.js +4 -1
- package/dist/html-CPZ3oZQ7.js +10 -1
- package/dist/index.d.ts +124 -2
- package/dist/index.js +15593 -0
- package/dist/javascript-C25yR2R2.js +6 -1
- package/dist/json-DxJze_jm.js +6 -1
- package/dist/kitn-chat.es.js +1 -77
- package/dist/llms/llms-full.txt +57 -12
- package/dist/llms/llms.txt +3 -3
- package/dist/mcp.es.js +2296 -0
- package/dist/primitives/card-contract.d.ts +119 -0
- package/dist/primitives/card-host.d.ts +12 -0
- package/dist/primitives/card-recovery.d.ts +55 -0
- package/dist/primitives/card-registry.d.ts +17 -0
- package/dist/primitives/card-resolution.d.ts +8 -0
- package/dist/primitives/card-routing.d.ts +12 -0
- package/dist/primitives/card-validate.d.ts +25 -0
- package/dist/primitives/chat-config.d.ts +31 -0
- package/dist/primitives/controllable.d.ts +13 -0
- package/dist/primitives/embed-providers.d.ts +65 -0
- package/dist/primitives/highlighter.d.ts +23 -0
- package/dist/primitives/link-preview.d.ts +47 -0
- package/dist/primitives/message-feedback.d.ts +35 -0
- package/dist/primitives/pdf-preview.d.ts +50 -0
- package/dist/primitives/toast-store.d.ts +88 -0
- package/dist/primitives/use-auto-resize.d.ts +8 -0
- package/dist/primitives/use-resize-observer.d.ts +1 -0
- package/dist/primitives/use-stick-to-bottom.d.ts +5 -0
- package/dist/primitives/use-text-stream.d.ts +19 -0
- package/dist/primitives/use-voice-recorder.d.ts +9 -0
- package/dist/react/index.d.ts +1198 -0
- package/dist/react/runtime.d.ts +15 -0
- package/dist/react.js +275 -0
- package/dist/register-JyTglR6m.js +1 -0
- package/dist/register-impl-C6wlSsts.js +77 -0
- package/dist/remote/host-embed.d.ts +33 -0
- package/dist/remote/index.d.ts +2 -0
- package/dist/remote/origin.d.ts +5 -0
- package/dist/remote/provider-runtime.d.ts +27 -0
- package/dist/remote/provider.d.ts +2 -0
- package/dist/remote/validate.d.ts +4 -0
- package/dist/remote/version.d.ts +4 -0
- package/dist/remote/wire.d.ts +53 -0
- package/dist/schemas/choice.schema.json +5 -0
- package/dist/schemas/tasks.schema.json +5 -0
- package/dist/svelte--5p79yCD.js +15 -1
- package/dist/tsx-B8rCNbgL.js +6 -1
- package/dist/types.d.ts +42 -0
- package/dist/typescript-RycA9KXf.js +6 -1
- package/dist/ui/action-icons.d.ts +11 -0
- package/dist/ui/avatar.d.ts +8 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/collapsible.d.ts +27 -0
- package/dist/ui/dropdown.d.ts +20 -0
- package/dist/ui/hover-card.d.ts +28 -0
- package/dist/ui/overlay.d.ts +67 -0
- package/dist/ui/popover.d.ts +32 -0
- package/dist/ui/resizable.d.ts +76 -0
- package/dist/ui/scroll-area.d.ts +5 -0
- package/dist/ui/separator.d.ts +5 -0
- package/dist/ui/skeleton.d.ts +5 -0
- package/dist/ui/switch.d.ts +19 -0
- package/dist/ui/textarea.d.ts +6 -0
- package/dist/ui/tooltip.d.ts +9 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/vue-BmIZj4XD.js +33 -1
- package/frameworks/react/index.tsx +67 -11
- package/frameworks/react/runtime.tsx +16 -2
- package/llms-full.txt +57 -12
- package/llms.txt +3 -3
- package/package.json +36 -14
- package/src/agent-tooling/archetypes.ts +46 -0
- package/src/agent-tooling/integrations/cloudflare.ts +88 -0
- package/src/agent-tooling/integrations/langgraph.ts +60 -0
- package/src/agent-tooling/integrations/mastra.ts +27 -0
- package/src/agent-tooling/integrations/mock.ts +34 -0
- package/src/agent-tooling/integrations/ollama.ts +47 -0
- package/src/agent-tooling/integrations/openrouter.ts +26 -0
- package/src/agent-tooling/integrations/pi.ts +40 -0
- package/src/agent-tooling/integrations/pydantic-ai.ts +52 -0
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +44 -0
- package/src/agent-tooling/mcp/manifest.ts +128 -0
- package/src/agent-tooling/mcp/server.ts +59 -0
- package/src/agent-tooling/mcp/stdio.ts +18 -0
- package/src/agent-tooling/mcp/tools/debug.ts +489 -0
- package/src/agent-tooling/mcp/tools/reference.ts +132 -0
- package/src/agent-tooling/mcp/tools/scaffold.ts +1759 -0
- package/src/agent-tooling/mcp/tools/theme.ts +340 -0
- package/src/agent-tooling/mcp/tools/types.ts +14 -0
- package/src/agent-tooling/registry.ts +41 -0
- package/src/agent-tooling/types.ts +30 -0
- package/src/components/chat-thread.tsx +27 -35
- package/src/components/choice-card.tsx +33 -4
- package/src/components/component-meta.json +250 -26
- package/src/components/confirm-card.tsx +15 -1
- package/src/components/dismissed-stub.tsx +80 -0
- package/src/components/form.tsx +21 -3
- package/src/components/message.tsx +151 -10
- package/src/components/response-compare-types.ts +127 -0
- package/src/components/response-compare.tsx +431 -0
- package/src/components/tasks-card.tsx +33 -3
- package/src/components/toast.tsx +398 -0
- package/src/components/use-card-resolution.ts +24 -8
- package/src/elements/autoloader.ts +89 -0
- package/src/elements/chat-types.ts +7 -0
- package/src/elements/chat-workspace.tsx +4 -2
- package/src/elements/chat.tsx +4 -2
- package/src/elements/compare.tsx +88 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/define.tsx +7 -1
- package/src/elements/element-manifest.json +182 -0
- package/src/elements/element-meta.json +191 -68
- package/src/elements/element-types.d.ts +43 -6
- package/src/elements/framework-usage.json +25 -0
- package/src/elements/message.tsx +27 -45
- package/src/elements/register-impl.ts +58 -0
- package/src/elements/register.ts +26 -51
- package/src/elements/remote.tsx +4 -0
- package/src/elements/styles.css +19 -0
- package/src/elements/toast.tsx +74 -0
- package/src/index.ts +30 -0
- package/src/primitives/card-contract.ts +14 -5
- package/src/primitives/card-recovery.ts +149 -0
- package/src/primitives/card-routing.ts +3 -0
- package/src/primitives/card-schemas/choice.schema.json +5 -0
- package/src/primitives/card-schemas/tasks.schema.json +5 -0
- package/src/primitives/message-feedback.ts +123 -0
- package/src/primitives/toast-store.ts +235 -0
- package/src/ui/tooltip.tsx +8 -2
- package/theme.css +4 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { CardEnvelope, CardHost, CardResolution } from '../primitives/card-contract';
|
|
3
|
+
/** A field definition (the JSON Schema subset kai-form renders). */
|
|
4
|
+
export interface FormField {
|
|
5
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
default?: unknown;
|
|
9
|
+
enum?: unknown[];
|
|
10
|
+
format?: 'email' | 'uri' | 'url' | 'date' | 'date-time' | 'time';
|
|
11
|
+
minimum?: number;
|
|
12
|
+
maximum?: number;
|
|
13
|
+
minLength?: number;
|
|
14
|
+
maxLength?: number;
|
|
15
|
+
pattern?: string;
|
|
16
|
+
minItems?: number;
|
|
17
|
+
maxItems?: number;
|
|
18
|
+
items?: FormField | {
|
|
19
|
+
enum: unknown[];
|
|
20
|
+
};
|
|
21
|
+
properties?: Record<string, FormField>;
|
|
22
|
+
required?: string[];
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
'x-kai-widget'?: 'textarea' | 'slider' | 'rating' | 'radio' | 'select' | 'checkbox' | 'password' | 'switch';
|
|
25
|
+
'x-kai-placeholder'?: string;
|
|
26
|
+
'x-kai-step'?: number;
|
|
27
|
+
}
|
|
28
|
+
/** The form definition = CardEnvelope.data for type:'form'. */
|
|
29
|
+
export interface FormDefinition {
|
|
30
|
+
type: 'object';
|
|
31
|
+
title?: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
required?: string[];
|
|
34
|
+
properties: Record<string, FormField>;
|
|
35
|
+
'x-kai-order'?: string[];
|
|
36
|
+
'x-kai-inlineMax'?: number;
|
|
37
|
+
'x-kai-submitLabel'?: string;
|
|
38
|
+
'x-kai-dismissible'?: boolean;
|
|
39
|
+
'x-kai-actions'?: {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
variant?: 'default' | 'ghost' | 'outline';
|
|
43
|
+
}[];
|
|
44
|
+
}
|
|
45
|
+
export type FormCardEnvelope = CardEnvelope<'form', FormDefinition>;
|
|
46
|
+
/** The internal widget identifiers `widgetFor` resolves to. */
|
|
47
|
+
export type WidgetKind = 'text' | 'textarea' | 'password' | 'email' | 'url' | 'date' | 'datetime' | 'time' | 'number' | 'slider' | 'rating' | 'switch' | 'checkbox' | 'radio' | 'select' | 'checkbox-group' | 'multiselect' | 'repeater' | 'taglist' | 'fieldset' | 'unsupported';
|
|
48
|
+
export declare const DEFAULT_INLINE_MAX = 4;
|
|
49
|
+
/** Resolve the widget for a field. An explicit valid `x-kai-widget` always wins;
|
|
50
|
+
* otherwise the type/format/enum/constraint combination selects the widget. */
|
|
51
|
+
export declare function widgetFor(field: FormField, inlineMax: number): WidgetKind;
|
|
52
|
+
/** Humanize a camelCase / snake_case property key into a label. */
|
|
53
|
+
export declare function humanize(key: string): string;
|
|
54
|
+
/** Field order: `x-kai-order` (filtered to known keys, missing appended) if
|
|
55
|
+
* present, else `required` first then schema declaration order. */
|
|
56
|
+
export declare function orderedKeys(def: FormDefinition): string[];
|
|
57
|
+
/** Coerce a raw control value to the field's JSON type. Empty number string →
|
|
58
|
+
* undefined; number/integer → Number; boolean → real boolean. */
|
|
59
|
+
export declare function coerceValue(field: FormField, raw: unknown): unknown;
|
|
60
|
+
export interface FormValidation {
|
|
61
|
+
valid: boolean;
|
|
62
|
+
fieldErrors: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
/** Full client-side validation of `values` against the form definition. Returns a
|
|
65
|
+
* per-field error map (the contract validator subset, applied field-by-field so
|
|
66
|
+
* each field can show its own inline message). */
|
|
67
|
+
export declare function validateForm(def: FormDefinition, values: Record<string, unknown>): FormValidation;
|
|
68
|
+
export interface FormSummaryRow {
|
|
69
|
+
key: string;
|
|
70
|
+
label: string;
|
|
71
|
+
value: string;
|
|
72
|
+
}
|
|
73
|
+
/** Format one field's value for the read-only summary. */
|
|
74
|
+
export declare function formatFieldValue(field: FormField | undefined, raw: unknown): string;
|
|
75
|
+
/** Build the label→value rows for a submitted form, honoring x-kai-order. */
|
|
76
|
+
export declare function summarizeForm(def: FormDefinition, data: Record<string, unknown>): FormSummaryRow[];
|
|
77
|
+
/** Build the result object: coerced values with empty optional fields omitted.
|
|
78
|
+
* `false` and `0` are kept (they are real values, not "empty"). */
|
|
79
|
+
export declare function buildResult(def: FormDefinition, values: Record<string, unknown>): Record<string, unknown>;
|
|
80
|
+
export interface FormProps {
|
|
81
|
+
/** The form definition (CardEnvelope.data). */
|
|
82
|
+
data?: FormDefinition;
|
|
83
|
+
/** The card id used to correlate every emitted CardEvent. */
|
|
84
|
+
cardId?: string;
|
|
85
|
+
/** The envelope title rendered in the card chrome. */
|
|
86
|
+
heading?: string;
|
|
87
|
+
/** Optional explicit CardHost (otherwise read from a CardProvider, otherwise the
|
|
88
|
+
* bubbling `kai-card` CustomEvent off `hostElement`). */
|
|
89
|
+
host?: CardHost;
|
|
90
|
+
/** The custom-element host node, for the bubbling `kai-card` fallback emit. */
|
|
91
|
+
hostElement?: HTMLElement;
|
|
92
|
+
class?: string;
|
|
93
|
+
/** When set, render the chromed read-only view instead of the form inputs. */
|
|
94
|
+
resolution?: CardResolution;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `Form` — renders a JSON-Schema form definition into themed, accessible widgets
|
|
98
|
+
* inside `Card` chrome, validates input against that schema, and emits the
|
|
99
|
+
* collected, coerced, validated object up the Card contract as `submit`.
|
|
100
|
+
* Reads context/emits via a `CardProvider` when present, else the bubbling
|
|
101
|
+
* `kai-card` CustomEvent.
|
|
102
|
+
*/
|
|
103
|
+
export declare function Form(props: FormProps): JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface GeneratedImageLike {
|
|
3
|
+
base64?: string;
|
|
4
|
+
uint8Array?: Uint8Array;
|
|
5
|
+
mediaType?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ImageProps extends GeneratedImageLike {
|
|
8
|
+
alt: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function Image(props: ImageProps): JSX.Element;
|
|
12
|
+
export { Image };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { CardEvent } from '../primitives/card-contract';
|
|
3
|
+
import { LinkPreviewData } from '../primitives/link-preview';
|
|
4
|
+
export interface LinkPreviewProps {
|
|
5
|
+
/** The card id correlating every emitted event. */
|
|
6
|
+
cardId: string;
|
|
7
|
+
/** The link payload (data-down). */
|
|
8
|
+
data: LinkPreviewData;
|
|
9
|
+
/** Emit a contract CardEvent up (host routes it). */
|
|
10
|
+
onEmit?: (event: CardEvent) => void;
|
|
11
|
+
/** Extra classes for the card root. */
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `LinkPreview` — a pure, themed, accessible rich link / OG preview. Renders from the
|
|
16
|
+
* supplied metadata; it never fetches the network itself. When the payload is a
|
|
17
|
+
* bare `{ url }` and an app has registered a `configureLinkPreview` fetcher, it
|
|
18
|
+
* shows a skeleton, calls the hook, merges the result, and renders. Activating the
|
|
19
|
+
* card (click / Enter / Space) emits the contract `open` verb (`target:'tab'`); the
|
|
20
|
+
* host policy performs the navigation so it can veto/redirect.
|
|
21
|
+
*/
|
|
22
|
+
export declare function LinkPreview(props: LinkPreviewProps): JSX.Element;
|
|
23
|
+
export type { LinkPreviewData } from '../primitives/link-preview';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type LoaderVariant = 'circular' | 'classic' | 'pulse' | 'pulse-dot' | 'dots' | 'typing' | 'wave' | 'bars' | 'terminal' | 'text-blink' | 'text-shimmer' | 'loading-dots';
|
|
2
|
+
export type LoaderSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface LoaderProps {
|
|
4
|
+
variant?: LoaderVariant;
|
|
5
|
+
size?: LoaderSize;
|
|
6
|
+
text?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CircularLoader(props: {
|
|
10
|
+
class?: string;
|
|
11
|
+
size?: LoaderSize;
|
|
12
|
+
}): import("solid-js").JSX.Element;
|
|
13
|
+
export declare function ClassicLoader(props: {
|
|
14
|
+
class?: string;
|
|
15
|
+
size?: LoaderSize;
|
|
16
|
+
}): import("solid-js").JSX.Element;
|
|
17
|
+
export declare function PulseLoader(props: {
|
|
18
|
+
class?: string;
|
|
19
|
+
size?: LoaderSize;
|
|
20
|
+
}): import("solid-js").JSX.Element;
|
|
21
|
+
export declare function PulseDotLoader(props: {
|
|
22
|
+
class?: string;
|
|
23
|
+
size?: LoaderSize;
|
|
24
|
+
}): import("solid-js").JSX.Element;
|
|
25
|
+
export declare function DotsLoader(props: {
|
|
26
|
+
class?: string;
|
|
27
|
+
size?: LoaderSize;
|
|
28
|
+
}): import("solid-js").JSX.Element;
|
|
29
|
+
export declare function TypingLoader(props: {
|
|
30
|
+
class?: string;
|
|
31
|
+
size?: LoaderSize;
|
|
32
|
+
}): import("solid-js").JSX.Element;
|
|
33
|
+
export declare function WaveLoader(props: {
|
|
34
|
+
class?: string;
|
|
35
|
+
size?: LoaderSize;
|
|
36
|
+
}): import("solid-js").JSX.Element;
|
|
37
|
+
export declare function BarsLoader(props: {
|
|
38
|
+
class?: string;
|
|
39
|
+
size?: LoaderSize;
|
|
40
|
+
}): import("solid-js").JSX.Element;
|
|
41
|
+
export declare function TerminalLoader(props: {
|
|
42
|
+
class?: string;
|
|
43
|
+
size?: LoaderSize;
|
|
44
|
+
}): import("solid-js").JSX.Element;
|
|
45
|
+
export declare function TextBlinkLoader(props: {
|
|
46
|
+
text?: string;
|
|
47
|
+
class?: string;
|
|
48
|
+
size?: LoaderSize;
|
|
49
|
+
}): import("solid-js").JSX.Element;
|
|
50
|
+
export declare function TextShimmerLoader(props: {
|
|
51
|
+
text?: string;
|
|
52
|
+
class?: string;
|
|
53
|
+
size?: LoaderSize;
|
|
54
|
+
}): import("solid-js").JSX.Element;
|
|
55
|
+
export declare function TextDotsLoader(props: {
|
|
56
|
+
text?: string;
|
|
57
|
+
class?: string;
|
|
58
|
+
size?: LoaderSize;
|
|
59
|
+
}): import("solid-js").JSX.Element;
|
|
60
|
+
export declare function Loader(props: LoaderProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface Skill {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MessageSkillsProps {
|
|
7
|
+
skills: Skill[];
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Displays skill badges above a message to indicate which skills
|
|
12
|
+
* were active when the message was generated.
|
|
13
|
+
*/
|
|
14
|
+
declare function MessageSkills(props: MessageSkillsProps): JSX.Element;
|
|
15
|
+
export { MessageSkills };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { ChatMessageAction, CustomAction, FeedbackVote } from '../elements/chat-types';
|
|
3
|
+
import { ToolPart } from './tool';
|
|
4
|
+
import { AttachmentData } from './attachments';
|
|
5
|
+
export interface MessageProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children: JSX.Element;
|
|
7
|
+
}
|
|
8
|
+
declare function Message(props: MessageProps): JSX.Element;
|
|
9
|
+
export interface MessageAvatarProps {
|
|
10
|
+
src: string;
|
|
11
|
+
alt: string;
|
|
12
|
+
fallback?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function MessageAvatar(props: MessageAvatarProps): JSX.Element;
|
|
16
|
+
export interface MessageContentProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
children: JSX.Element | string;
|
|
18
|
+
markdown?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare function MessageContent(props: MessageContentProps): JSX.Element;
|
|
21
|
+
export interface MessageActionsProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
children: JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
declare function MessageActions(props: MessageActionsProps): JSX.Element;
|
|
25
|
+
export interface MessageActionBarProps {
|
|
26
|
+
/** Built-in action names and/or custom action descriptors, in order. */
|
|
27
|
+
actions: (ChatMessageAction | CustomAction)[];
|
|
28
|
+
/** `'always'` (default) keeps the bar visible; `'hover'` reveals it on
|
|
29
|
+
* parent `.group` hover. */
|
|
30
|
+
reveal?: 'always' | 'hover';
|
|
31
|
+
/** Fired with the built-in name or the custom action id when a button is clicked. */
|
|
32
|
+
onAction: (id: string) => void;
|
|
33
|
+
/** The active feedback vote. When `'like'`/`'dislike'` is set, that button is
|
|
34
|
+
* marked pressed (filled) and the OTHER vote button animates out. `undefined`
|
|
35
|
+
* shows both. Pure/prop-driven so the bar survives re-renders. */
|
|
36
|
+
activeFeedback?: FeedbackVote;
|
|
37
|
+
/** When true, the `copy` button shows its emerald check icon instead of the
|
|
38
|
+
* copy glyph (cleared by the owner after ~2s). */
|
|
39
|
+
copied?: boolean;
|
|
40
|
+
class?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The shared message action toolbar. Renders one ghost icon button per entry —
|
|
44
|
+
* built-in names pull their label+icon from the curated registry; custom
|
|
45
|
+
* descriptors use their `label` plus `actionIcon(icon)` (label-only when the
|
|
46
|
+
* icon is unknown or absent). `reveal="hover"` makes the bar fade in on the
|
|
47
|
+
* parent `.group`'s hover.
|
|
48
|
+
*
|
|
49
|
+
* Pure/prop-driven: feedback (`activeFeedback`) and copy (`copied`) state are
|
|
50
|
+
* owned by the parent facade and passed in — the bar holds no internal signals,
|
|
51
|
+
* so it survives the new-array-per-chunk re-renders of a streaming thread. With
|
|
52
|
+
* a vote active, the chosen `like`/`dislike` button is marked `aria-pressed` +
|
|
53
|
+
* filled and the other vote button collapses its width (sliding the active thumb
|
|
54
|
+
* into its place) via a 0fr↔1fr grid transition. The
|
|
55
|
+
* `copy` button swaps to an emerald check while `copied`.
|
|
56
|
+
*/
|
|
57
|
+
declare function MessageActionBar(props: MessageActionBarProps): JSX.Element;
|
|
58
|
+
export interface MessageBodyProps {
|
|
59
|
+
/** The message text/markdown. */
|
|
60
|
+
content: string;
|
|
61
|
+
/** Optional collapsible reasoning block, rendered above the content. */
|
|
62
|
+
reasoning?: {
|
|
63
|
+
text: string;
|
|
64
|
+
label?: string;
|
|
65
|
+
};
|
|
66
|
+
/** Tool-call parts, rendered above the content. */
|
|
67
|
+
tools?: ToolPart[];
|
|
68
|
+
/** Inline attachment previews, rendered above the content. */
|
|
69
|
+
attachments?: AttachmentData[];
|
|
70
|
+
/** Whether this is a user message (right-aligned bubble) vs an assistant
|
|
71
|
+
* message (full-width transparent). */
|
|
72
|
+
isUser: boolean;
|
|
73
|
+
/** Whether the content renders as markdown. */
|
|
74
|
+
markdown: boolean;
|
|
75
|
+
/** Action-bar entries — built-in names and/or custom descriptors. When empty
|
|
76
|
+
* the bar is not rendered. */
|
|
77
|
+
actions?: (ChatMessageAction | CustomAction)[];
|
|
78
|
+
/** `'always'` (default) keeps the bar visible; `'hover'` reveals it on parent
|
|
79
|
+
* `.group` hover. */
|
|
80
|
+
actionsReveal?: 'always' | 'hover';
|
|
81
|
+
/** Fired with the built-in name or custom id when an action is clicked. */
|
|
82
|
+
onAction?: (id: string) => void;
|
|
83
|
+
/** The currently-active feedback vote, so the bar can mark like/dislike and
|
|
84
|
+
* hide the other. */
|
|
85
|
+
activeFeedback?: FeedbackVote;
|
|
86
|
+
/** When true, the copy button shows its "copied" check icon. */
|
|
87
|
+
copied?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The shared message body: an optional reasoning block, tool calls, inline
|
|
91
|
+
* attachments, the content bubble, and the action bar — in that order. This is
|
|
92
|
+
* the single source of truth for how a message renders, consumed by `ChatThread`
|
|
93
|
+
* (the `<For>` over `messages`), the standalone `<kai-message>` facade, and (in
|
|
94
|
+
* future) `kai-compare` for each candidate. Pure/prop-driven: all interaction
|
|
95
|
+
* state (copied, feedback vote) is owned above and passed in.
|
|
96
|
+
*/
|
|
97
|
+
declare function MessageBody(props: MessageBodyProps): JSX.Element;
|
|
98
|
+
export interface MessageActionProps {
|
|
99
|
+
tooltip: string;
|
|
100
|
+
children: JSX.Element;
|
|
101
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
102
|
+
class?: string;
|
|
103
|
+
}
|
|
104
|
+
declare function MessageAction(props: MessageActionProps): JSX.Element;
|
|
105
|
+
export interface MessageCopyButtonProps {
|
|
106
|
+
content: string;
|
|
107
|
+
size?: number;
|
|
108
|
+
class?: string;
|
|
109
|
+
}
|
|
110
|
+
declare function MessageCopyButton(props: MessageCopyButtonProps): JSX.Element;
|
|
111
|
+
export { Message, MessageAvatar, MessageContent, MessageActions, MessageActionBar, MessageBody, MessageAction, MessageCopyButton };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModelOption } from '../types';
|
|
2
|
+
export interface ModelSwitcherProps {
|
|
3
|
+
models: ModelOption[];
|
|
4
|
+
currentModelId: string;
|
|
5
|
+
onModelChange: (modelId: string) => void;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function ModelSwitcher(props: ModelSwitcherProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
interface PromptInputContextType {
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
value: () => string;
|
|
5
|
+
setValue: (value: string) => void;
|
|
6
|
+
maxHeight: number | string;
|
|
7
|
+
onSubmit?: () => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
textareaRef: HTMLTextAreaElement | undefined;
|
|
10
|
+
setTextareaRef: (el: HTMLTextAreaElement) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function usePromptInput(): PromptInputContextType;
|
|
13
|
+
export interface PromptInputProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
value?: string;
|
|
16
|
+
onValueChange?: (value: string) => void;
|
|
17
|
+
maxHeight?: number | string;
|
|
18
|
+
onSubmit?: () => void;
|
|
19
|
+
children: JSX.Element;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare function PromptInput(props: PromptInputProps): JSX.Element;
|
|
23
|
+
export interface PromptInputTextareaProps extends JSX.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
24
|
+
disableAutosize?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare function PromptInputTextarea(props: PromptInputTextareaProps): JSX.Element;
|
|
27
|
+
export interface PromptInputActionsProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
28
|
+
children: JSX.Element;
|
|
29
|
+
}
|
|
30
|
+
declare function PromptInputActions(props: PromptInputActionsProps): JSX.Element;
|
|
31
|
+
export interface PromptInputActionProps {
|
|
32
|
+
tooltip?: string;
|
|
33
|
+
children: JSX.Element;
|
|
34
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
35
|
+
class?: string;
|
|
36
|
+
}
|
|
37
|
+
declare function PromptInputAction(props: PromptInputActionProps): JSX.Element;
|
|
38
|
+
export { PromptInput, PromptInputTextarea, PromptInputActions, PromptInputAction, usePromptInput, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface PromptSuggestionProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
children: JSX.Element | string;
|
|
4
|
+
variant?: 'outline' | 'ghost' | 'default';
|
|
5
|
+
size?: 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
|
|
6
|
+
highlight?: string;
|
|
7
|
+
/** Render as a full-width, left-aligned list row (the "suggested questions"
|
|
8
|
+
* idiom) instead of a rounded pill. Wraps long text. Ignored in highlight
|
|
9
|
+
* mode, which is always a list row. */
|
|
10
|
+
block?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function PromptSuggestion(props: PromptSuggestionProps): JSX.Element;
|
|
13
|
+
export { PromptSuggestion };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface ReasoningProps {
|
|
3
|
+
children: JSX.Element;
|
|
4
|
+
class?: string;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
isStreaming?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function Reasoning(props: ReasoningProps): JSX.Element;
|
|
10
|
+
export interface ReasoningTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
|
+
children: JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare function ReasoningTrigger(props: ReasoningTriggerProps): JSX.Element;
|
|
14
|
+
export interface ReasoningContentProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
children: JSX.Element;
|
|
16
|
+
markdown?: boolean;
|
|
17
|
+
contentClass?: string;
|
|
18
|
+
}
|
|
19
|
+
declare function ReasoningContent(props: ReasoningContentProps): JSX.Element;
|
|
20
|
+
export { Reasoning, ReasoningTrigger, ReasoningContent };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ToolPart } from './tool';
|
|
2
|
+
import { AttachmentData } from './attachments';
|
|
3
|
+
/** One assistant response in a comparison. Rendered identically to an assistant
|
|
4
|
+
* message (reasoning + tools + attachments + markdown content) via `MessageBody`. */
|
|
5
|
+
export interface CompareCandidate {
|
|
6
|
+
/** Stable id, unique within the pair; echoed back in the selection. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The response text/markdown. */
|
|
9
|
+
content: string;
|
|
10
|
+
/** Optional collapsible reasoning block. */
|
|
11
|
+
reasoning?: {
|
|
12
|
+
text: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Tool-call parts rendered above the content. */
|
|
16
|
+
tools?: ToolPart[];
|
|
17
|
+
/** Inline attachment previews rendered above the content. */
|
|
18
|
+
attachments?: AttachmentData[];
|
|
19
|
+
/** Optional short column label (e.g. "A" / "B" / "Concise"). */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Optional model name shown as a sub-label. */
|
|
22
|
+
model?: string;
|
|
23
|
+
/** When true this candidate is still streaming — its pick control is disabled
|
|
24
|
+
* and a per-column shimmer shows until it (and its sibling) settle. */
|
|
25
|
+
streaming?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** The two-candidate tuple. Enforced at the type level; validated at runtime by
|
|
28
|
+
* `normalizeCandidates`. */
|
|
29
|
+
export type ComparePair = [CompareCandidate, CompareCandidate];
|
|
30
|
+
/** How the card collapses once the user picks. `'winner'` (default) shows just the
|
|
31
|
+
* chosen candidate's body; `'none'` keeps both columns but marks the choice. */
|
|
32
|
+
export type CompareCollapse = 'winner' | 'none';
|
|
33
|
+
/** The compare definition (set as the `data` JS property on `<kai-compare>`). */
|
|
34
|
+
export interface ResponseCompareData {
|
|
35
|
+
/** Optional prompt/question shown above the two columns. */
|
|
36
|
+
prompt?: string;
|
|
37
|
+
/** Exactly two candidates: [A, B]. */
|
|
38
|
+
candidates: ComparePair;
|
|
39
|
+
/** Collapse behaviour after a pick. Default `'winner'`. */
|
|
40
|
+
collapse?: CompareCollapse;
|
|
41
|
+
}
|
|
42
|
+
/** Emitted (and re-hydratable) when the user picks. The consumer pairs
|
|
43
|
+
* `(prompt, chosenId, rejectedIds)` for preference capture / RLHF. */
|
|
44
|
+
export interface CompareSelection {
|
|
45
|
+
/** The id of the chosen candidate. */
|
|
46
|
+
chosenId: string;
|
|
47
|
+
/** The id(s) of the rejected candidate(s) — for a pair, the other one. */
|
|
48
|
+
rejectedIds: string[];
|
|
49
|
+
/** Epoch ms when the pick was made. */
|
|
50
|
+
at?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validate + normalize the candidate list. A compare requires EXACTLY two
|
|
54
|
+
* candidates with unique, non-empty string ids. Returns the usable pair, or an
|
|
55
|
+
* error message when the definition is unusable (rendered as an inline error /
|
|
56
|
+
* emitted as a `kai-error`). Modeled on `normalizeOptions`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function normalizeCandidates(candidates: unknown): {
|
|
59
|
+
candidates: ComparePair | null;
|
|
60
|
+
error?: string;
|
|
61
|
+
};
|
|
62
|
+
/** Build the selection payload for choosing `chosenId` out of the pair (the other
|
|
63
|
+
* candidate is the rejected one). Stamps `at` with the current time. */
|
|
64
|
+
export declare function buildSelection(pair: ComparePair, chosenId: string): CompareSelection;
|
|
65
|
+
/** Whether any candidate in the pair is still streaming (pick stays disabled). */
|
|
66
|
+
export declare function isAnyStreaming(pair: ComparePair | null): boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { JSX, Accessor } from 'solid-js';
|
|
2
|
+
import { CompareSelection, ResponseCompareData } from './response-compare-types';
|
|
3
|
+
export type { CompareCandidate, ComparePair, CompareCollapse, ResponseCompareData, CompareSelection, } from './response-compare-types';
|
|
4
|
+
export { normalizeCandidates, buildSelection, isAnyStreaming } from './response-compare-types';
|
|
5
|
+
export type CompareLayout = 'auto' | 'columns' | 'tabs';
|
|
6
|
+
export interface ResolvedController<T> {
|
|
7
|
+
value: Accessor<T | undefined>;
|
|
8
|
+
isResolved: Accessor<boolean>;
|
|
9
|
+
isOptimistic: Accessor<boolean>;
|
|
10
|
+
setLocal: (v: T) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function useResolved<T>(opts: {
|
|
13
|
+
prop: Accessor<T | undefined>;
|
|
14
|
+
data: Accessor<unknown>;
|
|
15
|
+
}): ResolvedController<T>;
|
|
16
|
+
export interface ResponseCompareProps {
|
|
17
|
+
/** The compare definition (prompt + the two candidates). */
|
|
18
|
+
data?: ResponseCompareData;
|
|
19
|
+
/** Stable id correlating every emitted event. */
|
|
20
|
+
compareId?: string;
|
|
21
|
+
/** Re-hydrate / control the selection. Renders the collapsed winner. Set as a
|
|
22
|
+
* JS property: `el.selection = { chosenId, rejectedIds }`. */
|
|
23
|
+
selection?: CompareSelection;
|
|
24
|
+
/** Layout. `'columns'` = side-by-side; `'tabs'` = one candidate at a time with
|
|
25
|
+
* pills to switch; `'auto'` (default) uses a CONTAINER query — columns when the
|
|
26
|
+
* component is ≥640px wide, tabs when narrower (e.g. on a phone). */
|
|
27
|
+
layout?: CompareLayout;
|
|
28
|
+
class?: string;
|
|
29
|
+
/** Fired when the user commits a pick. */
|
|
30
|
+
onSelect?: (sel: CompareSelection) => void;
|
|
31
|
+
/** Fired once both candidates have settled (stopped streaming) and a valid
|
|
32
|
+
* definition is shown. */
|
|
33
|
+
onReady?: () => void;
|
|
34
|
+
/** Fired for an unusable definition (inline error state). */
|
|
35
|
+
onError?: (message: string) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `ResponseCompare` — a dual-response comparison. Two assistant candidates for the
|
|
39
|
+
* same prompt render side-by-side (or as tabs), each via `MessageBody` so a
|
|
40
|
+
* candidate reads exactly like an assistant message (reasoning + tools +
|
|
41
|
+
* attachments + markdown). The pick is a COMMIT, not a Submit: clicking "Pick this"
|
|
42
|
+
* (or Enter on the focused column) computes `{ chosenId, rejectedIds:[other], at }`,
|
|
43
|
+
* optimistically collapses to the chosen candidate's body, and calls `onSelect` for
|
|
44
|
+
* the consumer to send a `(prompt, chosen, rejected)` preference pair. Single-shot.
|
|
45
|
+
*
|
|
46
|
+
* While EITHER candidate is `streaming`, both pick controls are disabled and the
|
|
47
|
+
* streaming column shows a `TextShimmer`; `onReady` fires once both settle. The two
|
|
48
|
+
* columns are a WAI-ARIA radiogroup with roving tabindex (Arrow keys move A↔B,
|
|
49
|
+
* Enter/Space picks). Emits `onError` for a malformed definition.
|
|
50
|
+
*/
|
|
51
|
+
export declare function ResponseCompare(props: ResponseCompareProps): JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Mode = 'typewriter' | 'fade';
|
|
2
|
+
export interface ResponseStreamProps {
|
|
3
|
+
textStream: string | AsyncIterable<string>;
|
|
4
|
+
mode?: Mode;
|
|
5
|
+
speed?: number;
|
|
6
|
+
class?: string;
|
|
7
|
+
onComplete?: () => void;
|
|
8
|
+
as?: string;
|
|
9
|
+
fadeDuration?: number;
|
|
10
|
+
segmentDelay?: number;
|
|
11
|
+
characterChunkSize?: number;
|
|
12
|
+
}
|
|
13
|
+
declare function ResponseStream(props: ResponseStreamProps): import("solid-js").JSX.Element;
|
|
14
|
+
export { ResponseStream };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ScrollButtonProps {
|
|
2
|
+
class?: string;
|
|
3
|
+
variant?: 'outline' | 'ghost' | 'default';
|
|
4
|
+
size?: 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
|
|
5
|
+
}
|
|
6
|
+
declare function ScrollButton(props: ScrollButtonProps): import("solid-js").JSX.Element;
|
|
7
|
+
export { ScrollButton };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface SlashCommandItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
category?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SlashCommandProps {
|
|
8
|
+
commands: SlashCommandItem[];
|
|
9
|
+
activeIds?: string[];
|
|
10
|
+
onSelect: (command: SlashCommandItem) => void;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function SlashCommand(props: SlashCommandProps): import("solid-js").JSX.Element;
|
|
15
|
+
export { SlashCommand };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface SourceProps {
|
|
3
|
+
href: string;
|
|
4
|
+
children: JSX.Element;
|
|
5
|
+
}
|
|
6
|
+
declare function Source(props: SourceProps): JSX.Element;
|
|
7
|
+
export interface SourceTriggerProps {
|
|
8
|
+
label?: string | number;
|
|
9
|
+
showFavicon?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function SourceTrigger(props: SourceTriggerProps): JSX.Element;
|
|
13
|
+
export interface SourceContentProps {
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
declare function SourceContent(props: SourceContentProps): JSX.Element;
|
|
19
|
+
declare function SourceList(props: {
|
|
20
|
+
children: JSX.Element;
|
|
21
|
+
class?: string;
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
export { Source, SourceTrigger, SourceContent, SourceList };
|