bunnyquery 1.21.7 → 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/README.md +35 -1
- package/bunnyquery.js +345 -21
- package/dist/engine.cjs +447 -10
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +280 -1
- package/dist/engine.d.ts +280 -1
- package/dist/engine.mjs +423 -11
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/host.ts +7 -0
- package/src/engine/identical.ts +448 -0
- package/src/engine/index.ts +41 -0
- package/src/engine/indexing_groups.ts +42 -1
- package/src/engine/office.ts +2 -0
- package/src/engine/project_settings.ts +37 -0
- package/src/engine/prompts/chat_system_prompt.ts +2 -1
- package/src/engine/requests.ts +38 -2
- package/src/engine/session.ts +74 -1
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
|
}
|
|
@@ -1066,7 +1077,7 @@ function buildChatSystemPrompt(params) {
|
|
|
1066
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)`;
|
|
1067
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.
|
|
1068
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`}.
|
|
1069
|
-
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
|
|
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.
|
|
1070
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.
|
|
1071
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.`;
|
|
1072
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.`;
|
|
@@ -1085,6 +1096,7 @@ NUMBERS FROM A SPREADSHEET are computed from the ROWS, never from one page and n
|
|
|
1085
1096
|
${documentRules}
|
|
1086
1097
|
${accessGroupRule}
|
|
1087
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.
|
|
1088
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.
|
|
1089
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.`}
|
|
1090
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.
|
|
@@ -2895,12 +2907,14 @@ async function notifyAgentSaveAttachment(info) {
|
|
|
2895
2907
|
const singlePass = !visionFile && !windowedRead && !pagedRead && !continuing;
|
|
2896
2908
|
const imageFile = singlePass && !parsedContent && !serverExtract ? indexingImageFile(attachment) : void 0;
|
|
2897
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));
|
|
2898
2911
|
const skapiFileUrls = attachment.url && attachment.storagePath ? {
|
|
2899
2912
|
_skapi_file_urls: [{
|
|
2900
2913
|
path: attachment.storagePath,
|
|
2901
2914
|
url: attachment.url,
|
|
2902
2915
|
...singlePass ? { index_end: true } : {},
|
|
2903
|
-
...fileUrlDetail ? { detail: fileUrlDetail } : {}
|
|
2916
|
+
...fileUrlDetail ? { detail: fileUrlDetail } : {},
|
|
2917
|
+
...shareIdentical ? { share_identical: true } : {}
|
|
2904
2918
|
}]
|
|
2905
2919
|
} : {};
|
|
2906
2920
|
const userMessage = visionFile && renderPlaceholder ? buildIndexingRenderMessage(attachment, renderPlaceholder, renderFrom) : windowedRead && windowPlaceholder ? buildIndexingWindowMessage(attachment, windowPlaceholder, false) : continuing ? buildIndexingContinueMessage(attachment) : buildIndexingUserMessage(
|
|
@@ -3027,13 +3041,26 @@ async function notifyAgentSaveAttachment(info) {
|
|
|
3027
3041
|
}
|
|
3028
3042
|
}));
|
|
3029
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
|
+
}
|
|
3030
3055
|
function extractClaudeText(response) {
|
|
3056
|
+
response = providerDocument(response);
|
|
3031
3057
|
if (!Array.isArray(response?.content)) {
|
|
3032
3058
|
return "";
|
|
3033
3059
|
}
|
|
3034
3060
|
return response.content.filter((block) => block?.type === "text").map((block) => block.text).join("\n");
|
|
3035
3061
|
}
|
|
3036
3062
|
function extractOpenAIText(response) {
|
|
3063
|
+
response = providerDocument(response);
|
|
3037
3064
|
if (typeof response?.output_text === "string" && response.output_text.length) {
|
|
3038
3065
|
return response.output_text;
|
|
3039
3066
|
}
|
|
@@ -3235,6 +3262,311 @@ function messageTimeMs(m) {
|
|
|
3235
3262
|
return typeof m._ts === "number" && m._ts > 0 ? m._ts : 0;
|
|
3236
3263
|
}
|
|
3237
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
|
+
|
|
3238
3570
|
// src/engine/indexing_groups.ts
|
|
3239
3571
|
function canonIndexKey(s) {
|
|
3240
3572
|
return typeof s === "string" && s ? s.trim() : "";
|
|
@@ -3353,6 +3685,10 @@ function indexGroupDurationLabel(group) {
|
|
|
3353
3685
|
if (!group || group.status !== "done" || !group.finished || group.resolving || group.queued) return "";
|
|
3354
3686
|
return formatIndexDuration(group.durationMs);
|
|
3355
3687
|
}
|
|
3688
|
+
function indexGroupLinkedLabel(group) {
|
|
3689
|
+
if (!group || !group.linked || group.status !== "done") return "";
|
|
3690
|
+
return linkedRowLabel(group.linked.original, group.linked.ms);
|
|
3691
|
+
}
|
|
3356
3692
|
function buildChatDisplayList(messages, opts) {
|
|
3357
3693
|
var list = Array.isArray(messages) ? messages : [];
|
|
3358
3694
|
var liveIndexKeys = opts && opts.liveIndexKeys || {};
|
|
@@ -3548,6 +3884,14 @@ function buildChatDisplayList(messages, opts) {
|
|
|
3548
3884
|
var vm = grp.members[vi];
|
|
3549
3885
|
if (vm.msg._indexComplete) sawComplete = true;
|
|
3550
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;
|
|
3551
3895
|
}
|
|
3552
3896
|
grp.driver = !isPagedReadFile(grp.name, grp.mime) ? "single" : isImageVisionFile(grp.name, grp.mime) ? "worker" : windowedIndexing ? "worker" : "client";
|
|
3553
3897
|
if (grp.status === "active") {
|
|
@@ -3559,7 +3903,7 @@ function buildChatDisplayList(messages, opts) {
|
|
|
3559
3903
|
} else if (grp.driver === "client") {
|
|
3560
3904
|
grp.finished = sawComplete || grp.status === "error" || grp.passCount >= MAX_INDEXING_RESUME_PASSES;
|
|
3561
3905
|
} else {
|
|
3562
|
-
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];
|
|
3563
3907
|
}
|
|
3564
3908
|
if (grp.status !== "done") {
|
|
3565
3909
|
grp.resolving = false;
|
|
@@ -3710,7 +4054,8 @@ function buildChatDisplayList(messages, opts) {
|
|
|
3710
4054
|
queued: waitingStub || live && !!runningKeys && !runningKeys[sp] && !runningKeys[canonIndexKey(sp)] && !runningKeys[fname] ? true : void 0,
|
|
3711
4055
|
stubError: rec.error || (st === "error" && !rec.error ? "Indexing did not finish." : void 0),
|
|
3712
4056
|
// The stub IS the record, so a 'done' record's span is this run's.
|
|
3713
|
-
durationMs: st === "done" ? runRecordDurationMs(rec) : void 0
|
|
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
|
|
3714
4059
|
};
|
|
3715
4060
|
stubList.push({ started: typeof rec.started === "number" ? rec.started : Infinity, group: sg });
|
|
3716
4061
|
}
|
|
@@ -3730,6 +4075,9 @@ function buildChatDisplayList(messages, opts) {
|
|
|
3730
4075
|
stubList.push({ started: trec.started, group: tg });
|
|
3731
4076
|
overlayRunRecordVerdict(tg, trec, liveIndexKeys);
|
|
3732
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
|
+
}
|
|
3733
4081
|
}
|
|
3734
4082
|
}
|
|
3735
4083
|
stubList.sort(function(a, b) {
|
|
@@ -3771,7 +4119,7 @@ function isDuplicateCandidateId(uniqueId, name) {
|
|
|
3771
4119
|
const tail = "/" + name;
|
|
3772
4120
|
return uniqueId.length > SRC_PREFIX2.length + tail.length && uniqueId.slice(-tail.length) === tail;
|
|
3773
4121
|
}
|
|
3774
|
-
function
|
|
4122
|
+
function listOf2(res) {
|
|
3775
4123
|
if (!res) return [];
|
|
3776
4124
|
if (Array.isArray(res)) return res;
|
|
3777
4125
|
return Array.isArray(res.list) ? res.list : [];
|
|
@@ -3788,14 +4136,14 @@ function nfc(text) {
|
|
|
3788
4136
|
async function storedCopyIndexing(skapi, storagePath, service) {
|
|
3789
4137
|
const doneId = "done::" + storagePath;
|
|
3790
4138
|
try {
|
|
3791
|
-
const done =
|
|
4139
|
+
const done = listOf2(await skapi.getUniqueId(Object.assign({ unique_id: doneId }, service), { fetchMore: false, limit: 1 }));
|
|
3792
4140
|
if (done.some(function(it) {
|
|
3793
4141
|
return (it && typeof it === "object" ? it.unique_id : it) === doneId;
|
|
3794
4142
|
})) return "done";
|
|
3795
4143
|
} catch {
|
|
3796
4144
|
}
|
|
3797
4145
|
try {
|
|
3798
|
-
const run =
|
|
4146
|
+
const run = listOf2(await skapi.getRecords(Object.assign({ unique_id: "run::" + storagePath }, service)))[0];
|
|
3799
4147
|
const data = run && run.data && typeof run.data === "object" ? run.data : null;
|
|
3800
4148
|
if (data && data.status === "working" && typeof data.started === "number" && Date.now() - data.started < RUN_RECORD_WORKING_STALE_MS) return "running";
|
|
3801
4149
|
} catch {
|
|
@@ -3824,7 +4172,7 @@ async function lookupDuplicate(skapi, file, userId, opts) {
|
|
|
3824
4172
|
const size = file && typeof file.size === "number" ? file.size : NaN;
|
|
3825
4173
|
if (!name || !(size >= 0) || !userId) return null;
|
|
3826
4174
|
const service = opts && opts.service ? { service: opts.service } : {};
|
|
3827
|
-
const found =
|
|
4175
|
+
const found = listOf2(await skapi.getUniqueId(
|
|
3828
4176
|
Object.assign({ unique_id: name, condition: "<=" }, service),
|
|
3829
4177
|
{ fetchMore: false, limit: DUPLICATE_LOOKUP_LIMIT }
|
|
3830
4178
|
));
|
|
@@ -3837,7 +4185,7 @@ async function lookupDuplicate(skapi, file, userId, opts) {
|
|
|
3837
4185
|
for (const uniqueId of ids) {
|
|
3838
4186
|
let record = null;
|
|
3839
4187
|
try {
|
|
3840
|
-
record =
|
|
4188
|
+
record = listOf2(await skapi.getRecords(Object.assign({ unique_id: uniqueId }, service)))[0] || null;
|
|
3841
4189
|
} catch {
|
|
3842
4190
|
continue;
|
|
3843
4191
|
}
|
|
@@ -6358,6 +6706,43 @@ var _ChatSession = class _ChatSession {
|
|
|
6358
6706
|
return queued;
|
|
6359
6707
|
});
|
|
6360
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
|
+
}
|
|
6361
6746
|
/**
|
|
6362
6747
|
* The same question, asked of the SERVER when this page cannot answer it.
|
|
6363
6748
|
*
|
|
@@ -13150,6 +13535,7 @@ var _ChatSession = class _ChatSession {
|
|
|
13150
13535
|
att._storedCount = 0;
|
|
13151
13536
|
att._indexQueuedCount = 0;
|
|
13152
13537
|
att._indexQueued = false;
|
|
13538
|
+
att._landedNew = [];
|
|
13153
13539
|
var cancelError = function() {
|
|
13154
13540
|
var e = new Error(UPLOAD_CANCELLED_MESSAGE);
|
|
13155
13541
|
e.code = "CANCELLED";
|
|
@@ -13177,10 +13563,13 @@ var _ChatSession = class _ChatSession {
|
|
|
13177
13563
|
checkCancel();
|
|
13178
13564
|
var hadExists = false;
|
|
13179
13565
|
var skipped = false;
|
|
13566
|
+
var promotion = null;
|
|
13180
13567
|
var duplicateOf = null;
|
|
13181
13568
|
var existedBefore = false;
|
|
13182
13569
|
var madeRecord = false;
|
|
13570
|
+
var sentAll = false;
|
|
13183
13571
|
var onProg = function(p) {
|
|
13572
|
+
if (p && p.total && p.loaded >= p.total) sentAll = true;
|
|
13184
13573
|
if (p && p.total) {
|
|
13185
13574
|
att.progress = Math.floor((idx + p.loaded / p.total) / total * 100);
|
|
13186
13575
|
self.host.renderAttachmentChips();
|
|
@@ -13188,6 +13577,7 @@ var _ChatSession = class _ChatSession {
|
|
|
13188
13577
|
};
|
|
13189
13578
|
var doMemberUpload = function(checkExistence) {
|
|
13190
13579
|
checkCancel();
|
|
13580
|
+
sentAll = false;
|
|
13191
13581
|
return self.host.uploadFile({
|
|
13192
13582
|
file: member.file,
|
|
13193
13583
|
storagePath: member.storagePath,
|
|
@@ -13209,10 +13599,14 @@ var _ChatSession = class _ChatSession {
|
|
|
13209
13599
|
}).then(function(r) {
|
|
13210
13600
|
att._abort = null;
|
|
13211
13601
|
att._storedCount = (att._storedCount || 0) + 1;
|
|
13602
|
+
if (checkExistence) att._landedNew.push(member.storagePath);
|
|
13212
13603
|
return r;
|
|
13213
13604
|
}, function(err) {
|
|
13214
13605
|
att._abort = null;
|
|
13215
|
-
if (att._cancelled)
|
|
13606
|
+
if (att._cancelled) {
|
|
13607
|
+
if (checkExistence && sentAll) att._landedNew.push(member.storagePath);
|
|
13608
|
+
throw cancelError();
|
|
13609
|
+
}
|
|
13216
13610
|
throw err;
|
|
13217
13611
|
});
|
|
13218
13612
|
};
|
|
@@ -13236,6 +13630,7 @@ var _ChatSession = class _ChatSession {
|
|
|
13236
13630
|
return self.host.promptOverwrite(member.file.name).then(function(choice) {
|
|
13237
13631
|
if (choice === "overwrite") {
|
|
13238
13632
|
existedBefore = true;
|
|
13633
|
+
promotion = self.collectLinkedCopies([member.storagePath]);
|
|
13239
13634
|
markImagePreviewStale(self.host.getIdentity().projectId || "default", member.storagePath);
|
|
13240
13635
|
return doMemberUpload(false);
|
|
13241
13636
|
}
|
|
@@ -13368,6 +13763,9 @@ var _ChatSession = class _ChatSession {
|
|
|
13368
13763
|
if (alreadyIndexing) return;
|
|
13369
13764
|
att._indexQueuedCount = (att._indexQueuedCount || 0) + 1;
|
|
13370
13765
|
if (att.kind !== "folder") att._indexQueued = true;
|
|
13766
|
+
att._landedNew = (att._landedNew || []).filter(function(p) {
|
|
13767
|
+
return p !== member.storagePath;
|
|
13768
|
+
});
|
|
13371
13769
|
self.host.renderAttachmentChips();
|
|
13372
13770
|
return self.trackIndexDispatch(notifyAgentSaveAttachment({
|
|
13373
13771
|
platform: id.platform,
|
|
@@ -13409,6 +13807,14 @@ var _ChatSession = class _ChatSession {
|
|
|
13409
13807
|
});
|
|
13410
13808
|
self.noteBgQueueChanged();
|
|
13411
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
|
+
}
|
|
13412
13818
|
}
|
|
13413
13819
|
}, function(e) {
|
|
13414
13820
|
console.error("[chat-engine] indexing request failed", e);
|
|
@@ -13489,6 +13895,12 @@ var _ChatSession = class _ChatSession {
|
|
|
13489
13895
|
att.status = "cancelled";
|
|
13490
13896
|
att._abort = null;
|
|
13491
13897
|
self.host.renderAttachmentChips();
|
|
13898
|
+
if (typeof att._onCancelSettled === "function") {
|
|
13899
|
+
try {
|
|
13900
|
+
att._onCancelSettled((att._landedNew || []).slice());
|
|
13901
|
+
} catch (e) {
|
|
13902
|
+
}
|
|
13903
|
+
}
|
|
13492
13904
|
return;
|
|
13493
13905
|
}
|
|
13494
13906
|
if (removed || aborted) return;
|
|
@@ -13536,6 +13948,7 @@ exports.BOM_EXTS = BOM_EXTS;
|
|
|
13536
13948
|
exports.CHAT_GREETING_MAX_LENGTH = CHAT_GREETING_MAX_LENGTH;
|
|
13537
13949
|
exports.CLAUDE_INPUT_CAP_RATIO = CLAUDE_INPUT_CAP_RATIO;
|
|
13538
13950
|
exports.CLAUDE_PER_REQUEST_INPUT_CAP = CLAUDE_PER_REQUEST_INPUT_CAP;
|
|
13951
|
+
exports.CONTENT_CLAIM_PREFIX = CONTENT_CLAIM_PREFIX;
|
|
13539
13952
|
exports.CONTEXT_WINDOW_BY_MODEL = CONTEXT_WINDOW_BY_MODEL;
|
|
13540
13953
|
exports.CONTEXT_WINDOW_DEFAULT = CONTEXT_WINDOW_DEFAULT;
|
|
13541
13954
|
exports.ChatSession = ChatSession;
|
|
@@ -13544,6 +13957,7 @@ exports.DEFAULT_ANSWER_MODE = DEFAULT_ANSWER_MODE;
|
|
|
13544
13957
|
exports.DEFAULT_CLAUDE_MODEL = DEFAULT_CLAUDE_MODEL;
|
|
13545
13958
|
exports.DEFAULT_CONTEXT_WINDOW = DEFAULT_CONTEXT_WINDOW;
|
|
13546
13959
|
exports.DEFAULT_OPENAI_MODEL = DEFAULT_OPENAI_MODEL;
|
|
13960
|
+
exports.DEFAULT_SHARE_IDENTICAL_FILES = DEFAULT_SHARE_IDENTICAL_FILES;
|
|
13547
13961
|
exports.DEFAULT_SKIP_DUPLICATE_FILES = DEFAULT_SKIP_DUPLICATE_FILES;
|
|
13548
13962
|
exports.DEFAULT_UPLOAD_ACCESS_GROUP = DEFAULT_UPLOAD_ACCESS_GROUP;
|
|
13549
13963
|
exports.DEFAULT_WEB_ACCESS = DEFAULT_WEB_ACCESS;
|
|
@@ -13567,6 +13981,7 @@ exports.INLINE_LINK_GLYPH = INLINE_LINK_GLYPH;
|
|
|
13567
13981
|
exports.INLINE_LINK_UNAVAILABLE_GLYPH = INLINE_LINK_UNAVAILABLE_GLYPH;
|
|
13568
13982
|
exports.INLINE_LINK_UNAVAILABLE_SUFFIX = INLINE_LINK_UNAVAILABLE_SUFFIX;
|
|
13569
13983
|
exports.INPUT_CAP_RATIO = INPUT_CAP_RATIO;
|
|
13984
|
+
exports.LINKED_COPY_TAG = LINKED_COPY_TAG;
|
|
13570
13985
|
exports.LINK_LABEL_MAX_DISPLAY_CHARS = LINK_LABEL_MAX_DISPLAY_CHARS;
|
|
13571
13986
|
exports.LINK_REFRESH_WINDOW_MS = LINK_REFRESH_WINDOW_MS;
|
|
13572
13987
|
exports.LOOK_DEADLINE_MS = LOOK_DEADLINE_MS;
|
|
@@ -13607,6 +14022,7 @@ exports.RETRIEVAL_NOTE_MAX_ITEMS = RETRIEVAL_NOTE_MAX_ITEMS;
|
|
|
13607
14022
|
exports.RETRIEVAL_NOTE_PREFIX = RETRIEVAL_NOTE_PREFIX;
|
|
13608
14023
|
exports.RTF_EXTS = RTF_EXTS;
|
|
13609
14024
|
exports.RUN_RECORD_WORKING_STALE_MS = RUN_RECORD_WORKING_STALE_MS;
|
|
14025
|
+
exports.SHARE_IDENTICAL_FILES_KEY = SHARE_IDENTICAL_FILES_KEY;
|
|
13610
14026
|
exports.STREAM_POLL_INTERVAL = STREAM_POLL_INTERVAL;
|
|
13611
14027
|
exports.TOOL_AND_RESPONSE_BUFFER = TOOL_AND_RESPONSE_BUFFER;
|
|
13612
14028
|
exports.UPLOAD_ACCESS_GROUPS = UPLOAD_ACCESS_GROUPS;
|
|
@@ -13659,6 +14075,11 @@ exports.composeUserMessage = composeUserMessage;
|
|
|
13659
14075
|
exports.configureChatEngine = configureChatEngine;
|
|
13660
14076
|
exports.configureProjectSettings = configureProjectSettings;
|
|
13661
14077
|
exports.contentTypeForExt = contentTypeForExt;
|
|
14078
|
+
exports.copiesByOriginal = copiesByOriginal;
|
|
14079
|
+
exports.copiesToPromote = copiesToPromote;
|
|
14080
|
+
exports.copyCountLabel = copyCountLabel;
|
|
14081
|
+
exports.copyCountTitle = copyCountTitle;
|
|
14082
|
+
exports.copyStatusOf = copyStatusOf;
|
|
13662
14083
|
exports.createHistoryFiller = createHistoryFiller;
|
|
13663
14084
|
exports.createInlineLinkRegex = createInlineLinkRegex;
|
|
13664
14085
|
exports.createScrollAnchor = createScrollAnchor;
|
|
@@ -13680,13 +14101,16 @@ exports.extractOpenAIText = extractOpenAIText;
|
|
|
13680
14101
|
exports.extractRemotePathFromAttachmentHref = extractRemotePathFromAttachmentHref;
|
|
13681
14102
|
exports.extractRetrievalNote = extractRetrievalNote;
|
|
13682
14103
|
exports.fetchLiveIndexingKeys = fetchLiveIndexingKeys;
|
|
14104
|
+
exports.fileNameOf = fileNameOf;
|
|
13683
14105
|
exports.fillHistoryViewport = fillHistoryViewport;
|
|
13684
14106
|
exports.filterListByClearHorizon = filterListByClearHorizon;
|
|
13685
14107
|
exports.findAttachmentParser = findAttachmentParser;
|
|
13686
14108
|
exports.findDuplicateUpload = findDuplicateUpload;
|
|
14109
|
+
exports.findIdenticalFiles = findIdenticalFiles;
|
|
13687
14110
|
exports.formatChatTimestamp = formatChatTimestamp;
|
|
13688
14111
|
exports.formatDuration = formatDuration;
|
|
13689
14112
|
exports.formatIndexDuration = formatIndexDuration;
|
|
14113
|
+
exports.formatLinkDuration = formatLinkDuration;
|
|
13690
14114
|
exports.formatRetrievalNote = formatRetrievalNote;
|
|
13691
14115
|
exports.getAttachmentParsers = getAttachmentParsers;
|
|
13692
14116
|
exports.getChatHistory = getChatHistory;
|
|
@@ -13702,8 +14126,10 @@ exports.getVisionProfile = getVisionProfile;
|
|
|
13702
14126
|
exports.groupAttachmentFailures = groupAttachmentFailures;
|
|
13703
14127
|
exports.hasBom = hasBom;
|
|
13704
14128
|
exports.hydrateImagePreviews = hydrateImagePreviews;
|
|
14129
|
+
exports.identicalLinkReasonText = identicalLinkReasonText;
|
|
13705
14130
|
exports.indexDoneUniqueId = indexDoneUniqueId;
|
|
13706
14131
|
exports.indexGroupDurationLabel = indexGroupDurationLabel;
|
|
14132
|
+
exports.indexGroupLinkedLabel = indexGroupLinkedLabel;
|
|
13707
14133
|
exports.indexScopeKey = indexScopeKey;
|
|
13708
14134
|
exports.indexingAccessGroup = indexingAccessGroup;
|
|
13709
14135
|
exports.isAuthExpiredError = isAuthExpiredError;
|
|
@@ -13730,10 +14156,15 @@ exports.isServiceDbAttachmentHref = isServiceDbAttachmentHref;
|
|
|
13730
14156
|
exports.isTransportFailure = isTransportFailure;
|
|
13731
14157
|
exports.isUploadCancelledError = isUploadCancelledError;
|
|
13732
14158
|
exports.isWindowedReadFile = isWindowedReadFile;
|
|
14159
|
+
exports.linkIdenticalFile = linkIdenticalFile;
|
|
13733
14160
|
exports.linkUnavailableKeyForHref = linkUnavailableKeyForHref;
|
|
13734
14161
|
exports.linkUnavailableKeyForPath = linkUnavailableKeyForPath;
|
|
13735
14162
|
exports.linkUnavailableKeysForPath = linkUnavailableKeysForPath;
|
|
14163
|
+
exports.linkedMarkerOf = linkedMarkerOf;
|
|
14164
|
+
exports.linkedRowLabel = linkedRowLabel;
|
|
13736
14165
|
exports.listClaudeModels = listClaudeModels;
|
|
14166
|
+
exports.listContentClaims = listContentClaims;
|
|
14167
|
+
exports.listLinkedCopies = listLinkedCopies;
|
|
13737
14168
|
exports.listOpenAIModels = listOpenAIModels;
|
|
13738
14169
|
exports.listedRequestText = listedRequestText;
|
|
13739
14170
|
exports.liveSafePrefix = liveSafePrefix;
|
|
@@ -13752,6 +14183,7 @@ exports.normalizeAttachmentPathCandidate = normalizeAttachmentPathCandidate;
|
|
|
13752
14183
|
exports.normalizeChatGreeting = normalizeChatGreeting;
|
|
13753
14184
|
exports.normalizeExt = normalizeExt;
|
|
13754
14185
|
exports.normalizeProjectAccessSetting = normalizeProjectAccessSetting;
|
|
14186
|
+
exports.normalizeShareIdenticalFiles = normalizeShareIdenticalFiles;
|
|
13755
14187
|
exports.normalizeSkipDuplicateFiles = normalizeSkipDuplicateFiles;
|
|
13756
14188
|
exports.normalizeStoredPathTarget = normalizeStoredPathTarget;
|
|
13757
14189
|
exports.normalizeTextContent = normalizeTextContent;
|
|
@@ -13763,6 +14195,7 @@ exports.parseAiAgentValue = parseAiAgentValue;
|
|
|
13763
14195
|
exports.parseAttachmentContent = parseAttachmentContent;
|
|
13764
14196
|
exports.parseIndexingLabel = parseIndexingLabel;
|
|
13765
14197
|
exports.parseIndexingRequestText = parseIndexingRequestText;
|
|
14198
|
+
exports.parseLinkedReply = parseLinkedReply;
|
|
13766
14199
|
exports.patchProjectSettings = patchProjectSettings;
|
|
13767
14200
|
exports.peekImagePreviewUrl = peekImagePreviewUrl;
|
|
13768
14201
|
exports.prepareDownloadText = prepareDownloadText;
|
|
@@ -13777,10 +14210,13 @@ exports.projectAnswerMode = projectAnswerMode;
|
|
|
13777
14210
|
exports.projectAsksUploadAccess = projectAsksUploadAccess;
|
|
13778
14211
|
exports.projectChatGreeting = projectChatGreeting;
|
|
13779
14212
|
exports.projectSettingsSettled = projectSettingsSettled;
|
|
14213
|
+
exports.projectShareIdenticalFiles = projectShareIdenticalFiles;
|
|
13780
14214
|
exports.projectSkipDuplicateFiles = projectSkipDuplicateFiles;
|
|
13781
14215
|
exports.projectUploadAccessGroup = projectUploadAccessGroup;
|
|
13782
14216
|
exports.projectWebAccess = projectWebAccess;
|
|
14217
|
+
exports.promotableCopies = promotableCopies;
|
|
13783
14218
|
exports.providerBodyWasRead = providerBodyWasRead;
|
|
14219
|
+
exports.providerDocument = providerDocument;
|
|
13784
14220
|
exports.readExpiredAttachmentHref = readExpiredAttachmentHref;
|
|
13785
14221
|
exports.readyProjectSettings = readyProjectSettings;
|
|
13786
14222
|
exports.reconcilerReadsEnabled = reconcilerReadsEnabled;
|
|
@@ -13804,6 +14240,7 @@ exports.safeDecodeURIComponent = safeDecodeURIComponent;
|
|
|
13804
14240
|
exports.sanitizeAttachmentLinksForHistory = sanitizeAttachmentLinksForHistory;
|
|
13805
14241
|
exports.setProjectContextWindow = setProjectContextWindow;
|
|
13806
14242
|
exports.setProjectSettings = setProjectSettings;
|
|
14243
|
+
exports.shareIdenticalFilesFrom = shareIdenticalFilesFrom;
|
|
13807
14244
|
exports.shouldRescueInFlightMessage = shouldRescueInFlightMessage;
|
|
13808
14245
|
exports.sideEffectDone = sideEffectDone;
|
|
13809
14246
|
exports.skapiSupportsStreaming = skapiSupportsStreaming;
|