@epam/ai-dial-chat-hooks 1.1.2 → 1.2.0-dev.101

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 (44) hide show
  1. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  2. package/attachments.d.ts +10 -4
  3. package/catalog/map-skill-to-catalog-item.js +48 -48
  4. package/catalog/publish.js +2 -1
  5. package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
  6. package/catalog.d.ts +22 -0
  7. package/catalog.js +6 -5
  8. package/conversation/conversation-transfer/queue.js +8 -5
  9. package/conversation/stage.js +23 -0
  10. package/conversation/useConversationImport/useConversationImport.js +1 -1
  11. package/conversation/useConversationScroll/useConversationScroll.js +68 -64
  12. package/conversation/useConversationStream/apply-chunk.js +1 -1
  13. package/conversation-sources/useConversationSources/useConversationSources.js +24 -31
  14. package/conversation-sources.d.ts +1 -1
  15. package/conversation.d.ts +107 -0
  16. package/conversation.js +23 -21
  17. package/file-manager.d.ts +71 -5
  18. package/file-manager.js +3 -2
  19. package/files/attachment-types.js +14 -13
  20. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -5
  21. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
  22. package/index.d.ts +614 -16
  23. package/index.js +123 -111
  24. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  25. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  26. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  27. package/mcp-apps.d.ts +8 -6
  28. package/package.json +26 -17
  29. package/scheduled-task/scheduled-task-description.js +77 -0
  30. package/scheduled-task/scheduled-task-preparation.js +24 -0
  31. package/scheduled-task/scheduled-tasks-api-client.js +19 -0
  32. package/scheduled-task/use-scheduled-task-runs.js +82 -0
  33. package/scheduled-task/use-scheduled-tasks.js +93 -0
  34. package/scheduled-tasks.d.ts +178 -0
  35. package/scheduled-tasks.js +7 -2
  36. package/skill/skill.js +10 -7
  37. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
  38. package/skill/useSkillEditorSubmit.js +83 -71
  39. package/skill-editor.d.ts +103 -0
  40. package/skill-editor.js +9 -8
  41. package/usage/map-usage-data-to-dashboard.js +66 -0
  42. package/usage/map-user-usage-to-model-limits.js +160 -0
  43. package/usage.d.ts +120 -0
  44. package/usage.js +3 -0
