@epam/ai-dial-chat-hooks 1.2.0-dev.20 → 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.
Files changed (88) hide show
  1. package/api-error/api-error.js +5 -4
  2. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  3. package/attachments.d.ts +10 -4
  4. package/catalog/catalog-derivations.js +1 -1
  5. package/catalog/deployment-id.js +8 -2
  6. package/catalog/map-deployment-limits-to-input.js +81 -9
  7. package/catalog/map-deployment-to-catalog-item.js +34 -34
  8. package/catalog/map-entity-details-to-catalog.js +7 -0
  9. package/catalog/map-skill-to-catalog-item.js +30 -27
  10. package/catalog/publish.js +6 -5
  11. package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
  12. package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
  13. package/catalog/useSkillItemDetails.js +17 -13
  14. package/catalog.d.ts +116 -20
  15. package/catalog.js +23 -22
  16. package/conversation/conversation-transfer/export-conversation.js +24 -16
  17. package/conversation/conversation-transfer/import-conversation.js +80 -31
  18. package/conversation/conversation-transfer/queue.js +8 -5
  19. package/conversation/create-chat-stream-api.js +85 -49
  20. package/conversation/message-utils.js +44 -2
  21. package/conversation/stage.js +23 -0
  22. package/conversation/useConversationExport/useConversationExport.js +9 -9
  23. package/conversation/useConversationImport/useConversationImport.js +123 -121
  24. package/conversation/useConversationPanelItems/useConversationPanelItems.js +2 -3
  25. package/conversation/useConversationScroll/useConversationScroll.js +68 -64
  26. package/conversation/useConversationStream/apply-chunk.js +1 -1
  27. package/conversation/useConversationStream/generation-resume.js +104 -63
  28. package/conversation/useConversationStream/useConversationStream.js +183 -108
  29. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
  30. package/conversation-overlay.d.ts +7 -0
  31. package/conversation-overlay.js +2 -0
  32. package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
  33. package/conversation-sources.d.ts +1 -1
  34. package/conversation-transfer.d.ts +2 -1
  35. package/conversation.d.ts +241 -13
  36. package/conversation.js +32 -30
  37. package/file-manager-canvas.d.ts +398 -0
  38. package/file-manager-canvas.js +2 -0
  39. package/file-manager.d.ts +153 -350
  40. package/file-manager.js +25 -24
  41. package/files/attachment-canvas.js +40 -1
  42. package/files/attachment-types.js +14 -13
  43. package/files/dial-file-manager-mapping.util.js +2 -1
  44. package/files/dial-file-manager-path.util.js +23 -1
  45. package/files/dial-file-manager.model.js +23 -19
  46. package/files/dial-file-manager.types.js +3 -3
  47. package/files/useDialFileListing/useDialFileListing.js +157 -145
  48. package/files/useDialFileManager/useDialFileManager.js +132 -128
  49. package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
  50. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
  51. package/files/useDialFileMutations/useDialFileMutations.js +33 -32
  52. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
  53. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
  54. package/index.d.ts +1066 -81
  55. package/index.js +136 -122
  56. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  57. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  58. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
  59. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  60. package/mcp-apps.d.ts +8 -6
  61. package/oauth/toolset-id.js +5 -3
  62. package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
  63. package/oauth.d.ts +32 -0
  64. package/oauth.js +9 -9
  65. package/package.json +36 -21
  66. package/scheduled-task/scheduled-task-description.js +77 -0
  67. package/scheduled-task/scheduled-task-preparation.js +24 -0
  68. package/scheduled-task/scheduled-task-trigger.js +7 -2
  69. package/scheduled-task/scheduled-tasks-api-client.js +19 -0
  70. package/scheduled-task/use-scheduled-task-runs.js +194 -0
  71. package/scheduled-task/use-scheduled-tasks.js +93 -0
  72. package/scheduled-tasks.d.ts +195 -3
  73. package/scheduled-tasks.js +7 -2
  74. package/skill/skill-archive.js +19 -0
  75. package/skill/skill-types.js +8 -7
  76. package/skill/skill.js +42 -27
  77. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
  78. package/skill/useSkillEditorLoad.js +29 -28
  79. package/skill/useSkillEditorSubmit.js +108 -84
  80. package/skill/useSkillFileActions.js +70 -58
  81. package/skill-editor.d.ts +131 -3
  82. package/skill-editor.js +9 -8
  83. package/usage/map-usage-data-to-dashboard.js +66 -0
  84. package/usage/map-user-usage-to-model-limits.js +202 -0
  85. package/usage.d.ts +125 -0
  86. package/usage.js +3 -0
  87. package/usePageFileDrag/usePageFileDrag.js +3 -3
  88. 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';
