bunnyquery 1.9.1 → 1.9.5

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/dist/engine.d.mts CHANGED
@@ -279,6 +279,18 @@ type ChatSystemPromptParams = {
279
279
  * given when the caller says which one this is.
280
280
  */
281
281
  client?: 'console' | 'widget';
282
+ /**
283
+ * The access group THIS project's indexer writes its records at, from the
284
+ * project's `default_access_group` setting.
285
+ *
286
+ * The MCP auto-fills an index/tag query that names a table but no group with
287
+ * "authorized", which used to be right because every BunnyQuery record was
288
+ * hardcoded to it. Now a project can index at "public" (so an anonymous
289
+ * visitor can read it) or "private", and on those projects the auto-fill
290
+ * silently searches a group the data is not in and answers "nothing found".
291
+ * Defaults to 'authorized', which is what an unset project still uses.
292
+ */
293
+ indexAccessGroup?: string;
282
294
  };
283
295
  declare function buildChatSystemPrompt(params: ChatSystemPromptParams): string;
284
296
 
@@ -297,6 +309,13 @@ type IndexingSystemPromptParams = {
297
309
  serviceName?: string;
298
310
  /** Project description. When present, name + description are appended. */
299
311
  serviceDescription?: string;
312
+ /**
313
+ * Access group every record written during this run must carry. Chosen by the
314
+ * uploader (project default, or a per-upload prompt) and already applied to
315
+ * the "src::" file record before indexing starts. Defaults to "authorized",
316
+ * which is what every record written before this setting existed used.
317
+ */
318
+ accessGroup?: 'public' | 'authorized' | 'private';
300
319
  };
301
320
  declare function buildIndexingSystemPrompt(params: IndexingSystemPromptParams): string;
302
321
 
@@ -321,6 +340,18 @@ type IndexingAttachmentInfo = {
321
340
  size?: number;
322
341
  /** Temporary signed URL the agent/MCP fetches to read the file contents. */
323
342
  url: string;
343
+ /**
344
+ * Access group every record extracted from this file must be written at.
345
+ *
346
+ * The uploader chooses it (project default, or a per-upload prompt), and the
347
+ * `src::` file record is already created at this group before indexing starts.
348
+ * The rows, chapters and summaries the agent writes have to MATCH it: skapi's
349
+ * access group is part of a record's table key, so a public file whose rows
350
+ * were saved as "authorized" is a file an anonymous visitor can see the name
351
+ * of and none of the contents of. Omitted means "authorized", which is what
352
+ * every record written before this setting existed used.
353
+ */
354
+ accessGroup?: 'public' | 'authorized' | 'private';
324
355
  };
325
356
  type BuildIndexingUserMessageOptions = {
326
357
  /**
@@ -343,6 +374,13 @@ type BuildIndexingUserMessageOptions = {
343
374
  */
344
375
  pagedRead?: boolean;
345
376
  };
377
+ /**
378
+ * The access group to write this file's records at. One place, so the user
379
+ * message, the continue message and the system prompt cannot disagree.
380
+ */
381
+ declare function indexingAccessGroup(attachment: {
382
+ accessGroup?: string;
383
+ }): 'public' | 'authorized' | 'private';
346
384
  declare function buildIndexingUserMessage(attachment: IndexingAttachmentInfo, options?: BuildIndexingUserMessageOptions): string;
347
385
  /**
348
386
  * Token the WORKER substitutes with the 1-based first page of the window it is about to
@@ -1248,8 +1286,14 @@ type CallClaudeWithMcpParams = {
1248
1286
  declare const POLL_INTERVAL = 3000;
1249
1287
  declare const MAX_CONCURRENT_BG_POLLS = 6;
1250
1288
  declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
1251
- 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): Promise<any>;
1252
- declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
1289
+ 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?: {
1290
+ anonymous?: boolean;
1291
+ publicProjectId?: string;
1292
+ }): Promise<any>;
1293
+ declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void, mcpScope?: {
1294
+ anonymous?: boolean;
1295
+ publicProjectId?: string;
1296
+ }): Promise<any>;
1253
1297
  type AttachmentSaveInfo = {
1254
1298
  platform: 'claude' | 'openai';
1255
1299
  model?: string;
@@ -1276,6 +1320,13 @@ type AttachmentSaveInfo = {
1276
1320
  mime?: string;
1277
1321
  size?: number;
1278
1322
  url: string;
1323
+ /**
1324
+ * Access group this file's records are written at (the uploader's choice,
1325
+ * already applied to the "src::" record). Threaded into the indexing
1326
+ * prompts so the agent's own records land in the same group; omitted
1327
+ * means "authorized", the group everything used before the setting existed.
1328
+ */
1329
+ accessGroup?: 'public' | 'authorized' | 'private';
1279
1330
  };