package/usage.d.ts ADDED
@@ -0,0 +1,120 @@
1
+ import { DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
2
+ import { ModelLimitPeriodStatuses } from '@epam/ai-dial-usage-dashboard';
3
+ import { ModelLimitRow } from '@epam/ai-dial-usage-dashboard';
4
+ import { UsageLimitCardData } from '@epam/ai-dial-usage-dashboard';
5
+ import { UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
6
+
7
+ /** Formats a raw `resetsAt` into display strings, or returns `undefined` when it cannot be formatted. */
8
+ export declare type FormatResetTime = (resetsAt: string | undefined) => ResetTimeDisplay | undefined;
9
+
10
+ /**
11
+ * Maps the same top-level Cost budgets used by the aggregate cards into table-header state.
12
+ *
13
+ * @param formatResetTime - Formats each period's top-level `resetsAt` into the header's reset trio. Omit it to produce statuses with no reset fields.
14
+ */
15
+ export declare const mapOverallCostLimitsToPeriodStatuses: (usage: UserLimitStatsResponseDto | undefined, activeLocale: string, t: Translate_2, formatResetTime?: FormatResetTime) => ModelLimitPeriodStatuses;
16
+
17
+ /**
18
+ * Maps a `UserLimitStatsResponseDto` into `UsageLimitCardGroup`'s `cards` prop,
19
+ * in Today / This week / This month order. A period is omitted entirely when
20
+ * the response carries no usable stat for it. Each card's reset trio comes from
21
+ * `formatResetTime`, and is absent when that callback returns `undefined`.
22
+ */
23
+ export declare const mapUsageDataToDashboard: (usage: UserLimitStatsResponseDto | undefined, t: Translate, formatResetTime: FormatResetTime) => UsageLimitCardData[];
24
+
25
+ /**
26
+ * Maps `usage.deployments` into `ModelLimitsSection`'s `rows` prop, joined with model identity
27
+ * from `deploymentItems`. Rows are included only when any displayed period stat has nonzero usage.
28
+ * Order follows `Object.keys(deployments)` — `deploymentItems` is enrichment-only.
29
+ *
30
+ * @param resolveIconUrl - Resolves a deployment's raw `iconUrl` to the URL the avatar should load.
31
+ * @param resolveDisplayName - Resolves a localized-text map or plain string to the display name for `activeLocale`.
32
+ */
33
+ export declare const mapUserUsageToModelLimits: (usage: UserLimitStatsResponseDto | undefined, deploymentItems: DeploymentItemDto[], activeLocale: string, t: Translate_2, resolveIconUrl: ResolveIconUrl, resolveDisplayName: ResolveDisplayName) => ModelLimitRow[];
34
+
35
+ /**
36
+ * One reset time, already parsed and formatted by the host. Declared
37
+ * structurally here so this library never imports an application type; the
38
+ * host passes a value that satisfies this shape (e.g. `apps/chat`'s own
39
+ * `ResetTimeDisplay`).
40
+ */
41
+ export declare interface ResetTimeDisplay {
42
+ /** Exclusive end of the period as an epoch ms value, for the host's boundary scheduling. */
43
+ resetsAtMs: number;
44
+ /** Machine-readable instant for a `<time dateTime>` attribute. */
45
+ isoValue: string;
46
+ /** Visible reset line. */
47
+ label: string;
48
+ /** Accessible expansion of the reset line. */
49
+ ariaLabel: string;
50
+ }
51
+
52
+ /** A callback that resolves a display name from a localized-text value. */
53
+ declare type ResolveDisplayName = (name: string | Record<string, string> | undefined | null, locale: string) => string;
54
+
55
+ /** A callback that resolves an icon URL from a deployment's raw `iconUrl` field. */
56
+ declare type ResolveIconUrl = (iconUrl: string | undefined) => string | undefined;
57
+
58
+ /** A translate function compatible with i18next's `TFunction`. */
59
+ declare type Translate = (key: string, options?: Record<string, unknown>) => string;
60
+
61
+ /** A translate function compatible with i18next's `TFunction`. */
62
+ declare type Translate_2 = (key: string, options?: Record<string, unknown>) => string;
63
+
64
+ /**
65
+ * i18n key strings that the consuming app's translation bundle must define for
66
+ * `mapUsageDataToDashboard` to produce correctly translated strings. The
67
+ * values are the default key paths used by AI DIAL Chat.
68
+ */
69
+ export declare const USAGE_DATA_I18N_KEYS: {
70
+ /** Title for the current-UTC-day card (e.g. `'Today'`). */
71
+ readonly todayTitle: "usage.todayTitle";
72
+ /** Accessible period description for the current-UTC-day card. */
73
+ readonly todayPeriodDescription: "usage.todayPeriodDescription";
74
+ /** Title for the current-UTC-week card (e.g. `'This week'`). */
75
+ readonly thisWeekTitle: "usage.thisWeekTitle";
76
+ /** Accessible period description for the current-UTC-week card. */
77
+ readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
78
+ /** Title for the current-UTC-month card (e.g. `'This month'`). */
79
+ readonly thisMonthTitle: "usage.thisMonthTitle";
80
+ /** Accessible period description for the current-UTC-month card. */
81
+ readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
82
+ /** Aria label when there is no limit. Receives `{ used: string }`. */
83
+ readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
84
+ /** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
85
+ readonly progressAriaLabel: "usage.progressAriaLabel";
86
+ };
87
+
88
+ /**
89
+ * i18n key strings that the consuming app's translation bundle must define for
90
+ * `mapUserUsageToModelLimits` and `mapOverallCostLimitsToPeriodStatuses` to produce
91
+ * correctly translated strings. The values are the default key paths used by AI DIAL Chat.
92
+ */
93
+ export declare const USAGE_MODEL_LIMITS_I18N_KEYS: {
94
+ /** Period label used in tooltip text. Receives no interpolation. */
95
+ readonly todayPeriodDescription: "usage.todayPeriodDescription";
96
+ /** Period label used in tooltip text. Receives no interpolation. */
97
+ readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
98
+ /** Period label used in tooltip text. Receives no interpolation. */
99
+ readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
100
+ /** Tooltip when the overall cost limit is running low. Receives `{ period: string }`. */
101
+ readonly overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip";
102
+ /** Tooltip when the overall cost limit is reached. Receives `{ period: string }`. */
103
+ readonly overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip";
104
+ /** Aria label for a metric cell with no data. */
105
+ readonly unavailableLabel: "usage.unavailableLabel";
106
+ /** Supporting label when a token limit follows the cost limit. */
107
+ readonly followsCostLimitLabel: "usage.followsCostLimitLabel";
108
+ /** Supporting label when there is no per-deployment token limit. */
109
+ readonly noLimitLabel: "usage.noLimitLabel";
110
+ /** Aria label when token usage has no limit but follows the cost limit. Receives `{ used: string }`. */
111
+ readonly followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel";
112
+ /** Aria label when there is no limit. Receives `{ used: string }`. */
113
+ readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
114
+ /** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
115
+ readonly progressAriaLabel: "usage.progressAriaLabel";
116
+ /** Label for the spent-cost cell. Receives `{ amount: string }`. */
117
+ readonly spentLabel: "usage.spentLabel";
118
+ };
119
+
120
+ export { }
package/usage.js ADDED
@@ -0,0 +1,3 @@
1
+ import { USAGE_DATA_I18N_KEYS as e, mapUsageDataToDashboard as t } from "./usage/map-usage-data-to-dashboard.js";
2
+ import { USAGE_MODEL_LIMITS_I18N_KEYS as n, mapOverallCostLimitsToPeriodStatuses as r, mapUserUsageToModelLimits as i } from "./usage/map-user-usage-to-model-limits.js";
3
+ export { e as USAGE_DATA_I18N_KEYS, n as USAGE_MODEL_LIMITS_I18N_KEYS, r as mapOverallCostLimitsToPeriodStatuses, t as mapUsageDataToDashboard, i as mapUserUsageToModelLimits };