@@ -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
  /**
@@ -328,6 +347,12 @@ export declare interface CreateChatStreamApiDeps {
328
347
  getTimezone?: () => string | undefined;
329
348
  /** `fetch` implementation to issue requests through. Defaults to the global `fetch`. */
330
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;
331
356
  }
332
357
 
333
358
  /**
@@ -342,6 +367,11 @@ export declare const createMessagePair: (content: string, customContent?: Messag
342
367
  /** Fallback text of a {@link GenerationConflictError} when no message is supplied. */
343
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.";
344
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
+
345
375
  /**
346
376
  * Derives the row-action visibility state for a single conversation item.
347
377
  *
@@ -376,6 +406,12 @@ export declare class GenerationConflictError extends Error {
376
406
  constructor(message?: string);
377
407
  }
378
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
+
379
415
  /**
380
416
  * Strips the leading bucket segment from a conversation id and decodes any
381
417
  * already-percent-encoded remainder back to raw, so callers that re-encode
@@ -388,6 +424,21 @@ export declare const getConversationPath: (conversationId: string) => string;
388
424
  */
389
425
  export declare const getConversationSource: (item: Pick<ConversationListItemDto, "sharedWithMe" | "publishedWithMe">) => FilterTab;
390
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
+
391
442
  /**
392
443
  * Returns the deployment the conversation was last running on: scanning
393
444
  * backwards, the `new_deployment_id` of a `model_changed` status message or
@@ -411,6 +462,15 @@ export declare const getLastDeploymentId: (messages: Message[]) => string | null
411
462
  */
412
463
  export declare const getLastUserMessageToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
413
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
+
414
474
  /**
415
475
  * Extracts the deployment/model ID from a DIAL Core conversation ID.
416
476
  *
@@ -494,6 +554,15 @@ export declare const getStarterSubmitText: (starter: StarterOption, description?
494
554
  */
495
555
  export declare const getTimeOfDayGreeting: (hour: number, translations: GreetingTranslations, firstName?: string) => string;
496
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
+
497
566
  /** Pre-translated greeting phrase strings for each time-of-day period. */
498
567
  export declare interface GreetingTranslations {
499
568
  morningWithName: string;
@@ -530,8 +599,8 @@ export declare const isAnswerIncomplete: (answer: Message | undefined) => boolea
530
599
  * True when the conversation's last message is an unresolved assistant
531
600
  * placeholder: the backend only persists a conversation at generation start
532
601
  * (empty placeholder) and at generation end (final content, or a partial
533
- * flagged `streamErrorMessage`/`wasStoppedByUser`), so this shape means a
534
- * generation was still active elsewhere when the conversation was loaded.
602
+ * flagged `streamErrorMessage`/`wasStoppedByUser`). This can mean generation
603
+ * is still active elsewhere, or that its terminal save failed.
535
604
  */
536
605
  export declare const isAwaitingGenerationResume: (conversation: Conversation) => boolean;
537
606
 
@@ -573,6 +642,29 @@ declare interface LocalModeValues {
573
642
  temperature: number;
574
643
  }
575
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
+
576
668
  /** True when `message` is an assistant message carrying at least one stage. */
577
669
  export declare const messageHasStages: (message: Message) => boolean;
578
670
 
@@ -582,6 +674,20 @@ export declare interface MessagePair {
582
674
  assistantMessage: Message;
583
675
  }
