@epam/ai-dial-chat-hooks 1.2.0-dev.12 → 1.2.0-dev.120
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/map-deployment-to-catalog-item.js +2 -2
- package/catalog/map-skill-to-catalog-item.js +30 -27
- package/catalog/publish.js +2 -1
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +17 -13
- package/catalog.d.ts +42 -5
- package/catalog.js +6 -5
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/create-chat-stream-api.js +18 -14
- package/conversation/stage.js +23 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
- package/conversation/useConversationHandlers/useConversationHandlers.js +13 -17
- package/conversation/useConversationImport/useConversationImport.js +1 -1
- package/conversation/useConversationScroll/useConversationScroll.js +68 -64
- package/conversation/useConversationStream/apply-chunk.js +1 -1
- package/conversation/useConversationStream/useConversationStream.js +87 -78
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation.d.ts +127 -6
- package/conversation.js +30 -29
- package/file-manager-canvas.d.ts +398 -0
- package/file-manager-canvas.js +2 -0
- package/file-manager.d.ts +71 -330
- package/file-manager.js +15 -15
- package/files/attachment-canvas.js +51 -13
- package/files/attachment-types.js +14 -13
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -5
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
- package/index.d.ts +736 -32
- package/index.js +123 -111
- 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/package.json +37 -18
- 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 +82 -0
- package/scheduled-task/use-scheduled-tasks.js +93 -0
- package/scheduled-tasks.d.ts +180 -3
- package/scheduled-tasks.js +7 -2
- package/skill/skill.js +10 -7
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
- package/skill/useSkillEditorLoad.js +29 -28
- package/skill/useSkillEditorSubmit.js +92 -75
- package/skill-editor.d.ts +107 -0
- 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 +160 -0
- package/usage.d.ts +120 -0
- package/usage.js +3 -0
- package/utils.d.ts +3 -1
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';
|
|
@@ -58,6 +58,25 @@ export declare interface AnnouncementListItemLink {
|
|
|
58
58
|
href: string;
|
|
59
59
|
}
|
|
60
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
|
+
|
|
61
80
|
/** State and controls returned by `useAsyncConfirmDialog`. */
|
|
62
81
|
export declare interface AsyncConfirmDialogControls<T> {
|
|
63
82
|
/**
|
|
@@ -573,6 +592,29 @@ declare interface LocalModeValues {
|
|
|
573
592
|
temperature: number;
|
|
574
593
|
}
|
|
575
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
|
+
|
|
576
618
|
/** True when `message` is an assistant message carrying at least one stage. */
|
|
577
619
|
export declare const messageHasStages: (message: Message) => boolean;
|
|
578
620
|
|
|
@@ -606,6 +648,63 @@ export declare interface QuickAppConversationStartersSettings {
|
|
|
606
648
|
isChatMessageInputDisabled: boolean;
|
|
607
649
|
}
|
|
608
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
|
+
|
|
609
708
|
/** State of one resource's recipient-count lookup. */
|
|
610
709
|
declare interface RecipientsCountEntry {
|
|
611
710
|
/** Where the lookup for this resource currently stands. */
|
|
@@ -662,8 +761,23 @@ export declare interface StreamCompletionOptions {
|
|
|
662
761
|
signal: AbortSignal;
|
|
663
762
|
}
|
|
664
763
|
|
|
665
|
-
/**
|
|
666
|
-
|
|
764
|
+
/**
|
|
765
|
+
* Reported through `onError` when DIAL Core itself signals a failure with an
|
|
766
|
+
* in-band `{ error: { message } }` SSE chunk. Its `message` is upstream text
|
|
767
|
+
* intended for the user, unlike a transport failure (failed `fetch`, non-OK
|
|
768
|
+
* status, broken stream), whose message is technical detail. A custom
|
|
769
|
+
* transport raises this for any user-facing upstream error text.
|
|
770
|
+
*/
|
|
771
|
+
export declare class StreamUpstreamError extends Error {
|
|
772
|
+
constructor(message: string);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Returns a renderable `Stage` for one raw payload: `index` defaults to `0`,
|
|
777
|
+
* `name` to `''`, an unrecognized `status` to `null` (still running), and
|
|
778
|
+
* `content`/`tag`/`attachments` are passed through when present.
|
|
779
|
+
*/
|
|
780
|
+
export declare const toStage: (stage: RawStage) => Stage;
|
|
667
781
|
|
|
668
782
|
/** Request shape the host's selected-deployment recognition call accepts. */
|
|
669
783
|
export declare interface TranscribeWithDeploymentParams {
|
|
@@ -728,8 +842,8 @@ export declare const useAttachmentUpload: ({ filesApi, bucket, onNetworkError, d
|
|
|
728
842
|
|
|
729
843
|
/** Parameters for {@link useAttachmentUpload}. */
|
|
730
844
|
export declare interface UseAttachmentUploadParams {
|
|
731
|
-
/** Already-configured
|
|
732
|
-
filesApi: Pick<FilesApi, 'uploadFile'
|
|
845
|
+
/** Already-configured client; optional listing skips stored names after a conflict. */
|
|
846
|
+
filesApi: Pick<FilesApi, 'uploadFile'> & Partial<Pick<FilesApi, 'listFiles'>>;
|
|
733
847
|
/** DIAL Core bucket the file is uploaded into. */
|
|
734
848
|
bucket: string | undefined;
|
|
735
849
|
/** Called with batched filenames after a burst of network-error upload failures. */
|
|
@@ -938,7 +1052,7 @@ export declare interface UseConversationPanelItemsResolvers {
|
|
|
938
1052
|
* `transport`/`generation`/`channel`/`overlay` capabilities rather than any
|
|
939
1053
|
* app context or `server-api` import.
|
|
940
1054
|
*/
|
|
941
|
-
export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, }: UseConversationStreamParams) => UseConversationStreamResult;
|
|
1055
|
+
export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, onStreamError, }: UseConversationStreamParams) => UseConversationStreamResult;
|
|
942
1056
|
|
|
943
1057
|
/** Parameters for {@link useConversationStream}. */
|
|
944
1058
|
export declare interface UseConversationStreamParams {
|
|
@@ -956,6 +1070,13 @@ export declare interface UseConversationStreamParams {
|
|
|
956
1070
|
* {@link DEFAULT_GENERATION_CONFLICT_MESSAGE}.
|
|
957
1071
|
*/
|
|
958
1072
|
generationConflictMessage?: string;
|
|
1073
|
+
/**
|
|
1074
|
+
* Receives the original error of every failed stream. The hook shows only
|
|
1075
|
+
* host-supplied or upstream-supplied text on the message bubble and hides
|
|
1076
|
+
* transport detail (e.g. `Failed to fetch`), so this is where the host can
|
|
1077
|
+
* still log or report the raw error.
|
|
1078
|
+
*/
|
|
1079
|
+
onStreamError?: (error: Error) => void;
|
|
959
1080
|
}
|
|
960
1081
|
|
|
961
1082
|
/** Return value of {@link useConversationStream}. */
|
package/conversation.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
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, GenerationConflictError as o,
|
|
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 { toOverlayMessages as y } from "./conversation/overlay-messages.js";
|
|
2
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as a, GenerationConflictError as o, StreamUpstreamError as s, createChatStreamApi as c } from "./conversation/create-chat-stream-api.js";
|
|
3
|
+
import { shouldWatchForDisplayNameUpdate as l } from "./conversation/display-name-watch.js";
|
|
4
|
+
import { formatAppVersion as u, sanitizeFooterHtml as d } from "./conversation/footer-message.js";
|
|
5
|
+
import { getModelIdFromConversationId as f } from "./conversation/get-model-id-from-conversation-id.js";
|
|
6
|
+
import { getTimeOfDayGreeting as p } from "./conversation/greeting.js";
|
|
7
|
+
import { createDeploymentChangedMessage as m } from "./conversation/message-factory.js";
|
|
8
|
+
import { getLastDeploymentId as h, getLastUserMessageToolConfiguration as g, isMessageStreaming as _, messageHasStages as v, normalizeResponseFormat as y } from "./conversation/message-utils.js";
|
|
10
9
|
import { getQuickAppConversationStarters as b } from "./conversation/quick-app-conversation-starters.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
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
|
-
|
|
10
|
+
import { mapStages as x, toStage as S } from "./conversation/stage.js";
|
|
11
|
+
import { getStarterPopulateText as C, getStartersFromSchema as w } from "./conversation/starter-option.js";
|
|
12
|
+
import { deriveConversationRowActionState as T } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
13
|
+
import { useActiveConversationSync as E } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
14
|
+
import { useAsyncConfirmDialog as D } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
15
|
+
import { useConversationLookupMaps as O } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
16
|
+
import { getConversationSource as k, useConversationPanelItems as A } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
17
|
+
import { useImportFilePicker as j } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
18
|
+
import { useAttachmentUpload as M } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
19
|
+
import { AudioTranscriptionError as N, AudioTranscriptionErrorReason as P } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
20
|
+
import { useTranscribeAudio as F } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
21
|
+
import { attachmentToDto as I, attachmentsToDtos as L } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
22
|
+
import { createMessagePair as R } from "./conversation/useConversationHandlers/message-factory.js";
|
|
23
|
+
import { hasActiveToolConfig as z, isAnswerIncomplete as B, isMessageChanged as V, shouldRerunGenerationOnEdit as H } from "./conversation/useConversationHandlers/message-utils.js";
|
|
24
|
+
import { getStarterConversationText as U, getStarterDisplayText as W, getStarterSubmitText as G } from "./conversation/useConversationHandlers/starter-option.js";
|
|
25
|
+
import { getConversationPath as K } from "./conversation/useConversationStream/conversation-path.js";
|
|
26
|
+
import { useConversationHandlers as q } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
27
|
+
import { applyChunkToMessages as J, mergeStages as Y } from "./conversation/useConversationStream/apply-chunk.js";
|
|
28
|
+
import { isAwaitingGenerationResume as X } from "./conversation/useConversationStream/generation-resume.js";
|
|
29
|
+
import { useConversationStream as Z } from "./conversation/useConversationStream/useConversationStream.js";
|
|
30
|
+
import { useChatSettingsFormConfig as Q } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
31
|
+
import { useToolsMenu as $ } from "./useToolsMenu/useToolsMenu.js";
|
|
32
|
+
export { N as AudioTranscriptionError, P as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as GenerationConflictError, s as StreamUpstreamError, J as applyChunkToMessages, I as attachmentToDto, L as attachmentsToDtos, e as buildAnnouncementSignature, c as createChatStreamApi, m as createDeploymentChangedMessage, R as createMessagePair, T as deriveConversationRowActionState, u as formatAppVersion, K as getConversationPath, k as getConversationSource, h as getLastDeploymentId, g as getLastUserMessageToolConfiguration, f as getModelIdFromConversationId, b as getQuickAppConversationStarters, U as getStarterConversationText, W as getStarterDisplayText, C as getStarterPopulateText, G as getStarterSubmitText, w as getStartersFromSchema, p as getTimeOfDayGreeting, z as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, B as isAnswerIncomplete, X as isAwaitingGenerationResume, V as isMessageChanged, _ as isMessageStreaming, x as mapStages, Y as mergeStages, v as messageHasStages, y as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, d as sanitizeFooterHtml, H as shouldRerunGenerationOnEdit, l as shouldWatchForDisplayNameUpdate, S as toStage, E as useActiveConversationSync, D as useAsyncConfirmDialog, M as useAttachmentUpload, Q as useChatSettingsFormConfig, q as useConversationHandlers, O as useConversationLookupMaps, A as useConversationPanelItems, Z as useConversationStream, j as useImportFilePicker, $ as useToolsMenu, F as useTranscribeAudio };
|