1280
1331
  /**
1281
1332
  * Content parsed CLIENT-SIDE by an attachment-parser plugin (e.g. an .hwp
@@ -1453,6 +1504,19 @@ interface ChatIdentity {
1453
1504
  owner: string;
1454
1505
  /** Per-user queue name (falls back to projectId). */
1455
1506
  userId: string;
1507
+ /**
1508
+ * This chat is being used by a visitor with NO account, on a project whose
1509
+ * owner allows that.
1510
+ *
1511
+ * It changes where the MCP tools point. A signed-in turn goes to the MCP
1512
+ * server's root endpoint and authenticates with the caller's own token; an
1513
+ * anonymous turn has no token to send, and an EMPTY one is worse than none
1514
+ * (the server cannot identify a project from it, and an empty credential may
1515
+ * be rejected by the provider before the request is even made). So an
1516
+ * anonymous turn goes to the project-scoped endpoint instead, which is
1517
+ * read-only, restricted to public records, and needs no credential at all.
1518
+ */
1519
+ anonymous?: boolean;
1456
1520
  platform: 'claude' | 'openai' | 'none';
1457
1521
  model?: string;
1458
1522
  serviceName?: string;
@@ -1676,6 +1740,22 @@ interface ChatHost {
1676
1740
  mime?: string;
1677
1741
  size?: number;
1678
1742
  }): Promise<any>;
1743
+ /**
1744
+ * The access group this file's records must be written at: the uploader's
1745
+ * choice, which is the project default or a per-upload answer.
1746
+ *
1747
+ * Asked PER FILE, and asked AFTER ensureFileIndexRecord has run, because the
1748
+ * host is what actually creates the "src::" record and it must report the
1749
+ * group it really used. The engine threads the answer into the indexing
1750
+ * prompts so the agent's own records land in the same group; a record saved
1751
+ * under a different group is in a different table and never comes back with
1752
+ * the rest of the file.
1753
+ *
1754
+ * Optional and may return a promise. A host without it (or one that returns
1755
+ * nothing) gets "authorized", which is what every record used before the
1756
+ * setting existed.
1757
+ */
1758
+ uploadAccessGroup?(storagePath: string): 'public' | 'authorized' | 'private' | undefined | Promise<'public' | 'authorized' | 'private' | undefined>;
1679
1759
  /** Map a relative path to the consumer's db storage key (e.g. uid-prefixed). */
1680
1760
  storagePathFor(relPath: string): string;
1681
1761
  getMimeType(name: string): string | null;
@@ -1773,12 +1853,63 @@ declare function getSplitChatHistory(params: {
1773
1853
  owner: string;
1774
1854
  platform: 'claude' | 'openai';
1775
1855
  userId?: string;
1856
+ /**
1857
+ * Scope the SURFACE fetch to this chat's own queue instead of "everything
1858
+ * that is not the bg queue".
1859
+ *
1860
+ * Set for an ANONYMOUS visitor, and only for one. The backend identifies an
1861
+ * unauthenticated caller as `ip + "(" + user_agent + ")"`, and the default
1862
+ * surface fetch (queue_exclude, no queue) is scoped by exactly that string
1863
+ * server side - so two anonymous visitors behind one NAT on the same browser
1864
+ * build read each other's transcript, which is the thing per-device history
1865
+ * exists to prevent. Reading the device's own queue instead scopes it by a
1866
+ * value the client controls and the other device does not share.
1867
+ *
1868
+ * NOT used for a signed-in caller. Their turns are already scoped by their
1869
+ * `sub`, and queue_exact would additionally hide any history sent under a
1870
+ * different queue name than the current userId (an older fallback, a
1871
+ * pre-rename row), which queue_exclude still returns.
1872
+ *
1873
+ * The queue name is unguessable but NOT secret: it travels on every request
1874
+ * and queue listings are not user-scoped server side. Anonymous transcripts
1875
+ * are non-confidential by construction.
1876
+ */
1877
+ scopeSurfaceToQueue?: boolean;
1776
1878
  }, fetchOptions: Record<string, any>,
1777
1879
  /** Test seam: replaces getChatHistory. Not for production callers. */
1778
1880
  _fetchImpl?: typeof getChatHistory): Promise<SplitHistoryResult>;
