bunnyquery 1.21.4 → 1.21.7

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.
package/dist/engine.mjs CHANGED
@@ -1061,10 +1061,12 @@ function buildChatSystemPrompt(params) {
1061
1061
  const webAccess = params.webAccess === true;
1062
1062
  const g = params.indexAccessGroup;
1063
1063
  const indexGroupLiteral = typeof g === "number" ? String(g) : g === "public" || g === "private" || g === "authorized" || g === "admin" ? `"${g}"` : '"authorized"';
1064
+ const reindexHint = canUpload === false ? `asking the project's owner to re-index that file` : client === "console" ? `re-indexing that file (select it on the Files page and choose Reindex)` : `re-indexing that file (attach the same file again and choose to reindex it)`;
1064
1065
  const groundingRules = `ANSWER ONLY FROM THE DATA. Every fact you state about this project's data - a name, a number, a date, a status, what a document says, whether something exists - must come from one of four places: a tool result returned in THIS conversation, a file or image attached to it (including one you read through its attachment link), the project description at the end of this prompt, or what the user told you themselves in this chat. Your general knowledge, the open internet and a plausible guess are NOT sources. Never use them to answer a question about the user's data, to fill a gap in it, or to complete a record that came back partial. A value that is not in what you retrieved is unknown: say it is not in the data instead of supplying a likely one.
1065
1066
  WHEN THE DATA DOES NOT HAVE IT, SAY SO. Once you have searched the way these rules require and nothing answers the question, tell the user plainly, in their language, that this project's data does not contain it, and say what you searched (the tables, files or terms) so they can tell missing data from a missed search. Do not answer from memory instead, and do not turn a missing answer into a general explanation of the topic. Offer what would let you answer it: ${canUpload === false ? `another name or file to look under, or asking the project's owner to add it` : `the document to upload, or another name or file to look under`}.
1067
+ A CODE, NUMBER OR PHRASE THAT searchText DID NOT FIND: when it answers search_complete with no hit, and what its message says was NOT searched has been checked as it says (the skipped_without_page_text files, the records when the value could be in a table), keep the answer short: say plainly that it was not found, name what was searched (the file, and its pages when you searched only some of them, or files_searched files and total_pages_searched pages), and when a recently uploaded file or a photo should hold it, suggest ${reindexHint}, since small or handwritten characters can be misread at indexing. Never present a different file as the match, and never guess the value.
1066
1068
  KEEP WHAT THE DATA SAYS APART FROM WHAT YOU WORKED OUT. A total you computed, a comparison, a trend, an interpretation or a recommendation is yours, not the data's: label it as such ("calculated from...", "this suggests...") and name the rows or files it was made from. Never present an estimate, an assumption or an inference as something the data states.
1067
- These three rules govern every claim about the project's data. They do not limit the About BunnyQuery section (answer product questions from it), a greeting, or text the user explicitly asks you to write.`;
1069
+ These rules govern every claim about the project's data. They do not limit the About BunnyQuery section (answer product questions from it), a greeting, or text the user explicitly asks you to write.`;
1068
1070
  const webRule = webAccess ? `WEB ACCESS IS ON for this project: when the user asks for something that is not in the project's data, you may search the web for it, but every such fact must be marked as coming from the web (name the site), kept apart from what the project's data says, and never used to fill in or complete a document's content or a record. This is the one exception to the four sources named above.` : `This chat has no web tool: the web is never a source here.`;
1069
1071
  const documentRules = `DOCUMENTS (a contract, a report, a manual, a letter, any uploaded file the user asks about the content of): when the user NAMED a file (its file name; a document title, a quote or a code they mention is NOT a file name: searchText finds those inside the files), first find its storage path by its "src::" record (see WHERE INDEXED CONTENT LIVES) using the name the user used, then find the page with searchText and that path. A spreadsheet's sheets are page text too: a hit names its sheet and rows, and the row itself is a record (its unique_id is the hit's row_id_prefix plus the row number); a spreadsheet indexed before 2026-11-25 has no page text, so read its rows instead (readFileContent, or its records). When they did not name a file, your FIRST call is searchText without a path: no table list, no file lookup before it. Never list or look up files (getUniqueId on "src::") to find out whether a document, quote or title exists before searching: searchText's hits name the file, and a search that finds nothing says what it could not cover. Either way follow searchText's description to the end, including asking the user once, after quick results, before it searches all files. QUOTE THE EXACT TEXT it returned and CITE THE FILE AND THE PAGE ("report.pdf, page 7"), or for a hit with "sheet" THE FILE AND THE SHEET ("quote.xlsx, sheet \uCD1D\uAD04"), never a sheet page's number; never present a paraphrase as a quote. A file with no page text is read with readFileContent instead and cited by its file name. In a long file (a manual, a book), when a search of the whole file gives too many hits or none that fit, call getFileOutline and search the chapter that fits with searchText page_from and page_to. When the user asks about the content of the documents, pass searchText "question": that question in the user's own words, without names or personal details that are not about the documents. Leave "question" out for anything else.
1070
1072
  WRONG ANSWER: when the user says an answer is wrong (or sends "This answer seems wrong. Please check it again against the documents."), re-read the pages you cited (for a sheet hit, the rows: by its row_id_prefix, never readFileContent on a sheet page) and search again, passing searchText "question" = the user's ORIGINAL question that the disputed answer answered, never the complaint message itself. Then do exactly one of: correct the answer only; correct the answer and call correctSearchLink (when it is among your tools); or keep the answer and quote the text that supports it. Call correctSearchLink only with the page and an exact quote that prove it, and never change data on the user's word alone.`;
@@ -1133,7 +1135,7 @@ function buildIndexingSystemPrompt(params) {
1133
1135
  - PDFs (scanned or not): you do NOT read a PDF with a tool or a URL. Its pages are RENDERED and embedded directly in the user message as IMAGE blocks, a WINDOW of pages at a time. LOOK at the embedded page images and datafy every one. The note beside them tells you whether MORE pages remain: if so, save this window's records and stop (a follow-up pass shows the next window automatically); only when the note says it was the LAST window is the PDF fully seen. Do NOT call readFileContent or web_fetch for a PDF.
1134
1136
  - VISION: when the message (a readFileContent window, an embedded PDF page, or an inline attachment) includes IMAGES - scanned/rendered PDF pages, or photos embedded in a spreadsheet next to a row/block - LOOK at them and capture what they show as record data (the reading/values in a scanned table, the part/defect/condition visible in a photo). The image IS part of the data; correlate each photo with its labelled block ("PHOTO A3" markers tie a photo to that grid row).
1135
1137
  - TRANSCRIBE, DO NOT DESCRIBE. When an image contains ANY text - a label, tag, stamp, form field, serial/part number, handwriting - your FIRST job is to read the characters out and store them VERBATIM, not to describe the scene. A record saying "a red inspection tag with handwritten markings" is worthless: it is unsearchable and every such photo produces the same sentence. Put the characters you can actually read into these EXACT fields, not variations of them: "printed_text" (the pre-printed wording), "handwritten_text" (what a person wrote by hand), and, when you can resolve one, "part_no", "serial_no", "tag_id" and "date". Every identifier you read (a serial number, a part number, a tag id, a model code) ALSO goes into "printed_text" or "handwritten_text", exactly as it appears, because those two fields are the image's searchable text. Text can appear at ANY angle (sideways, upside down, mirrored, along a curve): read it in its own orientation, and never call text unreadable only because it is turned. When it is upside down or sideways, watch the look-alikes (6 and 9, 0 and O, 1 and I, Latin and Cyrillic letters of the same shape). Same reason as the fixed table names: a field called photo_text in one pass and visible_text_notes in the next cannot be queried together. Read PARTIAL values rather than skipping: "500.7402.5[?][?]" beats nothing. Write [?] for each character that is genuinely unreadable and copy handwriting character for character - do NOT invent a character, and do NOT replace the whole transcription with a description of what the object looks like. A scene description is a nice extra AFTER the text, never instead of it.
1136
- - IMAGE FILES uploaded as the file itself: if ANY readable character appears ANYWHERE in the image (a label, a stamp, a sign in the background) it counts as an image WITH text - transcribe it per the rule above, and also capture the layout (what appears where) and every entity named. Only a truly text-free image gets description first: a one-line caption, then the objects present with their attributes (type, color, count, condition, position). Either way, save what you extract onto the file's "src::" record with updateRecords, TAG every entity and identifier visible, and INDEX the one number the image offers (a measured value, an amount, a count). On that same record ALSO set "text_rotation" and "text_legibility". "text_rotation" is the CLOCKWISE turn, 0, 90, 180 or 270, that would make the image's main text upright AS THE IMAGE IS SHOWN TO YOU: 0 when it already reads normally; 180 when it is upside down; 90 when its lines run from bottom to top (the tops of the letters face left); 270 when its lines run from top to bottom (the tops of the letters face right). "text_legibility" is "clear", "partial" or "unreadable" ("none" when there is no text).
1138
+ - IMAGE FILES uploaded as the file itself: if ANY readable character appears ANYWHERE in the image (a label, a stamp, a sign in the background) it counts as an image WITH text - transcribe it per the rule above, and also capture the layout (what appears where) and every entity named. Only a truly text-free image gets description first: a one-line caption, then the objects present with their attributes (type, color, count, condition, position). Either way, save what you extract onto the file's "src::" record with updateRecords, TAG every entity and identifier visible, and INDEX the one number the image offers (a measured value, an amount, a count). On that same record ALSO set "text_rotation" and "text_legibility". "text_rotation" is the CLOCKWISE turn, 0, 90, 180 or 270, that would make the image's main text upright AS THE IMAGE IS SHOWN TO YOU: 0 when it already reads normally; 180 when it is upside down; 90 when its lines run from bottom to top (the tops of the letters face left); 270 when its lines run from top to bottom (the tops of the letters face right). "text_legibility" is "clear", "partial" or "unreadable" ("none" when there is no text). ALSO set "text_regions" on that record: a list of up to 4 boxes [left, top, right, bottom], each a fraction from 0 to 1 of the image AS IT IS SHOWN TO YOU (not turned upright), drawn tightly around a label, plate or handwritten area whose characters matter (a serial number, a part number, a tag id); [] when there is none. Where a label names a value (a form field, a plate line), write the value right after its label in "printed_text" or "handwritten_text", as "<label>: <value>" (the label's own words, then the characters written beside it), so the label and its value are found together.
1137
1139
  - Whatever the file type, this file's identity is "src::" + its storage path (the "storage path" metadata line) - never the inline content or a temporary URL. That record ALREADY EXISTS: the upload pipeline creates it in table "file_summaries" (access group "${accessGroup}") before indexing starts, so posting it again is rejected as a duplicate unique_id. Reference it from every record you write, and add what you learn to it with updateRecords. If that update unexpectedly reports the record does not exist, post it yourself ONCE with that exact "src::" unique_id (table "file_summaries", access group "${accessGroup}") and carry on; this is the ONE exception to the do-NOT-post-the-file-record rules elsewhere in these instructions, because the source identity must never be dropped just because an update failed.
1138
1140
  - ACCESS GROUP (hard rule): every record you write for this file - the file record, per-row records, chapters, summaries, intermediates - MUST be posted with access group "${accessGroup}". Pass it explicitly on every postRecords call; do not leave it out and do not vary it between passes of the same file. An access group is part of a record's table key, so records saved under a different group than the file are in a different table and will not come back with the rest of it: a "public" file whose rows were saved as "authorized" is one an anonymous visitor can see the name of and none of the contents of, and a re-index cannot find the strays to clean them up. The one exception is the EXTRACTED MEDIA records in "__MEDIA__", which the pipeline creates for you - leave their group alone and only enrich them.
1139
1141
  - REACHABILITY (hard rule): every record you write while indexing this file MUST be reachable from the file's "src::<storage path>" record by following reference - either reference that record directly, or reference something that already reaches it. A record with no reference, or one pointing outside this file's chain, is an ORPHAN: deleting or re-indexing the file removes the reachable records and leaves the orphan behind forever, where it keeps turning up in later answers as stale data. If you create an intermediate record that OTHER records reference (a page record that rows hang off, a sheet or section record), set source.can_remove_referencing_records to true on it; the delete cascade passes a delete through a record only when that record carries the flag OR a unique_id starting "src::" (the file record cascades because its unique_id starts with "src::"; the intermediates you create carry no "src::" id, so they need the flag), and it cascades ONE LEVEL AT A TIME, so EVERY intermediate record in a chain needs its own marker - an unmarked link stops the cascade there and everything below it survives as orphans. When in doubt, reference the file record directly and keep the chain flat.
@@ -1210,7 +1212,7 @@ Read this file with the readFileContent tool, using the storage path above - do
1210
1212
  return head + `- temporary URL: ${attachment.url}
1211
1213
  ` + (options.imageFile === "attached" ? `
1212
1214
  This is an IMAGE file, attached to this message as an image: read it there, not from the URL. ` : `
1213
- This is an IMAGE file in a format the AI cannot take directly. When an image of it is attached to this message (the server converts it when it can), read it there; when none is attached, index the file from its metadata only and do not guess its contents. `) + `Transcribe every character FIRST, at whatever angle the text is: "printed_text", "handwritten_text", and "part_no" / "serial_no" / "tag_id", with every identifier also written inside "printed_text" or "handwritten_text". Then set "text_rotation" and "text_legibility" on the file's "src::" record, and only then describe what the image shows.`;
1215
+ This is an IMAGE file in a format the AI cannot take directly. When an image of it is attached to this message (the server converts it when it can), read it there; when none is attached, index the file from its metadata only and do not guess its contents. `) + `Transcribe every character FIRST, at whatever angle the text is: "printed_text", "handwritten_text", and "part_no" / "serial_no" / "tag_id", with every identifier also written inside "printed_text" or "handwritten_text". Write each label's value right after its label, as "<label>: <value>" (the label's own words, then the characters written beside it), reading small and handwritten characters closely; use [?] only for a character that is truly unreadable, and never put a guessed character in its place. Then set "text_rotation", "text_legibility" and "text_regions" on the file's "src::" record, and only then describe what the image shows. "text_regions" is a list of up to 4 boxes [left, top, right, bottom], each a fraction from 0 to 1 of the image exactly as it is shown to you here (not turned upright), drawn tightly around a label, plate or handwritten area whose characters matter (a serial number, a part number, a tag); [] when there is none.`;
1214
1216
  }
1215
1217
  return head + `- temporary URL (fetch this to read the file contents): ${attachment.url}`;
1216
1218
  }
