@smarter.sh/ui-chat 0.10.0 → 0.16.2

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 (34) hide show
  1. package/README.md +80 -61
  2. package/dist/embed.js +31 -41
  3. package/dist/embed.js.map +1 -1
  4. package/dist/smarter-chat-library.es.js +3902 -9458
  5. package/dist/smarter-chat-library.es.js.map +1 -1
  6. package/dist/smarter-chat-library.umd.js +51 -61
  7. package/dist/smarter-chat-library.umd.js.map +1 -1
  8. package/dist/types/src/catalogs.gen.d.ts +12 -0
  9. package/dist/types/src/components/AppTitle/Component.d.ts +0 -4
  10. package/dist/types/src/components/ErrorBoundary/Component.d.ts +1 -1
  11. package/dist/types/src/components/SmarterChat/Component.d.ts +17 -12
  12. package/dist/types/src/components/SmarterChat/HeaderButton.d.ts +9 -0
  13. package/dist/types/src/components/SmarterChat/icons.d.ts +0 -9
  14. package/dist/types/src/components/SmarterChat/index.d.ts +3 -0
  15. package/dist/types/src/contract.gen.d.ts +14 -3
  16. package/dist/types/src/embed/element.d.ts +1 -1
  17. package/dist/types/src/embed/options.d.ts +5 -4
  18. package/dist/types/src/index.d.ts +4 -4
  19. package/dist/types/src/lib/api.d.ts +8 -1
  20. package/dist/types/src/lib/i18n.d.ts +71 -0
  21. package/dist/types/src/types.d.ts +28 -10
  22. package/dist/ui-chat.css +1 -1
  23. package/package.json +3 -3
  24. package/dist/types/src/components/Console/Component.d.ts +0 -17
  25. package/dist/types/src/components/Console/ServerLogs.d.ts +0 -8
  26. package/dist/types/src/components/Console/data.d.ts +0 -7
  27. package/dist/types/src/components/Console/enums.d.ts +0 -9
  28. package/dist/types/src/components/Console/index.d.ts +0 -2
  29. package/dist/types/src/components/DocsDialog/Component.d.ts +0 -8
  30. package/dist/types/src/components/DocsDialog/data.d.ts +0 -18
  31. package/dist/types/src/components/DocsDialog/index.d.ts +0 -2
  32. package/dist/types/src/lib/ansi.d.ts +0 -33
  33. package/dist/types/src/lib/layout.d.ts +0 -42
  34. package/dist/types/src/lib/logStream.d.ts +0 -30
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Smarter Chat's message catalogs: generated from locale/<language>/LC_MESSAGES/smarter-chat.po by
3
+ * scripts/i18n.mjs. Do not edit; run `npm run i18n`. See src/lib/i18n.tsx.
4
+ */
5
+ /** A language's translated messages, by msgid (context, \u0004, msgid in a context), and its plural rule. */
6
+ export interface Catalog {
7
+ /** The index of the plural form for a count. */
8
+ plural: (n: number) => number;
9
+ /** A message's translation, or its plural forms' translations. */
10
+ messages: Record<string, string | string[]>;
11
+ }
12
+ export declare const CATALOGS: Record<string, Catalog>;
@@ -1,7 +1,3 @@
1
- /**
2
- * The chat's title: the LLMClient's app name and version, with icons for whether it is valid, and
3
- * whether it is deployed or is still in the sandbox.
4
- */
5
1
  import "@/components/AppTitle/styles.css";
6
2
  interface AppTitleProps {
7
3
  title: string;
@@ -12,6 +12,6 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
12
12
  state: ErrorBoundaryState;
13
13
  static getDerivedStateFromError(error: Error): ErrorBoundaryState;
14
14
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
15
- render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
15
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
16
16
  }
17
17
  export default ErrorBoundary;