1881
+ /**
1882
+ * THE chat key. Every cache, every ownership stamp and every "is this turn for
1883
+ * the chat on screen?" comparison is built here and nowhere else.
1884
+ *
1885
+ * It used to be written out by hand in four places. When a third segment was
1886
+ * added for the chat identity - a browser can hold an anonymous conversation and
1887
+ * a signed-in one on the SAME project, and the two must not share a cache - only
1888
+ * one of those four was updated. The rest kept producing the two-segment form,
1889
+ * so `key !== getHistoryCacheKey()` became permanently true: every send was
1890
+ * treated as belonging to another project, the optimistic bubble and the
1891
+ * "Thinking..." placeholder were never pushed, and nothing appeared until the
1892
+ * server history caught up. One function, so a twin cannot drift again.
1893
+ */
1894
+ declare function chatCacheKey(projectId: string | undefined, platform: string | undefined, userId?: string): string;
1895
+ /**
1896
+ * The INDEXING scope key: project + platform, deliberately WITHOUT the identity.
1897
+ *
1898
+ * Claiming, stopping and cancelling a file's indexing are scoped per project and
1899
+ * platform because a storage path is project-relative and one ChatSession serves
1900
+ * every project. They are NOT per user: an anonymous visitor cannot upload or
1901
+ * index at all, so there is no second identity to separate, and folding the
1902
+ * identity in here would only have to be threaded through BgTaskEntry to no end.
1903
+ *
1904
+ * Kept separate from chatCacheKey ON PURPOSE. These two were the same string
1905
+ * once, which is exactly how adding a segment to one silently broke the other.
1906
+ */
1907
+ declare function indexScopeKey(projectId: string | undefined, platform: string | undefined): string;
1779
1908
  type MapHistoryOptions = {
1780
1909
  clearedAt: number;
1781
1910
  projectId: string;
1911
+ /** Chat identity, so the `_ownerKey` stamp matches chatCacheKey(). */
1912
+ userId?: string;
1782
1913
  /** View-side display formatter for "Indexing:/Reindexing: …" bubbles. */
1783
1914
  formatIndexingLabel: (name: string, mime?: string, size?: number | null, storagePath?: string, reindex?: boolean, continued?: boolean) => string;
1784
1915
  };
@@ -2714,6 +2845,19 @@ declare class ChatSession {
2714
2845
  */
2715
2846
  resumePolling(reason: string): Promise<void>;
2716
2847
  private _newLocalId;
2848
+ /**
2849
+ * The key every per-chat cache hangs off: the restored message cache, the
2850
+ * hydrated-body memo, the live-index key and the per-file storage-path key.
2851
+ *
2852
+ * It carries the IDENTITY as well as the project and platform. A single
2853
+ * browser can hold more than one conversation on one project without a
2854
+ * reload — an anonymous visitor who signs in, or a dashboard user who logs
2855
+ * out and back in as someone else — and with an identity-free key the
2856
+ * previous conversation stayed in the cache and was re-rendered, and written
2857
+ * back, as the new one's. `userId` is the same value the request queue is
2858
+ * named after, so two identities that share a queue share a cache, which is
2859
+ * exactly right.
2860
+ */
2717
2861
  getHistoryCacheKey(): string;
2718
2862
  private _hydratedBodies;
2719
2863
  private _hydratingItems;
@@ -3120,4 +3264,4 @@ declare class ChatSession {
3120
3264
  bumpGate(): void;
3121
3265
  }
3122
3266
 
3123
- 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, 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 ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, 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, 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, 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, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, type ScrollAnchor, type ScrollAnchorOptions, TOOL_AND_RESPONSE_BUFFER, type VisionProfile, XML_EXTS, __resetSplitHistoryState, applyEncodingDeclaration, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, shouldRescueInFlightMessage, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, upsertIndexRunRecordSafe, wallClockNow };
3267
+ 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, 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 ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, 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, 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, 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, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, type ScrollAnchor, type ScrollAnchorOptions, TOOL_AND_RESPONSE_BUFFER, type VisionProfile, XML_EXTS, __resetSplitHistoryState, applyEncodingDeclaration, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, shouldRescueInFlightMessage, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, upsertIndexRunRecordSafe, wallClockNow };
package/dist/engine.d.ts CHANGED
@@ -279,6 +279,18 @@ type ChatSystemPromptParams = {
279
279
  * given when the caller says which one this is.
280
280
  */
281
281
  client?: 'console' | 'widget';
282
+ /**
283
+ * The access group THIS project's indexer writes its records at, from the
284
+ * project's `default_access_group` setting.
285
+ *
286
+ * The MCP auto-fills an index/tag query that names a table but no group with
287
+ * "authorized", which used to be right because every BunnyQuery record was
288
+ * hardcoded to it. Now a project can index at "public" (so an anonymous
289
+ * visitor can read it) or "private", and on those projects the auto-fill
290
+ * silently searches a group the data is not in and answers "nothing found".
291
+ * Defaults to 'authorized', which is what an unset project still uses.
292
+ */
293
+ indexAccessGroup?: string;
282
294
  };
