bunnyquery 1.21.0 → 1.21.4
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/README.md +22 -6
- package/bunnyquery.js +184 -89
- package/dist/engine.cjs +174 -83
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +52 -5
- package/dist/engine.d.ts +52 -5
- package/dist/engine.mjs +173 -84
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/citations.ts +12 -0
- package/src/engine/config.ts +16 -2
- package/src/engine/indexing_groups.ts +10 -4
- package/src/engine/prompts/chat_system_prompt.ts +3 -3
- package/src/engine/prompts/indexing_system_prompt.ts +3 -3
- package/src/engine/prompts/indexing_user_message.ts +20 -0
- package/src/engine/requests.ts +39 -2
- package/src/engine/retrieval_memory.ts +21 -6
- package/src/engine/session.ts +54 -35
- package/src/engine/time.ts +36 -0
package/dist/engine.mjs
CHANGED
|
@@ -276,6 +276,9 @@ function crefSupported() {
|
|
|
276
276
|
function windowedIndexingEnabled() {
|
|
277
277
|
return _config?.windowedIndexing === true;
|
|
278
278
|
}
|
|
279
|
+
function workerIndexEndingsEnabled() {
|
|
280
|
+
return _config?.workerIndexEndings === true;
|
|
281
|
+
}
|
|
279
282
|
function statusPushEnabled() {
|
|
280
283
|
return _config?.statusPush === true && typeof _config?.onRequestStatus === "function";
|
|
281
284
|
}
|
|
@@ -1063,8 +1066,8 @@ WHEN THE DATA DOES NOT HAVE IT, SAY SO. Once you have searched the way these rul
|
|
|
1063
1066
|
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.
|
|
1064
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.`;
|
|
1065
1068
|
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.`;
|
|
1066
|
-
const documentRules = `DOCUMENTS (a contract, a report, a manual, a letter, any uploaded file the user asks about the content of):
|
|
1067
|
-
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 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.`;
|
|
1069
|
+
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
|
+
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.`;
|
|
1068
1071
|
const groupIsPublic = indexGroupLiteral === '"public"' || indexGroupLiteral === "0";
|
|
1069
1072
|
const accessGroupRule = `THIS PROJECT INDEXES AT access_group ${indexGroupLiteral}: pass access_group ${indexGroupLiteral} EXPLICITLY on EVERY query that names a table_name, whether it filters by index, by tag or by nothing, and never rely on a default: a group left off is NOT "all groups", and any user but the project's owner is then answered from access_group 0 (public) alone${groupIsPublic ? "" : `, so a table indexed at ${indexGroupLiteral} would look empty with its records sitting right there`}. Files uploaded before the project's setting changed may sit at another group, so when a table query comes back empty, retry it in the other groups among 0, 1 and "private" before concluding there is nothing. Reference is the exception: reference ALONE spans EVERY table and EVERY access group, so getRecords with reference "src::<the file's storage path>" is the one call that returns a whole file's records wherever the indexer put them; adding table_name narrows it to that table, and access_group WITHOUT table_name fails.`;
|
|
1070
1073
|
let systemPrompt = `
|
|
@@ -1073,7 +1076,7 @@ Scope: Only answer questions about this project and its data. Do not answer ques
|
|
|
1073
1076
|
Knowledge lookup: before saying you don't know, or that something isn't in the chat history, ALWAYS search this project's data with the tools: the project's data lives in its database, not in the earlier messages of this chat.
|
|
1074
1077
|
${groundingRules}
|
|
1075
1078
|
${webRule}
|
|
1076
|
-
FINDING THE DATA: the database is the way in, for every kind of file.
|
|
1079
|
+
FINDING THE DATA: the database is the way in, for every kind of file. A question about what the documents SAY (a procedure, a passage, a definition, how to fix or do something), or one that names a code, a number or a phrase to find (a quote no., a part no., a name), starts with searchText (DOCUMENTS below), not with getTables: the sheets of spreadsheets are in page text too. searchText finds WHICH file, sheet and row holds a value; a total, count or list over rows is still computed from the full row set (NUMBERS FROM A SPREADSHEET below). Everything else (numbers, rows, records, lists, counts, files) follows the search path in getTables' description, with one exception for this project: when getTables' one page is the whole list (end_of_list true), skip its table-name search even when no name fits: you already see every table, and a table is never named after a company, a person or a single fact, so when no table fits, the answer is in a document's text: use searchText (DOCUMENTS below). Pick EVERY table that could hold the answer, not the first that fits. Read getIndexes and getTags one page each, never with fetch_all: name and tag lists can be millions of characters long and are never read whole, so when the name is not on that page, search for it with the user's words as their descriptions say. Never call getTags with neither table_name nor tag: that lists every tag of every table. Then getRecords in that table and group with the selector that matched (an index, one exact tag, or none for the whole table), always with fetch_all true. WHERE INDEXED CONTENT LIVES: a document's extracted content (PDF, Word, slides, scans) is in table "document_entries", one record per row / entry / section, with its page in "page"; spreadsheet rows are in "spreadsheet_rows". Files indexed before 2026-11-20 may still hold theirs in other tables, so a file's records are found wherever they are with getRecords reference "src::<path>" (see the access group rule below); every later mention of a file's records means this call. Every stored file has a record whose unique_id is "src::<its storage path>", so getUniqueId with unique_id "src::" and condition "gte" lists every file across every table (add the start of a path to narrow it; condition "lte" with a file name alone finds it in any folder).
|
|
1077
1080
|
NUMBERS FROM A SPREADSHEET are computed from the ROWS, never from one page and never from a guess. Each row of each sheet is one record in its table: reference "src::<path>", unique_id "row::<path>#<sheet>#R<n>", the cells by header name, plus "_sheet", "_row", "_grain" ("detail" or "summary") and, on a total or preamble row, "_row_type". Its tags carry the file name, the sheet, the grain and up to four key values of the row (a name, a code), so getRecords with one exact tag selects every row about that thing across all the files in the table. Workbooks state the same money more than once: a detail sheet, then per-song, per-album and per-artist sheets that re-total it, plus a summary. Use rows whose "_grain" is "detail" and whose "_row_type" is not "total", pick ONE sheet per file and say which, and never add a sheet to its summary. Fetch the COMPLETE matching set, keep only the rows whose column or tag names what was asked, then add them up carefully, in groups, and check that the group sums agree with the grand total. A FILE TOTAL IS NOT A ROW'S TOTAL: the biggest number on a summary sheet is the whole file, not the thing asked about, so check every figure is scoped to what the question named (filter by the column that identifies it). Quote the row count, the sheet(s) and the file(s) the figure was made from and label it as calculated.
|
|
1078
1081
|
${documentRules}
|
|
1079
1082
|
${accessGroupRule}
|
|
@@ -1124,13 +1127,13 @@ function buildIndexingSystemPrompt(params) {
|
|
|
1124
1127
|
const { projectId, serviceName, serviceDescription } = params;
|
|
1125
1128
|
const accessGroup = params.accessGroup === "public" || params.accessGroup === "private" ? params.accessGroup : "authorized";
|
|
1126
1129
|
let systemPrompt = `You are a background indexing agent for project ${projectId}.
|
|
1127
|
-
- Image files (.jpg, .jpeg, .png, .gif, .webp) are ALREADY attached inline as image content blocks in the same message: look at them directly, and never fetch an image URL.
|
|
1130
|
+
- Image files (.jpg, .jpeg, .png, .gif, .webp) are ALREADY attached inline as image content blocks in the same message: look at them directly, and never fetch an image URL. Any other image file (.tif, .tiff, .bmp, .heic) is attached only when the message shows an image of it (the server attaches a converted copy when it can); when none is attached, index it from its metadata and never guess its contents.
|
|
1128
1131
|
- Most files (office documents like .docx/.xlsx/.pptx/.hwp/.hwpx/.ods, email messages (.eml), and text/data/code files like .csv/.tsv/.json/.xml/.txt/.md and source code) have ALREADY been extracted on the server and included inline in the user message between the "BEGIN FILE CONTENT" / "END FILE CONTENT" markers - read that directly. If the inline content is a "[skapi: ...]" note, the file could not be extracted - index it from its metadata only.
|
|
1129
1132
|
- BIG SPREADSHEETS / TEXT: the inline content may be only the FIRST part of a large file (it can end with a truncation or "more remains" note). UNLESS this message already embeds a window of the file (in which case the message tells you not to call readFileContent, and you must not), read big spreadsheets and big text/data files WITH THE readFileContent TOOL: it returns the file ONE WINDOW at a time (spreadsheets as coordinate-tagged grid rows, text as a range of characters). Pass the file's storage path. After each window: datafy it into records and SAVE them, THEN if the window says MORE REMAINS call readFileContent again with the cursor it gives you. Repeat until it says END OF FILE, so the WHOLE file is indexed - never stop after the first window.
|
|
1130
1133
|
- 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.
|
|
1131
1134
|
- 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).
|
|
1132
|
-
- 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", "tag_id" and "date". 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.
|
|
1133
|
-
- 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).
|
|
1135
|
+
- 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).
|
|
1134
1137
|
- 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.
|
|
1135
1138
|
- 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.
|
|
1136
1139
|
- 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.
|
|
@@ -1202,6 +1205,12 @@ ${options.inlineContentPlaceholder}
|
|
|
1202
1205
|
return head + `
|
|
1203
1206
|
Read this file with the readFileContent tool, using the storage path above - do NOT fetch a URL and do NOT rely on a single sample. readFileContent returns the file ONE WINDOW at a time: spreadsheets as coordinate-tagged grid rows (e.g. 'R4 A:E&I NUMBER | B:E1007'), text as a character range, and windows may include embedded photos - LOOK at any images and datafy what they show. Page through EVERY window: for each window SAVE records for its rows/items/pages (postRecords, one record per row/item; spreadsheet rows in "spreadsheet_rows", everything else in "document_entries"), THEN if the window says MORE REMAINS call readFileContent again with the cursor it gives you. Repeat until it says END OF FILE, so the WHOLE file is indexed. Do NOT stop after the first window and do NOT just write a summary. Set every record's reference to exactly "src::" + the storage path above; that file record already exists, so enrich it with updateRecords instead of posting it again.` + (attachment.url ? `
|
|
1204
1207
|
(A temporary URL is provided ONLY as a fallback if readFileContent fails: ${attachment.url})` : "");
|
|
1208
|
+
}
|
|
1209
|
+
if (options?.imageFile) {
|
|
1210
|
+
return head + `- temporary URL: ${attachment.url}
|
|
1211
|
+
` + (options.imageFile === "attached" ? `
|
|
1212
|
+
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.`;
|
|
1205
1214
|
}
|
|
1206
1215
|
return head + `- temporary URL (fetch this to read the file contents): ${attachment.url}`;
|
|
1207
1216
|
}
|
|
@@ -1821,16 +1830,19 @@ function pushGroup(list, value) {
|
|
|
1821
1830
|
if (typeof value === "number" && isFinite(value)) pushUnique(list, String(value));
|
|
1822
1831
|
else pushUnique(list, value);
|
|
1823
1832
|
}
|
|
1824
|
-
function pushHit(list, path, page) {
|
|
1833
|
+
function pushHit(list, path, page, sheet) {
|
|
1825
1834
|
if (typeof path !== "string" || !path.trim()) return;
|
|
1826
1835
|
var n = typeof page === "number" ? page : Number(page);
|
|
1827
1836
|
if (!isFinite(n) || n <= 0) return;
|
|
1828
1837
|
n = Math.floor(n);
|
|
1838
|
+
var sh = typeof sheet === "string" && sheet.trim() ? sheet.trim() : "";
|
|
1829
1839
|
for (var i = 0; i < list.length; i++) {
|
|
1830
|
-
if (list[i].path === path && list[i].page === n) return;
|
|
1840
|
+
if (sh ? list[i].path === path && list[i].sheet === sh : list[i].path === path && list[i].page === n) return;
|
|
1831
1841
|
}
|
|
1832
1842
|
if (list.length >= RETRIEVAL_NOTE_MAX_ITEMS) return;
|
|
1833
|
-
|
|
1843
|
+
var hit = { path: path.trim(), page: n };
|
|
1844
|
+
if (sh) hit.sheet = sh;
|
|
1845
|
+
list.push(hit);
|
|
1834
1846
|
}
|
|
1835
1847
|
function pathFromSrcId(value) {
|
|
1836
1848
|
if (typeof value !== "string") return null;
|
|
@@ -1877,7 +1889,7 @@ function readHits(note, result) {
|
|
|
1877
1889
|
return;
|
|
1878
1890
|
}
|
|
1879
1891
|
if (typeof node.path === "string" && node.page !== void 0) {
|
|
1880
|
-
pushHit(note.hits, node.path, node.page);
|
|
1892
|
+
pushHit(note.hits, node.path, node.page, node.sheet);
|
|
1881
1893
|
}
|
|
1882
1894
|
for (var k in node) {
|
|
1883
1895
|
if (!Object.prototype.hasOwnProperty.call(node, k)) continue;
|
|
@@ -2006,8 +2018,16 @@ function formatRetrievalNote(note) {
|
|
|
2006
2018
|
}
|
|
2007
2019
|
byFile[h.path].push(h.page);
|
|
2008
2020
|
}
|
|
2021
|
+
var sheetsOf = {};
|
|
2022
|
+
for (var s2 = 0; s2 < note.hits.length; s2++) {
|
|
2023
|
+
var hs = note.hits[s2];
|
|
2024
|
+
if (hs.sheet) {
|
|
2025
|
+
if (!sheetsOf[hs.path]) sheetsOf[hs.path] = [];
|
|
2026
|
+
if (sheetsOf[hs.path].indexOf(hs.sheet) === -1) sheetsOf[hs.path].push(hs.sheet);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2009
2029
|
parts.push("searchText hits " + order.map(function(p) {
|
|
2010
|
-
return p + " p" + byFile[p].join(", p");
|
|
2030
|
+
return sheetsOf[p] ? p + " sheet " + sheetsOf[p].join(", sheet ") : p + " p" + byFile[p].join(", p");
|
|
2011
2031
|
}).join("; "));
|
|
2012
2032
|
}
|
|
2013
2033
|
if (note.tools.length) parts.push("tools " + note.tools.join(", "));
|
|
@@ -2422,6 +2442,13 @@ function getVisionProfile(model) {
|
|
|
2422
2442
|
return { detail, pagesPerWindow: RENDER_PAGES_PER_WINDOW, tile: 1 };
|
|
2423
2443
|
}
|
|
2424
2444
|
var IMAGE_URL_REGEX = /\bhttps?:\/\/[^\s<>"'()\[\]]+?\.(?:jpg|jpeg|png|gif|webp)(?:\?[^\s<>"'()\[\]]*)?/gi;
|
|
2445
|
+
var INDEX_IMAGE_OTHER_EXT = /\.(?:tiff?|bmp|heic|heif)$/i;
|
|
2446
|
+
function indexingImageFile(attachment) {
|
|
2447
|
+
const url = typeof attachment.url === "string" ? attachment.url : "";
|
|
2448
|
+
if (url && new RegExp(IMAGE_URL_REGEX.source, "i").test(url)) return "attached";
|
|
2449
|
+
if (INDEX_IMAGE_OTHER_EXT.test(attachment.name || "") || INDEX_IMAGE_OTHER_EXT.test(attachment.storagePath || "")) return "maybe";
|
|
2450
|
+
return void 0;
|
|
2451
|
+
}
|
|
2425
2452
|
function transformContentWithImages(content) {
|
|
2426
2453
|
if (typeof content !== "string" || !content) {
|
|
2427
2454
|
return content;
|
|
@@ -2861,10 +2888,20 @@ async function notifyAgentSaveAttachment(info) {
|
|
|
2861
2888
|
save_media: !continuing
|
|
2862
2889
|
}))
|
|
2863
2890
|
} : {};
|
|
2864
|
-
const
|
|
2891
|
+
const singlePass = !visionFile && !windowedRead && !pagedRead && !continuing;
|
|
2892
|
+
const imageFile = singlePass && !parsedContent && !serverExtract ? indexingImageFile(attachment) : void 0;
|
|
2893
|
+
const fileUrlDetail = imageFile && platform === "openai" ? getOpenAIImageDetail(info.model || DEFAULT_OPENAI_MODEL) : void 0;
|
|
2894
|
+
const skapiFileUrls = attachment.url && attachment.storagePath ? {
|
|
2895
|
+
_skapi_file_urls: [{
|
|
2896
|
+
path: attachment.storagePath,
|
|
2897
|
+
url: attachment.url,
|
|
2898
|
+
...singlePass ? { index_end: true } : {},
|
|
2899
|
+
...fileUrlDetail ? { detail: fileUrlDetail } : {}
|
|
2900
|
+
}]
|
|
2901
|
+
} : {};
|
|
2865
2902
|
const userMessage = visionFile && renderPlaceholder ? buildIndexingRenderMessage(attachment, renderPlaceholder, renderFrom) : windowedRead && windowPlaceholder ? buildIndexingWindowMessage(attachment, windowPlaceholder, false) : continuing ? buildIndexingContinueMessage(attachment) : buildIndexingUserMessage(
|
|
2866
2903
|
attachment,
|
|
2867
|
-
parsedContent ? { inlineContent: parsedContent } : placeholder ? { inlineContentPlaceholder: placeholder } : pagedRead ? { pagedRead: true } : void 0
|
|
2904
|
+
parsedContent ? { inlineContent: parsedContent } : placeholder ? { inlineContentPlaceholder: placeholder } : pagedRead ? { pagedRead: true } : imageFile ? { imageFile } : void 0
|
|
2868
2905
|
);
|
|
2869
2906
|
const systemPrompt = buildIndexingSystemPrompt({
|
|
2870
2907
|
// The model copies this id verbatim into project_id tool calls, so it must be
|
|
@@ -3133,6 +3170,57 @@ function buildHistoryItemFullId(platform, service, itemId) {
|
|
|
3133
3170
|
return `[POST]${url.toLowerCase()}#${service}:${itemId}`;
|
|
3134
3171
|
}
|
|
3135
3172
|
|
|
3173
|
+
// src/engine/time.ts
|
|
3174
|
+
function wallClockNow() {
|
|
3175
|
+
return Date.now();
|
|
3176
|
+
}
|
|
3177
|
+
function formatChatTimestamp(ms) {
|
|
3178
|
+
if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
|
|
3179
|
+
try {
|
|
3180
|
+
return new Date(ms).toLocaleString(void 0, {
|
|
3181
|
+
year: "numeric",
|
|
3182
|
+
month: "short",
|
|
3183
|
+
day: "numeric",
|
|
3184
|
+
hour: "numeric",
|
|
3185
|
+
minute: "2-digit",
|
|
3186
|
+
second: "2-digit"
|
|
3187
|
+
});
|
|
3188
|
+
} catch (e) {
|
|
3189
|
+
return "";
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
function formatDuration(ms) {
|
|
3193
|
+
if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
|
|
3194
|
+
var total = Math.floor(ms / 1e3);
|
|
3195
|
+
var h = Math.floor(total / 3600);
|
|
3196
|
+
var m = Math.floor(total % 3600 / 60);
|
|
3197
|
+
var s = total % 60;
|
|
3198
|
+
var out = [];
|
|
3199
|
+
if (h) out.push(h + "h");
|
|
3200
|
+
if (m) out.push(m + "m");
|
|
3201
|
+
out.push(s + "s");
|
|
3202
|
+
return out.join(" ");
|
|
3203
|
+
}
|
|
3204
|
+
function requestIdTimeMs(rid) {
|
|
3205
|
+
if (typeof rid !== "string") return 0;
|
|
3206
|
+
var stamp = rid.split(":")[0] || "";
|
|
3207
|
+
if (stamp.length !== 13) return 0;
|
|
3208
|
+
var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
3209
|
+
var v = 0;
|
|
3210
|
+
for (var i = 0; i < stamp.length; i++) {
|
|
3211
|
+
var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
|
|
3212
|
+
if (d < 0) return 0;
|
|
3213
|
+
v = v * 32 + d;
|
|
3214
|
+
}
|
|
3215
|
+
return Math.floor(v / 2 / 1e6);
|
|
3216
|
+
}
|
|
3217
|
+
function messageTimeMs(m) {
|
|
3218
|
+
if (!m) return 0;
|
|
3219
|
+
var r = typeof m._serverItemId === "string" ? requestIdTimeMs(m._serverItemId) : 0;
|
|
3220
|
+
if (r > 0) return r;
|
|
3221
|
+
return typeof m._ts === "number" && m._ts > 0 ? m._ts : 0;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3136
3224
|
// src/engine/indexing_groups.ts
|
|
3137
3225
|
function canonIndexKey(s) {
|
|
3138
3226
|
return typeof s === "string" && s ? s.trim() : "";
|
|
@@ -3243,8 +3331,9 @@ function buildChatDisplayList(messages, opts) {
|
|
|
3243
3331
|
var alreadySeen = !!(msg._serverItemId && runByItemId[msg._serverItemId]);
|
|
3244
3332
|
var openId = openRunOfKey[key];
|
|
3245
3333
|
var notLater = false;
|
|
3246
|
-
|
|
3247
|
-
|
|
3334
|
+
var msgTime = messageTimeMs(msg);
|
|
3335
|
+
if (openId && msgTime > 0 && typeof newestTsOfRun[openId] === "number") {
|
|
3336
|
+
notLater = msgTime <= newestTsOfRun[openId];
|
|
3248
3337
|
}
|
|
3249
3338
|
if (!ref.continued && !alreadySeen && !notLater && openRunOfKey[key]) delete openRunOfKey[key];
|
|
3250
3339
|
runId = openRunOfKey[key];
|
|
@@ -3258,9 +3347,10 @@ function buildChatDisplayList(messages, opts) {
|
|
|
3258
3347
|
runId = runOfIndex[i - 1];
|
|
3259
3348
|
}
|
|
3260
3349
|
if (!runId) continue;
|
|
3261
|
-
|
|
3350
|
+
var memberTime = messageTimeMs(msg);
|
|
3351
|
+
if (memberTime > 0) {
|
|
3262
3352
|
var prevTs = newestTsOfRun[runId];
|
|
3263
|
-
if (typeof prevTs !== "number" ||
|
|
3353
|
+
if (typeof prevTs !== "number" || memberTime > prevTs) newestTsOfRun[runId] = memberTime;
|
|
3264
3354
|
}
|
|
3265
3355
|
var g = groups[runId];
|
|
3266
3356
|
if (!g) {
|
|
@@ -3769,10 +3859,20 @@ function citationsFor(note) {
|
|
|
3769
3859
|
var out = [];
|
|
3770
3860
|
var hitPaths = [];
|
|
3771
3861
|
var byPath = {};
|
|
3862
|
+
var sheetsByPath = {};
|
|
3772
3863
|
var i;
|
|
3773
3864
|
for (i = 0; i < note.hits.length; i++) {
|
|
3774
3865
|
var h = note.hits[i];
|
|
3775
3866
|
if (!h || typeof h.path !== "string" || !isMintablePath(h.path)) continue;
|
|
3867
|
+
if (typeof h.sheet === "string" && h.sheet) {
|
|
3868
|
+
if (!byPath[h.path]) {
|
|
3869
|
+
byPath[h.path] = [];
|
|
3870
|
+
hitPaths.push(h.path);
|
|
3871
|
+
}
|
|
3872
|
+
if (!sheetsByPath[h.path]) sheetsByPath[h.path] = [];
|
|
3873
|
+
if (sheetsByPath[h.path].indexOf(h.sheet) === -1) sheetsByPath[h.path].push(h.sheet);
|
|
3874
|
+
continue;
|
|
3875
|
+
}
|
|
3776
3876
|
var page = typeof h.page === "number" ? h.page : Number(h.page);
|
|
3777
3877
|
if (!isFinite(page) || page <= 0) continue;
|
|
3778
3878
|
page = Math.floor(page);
|
|
@@ -3784,6 +3884,10 @@ function citationsFor(note) {
|
|
|
3784
3884
|
}
|
|
3785
3885
|
for (i = 0; i < hitPaths.length; i++) {
|
|
3786
3886
|
var p = hitPaths[i];
|
|
3887
|
+
var sheets = sheetsByPath[p] || [];
|
|
3888
|
+
for (var sj = 0; sj < sheets.length; sj++) {
|
|
3889
|
+
out.push({ path: p, label: citationFileName(p) + " \xB7 " + sheets[sj] });
|
|
3890
|
+
}
|
|
3787
3891
|
var pages = byPath[p].slice().sort(function(a, b) {
|
|
3788
3892
|
return a - b;
|
|
3789
3893
|
});
|
|
@@ -4160,38 +4264,6 @@ function previewLayoutBox(img) {
|
|
|
4160
4264
|
return closest.call(img, PREVIEW_LAYOUT_BOX_SELECTOR) || img;
|
|
4161
4265
|
}
|
|
4162
4266
|
|
|
4163
|
-
// src/engine/time.ts
|
|
4164
|
-
function wallClockNow() {
|
|
4165
|
-
return Date.now();
|
|
4166
|
-
}
|
|
4167
|
-
function formatChatTimestamp(ms) {
|
|
4168
|
-
if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
|
|
4169
|
-
try {
|
|
4170
|
-
return new Date(ms).toLocaleString(void 0, {
|
|
4171
|
-
year: "numeric",
|
|
4172
|
-
month: "short",
|
|
4173
|
-
day: "numeric",
|
|
4174
|
-
hour: "numeric",
|
|
4175
|
-
minute: "2-digit",
|
|
4176
|
-
second: "2-digit"
|
|
4177
|
-
});
|
|
4178
|
-
} catch (e) {
|
|
4179
|
-
return "";
|
|
4180
|
-
}
|
|
4181
|
-
}
|
|
4182
|
-
function formatDuration(ms) {
|
|
4183
|
-
if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
|
|
4184
|
-
var total = Math.floor(ms / 1e3);
|
|
4185
|
-
var h = Math.floor(total / 3600);
|
|
4186
|
-
var m = Math.floor(total % 3600 / 60);
|
|
4187
|
-
var s = total % 60;
|
|
4188
|
-
var out = [];
|
|
4189
|
-
if (h) out.push(h + "h");
|
|
4190
|
-
if (m) out.push(m + "m");
|
|
4191
|
-
out.push(s + "s");
|
|
4192
|
-
return out.join(" ");
|
|
4193
|
-
}
|
|
4194
|
-
|
|
4195
4267
|
// src/engine/ai_agent.ts
|
|
4196
4268
|
function normalizePlatform(raw) {
|
|
4197
4269
|
var p = (raw || "").trim().toLowerCase();
|
|
@@ -5773,19 +5845,6 @@ function streamRecoveryLabels(phase) {
|
|
|
5773
5845
|
}
|
|
5774
5846
|
var LIVE_PAINT_MIN_MS = 250;
|
|
5775
5847
|
var LIVE_TYPE_MAX_STEP = 1200;
|
|
5776
|
-
function requestIdTimeMs(rid) {
|
|
5777
|
-
if (typeof rid !== "string") return 0;
|
|
5778
|
-
var stamp = rid.split(":")[0] || "";
|
|
5779
|
-
if (stamp.length !== 13) return 0;
|
|
5780
|
-
var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
5781
|
-
var v = 0;
|
|
5782
|
-
for (var i = 0; i < stamp.length; i++) {
|
|
5783
|
-
var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
|
|
5784
|
-
if (d < 0) return 0;
|
|
5785
|
-
v = v * 32 + d;
|
|
5786
|
-
}
|
|
5787
|
-
return Math.floor(v / 2 / 1e6);
|
|
5788
|
-
}
|
|
5789
5848
|
var WRONG_ANSWER_MESSAGE = "This answer seems wrong. Please check it again against the documents.";
|
|
5790
5849
|
var WRONG_ANSWER_LABEL = "Wrong answer?";
|
|
5791
5850
|
function canReportWrongAnswer(msg) {
|
|
@@ -5872,6 +5931,18 @@ var _ChatSession = class _ChatSession {
|
|
|
5872
5931
|
/** Pages watching a project's background indexing queue (watchIndexQueue). */
|
|
5873
5932
|
this._iqWatches = [];
|
|
5874
5933
|
this._chainsRestored = false;
|
|
5934
|
+
/**
|
|
5935
|
+
* A run closed idle (a complete queue look found no pass of it) whose record still says
|
|
5936
|
+
* 'working': when it is THIS user's run of a client-driven file and no browser tab here
|
|
5937
|
+
* keeps its chain (a reload, a discarded tab, or a browser without localStorage lost
|
|
5938
|
+
* it), nothing will ever send its next pass, so run:: says CHAIN_LOST_TEXT. Never for a
|
|
5939
|
+
* worker-driven file (the worker writes its endings), another user's run (their chain is
|
|
5940
|
+
* in their browser), or a run whose next pass is being looked for.
|
|
5941
|
+
*/
|
|
5942
|
+
/** Files the last queue look listed pending or running, settled bubbles included. */
|
|
5943
|
+
this._rawListedIndexKeys = {};
|
|
5944
|
+
/** Runs found idle on one complete look, waiting for a second before "lost" (see below). */
|
|
5945
|
+
this._lostLooks = {};
|
|
5875
5946
|
/**
|
|
5876
5947
|
* Pick up indexing passes the WORKER minted, which no client ever dispatched.
|
|
5877
5948
|
*
|
|
@@ -6267,6 +6338,7 @@ var _ChatSession = class _ChatSession {
|
|
|
6267
6338
|
_recordLiveIndexKeys(lists) {
|
|
6268
6339
|
var next = {};
|
|
6269
6340
|
var running = {};
|
|
6341
|
+
var rawListed = {};
|
|
6270
6342
|
var truncated = false;
|
|
6271
6343
|
var runningTruncated = false;
|
|
6272
6344
|
var settledIds = {};
|
|
@@ -6289,6 +6361,11 @@ var _ChatSession = class _ChatSession {
|
|
|
6289
6361
|
for (var i = 0; i < list.length; i++) {
|
|
6290
6362
|
var item = list[i];
|
|
6291
6363
|
if (!item || item.status !== "pending" && item.status !== "running") continue;
|
|
6364
|
+
var rawRef = parseIndexingRequestText(listedRequestText(item));
|
|
6365
|
+
if (rawRef) {
|
|
6366
|
+
if (rawRef.path) rawListed[rawRef.path] = true;
|
|
6367
|
+
if (rawRef.name) rawListed[rawRef.name] = true;
|
|
6368
|
+
}
|
|
6292
6369
|
if (item.id && settledIds[item.id]) continue;
|
|
6293
6370
|
var text = listedRequestText(item);
|
|
6294
6371
|
if (!isIndexingRequestText(text)) continue;
|
|
@@ -6330,6 +6407,7 @@ var _ChatSession = class _ChatSession {
|
|
|
6330
6407
|
}
|
|
6331
6408
|
}
|
|
6332
6409
|
this.state.liveIndexKeys = next;
|
|
6410
|
+
this._rawListedIndexKeys = rawListed;
|
|
6333
6411
|
if (this.state.liveIndexRunningChecked !== !runningTruncated) changed = true;
|
|
6334
6412
|
var settledNow = this.state.liveIndexSettled || {};
|
|
6335
6413
|
var settledNext = {};
|
|
@@ -10152,33 +10230,40 @@ var _ChatSession = class _ChatSession {
|
|
|
10152
10230
|
else if (!Object.keys(self._openMap()).length && !self._viewMounted()) self._stopStatusPush();
|
|
10153
10231
|
});
|
|
10154
10232
|
}
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
* keeps its chain (a reload, a discarded tab, or a browser without localStorage lost
|
|
10159
|
-
* it), nothing will ever send its next pass, so run:: says CHAIN_LOST_TEXT. Never for a
|
|
10160
|
-
* worker-driven file (the worker writes its endings), another user's run (their chain is
|
|
10161
|
-
* in their browser), or a run whose next pass is being looked for.
|
|
10162
|
-
*/
|
|
10233
|
+
_lostKey(run) {
|
|
10234
|
+
return run.projectId + "\0" + run.storagePath + "\0" + run.since;
|
|
10235
|
+
}
|
|
10163
10236
|
_flipIfChainLost(run) {
|
|
10164
10237
|
var self = this;
|
|
10165
|
-
if (!run.owner) return;
|
|
10238
|
+
if (!run.owner) return false;
|
|
10239
|
+
var raw = this._rawListedIndexKeys || {};
|
|
10240
|
+
if (raw[run.storagePath] || run.filename && raw[run.filename]) {
|
|
10241
|
+
delete this._lostLooks[this._lostKey(run)];
|
|
10242
|
+
return true;
|
|
10243
|
+
}
|
|
10244
|
+
var lk = this._lostKey(run);
|
|
10245
|
+
if (!this._lostLooks[lk]) {
|
|
10246
|
+
this._lostLooks[lk] = 1;
|
|
10247
|
+
return true;
|
|
10248
|
+
}
|
|
10249
|
+
delete this._lostLooks[lk];
|
|
10166
10250
|
var live = null;
|
|
10167
10251
|
try {
|
|
10168
10252
|
live = this.host.getIdentity();
|
|
10169
10253
|
} catch (e2) {
|
|
10170
10254
|
live = null;
|
|
10171
10255
|
}
|
|
10172
|
-
if (!live || !live.userId || live.userId !== run.owner || live.projectId !== run.projectId) return;
|
|
10256
|
+
if (!live || !live.userId || live.userId !== run.owner || live.projectId !== run.projectId) return false;
|
|
10173
10257
|
var name = run.filename || run.storagePath.split("/").pop() || run.storagePath;
|
|
10174
|
-
if (this._isWorkerDrivenIndexing(name, void 0)) return;
|
|
10175
|
-
if (
|
|
10258
|
+
if (this._isWorkerDrivenIndexing(name, void 0)) return false;
|
|
10259
|
+
if (workerIndexEndingsEnabled() && !isPagedReadFile(name, void 0)) return false;
|
|
10260
|
+
if (this._chainKept(run.projectId, run.storagePath)) return false;
|
|
10176
10261
|
for (var q = 0; q < this.bgTaskQueue.length; q++) {
|
|
10177
10262
|
var e = this.bgTaskQueue[q];
|
|
10178
|
-
if (e && e.projectId === run.projectId && e.storagePath === run.storagePath) return;
|
|
10263
|
+
if (e && e.projectId === run.projectId && e.storagePath === run.storagePath) return false;
|
|
10179
10264
|
}
|
|
10180
10265
|
if (this._recPending) for (var c in this._recPending) {
|
|
10181
|
-
if (this._recPending[c].kind === "indexing" && this._recPending[c].projectId === run.projectId) return;
|
|
10266
|
+
if (this._recPending[c].kind === "indexing" && this._recPending[c].projectId === run.projectId) return false;
|
|
10182
10267
|
}
|
|
10183
10268
|
var projectId = run.projectId, path = run.storagePath;
|
|
10184
10269
|
runSettleSideEffect(projectId, bgIndexingQueueName(live.userId, projectId), "lost:" + projectId + ":" + path + ":" + run.since, function() {
|
|
@@ -10191,6 +10276,7 @@ var _ChatSession = class _ChatSession {
|
|
|
10191
10276
|
}
|
|
10192
10277
|
});
|
|
10193
10278
|
});
|
|
10279
|
+
return false;
|
|
10194
10280
|
}
|
|
10195
10281
|
/** A file run the queue says is live, or that this page has a pass queued for. */
|
|
10196
10282
|
_fileRunLive(run) {
|
|
@@ -10222,8 +10308,8 @@ var _ChatSession = class _ChatSession {
|
|
|
10222
10308
|
var closed = [];
|
|
10223
10309
|
for (var k in runs) {
|
|
10224
10310
|
if (runs[k].projectId !== projectId || this._fileRunLive(runs[k])) continue;
|
|
10311
|
+
if (this._flipIfChainLost(runs[k])) continue;
|
|
10225
10312
|
closed.push(runs[k].storagePath);
|
|
10226
|
-
this._flipIfChainLost(runs[k]);
|
|
10227
10313
|
delete runs[k];
|
|
10228
10314
|
if (!this._fileRunsIdle) this._fileRunsIdle = {};
|
|
10229
10315
|
this._fileRunsIdle[k] = true;
|
|
@@ -11686,15 +11772,18 @@ var _ChatSession = class _ChatSession {
|
|
|
11686
11772
|
self.updateHistoryCache();
|
|
11687
11773
|
});
|
|
11688
11774
|
}
|
|
11689
|
-
/** Insert bubbles before the first message that is newer than them
|
|
11690
|
-
*
|
|
11775
|
+
/** Insert bubbles before the first message that is newer than them; messages whose time
|
|
11776
|
+
* is unknown are skipped over, and the end of the list takes them otherwise. A message's
|
|
11777
|
+
* time is its `_ts`, else (2026-11-25) the time in its request id: a live worker pass
|
|
11778
|
+
* adopted from the queue carries no `_ts`, and a file's older passes loaded by opening its
|
|
11779
|
+
* row (loadRunPasses) used to land AFTER it, which split one run into two rows. */
|
|
11691
11780
|
_insertByTime(bubbles) {
|
|
11692
|
-
var at = bubbles[0]
|
|
11781
|
+
var at = messageTimeMs(bubbles[0]);
|
|
11693
11782
|
var idx = this.state.messages.length;
|
|
11694
|
-
if (
|
|
11783
|
+
if (at > 0) {
|
|
11695
11784
|
for (var i = 0; i < this.state.messages.length; i++) {
|
|
11696
|
-
var t = this.state.messages[i]
|
|
11697
|
-
if (
|
|
11785
|
+
var t = messageTimeMs(this.state.messages[i]);
|
|
11786
|
+
if (t > 0 && t > at) {
|
|
11698
11787
|
idx = i;
|
|
11699
11788
|
break;
|
|
11700
11789
|
}
|
|
@@ -13254,6 +13343,6 @@ var _ChatSession = class _ChatSession {
|
|
|
13254
13343
|
_ChatSession.RUN_PASS_PAGE = 10;
|
|
13255
13344
|
var ChatSession = _ChatSession;
|
|
13256
13345
|
|
|
13257
|
-
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 };
|
|
13346
|
+
export { ANSWER_MODES, ANSWER_MODE_HINTS, ANSWER_MODE_LABELS, ANSWER_MODE_OPTIONS, ANSWER_MODE_SETTING_LABEL, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, ChatSession, DATA_TOOL_NAMES, DEFAULT_ANSWER_MODE, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_SKIP_DUPLICATE_FILES, DEFAULT_UPLOAD_ACCESS_GROUP, DEFAULT_WEB_ACCESS, DUPLICATE_LOOKUP_LIMIT, DUPLICATE_LOOKUP_MAX_CANDIDATES, DUPLICATE_LOOKUP_TIMEOUT_MS, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, LOOK_DEADLINE_MS, LOOK_FAST_MS, LOOK_SLOW_MS, LOOK_STALE_MS, LookScheduler, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, NOT_SENT_TEXT, NO_DATA_TOOL_MARK, OUTPUT_TOKEN_RESERVE, PAGE_TEXT_TABLE, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, RENDER_FROM_TOKEN, REQUEST_GONE_TEXT, REQUEST_UNREACHABLE_TEXT, RETRIEVAL_NOTES_MAX, RETRIEVAL_NOTES_TOKEN_BUDGET, RETRIEVAL_NOTE_MAX_CHARS, RETRIEVAL_NOTE_MAX_ITEMS, RETRIEVAL_NOTE_PREFIX, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, STREAM_POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLiveTextIntoRunningRow, adoptLocalAnswerIntoPage, answerModeFrom, answerUsedNoDataTool, applyEncodingDeclaration, applyRetrievalNotes, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEffortFields, chatEngineConfig, chatGreetingFrom, chatStreamWiring, citationFileName, citationLinkPart, citationsFor, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, crefSupported, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, extractRetrievalNote, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, findDuplicateUpload, formatChatTimestamp, formatDuration, formatRetrievalNote, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isDataToolName, isDuplicateCandidateId, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isNotExistsError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isRetrievalNote, isReturnTrigger, isServerExtractable, isServiceDbAttachmentHref, isTransportFailure, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, listedRequestText, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, messageTimeMs, mintCacheBustStamp, needsBomForExt, newClientRef, normalizeAnswerMode, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeSkipDuplicateFiles, normalizeStoredPathTarget, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, normalizeWebAccess, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAnswerMode, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectSkipDuplicateFiles, projectUploadAccessGroup, projectWebAccess, providerBodyWasRead, readExpiredAttachmentHref, readyProjectSettings, reconcilerReadsEnabled, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, requestIdTimeMs, resetFileIndexOnServer, resolveAnswerMode, resolveImagePreviewUrl, resolveSkipDuplicateFiles, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, runSettleSideEffect, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, sideEffectDone, skapiSupportsStreaming, skipDuplicateFilesEnabled, skipDuplicateFilesFrom, statusPushEnabled, statusPushLive, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
|
|
13258
13347
|
//# sourceMappingURL=engine.mjs.map
|
|
13259
13348
|
//# sourceMappingURL=engine.mjs.map
|