@@ -3201,6 +3203,16 @@ function formatDuration(ms) {
3201
3203
  out.push(s + "s");
3202
3204
  return out.join(" ");
3203
3205
  }
3206
+ function formatIndexDuration(ms) {
3207
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
3208
+ var total = Math.floor(ms / 1e3);
3209
+ var h = Math.floor(total / 3600);
3210
+ var m = Math.floor(total % 3600 / 60);
3211
+ var s = total % 60;
3212
+ if (h) return h + " h" + (m ? " " + m + " min" : "");
3213
+ if (m) return m + " min" + (s ? " " + s + " s" : "");
3214
+ return s + " s";
3215
+ }
3204
3216
  function requestIdTimeMs(rid) {
3205
3217
  if (typeof rid !== "string") return 0;
3206
3218
  var stamp = rid.split(":")[0] || "";
@@ -3299,6 +3311,46 @@ function overlayRunRecordVerdict(grp, rec, liveIndexKeys) {
3299
3311
  grp.resolving = false;
3300
3312
  grp.resolvingReason = void 0;
3301
3313
  }
3314
+ function runRecordDurationMs(rec) {
3315
+ if (!rec || rec.status !== "done") return void 0;
3316
+ var a = rec.started;
3317
+ var b = rec.finished;
3318
+ if (typeof a !== "number" || typeof b !== "number" || !isFinite(a) || !isFinite(b) || b < a) return void 0;
3319
+ return b - a;
3320
+ }
3321
+ var RUN_DURATION_CLOCK_SLACK_MS = 6e4;
3322
+ var RUN_DURATION_SERVER_SLACK_MS = 5e3;
3323
+ function runRecordGroupDurationMs(grp, rec) {
3324
+ if (rec.status !== "done" || !grp.members.length) return void 0;
3325
+ var fin = rec.finished;
3326
+ if (typeof fin !== "number" || !isFinite(fin)) return void 0;
3327
+ var firstTs = messageTimeMs(grp.members[0].msg);
3328
+ var lastTs = messageTimeMs(grp.members[grp.members.length - 1].msg);
3329
+ if (!firstTs || !lastTs) return void 0;
3330
+ if (fin < firstTs || fin < lastTs - RUN_DURATION_SERVER_SLACK_MS) return void 0;
3331
+ var firstPassTs = 0;
3332
+ for (var i = 0; i < grp.members.length; i++) {
3333
+ var m = grp.members[i].msg;
3334
+ if (m.role !== "user") continue;
3335
+ var ref = readFileRef(m);
3336
+ if (ref && !ref.continued) firstPassTs = messageTimeMs(m);
3337
+ break;
3338
+ }
3339
+ var st = typeof rec.started === "number" && isFinite(rec.started) ? rec.started : void 0;
3340
+ var start;
3341
+ if (st !== void 0 && st > firstTs + RUN_DURATION_CLOCK_SLACK_MS) return void 0;
3342
+ if (firstPassTs) {
3343
+ start = st !== void 0 && st >= firstPassTs - RUN_DURATION_CLOCK_SLACK_MS ? st : firstPassTs;
3344
+ } else {
3345
+ if (st === void 0) return void 0;
3346
+ start = st;
3347
+ }
3348
+ return fin >= start ? fin - start : void 0;
3349
+ }
3350
+ function indexGroupDurationLabel(group) {
3351
+ if (!group || group.status !== "done" || !group.finished || group.resolving || group.queued) return "";
3352
+ return formatIndexDuration(group.durationMs);
3353
+ }
3302
3354
  function buildChatDisplayList(messages, opts) {
3303
3355
  var list = Array.isArray(messages) ? messages : [];
3304
3356
  var liveIndexKeys = opts && opts.liveIndexKeys || {};
@@ -3654,7 +3706,9 @@ function buildChatDisplayList(messages, opts) {
3654
3706
  resolvingReason: reason,
3655
3707
  stub: true,
3656
3708
  queued: waitingStub || live && !!runningKeys && !runningKeys[sp] && !runningKeys[canonIndexKey(sp)] && !runningKeys[fname] ? true : void 0,
3657
- stubError: rec.error || (st === "error" && !rec.error ? "Indexing did not finish." : void 0)
3709
+ stubError: rec.error || (st === "error" && !rec.error ? "Indexing did not finish." : void 0),
3710
+ // The stub IS the record, so a 'done' record's span is this run's.
3711
+ durationMs: st === "done" ? runRecordDurationMs(rec) : void 0
3658
3712
  };
3659
3713
  stubList.push({ started: typeof rec.started === "number" ? rec.started : Infinity, group: sg });
3660
3714
  }
@@ -3673,6 +3727,7 @@ function buildChatDisplayList(messages, opts) {
3673
3727
  tg.runKey = "run:" + (tg.path || tg.key) + "#" + trec.started;
3674
3728
  stubList.push({ started: trec.started, group: tg });
3675
3729
  overlayRunRecordVerdict(tg, trec, liveIndexKeys);
3730
+ tg.durationMs = runRecordGroupDurationMs(tg, trec);
3676
3731
  }
3677
3732
  }