283
295
  declare function buildChatSystemPrompt(params: ChatSystemPromptParams): string;
284
296
 
@@ -297,6 +309,13 @@ type IndexingSystemPromptParams = {
297
309
  serviceName?: string;
298
310
  /** Project description. When present, name + description are appended. */
299
311
  serviceDescription?: string;
312
+ /**
313
+ * Access group every record written during this run must carry. Chosen by the
314
+ * uploader (project default, or a per-upload prompt) and already applied to
315
+ * the "src::" file record before indexing starts. Defaults to "authorized",
316
+ * which is what every record written before this setting existed used.
317
+ */
318
+ accessGroup?: 'public' | 'authorized' | 'private';
300
319
  };
301
320
  declare function buildIndexingSystemPrompt(params: IndexingSystemPromptParams): string;
302
321
 
@@ -321,6 +340,18 @@ type IndexingAttachmentInfo = {
321
340
  size?: number;
322
341
  /** Temporary signed URL the agent/MCP fetches to read the file contents. */
323
342
  url: string;
343
+ /**
344
+ * Access group every record extracted from this file must be written at.
345
+ *
346
+ * The uploader chooses it (project default, or a per-upload prompt), and the
347
+ * `src::` file record is already created at this group before indexing starts.
348
+ * The rows, chapters and summaries the agent writes have to MATCH it: skapi's
349
+ * access group is part of a record's table key, so a public file whose rows
350
+ * were saved as "authorized" is a file an anonymous visitor can see the name
351
+ * of and none of the contents of. Omitted means "authorized", which is what
352
+ * every record written before this setting existed used.
353
+ */
354
+ accessGroup?: 'public' | 'authorized' | 'private';
324
355
  };
325
356
  type BuildIndexingUserMessageOptions = {
326
357
  /**
@@ -343,6 +374,13 @@ type BuildIndexingUserMessageOptions = {
343
374
  */
344
375
  pagedRead?: boolean;
345
376
  };
377
+ /**
378
+ * The access group to write this file's records at. One place, so the user
379
+ * message, the continue message and the system prompt cannot disagree.
380
+ */
381
+ declare function indexingAccessGroup(attachment: {
382
+ accessGroup?: string;
383
+ }): 'public' | 'authorized' | 'private';
346
384
  declare function buildIndexingUserMessage(attachment: IndexingAttachmentInfo, options?: BuildIndexingUserMessageOptions): string;
347
385
  /**
348
386
  * Token the WORKER substitutes with the 1-based first page of the window it is about to
@@ -1248,8 +1286,14 @@ type CallClaudeWithMcpParams = {
1248
1286
  declare const POLL_INTERVAL = 3000;
1249
1287
  declare const MAX_CONCURRENT_BG_POLLS = 6;
1250
1288
  declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
1251
- 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): Promise<any>;
1252
- declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
1289
+ 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?: {
1290
+ anonymous?: boolean;
1291
+ publicProjectId?: string;
1292
+ }): Promise<any>;
1293
+ declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void, mcpScope?: {
1294
+ anonymous?: boolean;
1295
+ publicProjectId?: string;
1296
+ }): Promise<any>;
1253
1297
  type AttachmentSaveInfo = {
1254
1298
  platform: 'claude' | 'openai';
1255
1299
  model?: string;
@@ -1276,6 +1320,13 @@ type AttachmentSaveInfo = {
1276
1320
  mime?: string;
1277
1321
  size?: number;
1278
1322
  url: string;
1323
+ /**
1324
+ * Access group this file's records are written at (the uploader's choice,
1325
+ * already applied to the "src::" record). Threaded into the indexing
1326
+ * prompts so the agent's own records land in the same group; omitted
1327
+ * means "authorized", the group everything used before the setting existed.
1328
+ */
1329
+ accessGroup?: 'public' | 'authorized' | 'private';
1279
1330
  };