584
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
+
585
691
  /**
586
692
  * Normalises a stored response-format string to the current enum. Legacy data
587
693
  * may contain `'Markdown'` or `'PlainText'` (capital-first) instead of the
@@ -606,6 +712,63 @@ export declare interface QuickAppConversationStartersSettings {
606
712
  isChatMessageInputDisabled: boolean;
607
713
  }
608
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
+
609
772
  /** State of one resource's recipient-count lookup. */
610
773
  declare interface RecipientsCountEntry {
611
774
  /** Where the lookup for this resource currently stands. */
@@ -662,8 +825,35 @@ export declare interface StreamCompletionOptions {
662
825
  signal: AbortSignal;
663
826
  }
664
827
 
665
- /** Maps chat messages to the DIAL Chat Overlay protocol's message shape. */
666
- export declare const toOverlayMessages: (messages: Message[]) => OverlayChatMessage[];
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;
667
857
 
668
858
  /** Request shape the host's selected-deployment recognition call accepts. */
669
859
  export declare interface TranscribeWithDeploymentParams {
@@ -883,9 +1073,8 @@ export declare interface UseConversationLookupMapsParams {
883
1073
  * panel's item contract. All app-specific concerns (icon URL resolution,
884
1074
  * route generation, id normalisation) are injected via resolver callbacks.
885
1075
  */
886
- export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskBadge, }: UseConversationPanelItemsParams) => {
887
- showTaskBadge?: boolean | undefined;
888
- taskBadgeLabel?: string | undefined;
1076
+ export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskPresentation, }: UseConversationPanelItemsParams) => {
1077
+ leadingIcon?: ReactNode;
889
1078
  isUnread?: boolean | undefined;
890
1079
  id: string;
891
1080
  title: string;
@@ -921,11 +1110,12 @@ export declare interface UseConversationPanelItemsResolvers {
921
1110
  /** Resolves the href to navigate to when the conversation row is clicked. */
922
1111
  resolveHref: (panelConversationId: string) => string;
923
1112
  /**
924
- * Returns badge metadata for a scheduled-task conversation, or `undefined`
925
- * when the item should not show a task badge.
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.
926
1116
  */
927
- resolveTaskBadge?: (item: ConversationListItemDto) => {
928
- label: string;
1117
+ resolveTaskPresentation?: (item: ConversationListItemDto) => {
1118
+ leadingIcon?: ReactNode;
929
1119
  isUnread: boolean;
930
1120
  } | undefined;
931
1121
  }
@@ -938,7 +1128,7 @@ export declare interface UseConversationPanelItemsResolvers {
938
1128
  * `transport`/`generation`/`channel`/`overlay` capabilities rather than any
939
1129
  * app context or `server-api` import.
940
1130
  */
941
- 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;
942
1132
 
943
1133
  /** Parameters for {@link useConversationStream}. */
944
1134
  export declare interface UseConversationStreamParams {
@@ -956,6 +1146,15 @@ export declare interface UseConversationStreamParams {
956
1146
  * {@link DEFAULT_GENERATION_CONFLICT_MESSAGE}.
957
1147
  */
958
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;
959
1158
  }
960
1159
 
961
1160
  /** Return value of {@link useConversationStream}. */
@@ -1002,6 +1201,35 @@ export declare interface UseImportFilePickerResult {
1002
1201
  handleFileChange: (event: ChangeEvent<HTMLInputElement>) => void;
1003
1202
  }
1004
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
+
1005
1233
  /**
1006
1234
  * Derives the tools submenu from the active deployment's configuration schema:
1007
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, GenerationConflictError as o, createChatStreamApi as s } from "./conversation/create-chat-stream-api.js";
3
- import { shouldWatchForDisplayNameUpdate as c } from "./conversation/display-name-watch.js";
4
- import { formatAppVersion as l, sanitizeFooterHtml as u } from "./conversation/footer-message.js";
5
- import { getModelIdFromConversationId as d } from "./conversation/get-model-id-from-conversation-id.js";
6
- import { getTimeOfDayGreeting as f } from "./conversation/greeting.js";
7
- import { createDeploymentChangedMessage as p } from "./conversation/message-factory.js";
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 };
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 };