@@ -1,30 +1,35 @@
1
1
  /**
2
- * SmarterChat: a chat with a Smarter LLMClient, with an optional Console beside it.
2
+ * SmarterChat: a chat with a Smarter LLMClient.
3
3
  *
4
4
  * It fetches the LLMClient's configuration, which includes the chat session's history, then sends
5
5
  * the chat thread to the LLMClient's prompt api with each new message, and adds the response's
6
- * messages to the thread. Failed prompts are displayed in the thread, as "smarter_error" messages.
6
+ * messages to the thread. With verbose, the configuration's diagnostic parts, e.g. the session's tool
7
+ * calls, are fetched too (with ?verbose=true), and again after each prompt. Failed prompts are
8
+ * displayed in the thread, as "smarter_error" messages.
7
9
  * While a prompt runs, its progress (e.g. its tool calls and MCP server requests) is displayed in
8
10
  * the thread, with a spinner beside its current step, and is replaced by the response's messages
9
11
  * when it finishes. Code blocks in messages
10
12
  * are syntax highlighted, and have a copy button.
11
13
  *
12
- * The user can resize the chat and the Console by dragging the separator between them, and can
13
- * hide the Console, which slides out to the right. In sandbox mode, the thread also displays
14
- * Smarter's system, tool and meta data messages. In production mode, it displays only the
15
- * conversation, as the LLMClient's users see it, and the Console and its toggle button are hidden. The Console's server logs follow the mode: DEBUG
16
- * and above in sandbox mode, and the server's own log level in production mode. A new chat also
17
- * clears the Console's server logs. Sandbox mode also has a Docs button, which opens a dialog of
18
- * links to the technical references for prompt engineers and software engineers.
14
+ * With toggleMetadata, the header has a Sandbox / Production mode switch. In sandbox mode, the
15
+ * thread also displays Smarter's system, tool and meta data messages. In production mode, it displays
16
+ * only the conversation, as the LLMClient's users see it. When the chat is narrow, the header's
17
+ * buttons show only their icons. See styles.css.
18
+ *
19
+ * A page that hosts the chat, e.g. the Smarter web console's Prompt Engineer's Workbench, which puts
20
+ * its developer Console beside it, follows it with onConfig, onNewChat and onModeChange, asks it to
21
+ * reload its configuration with reloadKey, and adds its own buttons to the header with headerActions.
19
22
  *
20
23
  * The LLMClient's styles (its manifest's spec.config.styles) set its logo, which is displayed in
21
24
  * the header, its avatars, its background image, its fonts and its colors. See lib/styles.ts.
22
25
  *
23
- * This is the component that the @smarter.sh/ui-chat npm package exports, and that the Smarter web
24
- * console's LLMClient prompt workbench renders. See main.tsx.
26
+ * The chat's own text, e.g. its buttons' labels, is in the language that the `language` prop asks for, or else the
27
+ * page's, or else the browser's: English, Spanish or French. See lib/i18n.tsx. The LLMClient's own text, e.g. its
28
+ * welcome message and its example prompts, and the messages of the conversation are displayed as they are.
29
+ *
25
30
  */
26
31
  import "@chatscope/chat-ui-kit-styles/dist/default/styles.min.css";
27
32
  import type { SmarterChatProps } from "@/types";
28
33
  import "@/components/SmarterChat/styles.css";
29
- declare function SmarterChat({ apiUrl, apiKey, toggleMetadata, csrfCookieName, csrftoken, debugCookieName, debugCookieExpiration, debugMode, sessionCookieName, sessionCookieExpiration, cookiePath, showConsole, cookieDomain, smarterRequestId, logStreamUrl, streamProgress, }: SmarterChatProps): import("react").JSX.Element;
34
+ declare function SmarterChat({ apiUrl, apiKey, toggleMetadata, csrfCookieName, csrftoken, debugCookieName, debugCookieExpiration, debugMode, sessionCookieName, sessionCookieExpiration, cookiePath, cookieDomain, smarterRequestId, streamProgress, language, verbose, reloadKey, headerActions, onConfig, onNewChat, onModeChange, }: SmarterChatProps): import("react").JSX.Element;
30
35
  export default SmarterChat;
@@ -0,0 +1,9 @@
1
+ import type { ButtonHTMLAttributes, ReactNode, Ref } from "react";
2
+ export interface HeaderButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ /** The button's icon, before its label. */
4
+ icon?: ReactNode;
5
+ children?: ReactNode;
6
+ ref?: Ref<HTMLButtonElement>;
7
+ }
8
+ declare function HeaderButton({ className, icon, children, ...props }: HeaderButtonProps): import("react").JSX.Element;
9
+ export default HeaderButton;
@@ -4,16 +4,7 @@
4
4
  */
5
5
  /** A blank sheet of paper: a new chat. (bi-file-earmark) */