1280
1331
  /**
1281
1332
  * Content parsed CLIENT-SIDE by an attachment-parser plugin (e.g. an .hwp
@@ -1453,6 +1504,19 @@ interface ChatIdentity {
1453
1504
  owner: string;
1454
1505
  /** Per-user queue name (falls back to projectId). */
1455
1506
  userId: string;
1507
+ /**
1508
+ * This chat is being used by a visitor with NO account, on a project whose
1509
+ * owner allows that.
1510
+ *
1511
+ * It changes where the MCP tools point. A signed-in turn goes to the MCP
1512
+ * server's root endpoint and authenticates with the caller's own token; an
1513
+ * anonymous turn has no token to send, and an EMPTY one is worse than none
1514
+ * (the server cannot identify a project from it, and an empty credential may
1515
+ * be rejected by the provider before the request is even made). So an
1516
+ * anonymous turn goes to the project-scoped endpoint instead, which is
1517
+ * read-only, restricted to public records, and needs no credential at all.
1518
+ */
1519
+ anonymous?: boolean;
1456
1520
  platform: 'claude' | 'openai' | 'none';
1457
1521
  model?: string;
1458
1522
  serviceName?: string;
@@ -1676,6 +1740,22 @@ interface ChatHost {
1676
1740
  mime?: string;
1677
1741
  size?: number;
1678
1742
  }): Promise<any>;
1743
+ /**
1744
+ * The access group this file's records must be written at: the uploader's
1745
+ * choice, which is the project default or a per-upload answer.
1746
+ *
1747
+ * Asked PER FILE, and asked AFTER ensureFileIndexRecord has run, because the
1748
+ * host is what actually creates the "src::" record and it must report the
1749
+ * group it really used. The engine threads the answer into the indexing
1750
+ * prompts so the agent's own records land in the same group; a record saved
1751
+ * under a different group is in a different table and never comes back with
1752
+ * the rest of the file.
1753
+ *
1754
+ * Optional and may return a promise. A host without it (or one that returns
1755
+ * nothing) gets "authorized", which is what every record used before the
1756
+ * setting existed.
1757
+ */
1758
+ uploadAccessGroup?(storagePath: string): 'public' | 'authorized' | 'private' | undefined | Promise<'public' | 'authorized' | 'private' | undefined>;
1679
1759
  /** Map a relative path to the consumer's db storage key (e.g. uid-prefixed). */
1680
1760
  storagePathFor(relPath: string): string;
1681
1761
  getMimeType(name: string): string | null;
@@ -1773,12 +1853,63 @@ declare function getSplitChatHistory(params: {
1773
1853
  owner: string;
1774
1854
  platform: 'claude' | 'openai';
1775
1855
  userId?: string;
1856
+ /**
1857
+ * Scope the SURFACE fetch to this chat's own queue instead of "everything
1858
+ * that is not the bg queue".
1859
+ *
1860
+ * Set for an ANONYMOUS visitor, and only for one. The backend identifies an
1861
+ * unauthenticated caller as `ip + "(" + user_agent + ")"`, and the default
1862
+ * surface fetch (queue_exclude, no queue) is scoped by exactly that string
1863
+ * server side - so two anonymous visitors behind one NAT on the same browser
1864
+ * build read each other's transcript, which is the thing per-device history
1865
+ * exists to prevent. Reading the device's own queue instead scopes it by a
1866
+ * value the client controls and the other device does not share.
1867
+ *
1868
+ * NOT used for a signed-in caller. Their turns are already scoped by their
1869
+ * `sub`, and queue_exact would additionally hide any history sent under a
1870
+ * different queue name than the current userId (an older fallback, a
1871
+ * pre-rename row), which queue_exclude still returns.
1872
+ *
1873
+ * The queue name is unguessable but NOT secret: it travels on every request
1874
+ * and queue listings are not user-scoped server side. Anonymous transcripts
1875
+ * are non-confidential by construction.
1876
+ */
1877
+ scopeSurfaceToQueue?: boolean;
1776
1878
  }, fetchOptions: Record<string, any>,
1777
1879
  /** Test seam: replaces getChatHistory. Not for production callers. */
1778
1880
  _fetchImpl?: typeof getChatHistory): Promise<SplitHistoryResult>;
