@epam/ai-dial-chat-hooks 1.1.6 → 1.1.8

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/index.d.ts CHANGED
@@ -84,6 +84,8 @@ import { MessageAttachment } from '@epam/ai-dial-chat-shared';
84
84
  import { MessageCustomContent } from '@epam/ai-dial-chat-shared';
85
85
  import { MessageRating } from '@epam/ai-dial-chat-shared';
86
86
  import { Middleware } from '@epam/ai-dial-chat-api-client';
87
+ import { ModelLimitPeriodStatuses } from '@epam/ai-dial-usage-dashboard';
88
+ import { ModelLimitRow } from '@epam/ai-dial-usage-dashboard';
87
89
  import { MoveFilesResponseDto } from '@epam/ai-dial-chat-api-client';
88
90
  import { MoveItemDto } from '@epam/ai-dial-chat-api-client';
89
91
  import { MutableRefObject } from 'react';
@@ -144,6 +146,7 @@ import { UnpublishResultDto } from '@epam/ai-dial-chat-api-client';
144
146
  import { UpdateScheduledTaskBodyDto } from '@epam/ai-dial-chat-api-client';
145
147
  import { UploadArchiveResponseDto } from '@epam/ai-dial-chat-api-client';
146
148
  import { UploadedAttachmentResult } from '@epam/ai-dial-chat-shared';
149
+ import { UsageLimitCardData } from '@epam/ai-dial-usage-dashboard';
147
150
  import { useGridEditingScroll } from '@epam/ai-dial-chat-shared';
148
151
  import { UseGridEditingScrollOptions } from '@epam/ai-dial-chat-shared';
149
152
  import { UseGridEditingScrollResult } from '@epam/ai-dial-chat-shared';
@@ -769,6 +772,28 @@ export declare interface ConversationGenerationLifecycle {
769
772
  completeGeneration: (path: string, generationId: string) => void;
770
773
  }
771
774
 
775
+ /** Labels and formatter callbacks for the conversation-input limits mapping utility. */
776
+ export declare interface ConversationInputLimitsLabels {
777
+ /** Heading of the group listing the selected deployment's token limits. */
778
+ tokenGroup: string;
779
+ /** Heading of the group listing the caller's cost budget and spend against it. */
780
+ costGroup: string;
781
+ /** Label for the current-UTC-day row, used by both groups. */
782
+ periodDay: string;
783
+ /** Label for the current-UTC-week row, used by both groups. */
784
+ periodWeek: string;
785
+ /** Label for the current-UTC-month row, used by both groups. */
786
+ periodMonth: string;
787
+ /** Formats the combined used/total display value for a capped row. */
788
+ formatValueLabel: (used: string, total: string) => string;
789
+ /** Formats the ARIA label for a capped progress row. */
790
+ formatProgressAriaLabel: (params: {
791
+ label: string;
792
+ used: string;
793
+ total: string;
794
+ }) => string;
795
+ }
796
+
772
797
  /** Stable reverse-lookup maps returned by `useConversationLookupMaps`. */
