bunnyquery 1.8.1 → 1.8.2

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
@@ -372,6 +372,102 @@ declare function buildBoundedChatMessages(options: BoundedChatOptions): {
372
372
  estimatedBudget: number;
373
373
  };
374
374
 
375
+ /**
376
+ * How a text file the chat offers as a download is encoded and labelled, so that
377
+ * whatever opens it reads the characters correctly, in any language.
378
+ *
379
+ * When the model answers with a fenced ```name.ext block, the client turns that
380
+ * block into a Blob and an <a download>. We always write UTF-8, but several very
381
+ * common consumers do not assume UTF-8 when nothing in the file says so, and fall
382
+ * back to the reader's local ANSI codepage: CP949 in Korea, CP932 in Japan,
383
+ * CP936/CP950 in China and Taiwan, CP1251 for Cyrillic. The file is valid and
384
+ * every non-ASCII character still opens as mojibake.
385
+ *
386
+ * There is no single fix, because the way a file declares "this is UTF-8" is a
387
+ * property of the FORMAT:
388
+ *
389
+ * - a spreadsheet (csv/tsv) and a Windows text editor read a BOM;
390
+ * - HTML is opened from disk with no HTTP headers, so only an in-document
391
+ * <meta charset> survives;
392
+ * - XML carries its encoding in its declaration, and a WRONG declaration makes
393
+ * a conforming parser fail outright;
394
+ * - RTF is 7-bit, so non-ASCII has to be escaped into \uNNNN?;
395
+ * - JSON, JSONL and YAML are UTF-8 by specification, and a BOM BREAKS them.
396
+ *
397
+ * Anything unrecognised is left byte-for-byte alone: an unknown extension is far
398
+ * more likely to be machine-parsed, where an uninvited BOM is a new bug, than to
399
+ * be opened by a legacy editor.
400
+ *
401
+ * MIRROR of skapi-mcp/download-encoding.js, which does the same job for files the
402
+ * server publishes (writeReport / exportRecordsToFile). A file the user gets from
403
+ * a fenced block and the same file published as a download must behave
404
+ * identically, so the two have to change together.
405
+ */
406
+ declare const BOM = "\uFEFF";
407
+ /** Files a spreadsheet or a Windows text editor opens directly. */
408
+ declare const BOM_EXTS: Set<string>;
409
+ /** Read from disk with no HTTP headers, so the declaration must be in the file. */
410
+ declare const HTML_EXTS: Set<string>;
411
+ declare const XML_EXTS: Set<string>;
412
+ declare const RTF_EXTS: Set<string>;
413
+ /** Content types by extension. Every text family carries an explicit charset. */
414
+ declare const EXT_CONTENT_TYPES: Record<string, string>;
415
+ type EncodingClass = 'bom' | 'html' | 'xml' | 'rtf' | 'none';
416
+ declare function normalizeExt(ext: string | null | undefined): string;
417
+ /** Extension of a filename, '' when it has none. */
418
+ declare function extOf(filename: string | null | undefined): string;
419
+ /** Which encoding declaration this format understands. */
420
+ declare function encodingClassForExt(ext: string | null | undefined): EncodingClass;
421
+ /** True when a file with this extension must be written BOM-first. */
422
+ declare function needsBomForExt(ext: string | null | undefined): boolean;
423
+ /**
424
+ * Content type to declare. Everything textual carries an explicit charset:
425
+ * without one the receiving end guesses, and it guesses the local codepage.
426
+ */
427
+ declare function contentTypeForExt(ext: string | null | undefined, fallback?: string): string;
428
+ declare function hasBom(text: string): boolean;
429
+ declare const HTML_HEAD_WINDOW = 4096;
430
+ /**
431
+ * Make an HTML document state its own encoding. Downloaded HTML is opened from
432
+ * disk, where the Content-Type we set no longer exists, so a document with no
433
+ * <meta charset> is decoded with the browser's locale default.
434
+ */
435
+ declare function ensureHtmlCharset(text: string): string;
436
+ /**
437
+ * Correct an XML declaration that names the wrong encoding.
438
+ *
439
+ * A MISSING declaration is left alone on purpose: XML with none is UTF-8 by
440
+ * specification, so every conforming parser already gets it right. A declaration
441
+ * naming EUC-KR over UTF-8 bytes, on the other hand, makes a parser fail outright.
442
+ */
443
+ declare function ensureXmlEncoding(text: string): string;
444
+ /** True when the body really is RTF rather than text merely named .rtf. */
445
+ declare function looksLikeRtf(text: string): boolean;
446
+ /**
447
+ * Escape every non-ASCII character into RTF's \uNNNN? form.
448
+ *
449
+ * RTF is 7-bit: a literal UTF-8 byte in the body is read through the codepage the
450
+ * header declares, which is how Korean, Japanese and Cyrillic RTF turns to
451
+ * mojibake in Word. \uNNNN? is codepage-independent.
452
+ *
453
+ * ASCII is never touched, which matters: backslashes and braces in an RTF body
454
+ * are control syntax, and "escaping" them would destroy the document. \u takes a
455
+ * SIGNED 16-bit value, so anything above 0x7FFF is emitted negative, and astral
456
+ * characters are emitted as their two surrogates.
457
+ */
458
+ declare function escapeRtfNonAscii(text: string): string;
459
+ /** Apply the format's encoding declaration to a whole document. */
460
+ declare function applyEncodingDeclaration(text: string, ext: string | null | undefined): string;
461
+ /**
462
+ * Everything a client needs to turn a fenced ```name.ext block into a download:
463
+ * the exact text to put in the Blob and the type to give it.
464
+ */
465
+ declare function prepareDownloadText(filename: string, body: string): {
466
+ ext: string;
467
+ text: string;
468
+ contentType: string;
469
+ };
470
+
375
471
  /**
376
472
  * Pure link/path helpers (no DOM, no marked). Moved verbatim from the chatbox.
377
473
  * `serviceId` is passed as a PARAMETER (the original read it from a global) so
@@ -721,7 +817,7 @@ type CallClaudeWithMcpParams = {
721
817
  onResponse?: (res: any) => void;
722
818
  onError?: (err: any) => void;
723
819
  };
724
- declare const POLL_INTERVAL = 1500;
820
+ declare const POLL_INTERVAL = 3000;
725
821
  declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
726
822
  declare function callClaudeWithPublicMcp(prompt: string, service: string, owner: string, messages?: ClaudeMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
727
823
  declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
@@ -1336,4 +1432,4 @@ declare class ChatSession {
1336
1432
  bumpGate(): void;
1337
1433
  }
1338
1434
 
1339
- export { type AiAgentPlatform, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, 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 ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_OPENAI_MODEL, type DisplayEntry, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, type ExtractDirective, type FillHistoryViewportOptions, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, type ParsedAiAgent, type PinnedDispatchContext, RENDER_FROM_TOKEN, TOOL_AND_RESPONSE_BUFFER, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, composeUserMessage, configureChatEngine, createHistoryFiller, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getProjectContextWindow, groupAttachmentFailures, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, repairUrlEntities, repairUrlWhitespace, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, wallClockNow };
1435
+ export { type AiAgentPlatform, 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 ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_OPENAI_MODEL, type DisplayEntry, 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, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, type ParsedAiAgent, type PinnedDispatchContext, RENDER_FROM_TOKEN, RTF_EXTS, TOOL_AND_RESPONSE_BUFFER, XML_EXTS, applyEncodingDeclaration, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getProjectContextWindow, groupAttachmentFailures, hasBom, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, prepareDownloadText, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, repairUrlEntities, repairUrlWhitespace, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, wallClockNow };
package/dist/engine.d.ts CHANGED
@@ -372,6 +372,102 @@ declare function buildBoundedChatMessages(options: BoundedChatOptions): {
372
372
  estimatedBudget: number;
373
373
  };
374
374
 
375
+ /**
376
+ * How a text file the chat offers as a download is encoded and labelled, so that
377
+ * whatever opens it reads the characters correctly, in any language.
378
+ *
379
+ * When the model answers with a fenced ```name.ext block, the client turns that
380
+ * block into a Blob and an <a download>. We always write UTF-8, but several very
381
+ * common consumers do not assume UTF-8 when nothing in the file says so, and fall
382
+ * back to the reader's local ANSI codepage: CP949 in Korea, CP932 in Japan,
383
+ * CP936/CP950 in China and Taiwan, CP1251 for Cyrillic. The file is valid and
384
+ * every non-ASCII character still opens as mojibake.
385
+ *
386
+ * There is no single fix, because the way a file declares "this is UTF-8" is a
387
+ * property of the FORMAT:
388
+ *
389
+ * - a spreadsheet (csv/tsv) and a Windows text editor read a BOM;
390
+ * - HTML is opened from disk with no HTTP headers, so only an in-document
391
+ * <meta charset> survives;
392
+ * - XML carries its encoding in its declaration, and a WRONG declaration makes
393
+ * a conforming parser fail outright;
394
+ * - RTF is 7-bit, so non-ASCII has to be escaped into \uNNNN?;
395
+ * - JSON, JSONL and YAML are UTF-8 by specification, and a BOM BREAKS them.
396
+ *
397
+ * Anything unrecognised is left byte-for-byte alone: an unknown extension is far
398
+ * more likely to be machine-parsed, where an uninvited BOM is a new bug, than to
399
+ * be opened by a legacy editor.
400
+ *
401
+ * MIRROR of skapi-mcp/download-encoding.js, which does the same job for files the
402
+ * server publishes (writeReport / exportRecordsToFile). A file the user gets from
403
+ * a fenced block and the same file published as a download must behave
404
+ * identically, so the two have to change together.
405
+ */
406
+ declare const BOM = "\uFEFF";
407
+ /** Files a spreadsheet or a Windows text editor opens directly. */
408
+ declare const BOM_EXTS: Set<string>;
409
+ /** Read from disk with no HTTP headers, so the declaration must be in the file. */
410
+ declare const HTML_EXTS: Set<string>;
411
+ declare const XML_EXTS: Set<string>;
412
+ declare const RTF_EXTS: Set<string>;
413
+ /** Content types by extension. Every text family carries an explicit charset. */
414
+ declare const EXT_CONTENT_TYPES: Record<string, string>;
415
+ type EncodingClass = 'bom' | 'html' | 'xml' | 'rtf' | 'none';
416
+ declare function normalizeExt(ext: string | null | undefined): string;
417
+ /** Extension of a filename, '' when it has none. */
418
+ declare function extOf(filename: string | null | undefined): string;
419
+ /** Which encoding declaration this format understands. */
420
+ declare function encodingClassForExt(ext: string | null | undefined): EncodingClass;
421
+ /** True when a file with this extension must be written BOM-first. */
422
+ declare function needsBomForExt(ext: string | null | undefined): boolean;
423
+ /**
424
+ * Content type to declare. Everything textual carries an explicit charset:
425
+ * without one the receiving end guesses, and it guesses the local codepage.
426
+ */
427
+ declare function contentTypeForExt(ext: string | null | undefined, fallback?: string): string;
428
+ declare function hasBom(text: string): boolean;
429
+ declare const HTML_HEAD_WINDOW = 4096;
430
+ /**
431
+ * Make an HTML document state its own encoding. Downloaded HTML is opened from
432
+ * disk, where the Content-Type we set no longer exists, so a document with no
433
+ * <meta charset> is decoded with the browser's locale default.
434
+ */
435
+ declare function ensureHtmlCharset(text: string): string;
436
+ /**
437
+ * Correct an XML declaration that names the wrong encoding.
438
+ *
439
+ * A MISSING declaration is left alone on purpose: XML with none is UTF-8 by
440
+ * specification, so every conforming parser already gets it right. A declaration
441
+ * naming EUC-KR over UTF-8 bytes, on the other hand, makes a parser fail outright.
442
+ */
443
+ declare function ensureXmlEncoding(text: string): string;
444
+ /** True when the body really is RTF rather than text merely named .rtf. */
445
+ declare function looksLikeRtf(text: string): boolean;
446
+ /**
447
+ * Escape every non-ASCII character into RTF's \uNNNN? form.
448
+ *
449
+ * RTF is 7-bit: a literal UTF-8 byte in the body is read through the codepage the
450
+ * header declares, which is how Korean, Japanese and Cyrillic RTF turns to
451
+ * mojibake in Word. \uNNNN? is codepage-independent.
452
+ *
453
+ * ASCII is never touched, which matters: backslashes and braces in an RTF body
454
+ * are control syntax, and "escaping" them would destroy the document. \u takes a
455
+ * SIGNED 16-bit value, so anything above 0x7FFF is emitted negative, and astral
456
+ * characters are emitted as their two surrogates.
457
+ */
458
+ declare function escapeRtfNonAscii(text: string): string;
459
+ /** Apply the format's encoding declaration to a whole document. */
460
+ declare function applyEncodingDeclaration(text: string, ext: string | null | undefined): string;
461
+ /**
462
+ * Everything a client needs to turn a fenced ```name.ext block into a download:
463
+ * the exact text to put in the Blob and the type to give it.
464
+ */
465
+ declare function prepareDownloadText(filename: string, body: string): {
466
+ ext: string;
467
+ text: string;
468
+ contentType: string;
469
+ };
470
+
375
471
  /**
376
472
  * Pure link/path helpers (no DOM, no marked). Moved verbatim from the chatbox.
377
473
  * `serviceId` is passed as a PARAMETER (the original read it from a global) so
@@ -721,7 +817,7 @@ type CallClaudeWithMcpParams = {
721
817
  onResponse?: (res: any) => void;
722
818
  onError?: (err: any) => void;
723
819
  };
724
- declare const POLL_INTERVAL = 1500;
820
+ declare const POLL_INTERVAL = 3000;
725
821
  declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
726
822
  declare function callClaudeWithPublicMcp(prompt: string, service: string, owner: string, messages?: ClaudeMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
727
823
  declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], fileUrls?: FileUrlDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
@@ -1336,4 +1432,4 @@ declare class ChatSession {
1336
1432
  bumpGate(): void;
1337
1433
  }
1338
1434
 
1339
- export { type AiAgentPlatform, type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, 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 ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_OPENAI_MODEL, type DisplayEntry, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, type ExtractDirective, type FillHistoryViewportOptions, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, type ParsedAiAgent, type PinnedDispatchContext, RENDER_FROM_TOKEN, TOOL_AND_RESPONSE_BUFFER, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, composeUserMessage, configureChatEngine, createHistoryFiller, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getProjectContextWindow, groupAttachmentFailures, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, repairUrlEntities, repairUrlWhitespace, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, wallClockNow };
1435
+ export { type AiAgentPlatform, 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 ChatHost, type ChatIdentity, type ChatMessage, ChatSession, type ChatState, type ChatSystemPromptParams, type ClaudeMcpServerRequest, type ClaudeMcpToolConfig, type ClaudeMessage, type ClaudeRole, type ComposedUserMessage, DEFAULT_CLAUDE_MODEL, DEFAULT_OPENAI_MODEL, type DisplayEntry, 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, type IndexingAttachmentInfo, type IndexingFileRef, type IndexingGroup, type IndexingGroupStatus, type IndexingRequestRef, type IndexingSystemPromptParams, type InlineLinkContext, type InlineLinkPart, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, type ParsedAiAgent, type PinnedDispatchContext, RENDER_FROM_TOKEN, RTF_EXTS, TOOL_AND_RESPONSE_BUFFER, XML_EXTS, applyEncodingDeclaration, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getProjectContextWindow, groupAttachmentFailures, hasBom, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, prepareDownloadText, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, repairUrlEntities, repairUrlWhitespace, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, wallClockNow };
package/dist/engine.mjs CHANGED
@@ -437,6 +437,19 @@ Index the REMAINING windows - one record per row/item, looking at any page image
437
437
  }
438
438
 
439
439
  // src/engine/errors.ts
440
+ var STATUS_MESSAGE = {
441
+ "408": "The AI provider timed out before it started.",
442
+ "409": "The AI provider rejected the request as conflicting.",
443
+ "413": "The request was too large for the AI provider.",
444
+ "429": "The AI provider is rate limiting requests right now.",
445
+ "500": "The AI provider hit an internal error.",
446
+ "502": "The AI provider is temporarily unreachable.",
447
+ "503": "The AI provider is temporarily unavailable.",
448
+ "504": "The AI provider timed out."
449
+ };
450
+ function isTransientStatus(status) {
451
+ return status === 408 || status === 425 || status === 429 || status >= 500;
452
+ }
440
453
  function getErrorMessage(input) {
441
454
  if (!input) return "Something went wrong.";
442
455
  if (typeof input === "string") return input;
@@ -444,6 +457,11 @@ function getErrorMessage(input) {
444
457
  if (input.body && input.body.error && input.body.error.message) return input.body.error.message;
445
458
  if (input.body && typeof input.body.message === "string") return input.body.message;
446
459
  if (input.message) return input.message;
460
+ var status = typeof input.status_code === "number" ? input.status_code : typeof input.status === "number" ? input.status : 0;
461
+ if (status) {
462
+ var text = STATUS_MESSAGE[String(status)] || (status >= 500 ? "The AI provider returned a server error." : "The AI provider rejected the request.");
463
+ return text + " (error " + status + ")" + (isTransientStatus(status) ? " This is usually temporary, please try again." : "");
464
+ }
447
465
  return "Something went wrong.";
448
466
  }
449
467
  function isErrorResponseBody(response) {
@@ -867,6 +885,166 @@ function buildBoundedChatMessages(options) {
867
885
  };
868
886
  }
869
887
 
888
+ // src/engine/download_encoding.ts
889
+ var BOM = "\uFEFF";
890
+ var BOM_EXTS = /* @__PURE__ */ new Set(["csv", "tsv", "tab", "txt", "text", "log"]);
891
+ var HTML_EXTS = /* @__PURE__ */ new Set(["html", "htm", "xhtml"]);
892
+ var XML_EXTS = /* @__PURE__ */ new Set(["xml", "svg", "rss", "atom", "xsl", "xslt", "plist", "kml"]);
893
+ var RTF_EXTS = /* @__PURE__ */ new Set(["rtf"]);
894
+ var EXT_CONTENT_TYPES = {
895
+ csv: "text/csv; charset=utf-8",
896
+ tsv: "text/tab-separated-values; charset=utf-8",
897
+ tab: "text/tab-separated-values; charset=utf-8",
898
+ txt: "text/plain; charset=utf-8",
899
+ text: "text/plain; charset=utf-8",
900
+ log: "text/plain; charset=utf-8",
901
+ md: "text/markdown; charset=utf-8",
902
+ markdown: "text/markdown; charset=utf-8",
903
+ json: "application/json; charset=utf-8",
904
+ jsonl: "application/x-ndjson; charset=utf-8",
905
+ ndjson: "application/x-ndjson; charset=utf-8",
906
+ geojson: "application/geo+json; charset=utf-8",
907
+ yaml: "text/yaml; charset=utf-8",
908
+ yml: "text/yaml; charset=utf-8",
909
+ toml: "text/plain; charset=utf-8",
910
+ ini: "text/plain; charset=utf-8",
911
+ sql: "text/plain; charset=utf-8",
912
+ html: "text/html; charset=utf-8",
913
+ htm: "text/html; charset=utf-8",
914
+ xhtml: "application/xhtml+xml; charset=utf-8",
915
+ xml: "application/xml; charset=utf-8",
916
+ svg: "image/svg+xml; charset=utf-8",
917
+ css: "text/css; charset=utf-8",
918
+ js: "text/javascript; charset=utf-8",
919
+ ts: "text/plain; charset=utf-8",
920
+ py: "text/x-python; charset=utf-8",
921
+ sh: "text/x-shellscript; charset=utf-8",
922
+ srt: "application/x-subrip; charset=utf-8",
923
+ vtt: "text/vtt; charset=utf-8",
924
+ ics: "text/calendar; charset=utf-8",
925
+ vcf: "text/vcard; charset=utf-8",
926
+ // RTF is 7-bit ASCII by specification, so it takes no charset parameter.
927
+ rtf: "application/rtf",
928
+ // Binary types the model can only ever REFERENCE, never author in a fence, but
929
+ // which keep the type sensible if one ever shows up.
930
+ pdf: "application/pdf",
931
+ png: "image/png",
932
+ jpg: "image/jpeg",
933
+ jpeg: "image/jpeg",
934
+ gif: "image/gif",
935
+ webp: "image/webp"
936
+ };
937
+ function normalizeExt(ext) {
938
+ return String(ext || "").trim().replace(/^\./, "").toLowerCase();
939
+ }
940
+ function extOf(filename) {
941
+ const name = String(filename || "");
942
+ const dot = name.lastIndexOf(".");
943
+ return dot > 0 ? normalizeExt(name.slice(dot + 1)) : "";
944
+ }
945
+ function encodingClassForExt(ext) {
946
+ const e = normalizeExt(ext);
947
+ if (BOM_EXTS.has(e)) return "bom";
948
+ if (HTML_EXTS.has(e)) return "html";
949
+ if (XML_EXTS.has(e)) return "xml";
950
+ if (RTF_EXTS.has(e)) return "rtf";
951
+ return "none";
952
+ }
953
+ function needsBomForExt(ext) {
954
+ return encodingClassForExt(ext) === "bom";
955
+ }
956
+ function contentTypeForExt(ext, fallback = "text/plain; charset=utf-8") {
957
+ return EXT_CONTENT_TYPES[normalizeExt(ext)] || fallback;
958
+ }
959
+ function hasBom(text) {
960
+ return typeof text === "string" && text.charCodeAt(0) === 65279;
961
+ }
962
+ var HTML_HEAD_WINDOW = 4096;
963
+ var META_CHARSET_RE = /<meta[^>]+charset\s*=\s*["']?\s*([a-z0-9_-]+)/i;
964
+ var META_HTTP_EQUIV_RE = /<meta[^>]+http-equiv\s*=\s*["']?content-type["']?[^>]*>/i;
965
+ function ensureHtmlCharset(text) {
966
+ const src = String(text == null ? "" : text);
967
+ const head = src.slice(0, HTML_HEAD_WINDOW);
968
+ const declared = META_CHARSET_RE.exec(head);
969
+ if (declared) {
970
+ if (declared[1].toLowerCase().replace(/[^a-z0-9]/g, "") === "utf8") return src;
971
+ const start = declared.index + declared[0].length - declared[1].length;
972
+ return src.slice(0, start) + "utf-8" + src.slice(start + declared[1].length);
973
+ }
974
+ const httpEquiv = META_HTTP_EQUIV_RE.exec(head);
975
+ if (httpEquiv) {
976
+ return src.slice(0, httpEquiv.index) + '<meta charset="utf-8">' + src.slice(httpEquiv.index + httpEquiv[0].length);
977
+ }
978
+ const tag = '<meta charset="utf-8">';
979
+ const headOpen = /<head[^>]*>/i.exec(head);
980
+ if (headOpen) {
981
+ const at = headOpen.index + headOpen[0].length;
982
+ return src.slice(0, at) + "\n" + tag + src.slice(at);
983
+ }
984
+ const htmlOpen = /<html[^>]*>/i.exec(head);
985
+ if (htmlOpen) {
986
+ const at = htmlOpen.index + htmlOpen[0].length;
987
+ return src.slice(0, at) + "\n<head>" + tag + "</head>" + src.slice(at);
988
+ }
989
+ const doctype = /<!doctype[^>]*>/i.exec(head);
990
+ if (doctype) {
991
+ const at = doctype.index + doctype[0].length;
992
+ return src.slice(0, at) + "\n" + tag + src.slice(at);
993
+ }
994
+ return tag + "\n" + src;
995
+ }
996
+ var XML_DECL_RE = /^\s*<\?xml\s[^?]*\?>/i;
997
+ function ensureXmlEncoding(text) {
998
+ const src = String(text == null ? "" : text);
999
+ const decl = XML_DECL_RE.exec(src);
1000
+ if (!decl) return src;
1001
+ const found = /encoding\s*=\s*["']([^"']*)["']/i.exec(decl[0]);
1002
+ if (!found) return src;
1003
+ if (found[1].toLowerCase().replace(/[^a-z0-9]/g, "") === "utf8") return src;
1004
+ const fixedDecl = decl[0].slice(0, found.index) + found[0].replace(found[1], "UTF-8") + decl[0].slice(found.index + found[0].length);
1005
+ return fixedDecl + src.slice(decl[0].length);
1006
+ }
1007
+ var RTF_SIGNATURE_RE = /^[\s]*\{\\rtf/i;
1008
+ function looksLikeRtf(text) {
1009
+ return RTF_SIGNATURE_RE.test(String(text == null ? "" : text));
1010
+ }
1011
+ function escapeRtfNonAscii(text) {
1012
+ const src = String(text == null ? "" : text);
1013
+ let out = "";
1014
+ let plainFrom = 0;
1015
+ for (let i = 0; i < src.length; i++) {
1016
+ const code = src.charCodeAt(i);
1017
+ if (code < 128) continue;
1018
+ out += src.slice(plainFrom, i);
1019
+ out += `\\u${code > 32767 ? code - 65536 : code}?`;
1020
+ plainFrom = i + 1;
1021
+ }
1022
+ return plainFrom === 0 ? src : out + src.slice(plainFrom);
1023
+ }
1024
+ function applyEncodingDeclaration(text, ext) {
1025
+ const src = String(text == null ? "" : text);
1026
+ switch (encodingClassForExt(ext)) {
1027
+ case "bom":
1028
+ return hasBom(src) ? src : BOM + src;
1029
+ case "html":
1030
+ return ensureHtmlCharset(src);
1031
+ case "xml":
1032
+ return ensureXmlEncoding(src);
1033
+ case "rtf":
1034
+ return looksLikeRtf(src) ? escapeRtfNonAscii(src) : hasBom(src) ? src : BOM + src;
1035
+ default:
1036
+ return src;
1037
+ }
1038
+ }
1039
+ function prepareDownloadText(filename, body) {
1040
+ const ext = extOf(filename);
1041
+ return {
1042
+ ext,
1043
+ text: applyEncodingDeclaration(body, ext),
1044
+ contentType: contentTypeForExt(ext)
1045
+ };
1046
+ }
1047
+
870
1048
  // src/engine/time.ts
871
1049
  function wallClockNow() {
872
1050
  return Date.now();
@@ -1039,7 +1217,7 @@ function applyHistoryCacheBreakpoint(messages) {
1039
1217
  return { ...m, content: blocks };
1040
1218
  });
1041
1219
  }
1042
- var POLL_INTERVAL = 1500;
1220
+ var POLL_INTERVAL = 3e3;
1043
1221
  async function callClaudeWithMcp({
1044
1222
  prompt,
1045
1223
  messages,
@@ -1988,7 +2166,7 @@ var ChatSession = class {
1988
2166
  var chatQueue = useBgQueue ? userId + BG_INDEXING_QUEUE_SUFFIX : userId;
1989
2167
  if (offChat) {
1990
2168
  var offHistory = (this.aiChatHistoryCache[key] ? this.aiChatHistoryCache[key].messages : []).filter(function(m) {
1991
- return !m.isPending && !m.isPendingQueued && !m.isPendingInProcess && !m.isPendingOlder && !m.isCancelled && !m.isBackgroundTask;
2169
+ return !m.isPending && !m.isPendingQueued && !m.isPendingInProcess && !m.isPendingOlder && !m.isCancelled && !m.isBackgroundTask && !m.isError;
1992
2170
  });
1993
2171
  var offBounded = buildBoundedChatMessages({
1994
2172
  platform: aiPlatform,
@@ -2023,7 +2201,7 @@ var ChatSession = class {
2023
2201
  }
2024
2202
  if (isQueuedSend) {
2025
2203
  var resolvedHistory = this.state.messages.filter(function(m) {
2026
- return !m.isPending && !m.isPendingQueued && !m.isPendingInProcess && !m.isPendingOlder && !m.isCancelled && !m.isBackgroundTask;
2204
+ return !m.isPending && !m.isPendingQueued && !m.isPendingInProcess && !m.isPendingOlder && !m.isCancelled && !m.isBackgroundTask && !m.isError;
2027
2205
  });
2028
2206
  var boundedQ = buildBoundedChatMessages({
2029
2207
  platform: aiPlatform,
@@ -2074,7 +2252,7 @@ var ChatSession = class {
2074
2252
  this.state.sending = true;
2075
2253
  this.host.scrollToBottom(true);
2076
2254
  var historyForLlm = this.state.messages.filter(function(m) {
2077
- return !m.isCancelled && !m.isBackgroundTask;
2255
+ return !m.isPending && !m.isPendingQueued && !m.isPendingInProcess && !m.isPendingOlder && !m.isCancelled && !m.isBackgroundTask && !m.isError;
2078
2256
  });
2079
2257
  if (llmComposed !== composed) {
2080
2258
  for (var li = historyForLlm.length - 1; li >= 0; li--) {
@@ -3679,6 +3857,6 @@ function buildChatDisplayList(messages, opts) {
3679
3857
  return out;
3680
3858
  }
3681
3859
 
3682
- export { BG_INDEXING_QUEUE_SUFFIX, CLAUDE_INPUT_CAP_RATIO, CLAUDE_PER_REQUEST_INPUT_CAP, CONTEXT_WINDOW_BY_MODEL, CONTEXT_WINDOW_DEFAULT, ChatSession, DEFAULT_CLAUDE_MODEL, DEFAULT_OPENAI_MODEL, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, EXPIRED_LINK_REFRESH_EXPIRES_SECONDS, HISTORY_BUDGET_RATIO, HISTORY_FILL_SLACK_PX, HISTORY_TOKEN_BUDGET, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, RENDER_FROM_TOKEN, TOOL_AND_RESPONSE_BUFFER, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, composeUserMessage, configureChatEngine, createHistoryFiller, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getProjectContextWindow, groupAttachmentFailures, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, repairUrlEntities, repairUrlWhitespace, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, wallClockNow };
3860
+ 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_OPENAI_MODEL, 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, LINK_LABEL_MAX_DISPLAY_CHARS, LINK_REFRESH_WINDOW_MS, MAX_HISTORY_FILL_PAGES, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, RENDER_FROM_TOKEN, RTF_EXTS, TOOL_AND_RESPONSE_BUFFER, XML_EXTS, applyEncodingDeclaration, buildAiAgentValue, buildBoundedChatMessages, buildChatDisplayList, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingContinueMessage, buildIndexingRenderContinueTemplate, buildIndexingRenderMessage, buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingWindowMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, classifyInlineLink, clearAttachmentParsers, composeUserMessage, configureChatEngine, contentTypeForExt, createHistoryFiller, createInlineLinkRegex, encodePathSegments, encodingClassForExt, ensureHtmlCharset, ensureXmlEncoding, escapeRtfNonAscii, estimateMessageTokens, estimateTextTokens, extOf, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, fillHistoryViewport, filterListByClearHorizon, findAttachmentParser, formatChatTimestamp, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, getProjectContextWindow, groupAttachmentFailures, hasBom, isAuthExpiredError, isBgIndexingQueue, isErrorResponseBody, isHttpUrlLike, isIndexingRequestText, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, looksLikeRtf, makeExtractPlaceholder, mapHistoryListToMessages, needsBomForExt, normalizeAttachmentPathCandidate, normalizeExt, normalizeTextContent, normalizeTrailingInlineToken, notifyAgentSaveAttachment, parseAiAgentValue, parseAttachmentContent, parseIndexingLabel, parseIndexingRequestText, prepareDownloadText, readExpiredAttachmentHref, registerAttachmentParser, registerModelContextWindows, repairUrlEntities, repairUrlWhitespace, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, setProjectContextWindow, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay, wallClockNow };
3683
3861
  //# sourceMappingURL=engine.mjs.map
3684
3862
  //# sourceMappingURL=engine.mjs.map