@stll/chat 0.3.5 → 0.4.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.
Files changed (29) hide show
  1. package/dist/.bun/install/cache/links/@tanstack_ai-event-client@0.13.1-cfefc90983c2de00/node_modules/@tanstack/ai-event-client/dist/esm/envelope.d.ts +0 -1
  2. package/dist/.bun/install/cache/links/@tanstack_ai-event-client@0.13.1-cfefc90983c2de00/node_modules/@tanstack/ai-event-client/dist/esm/index.d.ts +1 -3
  3. package/dist/.bun/install/cache/links/@tanstack_devtools-event-client@0.4.4-700fc304f0957f2a/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.d.ts +0 -1
  4. package/dist/composer.d.ts +1 -3
  5. package/dist/composer.js +1 -2
  6. package/dist/durable-transport.d.ts +0 -2
  7. package/dist/durable-transport.js +3 -4
  8. package/dist/html-to-markdown.d.ts +1 -3
  9. package/dist/html-to-markdown.js +1 -2
  10. package/dist/link-detection.d.ts +1 -3
  11. package/dist/link-detection.js +1 -2
  12. package/dist/link-editor.d.ts +1 -3
  13. package/dist/link-editor.js +1 -2
  14. package/dist/link-markdown.d.ts +1 -3
  15. package/dist/link-markdown.js +1 -2
  16. package/dist/link.d.ts +15 -4
  17. package/dist/link.js +78 -33
  18. package/dist/model-selector.d.ts +4 -5
  19. package/dist/model-selector.js +21 -21
  20. package/dist/resume-contract.d.ts +1 -3
  21. package/dist/resume-contract.js +1 -2
  22. package/dist/runtime.d.ts +0 -2
  23. package/dist/runtime.js +1 -2
  24. package/dist/stream.d.ts +1 -3
  25. package/dist/stream.js +1 -2
  26. package/dist/work/stella/stella/node_modules/.bun/@tanstack_ai@0.65.1_969a6d035afea0f4/node_modules/@tanstack/ai/dist/esm/interrupts.d.ts +1 -3
  27. package/dist/work/stella/stella/node_modules/.bun/@tanstack_ai@0.65.1_969a6d035afea0f4/node_modules/@tanstack/ai/dist/esm/types.d.ts +0 -2
  28. package/dist/work/stella/stella/node_modules/.bun/@tanstack_ai@0.65.1_969a6d035afea0f4/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.d.ts +0 -2
  29. package/package.json +4 -4
@@ -1,4 +1,3 @@
1
- //#region ../../../../../.bun/install/cache/links/@tanstack+ai-event-client@0.13.1-cfefc90983c2de00/node_modules/@tanstack/ai-event-client/dist/esm/envelope.d.ts
2
1
  declare global {
3
2
  var __TANSTACK_AI_DEVTOOLS_RUNTIME_ID__: string | undefined;
4
3
  }
@@ -1,6 +1,5 @@
1
1
  import "../../../../../../@tanstack_devtools-event-client@0.4.4-700fc304f0957f2a/node_modules/@tanstack/devtools-event-client/dist/esm/index.js";
2
2
  import "./envelope.js";
3
- //#region ../../../../../.bun/install/cache/links/@tanstack+ai-event-client@0.13.1-cfefc90983c2de00/node_modules/@tanstack/ai-event-client/dist/esm/index.d.ts
4
3
  /**
5
4
  * Detailed breakdown of prompt/input token usage.
6
5
  * Fields are populated based on provider support.
@@ -137,5 +136,4 @@ export interface TokenUsage<TProviderDetails = ProviderUsageDetails> {
137
136
  cost?: number;
138
137
  /** Provider-reported cost breakdown, when available. */
139
138
  costDetails?: UsageCostBreakdown;
140
- }
141
- //#endregion
139
+ }
@@ -1,4 +1,3 @@
1
- //#region ../../../../../.bun/install/cache/links/@tanstack+devtools-event-client@0.4.4-700fc304f0957f2a/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.d.ts
2
1
  declare global {
3
2
  var __TANSTACK_EVENT_TARGET__: EventTarget | null;
4
3
  }
