@epam/ai-dial-chat-hooks 1.2.0-dev.1 → 1.2.0-dev.102

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 (56) hide show
  1. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  2. package/attachments.d.ts +10 -4
  3. package/catalog/map-deployment-to-catalog-item.js +2 -2
  4. package/catalog/map-skill-to-catalog-item.js +48 -48
  5. package/catalog/publish.js +2 -1
  6. package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
  7. package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
  8. package/catalog/useSkillItemDetails.js +19 -17
  9. package/catalog.d.ts +60 -5
  10. package/catalog.js +15 -14
  11. package/conversation/announcement-message.js +16 -5
  12. package/conversation/conversation-transfer/queue.js +8 -5
  13. package/conversation/stage.js +23 -0
  14. package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
  15. package/conversation/useConversationHandlers/useConversationHandlers.js +13 -17
  16. package/conversation/useConversationImport/useConversationImport.js +1 -1
  17. package/conversation/useConversationScroll/useConversationScroll.js +68 -64
  18. package/conversation/useConversationStream/apply-chunk.js +1 -1
  19. package/conversation/useConversationStream/useConversationStream.js +5 -1
  20. package/conversation/useTranscribeAudio/transcription-retry.js +5 -4
  21. package/conversation-overlay.d.ts +7 -0
  22. package/conversation-overlay.js +2 -0
  23. package/conversation.d.ts +139 -7
  24. package/conversation.js +24 -23
  25. package/file-manager-canvas.d.ts +398 -0
  26. package/file-manager-canvas.js +2 -0
  27. package/file-manager.d.ts +71 -330
  28. package/file-manager.js +15 -15
  29. package/files/attachment-canvas.js +51 -13
  30. package/files/attachment-types.js +14 -13
  31. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -5
  32. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
  33. package/index.d.ts +761 -29
  34. package/index.js +123 -111
  35. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  36. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  37. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  38. package/mcp-apps.d.ts +8 -6
  39. package/package.json +37 -18
  40. package/scheduled-task/scheduled-task-description.js +77 -0
  41. package/scheduled-task/scheduled-task-preparation.js +24 -0
  42. package/scheduled-task/scheduled-tasks-api-client.js +19 -0
  43. package/scheduled-task/use-scheduled-task-runs.js +82 -0
  44. package/scheduled-task/use-scheduled-tasks.js +93 -0
  45. package/scheduled-tasks.d.ts +178 -0
  46. package/scheduled-tasks.js +7 -2
  47. package/skill/skill.js +10 -7
  48. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
  49. package/skill/useSkillEditorLoad.js +29 -28
  50. package/skill/useSkillEditorSubmit.js +92 -75
  51. package/skill-editor.d.ts +107 -0
  52. package/skill-editor.js +9 -8
  53. package/usage/map-usage-data-to-dashboard.js +66 -0
  54. package/usage/map-user-usage-to-model-limits.js +160 -0
  55. package/usage.d.ts +120 -0
  56. package/usage.js +3 -0
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
- /** The upstream ASR provider stayed rate-limited or unavailable after retrying. */
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
 
@@ -544,6 +592,29 @@ declare interface LocalModeValues {
544
592
  temperature: number;
545
593
  }
546
594
 
595
+ /**
596
+ * Returns the normalized stages of a raw stage array or a message-like
597
+ * payload (reading `custom_content.stages`, falling back to
598
+ * `customContent.stages`), or `undefined` when there are none.
599
+ */
600
+ export declare const mapStages: (source: RawStage[] | RawStageSource | null | undefined) => Stage[] | undefined;
601
+
602
+ /**
603
+ * Merges incoming stage deltas into an existing stage list, keyed by `index`.
604
+ *
605
+ * Partial `name` and `content` strings are concatenated across chunks;
606
+ * attachments are merged by their own `index` (concatenating partial `title`
607
+ * and `data`); every other field on the incoming delta overwrites the
608
+ * accumulated one. A brand-new stage whose first chunk carries `name: null`
609
+ * is normalized to `''`.
610
+ *
611
+ * Exported for hosts that keep a flattened `Stage[]` on the message instead
612
+ * of `Message.custom_content.stages` and therefore cannot reuse
613
+ * {@link applyChunkToMessages}. Prefer `useConversationStream` when the host
614
+ * can delegate the whole stream loop.
615
+ */
616
+ export declare const mergeStages: (existing: Stage[], incoming: Stage[]) => Stage[];
617
+
547
618
  /** True when `message` is an assistant message carrying at least one stage. */
