@kitnai/chat 0.6.0 → 0.8.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 +9 -9
- package/dist/custom-elements.json +1676 -881
- package/dist/kitn-chat.es.js +36 -36
- package/dist/llms/llms-full.txt +316 -155
- 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 +382 -193
- package/frameworks/react/runtime.tsx +2 -2
- package/llms-full.txt +316 -155
- 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/code-block.stories.tsx +8 -9
- package/src/components/component-meta.json +3411 -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 -11
- 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 -13
- package/src/elements/chain-of-thought.tsx +3 -3
- package/src/elements/{kitn-chat-scope-picker.stories.tsx → chat-scope-picker.stories.tsx} +10 -10
- package/src/elements/chat-scope-picker.tsx +4 -4
- package/src/elements/{kitn-chat-workspace.stories.tsx → chat-workspace.stories.tsx} +71 -29
- package/src/elements/chat-workspace.tsx +29 -3
- package/src/elements/{kitn-chat.stories.tsx → chat.stories.tsx} +61 -16
- package/src/elements/chat.tsx +23 -2
- package/src/elements/{kitn-checkpoint.stories.tsx → checkpoint.stories.tsx} +11 -11
- package/src/elements/checkpoint.tsx +4 -4
- package/src/elements/{kitn-code-block.stories.tsx → code-block.stories.tsx} +10 -10
- 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 -10
- package/src/elements/context-meter.tsx +3 -3
- package/src/elements/{kitn-conversation-list.stories.tsx → conversation-list.stories.tsx} +35 -22
- package/src/elements/conversation-list.tsx +11 -2
- package/src/elements/css.ts +1 -1
- package/src/elements/define.tsx +10 -10
- package/src/elements/element-meta.json +2649 -0
- 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 -12
- package/src/elements/empty.tsx +3 -3
- package/src/elements/{kitn-feedback-bar.stories.tsx → feedback-bar.stories.tsx} +11 -11
- 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 -12
- 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 -10
- 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 -11
- package/src/elements/loader.tsx +3 -3
- package/src/elements/{kitn-markdown.stories.tsx → markdown.stories.tsx} +10 -10
- package/src/elements/markdown.tsx +3 -3
- package/src/elements/{kitn-message-skills.stories.tsx → message-skills.stories.tsx} +10 -10
- package/src/elements/message-skills.tsx +3 -3
- package/src/elements/{kitn-message.stories.tsx → message.stories.tsx} +12 -12
- package/src/elements/message.tsx +5 -5
- package/src/elements/{kitn-model-switcher.stories.tsx → model-switcher.stories.tsx} +10 -10
- package/src/elements/model-switcher.tsx +5 -5
- package/src/elements/{kitn-prompt-input.stories.tsx → prompt-input.stories.tsx} +41 -19
- package/src/elements/prompt-input.tsx +5 -5
- package/src/elements/{kitn-prompt-suggestions.stories.tsx → prompt-suggestions.stories.tsx} +13 -13
- package/src/elements/prompt-suggestions.tsx +4 -4
- package/src/elements/{kitn-reasoning.stories.tsx → reasoning.stories.tsx} +10 -10
- 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 -10
- package/src/elements/response-stream.tsx +4 -4
- package/src/elements/{kitn-source-list.stories.tsx → source-list.stories.tsx} +11 -11
- package/src/elements/{kitn-source.stories.tsx → source.stories.tsx} +12 -12
- 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 -10
- package/src/elements/text-shimmer.tsx +3 -3
- package/src/elements/{kitn-thinking-bar.stories.tsx → thinking-bar.stories.tsx} +11 -11
- package/src/elements/thinking-bar.tsx +5 -5
- package/src/elements/{kitn-tool.stories.tsx → tool.stories.tsx} +10 -10
- package/src/elements/tool.tsx +3 -3
- package/src/elements/{kitn-voice-input.stories.tsx → voice-input.stories.tsx} +10 -10
- 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 +60 -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
|
@@ -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. */
|
|
@@ -78,94 +122,31 @@ export interface KitnChatProps extends KitnBaseProps {
|
|
|
78
122
|
slashActiveIds?: string[];
|
|
79
123
|
/** Single-line palette rows. */
|
|
80
124
|
slashCompact?: boolean;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export interface KitnChatScopePickerProps extends KitnBaseProps {
|
|
98
|
-
/** Authors to offer as scope filters. Set as a JS property. */
|
|
99
|
-
availableAuthors: string[];
|
|
100
|
-
/** Tags to offer as scope filters. Set as a JS property. */
|
|
101
|
-
availableTags: string[];
|
|
102
|
-
/** The label shown on the trigger for the active scope. */
|
|
103
|
-
currentLabel?: string;
|
|
104
|
-
/** A scope was chosen (`undefined` filters = "All Content"). */
|
|
105
|
-
onScopechange?: (event: CustomEvent<{ filters: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }>) => void;
|
|
125
|
+
/** An action button on a message was clicked. */
|
|
126
|
+
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
127
|
+
/** The header model switcher changed. */
|
|
128
|
+
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
129
|
+
/** The Search button was clicked. */
|
|
130
|
+
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
131
|
+
/** A slash command was chosen from the palette. */
|
|
132
|
+
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
133
|
+
/** User submitted a message. */
|
|
134
|
+
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;
|
|
135
|
+
/** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
|
|
136
|
+
onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
|
|
137
|
+
/** Fired on every input change. */
|
|
138
|
+
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
139
|
+
/** The Mic / voice button was clicked. */
|
|
140
|
+
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
106
141
|
}
|
|
107
142
|
|
|
108
|
-
export const
|
|
109
|
-
'
|
|
110
|
-
["theme","
|
|
111
|
-
{
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
export interface KitnChatWorkspaceProps extends KitnBaseProps {
|
|
115
|
-
/** Pre-bucketed conversation groups for the sidebar. Set as a JS property. */
|
|
116
|
-
groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
|
|
117
|
-
/** Flat conversation list (auto-bucketed if `groups` is empty). Set as a JS property. */
|
|
118
|
-
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 }[];
|
|
119
|
-
/** Id of the open conversation, highlighted in the sidebar. */
|
|
120
|
-
activeId?: string;
|
|
121
|
-
/** The active conversation's message thread, newest last. Set as a JS property. */
|
|
122
|
-
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")[] }[];
|
|
123
|
-
value?: string;
|
|
124
|
-
placeholder?: string;
|
|
125
|
-
loading?: boolean;
|
|
126
|
-
suggestions?: string[];
|
|
127
|
-
suggestionMode?: "submit" | "fill";
|
|
128
|
-
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
129
|
-
codeTheme?: string;
|
|
130
|
-
codeHighlight?: boolean;
|
|
131
|
-
chatTitle?: string;
|
|
132
|
-
models?: { id: string; name: string; provider?: string }[];
|
|
133
|
-
currentModel?: string;
|
|
134
|
-
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; estimatedCost?: number };
|
|
135
|
-
scrollButton?: boolean;
|
|
136
|
-
search?: boolean;
|
|
137
|
-
voice?: boolean;
|
|
138
|
-
slashCommands?: { id: string; label: string; description?: string; category?: string }[];
|
|
139
|
-
slashActiveIds?: string[];
|
|
140
|
-
slashCompact?: boolean;
|
|
141
|
-
/** Sidebar default width as a percent of the workspace (default 22). */
|
|
142
|
-
sidebarWidth?: number;
|
|
143
|
-
/** Sidebar min width in px (default 200). */
|
|
144
|
-
sidebarMinWidth?: number;
|
|
145
|
-
/** Sidebar max width in px (default 420). */
|
|
146
|
-
sidebarMaxWidth?: number;
|
|
147
|
-
/** Initial collapsed state of the sidebar (default false). */
|
|
148
|
-
sidebarCollapsed?: boolean;
|
|
149
|
-
onConversationselect?: (event: CustomEvent<unknown>) => void;
|
|
150
|
-
onMessageaction?: (event: CustomEvent<unknown>) => void;
|
|
151
|
-
onModelchange?: (event: CustomEvent<unknown>) => void;
|
|
152
|
-
onNewchat?: (event: CustomEvent<unknown>) => void;
|
|
153
|
-
onSearch?: (event: CustomEvent<unknown>) => void;
|
|
154
|
-
onSidebartoggle?: (event: CustomEvent<unknown>) => void;
|
|
155
|
-
onSlashselect?: (event: CustomEvent<unknown>) => void;
|
|
156
|
-
onSubmit?: (event: CustomEvent<unknown>) => void;
|
|
157
|
-
onSuggestionclick?: (event: CustomEvent<unknown>) => void;
|
|
158
|
-
onValuechange?: (event: CustomEvent<unknown>) => void;
|
|
159
|
-
onVoice?: (event: CustomEvent<unknown>) => void;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export const KitnChatWorkspace = createKitnComponent<KitnChatWorkspaceProps>(
|
|
163
|
-
'kitn-chat-workspace',
|
|
164
|
-
["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"],
|
|
165
|
-
{ onConversationselect: 'conversationselect', onMessageaction: 'messageaction', onModelchange: 'modelchange', onNewchat: 'newchat', onSearch: 'search', onSidebartoggle: 'sidebartoggle', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
143
|
+
export const KcChat = createWebComponent<KcChatProps>(
|
|
144
|
+
'kc-chat',
|
|
145
|
+
["theme","messages","value","placeholder","loading","suggestions","suggestionMode","proseSize","codeTheme","codeHighlight","chatTitle","models","currentModel","context","scrollButton","search","voice","slashCommands","slashActiveIds","slashCompact"],
|
|
146
|
+
{ onMessageaction: 'messageaction', onModelchange: 'modelchange', onSearch: 'search', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
166
147
|
);
|
|
167
148
|
|
|
168
|
-
export interface
|
|
149
|
+
export interface KcCheckpointProps extends WebComponentProps {
|
|
169
150
|
/** Optional text beside the icon. */
|
|
170
151
|
label?: string;
|
|
171
152
|
/** Tooltip on hover. */
|
|
@@ -178,13 +159,13 @@ export interface KitnCheckpointProps extends KitnBaseProps {
|
|
|
178
159
|
onSelect?: (event: CustomEvent) => void;
|
|
179
160
|
}
|
|
180
161
|
|
|
181
|
-
export const
|
|
182
|
-
'
|
|
162
|
+
export const KcCheckpoint = createWebComponent<KcCheckpointProps>(
|
|
163
|
+
'kc-checkpoint',
|
|
183
164
|
["theme","label","tooltip","variant","size"],
|
|
184
165
|
{ onSelect: 'select' },
|
|
185
166
|
);
|
|
186
167
|
|
|
187
|
-
export interface
|
|
168
|
+
export interface KcCodeBlockProps extends WebComponentProps {
|
|
188
169
|
/** The source code to render. */
|
|
189
170
|
code: string;
|
|
190
171
|
/** Language grammar (e.g. `js`, `python`). Defaults to `tsx`. */
|
|
@@ -197,55 +178,88 @@ export interface KitnCodeBlockProps extends KitnBaseProps {
|
|
|
197
178
|
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
198
179
|
}
|
|
199
180
|
|
|
200
|
-
export const
|
|
201
|
-
'
|
|
181
|
+
export const KcCodeBlock = createWebComponent<KcCodeBlockProps>(
|
|
182
|
+
'kc-code-block',
|
|
202
183
|
["theme","code","language","codeTheme","codeHighlight","proseSize"],
|
|
203
184
|
{ },
|
|
204
185
|
);
|
|
205
186
|
|
|
206
|
-
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 {
|
|
207
205
|
/** Token-usage data. Set as a JS property. */
|
|
208
206
|
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; reasoningTokens?: number; cacheTokens?: number; estimatedCost?: number };
|
|
209
207
|
}
|
|
210
208
|
|
|
211
|
-
export const
|
|
212
|
-
'
|
|
209
|
+
export const KcContext = createWebComponent<KcContextProps>(
|
|
210
|
+
'kc-context',
|
|
213
211
|
["theme","context"],
|
|
214
212
|
{ },
|
|
215
213
|
);
|
|
216
214
|
|
|
217
|
-
export interface
|
|
215
|
+
export interface KcConversationsProps extends WebComponentProps {
|
|
218
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. */
|
|
219
217
|
groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
|
|
220
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. */
|
|
221
219
|
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 }[];
|
|
222
220
|
/** The id of the currently-open conversation, highlighted in the list. */
|
|
223
221
|
activeId?: string;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
/** The "New chat" button was clicked. */
|
|
223
|
+
onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
|
|
224
|
+
/** A conversation was selected. */
|
|
225
|
+
onSelect?: (event: CustomEvent<{ id: string }>) => void;
|
|
226
|
+
/** The sidebar toggle was clicked. */
|
|
227
|
+
onTogglesidebar?: (event: CustomEvent<Record<string, never>>) => void;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
export const
|
|
230
|
-
'
|
|
230
|
+
export const KcConversations = createWebComponent<KcConversationsProps>(
|
|
231
|
+
'kc-conversations',
|
|
231
232
|
["theme","groups","conversations","activeId"],
|
|
232
233
|
{ onNewchat: 'newchat', onSelect: 'select', onTogglesidebar: 'togglesidebar' },
|
|
233
234
|
);
|
|
234
235
|
|
|
235
|
-
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 {
|
|
236
250
|
/** Title text. Attribute: `empty-title` (`title` is a global HTML attribute). */
|
|
237
251
|
emptyTitle?: string;
|
|
238
252
|
/** Description text. */
|
|
239
253
|
description?: string;
|
|
240
254
|
}
|
|
241
255
|
|
|
242
|
-
export const
|
|
243
|
-
'
|
|
256
|
+
export const KcEmpty = createWebComponent<KcEmptyProps>(
|
|
257
|
+
'kc-empty',
|
|
244
258
|
["theme","emptyTitle","description"],
|
|
245
259
|
{ },
|
|
246
260
|
);
|
|
247
261
|
|
|
248
|
-
export interface
|
|
262
|
+
export interface KcFeedbackBarProps extends WebComponentProps {
|
|
249
263
|
/** The banner label (e.g. "Was this helpful?"). Attribute: `bar-title` (`title` is avoided — it's a global HTML attribute). */
|
|
250
264
|
barTitle?: string;
|
|
251
265
|
/** The user dismissed the banner. */
|
|
@@ -256,13 +270,30 @@ export interface KitnFeedbackBarProps extends KitnBaseProps {
|
|
|
256
270
|
onNothelpful?: (event: CustomEvent) => void;
|
|
257
271
|
}
|
|
258
272
|
|
|
259
|
-
export const
|
|
260
|
-
'
|
|
273
|
+
export const KcFeedbackBar = createWebComponent<KcFeedbackBarProps>(
|
|
274
|
+
'kc-feedback-bar',
|
|
261
275
|
["theme","barTitle"],
|
|
262
276
|
{ onClose: 'close', onHelpful: 'helpful', onNothelpful: 'nothelpful' },
|
|
263
277
|
);
|
|
264
278
|
|
|
265
|
-
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 {
|
|
266
297
|
/** Allow selecting multiple files (default true). */
|
|
267
298
|
multiple?: boolean;
|
|
268
299
|
/** `accept` attribute for the file picker (e.g. `image/*`). */
|
|
@@ -275,13 +306,28 @@ export interface KitnFileUploadProps extends KitnBaseProps {
|
|
|
275
306
|
onFilesadded?: (event: CustomEvent<{ files: File[] }>) => void;
|
|
276
307
|
}
|
|
277
308
|
|
|
278
|
-
export const
|
|
279
|
-
'
|
|
309
|
+
export const KcFileUpload = createWebComponent<KcFileUploadProps>(
|
|
310
|
+
'kc-file-upload',
|
|
280
311
|
["theme","multiple","accept","disabled","label"],
|
|
281
312
|
{ onFilesadded: 'filesadded' },
|
|
282
313
|
);
|
|
283
314
|
|
|
284
|
-
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 {
|
|
285
331
|
/** Base64-encoded image data (pair with `media-type`). */
|
|
286
332
|
base64?: string;
|
|
287
333
|
/** Raw image bytes (set as a JS property). */
|
|
@@ -292,13 +338,26 @@ export interface KitnImageProps extends KitnBaseProps {
|
|
|
292
338
|
mediaType?: string;
|
|
293
339
|
}
|
|
294
340
|
|
|
295
|
-
export const
|
|
296
|
-
'
|
|
341
|
+
export const KcImage = createWebComponent<KcImageProps>(
|
|
342
|
+
'kc-image',
|
|
297
343
|
["theme","base64","bytes","alt","mediaType"],
|
|
298
344
|
{ },
|
|
299
345
|
);
|
|
300
346
|
|
|
301
|
-
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 {
|
|
302
361
|
/** The animation style: `'circular' | 'classic' | 'pulse' | 'pulse-dot' | 'dots' | 'typing' | 'wave' | 'bars' | 'terminal' | 'text-blink' | 'text-shimmer' | 'loading-dots'`. Defaults to `'circular'`. */
|
|
303
362
|
variant?: "circular" | "classic" | "pulse" | "pulse-dot" | "dots" | "typing" | "wave" | "bars" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
304
363
|
/** Loader size: `'sm' | 'md' | 'lg'`. Defaults to `'md'`. */
|
|
@@ -307,13 +366,13 @@ export interface KitnLoaderProps extends KitnBaseProps {
|
|
|
307
366
|
text?: string;
|
|
308
367
|
}
|
|
309
368
|
|
|
310
|
-
export const
|
|
311
|
-
'
|
|
369
|
+
export const KcLoader = createWebComponent<KcLoaderProps>(
|
|
370
|
+
'kc-loader',
|
|
312
371
|
["theme","variant","size","text"],
|
|
313
372
|
{ },
|
|
314
373
|
);
|
|
315
374
|
|
|
316
|
-
export interface
|
|
375
|
+
export interface KcMarkdownProps extends WebComponentProps {
|
|
317
376
|
/** The markdown source to render. */
|
|
318
377
|
content: string;
|
|
319
378
|
/** Text/markdown sizing. */
|
|
@@ -324,13 +383,13 @@ export interface KitnMarkdownProps extends KitnBaseProps {
|
|
|
324
383
|
codeHighlight?: boolean;
|
|
325
384
|
}
|
|
326
385
|
|
|
327
|
-
export const
|
|
328
|
-
'
|
|
386
|
+
export const KcMarkdown = createWebComponent<KcMarkdownProps>(
|
|
387
|
+
'kc-markdown',
|
|
329
388
|
["theme","content","proseSize","codeTheme","codeHighlight"],
|
|
330
389
|
{ },
|
|
331
390
|
);
|
|
332
391
|
|
|
333
|
-
export interface
|
|
392
|
+
export interface KcMessageProps extends WebComponentProps {
|
|
334
393
|
/** The full message object. Set as a JS property. */
|
|
335
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")[] };
|
|
336
395
|
/** Convenience for simple cases when not passing a `message` object. */
|
|
@@ -349,24 +408,13 @@ export interface KitnMessageProps extends KitnBaseProps {
|
|
|
349
408
|
onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
|
|
350
409
|
}
|
|
351
410
|
|
|
352
|
-
export const
|
|
353
|
-
'
|
|
411
|
+
export const KcMessage = createWebComponent<KcMessageProps>(
|
|
412
|
+
'kc-message',
|
|
354
413
|
["theme","message","role","content","markdown","proseSize","codeTheme","codeHighlight"],
|
|
355
414
|
{ onMessageaction: 'messageaction' },
|
|
356
415
|
);
|
|
357
416
|
|
|
358
|
-
export interface
|
|
359
|
-
/** The active skills to badge. Set as a JS property. */
|
|
360
|
-
skills: { id: string; name: string }[];
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export const KitnMessageSkills = createKitnComponent<KitnMessageSkillsProps>(
|
|
364
|
-
'kitn-message-skills',
|
|
365
|
-
["theme","skills"],
|
|
366
|
-
{ },
|
|
367
|
-
);
|
|
368
|
-
|
|
369
|
-
export interface KitnModelSwitcherProps extends KitnBaseProps {
|
|
417
|
+
export interface KcModelSwitcherProps extends WebComponentProps {
|
|
370
418
|
/** The selectable models. Set as a JS property (array). */
|
|
371
419
|
models: { id: string; name: string; provider?: undefined | string }[];
|
|
372
420
|
/** The currently-selected model id. Defaults to the first model. */
|
|
@@ -375,13 +423,13 @@ export interface KitnModelSwitcherProps extends KitnBaseProps {
|
|
|
375
423
|
onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
|
|
376
424
|
}
|
|
377
425
|
|
|
378
|
-
export const
|
|
379
|
-
'
|
|
426
|
+
export const KcModelSwitcher = createWebComponent<KcModelSwitcherProps>(
|
|
427
|
+
'kc-model-switcher',
|
|
380
428
|
["theme","models","currentModel"],
|
|
381
429
|
{ onModelchange: 'modelchange' },
|
|
382
430
|
);
|
|
383
431
|
|
|
384
|
-
export interface
|
|
432
|
+
export interface KcPromptInputProps extends WebComponentProps {
|
|
385
433
|
/** Controlled value of the input. When set, the host owns the text and must update it on `valuechange`; leave unset for uncontrolled behavior. */
|
|
386
434
|
value?: string;
|
|
387
435
|
/** Placeholder text shown in the empty input. */
|
|
@@ -407,7 +455,7 @@ export interface KitnPromptInputProps extends KitnBaseProps {
|
|
|
407
455
|
/** Attachments to seed the input with (so a consumer can pre-populate staged files without an upload). Set as a JS property; the element then manages its own attachment state from there (add via the paperclip, remove per chip). */
|
|
408
456
|
attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[];
|
|
409
457
|
/** The Search (Globe) toolbar button was clicked. */
|
|
410
|
-
onSearch?: (event: CustomEvent<
|
|
458
|
+
onSearch?: (event: CustomEvent<Record<string, never>>) => void;
|
|
411
459
|
/** A slash command was chosen from the palette. */
|
|
412
460
|
onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
|
|
413
461
|
/** The user submitted the prompt (Enter or send button) with its attachments. */
|
|
@@ -417,37 +465,16 @@ export interface KitnPromptInputProps extends KitnBaseProps {
|
|
|
417
465
|
/** The input text changed (fires on every keystroke). */
|
|
418
466
|
onValuechange?: (event: CustomEvent<{ value: string }>) => void;
|
|
419
467
|
/** The Voice (Mic) toolbar button was clicked. */
|
|
420
|
-
onVoice?: (event: CustomEvent<
|
|
468
|
+
onVoice?: (event: CustomEvent<Record<string, never>>) => void;
|
|
421
469
|
}
|
|
422
470
|
|
|
423
|
-
export const
|
|
424
|
-
'
|
|
471
|
+
export const KcPromptInput = createWebComponent<KcPromptInputProps>(
|
|
472
|
+
'kc-prompt-input',
|
|
425
473
|
["theme","value","placeholder","disabled","loading","suggestions","suggestionMode","slashCommands","slashActiveIds","slashCompact","search","voice","attachments"],
|
|
426
474
|
{ onSearch: 'search', onSlashselect: 'slashselect', onSubmit: 'submit', onSuggestionclick: 'suggestionclick', onValuechange: 'valuechange', onVoice: 'voice' },
|
|
427
475
|
);
|
|
428
476
|
|
|
429
|
-
export interface
|
|
430
|
-
/** The suggestions. Strings, or `{ label, value }` when the displayed text and the emitted value differ. Set as a JS property. */
|
|
431
|
-
suggestions: (string | { label: string; value?: undefined | string })[];
|
|
432
|
-
/** Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). */
|
|
433
|
-
variant?: "ghost" | "default" | "outline";
|
|
434
|
-
/** Size preset for each chip. Defaults to the pill default (`'lg'`); pass `'sm'` for smaller pills (or `'md'`). */
|
|
435
|
-
size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
|
|
436
|
-
/** Full-width left-aligned rows instead of pills. */
|
|
437
|
-
block?: boolean;
|
|
438
|
-
/** Substring to highlight within each suggestion. */
|
|
439
|
-
highlight?: string;
|
|
440
|
-
/** A suggestion was clicked. */
|
|
441
|
-
onSelect?: (event: CustomEvent<{ value: string }>) => void;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export const KitnPromptSuggestions = createKitnComponent<KitnPromptSuggestionsProps>(
|
|
445
|
-
'kitn-prompt-suggestions',
|
|
446
|
-
["theme","suggestions","variant","size","block","highlight"],
|
|
447
|
-
{ onSelect: 'select' },
|
|
448
|
-
);
|
|
449
|
-
|
|
450
|
-
export interface KitnReasoningProps extends KitnBaseProps {
|
|
477
|
+
export interface KcReasoningProps extends WebComponentProps {
|
|
451
478
|
/** The reasoning text to display. */
|
|
452
479
|
text: string;
|
|
453
480
|
/** Trigger label. */
|
|
@@ -462,13 +489,46 @@ export interface KitnReasoningProps extends KitnBaseProps {
|
|
|
462
489
|
onOpenchange?: (event: CustomEvent<{ open: boolean }>) => void;
|
|
463
490
|
}
|
|
464
491
|
|
|
465
|
-
export const
|
|
466
|
-
'
|
|
492
|
+
export const KcReasoning = createWebComponent<KcReasoningProps>(
|
|
493
|
+
'kc-reasoning',
|
|
467
494
|
["theme","text","label","open","streaming","markdown"],
|
|
468
495
|
{ onOpenchange: 'openchange' },
|
|
469
496
|
);
|
|
470
497
|
|
|
471
|
-
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 {
|
|
472
532
|
/** Text to stream. A string, or an `AsyncIterable<string>` (set as a JS property — async iterables can't be HTML attributes). */
|
|
473
533
|
text?: string | AsyncIterable<string>;
|
|
474
534
|
/** Reveal animation. */
|
|
@@ -481,13 +541,41 @@ export interface KitnResponseStreamProps extends KitnBaseProps {
|
|
|
481
541
|
onComplete?: (event: CustomEvent) => void;
|
|
482
542
|
}
|
|
483
543
|
|
|
484
|
-
export const
|
|
485
|
-
'
|
|
544
|
+
export const KcResponseStream = createWebComponent<KcResponseStreamProps>(
|
|
545
|
+
'kc-response-stream',
|
|
486
546
|
["theme","text","mode","speed","as"],
|
|
487
547
|
{ onComplete: 'complete' },
|
|
488
548
|
);
|
|
489
549
|
|
|
490
|
-
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 {
|
|
491
579
|
/** The URL this citation links to (the domain also seeds the default label/favicon). */
|
|
492
580
|
href?: string;
|
|
493
581
|
/** Trigger label (defaults to the domain). */
|
|
@@ -500,26 +588,62 @@ export interface KitnSourceProps extends KitnBaseProps {
|
|
|
500
588
|
showFavicon?: boolean;
|
|
501
589
|
}
|
|
502
590
|
|
|
503
|
-
export const
|
|
504
|
-
'
|
|
591
|
+
export const KcSource = createWebComponent<KcSourceProps>(
|
|
592
|
+
'kc-source',
|
|
505
593
|
["theme","href","label","headline","description","showFavicon"],
|
|
506
594
|
{ },
|
|
507
595
|
);
|
|
508
596
|
|
|
509
|
-
export interface
|
|
597
|
+
export interface KcSourcesProps extends WebComponentProps {
|
|
510
598
|
/** The sources to render. Set as a JS property. */
|
|
511
599
|
sources: { href: string; title?: undefined | string; description?: undefined | string; label?: undefined | string; showFavicon?: undefined | boolean }[];
|
|
512
600
|
/** Show favicons on all items (per-item `showFavicon` overrides). */
|
|
513
601
|
showFavicon?: boolean;
|
|
514
602
|
}
|
|
515
603
|
|
|
516
|
-
export const
|
|
517
|
-
'
|
|
604
|
+
export const KcSources = createWebComponent<KcSourcesProps>(
|
|
605
|
+
'kc-sources',
|
|
518
606
|
["theme","sources","showFavicon"],
|
|
519
607
|
{ },
|
|
520
608
|
);
|
|
521
609
|
|
|
522
|
-
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 {
|
|
523
647
|
/** The text to shimmer. */
|
|
524
648
|
text?: string;
|
|
525
649
|
/** Element tag to render as (default `span`). */
|
|
@@ -530,13 +654,13 @@ export interface KitnTextShimmerProps extends KitnBaseProps {
|
|
|
530
654
|
spread?: number;
|
|
531
655
|
}
|
|
532
656
|
|
|
533
|
-
export const
|
|
534
|
-
'
|
|
657
|
+
export const KcTextShimmer = createWebComponent<KcTextShimmerProps>(
|
|
658
|
+
'kc-text-shimmer',
|
|
535
659
|
["theme","text","as","duration","spread"],
|
|
536
660
|
{ },
|
|
537
661
|
);
|
|
538
662
|
|
|
539
|
-
export interface
|
|
663
|
+
export interface KcThinkingBarProps extends WebComponentProps {
|
|
540
664
|
/** The shimmering label, e.g. "Thinking…". */
|
|
541
665
|
text?: string;
|
|
542
666
|
/** When true, show a "stop" affordance that fires a `stop` event. */
|
|
@@ -547,26 +671,26 @@ export interface KitnThinkingBarProps extends KitnBaseProps {
|
|
|
547
671
|
onStop?: (event: CustomEvent) => void;
|
|
548
672
|
}
|
|
549
673
|
|
|
550
|
-
export const
|
|
551
|
-
'
|
|
674
|
+
export const KcThinkingBar = createWebComponent<KcThinkingBarProps>(
|
|
675
|
+
'kc-thinking-bar',
|
|
552
676
|
["theme","text","stoppable","stopLabel"],
|
|
553
677
|
{ onStop: 'stop' },
|
|
554
678
|
);
|
|
555
679
|
|
|
556
|
-
export interface
|
|
680
|
+
export interface KcToolProps extends WebComponentProps {
|
|
557
681
|
/** The tool-call to display. Set as a JS property. */
|
|
558
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 };
|
|
559
683
|
/** Start expanded. */
|
|
560
684
|
open?: boolean;
|
|
561
685
|
}
|
|
562
686
|
|
|
563
|
-
export const
|
|
564
|
-
'
|
|
687
|
+
export const KcTool = createWebComponent<KcToolProps>(
|
|
688
|
+
'kc-tool',
|
|
565
689
|
["theme","tool","open"],
|
|
566
690
|
{ },
|
|
567
691
|
);
|
|
568
692
|
|
|
569
|
-
export interface
|
|
693
|
+
export interface KcVoiceInputProps extends WebComponentProps {
|
|
570
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. */
|
|
571
695
|
transcribe?: (audio: Blob) => Promise<string>;
|
|
572
696
|
/** Disable the mic button (non-interactive). */
|
|
@@ -577,8 +701,73 @@ export interface KitnVoiceInputProps extends KitnBaseProps {
|
|
|
577
701
|
onTranscription?: (event: CustomEvent<{ text: string }>) => void;
|
|
578
702
|
}
|
|
579
703
|
|
|
580
|
-
export const
|
|
581
|
-
'
|
|
704
|
+
export const KcVoiceInput = createWebComponent<KcVoiceInputProps>(
|
|
705
|
+
'kc-voice-input',
|
|
582
706
|
["theme","transcribe","disabled"],
|
|
583
707
|
{ onAudiocaptured: 'audiocaptured', onTranscription: 'transcription' },
|
|
584
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
|
+
);
|