@epam/ai-dial-chat-hooks 1.1.0-rc.2 → 1.1.0-rc.3

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.
@@ -1,59 +1,59 @@
1
1
  import { SkillSource as e } from "../../skill/skill-types.js";
2
2
  import { mapSkillToCatalogItem as t } from "../map-skill-to-catalog-item.js";
3
3
  import { useSkillItemDetails as n } from "../useSkillItemDetails.js";
4
- import { useEffect as r, useMemo as i, useState as a } from "react";
4
+ import { useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
5
5
  //#region src/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.ts
6
- var o = ({ api: o, skills: s, sharedWithMe: c, publicSkills: l, skillId: u, folderLabels: d, skillOverviewLabels: f, favoriteIds: p }) => {
7
- let m = i(() => [
8
- ...s,
9
- ...c ?? [],
10
- ...l ?? []
6
+ var s = ({ api: s, skills: c, sharedWithMe: l, publicSkills: u, skillId: d, folderLabels: f, skillOverviewLabels: p, favoriteIds: m }) => {
7
+ let h = i(() => [
8
+ ...c,
9
+ ...l ?? [],
10
+ ...u ?? []
11
11
  ], [
12
- s,
13
- c,
14
- l
15
- ]), { onFetchSkillDetails: h, onLoadSkillDetailsFile: g } = n({
16
- api: o,
17
- skills: m,
18
- skillOverviewLabels: f
19
- }), _ = i(() => m.find((e) => e.url === u) ?? null, [m, u]), v = i(() => s.some((e) => e.url === u) ? e.Personal : c?.some((e) => e.url === u) ? e.SharedWithMe : e.Public, [
20
- s,
21
12
  c,
13
+ l,
22
14
  u
23
- ]), y = i(() => _ == null ? null : t(_, {
24
- folderLabels: d,
25
- source: v,
26
- favoriteIds: p
15
+ ]), { onFetchSkillDetails: g, onLoadSkillDetailsFile: _ } = n({
16
+ api: s,
17
+ skills: h,
18
+ skillOverviewLabels: p
19
+ }), v = i(() => h.find((e) => e.url === d) ?? null, [h, d]), y = i(() => c.some((e) => e.url === d) ? e.Personal : l?.some((e) => e.url === d) ? e.SharedWithMe : e.Public, [
20
+ c,
21
+ l,
22
+ d
23
+ ]), b = i(() => v == null ? null : t(v, {
24
+ folderLabels: f,
25
+ source: y,
26
+ favoriteIds: m
27
27
  }), [
28
- _,
29
28
  v,
30
- d,
31
- p
32
- ]), [b, x] = a(null), [S, C] = a(!1);
29
+ y,
30
+ f,
31
+ m
32
+ ]), [x, S] = o(null), [C, w] = o(!1), T = a(0);
33
33
  return r(() => {
34
- if (y == null) return;
35
- C(!0), x(null);
36
- let e = !1;
37
- return h(y).then((t) => {
38
- e || (x(t ?? null), C(!1));
34
+ if (b == null) return;
35
+ w(!0), S(null);
36
+ let e = !1, t = ++T.current;
37
+ return g(b).then((n) => {
38
+ e || T.current !== t || (S(n ?? null), w(!1));
39
39
  }), () => {
40
40
  e = !0;
41
41
  };
42
- }, [y?.id]), {
42
+ }, [b?.id]), {
43
43
  detailsPanelItem: i(() => {
44
- if (y == null) return null;
45
- if (b == null) return y;
46
- let { credentials: e, ...t } = b;
44
+ if (b == null) return null;
45
+ if (x == null) return b;
46
+ let { credentials: e, ...t } = x;
47
47
  return {
48
- ...y,
48
+ ...b,
49
49
  details: t,
50
- credentials: e ?? y.credentials
50
+ credentials: e ?? b.credentials
51
51
  };
52
- }, [y, b]),
53
- isDetailsLoading: S,
54
- isStarred: y != null && p.has(y.id),
55
- onLoadSkillDetailsFile: g
52
+ }, [b, x]),
53
+ isDetailsLoading: C,
54
+ isStarred: b != null && m.has(b.id),
55
+ onLoadSkillDetailsFile: _
56
56
  };
57
57
  };
58
58
  //#endregion
59
- export { o as useSkillDetailsPanelData };
59
+ export { s as useSkillDetailsPanelData };
@@ -12,20 +12,24 @@ var d = ({ api: d, skills: f, skillOverviewLabels: p }) => {
12
12
  if (o == null) return;
13
13
  let { bucket: l, path: u } = o;
14
14
  m.current = o;
15
- let [h, g] = await Promise.allSettled([d.downloadSkillFile(l, u, e).then(a), d.listSkillFiles({
16
- bucket: l,
17
- path: u,
18
- filePath: "",
19
- recursive: !0
20
- })]), _ = h.status === "fulfilled" && h.value != null ? c(h.value) : void 0, v = f.find((e) => e.url === i.id), y = g.status === "fulfilled" ? r(v, g.value.items, _?.about, p) : void 0, b = g.status === "fulfilled" ? n(g.value.items, u) : [], x = g.status === "fulfilled" ? s(g.value.items, u) : e;
21
- if (!(_ == null && y == null)) return {
22
- ..._ == null ? {} : { promptContent: {
23
- content: _.body,
24
- ..._.description == null ? {} : { description: _.description },
25
- files: b,
26
- selectedFileId: x
15
+ let [h, g, _] = await Promise.allSettled([
16
+ d.downloadSkillFile(l, u, e).then(a),
17
+ d.listSkillFiles({
18
+ bucket: l,
19
+ path: u,
20
+ filePath: "",
21
+ recursive: !0
22
+ }),
23
+ d.getSkillMetadata(l, u)
24
+ ]), v = h.status === "fulfilled" && h.value != null ? c(h.value) : void 0, y = _.status === "fulfilled" ? _.value : f.find((e) => e.url === i.id), b = g.status === "fulfilled" ? r(y, g.value.items, v?.about, p) : void 0, x = g.status === "fulfilled" ? n(g.value.items, u) : [], S = g.status === "fulfilled" ? s(g.value.items, u) : e;
25
+ if (!(v == null && b == null)) return {
26
+ ...v == null ? {} : { promptContent: {
27
+ content: v.body,
28
+ ...v.description == null ? {} : { description: v.description },
29
+ files: x,
30
+ selectedFileId: S
27
31
  } },
28
- ...y == null ? {} : { overview: y }
32
+ ...b == null ? {} : { overview: b }
29
33
  };
30
34
  }, [
31
35
  d,
package/catalog.d.ts CHANGED
@@ -132,6 +132,13 @@ export declare const buildSkillContentTree: (files: SkillMetadataItemDto[], skil
132
132
  * authored it, when it last changed, and its file inventory. Grouping folders
133
133
  * in the file listing are excluded from both the count and the rows. Sizes are
134
134
  * not shown — the skill metadata carries no content-length field.
135
+ *
136
+ * `skill` is the authoritative `getSkillMetadata` response when that request
137
+ * fulfilled; the caller falls back to the catalog listing entry only when it
138
+ * rejected (`useSkillItemDetails`'s `onFetchSkillDetails`). Either way, this
139
+ * function never fills a gap in one source from the other — an absent
140
+ * `author` omits the row and an absent `updatedAt` leaves the updated row's
141
+ * value empty, exactly as `skill` carries it.
135
142
  */
136
143
  export declare const buildSkillOverview: (skill: SkillMetadataItemDto | undefined, files: SkillMetadataItemDto[], about: SkillAboutDetails | undefined, labels: SkillOverviewLabels) => CatalogItemOverview;
137
144
 
@@ -757,6 +764,12 @@ export declare interface SkillDetailsApi {
757
764
  limit?: number;
758
765
  recursive?: boolean;
759
766
  }, signal?: AbortSignal): Promise<SkillFileListResponseDto>;
767
+ /**
768
+ * Fetches a single skill's own authoritative metadata (`author`,
769
+ * `updatedAt`, and the rest of `SkillMetadataItemDto`) — not the catalog
770
+ * listing entry, which may be sparse for a shared skill.
771
+ */
772
+ getSkillMetadata(bucket: string, path: string, signal?: AbortSignal): Promise<SkillMetadataItemDto>;
760
773
  }
761
774
 
762
775
  /** A skill's parsed manifest details. */
@@ -1218,10 +1231,11 @@ export declare interface UseSkillFilePreviewResult {
1218
1231
 
1219
1232
  /**
1220
1233
  * Headless hook that encapsulates skill detail fetching: manifest download and
1221
- * parse, package file listing, overview construction, and in-package file
1222
- * loads. `useCatalogItemDetails` delegates its skill branch here; hosts that
1223
- * only surface skill details consume this hook directly, without the
1224
- * deployment and prompt ports the full catalog pipeline requires.
1234
+ * parse, package file listing, authoritative metadata fetching, overview
1235
+ * construction, and in-package file loads. `useCatalogItemDetails` delegates
1236
+ * its skill branch here; hosts that only surface skill details consume this
1237
+ * hook directly, without the deployment and prompt ports the full catalog
1238
+ * pipeline requires.
1225
1239
  */
1226
1240
  export declare const useSkillItemDetails: ({ api, skills, skillOverviewLabels, }: UseSkillItemDetailsOptions) => UseSkillItemDetailsResult;
1227
1241
 
@@ -195,6 +195,16 @@ declare interface OoxmlDocxHighlightLocation {
195
195
  text: string;
196
196
  }
197
197
 
198
+ /** A complete table row in the DOCX body, matched by cell text. */
199
+ declare interface OoxmlDocxTableRowLocation {
200
+ /** Location kind. */
201
+ kind: OoxmlHighlightKind.DocxTableRow;
202
+ /** Plain text of each cell, in column order. */
203
+ cells: string[];
204
+ /** 1-based matching row in document order. */
205
+ occurrence: number;
206
+ }
207
+
198
208
  /** Supported document formats rendered by the installed `@silurus/ooxml` runtime. */
199
209
  declare enum OoxmlFileType {
200
210
  Docx = 'docx',
@@ -217,6 +227,10 @@ declare enum OoxmlHighlightKind {
217
227
  DocxTextRange = 'docxTextRange',
218
228
  /** A character range inside a single PPTX shape on one slide. */
219
229
  PptxTextRange = 'pptxTextRange',
230
+ /** A complete DOCX table row identified by its cell text. */
231
+ DocxTableRow = 'docxTableRow',
232
+ /** A complete PPTX table row identified by its cell text on one slide. */
233
+ PptxTableRow = 'pptxTableRow',
220
234
  /** One cell, or a contiguous same-row cell range, on a named XLSX sheet. */
221
235
  XlsxCellRange = 'xlsxCellRange',
222
236
  }
@@ -225,6 +239,8 @@ declare enum OoxmlHighlightKind {
225
239
  declare type OoxmlHighlightLocation =
226
240
  | OoxmlDocxHighlightLocation
227
241
  | OoxmlPptxHighlightLocation
242
+ | OoxmlDocxTableRowLocation
243
+ | OoxmlPptxTableRowLocation
228
244
  | OoxmlXlsxHighlightLocation;
229
245
 
230
246
  /** A cited character range inside a single shape on one PPTX slide. */
@@ -243,6 +259,18 @@ declare interface OoxmlPptxHighlightLocation {
243
259
  text: string;
244
260
  }
245
261
 
262
+ /** A complete table row on one PPTX slide, matched by cell text. */
263
+ declare interface OoxmlPptxTableRowLocation {
264
+ /** Location kind. */
265
+ kind: OoxmlHighlightKind.PptxTableRow;
266
+ /** Plain text of each cell, in column order. */
267
+ cells: string[];
268
+ /** 1-based matching row on the specified slide. */
269
+ occurrence: number;
270
+ /** 1-based slide number. */
271
+ slide: number;
272
+ }
273
+
246
274
  /** A cited cell, or contiguous same-row cell range, on a named XLSX sheet. */
247
275
  declare interface OoxmlXlsxHighlightLocation {
248
276
  /** Discriminates this location within `OoxmlHighlightLocation`. */
@@ -150,6 +150,17 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
150
150
  };
151
151
  }, R = (e) => {
152
152
  switch (e.type) {
153
+ case "docx_text_anchor": return {
154
+ kind: i.DocxTableRow,
155
+ cells: e.cells,
156
+ occurrence: e.occurrence
157
+ };
158
+ case "pptx_text_anchor": return {
159
+ kind: i.PptxTableRow,
160
+ cells: e.cells,
161
+ occurrence: e.occurrence,
162
+ slide: e.slide
163
+ };
153
164
  case "docx_text_range": return {
154
165
  kind: i.DocxTextRange,
155
166
  story: e.story,
package/index.d.ts CHANGED
@@ -525,6 +525,13 @@ export declare const buildSkillManifestFromFrontmatter: (baseFrontmatter: Record
525
525
  * authored it, when it last changed, and its file inventory. Grouping folders
526
526
  * in the file listing are excluded from both the count and the rows. Sizes are
527
527
  * not shown — the skill metadata carries no content-length field.
528
+ *
529
+ * `skill` is the authoritative `getSkillMetadata` response when that request
530
+ * fulfilled; the caller falls back to the catalog listing entry only when it
531
+ * rejected (`useSkillItemDetails`'s `onFetchSkillDetails`). Either way, this
532
+ * function never fills a gap in one source from the other — an absent
533
+ * `author` omits the row and an absent `updatedAt` leaves the updated row's
534
+ * value empty, exactly as `skill` carries it.
528
535
  */
529
536
  export declare const buildSkillOverview: (skill: SkillMetadataItemDto | undefined, files: SkillMetadataItemDto[], about: SkillAboutDetails | undefined, labels: SkillOverviewLabels) => CatalogItemOverview;
530
537
 
@@ -2571,6 +2578,16 @@ declare interface OoxmlDocxHighlightLocation {
2571
2578
  text: string;
2572
2579
  }
2573
2580
 
2581
+ /** A complete table row in the DOCX body, matched by cell text. */
2582
+ declare interface OoxmlDocxTableRowLocation {
2583
+ /** Location kind. */
2584
+ kind: OoxmlHighlightKind.DocxTableRow;
2585
+ /** Plain text of each cell, in column order. */
2586
+ cells: string[];
2587
+ /** 1-based matching row in document order. */
2588
+ occurrence: number;
2589
+ }
2590
+
2574
2591
  /** Supported document formats rendered by the installed `@silurus/ooxml` runtime. */
2575
2592
  declare enum OoxmlFileType {
2576
2593
  Docx = 'docx',
@@ -2593,6 +2610,10 @@ declare enum OoxmlHighlightKind {
2593
2610
  DocxTextRange = 'docxTextRange',
2594
2611
  /** A character range inside a single PPTX shape on one slide. */
2595
2612
  PptxTextRange = 'pptxTextRange',
2613
+ /** A complete DOCX table row identified by its cell text. */
2614
+ DocxTableRow = 'docxTableRow',
2615
+ /** A complete PPTX table row identified by its cell text on one slide. */
2616
+ PptxTableRow = 'pptxTableRow',
2596
2617
  /** One cell, or a contiguous same-row cell range, on a named XLSX sheet. */
2597
2618
  XlsxCellRange = 'xlsxCellRange',
2598
2619
  }
@@ -2601,6 +2622,8 @@ declare enum OoxmlHighlightKind {
2601
2622
  declare type OoxmlHighlightLocation =
2602
2623
  | OoxmlDocxHighlightLocation
2603
2624
  | OoxmlPptxHighlightLocation
2625
+ | OoxmlDocxTableRowLocation
2626
+ | OoxmlPptxTableRowLocation
2604
2627
  | OoxmlXlsxHighlightLocation;
2605
2628
 
2606
2629
  /** A cited character range inside a single shape on one PPTX slide. */
@@ -2619,6 +2642,18 @@ declare interface OoxmlPptxHighlightLocation {
2619
2642
  text: string;
2620
2643
  }
2621
2644
 
2645
+ /** A complete table row on one PPTX slide, matched by cell text. */
2646
+ declare interface OoxmlPptxTableRowLocation {
2647
+ /** Location kind. */
2648
+ kind: OoxmlHighlightKind.PptxTableRow;
2649
+ /** Plain text of each cell, in column order. */
2650
+ cells: string[];
2651
+ /** 1-based matching row on the specified slide. */
2652
+ occurrence: number;
2653
+ /** 1-based slide number. */
2654
+ slide: number;
2655
+ }
2656
+
2622
2657
  /** A cited cell, or contiguous same-row cell range, on a named XLSX sheet. */
2623
2658
  declare interface OoxmlXlsxHighlightLocation {
2624
2659
  /** Discriminates this location within `OoxmlHighlightLocation`. */
@@ -3234,6 +3269,12 @@ export declare interface SkillDetailsApi {
3234
3269
  limit?: number;
3235
3270
  recursive?: boolean;
3236
3271
  }, signal?: AbortSignal): Promise<SkillFileListResponseDto>;
3272
+ /**
3273
+ * Fetches a single skill's own authoritative metadata (`author`,
3274
+ * `updatedAt`, and the rest of `SkillMetadataItemDto`) — not the catalog
3275
+ * listing entry, which may be sparse for a shared skill.
3276
+ */
3277
+ getSkillMetadata(bucket: string, path: string, signal?: AbortSignal): Promise<SkillMetadataItemDto>;
3237
3278
  }
3238
3279
 
3239
3280
  /** Already-configured DIAL Core download operations `useSkillEditorLoad` needs. */
@@ -5532,10 +5573,11 @@ export declare interface UseSkillFilePreviewResult {
5532
5573
 
5533
5574
  /**
5534
5575
  * Headless hook that encapsulates skill detail fetching: manifest download and
5535
- * parse, package file listing, overview construction, and in-package file
5536
- * loads. `useCatalogItemDetails` delegates its skill branch here; hosts that
5537
- * only surface skill details consume this hook directly, without the
5538
- * deployment and prompt ports the full catalog pipeline requires.
5576
+ * parse, package file listing, authoritative metadata fetching, overview
5577
+ * construction, and in-package file loads. `useCatalogItemDetails` delegates
5578
+ * its skill branch here; hosts that only surface skill details consume this
5579
+ * hook directly, without the deployment and prompt ports the full catalog
5580
+ * pipeline requires.
5539
5581
  */
5540
5582
  export declare const useSkillItemDetails: ({ api, skills, skillOverviewLabels, }: UseSkillItemDetailsOptions) => UseSkillItemDetailsResult;
5541
5583
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-hooks",
3
3
  "description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
4
- "version": "1.1.0-rc.2",
4
+ "version": "1.1.0-rc.3",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -106,7 +106,7 @@
106
106
  }
107
107
  },
108
108
  "dependencies": {
109
- "@epam/ai-dial-chat-api-client": "1.1.0-rc.2",
109
+ "@epam/ai-dial-chat-api-client": "1.1.0-rc.3",
110
110
  "dompurify": "3.4.15",
111
111
  "fflate": "^0.8.3",
112
112
  "lru-cache": "^10.4.3",
@@ -115,20 +115,20 @@
115
115
  },
116
116
  "peerDependencies": {
117
117
  "react": "^19.2.8",
118
- "@epam/ai-dial-attachment-canvas": "1.1.0-rc.2",
119
- "@epam/ai-dial-attachment-input": "1.1.0-rc.2",
120
- "@epam/ai-dial-builder-form": "1.1.0-rc.2",
121
- "@epam/ai-dial-catalog": "1.1.0-rc.2",
122
- "@epam/ai-dial-chat-overlay": "1.1.0-rc.2",
123
- "@epam/ai-dial-chat-shared": "1.1.0-rc.2",
124
- "@epam/ai-dial-mcp-apps": "1.1.0-rc.2",
125
- "@epam/ai-dial-publish-panel": "1.1.0-rc.2",
126
- "@epam/ai-dial-quotations": "1.1.0-rc.2",
118
+ "@epam/ai-dial-attachment-canvas": "1.1.0-rc.3",
119
+ "@epam/ai-dial-attachment-input": "1.1.0-rc.3",
120
+ "@epam/ai-dial-builder-form": "1.1.0-rc.3",
121
+ "@epam/ai-dial-catalog": "1.1.0-rc.3",
122
+ "@epam/ai-dial-chat-overlay": "1.1.0-rc.3",
123
+ "@epam/ai-dial-chat-shared": "1.1.0-rc.3",
124
+ "@epam/ai-dial-mcp-apps": "1.1.0-rc.3",
125
+ "@epam/ai-dial-publish-panel": "1.1.0-rc.3",
126
+ "@epam/ai-dial-quotations": "1.1.0-rc.3",
127
127
  "@epam/ai-dial-react-file-manager": "^0.2.0",
128
- "@epam/ai-dial-scheduled-tasks": "1.1.0-rc.2",
129
- "@epam/ai-dial-share": "1.1.0-rc.2",
130
- "@epam/ai-dial-skill-editor": "1.1.0-rc.2",
131
- "@epam/ai-dial-source-panel": "1.1.0-rc.2",
128
+ "@epam/ai-dial-scheduled-tasks": "1.1.0-rc.3",
129
+ "@epam/ai-dial-share": "1.1.0-rc.3",
130
+ "@epam/ai-dial-skill-editor": "1.1.0-rc.3",
131
+ "@epam/ai-dial-source-panel": "1.1.0-rc.3",
132
132
  "@epam/ai-dial-ui-kit": "^0.14.2",
133
133
  "@modelcontextprotocol/sdk": "^1.29.0",
134
134
  "@epam/pdf-highlighter-kit": "^0.0.19",