548
619
  export declare const messageHasStages: (message: Message) => boolean;
549
620
 
@@ -577,6 +648,63 @@ export declare interface QuickAppConversationStartersSettings {
577
648
  isChatMessageInputDisabled: boolean;
578
649
  }
579
650
 
651
+ /**
652
+ * One stage as it arrives from the REST API or the SSE stream, before
653
+ * normalization. Structurally satisfied by the generated `StageDto` and by a
654
+ * raw stream delta, both of which omit `index`/`name`/`status` on the chunk
655
+ * that opens a stage.
656
+ */
657
+ export declare interface RawStage {
658
+ /** Ordering key. Defaults to `0` when absent. */
659
+ index?: number | null;
660
+ /** Stage title. `null` on the chunk that opens the stage. */
661
+ name?: string | null;
662
+ /** Terminal state as a raw wire string; anything other than `'completed'`/`'failed'` means still running. */
663
+ status?: string | null;
664
+ /** Additional stage text. */
665
+ content?: string | null;
666
+ /** Short source/category label shown beside the stage name. */
667
+ tag?: string | null;
668
+ /** Files produced or referenced by this stage. */
669
+ attachments?: RawStageAttachment[] | null;
670
+ }
671
+
672
+ /**
673
+ * One stage attachment as it arrives from the REST API or the SSE stream,
674
+ * before normalization: every field is optional and may be `null`.
675
+ */
676
+ export declare interface RawStageAttachment {
677
+ /** Zero-based position in the attachment list. */
678
+ index?: number | null;
679
+ /** MIME type of the attachment content. */
680
+ type?: string | null;
681
+ /** Display name shown in the UI. */
682
+ title?: string | null;
683
+ /** Inline base-64 encoded content. */
684
+ data?: string | null;
685
+ /** Remote URL pointing to the attachment content. */
686
+ url?: string | null;
687
+ /** MIME type of the referenced resource. */
688
+ reference_type?: string | null;
689
+ /** URL of an alternate reference resource. */
690
+ reference_url?: string | null;
691
+ }
692
+
693
+ /**
694
+ * Message-like payload carrying stages under either the wire's snake_case
695
+ * `custom_content` or a host's camelCased `customContent`.
696
+ */
697
+ export declare interface RawStageSource {
698
+ /** Custom content as the DIAL wire format spells it. */
699
+ custom_content?: {
700
+ stages?: RawStage[] | null;
701
+ } | null;
702
+ /** Custom content as a camelCasing host spells it. */
703
+ customContent?: {
704
+ stages?: RawStage[] | null;
705
+ } | null;
706
+ }
707
+
580
708
  /** State of one resource's recipient-count lookup. */
