@epam/ai-dial-chat-hooks 1.2.0-dev.2 → 1.2.0-dev.201
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/api-error/api-error.js +5 -4
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
- package/attachments.d.ts +10 -4
- package/catalog/catalog-derivations.js +1 -1
- package/catalog/deployment-id.js +8 -2
- package/catalog/map-deployment-limits-to-input.js +81 -9
- package/catalog/map-deployment-to-catalog-item.js +34 -34
- package/catalog/map-entity-details-to-catalog.js +7 -0
- package/catalog/map-skill-to-catalog-item.js +30 -27
- package/catalog/publish.js +6 -5
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +19 -17
- package/catalog.d.ts +134 -20
- package/catalog.js +23 -22
- package/conversation/announcement-message.js +16 -5
- package/conversation/conversation-transfer/export-conversation.js +24 -16
- package/conversation/conversation-transfer/import-conversation.js +80 -31
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/create-chat-stream-api.js +85 -49
- package/conversation/message-utils.js +44 -2
- package/conversation/stage.js +23 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
- package/conversation/useConversationExport/useConversationExport.js +9 -9
- package/conversation/useConversationHandlers/useConversationHandlers.js +13 -17
- package/conversation/useConversationImport/useConversationImport.js +123 -121
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +2 -3
- package/conversation/useConversationScroll/useConversationScroll.js +68 -64
- package/conversation/useConversationStream/apply-chunk.js +1 -1
- package/conversation/useConversationStream/generation-resume.js +104 -63
- package/conversation/useConversationStream/useConversationStream.js +183 -108
- package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
- package/conversation/useTranscribeAudio/transcription-retry.js +5 -4
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
- package/conversation-sources.d.ts +1 -1
- package/conversation-transfer.d.ts +2 -1
- package/conversation.d.ts +274 -17
- package/conversation.js +32 -30
- package/file-manager-canvas.d.ts +398 -0
- package/file-manager-canvas.js +2 -0
- package/file-manager.d.ts +153 -348
- package/file-manager.js +25 -24
- package/files/attachment-canvas.js +51 -13
- package/files/attachment-types.js +14 -13
- package/files/dial-file-manager-mapping.util.js +2 -1
- package/files/dial-file-manager-path.util.js +23 -1
- package/files/dial-file-manager.model.js +23 -19
- package/files/dial-file-manager.types.js +3 -3
- package/files/useDialFileListing/useDialFileListing.js +157 -145
- package/files/useDialFileManager/useDialFileManager.js +132 -128
- package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
- package/files/useDialFileMutations/useDialFileMutations.js +33 -32
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
- package/index.d.ts +1124 -90
- package/index.js +136 -122
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
- package/mcp-apps.d.ts +8 -6
- package/oauth/toolset-id.js +5 -3
- package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
- package/oauth.d.ts +32 -0
- package/oauth.js +9 -9
- package/package.json +36 -21
- package/scheduled-task/scheduled-task-description.js +77 -0
- package/scheduled-task/scheduled-task-preparation.js +24 -0
- package/scheduled-task/scheduled-task-trigger.js +7 -2
- package/scheduled-task/scheduled-tasks-api-client.js +19 -0
- package/scheduled-task/use-scheduled-task-runs.js +194 -0
- package/scheduled-task/use-scheduled-tasks.js +93 -0
- package/scheduled-tasks.d.ts +195 -3
- package/scheduled-tasks.js +7 -2
- package/skill/skill-archive.js +19 -0
- package/skill/skill-types.js +8 -7
- package/skill/skill.js +42 -27
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
- package/skill/useSkillEditorLoad.js +29 -28
- package/skill/useSkillEditorSubmit.js +108 -84
- package/skill/useSkillFileActions.js +70 -58
- package/skill-editor.d.ts +131 -3
- package/skill-editor.js +9 -8
- package/usage/map-usage-data-to-dashboard.js +66 -0
- package/usage/map-user-usage-to-model-limits.js +202 -0
- package/usage.d.ts +125 -0
- package/usage.js +3 -0
- package/usePageFileDrag/usePageFileDrag.js +3 -3
- package/utils.d.ts +8 -6
package/conversation.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { Message } from '@epam/ai-dial-chat-shared';
|
|
|
15
15
|
import { MessageCustomContent } from '@epam/ai-dial-chat-shared';
|
|
16
16
|
import { MessageRating } from '@epam/ai-dial-chat-shared';
|
|
17
17
|
import { MutableRefObject } from 'react';
|
|
18
|
-
import { OverlayChatMessage } from '@epam/ai-dial-chat-overlay';
|
|
19
18
|
import { PublishHistoryEntry } from '@epam/ai-dial-publish-panel';
|
|
20
19
|
import { RateApi } from '@epam/ai-dial-chat-api-client';
|
|
21
20
|
import { ReactNode } from 'react';
|
|
@@ -24,6 +23,7 @@ import { RequestSkill } from '@epam/ai-dial-chat-shared';
|
|
|
24
23
|
import { ResponseFormat } from '@epam/ai-dial-chat-shared';
|
|
25
24
|
import { SendCompletionDtoModeEnum } from '@epam/ai-dial-chat-api-client';
|
|
26
25
|
import { SetStateAction } from 'react';
|
|
26
|
+
import { Stage } from '@epam/ai-dial-chat-shared';
|
|
27
27
|
import { StarterOption } from '@epam/ai-dial-chat-shared';
|
|
28
28
|
import { StatusMessage } from '@epam/ai-dial-chat-shared';
|
|
29
29
|
import { StreamChunk } from '@epam/ai-dial-chat-shared';
|
|
@@ -36,8 +36,47 @@ export declare interface AnnouncementContent {
|
|
|
36
36
|
title: string | null;
|
|
37
37
|
description: string | null;
|
|
38
38
|
html: string | null;
|
|
39
|
+
/** Entries of the popover the banner opens. */
|
|
40
|
+
items?: readonly AnnouncementListItem[];
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
/** One entry of the announcements popover behind the banner's `+N` pill. */
|
|
44
|
+
export declare interface AnnouncementListItem {
|
|
45
|
+
/** Plain-text heading of the entry. */
|
|
46
|
+
title: string;
|
|
47
|
+
/** Supporting copy of the entry, sanitized before it is rendered. */
|
|
48
|
+
description?: string | null;
|
|
49
|
+
/** Optional call to action shown at the end of the entry. */
|
|
50
|
+
link?: AnnouncementListItemLink | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** A link rendered as the call to action of an announcements-popover entry. */
|
|
54
|
+
export declare interface AnnouncementListItemLink {
|
|
55
|
+
/** Visible text of the call to action. */
|
|
56
|
+
label: string;
|
|
57
|
+
/** Absolute `http`/`https` target the call to action opens. */
|
|
58
|
+
href: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Applies a single SSE stream chunk to the message list.
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* Attachments are accumulated: each chunk's attachments are appended to the
|
|
66
|
+
* existing array rather than replacing it.
|
|
67
|
+
*
|
|
68
|
+
* Annotations are merged by `index`: partial `body.title` and `body.quote`
|
|
69
|
+
* strings are concatenated across chunks, matching the same delta-merge
|
|
70
|
+
* semantics used for stages.
|
|
71
|
+
*
|
|
72
|
+
* `state` is overwritten (not merged) by each chunk that carries one,
|
|
73
|
+
* matching the DIAL stateful-app contract.
|
|
74
|
+
*
|
|
75
|
+
* @returns Updated message array, or `null` when the chunk carries no
|
|
76
|
+
* actionable data (empty content, no form_schema, and no attachments).
|
|
77
|
+
*/
|
|
78
|
+
export declare const applyChunkToMessages: (messages: Message[], messageIndex: number, chunk: StreamChunk) => Message[] | null;
|
|
79
|
+
|
|
41
80
|
/** State and controls returned by `useAsyncConfirmDialog`. */
|
|
42
81
|
export declare interface AsyncConfirmDialogControls<T> {
|
|
43
82
|
/**
|
|
@@ -95,7 +134,7 @@ export declare enum AudioTranscriptionErrorReason {
|
|
|
95
134
|
Unavailable = "unavailable",
|
|
96
135
|
/** The recording exceeds the caller's configured size limit. */
|
|
97
136
|
TooLarge = "tooLarge",
|
|
98
|
-
/**
|
|
137
|
+
/** Recognition is rate-limited, unavailable, or exhausted short gateway retries. */
|
|
99
138
|
Busy = "busy",
|
|
100
139
|
/** Recognition failed for any other reason. */
|
|
101
140
|
Failed = "failed"
|
|
@@ -107,9 +146,18 @@ export declare enum AudioTranscriptionErrorReason {
|
|
|
107
146
|
* hidden only while the current announcement produces the same signature, so
|
|
108
147
|
* editing any part of it brings the banner back with no version counter.
|
|
109
148
|
*
|
|
149
|
+
* Every piece of content the banner surface renders feeds the signature — the
|
|
150
|
+
* title, the description, and the popover entries behind the pill, which live
|
|
151
|
+
* inside the banner and are hidden along with it. Publishing a new entry in
|
|
152
|
+
* that list therefore invalidates an earlier dismissal on its own, even when
|
|
153
|
+
* the banner line itself is untouched.
|
|
154
|
+
*
|
|
110
155
|
* A legacy-only announcement returns the raw HTML string — byte-identical to
|
|
111
156
|
* what shipped before the structured fields existed — so dismissals recorded
|
|
112
|
-
* by older builds keep working without a storage migration.
|
|
157
|
+
* by older builds keep working without a storage migration. `items` is left
|
|
158
|
+
* out of the payload entirely when the list is empty for the same reason: a
|
|
159
|
+
* deployment that never configured the popover keeps matching the signatures
|
|
160
|
+
* its users already have stored.
|
|
113
161
|
*/
|
|
114
162
|
export declare const buildAnnouncementSignature: (content: AnnouncementContent) => string;
|
|
115
163
|
|
|
@@ -299,6 +347,12 @@ export declare interface CreateChatStreamApiDeps {
|
|
|
299
347
|
getTimezone?: () => string | undefined;
|
|
300
348
|
/** `fetch` implementation to issue requests through. Defaults to the global `fetch`. */
|
|
301
349
|
fetchImpl?: typeof fetch;
|
|
350
|
+
/**
|
|
351
|
+
* How long an open completion stream may go without receiving a byte
|
|
352
|
+
* (keepalive comments included) before it is reported as a
|
|
353
|
+
* {@link StreamInterruptedError}. Defaults to {@link DEFAULT_STREAM_IDLE_TIMEOUT_MS}.
|
|
354
|
+
*/
|
|
355
|
+
idleTimeoutMs?: number;
|
|
302
356
|
}
|
|
303
357
|
|
|
304
358
|
/**
|
|
@@ -313,6 +367,11 @@ export declare const createMessagePair: (content: string, customContent?: Messag
|
|
|
313
367
|
/** Fallback text of a {@link GenerationConflictError} when no message is supplied. */
|
|
314
368
|
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.";
|
|
315
369
|
|
|
370
|
+
/** Safe fallback for hosts that do not supply a translated persistence warning. */
|
|
371
|
+
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.";
|
|
372
|
+
|
|
373
|
+
export declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45000;
|
|
374
|
+
|
|
316
375
|
/**
|
|
317
376
|
* Derives the row-action visibility state for a single conversation item.
|
|
318
377
|
*
|
|
@@ -347,6 +406,12 @@ export declare class GenerationConflictError extends Error {
|
|
|
347
406
|
constructor(message?: string);
|
|
348
407
|
}
|
|
349
408
|
|
|
409
|
+
/** Identifies a failed terminal save independently of the model's generation outcome. */
|
|
410
|
+
export declare class GenerationPersistenceError extends Error {
|
|
411
|
+
static readonly type = "conversation_save_failed";
|
|
412
|
+
constructor();
|
|
413
|
+
}
|
|
414
|
+
|
|
350
415
|
/**
|
|
351
416
|
* Strips the leading bucket segment from a conversation id and decodes any
|
|
352
417
|
* already-percent-encoded remainder back to raw, so callers that re-encode
|
|
@@ -359,6 +424,21 @@ export declare const getConversationPath: (conversationId: string) => string;
|
|
|
359
424
|
*/
|
|
360
425
|
export declare const getConversationSource: (item: Pick<ConversationListItemDto, "sharedWithMe" | "publishedWithMe">) => FilterTab;
|
|
361
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Returns the tool values the conversation's last message sets through its
|
|
429
|
+
* `form_schema`, restricted to `toolIds`, plus a key identifying that exact
|
|
430
|
+
* application. `undefined` when the last message is not an assistant message
|
|
431
|
+
* or sets no known tool.
|
|
432
|
+
*
|
|
433
|
+
* Streamed chunks and reloads re-create an identical `form_schema`; comparing
|
|
434
|
+
* keys rather than object identity applies an app's value once and leaves a
|
|
435
|
+
* later user toggle alone until the app sends a different value.
|
|
436
|
+
*/
|
|
437
|
+
export declare const getFormSchemaToolSyncKey: (conversationId: string, messages: Message[], toolIds: readonly string[]) => {
|
|
438
|
+
key: string;
|
|
439
|
+
values: Record<string, boolean>;
|
|
440
|
+
} | undefined;
|
|
441
|
+
|
|
362
442
|
/**
|
|
363
443
|
* Returns the deployment the conversation was last running on: scanning
|
|
364
444
|
* backwards, the `new_deployment_id` of a `model_changed` status message or
|
|
@@ -382,6 +462,15 @@ export declare const getLastDeploymentId: (messages: Message[]) => string | null
|
|
|
382
462
|
*/
|
|
383
463
|
export declare const getLastUserMessageToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
|
|
384
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Returns the tool configuration a (re-)loaded conversation should show: the
|
|
467
|
+
* last user message's `configuration_value`, overlaid in order by the
|
|
468
|
+
* `form_schema` values of the assistant messages after it. An app that turned
|
|
469
|
+
* a toggle off in its final response must not see it re-armed on reload just
|
|
470
|
+
* because the user message that started the run had it on.
|
|
471
|
+
*/
|
|
472
|
+
export declare const getLatestToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
|
|
473
|
+
|
|
385
474
|
/**
|
|
386
475
|
* Extracts the deployment/model ID from a DIAL Core conversation ID.
|
|
387
476
|
*
|
|
@@ -465,6 +554,15 @@ export declare const getStarterSubmitText: (starter: StarterOption, description?
|
|
|
465
554
|
*/
|
|
466
555
|
export declare const getTimeOfDayGreeting: (hour: number, translations: GreetingTranslations, firstName?: string) => string;
|
|
467
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Returns the boolean values an assistant message's `form_schema` sets, keyed
|
|
559
|
+
* by property name, or `undefined` when no property resolves to a boolean.
|
|
560
|
+
* Lets a DIAL app switch a tools-menu toggle (e.g. `deep_research`) per
|
|
561
|
+
* message — on while a run is in progress, off once its result is delivered.
|
|
562
|
+
* Not filtered by tool id: `restoreToolConfiguration` ignores unknown ids.
|
|
563
|
+
*/
|
|
564
|
+
export declare const getToolConfigurationFromFormSchema: (formSchema: DeploymentConfigurationSchema | undefined) => Record<string, boolean> | undefined;
|
|
565
|
+
|
|
468
566
|
/** Pre-translated greeting phrase strings for each time-of-day period. */
|
|
469
567
|
export declare interface GreetingTranslations {
|
|
470
568
|
morningWithName: string;
|
|
@@ -501,8 +599,8 @@ export declare const isAnswerIncomplete: (answer: Message | undefined) => boolea
|
|
|
501
599
|
* True when the conversation's last message is an unresolved assistant
|
|
502
600
|
* placeholder: the backend only persists a conversation at generation start
|
|
503
601
|
* (empty placeholder) and at generation end (final content, or a partial
|
|
504
|
-
* flagged `streamErrorMessage`/`wasStoppedByUser`)
|
|
505
|
-
*
|
|
602
|
+
* flagged `streamErrorMessage`/`wasStoppedByUser`). This can mean generation
|
|
603
|
+
* is still active elsewhere, or that its terminal save failed.
|
|
506
604
|
*/
|
|
507
605
|
export declare const isAwaitingGenerationResume: (conversation: Conversation) => boolean;
|
|
508
606
|
|
|
@@ -544,6 +642,29 @@ declare interface LocalModeValues {
|
|
|
544
642
|
temperature: number;
|
|
545
643
|
}
|
|
546
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Returns the normalized stages of a raw stage array or a message-like
|
|
647
|
+
* payload (reading `custom_content.stages`, falling back to
|
|
648
|
+
* `customContent.stages`), or `undefined` when there are none.
|
|
649
|
+
*/
|
|
650
|
+
export declare const mapStages: (source: RawStage[] | RawStageSource | null | undefined) => Stage[] | undefined;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Merges incoming stage deltas into an existing stage list, keyed by `index`.
|
|
654
|
+
*
|
|
655
|
+
* Partial `name` and `content` strings are concatenated across chunks;
|
|
656
|
+
* attachments are merged by their own `index` (concatenating partial `title`
|
|
657
|
+
* and `data`); every other field on the incoming delta overwrites the
|
|
658
|
+
* accumulated one. A brand-new stage whose first chunk carries `name: null`
|
|
659
|
+
* is normalized to `''`.
|
|
660
|
+
*
|
|
661
|
+
* Exported for hosts that keep a flattened `Stage[]` on the message instead
|
|
662
|
+
* of `Message.custom_content.stages` and therefore cannot reuse
|
|
663
|
+
* {@link applyChunkToMessages}. Prefer `useConversationStream` when the host
|
|
664
|
+
* can delegate the whole stream loop.
|
|
665
|
+
*/
|
|
666
|
+
export declare const mergeStages: (existing: Stage[], incoming: Stage[]) => Stage[];
|
|
667
|
+
|
|
547
668
|
/** True when `message` is an assistant message carrying at least one stage. */
|
|
548
669
|
export declare const messageHasStages: (message: Message) => boolean;
|
|
549
670
|
|
|
@@ -553,6 +674,20 @@ export declare interface MessagePair {
|
|
|
553
674
|
assistantMessage: Message;
|
|
554
675
|
}
|
|
555
676
|
|
|
677
|
+
/** A stable snapshot of one eligible native text selection. */
|
|
678
|
+
export declare interface MessageSelectionReplySnapshot {
|
|
679
|
+
/** Scope that owned the selection when it was captured. */
|
|
680
|
+
conversationId: string;
|
|
681
|
+
/** Message text root containing the captured range. */
|
|
682
|
+
body: HTMLDivElement;
|
|
683
|
+
/** Captured native range. */
|
|
684
|
+
range: Range;
|
|
685
|
+
/** Native selected text preserved for the generated file. */
|
|
686
|
+
text: string;
|
|
687
|
+
/** Visible fragment of the selected range. */
|
|
688
|
+
rect: DOMRect;
|
|
689
|
+
}
|
|
690
|
+
|
|
556
691
|
/**
|
|
557
692
|
* Normalises a stored response-format string to the current enum. Legacy data
|
|
558
693
|
* may contain `'Markdown'` or `'PlainText'` (capital-first) instead of the
|
|
@@ -577,6 +712,63 @@ export declare interface QuickAppConversationStartersSettings {
|
|
|
577
712
|
isChatMessageInputDisabled: boolean;
|
|
578
713
|
}
|
|
579
714
|
|
|
715
|
+
/**
|
|
716
|
+
* One stage as it arrives from the REST API or the SSE stream, before
|
|
717
|
+
* normalization. Structurally satisfied by the generated `StageDto` and by a
|
|
718
|
+
* raw stream delta, both of which omit `index`/`name`/`status` on the chunk
|
|
719
|
+
* that opens a stage.
|
|
720
|
+
*/
|
|
721
|
+
export declare interface RawStage {
|
|
722
|
+
/** Ordering key. Defaults to `0` when absent. */
|
|
723
|
+
index?: number | null;
|
|
724
|
+
/** Stage title. `null` on the chunk that opens the stage. */
|
|
725
|
+
name?: string | null;
|
|
726
|
+
/** Terminal state as a raw wire string; anything other than `'completed'`/`'failed'` means still running. */
|
|
727
|
+
status?: string | null;
|
|
728
|
+
/** Additional stage text. */
|
|
729
|
+
content?: string | null;
|
|
730
|
+
/** Short source/category label shown beside the stage name. */
|
|
731
|
+
tag?: string | null;
|
|
732
|
+
/** Files produced or referenced by this stage. */
|
|
733
|
+
attachments?: RawStageAttachment[] | null;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* One stage attachment as it arrives from the REST API or the SSE stream,
|
|
738
|
+
* before normalization: every field is optional and may be `null`.
|
|
739
|
+
*/
|
|
740
|
+
export declare interface RawStageAttachment {
|
|
741
|
+
/** Zero-based position in the attachment list. */
|
|
742
|
+
index?: number | null;
|
|
743
|
+
/** MIME type of the attachment content. */
|
|
744
|
+
type?: string | null;
|
|
745
|
+
/** Display name shown in the UI. */
|
|
746
|
+
title?: string | null;
|
|
747
|
+
/** Inline base-64 encoded content. */
|
|
748
|
+
data?: string | null;
|
|
749
|
+
/** Remote URL pointing to the attachment content. */
|
|
750
|
+
url?: string | null;
|
|
751
|
+
/** MIME type of the referenced resource. */
|
|
752
|
+
reference_type?: string | null;
|
|
753
|
+
/** URL of an alternate reference resource. */
|
|
754
|
+
reference_url?: string | null;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Message-like payload carrying stages under either the wire's snake_case
|
|
759
|
+
* `custom_content` or a host's camelCased `customContent`.
|
|
760
|
+
*/
|
|
761
|
+
export declare interface RawStageSource {
|
|
762
|
+
/** Custom content as the DIAL wire format spells it. */
|
|
763
|
+
custom_content?: {
|
|
764
|
+
stages?: RawStage[] | null;
|
|
765
|
+
} | null;
|
|
766
|
+
/** Custom content as a camelCasing host spells it. */
|
|
767
|
+
customContent?: {
|
|
768
|
+
stages?: RawStage[] | null;
|
|
769
|
+
} | null;
|
|
770
|
+
}
|
|
771
|
+
|
|
580
772
|
/** State of one resource's recipient-count lookup. */
|
|
581
773
|
declare interface RecipientsCountEntry {
|
|
582
774
|
/** Where the lookup for this resource currently stands. */
|
|
@@ -633,8 +825,35 @@ export declare interface StreamCompletionOptions {
|
|
|
633
825
|
signal: AbortSignal;
|
|
634
826
|
}
|
|
635
827
|
|
|
636
|
-
/**
|
|
637
|
-
|
|
828
|
+
/**
|
|
829
|
+
* Reported through `onError` when the network connection carrying a
|
|
830
|
+
* completion stream is lost (a rejected `fetch`, or a read that fails after a
|
|
831
|
+
* 2xx response) or goes silent past the idle timeout — what a laptop sleep or
|
|
832
|
+
* a phone lock mid-generation produces. The backend-owned generation may
|
|
833
|
+
* still be running, so the caller can recover it rather than treat the
|
|
834
|
+
* response as failed. `cause` holds the original error, when there is one.
|
|
835
|
+
*/
|
|
836
|
+
export declare class StreamInterruptedError extends Error {
|
|
837
|
+
constructor(cause?: unknown);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Reported through `onError` when DIAL Core itself signals a failure with an
|
|
842
|
+
* in-band `{ error: { message } }` SSE chunk. Its `message` is upstream text
|
|
843
|
+
* intended for the user, unlike a transport failure (failed `fetch`, non-OK
|
|
844
|
+
* status, broken stream), whose message is technical detail. A custom
|
|
845
|
+
* transport raises this for any user-facing upstream error text.
|
|
846
|
+
*/
|
|
847
|
+
export declare class StreamUpstreamError extends Error {
|
|
848
|
+
constructor(message: string);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Returns a renderable `Stage` for one raw payload: `index` defaults to `0`,
|
|
853
|
+
* `name` to `''`, an unrecognized `status` to `null` (still running), and
|
|
854
|
+
* `content`/`tag`/`attachments` are passed through when present.
|
|
855
|
+
*/
|
|
856
|
+
export declare const toStage: (stage: RawStage) => Stage;
|
|
638
857
|
|
|
639
858
|
/** Request shape the host's selected-deployment recognition call accepts. */
|
|
640
859
|
export declare interface TranscribeWithDeploymentParams {
|
|
@@ -699,8 +918,8 @@ export declare const useAttachmentUpload: ({ filesApi, bucket, onNetworkError, d
|
|
|
699
918
|
|
|
700
919
|
/** Parameters for {@link useAttachmentUpload}. */
|
|
701
920
|
export declare interface UseAttachmentUploadParams {
|
|
702
|
-
/** Already-configured
|
|
703
|
-
filesApi: Pick<FilesApi, 'uploadFile'
|
|
921
|
+
/** Already-configured client; optional listing skips stored names after a conflict. */
|
|
922
|
+
filesApi: Pick<FilesApi, 'uploadFile'> & Partial<Pick<FilesApi, 'listFiles'>>;
|
|
704
923
|
/** DIAL Core bucket the file is uploaded into. */
|
|
705
924
|
bucket: string | undefined;
|
|
706
925
|
/** Called with batched filenames after a burst of network-error upload failures. */
|
|
@@ -854,9 +1073,8 @@ export declare interface UseConversationLookupMapsParams {
|
|
|
854
1073
|
* panel's item contract. All app-specific concerns (icon URL resolution,
|
|
855
1074
|
* route generation, id normalisation) are injected via resolver callbacks.
|
|
856
1075
|
*/
|
|
857
|
-
export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref,
|
|
858
|
-
|
|
859
|
-
taskBadgeLabel?: string | undefined;
|
|
1076
|
+
export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskPresentation, }: UseConversationPanelItemsParams) => {
|
|
1077
|
+
leadingIcon?: ReactNode;
|
|
860
1078
|
isUnread?: boolean | undefined;
|
|
861
1079
|
id: string;
|
|
862
1080
|
title: string;
|
|
@@ -892,11 +1110,12 @@ export declare interface UseConversationPanelItemsResolvers {
|
|
|
892
1110
|
/** Resolves the href to navigate to when the conversation row is clicked. */
|
|
893
1111
|
resolveHref: (panelConversationId: string) => string;
|
|
894
1112
|
/**
|
|
895
|
-
* Returns
|
|
896
|
-
*
|
|
1113
|
+
* Returns the row presentation for a scheduled-task conversation — a
|
|
1114
|
+
* host-rendered leading icon that replaces the deployment avatar, and the
|
|
1115
|
+
* unread flag — or `undefined` for an ordinary conversation.
|
|
897
1116
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
1117
|
+
resolveTaskPresentation?: (item: ConversationListItemDto) => {
|
|
1118
|
+
leadingIcon?: ReactNode;
|
|
900
1119
|
isUnread: boolean;
|
|
901
1120
|
} | undefined;
|
|
902
1121
|
}
|
|
@@ -909,7 +1128,7 @@ export declare interface UseConversationPanelItemsResolvers {
|
|
|
909
1128
|
* `transport`/`generation`/`channel`/`overlay` capabilities rather than any
|
|
910
1129
|
* app context or `server-api` import.
|
|
911
1130
|
*/
|
|
912
|
-
export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, }: UseConversationStreamParams) => UseConversationStreamResult;
|
|
1131
|
+
export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, generationPersistenceErrorMessage, onStreamError, }: UseConversationStreamParams) => UseConversationStreamResult;
|
|
913
1132
|
|
|
914
1133
|
/** Parameters for {@link useConversationStream}. */
|
|
915
1134
|
export declare interface UseConversationStreamParams {
|
|
@@ -927,6 +1146,15 @@ export declare interface UseConversationStreamParams {
|
|
|
927
1146
|
* {@link DEFAULT_GENERATION_CONFLICT_MESSAGE}.
|
|
928
1147
|
*/
|
|
929
1148
|
generationConflictMessage?: string;
|
|
1149
|
+
/** Host-translated warning shown when the received answer could not be saved. */
|
|
1150
|
+
generationPersistenceErrorMessage?: string;
|
|
1151
|
+
/**
|
|
1152
|
+
* Receives the original error of every failed stream. The hook shows only
|
|
1153
|
+
* host-supplied or upstream-supplied text on the message bubble and hides
|
|
1154
|
+
* transport detail (e.g. `Failed to fetch`), so this is where the host can
|
|
1155
|
+
* still log or report the raw error.
|
|
1156
|
+
*/
|
|
1157
|
+
onStreamError?: (error: Error) => void;
|
|
930
1158
|
}
|
|
931
1159
|
|
|
932
1160
|
/** Return value of {@link useConversationStream}. */
|
|
@@ -973,6 +1201,35 @@ export declare interface UseImportFilePickerResult {
|
|
|
973
1201
|
handleFileChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
974
1202
|
}
|
|
975
1203
|
|
|
1204
|
+
/**
|
|
1205
|
+
* Captures eligible message text and creates Reply files for an existing composer
|
|
1206
|
+
* attachment flow without acquiring host deployment, upload or localization knowledge.
|
|
1207
|
+
*/
|
|
1208
|
+
export declare const useMessageSelectionReply: ({ conversationId, enabled, droppedFiles, onDroppedFilesConsumed, }: UseMessageSelectionReplyParams) => {
|
|
1209
|
+
contentRef: (node: HTMLDivElement | null) => (() => void) | undefined;
|
|
1210
|
+
actionRef: RefObject<HTMLDivElement | null>;
|
|
1211
|
+
selection: MessageSelectionReplySnapshot | null;
|
|
1212
|
+
onReply: () => void;
|
|
1213
|
+
dismiss: () => void;
|
|
1214
|
+
pendingFiles: File[];
|
|
1215
|
+
onFilesConsumed: () => void;
|
|
1216
|
+
focusRequestId: number | undefined;
|
|
1217
|
+
onAttachmentsChange: (attachments: Attachment[]) => void;
|
|
1218
|
+
addedRevision: number;
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
/** Parameters accepted by {@link useMessageSelectionReply}. */
|
|
1222
|
+
export declare interface UseMessageSelectionReplyParams {
|
|
1223
|
+
/** Identifier used to discard selection and queued files after a scope change. */
|
|
1224
|
+
conversationId: string;
|
|
1225
|
+
/** Whether the host currently permits a Reply attachment. */
|
|
1226
|
+
enabled: boolean;
|
|
1227
|
+
/** Files from the host's ordinary page-drop queue. */
|
|
1228
|
+
droppedFiles: File[];
|
|
1229
|
+
/** Acknowledges the captured page-drop batch after the composer accepts it. */
|
|
1230
|
+
onDroppedFilesConsumed: () => void;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
976
1233
|
/**
|
|
977
1234
|
* Derives the tools submenu from the active deployment's configuration schema:
|
|
978
1235
|
* every boolean property becomes a toggle. Manages toggle state locally, resets
|
package/conversation.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { buildAnnouncementSignature as e, hasAnnouncementContent as t, hasStructuredAnnouncement as n, sanitizeAnnouncementHtml as r, sanitizeAnnouncementMessageHtml as i } from "./conversation/announcement-message.js";
|
|
2
|
-
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as a,
|
|
3
|
-
import { shouldWatchForDisplayNameUpdate as
|
|
4
|
-
import { formatAppVersion as
|
|
5
|
-
import { getModelIdFromConversationId as
|
|
6
|
-
import { getTimeOfDayGreeting as
|
|
7
|
-
import { createDeploymentChangedMessage as
|
|
8
|
-
import { getLastDeploymentId as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { getStarterPopulateText as
|
|
12
|
-
import { deriveConversationRowActionState as
|
|
13
|
-
import { useActiveConversationSync as
|
|
14
|
-
import { useAsyncConfirmDialog as
|
|
15
|
-
import { useConversationLookupMaps as
|
|
16
|
-
import { getConversationSource as
|
|
17
|
-
import { useImportFilePicker as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
|
|
2
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as a, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as o, DEFAULT_STREAM_IDLE_TIMEOUT_MS as s, GenerationConflictError as c, GenerationPersistenceError as l, StreamInterruptedError as u, StreamUpstreamError as d, createChatStreamApi as f } from "./conversation/create-chat-stream-api.js";
|
|
3
|
+
import { shouldWatchForDisplayNameUpdate as p } from "./conversation/display-name-watch.js";
|
|
4
|
+
import { formatAppVersion as m, sanitizeFooterHtml as h } from "./conversation/footer-message.js";
|
|
5
|
+
import { getModelIdFromConversationId as g } from "./conversation/get-model-id-from-conversation-id.js";
|
|
6
|
+
import { getTimeOfDayGreeting as _ } from "./conversation/greeting.js";
|
|
7
|
+
import { createDeploymentChangedMessage as v } from "./conversation/message-factory.js";
|
|
8
|
+
import { getFormSchemaToolSyncKey as y, getLastDeploymentId as b, getLastUserMessageToolConfiguration as x, getLatestToolConfiguration as S, getToolConfigurationFromFormSchema as C, isMessageStreaming as w, messageHasStages as T, normalizeResponseFormat as E } from "./conversation/message-utils.js";
|
|
9
|
+
import { getQuickAppConversationStarters as D } from "./conversation/quick-app-conversation-starters.js";
|
|
10
|
+
import { mapStages as O, toStage as k } from "./conversation/stage.js";
|
|
11
|
+
import { getStarterPopulateText as A, getStartersFromSchema as j } from "./conversation/starter-option.js";
|
|
12
|
+
import { deriveConversationRowActionState as M } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
13
|
+
import { useActiveConversationSync as N } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
14
|
+
import { useAsyncConfirmDialog as P } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
15
|
+
import { useConversationLookupMaps as F } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
16
|
+
import { getConversationSource as I, useConversationPanelItems as L } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
17
|
+
import { useImportFilePicker as R } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
18
|
+
import { useMessageSelectionReply as z } from "./conversation/useMessageSelectionReply/useMessageSelectionReply.js";
|
|
19
|
+
import { useAttachmentUpload as B } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
20
|
+
import { AudioTranscriptionError as V, AudioTranscriptionErrorReason as H } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
21
|
+
import { useTranscribeAudio as U } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
22
|
+
import { attachmentToDto as W, attachmentsToDtos as G } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
23
|
+
import { createMessagePair as K } from "./conversation/useConversationHandlers/message-factory.js";
|
|
24
|
+
import { hasActiveToolConfig as q, isAnswerIncomplete as J, isMessageChanged as Y, shouldRerunGenerationOnEdit as X } from "./conversation/useConversationHandlers/message-utils.js";
|
|
25
|
+
import { getStarterConversationText as Z, getStarterDisplayText as Q, getStarterSubmitText as $ } from "./conversation/useConversationHandlers/starter-option.js";
|
|
26
|
+
import { getConversationPath as ee } from "./conversation/useConversationStream/conversation-path.js";
|
|
27
|
+
import { useConversationHandlers as te } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
28
|
+
import { applyChunkToMessages as ne, mergeStages as re } from "./conversation/useConversationStream/apply-chunk.js";
|
|
29
|
+
import { isAwaitingGenerationResume as ie } from "./conversation/useConversationStream/generation-resume.js";
|
|
30
|
+
import { useConversationStream as ae } from "./conversation/useConversationStream/useConversationStream.js";
|
|
31
|
+
import { useChatSettingsFormConfig as oe } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
32
|
+
import { useToolsMenu as se } from "./useToolsMenu/useToolsMenu.js";
|
|
33
|
+
export { V as AudioTranscriptionError, H as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE, s as DEFAULT_STREAM_IDLE_TIMEOUT_MS, c as GenerationConflictError, l as GenerationPersistenceError, u as StreamInterruptedError, d as StreamUpstreamError, ne as applyChunkToMessages, W as attachmentToDto, G as attachmentsToDtos, e as buildAnnouncementSignature, f as createChatStreamApi, v as createDeploymentChangedMessage, K as createMessagePair, M as deriveConversationRowActionState, m as formatAppVersion, ee as getConversationPath, I as getConversationSource, y as getFormSchemaToolSyncKey, b as getLastDeploymentId, x as getLastUserMessageToolConfiguration, S as getLatestToolConfiguration, g as getModelIdFromConversationId, D as getQuickAppConversationStarters, Z as getStarterConversationText, Q as getStarterDisplayText, A as getStarterPopulateText, $ as getStarterSubmitText, j as getStartersFromSchema, _ as getTimeOfDayGreeting, C as getToolConfigurationFromFormSchema, q as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, J as isAnswerIncomplete, ie as isAwaitingGenerationResume, Y as isMessageChanged, w as isMessageStreaming, O as mapStages, re as mergeStages, T as messageHasStages, E as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, h as sanitizeFooterHtml, X as shouldRerunGenerationOnEdit, p as shouldWatchForDisplayNameUpdate, k as toStage, N as useActiveConversationSync, P as useAsyncConfirmDialog, B as useAttachmentUpload, oe as useChatSettingsFormConfig, te as useConversationHandlers, F as useConversationLookupMaps, L as useConversationPanelItems, ae as useConversationStream, R as useImportFilePicker, z as useMessageSelectionReply, se as useToolsMenu, U as useTranscribeAudio };
|