bunnyquery 1.18.0 → 1.19.0
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 -16
- package/bunnyquery.css +14 -0
- package/bunnyquery.js +8818 -7335
- package/dist/engine.cjs +8518 -7380
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +458 -193
- package/dist/engine.d.ts +458 -193
- package/dist/engine.mjs +8512 -7381
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/config.ts +72 -138
- package/src/engine/duplicates.ts +114 -35
- package/src/engine/findings.ts +305 -0
- package/src/engine/history.ts +27 -2
- package/src/engine/host.ts +25 -1
- package/src/engine/index.ts +15 -1
- package/src/engine/indexing_groups.ts +18 -0
- package/src/engine/prompts/chat_system_prompt.ts +2 -1
- package/src/engine/prompts/indexing_system_prompt.ts +2 -2
- package/src/engine/prompts/indexing_user_message.ts +4 -3
- package/src/engine/requests.ts +57 -3
- package/src/engine/retrieval_memory.ts +11 -0
- package/src/engine/session.ts +859 -83
- package/styles/chat.css +14 -0
package/dist/engine.d.mts
CHANGED
|
@@ -1,3 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieval memory: a compact note of what a chat turn RETRIEVED, kept with the
|
|
3
|
+
* turn so a follow-up question skips discovery.
|
|
4
|
+
*
|
|
5
|
+
* THE PROBLEM. The provider runs the tool loop on its side and history keeps
|
|
6
|
+
* only the answer text (budget.ts), so on "and what does page 3 say?" the model
|
|
7
|
+
* starts from nothing: it looks the file up again, guesses a table and an access
|
|
8
|
+
* group again, and routinely lands somewhere else, which is how an answer flips
|
|
9
|
+
* between two turns about the same document.
|
|
10
|
+
*
|
|
11
|
+
* WHAT THE ENGINE CAN SEE. The provider's final body carries the tool loop:
|
|
12
|
+
* - Anthropic Messages: content[] blocks `mcp_tool_use` (name, input) and
|
|
13
|
+
* `mcp_tool_result` (content), plus `server_tool_use` / `web_*_tool_result`
|
|
14
|
+
* for the built-in web tools;
|
|
15
|
+
* - OpenAI Responses: output[] items `mcp_call` (name, arguments as a JSON
|
|
16
|
+
* string, output as a string) and `web_search_call`.
|
|
17
|
+
* The polling worker stores that body on the row (spilling to S3 past 300 KB,
|
|
18
|
+
* never truncating), and a streamed turn's assembled body keeps the same blocks
|
|
19
|
+
* (sse.ts copies each block's skeleton and its JSON input verbatim), so the
|
|
20
|
+
* same reader works live, after a stream and after a reload. When a body has no
|
|
21
|
+
* tool blocks at all (a host that strips them, a provider shape this does not
|
|
22
|
+
* know), the note falls back to what the ANSWER names: db: file links and src::
|
|
23
|
+
* paths. Nothing is ever invented: an empty note is null, not a guess.
|
|
24
|
+
*
|
|
25
|
+
* WHAT IS KEPT, per turn: files (storage paths), tables, access groups,
|
|
26
|
+
* searchText hits as path + page, the tool names, and whether a web tool ran.
|
|
27
|
+
* Arguments are read by KEY, never by position, and only the keys the
|
|
28
|
+
* BunnyQuery tools use for those four things; a query's filter values, a
|
|
29
|
+
* record's data and a tool result's text are never copied, so the note cannot
|
|
30
|
+
* leak a page of a document into every later turn.
|
|
31
|
+
*
|
|
32
|
+
* HOW IT REACHES THE MODEL. buildBoundedChatMessages appends the formatted note
|
|
33
|
+
* to the LLM copy of the assistant turn it belongs to (never the displayed
|
|
34
|
+
* bubble), for the newest RETRIEVAL_NOTES_MAX turns and within
|
|
35
|
+
* RETRIEVAL_NOTES_TOKEN_BUDGET tokens, so the memory is bounded however long
|
|
36
|
+
* the chat gets. A host that never attaches `_retrieval` sees byte-identical
|
|
37
|
+
* requests to today.
|
|
38
|
+
*/
|
|
39
|
+
type RetrievalHit = {
|
|
40
|
+
path: string;
|
|
41
|
+
page: number;
|
|
42
|
+
};
|
|
43
|
+
type RetrievalNote = {
|
|
44
|
+
/** Storage paths (the part after "src::") the turn read, queried or linked. */
|
|
45
|
+
files: string[];
|
|
46
|
+
/** Table names the turn queried. */
|
|
47
|
+
tables: string[];
|
|
48
|
+
/** Access groups the turn queried at, as written in the call. */
|
|
49
|
+
accessGroups: string[];
|
|
50
|
+
/** searchText hits: the page a term was found on, per file. */
|
|
51
|
+
hits: RetrievalHit[];
|
|
52
|
+
/** Tool names, in order of first use. */
|
|
53
|
+
tools: string[];
|
|
54
|
+
/** A web tool ran in this turn (web_search / web_fetch). */
|
|
55
|
+
web: boolean;
|
|
56
|
+
/** 'tools' when read off the body's tool blocks; 'answer' when only the
|
|
57
|
+
* answer text was available to read. */
|
|
58
|
+
source: 'tools' | 'answer' | 'body';
|
|
59
|
+
};
|
|
60
|
+
/** How many of the newest turns carry their note into the request. */
|
|
61
|
+
declare const RETRIEVAL_NOTES_MAX = 6;
|
|
62
|
+
/** Ceiling on the estimated tokens all carried notes may add to one request. */
|
|
63
|
+
declare const RETRIEVAL_NOTES_TOKEN_BUDGET = 1200;
|
|
64
|
+
/** Per-list cap inside one note (files, tables, groups, hits, tools). */
|
|
65
|
+
declare const RETRIEVAL_NOTE_MAX_ITEMS = 8;
|
|
66
|
+
/** Hard cap on one formatted note. */
|
|
67
|
+
declare const RETRIEVAL_NOTE_MAX_CHARS = 600;
|
|
68
|
+
/** The marker a carried note opens with; also what keeps it out of the model's own voice. */
|
|
69
|
+
declare const RETRIEVAL_NOTE_PREFIX = "[Retrieval note, not shown to the user";
|
|
70
|
+
/**
|
|
71
|
+
* What an ANSWER names: db: file links ("[name](db:path)") and src:: ids. The
|
|
72
|
+
* fallback for a body with no tool blocks, and merged into a tool note too so a
|
|
73
|
+
* file the model linked but never queried (it knew the path from history) is
|
|
74
|
+
* still remembered.
|
|
75
|
+
*/
|
|
76
|
+
declare function retrievalNoteFromText(text: string | null | undefined): RetrievalNote | null;
|
|
77
|
+
/**
|
|
78
|
+
* The note for one assistant turn: the body's tool loop when it has one, else
|
|
79
|
+
* what the answer names, else null. `answerText` is the extracted answer, read
|
|
80
|
+
* for file links in both cases.
|
|
81
|
+
*/
|
|
82
|
+
declare function extractRetrievalNote(body: any, answerText?: string | null): RetrievalNote | null;
|
|
83
|
+
/**
|
|
84
|
+
* True when `body` is a provider response this module can read: an Anthropic
|
|
85
|
+
* Messages body (`content` array) or an OpenAI Responses body (`output` array).
|
|
86
|
+
*/
|
|
87
|
+
declare function providerBodyWasRead(body: any): boolean;
|
|
88
|
+
/** True when the value is a note this module produced (or an equivalent shape). */
|
|
89
|
+
declare function isRetrievalNote(value: any): value is RetrievalNote;
|
|
90
|
+
/**
|
|
91
|
+
* One line the model reads. Sections are omitted when empty, the whole thing is
|
|
92
|
+
* capped at RETRIEVAL_NOTE_MAX_CHARS, and it opens with RETRIEVAL_NOTE_PREFIX so
|
|
93
|
+
* the model can tell it from its own earlier words. Returns '' for an empty note.
|
|
94
|
+
*/
|
|
95
|
+
declare function formatRetrievalNote(note: RetrievalNote | null | undefined): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Saved search findings (owner, 2026-11-20): where a hard search found its answer, kept in
|
|
99
|
+
* the project's database so the same question, from anyone, later goes straight to the page.
|
|
100
|
+
*
|
|
101
|
+
* WHAT IS SAVED: the LOCATION, never the answer. One record per file page in table
|
|
102
|
+
* "search_findings", unique_id "find::<path>#p<page>", reference "src::<path>" (so a
|
|
103
|
+
* re-index or a delete of the file removes its findings through the cascade), the file's own
|
|
104
|
+
* access group (a finding is never visible to someone who cannot read the file), and tags:
|
|
105
|
+
* the key words of the question and the search terms that found the page, normalized the way
|
|
106
|
+
* every BunnyQuery tag is (tagForms). The chat reads the page again before answering, so a
|
|
107
|
+
* finding can never replay an outdated answer; it only skips the hunt.
|
|
108
|
+
*
|
|
109
|
+
* WHEN: after a chat turn that needed a real search (FINDING_MIN_TOOL_CALLS or more tool
|
|
110
|
+
* calls) and whose answer links a file that a searchText hit found on a page, or, when the
|
|
111
|
+
* turn read the file with readFileContent instead, the pages its answer cites of that file. Read from the
|
|
112
|
+
* provider body the turn already has, by the engine, so it costs no model step. Nothing is
|
|
113
|
+
* invented: no hit on a linked file, no finding. No page text and no result text is copied.
|
|
114
|
+
*
|
|
115
|
+
* The engine never writes records itself: the host's saveSearchFinding hook does (config.ts).
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
declare const FINDINGS_TABLE = "search_findings";
|
|
119
|
+
declare const FINDING_ID_PREFIX = "find::";
|
|
120
|
+
/** The words of a question or a search term that say WHAT is looked for. */
|
|
121
|
+
declare function keyWords(text: string | null | undefined): string[];
|
|
122
|
+
type SearchFinding = {
|
|
123
|
+
storagePath: string;
|
|
124
|
+
page: number;
|
|
125
|
+
uniqueId: string;
|
|
126
|
+
tags: string[];
|
|
127
|
+
data: {
|
|
128
|
+
path: string;
|
|
129
|
+
page: number;
|
|
130
|
+
question_words: string[];
|
|
131
|
+
search_terms: string[];
|
|
132
|
+
found_at: number;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* The findings one finished chat turn earns, or [] (see the file comment for the rules).
|
|
137
|
+
* `note` is the turn's retrieval note (its searchText hits and the files its answer links).
|
|
138
|
+
*/
|
|
139
|
+
declare function findingsForTurn(args: {
|
|
140
|
+
question: string | null | undefined;
|
|
141
|
+
body: any;
|
|
142
|
+
note: RetrievalNote | null | undefined;
|
|
143
|
+
answer: string | null | undefined;
|
|
144
|
+
now?: number;
|
|
145
|
+
}): SearchFinding[];
|
|
146
|
+
|
|
1
147
|
/**
|
|
2
148
|
* Client-side attachment-parser plugins.
|
|
3
149
|
*
|
|
@@ -48,30 +194,6 @@ declare function findAttachmentParser(name: string, mime?: string): AttachmentPa
|
|
|
48
194
|
*/
|
|
49
195
|
declare function parseAttachmentContent(file: File, name: string, mime?: string): Promise<string | null>;
|
|
50
196
|
|
|
51
|
-
/**
|
|
52
|
-
* Engine configuration / dependency injection.
|
|
53
|
-
*
|
|
54
|
-
* The engine is framework- and transport-agnostic: it never imports a skapi
|
|
55
|
-
* instance or `import.meta.env`. Each consumer calls `configureChatEngine()`
|
|
56
|
-
* once at startup to inject the skapi transport functions, the MCP base URL,
|
|
57
|
-
* and (optionally) the `poll` value to attach to every forwarded request.
|
|
58
|
-
*
|
|
59
|
-
* Why `poll` is configurable: agent.vue uses the npm-bundled skapi-js and OMITS
|
|
60
|
-
* `poll` (its request auto-resolves with the final body), whereas
|
|
61
|
-
* the BunnyQuery widget uses the deployed skapi-js@latest and must pass
|
|
62
|
-
* `poll: 0` to get the early ack + a manual `.poll()` handle (needed for queued-
|
|
63
|
-
* send cancel). So the request builders include `poll` only when it is set.
|
|
64
|
-
*
|
|
65
|
-
* THE TRANSPORT HAS TWO SPELLINGS, and a host may inject either. skapi-js renamed
|
|
66
|
-
* clientSecretRequest and its companions to the forwardRequest family, and kept
|
|
67
|
-
* every old name working. So this config accepts both families of keys, prefers
|
|
68
|
-
* the new one, and every call goes through the resolveForwardRequest* functions
|
|
69
|
-
* below, which are the only code in the engine that knows there are two. The old
|
|
70
|
-
* keys are not a courtesy: this package is pinned with a caret range, so a host
|
|
71
|
-
* written against an earlier release takes this one on its next install with
|
|
72
|
-
* nothing but the old keys injected, and it has to keep working unchanged.
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
197
|
/**
|
|
76
198
|
* One report about a turn that is streaming, as handed to `onLiveStreamUpdate`.
|
|
77
199
|
*
|
|
@@ -155,35 +277,13 @@ interface ChatEngineConfig {
|
|
|
155
277
|
* is given the embedder's) decides by a companion only the new SDK has,
|
|
156
278
|
* `forwardRequestHistory`, and never by this method's presence.
|
|
157
279
|
*
|
|
158
|
-
*
|
|
159
|
-
* one is used. See resolveForwardRequest.
|
|
280
|
+
* Required. See resolveForwardRequest.
|
|
160
281
|
*/
|
|
161
282
|
forwardRequest?: (form: any, opts: any) => Promise<any>;
|
|
162
283
|
/**
|
|
163
|
-
* skapi.forwardRequestHistory, bound to the consumer's skapi instance.
|
|
164
|
-
* the deprecated `clientSecretRequestHistory` is required; with both, this one
|
|
165
|
-
* is used. Same arguments either way.
|
|
284
|
+
* skapi.forwardRequestHistory, bound to the consumer's skapi instance. Required.
|
|
166
285
|
*/
|
|
167
286
|
forwardRequestHistory?: (params: any, fetchOptions: any) => Promise<any>;
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Inject `forwardRequest` instead.
|
|
170
|
-
*
|
|
171
|
-
* skapi.clientSecretRequest, bound to the consumer's skapi instance. Still
|
|
172
|
-
* accepted as a COMPATIBILITY CONTRACT, not a leftover: a host that injects
|
|
173
|
-
* only the old keys must keep working on this release. Used only when
|
|
174
|
-
* `forwardRequest` is absent, and handed the engine's request with `secretName`
|
|
175
|
-
* moved back to `clientSecretName`, which is exactly the request it was handed
|
|
176
|
-
* before the rename (see resolveForwardRequest).
|
|
177
|
-
*/
|
|
178
|
-
clientSecretRequest?: (opts: any) => Promise<any>;
|
|
179
|
-
/**
|
|
180
|
-
* @deprecated Inject `forwardRequestHistory` instead.
|
|
181
|
-
*
|
|
182
|
-
* skapi.clientSecretRequestHistory, bound to the consumer's skapi instance.
|
|
183
|
-
* Kept for the same compatibility contract as `clientSecretRequest`, and used
|
|
184
|
-
* only when `forwardRequestHistory` is absent.
|
|
185
|
-
*/
|
|
186
|
-
clientSecretRequestHistory?: (params: any, fetchOptions: any) => Promise<any>;
|
|
187
287
|
/** MCP server base URL (prod vs dev resolved by the consumer). */
|
|
188
288
|
mcpBaseUrl: string;
|
|
189
289
|
/**
|
|
@@ -311,20 +411,10 @@ interface ChatEngineConfig {
|
|
|
311
411
|
* sends the ASSEMBLED provider body, so history reads it exactly as it reads
|
|
312
412
|
* a buffered turn) and releases that request's chunks. Optional: a host
|
|
313
413
|
* without it can still stream, it just leaves the chunks and an empty row.
|
|
314
|
-
* Takes precedence over the deprecated `clientSecretRequestFinalize`.
|
|
315
414
|
*/
|
|
316
415
|
forwardRequestFinalize?: ForwardRequestFinalizeFn;
|
|
317
416
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* skapi.clientSecretRequestFinalize, the same call under its old name. Kept
|
|
321
|
-
* for the compatibility contract `clientSecretRequest` describes, and used
|
|
322
|
-
* only when `forwardRequestFinalize` is absent.
|
|
323
|
-
*/
|
|
324
|
-
clientSecretRequestFinalize?: ForwardRequestFinalizeFn;
|
|
325
|
-
/**
|
|
326
|
-
* skapi.forwardRequestStream, bound to the consumer's skapi instance. Takes
|
|
327
|
-
* precedence over the deprecated `clientSecretRequestStream`.
|
|
417
|
+
* skapi.forwardRequestStream, bound to the consumer's skapi instance.
|
|
328
418
|
*
|
|
329
419
|
* THE SECOND HALF OF THE DURABILITY GUARANTEE, and without it a streamed turn
|
|
330
420
|
* is only as durable as the tab that started it. A streamed row settles with a
|
|
@@ -352,15 +442,6 @@ interface ChatEngineConfig {
|
|
|
352
442
|
* streamRecoveryEnabled() below for why the two decisions are separate.
|
|
353
443
|
*/
|
|
354
444
|
forwardRequestStream?: ForwardRequestStreamFn;
|
|
355
|
-
/**
|
|
356
|
-
* @deprecated Inject `forwardRequestStream` instead.
|
|
357
|
-
*
|
|
358
|
-
* skapi.clientSecretRequestStream, the same call under its old name. Kept for
|
|
359
|
-
* the compatibility contract `clientSecretRequest` describes, and used only
|
|
360
|
-
* when `forwardRequestStream` is absent. It arms recovery exactly as the new
|
|
361
|
-
* key does.
|
|
362
|
-
*/
|
|
363
|
-
clientSecretRequestStream?: ForwardRequestStreamFn;
|
|
364
445
|
/**
|
|
365
446
|
* Observation hook for a live-streaming turn, called at most once per paint
|
|
366
447
|
* (about once a second) plus once when the turn settles.
|
|
@@ -380,8 +461,7 @@ interface ChatEngineConfig {
|
|
|
380
461
|
* reader is injected.
|
|
381
462
|
*
|
|
382
463
|
* There is no need to set it to turn recovery ON: injecting
|
|
383
|
-
* `forwardRequestStream`
|
|
384
|
-
* is what arms it (see streamRecoveryEnabled).
|
|
464
|
+
* `forwardRequestStream` is what arms it (see streamRecoveryEnabled).
|
|
385
465
|
* This exists only as the way back out for a host that wants byte-for-byte the
|
|
386
466
|
* pre-recovery rendering of a terminal-but-empty row - no bubble, no marker, no
|
|
387
467
|
* chunk read - while keeping the reader available for its own use. Omit it and
|
|
@@ -397,6 +477,36 @@ interface ChatEngineConfig {
|
|
|
397
477
|
* without it, stubs keep their server-extracted heads.
|
|
398
478
|
*/
|
|
399
479
|
csrHistoryItemLookup?: (fullId: string, service: string, owner: string) => Promise<any>;
|
|
480
|
+
/**
|
|
481
|
+
* Read a document's page progress: the `data` of its "prog::<storagePath>" record
|
|
482
|
+
* ({ pages_saved, pages_total }), which the MCP keeps while the document's pages are
|
|
483
|
+
* saved, or null when there is none. Optional: without it a row shows passes only.
|
|
484
|
+
* Asked by the 10-second queue check for files still being indexed.
|
|
485
|
+
*/
|
|
486
|
+
readIndexProgress?: (service: string, storagePath: string) => Promise<{
|
|
487
|
+
pages_saved?: number;
|
|
488
|
+
pages_total?: number | null;
|
|
489
|
+
} | null>;
|
|
490
|
+
/**
|
|
491
|
+
* Save one search finding (findings.ts): where a hard search found its answer, as a
|
|
492
|
+
* record in table "search_findings" with the given unique_id, tags and data, reference
|
|
493
|
+
* "src::<storagePath>" and the ACCESS GROUP OF THAT FILE (read it; skip the save when
|
|
494
|
+
* the file has no record). When the unique_id is taken, add the new tags to the existing
|
|
495
|
+
* record instead. Best effort: never throw into the engine. Optional: without it nothing
|
|
496
|
+
* is saved.
|
|
497
|
+
*/
|
|
498
|
+
saveSearchFinding?: (finding: SearchFinding & {
|
|
499
|
+
service: string;
|
|
500
|
+
owner?: string;
|
|
501
|
+
}) => Promise<any> | void;
|
|
502
|
+
/**
|
|
503
|
+
* The request ids of one file's indexing passes: the unique ids "pass::<storagePath>#<id>"
|
|
504
|
+
* the worker writes as each pass starts (getUniqueId, prefix "pass::<storagePath>#", every
|
|
505
|
+
* page), answered as the ids after "#" in any order. With it (and csrHistoryItemLookup) the
|
|
506
|
+
* chat history fetches the CONVERSATION only and a file's row loads its passes when opened
|
|
507
|
+
* (ChatSession.loadRunPasses). Without it the history pages the indexing queue as before.
|
|
508
|
+
*/
|
|
509
|
+
listIndexPasses?: (service: string, storagePath: string) => Promise<string[]>;
|
|
400
510
|
}
|
|
401
511
|
declare function configureChatEngine(config: ChatEngineConfig): void;
|
|
402
512
|
declare function chatEngineConfig(): ChatEngineConfig;
|
|
@@ -460,11 +570,7 @@ declare function resolveSkipDuplicateFiles(service?: string): Promise<boolean>;
|
|
|
460
570
|
* bubble is dropped, and the list looks exactly as it did before. Set
|
|
461
571
|
* `streamRecovery: false` to opt out of even that.
|
|
462
572
|
*
|
|
463
|
-
* The reader is asked for through resolveForwardRequestStream
|
|
464
|
-
* it arms recovery: `forwardRequestStream`, or the deprecated
|
|
465
|
-
* `clientSecretRequestStream` a host written before the rename still injects. Asked
|
|
466
|
-
* for the new key alone, this would quietly disarm recovery for every such host on
|
|
467
|
-
* its next install, which is the stranding described above arriving by a rename.
|
|
573
|
+
* The reader is asked for through resolveForwardRequestStream: `forwardRequestStream`.
|
|
468
574
|
*/
|
|
469
575
|
declare function streamRecoveryEnabled(): boolean;
|
|
470
576
|
/**
|
|
@@ -477,8 +583,8 @@ declare function streamRecoveryEnabled(): boolean;
|
|
|
477
583
|
* into the chunk table) and the DESTINATION's own field inside `data`, which
|
|
478
584
|
* BunnyQuery is the party that sets, because skapi relays bytes and knows no
|
|
479
585
|
* vendor. skapi validates the request's params against a schema and KEEPS ONLY
|
|
480
|
-
* THE KEYS IN THAT SCHEMA, so an skapi-js predating the feature
|
|
481
|
-
*
|
|
586
|
+
* THE KEYS IN THAT SCHEMA, so an skapi-js predating the feature does not reject
|
|
587
|
+
* `stream` - it silently DROPS it. What
|
|
482
588
|
* ships is then the exact split
|
|
483
589
|
* chatStreamWiring exists to make impossible: the destination is asked to answer in
|
|
484
590
|
* SSE frames, skapi waits and stores the whole transcript on the row, and
|
|
@@ -506,18 +612,11 @@ declare function streamRecoveryEnabled(): boolean;
|
|
|
506
612
|
* learn that `stream` was dropped is to send a real request and read an empty
|
|
507
613
|
* answer, which is the bug itself.
|
|
508
614
|
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* embed page pinned between the two releases streaming; accepting the new pair is
|
|
515
|
-
* what keeps this answering yes once the old aliases are finally removed. The
|
|
516
|
-
* reasoning above holds for both: each pair shipped in the same change as, or after,
|
|
517
|
-
* the `stream` key, and each IS the capability rather than a proxy for it. A mixed
|
|
518
|
-
* half of each is not a pair and is refused, because no real SDK has that shape and
|
|
519
|
-
* the engine would still be missing one half of the protocol under the name it asks
|
|
520
|
-
* for.
|
|
615
|
+
* ONLY THE NEW PAIR ANSWERS YES (owner, 2026-11-20). forwardRequestStream and
|
|
616
|
+
* forwardRequestFinalize shipped with the forwardRequest rename (skapi-js 2.1.0), after
|
|
617
|
+
* the `stream` key, so each IS the capability. The old clientSecretRequestStream /
|
|
618
|
+
* clientSecretRequestFinalize pair is no longer accepted: the engine no longer reads the
|
|
619
|
+
* old transport keys at all, so an SDK with only that pair could not be wired anyway.
|
|
521
620
|
*
|
|
522
621
|
* A presence probe is safe for these two names in a way it is NOT for forwardRequest
|
|
523
622
|
* itself: no skapi-js ever shipped a forwardRequestStream or forwardRequestFinalize
|
|
@@ -532,7 +631,8 @@ declare function skapiSupportsStreaming(sk: any): boolean;
|
|
|
532
631
|
* yes 2026-10-12): "has the signed-in user already uploaded THIS file to this
|
|
533
632
|
* project?", answered from the file records the upload path already writes.
|
|
534
633
|
*
|
|
535
|
-
* WHAT COUNTS AS THE SAME FILE. Same name, same size in bytes, same uploader
|
|
634
|
+
* WHAT COUNTS AS THE SAME FILE. Same name, same size in bytes, same uploader, and a
|
|
635
|
+
* stored copy that finished indexing or is still being indexed (see findDuplicateUpload).
|
|
536
636
|
* Every upload creates a `src::<storagePath>` record (table `file_summaries`)
|
|
537
637
|
* whose `data.size_bytes` is the byte count and whose `user_id` is the
|
|
538
638
|
* uploader, so a lookup by name narrowed by those two fields finds a file
|
|
@@ -565,6 +665,8 @@ type DuplicateUploadMatch = {
|
|
|
565
665
|
uniqueId: string;
|
|
566
666
|
/** The file record as read. */
|
|
567
667
|
record: any;
|
|
668
|
+
/** Why it is skipped: the stored copy finished indexing, or is being indexed. */
|
|
669
|
+
indexing?: StoredCopyIndexing;
|
|
568
670
|
};
|
|
569
671
|
type DuplicateUploadFile = {
|
|
570
672
|
/** The file name as it is STORED: the last segment of the storage path. */
|
|
@@ -576,14 +678,30 @@ type DuplicateUploadFile = {
|
|
|
576
678
|
declare const DUPLICATE_LOOKUP_MAX_CANDIDATES = 25;
|
|
577
679
|
/** Narrow an ends-with listing to real file records for exactly this name. */
|
|
578
680
|
declare function isDuplicateCandidateId(uniqueId: unknown, name: string): boolean;
|
|
579
|
-
/**
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
681
|
+
/** How long one check may take. A slower lookup answers "not a duplicate": upload as usual. */
|
|
682
|
+
declare const DUPLICATE_LOOKUP_TIMEOUT_MS = 15000;
|
|
683
|
+
/** Most ids the ends-with listing fetches. */
|
|
684
|
+
declare const DUPLICATE_LOOKUP_LIMIT = 500;
|
|
685
|
+
/** The stored copy's indexing state, read from its `done::` and `run::` markers. */
|
|
686
|
+
type StoredCopyIndexing = 'done' | 'running' | 'other';
|
|
687
|
+
/**
|
|
688
|
+
* This user's stored copy of `file`, when the upload should be SKIPPED, or null to upload as
|
|
689
|
+
* usual. One implementation for the widget and the site (www's duplicates.ts wraps it).
|
|
690
|
+
*
|
|
691
|
+
* THE RULE (owner, 2026-11-20). A `src::` record for `file.name` (root or any folder) whose
|
|
692
|
+
* `data.size_bytes` equals `file.size` and whose `user_id` is `userId`, AND whose stored copy
|
|
693
|
+
* finished indexing or is still being indexed (storedCopyIndexing). A copy whose indexing
|
|
694
|
+
* failed or was cancelled is NOT a duplicate: the upload goes on and reaches the host's usual
|
|
695
|
+
* "already exists: Skip / Reindex / Overwrite" question, instead of being skipped silently
|
|
696
|
+
* with no way to index it again.
|
|
697
|
+
*
|
|
698
|
+
* NEVER THROWS and never takes longer than `opts.timeoutMs` (DUPLICATE_LOOKUP_TIMEOUT_MS): a
|
|
699
|
+
* failed, refused or slow lookup answers null. `opts.service` is passed through to every skapi
|
|
700
|
+
* call when given (the widget and the site name the project on every call).
|
|
584
701
|
*/
|
|
585
702
|
declare function findDuplicateUpload(skapi: any, file: DuplicateUploadFile, userId: string, opts?: {
|
|
586
703
|
service?: string;
|
|
704
|
+
timeoutMs?: number;
|
|
587
705
|
}): Promise<DuplicateUploadMatch | null>;
|
|
588
706
|
|
|
589
707
|
/**
|
|
@@ -1058,102 +1176,6 @@ declare function isAuthExpiredError(input: any): boolean;
|
|
|
1058
1176
|
*/
|
|
1059
1177
|
declare function isProviderApiKeyError(input: any): boolean;
|
|
1060
1178
|
|
|
1061
|
-
/**
|
|
1062
|
-
* Retrieval memory: a compact note of what a chat turn RETRIEVED, kept with the
|
|
1063
|
-
* turn so a follow-up question skips discovery.
|
|
1064
|
-
*
|
|
1065
|
-
* THE PROBLEM. The provider runs the tool loop on its side and history keeps
|
|
1066
|
-
* only the answer text (budget.ts), so on "and what does page 3 say?" the model
|
|
1067
|
-
* starts from nothing: it looks the file up again, guesses a table and an access
|
|
1068
|
-
* group again, and routinely lands somewhere else, which is how an answer flips
|
|
1069
|
-
* between two turns about the same document.
|
|
1070
|
-
*
|
|
1071
|
-
* WHAT THE ENGINE CAN SEE. The provider's final body carries the tool loop:
|
|
1072
|
-
* - Anthropic Messages: content[] blocks `mcp_tool_use` (name, input) and
|
|
1073
|
-
* `mcp_tool_result` (content), plus `server_tool_use` / `web_*_tool_result`
|
|
1074
|
-
* for the built-in web tools;
|
|
1075
|
-
* - OpenAI Responses: output[] items `mcp_call` (name, arguments as a JSON
|
|
1076
|
-
* string, output as a string) and `web_search_call`.
|
|
1077
|
-
* The polling worker stores that body on the row (spilling to S3 past 300 KB,
|
|
1078
|
-
* never truncating), and a streamed turn's assembled body keeps the same blocks
|
|
1079
|
-
* (sse.ts copies each block's skeleton and its JSON input verbatim), so the
|
|
1080
|
-
* same reader works live, after a stream and after a reload. When a body has no
|
|
1081
|
-
* tool blocks at all (a host that strips them, a provider shape this does not
|
|
1082
|
-
* know), the note falls back to what the ANSWER names: db: file links and src::
|
|
1083
|
-
* paths. Nothing is ever invented: an empty note is null, not a guess.
|
|
1084
|
-
*
|
|
1085
|
-
* WHAT IS KEPT, per turn: files (storage paths), tables, access groups,
|
|
1086
|
-
* searchText hits as path + page, the tool names, and whether a web tool ran.
|
|
1087
|
-
* Arguments are read by KEY, never by position, and only the keys the
|
|
1088
|
-
* BunnyQuery tools use for those four things; a query's filter values, a
|
|
1089
|
-
* record's data and a tool result's text are never copied, so the note cannot
|
|
1090
|
-
* leak a page of a document into every later turn.
|
|
1091
|
-
*
|
|
1092
|
-
* HOW IT REACHES THE MODEL. buildBoundedChatMessages appends the formatted note
|
|
1093
|
-
* to the LLM copy of the assistant turn it belongs to (never the displayed
|
|
1094
|
-
* bubble), for the newest RETRIEVAL_NOTES_MAX turns and within
|
|
1095
|
-
* RETRIEVAL_NOTES_TOKEN_BUDGET tokens, so the memory is bounded however long
|
|
1096
|
-
* the chat gets. A host that never attaches `_retrieval` sees byte-identical
|
|
1097
|
-
* requests to today.
|
|
1098
|
-
*/
|
|
1099
|
-
type RetrievalHit = {
|
|
1100
|
-
path: string;
|
|
1101
|
-
page: number;
|
|
1102
|
-
};
|
|
1103
|
-
type RetrievalNote = {
|
|
1104
|
-
/** Storage paths (the part after "src::") the turn read, queried or linked. */
|
|
1105
|
-
files: string[];
|
|
1106
|
-
/** Table names the turn queried. */
|
|
1107
|
-
tables: string[];
|
|
1108
|
-
/** Access groups the turn queried at, as written in the call. */
|
|
1109
|
-
accessGroups: string[];
|
|
1110
|
-
/** searchText hits: the page a term was found on, per file. */
|
|
1111
|
-
hits: RetrievalHit[];
|
|
1112
|
-
/** Tool names, in order of first use. */
|
|
1113
|
-
tools: string[];
|
|
1114
|
-
/** A web tool ran in this turn (web_search / web_fetch). */
|
|
1115
|
-
web: boolean;
|
|
1116
|
-
/** 'tools' when read off the body's tool blocks; 'answer' when only the
|
|
1117
|
-
* answer text was available to read. */
|
|
1118
|
-
source: 'tools' | 'answer' | 'body';
|
|
1119
|
-
};
|
|
1120
|
-
/** How many of the newest turns carry their note into the request. */
|
|
1121
|
-
declare const RETRIEVAL_NOTES_MAX = 6;
|
|
1122
|
-
/** Ceiling on the estimated tokens all carried notes may add to one request. */
|
|
1123
|
-
declare const RETRIEVAL_NOTES_TOKEN_BUDGET = 1200;
|
|
1124
|
-
/** Per-list cap inside one note (files, tables, groups, hits, tools). */
|
|
1125
|
-
declare const RETRIEVAL_NOTE_MAX_ITEMS = 8;
|
|
1126
|
-
/** Hard cap on one formatted note. */
|
|
1127
|
-
declare const RETRIEVAL_NOTE_MAX_CHARS = 600;
|
|
1128
|
-
/** The marker a carried note opens with; also what keeps it out of the model's own voice. */
|
|
1129
|
-
declare const RETRIEVAL_NOTE_PREFIX = "[Retrieval note, not shown to the user";
|
|
1130
|
-
/**
|
|
1131
|
-
* What an ANSWER names: db: file links ("[name](db:path)") and src:: ids. The
|
|
1132
|
-
* fallback for a body with no tool blocks, and merged into a tool note too so a
|
|
1133
|
-
* file the model linked but never queried (it knew the path from history) is
|
|
1134
|
-
* still remembered.
|
|
1135
|
-
*/
|
|
1136
|
-
declare function retrievalNoteFromText(text: string | null | undefined): RetrievalNote | null;
|
|
1137
|
-
/**
|
|
1138
|
-
* The note for one assistant turn: the body's tool loop when it has one, else
|
|
1139
|
-
* what the answer names, else null. `answerText` is the extracted answer, read
|
|
1140
|
-
* for file links in both cases.
|
|
1141
|
-
*/
|
|
1142
|
-
declare function extractRetrievalNote(body: any, answerText?: string | null): RetrievalNote | null;
|
|
1143
|
-
/**
|
|
1144
|
-
* True when `body` is a provider response this module can read: an Anthropic
|
|
1145
|
-
* Messages body (`content` array) or an OpenAI Responses body (`output` array).
|
|
1146
|
-
*/
|
|
1147
|
-
declare function providerBodyWasRead(body: any): boolean;
|
|
1148
|
-
/** True when the value is a note this module produced (or an equivalent shape). */
|
|
1149
|
-
declare function isRetrievalNote(value: any): value is RetrievalNote;
|
|
1150
|
-
/**
|
|
1151
|
-
* One line the model reads. Sections are omitted when empty, the whole thing is
|
|
1152
|
-
* capped at RETRIEVAL_NOTE_MAX_CHARS, and it opens with RETRIEVAL_NOTE_PREFIX so
|
|
1153
|
-
* the model can tell it from its own earlier words. Returns '' for an empty note.
|
|
1154
|
-
*/
|
|
1155
|
-
declare function formatRetrievalNote(note: RetrievalNote | null | undefined): string;
|
|
1156
|
-
|
|
1157
1179
|
declare var CONTEXT_WINDOW_DEFAULT: Record<string, number>;
|
|
1158
1180
|
declare var CONTEXT_WINDOW_BY_MODEL: Record<string, number>;
|
|
1159
1181
|
declare var MAX_OUTPUT_BY_MODEL: Record<string, number>;
|
|
@@ -2489,6 +2511,35 @@ declare const BG_INDEXING_QUEUE_SUFFIX = "-bg";
|
|
|
2489
2511
|
* fall back to the live-queue probe (fetchLiveIndexingKeys) before reading
|
|
2490
2512
|
* absence as anything.
|
|
2491
2513
|
*/
|
|
2514
|
+
/** What the MCP's /internal/index-reset answered. */
|
|
2515
|
+
type IndexResetResult = {
|
|
2516
|
+
path: string;
|
|
2517
|
+
/** The access group the old file record had, or null when there was none. */
|
|
2518
|
+
access_group: string | number | null;
|
|
2519
|
+
removed: number;
|
|
2520
|
+
missing: number;
|
|
2521
|
+
failed: number;
|
|
2522
|
+
decorations: number;
|
|
2523
|
+
ambiguous: number;
|
|
2524
|
+
ms?: number;
|
|
2525
|
+
};
|
|
2526
|
+
/**
|
|
2527
|
+
* Clear a file's index on the SERVER before a Reindex or an Overwrite (owner,
|
|
2528
|
+
* 2026-11-20): the MCP's /internal/index-reset removes the file record (and, through its
|
|
2529
|
+
* cascade, everything referencing it), the agent's decorated per-window ids and the
|
|
2530
|
+
* done::/run:: markers, in parallel, as the signed-in user. Reached through the host's
|
|
2531
|
+
* forwardRequest with "$ACCESS_TOKEN", which skapi fills in with the caller's own token,
|
|
2532
|
+
* so no client code ever holds it.
|
|
2533
|
+
*
|
|
2534
|
+
* Resolves to the server's answer, or null when the call could not be made or answered
|
|
2535
|
+
* something else (an older MCP without the route, a timeout): the caller then clears
|
|
2536
|
+
* the index itself, as it always did. Never rejects.
|
|
2537
|
+
*/
|
|
2538
|
+
declare function resetFileIndexOnServer(args: {
|
|
2539
|
+
service: string;
|
|
2540
|
+
owner?: string;
|
|
2541
|
+
storagePath: string;
|
|
2542
|
+
}): Promise<IndexResetResult | null>;
|
|
2492
2543
|
declare function indexDoneUniqueId(storagePath: string): string;
|
|
2493
2544
|
/**
|
|
2494
2545
|
* unique_id of the per-file indexing RUN record.
|
|
@@ -2570,6 +2621,15 @@ type BgTaskEntry = {
|
|
|
2570
2621
|
* once everything finishes. Absent for work with no chat turn behind it (the dbfile
|
|
2571
2622
|
* page, an attachment-only send, a worker-adopted pass), which appends as before. */
|
|
2572
2623
|
stageId?: string;
|
|
2624
|
+
/** Settled from the 10-second queue check instead of its own poll (owner, 2026-11-20).
|
|
2625
|
+
* Set by drainBgTaskQueue on every pass when the host has csrHistoryItemLookup, and on
|
|
2626
|
+
* adoption for the worker's lanes. Polls on one queue run one at a time in skapi-js, so
|
|
2627
|
+
* a pass that finished waited behind every pass ahead of it; see
|
|
2628
|
+
* ChatSession._settleByListing. */
|
|
2629
|
+
byListing?: boolean;
|
|
2630
|
+
/** When this client first tracked the pass (ms). A pass missing from a listing taken
|
|
2631
|
+
* BEFORE that proves nothing about it. */
|
|
2632
|
+
adoptedAt?: number;
|
|
2573
2633
|
};
|
|
2574
2634
|
declare const INDEXING_COMPLETE_MARKER = "INDEXING_COMPLETE";
|
|
2575
2635
|
declare const EMPTY_INDEXING_REPLY = "Finished reading this file.";
|
|
@@ -2868,6 +2928,29 @@ interface ChatState {
|
|
|
2868
2928
|
historyStartKeyHistory: string[];
|
|
2869
2929
|
historyRequestToken: number;
|
|
2870
2930
|
gateRefreshToken: number;
|
|
2931
|
+
/** Saved pages of each document being indexed, by storage path (owner, 2026-11-20):
|
|
2932
|
+
* `saved` of `total` pages, read from the MCP's prog::<path> record by the 10-second
|
|
2933
|
+
* queue check (config readIndexProgress). Only files with passes still tracked are
|
|
2934
|
+
* refreshed; a row shows it while the file is indexing. */
|
|
2935
|
+
indexPageProgress?: {
|
|
2936
|
+
[storagePath: string]: {
|
|
2937
|
+
saved: number;
|
|
2938
|
+
total: number | null;
|
|
2939
|
+
at: number;
|
|
2940
|
+
};
|
|
2941
|
+
};
|
|
2942
|
+
/** Per-file paging of a run's passes loaded on demand (ChatSession.loadRunPasses), by
|
|
2943
|
+
* storage path: every pass id the file has (newest first), how many are on screen,
|
|
2944
|
+
* whether a load is in flight, and whether the oldest one is loaded. */
|
|
2945
|
+
passPaging?: {
|
|
2946
|
+
[storagePath: string]: {
|
|
2947
|
+
ids: string[];
|
|
2948
|
+
loaded: number;
|
|
2949
|
+
loading: boolean;
|
|
2950
|
+
done: boolean;
|
|
2951
|
+
error?: string;
|
|
2952
|
+
};
|
|
2953
|
+
};
|
|
2871
2954
|
/** Files the SERVER still has unresolved indexing work for, by the key a
|
|
2872
2955
|
* collapsed row uses (storage path, else filename). Lives on the state rather
|
|
2873
2956
|
* than privately so a reactive consumer re-renders when it changes. */
|
|
@@ -2878,6 +2961,11 @@ interface ChatState {
|
|
|
2878
2961
|
* means "we have not found out", which the display layer reads as still
|
|
2879
2962
|
* working — never as an all-clear. */
|
|
2880
2963
|
liveIndexChecked: boolean;
|
|
2964
|
+
/** The files of liveIndexKeys that have a pass RUNNING, same keys. A live file missing
|
|
2965
|
+
* here only has passes waiting: its row says "Queued". */
|
|
2966
|
+
liveIndexRunning?: {
|
|
2967
|
+
[fileKey: string]: boolean;
|
|
2968
|
+
};
|
|
2881
2969
|
/** Server item ids of the indexing passes that existed — on the row, or on the
|
|
2882
2970
|
* bg queue — when the user STOPPED that file. Two readers, one fact:
|
|
2883
2971
|
* buildChatDisplayList reports the run as stopped when it holds any of them
|
|
@@ -2966,7 +3054,19 @@ interface ChatHost {
|
|
|
2966
3054
|
name?: string;
|
|
2967
3055
|
mime?: string;
|
|
2968
3056
|
size?: number;
|
|
2969
|
-
}): Promise<any>;
|
|
3057
|
+
}, accessGroup?: 'public' | 'authorized' | 'private'): Promise<any>;
|
|
3058
|
+
/**
|
|
3059
|
+
* The access group a file's EXISTING "src::" record is at, or null when it has
|
|
3060
|
+
* none (never indexed). Read by the engine BEFORE it deletes that record for a
|
|
3061
|
+
* re-index or an overwrite: re-indexing a file is not a decision about who may
|
|
3062
|
+
* read it, so the file keeps its group, and it is then passed to
|
|
3063
|
+
* ensureFileIndexRecord as `accessGroup` and used for the indexing prompt
|
|
3064
|
+
* instead of asking uploadAccessGroup (which may prompt again, or apply a
|
|
3065
|
+
* changed project default and declassify a private file). Optional; a host
|
|
3066
|
+
* without it re-decides the group as before. Should reject (not answer null)
|
|
3067
|
+
* when the record could not be read, so a read failure never re-classifies.
|
|
3068
|
+
*/
|
|
3069
|
+
readFileAccessGroup?(storagePath: string): Promise<'public' | 'authorized' | 'private' | null>;
|
|
2970
3070
|
/**
|
|
2971
3071
|
* The access group this file's records must be written at: the uploader's
|
|
2972
3072
|
* choice, which is the project default or a per-upload answer.
|
|
@@ -3121,6 +3221,14 @@ declare function getSplitChatHistory(params: {
|
|
|
3121
3221
|
* are non-confidential by construction.
|
|
3122
3222
|
*/
|
|
3123
3223
|
scopeSurfaceToQueue?: boolean;
|
|
3224
|
+
/**
|
|
3225
|
+
* CHATS ONLY (owner, 2026-11-21): fetch the conversation and NOT the background
|
|
3226
|
+
* indexing queue. A file's indexing passes are listed from its own pass records when
|
|
3227
|
+
* its row is opened (ChatSession.loadRunPasses), and its row comes from the run::
|
|
3228
|
+
* record, so the history pager never walks the indexing queue: reaching the first
|
|
3229
|
+
* chat message is the end of history.
|
|
3230
|
+
*/
|
|
3231
|
+
skipBg?: boolean;
|
|
3124
3232
|
}, fetchOptions: Record<string, any>,
|
|
3125
3233
|
/** Test seam: replaces getChatHistory. Not for production callers. */
|
|
3126
3234
|
_fetchImpl?: typeof getChatHistory): Promise<SplitHistoryResult>;
|
|
@@ -3700,6 +3808,8 @@ type IndexingGroup = {
|
|
|
3700
3808
|
stub?: boolean;
|
|
3701
3809
|
/** The run:: record's stored error text, for a stub row's meta line. */
|
|
3702
3810
|
stubError?: string;
|
|
3811
|
+
/** A run:: row that is live with no pass running yet: waiting in the queue. */
|
|
3812
|
+
queued?: boolean;
|
|
3703
3813
|
};
|
|
3704
3814
|
type DisplayEntry = {
|
|
3705
3815
|
kind: 'message';
|
|
@@ -3730,6 +3840,12 @@ type BuildDisplayListOptions = {
|
|
|
3730
3840
|
/** Whether `liveIndexKeys` has been answered at least once for this chat. False
|
|
3731
3841
|
* is "we do not know", and a worker-driven run stays unfinished on it. */
|
|
3732
3842
|
liveIndexChecked?: boolean;
|
|
3843
|
+
/** Files of liveIndexKeys with a pass RUNNING (same keys). A live run:: row whose file
|
|
3844
|
+
* is missing here has only waiting passes and is marked `queued`. Absent: unknown, and
|
|
3845
|
+
* no row is marked. */
|
|
3846
|
+
liveIndexRunningKeys?: {
|
|
3847
|
+
[fileKey: string]: boolean;
|
|
3848
|
+
};
|
|
3733
3849
|
/** Files carrying the durable done:: completion marker (one prefix sweep),
|
|
3734
3850
|
* keyed like IndexingGroup.key (storage path; the bare-name fallback keys
|
|
3735
3851
|
* of very old prompts simply never match — they keep the queue inference).
|
|
@@ -4079,6 +4195,9 @@ declare class ChatSession {
|
|
|
4079
4195
|
[fileKey: string]: boolean;
|
|
4080
4196
|
};
|
|
4081
4197
|
checked: boolean;
|
|
4198
|
+
running: {
|
|
4199
|
+
[fileKey: string]: boolean;
|
|
4200
|
+
};
|
|
4082
4201
|
};
|
|
4083
4202
|
/** Passes that were on a row when the user stopped it, so the display layer can
|
|
4084
4203
|
* still tell that this run was stopped once the stop has left no other trace.
|
|
@@ -4148,6 +4267,22 @@ declare class ChatSession {
|
|
|
4148
4267
|
claimIndexRun(storagePath?: string): Promise<boolean>;
|
|
4149
4268
|
/** Give the slot back — the dispatch failed, or was abandoned. */
|
|
4150
4269
|
releaseIndexRun(storagePath?: string): void;
|
|
4270
|
+
/**
|
|
4271
|
+
* Index files that are ALREADY STORED again, without uploading anything: the
|
|
4272
|
+
* Reindex answer of the "already uploaded" report, offered for the members a send
|
|
4273
|
+
* skipped as duplicates (att.duplicates, see uploadSingleAttachment). The same
|
|
4274
|
+
* steps the Files page's Reindex takes: claim the file (one already being indexed
|
|
4275
|
+
* is left alone), keep its access group (host.readFileAccessGroup, read before the
|
|
4276
|
+
* delete), clear the old index, re-create the file record, queue the first pass.
|
|
4277
|
+
* Each file appears in the chat as a "Reindexing" row. Never rejects; resolves to
|
|
4278
|
+
* the number of files queued.
|
|
4279
|
+
*/
|
|
4280
|
+
reindexStoredFiles(list: Array<{
|
|
4281
|
+
storagePath: string;
|
|
4282
|
+
name?: string;
|
|
4283
|
+
size?: number;
|
|
4284
|
+
mime?: string;
|
|
4285
|
+
}>): Promise<number>;
|
|
4151
4286
|
/**
|
|
4152
4287
|
* The same question, asked of the SERVER when this page cannot answer it.
|
|
4153
4288
|
*
|
|
@@ -4599,6 +4734,15 @@ declare class ChatSession {
|
|
|
4599
4734
|
* the results of anything still in flight across the pause.
|
|
4600
4735
|
*/
|
|
4601
4736
|
resumePolling(reason: string): Promise<void>;
|
|
4737
|
+
/**
|
|
4738
|
+
* Does the chat on screen need its first history page fetched again to stay right?
|
|
4739
|
+
* Only when a waiting bubble of THIS chat has nothing that will settle it: no live poll
|
|
4740
|
+
* and no entry in bgTaskQueue (whose passes the drain and the queue check follow). Then
|
|
4741
|
+
* the page is the only place its poll handle or its answer can come from (a turn on the
|
|
4742
|
+
* background queue whose poll paused while the tab was hidden, for instance). A bubble
|
|
4743
|
+
* with no server id yet is a send still in flight, which resolves on its own.
|
|
4744
|
+
*/
|
|
4745
|
+
needsHistoryRefetch(): boolean;
|
|
4602
4746
|
private _newLocalId;
|
|
4603
4747
|
/**
|
|
4604
4748
|
* The key every per-chat cache hangs off: the restored message cache, the
|
|
@@ -5044,6 +5188,119 @@ declare class ChatSession {
|
|
|
5044
5188
|
* shape that previously looped fetchHistoryPage after an already-DONE index.
|
|
5045
5189
|
*/
|
|
5046
5190
|
private _adoptingWorkerPasses;
|
|
5191
|
+
/** Per project: when a look last CONFIRMED the bg queue held nothing pending or running
|
|
5192
|
+
* (2026-11-20). A recent pass older than this is a finished run, not evidence of live
|
|
5193
|
+
* work, so a tab return no longer re-asks for ten minutes after every run. Memory only:
|
|
5194
|
+
* a reload starts without it and asks once, as before. */
|
|
5195
|
+
private _idleVerdictAt;
|
|
5196
|
+
private _adoptTickTimer;
|
|
5197
|
+
/** Newest wall-clock `_ts` of any indexing pass on screen, or 0. */
|
|
5198
|
+
private _newestIndexPassTs;
|
|
5199
|
+
/** Live indexing work THIS page is tracking for the project: a queued or adopted pass,
|
|
5200
|
+
* an attached bg poll, or a live key a look recorded. No recency guess. */
|
|
5201
|
+
private _hasLocalLiveIndexWork;
|
|
5202
|
+
/** Start the ADOPT_TICK_MS follow-up if this page is tracking live indexing work and
|
|
5203
|
+
* is visible. Idempotent; each tick re-checks and stops when the work is gone, the tab
|
|
5204
|
+
* is hidden (resume restarts it through refreshLiveIndexState) or the view closed. */
|
|
5205
|
+
private _ensureAdoptTick;
|
|
5206
|
+
/** The last COMPLETE running+pending look at this user's bg queue: which pass ids were
|
|
5207
|
+
* live. Complete means both lists came back shorter than their limit, so a tracked pass
|
|
5208
|
+
* missing from it really has left the queue. */
|
|
5209
|
+
private _lastLiveLook;
|
|
5210
|
+
/** By-listing passes whose by-id lookup is in flight, so one tick never reads a pass twice. */
|
|
5211
|
+
private _listingSettling;
|
|
5212
|
+
private _listingLookInflight;
|
|
5213
|
+
/**
|
|
5214
|
+
* Follow an indexing pass found in a loaded history page through the queue check
|
|
5215
|
+
* instead of polling it (owner, 2026-11-20): polls on one queue run one at a time in
|
|
5216
|
+
* skapi-js, so after a reload mid-run every lane waited behind the first. Only for a
|
|
5217
|
+
* pass the worker drives (a client-driven chain is resumed off its dispatching entry,
|
|
5218
|
+
* whose pass count caps it) and only when the host can read a row by id. True when the
|
|
5219
|
+
* pass is now tracked (the caller then attaches no poll).
|
|
5220
|
+
*/
|
|
5221
|
+
trackHistoryIndexPass(item: any): boolean;
|
|
5222
|
+
/**
|
|
5223
|
+
* Show a pass as RUNNING once the queue says it is. A pass this client sent starts out
|
|
5224
|
+
* waiting (the server queues it), and its own poll's running tick used to be what
|
|
5225
|
+
* moved it on. Settled from the listing, it has no poll, so the running listing the
|
|
5226
|
+
* 10-second check already takes does it instead (owner, 2026-11-20).
|
|
5227
|
+
*/
|
|
5228
|
+
private _promoteListedRunning;
|
|
5229
|
+
/** promoteNextBgQueuedToRunning for one named pass: its waiting request bubble becomes
|
|
5230
|
+
* the running one, with a "Thinking..." placeholder under it. False when that pass has
|
|
5231
|
+
* no waiting bubble (already running, settled, or not on screen). */
|
|
5232
|
+
private _promoteBgItemToRunning;
|
|
5233
|
+
/** Turns whose findings were already looked at (a turn can settle by more than one path). */
|
|
5234
|
+
private _findingsDone;
|
|
5235
|
+
/**
|
|
5236
|
+
* Save where a hard search found its answer (findings.ts), through the host's
|
|
5237
|
+
* saveSearchFinding hook. Never for an indexing pass, never twice for one turn, never
|
|
5238
|
+
* throws, never waited on.
|
|
5239
|
+
*/
|
|
5240
|
+
private _saveFindings;
|
|
5241
|
+
/**
|
|
5242
|
+
* Chats-only history (owner, 2026-11-21): on when the host can list a file's passes
|
|
5243
|
+
* (listIndexPasses) and read one by id (csrHistoryItemLookup). The history fetch then
|
|
5244
|
+
* skips the indexing queue, a file's row comes from its run:: record, and opening the
|
|
5245
|
+
* row loads its passes (loadRunPasses), a page at a time.
|
|
5246
|
+
*/
|
|
5247
|
+
lazyIndexRowsEnabled(): boolean;
|
|
5248
|
+
/** How many passes one "Load more" brings into a file's row. */
|
|
5249
|
+
static RUN_PASS_PAGE: number;
|
|
5250
|
+
/** The paging state of a file's passes, or null before its row was first opened. */
|
|
5251
|
+
runPassPaging(storagePath?: string): {
|
|
5252
|
+
ids: string[];
|
|
5253
|
+
loaded: number;
|
|
5254
|
+
loading: boolean;
|
|
5255
|
+
done: boolean;
|
|
5256
|
+
error?: string;
|
|
5257
|
+
} | null;
|
|
5258
|
+
/**
|
|
5259
|
+
* Load the next page of a file's indexing passes into the chat, newest first (owner,
|
|
5260
|
+
* 2026-11-21). The ids come from the file's pass records (listIndexPasses, once), each
|
|
5261
|
+
* pass is read by id (csrHistoryItemLookup) and lands as the same request + reply bubbles
|
|
5262
|
+
* a live pass produces, so its file's row groups it like any other. A pass still running
|
|
5263
|
+
* or waiting is left to the live queue check, which shows it as it settles; one already
|
|
5264
|
+
* in the chat is not read again. Never throws.
|
|
5265
|
+
*/
|
|
5266
|
+
loadRunPasses(storagePath: string, fileName?: string): Promise<void>;
|
|
5267
|
+
/** Insert bubbles before the first message that is newer than them (by `_ts`); messages
|
|
5268
|
+
* without a time are skipped over, and the end of the list takes them otherwise. */
|
|
5269
|
+
private _insertByTime;
|
|
5270
|
+
private _progressInflight;
|
|
5271
|
+
/**
|
|
5272
|
+
* Refresh the page progress ("175 of 530 pages") of the documents this page is still
|
|
5273
|
+
* tracking passes for, one read per file (config readIndexProgress, the MCP's
|
|
5274
|
+
* prog::<path> record). Runs on the ADOPT_TICK_MS check; a file with nothing tracked is
|
|
5275
|
+
* not asked about. Never throws.
|
|
5276
|
+
*/
|
|
5277
|
+
private _refreshPageProgress;
|
|
5278
|
+
/** The page progress to show for a file's row, or null (see _refreshPageProgress). */
|
|
5279
|
+
pageProgressFor(storagePath?: string): {
|
|
5280
|
+
saved: number;
|
|
5281
|
+
total: number | null;
|
|
5282
|
+
} | null;
|
|
5283
|
+
private _noteLiveLook;
|
|
5284
|
+
/**
|
|
5285
|
+
* Settle indexing passes from the queue instead of from their own polls (owner,
|
|
5286
|
+
* 2026-11-20): the worker's lanes AND the first passes this client sent. Runs on the
|
|
5287
|
+
* ADOPT_TICK_MS check, beside the adoption look.
|
|
5288
|
+
*
|
|
5289
|
+
* WHY. skapi-js runs every poll on one queue one at a time, each until its request
|
|
5290
|
+
* finishes. The worker runs a document's windows in parallel lanes on that one queue, so
|
|
5291
|
+
* a lane that finished waited behind every pass ahead of it (measured: passes done at
|
|
5292
|
+
* 17:04 shown at 17:06-17:07, one every ~5 s, after a 3-minute first pass).
|
|
5293
|
+
*
|
|
5294
|
+
* HOW. One compact listing each of the queue's `resolved` and `failed` rows (stubs, no
|
|
5295
|
+
* bodies). A tracked pass found there, or one missing from a COMPLETE running+pending look
|
|
5296
|
+
* taken after it was adopted (cancelled, removed), is read ONCE by id through the host's
|
|
5297
|
+
* csrHistoryItemLookup, the same row a poll's last read returns, and settled through
|
|
5298
|
+
* _settleBgOutcome exactly as its poll would have been. A lookup that still says
|
|
5299
|
+
* running/pending (the status index lags the table) leaves the pass for the next tick.
|
|
5300
|
+
*/
|
|
5301
|
+
private _settleByListing;
|
|
5302
|
+
/** One by-id read of a by-listing pass, then the shared settle. */
|
|
5303
|
+
private _settleListedEntry;
|
|
5047
5304
|
private _adoptWorkerIndexingPasses;
|
|
5048
5305
|
/** Anything at all suggesting THIS project's indexing may be live: a queued
|
|
5049
5306
|
* local entry, a recorded live key (the adopt look just wrote them), or an
|
|
@@ -5060,6 +5317,14 @@ declare class ChatSession {
|
|
|
5060
5317
|
* cancelQueuedMessage, which drives one, has nothing to act on). */
|
|
5061
5318
|
private _cancelServerItem;
|
|
5062
5319
|
drainBgTaskQueue(): void;
|
|
5320
|
+
/**
|
|
5321
|
+
* Settle one background pass from the outcome of reading it: its poll (drainBgTaskQueue)
|
|
5322
|
+
* or a single by-id lookup made by the 10-second queue check (_settleByListing). Both
|
|
5323
|
+
* read the same row the same way, so they share this one path: the resolution, the
|
|
5324
|
+
* resume/chain follow-up, the failure bubble and run record, and the queue entry's removal.
|
|
5325
|
+
* A stopped poll (isPollStopped) leaves the bubble and the entry as they were.
|
|
5326
|
+
*/
|
|
5327
|
+
private _settleBgOutcome;
|
|
5063
5328
|
/** Fire the consumer's done::-marker hook for a run whose completion this
|
|
5064
5329
|
* client knows DETERMINISTICALLY (see the two call sites in
|
|
5065
5330
|
* maybeResumeIndexing). Best-effort by contract; identity-checked so a
|
|
@@ -5356,4 +5621,4 @@ declare function patchProjectSettings(service: string, patch: ProjectSettingsDat
|
|
|
5356
5621
|
*/
|
|
5357
5622
|
declare function clearProjectSettings(service?: string): void;
|
|
5358
5623
|
|
|
5359
|
-
export { type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, 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, 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 Citation, type CitationLinkPart, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DATA_TOOL_NAMES, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_SKIP_DUPLICATE_FILES, DEFAULT_UPLOAD_ACCESS_GROUP, DEFAULT_WEB_ACCESS, DUPLICATE_LOOKUP_MAX_CANDIDATES, 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 ImagePreviewContext, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, type LiveStreamUpdate, 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, NO_DATA_TOOL_MARK, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, 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, RENDER_FROM_TOKEN, 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, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, type UploadAccessGroup, type VisionProfile, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, answerUsedNoDataTool, applyEncodingDeclaration, applyRetrievalNotes, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, citationFileName, citationLinkPart, citationsFor, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, 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, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isRetrievalNote, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, 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, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectSkipDuplicateFiles, projectUploadAccessGroup, projectWebAccess, providerBodyWasRead, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, resolveSkipDuplicateFiles, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, skipDuplicateFilesEnabled, skipDuplicateFilesFrom, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
|
|
5624
|
+
export { type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, 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, 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 Citation, type CitationLinkPart, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DATA_TOOL_NAMES, 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, 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, FINDINGS_TABLE, FINDING_ID_PREFIX, 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 ImagePreviewContext, type IndexResetResult, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, type LiveStreamUpdate, 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, NO_DATA_TOOL_MARK, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, 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, RENDER_FROM_TOKEN, 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, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SearchFinding, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StoredCopyIndexing, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, type UploadAccessGroup, type VisionProfile, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, answerUsedNoDataTool, applyEncodingDeclaration, applyRetrievalNotes, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, citationFileName, citationLinkPart, citationsFor, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, extractRetrievalNote, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, findDuplicateUpload, keyWords as findingKeyWords, findingsForTurn, 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, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isRetrievalNote, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, 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, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectSkipDuplicateFiles, projectUploadAccessGroup, projectWebAccess, providerBodyWasRead, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resetFileIndexOnServer, resolveImagePreviewUrl, resolveSkipDuplicateFiles, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, skipDuplicateFilesEnabled, skipDuplicateFilesFrom, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
|