bunnyquery 1.9.4 → 1.9.6
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/bunnyquery.js +37 -12
- package/dist/engine.cjs +38 -11
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +52 -1
- package/dist/engine.d.ts +52 -1
- package/dist/engine.mjs +37 -12
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/history.ts +111 -5
- package/src/engine/index.ts +5 -0
- package/src/engine/session.ts +24 -9
package/dist/engine.d.mts
CHANGED
|
@@ -1853,12 +1853,63 @@ declare function getSplitChatHistory(params: {
|
|
|
1853
1853
|
owner: string;
|
|
1854
1854
|
platform: 'claude' | 'openai';
|
|
1855
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;
|
|
1856
1878
|
}, fetchOptions: Record<string, any>,
|
|
1857
1879
|
/** Test seam: replaces getChatHistory. Not for production callers. */
|
|
1858
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;
|
|
1859
1908
|
type MapHistoryOptions = {
|
|
1860
1909
|
clearedAt: number;
|
|
1861
1910
|
projectId: string;
|
|
1911
|
+
/** Chat identity, so the `_ownerKey` stamp matches chatCacheKey(). */
|
|
1912
|
+
userId?: string;
|
|
1862
1913
|
/** View-side display formatter for "Indexing:/Reindexing: …" bubbles. */
|
|
1863
1914
|
formatIndexingLabel: (name: string, mime?: string, size?: number | null, storagePath?: string, reindex?: boolean, continued?: boolean) => string;
|
|
1864
1915
|
};
|
|
@@ -3213,4 +3264,4 @@ declare class ChatSession {
|
|
|
3213
3264
|
bumpGate(): void;
|
|
3214
3265
|
}
|
|
3215
3266
|
|
|
3216
|
-
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, 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 };
|
|
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
|
@@ -1853,12 +1853,63 @@ declare function getSplitChatHistory(params: {
|
|
|
1853
1853
|
owner: string;
|
|
1854
1854
|
platform: 'claude' | 'openai';
|
|
1855
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;
|
|
1856
1878
|
}, fetchOptions: Record<string, any>,
|
|
1857
1879
|
/** Test seam: replaces getChatHistory. Not for production callers. */
|
|
1858
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;
|
|
1859
1908
|
type MapHistoryOptions = {
|
|
1860
1909
|
clearedAt: number;
|
|
1861
1910
|
projectId: string;
|
|
1911
|
+
/** Chat identity, so the `_ownerKey` stamp matches chatCacheKey(). */
|
|
1912
|
+
userId?: string;
|
|
1862
1913
|
/** View-side display formatter for "Indexing:/Reindexing: …" bubbles. */
|
|
1863
1914
|
formatIndexingLabel: (name: string, mime?: string, size?: number | null, storagePath?: string, reindex?: boolean, continued?: boolean) => string;
|
|
1864
1915
|
};
|
|
@@ -3213,4 +3264,4 @@ declare class ChatSession {
|
|
|
3213
3264
|
bumpGate(): void;
|
|
3214
3265
|
}
|
|
3215
3266
|
|
|
3216
|
-
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, 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 };
|
|
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.mjs
CHANGED
|
@@ -2344,6 +2344,7 @@ async function _getSplitChatHistoryLocked(key, params, fetchOptions, releaseLock
|
|
|
2344
2344
|
const fetch = _fetchImpl || getChatHistory;
|
|
2345
2345
|
const bgQueue = bgIndexingQueueName(params.userId, params.service);
|
|
2346
2346
|
const base = { service: params.service, owner: params.owner, platform: params.platform };
|
|
2347
|
+
const surfaceScope = params.scopeSurfaceToQueue && params.userId ? { queue: params.userId, queue_exact: true } : { queue_exclude: bgQueue };
|
|
2347
2348
|
const fetchMore = !!(fetchOptions && fetchOptions.fetchMore);
|
|
2348
2349
|
const limit = fetchOptions && fetchOptions.limit;
|
|
2349
2350
|
const firstLoad = !splitHistoryStates[key];
|
|
@@ -2371,13 +2372,13 @@ async function _getSplitChatHistoryLocked(key, params, fetchOptions, releaseLock
|
|
|
2371
2372
|
} else {
|
|
2372
2373
|
const sOpts = { fetchMore };
|
|
2373
2374
|
if (limit) sOpts.limit = limit;
|
|
2374
|
-
let s = await fetch({ ...base,
|
|
2375
|
+
let s = await fetch({ ...base, ...surfaceScope }, sOpts);
|
|
2375
2376
|
let hops = 0;
|
|
2376
2377
|
while (s && !s.endOfList && !(s.list || []).length && hops < SURFACE_EMPTY_MAX_PAGES) {
|
|
2377
2378
|
hops++;
|
|
2378
2379
|
const nOpts = { fetchMore: true };
|
|
2379
2380
|
if (limit) nOpts.limit = limit;
|
|
2380
|
-
s = await fetch({ ...base,
|
|
2381
|
+
s = await fetch({ ...base, ...surfaceScope }, nOpts);
|
|
2381
2382
|
}
|
|
2382
2383
|
state.pendingSurface = {
|
|
2383
2384
|
list: s && Array.isArray(s.list) ? s.list : [],
|
|
@@ -2510,6 +2511,14 @@ async function _getSplitChatHistoryLocked(key, params, fetchOptions, releaseLock
|
|
|
2510
2511
|
firstLoad
|
|
2511
2512
|
};
|
|
2512
2513
|
}
|
|
2514
|
+
function chatCacheKey(projectId, platform, userId) {
|
|
2515
|
+
if (!projectId || platform === "none") return "";
|
|
2516
|
+
return projectId + "#" + platform + "#" + (userId || "");
|
|
2517
|
+
}
|
|
2518
|
+
function indexScopeKey(projectId, platform) {
|
|
2519
|
+
if (!projectId || platform === "none") return "";
|
|
2520
|
+
return projectId + "#" + platform;
|
|
2521
|
+
}
|
|
2513
2522
|
function mapHistoryListToMessages(list, platform, opts) {
|
|
2514
2523
|
var mapped = [], runningItemIds = [];
|
|
2515
2524
|
var extractAssistantText = platform === "openai" ? extractOpenAIText : extractClaudeText;
|
|
@@ -2596,7 +2605,7 @@ function mapHistoryListToMessages(list, platform, opts) {
|
|
|
2596
2605
|
}
|
|
2597
2606
|
});
|
|
2598
2607
|
if (opts.projectId) {
|
|
2599
|
-
var ownerKey = opts.projectId
|
|
2608
|
+
var ownerKey = chatCacheKey(opts.projectId, platform, opts.userId);
|
|
2600
2609
|
for (var oi = 0; oi < mapped.length; oi++) mapped[oi]._ownerKey = ownerKey;
|
|
2601
2610
|
}
|
|
2602
2611
|
return { messages: mapped, runningItemIds };
|
|
@@ -3123,7 +3132,8 @@ var ChatSession = class {
|
|
|
3123
3132
|
/** Storage paths are project-relative, and one ChatSession serves every
|
|
3124
3133
|
* project, so a claim has to be scoped the way a stop is (_indexKeyOf). */
|
|
3125
3134
|
_indexClaimKey(storagePath) {
|
|
3126
|
-
|
|
3135
|
+
var id = this.host.getIdentity();
|
|
3136
|
+
return indexScopeKey(id.projectId, id.platform) + "|" + storagePath;
|
|
3127
3137
|
}
|
|
3128
3138
|
/**
|
|
3129
3139
|
* Take this file's indexing slot, or report that someone already has it.
|
|
@@ -3565,8 +3575,7 @@ var ChatSession = class {
|
|
|
3565
3575
|
*/
|
|
3566
3576
|
getHistoryCacheKey() {
|
|
3567
3577
|
var id = this.host.getIdentity();
|
|
3568
|
-
|
|
3569
|
-
return id.projectId + "#" + id.platform + "#" + (id.userId || "");
|
|
3578
|
+
return chatCacheKey(id.projectId, id.platform, id.userId);
|
|
3570
3579
|
}
|
|
3571
3580
|
/** Re-apply memoized hydrated texts onto freshly-mapped messages. Both
|
|
3572
3581
|
* clients call this right after their mapper runs (loadHistory does it
|
|
@@ -4116,7 +4125,7 @@ var ChatSession = class {
|
|
|
4116
4125
|
}
|
|
4117
4126
|
if (stageId) delete this._liveStages[stageId];
|
|
4118
4127
|
var llmComposed = composedForLlm || composed;
|
|
4119
|
-
var key =
|
|
4128
|
+
var key = chatCacheKey(id.projectId, id.platform, id.userId);
|
|
4120
4129
|
var offChat = !!key && key !== this.getHistoryCacheKey();
|
|
4121
4130
|
var isQueuedSend = !offChat && (useBgQueue || this.state.sending || this.state.messages.some(function(m) {
|
|
4122
4131
|
return (m.isPending || m.isPendingQueued) && !m.isBackgroundTask && !m._useBgQueue;
|
|
@@ -4682,7 +4691,8 @@ var ChatSession = class {
|
|
|
4682
4691
|
cancelIndexingGroup(group) {
|
|
4683
4692
|
var self = this;
|
|
4684
4693
|
if (!group || !group.key) return;
|
|
4685
|
-
var
|
|
4694
|
+
var idn = this.host.getIdentity();
|
|
4695
|
+
var scoped = indexScopeKey(idn.projectId, idn.platform) + "|" + group.key;
|
|
4686
4696
|
this.cancelledIndexKeys.add(scoped);
|
|
4687
4697
|
if (!group.finished) {
|
|
4688
4698
|
var stoppedIds = {};
|
|
@@ -5150,7 +5160,7 @@ var ChatSession = class {
|
|
|
5150
5160
|
if (!entry) return "";
|
|
5151
5161
|
var file = entry.storagePath || entry.filename;
|
|
5152
5162
|
if (!file) return "";
|
|
5153
|
-
return entry.projectId
|
|
5163
|
+
return indexScopeKey(entry.projectId, entry.platform) + "|" + file;
|
|
5154
5164
|
}
|
|
5155
5165
|
/**
|
|
5156
5166
|
* Reconcile the bg queue with the files the user has stopped.
|
|
@@ -5677,7 +5687,7 @@ var ChatSession = class {
|
|
|
5677
5687
|
loadHistory(fetchMore, token) {
|
|
5678
5688
|
var self = this;
|
|
5679
5689
|
var id = this.host.getIdentity();
|
|
5680
|
-
var loadKey =
|
|
5690
|
+
var loadKey = chatCacheKey(id.projectId, id.platform, id.userId);
|
|
5681
5691
|
if (token === void 0) token = this.state.gateRefreshToken;
|
|
5682
5692
|
if (this.state.loadingHistory && this.state.historyRequestToken === token || id.platform === "none" || !id.projectId) {
|
|
5683
5693
|
return Promise.resolve();
|
|
@@ -5696,7 +5706,17 @@ var ChatSession = class {
|
|
|
5696
5706
|
if (fetchMore && this.state.historyStartKeyHistory.length) options.startKeyHistory = this.state.historyStartKeyHistory.slice();
|
|
5697
5707
|
if (!fetchMore) options.deferBg = true;
|
|
5698
5708
|
var fetchHistory = function() {
|
|
5699
|
-
return getSplitChatHistory({
|
|
5709
|
+
return getSplitChatHistory({
|
|
5710
|
+
service: projectId,
|
|
5711
|
+
owner,
|
|
5712
|
+
platform,
|
|
5713
|
+
userId: id.userId,
|
|
5714
|
+
// An anonymous visitor's history is scoped server side by
|
|
5715
|
+
// ip + "(" + user_agent + ")", which two devices behind one NAT
|
|
5716
|
+
// share. Read this device's own queue instead. See
|
|
5717
|
+
// scopeSurfaceToQueue.
|
|
5718
|
+
scopeSurfaceToQueue: !!id.anonymous
|
|
5719
|
+
}, options);
|
|
5700
5720
|
};
|
|
5701
5721
|
return Promise.resolve().then(fetchHistory).catch(function(err) {
|
|
5702
5722
|
if (isAuthExpiredError(err) && !isNonRetryableRequestError(err)) return self.host.refreshSession().then(fetchHistory);
|
|
@@ -5718,6 +5738,10 @@ var ChatSession = class {
|
|
|
5718
5738
|
var mapped = mapHistoryListToMessages(list, platform, {
|
|
5719
5739
|
clearedAt: self.host.getClearedAt(),
|
|
5720
5740
|
projectId: id.projectId,
|
|
5741
|
+
// So the `_ownerKey` stamped on server history matches loadKey and
|
|
5742
|
+
// the cache key. Without it every mapped bubble carries a
|
|
5743
|
+
// two-segment stamp that no comparison can ever match.
|
|
5744
|
+
userId: id.userId,
|
|
5721
5745
|
formatIndexingLabel: self.host.formatIndexingLabel
|
|
5722
5746
|
}).messages;
|
|
5723
5747
|
self.applyHydratedBodies(mapped);
|
|
@@ -5926,6 +5950,7 @@ var ChatSession = class {
|
|
|
5926
5950
|
var m2 = mapHistoryListToMessages(sorted, platform, {
|
|
5927
5951
|
clearedAt: self.host.getClearedAt(),
|
|
5928
5952
|
projectId: id.projectId,
|
|
5953
|
+
userId: id.userId,
|
|
5929
5954
|
formatIndexingLabel: self.host.formatIndexingLabel
|
|
5930
5955
|
}).messages;
|
|
5931
5956
|
self.applyHydratedBodies(m2);
|
|
@@ -6714,6 +6739,6 @@ function buildChatDisplayList(messages, opts) {
|
|
|
6714
6739
|
return out;
|
|
6715
6740
|
}
|
|
6716
6741
|
|
|
6717
|
-
export { BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, ChatSession, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, 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, 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, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, TOOL_AND_RESPONSE_BUFFER, 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, 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 };
|
|
6742
|
+
export { BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, ChatSession, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, 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, 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, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, TOOL_AND_RESPONSE_BUFFER, 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 };
|
|
6718
6743
|
//# sourceMappingURL=engine.mjs.map
|
|
6719
6744
|
//# sourceMappingURL=engine.mjs.map
|