bunnyquery 1.11.1 → 1.12.1

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
@@ -896,6 +896,16 @@ declare function isCsrStatusEnvelope(res: any): boolean;
896
896
  */
897
897
  declare function csrEnvelopeError(input: any): any;
898
898
  declare function getErrorMessage(input: any): string;
899
+ /**
900
+ * True when the worker has already sent this pass's window again. Its stored
901
+ * error then carries `retried` (the worker's _mark_pass_retried writes it only
902
+ * AFTER the replacement pass was queued, so the flag never promises a retry that
903
+ * does not exist). The failure is real but it is not the file's outcome: the
904
+ * replacement pass is. The file's row must not go red over it, and the bubble is
905
+ * drawn muted rather than as a dead end. Same one-level unwrap as every reader
906
+ * here, so a streamed turn's failure answers the same way as a buffered one.
907
+ */
908
+ declare function isRetriedFailure(input: any): boolean;
899
909
  declare function isErrorResponseBody(response: any): boolean;
900
910
  declare function isNonRetryableRequestError(input: any): boolean;
901
911
  declare function isAuthExpiredError(input: any): boolean;
@@ -2325,6 +2335,10 @@ interface ChatMessage {
2325
2335
  _dimSending?: boolean;
2326
2336
  isCancelled?: boolean;
2327
2337
  isError?: boolean;
2338
+ /** With isError: the worker has already sent this pass's window again, so the
2339
+ * failure is not the file's outcome. Set from the row's error payload
2340
+ * (`retried`, see errors.ts isRetriedFailure); never set locally. */
2341
+ isRetried?: boolean;
2328
2342
  isBackgroundTask?: boolean;
2329
2343
  /** Set on background-indexing REQUEST bubbles only (see IndexingFileRef). */
2330
2344
  _indexFile?: IndexingFileRef;
@@ -4372,6 +4386,70 @@ declare class ChatSession {
4372
4386
  onQueuedSendResponse(_composed: string, response: any, platform: string, serverId?: string, ownerKey?: string): void;
4373
4387
  onQueuedSendError(_composed: string, err: any, serverId?: string, ownerKey?: string): void;
4374
4388
  cancelQueuedMessage(msg: ChatMessage, idx: number): void;
4389
+ /**
4390
+ * Stop waiting for the reply to the chat turn that is running now, and move on.
4391
+ *
4392
+ * `msg` is the turn's pending ASSISTANT bubble (the dot-trail "Thinking"
4393
+ * placeholder), which is where both views draw the control. A turn's two bubbles
4394
+ * carry the same _serverItemId, so it is also how the request is found.
4395
+ * cancelQueuedMessage is the sibling for a turn still waiting in the queue and
4396
+ * takes the USER bubble; the two differ in what they are handed and in what has
4397
+ * to be unwound afterwards, not in what the server is asked.
4398
+ *
4399
+ * What ends the wait:
4400
+ * 1. csr-cancel marks the running row cancelled. The worker stops relaying and
4401
+ * never stores an answer for it, so the reply cannot turn up later on this
4402
+ * device or another, and history replays the turn as cancelled;
4403
+ * 2. the poll on it is stopped, which settles whichever chain was awaiting it
4404
+ * with a stopped result: dispatchAgentRequest's for an immediate send, the
4405
+ * queued chain for a promoted turn, the history poll after a reload. Each
4406
+ * reads a stopped or cancelled result as "no reply" and releases what it
4407
+ * holds (state.sending, pendingAgentRequests, historyItemPolls), which is
4408
+ * what lets the next send go out immediately instead of queueing;
4409
+ * 3. the bubbles settle at once, without waiting for that chain: the user
4410
+ * bubble takes its cancelled form, the placeholder goes, and the next queued
4411
+ * turn, if there is one, is promoted so its own "Thinking" appears.
4412
+ *
4413
+ * What it does NOT do: the provider call already in flight on the worker runs
4414
+ * to its end (a streamed one stops within about a second). A message sent
4415
+ * behind it on the same queue starts once the worker acks the cancelled row.
4416
+ *
4417
+ * Refused without a server id (the ack has not come back yet; the views disable
4418
+ * the control until it has) and while a cancel is already out. Indexing passes
4419
+ * are not this method's business: their Stop is cancelIndexingGroup, which ends
4420
+ * the file's whole chain.
4421
+ */
4422
+ cancelPendingReply(msg: ChatMessage, idx: number): void;
4423
+ /** The cancelled form of a request bubble, with everything that keeps it in
4424
+ * place carried over: the file markers that hold an indexing pass in its
4425
+ * collapsed row, the chat it belongs to, its send time and its render key. */
4426
+ private _cancelledCopyOf;
4427
+ /**
4428
+ * Settle a turn as cancelled wherever it lives, and let the queue move on.
4429
+ *
4430
+ * On the chat on screen: every pending placeholder carrying the id goes (a
4431
+ * history refetch can have re-mapped the running turn into a second one), the
4432
+ * request bubble takes its cancelled form, and the next queued turn is promoted
4433
+ * so the conversation does not sit on an "(In queue)" bubble with nothing
4434
+ * running. For a chat that is NOT on screen (the user moved on while the turn
4435
+ * ran, and it was cancelled from elsewhere) the same edit is made in that chat's
4436
+ * history cache, which is what the next visit renders.
4437
+ *
4438
+ * Idempotent on purpose: a cancel this client made settles the bubbles at once,
4439
+ * and the chain that was awaiting the poll settles again a moment later when the
4440
+ * stop resolves it. The second pass finds nothing to do. Deliberately NOT
4441
+ * _removeStrayPendingAssistants: by then the placeholder on screen is the freshly
4442
+ * promoted turn's, whose user bubble is pending, and the sweep would take it.
4443
+ */
4444
+ private _settleCancelledTurn;
4445
+ /**
4446
+ * _settleCancelledTurn for a chat that is not on screen: the same edit, made in
4447
+ * its history cache. Matched by id where the cached bubbles carry one; an
4448
+ * off-chat send caches its pair before the ack (see dispatchComposedMessage), so
4449
+ * the fallback is positional, exactly as _applyReplyToCache's is: the trailing
4450
+ * pending placeholder, and the last request bubble still marked in flight.
4451
+ */
4452
+ private _applyCancelToCache;
4375
4453
  /**
4376
4454
  * Stop indexing a file, from its collapsed row — every pass at once, not just
4377
4455
  * the bubble the user happens to see.
@@ -4783,4 +4861,4 @@ declare function patchProjectSettings(service: string, patch: ProjectSettingsDat
4783
4861
  */
4784
4862
  declare function clearProjectSettings(service?: string): void;
4785
4863
 
4786
- export { type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, type BgTaskEntry, type BoundedChatOptions, type BuildDisplayListOptions, type BuildIndexingUserMessageOptions, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, type CallClaudeWithMcpParams, type ChatEngineConfig, type ChatGreetingParams, type ChatGreetingParts, type ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatStreamWiring, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_UPLOAD_ACCESS_GROUP, type DisplayEntry, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, type EncodingClass, type ExtractDirective, type FillHistoryViewportOptions, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, type ImagePreviewContext, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, type LiveStreamUpdate, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, type ProjectAccessSetting, type ProjectSettingsData, type ProjectSettingsReader, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, type UploadAccessGroup, type VisionProfile, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
4864
+ export { type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, type BgTaskEntry, type BoundedChatOptions, type BuildDisplayListOptions, type BuildIndexingUserMessageOptions, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, type CallClaudeWithMcpParams, type ChatEngineConfig, type ChatGreetingParams, type ChatGreetingParts, type ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatStreamWiring, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_UPLOAD_ACCESS_GROUP, type DisplayEntry, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, type EncodingClass, type ExtractDirective, type FillHistoryViewportOptions, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, type ImagePreviewContext, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, type LiveStreamUpdate, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, type ProjectAccessSetting, type ProjectSettingsData, type ProjectSettingsReader, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, type UploadAccessGroup, type VisionProfile, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
package/dist/engine.d.ts CHANGED
@@ -896,6 +896,16 @@ declare function isCsrStatusEnvelope(res: any): boolean;
896
896
  */
897
897
  declare function csrEnvelopeError(input: any): any;
898
898
  declare function getErrorMessage(input: any): string;
899
+ /**
900
+ * True when the worker has already sent this pass's window again. Its stored
901
+ * error then carries `retried` (the worker's _mark_pass_retried writes it only
902
+ * AFTER the replacement pass was queued, so the flag never promises a retry that
903
+ * does not exist). The failure is real but it is not the file's outcome: the
904
+ * replacement pass is. The file's row must not go red over it, and the bubble is
905
+ * drawn muted rather than as a dead end. Same one-level unwrap as every reader
906
+ * here, so a streamed turn's failure answers the same way as a buffered one.
907
+ */
908
+ declare function isRetriedFailure(input: any): boolean;
899
909
  declare function isErrorResponseBody(response: any): boolean;
900
910
  declare function isNonRetryableRequestError(input: any): boolean;
901
911
  declare function isAuthExpiredError(input: any): boolean;
@@ -2325,6 +2335,10 @@ interface ChatMessage {
2325
2335
  _dimSending?: boolean;
2326
2336
  isCancelled?: boolean;
2327
2337
  isError?: boolean;
2338
+ /** With isError: the worker has already sent this pass's window again, so the
2339
+ * failure is not the file's outcome. Set from the row's error payload
2340
+ * (`retried`, see errors.ts isRetriedFailure); never set locally. */
2341
+ isRetried?: boolean;
2328
2342
  isBackgroundTask?: boolean;
2329
2343
  /** Set on background-indexing REQUEST bubbles only (see IndexingFileRef). */
2330
2344
  _indexFile?: IndexingFileRef;
@@ -4372,6 +4386,70 @@ declare class ChatSession {
4372
4386
  onQueuedSendResponse(_composed: string, response: any, platform: string, serverId?: string, ownerKey?: string): void;
4373
4387
  onQueuedSendError(_composed: string, err: any, serverId?: string, ownerKey?: string): void;
4374
4388
  cancelQueuedMessage(msg: ChatMessage, idx: number): void;
4389
+ /**
4390
+ * Stop waiting for the reply to the chat turn that is running now, and move on.
4391
+ *
4392
+ * `msg` is the turn's pending ASSISTANT bubble (the dot-trail "Thinking"
4393
+ * placeholder), which is where both views draw the control. A turn's two bubbles
4394
+ * carry the same _serverItemId, so it is also how the request is found.
4395
+ * cancelQueuedMessage is the sibling for a turn still waiting in the queue and
4396
+ * takes the USER bubble; the two differ in what they are handed and in what has
4397
+ * to be unwound afterwards, not in what the server is asked.
4398
+ *
4399
+ * What ends the wait:
4400
+ * 1. csr-cancel marks the running row cancelled. The worker stops relaying and
4401
+ * never stores an answer for it, so the reply cannot turn up later on this
4402
+ * device or another, and history replays the turn as cancelled;
4403
+ * 2. the poll on it is stopped, which settles whichever chain was awaiting it
4404
+ * with a stopped result: dispatchAgentRequest's for an immediate send, the
4405
+ * queued chain for a promoted turn, the history poll after a reload. Each
4406
+ * reads a stopped or cancelled result as "no reply" and releases what it
4407
+ * holds (state.sending, pendingAgentRequests, historyItemPolls), which is
4408
+ * what lets the next send go out immediately instead of queueing;
4409
+ * 3. the bubbles settle at once, without waiting for that chain: the user
4410
+ * bubble takes its cancelled form, the placeholder goes, and the next queued
4411
+ * turn, if there is one, is promoted so its own "Thinking" appears.
4412
+ *
4413
+ * What it does NOT do: the provider call already in flight on the worker runs
4414
+ * to its end (a streamed one stops within about a second). A message sent
4415
+ * behind it on the same queue starts once the worker acks the cancelled row.
4416
+ *
4417
+ * Refused without a server id (the ack has not come back yet; the views disable
4418
+ * the control until it has) and while a cancel is already out. Indexing passes
4419
+ * are not this method's business: their Stop is cancelIndexingGroup, which ends
4420
+ * the file's whole chain.
4421
+ */
4422
+ cancelPendingReply(msg: ChatMessage, idx: number): void;
4423
+ /** The cancelled form of a request bubble, with everything that keeps it in
4424
+ * place carried over: the file markers that hold an indexing pass in its
4425
+ * collapsed row, the chat it belongs to, its send time and its render key. */
4426
+ private _cancelledCopyOf;
4427
+ /**
4428
+ * Settle a turn as cancelled wherever it lives, and let the queue move on.
4429
+ *
4430
+ * On the chat on screen: every pending placeholder carrying the id goes (a
4431
+ * history refetch can have re-mapped the running turn into a second one), the
4432
+ * request bubble takes its cancelled form, and the next queued turn is promoted
4433
+ * so the conversation does not sit on an "(In queue)" bubble with nothing
4434
+ * running. For a chat that is NOT on screen (the user moved on while the turn
4435
+ * ran, and it was cancelled from elsewhere) the same edit is made in that chat's
4436
+ * history cache, which is what the next visit renders.
4437
+ *
4438
+ * Idempotent on purpose: a cancel this client made settles the bubbles at once,
4439
+ * and the chain that was awaiting the poll settles again a moment later when the
4440
+ * stop resolves it. The second pass finds nothing to do. Deliberately NOT
4441
+ * _removeStrayPendingAssistants: by then the placeholder on screen is the freshly
4442
+ * promoted turn's, whose user bubble is pending, and the sweep would take it.
4443
+ */
4444
+ private _settleCancelledTurn;
4445
+ /**
4446
+ * _settleCancelledTurn for a chat that is not on screen: the same edit, made in
4447
+ * its history cache. Matched by id where the cached bubbles carry one; an
4448
+ * off-chat send caches its pair before the ack (see dispatchComposedMessage), so
4449
+ * the fallback is positional, exactly as _applyReplyToCache's is: the trailing
4450
+ * pending placeholder, and the last request bubble still marked in flight.
4451
+ */
4452
+ private _applyCancelToCache;
4375
4453
  /**
4376
4454
  * Stop indexing a file, from its collapsed row — every pass at once, not just
4377
4455
  * the bubble the user happens to see.
@@ -4783,4 +4861,4 @@ declare function patchProjectSettings(service: string, patch: ProjectSettingsDat
4783
4861
  */
4784
4862
  declare function clearProjectSettings(service?: string): void;
4785
4863
 
4786
- export { type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, type BgTaskEntry, type BoundedChatOptions, type BuildDisplayListOptions, type BuildIndexingUserMessageOptions, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, type CallClaudeWithMcpParams, type ChatEngineConfig, type ChatGreetingParams, type ChatGreetingParts, type ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatStreamWiring, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_UPLOAD_ACCESS_GROUP, type DisplayEntry, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, type EncodingClass, type ExtractDirective, type FillHistoryViewportOptions, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, type ImagePreviewContext, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, type LiveStreamUpdate, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, type ProjectAccessSetting, type ProjectSettingsData, type ProjectSettingsReader, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, type UploadAccessGroup, type VisionProfile, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
4864
+ export { type AiAgentPlatform, type AnchorBoxEl, type AnchorRowEl, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, type BgTaskEntry, type BoundedChatOptions, type BuildDisplayListOptions, type BuildIndexingUserMessageOptions, CHAT_GREETING_MAX_LENGTH, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, type CallClaudeWithMcpParams, type ChatEngineConfig, type ChatGreetingParams, type ChatGreetingParts, type ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatStreamWiring, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_CONTEXT_WINDOW, DEFAULT_OPENAI_MODEL, DEFAULT_UPLOAD_ACCESS_GROUP, type DisplayEntry, EMPTY_INDEXING_REPLY, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, EXT_CONTENT_TYPES, type EncodingClass, type ExtractDirective, type FillHistoryViewportOptions, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, HTML_EXTS, HTML_HEAD_WINDOW, IMAGE_PREVIEWS_PER_MESSAGE, INDEXING_COMPLETE_MARKER, INDEXING_MAX_OUTPUT_TOKENS, INLINE_LINK_GLYPH, INLINE_LINK_UNAVAILABLE_GLYPH, INLINE_LINK_UNAVAILABLE_SUFFIX, INPUT_CAP_RATIO, type ImagePreviewContext, type IndexRunPatch, type IndexRunStatus, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkMarkupOptions, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, type LiveStreamUpdate, MAX_CONCURRENT_BG_POLLS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_OUTPUT_BY_MODEL, MAX_OUTPUT_TOKENS, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MINT_CACHE_GENERATION, MIN_INPUT_TOKEN_BUDGET, MIN_PER_REQUEST_INPUT_CAP, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, PRESIGN_SAFETY_MARGIN_MS, PREVIEWABLE_IMAGE_CONTENT_TYPES, PREVIEW_BROWSER_CACHE_SECONDS, PREVIEW_LAYOUT_BOX_SELECTOR, PREVIEW_URL_EXPIRES_SECONDS, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, type ParsedAiAgent, type PinnedDispatchContext, type PreviewImageEl, type ProjectAccessSetting, type ProjectSettingsData, type ProjectSettingsReader, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, type RenderableInlineLink, type RescueDecisionContext, type RowAnchor, type RunStubInfo, STREAM_POLL_INTERVAL, type ScrollAnchor, type ScrollAnchorOptions, type SseChunk, type SseParser, type SseProvider, type SseSnapshot, type SseToolCall, type StreamDispatchContext, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, type UploadAccessGroup, type VisionProfile, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
package/dist/engine.mjs CHANGED
@@ -625,6 +625,11 @@ function getErrorMessage(input) {
625
625
  }
626
626
  return "Something went wrong.";
627
627
  }
628
+ function isRetriedFailure(input) {
629
+ var envErr = csrEnvelopeError(input);
630
+ if (envErr !== void 0) input = envErr;
631
+ return !!input && typeof input === "object" && input.retried === true;
632
+ }
628
633
  function isErrorResponseBody(response) {
629
634
  var envErr = csrEnvelopeError(response);
630
635
  if (envErr !== void 0) response = envErr;
@@ -3296,6 +3301,7 @@ function mapHistoryListToMessages(list, platform, opts) {
3296
3301
  mapped.push(ph);
3297
3302
  } else if (isQueued) ; else if (isErrorResponse) {
3298
3303
  var em = { role: "assistant", content: getErrorMessage(response), isError: true };
3304
+ if (isRetriedFailure(response)) em.isRetried = true;
3299
3305
  if (item._fromBgChain) em._fromBgChain = true;
3300
3306
  if (item._isBgTask) em.isBackgroundTask = true;
3301
3307
  if (serverItemId !== void 0) em._serverItemId = serverItemId;
@@ -4324,7 +4330,9 @@ var ChatSession = class {
4324
4330
  timers = [];
4325
4331
  };
4326
4332
  var stopBase = base && typeof base.stop === "function" ? base.stop.bind(base) : null;
4333
+ var resolveRaced = null;
4327
4334
  var raced = new Promise(function(resolve, reject) {
4335
+ resolveRaced = resolve;
4328
4336
  base.then(function(res) {
4329
4337
  if (settled) return;
4330
4338
  settled = true;
@@ -4365,9 +4373,16 @@ var ChatSession = class {
4365
4373
  });
4366
4374
  });
4367
4375
  raced.stop = function() {
4376
+ if (settled) return;
4368
4377
  settled = true;
4369
4378
  clearProbes();
4370
- if (stopBase) stopBase();
4379
+ if (stopBase) {
4380
+ try {
4381
+ stopBase();
4382
+ } catch (e) {
4383
+ }
4384
+ }
4385
+ if (resolveRaced) resolveRaced({ id: itemId, status: "stopped" });
4371
4386
  };
4372
4387
  return raced;
4373
4388
  }
@@ -5380,6 +5395,7 @@ var ChatSession = class {
5380
5395
  }
5381
5396
  return response;
5382
5397
  }).then(function(response) {
5398
+ if (isPollStopped(response) || self._isCancelledPollResult(response)) return { content: "", isError: false, cancelled: true };
5383
5399
  if (isErrorResponseBody(response)) return { content: getErrorMessage(response), isError: true };
5384
5400
  var answer = params.aiPlatform === "openai" ? extractOpenAIText(response) : extractClaudeText(response);
5385
5401
  answer = (answer || "").trim();
@@ -5389,6 +5405,10 @@ var ChatSession = class {
5389
5405
  }).then(function(result) {
5390
5406
  delete self.pendingAgentRequests[params.key];
5391
5407
  if (dispatchItemId) self.historyItemPolls.delete(dispatchItemId);
5408
+ if (result.cancelled) {
5409
+ if (dispatchItemId) self._settleCancelledTurn(dispatchItemId, params.key);
5410
+ return result;
5411
+ }
5392
5412
  var reply = { role: "assistant", content: result.content, isError: result.isError };
5393
5413
  if (dispatchItemId) reply._serverItemId = dispatchItemId;
5394
5414
  self._applyReplyToCache(params.key, reply, dispatchItemId);
@@ -5867,8 +5887,9 @@ var ChatSession = class {
5867
5887
  }
5868
5888
  });
5869
5889
  Promise.resolve(run).catch(function() {
5870
- }).then(function() {
5890
+ }).then(function(result) {
5871
5891
  self.state.sending = false;
5892
+ if (result && result.cancelled) return;
5872
5893
  if (!(self.host.isViewMounted() && self.getHistoryCacheKey() === key)) return;
5873
5894
  return Promise.resolve(self.typewriteLatestReply(key)).then(function() {
5874
5895
  self.host.scrollToBottomIfSticky(true);
@@ -6047,6 +6068,10 @@ var ChatSession = class {
6047
6068
  }
6048
6069
  onQueuedSendResponse(_composed, response, platform, serverId, ownerKey) {
6049
6070
  if (serverId) this.historyItemPolls.delete(serverId);
6071
+ if (this._isCancelledPollResult(response)) {
6072
+ if (serverId) this._settleCancelledTurn(serverId, ownerKey);
6073
+ return;
6074
+ }
6050
6075
  if (ownerKey && this.getHistoryCacheKey() !== ownerKey) {
6051
6076
  var offReply = isErrorResponseBody(response) ? { role: "assistant", content: getErrorMessage(response), isError: true } : { role: "assistant", content: ((platform === "openai" ? extractOpenAIText(response) : extractClaudeText(response)) || "").trim() || "No text response received from AI provider." };
6052
6077
  this._applyReplyToCache(ownerKey, offReply, serverId);
@@ -6246,6 +6271,191 @@ var ChatSession = class {
6246
6271
  }
6247
6272
  });
6248
6273
  }
6274
+ /**
6275
+ * Stop waiting for the reply to the chat turn that is running now, and move on.
6276
+ *
6277
+ * `msg` is the turn's pending ASSISTANT bubble (the dot-trail "Thinking"
6278
+ * placeholder), which is where both views draw the control. A turn's two bubbles
6279
+ * carry the same _serverItemId, so it is also how the request is found.
6280
+ * cancelQueuedMessage is the sibling for a turn still waiting in the queue and
6281
+ * takes the USER bubble; the two differ in what they are handed and in what has
6282
+ * to be unwound afterwards, not in what the server is asked.
6283
+ *
6284
+ * What ends the wait:
6285
+ * 1. csr-cancel marks the running row cancelled. The worker stops relaying and
6286
+ * never stores an answer for it, so the reply cannot turn up later on this
6287
+ * device or another, and history replays the turn as cancelled;
6288
+ * 2. the poll on it is stopped, which settles whichever chain was awaiting it
6289
+ * with a stopped result: dispatchAgentRequest's for an immediate send, the
6290
+ * queued chain for a promoted turn, the history poll after a reload. Each
6291
+ * reads a stopped or cancelled result as "no reply" and releases what it
6292
+ * holds (state.sending, pendingAgentRequests, historyItemPolls), which is
6293
+ * what lets the next send go out immediately instead of queueing;
6294
+ * 3. the bubbles settle at once, without waiting for that chain: the user
6295
+ * bubble takes its cancelled form, the placeholder goes, and the next queued
6296
+ * turn, if there is one, is promoted so its own "Thinking" appears.
6297
+ *
6298
+ * What it does NOT do: the provider call already in flight on the worker runs
6299
+ * to its end (a streamed one stops within about a second). A message sent
6300
+ * behind it on the same queue starts once the worker acks the cancelled row.
6301
+ *
6302
+ * Refused without a server id (the ack has not come back yet; the views disable
6303
+ * the control until it has) and while a cancel is already out. Indexing passes
6304
+ * are not this method's business: their Stop is cancelIndexingGroup, which ends
6305
+ * the file's whole chain.
6306
+ */
6307
+ cancelPendingReply(msg, idx) {
6308
+ var self = this;
6309
+ var id = this.host.getIdentity();
6310
+ var serverId = msg._serverItemId;
6311
+ if (!serverId || msg._cancelling) return;
6312
+ if (msg.role !== "assistant" || !msg.isPending || msg.isBackgroundTask) return;
6313
+ var platform = id.platform;
6314
+ if (platform !== "claude" && platform !== "openai") return;
6315
+ var url = platform === "claude" ? ANTHROPIC_MESSAGES_API_URL : OPENAI_RESPONSES_API_URL;
6316
+ var queueBase = id.userId || id.projectId;
6317
+ var queue = msg._useBgQueue ? bgIndexingQueueName(queueBase) : queueBase;
6318
+ var findPlaceholder = function() {
6319
+ return self.state.messages.findIndex(function(m) {
6320
+ return m._serverItemId === serverId && m.role === "assistant" && !!m.isPending;
6321
+ });
6322
+ };
6323
+ var at = this.state.messages[idx] && this.state.messages[idx]._serverItemId === serverId && this.state.messages[idx].role === "assistant" ? idx : findPlaceholder();
6324
+ if (at !== -1) {
6325
+ this.state.messages[at] = Object.assign({}, this.state.messages[at], { _cancelling: true, _cancelError: void 0 });
6326
+ }
6327
+ this.host.notify();
6328
+ var unmark = function(errMsg) {
6329
+ var ci = findPlaceholder();
6330
+ if (ci === -1) return;
6331
+ self.state.messages[ci] = Object.assign({}, self.state.messages[ci], { _cancelling: false, _cancelError: errMsg });
6332
+ self.host.notify();
6333
+ };
6334
+ Promise.resolve(this.host.cancelRequest({
6335
+ url,
6336
+ method: "POST",
6337
+ id: serverId,
6338
+ queue,
6339
+ service: id.projectId,
6340
+ owner: id.owner
6341
+ })).then(function(result) {
6342
+ if (result && result.removed) {
6343
+ self._stopPoll(serverId);
6344
+ self._settleCancelledTurn(serverId);
6345
+ return;
6346
+ }
6347
+ unmark(void 0);
6348
+ }).catch(function(err) {
6349
+ unmark(err && typeof err.message === "string" && err.message ? err.message : "Could not stop this request.");
6350
+ });
6351
+ }
6352
+ /** The cancelled form of a request bubble, with everything that keeps it in
6353
+ * place carried over: the file markers that hold an indexing pass in its
6354
+ * collapsed row, the chat it belongs to, its send time and its render key. */
6355
+ _cancelledCopyOf(m, itemId) {
6356
+ var cancelled = { role: "user", content: m.content, isCancelled: true };
6357
+ if (itemId !== void 0) cancelled._serverItemId = itemId;
6358
+ else if (m._serverItemId !== void 0) cancelled._serverItemId = m._serverItemId;
6359
+ if (m.isBackgroundTask) cancelled.isBackgroundTask = true;
6360
+ if (m._indexFile) cancelled._indexFile = m._indexFile;
6361
+ if (m._useBgQueue) cancelled._useBgQueue = true;
6362
+ if (m._ownerKey !== void 0) cancelled._ownerKey = m._ownerKey;
6363
+ if (m._ts !== void 0) cancelled._ts = m._ts;
6364
+ if (m._localId !== void 0) cancelled._localId = m._localId;
6365
+ return cancelled;
6366
+ }
6367
+ /**
6368
+ * Settle a turn as cancelled wherever it lives, and let the queue move on.
6369
+ *
6370
+ * On the chat on screen: every pending placeholder carrying the id goes (a
6371
+ * history refetch can have re-mapped the running turn into a second one), the
6372
+ * request bubble takes its cancelled form, and the next queued turn is promoted
6373
+ * so the conversation does not sit on an "(In queue)" bubble with nothing
6374
+ * running. For a chat that is NOT on screen (the user moved on while the turn
6375
+ * ran, and it was cancelled from elsewhere) the same edit is made in that chat's
6376
+ * history cache, which is what the next visit renders.
6377
+ *
6378
+ * Idempotent on purpose: a cancel this client made settles the bubbles at once,
6379
+ * and the chain that was awaiting the poll settles again a moment later when the
6380
+ * stop resolves it. The second pass finds nothing to do. Deliberately NOT
6381
+ * _removeStrayPendingAssistants: by then the placeholder on screen is the freshly
6382
+ * promoted turn's, whose user bubble is pending, and the sweep would take it.
6383
+ */
6384
+ _settleCancelledTurn(itemId, ownerKey) {
6385
+ if (!itemId) return;
6386
+ if (ownerKey && this.getHistoryCacheKey() !== ownerKey) {
6387
+ this._applyCancelToCache(ownerKey, itemId);
6388
+ return;
6389
+ }
6390
+ var changed = false, wasBg = false;
6391
+ for (var i = this.state.messages.length - 1; i >= 0; i--) {
6392
+ var m = this.state.messages[i];
6393
+ if (!m || m._serverItemId !== itemId) continue;
6394
+ if (m.role === "assistant" && m.isPending) {
6395
+ this.state.messages.splice(i, 1);
6396
+ changed = true;
6397
+ continue;
6398
+ }
6399
+ if (m.role === "user" && !m.isCancelled) {
6400
+ if (m.isBackgroundTask) wasBg = true;
6401
+ this.state.messages[i] = this._cancelledCopyOf(m, itemId);
6402
+ changed = true;
6403
+ }
6404
+ }
6405
+ this.cancelledServerIds.delete(itemId);
6406
+ if (!changed) return;
6407
+ if (wasBg) this.promoteNextBgQueuedToRunning();
6408
+ else this.promoteNextQueuedToRunning();
6409
+ this.updateHistoryCache();
6410
+ this.host.notify();
6411
+ }
6412
+ /**
6413
+ * _settleCancelledTurn for a chat that is not on screen: the same edit, made in
6414
+ * its history cache. Matched by id where the cached bubbles carry one; an
6415
+ * off-chat send caches its pair before the ack (see dispatchComposedMessage), so
6416
+ * the fallback is positional, exactly as _applyReplyToCache's is: the trailing
6417
+ * pending placeholder, and the last request bubble still marked in flight.
6418
+ */
6419
+ _applyCancelToCache(key, itemId) {
6420
+ var existing = key ? this.aiChatHistoryCache[key] : void 0;
6421
+ if (!existing) return;
6422
+ var msgs = existing.messages.slice();
6423
+ var changed = false;
6424
+ var pIdx = -1, uIdx = -1;
6425
+ for (var i = msgs.length - 1; i >= 0; i--) {
6426
+ var m = msgs[i];
6427
+ if (!m || m._serverItemId !== itemId) continue;
6428
+ if (m.role === "assistant" && m.isPending) {
6429
+ msgs.splice(i, 1);
6430
+ changed = true;
6431
+ pIdx = i;
6432
+ } else if (m.role === "user" && !m.isCancelled && uIdx === -1) uIdx = i;
6433
+ }
6434
+ if (pIdx === -1) {
6435
+ for (var p = msgs.length - 1; p >= 0; p--) {
6436
+ var pm = msgs[p];
6437
+ if (!pm || !pm.isPending || pm.role !== "assistant" || pm.isBackgroundTask || pm._serverItemId !== void 0) continue;
6438
+ msgs.splice(p, 1);
6439
+ changed = true;
6440
+ break;
6441
+ }
6442
+ }
6443
+ if (uIdx === -1) {
6444
+ for (var u = msgs.length - 1; u >= 0; u--) {
6445
+ var um = msgs[u];
6446
+ if (!um || um.role !== "user" || um.isBackgroundTask || um._serverItemId !== void 0 || um._stageId) continue;
6447
+ if (!(um.isPendingQueued || um.isPendingInProcess || um.isSendingToServer)) continue;
6448
+ uIdx = u;
6449
+ break;
6450
+ }
6451
+ }
6452
+ if (uIdx !== -1) {
6453
+ msgs[uIdx] = this._cancelledCopyOf(msgs[uIdx], itemId);
6454
+ changed = true;
6455
+ }
6456
+ if (!changed) return;
6457
+ this.aiChatHistoryCache[key] = { messages: msgs, endOfList: existing.endOfList, startKeyHistory: existing.startKeyHistory };
6458
+ }
6249
6459
  /**
6250
6460
  * Stop indexing a file, from its collapsed row — every pass at once, not just
6251
6461
  * the bubble the user happens to see.
@@ -6312,6 +6522,7 @@ var ChatSession = class {
6312
6522
  }
6313
6523
  }
6314
6524
  this._adoptWorkerIndexingPasses(0);
6525
+ this._sweepCancelledIndexing();
6315
6526
  var ids = group.cancellableIds || [];
6316
6527
  if (!ids.length) {
6317
6528
  this.host.notify();
@@ -6594,9 +6805,10 @@ var ChatSession = class {
6594
6805
  this.state.sending = true;
6595
6806
  this.host.scrollToBottomIfSticky(true);
6596
6807
  return Promise.resolve(pending).catch(function() {
6597
- }).then(function() {
6808
+ }).then(function(result) {
6598
6809
  if (token !== self.state.gateRefreshToken) return;
6599
6810
  self.state.sending = false;
6811
+ if (result && result.cancelled) return;
6600
6812
  return Promise.resolve(self.typewriteLatestReply(key)).then(function() {
6601
6813
  self.host.scrollToBottomIfSticky(true);
6602
6814
  });
@@ -8225,8 +8437,19 @@ function buildChatDisplayList(messages, opts) {
8225
8437
  } else if (stopped) {
8226
8438
  grp.status = "cancelled";
8227
8439
  } else {
8228
- var last = grp.members[grp.members.length - 1].msg;
8229
- grp.status = last.isError ? "error" : "done";
8440
+ var retriedIds = {};
8441
+ for (var ri = 0; ri < grp.members.length; ri++) {
8442
+ var rm = grp.members[ri].msg;
8443
+ if (rm.isRetried && rm._serverItemId) retriedIds[rm._serverItemId] = true;
8444
+ }
8445
+ var li = grp.members.length - 1;
8446
+ while (li >= 0 && (grp.members[li].msg.isRetried || grp.members[li].msg._serverItemId && retriedIds[grp.members[li].msg._serverItemId])) li--;
8447
+ if (li < 0) {
8448
+ grp.status = "active";
8449
+ } else {
8450
+ var last = grp.members[li].msg;
8451
+ grp.status = last.isError ? "error" : "done";
8452
+ }
8230
8453
  }
8231
8454
  var sawFirstPass = false;
8232
8455
  for (var pi = 0; pi < grp.members.length; pi++) {
@@ -8539,6 +8762,6 @@ function clearProjectSettings(service) {
8539
8762
  else cache.clear();
8540
8763
  }
8541
8764
 
8542
- export { BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CHAT_GREETING_MAX_LENGTH, 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, DEFAULT_UPLOAD_ACCESS_GROUP, 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, INDEXING_MAX_OUTPUT_TOKENS, 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, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, STREAM_POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
8765
+ export { BG_INDEXING_QUEUE_SUFFIX, BOM, BOM_EXTS, CHAT_GREETING_MAX_LENGTH, 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, DEFAULT_UPLOAD_ACCESS_GROUP, 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, INDEXING_MAX_OUTPUT_TOKENS, 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, PROJECT_SETTINGS_ACCESS_GROUP, PROJECT_SETTINGS_TABLE, PROJECT_SETTINGS_UNIQUE_ID, RENDER_FROM_TOKEN, RTF_EXTS, RUN_RECORD_WORKING_STALE_MS, STREAM_POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, UPLOAD_ACCESS_GROUPS, UPLOAD_ACCESS_HINTS, UPLOAD_ACCESS_LABELS, UPLOAD_ACCESS_OPTIONS, XML_EXTS, __resetSplitHistoryState, accessSettingFrom, adoptLocalAnswerIntoPage, applyEncodingDeclaration, asksUploadAccessFrom, bgIndexingQueueName, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatGreeting, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildHistoryItemFullId, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, cachedProjectSettings, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, canonicalizePathForm, chatCacheKey, chatEngineConfig, chatGreetingFrom, chatStreamWiring, classifyInlineLink, clearAttachmentParsers, clearImagePreviewCache, clearProjectSettings, composeUserMessage, configureChatEngine, configureProjectSettings, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, createScrollAnchor, createSseParser, csrEnvelopeError, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeInlineHtml, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fetchLiveIndexingKeys, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, formatDuration, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getInputTokenBudget, getMaxOutputTokens, getModelContextWindow, getProjectContextWindow, getSplitChatHistory, getVisionProfile, groupAttachmentFailures, hasBom, hydrateImagePreviews, indexDoneUniqueId, indexScopeKey, indexingAccessGroup, isAuthExpiredError, isBgIndexingQueue, isCsrStatusEnvelope, isErrorResponseBody, isHttpUrlLike, isImageVisionFile, isIndexingRequestText, isLinkUnavailable, isNonRetryableRequestError, isOfficeFile, isPagedReadFile, isPreviewableImagePath, isProviderApiKeyError, isRetriedFailure, isServerExtractable, isServiceDbAttachmentHref, isWindowedReadFile, linkUnavailableKeyForHref, linkUnavailableKeyForPath, linkUnavailableKeysForPath, listClaudeModels, listOpenAIModels, liveSafePrefix, loadProjectSettings, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, markImagePreviewStale, mayKeepStreamedAnswer, mintCacheBustStamp, needsBomForExt, normalizeAttachmentPathCandidate, normalizeChatGreeting, normalizeExt, normalizeProjectAccessSetting, normalizeTextContent, normalizeTrailingInlineToken, normalizeUploadAccessGroup, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, patchProjectSettings, peekImagePreviewUrl, prepareDownloadText, presignExpiryEpochMs, previewImageContentType, previewLayoutBox, previewMintCacheToken, previewableExtOf, primeProjectSettings, projectAccessSetting, projectAsksUploadAccess, projectChatGreeting, projectSettingsSettled, projectUploadAccessGroup, readExpiredAttachmentHref, readyProjectSettings, registerAttachmentParser, registerModelContextWindows, renderInlineLinkHtml, repairUrlEntities, repairUrlWhitespace, resolveImagePreviewUrl, runIndexUniqueId, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, setProjectSettings, shouldRescueInFlightMessage, skapiSupportsStreaming, streamRecoveryEnabled, streamRecoveryLabels, streamRecoveryPhase, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, typewriterResumeIndex, uploadAccessGroupFrom, upsertIndexRunRecordSafe, wallClockNow };
8543
8766
  //# sourceMappingURL=engine.mjs.map
8544
8767
  //# sourceMappingURL=engine.mjs.map