bunnyquery 1.21.3 → 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
  }
@@ -3170,6 +3172,67 @@ function buildHistoryItemFullId(platform, service, itemId) {
3170
3172
  return `[POST]${url.toLowerCase()}#${service}:${itemId}`;
3171
3173
  }
3172
3174
 
3175
+ // src/engine/time.ts
3176
+ function wallClockNow() {
3177
+ return Date.now();
3178
+ }
3179
+ function formatChatTimestamp(ms) {
3180
+ if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
3181
+ try {
3182
+ return new Date(ms).toLocaleString(void 0, {
3183
+ year: "numeric",
3184
+ month: "short",
3185
+ day: "numeric",
3186
+ hour: "numeric",
3187
+ minute: "2-digit",
3188
+ second: "2-digit"
3189
+ });
3190
+ } catch (e) {
3191
+ return "";
3192
+ }
3193
+ }
3194
+ function formatDuration(ms) {
3195
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
3196
+ var total = Math.floor(ms / 1e3);
3197
+ var h = Math.floor(total / 3600);
3198
+ var m = Math.floor(total % 3600 / 60);
3199
+ var s = total % 60;
3200
+ var out = [];
3201
+ if (h) out.push(h + "h");
3202
+ if (m) out.push(m + "m");
3203
+ out.push(s + "s");
3204
+ return out.join(" ");
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
+ }
3216
+ function requestIdTimeMs(rid) {
3217
+ if (typeof rid !== "string") return 0;
3218
+ var stamp = rid.split(":")[0] || "";
3219
+ if (stamp.length !== 13) return 0;
3220
+ var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
3221
+ var v = 0;
3222
+ for (var i = 0; i < stamp.length; i++) {
3223
+ var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
3224
+ if (d < 0) return 0;
3225
+ v = v * 32 + d;
3226
+ }
3227
+ return Math.floor(v / 2 / 1e6);
3228
+ }
3229
+ function messageTimeMs(m) {
3230
+ if (!m) return 0;
3231
+ var r = typeof m._serverItemId === "string" ? requestIdTimeMs(m._serverItemId) : 0;
3232
+ if (r > 0) return r;
3233
+ return typeof m._ts === "number" && m._ts > 0 ? m._ts : 0;
3234
+ }
3235
+
3173
3236
  // src/engine/indexing_groups.ts