1881
+ /**
1882
+ * THE chat key. Every cache, every ownership stamp and every "is this turn for
1883
+ * the chat on screen?" comparison is built here and nowhere else.
1884
+ *
1885
+ * It used to be written out by hand in four places. When a third segment was
1886
+ * added for the chat identity - a browser can hold an anonymous conversation and
1887
+ * a signed-in one on the SAME project, and the two must not share a cache - only
1888
+ * one of those four was updated. The rest kept producing the two-segment form,
1889
+ * so `key !== getHistoryCacheKey()` became permanently true: every send was
1890
+ * treated as belonging to another project, the optimistic bubble and the
1891
+ * "Thinking..." placeholder were never pushed, and nothing appeared until the
1892
+ * server history caught up. One function, so a twin cannot drift again.
1893
+ */
1894
+ declare function chatCacheKey(projectId: string | undefined, platform: string | undefined, userId?: string): string;
1895
+ /**
1896
+ * The INDEXING scope key: project + platform, deliberately WITHOUT the identity.
1897
+ *
1898
+ * Claiming, stopping and cancelling a file's indexing are scoped per project and
1899
+ * platform because a storage path is project-relative and one ChatSession serves
1900
+ * every project. They are NOT per user: an anonymous visitor cannot upload or
1901
+ * index at all, so there is no second identity to separate, and folding the
1902
+ * identity in here would only have to be threaded through BgTaskEntry to no end.
1903
+ *
1904
+ * Kept separate from chatCacheKey ON PURPOSE. These two were the same string
1905
+ * once, which is exactly how adding a segment to one silently broke the other.
1906
+ */
1907
+ declare function indexScopeKey(projectId: string | undefined, platform: string | undefined): string;
1779
1908
  type MapHistoryOptions = {
1780
1909
  clearedAt: number;
1781
1910
  projectId: string;
1911
+ /** Chat identity, so the `_ownerKey` stamp matches chatCacheKey(). */
1912
+ userId?: string;
1782
1913
  /** View-side display formatter for "Indexing:/Reindexing: …" bubbles. */
1783
1914
  formatIndexingLabel: (name: string, mime?: string, size?: number | null, storagePath?: string, reindex?: boolean, continued?: boolean) => string;
1784
1915
  };
@@ -2714,6 +2845,19 @@ declare class ChatSession {
2714
2845
  */
2715
2846
  resumePolling(reason: string): Promise<void>;
2716
2847
  private _newLocalId;
2848
+ /**
2849
+ * The key every per-chat cache hangs off: the restored message cache, the
2850
+ * hydrated-body memo, the live-index key and the per-file storage-path key.
2851
+ *
2852
+ * It carries the IDENTITY as well as the project and platform. A single
2853
+ * browser can hold more than one conversation on one project without a
2854
+ * reload — an anonymous visitor who signs in, or a dashboard user who logs
2855
+ * out and back in as someone else — and with an identity-free key the
2856
+ * previous conversation stayed in the cache and was re-rendered, and written
2857
+ * back, as the new one's. `userId` is the same value the request queue is
2858
+ * named after, so two identities that share a queue share a cache, which is
2859
+ * exactly right.
2860
+ */
2717
2861
  getHistoryCacheKey(): string;
2718
2862
  private _hydratedBodies;
2719
2863
  private _hydratingItems;
@@ -3120,4 +3264,4 @@ declare class ChatSession {
3120
3264
  bumpGate(): void;
3121
3265
  }
3122
3266
 
3123
- 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, 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 ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, 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, 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, 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, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, type ScrollAnchor, type ScrollAnchorOptions, TOOL_AND_RESPONSE_BUFFER, type VisionProfile, XML_EXTS, __resetSplitHistoryState, applyEncodingDeclaration, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, shouldRescueInFlightMessage, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, upsertIndexRunRecordSafe, wallClockNow };
3267
+ 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, 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 ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, 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, 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, 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, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, type ScrollAnchor, type ScrollAnchorOptions, TOOL_AND_RESPONSE_BUFFER, type VisionProfile, XML_EXTS, __resetSplitHistoryState, applyEncodingDeclaration, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, shouldRescueInFlightMessage, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, upsertIndexRunRecordSafe, wallClockNow };