bunnyquery 1.21.4 → 1.21.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -2
- package/bunnyquery.css +70 -0
- package/bunnyquery.js +660 -29
- package/dist/engine.cjs +636 -13
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +350 -1
- package/dist/engine.d.ts +350 -1
- package/dist/engine.mjs +606 -14
- 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 +46 -0
- package/src/engine/indexing_groups.ts +129 -2
- package/src/engine/link_markup.ts +51 -2
- package/src/engine/office.ts +2 -0
- package/src/engine/project_settings.ts +37 -0
- package/src/engine/prompts/chat_system_prompt.ts +14 -1
- package/src/engine/prompts/indexing_system_prompt.ts +1 -1
- package/src/engine/prompts/indexing_user_message.ts +6 -1
- package/src/engine/requests.ts +38 -2
- package/src/engine/session.ts +210 -5
- package/src/engine/time.ts +21 -0
- package/src/widget.css +10 -0
- package/styles/chat.css +60 -0
package/dist/engine.d.mts
CHANGED
|
@@ -130,6 +130,7 @@ type ProjectSettingsData = {
|
|
|
130
130
|
chat_greeting?: unknown;
|
|
131
131
|
web_access?: unknown;
|
|
132
132
|
skip_duplicate_files?: unknown;
|
|
133
|
+
share_identical_files?: unknown;
|
|
133
134
|
answer_mode?: unknown;
|
|
134
135
|
[key: string]: unknown;
|
|
135
136
|
};
|
|
@@ -179,6 +180,27 @@ declare const DEFAULT_SKIP_DUPLICATE_FILES = true;
|
|
|
179
180
|
declare function normalizeSkipDuplicateFiles(value: any): boolean;
|
|
180
181
|
/** The switch held in a settings-record `data`, true when unset. */
|
|
181
182
|
declare function skipDuplicateFilesFrom(data: ProjectSettingsData | null | undefined): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Whether files with the same CONTENT share one index (owner, 2026-11-26). Same record,
|
|
185
|
+
* its own `share_identical_files` key. Not the skip above, which is about one uploader's
|
|
186
|
+
* same-named file: this compares stored bytes, whoever uploaded them and whatever they are
|
|
187
|
+
* called. The first such file is indexed as usual (the original); every later one is
|
|
188
|
+
* LINKED to it on the server with no AI call (the MCP's content-dedup.js), and search,
|
|
189
|
+
* outlines and totals count the content once.
|
|
190
|
+
*
|
|
191
|
+
* ON BY DEFAULT, for the same reason as skip_duplicate_files: a second index of the same
|
|
192
|
+
* bytes costs a second AI run and doubles every row. Only the literal `false` turns it
|
|
193
|
+
* off. The clients send `share_identical: true` on a run's FIRST pass while it is on
|
|
194
|
+
* (requests.ts notifyAgentSaveAttachment), and the MCP reads this key again before it
|
|
195
|
+
* links anything, so a client holding an old copy of the settings cannot link against
|
|
196
|
+
* the owner's choice.
|
|
197
|
+
*/
|
|
198
|
+
declare const SHARE_IDENTICAL_FILES_KEY = "share_identical_files";
|
|
199
|
+
declare const DEFAULT_SHARE_IDENTICAL_FILES = true;
|
|
200
|
+
/** Narrow a stored value to the switch: only the literal `false` is off. */
|
|
201
|
+
declare function normalizeShareIdenticalFiles(value: any): boolean;
|
|
202
|
+
/** The switch held in a settings-record `data`, true when unset. */
|
|
203
|
+
declare function shareIdenticalFilesFrom(data: ProjectSettingsData | null | undefined): boolean;
|
|
182
204
|
/**
|
|
183
205
|
* How much the model thinks before a CHAT answer. Same record, its own
|
|
184
206
|
* `answer_mode` key. Optional, and absent on almost every project.
|
|
@@ -326,6 +348,11 @@ declare function projectWebAccess(service: string): boolean;
|
|
|
326
348
|
* awaiting form (config.ts resolveSkipDuplicateFiles).
|
|
327
349
|
*/
|
|
328
350
|
declare function projectSkipDuplicateFiles(service: string): boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Sync convenience: the project's share-identical-files setting, true until the fetch
|
|
353
|
+
* settles or when the project never set it (the MCP checks the stored value again).
|
|
354
|
+
*/
|
|
355
|
+
declare function projectShareIdenticalFiles(service: string): boolean;
|
|
329
356
|
/**
|
|
330
357
|
* Sync convenience: the project's answer mode, 'standard' until the fetch
|
|
331
358
|
* settles or when the project never set it. The request builders use the
|
|
@@ -1142,6 +1169,8 @@ type FileUrlDirective = {
|
|
|
1142
1169
|
path: string;
|
|
1143
1170
|
/** The exact baked url string in the request body to replace with a fresh one. */
|
|
1144
1171
|
url: string;
|
|
1172
|
+
/** Indexing first pass only: link to an indexed file with the same bytes (see requests.ts). */
|
|
1173
|
+
share_identical?: boolean;
|
|
1145
1174
|
};
|
|
1146
1175
|
/**
|
|
1147
1176
|
* True when a file should be EXTRACTED SERVER-SIDE (text inlined for indexing)
|
|
@@ -2425,7 +2454,28 @@ interface InlineLinkMarkupOptions {
|
|
|
2425
2454
|
* isLinkUnavailable). Renders a dead chip: ✕, greyed, no href.
|
|
2426
2455
|
*/
|
|
2427
2456
|
unavailable?: boolean;
|
|
2457
|
+
/**
|
|
2458
|
+
* Render the FULL name and let CSS shorten it to the room it has, instead of
|
|
2459
|
+
* the fixed LINK_LABEL_MAX_DISPLAY_CHARS cut. Used by the collapsed indexing
|
|
2460
|
+
* row head, which is one line with the whole chat width to spend: a 32
|
|
2461
|
+
* character cap left most of that line empty and cut names that would have
|
|
2462
|
+
* fit. The name is split into a stem that ellipsizes and a tail (the end of
|
|
2463
|
+
* the name plus its extension) that never shrinks, so a name too long for the
|
|
2464
|
+
* row still shows what kind of file it is. Ignored on an image preview.
|
|
2465
|
+
*/
|
|
2466
|
+
fitLabel?: boolean;
|
|
2428
2467
|
}
|
|
2468
|
+
/**
|
|
2469
|
+
* Split a file name into the part a fitted chip may cut (stem) and the part it
|
|
2470
|
+
* always shows (tail): the last few characters of the name plus its extension,
|
|
2471
|
+
* e.g. "4500.00.0265.001_Non-ret" + "urn Valve.tiff". Counted in code points so a
|
|
2472
|
+
* surrogate pair (emoji, rare CJK) is never split in half. Pure: the two halves
|
|
2473
|
+
* concatenate back to the input exactly.
|
|
2474
|
+
*/
|
|
2475
|
+
declare function splitLabelForFit(name: string): {
|
|
2476
|
+
stem: string;
|
|
2477
|
+
tail: string;
|
|
2478
|
+
};
|
|
2429
2479
|
declare function renderInlineLinkHtml(link: RenderableInlineLink, opts?: InlineLinkMarkupOptions): string;
|
|
2430
2480
|
|
|
2431
2481
|
/**
|
|
@@ -2580,6 +2630,17 @@ declare function formatChatTimestamp(ms?: number): string;
|
|
|
2580
2630
|
* the result being truthy exactly as they do for formatChatTimestamp.
|
|
2581
2631
|
*/
|
|
2582
2632
|
declare function formatDuration(ms?: number): string;
|
|
2633
|
+
/**
|
|
2634
|
+
* "45 s", "12 min 5 s", "1 h 3 min": how long a whole file took to index, from its run::
|
|
2635
|
+
* record's `started` to its `finished`. Coarser than formatDuration on purpose: a file run
|
|
2636
|
+
* spans many passes and often minutes, so seconds are dropped once it passes an hour, and a
|
|
2637
|
+
* zero unit is left out ("12 min", "1 h"). Hours stay the largest unit for the reason
|
|
2638
|
+
* formatDuration gives.
|
|
2639
|
+
*
|
|
2640
|
+
* Empty string for anything under a second, negative, or non-finite: a file cannot be read
|
|
2641
|
+
* in no time, so those are missing data or clock skew, and callers gate on the result.
|
|
2642
|
+
*/
|
|
2643
|
+
declare function formatIndexDuration(ms?: number): string;
|
|
2583
2644
|
/**
|
|
2584
2645
|
* Creation time (ms epoch) of a request id "stamp:entropy", whose stamp is a time_ns written
|
|
2585
2646
|
* as 8 bytes of base32hex without padding (the worker's and the producer's _generate_req_id).
|
|
@@ -3353,6 +3414,18 @@ interface ChatHost {
|
|
|
3353
3414
|
} | null> | {
|
|
3354
3415
|
storagePath: string;
|
|
3355
3416
|
} | null;
|
|
3417
|
+
/**
|
|
3418
|
+
* Optional. Every linked copy of the project, read fresh (one shared index for
|
|
3419
|
+
* identical files; the engine's listLinkedCopies is the ready-made implementation).
|
|
3420
|
+
* With it, an Overwrite of an ORIGINAL sends its copies again afterwards (the oldest
|
|
3421
|
+
* becomes the new original, the others link to it). Missing or null: nothing is sent.
|
|
3422
|
+
*/
|
|
3423
|
+
findLinkedCopies?(): Promise<Map<string, {
|
|
3424
|
+
original: string;
|
|
3425
|
+
claim?: string;
|
|
3426
|
+
linkedAt?: number;
|
|
3427
|
+
owner?: string | null;
|
|
3428
|
+
}> | null>;
|
|
3356
3429
|
/** Map a relative path to the consumer's db storage key (e.g. uid-prefixed). */
|
|
3357
3430
|
storagePathFor(relPath: string): string;
|
|
3358
3431
|
getMimeType(name: string): string | null;
|
|
@@ -3590,8 +3663,23 @@ type AttachmentSaveInfo = {
|
|
|
3590
3663
|
* as image blocks; the resume loop advances this by a window each pass.
|
|
3591
3664
|
*/
|
|
3592
3665
|
renderFrom?: number;
|
|
3666
|
+
/**
|
|
3667
|
+
* One shared index for identical files: whether this FIRST pass may be linked to an
|
|
3668
|
+
* already indexed file with the same bytes (the worker then runs no AI for it).
|
|
3669
|
+
* Omitted: the project's `share_identical_files` setting decides (on unless the owner
|
|
3670
|
+
* turned it off). `false` never asks. Never sent on a continue pass.
|
|
3671
|
+
*/
|
|
3672
|
+
shareIdentical?: boolean;
|
|
3593
3673
|
};
|
|
3594
3674
|
declare function notifyAgentSaveAttachment(info: AttachmentSaveInfo): Promise<any>;
|
|
3675
|
+
/**
|
|
3676
|
+
* A provider answer that arrives as its JSON TEXT, read as the document it is. The worker
|
|
3677
|
+
* stores the answer it writes itself (a linked copy's "Same content as ...", identical.ts
|
|
3678
|
+
* parseLinkedReply) as a JSON string, and a status read hands that body back unparsed, so
|
|
3679
|
+
* the live row read no text from it until a reload brought the server's response_text.
|
|
3680
|
+
* Anything else is handed back as it came.
|
|
3681
|
+
*/
|
|
3682
|
+
declare function providerDocument(response: any): any;
|
|
3595
3683
|
declare function extractClaudeText(response: any): any;
|
|
3596
3684
|
declare function extractOpenAIText(response: any): any;
|
|
3597
3685
|
declare function listClaudeModels(service: string, owner: string): Promise<any>;
|
|
@@ -4510,6 +4598,22 @@ type IndexingGroup = {
|
|
|
4510
4598
|
stubError?: string;
|
|
4511
4599
|
/** A run:: row that is live with no pass running yet: waiting in the queue. */
|
|
4512
4600
|
queued?: boolean;
|
|
4601
|
+
/** How long the file took to index (ms), from the run:: record's `started` to its
|
|
4602
|
+
* `finished`. Set only when the record is 'done' and describes THIS run (a stub, or
|
|
4603
|
+
* the newest run of a file whose loaded passes fall inside the record's span; there
|
|
4604
|
+
* the first pass's server time stands in for a `started` it disagrees with). Read
|
|
4605
|
+
* it through indexGroupDurationLabel, which also holds it back from any row that is
|
|
4606
|
+
* not a finished 'done'. */
|
|
4607
|
+
durationMs?: number;
|
|
4608
|
+
/** This run LINKED the file to an already indexed file with the same content (one
|
|
4609
|
+
* shared index for identical files, identical.ts): no AI ran and the file has no
|
|
4610
|
+
* rows or pages of its own. `original` is the original's storage path when the run::
|
|
4611
|
+
* record named it, else the file name the linked pass's answer gave; `ms` how long
|
|
4612
|
+
* the link took. Read it through indexGroupLinkedLabel. */
|
|
4613
|
+
linked?: {
|
|
4614
|
+
original: string;
|
|
4615
|
+
ms?: number;
|
|
4616
|
+
};
|
|
4513
4617
|
};
|
|
4514
4618
|
type DisplayEntry = {
|
|
4515
4619
|
kind: 'message';
|
|
@@ -4612,6 +4716,13 @@ type RunStubInfo = {
|
|
|
4612
4716
|
/** Chat that owns this run. Absent on records minted before it was
|
|
4613
4717
|
* stamped; see BuildDisplayListOptions.stubPlatform. */
|
|
4614
4718
|
platform?: 'claude' | 'openai';
|
|
4719
|
+
/** The run linked the file to an identical file's index (identical.ts): the record's
|
|
4720
|
+
* `linked: true` and the original's storage path (`alias_of`). */
|
|
4721
|
+
linked?: boolean;
|
|
4722
|
+
alias_of?: string;
|
|
4723
|
+
/** How long the link itself took on the server (ms); the record's started..finished
|
|
4724
|
+
* span also holds the time the pass waited in the queue, so it is not used. */
|
|
4725
|
+
link_ms?: number;
|
|
4615
4726
|
};
|
|
4616
4727
|
/** A 'working' run record older than this with no live-queue confirmation is
|
|
4617
4728
|
* treated as unknown rather than live: a chain that died without reaching any
|
|
@@ -4624,6 +4735,27 @@ declare function parseIndexingLabel(content: string): {
|
|
|
4624
4735
|
continued: boolean;
|
|
4625
4736
|
isReindex: boolean;
|
|
4626
4737
|
} | null;
|
|
4738
|
+
/** A 'done' run:: record's span in ms (`finished - started`), or undefined when the
|
|
4739
|
+
* record is not 'done' or either stamp is missing, non-finite, or out of order. The
|
|
4740
|
+
* files page reads the same records, so it uses this too. */
|
|
4741
|
+
declare function runRecordDurationMs(rec?: {
|
|
4742
|
+
status?: string;
|
|
4743
|
+
started?: number;
|
|
4744
|
+
finished?: number;
|
|
4745
|
+
} | null): number | undefined;
|
|
4746
|
+
/**
|
|
4747
|
+
* The time a row's file took to index ("12 min 5 s"), or '' when the row should not
|
|
4748
|
+
* say one: only a finished, settled 'done' row with a duration from its own run::
|
|
4749
|
+
* record. Active, queued, error and cancelled rows get nothing. Shared so agent.vue
|
|
4750
|
+
* and the widget print the same text in the same place.
|
|
4751
|
+
*/
|
|
4752
|
+
declare function indexGroupDurationLabel(group?: IndexingGroup | null): string;
|
|
4753
|
+
/**
|
|
4754
|
+
* A linked copy's row line ("Same content as A.tif: linked in 0.4 s, no AI used"), or ''
|
|
4755
|
+
* for any other row. Shared so agent.vue and the widget print the same text in the same
|
|
4756
|
+
* place (they show it instead of the pass count and duration).
|
|
4757
|
+
*/
|
|
4758
|
+
declare function indexGroupLinkedLabel(group?: IndexingGroup | null): string;
|
|
4627
4759
|
declare function buildChatDisplayList(messages: ChatMessage[], opts?: BuildDisplayListOptions): DisplayEntry[];
|
|
4628
4760
|
|
|
4629
4761
|
/**
|
|
@@ -4938,6 +5070,10 @@ type StreamDispatchContext = {
|
|
|
4938
5070
|
ownerKey?: string;
|
|
4939
5071
|
};
|
|
4940
5072
|
|
|
5073
|
+
/** The message of the error an attachment upload rejects with when the user cancelled it. */
|
|
5074
|
+
declare var UPLOAD_CANCELLED_MESSAGE: string;
|
|
5075
|
+
/** True for the rejection of an attachment upload the user cancelled (cancelAttachmentUpload). */
|
|
5076
|
+
declare function isUploadCancelledError(err: any): boolean;
|
|
4941
5077
|
declare class ChatSession {
|
|
4942
5078
|
host: ChatHost;
|
|
4943
5079
|
state: ChatState;
|
|
@@ -5120,6 +5256,30 @@ declare class ChatSession {
|
|
|
5120
5256
|
size?: number;
|
|
5121
5257
|
mime?: string;
|
|
5122
5258
|
}>): Promise<number>;
|
|
5259
|
+
/**
|
|
5260
|
+
* ONE SHARED INDEX FOR IDENTICAL FILES: the linked copies that lose their original when
|
|
5261
|
+
* `removed` files (or every file under `folders`) go away, per original, oldest first
|
|
5262
|
+
* (identical.ts copiesToPromote). Read through host.findLinkedCopies, fresh, and it has
|
|
5263
|
+
* to be read BEFORE the delete or reset: those remove nothing from the copies' markers,
|
|
5264
|
+
* but a later sweep could no longer tell whose copies they were once a new original
|
|
5265
|
+
* exists. Never rejects; [] without the hook or on any failure.
|
|
5266
|
+
*/
|
|
5267
|
+
collectLinkedCopies(removed: string[], folders?: string[]): Promise<{
|
|
5268
|
+
original: string;
|
|
5269
|
+
copies: string[];
|
|
5270
|
+
}[]>;
|
|
5271
|
+
/**
|
|
5272
|
+
* Send the copies of a removed or overwritten original again (owner decision
|
|
5273
|
+
* 2026-11-26): each list's oldest copy first, so its first pass claims the content and
|
|
5274
|
+
* is indexed for real (one AI run), then the others, which link to it with no AI call.
|
|
5275
|
+
* The share flag rides on every first pass while the project's switch is on (requests.ts
|
|
5276
|
+
* notifyAgentSaveAttachment). Through reindexStoredFiles, so each copy keeps its access
|
|
5277
|
+
* group and shows as a "Reindexing" row. Resolves to the number of files queued.
|
|
5278
|
+
*/
|
|
5279
|
+
promoteLinkedCopies(plan: {
|
|
5280
|
+
original: string;
|
|
5281
|
+
copies: string[];
|
|
5282
|
+
}[]): Promise<number>;
|
|
5123
5283
|
/**
|
|
5124
5284
|
* The same question, asked of the SERVER when this page cannot answer it.
|
|
5125
5285
|
*
|
|
@@ -6645,6 +6805,18 @@ declare class ChatSession {
|
|
|
6645
6805
|
*/
|
|
6646
6806
|
private _sendNextIndexingPass;
|
|
6647
6807
|
loadHistory(fetchMore?: boolean, token?: number): Promise<void>;
|
|
6808
|
+
/**
|
|
6809
|
+
* The user cancelled this chip's upload (the widget's per-chip x or "Cancel all
|
|
6810
|
+
* uploads"). Stops the bytes now when they are moving (the host's abort), and
|
|
6811
|
+
* leaves a flag every later step of uploadSingleAttachment checks, so a cancel
|
|
6812
|
+
* that lands between steps (the get-signed-url round trip before the bytes, or
|
|
6813
|
+
* the src:: record and the indexing request after them) still stops the file
|
|
6814
|
+
* from being indexed and from being attached to the chat turn. A member whose
|
|
6815
|
+
* indexing request has already gone out is past cancelling: it shows as an
|
|
6816
|
+
* indexing row with its own Stop. Returns false for a chip that is not being
|
|
6817
|
+
* uploaded by this session any more.
|
|
6818
|
+
*/
|
|
6819
|
+
cancelAttachmentUpload(att: any): boolean;
|
|
6648
6820
|
uploadSingleAttachment(att: any, stageId?: string): Promise<Array<{
|
|
6649
6821
|
name: string;
|
|
6650
6822
|
url: string;
|
|
@@ -6659,4 +6831,181 @@ declare class ChatSession {
|
|
|
6659
6831
|
bumpGate(): void;
|
|
6660
6832
|
}
|
|
6661
6833
|
|
|
6662
|
-
|
|
6834
|
+
/** Tag on every linked copy's done:: marker. */
|
|
6835
|
+
declare const LINKED_COPY_TAG = "bq_linked";
|
|
6836
|
+
/** unique_id prefix of the content claims. */
|
|
6837
|
+
declare const CONTENT_CLAIM_PREFIX = "cas::";
|
|
6838
|
+
/** What a linked copy's done:: (or run::) record says about its link. */
|
|
6839
|
+
type LinkedMarker = {
|
|
6840
|
+
/** Storage path of the original whose index this copy shares. */
|
|
6841
|
+
original: string;
|
|
6842
|
+
/** The claim id the link was made under ("cas::<scope>::<key>"), when recorded. */
|
|
6843
|
+
claim?: string;
|
|
6844
|
+
/** When the link was written (ms), when recorded. */
|
|
6845
|
+
linkedAt?: number;
|
|
6846
|
+
/** The copy's own access group, when recorded. */
|
|
6847
|
+
group?: string | number | null;
|
|
6848
|
+
/** The copy's uploader, when recorded. */
|
|
6849
|
+
owner?: string | null;
|
|
6850
|
+
/** The content key the copy was linked under, when recorded. */
|
|
6851
|
+
contentKey?: string;
|
|
6852
|
+
};
|
|
6853
|
+
/** The link a done:: or run:: record's `data` describes, or null when it is not a linked copy's. */
|
|
6854
|
+
declare function linkedMarkerOf(data: any): LinkedMarker | null;
|
|
6855
|
+
/** The last segment of a storage path. */
|
|
6856
|
+
declare function fileNameOf(path: string): string;
|
|
6857
|
+
type CopyStatusKind = 'linked' | 'waiting' | 'original_failed' | 'original_removed';
|
|
6858
|
+
type CopyStatus = {
|
|
6859
|
+
kind: CopyStatusKind;
|
|
6860
|
+
/** Storage path of the original. */
|
|
6861
|
+
original: string;
|
|
6862
|
+
/** The chip's text. */
|
|
6863
|
+
label: string;
|
|
6864
|
+
/** The chip's tooltip. */
|
|
6865
|
+
title: string;
|
|
6866
|
+
/** True for the two states in which the copy has no index anyone can search (red). */
|
|
6867
|
+
broken: boolean;
|
|
6868
|
+
};
|
|
6869
|
+
/** What the original's own markers say, for copyStatusOf. */
|
|
6870
|
+
type OriginalState = {
|
|
6871
|
+
/** The original has a done:: marker of its own (not a linked one). */
|
|
6872
|
+
done?: boolean;
|
|
6873
|
+
/** Its newest run:: record's status, when there is one. */
|
|
6874
|
+
run?: string;
|
|
6875
|
+
/** The content key its own done:: marker records (the MCP writes it when the original
|
|
6876
|
+
* finishes), when known. Different from the copy's: the original now holds other content. */
|
|
6877
|
+
contentKey?: string;
|
|
6878
|
+
};
|
|
6879
|
+
/**
|
|
6880
|
+
* A linked copy's status for the Files page and the widget:
|
|
6881
|
+
* 'original_removed' its claim id is not among the live claims (the original was deleted,
|
|
6882
|
+
* or reset and not indexed again), or the original has no markers left;
|
|
6883
|
+
* 'original_failed' the original's newest run ended in an error or was cancelled;
|
|
6884
|
+
* 'waiting' the original is still being indexed;
|
|
6885
|
+
* 'linked' the original is indexed: search and totals count the content once.
|
|
6886
|
+
* `liveClaims` is the set of live "cas::" ids (listContentClaims), or null when it could not
|
|
6887
|
+
* be read: then the claim is not used as evidence either way.
|
|
6888
|
+
*/
|
|
6889
|
+
declare function copyStatusOf(marker: LinkedMarker, original?: OriginalState | null, liveClaims?: Set<string> | null): CopyStatus;
|
|
6890
|
+
/** "1 copy" / "3 copies": the chip on an original. */
|
|
6891
|
+
declare function copyCountLabel(n: number): string;
|
|
6892
|
+
/** The tooltip of an original's copy chip, naming the copies. */
|
|
6893
|
+
declare function copyCountTitle(copies: string[]): string;
|
|
6894
|
+
/** Copies per original, oldest link first: Map(original path -> copy paths). */
|
|
6895
|
+
declare function copiesByOriginal(linked: Map<string, LinkedMarker> | {
|
|
6896
|
+
[path: string]: LinkedMarker;
|
|
6897
|
+
}): Map<string, string[]>;
|
|
6898
|
+
/**
|
|
6899
|
+
* A short duration for a link ("0.4 s", "1.9 s", "12 s", then formatIndexDuration's words).
|
|
6900
|
+
* A link takes about a second, so the whole-second helper would print nothing for it.
|
|
6901
|
+
*/
|
|
6902
|
+
declare function formatLinkDuration(ms?: number): string;
|
|
6903
|
+
/** The chat indexing row's line for a linked copy: "Same content as A: linked in 0.4 s, no AI used". */
|
|
6904
|
+
declare function linkedRowLabel(original: string, ms?: number): string;
|
|
6905
|
+
/**
|
|
6906
|
+
* A linked pass's answer, as the worker writes it ("[skapi] Same content as "A.tif": linked
|
|
6907
|
+
* to its index in 1.9 s, no AI used. ..."), read back: { original (the file NAME it gives),
|
|
6908
|
+
* ms }, or null for any other text.
|
|
6909
|
+
*/
|
|
6910
|
+
declare function parseLinkedReply(text: any): {
|
|
6911
|
+
original: string;
|
|
6912
|
+
ms?: number;
|
|
6913
|
+
} | null;
|
|
6914
|
+
/** Who sends the copies again: the signed-in user, and whether they own the project. */
|
|
6915
|
+
type PromotionActor = {
|
|
6916
|
+
userId?: string | null;
|
|
6917
|
+
isProjectOwner?: boolean;
|
|
6918
|
+
};
|
|
6919
|
+
/**
|
|
6920
|
+
* The linked copies `actor` may send to indexing again (review 2026-11-26): every copy for the
|
|
6921
|
+
* project owner, otherwise only the copies the actor uploaded (the marker's copy_owner). Another
|
|
6922
|
+
* user's copy is never re-indexed from this user's session: it would read that user's file
|
|
6923
|
+
* (perhaps a private one) and write its index under this user's records and upload group. A copy
|
|
6924
|
+
* left out keeps its link; once the original holds other content the server answers it as having
|
|
6925
|
+
* no index, the Files page shows it red ("Original removed or failed") and its Reindex fixes it.
|
|
6926
|
+
*/
|
|
6927
|
+
declare function promotableCopies(linked: Map<string, LinkedMarker> | {
|
|
6928
|
+
[path: string]: LinkedMarker;
|
|
6929
|
+
}, actor: PromotionActor): Map<string, LinkedMarker>;
|
|
6930
|
+
/**
|
|
6931
|
+
* The copies to send again when originals go away (a delete, a folder delete, an Overwrite
|
|
6932
|
+
* of an original), per original, oldest first. The first copy of each list becomes the new
|
|
6933
|
+
* original (one real AI run, sent with the share flag so it claims the content); the others
|
|
6934
|
+
* are sent after it and link to it. Copies that are themselves being removed are left out, and
|
|
6935
|
+
* with `actor`, the copies that user may not re-index (promotableCopies).
|
|
6936
|
+
* `removed`: the storage paths going away; `removedFolders`: folder paths whose whole
|
|
6937
|
+
* content goes away.
|
|
6938
|
+
*/
|
|
6939
|
+
declare function copiesToPromote(linked: Map<string, LinkedMarker> | {
|
|
6940
|
+
[path: string]: LinkedMarker;
|
|
6941
|
+
}, removed: string[], removedFolders?: string[], actor?: PromotionActor | null): {
|
|
6942
|
+
original: string;
|
|
6943
|
+
copies: string[];
|
|
6944
|
+
}[];
|
|
6945
|
+
/**
|
|
6946
|
+
* The live content claim ids of a project ("cas::..."), from one prefix listing of unique
|
|
6947
|
+
* ids (open to every signed-in caller, whatever group the claim is in), or null when it
|
|
6948
|
+
* could not be read or was cut off (then absence proves nothing).
|
|
6949
|
+
*/
|
|
6950
|
+
declare function listContentClaims(skapi: any, service: string, maxPages?: number): Promise<Set<string> | null>;
|
|
6951
|
+
/**
|
|
6952
|
+
* Every linked copy of a project, fresh: Map(copy path -> LinkedMarker), from the done::
|
|
6953
|
+
* markers tagged "bq_linked". Null when it could not be read. Used before a delete or an
|
|
6954
|
+
* Overwrite, where a 30-second-old sweep could miss a copy linked a moment ago.
|
|
6955
|
+
*/
|
|
6956
|
+
declare function listLinkedCopies(skapi: any, service: string, maxPages?: number): Promise<Map<string, LinkedMarker> | null>;
|
|
6957
|
+
type IdenticalFileEntry = {
|
|
6958
|
+
path: string;
|
|
6959
|
+
group?: any;
|
|
6960
|
+
uploader?: string | null;
|
|
6961
|
+
indexed?: boolean;
|
|
6962
|
+
indexed_at?: number | null;
|
|
6963
|
+
};
|
|
6964
|
+
type IdenticalGroup = {
|
|
6965
|
+
content_key: string;
|
|
6966
|
+
original: IdenticalFileEntry;
|
|
6967
|
+
copies: IdenticalFileEntry[];
|
|
6968
|
+
};
|
|
6969
|
+
type IdenticalScan = {
|
|
6970
|
+
complete: boolean;
|
|
6971
|
+
scanned: number;
|
|
6972
|
+
total: number;
|
|
6973
|
+
groups: IdenticalGroup[];
|
|
6974
|
+
skipped?: {
|
|
6975
|
+
path: string;
|
|
6976
|
+
reason: string;
|
|
6977
|
+
}[];
|
|
6978
|
+
};
|
|
6979
|
+
/**
|
|
6980
|
+
* The owner's scan for identical files that are indexed separately (MCP
|
|
6981
|
+
* /internal/identical-files). Calls again while the server says it is not complete (each
|
|
6982
|
+
* call keeps what the last one read), up to `maxCalls`. `onProgress` hears each answer.
|
|
6983
|
+
* Rejects with the server's words when it refuses (not the owner, no session).
|
|
6984
|
+
*/
|
|
6985
|
+
declare function findIdenticalFiles(args: {
|
|
6986
|
+
service: string;
|
|
6987
|
+
owner?: string;
|
|
6988
|
+
maxCalls?: number;
|
|
6989
|
+
budgetS?: number;
|
|
6990
|
+
onProgress?: (scan: IdenticalScan) => void;
|
|
6991
|
+
}): Promise<IdenticalScan>;
|
|
6992
|
+
/**
|
|
6993
|
+
* Link one copy to an original the owner confirmed (MCP /internal/identical-link, no AI):
|
|
6994
|
+
* the copy's own index is removed and it shares the original's. Resolves to the server's
|
|
6995
|
+
* answer ({ linked: true, ... }) or { linked: false, reason } when it was refused. Never
|
|
6996
|
+
* rejects.
|
|
6997
|
+
*/
|
|
6998
|
+
declare function linkIdenticalFile(args: {
|
|
6999
|
+
service: string;
|
|
7000
|
+
owner?: string;
|
|
7001
|
+
copy: string;
|
|
7002
|
+
original: string;
|
|
7003
|
+
}): Promise<{
|
|
7004
|
+
linked: boolean;
|
|
7005
|
+
reason?: string;
|
|
7006
|
+
[k: string]: any;
|
|
7007
|
+
}>;
|
|
7008
|
+
/** Plain words for identical-link's refusal reasons. */
|
|
7009
|
+
declare function identicalLinkReasonText(reason?: string): string;
|
|
7010
|
+
|
|
7011
|
+
export { ANSWER_MODES, ANSWER_MODE_HINTS, ANSWER_MODE_LABELS, ANSWER_MODE_OPTIONS, ANSWER_MODE_SETTING_LABEL, type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, type AnswerMode, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, type BgTaskEntry, type BoundedChatOptions, type BuildDisplayListOptions, type BuildIndexingUserMessageOptions, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTENT_CLAIM_PREFIX, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, type CallClaudeWithMcpParams, type ChatEngineConfig, type ChatGreetingParams, type ChatGreetingParts, type ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatStreamWiring, type ChatSystemPromptParams, type ChatTurnContext, type Citation, type CitationLinkPart, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, type CopyStatus, type CopyStatusKind, DATA_TOOL_NAMES, DEFAULT_ANSWER_MODE, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_SHARE_IDENTICAL_FILES, DEFAULT_SKIP_DUPLICATE_FILES, DEFAULT_UPLOAD_ACCESS_GROUP, DEFAULT_WEB_ACCESS, DUPLICATE_LOOKUP_LIMIT, DUPLICATE_LOOKUP_MAX_CANDIDATES, DUPLICATE_LOOKUP_TIMEOUT_MS, type DisplayEntry, type DuplicateUploadFile, type DuplicateUploadMatch, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, type EncodingClass, type ExtractDirective, type FillHistoryViewportOptions, 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, type IdenticalFileEntry, type IdenticalGroup, type IdenticalScan, type ImagePreviewContext, type IndexQueueIdentity, type IndexQueueSnapshot, type IndexQueueWatchHandle, type IndexQueueWatchOptions, type IndexResetResult, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINKED_COPY_TAG, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, LOOK_DEADLINE_MS, LOOK_FAST_MS, LOOK_SLOW_MS, LOOK_STALE_MS, type LinkedMarker, type LiveStreamUpdate, type LookOutcome, type LookRequest, LookScheduler, type LookTrigger, 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, type MapHistoryOptions, NOT_SENT_TEXT, NO_DATA_TOOL_MARK, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, type OpenItem, type OpenItemInit, type OriginalState, 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, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, type ProjectAccessSetting, type ProjectSettingsData, type ProjectSettingsReader, type PromotionActor, 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, type RenderableInlineLink, type RescueDecisionContext, type RetrievalHit, type RetrievalNote, type RowAnchor, type RunStubInfo, SHARE_IDENTICAL_FILES_KEY, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StoredCopyIndexing, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, type TerminalContext, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, UPLOAD_CANCELLED_MESSAGE, type UploadAccessGroup, type VisionProfile, 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, copiesByOriginal, copiesToPromote, copyCountLabel, copyCountTitle, copyStatusOf, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, crefSupported, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, extractRetrievalNote, fetchLiveIndexingKeys, fileNameOf, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, findDuplicateUpload, findIdenticalFiles, formatChatTimestamp, formatDuration, formatIndexDuration, formatLinkDuration, formatRetrievalNote, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, identicalLinkReasonText, indexDoneUniqueId, indexGroupDurationLabel, indexGroupLinkedLabel, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isDataToolName, isDuplicateCandidateId, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isNotExistsError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isRetrievalNote, isReturnTrigger, isServerExtractable, isServiceDbAttachmentHref, isTransportFailure, isUploadCancelledError, isWindowedReadFile, linkIdenticalFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, linkedMarkerOf, linkedRowLabel, listClaudeModels, listContentClaims, listLinkedCopies, listOpenAIModels, listedRequestText, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, messageTimeMs, mintCacheBustStamp, needsBomForExt, newClientRef, normalizeAnswerMode, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeShareIdenticalFiles, normalizeSkipDuplicateFiles, normalizeStoredPathTarget, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, normalizeWebAccess, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, parseLinkedReply, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAnswerMode, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectShareIdenticalFiles, projectSkipDuplicateFiles, projectUploadAccessGroup, projectWebAccess, promotableCopies, providerBodyWasRead, providerDocument, readExpiredAttachmentHref, readyProjectSettings, reconcilerReadsEnabled, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, requestIdTimeMs, resetFileIndexOnServer, resolveAnswerMode, resolveImagePreviewUrl, resolveSkipDuplicateFiles, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, runRecordDurationMs, runSettleSideEffect, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shareIdenticalFilesFrom, shouldRescueInFlightMessage, sideEffectDone, skapiSupportsStreaming, skipDuplicateFilesEnabled, skipDuplicateFilesFrom, splitLabelForFit, statusPushEnabled, statusPushLive, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
|