bunnyquery 1.5.0 → 1.5.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/bunnyquery.js +84 -31
- package/dist/engine.cjs +60 -22
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +25 -8
- package/dist/engine.d.ts +25 -8
- package/dist/engine.mjs +60 -23
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/budget.ts +5 -2
- package/src/engine/history.ts +3 -1
- package/src/engine/host.ts +9 -2
- package/src/engine/links.ts +25 -3
- package/src/engine/office.ts +25 -1
- package/src/engine/prompts/indexing_system_prompt.ts +1 -1
- package/src/engine/requests.ts +12 -1
- package/src/engine/session.ts +34 -13
package/dist/engine.d.mts
CHANGED
|
@@ -104,6 +104,12 @@ type ExtractDirective = {
|
|
|
104
104
|
/** MIME type — informational (server logs only). */
|
|
105
105
|
mime?: string;
|
|
106
106
|
};
|
|
107
|
+
type FileUrlDirective = {
|
|
108
|
+
/** db storage path of the file, e.g. "folder/report.pdf" (also the src:: value). */
|
|
109
|
+
path: string;
|
|
110
|
+
/** The exact baked url string in the request body to replace with a fresh one. */
|
|
111
|
+
url: string;
|
|
112
|
+
};
|
|
107
113
|
/**
|
|
108
114
|
* True when a file should be EXTRACTED SERVER-SIDE (text inlined for indexing)
|
|
109
115
|
* rather than handed to the agent as a URL to fetch — i.e. binary office
|
|
@@ -122,6 +128,8 @@ interface ComposedUserMessage {
|
|
|
122
128
|
composedForLlm: string;
|
|
123
129
|
/** Office-extraction directives for the proxy worker (undefined if no office files). */
|
|
124
130
|
extractContent?: ExtractDirective[];
|
|
131
|
+
/** JIT url re-mint directives for the worker (non-extractable files: PDFs, images). */
|
|
132
|
+
fileUrls?: FileUrlDirective[];
|
|
125
133
|
}
|
|
126
134
|
declare function composeUserMessage(text: string, attachmentUrls: Array<{
|
|
127
135
|
name: string;
|
|
@@ -290,7 +298,8 @@ declare function normalizeAttachmentPathCandidate(value: string): string;
|
|
|
290
298
|
declare function extractRemotePathFromAttachmentHref(href: string, serviceId: string): string | null;
|
|
291
299
|
declare function getExpiredAttachmentVisiblePath(remotePath: string, fallback?: string): string;
|
|
292
300
|
declare function buildDisplayExpiredAttachmentHref(remotePath: string, fallback?: string): string;
|
|
293
|
-
declare function
|
|
301
|
+
declare function isServiceDbAttachmentHref(href: string, serviceId: string): boolean;
|
|
302
|
+
declare function sanitizeAttachmentLinksForHistory(content: string, serviceId: string, forAssistant?: boolean): string;
|
|
294
303
|
declare function truncateLabelForDisplay(label: string): string;
|
|
295
304
|
|
|
296
305
|
declare function filterListByClearHorizon(list: any[], clearedAt: number): any[];
|
|
@@ -343,13 +352,14 @@ type CallClaudeWithMcpParams = {
|
|
|
343
352
|
system?: string;
|
|
344
353
|
mcpServer: ClaudeMcpServerRequest;
|
|
345
354
|
extractContent?: ExtractDirective[];
|
|
355
|
+
fileUrls?: FileUrlDirective[];
|
|
346
356
|
onResponse?: (res: any) => void;
|
|
347
357
|
onError?: (err: any) => void;
|
|
348
358
|
};
|
|
349
359
|
declare const POLL_INTERVAL = 1500;
|
|
350
|
-
declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, }: CallClaudeWithMcpParams): Promise<any>;
|
|
351
|
-
declare function callClaudeWithPublicMcp(prompt: string, service: string, owner: string, messages?: ClaudeMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
|
|
352
|
-
declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
|
|
360
|
+
declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
|
|
361
|
+
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>;
|
|
362
|
+
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>;
|
|
353
363
|
type AttachmentSaveInfo = {
|
|
354
364
|
platform: 'claude' | 'openai';
|
|
355
365
|
model?: string;
|
|
@@ -489,11 +499,18 @@ interface ChatHost {
|
|
|
489
499
|
}): Promise<any>;
|
|
490
500
|
/** Mint a temporary CDN URL for a stored file. */
|
|
491
501
|
getTemporaryUrl(storagePath: string): Promise<string>;
|
|
502
|
+
/** Delete a file's AI-index record ("src::<storagePath>") ahead of a
|
|
503
|
+
* reindex/overwrite so the agent re-creates it fresh instead of colliding/
|
|
504
|
+
* duplicating. The skapi backend cascades a src:: delete to the record's
|
|
505
|
+
* reference-linked children. OPTIONAL — hosts that don't implement it fall
|
|
506
|
+
* through to a plain re-index. Implementations must be best-effort (swallow
|
|
507
|
+
* "not found" / permission errors so indexing still proceeds). */
|
|
508
|
+
deleteExistingFileRecord?(storagePath: string): Promise<any>;
|
|
492
509
|
/** Map a relative path to the consumer's db storage key (e.g. uid-prefixed). */
|
|
493
510
|
storagePathFor(relPath: string): string;
|
|
494
511
|
getMimeType(name: string): string | null;
|
|
495
|
-
/** Non-dismissible "file exists" prompt → keep+reindex
|
|
496
|
-
promptOverwrite(filename: string): Promise<'overwrite' | 'reindex'>;
|
|
512
|
+
/** Non-dismissible "file exists" prompt → skip, keep+reindex, or overwrite. */
|
|
513
|
+
promptOverwrite(filename: string): Promise<'overwrite' | 'reindex' | 'skip'>;
|
|
497
514
|
/** Clear the "apply to all" overwrite choice at the start of a batch. */
|
|
498
515
|
resetOverwriteBatch(): void;
|
|
499
516
|
/** Re-render the attachment chip row (progress / status). */
|
|
@@ -541,7 +558,7 @@ declare class ChatSession {
|
|
|
541
558
|
updateHistoryCache(): void;
|
|
542
559
|
private _callProviderFor;
|
|
543
560
|
dispatchAgentRequest(params: any): Promise<any>;
|
|
544
|
-
dispatchComposedMessage(composed: string, useBgQueue?: boolean, composedForLlm?: string, extractContent?: any): void;
|
|
561
|
+
dispatchComposedMessage(composed: string, useBgQueue?: boolean, composedForLlm?: string, extractContent?: any, fileUrls?: any): void;
|
|
545
562
|
promoteNextBgQueuedToRunning(): void;
|
|
546
563
|
promoteNextQueuedToRunning(): void;
|
|
547
564
|
resolveQueuedUserBubble(serverId?: string): number | undefined;
|
|
@@ -574,4 +591,4 @@ declare class ChatSession {
|
|
|
574
591
|
bumpGate(): void;
|
|
575
592
|
}
|
|
576
593
|
|
|
577
|
-
export { type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, type BgTaskEntry, type BoundedChatOptions, type BuildIndexingUserMessageOptions, 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, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, type ExtractDirective, HISTORY_TOKEN_BUDGET, type IndexingAttachmentInfo, type IndexingSystemPromptParams, LINK_LABEL_MAX_DISPLAY_CHARS, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, clearAttachmentParsers, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, findAttachmentParser, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, isServerExtractable, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, parseAttachmentContent, registerAttachmentParser, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
594
|
+
export { type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, type BgTaskEntry, type BoundedChatOptions, type BuildIndexingUserMessageOptions, 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, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, type ExtractDirective, HISTORY_TOKEN_BUDGET, type IndexingAttachmentInfo, type IndexingSystemPromptParams, LINK_LABEL_MAX_DISPLAY_CHARS, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, clearAttachmentParsers, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, findAttachmentParser, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, parseAttachmentContent, registerAttachmentParser, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
package/dist/engine.d.ts
CHANGED
|
@@ -104,6 +104,12 @@ type ExtractDirective = {
|
|
|
104
104
|
/** MIME type — informational (server logs only). */
|
|
105
105
|
mime?: string;
|
|
106
106
|
};
|
|
107
|
+
type FileUrlDirective = {
|
|
108
|
+
/** db storage path of the file, e.g. "folder/report.pdf" (also the src:: value). */
|
|
109
|
+
path: string;
|
|
110
|
+
/** The exact baked url string in the request body to replace with a fresh one. */
|
|
111
|
+
url: string;
|
|
112
|
+
};
|
|
107
113
|
/**
|
|
108
114
|
* True when a file should be EXTRACTED SERVER-SIDE (text inlined for indexing)
|
|
109
115
|
* rather than handed to the agent as a URL to fetch — i.e. binary office
|
|
@@ -122,6 +128,8 @@ interface ComposedUserMessage {
|
|
|
122
128
|
composedForLlm: string;
|
|
123
129
|
/** Office-extraction directives for the proxy worker (undefined if no office files). */
|
|
124
130
|
extractContent?: ExtractDirective[];
|
|
131
|
+
/** JIT url re-mint directives for the worker (non-extractable files: PDFs, images). */
|
|
132
|
+
fileUrls?: FileUrlDirective[];
|
|
125
133
|
}
|
|
126
134
|
declare function composeUserMessage(text: string, attachmentUrls: Array<{
|
|
127
135
|
name: string;
|
|
@@ -290,7 +298,8 @@ declare function normalizeAttachmentPathCandidate(value: string): string;
|
|
|
290
298
|
declare function extractRemotePathFromAttachmentHref(href: string, serviceId: string): string | null;
|
|
291
299
|
declare function getExpiredAttachmentVisiblePath(remotePath: string, fallback?: string): string;
|
|
292
300
|
declare function buildDisplayExpiredAttachmentHref(remotePath: string, fallback?: string): string;
|
|
293
|
-
declare function
|
|
301
|
+
declare function isServiceDbAttachmentHref(href: string, serviceId: string): boolean;
|
|
302
|
+
declare function sanitizeAttachmentLinksForHistory(content: string, serviceId: string, forAssistant?: boolean): string;
|
|
294
303
|
declare function truncateLabelForDisplay(label: string): string;
|
|
295
304
|
|
|
296
305
|
declare function filterListByClearHorizon(list: any[], clearedAt: number): any[];
|
|
@@ -343,13 +352,14 @@ type CallClaudeWithMcpParams = {
|
|
|
343
352
|
system?: string;
|
|
344
353
|
mcpServer: ClaudeMcpServerRequest;
|
|
345
354
|
extractContent?: ExtractDirective[];
|
|
355
|
+
fileUrls?: FileUrlDirective[];
|
|
346
356
|
onResponse?: (res: any) => void;
|
|
347
357
|
onError?: (err: any) => void;
|
|
348
358
|
};
|
|
349
359
|
declare const POLL_INTERVAL = 1500;
|
|
350
|
-
declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, }: CallClaudeWithMcpParams): Promise<any>;
|
|
351
|
-
declare function callClaudeWithPublicMcp(prompt: string, service: string, owner: string, messages?: ClaudeMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
|
|
352
|
-
declare function callOpenAIWithPublicMcp(prompt: string, service: string, owner: string, messages?: OpenAIMessage[], system?: string, model?: string, userId?: string, extractContent?: ExtractDirective[], onResponse?: (res: any) => void, onError?: (err: any) => void): Promise<any>;
|
|
360
|
+
declare function callClaudeWithMcp({ prompt, messages, service, owner, userId, model, maxTokens, system, mcpServer, extractContent, fileUrls, }: CallClaudeWithMcpParams): Promise<any>;
|
|
361
|
+
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>;
|
|
362
|
+
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>;
|
|
353
363
|
type AttachmentSaveInfo = {
|
|
354
364
|
platform: 'claude' | 'openai';
|
|
355
365
|
model?: string;
|
|
@@ -489,11 +499,18 @@ interface ChatHost {
|
|
|
489
499
|
}): Promise<any>;
|
|
490
500
|
/** Mint a temporary CDN URL for a stored file. */
|
|
491
501
|
getTemporaryUrl(storagePath: string): Promise<string>;
|
|
502
|
+
/** Delete a file's AI-index record ("src::<storagePath>") ahead of a
|
|
503
|
+
* reindex/overwrite so the agent re-creates it fresh instead of colliding/
|
|
504
|
+
* duplicating. The skapi backend cascades a src:: delete to the record's
|
|
505
|
+
* reference-linked children. OPTIONAL — hosts that don't implement it fall
|
|
506
|
+
* through to a plain re-index. Implementations must be best-effort (swallow
|
|
507
|
+
* "not found" / permission errors so indexing still proceeds). */
|
|
508
|
+
deleteExistingFileRecord?(storagePath: string): Promise<any>;
|
|
492
509
|
/** Map a relative path to the consumer's db storage key (e.g. uid-prefixed). */
|
|
493
510
|
storagePathFor(relPath: string): string;
|
|
494
511
|
getMimeType(name: string): string | null;
|
|
495
|
-
/** Non-dismissible "file exists" prompt → keep+reindex
|
|
496
|
-
promptOverwrite(filename: string): Promise<'overwrite' | 'reindex'>;
|
|
512
|
+
/** Non-dismissible "file exists" prompt → skip, keep+reindex, or overwrite. */
|
|
513
|
+
promptOverwrite(filename: string): Promise<'overwrite' | 'reindex' | 'skip'>;
|
|
497
514
|
/** Clear the "apply to all" overwrite choice at the start of a batch. */
|
|
498
515
|
resetOverwriteBatch(): void;
|
|
499
516
|
/** Re-render the attachment chip row (progress / status). */
|
|
@@ -541,7 +558,7 @@ declare class ChatSession {
|
|
|
541
558
|
updateHistoryCache(): void;
|
|
542
559
|
private _callProviderFor;
|
|
543
560
|
dispatchAgentRequest(params: any): Promise<any>;
|
|
544
|
-
dispatchComposedMessage(composed: string, useBgQueue?: boolean, composedForLlm?: string, extractContent?: any): void;
|
|
561
|
+
dispatchComposedMessage(composed: string, useBgQueue?: boolean, composedForLlm?: string, extractContent?: any, fileUrls?: any): void;
|
|
545
562
|
promoteNextBgQueuedToRunning(): void;
|
|
546
563
|
promoteNextQueuedToRunning(): void;
|
|
547
564
|
resolveQueuedUserBubble(serverId?: string): number | undefined;
|
|
@@ -574,4 +591,4 @@ declare class ChatSession {
|
|
|
574
591
|
bumpGate(): void;
|
|
575
592
|
}
|
|
576
593
|
|
|
577
|
-
export { type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, type BgTaskEntry, type BoundedChatOptions, type BuildIndexingUserMessageOptions, 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, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, type ExtractDirective, HISTORY_TOKEN_BUDGET, type IndexingAttachmentInfo, type IndexingSystemPromptParams, LINK_LABEL_MAX_DISPLAY_CHARS, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, clearAttachmentParsers, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, findAttachmentParser, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, isServerExtractable, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, parseAttachmentContent, registerAttachmentParser, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
594
|
+
export { type AttachmentFailureGroup, type AttachmentParser, type AttachmentSaveInfo, BG_INDEXING_QUEUE_SUFFIX, type BgTaskEntry, type BoundedChatOptions, type BuildIndexingUserMessageOptions, 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, EXPIRED_ATTACHMENT_URL_HOST, EXPIRED_ATTACHMENT_URL_ORIGIN, type ExtractDirective, HISTORY_TOKEN_BUDGET, type IndexingAttachmentInfo, type IndexingSystemPromptParams, LINK_LABEL_MAX_DISPLAY_CHARS, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, type MapHistoryOptions, OUTPUT_TOKEN_RESERVE, type OpenAIMessage, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, clearAttachmentParsers, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, findAttachmentParser, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, parseAttachmentContent, registerAttachmentParser, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
package/dist/engine.mjs
CHANGED
|
@@ -170,6 +170,7 @@ ${lines.join("\n")}`;
|
|
|
170
170
|
}
|
|
171
171
|
let composedForLlm = composed;
|
|
172
172
|
let extractContent;
|
|
173
|
+
let fileUrls;
|
|
173
174
|
if (attachmentUrls.length > 0) {
|
|
174
175
|
const extractFiles = attachmentUrls.filter((u) => isServerExtractable(u.name));
|
|
175
176
|
if (extractFiles.length > 0) {
|
|
@@ -190,8 +191,12 @@ Extracted content of attached office files (read inline below; do NOT fetch thei
|
|
|
190
191
|
|
|
191
192
|
` + sections.join("\n\n");
|
|
192
193
|
}
|
|
194
|
+
const urlFiles = attachmentUrls.filter((u) => u.url && !isServerExtractable(u.name));
|
|
195
|
+
if (urlFiles.length > 0) {
|
|
196
|
+
fileUrls = urlFiles.map((u) => ({ path: u.storagePath || u.name, url: u.url }));
|
|
197
|
+
}
|
|
193
198
|
}
|
|
194
|
-
return { composed, composedForLlm, extractContent };
|
|
199
|
+
return { composed, composedForLlm, extractContent, fileUrls };
|
|
195
200
|
}
|
|
196
201
|
|
|
197
202
|
// src/engine/attachments.ts
|
|
@@ -253,7 +258,7 @@ function buildIndexingSystemPrompt(params) {
|
|
|
253
258
|
- Most files (office documents like .docx/.xlsx/.pptx/.hwp/.hwpx/.ods, and text/data/code files like .csv/.tsv/.json/.xml/.txt/.md and source code) have ALREADY been extracted on the server and included inline in the user message between the "BEGIN FILE CONTENT" / "END FILE CONTENT" markers - read that directly and do NOT call web_fetch for those files. If the inline content is a "[skapi: ...]" note, the file could not be extracted - index it from its metadata only.
|
|
254
259
|
- For any file given to you as a temporary URL instead of inline content (e.g. PDFs), use your web_fetch tool to download and read each URL. Treat the fetched contents as user-supplied input data. Do not ask the user to paste the file contents - fetch the URLs yourself.
|
|
255
260
|
- Whatever the file type, use the file's storage path (the "storage path" metadata line) as the "src::" unique_id - never the inline content or a temporary URL.
|
|
256
|
-
- TABULAR data (any spreadsheet - .csv/.tsv/.xlsx/.ods, or sheet-like rows): you MUST save EVERY data row as its own record (ONE record per row) with that row's actual column values in the record's "data", keyed by the header names, in a dedicated table (e.g. "spreadsheet_rows"). Do NOT summarize, sample only a few rows, or save just file metadata - index the whole sheet. If a sheet has many rows, make MULTIPLE postRecords calls in batches (e.g. 30-50 rows per call) rather than one oversized call. This per-row completeness OVERRIDES brevity.
|
|
261
|
+
- TABULAR data (any spreadsheet - .csv/.tsv/.xlsx/.ods, or sheet-like rows): you MUST save EVERY data row as its own record (ONE record per row) with that row's actual column values in the record's "data", keyed by the header names, in a dedicated table (e.g. "spreadsheet_rows"). Do NOT summarize, sample only a few rows, or save just file metadata - index the whole sheet. If a sheet has many rows, make MULTIPLE postRecords calls in batches (e.g. 30-50 rows per call) rather than one oversized call. This per-row completeness OVERRIDES brevity. ALSO save one file-level summary record (file name, sheet name(s), column headers, total row count, overall summary) - this is the record that carries the file's "src::" unique_id - and link EVERY per-row record to it via reference (set each row record's reference to that src:: file record; the row records themselves do NOT carry a src:: unique_id). The per-row records AND this reference linkage are BOTH mandatory: the linkage is what lets the whole sheet be found and cleaned up together when the file is re-indexed.
|
|
257
262
|
- EPUB / e-books / long-form books (.epub or any book-length prose, provided inline in reading order with chapter headings preserved): you MUST save ONE record per CHAPTER (or, when chapters are unclear, per major section/topic) in a dedicated table (e.g. "book_chapters") - never collapse the whole book into a single record. Each chapter record's "data" must capture the chapter title plus its order/number AND a substantive summary of that chapter's content (key events, arguments, characters, places, concepts, terms, notable quotes). Apply AS MANY relevant tags as possible to EVERY chapter record (characters, locations, themes, topics, key concepts, key terms, dates, named entities) so the book is easy to SEARCH and cross-reference later - this is the whole point. ALSO save one book-level record (title, author, language, overall summary, chapter list / table of contents, genre/subjects) and link each chapter record to it via reference. This per-chapter completeness OVERRIDES brevity; human-readable summaries only, never raw/binary bytes.
|
|
258
263
|
- This is a ONE-SHOT background indexing task: do ALL the MCP saving FIRST, never reply mid-task, and never ask the user questions or invite back-and-forth. Always use the MCP tools to save what you learn - be exhaustive about meaning (and, for tabular data, about every row). Never store raw or binary bytes (base64, blobs); describe them in human-readable text instead.
|
|
259
264
|
- Only AFTER every save is done, send exactly ONE final message summarizing what you indexed - never just "Indexing complete", and never a raw/base64/binary value or a large pasted dump. Keep it to a few factual sentences or a short markdown bullet list covering: the file name, its content type, each table you wrote to with its record/row count and the key columns/fields or topics captured, and anything that could not be extracted. Follow this shape - Indexed <file name> (<content type>): saved <N> records to <table(s)> capturing <key columns/fields or topics>; could not extract: <gaps, or none>.`;
|
|
@@ -436,13 +441,26 @@ function getExpiredAttachmentVisiblePath(remotePath, fallback) {
|
|
|
436
441
|
function buildDisplayExpiredAttachmentHref(remotePath, fallback) {
|
|
437
442
|
return EXPIRED_ATTACHMENT_URL_ORIGIN + "/" + encodePathSegments(getExpiredAttachmentVisiblePath(remotePath, fallback));
|
|
438
443
|
}
|
|
439
|
-
function
|
|
440
|
-
if (!
|
|
444
|
+
function isServiceDbAttachmentHref(href, serviceId) {
|
|
445
|
+
if (!serviceId) return false;
|
|
446
|
+
try {
|
|
447
|
+
var parsed = new URL(href);
|
|
448
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
|
|
449
|
+
var segs = normalizeAttachmentPathCandidate(parsed.pathname || "").split("/").filter(Boolean);
|
|
450
|
+
return segs.length > 0 && segs[0] === serviceId;
|
|
451
|
+
} catch (e) {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function sanitizeAttachmentLinksForHistory(content, serviceId, forAssistant) {
|
|
456
|
+
if (!content) return content;
|
|
457
|
+
if (!forAssistant && content.indexOf("Attached files:") === -1) return content;
|
|
441
458
|
return content.replace(/\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/g, function(_m, label, href) {
|
|
459
|
+
if (forAssistant && !isServiceDbAttachmentHref(href, serviceId)) return _m;
|
|
442
460
|
var remotePath = extractRemotePathFromAttachmentHref(href, serviceId);
|
|
443
461
|
var labelPath = normalizeAttachmentPathCandidate(label);
|
|
444
462
|
var fullPath = remotePath || labelPath;
|
|
445
|
-
if (!fullPath) return "[" + label + "](" + EXPIRED_ATTACHMENT_URL_ORIGIN + "/file)";
|
|
463
|
+
if (!fullPath) return forAssistant ? _m : "[" + label + "](" + EXPIRED_ATTACHMENT_URL_ORIGIN + "/file)";
|
|
446
464
|
return "[" + label + "](" + buildDisplayExpiredAttachmentHref(fullPath, label) + ")";
|
|
447
465
|
});
|
|
448
466
|
}
|
|
@@ -478,7 +496,7 @@ function getContextWindow(platform, model) {
|
|
|
478
496
|
}
|
|
479
497
|
function stripFileBlocksFromHistory(content) {
|
|
480
498
|
if (!content) return content;
|
|
481
|
-
return content.replace(/```([
|
|
499
|
+
return content.replace(/```([^\n`]+?\.[^\s.`]+)\n[\s\S]*?```/g, "[file previously attached: $1]");
|
|
482
500
|
}
|
|
483
501
|
function buildBoundedChatMessages(options) {
|
|
484
502
|
var contextWindow = getContextWindow(options.platform, options.model);
|
|
@@ -494,7 +512,7 @@ function buildBoundedChatMessages(options) {
|
|
|
494
512
|
var trimmed = windowed.map(function(m, i2) {
|
|
495
513
|
if (i2 === latestIndex) return m;
|
|
496
514
|
var stripped = stripFileBlocksFromHistory(m.content);
|
|
497
|
-
var sanitized =
|
|
515
|
+
var sanitized = sanitizeAttachmentLinksForHistory(stripped, options.serviceId, m.role !== "user");
|
|
498
516
|
return Object.assign({}, m, { content: sanitized });
|
|
499
517
|
});
|
|
500
518
|
var bounded = [], used = 0;
|
|
@@ -640,7 +658,8 @@ async function callClaudeWithMcp({
|
|
|
640
658
|
maxTokens = 1e3,
|
|
641
659
|
system,
|
|
642
660
|
mcpServer,
|
|
643
|
-
extractContent
|
|
661
|
+
extractContent,
|
|
662
|
+
fileUrls
|
|
644
663
|
}) {
|
|
645
664
|
const mcpServerDefinition = {
|
|
646
665
|
type: "url",
|
|
@@ -668,6 +687,7 @@ async function callClaudeWithMcp({
|
|
|
668
687
|
model,
|
|
669
688
|
max_tokens: maxTokens,
|
|
670
689
|
...extractContent && extractContent.length ? { _skapi_extract: extractContent } : {},
|
|
690
|
+
...fileUrls && fileUrls.length ? { _skapi_file_urls: fileUrls } : {},
|
|
671
691
|
...system ? {
|
|
672
692
|
system: [
|
|
673
693
|
{
|
|
@@ -705,7 +725,7 @@ async function callClaudeWithMcp({
|
|
|
705
725
|
}
|
|
706
726
|
});
|
|
707
727
|
}
|
|
708
|
-
async function callClaudeWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, onResponse, onError) {
|
|
728
|
+
async function callClaudeWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, fileUrls, onResponse, onError) {
|
|
709
729
|
return callClaudeWithMcp({
|
|
710
730
|
prompt,
|
|
711
731
|
messages,
|
|
@@ -716,13 +736,14 @@ async function callClaudeWithPublicMcp(prompt, service, owner, messages, system,
|
|
|
716
736
|
maxTokens: MAX_TOKENS,
|
|
717
737
|
system,
|
|
718
738
|
extractContent,
|
|
739
|
+
fileUrls,
|
|
719
740
|
mcpServer: {
|
|
720
741
|
name: MCP_NAME,
|
|
721
742
|
url: mcpUrl(),
|
|
722
743
|
authorizationToken: "$ACCESS_TOKEN"
|
|
723
744
|
}});
|
|
724
745
|
}
|
|
725
|
-
async function callOpenAIWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, onResponse, onError) {
|
|
746
|
+
async function callOpenAIWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, fileUrls, onResponse, onError) {
|
|
726
747
|
const resolvedModel = model || DEFAULT_OPENAI_MODEL;
|
|
727
748
|
const imageDetail = getOpenAIImageDetail(resolvedModel);
|
|
728
749
|
const messageList = messages && messages.length ? prepareOpenAIMessages(messages, imageDetail) : [
|
|
@@ -759,6 +780,7 @@ async function callOpenAIWithPublicMcp(prompt, service, owner, messages, system,
|
|
|
759
780
|
model: resolvedModel,
|
|
760
781
|
max_output_tokens: MAX_TOKENS,
|
|
761
782
|
...extractContent && extractContent.length ? { _skapi_extract: extractContent } : {},
|
|
783
|
+
...fileUrls && fileUrls.length ? { _skapi_file_urls: fileUrls } : {},
|
|
762
784
|
input: responseInput,
|
|
763
785
|
tools: [
|
|
764
786
|
{
|
|
@@ -1058,7 +1080,7 @@ function mapHistoryListToMessages(list, platform, opts) {
|
|
|
1058
1080
|
if (serverItemId !== void 0) em._serverItemId = serverItemId;
|
|
1059
1081
|
mapped.push(em);
|
|
1060
1082
|
} else if (assistantText) {
|
|
1061
|
-
var okm = { role: "assistant", content: assistantText };
|
|
1083
|
+
var okm = { role: "assistant", content: sanitizeAttachmentLinksForHistory(assistantText, opts.serviceId, true) };
|
|
1062
1084
|
if (item._isBgTask) okm.isBackgroundTask = true;
|
|
1063
1085
|
if (serverItemId !== void 0) okm._serverItemId = serverItemId;
|
|
1064
1086
|
mapped.push(okm);
|
|
@@ -1124,16 +1146,16 @@ var ChatSession = class {
|
|
|
1124
1146
|
startKeyHistory: this.state.historyStartKeyHistory.slice()
|
|
1125
1147
|
};
|
|
1126
1148
|
}
|
|
1127
|
-
_callProviderFor(platform, prompt, messages, system, model, userId, extractContent) {
|
|
1149
|
+
_callProviderFor(platform, prompt, messages, system, model, userId, extractContent, fileUrls) {
|
|
1128
1150
|
var id = this.host.getIdentity();
|
|
1129
|
-
return platform === "openai" ? callOpenAIWithPublicMcp(prompt, id.serviceId, id.owner, messages, system, model, userId, extractContent) : callClaudeWithPublicMcp(prompt, id.serviceId, id.owner, messages, system, model, userId, extractContent);
|
|
1151
|
+
return platform === "openai" ? callOpenAIWithPublicMcp(prompt, id.serviceId, id.owner, messages, system, model, userId, extractContent, fileUrls) : callClaudeWithPublicMcp(prompt, id.serviceId, id.owner, messages, system, model, userId, extractContent, fileUrls);
|
|
1130
1152
|
}
|
|
1131
1153
|
dispatchAgentRequest(params) {
|
|
1132
1154
|
var self = this;
|
|
1133
1155
|
var dispatchItemId;
|
|
1134
1156
|
var sendAndPoll = function() {
|
|
1135
1157
|
return Promise.resolve(
|
|
1136
|
-
self._callProviderFor(params.aiPlatform, params.text, params.boundedMessages, params.systemPrompt, params.aiModel, params.userId, params.extractContent)
|
|
1158
|
+
self._callProviderFor(params.aiPlatform, params.text, params.boundedMessages, params.systemPrompt, params.aiModel, params.userId, params.extractContent, params.fileUrls)
|
|
1137
1159
|
).then(function(initial) {
|
|
1138
1160
|
if (initial && initial.poll && (initial.status === "pending" || initial.status === "running")) {
|
|
1139
1161
|
if (initial.id) {
|
|
@@ -1194,7 +1216,7 @@ var ChatSession = class {
|
|
|
1194
1216
|
// composed = clean display text; composedForLlm carries office-extraction
|
|
1195
1217
|
// placeholders for the provider only. useBgQueue routes a post-attachment turn
|
|
1196
1218
|
// onto the "-bg" queue so it runs after indexing.
|
|
1197
|
-
dispatchComposedMessage(composed, useBgQueue, composedForLlm, extractContent) {
|
|
1219
|
+
dispatchComposedMessage(composed, useBgQueue, composedForLlm, extractContent, fileUrls) {
|
|
1198
1220
|
var self = this;
|
|
1199
1221
|
if (!composed) return;
|
|
1200
1222
|
var id = this.host.getIdentity();
|
|
@@ -1226,7 +1248,7 @@ var ChatSession = class {
|
|
|
1226
1248
|
this.updateHistoryCache();
|
|
1227
1249
|
this.host.scrollToBottom(true);
|
|
1228
1250
|
var capturedComposed = composed, capturedPlatform = aiPlatform;
|
|
1229
|
-
Promise.resolve(this._callProviderFor(aiPlatform, composed, boundedQ.messages, systemPrompt, aiModel, chatQueue, extractContent)).then(function(result) {
|
|
1251
|
+
Promise.resolve(this._callProviderFor(aiPlatform, composed, boundedQ.messages, systemPrompt, aiModel, chatQueue, extractContent, fileUrls)).then(function(result) {
|
|
1230
1252
|
var sendingIdx = self.state.messages.findIndex(function(m) {
|
|
1231
1253
|
return m.isSendingToServer && (m.isPendingQueued || m.isPendingInProcess) && m.role === "user";
|
|
1232
1254
|
});
|
|
@@ -1286,7 +1308,8 @@ var ChatSession = class {
|
|
|
1286
1308
|
text: composed,
|
|
1287
1309
|
boundedMessages: bounded.messages,
|
|
1288
1310
|
userId: chatQueue,
|
|
1289
|
-
extractContent
|
|
1311
|
+
extractContent,
|
|
1312
|
+
fileUrls
|
|
1290
1313
|
});
|
|
1291
1314
|
Promise.resolve(run).catch(function() {
|
|
1292
1315
|
}).then(function() {
|
|
@@ -1562,7 +1585,7 @@ var ChatSession = class {
|
|
|
1562
1585
|
var MIN_STEP = 1;
|
|
1563
1586
|
var MAX_FRAME_MS = 1e3;
|
|
1564
1587
|
var regions = [], m;
|
|
1565
|
-
var fenceRegex = /```[
|
|
1588
|
+
var fenceRegex = /```[^\n`]+?\.[^\s.`]+\n[\s\S]*?```/g;
|
|
1566
1589
|
while ((m = fenceRegex.exec(fullText)) !== null) regions.push({ start: m.index, end: m.index + m[0].length });
|
|
1567
1590
|
var linkRegex = createInlineLinkRegex();
|
|
1568
1591
|
while ((m = linkRegex.exec(fullText)) !== null) regions.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -2047,6 +2070,8 @@ var ChatSession = class {
|
|
|
2047
2070
|
members.forEach(function(member, idx) {
|
|
2048
2071
|
chain = chain.then(function() {
|
|
2049
2072
|
var hadExists = false;
|
|
2073
|
+
var skipped = false;
|
|
2074
|
+
var existedBefore = false;
|
|
2050
2075
|
var onProg = function(p) {
|
|
2051
2076
|
if (p && p.total) {
|
|
2052
2077
|
att.progress = Math.floor((idx + p.loaded / p.total) / total * 100);
|
|
@@ -2070,21 +2095,33 @@ var ChatSession = class {
|
|
|
2070
2095
|
var isExists = code === "EXISTS" || msg && /exist/i.test(msg);
|
|
2071
2096
|
if (!isExists) throw err;
|
|
2072
2097
|
return self.host.promptOverwrite(member.file.name).then(function(choice) {
|
|
2073
|
-
if (choice === "overwrite")
|
|
2098
|
+
if (choice === "overwrite") {
|
|
2099
|
+
existedBefore = true;
|
|
2100
|
+
return doMemberUpload(false);
|
|
2101
|
+
}
|
|
2102
|
+
if (choice === "skip") {
|
|
2103
|
+
skipped = true;
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
2074
2106
|
hadExists = true;
|
|
2107
|
+
existedBefore = true;
|
|
2075
2108
|
});
|
|
2076
2109
|
}).then(function() {
|
|
2110
|
+
if (skipped) return;
|
|
2077
2111
|
return self.host.getTemporaryUrl(member.storagePath);
|
|
2078
2112
|
}).then(function(url) {
|
|
2113
|
+
if (skipped) return;
|
|
2079
2114
|
urls.push({ name: member.relPath, url, storagePath: member.storagePath });
|
|
2080
2115
|
if (att.kind !== "folder") {
|
|
2081
2116
|
att.uploadedUrl = url;
|
|
2082
2117
|
att.storagePath = member.storagePath;
|
|
2083
2118
|
}
|
|
2084
2119
|
var mime = member.file.type || self.host.getMimeType(member.file.name);
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2120
|
+
var preIndex = existedBefore && typeof self.host.deleteExistingFileRecord === "function" ? Promise.resolve(self.host.deleteExistingFileRecord(member.storagePath)).catch(function() {
|
|
2121
|
+
}) : Promise.resolve();
|
|
2122
|
+
return preIndex.then(function() {
|
|
2123
|
+
return parseAttachmentContent(member.file, member.file.name, mime || void 0);
|
|
2124
|
+
}).then(function(parsedContent) {
|
|
2088
2125
|
return notifyAgentSaveAttachment({
|
|
2089
2126
|
platform: id.platform,
|
|
2090
2127
|
model: id.model,
|
|
@@ -2204,6 +2241,6 @@ var ChatSession = class {
|
|
|
2204
2241
|
}
|
|
2205
2242
|
};
|
|
2206
2243
|
|
|
2207
|
-
export { BG_INDEXING_QUEUE_SUFFIX, 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, HISTORY_TOKEN_BUDGET, LINK_LABEL_MAX_DISPLAY_CHARS, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, clearAttachmentParsers, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, findAttachmentParser, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, isServerExtractable, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, parseAttachmentContent, registerAttachmentParser, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
2244
|
+
export { BG_INDEXING_QUEUE_SUFFIX, 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, HISTORY_TOKEN_BUDGET, LINK_LABEL_MAX_DISPLAY_CHARS, MAX_HISTORY_MESSAGES, MAX_PARSED_CONTENT_CHARS, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, clearAttachmentParsers, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, findAttachmentParser, getAttachmentParsers, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, isServerExtractable, isServiceDbAttachmentHref, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, parseAttachmentContent, registerAttachmentParser, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
2208
2245
|
//# sourceMappingURL=engine.mjs.map
|
|
2209
2246
|
//# sourceMappingURL=engine.mjs.map
|