bunnyquery 1.13.0 → 1.14.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 +4 -2
- package/bunnyquery.css +31 -0
- package/bunnyquery.js +567 -144
- package/dist/engine.cjs +566 -154
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +295 -2
- package/dist/engine.d.ts +295 -2
- package/dist/engine.mjs +542 -155
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/budget.ts +43 -1
- package/src/engine/citations.ts +181 -0
- package/src/engine/config.ts +44 -0
- package/src/engine/history.ts +9 -0
- package/src/engine/host.ts +7 -0
- package/src/engine/index.ts +17 -0
- package/src/engine/project_settings.ts +40 -0
- package/src/engine/prompts/chat_system_prompt.ts +27 -1
- package/src/engine/requests.ts +64 -35
- package/src/engine/retrieval_memory.ts +348 -0
- package/src/engine/session.ts +33 -4
- package/styles/chat.css +31 -0
package/dist/engine.d.mts
CHANGED
|
@@ -286,6 +286,23 @@ interface ChatEngineConfig {
|
|
|
286
286
|
* unless the embedder turns it on.
|
|
287
287
|
*/
|
|
288
288
|
liveStreamingRealtime?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Whether a CHAT answer may reach the open web: Claude's `web_fetch` and
|
|
291
|
+
* OpenAI's `web_search` are attached to a chat request only when this
|
|
292
|
+
* resolves to true.
|
|
293
|
+
*
|
|
294
|
+
* OPTIONAL, AND UNSET IS NOT FALSE. When the host leaves it out, the engine
|
|
295
|
+
* reads the project's own setting (`web_access` in the `bq::settings`
|
|
296
|
+
* record, see project_settings.ts) and falls back to OFF, so the project
|
|
297
|
+
* owner's switch on the Project Settings page decides for every client that
|
|
298
|
+
* does not override it. A host that sets a boolean here overrides the
|
|
299
|
+
* project for its own page, both ways. Resolution: this option, then the
|
|
300
|
+
* project setting, then false.
|
|
301
|
+
*
|
|
302
|
+
* Chat turns only. An indexing pass keeps the tools it has today, since the
|
|
303
|
+
* worker hands it rendered pages and extracted text and not a URL to fetch.
|
|
304
|
+
*/
|
|
305
|
+
webAccess?: boolean;
|
|
289
306
|
/**
|
|
290
307
|
* skapi.forwardRequestFinalize, bound to the consumer's skapi instance.
|
|
291
308
|
* Stores the version of a streamed turn that history should keep (the engine
|
|
@@ -381,6 +398,21 @@ interface ChatEngineConfig {
|
|
|
381
398
|
}
|
|
382
399
|
declare function configureChatEngine(config: ChatEngineConfig): void;
|
|
383
400
|
declare function chatEngineConfig(): ChatEngineConfig;
|
|
401
|
+
/**
|
|
402
|
+
* The web switch for a chat turn, SYNCHRONOUSLY: the host's `webAccess` option
|
|
403
|
+
* when it is a boolean, else the project's cached `web_access` setting, else
|
|
404
|
+
* false. For a template or a prompt builder, which have nowhere to await. Reads
|
|
405
|
+
* the cache as it stands, so before the settings fetch settles it answers the
|
|
406
|
+
* default; request builders use resolveWebAccess below instead.
|
|
407
|
+
*/
|
|
408
|
+
declare function webAccessEnabled(service?: string): boolean;
|
|
409
|
+
/**
|
|
410
|
+
* The same switch, awaiting the project's settings record when the host did not
|
|
411
|
+
* decide. Never rejects: a failed or impossible read (no reader injected, a
|
|
412
|
+
* signed-out visitor on a require_login project) settles as "unset", which is
|
|
413
|
+
* off. Cheap after the first call per project: the store dedupes and caches.
|
|
414
|
+
*/
|
|
415
|
+
declare function resolveWebAccess(service?: string): Promise<boolean>;
|
|
384
416
|
/**
|
|
385
417
|
* True when a streamed turn whose answer never reached its row can be READ BACK.
|
|
386
418
|
*
|
|
@@ -652,6 +684,15 @@ type ChatSystemPromptParams = {
|
|
|
652
684
|
* ones.
|
|
653
685
|
*/
|
|
654
686
|
indexAccessGroup?: string;
|
|
687
|
+
/**
|
|
688
|
+
* Whether THIS chat may reach the open web. The engine attaches Claude's
|
|
689
|
+
* web_fetch and OpenAI's web_search to a chat request only when the project's
|
|
690
|
+
* web switch is on (the host's `webAccess` option, else the project's
|
|
691
|
+
* `web_access` setting, else off: config.ts webAccessEnabled), and the prompt
|
|
692
|
+
* follows the tool list, so the model is never told to fetch with a tool it
|
|
693
|
+
* does not have. Omitted means off, which is also the engine's default.
|
|
694
|
+
*/
|
|
695
|
+
webAccess?: boolean;
|
|
655
696
|
};
|
|
656
697
|
declare function buildChatSystemPrompt(params: ChatSystemPromptParams): string;
|
|
657
698
|
|
|
@@ -926,6 +967,102 @@ declare function isAuthExpiredError(input: any): boolean;
|
|
|
926
967
|
*/
|
|
927
968
|
declare function isProviderApiKeyError(input: any): boolean;
|
|
928
969
|
|
|
970
|
+
/**
|
|
971
|
+
* Retrieval memory: a compact note of what a chat turn RETRIEVED, kept with the
|
|
972
|
+
* turn so a follow-up question skips discovery.
|
|
973
|
+
*
|
|
974
|
+
* THE PROBLEM. The provider runs the tool loop on its side and history keeps
|
|
975
|
+
* only the answer text (budget.ts), so on "and what does page 3 say?" the model
|
|
976
|
+
* starts from nothing: it looks the file up again, guesses a table and an access
|
|
977
|
+
* group again, and routinely lands somewhere else, which is how an answer flips
|
|
978
|
+
* between two turns about the same document.
|
|
979
|
+
*
|
|
980
|
+
* WHAT THE ENGINE CAN SEE. The provider's final body carries the tool loop:
|
|
981
|
+
* - Anthropic Messages: content[] blocks `mcp_tool_use` (name, input) and
|
|
982
|
+
* `mcp_tool_result` (content), plus `server_tool_use` / `web_*_tool_result`
|
|
983
|
+
* for the built-in web tools;
|
|
984
|
+
* - OpenAI Responses: output[] items `mcp_call` (name, arguments as a JSON
|
|
985
|
+
* string, output as a string) and `web_search_call`.
|
|
986
|
+
* The polling worker stores that body on the row (spilling to S3 past 300 KB,
|
|
987
|
+
* never truncating), and a streamed turn's assembled body keeps the same blocks
|
|
988
|
+
* (sse.ts copies each block's skeleton and its JSON input verbatim), so the
|
|
989
|
+
* same reader works live, after a stream and after a reload. When a body has no
|
|
990
|
+
* tool blocks at all (a host that strips them, a provider shape this does not
|
|
991
|
+
* know), the note falls back to what the ANSWER names: db: file links and src::
|
|
992
|
+
* paths. Nothing is ever invented: an empty note is null, not a guess.
|
|
993
|
+
*
|
|
994
|
+
* WHAT IS KEPT, per turn: files (storage paths), tables, access groups,
|
|
995
|
+
* searchText hits as path + page, the tool names, and whether a web tool ran.
|
|
996
|
+
* Arguments are read by KEY, never by position, and only the keys the
|
|
997
|
+
* BunnyQuery tools use for those four things; a query's filter values, a
|
|
998
|
+
* record's data and a tool result's text are never copied, so the note cannot
|
|
999
|
+
* leak a page of a document into every later turn.
|
|
1000
|
+
*
|
|
1001
|
+
* HOW IT REACHES THE MODEL. buildBoundedChatMessages appends the formatted note
|
|
1002
|
+
* to the LLM copy of the assistant turn it belongs to (never the displayed
|
|
1003
|
+
* bubble), for the newest RETRIEVAL_NOTES_MAX turns and within
|
|
1004
|
+
* RETRIEVAL_NOTES_TOKEN_BUDGET tokens, so the memory is bounded however long
|
|
1005
|
+
* the chat gets. A host that never attaches `_retrieval` sees byte-identical
|
|
1006
|
+
* requests to today.
|
|
1007
|
+
*/
|
|
1008
|
+
type RetrievalHit = {
|
|
1009
|
+
path: string;
|
|
1010
|
+
page: number;
|
|
1011
|
+
};
|
|
1012
|
+
type RetrievalNote = {
|
|
1013
|
+
/** Storage paths (the part after "src::") the turn read, queried or linked. */
|
|
1014
|
+
files: string[];
|
|
1015
|
+
/** Table names the turn queried. */
|
|
1016
|
+
tables: string[];
|
|
1017
|
+
/** Access groups the turn queried at, as written in the call. */
|
|
1018
|
+
accessGroups: string[];
|
|
1019
|
+
/** searchText hits: the page a term was found on, per file. */
|
|
1020
|
+
hits: RetrievalHit[];
|
|
1021
|
+
/** Tool names, in order of first use. */
|
|
1022
|
+
tools: string[];
|
|
1023
|
+
/** A web tool ran in this turn (web_search / web_fetch). */
|
|
1024
|
+
web: boolean;
|
|
1025
|
+
/** 'tools' when read off the body's tool blocks; 'answer' when only the
|
|
1026
|
+
* answer text was available to read. */
|
|
1027
|
+
source: 'tools' | 'answer' | 'body';
|
|
1028
|
+
};
|
|
1029
|
+
/** How many of the newest turns carry their note into the request. */
|
|
1030
|
+
declare const RETRIEVAL_NOTES_MAX = 6;
|
|
1031
|
+
/** Ceiling on the estimated tokens all carried notes may add to one request. */
|
|
1032
|
+
declare const RETRIEVAL_NOTES_TOKEN_BUDGET = 1200;
|
|
1033
|
+
/** Per-list cap inside one note (files, tables, groups, hits, tools). */
|
|
1034
|
+
declare const RETRIEVAL_NOTE_MAX_ITEMS = 8;
|
|
1035
|
+
/** Hard cap on one formatted note. */
|
|
1036
|
+
declare const RETRIEVAL_NOTE_MAX_CHARS = 600;
|
|
1037
|
+
/** The marker a carried note opens with; also what keeps it out of the model's own voice. */
|
|
1038
|
+
declare const RETRIEVAL_NOTE_PREFIX = "[Retrieval note, not shown to the user";
|
|
1039
|
+
/**
|
|
1040
|
+
* What an ANSWER names: db: file links ("[name](db:path)") and src:: ids. The
|
|
1041
|
+
* fallback for a body with no tool blocks, and merged into a tool note too so a
|
|
1042
|
+
* file the model linked but never queried (it knew the path from history) is
|
|
1043
|
+
* still remembered.
|
|
1044
|
+
*/
|
|
1045
|
+
declare function retrievalNoteFromText(text: string | null | undefined): RetrievalNote | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* The note for one assistant turn: the body's tool loop when it has one, else
|
|
1048
|
+
* what the answer names, else null. `answerText` is the extracted answer, read
|
|
1049
|
+
* for file links in both cases.
|
|
1050
|
+
*/
|
|
1051
|
+
declare function extractRetrievalNote(body: any, answerText?: string | null): RetrievalNote | null;
|
|
1052
|
+
/**
|
|
1053
|
+
* True when `body` is a provider response this module can read: an Anthropic
|
|
1054
|
+
* Messages body (`content` array) or an OpenAI Responses body (`output` array).
|
|
1055
|
+
*/
|
|
1056
|
+
declare function providerBodyWasRead(body: any): boolean;
|
|
1057
|
+
/** True when the value is a note this module produced (or an equivalent shape). */
|
|
1058
|
+
declare function isRetrievalNote(value: any): value is RetrievalNote;
|
|
1059
|
+
/**
|
|
1060
|
+
* One line the model reads. Sections are omitted when empty, the whole thing is
|
|
1061
|
+
* capped at RETRIEVAL_NOTE_MAX_CHARS, and it opens with RETRIEVAL_NOTE_PREFIX so
|
|
1062
|
+
* the model can tell it from its own earlier words. Returns '' for an empty note.
|
|
1063
|
+
*/
|
|
1064
|
+
declare function formatRetrievalNote(note: RetrievalNote | null | undefined): string;
|
|
1065
|
+
|
|
929
1066
|
declare var CONTEXT_WINDOW_DEFAULT: Record<string, number>;
|
|
930
1067
|
declare var CONTEXT_WINDOW_BY_MODEL: Record<string, number>;
|
|
931
1068
|
declare var MAX_OUTPUT_BY_MODEL: Record<string, number>;
|
|
@@ -1021,12 +1158,37 @@ type BoundedChatOptions = {
|
|
|
1021
1158
|
platform: string;
|
|
1022
1159
|
model?: string;
|
|
1023
1160
|
systemPrompt: string;
|
|
1161
|
+
/**
|
|
1162
|
+
* The turns, oldest first, the one being sent LAST. An assistant turn may
|
|
1163
|
+
* carry `_retrieval` (see retrieval_memory.ts): the note is appended to that
|
|
1164
|
+
* turn's LLM copy for the newest RETRIEVAL_NOTES_MAX such turns, within
|
|
1165
|
+
* RETRIEVAL_NOTES_TOKEN_BUDGET. Turns without it are sent as they always were.
|
|
1166
|
+
*/
|
|
1024
1167
|
history: Array<{
|
|
1025
1168
|
role: string;
|
|
1026
1169
|
content: string;
|
|
1170
|
+
_retrieval?: RetrievalNote | null;
|
|
1027
1171
|
}>;
|
|
1028
1172
|
/** Used to strip/rewrite expired attachment links in older user turns. */
|
|
1029
1173
|
projectId: string;
|
|
1174
|
+
/** Set false to leave every `_retrieval` note out of the request. Default on. */
|
|
1175
|
+
retrievalNotes?: boolean;
|
|
1176
|
+
};
|
|
1177
|
+
/**
|
|
1178
|
+
* Append each carried retrieval note to its assistant turn, newest first, until
|
|
1179
|
+
* RETRIEVAL_NOTES_MAX notes or RETRIEVAL_NOTES_TOKEN_BUDGET estimated tokens are
|
|
1180
|
+
* used. Returns new message objects for the turns it changed and the originals
|
|
1181
|
+
* for the rest; the turn at `latestIndex` (the one being sent) is never touched.
|
|
1182
|
+
* Pure, and exported so the bound can be tested without a session.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function applyRetrievalNotes<T extends {
|
|
1185
|
+
role: string;
|
|
1186
|
+
content: string;
|
|
1187
|
+
_retrieval?: RetrievalNote | null;
|
|
1188
|
+
}>(messages: T[], latestIndex: number): {
|
|
1189
|
+
messages: T[];
|
|
1190
|
+
notesUsed: number;
|
|
1191
|
+
noteTokens: number;
|
|
1030
1192
|
};
|
|
1031
1193
|
declare function buildBoundedChatMessages(options: BoundedChatOptions): {
|
|
1032
1194
|
messages: {
|
|
@@ -1038,6 +1200,95 @@ declare function buildBoundedChatMessages(options: BoundedChatOptions): {
|
|
|
1038
1200
|
estimatedBudget: number;
|
|
1039
1201
|
};
|
|
1040
1202
|
|
|
1203
|
+
/**
|
|
1204
|
+
* Citations and the no-source mark (reliability plan 3.5).
|
|
1205
|
+
*
|
|
1206
|
+
* The retrieval note (retrieval_memory.ts) already records what a turn READ:
|
|
1207
|
+
* the files it queried or linked and the pages searchText found a term on.
|
|
1208
|
+
* This module turns that note into what the two clients DRAW under an answer:
|
|
1209
|
+
*
|
|
1210
|
+
* - a row of file chips, one per cited file (and page, when a page is
|
|
1211
|
+
* known), each opening the file the way every other stored-file chip does
|
|
1212
|
+
* (the `_expired_.url` placeholder that the client's click handler mints a
|
|
1213
|
+
* fresh url for; the page is in the label only, there is no deep link);
|
|
1214
|
+
* - a small mark when the answer used NO data tool at all, so an answer the
|
|
1215
|
+
* model wrote from its own head is visibly different from one it read.
|
|
1216
|
+
*
|
|
1217
|
+
* Pure data in, pure data out: no DOM, nothing reactive. Each client renders the
|
|
1218
|
+
* parts with the same emitter it already uses for inline links, so a citation
|
|
1219
|
+
* chip is byte for byte the chip the model would have written inline, and the
|
|
1220
|
+
* same delegated click handler, the same unavailable state and the same minted
|
|
1221
|
+
* url cache serve it.
|
|
1222
|
+
*/
|
|
1223
|
+
|
|
1224
|
+
interface Citation {
|
|
1225
|
+
/** Storage path, exactly as the note carries it. */
|
|
1226
|
+
path: string;
|
|
1227
|
+
/** 1-based page, when a searchText hit named one. */
|
|
1228
|
+
page?: number;
|
|
1229
|
+
/** What the chip says: the file name (last path segment) plus " p.N" when a page is known. */
|
|
1230
|
+
label: string;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* The tools that READ project data. An answer whose turn called none of these
|
|
1234
|
+
* (and no web tool) was written without looking at anything, which is what the
|
|
1235
|
+
* no-source mark says. Names are the MCP tool names as the body carries them.
|
|
1236
|
+
*/
|
|
1237
|
+
declare var DATA_TOOL_NAMES: string[];
|
|
1238
|
+
/** The mark's text, single-sourced so the two clients cannot word it differently. */
|
|
1239
|
+
declare var NO_DATA_TOOL_MARK: string;
|
|
1240
|
+
/** The file name of a storage path: its last non-empty segment. */
|
|
1241
|
+
declare function citationFileName(path: string): string;
|
|
1242
|
+
/**
|
|
1243
|
+
* The citations of one note, deduplicated and ordered: searchText hits first
|
|
1244
|
+
* (files in the order they were first hit, pages ascending within a file), then
|
|
1245
|
+
* the files the turn read or linked without a page, in the note's order. A file
|
|
1246
|
+
* that has a page hit is not repeated as a page-less chip. Empty for a null note.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function citationsFor(note: RetrievalNote | null | undefined): Citation[];
|
|
1249
|
+
/** True when `name` is one of the data-reading tools. */
|
|
1250
|
+
declare function isDataToolName(name: string): boolean;
|
|
1251
|
+
/**
|
|
1252
|
+
* True when the turn has a note and that note shows no data tool and no web
|
|
1253
|
+
* tool: the answer was written without reading anything. A null note is
|
|
1254
|
+
* UNKNOWN (no body to read, a greeting, an indexing pass), never "no source".
|
|
1255
|
+
*/
|
|
1256
|
+
declare function answerUsedNoDataTool(note: RetrievalNote | null | undefined): boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* The retrieval note of a SETTLED CHAT ANSWER, or null: the one place both
|
|
1259
|
+
* clients decide which bubbles get chips and the mark. Not a user turn, not an
|
|
1260
|
+
* indexing pass (a collapsed row, never a bubble), not an error, not a bubble
|
|
1261
|
+
* still waiting for its answer. The greeting is client chrome with no note.
|
|
1262
|
+
*/
|
|
1263
|
+
declare function retrievalNoteOfAnswer(msg: {
|
|
1264
|
+
role?: string;
|
|
1265
|
+
isError?: boolean;
|
|
1266
|
+
isPending?: boolean;
|
|
1267
|
+
isBackgroundTask?: boolean;
|
|
1268
|
+
_streamPending?: boolean;
|
|
1269
|
+
_retrieval?: RetrievalNote | null;
|
|
1270
|
+
} | null | undefined): RetrievalNote | null;
|
|
1271
|
+
/** The shape both clients' link emitters accept (a RenderableInlineLink with the view's part tag). */
|
|
1272
|
+
interface CitationLinkPart {
|
|
1273
|
+
type: 'link';
|
|
1274
|
+
label: string;
|
|
1275
|
+
fullLabel: string;
|
|
1276
|
+
href: string;
|
|
1277
|
+
expired: boolean;
|
|
1278
|
+
expiredHref: string;
|
|
1279
|
+
remotePath: string;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* One citation as the link part the clients already know how to draw and click:
|
|
1283
|
+
* the `_expired_.url` placeholder for the file's storage path (or the fresh url
|
|
1284
|
+
* the view has cached for it), the storage path as `remotePath` so the click
|
|
1285
|
+
* handler and the unavailable map find it, and NO image, so a cited picture is
|
|
1286
|
+
* a chip under the answer rather than a second preview of it. The display label
|
|
1287
|
+
* is truncated from the front (truncateLabelForDisplay keeps the tail), so the
|
|
1288
|
+
* " p.N" suffix survives a long file name.
|
|
1289
|
+
*/
|
|
1290
|
+
declare function citationLinkPart(citation: Citation, resolveFreshHref?: (expiredHref: string) => string | undefined): CitationLinkPart;
|
|
1291
|
+
|
|
1041
1292
|
/**
|
|
1042
1293
|
* How a text file the chat offers as a download is encoded and labelled, so that
|
|
1043
1294
|
* whatever opens it reads the characters correctly, in any language.
|
|
@@ -2037,11 +2288,17 @@ type CallClaudeWithMcpParams = {
|
|
|
2037
2288
|
fileUrls?: FileUrlDirective[];
|
|
2038
2289
|
onResponse?: (res: any) => void;
|
|
2039
2290
|
onError?: (err: any) => void;
|
|
2291
|
+
/**
|
|
2292
|
+
* Attach Claude's `web_fetch` to this turn. Omitted means "ask the engine":
|
|
2293
|
+
* the host's `webAccess` config option, then the project's `web_access`
|
|
2294
|
+
* setting, then off. See config.ts resolveWebAccess.
|
|
2295
|
+
*/
|
|
2296
|
+
webAccess?: boolean;
|
|
2040
2297
|
};
|
|
2041
2298
|
declare const POLL_INTERVAL = 3000;
|
|
2042
2299
|
declare const STREAM_POLL_INTERVAL = 1000;
|
|
2043
2300
|
declare const MAX_CONCURRENT_BG_POLLS = 6;
|
|
2044
|
-
declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
|
|
2301
|
+
declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, webAccess, }: CallClaudeWithMcpParams): Promise<any>;
|
|
2045
2302
|
declare function callClaudeWithPublicMcp(prompt: string, service: string, owner: string, messages?: ClaudeMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void, mcpScope?: {
|
|
2046
2303
|
anonymous?: boolean;
|
|
2047
2304
|
publicProjectId?: string;
|
|
@@ -2250,6 +2507,7 @@ declare function buildHistoryItemFullId(platform: 'claude' | 'openai', service:
|
|
|
2250
2507
|
* and the skapi cancel/refresh surface. Everything the session needs that would
|
|
2251
2508
|
* otherwise touch the DOM or a framework goes through a host hook.
|
|
2252
2509
|
*/
|
|
2510
|
+
|
|
2253
2511
|
interface ChatIdentity {
|
|
2254
2512
|
projectId: string;
|
|
2255
2513
|
/**
|
|
@@ -2318,6 +2576,11 @@ interface IndexingFileRef {
|
|
|
2318
2576
|
interface ChatMessage {
|
|
2319
2577
|
role: 'user' | 'assistant';
|
|
2320
2578
|
content: string;
|
|
2579
|
+
/** Retrieval memory (retrieval_memory.ts): what this assistant turn read,
|
|
2580
|
+
* queried or linked, taken off the provider body's tool blocks or, failing
|
|
2581
|
+
* that, the answer's file links. Never rendered. buildBoundedChatMessages
|
|
2582
|
+
* appends it to the turn's LLM copy so a follow-up skips discovery. */
|
|
2583
|
+
_retrieval?: RetrievalNote;
|
|
2321
2584
|
isPending?: boolean;
|
|
2322
2585
|
isPendingInProcess?: boolean;
|
|
2323
2586
|
isPendingQueued?: boolean;
|
|
@@ -4758,8 +5021,31 @@ declare const UPLOAD_ACCESS_OPTIONS: {
|
|
|
4758
5021
|
type ProjectSettingsData = {
|
|
4759
5022
|
upload_access_group?: unknown;
|
|
4760
5023
|
chat_greeting?: unknown;
|
|
5024
|
+
web_access?: unknown;
|
|
4761
5025
|
[key: string]: unknown;
|
|
4762
5026
|
};
|
|
5027
|
+
/**
|
|
5028
|
+
* Whether a CHAT answer may reach the open web (Claude `web_fetch`, OpenAI
|
|
5029
|
+
* `web_search`). Same record, its own `web_access` key.
|
|
5030
|
+
*
|
|
5031
|
+
* OFF BY DEFAULT, and the default is the point: customers reported answers that
|
|
5032
|
+
* were not in their data, and an open web tool is one of the ways such an answer
|
|
5033
|
+
* gets out. A project that never opens the setting answers from its files and
|
|
5034
|
+
* database alone. Only the literal `true` turns it on: this record is public and
|
|
5035
|
+
* a client must never read a value it did not write as permission.
|
|
5036
|
+
*
|
|
5037
|
+
* Resolution order, applied by the engine where the chat request is built:
|
|
5038
|
+
* 1. the host's `webAccess` init/config option, when it is a boolean;
|
|
5039
|
+
* 2. this setting, when the project has set it;
|
|
5040
|
+
* 3. off.
|
|
5041
|
+
* Indexing requests are not governed by this: an indexing pass keeps the tools
|
|
5042
|
+
* it has today (see requests.ts notifyAgentSaveAttachment).
|
|
5043
|
+
*/
|
|
5044
|
+
declare const DEFAULT_WEB_ACCESS = false;
|
|
5045
|
+
/** Narrow a stored value to the switch: only `true` is on. */
|
|
5046
|
+
declare function normalizeWebAccess(value: any): boolean;
|
|
5047
|
+
/** The switch held in a settings-record `data`, false when unset. */
|
|
5048
|
+
declare function webAccessFrom(data: ProjectSettingsData | null | undefined): boolean;
|
|
4763
5049
|
/**
|
|
4764
5050
|
* Longest custom opening line the dashboard will store.
|
|
4765
5051
|
*
|
|
@@ -4855,6 +5141,13 @@ declare function projectAsksUploadAccess(service: string): boolean;
|
|
|
4855
5141
|
* the page.
|
|
4856
5142
|
*/
|
|
4857
5143
|
declare function projectChatGreeting(service: string): string;
|
|
5144
|
+
/**
|
|
5145
|
+
* Sync convenience: the project's web-access setting, false until the fetch
|
|
5146
|
+
* settles or when the project never set it. The request builders prefer the
|
|
5147
|
+
* awaiting form (config.ts resolveWebAccess) so the first turn after a page load
|
|
5148
|
+
* reads the stored value rather than the cold-cache default.
|
|
5149
|
+
*/
|
|
5150
|
+
declare function projectWebAccess(service: string): boolean;
|
|
4858
5151
|
/**
|
|
4859
5152
|
* Adopt a value the caller just WROTE, so the settings page reflects its own
|
|
4860
5153
|
* save without a re-fetch.
|
|
@@ -4875,4 +5168,4 @@ declare function patchProjectSettings(service: string, patch: ProjectSettingsDat
|
|
|
4875
5168
|
*/
|
|
4876
5169
|
declare function clearProjectSettings(service?: string): void;
|
|
4877
5170
|
|
|
4878
|
-
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 ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_UPLOAD_ACCESS_GROUP, type DisplayEntry, 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, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, 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, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, 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, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, 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, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
|
|
5171
|
+
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_UPLOAD_ACCESS_GROUP, DEFAULT_WEB_ACCESS, type DisplayEntry, 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, 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, formatChatTimestamp, formatDuration, formatRetrievalNote, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isDataToolName, 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, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, normalizeWebAccess, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, projectWebAccess, providerBodyWasRead, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, resolveWebAccess, retrievalNoteFromText, retrievalNoteOfAnswer, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow, webAccessEnabled, webAccessFrom };
|