@burdenoff/fe-libs 2026.912.4 → 2026.912.6

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.
@@ -4,6 +4,29 @@ export declare const MAX_ATTACHMENTS = 5;
4
4
  /** Per-file ceiling before downscaling (images) / rejection (everything else). */
5
5
  export declare const MAX_FILE_BYTES: number;
6
6
  /** Per-file inline budget for text-like content, in characters. */
7
+ /**
8
+ * Media types a provider will accept as a URL-only `file` part.
9
+ *
10
+ * ★ An ALLOW-list on purpose. The provider SDK throws
11
+ * `UnsupportedFunctionalityError: media type: <x>` for anything outside its
12
+ * accepted set, and that throw kills the turn silently — so an unknown type
13
+ * must be DROPPED, never forwarded hopefully. Widen this only once the
14
+ * provider genuinely accepts the type.
15
+ *
16
+ * `text/plain` is here because it is the one text type providers take
17
+ * verbatim. Every other text type (`text/markdown`, `text/csv`, …) is dropped
18
+ * and reaches the model through the inlined prompt block instead — the same
19
+ * content, by a channel that cannot fail.
20
+ */
21
+ export declare const PROVIDER_READABLE_FILE_MEDIA_TYPES: readonly ["application/pdf", "text/plain"];
22
+ /**
23
+ * Whether a `file` part carrying this media type is safe to send.
24
+ *
25
+ * Case- and parameter-insensitive, because a browser may report
26
+ * `text/plain; charset=utf-8`. Images are accepted for completeness though
27
+ * they normally travel as `image` parts with inline bytes.
28
+ */
29
+ export declare function isProviderReadableFilePart(mimeType: string | undefined): boolean;
7
30
  export declare const MAX_INLINE_CHARS_PER_FILE = 8000;
8
31
  /** Total inline budget across all attachments in one turn. */
9
32
  export declare const MAX_INLINE_CHARS_TOTAL = 20000;