6
6
  export declare function NewChatIcon(): import("react").JSX.Element;
7
- /**
8
- * A window with a panel on its right, as the Console is: filled while the Console is visible
9
- * (bi-layout-sidebar-inset-reverse), and empty while it is hidden (bi-layout-sidebar-reverse).
10
- */
11
- export declare function ConsoleIcon({ visible }: {
12
- visible: boolean;
13
- }): import("react").JSX.Element;
14
7
  /** Tools: sandbox mode, which displays Smarter's system, tool and meta data messages. (bi-tools) */
15
8
  export declare function SandboxIcon(): import("react").JSX.Element;
16
9
  /** A shield: production mode, which displays the conversation only, as its users see it. (bi-shield-check) */
17
10
  export declare function ProductionIcon(): import("react").JSX.Element;
18
- /** An open book: the Docs dialog, which links to the technical references. (bi-book) */
19
- export declare function DocsIcon(): import("react").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  import SmarterChat from "@/components/SmarterChat/Component";
2
+ import HeaderButton from "@/components/SmarterChat/HeaderButton";
3
+ export { HeaderButton };
4
+ export type { HeaderButtonProps } from "@/components/SmarterChat/HeaderButton";
2
5
  export default SmarterChat;
@@ -366,7 +366,7 @@ export interface PromptChatApiConfig {
366
366
  /**
367
367
  * The LLMClient's extensions.
368
368
  *
369
- * The list itself is returned only in the complete configuration.
369
+ * The list itself is returned only in the complete configuration, with ``?verbose=true``.
370
370
  *
371
371
  * This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
372
372
  * via the `definition` "PromptChatApiExtensionList".
@@ -432,7 +432,8 @@ export interface PromptChatApiListMetaData {
432
432
  /**
433
433
  * The chat session's history, in version 2.
434
434
  *
435
- * Only ``chat_history`` is public.
435
+ * Only ``chat_history`` is public. ``prompt_tool_call_history`` is in the complete configuration with
436
+ * ``?verbose=true``, and the other histories are returned only to the cli.
436
437
  *
437
438
  * This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
438
439
  * via the `definition` "PromptChatApiHistory".
@@ -641,10 +642,20 @@ export interface PromptChatApiLLMClient {
641
642
  /**
642
643
  * The LLMClient's state.
643
644
  *
645
+ * The complete configuration, with ``?verbose=true``, adds the rest of ``LLMClientHelper.to_json()``.
646
+ *
644
647
  * This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
645
648
  * via the `definition` "PromptChatApiMetaData".
646
649
  */
647
650
  export interface PromptChatApiMetaData {
651
+ /**
652
+ * True if the LLMClient requires a Smarter api key, or a logged-in user.
653
+ */
654
+ is_authentication_required?: boolean | null;
655
+ /**
656
+ * True if the request's host is a custom domain.
657
+ */
658
+ is_custom_domain?: boolean | null;
648
659
  is_deployed?: boolean | null;
649
660
  is_valid?: boolean | null;
650
661
  ready?: boolean | null;
@@ -653,7 +664,7 @@ export interface PromptChatApiMetaData {
653
664
  /**
654
665
  * The LLMClient's plugins.
655
666
  *
656
- * The list itself is returned only in the complete configuration.
667
+ * The list itself is returned only in the complete configuration, with ``?verbose=true``.
657
668
  *
658
669
  * This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
659
670
  * via the `definition` "PromptChatApiPluginList".
@@ -3,7 +3,7 @@ export declare const ELEMENT_NAME = "smarter-chat";
3
3
  export declare const TOGGLE_EVENT = "smarter-chat-toggle";
4
4
  export declare class SmarterChatElement extends HTMLElement {
5
5
  #private;
6
- static observedAttributes: ("chatbot" | "color" | "label" | "open" | "debug" | "width" | "height" | "position" | "api-key" | "mode" | "z-index" | "session-cookie-name" | "cookie-path" | "stream-progress")[];
6
+ static observedAttributes: ("chatbot" | "color" | "language" | "label" | "debug" | "width" | "height" | "position" | "api-key" | "mode" | "open" | "z-index" | "session-cookie-name" | "cookie-path" | "stream-progress")[];
7
7
  /** The element's options, from its attributes. */
8
8
  get options(): EmbedOptionsResult;
9
9
  /** Whether the launcher is open. */
@@ -11,8 +11,8 @@ export interface EmbedOptions {
11
11
  position: EmbedPosition;
12
12
  /** Whether the launcher starts open. */
13
13
  open: boolean;
14
- /** The launcher's accessible name, and the chat panel's. */
15
- label: string;
14
+ /** The launcher's accessible name, and the chat panel's. Null for the default, "Chat", in the chat's language. */
15
+ label: string | null;
16
16
  /** The launcher button's background color. */
17
17
  color: string;
18
18
  /** The width of the inline chat, or of the launcher's panel. */
@@ -29,6 +29,8 @@ export interface EmbedOptions {
29
29
  streamProgress: boolean;
30
30
  /** Log to the browser console. */
31
31
  debug: boolean;
32
+ /** The language of the chat's own text, e.g. "fr". Null for the page's, or else the browser's. */
33
+ language: string | null;
32
34
  }
33
35
  /** The result of reading the options: the options, or why they can't be used. */
34
36
  export type EmbedOptionsResult = {
@@ -39,8 +41,7 @@ export type EmbedOptionsResult = {
39
41
  error: string;
40
42
  };
41
43
  /** The attributes that a <smarter-chat> element reads, in kebab-case. */
42
- export declare const OPTION_ATTRIBUTES: readonly ["chatbot", "api-key", "mode", "position", "open", "label", "color", "width", "height", "z-index", "session-cookie-name", "cookie-path", "stream-progress", "debug"];
43
- export declare const DEFAULT_LABEL = "Chat";
44
+ export declare const OPTION_ATTRIBUTES: readonly ["chatbot", "api-key", "mode", "position", "open", "label", "color", "width", "height", "z-index", "session-cookie-name", "cookie-path", "stream-progress", "debug", "language"];
44
45
  export declare const DEFAULT_COLOR = "#ff5733";
45
46
  export declare const DEFAULT_Z_INDEX = 2147483000;
46
47
  /** A boolean attribute: present and empty, or "true", is true. "false" is false. Missing is the default. */
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @smarter.sh/ui-chat: the public api of the npm package. See vite.config.ts (--mode lib).
3
3
  *
4
- * The Smarter web console builds this package as an app instead. See main.tsx.
4
+ * The Smarter web console's Prompt Engineer's Workbench imports it too, and puts its developer Console beside the
5
+ * chat, with SmarterChat's verbose, reloadKey, headerActions and on* props.
5
6
  */
6
- export { default as SmarterChat } from "./components/SmarterChat";
7
- export { default as Console } from "./components/Console";
8
- export { MenuItems } from "./components/Console/enums";
7
+ export { default as SmarterChat, HeaderButton } from "./components/SmarterChat";
8
+ export type { HeaderButtonProps } from "./components/SmarterChat";
9
9
  export { MessageDirectionEnum, SenderRoleEnum, ValidMessageRolesEnum } from "./lib/enums";
10
10
  export { projectVersion as version } from "./const";
11
11
  export { CHAT_CONTRACT_V2_CAPABILITY, normalizeConfig } from "./lib/api";
@@ -68,11 +68,18 @@ export declare function normalizeConfig(data: unknown): ChatConfig | null;
68
68
  * e.g. by the Console, which displays the configuration as JSON.
69
69
  */
70
70
  export declare function withLegacyChatbot(config: Contract.PromptChatApiConfig): ChatConfig;
71
+ /** The config api's query parameter that asks for the configuration's diagnostic parts. */
72
+ export declare const VERBOSE_PARAMETER = "verbose";
71
73
  /**
72
74
  * The LLMClient's configuration. A new chat session's key, and the debug mode, are saved in their
73
75
  * cookies, for the next page load.
76
+ *
77
+ * With verbose, the platform adds the configuration's diagnostic parts, which the Console displays:
78
+ * the session's tool calls, the complete meta_data, and the lists of plugins and extensions. They are
79
+ * costly to build, so the chat asks for them only while the Console displays them. A deployed
80
+ * LLMClient's own host, and an older platform, ignore it.
74
81
  */
75
- export declare function fetchConfig(apiUrl: string, cookies: ChatCookies, context: ClientContext): Promise<ChatConfig>;
82
+ export declare function fetchConfig(apiUrl: string, cookies: ChatCookies, context: ClientContext, verbose?: boolean): Promise<ChatConfig>;
76
83
  /**
77
84
  * Reads a Server-Sent Events stream, and calls onEvent with each event's name and data. Comments
78
85
  * (e.g. keepalives) and retry hints are ignored.
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Translation functions for Smarter Chat.
3
+ *
4
+ * Smarter Chat is translated with gettext, the same way as the Smarter web console, and has the same
5
+ * languages: English, which is the source language of every message, Spanish (Latin American, under the
6
+ * generic "es" code), French and Brazilian Portuguese ("pt-br", whose catalog is pt_BR). Its message catalogs are its own, in locale/<language>/LC_MESSAGES/smarter-chat.po,
7
+ * because the chat also runs on pages that the Smarter platform didn't render: the npm library's and the embed
8
+ * script's. `npm run i18n` compiles them into src/catalogs.gen.ts, which every build bundles.
9
+ *
10
+ * The language is the one that SmarterChat's `language` prop asks for, or else the page's, from the lang attribute
11
+ * of its <html> element, which the web console sets to the console's language, or else the browser's. A language
12
+ * that Smarter Chat doesn't have falls back to its generic language (fr-CA to fr), or else to a regional language
13
+ * of the same generic language (pt and pt-PT to pt-br), and then to English.
14
+ * SmarterChat activates its language as it renders, so that the functions here, which every component and module
15
+ * calls, translate into it. A page with two chats in two languages therefore gets the language of the last one to
16
+ * render.
17
+ *
18
+ * Every message is English source text, and must be a string literal, so that `npm run i18n` can extract it.
19
+ * Interpolate values afterwards, with Python-style named placeholders, so that a translator can move them:
20
+ *
21
+ * @example
22
+ * gettext("Start a new chat");
23
+ * interpolate(gettext("%(assistant)s is typing"), { assistant });
24
+ * interpolate(ngettext("%(count)s tool", "%(count)s tools", n), { count: n });
25
+ * pgettext("button", "Code");
26
+ * // a React element inside a sentence:
27
+ * interpolateNodes(gettext("Delete %(name)s?"), { name: <strong>{name}</strong> });
28
+ *
29
+ * A comment that begins with "Translators:" on the line before a call is copied into the message catalogs, for the
30
+ * translator. Translate when the text is displayed, never in a module-level constant, which is evaluated once,
31
+ * before any language is activated.
32
+ */
33
+ import { type ReactNode } from "react";
34
+ /** The source language, which has no catalog. */
35
+ export declare const DEFAULT_LANGUAGE = "en";
36
+ /** The languages that Smarter Chat is translated into, including English, as lowercase language tags. */
37
+ export declare const LANGUAGES: readonly string[];
38
+ type InterpolationValues = Record<string, string | number | null | undefined>;
39
+ /**
40
+ * The language of Smarter Chat that best matches a language tag, e.g. "fr" for "fr-CA", or "pt-br" for "pt" and
41
+ * "pt-PT", or null if it has none. The tag is case-insensitive, and may use "_" for "-", as Django's locale names do.
42
+ */
43
+ export declare function matchLanguage(tag: string | null | undefined): string | null;
44
+ /**
45
+ * The language to display: the requested one, if Smarter Chat has it, or else the page's (<html lang>), or else
46
+ * the browser's first one that it has, or else English.
47
+ */
48
+ export declare function resolveLanguage(requested?: string | null): string;
49
+ /** Translates from now on into the language that resolveLanguage() chooses for the request, and returns it. */
50
+ export declare function activateLanguage(requested?: string | null): string;
51
+ /** The active language. Until one is activated, the page's or the browser's. */
52
+ export declare function currentLanguage(): string;
53
+ /** Translates a message. */
54
+ export declare function gettext(msgid: string): string;
55
+ /** Translates a message that has a singular and a plural form, chosen by count. */
56
+ export declare function ngettext(singular: string, pluralText: string, count: number): string;
57
+ /** Translates a message in a context, which tells apart two messages with the same English text. */
58
+ export declare function pgettext(context: string, msgid: string): string;
59
+ /** ngettext() in a context. */
60
+ export declare function npgettext(context: string, singular: string, pluralText: string, count: number): string;
61
+ /**
62
+ * Replaces each %(name)s placeholder in a translated message with values[name].
63
+ * A placeholder with no value is left as it is, so that the mistake shows.
64
+ */
65
+ export declare function interpolate(message: string, values: InterpolationValues): string;
66
+ /**
67
+ * interpolate() for values that are React nodes, e.g. a name in <strong> inside a sentence. Returns a fragment of
68
+ * the message's text and the values, in the order that the (translated) message puts them.
69
+ */
70
+ export declare function interpolateNodes(message: string, values: Record<string, ReactNode>): ReactNode;
71
+ export {};
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * The api's types are generated from the contract's JSON Schema (contract/chat-contract.schema.json,
5
5
  * which the Smarter backend generates from smarter.apps.prompt.contract.models) into contract.gen.ts.
6
- * They describe the fields that Smarter Chat reads. The api returns more, which the Console displays
7
- * as is.
6
+ * They describe the fields that Smarter Chat reads. The api returns more, which onConfig passes on as is.
8
7
  */
8
+ import type { ReactNode } from "react";
9
9
  import type * as Contract from "./contract.gen";
10
10
  import type { MessageDirection, SenderRole } from "./lib/enums";
11
11
  export type { Contract };
@@ -75,7 +75,10 @@ export interface SmarterChatProps {
75
75
  apiUrl: string;
76
76
  /** An optional Smarter api key, for LLMClients that require authentication. */
77
77
  apiKey?: string | null;
78
- /** Show the button that shows and hides the thread's metadata messages. */
78
+ /**
79
+ * Show the Sandbox / Production mode switch, which shows and hides the thread's metadata messages (Smarter's
80
+ * system, tool and meta data messages), and start in sandbox mode.
81
+ */
79
82
  toggleMetadata?: boolean;
80
83
  /** The name of Django's CSRF cookie. */
81
84
  csrfCookieName?: string;
@@ -96,20 +99,35 @@ export interface SmarterChatProps {
96
99
  cookiePath?: string | null;
97
100
  /** @deprecated Not used. Django's session cookie is sent with each request, as is. */
98
101
  authSessionCookieName?: string;
99
- /** Show the Console, which displays the chat's configuration and history. */
100
- showConsole?: boolean;
101
102
  /** The domain whose cookies Smarter Chat reads. example: platform.smarter.sh */
102
103
  cookieDomain?: string;
103
104
  /** A unique id of the page request, sent as the X-Smarter-RequestId header. */
104
105
  smarterRequestId?: string;
105
- /**
106
- * The url of the user's server log stream (Server-Sent Events), which the Console displays in
107
- * its "Server Logs" tab. Without it, the Console has no such tab.
108
- */
109
- logStreamUrl?: string | null;
110
106
  /**
111
107
  * Display the progress of a running prompt, e.g. its tool calls, which the prompt api streams as
112
108
  * Server-Sent Events. Servers that don't stream answer as before.
113
109
  */
114
110
  streamProgress?: boolean;
111
+ /**
112
+ * The language of the chat's own text, e.g. its buttons' labels, as a language tag: "en", "es" or "fr", or a
113
+ * regional variant of one, e.g. "es-MX", which gets its generic language. By default, the page's (the lang
114
+ * attribute of its <html> element), or else the browser's. Other languages get English.
115
+ */
116
+ language?: string | null;
117
+ /**
118
+ * Fetch the configuration's diagnostic parts too, e.g. the chat session's tool calls, which are costly for the
119
+ * platform to build, and fetch them again after each prompt. The platform sends them only to a user who may read
120
+ * the LLMClient. onConfig receives them.
121
+ */
122
+ verbose?: boolean;
123
+ /** Reload the configuration when this changes, e.g. after the page changed the LLMClient's manifest. */
124
+ reloadKey?: number | string;
125
+ /** Buttons that the page adds to the chat's header, after its own. See HeaderButton. */
126
+ headerActions?: ReactNode;
127
+ /** Called with the configuration each time it loads: at the start of a chat, and with verbose, after each prompt. */
128
+ onConfig?: (config: ChatConfig) => void;
129
+ /** Called when the user starts a new chat, whose session has a new key. */
130
+ onNewChat?: () => void;
131
+ /** Called with whether the chat is in sandbox mode (true) or production mode, when it starts and when it changes. */
132
+ onModeChange?: (sandbox: boolean) => void;
115
133
  }