@burdenoff/fe-libs 2026.920.1 → 2026.920.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.
Files changed (42) hide show
  1. package/dist/shared/assistant/api.d.ts +17 -0
  2. package/dist/shared/assistant/api.d.ts.map +1 -1
  3. package/dist/shared/assistant/api.js +88 -66
  4. package/dist/shared/assistant/attachmentTurn.d.ts +21 -0
  5. package/dist/shared/assistant/attachmentTurn.d.ts.map +1 -0
  6. package/dist/shared/assistant/attachmentTurn.js +48 -0
  7. package/dist/shared/assistant/attachments.d.ts +85 -6
  8. package/dist/shared/assistant/attachments.d.ts.map +1 -1
  9. package/dist/shared/assistant/attachments.js +165 -112
  10. package/dist/shared/assistant/conversation.d.ts +21 -0
  11. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  12. package/dist/shared/assistant/documentExtract.d.ts +11 -2
  13. package/dist/shared/assistant/documentExtract.d.ts.map +1 -1
  14. package/dist/shared/assistant/documentExtract.js +39 -37
  15. package/dist/shared/assistant/gatewayLimits.d.ts +10 -0
  16. package/dist/shared/assistant/gatewayLimits.d.ts.map +1 -1
  17. package/dist/shared/assistant/gatewayLimits.js +2 -2
  18. package/dist/shared/assistant/index.d.ts +3 -0
  19. package/dist/shared/assistant/index.d.ts.map +1 -1
  20. package/dist/shared/assistant/preview/bridgeHost.d.ts +26 -0
  21. package/dist/shared/assistant/preview/bridgeHost.d.ts.map +1 -0
  22. package/dist/shared/assistant/preview/bridgeHost.js +16 -0
  23. package/dist/shared/assistant/preview/bridgeHostContext.d.ts +17 -0
  24. package/dist/shared/assistant/preview/bridgeHostContext.d.ts.map +1 -0
  25. package/dist/shared/assistant/preview/bridgeHostContext.js +11 -0
  26. package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -1
  27. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +4 -0
  28. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  29. package/dist/shared/assistant/ui/AIAssistantPanel.js +63 -62
  30. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  31. package/dist/shared/assistant/ui/AssistantChatArea.js +342 -325
  32. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +6 -0
  33. package/dist/shared/assistant/ui/AssistantOverlay.d.ts.map +1 -1
  34. package/dist/shared/assistant/ui/AssistantOverlay.js +93 -89
  35. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +12 -0
  36. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
  37. package/dist/shared/assistant/ui/composer/AssistantComposer.js +57 -57
  38. package/dist/shared/assistant/useAssistantAttachments.d.ts +12 -1
  39. package/dist/shared/assistant/useAssistantAttachments.d.ts.map +1 -1
  40. package/dist/shared/assistant/useAssistantAttachments.js +98 -98
  41. package/dist/shared-assistant.js +118 -115
  42. package/package.json +1 -1
@@ -3,7 +3,7 @@ import "../../shared-graphql.js";
3
3
  import { downscaleImage as t } from "../utils/imageDownscale.js";
4
4
  import { useAssistantStorageFolders as n } from "./product.js";
5
5
  import { useAssistantTr as r } from "./i18n.js";
6
- import { AttachmentRejectedError as i, INLINE_IMAGE_QUALITY as a, MAX_INLINE_CHARS_PER_FILE as o, classifyAttachment as s, detectDocumentFormat as c, getAttachmentSendBlocker as l, truncateForInline as u, validateFile as d } from "./attachments.js";
6
+ import { AttachmentRejectedError as i, INLINE_IMAGE_QUALITY as a, classifyAttachment as o, detectDocumentFormat as s, getAttachmentSendBlocker as c, resolveAssistantInlineLimits as l, truncateForInline as u, validateFile as d } from "./attachments.js";
7
7
  import { getWorkspaceId as f } from "./context.js";
8
8
  import { useSaveToFiles as p } from "../../storage/useSaveToFiles.js";
9
9
  import "../../storage/index.js";
@@ -30,58 +30,58 @@ var x = 0;
30
30
  function S() {
31
31
  return x += 1, `att-${Date.now()}-${x}`;
32
32
  }
