bunnyquery 1.21.4 → 1.21.12

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.cjs CHANGED
@@ -80,6 +80,14 @@ function normalizeSkipDuplicateFiles(value) {
80
80
  function skipDuplicateFilesFrom(data) {
81
81
  return data ? normalizeSkipDuplicateFiles(data.skip_duplicate_files) : DEFAULT_SKIP_DUPLICATE_FILES;
82
82
  }
83
+ var SHARE_IDENTICAL_FILES_KEY = "share_identical_files";
84
+ var DEFAULT_SHARE_IDENTICAL_FILES = true;
85
+ function normalizeShareIdenticalFiles(value) {
86
+ return value !== false;
87
+ }
88
+ function shareIdenticalFilesFrom(data) {
89
+ return data ? normalizeShareIdenticalFiles(data.share_identical_files) : DEFAULT_SHARE_IDENTICAL_FILES;
90
+ }
83
91
  var ANSWER_MODES = ["standard", "fast", "thorough"];
84
92
  var DEFAULT_ANSWER_MODE = "standard";
85
93
  var ANSWER_MODE_SETTING_LABEL = "Answer mode";
@@ -193,6 +201,9 @@ function projectWebAccess(service) {
193
201
  function projectSkipDuplicateFiles(service) {
194
202
  return skipDuplicateFilesFrom(cachedProjectSettings(service));
195
203
  }
204
+ function projectShareIdenticalFiles(service) {
205
+ return shareIdenticalFilesFrom(cachedProjectSettings(service));
206
+ }
196
207
  function projectAnswerMode(service) {
197
208
  return answerModeFrom(cachedProjectSettings(service));
198
209
  }
@@ -1063,10 +1074,12 @@ function buildChatSystemPrompt(params) {
1063
1074
  const webAccess = params.webAccess === true;
1064
1075
  const g = params.indexAccessGroup;
1065
1076
  const indexGroupLiteral = typeof g === "number" ? String(g) : g === "public" || g === "private" || g === "authorized" || g === "admin" ? `"${g}"` : '"authorized"';
1077
+ 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)`;
1066
1078
  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.
1067
1079
  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`}.
1080
+ 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 ONLY when the value could be a spreadsheet cell or a row, and then with ONE filtered getRecords on that value, never by paging through a whole table), keep the answer short. The text read from photos, scans and other images IS in the page text searchText covered, so a code, serial or phrase asked about a photo needs no records read: 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.
1068
1081
  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.
1069
- 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.`;
1082
+ 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.`;
1070
1083
  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.`;
1071
1084
  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.
1072
1085
  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.`;
@@ -1083,6 +1096,7 @@ NUMBERS FROM A SPREADSHEET are computed from the ROWS, never from one page and n
1083
1096
  ${documentRules}
1084
1097
  ${accessGroupRule}
1085
1098
  COMPLETE ANSWERS: ONE file is routinely SPLIT ACROSS SEVERAL TABLES (a summary row in one, its page or row content in another, its extracted pictures in "__MEDIA__"), so for anything not scoped to a single file run the query in EVERY table that could hold the answer and combine the results. For any request that counts, sums, totals, lists every match, compares across records, finds which one, or asks whether something is present or ABSENT (for example "how many", "total spent", "which card", "is there any", "\uC5C6\uC5B4?", "\uD558\uB098\uB3C4 \uC5C6\uB098?"), read the COMPLETE matching set across every such table and file before answering. Never assert absence ("there is no X", "none", "not found", "\uC544\uB2C8\uC694, \uC5C6\uC2B5\uB2C8\uB2E4") until a complete scan has come back empty: a confident "no" that later turns out wrong is worse than telling the user you are still checking. If you answered from one table and then find another holds more, re-run the sweep and give the complete answer instead of only apologising.
1099
+ LINKED COPIES: files with the same content are indexed once. A file a tool reports as a linked copy (linked_copy, or listed in a hit's also_at) has no rows or pages of its own: its content is the original's, stored and tagged under the original's name. Cite the original file and say that the copy is the same file; never count the two as two documents.
1086
1100
  Embedded values: a search term is often stored inside a larger string (a merchant "BAKSA" as "DNH*BAKSA#4070277042", a card as "5860****5173"), which no index or tag filter matches. When the value may be embedded, fetch the full set with fetch_all and match the substring yourself.
1087
1101
  File attachments: an "Attached files:" section with markdown links in a user message points at short-lived signed URLs in this project's storage. Image files (.jpg, .jpeg, .png, .gif, .webp) are ALREADY in the message as image blocks: look at them directly. Every other attached file (office documents such as .docx/.xlsx/.pptx/.hwp/.hwpx/.ods, PDFs, email (.eml), text/data/code files such as .csv/.tsv/.json/.xml/.txt/.md) is ALREADY INDEXED: it was read end to end when it was uploaded, before this message reached you, so answer from its records (reference "src::<the storage path from the attachment link>"), and for its exact wording use searchText or readFileContent on that same path (see DOCUMENTS). Some turns instead carry the file text between "BEGIN FILE CONTENT" / "END FILE CONTENT" markers: read that block directly; a "[skapi: ...]" note inside it means that file could not be extracted. ${webAccess ? `Never web_fetch an attachment link (the picture is already in the message, everything else is in the database); a file the user gives as an outside web address may be fetched under the web rule above.` : `This chat has no web tool: never try to download or fetch an attachment link.`}
1088
1102
  Stored files: a file already in this project's storage was read end to end at upload time, so its records come first. For its exact wording find the page with searchText (DOCUMENTS); readFileContent re-reads the raw file (an older file without page text, a data file), and you read it to the end before concluding anything is absent there. If its pictures do not reach you, say so plainly and fall back to the indexed records; never call a file unreadable when its content is in the database.
@@ -1135,7 +1149,7 @@ function buildIndexingSystemPrompt(params) {
1135
1149
  - 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.
1136
1150
  - 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).
1137
1151
  - 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.
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).
1152
+ - 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.
1139
1153
  - 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.
1140
1154
  - 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.
1141
1155
  - 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.