773
798
  export declare interface ConversationLookupMaps {
774
799
  /** Returns the raw context id for a panel-space conversation id, or `undefined` when not found. */
@@ -919,6 +944,12 @@ export declare interface CreateChatStreamApiDeps {
919
944
  getTimezone?: () => string | undefined;
920
945
  /** `fetch` implementation to issue requests through. Defaults to the global `fetch`. */
921
946
  fetchImpl?: typeof fetch;
947
+ /**
948
+ * How long an open completion stream may go without receiving a byte
949
+ * (keepalive comments included) before it is reported as a
950
+ * {@link StreamInterruptedError}. Defaults to {@link DEFAULT_STREAM_IDLE_TIMEOUT_MS}.
951
+ */
952
+ idleTimeoutMs?: number;
922
953
  }
923
954
 
924
955
  /**
@@ -1030,6 +1061,15 @@ export declare type CsrfRefreshOutcome = {
1030
1061
 
1031
1062
  export declare const DATE_OPTIONS: Intl.DateTimeFormatOptions;
1032
1063
 
1064
+ /**
1065
+ * Inverse of `encodeDeploymentId` — decodes each `/`-separated segment back
1066
+ * to its raw, human-readable form. A segment that isn't valid
1067
+ * percent-encoding is passed through unchanged rather than throwing, since
1068
+ * this decodes externally-sourced ids (the settings iframe's postMessage
1069
+ * protocol).
1070
+ */
1071
+ export declare const decodeDeploymentId: (id: string) => string;
1072
+
1033
1073
  /**
1034
1074
  * Inverse of `encodeToolsetId` — decodes each `/`-separated segment back to
1035
1075
  * its raw, human-readable form. A segment that isn't valid percent-encoding
@@ -1051,6 +1091,9 @@ export declare const decomposeLocalizedFields: (displayName: LocalizedText | und
1051
1091
  /** Fallback text of a {@link GenerationConflictError} when no message is supplied. */
1052
1092
  export declare const DEFAULT_GENERATION_CONFLICT_MESSAGE = "A response is already being generated in this conversation. Wait for it to finish or stop it before sending another message.";
1053
1093
 
1094
+ /** Safe fallback for hosts that do not supply a translated persistence warning. */
1095
+ export declare const DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE = "The response could not be saved. It is still shown here, but may be lost if you reload or leave this page. Copy it before continuing.";
1096
+
1054
1097
  /**
1055
1098
  * Default ceiling on the summed byte length of an export's attachments.
1056
1099
  *
@@ -1064,6 +1107,8 @@ export declare const DEFAULT_GENERATION_CONFLICT_MESSAGE = "A response is alread
1064
1107
  */
1065
1108
  export declare const DEFAULT_MAX_ARCHIVE_BYTES: number;
1066
1109
 
1110
+ export declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45000;
1111
+
1067
1112
  /** Translated folder-path labels for the Personal/Shared/Public deployment groupings. */
1068
1113
  export declare interface DeploymentFolderLabels {
1069
1114
  personal: string;
@@ -1130,7 +1175,7 @@ export declare const deriveAvailableTabIds: <T extends CatalogEntityType>(items:
1130
1175
  export declare const deriveConversationRowActionState: (item: Pick<ConversationListItemDto, "sharedWithMe" | "publishedWithMe" | "isReadonly">, publishHistory: PublishHistoryEntry[] | undefined, recipients: RecipientsCountEntry) => ConversationRowActionState;
1131
1176
 
1132
1177
  /**
1133
- * Returns items marked as a user favorite, in original order.
1178
+ * Returns items marked as a user favorite that are not hidden, in original order.
1134
1179
  */
1135
1180
  export declare const deriveFavoriteItems: (items: readonly CatalogItem[]) => CatalogItem[];
1136
1181
 
@@ -1645,6 +1690,9 @@ export declare const formatOperationFolderName: (destinationFolder: string, root
1645
1690
  */
1646
1691
  export declare const formatQuotedNameList: (names: string[]) => string;
1647
1692
 
1693
+ /** Formats a raw `resetsAt` into display strings, or returns `undefined` when it cannot be formatted. */
1694
+ export declare type FormatResetTime = (resetsAt: string | undefined) => ResetTimeDisplay | undefined;
1695
+
1648
1696
  /**
1649
1697
  * Reported through `onError` when the backend rejects a completion because
1650
1698
  * another generation is already active on the same conversation — what a
@@ -1656,6 +1704,12 @@ export declare class GenerationConflictError extends Error {
1656
1704
  constructor(message?: string);
1657
1705
  }
1658
1706
 
1707
+ /** Identifies a failed terminal save independently of the model's generation outcome. */
1708
+ export declare class GenerationPersistenceError extends Error {
1709
+ static readonly type = "conversation_save_failed";
1710
+ constructor();
1711
+ }
1712
+
1659
1713
  /** Normalizes any API error into a `{ status?, message, traceId? }` shape. */
1660
1714
  export declare const getApiErrorDetails: (error: unknown) => Promise<ApiErrorDetails>;
1661
1715
 
@@ -1691,6 +1745,21 @@ export declare const getConversationSource: (item: Pick<ConversationListItemDto,
1691
1745
  */
1692
1746
  export declare const getExternalServiceFallbackName: (serviceName: string) => string;
1693
1747
 
1748
+ /**
1749
+ * Returns the tool values the conversation's last message sets through its
1750
+ * `form_schema`, restricted to `toolIds`, plus a key identifying that exact
1751
+ * application. `undefined` when the last message is not an assistant message
1752
+ * or sets no known tool.
1753
+ *
1754
+ * Streamed chunks and reloads re-create an identical `form_schema`; comparing
1755
+ * keys rather than object identity applies an app's value once and leaves a
1756
+ * later user toggle alone until the app sends a different value.
1757
+ */
1758
+ export declare const getFormSchemaToolSyncKey: (conversationId: string, messages: Message[], toolIds: readonly string[]) => {
1759
+ key: string;
1760
+ values: Record<string, boolean>;
1761
+ } | undefined;
1762
+
1694
1763
  /**
1695
1764
  * Returns the deployment the conversation was last running on: scanning
1696
1765
  * backwards, the `new_deployment_id` of a `model_changed` status message or
@@ -1714,6 +1783,15 @@ export declare const getLastDeploymentId: (messages: Message[]) => string | null
1714
1783
  */
1715
1784
  export declare const getLastUserMessageToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
1716
1785
 
1786
+ /**
1787
+ * Returns the tool configuration a (re-)loaded conversation should show: the
1788
+ * last user message's `configuration_value`, overlaid in order by the
1789
+ * `form_schema` values of the assistant messages after it. An app that turned
1790
+ * a toggle off in its final response must not see it re-armed on reload just
1791
+ * because the user message that started the run had it on.
1792
+ */
1793
+ export declare const getLatestToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
1794
+
1717
1795
  /**
1718
1796
  * Extracts the deployment/model ID from a DIAL Core conversation ID.
1719
1797
  *
@@ -1814,6 +1892,15 @@ export declare const getStarterSubmitText: (starter: StarterOption, description?
1814
1892
  */
1815
1893
  export declare const getTimeOfDayGreeting: (hour: number, translations: GreetingTranslations, firstName?: string) => string;
1816
1894
 
1895
+ /**
1896
+ * Returns the boolean values an assistant message's `form_schema` sets, keyed
1897
+ * by property name, or `undefined` when no property resolves to a boolean.
1898
+ * Lets a DIAL app switch a tools-menu toggle (e.g. `deep_research`) per
1899
+ * message — on while a run is in progress, off once its result is delivered.
1900
+ * Not filtered by tool id: `restoreToolConfiguration` ignores unknown ids.
1901
+ */
1902
+ export declare const getToolConfigurationFromFormSchema: (formSchema: DeploymentConfigurationSchema | undefined) => Record<string, boolean> | undefined;
1903
+
1817
1904
  /** Name of the same-origin `BroadcastChannel` shared by an OAuth flow's opener and its callback popup. */
1818
1905
  export declare const getToolsetOAuthChannelName: (flowId: string) => string;
1819
1906
 
@@ -1941,8 +2028,8 @@ export declare const isAnswerIncomplete: (answer: Message | undefined) => boolea
1941
2028
  * True when the conversation's last message is an unresolved assistant
1942
2029
  * placeholder: the backend only persists a conversation at generation start
1943
2030
  * (empty placeholder) and at generation end (final content, or a partial
1944
- * flagged `streamErrorMessage`/`wasStoppedByUser`), so this shape means a
1945
- * generation was still active elsewhere when the conversation was loaded.
2031
+ * flagged `streamErrorMessage`/`wasStoppedByUser`). This can mean generation
2032
+ * is still active elsewhere, or that its terminal save failed.
1946
2033
  */
1947
2034
  export declare const isAwaitingGenerationResume: (conversation: Conversation) => boolean;
1948
2035
 
@@ -2077,8 +2164,8 @@ export declare const mapDeploymentDetailsDtoToEntityDetails: (dto: DeploymentDet
2077
2164
  /** Maps a deployment limits DTO to display-ready catalog limits, or `undefined` when no qualifying stats exist. */
2078
2165
  export declare const mapDeploymentLimitsDtoToCatalogLimits: (dto: DeploymentLimitsResponseDto | undefined, labels: DeploymentLimitsLabels) => CatalogItemLimits | undefined;
2079
2166
 
2080
- /** Maps the monthly deployment token limit to a display-ready value. */
2081
- export declare const mapDeploymentLimitsToInput: (dto: DeploymentLimitsResponseDto | undefined) => MonthlyUsageLimit | undefined;
2167
+ /** Maps a deployment's day, week, and month token limits and the caller's cost budget to display-ready rows, or `undefined` when none qualify. */
2168
+ export declare const mapDeploymentLimitsToInput: (dto: DeploymentLimitsResponseDto | undefined, labels: ConversationInputLimitsLabels, formatResetTime?: FormatResetTime) => CatalogItemLimits | undefined;
2082
2169
 
2083
2170
  /** Maps a deployment listing row into the catalog UI's `CatalogItem` shape. */
2084
2171
  export declare const mapDeploymentToCatalogItem: (deployment: DeploymentItemDto, { favoriteIds, entityDetails, folderLabels, editableSchemaIds, isCustomAppsEditable, activeLocale, primaryLocale, resolveIconUrl, }: MapDeploymentToCatalogItemOptions) => CatalogItem;
@@ -2150,6 +2237,13 @@ export declare const mapFormValuesToCreateBody: (values: ScheduledTaskCreateForm
2150
2237
  */
2151
2238
  export declare const mapFormValuesToUpdateBody: (values: ScheduledTaskCreateFormValues) => UpdateScheduledTaskBodyDto;
2152
2239
 
2240
+ /**
2241
+ * Maps the same top-level Cost budgets used by the aggregate cards into table-header state.
2242
+ *
2243
+ * @param formatResetTime - Formats each period's top-level `resetsAt` into the header's reset trio. Omit it to produce statuses with no reset fields.
2244
+ */
2245
+ export declare const mapOverallCostLimitsToPeriodStatuses: (usage: UserLimitStatsResponseDto | undefined, activeLocale: string, t: Translate_2, formatResetTime?: FormatResetTime) => ModelLimitPeriodStatuses;
2246
+
2153
2247
  /**
2154
2248
  * Maps a prompt DTO into a catalog item.
2155
2249
  *
@@ -2232,6 +2326,25 @@ export declare interface MapToolsetToCatalogItemOptions {
2232
2326
  resolveIconUrl: (iconUrl: string | undefined) => string | undefined;
2233
2327
  }
2234
2328
 
2329
+ /**
2330
+ * Maps a `UserLimitStatsResponseDto` into `UsageLimitCardGroup`'s `cards` prop,
2331
+ * in Today / This week / This month order. A period is omitted entirely when
2332
+ * the response carries no usable stat for it. Each card's reset trio comes from
2333
+ * `formatResetTime`, and is absent when that callback returns `undefined`.
2334
+ */
2335
+ export declare const mapUsageDataToDashboard: (usage: UserLimitStatsResponseDto | undefined, t: Translate, formatResetTime: FormatResetTime) => UsageLimitCardData[];
2336
+
2337
+ /**
2338
+ * Maps `usage.deployments` into `ModelLimitsSection`'s `rows` prop, joined with model or application
2339
+ * identity from `deploymentItems`. Rows are included only when any displayed period stat has nonzero
2340
+ * usage (Cost stats only, for an application). Order follows `Object.keys(deployments)` —
2341
+ * `deploymentItems` is enrichment-only.
2342
+ *
2343
+ * @param resolveIconUrl - Resolves a deployment's raw `iconUrl` to the URL the avatar should load.
2344
+ * @param resolveDisplayName - Resolves a localized-text map or plain string to the display name for `activeLocale`.
2345
+ */
2346
+ export declare const mapUserUsageToModelLimits: (usage: UserLimitStatsResponseDto | undefined, deploymentItems: DeploymentItemDto[], activeLocale: string, t: Translate_2, resolveIconUrl: ResolveIconUrl, resolveDisplayName: ResolveDisplayName) => ModelLimitRow[];
2347
+
2235
2348
  /** Content payload for Markdown file attachments. */
2236
2349
  declare interface MarkdownCanvasContent {
2237
2350
  /** Discriminates the content type to select the correct renderer. */
@@ -2469,18 +2582,6 @@ export declare interface ModelSpecification {
2469
2582
  createdAt?: number;
2470
2583
  }
2471
2584
 
2472
- /** Normalized monthly token usage consumed by the conversation input control. */
2473
- export declare interface MonthlyUsageLimit {
2474
- /** Normalized used-token count. */
2475
- used: number;
2476
- /** Configured monthly token limit. */
2477
- total: number;
2478
- /** Remaining monthly tokens, clamped to zero. */
2479
- remaining: number;
2480
- /** Monthly utilization percentage, clamped to 0–100. */
2481
- usedPercent: number;
2482
- }
2483
-
2484
2585
  /** Returns a skill relative path's final segment (its display name in the file tree). */
2485
2586
  export declare const nameFromPath: (path: string) => string;
2486
2587
 
@@ -2492,6 +2593,20 @@ export declare const nameFromPath: (path: string) => string;
2492
2593
  */
2493
2594
  export declare const navigateToolsetOAuthPopup: (popup: Window, auth: ToolsetOAuthSettings, toolsetId: string, callbackPath: string, credentialsLevel?: ToolsetCredentialsLevel, resourceKind?: OAuthResourceKind, offlineUsageConsent?: boolean) => ToolsetOAuthInitiationResult;
2494
2595
 
2596
+ /**
2597
+ * Encodes a deployment/application id to its single-encoded form regardless
2598
+ * of whether the value it received was already percent-encoded or the raw,
2599
+ * human-readable form — decoding first then re-encoding once is idempotent
2600
+ * either way, since `decodeDeploymentId` on a raw (unencoded) id is a no-op.
2601
+ * Use this instead of `encodeDeploymentId` at a boundary that cannot
2602
+ * guarantee which form it receives, such as a `postMessage` payload from the
2603
+ * settings iframe: calling `encodeDeploymentId` directly on a value the
2604
+ * sender already encoded escapes the existing `%` characters a second time
2605
+ * (`%20` becomes `%2520`), which the backend only ever undoes once and so
2606
+ * 404s on.
2607
+ */
2608
+ export declare const normalizeDeploymentId: (id: string) => string;
2609
+
2495
2610
  /**
2496
2611
  * Normalises a stored response-format string to the current enum. Legacy data
2497
2612
  * may contain `'Markdown'` or `'PlainText'` (capital-first) instead of the
@@ -2981,6 +3096,23 @@ export declare const referenceAttachmentToPdfCanvasContent: (attachment: Attachm
2981
3096
  /** Name reserved for the hidden marker file used to create empty folders. */
2982
3097
  export declare const RESERVED_MARKER_NAME = ".dial_folder";
2983
3098
 
3099
+ /**
3100
+ * One reset time, already parsed and formatted by the host. Declared
3101
+ * structurally here so this library never imports an application type; the
3102
+ * host passes a value that satisfies this shape (e.g. `apps/chat`'s own
3103
+ * `ResetTimeDisplay`).
3104
+ */
3105
+ export declare interface ResetTimeDisplay {
3106
+ /** Exclusive end of the period as an epoch ms value, for the host's boundary scheduling. */
3107
+ resetsAtMs: number;
3108
+ /** Machine-readable instant for a `<time dateTime>` attribute. */
3109
+ isoValue: string;
3110
+ /** Visible reset line. */
3111
+ label: string;
3112
+ /** Accessible expansion of the reset line. */
3113
+ ariaLabel: string;
3114
+ }
3115
+
2984
3116
  /**
2985
3117
  * Resolves the primary action for a catalog item.
2986
3118
  *
@@ -3019,6 +3151,9 @@ export declare const resolveDialFileBucketAndPath: (fileId: string) => {
3019
3151
  path: string;
3020
3152
  } | undefined;
3021
3153
 
3154
+ /** A callback that resolves a display name from a localized-text value. */
3155
+ declare type ResolveDisplayName = (name: string | Record<string, string> | undefined | null, locale: string) => string;
3156
+
3022
3157
  /** Resolves a DIAL Core file id to a downloadable URL. Host-owned — encodes the app's own file-download endpoint. */
3023
3158
  export declare type ResolveDownloadUrl = (fileId: string) => string | undefined;
3024
3159
 
@@ -3056,6 +3191,9 @@ export declare const resolveGroupedVisualizerCanvasContent: (attachments: Displa
3056
3191
  */
3057
3192
  export declare const resolveHtmlCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => Promise<HtmlCanvasContent | ErrorCanvasContent | null>;
3058
3193
 
3194
+ /** A callback that resolves an icon URL from a deployment's raw `iconUrl` field. */
3195
+ declare type ResolveIconUrl = (iconUrl: string | undefined) => string | undefined;
3196
+
3059
3197
  /**
3060
3198
  * Resolves an image canvas content payload from a DisplayAttachment without
3061
3199
  * fetching — returns a local blob URL or the BFF download URL directly so the
@@ -3532,6 +3670,29 @@ export declare interface StreamCompletionOptions {
3532
3670
  signal: AbortSignal;
3533
3671
  }
3534
3672
 
3673
+ /**
3674
+ * Reported through `onError` when the network connection carrying a
3675
+ * completion stream is lost (a rejected `fetch`, or a read that fails after a
3676
+ * 2xx response) or goes silent past the idle timeout — what a laptop sleep or
3677
+ * a phone lock mid-generation produces. The backend-owned generation may
3678
+ * still be running, so the caller can recover it rather than treat the
3679
+ * response as failed. `cause` holds the original error, when there is one.
3680
+ */
3681
+ export declare class StreamInterruptedError extends Error {
3682
+ constructor(cause?: unknown);
3683
+ }
3684
+
3685
+ /**
3686
+ * Reported through `onError` when DIAL Core itself signals a failure with an
3687
+ * in-band `{ error: { message } }` SSE chunk. Its `message` is upstream text
3688
+ * intended for the user, unlike a transport failure (failed `fetch`, non-OK
3689
+ * status, broken stream), whose message is technical detail. A custom
3690
+ * transport raises this for any user-facing upstream error text.
3691
+ */
3692
+ export declare class StreamUpstreamError extends Error {
3693
+ constructor(message: string);
3694
+ }
3695
+
3535
3696
  /** Strips leading and trailing slashes from a path segment. */
3536
3697
  export declare const stripSurroundingSlashes: (path: string) => string;
3537
3698
 
@@ -3857,6 +4018,12 @@ export declare interface TranscribeWithDeploymentParams {
3857
4018
  signal: AbortSignal;
3858
4019
  }
3859
4020
 
4021
+ /** A translate function compatible with i18next's `TFunction`. */
4022
+ declare type Translate = (key: string, options?: Record<string, unknown>) => string;
4023
+
4024
+ /** A translate function compatible with i18next's `TFunction`. */
4025
+ declare type Translate_2 = (key: string, options?: Record<string, unknown>) => string;
4026
+
3860
4027
  export declare const trimFileNameToByteLimit: (name: string, limit?: number) => string;
3861
4028
 
3862
4029
  /** An error thrown to indicate the caller is unauthenticated. */
@@ -3915,6 +4082,66 @@ export declare interface UploadFileWithProgressOptions {
3915
4082
  /** Upload mode passed to `FilesApi.uploadFile`: overwrite an existing file or fail if it already exists. */
3916
4083
  export declare type UploadMode = 'overwrite' | 'create-only';
3917
4084
 
4085
+ /**
4086
+ * i18n key strings that the consuming app's translation bundle must define for
4087
+ * `mapUsageDataToDashboard` to produce correctly translated strings. The
4088
+ * values are the default key paths used by AI DIAL Chat.
4089
+ */
4090
+ export declare const USAGE_DATA_I18N_KEYS: {
4091
+ /** Title for the current-UTC-day card (e.g. `'Today'`). */
4092
+ readonly todayTitle: "usage.todayTitle";
4093
+ /** Accessible period description for the current-UTC-day card. */
4094
+ readonly todayPeriodDescription: "usage.todayPeriodDescription";
4095
+ /** Title for the current-UTC-week card (e.g. `'This week'`). */
4096
+ readonly thisWeekTitle: "usage.thisWeekTitle";
4097
+ /** Accessible period description for the current-UTC-week card. */
4098
+ readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
4099
+ /** Title for the current-UTC-month card (e.g. `'This month'`). */
4100
+ readonly thisMonthTitle: "usage.thisMonthTitle";
4101
+ /** Accessible period description for the current-UTC-month card. */
4102
+ readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
4103
+ /** Aria label when there is no limit. Receives `{ used: string }`. */
4104
+ readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
4105
+ /** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
4106
+ readonly progressAriaLabel: "usage.progressAriaLabel";
4107
+ };
4108
+
4109
+ /**
4110
+ * i18n key strings that the consuming app's translation bundle must define for
4111
+ * `mapUserUsageToModelLimits` and `mapOverallCostLimitsToPeriodStatuses` to produce
4112
+ * correctly translated strings. The values are the default key paths used by AI DIAL Chat.
4113
+ */
4114
+ export declare const USAGE_MODEL_LIMITS_I18N_KEYS: {
4115
+ /** Period label used in tooltip text. Receives no interpolation. */
4116
+ readonly todayPeriodDescription: "usage.todayPeriodDescription";
4117
+ /** Period label used in tooltip text. Receives no interpolation. */
4118
+ readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
4119
+ /** Period label used in tooltip text. Receives no interpolation. */
4120
+ readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
4121
+ /** Tooltip when the overall cost limit is running low. Receives `{ period: string }`. */
4122
+ readonly overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip";
4123
+ /** Tooltip when the overall cost limit is reached. Receives `{ period: string }`. */
4124
+ readonly overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip";
4125
+ /** Aria label for a metric cell with no data. */
4126
+ readonly unavailableLabel: "usage.unavailableLabel";
4127
+ /** Supporting label when a token limit follows the cost limit. */
4128
+ readonly followsCostLimitLabel: "usage.followsCostLimitLabel";
4129
+ /** Supporting label when there is no per-deployment token limit. */
4130
+ readonly noLimitLabel: "usage.noLimitLabel";
4131
+ /** Aria label when token usage has no limit but follows the cost limit. Receives `{ used: string }`. */
4132
+ readonly followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel";
4133
+ /** Aria label when there is no limit. Receives `{ used: string }`. */
4134
+ readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
4135
+ /** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
4136
+ readonly progressAriaLabel: "usage.progressAriaLabel";
4137
+ /** Label for the spent-cost cell. Receives `{ amount: string }`. */
4138
+ readonly spentLabel: "usage.spentLabel";
4139
+ /** Type caption for an application (agent) row. Receives no interpolation. */
4140
+ readonly applicationTypeLabel: "usage.applicationTypeLabel";
4141
+ /** Supporting label on an application row's spent cost. Receives no interpolation. */
4142
+ readonly includesCalledModelsLabel: "usage.includesCalledModelsLabel";
4143
+ };
4144
+
3918
4145
  /**
3919
4146
  * Synchronises the active conversation with the conversation list and returns
3920
4147
  * the panel-space id of the active conversation, or `undefined` when none is active.
@@ -4539,7 +4766,7 @@ export declare interface UseConversationSourcesResult {
4539
4766
  * `transport`/`generation`/`channel`/`overlay` capabilities rather than any
4540
4767
  * app context or `server-api` import.
4541
4768
  */
4542
- export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, }: UseConversationStreamParams) => UseConversationStreamResult;
4769
+ export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, generationPersistenceErrorMessage, onStreamError, }: UseConversationStreamParams) => UseConversationStreamResult;
4543
4770
 
4544
4771
  /** Parameters for {@link useConversationStream}. */
4545
4772
  export declare interface UseConversationStreamParams {
@@ -4557,6 +4784,15 @@ export declare interface UseConversationStreamParams {
4557
4784
  * {@link DEFAULT_GENERATION_CONFLICT_MESSAGE}.
4558
4785
  */
4559
4786
  generationConflictMessage?: string;
4787
+ /** Host-translated warning shown when the received answer could not be saved. */
4788
+ generationPersistenceErrorMessage?: string;
4789
+ /**
4790
+ * Receives the original error of every failed stream. The hook shows only
4791
+ * host-supplied or upstream-supplied text on the message bubble and hides
4792
+ * transport detail (e.g. `Failed to fetch`), so this is where the host can
4793
+ * still log or report the raw error.
4794
+ */
4795
+ onStreamError?: (error: Error) => void;
4560
4796
  }
4561
4797
 
4562
4798
  /** Return value of {@link useConversationStream}. */