581
709
  declare interface RecipientsCountEntry {
582
710
  /** Where the lookup for this resource currently stands. */
@@ -633,8 +761,12 @@ export declare interface StreamCompletionOptions {
633
761
  signal: AbortSignal;
634
762
  }
635
763
 
636
- /** Maps chat messages to the DIAL Chat Overlay protocol's message shape. */
637
- export declare const toOverlayMessages: (messages: Message[]) => OverlayChatMessage[];
764
+ /**
765
+ * Returns a renderable `Stage` for one raw payload: `index` defaults to `0`,
766
+ * `name` to `''`, an unrecognized `status` to `null` (still running), and
767
+ * `content`/`tag`/`attachments` are passed through when present.
768
+ */
769
+ export declare const toStage: (stage: RawStage) => Stage;
638
770
 
639
771
  /** Request shape the host's selected-deployment recognition call accepts. */
640
772
  export declare interface TranscribeWithDeploymentParams {
@@ -699,8 +831,8 @@ export declare const useAttachmentUpload: ({ filesApi, bucket, onNetworkError, d
699
831
 
700
832
  /** Parameters for {@link useAttachmentUpload}. */
701
833
  export declare interface UseAttachmentUploadParams {
702
- /** Already-configured generated-client instance used to upload the file. */
703
- filesApi: Pick<FilesApi, 'uploadFile'>;
834
+ /** Already-configured client; optional listing skips stored names after a conflict. */
835
+ filesApi: Pick<FilesApi, 'uploadFile'> & Partial<Pick<FilesApi, 'listFiles'>>;
704
836
  /** DIAL Core bucket the file is uploaded into. */
705
837
  bucket: string | undefined;
706
838
  /** Called with batched filenames after a burst of network-error upload failures. */
package/conversation.js CHANGED
@@ -6,26 +6,27 @@ import { getModelIdFromConversationId as d } from "./conversation/get-model-id-f
6
6
  import { getTimeOfDayGreeting as f } from "./conversation/greeting.js";
7
7
  import { createDeploymentChangedMessage as p } from "./conversation/message-factory.js";
8
8
  import { getLastDeploymentId as m, getLastUserMessageToolConfiguration as h, isMessageStreaming as g, messageHasStages as _, normalizeResponseFormat as v } from "./conversation/message-utils.js";
9
- import { toOverlayMessages as y } from "./conversation/overlay-messages.js";
10
- import { getQuickAppConversationStarters as b } from "./conversation/quick-app-conversation-starters.js";
11
- import { getStarterPopulateText as x, getStartersFromSchema as S } from "./conversation/starter-option.js";
12
- import { deriveConversationRowActionState as C } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
13
- import { useActiveConversationSync as w } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
14
- import { useAsyncConfirmDialog as T } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
15
- import { useConversationLookupMaps as E } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
16
- import { getConversationSource as D, useConversationPanelItems as O } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
17
- import { useImportFilePicker as k } from "./conversation/useImportFilePicker/useImportFilePicker.js";
18
- import { useAttachmentUpload as A } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
19
- import { AudioTranscriptionError as j, AudioTranscriptionErrorReason as M } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
20
- import { useTranscribeAudio as N } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
21
- import { attachmentToDto as P, attachmentsToDtos as F } from "./conversation/useConversationHandlers/attachment-to-dto.js";
22
- import { createMessagePair as I } from "./conversation/useConversationHandlers/message-factory.js";
23
- import { hasActiveToolConfig as L, isAnswerIncomplete as R, isMessageChanged as z, shouldRerunGenerationOnEdit as B } from "./conversation/useConversationHandlers/message-utils.js";
24
- import { getStarterConversationText as V, getStarterDisplayText as H, getStarterSubmitText as U } from "./conversation/useConversationHandlers/starter-option.js";
25
- import { getConversationPath as W } from "./conversation/useConversationStream/conversation-path.js";
26
- import { useConversationHandlers as G } from "./conversation/useConversationHandlers/useConversationHandlers.js";
27
- import { isAwaitingGenerationResume as K } from "./conversation/useConversationStream/generation-resume.js";
28
- import { useConversationStream as q } from "./conversation/useConversationStream/useConversationStream.js";
29
- import { useChatSettingsFormConfig as J } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
30
- import { useToolsMenu as Y } from "./useToolsMenu/useToolsMenu.js";
31
- export { j as AudioTranscriptionError, M as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as GenerationConflictError, P as attachmentToDto, F as attachmentsToDtos, e as buildAnnouncementSignature, s as createChatStreamApi, p as createDeploymentChangedMessage, I as createMessagePair, C as deriveConversationRowActionState, l as formatAppVersion, W as getConversationPath, D as getConversationSource, m as getLastDeploymentId, h as getLastUserMessageToolConfiguration, d as getModelIdFromConversationId, b as getQuickAppConversationStarters, V as getStarterConversationText, H as getStarterDisplayText, x as getStarterPopulateText, U as getStarterSubmitText, S as getStartersFromSchema, f as getTimeOfDayGreeting, L as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, R as isAnswerIncomplete, K as isAwaitingGenerationResume, z as isMessageChanged, g as isMessageStreaming, _ as messageHasStages, v as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, u as sanitizeFooterHtml, B as shouldRerunGenerationOnEdit, c as shouldWatchForDisplayNameUpdate, y as toOverlayMessages, w as useActiveConversationSync, T as useAsyncConfirmDialog, A as useAttachmentUpload, J as useChatSettingsFormConfig, G as useConversationHandlers, E as useConversationLookupMaps, O as useConversationPanelItems, q as useConversationStream, k as useImportFilePicker, Y as useToolsMenu, N as useTranscribeAudio };
9
+ import { getQuickAppConversationStarters as y } from "./conversation/quick-app-conversation-starters.js";
10
+ import { mapStages as b, toStage as x } from "./conversation/stage.js";
11
+ import { getStarterPopulateText as S, getStartersFromSchema as C } from "./conversation/starter-option.js";
12
+ import { deriveConversationRowActionState as w } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
13
+ import { useActiveConversationSync as T } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
14
+ import { useAsyncConfirmDialog as E } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
15
+ import { useConversationLookupMaps as D } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
16
+ import { getConversationSource as O, useConversationPanelItems as k } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
17
+ import { useImportFilePicker as A } from "./conversation/useImportFilePicker/useImportFilePicker.js";
18
+ import { useAttachmentUpload as j } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
19
+ import { AudioTranscriptionError as M, AudioTranscriptionErrorReason as N } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
20
+ import { useTranscribeAudio as P } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
21
+ import { attachmentToDto as F, attachmentsToDtos as I } from "./conversation/useConversationHandlers/attachment-to-dto.js";
22
+ import { createMessagePair as L } from "./conversation/useConversationHandlers/message-factory.js";
23
+ import { hasActiveToolConfig as R, isAnswerIncomplete as z, isMessageChanged as B, shouldRerunGenerationOnEdit as V } from "./conversation/useConversationHandlers/message-utils.js";
24
+ import { getStarterConversationText as H, getStarterDisplayText as U, getStarterSubmitText as W } from "./conversation/useConversationHandlers/starter-option.js";
25
+ import { getConversationPath as G } from "./conversation/useConversationStream/conversation-path.js";
26
+ import { useConversationHandlers as K } from "./conversation/useConversationHandlers/useConversationHandlers.js";
27
+ import { applyChunkToMessages as q, mergeStages as J } from "./conversation/useConversationStream/apply-chunk.js";
28
+ import { isAwaitingGenerationResume as Y } from "./conversation/useConversationStream/generation-resume.js";
29
+ import { useConversationStream as X } from "./conversation/useConversationStream/useConversationStream.js";
30
+ import { useChatSettingsFormConfig as Z } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
31
+ import { useToolsMenu as Q } from "./useToolsMenu/useToolsMenu.js";
32
+ export { M as AudioTranscriptionError, N as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as GenerationConflictError, q as applyChunkToMessages, F as attachmentToDto, I as attachmentsToDtos, e as buildAnnouncementSignature, s as createChatStreamApi, p as createDeploymentChangedMessage, L as createMessagePair, w as deriveConversationRowActionState, l as formatAppVersion, G as getConversationPath, O as getConversationSource, m as getLastDeploymentId, h as getLastUserMessageToolConfiguration, d as getModelIdFromConversationId, y as getQuickAppConversationStarters, H as getStarterConversationText, U as getStarterDisplayText, S as getStarterPopulateText, W as getStarterSubmitText, C as getStartersFromSchema, f as getTimeOfDayGreeting, R as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, z as isAnswerIncomplete, Y as isAwaitingGenerationResume, B as isMessageChanged, g as isMessageStreaming, b as mapStages, J as mergeStages, _ as messageHasStages, v as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, u as sanitizeFooterHtml, V as shouldRerunGenerationOnEdit, c as shouldWatchForDisplayNameUpdate, x as toStage, T as useActiveConversationSync, E as useAsyncConfirmDialog, j as useAttachmentUpload, Z as useChatSettingsFormConfig, K as useConversationHandlers, D as useConversationLookupMaps, k as useConversationPanelItems, X as useConversationStream, A as useImportFilePicker, Q as useToolsMenu, P as useTranscribeAudio };