@kitnai/chat 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/custom-elements.json +1626 -883
- package/dist/kitn-chat.es.js +36 -36
- package/dist/llms/llms-full.txt +303 -142
- package/dist/llms/llms.txt +18 -18
- package/dist/schemas/card-envelope.schema.json +14 -0
- package/dist/schemas/card-event.schema.json +12 -0
- package/dist/schemas/confirm.schema.json +65 -0
- package/dist/schemas/embed.schema.json +65 -0
- package/dist/schemas/form.result.schema.json +7 -0
- package/dist/schemas/form.schema.json +33 -0
- package/dist/schemas/link.schema.json +56 -0
- package/dist/schemas/task-list.result.schema.json +16 -0
- package/dist/schemas/task-list.schema.json +78 -0
- package/dist/theme.tokens.css +65 -65
- package/dist/tsx-B8rCNbgL.js +1 -0
- package/dist/typescript-RycA9KXf.js +1 -0
- package/frameworks/react/index.tsx +356 -189
- package/frameworks/react/runtime.tsx +2 -2
- package/llms-full.txt +303 -142
- package/llms.txt +18 -18
- package/package.json +5 -2
- package/src/components/artifact.stories.tsx +138 -0
- package/src/components/artifact.tsx +581 -0
- package/src/components/attachments.stories.tsx +7 -8
- package/src/components/attachments.tsx +2 -2
- package/src/components/card.tsx +110 -0
- package/src/components/chain-of-thought.stories.tsx +7 -8
- package/src/components/chat-container.stories.tsx +7 -8
- package/src/components/chat-container.tsx +4 -0
- package/src/components/checkpoint.stories.tsx +7 -8
- package/src/components/checkpoint.tsx +3 -0
- package/src/components/code-block.stories.tsx +8 -9
- package/src/components/code-block.tsx +5 -2
- package/src/components/component-meta.json +3419 -0
- package/src/components/confirm-card.stories.tsx +74 -0
- package/src/components/confirm-card.tsx +299 -0
- package/src/components/context.stories.tsx +7 -8
- package/src/components/conversation-item.stories.tsx +7 -8
- package/src/components/conversation-item.tsx +2 -2
- package/src/components/conversation-list.stories.tsx +7 -8
- package/src/components/conversation-list.tsx +1 -1
- package/src/components/embed.tsx +196 -0
- package/src/components/empty.stories.tsx +8 -9
- package/src/components/feedback-bar.stories.tsx +7 -8
- package/src/components/file-tree.stories.tsx +73 -0
- package/src/components/file-tree.tsx +383 -0
- package/src/components/file-upload.stories.tsx +7 -8
- package/src/components/form-widgets.tsx +461 -0
- package/src/components/form.tsx +796 -0
- package/src/components/image.stories.tsx +7 -8
- package/src/components/link-card.tsx +194 -0
- package/src/components/loader.stories.tsx +7 -8
- package/src/components/markdown.stories.tsx +7 -8
- package/src/components/message-narrow.stories.tsx +12 -13
- package/src/components/message-skills.stories.tsx +16 -17
- package/src/components/message.stories.tsx +17 -18
- package/src/components/model-switcher.stories.tsx +7 -8
- package/src/components/prompt-input.stories.tsx +8 -9
- package/src/components/prompt-suggestion.stories.tsx +7 -8
- package/src/components/prompt-suggestion.tsx +3 -3
- package/src/components/reasoning.stories.tsx +7 -8
- package/src/components/scroll-button.stories.tsx +7 -8
- package/src/components/slash-command.stories.tsx +8 -9
- package/src/components/slash-command.tsx +2 -2
- package/src/components/source.stories.tsx +7 -8
- package/src/components/source.tsx +1 -1
- package/src/components/task-list-card.stories.tsx +78 -0
- package/src/components/task-list-card.tsx +388 -0
- package/src/components/text-shimmer.stories.tsx +7 -8
- package/src/components/thinking-bar.stories.tsx +7 -8
- package/src/components/tool.stories.tsx +7 -8
- package/src/components/tool.tsx +2 -2
- package/src/components/voice-input.stories.tsx +7 -8
- package/src/elements/artifact.stories.tsx +291 -0
- package/src/elements/artifact.tsx +72 -0
- package/src/elements/{kitn-attachments.stories.tsx → attachments.stories.tsx} +11 -20
- package/src/elements/attachments.tsx +4 -4
- package/src/elements/card.stories.tsx +118 -0
- package/src/elements/card.tsx +40 -0
- package/src/elements/catalog.stories.tsx +491 -0
- package/src/elements/{kitn-chain-of-thought.stories.tsx → chain-of-thought.stories.tsx} +13 -22
- package/src/elements/chain-of-thought.tsx +3 -3
- package/src/elements/{kitn-chat-scope-picker.stories.tsx → chat-scope-picker.stories.tsx} +10 -19
- package/src/elements/chat-scope-picker.tsx +4 -4
- package/src/elements/{kitn-chat-workspace.stories.tsx → chat-workspace.stories.tsx} +15 -23
- package/src/elements/chat-workspace.tsx +2 -2
- package/src/elements/{kitn-chat.stories.tsx → chat.stories.tsx} +12 -20
- package/src/elements/chat.tsx +2 -2
- package/src/elements/{kitn-checkpoint.stories.tsx → checkpoint.stories.tsx} +11 -20
- package/src/elements/checkpoint.tsx +8 -4
- package/src/elements/{kitn-code-block.stories.tsx → code-block.stories.tsx} +10 -19
- package/src/elements/code-block.tsx +3 -3
- package/src/elements/compiled.css +1 -1
- package/src/elements/composed-shell.stories.tsx +316 -0
- package/src/elements/confirm-card.stories.tsx +186 -0
- package/src/elements/confirm-card.tsx +45 -0
- package/src/elements/{kitn-context-meter.stories.tsx → context-meter.stories.tsx} +10 -19
- package/src/elements/context-meter.tsx +3 -3
- package/src/elements/{kitn-conversation-list.stories.tsx → conversation-list.stories.tsx} +12 -20
- package/src/elements/conversation-list.tsx +2 -2
- package/src/elements/css.ts +1 -1
- package/src/elements/define.tsx +10 -10
- package/src/elements/element-meta.json +1379 -733
- package/src/elements/element-types.d.ts +251 -125
- package/src/elements/embed.stories.tsx +197 -0
- package/src/elements/embed.tsx +35 -0
- package/src/elements/{kitn-empty.stories.tsx → empty.stories.tsx} +12 -21
- package/src/elements/empty.tsx +3 -3
- package/src/elements/{kitn-feedback-bar.stories.tsx → feedback-bar.stories.tsx} +11 -20
- package/src/elements/feedback-bar.tsx +4 -4
- package/src/elements/file-tree.stories.tsx +133 -0
- package/src/elements/file-tree.tsx +52 -0
- package/src/elements/{kitn-file-upload.stories.tsx → file-upload.stories.tsx} +12 -21
- package/src/elements/file-upload.tsx +4 -4
- package/src/elements/form.stories.tsx +204 -0
- package/src/elements/form.tsx +37 -0
- package/src/elements/{kitn-image.stories.tsx → image.stories.tsx} +10 -19
- package/src/elements/image.tsx +3 -3
- package/src/elements/link-card.stories.tsx +193 -0
- package/src/elements/link-card.tsx +34 -0
- package/src/elements/{kitn-loader.stories.tsx → loader.stories.tsx} +11 -20
- package/src/elements/loader.tsx +3 -3
- package/src/elements/{kitn-markdown.stories.tsx → markdown.stories.tsx} +10 -19
- package/src/elements/markdown.tsx +3 -3
- package/src/elements/{kitn-message-skills.stories.tsx → message-skills.stories.tsx} +10 -19
- package/src/elements/message-skills.tsx +3 -3
- package/src/elements/{kitn-message.stories.tsx → message.stories.tsx} +12 -21
- package/src/elements/message.tsx +5 -5
- package/src/elements/{kitn-model-switcher.stories.tsx → model-switcher.stories.tsx} +10 -19
- package/src/elements/model-switcher.tsx +5 -5
- package/src/elements/{kitn-prompt-input.stories.tsx → prompt-input.stories.tsx} +14 -22
- package/src/elements/prompt-input.tsx +3 -3
- package/src/elements/{kitn-prompt-suggestions.stories.tsx → prompt-suggestions.stories.tsx} +13 -22
- package/src/elements/prompt-suggestions.tsx +4 -4
- package/src/elements/{kitn-reasoning.stories.tsx → reasoning.stories.tsx} +10 -19
- package/src/elements/reasoning.tsx +4 -4
- package/src/elements/register.ts +11 -1
- package/src/elements/resizable.stories.tsx +200 -0
- package/src/elements/resizable.tsx +264 -0
- package/src/elements/{kitn-response-stream.stories.tsx → response-stream.stories.tsx} +10 -19
- package/src/elements/response-stream.tsx +4 -4
- package/src/elements/{kitn-source-list.stories.tsx → source-list.stories.tsx} +11 -20
- package/src/elements/{kitn-source.stories.tsx → source.stories.tsx} +12 -21
- package/src/elements/source.tsx +5 -5
- package/src/elements/styles.css +140 -1
- package/src/elements/task-list-card.stories.tsx +194 -0
- package/src/elements/task-list-card.tsx +40 -0
- package/src/elements/{kitn-text-shimmer.stories.tsx → text-shimmer.stories.tsx} +10 -19
- package/src/elements/text-shimmer.tsx +3 -3
- package/src/elements/{kitn-thinking-bar.stories.tsx → thinking-bar.stories.tsx} +11 -20
- package/src/elements/thinking-bar.tsx +5 -5
- package/src/elements/{kitn-tool.stories.tsx → tool.stories.tsx} +10 -19
- package/src/elements/tool.tsx +3 -3
- package/src/elements/{kitn-voice-input.stories.tsx → voice-input.stories.tsx} +10 -19
- package/src/elements/voice-input.tsx +4 -4
- package/src/index.ts +94 -2
- package/src/primitives/card-contract.ts +60 -0
- package/src/primitives/card-host.tsx +35 -0
- package/src/primitives/card-routing.ts +79 -0
- package/src/primitives/card-schemas/card-envelope.schema.json +14 -0
- package/src/primitives/card-schemas/card-event.schema.json +12 -0
- package/src/primitives/card-schemas/confirm.schema.json +65 -0
- package/src/primitives/card-schemas/embed.schema.json +65 -0
- package/src/primitives/card-schemas/form.result.schema.json +7 -0
- package/src/primitives/card-schemas/form.schema.json +33 -0
- package/src/primitives/card-schemas/link.schema.json +56 -0
- package/src/primitives/card-schemas/task-list.result.schema.json +16 -0
- package/src/primitives/card-schemas/task-list.schema.json +78 -0
- package/src/primitives/card-validate.ts +95 -0
- package/src/primitives/embed-providers.ts +254 -0
- package/src/primitives/highlighter.ts +4 -0
- package/src/primitives/link-preview.ts +87 -0
- package/src/primitives/pdf-preview.ts +121 -0
- package/src/stories/chat-panel-layout.stories.tsx +2 -1
- package/src/stories/chat-scene.tsx +22 -21
- package/src/stories/checkpoint-restore.stories.tsx +10 -10
- package/src/stories/conversation-with-reasoning.stories.tsx +4 -4
- package/src/stories/conversation-with-sources.stories.tsx +7 -7
- package/src/stories/docs/Accessibility.mdx +2 -2
- package/src/stories/docs/ForAIAgents.mdx +3 -3
- package/src/stories/docs/GettingStarted.mdx +2 -2
- package/src/stories/docs/Installation.mdx +2 -2
- package/src/stories/docs/Integrations.mdx +29 -29
- package/src/stories/docs/Introduction.mdx +3 -3
- package/src/stories/docs/Theming.mdx +2 -2
- package/src/stories/docs/element-controls.ts +32 -0
- package/src/stories/docs/theme-editor/theme-editor.tsx +1 -0
- package/src/stories/examples/ChoosingComponents.mdx +94 -0
- package/src/stories/examples/sample-data.ts +79 -0
- package/src/stories/message-actions.stories.tsx +13 -13
- package/src/stories/pattern-centered-conversation.stories.tsx +3 -3
- package/src/stories/pattern-docked-widget.stories.tsx +1 -1
- package/src/stories/pattern-empty-state.stories.tsx +3 -3
- package/src/stories/prompt-input-variants.stories.tsx +13 -13
- package/src/stories/streaming-response.stories.tsx +3 -3
- package/src/stories/typography.stories.tsx +4 -4
- package/src/ui/avatar.stories.tsx +7 -8
- package/src/ui/badge.stories.tsx +7 -8
- package/src/ui/button.stories.tsx +8 -9
- package/src/ui/button.tsx +1 -0
- package/src/ui/collapsible.stories.tsx +6 -7
- package/src/ui/dropdown.stories.tsx +6 -7
- package/src/ui/hover-card.stories.tsx +6 -7
- package/src/ui/resizable.stories.tsx +74 -9
- package/src/ui/resizable.tsx +351 -71
- package/src/ui/scroll-area.stories.tsx +6 -7
- package/src/ui/scroll-area.tsx +3 -1
- package/src/ui/separator.stories.tsx +7 -8
- package/src/ui/skeleton.stories.tsx +7 -8
- package/src/ui/textarea.stories.tsx +6 -7
- package/src/ui/tooltip.stories.tsx +8 -9
- package/theme.css +65 -65
- package/src/stories/docs/element-spec.tsx +0 -86
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/gen-element-api.mjs — do not edit by hand.
|
|
2
2
|
// Typed React wrappers for every kitn custom element. Usage:
|
|
3
|
-
// import {
|
|
4
|
-
// <
|
|
5
|
-
import {
|
|
3
|
+
// import { KcMessage } from '@kitnai/chat/react';
|
|
4
|
+
// <KcMessage message={msg} onMessageaction={(e) => …} />
|
|
5
|
+
import { createWebComponent, type WebComponentProps } from './runtime';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export interface KcArtifactProps extends WebComponentProps {
|
|
9
|
+
/** URL the preview iframe frames. Consumer-controlled. */
|
|
10
|
+
src?: string;
|
|
11
|
+
/** Files for the Code tab tree + each file's preview `url`. Set as a JS property (array). */
|
|
12
|
+
files: { path: string; url?: undefined | string; code?: undefined | string; language?: undefined | string; type?: undefined | "html" | "pdf" | "image" | "other" }[];
|
|
13
|
+
/** Active tab: `preview` (default) or `code`. */
|
|
14
|
+
tab?: "preview" | "code";
|
|
15
|
+
/** Selected file path — syncs the tree highlight, Code source, and preview. */
|
|
16
|
+
activeFile?: string;
|
|
17
|
+
/** iframe `sandbox` override. Secure default `allow-scripts allow-forms` (NOT `allow-same-origin`). */
|
|
18
|
+
sandbox?: string;
|
|
19
|
+
/** Accessible title for the preview iframe. */
|
|
20
|
+
iframeTitle?: string;
|
|
21
|
+
/** Fired when a file is selected. `detail.path`. */
|
|
22
|
+
onFileselect?: (event: CustomEvent<{ path: string }>) => void;
|
|
23
|
+
/** Fired when the preview navigates. `detail.url` = the new location. */
|
|
24
|
+
onNavigate?: (event: CustomEvent<{ url: string }>) => void;
|
|
25
|
+
/** Fired when the Preview|Code tab changes. `detail.tab`. */
|
|
26
|
+
onTabchange?: (event: CustomEvent<{ tab: "preview" | "code" }>) => void;
|
|
27
|
+
}
|
|
6
28
|
|
|
29
|
+
export const KcArtifact = createWebComponent<KcArtifactProps>(
|
|
30
|
+
'kc-artifact',
|
|
31
|
+
["theme","src","files","tab","activeFile","sandbox","iframeTitle"],
|
|
32
|
+
{ onFileselect: 'fileselect', onNavigate: 'navigate', onTabchange: 'tabchange' },
|
|
33
|
+
);
|
|
7
34
|
|
|
8
|
-
export interface
|
|
35
|
+
export interface KcAttachmentsProps extends WebComponentProps {
|
|
9
36
|
/** The attachments to render. Set as a JS property (array). */
|
|
10
37
|
items: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[];
|
|
11
38
|
/** Layout: `grid` = visual tiles, `inline` = icon + label chips, `list` = rows. */
|
|
@@ -22,24 +49,41 @@ export interface KitnAttachmentsProps extends KitnBaseProps {
|
|
|
22
49
|
onRemove?: (event: CustomEvent<{ id: string }>) => void;
|
|
23
50
|
}
|
|
24
51
|
|
|
25
|
-
export const
|
|
26
|
-
'
|
|
52
|
+
export const KcAttachments = createWebComponent<KcAttachmentsProps>(
|
|
53
|
+
'kc-attachments',
|
|
27
54
|
["theme","items","variant","hoverCard","removable","showMediaType","emptyText"],
|
|
28
55
|
{ onRemove: 'remove' },
|
|
29
56
|
);
|
|
30
57
|
|
|
31
|
-
export interface
|
|
58
|
+
export interface KcCardProps extends WebComponentProps {
|
|
59
|
+
/** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
|
|
60
|
+
heading?: string;
|
|
61
|
+
/** Supporting text under the heading. Attribute: `description`. */
|
|
62
|
+
description?: string;
|
|
63
|
+
/** When set, the card renders its inline error state instead of the body. Attribute: `error-message`. */
|
|
64
|
+
errorMessage?: string;
|
|
65
|
+
/** Compact spacing for dense lists. Attribute: `dense`. */
|
|
66
|
+
dense?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const KcCard = createWebComponent<KcCardProps>(
|
|
70
|
+
'kc-card',
|
|
71
|
+
["theme","heading","description","errorMessage","dense"],
|
|
72
|
+
{ },
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export interface KcChainOfThoughtProps extends WebComponentProps {
|
|
32
76
|
/** The reasoning steps. Set as a JS property. Compound sub-parts collapse to this one data model (Route 1). */
|
|
33
77
|
steps: { label: string; content?: undefined | string }[];
|
|
34
78
|
}
|
|
35
79
|
|
|
36
|
-
export const
|
|
37
|
-
'
|
|
80
|
+
export const KcChainOfThought = createWebComponent<KcChainOfThoughtProps>(
|
|
81
|
+
'kc-chain-of-thought',
|
|
38
82
|
["theme","steps"],
|
|
39
83
|
{ },
|
|
40
84
|
);
|
|
41
85
|
|
|
42
|
-
export interface
|
|
86
|
+
export interface KcChatProps extends WebComponentProps {
|
|
43
87
|
/** The full message thread to render, newest last. Each entry carries its role, content, and optional reasoning/tools/attachments/actions. Set as a JS property (`el.messages = [...]`). */
|
|
44
88
|
messages: { id: string; role: "user" | "assistant"; content: string; reasoning?: undefined | { text: string; label?: undefined | string }; tools?: undefined | { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string }[]; attachments?: undefined | { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit")[] }[];
|
|
45
89
|
/** Controlled value of the input. When set, the host owns the input text and must update it on `valuechange`; leave unset for uncontrolled behavior. */
|
|
@@ -96,95 +140,13 @@ export interface KitnChatProps extends KitnBaseProps {
|
|
|
96
140
|
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
97
141
|
}
|
|
98
142
|
|
|
99
|
-
export const
|
|
100
|
-
'
|
|
143
|
+
export const KcChat = createWebComponent<KcChatProps>(
|
|
144
|
+
'kc-chat',
|
|
101
145
|
["theme","messages","value","placeholder","loading","suggestions","suggestionMode","proseSize","codeTheme","codeHighlight","chatTitle","models","currentModel","context","scrollButton","search","voice","slashCommands","slashActiveIds","slashCompact"],
|
|
102
146
|
{ onMessageaction: 'messageaction', onModelchange: 'modelchange', onSearch: 'search', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
103
147
|
);
|
|
104
148
|
|
|
105
|
-
export interface
|
|
106
|
-
/** Authors to offer as scope filters. Set as a JS property. */
|
|
107
|
-
availableAuthors: string[];
|
|
108
|
-
/** Tags to offer as scope filters. Set as a JS property. */
|
|
109
|
-
availableTags: string[];
|
|
110
|
-
/** The label shown on the trigger for the active scope. */
|
|
111
|
-
currentLabel?: string;
|
|
112
|
-
/** A scope was chosen (`undefined` filters = "All Content"). */
|
|
113
|
-
onScopechange?: (event: CustomEvent<{ filters: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }>) => void;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export const KitnChatScopePicker = createKitnComponent<KitnChatScopePickerProps>(
|
|
117
|
-
'kitn-chat-scope-picker',
|
|
118
|
-
["theme","availableAuthors","availableTags","currentLabel"],
|
|
119
|
-
{ onScopechange: 'scopechange' },
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
export interface KitnChatWorkspaceProps extends KitnBaseProps {
|
|
123
|
-
/** Pre-bucketed conversation groups for the sidebar. Set as a JS property. */
|
|
124
|
-
groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
|
|
125
|
-
/** Flat conversation list (auto-bucketed if `groups` is empty). Set as a JS property. */
|
|
126
|
-
conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
|
|
127
|
-
/** Id of the open conversation, highlighted in the sidebar. */
|
|
128
|
-
activeId?: string;
|
|
129
|
-
/** The active conversation's message thread, newest last. Set as a JS property. */
|
|
130
|
-
messages: { id: string; role: "user" | "assistant"; content: string; reasoning?: undefined | { text: string; label?: undefined | string }; tools?: undefined | { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string }[]; attachments?: undefined | { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit")[] }[];
|
|
131
|
-
value?: string;
|
|
132
|
-
placeholder?: string;
|
|
133
|
-
loading?: boolean;
|
|
134
|
-
suggestions?: string[];
|
|
135
|
-
suggestionMode?: "submit" | "fill";
|
|
136
|
-
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
137
|
-
codeTheme?: string;
|
|
138
|
-
codeHighlight?: boolean;
|
|
139
|
-
chatTitle?: string;
|
|
140
|
-
models?: { id: string; name: string; provider?: string }[];
|
|
141
|
-
currentModel?: string;
|
|
142
|
-
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; estimatedCost?: number };
|
|
143
|
-
scrollButton?: boolean;
|
|
144
|
-
search?: boolean;
|
|
145
|
-
voice?: boolean;
|
|
146
|
-
slashCommands?: { id: string; label: string; description?: string; category?: string }[];
|
|
147
|
-
slashActiveIds?: string[];
|
|
148
|
-
slashCompact?: boolean;
|
|
149
|
-
/** Sidebar default width as a percent of the workspace (default 22). */
|
|
150
|
-
sidebarWidth?: number;
|
|
151
|
-
/** Sidebar min width in px (default 200). */
|
|
152
|
-
sidebarMinWidth?: number;
|
|
153
|
-
/** Sidebar max width in px (default 420). */
|
|
154
|
-
sidebarMaxWidth?: number;
|
|
155
|
-
/** Initial collapsed state of the sidebar (default false). */
|
|
156
|
-
sidebarCollapsed?: boolean;
|
|
157
|
-
/** A conversation was selected in the sidebar. */
|
|
158
|
-
onConversationselect?: (event: CustomEvent<{ id: string }>) => void;
|
|
159
|
-
/** An action button on a message was clicked. */
|
|
160
|
-
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
161
|
-
/** The header model switcher changed. */
|
|
162
|
-
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
163
|
-
/** The "New chat" button was clicked. */
|
|
164
|
-
onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
|
|
165
|
-
/** The Search button was clicked. */
|
|
166
|
-
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
167
|
-
/** The sidebar was collapsed or expanded. */
|
|
168
|
-
onSidebartoggle?: (event: CustomEvent<{ collapsed: boolean }>) => void;
|
|
169
|
-
/** A slash command was chosen from the palette. */
|
|
170
|
-
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
171
|
-
/** User submitted a message. */
|
|
172
|
-
onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
|
|
173
|
-
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
174
|
-
onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
|
|
175
|
-
/** Fired on every input change. */
|
|
176
|
-
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
177
|
-
/** The Mic / voice button was clicked. */
|
|
178
|
-
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export const KitnChatWorkspace = createKitnComponent<KitnChatWorkspaceProps>(
|
|
182
|
-
'kitn-chat-workspace',
|
|
183
|
-
["theme","groups","conversations","activeId","messages","value","placeholder","loading","suggestions","suggestionMode","proseSize","codeTheme","codeHighlight","chatTitle","models","currentModel","context","scrollButton","search","voice","slashCommands","slashActiveIds","slashCompact","sidebarWidth","sidebarMinWidth","sidebarMaxWidth","sidebarCollapsed"],
|
|
184
|
-
{ onConversationselect: 'conversationselect', onMessageaction: 'messageaction', onModelchange: 'modelchange', onNewchat: 'newchat', onSearch: 'search', onSidebartoggle: 'sidebartoggle', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
export interface KitnCheckpointProps extends KitnBaseProps {
|
|
149
|
+
export interface KcCheckpointProps extends WebComponentProps {
|
|
188
150
|
/** Optional text beside the icon. */
|
|
189
151
|
label?: string;
|
|
190
152
|
/** Tooltip on hover. */
|
|
@@ -197,13 +159,13 @@ export interface KitnCheckpointProps extends KitnBaseProps {
|
|
|
197
159
|
onSelect?: (event: CustomEvent) => void;
|
|
198
160
|
}
|
|
199
161
|
|
|
200
|
-
export const
|
|
201
|
-
'
|
|
162
|
+
export const KcCheckpoint = createWebComponent<KcCheckpointProps>(
|
|
163
|
+
'kc-checkpoint',
|
|
202
164
|
["theme","label","tooltip","variant","size"],
|
|
203
165
|
{ onSelect: 'select' },
|
|
204
166
|
);
|
|
205
167
|
|
|
206
|
-
export interface
|
|
168
|
+
export interface KcCodeBlockProps extends WebComponentProps {
|
|
207
169
|
/** The source code to render. */
|
|
208
170
|
code: string;
|
|
209
171
|
/** Language grammar (e.g. `js`, `python`). Defaults to `tsx`. */
|
|
@@ -216,24 +178,41 @@ export interface KitnCodeBlockProps extends KitnBaseProps {
|
|
|
216
178
|
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
217
179
|
}
|
|
218
180
|
|
|
219
|
-
export const
|
|
220
|
-
'
|
|
181
|
+
export const KcCodeBlock = createWebComponent<KcCodeBlockProps>(
|
|
182
|
+
'kc-code-block',
|
|
221
183
|
["theme","code","language","codeTheme","codeHighlight","proseSize"],
|
|
222
184
|
{ },
|
|
223
185
|
);
|
|
224
186
|
|
|
225
|
-
export interface
|
|
187
|
+
export interface KcConfirmProps extends WebComponentProps {
|
|
188
|
+
/** The confirm definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { body, tone, actions:[…] }`. Import `ConfirmCardData` from `@kitnai/chat` for the full shape. */
|
|
189
|
+
data?: Record<string, unknown>;
|
|
190
|
+
/** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
|
|
191
|
+
cardId?: string;
|
|
192
|
+
/** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
|
|
193
|
+
heading?: string;
|
|
194
|
+
/** Focus the default action on mount (off by default — no focus-stealing). Attribute: `autofocus`. */
|
|
195
|
+
autofocus?: boolean;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export const KcConfirm = createWebComponent<KcConfirmProps>(
|
|
199
|
+
'kc-confirm',
|
|
200
|
+
["theme","data","cardId","heading","autofocus"],
|
|
201
|
+
{ },
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
export interface KcContextProps extends WebComponentProps {
|
|
226
205
|
/** Token-usage data. Set as a JS property. */
|
|
227
206
|
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; reasoningTokens?: number; cacheTokens?: number; estimatedCost?: number };
|
|
228
207
|
}
|
|
229
208
|
|
|
230
|
-
export const
|
|
231
|
-
'
|
|
209
|
+
export const KcContext = createWebComponent<KcContextProps>(
|
|
210
|
+
'kc-context',
|
|
232
211
|
["theme","context"],
|
|
233
212
|
{ },
|
|
234
213
|
);
|
|
235
214
|
|
|
236
|
-
export interface
|
|
215
|
+
export interface KcConversationsProps extends WebComponentProps {
|
|
237
216
|
/** Pre-bucketed conversation groups (e.g. "Today", "Yesterday"), each with its own conversations. Use this when you want to control the grouping/headers yourself; otherwise pass a flat `conversations` array. Set as a JS property. */
|
|
238
217
|
groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
|
|
239
218
|
/** A flat list of conversation summaries; the component buckets them by recency for you. Ignored when `groups` is provided. Set as a JS property. */
|
|
@@ -248,26 +227,39 @@ export interface KitnConversationListProps extends KitnBaseProps {
|
|
|
248
227
|
onTogglesidebar?: (event: CustomEvent<Record<string, never>>) => void;
|
|
249
228
|
}
|
|
250
229
|
|
|
251
|
-
export const
|
|
252
|
-
'
|
|
230
|
+
export const KcConversations = createWebComponent<KcConversationsProps>(
|
|
231
|
+
'kc-conversations',
|
|
253
232
|
["theme","groups","conversations","activeId"],
|
|
254
233
|
{ onNewchat: 'newchat', onSelect: 'select', onTogglesidebar: 'togglesidebar' },
|
|
255
234
|
);
|
|
256
235
|
|
|
257
|
-
export interface
|
|
236
|
+
export interface KcEmbedProps extends WebComponentProps {
|
|
237
|
+
/** Stable card id correlating every emitted event. Set as an attribute or property. */
|
|
238
|
+
cardId?: string;
|
|
239
|
+
/** The embed payload (provider + id/url + options). Set as a JS **property** (object). */
|
|
240
|
+
data?: { provider: "youtube" | "vimeo" | "generic"; id?: string; url?: string; title?: string; poster?: string; start?: number; aspectRatio?: "16:9" | "4:3" | "1:1" | "9:16" };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export const KcEmbed = createWebComponent<KcEmbedProps>(
|
|
244
|
+
'kc-embed',
|
|
245
|
+
["theme","cardId","data"],
|
|
246
|
+
{ },
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
export interface KcEmptyProps extends WebComponentProps {
|
|
258
250
|
/** Title text. Attribute: `empty-title` (`title` is a global HTML attribute). */
|
|
259
251
|
emptyTitle?: string;
|
|
260
252
|
/** Description text. */
|
|
261
253
|
description?: string;
|
|
262
254
|
}
|
|
263
255
|
|
|
264
|
-
export const
|
|
265
|
-
'
|
|
256
|
+
export const KcEmpty = createWebComponent<KcEmptyProps>(
|
|
257
|
+
'kc-empty',
|
|
266
258
|
["theme","emptyTitle","description"],
|
|
267
259
|
{ },
|
|
268
260
|
);
|
|
269
261
|
|
|
270
|
-
export interface
|
|
262
|
+
export interface KcFeedbackBarProps extends WebComponentProps {
|
|
271
263
|
/** The banner label (e.g. "Was this helpful?"). Attribute: `bar-title` (`title` is avoided — it's a global HTML attribute). */
|
|
272
264
|
barTitle?: string;
|
|
273
265
|
/** The user dismissed the banner. */
|
|
@@ -278,13 +270,30 @@ export interface KitnFeedbackBarProps extends KitnBaseProps {
|
|
|
278
270
|
onNothelpful?: (event: CustomEvent) => void;
|
|
279
271
|
}
|
|
280
272
|
|
|
281
|
-
export const
|
|
282
|
-
'
|
|
273
|
+
export const KcFeedbackBar = createWebComponent<KcFeedbackBarProps>(
|
|
274
|
+
'kc-feedback-bar',
|
|
283
275
|
["theme","barTitle"],
|
|
284
276
|
{ onClose: 'close', onHelpful: 'helpful', onNothelpful: 'nothelpful' },
|
|
285
277
|
);
|
|
286
278
|
|
|
287
|
-
export interface
|
|
279
|
+
export interface KcFileTreeProps extends WebComponentProps {
|
|
280
|
+
/** The files to render. Set as a JS property (array of `{ path, url?, code?, language?, type? }`). */
|
|
281
|
+
files: { path: string; url?: undefined | string; code?: undefined | string; language?: undefined | string; type?: undefined | "html" | "pdf" | "image" | "other" }[];
|
|
282
|
+
/** Selected file path — highlighted in the tree. */
|
|
283
|
+
activeFile?: string;
|
|
284
|
+
/** Folder paths expanded initially. Omit to start with all folders open. */
|
|
285
|
+
defaultExpanded?: string[];
|
|
286
|
+
/** Fired when a file is selected. `detail.path` = the file's path. */
|
|
287
|
+
onSelect?: (event: CustomEvent<{ path: string }>) => void;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export const KcFileTree = createWebComponent<KcFileTreeProps>(
|
|
291
|
+
'kc-file-tree',
|
|
292
|
+
["theme","files","activeFile","defaultExpanded"],
|
|
293
|
+
{ onSelect: 'select' },
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
export interface KcFileUploadProps extends WebComponentProps {
|
|
288
297
|
/** Allow selecting multiple files (default true). */
|
|
289
298
|
multiple?: boolean;
|
|
290
299
|
/** `accept` attribute for the file picker (e.g. `image/*`). */
|
|
@@ -297,13 +306,28 @@ export interface KitnFileUploadProps extends KitnBaseProps {
|
|
|
297
306
|
onFilesadded?: (event: CustomEvent<{ files: File[] }>) => void;
|
|
298
307
|
}
|
|
299
308
|
|
|
300
|
-
export const
|
|
301
|
-
'
|
|
309
|
+
export const KcFileUpload = createWebComponent<KcFileUploadProps>(
|
|
310
|
+
'kc-file-upload',
|
|
302
311
|
["theme","multiple","accept","disabled","label"],
|
|
303
312
|
{ onFilesadded: 'filesadded' },
|
|
304
313
|
);
|
|
305
314
|
|
|
306
|
-
export interface
|
|
315
|
+
export interface KcFormProps extends WebComponentProps {
|
|
316
|
+
/** The form definition — a JSON Schema (`type:'object'`) + `x-kc-*` UI hints (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { type:'object', properties:{…} }`. Import the `FormDefinition` type from `@kitnai/chat` for the full shape (it is self-referential, so the element types it loosely). */
|
|
317
|
+
data?: Record<string, unknown>;
|
|
318
|
+
/** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
|
|
319
|
+
cardId?: string;
|
|
320
|
+
/** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
|
|
321
|
+
heading?: string;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export const KcForm = createWebComponent<KcFormProps>(
|
|
325
|
+
'kc-form',
|
|
326
|
+
["theme","data","cardId","heading"],
|
|
327
|
+
{ },
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
export interface KcImageProps extends WebComponentProps {
|
|
307
331
|
/** Base64-encoded image data (pair with `media-type`). */
|
|
308
332
|
base64?: string;
|
|
309
333
|
/** Raw image bytes (set as a JS property). */
|
|
@@ -314,13 +338,26 @@ export interface KitnImageProps extends KitnBaseProps {
|
|
|
314
338
|
mediaType?: string;
|
|
315
339
|
}
|
|
316
340
|
|
|
317
|
-
export const
|
|
318
|
-
'
|
|
341
|
+
export const KcImage = createWebComponent<KcImageProps>(
|
|
342
|
+
'kc-image',
|
|
319
343
|
["theme","base64","bytes","alt","mediaType"],
|
|
320
344
|
{ },
|
|
321
345
|
);
|
|
322
346
|
|
|
323
|
-
export interface
|
|
347
|
+
export interface KcLinkCardProps extends WebComponentProps {
|
|
348
|
+
/** Stable card id correlating every emitted event. Set as an attribute or property. */
|
|
349
|
+
cardId?: string;
|
|
350
|
+
/** The link payload (OG metadata). Set as a JS **property** (object). */
|
|
351
|
+
data?: { url: string; title?: string; description?: string; image?: string; imageAlt?: string; favicon?: string; domain?: string; siteName?: string };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export const KcLinkCard = createWebComponent<KcLinkCardProps>(
|
|
355
|
+
'kc-link-card',
|
|
356
|
+
["theme","cardId","data"],
|
|
357
|
+
{ },
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
export interface KcLoaderProps extends WebComponentProps {
|
|
324
361
|
/** The animation style: `'circular' | 'classic' | 'pulse' | 'pulse-dot' | 'dots' | 'typing' | 'wave' | 'bars' | 'terminal' | 'text-blink' | 'text-shimmer' | 'loading-dots'`. Defaults to `'circular'`. */
|
|
325
362
|
variant?: "circular" | "classic" | "pulse" | "pulse-dot" | "dots" | "typing" | "wave" | "bars" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
326
363
|
/** Loader size: `'sm' | 'md' | 'lg'`. Defaults to `'md'`. */
|
|
@@ -329,13 +366,13 @@ export interface KitnLoaderProps extends KitnBaseProps {
|
|
|
329
366
|
text?: string;
|
|
330
367
|
}
|
|
331
368
|
|
|
332
|
-
export const
|
|
333
|
-
'
|
|
369
|
+
export const KcLoader = createWebComponent<KcLoaderProps>(
|
|
370
|
+
'kc-loader',
|
|
334
371
|
["theme","variant","size","text"],
|
|
335
372
|
{ },
|
|
336
373
|
);
|
|
337
374
|
|
|
338
|
-
export interface
|
|
375
|
+
export interface KcMarkdownProps extends WebComponentProps {
|
|
339
376
|
/** The markdown source to render. */
|
|
340
377
|
content: string;
|
|
341
378
|
/** Text/markdown sizing. */
|
|
@@ -346,13 +383,13 @@ export interface KitnMarkdownProps extends KitnBaseProps {
|
|
|
346
383
|
codeHighlight?: boolean;
|
|
347
384
|
}
|
|
348
385
|
|
|
349
|
-
export const
|
|
350
|
-
'
|
|
386
|
+
export const KcMarkdown = createWebComponent<KcMarkdownProps>(
|
|
387
|
+
'kc-markdown',
|
|
351
388
|
["theme","content","proseSize","codeTheme","codeHighlight"],
|
|
352
389
|
{ },
|
|
353
390
|
);
|
|
354
391
|
|
|
355
|
-
export interface
|
|
392
|
+
export interface KcMessageProps extends WebComponentProps {
|
|
356
393
|
/** The full message object. Set as a JS property. */
|
|
357
394
|
message?: { id: string; role: "user" | "assistant"; content: string; reasoning?: { text: string; label?: string }; tools?: { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; output?: Record<string, unknown>; toolCallId?: string; errorText?: string }[]; attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit")[] };
|
|
358
395
|
/** Convenience for simple cases when not passing a `message` object. */
|
|
@@ -371,24 +408,13 @@ export interface KitnMessageProps extends KitnBaseProps {
|
|
|
371
408
|
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
372
409
|
}
|
|
373
410
|
|
|
374
|
-
export const
|
|
375
|
-
'
|
|
411
|
+
export const KcMessage = createWebComponent<KcMessageProps>(
|
|
412
|
+
'kc-message',
|
|
376
413
|
["theme","message","role","content","markdown","proseSize","codeTheme","codeHighlight"],
|
|
377
414
|
{ onMessageaction: 'messageaction' },
|
|
378
415
|
);
|
|
379
416
|
|
|
380
|
-
export interface
|
|
381
|
-
/** The active skills to badge. Set as a JS property. */
|
|
382
|
-
skills: { id: string; name: string }[];
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export const KitnMessageSkills = createKitnComponent<KitnMessageSkillsProps>(
|
|
386
|
-
'kitn-message-skills',
|
|
387
|
-
["theme","skills"],
|
|
388
|
-
{ },
|
|
389
|
-
);
|
|
390
|
-
|
|
391
|
-
export interface KitnModelSwitcherProps extends KitnBaseProps {
|
|
417
|
+
export interface KcModelSwitcherProps extends WebComponentProps {
|
|
392
418
|
/** The selectable models. Set as a JS property (array). */
|
|
393
419
|
models: { id: string; name: string; provider?: undefined | string }[];
|
|
394
420
|
/** The currently-selected model id. Defaults to the first model. */
|
|
@@ -397,13 +423,13 @@ export interface KitnModelSwitcherProps extends KitnBaseProps {
|
|
|
397
423
|
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
398
424
|
}
|
|
399
425
|
|
|
400
|
-
export const
|
|
401
|
-
'
|
|
426
|
+
export const KcModelSwitcher = createWebComponent<KcModelSwitcherProps>(
|
|
427
|
+
'kc-model-switcher',
|
|
402
428
|
["theme","models","currentModel"],
|
|
403
429
|
{ onModelchange: 'modelchange' },
|
|
404
430
|
);
|
|
405
431
|
|
|
406
|
-
export interface
|
|
432
|
+
export interface KcPromptInputProps extends WebComponentProps {
|
|
407
433
|
/** Controlled value of the input. When set, the host owns the text and must update it on `valuechange`; leave unset for uncontrolled behavior. */
|
|
408
434
|
value?: string;
|
|
409
435
|
/** Placeholder text shown in the empty input. */
|
|
@@ -442,34 +468,13 @@ export interface KitnPromptInputProps extends KitnBaseProps {
|
|
|
442
468
|
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
443
469
|
}
|
|
444
470
|
|
|
445
|
-
export const
|
|
446
|
-
'
|
|
471
|
+
export const KcPromptInput = createWebComponent<KcPromptInputProps>(
|
|
472
|
+
'kc-prompt-input',
|
|
447
473
|
["theme","value","placeholder","disabled","loading","suggestions","suggestionMode","slashCommands","slashActiveIds","slashCompact","search","voice","attachments"],
|
|
448
474
|
{ onSearch: 'search', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
449
475
|
);
|
|
450
476
|
|
|
451
|
-
export interface
|
|
452
|
-
/** The suggestions. Strings, or `{ label, value }` when the displayed text and the emitted value differ. Set as a JS property. */
|
|
453
|
-
suggestions: (string | { label: string; value?: undefined | string })[];
|
|
454
|
-
/** Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). */
|
|
455
|
-
variant?: "ghost" | "default" | "outline";
|
|
456
|
-
/** Size preset for each chip. Defaults to the pill default (`'lg'`); pass `'sm'` for smaller pills (or `'md'`). */
|
|
457
|
-
size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
|
|
458
|
-
/** Full-width left-aligned rows instead of pills. */
|
|
459
|
-
block?: boolean;
|
|
460
|
-
/** Substring to highlight within each suggestion. */
|
|
461
|
-
highlight?: string;
|
|
462
|
-
/** A suggestion was clicked. */
|
|
463
|
-
onSelect?: (event: CustomEvent<{ value: string }>) => void;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export const KitnPromptSuggestions = createKitnComponent<KitnPromptSuggestionsProps>(
|
|
467
|
-
'kitn-prompt-suggestions',
|
|
468
|
-
["theme","suggestions","variant","size","block","highlight"],
|
|
469
|
-
{ onSelect: 'select' },
|
|
470
|
-
);
|
|
471
|
-
|
|
472
|
-
export interface KitnReasoningProps extends KitnBaseProps {
|
|
477
|
+
export interface KcReasoningProps extends WebComponentProps {
|
|
473
478
|
/** The reasoning text to display. */
|
|
474
479
|
text: string;
|
|
475
480
|
/** Trigger label. */
|
|
@@ -484,13 +489,46 @@ export interface KitnReasoningProps extends KitnBaseProps {
|
|
|
484
489
|
onOpenchange?: (event: CustomEvent<{ open: boolean }>) => void;
|
|
485
490
|
}
|
|
486
491
|
|
|
487
|
-
export const
|
|
488
|
-
'
|
|
492
|
+
export const KcReasoning = createWebComponent<KcReasoningProps>(
|
|
493
|
+
'kc-reasoning',
|
|
489
494
|
["theme","text","label","open","streaming","markdown"],
|
|
490
495
|
{ onOpenchange: 'openchange' },
|
|
491
496
|
);
|
|
492
497
|
|
|
493
|
-
export interface
|
|
498
|
+
export interface KcResizableProps extends WebComponentProps {
|
|
499
|
+
/** Layout axis: `horizontal` (row, default) or `vertical` (column). */
|
|
500
|
+
orientation?: "horizontal" | "vertical";
|
|
501
|
+
/** Fired on drag-end / keyboard resize / visibility change. `detail.sizes` = panel sizes in percent. */
|
|
502
|
+
onChange?: (event: CustomEvent<{ sizes: number[] }>) => void;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export const KcResizable = createWebComponent<KcResizableProps>(
|
|
506
|
+
'kc-resizable',
|
|
507
|
+
["theme","orientation"],
|
|
508
|
+
{ onChange: 'change' },
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
export interface KcResizableItemProps extends WebComponentProps {
|
|
512
|
+
/** Initial main-axis size: `"280px"` (fixed) or `"25%"`/`25` (percent). Omitted → flexible. */
|
|
513
|
+
size?: string;
|
|
514
|
+
/** Minimum size during resize (px or %). */
|
|
515
|
+
min?: string;
|
|
516
|
+
/** Maximum size during resize (px or %). */
|
|
517
|
+
max?: string;
|
|
518
|
+
/** Fix this panel's size; adjacent dividers become non-draggable. */
|
|
519
|
+
locked?: boolean;
|
|
520
|
+
/** Hide this panel; its divider is dropped and the rest reflow. */
|
|
521
|
+
hidden?: boolean;
|
|
522
|
+
onChange?: (event: CustomEvent<unknown>) => void;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export const KcResizableItem = createWebComponent<KcResizableItemProps>(
|
|
526
|
+
'kc-resizable-item',
|
|
527
|
+
["theme","size","min","max","locked","hidden"],
|
|
528
|
+
{ onChange: 'change' },
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
export interface KcResponseStreamProps extends WebComponentProps {
|
|
494
532
|
/** Text to stream. A string, or an `AsyncIterable<string>` (set as a JS property — async iterables can't be HTML attributes). */
|
|
495
533
|
text?: string | AsyncIterable<string>;
|
|
496
534
|
/** Reveal animation. */
|
|
@@ -503,13 +541,41 @@ export interface KitnResponseStreamProps extends KitnBaseProps {
|
|
|
503
541
|
onComplete?: (event: CustomEvent) => void;
|
|
504
542
|
}
|
|
505
543
|
|
|
506
|
-
export const
|
|
507
|
-
'
|
|
544
|
+
export const KcResponseStream = createWebComponent<KcResponseStreamProps>(
|
|
545
|
+
'kc-response-stream',
|
|
508
546
|
["theme","text","mode","speed","as"],
|
|
509
547
|
{ onComplete: 'complete' },
|
|
510
548
|
);
|
|
511
549
|
|
|
512
|
-
export interface
|
|
550
|
+
export interface KcScopePickerProps extends WebComponentProps {
|
|
551
|
+
/** Authors to offer as scope filters. Set as a JS property. */
|
|
552
|
+
availableAuthors: string[];
|
|
553
|
+
/** Tags to offer as scope filters. Set as a JS property. */
|
|
554
|
+
availableTags: string[];
|
|
555
|
+
/** The label shown on the trigger for the active scope. */
|
|
556
|
+
currentLabel?: string;
|
|
557
|
+
/** A scope was chosen (`undefined` filters = "All Content"). */
|
|
558
|
+
onScopechange?: (event: CustomEvent<{ filters: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }>) => void;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export const KcScopePicker = createWebComponent<KcScopePickerProps>(
|
|
562
|
+
'kc-scope-picker',
|
|
563
|
+
["theme","availableAuthors","availableTags","currentLabel"],
|
|
564
|
+
{ onScopechange: 'scopechange' },
|
|
565
|
+
);
|
|
566
|
+
|
|
567
|
+
export interface KcSkillsProps extends WebComponentProps {
|
|
568
|
+
/** The active skills to badge. Set as a JS property. */
|
|
569
|
+
skills: { id: string; name: string }[];
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export const KcSkills = createWebComponent<KcSkillsProps>(
|
|
573
|
+
'kc-skills',
|
|
574
|
+
["theme","skills"],
|
|
575
|
+
{ },
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
export interface KcSourceProps extends WebComponentProps {
|
|
513
579
|
/** The URL this citation links to (the domain also seeds the default label/favicon). */
|
|
514
580
|
href?: string;
|
|
515
581
|
/** Trigger label (defaults to the domain). */
|
|
@@ -522,26 +588,62 @@ export interface KitnSourceProps extends KitnBaseProps {
|
|
|
522
588
|
showFavicon?: boolean;
|
|
523
589
|
}
|
|
524
590
|
|
|
525
|
-
export const
|
|
526
|
-
'
|
|
591
|
+
export const KcSource = createWebComponent<KcSourceProps>(
|
|
592
|
+
'kc-source',
|
|
527
593
|
["theme","href","label","headline","description","showFavicon"],
|
|
528
594
|
{ },
|
|
529
595
|
);
|
|
530
596
|
|
|
531
|
-
export interface
|
|
597
|
+
export interface KcSourcesProps extends WebComponentProps {
|
|
532
598
|
/** The sources to render. Set as a JS property. */
|
|
533
599
|
sources: { href: string; title?: undefined | string; description?: undefined | string; label?: undefined | string; showFavicon?: undefined | boolean }[];
|
|
534
600
|
/** Show favicons on all items (per-item `showFavicon` overrides). */
|
|
535
601
|
showFavicon?: boolean;
|
|
536
602
|
}
|
|
537
603
|
|
|
538
|
-
export const
|
|
539
|
-
'
|
|
604
|
+
export const KcSources = createWebComponent<KcSourcesProps>(
|
|
605
|
+
'kc-sources',
|
|
540
606
|
["theme","sources","showFavicon"],
|
|
541
607
|
{ },
|
|
542
608
|
);
|
|
543
609
|
|
|
544
|
-
export interface
|
|
610
|
+
export interface KcSuggestionsProps extends WebComponentProps {
|
|
611
|
+
/** The suggestions. Strings, or `{ label, value }` when the displayed text and the emitted value differ. Set as a JS property. */
|
|
612
|
+
suggestions: (string | { label: string; value?: undefined | string })[];
|
|
613
|
+
/** Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). */
|
|
614
|
+
variant?: "ghost" | "default" | "outline";
|
|
615
|
+
/** Size preset for each chip. Defaults to the pill default (`'lg'`); pass `'sm'` for smaller pills (or `'md'`). */
|
|
616
|
+
size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
|
|
617
|
+
/** Full-width left-aligned rows instead of pills. */
|
|
618
|
+
block?: boolean;
|
|
619
|
+
/** Substring to highlight within each suggestion. */
|
|
620
|
+
highlight?: string;
|
|
621
|
+
/** A suggestion was clicked. */
|
|
622
|
+
onSelect?: (event: CustomEvent<{ value: string }>) => void;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export const KcSuggestions = createWebComponent<KcSuggestionsProps>(
|
|
626
|
+
'kc-suggestions',
|
|
627
|
+
["theme","suggestions","variant","size","block","highlight"],
|
|
628
|
+
{ onSelect: 'select' },
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
export interface KcTaskListProps extends WebComponentProps {
|
|
632
|
+
/** The task-list definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { tasks:[…], selectAll, confirmLabel, … }`. Import `TaskListCardData` from `@kitnai/chat` for the full shape. */
|
|
633
|
+
data?: Record<string, unknown>;
|
|
634
|
+
/** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
|
|
635
|
+
cardId?: string;
|
|
636
|
+
/** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
|
|
637
|
+
heading?: string;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export const KcTaskList = createWebComponent<KcTaskListProps>(
|
|
641
|
+
'kc-task-list',
|
|
642
|
+
["theme","data","cardId","heading"],
|
|
643
|
+
{ },
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
export interface KcTextShimmerProps extends WebComponentProps {
|
|
545
647
|
/** The text to shimmer. */
|
|
546
648
|
text?: string;
|
|
547
649
|
/** Element tag to render as (default `span`). */
|
|
@@ -552,13 +654,13 @@ export interface KitnTextShimmerProps extends KitnBaseProps {
|
|
|
552
654
|
spread?: number;
|
|
553
655
|
}
|
|
554
656
|
|
|
555
|
-
export const
|
|
556
|
-
'
|
|
657
|
+
export const KcTextShimmer = createWebComponent<KcTextShimmerProps>(
|
|
658
|
+
'kc-text-shimmer',
|
|
557
659
|
["theme","text","as","duration","spread"],
|
|
558
660
|
{ },
|
|
559
661
|
);
|
|
560
662
|
|
|
561
|
-
export interface
|
|
663
|
+
export interface KcThinkingBarProps extends WebComponentProps {
|
|
562
664
|
/** The shimmering label, e.g. "Thinking…". */
|
|
563
665
|
text?: string;
|
|
564
666
|
/** When true, show a "stop" affordance that fires a `stop` event. */
|
|
@@ -569,26 +671,26 @@ export interface KitnThinkingBarProps extends KitnBaseProps {
|
|
|
569
671
|
onStop?: (event: CustomEvent) => void;
|
|
570
672
|
}
|
|
571
673
|
|
|
572
|
-
export const
|
|
573
|
-
'
|
|
674
|
+
export const KcThinkingBar = createWebComponent<KcThinkingBarProps>(
|
|
675
|
+
'kc-thinking-bar',
|
|
574
676
|
["theme","text","stoppable","stopLabel"],
|
|
575
677
|
{ onStop: 'stop' },
|
|
576
678
|
);
|
|
577
679
|
|
|
578
|
-
export interface
|
|
680
|
+
export interface KcToolProps extends WebComponentProps {
|
|
579
681
|
/** The tool-call to display. Set as a JS property. */
|
|
580
682
|
tool?: { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; output?: Record<string, unknown>; toolCallId?: string; errorText?: string };
|
|
581
683
|
/** Start expanded. */
|
|
582
684
|
open?: boolean;
|
|
583
685
|
}
|
|
584
686
|
|
|
585
|
-
export const
|
|
586
|
-
'
|
|
687
|
+
export const KcTool = createWebComponent<KcToolProps>(
|
|
688
|
+
'kc-tool',
|
|
587
689
|
["theme","tool","open"],
|
|
588
690
|
{ },
|
|
589
691
|
);
|
|
590
692
|
|
|
591
|
-
export interface
|
|
693
|
+
export interface KcVoiceInputProps extends WebComponentProps {
|
|
592
694
|
/** Transcriber the host supplies — records audio, returns the text. This is a **function-valued property** (`el.transcribe = async blob => '...'`) because a value-returning callback can't be modelled as a fire-and-forget event. */
|
|
593
695
|
transcribe?: (audio: Blob) => Promise<string>;
|
|
594
696
|
/** Disable the mic button (non-interactive). */
|
|
@@ -599,8 +701,73 @@ export interface KitnVoiceInputProps extends KitnBaseProps {
|
|
|
599
701
|
onTranscription?: (event: CustomEvent<{ text: string }>) => void;
|
|
600
702
|
}
|
|
601
703
|
|
|
602
|
-
export const
|
|
603
|
-
'
|
|
704
|
+
export const KcVoiceInput = createWebComponent<KcVoiceInputProps>(
|
|
705
|
+
'kc-voice-input',
|
|
604
706
|
["theme","transcribe","disabled"],
|
|
605
707
|
{ onAudiocaptured: 'audiocaptured', onTranscription: 'transcription' },
|
|
606
708
|
);
|
|
709
|
+
|
|
710
|
+
export interface KcWorkspaceProps extends WebComponentProps {
|
|
711
|
+
/** Pre-bucketed conversation groups for the sidebar. Set as a JS property. */
|
|
712
|
+
groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
|
|
713
|
+
/** Flat conversation list (auto-bucketed if `groups` is empty). Set as a JS property. */
|
|
714
|
+
conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
|
|
715
|
+
/** Id of the open conversation, highlighted in the sidebar. */
|
|
716
|
+
activeId?: string;
|
|
717
|
+
/** The active conversation's message thread, newest last. Set as a JS property. */
|
|
718
|
+
messages: { id: string; role: "user" | "assistant"; content: string; reasoning?: undefined | { text: string; label?: undefined | string }; tools?: undefined | { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string }[]; attachments?: undefined | { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit")[] }[];
|
|
719
|
+
value?: string;
|
|
720
|
+
placeholder?: string;
|
|
721
|
+
loading?: boolean;
|
|
722
|
+
suggestions?: string[];
|
|
723
|
+
suggestionMode?: "submit" | "fill";
|
|
724
|
+
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
725
|
+
codeTheme?: string;
|
|
726
|
+
codeHighlight?: boolean;
|
|
727
|
+
chatTitle?: string;
|
|
728
|
+
models?: { id: string; name: string; provider?: string }[];
|
|
729
|
+
currentModel?: string;
|
|
730
|
+
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; estimatedCost?: number };
|
|
731
|
+
scrollButton?: boolean;
|
|
732
|
+
search?: boolean;
|
|
733
|
+
voice?: boolean;
|
|
734
|
+
slashCommands?: { id: string; label: string; description?: string; category?: string }[];
|
|
735
|
+
slashActiveIds?: string[];
|
|
736
|
+
slashCompact?: boolean;
|
|
737
|
+
/** Sidebar default width as a percent of the workspace (default 22). */
|
|
738
|
+
sidebarWidth?: number;
|
|
739
|
+
/** Sidebar min width in px (default 200). */
|
|
740
|
+
sidebarMinWidth?: number;
|
|
741
|
+
/** Sidebar max width in px (default 420). */
|
|
742
|
+
sidebarMaxWidth?: number;
|
|
743
|
+
/** Initial collapsed state of the sidebar (default false). */
|
|
744
|
+
sidebarCollapsed?: boolean;
|
|
745
|
+
/** A conversation was selected in the sidebar. */
|
|
746
|
+
onConversationselect?: (event: CustomEvent<{ id: string }>) => void;
|
|
747
|
+
/** An action button on a message was clicked. */
|
|
748
|
+
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
749
|
+
/** The header model switcher changed. */
|
|
750
|
+
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
751
|
+
/** The "New chat" button was clicked. */
|
|
752
|
+
onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
|
|
753
|
+
/** The Search button was clicked. */
|
|
754
|
+
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
755
|
+
/** The sidebar was collapsed or expanded. */
|
|
756
|
+
onSidebartoggle?: (event: CustomEvent<{ collapsed: boolean }>) => void;
|
|
757
|
+
/** A slash command was chosen from the palette. */
|
|
758
|
+
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
759
|
+
/** User submitted a message. */
|
|
760
|
+
onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
|
|
761
|
+
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
762
|
+
onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
|
|
763
|
+
/** Fired on every input change. */
|
|
764
|
+
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
765
|
+
/** The Mic / voice button was clicked. */
|
|
766
|
+
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
export const KcWorkspace = createWebComponent<KcWorkspaceProps>(
|
|
770
|
+
'kc-workspace',
|
|
771
|
+
["theme","groups","conversations","activeId","messages","value","placeholder","loading","suggestions","suggestionMode","proseSize","codeTheme","codeHighlight","chatTitle","models","currentModel","context","scrollButton","search","voice","slashCommands","slashActiveIds","slashCompact","sidebarWidth","sidebarMinWidth","sidebarMaxWidth","sidebarCollapsed"],
|
|
772
|
+
{ onConversationselect: 'conversationselect', onMessageaction: 'messageaction', onModelchange: 'modelchange', onNewchat: 'newchat', onSearch: 'search', onSidebartoggle: 'sidebartoggle', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
773
|
+
);
|