@@ -1212,7 +1226,7 @@ Read this file with the readFileContent tool, using the storage path above - do
1212
1226
  return head + `- temporary URL: ${attachment.url}
1213
1227
  ` + (options.imageFile === "attached" ? `
1214
1228
  This is an IMAGE file, attached to this message as an image: read it there, not from the URL. ` : `
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". Then set "text_rotation" and "text_legibility" on the file's "src::" record, and only then describe what the image shows.`;
1229
+ 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.`;
1216
1230
  }
1217
1231
  return head + `- temporary URL (fetch this to read the file contents): ${attachment.url}`;
1218
1232
  }
@@ -2893,12 +2907,14 @@ async function notifyAgentSaveAttachment(info) {
2893
2907
  const singlePass = !visionFile && !windowedRead && !pagedRead && !continuing;
2894
2908
  const imageFile = singlePass && !parsedContent && !serverExtract ? indexingImageFile(attachment) : void 0;
2895
2909
  const fileUrlDetail = imageFile && platform === "openai" ? getOpenAIImageDetail(info.model || DEFAULT_OPENAI_MODEL) : void 0;
2910
+ const shareIdentical = !continuing && info.shareIdentical !== false && (info.shareIdentical === true || projectShareIdenticalFiles(service));
2896
2911
  const skapiFileUrls = attachment.url && attachment.storagePath ? {
2897
2912
  _skapi_file_urls: [{
2898
2913
  path: attachment.storagePath,
2899
2914
  url: attachment.url,
2900
2915
  ...singlePass ? { index_end: true } : {},
2901
- ...fileUrlDetail ? { detail: fileUrlDetail } : {}
2916
+ ...fileUrlDetail ? { detail: fileUrlDetail } : {},
2917
+ ...shareIdentical ? { share_identical: true } : {}
2902
2918
  }]
2903
2919
  } : {};
2904
2920
  const userMessage = visionFile && renderPlaceholder ? buildIndexingRenderMessage(attachment, renderPlaceholder, renderFrom) : windowedRead && windowPlaceholder ? buildIndexingWindowMessage(attachment, windowPlaceholder, false) : continuing ? buildIndexingContinueMessage(attachment) : buildIndexingUserMessage(
@@ -3025,13 +3041,26 @@ async function notifyAgentSaveAttachment(info) {
3025
3041
  }
3026
3042
  }));
3027
3043
  }
3044
+ function providerDocument(response) {
3045
+ if (typeof response !== "string") return response;
3046
+ var t = response.trim();
3047
+ if (t.charAt(0) !== "{" || t.charAt(t.length - 1) !== "}") return response;
3048
+ try {
3049
+ var doc = JSON.parse(t);
3050
+ return doc && typeof doc === "object" && !Array.isArray(doc) ? doc : response;
3051
+ } catch (e) {
3052
+ return response;
3053
+ }
3054
+ }
3028
3055
  function extractClaudeText(response) {
3056
+ response = providerDocument(response);
3029
3057
  if (!Array.isArray(response?.content)) {
3030
3058
  return "";
3031
3059
  }
3032
3060
  return response.content.filter((block) => block?.type === "text").map((block) => block.text).join("\n");
3033
3061
  }
3034
3062
  function extractOpenAIText(response) {
3063
+ response = providerDocument(response);
3035
3064
  if (typeof response?.output_text === "string" && response.output_text.length) {
3036
3065
  return response.output_text;
3037
3066
  }
@@ -3203,6 +3232,16 @@ function formatDuration(ms) {
3203
3232
  out.push(s + "s");
3204
3233
  return out.join(" ");
3205
3234
  }
3235
+ function formatIndexDuration(ms) {
3236
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
3237
+ var total = Math.floor(ms / 1e3);
3238
+ var h = Math.floor(total / 3600);
3239
+ var m = Math.floor(total % 3600 / 60);
3240
+ var s = total % 60;
3241
+ if (h) return h + " h" + (m ? " " + m + " min" : "");
3242
+ if (m) return m + " min" + (s ? " " + s + " s" : "");
3243
+ return s + " s";
3244
+ }
3206
3245
  function requestIdTimeMs(rid) {
3207
3246
  if (typeof rid !== "string") return 0;
3208
3247
  var stamp = rid.split(":")[0] || "";
@@ -3223,6 +3262,311 @@ function messageTimeMs(m) {
3223
3262
  return typeof m._ts === "number" && m._ts > 0 ? m._ts : 0;
3224
3263
  }
3225
3264
 
3265
+ // src/engine/identical.ts
3266
+ var LINKED_COPY_TAG = "bq_linked";
3267
+ var CONTENT_CLAIM_PREFIX = "cas::";
3268
+ function linkedMarkerOf(data) {
3269
+ if (!data || typeof data !== "object" || data.linked !== true) return null;
3270
+ var original = typeof data.alias_of === "string" ? data.alias_of : "";
3271
+ if (!original) return null;
3272
+ var at = Number(data.completed_at || data.finished || data.linked_at);
3273
+ return {
3274
+ original,
3275
+ claim: typeof data.alias_claim === "string" && data.alias_claim ? data.alias_claim : void 0,
3276
+ linkedAt: isFinite(at) && at > 0 ? at : void 0,
3277
+ group: data.copy_group !== void 0 ? data.copy_group : void 0,
3278
+ owner: typeof data.copy_owner === "string" ? data.copy_owner : void 0,
3279
+ contentKey: typeof data.content_key === "string" && data.content_key ? data.content_key : void 0
3280
+ };
3281
+ }
3282
+ function fileNameOf(path) {
3283
+ var s = String(path || "");
3284
+ var at = s.lastIndexOf("/");
3285
+ return at === -1 ? s : s.slice(at + 1);
3286
+ }
3287
+ function copyStatusOf(marker, original, liveClaims) {
3288
+ var name = fileNameOf(marker.original);
3289
+ var mk = function(kind, label, title, broken) {
3290
+ return { kind, original: marker.original, label, title, broken };
3291
+ };
3292
+ var o = original || {};
3293
+ var claimGone = !!(liveClaims && marker.claim && !liveClaims.has(marker.claim));
3294
+ if (o.done && o.contentKey && marker.contentKey && o.contentKey !== marker.contentKey && o.run !== "working") {
3295
+ return mk(
3296
+ "original_removed",
3297
+ "Original removed or failed",
3298
+ 'Linked to "' + name + '", which now holds other content. Reindex this file to index it on its own.',
3299
+ true
3300
+ );
3301
+ }
3302
+ if (claimGone && !(o.run === "working")) {
3303
+ return mk(
3304
+ "original_removed",
3305
+ "Original removed or failed",
3306
+ 'Linked to "' + name + '", which is no longer indexed. Reindex this file to index it on its own.',
3307
+ true
3308
+ );
3309
+ }
3310
+ if (o.run === "error" || o.run === "cancelled") {
3311
+ return mk(
3312
+ "original_failed",
3313
+ "Original removed or failed",
3314
+ 'Linked to "' + name + '", whose indexing did not finish. Reindex this file to index it on its own.',
3315
+ true
3316
+ );
3317
+ }
3318
+ if (o.run === "working" && !o.done) {
3319
+ return mk(
3320
+ "waiting",
3321
+ "Waiting for " + name,
3322
+ 'Same content as "' + name + '", which is still being indexed. This file shares its index when it finishes.',
3323
+ false
3324
+ );
3325
+ }
3326
+ if (!o.done && o.run !== "done" && liveClaims && !marker.claim) {
3327
+ return mk(
3328
+ "original_removed",
3329
+ "Original removed or failed",
3330
+ 'Linked to "' + name + '", which is no longer indexed. Reindex this file to index it on its own.',
3331
+ true
3332
+ );
3333
+ }
3334
+ return mk(
3335
+ "linked",
3336
+ "Indexed via " + name,
3337
+ 'Same content as "' + name + '"; search and totals count it once.',
3338
+ false
3339
+ );
3340
+ }
3341
+ function copyCountLabel(n) {
3342
+ return n === 1 ? "1 copy" : n + " copies";
3343
+ }
3344
+ function copyCountTitle(copies) {
3345
+ var list = copies.slice(0, 10).map(function(p) {
3346
+ return "/" + p;
3347
+ }).join("\n");
3348
+ var more = copies.length > 10 ? "\n...and " + (copies.length - 10) + " more" : "";
3349
+ return "The same content is also stored as:\n" + list + more + "\nThey share this file's index; search and totals count it once.";
3350
+ }
3351
+ function copiesByOriginal(linked) {
3352
+ var entries = linked instanceof Map ? Array.from(linked.entries()) : Object.keys(linked).map(function(k) {
3353
+ return [k, linked[k]];
3354
+ });
3355
+ entries.sort(function(a, b) {
3356
+ return (a[1].linkedAt || 0) - (b[1].linkedAt || 0) || (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
3357
+ });
3358
+ var out = /* @__PURE__ */ new Map();
3359
+ for (var i = 0; i < entries.length; i++) {
3360
+ var o = entries[i][1].original;
3361
+ if (!out.has(o)) out.set(o, []);
3362
+ out.get(o).push(entries[i][0]);
3363
+ }
3364
+ return out;
3365
+ }
3366
+ function formatLinkDuration(ms) {
3367
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 0) return "";
3368
+ if (ms < 1e4) return (Math.max(ms, 100) / 1e3).toFixed(1) + " s";
3369
+ return formatIndexDuration(ms);
3370
+ }
3371
+ function linkedRowLabel(original, ms) {
3372
+ var took = formatLinkDuration(ms);
3373
+ return "Same content as " + fileNameOf(original) + ": linked" + (took ? " in " + took : "") + ", no AI used";
3374
+ }
3375
+ function parseLinkedReply(text) {
3376
+ if (typeof text !== "string" || text.indexOf('[skapi] Same content as "') === -1) return null;
3377
+ var m = /\[skapi\] Same content as "([^"]+)": linked to its index(?: in ([0-9]+(?:\.[0-9]+)?) s)?/.exec(text);
3378
+ if (!m) return null;
3379
+ var secs = m[2] !== void 0 ? Number(m[2]) : NaN;
3380
+ return { original: m[1], ms: isFinite(secs) ? Math.round(secs * 1e3) : void 0 };
3381
+ }
3382
+ function promotableCopies(linked, actor) {
3383
+ var entries = linked instanceof Map ? Array.from(linked.entries()) : Object.keys(linked).map(function(k) {
3384
+ return [k, linked[k]];
3385
+ });
3386
+ var out = /* @__PURE__ */ new Map();
3387
+ for (var i = 0; i < entries.length; i++) {
3388
+ var m = entries[i][1];
3389
+ if (actor.isProjectOwner || !!actor.userId && !!m && m.owner === actor.userId) out.set(entries[i][0], m);
3390
+ }
3391
+ return out;
3392
+ }
3393
+ function copiesToPromote(linked, removed, removedFolders, actor) {
3394
+ if (actor) linked = promotableCopies(linked, actor);
3395
+ var gone = new Set(removed || []);
3396
+ var folders = (removedFolders || []).filter(Boolean).map(function(f) {
3397
+ return f.replace(/\/+$/, "") + "/";
3398
+ });
3399
+ var isGone = function(p) {
3400
+ if (gone.has(p)) return true;
3401
+ for (var i = 0; i < folders.length; i++) if (p.indexOf(folders[i]) === 0) return true;
3402
+ return false;
3403
+ };
3404
+ var out = [];
3405
+ copiesByOriginal(linked).forEach(function(copies, original) {
3406
+ if (!isGone(original)) return;
3407
+ var keep = copies.filter(function(c) {
3408
+ return !isGone(c);
3409
+ });
3410
+ if (keep.length) out.push({ original, copies: keep });
3411
+ });
3412
+ return out;
3413
+ }
3414
+ function listOf(res) {
3415
+ return res && Array.isArray(res.list) ? res.list : [];
3416
+ }
3417
+ async function listContentClaims(skapi, service, maxPages = 5) {
3418
+ if (!skapi || typeof skapi.getUniqueId !== "function" || !service) return null;
3419
+ try {
3420
+ var out = /* @__PURE__ */ new Set();
3421
+ var fetchMore = false;
3422
+ for (var page = 0; page < maxPages; page++) {
3423
+ var res = await skapi.getUniqueId(
3424
+ { service, unique_id: CONTENT_CLAIM_PREFIX, condition: "gte" },
3425
+ { limit: 1e3, fetchMore }
3426
+ );
3427
+ var list = listOf(res);
3428
+ for (var i = 0; i < list.length; i++) {
3429
+ var id = typeof list[i] === "string" ? list[i] : list[i] && list[i].unique_id;
3430
+ if (typeof id === "string" && id.indexOf(CONTENT_CLAIM_PREFIX) === 0) out.add(id);
3431
+ }
3432
+ if (!res || res.endOfList !== false) return out;
3433
+ fetchMore = true;
3434
+ }
3435
+ return null;
3436
+ } catch (err) {
3437
+ var msg = String(err && (err.code || err.message) || err || "");
3438
+ if (/NOT_EXISTS|not exist/i.test(msg)) return /* @__PURE__ */ new Set();
3439
+ return null;
3440
+ }
3441
+ }
3442
+ async function listLinkedCopies(skapi, service, maxPages = 10) {
3443
+ if (!skapi || typeof skapi.getRecords !== "function" || !service) return null;
3444
+ var out = /* @__PURE__ */ new Map();
3445
+ try {
3446
+ var fetchMore = false;
3447
+ for (var page = 0; page < maxPages; page++) {
3448
+ var res = await skapi.getRecords(
3449
+ { service, table: { name: "__INDEXING__", access_group: "authorized" }, tag: LINKED_COPY_TAG },
3450
+ { limit: 1e3, fetchMore }
3451
+ );
3452
+ var list = listOf(res);
3453
+ for (var i = 0; i < list.length; i++) {
3454
+ var r = list[i] || {};
3455
+ var uid = String(r.unique_id || "");
3456
+ if (uid.indexOf("done::") !== 0) continue;
3457
+ var mk = linkedMarkerOf(r.data);
3458
+ if (mk) out.set(uid.slice(6), mk);
3459
+ }
3460
+ if (!res || res.endOfList !== false) return out;
3461
+ fetchMore = true;
3462
+ }
3463
+ return out;
3464
+ } catch (err) {
3465
+ var msg = String(err && (err.code || err.message) || err || "");
3466
+ if (/NOT_EXISTS|not exist/i.test(msg)) return out;
3467
+ return null;
3468
+ }
3469
+ }
3470
+ function bodyOf(res) {
3471
+ if (typeof res === "string") {
3472
+ try {
3473
+ return JSON.parse(res);
3474
+ } catch (_) {
3475
+ return res;
3476
+ }
3477
+ }
3478
+ return res;
3479
+ }
3480
+ function errorText(err) {
3481
+ var b = err && (err.body || err.data || err.response);
3482
+ var bb = bodyOf(b);
3483
+ if (bb && typeof bb === "object") {
3484
+ if (typeof bb.reason === "string") return bb.reason;
3485
+ if (typeof bb.message === "string") return bb.message;
3486
+ }
3487
+ if (typeof bb === "string" && bb) return bb;
3488
+ return String(err && err.message || err || "The request failed.");
3489
+ }
3490
+ async function callMcpRoute(route, args, data) {
3491
+ var base = String(chatEngineConfig().mcpBaseUrl || "").replace(/\/+$/, "");
3492
+ if (!base) throw new Error("No BunnyQuery server is configured.");
3493
+ var res = await resolveForwardRequest()({
3494
+ service: args.service,
3495
+ ...args.owner ? { owner: args.owner } : {},
3496
+ url: base + route,
3497
+ method: "POST",
3498
+ headers: { "content-type": "application/json", Authorization: "Bearer $ACCESS_TOKEN" },
3499
+ data: Object.assign({ project_id: args.service }, data)
3500
+ });
3501
+ return bodyOf(res);
3502
+ }
3503
+ async function findIdenticalFiles(args) {
3504
+ var calls = Math.max(1, args.maxCalls || 12);
3505
+ var last = null;
3506
+ for (var i = 0; i < calls; i++) {
3507
+ var body;
3508
+ try {
3509
+ body = await callMcpRoute("/internal/identical-files", args, { budget_s: args.budgetS || 8 });
3510
+ } catch (err) {
3511
+ var msg = errorText(err);
3512
+ if (/timed? ?out|timeout|504/i.test(msg) && i < calls - 1) continue;
3513
+ throw new Error(msg);
3514
+ }
3515
+ if (!body || typeof body !== "object" || !Array.isArray(body.groups)) {
3516
+ throw new Error(typeof body === "string" && body ? body : "The server did not answer the scan.");
3517
+ }
3518
+ last = { complete: !!body.complete, scanned: Number(body.scanned) || 0, total: Number(body.total) || 0, groups: body.groups, skipped: body.skipped };
3519
+ if (args.onProgress) args.onProgress(last);
3520
+ if (last.complete) return last;
3521
+ }
3522
+ return last;
3523
+ }
3524
+ async function linkIdenticalFile(args) {
3525
+ var last = "";
3526
+ for (var attempt = 0; attempt < 4; attempt++) {
3527
+ try {
3528
+ var body = await callMcpRoute("/internal/identical-link", args, { copy: args.copy, original: args.original });
3529
+ if (body && typeof body === "object" && typeof body.linked === "boolean") return body;
3530
+ return { linked: false, reason: typeof body === "string" && body ? body : "unexpected answer" };
3531
+ } catch (err) {
3532
+ last = errorText(err);
3533
+ if (!/timed? ?out|timeout|504/i.test(last)) return { linked: false, reason: last };
3534
+ await new Promise(function(r) {
3535
+ setTimeout(r, 8e3);
3536
+ });
3537
+ }
3538
+ }
3539
+ return { linked: false, reason: last || "timed out" };
3540
+ }
3541
+ function identicalLinkReasonText(reason) {
3542
+ switch (reason) {
3543
+ case "not_identical":
3544
+ return "the two files no longer have the same content";
3545
+ case "original_not_indexed":
3546
+ return "the original is not indexed";
3547
+ case "original_is_a_copy":
3548
+ return "the original is itself a linked copy";
3549
+ case "less_open_original":
3550
+ return "the original can be read by fewer people than the copy";
3551
+ case "private_original":
3552
+ return "the original is private";
3553
+ case "private_copy":
3554
+ return "the copy is another user's private file: it shares the index once that user indexes it again";
3555
+ case "content_claimed_by_another_file":
3556
+ return "another file already holds this content's index";
3557
+ case "not_readable":
3558
+ return "one of the files could not be read from storage";
3559
+ case "different_kind":
3560
+ return "the files are of different kinds";
3561
+ case "no_file_record":
3562
+ return "one of the files has no index record";
3563
+ case "unshared_access_group":
3564
+ return "the file's access group cannot share an index";
3565
+ default:
3566
+ return reason || "refused";
3567
+ }
3568
+ }
3569
+
3226
3570
  // src/engine/indexing_groups.ts
3227
3571
  function canonIndexKey(s) {
3228
3572
  return typeof s === "string" && s ? s.trim() : "";
@@ -3301,6 +3645,50 @@ function overlayRunRecordVerdict(grp, rec, liveIndexKeys) {
3301
3645
  grp.resolving = false;
3302
3646
  grp.resolvingReason = void 0;
3303
3647
  }
3648
+ function runRecordDurationMs(rec) {
3649
+ if (!rec || rec.status !== "done") return void 0;
3650
+ var a = rec.started;
3651
+ var b = rec.finished;
3652
+ if (typeof a !== "number" || typeof b !== "number" || !isFinite(a) || !isFinite(b) || b < a) return void 0;
3653
+ return b - a;
3654
+ }
3655
+ var RUN_DURATION_CLOCK_SLACK_MS = 6e4;
3656
+ var RUN_DURATION_SERVER_SLACK_MS = 5e3;
3657
+ function runRecordGroupDurationMs(grp, rec) {
3658
+ if (rec.status !== "done" || !grp.members.length) return void 0;
3659
+ var fin = rec.finished;
3660
+ if (typeof fin !== "number" || !isFinite(fin)) return void 0;
3661
+ var firstTs = messageTimeMs(grp.members[0].msg);
3662
+ var lastTs = messageTimeMs(grp.members[grp.members.length - 1].msg);
3663
+ if (!firstTs || !lastTs) return void 0;
3664
+ if (fin < firstTs || fin < lastTs - RUN_DURATION_SERVER_SLACK_MS) return void 0;
3665
+ var firstPassTs = 0;
3666
+ for (var i = 0; i < grp.members.length; i++) {
3667
+ var m = grp.members[i].msg;
3668
+ if (m.role !== "user") continue;
3669
+ var ref = readFileRef(m);
3670
+ if (ref && !ref.continued) firstPassTs = messageTimeMs(m);
3671
+ break;
3672
+ }
3673
+ var st = typeof rec.started === "number" && isFinite(rec.started) ? rec.started : void 0;
3674
+ var start;
3675
+ if (st !== void 0 && st > firstTs + RUN_DURATION_CLOCK_SLACK_MS) return void 0;
3676
+ if (firstPassTs) {
3677
+ start = st !== void 0 && st >= firstPassTs - RUN_DURATION_CLOCK_SLACK_MS ? st : firstPassTs;
3678
+ } else {
3679
+ if (st === void 0) return void 0;
3680
+ start = st;
3681
+ }
3682
+ return fin >= start ? fin - start : void 0;
3683
+ }
3684
+ function indexGroupDurationLabel(group) {
3685
+ if (!group || group.status !== "done" || !group.finished || group.resolving || group.queued) return "";
3686
+ return formatIndexDuration(group.durationMs);
3687
+ }
3688
+ function indexGroupLinkedLabel(group) {
3689
+ if (!group || !group.linked || group.status !== "done") return "";
3690
+ return linkedRowLabel(group.linked.original, group.linked.ms);
3691
+ }
3304
3692
  function buildChatDisplayList(messages, opts) {
3305
3693
  var list = Array.isArray(messages) ? messages : [];
3306
3694
  var liveIndexKeys = opts && opts.liveIndexKeys || {};
@@ -3496,6 +3884,14 @@ function buildChatDisplayList(messages, opts) {
3496
3884
  var vm = grp.members[vi];
3497
3885
  if (vm.msg._indexComplete) sawComplete = true;
3498
3886
  if (!isHiddenPass(vm.msg)) grp.visibleMembers.push(vm);
3887
+ if (vm.msg.role === "assistant" && !vm.msg.isError && !grp.linked) {
3888
+ var linkedReply = parseLinkedReply(vm.msg.content);
3889
+ if (linkedReply) grp.linked = linkedReply;
3890
+ }
3891
+ }
3892
+ if (grp.linked && grp.status !== "active" && grp.status !== "cancelled") {
3893
+ grp.status = "done";
3894
+ sawComplete = true;
3499
3895
  }
3500
3896
  grp.driver = !isPagedReadFile(grp.name, grp.mime) ? "single" : isImageVisionFile(grp.name, grp.mime) ? "worker" : windowedIndexing ? "worker" : "client";
3501
3897
  if (grp.status === "active") {
@@ -3507,7 +3903,7 @@ function buildChatDisplayList(messages, opts) {
3507
3903
  } else if (grp.driver === "client") {
3508
3904
  grp.finished = sawComplete || grp.status === "error" || grp.passCount >= MAX_INDEXING_RESUME_PASSES;
3509
3905
  } else {
3510
- grp.finished = !newestRunOfKey[order[oi]] || !!doneKeys[grp.key] && !liveIndexKeys[grp.key] || liveIndexChecked && !liveIndexKeys[grp.key];
3906
+ grp.finished = !newestRunOfKey[order[oi]] || !!grp.linked || !!doneKeys[grp.key] && !liveIndexKeys[grp.key] || liveIndexChecked && !liveIndexKeys[grp.key];
3511
3907
  }
3512
3908
  if (grp.status !== "done") {
3513
3909
  grp.resolving = false;
@@ -3656,7 +4052,10 @@ function buildChatDisplayList(messages, opts) {
3656
4052
  resolvingReason: reason,
3657
4053
  stub: true,
3658
4054
  queued: waitingStub || live && !!runningKeys && !runningKeys[sp] && !runningKeys[canonIndexKey(sp)] && !runningKeys[fname] ? true : void 0,
3659
- stubError: rec.error || (st === "error" && !rec.error ? "Indexing did not finish." : void 0)
4055
+ stubError: rec.error || (st === "error" && !rec.error ? "Indexing did not finish." : void 0),
4056
+ // The stub IS the record, so a 'done' record's span is this run's.
4057
+ durationMs: st === "done" ? runRecordDurationMs(rec) : void 0,
4058
+ linked: st === "done" && rec.linked && rec.alias_of ? { original: rec.alias_of, ms: typeof rec.link_ms === "number" ? rec.link_ms : void 0 } : void 0
3660
4059
  };
3661
4060
  stubList.push({ started: typeof rec.started === "number" ? rec.started : Infinity, group: sg });
3662
4061
  }
@@ -3675,6 +4074,10 @@ function buildChatDisplayList(messages, opts) {
3675
4074
  tg.runKey = "run:" + (tg.path || tg.key) + "#" + trec.started;
3676
4075
  stubList.push({ started: trec.started, group: tg });
3677
4076
  overlayRunRecordVerdict(tg, trec, liveIndexKeys);
4077
+ tg.durationMs = runRecordGroupDurationMs(tg, trec);
4078
+ if (trec.linked && trec.alias_of && trec.status === "done") {
4079
+ tg.linked = { original: trec.alias_of, ms: tg.linked && tg.linked.ms !== void 0 ? tg.linked.ms : typeof trec.link_ms === "number" ? trec.link_ms : void 0 };
4080
+ }
3678
4081
  }
3679
4082
  }
3680
4083
  stubList.sort(function(a, b) {
@@ -3716,7 +4119,7 @@ function isDuplicateCandidateId(uniqueId, name) {
3716
4119
  const tail = "/" + name;
3717
4120
  return uniqueId.length > SRC_PREFIX2.length + tail.length && uniqueId.slice(-tail.length) === tail;
3718
4121
  }
3719
- function listOf(res) {
4122
+ function listOf2(res) {
3720
4123
  if (!res) return [];
3721
4124
  if (Array.isArray(res)) return res;
3722
4125
  return Array.isArray(res.list) ? res.list : [];
@@ -3733,14 +4136,14 @@ function nfc(text) {
3733
4136
  async function storedCopyIndexing(skapi, storagePath, service) {
3734
4137
  const doneId = "done::" + storagePath;
3735
4138
  try {
3736
- const done = listOf(await skapi.getUniqueId(Object.assign({ unique_id: doneId }, service), { fetchMore: false, limit: 1 }));
4139
+ const done = listOf2(await skapi.getUniqueId(Object.assign({ unique_id: doneId }, service), { fetchMore: false, limit: 1 }));
3737
4140
  if (done.some(function(it) {
3738
4141
  return (it && typeof it === "object" ? it.unique_id : it) === doneId;
3739
4142
  })) return "done";
3740
4143
  } catch {
3741
4144
  }
3742
4145
  try {
3743
- const run = listOf(await skapi.getRecords(Object.assign({ unique_id: "run::" + storagePath }, service)))[0];
4146
+ const run = listOf2(await skapi.getRecords(Object.assign({ unique_id: "run::" + storagePath }, service)))[0];
3744
4147
  const data = run && run.data && typeof run.data === "object" ? run.data : null;
3745
4148
  if (data && data.status === "working" && typeof data.started === "number" && Date.now() - data.started < RUN_RECORD_WORKING_STALE_MS) return "running";
3746
4149
  } catch {
@@ -3769,7 +4172,7 @@ async function lookupDuplicate(skapi, file, userId, opts) {
3769
4172
  const size = file && typeof file.size === "number" ? file.size : NaN;
3770
4173
  if (!name || !(size >= 0) || !userId) return null;
3771
4174
  const service = opts && opts.service ? { service: opts.service } : {};
3772
- const found = listOf(await skapi.getUniqueId(
4175
+ const found = listOf2(await skapi.getUniqueId(
3773
4176
  Object.assign({ unique_id: name, condition: "<=" }, service),
3774
4177
  { fetchMore: false, limit: DUPLICATE_LOOKUP_LIMIT }
3775
4178
  ));
@@ -3782,7 +4185,7 @@ async function lookupDuplicate(skapi, file, userId, opts) {
3782
4185
  for (const uniqueId of ids) {
3783
4186
  let record = null;
3784
4187
  try {
3785
- record = listOf(await skapi.getRecords(Object.assign({ unique_id: uniqueId }, service)))[0] || null;
4188
+ record = listOf2(await skapi.getRecords(Object.assign({ unique_id: uniqueId }, service)))[0] || null;
3786
4189
  } catch {
3787
4190
  continue;
3788
4191
  }
@@ -4113,6 +4516,22 @@ var IMAGE_PREVIEWS_PER_MESSAGE = 8;
4113
4516
  var INLINE_LINK_GLYPH = "\u2197";
4114
4517
  var INLINE_LINK_UNAVAILABLE_GLYPH = "\u2715";
4115
4518
  var INLINE_LINK_UNAVAILABLE_SUFFIX = " (unavailable)";
4519
+ var FIT_LABEL_TAIL_CHARS = 8;
4520
+ function splitLabelForFit(name) {
4521
+ var chars = Array.from(String(name == null ? "" : name));
4522
+ var dot = -1;
4523
+ for (var i = chars.length - 1; i > 0; i--) {
4524
+ if (chars[i] === ".") {
4525
+ dot = i;
4526
+ break;
4527
+ }
4528
+ if (chars[i] === " " || chars[i] === "/" || chars.length - i > 10) break;
4529
+ }
4530
+ var extStart = dot > 0 && dot < chars.length - 1 ? dot : chars.length;
4531
+ var tailStart = Math.max(0, extStart - FIT_LABEL_TAIL_CHARS);
4532
+ if (tailStart < 4) return { stem: chars.join(""), tail: "" };
4533
+ return { stem: chars.slice(0, tailStart).join(""), tail: chars.slice(tailStart).join("") };
4534
+ }
4116
4535
  function renderInlineLinkHtml(link, opts) {
4117
4536
  var o = opts || {};
4118
4537
  var unavailable = !!o.unavailable;
@@ -4125,7 +4544,16 @@ function renderInlineLinkHtml(link, opts) {
4125
4544
  if (unavailable) cls.push("is-unavailable");
4126
4545
  if (preview) cls.push("is-image-preview");
4127
4546
  var glyphHtml = '<span class="bq-link-glyph" translate="no">' + (unavailable ? INLINE_LINK_UNAVAILABLE_GLYPH : INLINE_LINK_GLYPH) + "</span>";
4128
- var labelHtml = glyphHtml + escapeInlineHtml(link.label + (unavailable ? INLINE_LINK_UNAVAILABLE_SUFFIX : refreshing ? " (fetching...)" : ""));
4547
+ var stateSuffix = unavailable ? INLINE_LINK_UNAVAILABLE_SUFFIX : refreshing ? " (fetching...)" : "";
4548
+ var fit = !!o.fitLabel && !preview;
4549
+ if (fit) cls.push("bq-link-fit");
4550
+ var labelHtml;
4551
+ if (fit) {
4552
+ var split = splitLabelForFit(full);
4553
+ 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>" : "");
4554
+ } else {
4555
+ labelHtml = glyphHtml + escapeInlineHtml(link.label + stateSuffix);
4556
+ }
4129
4557
  var attrs = ['class="' + cls.join(" ") + '"'];
4130
4558
  if (unavailable) attrs.push('aria-disabled="true"', 'data-bq-unavailable="1"');
4131
4559
  else attrs.push('href="' + escapeInlineHtml(link.href) + '"', 'target="_blank"', 'rel="noopener noreferrer"');
@@ -5853,6 +6281,10 @@ function canReportWrongAnswer(msg) {
5853
6281
  var note = retrievalNoteOfAnswer(msg);
5854
6282
  return !!note && !answerUsedNoDataTool(note) && !msg.isCancelled;
5855
6283
  }
6284
+ var UPLOAD_CANCELLED_MESSAGE = "Upload cancelled";
6285
+ function isUploadCancelledError(err) {
6286
+ return !!err && (err.code === "CANCELLED" || err.message === UPLOAD_CANCELLED_MESSAGE);
6287
+ }
5856
6288
  var _ChatSession = class _ChatSession {
5857
6289
  constructor(host) {
5858
6290
  // --- live streaming ----------------------------------------------------
@@ -6274,6 +6706,43 @@ var _ChatSession = class _ChatSession {
6274
6706
  return queued;
6275
6707
  });
6276
6708
  }
6709
+ /**
6710
+ * ONE SHARED INDEX FOR IDENTICAL FILES: the linked copies that lose their original when
6711
+ * `removed` files (or every file under `folders`) go away, per original, oldest first
6712
+ * (identical.ts copiesToPromote). Read through host.findLinkedCopies, fresh, and it has
6713
+ * to be read BEFORE the delete or reset: those remove nothing from the copies' markers,
6714
+ * but a later sweep could no longer tell whose copies they were once a new original
6715
+ * exists. Never rejects; [] without the hook or on any failure.
6716
+ */
6717
+ collectLinkedCopies(removed, folders) {
6718
+ if (typeof this.host.findLinkedCopies !== "function") return Promise.resolve([]);
6719
+ var id = this.host.getIdentity();
6720
+ var actor = { userId: id && !id.anonymous ? id.userId : null, isProjectOwner: !!(id && !id.anonymous && id.owner && id.userId === id.owner) };
6721
+ return Promise.resolve(this.host.findLinkedCopies()).then(function(map) {
6722
+ return map ? copiesToPromote(map, removed || [], folders, actor) : [];
6723
+ }).catch(function() {
6724
+ return [];
6725
+ });
6726
+ }
6727
+ /**
6728
+ * Send the copies of a removed or overwritten original again (owner decision
6729
+ * 2026-11-26): each list's oldest copy first, so its first pass claims the content and
6730
+ * is indexed for real (one AI run), then the others, which link to it with no AI call.
6731
+ * The share flag rides on every first pass while the project's switch is on (requests.ts
6732
+ * notifyAgentSaveAttachment). Through reindexStoredFiles, so each copy keeps its access
6733
+ * group and shows as a "Reindexing" row. Resolves to the number of files queued.
6734
+ */
6735
+ promoteLinkedCopies(plan) {
6736
+ var list = [];
6737
+ (plan || []).forEach(function(g) {
6738
+ (g && g.copies || []).forEach(function(c) {
6739
+ if (c) list.push({ storagePath: c });
6740
+ });
6741
+ });
6742
+ if (!list.length) return Promise.resolve(0);
6743
+ console.log("[chat-engine] identical files: sending " + list.length + " linked cop" + (list.length === 1 ? "y" : "ies") + " again, their original is gone:", plan);
6744
+ return this.reindexStoredFiles(list);
6745
+ }
6277
6746
  /**
6278
6747
  * The same question, asked of the SERVER when this page cannot answer it.
6279
6748
  *
@@ -13018,6 +13487,29 @@ var _ChatSession = class _ChatSession {
13018
13487
  });
13019
13488
  }
13020
13489
  // --- attachment upload orchestration ---------------------------------
13490
+ /**
13491
+ * The user cancelled this chip's upload (the widget's per-chip x or "Cancel all
13492
+ * uploads"). Stops the bytes now when they are moving (the host's abort), and
13493
+ * leaves a flag every later step of uploadSingleAttachment checks, so a cancel
13494
+ * that lands between steps (the get-signed-url round trip before the bytes, or
13495
+ * the src:: record and the indexing request after them) still stops the file
13496
+ * from being indexed and from being attached to the chat turn. A member whose
13497
+ * indexing request has already gone out is past cancelling: it shows as an
13498
+ * indexing row with its own Stop. Returns false for a chip that is not being
13499
+ * uploaded by this session any more.
13500
+ */
13501
+ cancelAttachmentUpload(att) {
13502
+ if (!att || att._cancelled) return false;
13503
+ if (att.status !== "uploading" && !att._batchId) return false;
13504
+ att._cancelled = true;
13505
+ if (typeof att._abort === "function") {
13506
+ try {
13507
+ att._abort();
13508
+ } catch (e) {
13509
+ }
13510
+ }
13511
+ return true;
13512
+ }
13021
13513
  // Upload one attachment (a file = 1 member, a folder = N) to db storage and
13022
13514
  // queue indexing per member. The bytes I/O + chip rendering go through host
13023
13515
  // hooks; the overwrite/reindex flow, status lifecycle, and indexing live here.
@@ -13040,6 +13532,18 @@ var _ChatSession = class _ChatSession {
13040
13532
  var anyIndexFailed = false;
13041
13533
  var reusedCount = 0;
13042
13534
  att.reused = false;
13535
+ att._storedCount = 0;
13536
+ att._indexQueuedCount = 0;
13537
+ att._indexQueued = false;
13538
+ att._landedNew = [];
13539
+ var cancelError = function() {
13540
+ var e = new Error(UPLOAD_CANCELLED_MESSAGE);
13541
+ e.code = "CANCELLED";
13542
+ return e;
13543
+ };
13544
+ var checkCancel = function() {
13545
+ if (att._cancelled) throw cancelError();
13546
+ };
13043
13547
  delete att.duplicates;
13044
13548
  var chain = Promise.resolve();
13045
13549
  var findDuplicate = function(member) {
@@ -13056,25 +13560,54 @@ var _ChatSession = class _ChatSession {
13056
13560
  };
13057
13561
  members.forEach(function(member, idx) {
13058
13562
  chain = chain.then(function() {
13563
+ checkCancel();
13059
13564
  var hadExists = false;
13060
13565
  var skipped = false;
13566
+ var promotion = null;
13061
13567
  var duplicateOf = null;
13062
13568
  var existedBefore = false;
13569
+ var madeRecord = false;
13570
+ var sentAll = false;
13063
13571
  var onProg = function(p) {
13572
+ if (p && p.total && p.loaded >= p.total) sentAll = true;
13064
13573
  if (p && p.total) {
13065
13574
  att.progress = Math.floor((idx + p.loaded / p.total) / total * 100);
13066
13575
  self.host.renderAttachmentChips();
13067
13576
  }
13068
13577
  };
13069
13578
  var doMemberUpload = function(checkExistence) {
13579
+ checkCancel();
13580
+ sentAll = false;
13070
13581
  return self.host.uploadFile({
13071
13582
  file: member.file,
13072
13583
  storagePath: member.storagePath,
13073
13584
  checkExistence,
13074
13585
  onProgress: onProg,
13586
+ // The host hands its abort over just before the bytes start. A
13587
+ // cancel made during the get-signed-url round trip had nothing to
13588
+ // abort yet, so it is applied here, before anything is sent: a
13589
+ // storage POST that never completes leaves no object behind.
13075
13590
  setAbort: function(abort) {
13076
13591
  att._abort = abort;
13592
+ if (att._cancelled) {
13593
+ try {
13594
+ abort();
13595
+ } catch (e) {
13596
+ }
13597
+ }
13077
13598
  }
13599
+ }).then(function(r) {
13600
+ att._abort = null;
13601
+ att._storedCount = (att._storedCount || 0) + 1;
13602
+ if (checkExistence) att._landedNew.push(member.storagePath);
13603
+ return r;
13604
+ }, function(err) {
13605
+ att._abort = null;
13606
+ if (att._cancelled) {
13607
+ if (checkExistence && sentAll) att._landedNew.push(member.storagePath);
13608
+ throw cancelError();
13609
+ }
13610
+ throw err;
13078
13611
  });
13079
13612
  };
13080
13613
  if (isIndexRetry) {
@@ -13097,6 +13630,7 @@ var _ChatSession = class _ChatSession {
13097
13630
  return self.host.promptOverwrite(member.file.name).then(function(choice) {
13098
13631
  if (choice === "overwrite") {
13099
13632
  existedBefore = true;
13633
+ promotion = self.collectLinkedCopies([member.storagePath]);
13100
13634
  markImagePreviewStale(self.host.getIdentity().projectId || "default", member.storagePath);
13101
13635
  return doMemberUpload(false);
13102
13636
  }
@@ -13108,12 +13642,14 @@ var _ChatSession = class _ChatSession {
13108
13642
  existedBefore = true;
13109
13643
  });
13110
13644
  }).then(function() {
13645
+ checkCancel();
13111
13646
  if (skipped) return;
13112
13647
  return Promise.resolve(self.host.getTemporaryUrl(duplicateOf || member.storagePath)).catch(function(err) {
13113
13648
  var ecode = err && (err.code || err.body && err.body.code);
13114
13649
  var emsg = String(err && (err.message || err.body && err.body.message) || err || "");
13115
13650
  var refused = /no access to this file/i.test(emsg) || ecode === "INVALID_REQUEST" && /access/i.test(emsg);
13116
13651
  if (duplicateOf || !refused || typeof self.host.ensureFileIndexRecord !== "function") throw err;
13652
+ madeRecord = !existedBefore;
13117
13653
  return Promise.resolve(self.host.ensureFileIndexRecord(member.storagePath, {
13118
13654
  name: member.file.name,
13119
13655
  mime: member.file.type || self.host.getMimeType(member.file.name),
@@ -13123,6 +13659,13 @@ var _ChatSession = class _ChatSession {
13123
13659
  });
13124
13660
  });
13125
13661
  }).then(function(url) {
13662
+ if (att._cancelled) {
13663
+ var dropEarly = madeRecord && typeof self.host.deleteExistingFileRecord === "function" ? Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13664
+ }) : Promise.resolve();
13665
+ return dropEarly.then(function() {
13666
+ throw cancelError();
13667
+ });
13668
+ }
13126
13669
  if (skipped) return;
13127
13670
  if (duplicateOf) {
13128
13671
  urls.push({ name: member.relPath, url, storagePath: duplicateOf });
@@ -13151,13 +13694,14 @@ var _ChatSession = class _ChatSession {
13151
13694
  var mime = member.file.type || self.host.getMimeType(member.file.name);
13152
13695
  var alreadyIndexing = false;
13153
13696
  var existingGroup = null;
13697
+ var clearedOld = false;
13154
13698
  var preIndex = self.claimIndexRun(member.storagePath).then(function(claimed) {
13155
13699
  alreadyIndexing = !claimed;
13156
13700
  if (alreadyIndexing) {
13157
13701
  console.log("[chat-engine] skipping a duplicate index request for", member.storagePath);
13158
13702
  return;
13159
13703
  }
13160
- if (!existedBefore) return;
13704
+ if (!existedBefore || att._cancelled) return;
13161
13705
  var readGroup = typeof self.host.readFileAccessGroup === "function" ? Promise.resolve(self.host.readFileAccessGroup(member.storagePath)).then(function(g) {
13162
13706
  existingGroup = g || null;
13163
13707
  }, function(err) {
@@ -13165,7 +13709,9 @@ var _ChatSession = class _ChatSession {
13165
13709
  throw err;
13166
13710
  }) : Promise.resolve();
13167
13711
  return readGroup.then(function() {
13712
+ if (att._cancelled) return;
13168
13713
  if (typeof self.host.deleteExistingFileRecord === "function") {
13714
+ clearedOld = true;
13169
13715
  return Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13170
13716
  });
13171
13717
  }
@@ -13173,7 +13719,9 @@ var _ChatSession = class _ChatSession {
13173
13719
  });
13174
13720
  preIndex = preIndex.then(function() {
13175
13721
  if (alreadyIndexing) return;
13722
+ if (att._cancelled && !clearedOld) return;
13176
13723
  if (typeof self.host.ensureFileIndexRecord !== "function") return;
13724
+ if (!existedBefore) madeRecord = true;
13177
13725
  return Promise.resolve(self.host.ensureFileIndexRecord(member.storagePath, {
13178
13726
  name: member.file.name,
13179
13727
  mime: mime || void 0,
@@ -13194,10 +13742,31 @@ var _ChatSession = class _ChatSession {
13194
13742
  }).catch(function() {
13195
13743
  });
13196
13744
  });
13745
+ var abandonIfCancelled = function() {
13746
+ if (!att._cancelled) return;
13747
+ if (!alreadyIndexing) self.releaseIndexRun(member.storagePath);
13748
+ var drop = !existedBefore && !alreadyIndexing && madeRecord && typeof self.host.deleteExistingFileRecord === "function" ? Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
13749
+ }) : Promise.resolve();
13750
+ return drop.then(function() {
13751
+ throw cancelError();
13752
+ });
13753
+ };
13197
13754
  return preIndex.then(function() {
13755
+ return abandonIfCancelled();
13756
+ }).then(function() {
13198
13757
  return parseAttachmentContent(member.file, member.file.name, mime || void 0);
13758
+ }).then(function(parsedContent) {
13759
+ return Promise.resolve(abandonIfCancelled()).then(function() {
13760
+ return parsedContent;
13761
+ });
13199
13762
  }).then(function(parsedContent) {
13200
13763
  if (alreadyIndexing) return;
13764
+ att._indexQueuedCount = (att._indexQueuedCount || 0) + 1;
13765
+ if (att.kind !== "folder") att._indexQueued = true;
13766
+ att._landedNew = (att._landedNew || []).filter(function(p) {
13767
+ return p !== member.storagePath;
13768
+ });
13769
+ self.host.renderAttachmentChips();
13201
13770
  return self.trackIndexDispatch(notifyAgentSaveAttachment({
13202
13771
  platform: id.platform,
13203
13772
  model: id.model,
@@ -13238,6 +13807,14 @@ var _ChatSession = class _ChatSession {
13238
13807
  });
13239
13808
  self.noteBgQueueChanged();
13240
13809
  self.drainBgTaskQueue();
13810
+ if (promotion) {
13811
+ var plan = promotion;
13812
+ promotion = null;
13813
+ plan.then(function(pl) {
13814
+ return self.promoteLinkedCopies(pl);
13815
+ }).catch(function() {
13816
+ });
13817
+ }
13241
13818
  }
13242
13819
  }, function(e) {
13243
13820
  console.error("[chat-engine] indexing request failed", e);
@@ -13253,6 +13830,7 @@ var _ChatSession = class _ChatSession {
13253
13830
  });
13254
13831
  });
13255
13832
  return chain.then(function() {
13833
+ checkCancel();
13256
13834
  att._abort = null;
13257
13835
  att.progress = 100;
13258
13836
  if (att.kind === "folder") att.uploadedUrls = urls.map(function(u) {
@@ -13313,12 +13891,26 @@ var _ChatSession = class _ChatSession {
13313
13891
  return a.id === att.id;
13314
13892
  });
13315
13893
  var aborted = err && (err.message === "Aborted" || err === "Aborted");
13894
+ if (att._cancelled || isUploadCancelledError(err)) {
13895
+ att.status = "cancelled";
13896
+ att._abort = null;
13897
+ self.host.renderAttachmentChips();
13898
+ if (typeof att._onCancelSettled === "function") {
13899
+ try {
13900
+ att._onCancelSettled((att._landedNew || []).slice());
13901
+ } catch (e) {
13902
+ }
13903
+ }
13904
+ return;
13905
+ }
13316
13906
  if (removed || aborted) return;
13317
13907
  att.status = "error";
13318
13908
  att.errorMessage = "File upload has failed";
13319
13909
  att.errorCode = err && (err.code || err.body && err.body.code) || "";
13320
13910
  att.errorDetail = err && (err.message || err.body && err.body.message) || (typeof err === "string" ? err : "");
13321
13911
  self.host.renderAttachmentChips();
13912
+ }).then(function() {
13913
+ att._settledBatch = att._batchId || true;
13322
13914
  });
13323
13915
  });
13324
13916
  });
@@ -13356,6 +13948,7 @@ exports.BOM_EXTS = BOM_EXTS;
13356
13948
  exports.CHAT_GREETING_MAX_LENGTH = CHAT_GREETING_MAX_LENGTH;
13357
13949
  exports.CLAUDE_INPUT_CAP_RATIO = CLAUDE_INPUT_CAP_RATIO;
13358
13950
  exports.CLAUDE_PER_REQUEST_INPUT_CAP = CLAUDE_PER_REQUEST_INPUT_CAP;
13951
+ exports.CONTENT_CLAIM_PREFIX = CONTENT_CLAIM_PREFIX;
13359
13952
  exports.CONTEXT_WINDOW_BY_MODEL = CONTEXT_WINDOW_BY_MODEL;
13360
13953
  exports.CONTEXT_WINDOW_DEFAULT = CONTEXT_WINDOW_DEFAULT;
13361
13954
  exports.ChatSession = ChatSession;
@@ -13364,6 +13957,7 @@ exports.DEFAULT_ANSWER_MODE = DEFAULT_ANSWER_MODE;
13364
13957
  exports.DEFAULT_CLAUDE_MODEL = DEFAULT_CLAUDE_MODEL;
13365
13958
  exports.DEFAULT_CONTEXT_WINDOW = DEFAULT_CONTEXT_WINDOW;
13366
13959
  exports.DEFAULT_OPENAI_MODEL = DEFAULT_OPENAI_MODEL;
13960
+ exports.DEFAULT_SHARE_IDENTICAL_FILES = DEFAULT_SHARE_IDENTICAL_FILES;
13367
13961
  exports.DEFAULT_SKIP_DUPLICATE_FILES = DEFAULT_SKIP_DUPLICATE_FILES;
13368
13962
  exports.DEFAULT_UPLOAD_ACCESS_GROUP = DEFAULT_UPLOAD_ACCESS_GROUP;
13369
13963
  exports.DEFAULT_WEB_ACCESS = DEFAULT_WEB_ACCESS;
@@ -13387,6 +13981,7 @@ exports.INLINE_LINK_GLYPH = INLINE_LINK_GLYPH;
13387
13981
  exports.INLINE_LINK_UNAVAILABLE_GLYPH = INLINE_LINK_UNAVAILABLE_GLYPH;
13388
13982
  exports.INLINE_LINK_UNAVAILABLE_SUFFIX = INLINE_LINK_UNAVAILABLE_SUFFIX;
13389
13983
  exports.INPUT_CAP_RATIO = INPUT_CAP_RATIO;
13984
+ exports.LINKED_COPY_TAG = LINKED_COPY_TAG;
13390
13985
  exports.LINK_LABEL_MAX_DISPLAY_CHARS = LINK_LABEL_MAX_DISPLAY_CHARS;
13391
13986
  exports.LINK_REFRESH_WINDOW_MS = LINK_REFRESH_WINDOW_MS;
13392
13987
  exports.LOOK_DEADLINE_MS = LOOK_DEADLINE_MS;
@@ -13427,12 +14022,14 @@ exports.RETRIEVAL_NOTE_MAX_ITEMS = RETRIEVAL_NOTE_MAX_ITEMS;
13427
14022
  exports.RETRIEVAL_NOTE_PREFIX = RETRIEVAL_NOTE_PREFIX;
13428
14023
  exports.RTF_EXTS = RTF_EXTS;
13429
14024
  exports.RUN_RECORD_WORKING_STALE_MS = RUN_RECORD_WORKING_STALE_MS;
14025
+ exports.SHARE_IDENTICAL_FILES_KEY = SHARE_IDENTICAL_FILES_KEY;
13430
14026
  exports.STREAM_POLL_INTERVAL = STREAM_POLL_INTERVAL;
13431
14027
  exports.TOOL_AND_RESPONSE_BUFFER = TOOL_AND_RESPONSE_BUFFER;
13432
14028
  exports.UPLOAD_ACCESS_GROUPS = UPLOAD_ACCESS_GROUPS;
13433
14029
  exports.UPLOAD_ACCESS_HINTS = UPLOAD_ACCESS_HINTS;
13434
14030
  exports.UPLOAD_ACCESS_LABELS = UPLOAD_ACCESS_LABELS;
13435
14031
  exports.UPLOAD_ACCESS_OPTIONS = UPLOAD_ACCESS_OPTIONS;
14032
+ exports.UPLOAD_CANCELLED_MESSAGE = UPLOAD_CANCELLED_MESSAGE;
13436
14033
  exports.XML_EXTS = XML_EXTS;
13437
14034
  exports.__resetSplitHistoryState = __resetSplitHistoryState;
13438
14035
  exports.accessSettingFrom = accessSettingFrom;
@@ -13478,6 +14075,11 @@ exports.composeUserMessage = composeUserMessage;
13478
14075
  exports.configureChatEngine = configureChatEngine;
13479
14076
  exports.configureProjectSettings = configureProjectSettings;
13480
14077
  exports.contentTypeForExt = contentTypeForExt;
14078
+ exports.copiesByOriginal = copiesByOriginal;
14079
+ exports.copiesToPromote = copiesToPromote;
14080
+ exports.copyCountLabel = copyCountLabel;
14081
+ exports.copyCountTitle = copyCountTitle;
14082
+ exports.copyStatusOf = copyStatusOf;
13481
14083
  exports.createHistoryFiller = createHistoryFiller;
13482
14084
  exports.createInlineLinkRegex = createInlineLinkRegex;
13483
14085
  exports.createScrollAnchor = createScrollAnchor;
@@ -13499,12 +14101,16 @@ exports.extractOpenAIText = extractOpenAIText;
13499
14101
  exports.extractRemotePathFromAttachmentHref = extractRemotePathFromAttachmentHref;
13500
14102
  exports.extractRetrievalNote = extractRetrievalNote;
13501
14103
  exports.fetchLiveIndexingKeys = fetchLiveIndexingKeys;
14104
+ exports.fileNameOf = fileNameOf;
13502
14105
  exports.fillHistoryViewport = fillHistoryViewport;
13503
14106
  exports.filterListByClearHorizon = filterListByClearHorizon;
13504
14107
  exports.findAttachmentParser = findAttachmentParser;
13505
14108
  exports.findDuplicateUpload = findDuplicateUpload;
14109
+ exports.findIdenticalFiles = findIdenticalFiles;
13506
14110
  exports.formatChatTimestamp = formatChatTimestamp;
13507
14111
  exports.formatDuration = formatDuration;
14112
+ exports.formatIndexDuration = formatIndexDuration;
14113
+ exports.formatLinkDuration = formatLinkDuration;
13508
14114
  exports.formatRetrievalNote = formatRetrievalNote;
13509
14115
  exports.getAttachmentParsers = getAttachmentParsers;
13510
14116
  exports.getChatHistory = getChatHistory;
@@ -13520,7 +14126,10 @@ exports.getVisionProfile = getVisionProfile;
13520
14126
  exports.groupAttachmentFailures = groupAttachmentFailures;
13521
14127
  exports.hasBom = hasBom;
13522
14128
  exports.hydrateImagePreviews = hydrateImagePreviews;
14129
+ exports.identicalLinkReasonText = identicalLinkReasonText;
13523
14130
  exports.indexDoneUniqueId = indexDoneUniqueId;
14131
+ exports.indexGroupDurationLabel = indexGroupDurationLabel;
14132
+ exports.indexGroupLinkedLabel = indexGroupLinkedLabel;
13524
14133
  exports.indexScopeKey = indexScopeKey;
13525
14134
  exports.indexingAccessGroup = indexingAccessGroup;
13526
14135
  exports.isAuthExpiredError = isAuthExpiredError;
@@ -13545,11 +14154,17 @@ exports.isReturnTrigger = isReturnTrigger;
13545
14154
  exports.isServerExtractable = isServerExtractable;
13546
14155
  exports.isServiceDbAttachmentHref = isServiceDbAttachmentHref;
13547
14156
  exports.isTransportFailure = isTransportFailure;
14157
+ exports.isUploadCancelledError = isUploadCancelledError;
13548
14158
  exports.isWindowedReadFile = isWindowedReadFile;
14159
+ exports.linkIdenticalFile = linkIdenticalFile;
13549
14160
  exports.linkUnavailableKeyForHref = linkUnavailableKeyForHref;
13550
14161
  exports.linkUnavailableKeyForPath = linkUnavailableKeyForPath;
13551
14162
  exports.linkUnavailableKeysForPath = linkUnavailableKeysForPath;
14163
+ exports.linkedMarkerOf = linkedMarkerOf;
14164
+ exports.linkedRowLabel = linkedRowLabel;
13552
14165
  exports.listClaudeModels = listClaudeModels;
14166
+ exports.listContentClaims = listContentClaims;
14167
+ exports.listLinkedCopies = listLinkedCopies;
13553
14168
  exports.listOpenAIModels = listOpenAIModels;
13554
14169
  exports.listedRequestText = listedRequestText;
13555
14170
  exports.liveSafePrefix = liveSafePrefix;
@@ -13568,6 +14183,7 @@ exports.normalizeAttachmentPathCandidate = normalizeAttachmentPathCandidate;
13568
14183
  exports.normalizeChatGreeting = normalizeChatGreeting;
13569
14184
  exports.normalizeExt = normalizeExt;
13570
14185
  exports.normalizeProjectAccessSetting = normalizeProjectAccessSetting;
14186
+ exports.normalizeShareIdenticalFiles = normalizeShareIdenticalFiles;
13571
14187
  exports.normalizeSkipDuplicateFiles = normalizeSkipDuplicateFiles;
13572
14188
  exports.normalizeStoredPathTarget = normalizeStoredPathTarget;
13573
14189
  exports.normalizeTextContent = normalizeTextContent;
@@ -13579,6 +14195,7 @@ exports.parseAiAgentValue = parseAiAgentValue;
13579
14195
  exports.parseAttachmentContent = parseAttachmentContent;
13580
14196
  exports.parseIndexingLabel = parseIndexingLabel;
13581
14197
  exports.parseIndexingRequestText = parseIndexingRequestText;
14198
+ exports.parseLinkedReply = parseLinkedReply;
13582
14199
  exports.patchProjectSettings = patchProjectSettings;
13583
14200
  exports.peekImagePreviewUrl = peekImagePreviewUrl;
13584
14201
  exports.prepareDownloadText = prepareDownloadText;
@@ -13593,10 +14210,13 @@ exports.projectAnswerMode = projectAnswerMode;
13593
14210
  exports.projectAsksUploadAccess = projectAsksUploadAccess;
13594
14211
  exports.projectChatGreeting = projectChatGreeting;
13595
14212
  exports.projectSettingsSettled = projectSettingsSettled;
14213
+ exports.projectShareIdenticalFiles = projectShareIdenticalFiles;
13596
14214
  exports.projectSkipDuplicateFiles = projectSkipDuplicateFiles;
13597
14215
  exports.projectUploadAccessGroup = projectUploadAccessGroup;
13598
14216
  exports.projectWebAccess = projectWebAccess;
14217
+ exports.promotableCopies = promotableCopies;
13599
14218
  exports.providerBodyWasRead = providerBodyWasRead;
14219
+ exports.providerDocument = providerDocument;
13600
14220
  exports.readExpiredAttachmentHref = readExpiredAttachmentHref;
13601
14221
  exports.readyProjectSettings = readyProjectSettings;
13602
14222
  exports.reconcilerReadsEnabled = reconcilerReadsEnabled;
@@ -13614,16 +14234,19 @@ exports.resolveWebAccess = resolveWebAccess;
13614
14234
  exports.retrievalNoteFromText = retrievalNoteFromText;
13615
14235
  exports.retrievalNoteOfAnswer = retrievalNoteOfAnswer;
13616
14236
  exports.runIndexUniqueId = runIndexUniqueId;
14237
+ exports.runRecordDurationMs = runRecordDurationMs;
13617
14238
  exports.runSettleSideEffect = runSettleSideEffect;
13618
14239
  exports.safeDecodeURIComponent = safeDecodeURIComponent;
13619
14240
  exports.sanitizeAttachmentLinksForHistory = sanitizeAttachmentLinksForHistory;
13620
14241
  exports.setProjectContextWindow = setProjectContextWindow;
13621
14242
  exports.setProjectSettings = setProjectSettings;
14243
+ exports.shareIdenticalFilesFrom = shareIdenticalFilesFrom;
13622
14244
  exports.shouldRescueInFlightMessage = shouldRescueInFlightMessage;
13623
14245
  exports.sideEffectDone = sideEffectDone;
13624
14246
  exports.skapiSupportsStreaming = skapiSupportsStreaming;
13625
14247
  exports.skipDuplicateFilesEnabled = skipDuplicateFilesEnabled;
13626
14248
  exports.skipDuplicateFilesFrom = skipDuplicateFilesFrom;
14249
+ exports.splitLabelForFit = splitLabelForFit;
13627
14250
  exports.statusPushEnabled = statusPushEnabled;
13628
14251
  exports.statusPushLive = statusPushLive;
13629
14252
  exports.streamRecoveryEnabled = streamRecoveryEnabled;