@@ -1,4 +1,3 @@
1
- //#region src/composer.d.ts
2
1
  export type ChatComposerActionState = {
3
2
  canSend: boolean;
4
3
  isGenerating: boolean;
@@ -7,5 +6,4 @@ export type ChatComposerActionState = {
7
6
  onStop?: (() => void) | undefined;
8
7
  };
9
8
  export type ChatComposerActionMode = "retry" | "send" | "stop";
10
- export declare const resolveChatComposerAction: ({ isGenerating, onRetry, onStop }: Pick<ChatComposerActionState, "isGenerating" | "onRetry" | "onStop">) => ChatComposerActionMode;
11
- //#endregion
9
+ export declare const resolveChatComposerAction: ({ isGenerating, onRetry, onStop }: Pick<ChatComposerActionState, "isGenerating" | "onRetry" | "onStop">) => ChatComposerActionMode;
package/dist/composer.js CHANGED
@@ -1,8 +1,7 @@
1
- //#region src/composer.tsx
1
+ // src/composer.tsx
2
2
  const resolveChatComposerAction = ({ isGenerating, onRetry, onStop }) => {
3
3
  if (isGenerating && onStop !== void 0) return "stop";
4
4
  if (!isGenerating && onRetry !== void 0) return "retry";
5
5
  return "send";
6
6
  };
7
- //#endregion
8
7
  export { resolveChatComposerAction };
@@ -3,7 +3,6 @@ import { AGUIEvent, ActivityDeltaEvent as ActivityDeltaEvent$1, ActivitySnapshot
3
3
  import { ChatTurnResumeProbe } from "./resume-contract.js";
4
4
  import { EventType } from "@ag-ui/core";
5
5
  import { UIMessage } from "@tanstack/ai-client";
6
- //#region src/durable-transport.d.ts
7
6
  declare const ChatReconnectError_base: import("better-result").TaggedErrorClass<"ChatReconnectError">;
8
7
  export declare class ChatReconnectError extends ChatReconnectError_base<{
9
8
  cause?: unknown;
@@ -65,5 +64,4 @@ export declare const createDurableChatTransport: <TMessages extends UIMessage[]>
65
64
  removeItem: () => undefined;
66
65
  };
67
66
  };
68
- //#endregion
69
67
  export {};
@@ -3,7 +3,7 @@ import { EventType } from "@ag-ui/core";
3
3
  import { fetchServerSentEvents } from "@tanstack/ai-client";
4
4
  import { Result, TaggedError, panic } from "better-result";
5
5
  import * as v from "valibot";
6
- //#region src/durable-transport.ts
6
+ // src/durable-transport.ts
7
7
  var ChatReconnectError = class extends TaggedError("ChatReconnectError") {};
8
8
  const RECONNECT_WINDOW_MS = 18e4;
9
9
  const MAX_RECONNECT_DELAY_MS = 15e3;
@@ -44,10 +44,10 @@ const terminalChatResponse = ({ runId, resume, onTranscript, onReconnectChange }
44
44
  return new Response(`data: ${JSON.stringify({
45
45
  type: "RUN_FINISHED",
46
46
  runId,
47
- ...resume?.pendingInterrupts === void 0 ? {} : { outcome: {
47
+ ...resume?.pendingInterrupts !== void 0 ? { outcome: {
48
48
  type: "interrupt",
49
49
  interrupts: resume.pendingInterrupts
50
- } }
50
+ } } : {}
51
51
  })}\n\n`, { headers: { "Content-Type": "text/event-stream" } });
52
52
  };
53
53
  const createChatResumePersistence = ({ initialMessages, initialTurn, probe, onReconnectChange, onTranscript, onError, random, now, wait }) => {
@@ -235,5 +235,4 @@ const createDurableChatTransport = ({ initialMessages, initialTurn, threadId, pr
235
235
  persistence
236
236
  };
237
237
  };
238
- //#endregion
239
238
  export { ChatReconnectError, createDurableChatTransport };
@@ -1,4 +1,3 @@
1
- //#region src/html-to-markdown.d.ts
2
1
  /**
3
2
  * Convert sanitized HTML to GFM-flavored Markdown.
4
3
  *
@@ -7,5 +6,4 @@
7
6
  * (children rendered, tag dropped). Output ends with a
8
7
  * single trailing newline when non-empty.
9
8
  */
10
- export declare const htmlToMarkdown: (html: string) => string;
11
- //#endregion
9
+ export declare const htmlToMarkdown: (html: string) => string;
@@ -1,6 +1,6 @@
1
1
  import { load } from "@stll/html";
2
2
  import { isTag, isText } from "@stll/html/nodes";
3
- //#region src/html-to-markdown.ts
3
+ // src/html-to-markdown.ts
4
4
  const INLINE_ESCAPE = /(?<ch>[\\`*_~[\]<>|])/g;
5
5
  const escapeText = (text) => text.replace(INLINE_ESCAPE, "\\$<ch>");
6
6
  const LINK_DESTINATION_ESCAPE = /(?<ch>[\\<>])/g;
@@ -214,5 +214,4 @@ const htmlToMarkdown = (html) => {
214
214
  const body = renderChildren($.root().contents().toArray());
215
215
  return body ? `${body}\n` : "";
216
216
  };
217
- //#endregion
218
217
  export { htmlToMarkdown };
@@ -1,4 +1,3 @@
1
- //#region src/link-detection.d.ts
2
1
  export type ChatLinkSpan = {
3
2
  start: number;
4
3
  end: number;
@@ -12,5 +11,4 @@ export declare const normalizeChatLink: (input: string) => {
12
11
  hostname: string;
13
12
  } | null;
14
13
  export declare const getChatLinkSite: (hostname: string) => string | null;
15
- export declare const detectChatLinks: (text: string) => ChatLinkSpan[];
16
- //#endregion
14
+ export declare const detectChatLinks: (text: string) => ChatLinkSpan[];
@@ -1,6 +1,6 @@
1
1
  import { LinkifyIt } from "linkify-it";
2
2
  import { getDomain, parse } from "tldts";
3
- //#region src/link-detection.ts
3
+ // src/link-detection.ts
4
4
  const HTTP_SCHEME = /^https?:\/\//iu;
5
5
  const BARE_HOST_LABEL_START = /^[\p{L}\p{N}]/u;
6
6
  const UNSAFE_CHARACTERS = /[\s\p{Cc}\p{Cf}\\]/u;
@@ -71,5 +71,4 @@ const detectChatLinks = (text) => {
71
71
  }
72
72
  return spans;
73
73
  };
74
- //#endregion
75
74
  export { FILE_EXTENSION_TLDS, detectChatLinks, getChatLinkSite, normalizeChatLink };
@@ -1,5 +1,3 @@
1
1
  import { Extension } from "@tiptap/core";
2
- //#region src/link-editor.d.ts
3
2
  /** View-only links: saved drafts and submitted HTML retain the original bytes. */
4
- export declare const ChatComposerLinks: Extension<any, any>;
5
- //#endregion
3
+ export declare const ChatComposerLinks: Extension<any, any>;
@@ -4,7 +4,7 @@ import { panic } from "better-result";
4
4
  import { Extension } from "@tiptap/core";
5
5
  import { Plugin, PluginKey } from "@tiptap/pm/state";
6
6
  import { Decoration, DecorationSet } from "@tiptap/pm/view";
7
- //#region src/link-editor.ts
7
+ // src/link-editor.ts
8
8
  const chatLinkPluginKey = new PluginKey("stllChatLinks");
9
9
  const decorateChatLinks = (doc) => {
10
10
  const decorations = [];
@@ -80,5 +80,4 @@ const ChatComposerLinks = Extension.create({
80
80
  })];
81
81
  }
82
82
  });
83
- //#endregion
84
83
  export { ChatComposerLinks };
@@ -1,5 +1,3 @@
1
1
  import { Root } from "hast";
2
- //#region src/link-markdown.d.ts
3
2
  /** Run after sanitization and source-offset anchoring; existing links keep their renderer contract. */
4
- export declare const rehypeChatLinks: () => (tree: Root) => void;
5
- //#endregion
3
+ export declare const rehypeChatLinks: () => (tree: Root) => void;
@@ -1,6 +1,6 @@
1
1
  import { detectChatLinks } from "./link-detection.js";
2
2
  import { CHAT_LINK_ATTRIBUTES } from "./link.js";
3
- //#region src/link-markdown.ts
3
+ // src/link-markdown.ts
4
4
  const SKIPPED_ELEMENTS = /* @__PURE__ */ new Set([
5
5
  "a",
6
6
  "code",
@@ -54,5 +54,4 @@ const rehypeChatLinks = () => (tree) => {
54
54
  };
55
55
  visit(tree);
56
56
  };
57
- //#endregion
58
57
  export { rehypeChatLinks };
package/dist/link.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { AnchorHTMLAttributes } from "react";
2
- //#region src/link.d.ts
1
+ import { AnchorHTMLAttributes, ReactNode } from "react";
3
2
  export declare const CHAT_LINK_ATTRIBUTES: {
4
3
  readonly target: "_blank";
5
4
  readonly rel: "noopener noreferrer";
@@ -15,7 +14,19 @@ type ChatLinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "tar
15
14
  appearance?: "inline" | "tray";
16
15
  iconSource?: ChatLinkIconSource | undefined;
17
16
  newTabLabel?: string;
17
+ /** A tray chip whose label is the whole point (a decision's case number and
18
+ * date) keeps it up to the row's width instead of the compact 20ch cap. */
19
+ fullLabel?: boolean | undefined;
18
20
  };
19
- export declare const ChatLink: ({ appearance, children, href, iconSource, newTabLabel, title, ...anchorProps }: ChatLinkProps) => import("react").JSX.Element;
20
- //#endregion
21
+ /**
22
+ * Gives the link rendered inside it fixed ids, so a surface that renders the
23
+ * same links again (a streamed answer, then the reloaded one) renders the same
24
+ * ids: `id` names the link's tooltip trigger and `${id}-hint` its hint.
25
+ * Without a scope, a link generates its ids.
26
+ */
27
+ export declare const ChatLinkIdScope: ({ children, id }: {
28
+ children: ReactNode;
29
+ id: string;
30
+ }) => import("react").JSX.Element;
31
+ export declare const ChatLink: ({ appearance, children, fullLabel, href, iconSource, id, newTabLabel, title, ...anchorProps }: ChatLinkProps) => import("react").JSX.Element;
21
32
  export {};
package/dist/link.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { normalizeChatLink } from "./link-detection.js";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { isValidElement, useState } from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { createContext, isValidElement, use, useId, useState } from "react";
4
4
  import { GitHubLogoIcon, XLogoIcon } from "@stll/ui/brand-icons";
5
5
  import { GlobeIcon } from "@stll/ui/icons";
6
- //#region src/link.tsx
6
+ import { Tooltip, TooltipPopup, TooltipTrigger } from "@stll/ui/tooltip";
7
+ // src/link.tsx
7
8
  const CHAT_LINK_ATTRIBUTES = {
8
9
  target: "_blank",
9
10
  rel: "noopener noreferrer"
@@ -46,9 +47,42 @@ const BUNDLED_ICONS = /* @__PURE__ */ new Map([
46
47
  ["www.twitter.com", X_LINK_ICON]
47
48
  ]);
48
49
  const hasBundledChatLinkIcon = (hostname) => BUNDLED_ICONS.has(hostname);
49
- const ChatLink = ({ appearance = "inline", children, href, iconSource, newTabLabel, title, ...anchorProps }) => {
50
- const className = appearance === "tray" ? "bg-muted/50 hover:bg-muted inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring" : CHAT_LINK_CLASS_NAME;
51
- const labelClassName = appearance === "tray" ? "max-w-[20ch] truncate" : void 0;
50
+ const ChatLinkIdContext = createContext(void 0);
51
+ /**
52
+ * Gives the link rendered inside it fixed ids, so a surface that renders the
53
+ * same links again (a streamed answer, then the reloaded one) renders the same
54
+ * ids: `id` names the link's tooltip trigger and `${id}-hint` its hint.
55
+ * Without a scope, a link generates its ids.
56
+ */
57
+ const ChatLinkIdScope = ({ children, id }) => /* @__PURE__ */ jsx(ChatLinkIdContext, {
58
+ value: id,
59
+ children
60
+ });
61
+ /**
62
+ * The hover hint a link carries: the new-tab notice, or the title the source
63
+ * gave it. A link with neither renders bare, so a long answer does not mount
64
+ * a tooltip for every link it has nothing to say about. The tooltip is for the
65
+ * pointer; the same words reach assistive technology as the link's
66
+ * description, a hidden element beside the link (`hintId`), so the link's own
67
+ * text stays its label.
68
+ */
69
+ const LinkHint = ({ children, hint, hintId, id }) => hint ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
70
+ id,
71
+ render: children
72
+ }), /* @__PURE__ */ jsx(TooltipPopup, { children: hint })] }), /* @__PURE__ */ jsx("span", {
73
+ hidden: true,
74
+ id: hintId,
75
+ children: hint
76
+ })] }) : children;
77
+ const ChatLink = ({ appearance = "inline", children, fullLabel = false, href, iconSource, id, newTabLabel, title, ...anchorProps }) => {
78
+ const hint = newTabLabel ?? title;
79
+ const generatedId = useId();
80
+ const baseId = use(ChatLinkIdContext) ?? generatedId;
81
+ const hintId = `${baseId}-hint`;
82
+ const triggerId = id ?? baseId;
83
+ const ownId = hint || id === void 0 ? {} : { id };
84
+ const className = appearance === "tray" ? "bg-muted/50 hover:bg-muted inline-flex max-w-full min-w-0 shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring" : CHAT_LINK_CLASS_NAME;
85
+ const labelClassName = appearance === "tray" ? fullLabel ? "min-w-0 truncate" : "max-w-[20ch] truncate" : void 0;
52
86
  const target = normalizeChatLink(href);
53
87
  if (!target) {
54
88
  const parsed = URL.canParse(href) ? new URL(href) : null;
@@ -61,16 +95,22 @@ const ChatLink = ({ appearance = "inline", children, href, iconSource, newTabLab
61
95
  children: children ?? href
62
96
  })
63
97
  }) : /* @__PURE__ */ jsx("span", { children: children ?? href });
64
- return /* @__PURE__ */ jsx("a", {
65
- ...anchorProps,
66
- title: newTabLabel ?? title,
67
- className,
68
- href,
69
- target: CHAT_LINK_ATTRIBUTES.target,
70
- rel: CHAT_LINK_ATTRIBUTES.rel,
71
- children: /* @__PURE__ */ jsx("bdi", {
72
- className: labelClassName,
73
- children: children ?? href
98
+ return /* @__PURE__ */ jsx(LinkHint, {
99
+ hint,
100
+ hintId,
101
+ id: triggerId,
102
+ children: /* @__PURE__ */ jsx("a", {
103
+ ...anchorProps,
104
+ ...ownId,
105
+ "aria-describedby": hint ? hintId : anchorProps["aria-describedby"],
106
+ className,
107
+ href,
108
+ target: CHAT_LINK_ATTRIBUTES.target,
109
+ rel: CHAT_LINK_ATTRIBUTES.rel,
110
+ children: /* @__PURE__ */ jsx("bdi", {
111
+ className: labelClassName,
112
+ children: children ?? href
113
+ })
74
114
  })
75
115
  });
76
116
  }
@@ -83,22 +123,27 @@ const ChatLink = ({ appearance = "inline", children, href, iconSource, newTabLab
83
123
  const bundledIcon = BUNDLED_ICONS.get(target.hostname);
84
124
  if (iconSource) icon = /* @__PURE__ */ jsx(ProxyIcon, { src: iconSource.src }, iconSource.src);
85
125
  else if (bundledIcon) icon = bundledIcon;
86
- return /* @__PURE__ */ jsxs("a", {
87
- ...anchorProps,
88
- title: newTabLabel ?? title,
89
- className,
90
- href: target.href,
91
- target: CHAT_LINK_ATTRIBUTES.target,
92
- rel: CHAT_LINK_ATTRIBUTES.rel,
93
- children: [/* @__PURE__ */ jsx("span", {
94
- "aria-hidden": "true",
95
- className: appearance === "tray" ? "inline-block shrink-0" : "me-1 inline-block align-[-0.125em]",
96
- children: icon
97
- }), /* @__PURE__ */ jsx("bdi", {
98
- className: labelClassName,
99
- children: label
100
- })]
126
+ return /* @__PURE__ */ jsx(LinkHint, {
127
+ hint,
128
+ hintId,
129
+ id: triggerId,
130
+ children: /* @__PURE__ */ jsxs("a", {
131
+ ...anchorProps,
132
+ ...ownId,
133
+ "aria-describedby": hint ? hintId : anchorProps["aria-describedby"],
134
+ className,
135
+ href: target.href,
136
+ target: CHAT_LINK_ATTRIBUTES.target,
137
+ rel: CHAT_LINK_ATTRIBUTES.rel,
138
+ children: [/* @__PURE__ */ jsx("span", {
139
+ "aria-hidden": "true",
140
+ className: appearance === "tray" ? "flex shrink-0" : "me-1 inline-block align-[-0.125em]",
141
+ children: icon
142
+ }), /* @__PURE__ */ jsx("bdi", {
143
+ className: labelClassName,
144
+ children: label
145
+ })]
146
+ })
101
147
  });
102
148
  };
103
- //#endregion
104
- export { CHAT_LINK_ATTRIBUTES, CHAT_LINK_CLASS_NAME, ChatLink, hasBundledChatLinkIcon };
149
+ export { CHAT_LINK_ATTRIBUTES, CHAT_LINK_CLASS_NAME, ChatLink, ChatLinkIdScope, hasBundledChatLinkIcon };
@@ -1,6 +1,5 @@
1
1
  import { ChatModelOption, ChatModelSelection } from "./runtime.js";
2
2
  import { ReasoningEffort } from "@stll/ai-catalog";
3
- //#region src/model-selector.d.ts
4
3
  export declare const compactModelDisplayName: (displayName: string) => string;
5
4
  export declare const groupReasoningEfforts: (efforts: readonly ReasoningEffort[]) => {
6
5
  extended: ReasoningEffort[];
@@ -25,7 +24,7 @@ export type ChatModelSelectorProps = {
25
24
  options: readonly ChatModelOption[];
26
25
  selection: ChatModelSelection;
27
26
  };
28
- /** Native, accessible model control. Provider configuration is validated by
29
- * `resolveChatModelSelection` before a host accepts the new selection. */
30
- export declare const ChatModelSelector: ({ autoLabel, disabled, label, onSelectionChange, options, selection }: ChatModelSelectorProps) => import("react").JSX.Element;
31
- //#endregion
27
+ /** Accessible model control on the design-system select. Provider
28
+ * configuration is validated by `resolveChatModelSelection` before a host
29
+ * accepts the new selection. */
30
+ export declare const ChatModelSelector: ({ autoLabel, disabled, label, onSelectionChange, options, selection }: ChatModelSelectorProps) => import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { ChatConfigurationError } from "./runtime.js";
2
+ import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "@stll/ui/select";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
- //#region src/model-selector.tsx
4
+ // src/model-selector.tsx
4
5
  const CLAUDE_FAMILY_PREFIX = /^Claude\s+/u;
5
6
  const compactModelDisplayName = (displayName) => displayName.replace(CLAUDE_FAMILY_PREFIX, "");
6
7
  const effortSection = {
@@ -53,25 +54,24 @@ const parseSelection = (value, options) => {
53
54
  reasoningEffort: null
54
55
  };
55
56
  };
56
- /** Native, accessible model control. Provider configuration is validated by
57
- * `resolveChatModelSelection` before a host accepts the new selection. */
58
- const ChatModelSelector = ({ autoLabel, disabled = false, label, onSelectionChange, options, selection }) => {
59
- const onChange = ({ currentTarget }) => {
60
- onSelectionChange(parseSelection(currentTarget.value, options));
61
- };
62
- return /* @__PURE__ */ jsxs("select", {
57
+ /** Accessible model control on the design-system select. Provider
58
+ * configuration is validated by `resolveChatModelSelection` before a host
59
+ * accepts the new selection. */
60
+ const ChatModelSelector = ({ autoLabel, disabled = false, label, onSelectionChange, options, selection }) => /* @__PURE__ */ jsxs(Select, {
61
+ disabled,
62
+ onValueChange: (value) => {
63
+ onSelectionChange(parseSelection(value ?? "", options));
64
+ },
65
+ value: toValue(selection),
66
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
63
67
  "aria-label": label,
64
- disabled,
65
- onChange,
66
- value: toValue(selection),
67
- children: [/* @__PURE__ */ jsx("option", {
68
- value: "",
69
- children: autoLabel
70
- }), options.map((option) => /* @__PURE__ */ jsx("option", {
71
- value: `${option.provider}:${option.modelId}`,
72
- children: option.displayName
73
- }, `${option.provider}:${option.modelId}`))]
74
- });
75
- };
76
- //#endregion
68
+ children: /* @__PURE__ */ jsx(SelectValue, {})
69
+ }), /* @__PURE__ */ jsxs(SelectPopup, { children: [/* @__PURE__ */ jsx(SelectItem, {
70
+ value: "",
71
+ children: autoLabel
72
+ }), options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
73
+ value: `${option.provider}:${option.modelId}`,
74
+ children: option.displayName
75
+ }, `${option.provider}:${option.modelId}`))] })]
76
+ });
77
77
  export { ChatModelSelector, compactModelDisplayName, groupReasoningEfforts, modelSelectionLabel };
@@ -1,6 +1,5 @@
1
1
  import * as v from "valibot";
2
2
  import { Interrupt } from "@ag-ui/core";
3
- //#region src/resume-contract.d.ts
4
3
  /** Keep native interrupt validation tied to the protocol's owning schema. */
5
4
  export declare const chatResumeSnapshotSchema: v.ObjectSchema<{
6
5
  readonly resumeState: v.ObjectSchema<{
@@ -28,5 +27,4 @@ export declare const chatTurnResumeProbeSchema: v.VariantSchema<"type", [v.Objec
28
27
  readonly pendingInterrupts: v.ExactOptionalSchema<v.ArraySchema<v.CustomSchema<Interrupt, undefined>, undefined>, undefined>;
29
28
  }, undefined>, undefined>;
30
29
  }, undefined>], undefined>;
31
- export type ChatTurnResumeProbe = v.InferOutput<typeof chatTurnResumeProbeSchema>;
32
- //#endregion
30
+ export type ChatTurnResumeProbe = v.InferOutput<typeof chatTurnResumeProbeSchema>;
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { InterruptSchema } from "@ag-ui/core/schemas";
3
- //#region src/resume-contract.ts
3
+ // src/resume-contract.ts
4
4
  /** Keep native interrupt validation tied to the protocol's owning schema. */
5
5
  const chatResumeSnapshotSchema = v.object({
6
6
  resumeState: v.object({
@@ -26,5 +26,4 @@ const chatTurnResumeProbeSchema = v.variant("type", [
26
26
  resumeSnapshot: v.exactOptional(chatResumeSnapshotSchema)
27
27
  })
28
28
  ]);
29
- //#endregion
30
29
  export { chatResumeSnapshotSchema, chatTurnResumeProbeSchema };
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { AIProvider, ReasoningEffort } from "@stll/ai-catalog";
2
- //#region src/runtime.d.ts
3
2
  export type ChatModelOption = {
4
3
  defaultReasoningEffort: ReasoningEffort | null;
5
4
  displayName: string;
@@ -74,5 +73,4 @@ export declare const createChatRuntime: <Metadata = undefined>({ initialMessages
74
73
  initialMessages?: readonly ChatMessage<Metadata>[];
75
74
  transport: ChatTransport<Metadata>;
76
75
  }) => ChatRuntime<Metadata>;
77
- //#endregion
78
76
  export {};
package/dist/runtime.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TaggedError } from "better-result";
2
2
  import { AI_PROVIDERS } from "@stll/ai-catalog";
3
- //#region src/runtime.ts
3
+ // src/runtime.ts
4
4
  var ChatConfigurationError = class extends TaggedError("ChatConfigurationError") {};
5
5
  var ChatStreamError = class extends TaggedError("ChatStreamError") {};
6
6
  const providerSet = new Set(AI_PROVIDERS);
@@ -140,5 +140,4 @@ const createChatRuntime = ({ initialMessages = [], transport }) => {
140
140
  }
141
141
  };
142
142
  };
143
- //#endregion
144
143
  export { ChatConfigurationError, ChatStreamError, createChatRuntime, resolveChatModelSelection };
package/dist/stream.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ChatMessage } from "./runtime.js";
2
2
  import { ReactElement } from "react";
3
- //#region src/stream.d.ts
4
3
  export type ChatMessageStreamProps<Metadata> = {
5
4
  className?: string | undefined;
6
5
  empty?: ReactElement | undefined;
@@ -9,5 +8,4 @@ export type ChatMessageStreamProps<Metadata> = {
9
8
  };
10
9
  /** A semantic transcript container; hosts supply their own rich markdown,
11
10
  * citation, tool-call, and attachment renderers through `renderMessage`. */
12
- export declare const ChatMessageStream: <Metadata>({ className, empty, messages, renderMessage }: ChatMessageStreamProps<Metadata>) => ReactElement | null;
13
- //#endregion
11
+ export declare const ChatMessageStream: <Metadata>({ className, empty, messages, renderMessage }: ChatMessageStreamProps<Metadata>) => ReactElement | null;
package/dist/stream.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- //#region src/stream.tsx
2
+ // src/stream.tsx
3
3
  /** A semantic transcript container; hosts supply their own rich markdown,
4
4
  * citation, tool-call, and attachment renderers through `renderMessage`. */
5
5
  const ChatMessageStream = ({ className, empty, messages, renderMessage }) => {
@@ -9,5 +9,4 @@ const ChatMessageStream = ({ className, empty, messages, renderMessage }) => {
9
9
  children: messages.map((message) => /* @__PURE__ */ jsx("li", { children: renderMessage(message) }, message.id))
10
10
  });
11
11
  };
12
- //#endregion
13
12
  export { ChatMessageStream };
@@ -1,5 +1,4 @@
1
1
  import "./types.js";
2
- //#region ../../node_modules/.bun/@tanstack+ai@0.65.1+969a6d035afea0f4/node_modules/@tanstack/ai/dist/esm/interrupts.d.ts
3
2
  export interface InterruptCorrelation {
4
3
  threadId: string;
5
4
  interruptedRunId: string;
@@ -26,5 +25,4 @@ export interface BatchInterruptError extends InterruptCorrelation {
26
25
  retryable: boolean;
27
26
  interruptIds: ReadonlyArray<string>;
28
27
  }
29
- export type InterruptSubmissionError = ItemInterruptError | BatchInterruptError;
30
- //#endregion
28
+ export type InterruptSubmissionError = ItemInterruptError | BatchInterruptError;
@@ -4,7 +4,6 @@ import { ActivityDeltaEvent, ActivityMessage, ActivitySnapshotEvent, AudioPart,
4
4
  import { BilledUsage, BillingUnit, CompletionTokensDetails, PromptTokensDetails, ProviderUsageDetails, TokenUsage, UsageCostBreakdown } from "../../../../../../../../../../../.bun/install/cache/links/@tanstack_ai-event-client@0.13.1-cfefc90983c2de00/node_modules/@tanstack/ai-event-client/dist/esm/index.js";
5
5
  import { InterruptSubmissionError } from "./interrupts.js";
6
6
  import { SpecTokenUsage, TokenUsageLeftover } from "./utilities/ag-ui-usage.js";
7
- //#region ../../node_modules/.bun/@tanstack+ai@0.65.1+969a6d035afea0f4/node_modules/@tanstack/ai/dist/esm/types.d.ts
8
7
  /**
9
8
  * Tool call states - track the lifecycle of a tool call
10
9
  */
@@ -540,5 +539,4 @@ interface SubagentErrorEvent$1 extends SubagentErrorEvent {}
540
539
  * Uses the AG-UI protocol event format.
541
540
  */
542
541
  export type StreamChunk = AGUIEvent;
543
- //#endregion
544
542
  export { ActivityDeltaEvent$1 as ActivityDeltaEvent, ActivitySnapshotEvent$1 as ActivitySnapshotEvent, AudioPart$1 as AudioPart, CustomEvent$1 as CustomEvent, DocumentPart$1 as DocumentPart, ImagePart$1 as ImagePart, MessagesSnapshotEvent$1 as MessagesSnapshotEvent, RawEvent$1 as RawEvent, ReasoningEncryptedValueEvent$1 as ReasoningEncryptedValueEvent, ReasoningEndEvent$1 as ReasoningEndEvent, ReasoningMessageChunkEvent$1 as ReasoningMessageChunkEvent, ReasoningMessageContentEvent$1 as ReasoningMessageContentEvent, ReasoningMessageEndEvent$1 as ReasoningMessageEndEvent, ReasoningMessageStartEvent$1 as ReasoningMessageStartEvent, ReasoningStartEvent$1 as ReasoningStartEvent, RunErrorEvent$1 as RunErrorEvent, RunFinishedEvent$1 as RunFinishedEvent, RunStartedEvent$1 as RunStartedEvent, StateDeltaEvent$1 as StateDeltaEvent, StateSnapshotEvent$1 as StateSnapshotEvent, StepFinishedEvent$1 as StepFinishedEvent, StepStartedEvent$1 as StepStartedEvent, SubagentErrorEvent$1 as SubagentErrorEvent, SubagentFinishedEvent$1 as SubagentFinishedEvent, SubagentStartedEvent$1 as SubagentStartedEvent, TextMessageChunkEvent$1 as TextMessageChunkEvent, TextMessageContentEvent$1 as TextMessageContentEvent, TextMessageEndEvent$1 as TextMessageEndEvent, TextMessageStartEvent$1 as TextMessageStartEvent, type TokenUsage, ToolCall$1 as ToolCall, ToolCallArgsEvent$1 as ToolCallArgsEvent, ToolCallChunkEvent$1 as ToolCallChunkEvent, ToolCallEndEvent$1 as ToolCallEndEvent, ToolCallResultEvent$1 as ToolCallResultEvent, ToolCallStartEvent$1 as ToolCallStartEvent, VideoPart$1 as VideoPart };
@@ -1,8 +1,6 @@
1
1
  import "../types.js";
2
2
  import { TokenUsage as SpecTokenUsage } from "@ag-ui/core";
3
3
  import { TokenUsage } from "../../../../../../../../../../../../.bun/install/cache/links/@tanstack_ai-event-client@0.13.1-cfefc90983c2de00/node_modules/@tanstack/ai-event-client/dist/esm/index.js";
4
- //#region ../../node_modules/.bun/@tanstack+ai@0.65.1+969a6d035afea0f4/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.d.ts
5
4
  /** TokenUsage fields that have no AG-UI `usage[]` equivalent. */
6
5
  export type TokenUsageLeftover = Omit<TokenUsage, 'promptTokens' | 'completionTokens' | 'totalTokens'>;
7
- //#endregion
8
6
  export type { SpecTokenUsage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/chat",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Typed React chat composer, message stream, model selector, and transport runtime primitives.",
5
5
  "keywords": [
6
6
  "ai",
@@ -92,7 +92,7 @@
92
92
  "@ag-ui/core": "1.0.3",
93
93
  "@stll/ai-catalog": "^0.10.1",
94
94
  "@stll/html": "0.1.0",
95
- "@stll/ui": "^0.65.0",
95
+ "@stll/ui": "^0.66.0",
96
96
  "@tanstack/ai-client": "0.38.0",
97
97
  "@types/hast": "^3.0.5",
98
98
  "better-result": "3.0.1",
@@ -115,8 +115,8 @@
115
115
  },
116
116
  "peerDependencies": {
117
117
  "@base-ui/react": "^1.7.0",
118
- "@tiptap/core": "^3.31.4",
119
- "@tiptap/pm": "^3.31.4",
118
+ "@tiptap/core": "^3.32.0",
119
+ "@tiptap/pm": "^3.32.0",
120
120
  "@types/react": ">=19",
121
121
  "react": ">=19"
122
122
  },