3678
3733
  stubList.sort(function(a, b) {
@@ -4111,6 +4166,22 @@ var IMAGE_PREVIEWS_PER_MESSAGE = 8;
4111
4166
  var INLINE_LINK_GLYPH = "\u2197";
4112
4167
  var INLINE_LINK_UNAVAILABLE_GLYPH = "\u2715";
4113
4168
  var INLINE_LINK_UNAVAILABLE_SUFFIX = " (unavailable)";
4169
+ var FIT_LABEL_TAIL_CHARS = 8;
4170
+ function splitLabelForFit(name) {
4171
+ var chars = Array.from(String(name == null ? "" : name));
4172
+ var dot = -1;
4173
+ for (var i = chars.length - 1; i > 0; i--) {
4174
+ if (chars[i] === ".") {
4175
+ dot = i;
4176
+ break;
4177
+ }
4178
+ if (chars[i] === " " || chars[i] === "/" || chars.length - i > 10) break;
4179
+ }
4180
+ var extStart = dot > 0 && dot < chars.length - 1 ? dot : chars.length;
4181
+ var tailStart = Math.max(0, extStart - FIT_LABEL_TAIL_CHARS);
4182
+ if (tailStart < 4) return { stem: chars.join(""), tail: "" };
4183
+ return { stem: chars.slice(0, tailStart).join(""), tail: chars.slice(tailStart).join("") };
4184
+ }
4114
4185
  function renderInlineLinkHtml(link, opts) {
4115
4186
  var o = opts || {};
4116
4187
  var unavailable = !!o.unavailable;
@@ -4123,7 +4194,16 @@ function renderInlineLinkHtml(link, opts) {
4123
4194
  if (unavailable) cls.push("is-unavailable");
4124
4195
  if (preview) cls.push("is-image-preview");
4125
4196
  var glyphHtml = '<span class="bq-link-glyph" translate="no">' + (unavailable ? INLINE_LINK_UNAVAILABLE_GLYPH : INLINE_LINK_GLYPH) + "</span>";
4126
- var labelHtml = glyphHtml + escapeInlineHtml(link.label + (unavailable ? INLINE_LINK_UNAVAILABLE_SUFFIX : refreshing ? " (fetching...)" : ""));
4197
+ var stateSuffix = unavailable ? INLINE_LINK_UNAVAILABLE_SUFFIX : refreshing ? " (fetching...)" : "";
4198
+ var fit = !!o.fitLabel && !preview;
4199
+ if (fit) cls.push("bq-link-fit");
4200
+ var labelHtml;
4201
+ if (fit) {
4202
+ var split = splitLabelForFit(full);
4203
+ labelHtml = glyphHtml + '<span class="bq-link-stem">' + escapeInlineHtml(split.stem) + "</span>" + (split.tail ? '<span class="bq-link-tail">' + escapeInlineHtml(split.tail) + "</span>" : "") + (stateSuffix ? '<span class="bq-link-tail">' + escapeInlineHtml(stateSuffix) + "</span>" : "");
4204
+ } else {
4205
+ labelHtml = glyphHtml + escapeInlineHtml(link.label + stateSuffix);
4206
+ }
4127
4207
  var attrs = ['class="' + cls.join(" ") + '"'];
4128
4208
  if (unavailable) attrs.push('aria-disabled="true"', 'data-bq-unavailable="1"');
4129
4209
  else attrs.push('href="' + escapeInlineHtml(link.href) + '"', 'target="_blank"', 'rel="noopener noreferrer"');
@@ -5851,6 +5931,10 @@ function canReportWrongAnswer(msg) {
5851
5931
  var note = retrievalNoteOfAnswer(msg);
5852
5932
  return !!note && !answerUsedNoDataTool(note) && !msg.isCancelled;
5853
5933
  }
5934
+ var UPLOAD_CANCELLED_MESSAGE = "Upload cancelled";
5935
+ function isUploadCancelledError(err) {
5936
+ return !!err && (err.code === "CANCELLED" || err.message === UPLOAD_CANCELLED_MESSAGE);
5937
+ }
5854
5938
  var _ChatSession = class _ChatSession {
5855
5939
  constructor(host) {
5856
5940
  // --- live streaming ----------------------------------------------------
@@ -13016,6 +13100,29 @@ var _ChatSession = class _ChatSession {
13016
13100
  });
13017
13101
  }
13018
13102
  // --- attachment upload orchestration ---------------------------------
13103
+ /**
13104
+ * The user cancelled this chip's upload (the widget's per-chip x or "Cancel all
13105
+ * uploads"). Stops the bytes now when they are moving (the host's abort), and
13106
+ * leaves a flag every later step of uploadSingleAttachment checks, so a cancel
13107
+ * that lands between steps (the get-signed-url round trip before the bytes, or
13108
+ * the src:: record and the indexing request after them) still stops the file
13109
+ * from being indexed and from being attached to the chat turn. A member whose
13110
+ * indexing request has already gone out is past cancelling: it shows as an
13111
+ * indexing row with its own Stop. Returns false for a chip that is not being
13112
+ * uploaded by this session any more.
13113
+ */
13114
+ cancelAttachmentUpload(att) {
13115
+ if (!att || att._cancelled) return false;
13116
+ if (att.status !== "uploading" && !att._batchId) return false;
13117
+ att._cancelled = true;
13118
+ if (typeof att._abort === "function") {
13119
+ try {
13120
+ att._abort();
13121
+ } catch (e) {
13122
+ }
13123
+ }
13124
+ return true;
13125
+ }
13019
13126
  // Upload one attachment (a file = 1 member, a folder = N) to db storage and
13020
13127
  // queue indexing per member. The bytes I/O + chip rendering go through host
13021
13128
  // hooks; the overwrite/reindex flow, status lifecycle, and indexing live here.
@@ -13038,6 +13145,17 @@ var _ChatSession = class _ChatSession {
13038
13145
  var anyIndexFailed = false;
13039
13146
  var reusedCount = 0;
13040
13147
  att.reused = false;
13148
+ att._storedCount = 0;
13149
+ att._indexQueuedCount = 0;
13150
+ att._indexQueued = false;
13151
+ var cancelError = function() {
13152
+ var e = new Error(UPLOAD_CANCELLED_MESSAGE);
13153
+ e.code = "CANCELLED";
13154
+ return e;
13155
+ };
13156
+ var checkCancel = function() {
13157
+ if (att._cancelled) throw cancelError();
13158
+ };
13041
13159
  delete att.duplicates;
13042
13160
  var chain = Promise.resolve();
13043
13161
  var findDuplicate = function(member) {
@@ -13054,10 +13172,12 @@ var _ChatSession = class _ChatSession {
13054
13172
  };
13055
13173
  members.forEach(function(member, idx) {
13056
13174
  chain = chain.then(function() {
13175
+ checkCancel();
13057
13176
  var hadExists = false;
13058
13177
  var skipped = false;
13059
13178
  var duplicateOf = null;
13060
13179
  var existedBefore = false;
13180
+ var madeRecord = false;
13061
13181
  var onProg = function(p) {
13062
13182
  if (p && p.total) {
13063
13183
  att.progress = Math.floor((idx + p.loaded / p.total) / total * 100);
@@ -13065,14 +13185,33 @@ var _ChatSession = class _ChatSession {
13065
13185
  }
13066
13186
  };
13067
13187
  var doMemberUpload = function(checkExistence) {
13188
+ checkCancel();
13068
13189
  return self.host.uploadFile({
13069
13190
  file: member.file,
13070
13191
  storagePath: member.storagePath,
13071
13192
  checkExistence,
13072
13193
  onProgress: onProg,
13194
+ // The host hands its abort over just before the bytes start. A
13195
+ // cancel made during the get-signed-url round trip had nothing to
13196
+ // abort yet, so it is applied here, before anything is sent: a
13197
+ // storage POST that never completes leaves no object behind.
13073
13198
  setAbort: function(abort) {
13074
13199
  att._abort = abort;
13200
+ if (att._cancelled) {
13201
+ try {
13202
+ abort();
13203
+ } catch (e) {
13204
+ }
13205
+ }
13075
13206
  }
13207
+ }).then(function(r) {
13208
+ att._abort = null;
13209
+ att._storedCount = (att._storedCount || 0) + 1;
13210
+ return r;
13211
+ }, function(err) {
13212
+ att._abort = null;
13213
+ if (att._cancelled) throw cancelError();
13214
+ throw err;
13076
13215
  });
13077
13216
  };
13078
13217
  if (isIndexRetry) {
@@ -13106,12 +13245,14 @@ var _ChatSession = class _ChatSession {
13106
13245
  existedBefore = true;
13107
13246
  });
13108
13247
  }).then(function() {
13248
+ checkCancel();
13109
13249
  if (skipped) return;
13110
13250
  return Promise.resolve(self.host.getTemporaryUrl(duplicateOf || member.storagePath)).catch(function(err) {
13111
13251
  var ecode = err && (err.code || err.body && err.body.code);
13112
13252
  var emsg = String(err && (err.message || err.body && err.body.message) || err || "");
13113
13253
  var refused = /no access to this file/i.test(emsg) || ecode === "INVALID_REQUEST" && /access/i.test(emsg);
13114
13254
  if (duplicateOf || !refused || typeof self.host.ensureFileIndexRecord !== "function") throw err;
13255
+ madeRecord = !existedBefore;
13115
13256
  return Promise.resolve(self.host.ensureFileIndexRecord(member.storagePath, {
13116
13257
  name: member.file.name,
13117
13258
  mime: member.file.type || self.host.getMimeType(member.file.name),
@@ -13121,6 +13262,13 @@ var _ChatSession = class _ChatSession {
13121
13262
  });
13122
13263
  });
13123
13264
  }).then(function(url) {
13265
+ if (att._cancelled) {
13266
+ var dropEarly = madeRecord && typeof self.host.deleteExistingFileRecord === "function" ? Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13267
+ }) : Promise.resolve();
13268
+ return dropEarly.then(function() {
13269
+ throw cancelError();
13270
+ });
13271
+ }
13124
13272
  if (skipped) return;
13125
13273
  if (duplicateOf) {
13126
13274
  urls.push({ name: member.relPath, url, storagePath: duplicateOf });
@@ -13149,13 +13297,14 @@ var _ChatSession = class _ChatSession {
13149
13297
  var mime = member.file.type || self.host.getMimeType(member.file.name);
13150
13298
  var alreadyIndexing = false;
13151
13299
  var existingGroup = null;
13300
+ var clearedOld = false;
13152
13301
  var preIndex = self.claimIndexRun(member.storagePath).then(function(claimed) {
13153
13302
  alreadyIndexing = !claimed;
13154
13303
  if (alreadyIndexing) {
13155
13304
  console.log("[chat-engine] skipping a duplicate index request for", member.storagePath);
13156
13305
  return;
13157
13306
  }
13158
- if (!existedBefore) return;
13307
+ if (!existedBefore || att._cancelled) return;
13159
13308
  var readGroup = typeof self.host.readFileAccessGroup === "function" ? Promise.resolve(self.host.readFileAccessGroup(member.storagePath)).then(function(g) {
13160
13309
  existingGroup = g || null;
13161
13310
  }, function(err) {
@@ -13163,7 +13312,9 @@ var _ChatSession = class _ChatSession {
13163
13312
  throw err;
13164
13313
  }) : Promise.resolve();
13165
13314
  return readGroup.then(function() {
13315
+ if (att._cancelled) return;
13166
13316
  if (typeof self.host.deleteExistingFileRecord === "function") {
13317
+ clearedOld = true;
13167
13318
  return Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13168
13319
  });
13169
13320
  }
@@ -13171,7 +13322,9 @@ var _ChatSession = class _ChatSession {
13171
13322
  });
13172
13323
  preIndex = preIndex.then(function() {
13173
13324
  if (alreadyIndexing) return;
13325
+ if (att._cancelled && !clearedOld) return;
13174
13326
  if (typeof self.host.ensureFileIndexRecord !== "function") return;
13327
+ if (!existedBefore) madeRecord = true;
13175
13328
  return Promise.resolve(self.host.ensureFileIndexRecord(member.storagePath, {
13176
13329
  name: member.file.name,
13177
13330
  mime: mime || void 0,
@@ -13192,10 +13345,28 @@ var _ChatSession = class _ChatSession {
13192
13345
  }).catch(function() {
13193
13346
  });
13194
13347
  });
13348
+ var abandonIfCancelled = function() {
13349
+ if (!att._cancelled) return;
13350
+ if (!alreadyIndexing) self.releaseIndexRun(member.storagePath);
13351
+ var drop = !existedBefore && !alreadyIndexing && madeRecord && typeof self.host.deleteExistingFileRecord === "function" ? Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13352
+ }) : Promise.resolve();
13353
+ return drop.then(function() {
13354
+ throw cancelError();
13355
+ });
13356
+ };
13195
13357
  return preIndex.then(function() {
13358
+ return abandonIfCancelled();
13359
+ }).then(function() {
13196
13360
  return parseAttachmentContent(member.file, member.file.name, mime || void 0);
13361
+ }).then(function(parsedContent) {
13362
+ return Promise.resolve(abandonIfCancelled()).then(function() {
13363
+ return parsedContent;
13364
+ });
13197
13365
  }).then(function(parsedContent) {
13198
13366
  if (alreadyIndexing) return;
13367
+ att._indexQueuedCount = (att._indexQueuedCount || 0) + 1;
13368
+ if (att.kind !== "folder") att._indexQueued = true;
13369
+ self.host.renderAttachmentChips();
13199
13370
  return self.trackIndexDispatch(notifyAgentSaveAttachment({
13200
13371
  platform: id.platform,
13201
13372
  model: id.model,
@@ -13251,6 +13422,7 @@ var _ChatSession = class _ChatSession {
13251
13422
  });
13252
13423
  });
13253
13424
  return chain.then(function() {
13425
+ checkCancel();
13254
13426
  att._abort = null;
13255
13427
  att.progress = 100;
13256
13428
  if (att.kind === "folder") att.uploadedUrls = urls.map(function(u) {
@@ -13311,12 +13483,20 @@ var _ChatSession = class _ChatSession {
13311
13483
  return a.id === att.id;
13312
13484
  });
13313
13485
  var aborted = err && (err.message === "Aborted" || err === "Aborted");
13486
+ if (att._cancelled || isUploadCancelledError(err)) {
13487
+ att.status = "cancelled";
13488
+ att._abort = null;
13489
+ self.host.renderAttachmentChips();
13490
+ return;
13491
+ }
13314
13492
  if (removed || aborted) return;
13315
13493
  att.status = "error";
13316
13494
  att.errorMessage = "File upload has failed";
13317
13495
  att.errorCode = err && (err.code || err.body && err.body.code) || "";
13318
13496
  att.errorDetail = err && (err.message || err.body && err.body.message) || (typeof err === "string" ? err : "");
13319
13497
  self.host.renderAttachmentChips();
13498
+ }).then(function() {
13499
+ att._settledBatch = att._batchId || true;
13320
13500
  });
13321
13501
  });
13322
13502
  });
@@ -13343,6 +13523,6 @@ var _ChatSession = class _ChatSession {
13343
13523
  _ChatSession.RUN_PASS_PAGE = 10;
13344
13524
  var ChatSession = _ChatSession;
13345
13525
 
13346
- export { ANSWER_MODES, ANSWER_MODE_HINTS, ANSWER_MODE_LABELS, ANSWER_MODE_OPTIONS, ANSWER_MODE_SETTING_LABEL, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, ChatSession, DATA_TOOL_NAMES, DEFAULT_ANSWER_MODE, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_SKIP_DUPLICATE_FILES, DEFAULT_UPLOAD_ACCESS_GROUP, DEFAULT_WEB_ACCESS, DUPLICATE_LOOKUP_LIMIT, DUPLICATE_LOOKUP_MAX_CANDIDATES, DUPLICATE_LOOKUP_TIMEOUT_MS, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, LOOK_DEADLINE_MS, LOOK_FAST_MS, LOOK_SLOW_MS, LOOK_STALE_MS, LookScheduler, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, NOT_SENT_TEXT, NO_DATA_TOOL_MARK, OUTPUT_TOKEN_RESERVE, PAGE_TEXT_TABLE, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, RENDER_FROM_TOKEN, REQUEST_GONE_TEXT, REQUEST_UNREACHABLE_TEXT, RETRIEVAL_NOTES_MAX, RETRIEVAL_NOTES_TOKEN_BUDGET, RETRIEVAL_NOTE_MAX_CHARS, RETRIEVAL_NOTE_MAX_ITEMS, RETRIEVAL_NOTE_PREFIX, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, STREAM_POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLiveTextIntoRunningRow, adoptLocalAnswerIntoPage, answerModeFrom, answerUsedNoDataTool, applyEncodingDeclaration, applyRetrievalNotes, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEffortFields, chatEngineConfig, chatGreetingFrom, chatStreamWiring, citationFileName, citationLinkPart, citationsFor, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, crefSupported, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, extractRetrievalNote, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, findDuplicateUpload, formatChatTimestamp, formatDuration, formatRetrievalNote, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isDataToolName, isDuplicateCandidateId, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isNotExistsError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isRetrievalNote, isReturnTrigger, isServerExtractable, isServiceDbAttachmentHref, isTransportFailure, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, listedRequestText, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, messageTimeMs, mintCacheBustStamp, needsBomForExt, newClientRef, normalizeAnswerMode, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeSkipDuplicateFiles, normalizeStoredPathTarget, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, normalizeWebAccess, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAnswerMode, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectSkipDuplicateFiles, projectUploadAccessGroup, projectWebAccess, providerBodyWasRead, readExpiredAttachmentHref, readyProjectSettings, reconcilerReadsEnabled, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, requestIdTimeMs, resetFileIndexOnServer, resolveAnswerMode, resolveImagePreviewUrl, resolveSkipDuplicateFiles, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, runSettleSideEffect, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, sideEffectDone, skapiSupportsStreaming, skipDuplicateFilesEnabled, skipDuplicateFilesFrom, statusPushEnabled, statusPushLive, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
13526
+ export { ANSWER_MODES, ANSWER_MODE_HINTS, ANSWER_MODE_LABELS, ANSWER_MODE_OPTIONS, ANSWER_MODE_SETTING_LABEL, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, ChatSession, DATA_TOOL_NAMES, DEFAULT_ANSWER_MODE, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_SKIP_DUPLICATE_FILES, DEFAULT_UPLOAD_ACCESS_GROUP, DEFAULT_WEB_ACCESS, DUPLICATE_LOOKUP_LIMIT, DUPLICATE_LOOKUP_MAX_CANDIDATES, DUPLICATE_LOOKUP_TIMEOUT_MS, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, LOOK_DEADLINE_MS, LOOK_FAST_MS, LOOK_SLOW_MS, LOOK_STALE_MS, LookScheduler, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, NOT_SENT_TEXT, NO_DATA_TOOL_MARK, OUTPUT_TOKEN_RESERVE, PAGE_TEXT_TABLE, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, RENDER_FROM_TOKEN, REQUEST_GONE_TEXT, REQUEST_UNREACHABLE_TEXT, RETRIEVAL_NOTES_MAX, RETRIEVAL_NOTES_TOKEN_BUDGET, RETRIEVAL_NOTE_MAX_CHARS, RETRIEVAL_NOTE_MAX_ITEMS, RETRIEVAL_NOTE_PREFIX, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, STREAM_POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, UPLOAD_CANCELLED_MESSAGE, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLiveTextIntoRunningRow, adoptLocalAnswerIntoPage, answerModeFrom, answerUsedNoDataTool, applyEncodingDeclaration, applyRetrievalNotes, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEffortFields, chatEngineConfig, chatGreetingFrom, chatStreamWiring, citationFileName, citationLinkPart, citationsFor, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, crefSupported, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, extractRetrievalNote, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, findDuplicateUpload, formatChatTimestamp, formatDuration, formatIndexDuration, formatRetrievalNote, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexGroupDurationLabel, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isDataToolName, isDuplicateCandidateId, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isNotExistsError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isRetrievalNote, isReturnTrigger, isServerExtractable, isServiceDbAttachmentHref, isTransportFailure, isUploadCancelledError, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, listedRequestText, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, messageTimeMs, mintCacheBustStamp, needsBomForExt, newClientRef, normalizeAnswerMode, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeSkipDuplicateFiles, normalizeStoredPathTarget, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, normalizeWebAccess, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAnswerMode, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectSkipDuplicateFiles, projectUploadAccessGroup, projectWebAccess, providerBodyWasRead, readExpiredAttachmentHref, readyProjectSettings, reconcilerReadsEnabled, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, requestIdTimeMs, resetFileIndexOnServer, resolveAnswerMode, resolveImagePreviewUrl, resolveSkipDuplicateFiles, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, runRecordDurationMs, runSettleSideEffect, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, sideEffectDone, skapiSupportsStreaming, skipDuplicateFilesEnabled, skipDuplicateFilesFrom, splitLabelForFit, statusPushEnabled, statusPushLive, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
13347
13527
  //# sourceMappingURL=engine.mjs.map
13348
13528
  //# sourceMappingURL=engine.mjs.map