@@ -1 +1 @@
1
- {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/attachments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,e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AAY,CAC1B,OAAO,EAAE,MAAM,GACd;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAG7C;AAwHD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,mBAAmB,EAAE,GACjC,mBAAmB,EAAE,GAAG,SAAS,CA4DnC"}
@@ -1,12 +1,18 @@
1
1
  import { MAX_REQUEST_BODY_BYTES as e } from "./gatewayLimits.js";
2
2
  import { formatPageRanges as t, isMostlyImagePages as n, truncatePagesForInline as r } from "./documentText.js";
3
3
  //#region src/shared/assistant/attachments.ts
4
- var i = 5, a = 10 * 1024 * 1024, o = 8e3, s = 2e4, c = class extends Error {
4
+ var i = 5, a = 10 * 1024 * 1024, o = ["application/pdf", "text/plain"];
5
+ function s(e) {
6
+ if (!e) return !1;
7
+ let t = e.split(";")[0]?.trim().toLowerCase() ?? "";
8
+ return t.startsWith("image/") ? !0 : o.includes(t);
9
+ }
10
+ var c = 8e3, l = 2e4, u = class extends Error {
5
11
  constructor(e) {
6
12
  super(e), this.reason = e, this.name = "AttachmentRejectedError";
7
13
  }
8
14
  };
9
- function l(e) {
15
+ function d(e) {
10
16
  return {
11
17
  id: e.id,
12
18
  filename: e.filename,
@@ -16,7 +22,7 @@ function l(e) {
16
22
  fileId: e.fileId
17
23
  };
18
24
  }
19
- var u = new Set([
25
+ var f = new Set([
20
26
  "txt",
21
27
  "md",
22
28
  "markdown",
@@ -40,48 +46,48 @@ var u = new Set([
40
46
  "toml",
41
47
  "conf"
42
48
  ]);
43
- function d(e) {
49
+ function p(e) {
44
50
  let t = e.lastIndexOf(".");
45
51
  return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
46
52
  }
47
- function f(e, t) {
48
- return e.startsWith("image/") ? "image" : e.startsWith("text/") || e === "application/json" || e === "application/xml" || e === "application/x-yaml" || u.has(d(t)) ? "text" : "document";
53
+ function m(e, t) {
54
+ return e.startsWith("image/") ? "image" : e.startsWith("text/") || e === "application/json" || e === "application/xml" || e === "application/x-yaml" || f.has(p(t)) ? "text" : "document";
49
55
  }
50
- var p = {
56
+ var h = {
51
57
  "application/pdf": "pdf",
52
58
  "application/x-pdf": "pdf",
53
59
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
54
60
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx"
55
- }, m = {
61
+ }, g = {
56
62
  pdf: "pdf",
57
63
  docx: "docx",
58
64
  xlsx: "xlsx"
59
65
  };
60
- function h(e, t) {
61
- return p[e.toLowerCase()] ?? m[d(t)] ?? null;
66
+ function ee(e, t) {
67
+ return h[e.toLowerCase()] ?? g[p(t)] ?? null;
62
68
  }
63
- var g = [
69
+ var _ = [
64
70
  "image/*",
65
71
  "text/*",
66
- ...[...u].map((e) => `.${e}`),
67
- ...Object.keys(m).map((e) => `.${e}`)
72
+ ...[...f].map((e) => `.${e}`),
73
+ ...Object.keys(g).map((e) => `.${e}`)
68
74
  ].join(",");
69
- function _(e) {
75
+ function v(e) {
70
76
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
71
77
  }
72
- function v(e, t) {
78
+ function y(e, t) {
73
79
  return e > 0 || t.some((e) => e.status === "pending" || e.status === "uploading");
74
80
  }
75
- function y(e) {
81
+ function b(e) {
76
82
  return e.filter((e) => e.status === "ready");
77
83
  }
78
- function b(e, t) {
79
- return v(e, t) ? "in-flight" : t.some((e) => e.status === "error") ? "failed" : null;
80
- }
81
84
  function x(e, t) {
82
- return t >= 5 ? "too-many" : e.size === 0 ? "empty" : e.size > 10485760 && !e.type.startsWith("image/") ? "too-large" : null;
85
+ return y(e, t) ? "in-flight" : t.some((e) => e.status === "error") ? "failed" : null;
83
86
  }
84
87
  function S(e, t) {
88
+ return t >= 5 ? "too-many" : e.size === 0 ? "empty" : e.size > 10485760 && !e.type.startsWith("image/") ? "too-large" : null;
89
+ }
90
+ function C(e, t) {
85
91
  if (e.length <= t) return {
86
92
  text: e,
87
93
  truncated: !1
@@ -92,20 +98,20 @@ function S(e, t) {
92
98
  truncated: !0
93
99
  };
94
100
  }
95
- function C(e) {
101
+ function w(e) {
96
102
  return [
97
103
  " ```",
98
104
  ...e.split("\n").map((e) => ` ${e}`),
99
105
  " ```"
100
106
  ];
101
107
  }
102
- function w(e) {
108
+ function T(e) {
103
109
  return e?.pageNumbers?.length ? e.pageNumbers : e?.pagesIncluded ? Array.from({ length: e.pagesIncluded }, (e, t) => t + 1) : [];
104
110
  }
105
- function T(e) {
111
+ function E(e) {
106
112
  let n = e.extraction, r = [];
107
113
  if (n?.pageCount) {
108
- let e = w(n);
114
+ let e = T(n);
109
115
  e.length >= n.pageCount ? r.push(`${n.pageCount} page${n.pageCount === 1 ? "" : "s"}`) : e.length === 1 ? r.push(`page ${e[0]} of ${n.pageCount}`) : r.push(`pages ${t(e)} of ${n.pageCount}`);
110
116
  }
111
117
  if (n?.sheetNames?.length && r.push(`sheets: ${n.sheetNames.join(", ")}`), e.textTruncated && e.textContent) {
@@ -114,11 +120,11 @@ function T(e) {
114
120
  }
115
121
  return r.length > 0 ? ` (${r.join("; ")})` : "";
116
122
  }
117
- var E = " Do NOT guess at, summarise or characterise its contents — you have not seen them.", D = [" Fetch the URL above if you can; otherwise ask the user to paste the relevant section as text.", E];
118
- function O(e) {
123
+ var D = " Do NOT guess at, summarise or characterise its contents — you have not seen them.", O = [" Fetch the URL above if you can; otherwise ask the user to paste the relevant section as text.", D];
124
+ function k(e) {
119
125
  let n = e.extraction;
120
126
  if (!n?.pageCount) return [];
121
- let r = new Set(w(n)), i = new Set(n.imagePages ?? []), a = [...i].filter((e) => !r.has(e)).sort((e, t) => e - t), o = [];
127
+ let r = new Set(T(n)), i = new Set(n.imagePages ?? []), a = [...i].filter((e) => !r.has(e)).sort((e, t) => e - t), o = [];
122
128
  if (a.length > 0) {
123
129
  let e = a.length === 1 ? `Page ${a[0]}` : `Pages ${t(a)}`;
124
130
  o.push(` ${e} of this document contain no extractable text — they are images.`, " Nothing about those pages is available to you.");
@@ -129,31 +135,31 @@ function O(e) {
129
135
  let e = s.length === 1 ? `Page ${s[0]}` : `Pages ${t(s)}`;
130
136
  o.push(` ${e} of this document ${s.length === 1 ? "was" : "were"} not read at all.`);
131
137
  }
132
- return o.length > 0 && o.push(E), o;
138
+ return o.length > 0 && o.push(D), o;
133
139
  }
134
- function k(e) {
140
+ function A(e) {
135
141
  let t = e.extraction;
136
142
  if (!t || t.status === "unsupported") return [" Binary file — contents not inlined. Fetch the URL above if you can; otherwise ask the user", " to paste the relevant section as text."];
137
143
  if (t.status === "no-text") return t.format === "docx" || t.format === "xlsx" ? [
138
144
  " NO TEXT AVAILABLE — this document holds no readable text; it is either empty or contains only",
139
145
  " images, charts or drawings, none of which carry text. No text could be extracted.",
140
- ...D
146
+ ...O
141
147
  ] : [
142
148
  ` NO TEXT AVAILABLE — this document appears to be scanned images; no text could be extracted${t.pagesScanned && t.pageCount && t.pagesScanned < t.pageCount ? ` (the first ${t.pagesScanned} of ${t.pageCount} pages were checked)` : ""}.`,
143
149
  " There is no text layer to read, so nothing about its contents is available to you.",
144
- ...D
150
+ ...O
145
151
  ];
146
152
  if (t.status === "encrypted") return [
147
153
  " NO TEXT AVAILABLE — this document is encrypted or password-protected; it could not be opened",
148
154
  " and no text could be extracted.",
149
- ...D
155
+ ...O
150
156
  ];
151
- if (t.status === "corrupt") return [` NO TEXT AVAILABLE — this file could not be read${t.detail ? ` (${t.detail})` : ""}; no text could be extracted.`, ...D];
157
+ if (t.status === "corrupt") return [` NO TEXT AVAILABLE — this file could not be read${t.detail ? ` (${t.detail})` : ""}; no text could be extracted.`, ...O];
152
158
  if (!e.textContent) return [
153
159
  " Text WAS extracted from this document but is omitted because this turn ran out of inline budget,",
154
160
  " not because it is unavailable. Ask the user which part matters so they can re-send just that",
155
161
  " section, or fetch the URL above if you can.",
156
- E
162
+ D
157
163
  ];
158
164
  let r = t.pagesScanned ?? t.pageCount ?? 0, i = t.textPageCount;
159
165
  if (t.pageCount && i !== void 0 && n(i, r)) {
@@ -162,25 +168,25 @@ function k(e) {
162
168
  ` NOT READ — this document is mostly images. Only ${i} of its ${t.pageCount} page${t.pageCount === 1 ? "" : "s"} carr${i === 1 ? "ies" : "y"} a text layer;`,
163
169
  ` the other ${n} contain no extractable text at all. Treat this as a document you have NOT`,
164
170
  " read: the fragment below is the whole of what was available, not a summary of the document.",
165
- ...O(e),
166
- ` The only extractable text${T(e)}:`,
167
- ...C(e.textContent)
171
+ ...k(e),
172
+ ` The only extractable text${E(e)}:`,
173
+ ...w(e.textContent)
168
174
  ];
169
175
  }
170
176
  return [
171
- ` Extracted text${T(e)}:`,
172
- ...C(e.textContent),
173
- ...O(e)
177
+ ` Extracted text${E(e)}:`,
178
+ ...w(e.textContent),
179
+ ...k(e)
174
180
  ];
175
181
  }
176
- function A(e, t, n = j) {
177
- let r = [`[${t + 1}] ${e.filename} — ${e.mimeType}, ${_(e.size)}`];
178
- return e.downloadUrl && r.push(` URL: ${e.downloadUrl}`), e.kind === "text" && e.textContent ? r.push(e.textTruncated ? ` Contents (first ${e.textContent.length} characters of ${_(e.size)}; truncated):` : " Contents:", ...C(e.textContent)) : e.kind === "document" ? r.push(...k(e)) : e.kind === "image" ? n.has(e.id) ? r.push(" NOT VIEWABLE IN THIS MESSAGE — this image did not fit the request-size budget, so only its URL", " travelled; its pixels are NOT attached. Fetch the URL above if you can; otherwise ask the user", " to describe it.", E) : r.push(" If this image is attached to the message as an image you can view, answer from what you see in it.", " If you cannot view attached images, say so plainly and ask the user to describe it — never guess.") : e.kind === "text" ? r.push(" Text file — contents omitted because this turn ran out of inline budget, not because they are", " unavailable. Fetch the URL above if you can; otherwise ask the user which part matters so they", " can re-send just that section.") : r.push(" Binary file — contents not inlined. Fetch the URL above if you can; otherwise ask the user", " to paste the relevant section as text."), r.join("\n");
182
+ function j(e, t, n = M) {
183
+ let r = [`[${t + 1}] ${e.filename} — ${e.mimeType}, ${v(e.size)}`];
184
+ return e.downloadUrl && r.push(` URL: ${e.downloadUrl}`), e.kind === "text" && e.textContent ? r.push(e.textTruncated ? ` Contents (first ${e.textContent.length} characters of ${v(e.size)}; truncated):` : " Contents:", ...w(e.textContent)) : e.kind === "document" ? r.push(...A(e)) : e.kind === "image" ? n.has(e.id) ? r.push(" NOT VIEWABLE IN THIS MESSAGE — this image did not fit the request-size budget, so only its URL", " travelled; its pixels are NOT attached. Fetch the URL above if you can; otherwise ask the user", " to describe it.", D) : r.push(" If this image is attached to the message as an image you can view, answer from what you see in it.", " If you cannot view attached images, say so plainly and ask the user to describe it — never guess.") : e.kind === "text" ? r.push(" Text file — contents omitted because this turn ran out of inline budget, not because they are", " unavailable. Fetch the URL above if you can; otherwise ask the user which part matters so they", " can re-send just that section.") : r.push(" Binary file — contents not inlined. Fetch the URL above if you can; otherwise ask the user", " to paste the relevant section as text."), r.join("\n");
179
185
  }
180
- var j = /* @__PURE__ */ new Set();
181
- function M(e, t) {
182
- let n = s, i = t, a = [...e], c = (e) => {
183
- let t = !!e.extraction, a = Math.min(n, o, t ? i : Infinity);
186
+ var M = /* @__PURE__ */ new Set();
187
+ function N(e, t) {
188
+ let n = l, i = t, a = [...e], o = (e) => {
189
+ let t = !!e.extraction, a = Math.min(n, c, t ? i : Infinity);
184
190
  if (a <= 0) return {
185
191
  ...e,
186
192
  textContent: void 0,
@@ -203,50 +209,50 @@ function M(e, t) {
203
209
  } } : {}
204
210
  });
205
211
  }
206
- let { text: s, truncated: c } = S(e.textContent ?? "", a);
207
- return n -= s.length, t && (i -= s.length), {
212
+ let { text: o, truncated: s } = C(e.textContent ?? "", a);
213
+ return n -= o.length, t && (i -= o.length), {
208
214
  ...e,
209
- textContent: s,
210
- textTruncated: e.textTruncated || c
215
+ textContent: o,
216
+ textTruncated: e.textTruncated || s
211
217
  };
212
218
  };
213
219
  for (let t of [!1, !0]) e.forEach((e, n) => {
214
- e.textContent && !!e.extraction === t && (a[n] = c(e));
220
+ e.textContent && !!e.extraction === t && (a[n] = o(e));
215
221
  });
216
222
  return a;
217
223
  }
218
- function N(e, t, n) {
219
- let r = M(e, t);
224
+ function P(e, t, n) {
225
+ let r = N(e, t);
220
226
  return [
221
227
  "",
222
228
  `--- Attachments (${e.length}) ---`,
223
229
  "The user attached the following file(s) to this message.",
224
- ...r.map((e, t) => A(e, t, n)),
230
+ ...r.map((e, t) => j(e, t, n)),
225
231
  "--- End attachments ---"
226
232
  ].join("\n");
227
233
  }
228
- var P = 2048;
229
- function F(e, t) {
230
- let n = Z(e);
234
+ var F = 2048;
235
+ function I(e, t) {
236
+ let n = Q(e);
231
237
  if (n.length === 0) return {
232
- documentChars: s,
233
- demotedImageIds: j
238
+ documentChars: l,
239
+ demotedImageIds: M
234
240
  };
235
241
  let r = (r, i, a) => {
236
- let o = new Set(n.slice(0, r).map((e) => e.id)), s = N(e, i, a), c = t ? `${t}\n${s}` : s.trimStart(), { media: l } = Q(e, o);
237
- return q(c, [{
242
+ let o = new Set(n.slice(0, r).map((e) => e.id)), s = P(e, i, a), c = t ? `${t}\n${s}` : s.trimStart(), { media: l } = $(e, o);
243
+ return J(c, [{
238
244
  type: "text",
239
245
  text: c
240
- }, ...l]) + P <= H;
246
+ }, ...l]) + F <= U;
241
247
  };
242
248
  for (let e = n.length; e >= 0; --e) {
243
249
  let t = new Set(n.slice(e).map((e) => e.id));
244
250
  if (r(e, 2e4, t)) return {
245
- documentChars: s,
251
+ documentChars: l,
246
252
  demotedImageIds: t
247
253
  };
248
254
  if (!r(e, 0, t)) continue;
249
- let i = 0, a = s;
255
+ let i = 0, a = l;
250
256
  for (; i < a;) {
251
257
  let n = Math.ceil((i + a) / 2);
252
258
  r(e, n, t) ? i = n : a = n - 1;
@@ -257,57 +263,57 @@ function F(e, t) {
257
263
  };
258
264
  }
259
265
  return {
260
- documentChars: s,
266
+ documentChars: l,
261
267
  demotedImageIds: new Set(n.map((e) => e.id))
262
268
  };
263
269
  }
264
- function I(e, t = "") {
265
- let n = y(e);
270
+ function L(e, t = "") {
271
+ let n = b(e);
266
272
  if (n.length === 0) return "";
267
- let r = F(n, t);
268
- return N(n, r.documentChars, r.demotedImageIds);
273
+ let r = I(n, t);
274
+ return P(n, r.documentChars, r.demotedImageIds);
269
275
  }
270
- function L(e, t) {
271
- let n = I(t, e);
276
+ function R(e, t) {
277
+ let n = L(t, e);
272
278
  return n ? e ? `${e}\n${n}` : n.trimStart() : e;
273
279
  }
274
- var R = 3, z = 15e5, B = e, V = 32768, H = B - V, U = 768, W = .6, G = typeof TextEncoder == "function" ? new TextEncoder() : null;
275
- function K(e) {
276
- return G ? G.encode(e).length : e.length;
280
+ var z = 3, B = 15e5, V = e, H = 32768, U = V - H, W = 768, G = .6, K = typeof TextEncoder == "function" ? new TextEncoder() : null;
281
+ function q(e) {
282
+ return K ? K.encode(e).length : e.length;
277
283
  }
278
- function q(e, t) {
279
- return K(JSON.stringify({
284
+ function J(e, t) {
285
+ return q(JSON.stringify({
280
286
  prompt: e,
281
287
  parts: t ?? []
282
288
  }));
283
289
  }
284
- function J(e) {
285
- return y(e).filter((e) => e.kind === "image" && !!(e.inlineDataUrl ?? e.previewUrl)).length;
286
- }
287
290
  function Y(e) {
288
- return (e ?? []).filter((e) => e.type === "image" && !!e.data).length;
291
+ return b(e).filter((e) => e.kind === "image" && !!(e.inlineDataUrl ?? e.previewUrl)).length;
289
292
  }
290
293
  function X(e) {
294
+ return (e ?? []).filter((e) => e.type === "image" && !!e.data).length;
295
+ }
296
+ function Z(e) {
291
297
  let t = /^data:([a-z0-9.+/-]+);base64,(.*)$/i.exec(e);
292
298
  return t ? {
293
299
  mimeType: t[1],
294
300
  base64: t[2]
295
301
  } : null;
296
302
  }
297
- function Z(e) {
303
+ function Q(e) {
298
304
  let t = [], n = 0;
299
305
  for (let r of e) {
300
306
  if (r.kind !== "image") continue;
301
- let e = r.inlineDataUrl ?? r.previewUrl, i = e ? X(e) : null;
307
+ let e = r.inlineDataUrl ?? r.previewUrl, i = e ? Z(e) : null;
302
308
  i && (t.length >= 3 || n + i.base64.length > 15e5 || (t.push(r), n += i.base64.length));
303
309
  }
304
310
  return t;
305
311
  }
306
- function Q(e, t) {
312
+ function $(e, t) {
307
313
  let n = [], r = [];
308
314
  for (let i of e) {
309
315
  if (i.kind === "image") {
310
- let e = i.inlineDataUrl ?? i.previewUrl, a = e ? X(e) : null;
316
+ let e = i.inlineDataUrl ?? i.previewUrl, a = e ? Z(e) : null;
311
317
  if (a && t.has(i.id)) {
312
318
  r.push(n.length), n.push({
313
319
  type: "image",
@@ -326,7 +332,7 @@ function Q(e, t) {
326
332
  });
327
333
  continue;
328
334
  }
329
- i.downloadUrl && n.push({
335
+ i.downloadUrl && s(i.mimeType) && n.push({
330
336
  type: "file",
331
337
  mimeType: i.mimeType,
332
338
  url: i.downloadUrl,
@@ -338,15 +344,15 @@ function Q(e, t) {
338
344
  inlinedIndices: r
339
345
  };
340
346
  }
341
- function $(e, t) {
342
- let n = y(t);
347
+ function te(e, t) {
348
+ let n = b(t);
343
349
  if (n.length === 0) return;
344
- let { media: r, inlinedIndices: i } = Q(n, new Set(Z(n).map((e) => e.id)));
350
+ let { media: r, inlinedIndices: i } = $(n, new Set(Q(n).map((e) => e.id)));
345
351
  if (r.length !== 0) {
346
- for (; i.length > 0 && q(e, [{
352
+ for (; i.length > 0 && J(e, [{
347
353
  type: "text",
348
354
  text: e
349
- }, ...r]) > H;) {
355
+ }, ...r]) > U;) {
350
356
  let e = i.pop();
351
357
  if (e === void 0) break;
352
358
  let t = r[e];
@@ -357,14 +363,14 @@ function $(e, t) {
357
363
  name: t.name
358
364
  } : r.splice(e, 1));
359
365
  }
360
- if (r.length !== 0 && !(q(e, [{
366
+ if (r.length !== 0 && !(J(e, [{
361
367
  type: "text",
362
368
  text: e
363
- }, ...r]) > H)) return [{
369
+ }, ...r]) > U)) return [{
364
370
  type: "text",
365
371
  text: e
366
372
  }, ...r];
367
373
  }
368
374
  }
369
375
  //#endregion
370
- export { g as ATTACHMENT_ACCEPT, c as AttachmentRejectedError, U as INLINE_IMAGE_MAX_DIM, W as INLINE_IMAGE_QUALITY, i as MAX_ATTACHMENTS, a as MAX_FILE_BYTES, o as MAX_INLINE_CHARS_PER_FILE, s as MAX_INLINE_CHARS_TOTAL, z as MAX_INLINE_IMAGE_BASE64_CHARS, R as MAX_INLINE_IMAGE_PARTS, H as MAX_INLINE_TURN_BODY_BYTES, B as MAX_TURN_BODY_BYTES, P as PROMPT_ENVELOPE_RESERVE_BYTES, V as TURN_BODY_HEADROOM_BYTES, I as buildAttachmentPromptBlock, $ as buildPromptParts, L as buildPromptWithAttachments, f as classifyAttachment, J as countInlineImageCandidates, Y as countInlinedImageParts, h as detectDocumentFormat, q as estimateTurnBodyBytes, _ as formatBytes, b as getAttachmentSendBlocker, d as getExtension, y as getSendableAttachments, v as hasAttachmentWorkInFlight, X as parseDataUrl, l as toMessageAttachment, S as truncateForInline, x as validateFile };
376
+ export { _ as ATTACHMENT_ACCEPT, u as AttachmentRejectedError, W as INLINE_IMAGE_MAX_DIM, G as INLINE_IMAGE_QUALITY, i as MAX_ATTACHMENTS, a as MAX_FILE_BYTES, c as MAX_INLINE_CHARS_PER_FILE, l as MAX_INLINE_CHARS_TOTAL, B as MAX_INLINE_IMAGE_BASE64_CHARS, z as MAX_INLINE_IMAGE_PARTS, U as MAX_INLINE_TURN_BODY_BYTES, V as MAX_TURN_BODY_BYTES, F as PROMPT_ENVELOPE_RESERVE_BYTES, o as PROVIDER_READABLE_FILE_MEDIA_TYPES, H as TURN_BODY_HEADROOM_BYTES, L as buildAttachmentPromptBlock, te as buildPromptParts, R as buildPromptWithAttachments, m as classifyAttachment, Y as countInlineImageCandidates, X as countInlinedImageParts, ee as detectDocumentFormat, J as estimateTurnBodyBytes, v as formatBytes, x as getAttachmentSendBlocker, p as getExtension, b as getSendableAttachments, y as hasAttachmentWorkInFlight, s as isProviderReadableFilePart, Z as parseDataUrl, d as toMessageAttachment, C as truncateForInline, S as validateFile };
@@ -34,6 +34,7 @@ export * from './createSandboxAssistantTransport';
34
34
  export * from './runtime';
35
35
  export * from './gatewayClient';
36
36
  export * from './progress';
37
+ export * from './streamBudget';
37
38
  export * from './api';
38
39
  export * from './types';
39
40
  export * from './voice/turnVisibility';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAGxB,cAAc,wBAAwB,CAAC;AAKvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,gBAAgB,CAAC;AAK/B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAG3C,cAAc,QAAQ,CAAC;AAEvB,cAAc,sBAAs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AC;AAC5B,cAAc,2BAA2B,CAAC;AAE1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,OAAO,CAAC;AACtB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { AssistantMode } from './types';
2
+ /**
3
+ * How long the client streams progress before it stops polling a turn.
4
+ *
5
+ * Chat replies (general / api-calls) finish in seconds; a vibe-plugins build is
6
+ * a multi-step pipeline (read docs → scaffold → bun install → bun build →
7
+ * checklist) that runs for minutes, so it gets a much larger budget. The sandbox
8
+ * TTL is auto-extended every 30s during the poll loop, so a longer budget never
9
+ * outlives the sandbox.
10
+ *
11
+ * ★★ THE BUDGET ELAPSING IS NOT AN ERROR. It used to be, for every mode except
12
+ * vibe-plugins: the poll loop `throw`ew, the catch wrote
13
+ * `Sorry, an error occurred: …` into the assistant message, and that error was
14
+ * PERSISTED — it survived a reload, so the turn was destroyed rather than
15
+ * merely unfinished. Measured in production on 2026-09-12 with a 10.8 KB
16
+ * markdown attachment: the turn produced no content for 206s, the client gave
17
+ * up at ~3 minutes, and re-opening the conversation showed only the error.
18
+ *
19
+ * A client-side deadline is a statement about how long THIS CLIENT will wait.
20
+ * It is not evidence that the turn failed, and it must never be allowed to
21
+ * overwrite the conversation. So the budget elapsing now yields a normal
22
+ * assistant message: whatever content arrived, plus an honest closing note.
23
+ */
24
+ export declare const STREAM_BUDGET_MS: Record<AssistantMode, number>;
25
+ export declare const DEFAULT_STREAM_BUDGET_MS = 180000;
26
+ /**
27
+ * Budget for `mode`, falling back to the default for a mode added later.
28
+ *
29
+ * Exported as a function rather than leaving callers to index the record, so a
30
+ * new mode cannot silently get `undefined` and a `NaN` deadline.
31
+ */
32
+ export declare function streamBudgetMs(mode: AssistantMode): number;
33
+ /** i18n key + English fallback for the note closing an unfinished turn. */
34
+ export interface IncompleteTurnNotice {
35
+ key: string;
36
+ fallback: string;
37
+ }
38
+ /**
39
+ * ★ NO PLACEHOLDERS IN EITHER FALLBACK, deliberately.
40
+ *
41
+ * `t()` did not interpolate single-brace placeholders until fe-libs 2026.910.7,
42
+ * and 37 app shells still pin older builds, so a `{minutes}` here would render
43
+ * raw braces to real users on most of the fleet. The elapsed budget is not worth
44
+ * that risk, and a reader does not need the number to know what to do next.
45
+ */
46
+ export declare function incompleteTurnNotice(mode: AssistantMode): IncompleteTurnNotice;
47
+ /**
48
+ * Close an unfinished turn: keep every character the turn did produce, then
49
+ * append the note for `mode`.
50
+ *
51
+ * Total function — it never throws, and never returns an empty string for a
52
+ * turn that produced nothing, because an empty assistant bubble reads as a
53
+ * silent failure. `translate` is injected rather than taken from a hook so this
54
+ * is testable without a React tree or an i18n provider.
55
+ */
56
+ export declare function withIncompleteTurnNotice(content: string, mode: AssistantMode, translate: (key: string, fallback: string) => string): string;
57
+ //# sourceMappingURL=streamBudget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamBudget.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/streamBudget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAK1D,CAAC;AAEF,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAClB,oBAAoB,CAsBtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GACnD,MAAM,CAWR"}
@@ -0,0 +1,30 @@
1
+ //#region src/shared/assistant/streamBudget.ts
2
+ var e = {
3
+ general: 18e4,
4
+ assistant: 18e4,
5
+ "api-calls": 18e4,
6
+ "vibe-plugins": 6e5
7
+ }, t = 18e4;
8
+ function n(t) {
9
+ return e[t] ?? 18e4;
10
+ }
11
+ function r(e) {
12
+ return e === "vibe-plugins" ? {
13
+ key: "assistant.turnStillBuilding",
14
+ fallback: "_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._"
15
+ } : {
16
+ key: "assistant.turnIncomplete",
17
+ fallback: "_This turn stopped before an answer arrived. Your message and any attachment are still here — send it again, or try a shorter document or a narrower question._"
18
+ };
19
+ }
20
+ function i(e, t, n) {
21
+ let i = r(t), a;
22
+ try {
23
+ a = n(i.key, i.fallback) || i.fallback;
24
+ } catch {
25
+ a = i.fallback;
26
+ }
27
+ return e.trim() ? `${e}\n\n${a}` : a;
28
+ }
29
+ //#endregion
30
+ export { t as DEFAULT_STREAM_BUDGET_MS, e as STREAM_BUDGET_MS, r as incompleteTurnNotice, n as streamBudgetMs, i as withIncompleteTurnNotice };
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAyEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAgLvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAg9DxD,CAAC"}
1
+ {"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAqEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAoKvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAs9DxD,CAAC"}