33
- async function C(e) {
34
- let n = s(e.type, e.name), r = {
33
+ async function C(e, n) {
34
+ let r = o(e.type, e.name), c = {
35
35
  id: S(),
36
36
  status: "pending"
37
37
  };
38
- if (n === "image") {
39
- let o = await t(e, {
38
+ if (r === "image") {
39
+ let n = await t(e, {
40
40
  encodeFallback: !1,
41
41
  inline: {
42
42
  maxDim: 768,
43
43
  quality: a
44
44
  }
45
45
  });
46
- if (!o.downscaled && o.blob.size > 10485760) throw new i("unsupported-image");
46
+ if (!n.downscaled && n.blob.size > 10485760) throw new i("unsupported-image");
47
47
  return {
48
48
  attachment: {
49
- ...r,
50
- filename: o.filename,
51
- mimeType: o.mimeType,
52
- size: o.blob.size,
53
- kind: n,
54
- previewUrl: o.dataUrl || void 0,
55
- inlineDataUrl: o.inlineDataUrl
49
+ ...c,
50
+ filename: n.filename,
51
+ mimeType: n.mimeType,
52
+ size: n.blob.size,
53
+ kind: r,
54
+ previewUrl: n.dataUrl || void 0,
55
+ inlineDataUrl: n.inlineDataUrl
56
56
  },
57
- blob: o.blob
57
+ blob: n.blob
58
58
  };
59
59
  }
60
- if (n === "text") {
61
- let { text: t, truncated: i } = u(await e.text(), o);
60
+ if (r === "text") {
61
+ let { text: t, truncated: i } = u(await e.text(), n);
62
62
  return {
63
63
  attachment: {
64
- ...r,
64
+ ...c,
65
65
  filename: e.name,
66
66
  mimeType: e.type || "text/plain",
67
67
  size: e.size,
68
- kind: n,
68
+ kind: r,
69
69
  textContent: t,
70
70
  textTruncated: i
71
71
  },
72
72
  blob: e
73
73
  };
74
74
  }
75
- let l = c(e.type, e.name);
75
+ let l = s(e.type, e.name);
76
76
  if (l) {
77
- let t = await m(e, l);
77
+ let t = await m(e, l, n);
78
78
  return {
79
79
  attachment: {
80
- ...r,
80
+ ...c,
81
81
  filename: e.name,
82
82
  mimeType: e.type || "application/octet-stream",
83
83
  size: e.size,
84
- kind: n,
84
+ kind: r,
85
85
  extraction: t.extraction,
86
86
  textContent: t.textContent,
87
87
  textTruncated: t.textTruncated,
@@ -92,131 +92,131 @@ async function C(e) {
92
92
  }
93
93
  return {
94
94
  attachment: {
95
- ...r,
95
+ ...c,
96
96
  filename: e.name,
97
97
  mimeType: e.type || "application/octet-stream",
98
98
  size: e.size,
99
- kind: n
99
+ kind: r
100
100
  },
101
101
  blob: e
102
102
  };
103
103
  }
104
- function w() {
105
- let e = r(), t = n(), { save: a } = p(), [o, s] = v([]), [c, u] = v(null), m = _(Promise.resolve()), [y, x] = v(0), S = _(0), w = _(/* @__PURE__ */ new Map()), T = _(/* @__PURE__ */ new Set()), E = _(0), D = _(!0);
104
+ function w(e = {}) {
105
+ let t = r(), a = l({ maxInlineCharsPerFile: e.perFileChars }).perFileChars, o = n(), { save: s } = p(), [u, m] = v([]), [y, x] = v(null), S = _(Promise.resolve()), [w, T] = v(0), E = _(0), D = _(/* @__PURE__ */ new Map()), O = _(/* @__PURE__ */ new Set()), k = _(0), A = _(!0);
106
106
  g(() => () => {
107
- D.current = !1;
107
+ A.current = !1;
108
108
  }, []);
109
- let O = _([]);
109
+ let j = _([]);
110
110
  g(() => {
111
- O.current = o;
112
- }, [o]);
113
- let k = h((e, t) => {
114
- D.current && s((n) => n.map((n) => n.id === e ? {
111
+ j.current = u;
112
+ }, [u]);
113
+ let M = h((e, t) => {
114
+ A.current && m((n) => n.map((n) => n.id === e ? {
115
115
  ...n,
116
116
  ...t
117
117
  } : n));
118
- }, []), A = h(async ({ attachment: n, blob: r }) => {
119
- if (!T.current.has(n.id)) {
120
- k(n.id, {
118
+ }, []), N = h(async ({ attachment: e, blob: n }) => {
119
+ if (!O.current.has(e.id)) {
120
+ M(e.id, {
121
121
  status: "uploading",
122
122
  progressNote: void 0
123
123
  });
124
124
  try {
125
- let i = await a({
125
+ let r = await s({
126
126
  source: {
127
127
  kind: "blob",
128
- filename: n.filename,
129
- mimeType: n.mimeType,
128
+ filename: e.filename,
129
+ mimeType: e.mimeType,
130
130
  getBlob: async () => ({
131
- blob: r,
132
- filename: n.filename,
133
- mimeType: n.mimeType
131
+ blob: n,
132
+ filename: e.filename,
133
+ mimeType: e.mimeType
134
134
  })
135
135
  },
136
- folderPath: t.attachments,
137
- onRetry: (t) => {
138
- T.current.has(n.id) || k(n.id, { progressNote: t.kind === "cold-start" ? e("attachments.waking", "File service is starting up — retry {{attempt}} of {{max}}", {
139
- attempt: String(t.attempt),
140
- max: String(t.maxAttempts)
141
- }) : e("attachments.retrying", "Retrying {{attempt}} of {{max}}", {
142
- attempt: String(t.attempt),
143
- max: String(t.maxAttempts)
136
+ folderPath: o.attachments,
137
+ onRetry: (n) => {
138
+ O.current.has(e.id) || M(e.id, { progressNote: n.kind === "cold-start" ? t("attachments.waking", "File service is starting up — retry {{attempt}} of {{max}}", {
139
+ attempt: String(n.attempt),
140
+ max: String(n.maxAttempts)
141
+ }) : t("attachments.retrying", "Retrying {{attempt}} of {{max}}", {
142
+ attempt: String(n.attempt),
143
+ max: String(n.maxAttempts)
144
144
  }) });
145
145
  }
146
146
  });
147
- if (T.current.has(n.id)) return;
148
- let o = i?.id ? await b(i.id, f()) : null;
149
- if (T.current.has(n.id)) return;
150
- k(n.id, {
147
+ if (O.current.has(e.id)) return;
148
+ let i = r?.id ? await b(r.id, f()) : null;
149
+ if (O.current.has(e.id)) return;
150
+ M(e.id, {
151
151
  status: "ready",
152
- fileId: i?.id,
153
- downloadUrl: o ?? void 0,
152
+ fileId: r?.id,
153
+ downloadUrl: i ?? void 0,
154
154
  progressNote: void 0
155
155
  });
156
- } catch (e) {
157
- if (T.current.has(n.id)) return;
158
- if (n.kind === "text" || n.textContent) {
159
- k(n.id, {
156
+ } catch (t) {
157
+ if (O.current.has(e.id)) return;
158
+ if (e.kind === "text" || e.textContent) {
159
+ M(e.id, {
160
160
  status: "ready",
161
161
  progressNote: void 0
162
162
  });
163
163
  return;
164
164
  }
165
- k(n.id, {
165
+ M(e.id, {
166
166
  status: "error",
167
- error: e instanceof Error ? e.message : "Upload failed",
167
+ error: t instanceof Error ? t.message : "Upload failed",
168
168
  progressNote: void 0
169
169
  });
170
170
  }
171
171
  }
172
172
  }, [
173
- k,
174
- a,
175
- e
176
- ]), j = h((e) => {
173
+ M,
174
+ s,
175
+ t
176
+ ]), P = h((e) => {
177
177
  if (!e) return;
178
178
  let t = Array.from(e);
179
179
  if (t.length === 0) return;
180
- u(null);
180
+ x(null);
181
181
  let n = [];
182
182
  for (let e of t) {
183
- let t = d(e, E.current);
183
+ let t = d(e, k.current);
184
184
  if (t) {
185
- u(t);
185
+ x(t);
186
186
  continue;
187
187
  }
188
- n.push(e), E.current += 1;
188
+ n.push(e), k.current += 1;
189
189
  }
190
190
  if (n.length !== 0) {
191
- x((e) => e + n.length);
191
+ T((e) => e + n.length);
192
192
  for (let e of n) {
193
- let t = S.current;
194
- m.current = m.current.then(async () => {
193
+ let t = E.current;
194
+ S.current = S.current.then(async () => {
195
195
  let n = null;
196
196
  try {
197
- n = await C(e);
197
+ n = await C(e, a);
198
198
  } catch (e) {
199
- E.current = Math.max(0, E.current - 1), D.current && u(e instanceof i ? e.reason : "unreadable");
199
+ k.current = Math.max(0, k.current - 1), A.current && x(e instanceof i ? e.reason : "unreadable");
200
200
  }
201
- if (!D.current || (x((e) => Math.max(0, e - 1)), !n)) return;
202
- if (t !== S.current) {
203
- E.current = Math.max(0, E.current - 1);
201
+ if (!A.current || (T((e) => Math.max(0, e - 1)), !n)) return;
202
+ if (t !== E.current) {
203
+ k.current = Math.max(0, k.current - 1);
204
204
  return;
205
205
  }
206
206
  let r = n;
207
- w.current.set(r.attachment.id, r.blob), s((e) => [...e, r.attachment]), await A(r);
207
+ D.current.set(r.attachment.id, r.blob), m((e) => [...e, r.attachment]), await N(r);
208
208
  });
209
209
  }
210
210
  }
211
- }, [A]), M = h((e) => {
212
- T.current.add(e), w.current.delete(e), E.current = Math.max(0, E.current - 1), s((t) => t.filter((t) => t.id !== e));
213
- }, []), N = h((e) => {
214
- let t = O.current.find((t) => t.id === e), n = w.current.get(e);
215
- !t || t.status !== "error" || !n || (T.current.delete(e), k(e, {
211
+ }, [N, a]), F = h((e) => {
212
+ O.current.add(e), D.current.delete(e), k.current = Math.max(0, k.current - 1), m((t) => t.filter((t) => t.id !== e));
213
+ }, []), I = h((e) => {
214
+ let t = j.current.find((t) => t.id === e), n = D.current.get(e);
215
+ !t || t.status !== "error" || !n || (O.current.delete(e), M(e, {
216
216
  status: "pending",
217
217
  error: void 0,
218
218
  progressNote: void 0
219
- }), m.current = m.current.then(() => A({
219
+ }), S.current = S.current.then(() => N({
220
220
  attachment: {
221
221
  ...t,
222
222
  status: "pending",
@@ -224,21 +224,21 @@ function w() {
224
224
  },
225
225
  blob: n
226
226
  })));
227
- }, [k, A]), P = h(() => {
228
- S.current += 1, E.current = 0, O.current.forEach((e) => T.current.add(e.id)), w.current.clear(), s([]);
229
- }, []), F = l(y, o);
227
+ }, [M, N]), L = h(() => {
228
+ E.current += 1, k.current = 0, j.current.forEach((e) => O.current.add(e.id)), D.current.clear(), m([]);
229
+ }, []), R = c(w, u);
230
230
  return {
231
- attachments: o,
232
- isBusy: F === "in-flight",
233
- preparingCount: y,
234
- sendBlocker: F,
235
- rejection: c,
236
- addFiles: j,
237
- remove: M,
238
- retry: N,
239
- clear: P,
240
- clearRejection: h(() => u(null), []),
241
- canAddMore: E.current < 5
231
+ attachments: u,
232
+ isBusy: R === "in-flight",
233
+ preparingCount: w,
234
+ sendBlocker: R,
235
+ rejection: y,
236
+ addFiles: P,
237
+ remove: F,
238
+ retry: I,
239
+ clear: L,
240
+ clearRejection: h(() => x(null), []),
241
+ canAddMore: k.current < 5
242
242
  };
243
243
  }
244
244
  //#endregion