3174
3237
  function canonIndexKey(s) {
3175
3238
  return typeof s === "string" && s ? s.trim() : "";
@@ -3248,6 +3311,46 @@ function overlayRunRecordVerdict(grp, rec, liveIndexKeys) {
3248
3311
  grp.resolving = false;
3249
3312
  grp.resolvingReason = void 0;
3250
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
+ }
3251
3354
  function buildChatDisplayList(messages, opts) {
3252
3355
  var list = Array.isArray(messages) ? messages : [];
3253
3356
  var liveIndexKeys = opts && opts.liveIndexKeys || {};
@@ -3280,8 +3383,9 @@ function buildChatDisplayList(messages, opts) {
3280
3383
  var alreadySeen = !!(msg._serverItemId && runByItemId[msg._serverItemId]);
3281
3384
  var openId = openRunOfKey[key];
3282
3385
  var notLater = false;
3283
- if (openId && typeof msg._ts === "number" && typeof newestTsOfRun[openId] === "number") {
3284
- notLater = msg._ts <= newestTsOfRun[openId];
3386
+ var msgTime = messageTimeMs(msg);
3387
+ if (openId && msgTime > 0 && typeof newestTsOfRun[openId] === "number") {
3388
+ notLater = msgTime <= newestTsOfRun[openId];
3285
3389
  }
3286
3390
  if (!ref.continued && !alreadySeen && !notLater && openRunOfKey[key]) delete openRunOfKey[key];
3287
3391
  runId = openRunOfKey[key];
@@ -3295,9 +3399,10 @@ function buildChatDisplayList(messages, opts) {
3295
3399
  runId = runOfIndex[i - 1];
3296
3400
  }
3297
3401
  if (!runId) continue;
3298
- if (typeof msg._ts === "number") {
3402
+ var memberTime = messageTimeMs(msg);
3403
+ if (memberTime > 0) {
3299
3404
  var prevTs = newestTsOfRun[runId];
3300
- if (typeof prevTs !== "number" || msg._ts > prevTs) newestTsOfRun[runId] = msg._ts;
3405
+ if (typeof prevTs !== "number" || memberTime > prevTs) newestTsOfRun[runId] = memberTime;
3301
3406
  }
3302
3407
  var g = groups[runId];
3303
3408
  if (!g) {
@@ -3601,7 +3706,9 @@ function buildChatDisplayList(messages, opts) {
3601
3706
  resolvingReason: reason,
3602
3707
  stub: true,
3603
3708
  queued: waitingStub || live && !!runningKeys && !runningKeys[sp] && !runningKeys[canonIndexKey(sp)] && !runningKeys[fname] ? true : void 0,
3604
- 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
3605
3712
  };
3606
3713
  stubList.push({ started: typeof rec.started === "number" ? rec.started : Infinity, group: sg });
3607
3714
  }
@@ -3620,6 +3727,7 @@ function buildChatDisplayList(messages, opts) {
3620
3727
  tg.runKey = "run:" + (tg.path || tg.key) + "#" + trec.started;
3621
3728
  stubList.push({ started: trec.started, group: tg });
3622
3729
  overlayRunRecordVerdict(tg, trec, liveIndexKeys);
3730
+ tg.durationMs = runRecordGroupDurationMs(tg, trec);
3623
3731
  }
3624
3732
  }
3625
3733
  stubList.sort(function(a, b) {
@@ -4058,6 +4166,22 @@ var IMAGE_PREVIEWS_PER_MESSAGE = 8;
4058
4166
  var INLINE_LINK_GLYPH = "\u2197";
4059
4167
  var INLINE_LINK_UNAVAILABLE_GLYPH = "\u2715";
4060
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
+ }
4061
4185
  function renderInlineLinkHtml(link, opts) {
4062
4186
  var o = opts || {};
4063
4187
  var unavailable = !!o.unavailable;
@@ -4070,7 +4194,16 @@ function renderInlineLinkHtml(link, opts) {
4070
4194
  if (unavailable) cls.push("is-unavailable");
4071
4195
  if (preview) cls.push("is-image-preview");
4072
4196
  var glyphHtml = '<span class="bq-link-glyph" translate="no">' + (unavailable ? INLINE_LINK_UNAVAILABLE_GLYPH : INLINE_LINK_GLYPH) + "</span>";
4073
- 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
+ }
4074
4207
  var attrs = ['class="' + cls.join(" ") + '"'];
4075
4208
  if (unavailable) attrs.push('aria-disabled="true"', 'data-bq-unavailable="1"');
4076
4209
  else attrs.push('href="' + escapeInlineHtml(link.href) + '"', 'target="_blank"', 'rel="noopener noreferrer"');
@@ -4211,38 +4344,6 @@ function previewLayoutBox(img) {
4211
4344
  return closest.call(img, PREVIEW_LAYOUT_BOX_SELECTOR) || img;
4212
4345
  }
4213
4346
 
4214
- // src/engine/time.ts
4215
- function wallClockNow() {
4216
- return Date.now();
4217
- }
4218
- function formatChatTimestamp(ms) {
4219
- if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
4220
- try {
4221
- return new Date(ms).toLocaleString(void 0, {
4222
- year: "numeric",
4223
- month: "short",
4224
- day: "numeric",
4225
- hour: "numeric",
4226
- minute: "2-digit",
4227
- second: "2-digit"
4228
- });
4229
- } catch (e) {
4230
- return "";
4231
- }
4232
- }
4233
- function formatDuration(ms) {
4234
- if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
4235
- var total = Math.floor(ms / 1e3);
4236
- var h = Math.floor(total / 3600);
4237
- var m = Math.floor(total % 3600 / 60);
4238
- var s = total % 60;
4239
- var out = [];
4240
- if (h) out.push(h + "h");
4241
- if (m) out.push(m + "m");
4242
- out.push(s + "s");
4243
- return out.join(" ");
4244
- }
4245
-
4246
4347
  // src/engine/ai_agent.ts
4247
4348
  function normalizePlatform(raw) {
4248
4349
  var p = (raw || "").trim().toLowerCase();
@@ -5824,25 +5925,16 @@ function streamRecoveryLabels(phase) {
5824
5925
  }
5825
5926
  var LIVE_PAINT_MIN_MS = 250;
5826
5927
  var LIVE_TYPE_MAX_STEP = 1200;
5827
- function requestIdTimeMs(rid) {
5828
- if (typeof rid !== "string") return 0;
5829
- var stamp = rid.split(":")[0] || "";
5830
- if (stamp.length !== 13) return 0;
5831
- var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
5832
- var v = 0;
5833
- for (var i = 0; i < stamp.length; i++) {
5834
- var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
5835
- if (d < 0) return 0;
5836
- v = v * 32 + d;
5837
- }
5838
- return Math.floor(v / 2 / 1e6);
5839
- }
5840
5928
  var WRONG_ANSWER_MESSAGE = "This answer seems wrong. Please check it again against the documents.";
5841
5929
  var WRONG_ANSWER_LABEL = "Wrong answer?";
5842
5930
  function canReportWrongAnswer(msg) {
5843
5931
  var note = retrievalNoteOfAnswer(msg);
5844
5932
  return !!note && !answerUsedNoDataTool(note) && !msg.isCancelled;
5845
5933
  }
5934
+ var UPLOAD_CANCELLED_MESSAGE = "Upload cancelled";
5935
+ function isUploadCancelledError(err) {
5936
+ return !!err && (err.code === "CANCELLED" || err.message === UPLOAD_CANCELLED_MESSAGE);
5937
+ }
5846
5938
  var _ChatSession = class _ChatSession {
5847
5939
  constructor(host) {
5848
5940
  // --- live streaming ----------------------------------------------------
@@ -11764,15 +11856,18 @@ var _ChatSession = class _ChatSession {
11764
11856
  self.updateHistoryCache();
11765
11857
  });
11766
11858
  }
11767
- /** Insert bubbles before the first message that is newer than them (by `_ts`); messages
11768
- * without a time are skipped over, and the end of the list takes them otherwise. */
11859
+ /** Insert bubbles before the first message that is newer than them; messages whose time
11860
+ * is unknown are skipped over, and the end of the list takes them otherwise. A message's
11861
+ * time is its `_ts`, else (2026-11-25) the time in its request id: a live worker pass
11862
+ * adopted from the queue carries no `_ts`, and a file's older passes loaded by opening its
11863
+ * row (loadRunPasses) used to land AFTER it, which split one run into two rows. */
11769
11864
  _insertByTime(bubbles) {
11770
- var at = bubbles[0] && bubbles[0]._ts;
11865
+ var at = messageTimeMs(bubbles[0]);
11771
11866
  var idx = this.state.messages.length;
11772
- if (typeof at === "number") {
11867
+ if (at > 0) {
11773
11868
  for (var i = 0; i < this.state.messages.length; i++) {
11774
- var t = this.state.messages[i] && this.state.messages[i]._ts;
11775
- if (typeof t === "number" && t > at) {
11869
+ var t = messageTimeMs(this.state.messages[i]);
11870
+ if (t > 0 && t > at) {
11776
11871
  idx = i;
11777
11872
  break;
11778
11873
  }
@@ -13005,6 +13100,29 @@ var _ChatSession = class _ChatSession {
13005
13100
  });
13006
13101
  }
13007
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
+ }
13008
13126
  // Upload one attachment (a file = 1 member, a folder = N) to db storage and
13009
13127
  // queue indexing per member. The bytes I/O + chip rendering go through host
13010
13128
  // hooks; the overwrite/reindex flow, status lifecycle, and indexing live here.
@@ -13027,6 +13145,17 @@ var _ChatSession = class _ChatSession {
13027
13145
  var anyIndexFailed = false;
13028
13146
  var reusedCount = 0;
13029
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
+ };
13030
13159
  delete att.duplicates;
13031
13160
  var chain = Promise.resolve();
13032
13161
  var findDuplicate = function(member) {
@@ -13043,10 +13172,12 @@ var _ChatSession = class _ChatSession {
13043
13172
  };
13044
13173
  members.forEach(function(member, idx) {
13045
13174
  chain = chain.then(function() {
13175
+ checkCancel();
13046
13176
  var hadExists = false;
13047
13177
  var skipped = false;
13048
13178
  var duplicateOf = null;
13049
13179
  var existedBefore = false;
13180
+ var madeRecord = false;
13050
13181
  var onProg = function(p) {
13051
13182
  if (p && p.total) {
13052
13183
  att.progress = Math.floor((idx + p.loaded / p.total) / total * 100);
@@ -13054,14 +13185,33 @@ var _ChatSession = class _ChatSession {
13054
13185
  }
13055
13186
  };
13056
13187
  var doMemberUpload = function(checkExistence) {
13188
+ checkCancel();
13057
13189
  return self.host.uploadFile({
13058
13190
  file: member.file,
13059
13191
  storagePath: member.storagePath,
13060
13192
  checkExistence,
13061
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.
13062
13198
  setAbort: function(abort) {
13063
13199
  att._abort = abort;
13200
+ if (att._cancelled) {
13201
+ try {
13202
+ abort();
13203
+ } catch (e) {
13204
+ }
13205
+ }
13064
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;
13065
13215
  });
13066
13216
  };
13067
13217
  if (isIndexRetry) {
@@ -13095,12 +13245,14 @@ var _ChatSession = class _ChatSession {
13095
13245
  existedBefore = true;
13096
13246
  });
13097
13247
  }).then(function() {
13248
+ checkCancel();
13098
13249
  if (skipped) return;
13099
13250
  return Promise.resolve(self.host.getTemporaryUrl(duplicateOf || member.storagePath)).catch(function(err) {
13100
13251
  var ecode = err && (err.code || err.body && err.body.code);
13101
13252
  var emsg = String(err && (err.message || err.body && err.body.message) || err || "");
13102
13253
  var refused = /no access to this file/i.test(emsg) || ecode === "INVALID_REQUEST" && /access/i.test(emsg);
13103
13254
  if (duplicateOf || !refused || typeof self.host.ensureFileIndexRecord !== "function") throw err;
13255
+ madeRecord = !existedBefore;
13104
13256
  return Promise.resolve(self.host.ensureFileIndexRecord(member.storagePath, {
13105
13257
  name: member.file.name,
13106
13258
  mime: member.file.type || self.host.getMimeType(member.file.name),
@@ -13110,6 +13262,13 @@ var _ChatSession = class _ChatSession {
13110
13262
  });
13111
13263
  });
13112
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
+ }
13113
13272
  if (skipped) return;
13114
13273
  if (duplicateOf) {
13115
13274
  urls.push({ name: member.relPath, url, storagePath: duplicateOf });
@@ -13138,13 +13297,14 @@ var _ChatSession = class _ChatSession {
13138
13297
  var mime = member.file.type || self.host.getMimeType(member.file.name);
13139
13298
  var alreadyIndexing = false;
13140
13299
  var existingGroup = null;
13300
+ var clearedOld = false;
13141
13301
  var preIndex = self.claimIndexRun(member.storagePath).then(function(claimed) {
13142
13302
  alreadyIndexing = !claimed;
13143
13303
  if (alreadyIndexing) {
13144
13304
  console.log("[chat-engine] skipping a duplicate index request for", member.storagePath);
13145
13305
  return;
13146
13306
  }
13147
- if (!existedBefore) return;
13307
+ if (!existedBefore || att._cancelled) return;
13148
13308
  var readGroup = typeof self.host.readFileAccessGroup === "function" ? Promise.resolve(self.host.readFileAccessGroup(member.storagePath)).then(function(g) {
13149
13309
  existingGroup = g || null;
13150
13310
  }, function(err) {
@@ -13152,7 +13312,9 @@ var _ChatSession = class _ChatSession {
13152
13312
  throw err;
13153
13313
  }) : Promise.resolve();
13154
13314
  return readGroup.then(function() {
13315
+ if (att._cancelled) return;
13155
13316
  if (typeof self.host.deleteExistingFileRecord === "function") {
13317
+ clearedOld = true;
13156
13318
  return Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13157
13319
  });
13158
13320
  }
@@ -13160,7 +13322,9 @@ var _ChatSession = class _ChatSession {
13160
13322
  });
13161
13323
  preIndex = preIndex.then(function() {
13162
13324
  if (alreadyIndexing) return;
13325
+ if (att._cancelled && !clearedOld) return;
13163
13326
  if (typeof self.host.ensureFileIndexRecord !== "function") return;
13327
+ if (!existedBefore) madeRecord = true;
13164
13328
  return Promise.resolve(self.host.ensureFileIndexRecord(member.storagePath, {
13165
13329
  name: member.file.name,
13166
13330
  mime: mime || void 0,
@@ -13181,10 +13345,28 @@ var _ChatSession = class _ChatSession {
13181
13345
  }).catch(function() {
13182
13346
  });
13183
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
+ };
13184
13357
  return preIndex.then(function() {
13358
+ return abandonIfCancelled();
13359
+ }).then(function() {
13185
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
+ });
13186
13365
  }).then(function(parsedContent) {
13187
13366
  if (alreadyIndexing) return;
13367
+ att._indexQueuedCount = (att._indexQueuedCount || 0) + 1;
13368
+ if (att.kind !== "folder") att._indexQueued = true;
13369
+ self.host.renderAttachmentChips();
13188
13370
  return self.trackIndexDispatch(notifyAgentSaveAttachment({
13189
13371
  platform: id.platform,
13190
13372
  model: id.model,
@@ -13240,6 +13422,7 @@ var _ChatSession = class _ChatSession {
13240
13422
  });
13241
13423
  });
13242
13424
  return chain.then(function() {
13425
+ checkCancel();
13243
13426
  att._abort = null;
13244
13427
  att.progress = 100;
13245
13428
  if (att.kind === "folder") att.uploadedUrls = urls.map(function(u) {
@@ -13300,12 +13483,20 @@ var _ChatSession = class _ChatSession {
13300
13483
  return a.id === att.id;
13301
13484
  });
13302
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
+ }
13303
13492
  if (removed || aborted) return;
13304
13493
  att.status = "error";
13305
13494
  att.errorMessage = "File upload has failed";
13306
13495
  att.errorCode = err && (err.code || err.body && err.body.code) || "";
13307
13496
  att.errorDetail = err && (err.message || err.body && err.body.message) || (typeof err === "string" ? err : "");
13308
13497
  self.host.renderAttachmentChips();
13498
+ }).then(function() {
13499
+ att._settledBatch = att._batchId || true;
13309
13500
  });
13310
13501
  });
13311
13502
  });
@@ -13332,6 +13523,6 @@ var _ChatSession = class _ChatSession {
13332
13523
  _ChatSession.RUN_PASS_PAGE = 10;
13333
13524
  var ChatSession = _ChatSession;
13334
13525
 
13335
- 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, 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, 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 };
13336
13527
  //# sourceMappingURL=engine.mjs.map
13337
13528
  //# sourceMappingURL=engine.mjs.map