@stll/chat 0.1.16 → 0.1.17
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/dist/composer.d.ts +8 -9
- package/dist/model-selector.d.ts +6 -7
- package/dist/runtime.d.ts +13 -14
- package/dist/stream.d.ts +3 -4
- package/package.json +6 -6
package/dist/composer.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
//#region src/composer.d.ts
|
|
3
|
-
type ChatComposerActionState = {
|
|
3
|
+
export type ChatComposerActionState = {
|
|
4
4
|
canSend: boolean;
|
|
5
5
|
isGenerating: boolean;
|
|
6
6
|
onRetry?: (() => void) | undefined;
|
|
7
7
|
onSend: () => void;
|
|
8
8
|
onStop?: (() => void) | undefined;
|
|
9
9
|
};
|
|
10
|
-
type ChatComposerActionMode = "retry" | "send" | "stop";
|
|
11
|
-
declare const resolveChatComposerAction: ({ isGenerating, onRetry, onStop }: Pick<ChatComposerActionState, "isGenerating" | "onRetry" | "onStop">) => ChatComposerActionMode;
|
|
12
|
-
type ChatComposerLabels = Record<ChatComposerActionMode, string>;
|
|
13
|
-
declare const ChatComposerAction: ({ canSend, className, isGenerating, labels, onRetry, onSend, onStop }: ChatComposerActionState & {
|
|
10
|
+
export type ChatComposerActionMode = "retry" | "send" | "stop";
|
|
11
|
+
export declare const resolveChatComposerAction: ({ isGenerating, onRetry, onStop }: Pick<ChatComposerActionState, "isGenerating" | "onRetry" | "onStop">) => ChatComposerActionMode;
|
|
12
|
+
export type ChatComposerLabels = Record<ChatComposerActionMode, string>;
|
|
13
|
+
export declare const ChatComposerAction: ({ canSend, className, isGenerating, labels, onRetry, onSend, onStop }: ChatComposerActionState & {
|
|
14
14
|
className?: string | undefined;
|
|
15
15
|
labels: ChatComposerLabels;
|
|
16
16
|
}) => import("react").JSX.Element;
|
|
17
|
-
type ChatComposerProps = ChatComposerActionState & {
|
|
17
|
+
export type ChatComposerProps = ChatComposerActionState & {
|
|
18
18
|
children: ReactNode;
|
|
19
19
|
className?: string | undefined;
|
|
20
20
|
labels: ChatComposerLabels;
|
|
@@ -26,6 +26,5 @@ type ChatComposerProps = ChatComposerActionState & {
|
|
|
26
26
|
* host-owned editor slot, so TipTap, ProseMirror, native inputs, and mobile
|
|
27
27
|
* editors can share send/stop/retry behavior without copying shell chrome.
|
|
28
28
|
*/
|
|
29
|
-
declare const ChatComposer: ({ children, className, labels, leading, status, ...action }: ChatComposerProps) => import("react").JSX.Element;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { ChatComposer, ChatComposerAction, ChatComposerActionMode, ChatComposerActionState, ChatComposerLabels, ChatComposerProps, resolveChatComposerAction };
|
|
29
|
+
export declare const ChatComposer: ({ children, className, labels, leading, status, ...action }: ChatComposerProps) => import("react").JSX.Element;
|
|
30
|
+
//#endregion
|
package/dist/model-selector.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ChatModelOption, ChatModelSelection } from "./runtime.js";
|
|
2
2
|
import { ReasoningEffort } from "@stll/ai-catalog";
|
|
3
3
|
//#region src/model-selector.d.ts
|
|
4
|
-
declare const compactModelDisplayName: (displayName: string) => string;
|
|
5
|
-
declare const groupReasoningEfforts: (efforts: readonly ReasoningEffort[]) => {
|
|
4
|
+
export declare const compactModelDisplayName: (displayName: string) => string;
|
|
5
|
+
export declare const groupReasoningEfforts: (efforts: readonly ReasoningEffort[]) => {
|
|
6
6
|
extended: ReasoningEffort[];
|
|
7
7
|
standard: ReasoningEffort[];
|
|
8
8
|
};
|
|
9
|
-
declare const modelSelectionLabel: ({ defaultEffortLabel, displayName, formatSelectionLabel, providerDefaultEffort, reasoningEffort, translateEffort }: {
|
|
9
|
+
export declare const modelSelectionLabel: ({ defaultEffortLabel, displayName, formatSelectionLabel, providerDefaultEffort, reasoningEffort, translateEffort }: {
|
|
10
10
|
defaultEffortLabel: string;
|
|
11
11
|
displayName: string;
|
|
12
12
|
formatSelectionLabel: (values: {
|
|
@@ -17,7 +17,7 @@ declare const modelSelectionLabel: ({ defaultEffortLabel, displayName, formatSel
|
|
|
17
17
|
reasoningEffort: ReasoningEffort | null;
|
|
18
18
|
translateEffort: (effort: ReasoningEffort) => string;
|
|
19
19
|
}) => string;
|
|
20
|
-
type ChatModelSelectorProps = {
|
|
20
|
+
export type ChatModelSelectorProps = {
|
|
21
21
|
autoLabel: string;
|
|
22
22
|
disabled?: boolean | undefined;
|
|
23
23
|
label: string;
|
|
@@ -27,6 +27,5 @@ type ChatModelSelectorProps = {
|
|
|
27
27
|
};
|
|
28
28
|
/** Native, accessible model control. Provider configuration is validated by
|
|
29
29
|
* `resolveChatModelSelection` before a host accepts the new selection. */
|
|
30
|
-
declare const ChatModelSelector: ({ autoLabel, disabled, label, onSelectionChange, options, selection }: ChatModelSelectorProps) => import("react").JSX.Element;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { ChatModelSelector, ChatModelSelectorProps, compactModelDisplayName, groupReasoningEfforts, modelSelectionLabel };
|
|
30
|
+
export declare const ChatModelSelector: ({ autoLabel, disabled, label, onSelectionChange, options, selection }: ChatModelSelectorProps) => import("react").JSX.Element;
|
|
31
|
+
//#endregion
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { AIProvider, ReasoningEffort } from "@stll/ai-catalog";
|
|
2
2
|
//#region src/runtime.d.ts
|
|
3
|
-
type ChatModelOption = {
|
|
3
|
+
export type ChatModelOption = {
|
|
4
4
|
defaultReasoningEffort: ReasoningEffort | null;
|
|
5
5
|
displayName: string;
|
|
6
6
|
modelId: string;
|
|
7
7
|
provider: AIProvider;
|
|
8
8
|
reasoningEfforts: readonly ReasoningEffort[] | null;
|
|
9
9
|
};
|
|
10
|
-
type ChatModelSelection = {
|
|
10
|
+
export type ChatModelSelection = {
|
|
11
11
|
modelId: string | null;
|
|
12
12
|
provider: AIProvider | null;
|
|
13
13
|
reasoningEffort: ReasoningEffort | null;
|
|
14
14
|
};
|
|
15
|
-
type ChatProviderConfiguration = {
|
|
15
|
+
export type ChatProviderConfiguration = {
|
|
16
16
|
modelIds: readonly string[];
|
|
17
17
|
provider: AIProvider;
|
|
18
18
|
};
|
|
19
19
|
declare const ChatConfigurationError_base: import("better-result").TaggedErrorClass<"ChatConfigurationError">;
|
|
20
|
-
declare class ChatConfigurationError extends ChatConfigurationError_base<{
|
|
20
|
+
export declare class ChatConfigurationError extends ChatConfigurationError_base<{
|
|
21
21
|
code: "duplicate-model" | "empty-model-id" | "empty-provider" | "unknown-provider" | "unconfigured-model";
|
|
22
22
|
message: string;
|
|
23
23
|
modelId?: string | undefined;
|
|
24
24
|
provider?: string | undefined;
|
|
25
25
|
}> {}
|
|
26
26
|
declare const ChatStreamError_base: import("better-result").TaggedErrorClass<"ChatStreamError">;
|
|
27
|
-
declare class ChatStreamError extends ChatStreamError_base<{
|
|
27
|
+
export declare class ChatStreamError extends ChatStreamError_base<{
|
|
28
28
|
cause: unknown;
|
|
29
29
|
message: string;
|
|
30
30
|
}> {}
|
|
@@ -33,33 +33,33 @@ declare class ChatStreamError extends ChatStreamError_base<{
|
|
|
33
33
|
* provider/model is an explicit typed error: the runtime never guesses a
|
|
34
34
|
* provider or silently routes a request somewhere else.
|
|
35
35
|
*/
|
|
36
|
-
declare const resolveChatModelSelection: ({ providers, selection }: {
|
|
36
|
+
export declare const resolveChatModelSelection: ({ providers, selection }: {
|
|
37
37
|
providers: readonly ChatProviderConfiguration[];
|
|
38
38
|
selection: ChatModelSelection;
|
|
39
39
|
}) => ChatModelSelection;
|
|
40
|
-
type ChatMessage<Metadata = undefined> = {
|
|
40
|
+
export type ChatMessage<Metadata = undefined> = {
|
|
41
41
|
content: string;
|
|
42
42
|
id: string;
|
|
43
43
|
metadata: Metadata;
|
|
44
44
|
role: "assistant" | "system" | "user";
|
|
45
45
|
};
|
|
46
|
-
type ChatStreamEvent<Metadata = undefined> = {
|
|
46
|
+
export type ChatStreamEvent<Metadata = undefined> = {
|
|
47
47
|
message: ChatMessage<Metadata>;
|
|
48
48
|
type: "message";
|
|
49
49
|
} | {
|
|
50
50
|
message: ChatMessage<Metadata>;
|
|
51
51
|
type: "replace-message";
|
|
52
52
|
};
|
|
53
|
-
type ChatTransport<Metadata = undefined> = (input: {
|
|
53
|
+
export type ChatTransport<Metadata = undefined> = (input: {
|
|
54
54
|
messages: readonly ChatMessage<Metadata>[];
|
|
55
55
|
signal: AbortSignal;
|
|
56
56
|
}) => AsyncIterable<ChatStreamEvent<Metadata>>;
|
|
57
|
-
type ChatRuntimeSnapshot<Metadata = undefined> = {
|
|
57
|
+
export type ChatRuntimeSnapshot<Metadata = undefined> = {
|
|
58
58
|
error: ChatStreamError | undefined;
|
|
59
59
|
isStreaming: boolean;
|
|
60
60
|
messages: readonly ChatMessage<Metadata>[];
|
|
61
61
|
};
|
|
62
|
-
type ChatRuntime<Metadata = undefined> = {
|
|
62
|
+
export type ChatRuntime<Metadata = undefined> = {
|
|
63
63
|
getSnapshot: () => ChatRuntimeSnapshot<Metadata>;
|
|
64
64
|
send: (message: ChatMessage<Metadata>) => Promise<void>;
|
|
65
65
|
stop: () => void;
|
|
@@ -70,9 +70,8 @@ type ChatRuntime<Metadata = undefined> = {
|
|
|
70
70
|
* selection, persistence, and provider credentials through `transport`; this
|
|
71
71
|
* primitive owns the observable stream lifecycle and makes failures explicit.
|
|
72
72
|
*/
|
|
73
|
-
declare const createChatRuntime: <Metadata = undefined>({ initialMessages, transport }: {
|
|
73
|
+
export declare const createChatRuntime: <Metadata = undefined>({ initialMessages, transport }: {
|
|
74
74
|
initialMessages?: readonly ChatMessage<Metadata>[];
|
|
75
75
|
transport: ChatTransport<Metadata>;
|
|
76
76
|
}) => ChatRuntime<Metadata>;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { ChatConfigurationError, ChatMessage, ChatModelOption, ChatModelSelection, ChatProviderConfiguration, ChatRuntime, ChatRuntimeSnapshot, ChatStreamError, ChatStreamEvent, ChatTransport, createChatRuntime, resolveChatModelSelection };
|
|
77
|
+
//#endregion
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChatMessage } from "./runtime.js";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
3
|
//#region src/stream.d.ts
|
|
4
|
-
type ChatMessageStreamProps<Metadata> = {
|
|
4
|
+
export type ChatMessageStreamProps<Metadata> = {
|
|
5
5
|
className?: string | undefined;
|
|
6
6
|
empty?: ReactElement | undefined;
|
|
7
7
|
messages: readonly ChatMessage<Metadata>[];
|
|
@@ -9,6 +9,5 @@ type ChatMessageStreamProps<Metadata> = {
|
|
|
9
9
|
};
|
|
10
10
|
/** A semantic transcript container; hosts supply their own rich markdown,
|
|
11
11
|
* citation, tool-call, and attachment renderers through `renderMessage`. */
|
|
12
|
-
declare const ChatMessageStream: <Metadata>({ className, empty, messages, renderMessage }: ChatMessageStreamProps<Metadata>) => ReactElement | null;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { ChatMessageStream, ChatMessageStreamProps };
|
|
12
|
+
export declare const ChatMessageStream: <Metadata>({ className, empty, messages, renderMessage }: ChatMessageStreamProps<Metadata>) => ReactElement | null;
|
|
13
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Typed React chat composer, message stream, model selector, and transport runtime primitives.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
"prepack": "bun run build"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@stll/ai-catalog": "^0.1.
|
|
65
|
-
"@stll/ui": "^0.
|
|
64
|
+
"@stll/ai-catalog": "^0.1.11",
|
|
65
|
+
"@stll/ui": "^0.27.0",
|
|
66
66
|
"better-result": "3.0.1",
|
|
67
|
-
"lucide-react": "1.
|
|
67
|
+
"lucide-react": "1.41.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@stll/typescript-config": "0.0.0",
|
|
71
71
|
"@types/react": "^19.2.17",
|
|
72
|
-
"@types/react-dom": "^19.2.
|
|
72
|
+
"@types/react-dom": "^19.2.7",
|
|
73
73
|
"bun-types": "1.4.2",
|
|
74
74
|
"react": "^19.2.8",
|
|
75
75
|
"react-dom": "^19.2.8",
|
|
76
76
|
"tailwindcss": "4.3.3",
|
|
77
|
-
"tsdown": "0.
|
|
77
|
+
"tsdown": "0.23.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@base-ui/react": "^1.7.0",
|