bunnyquery 1.3.2 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bunnyquery.js +73 -3
- package/dist/engine.cjs +74 -3
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +4 -1
- package/dist/engine.d.ts +4 -1
- package/dist/engine.mjs +74 -4
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/errors.ts +49 -0
- package/src/engine/index.ts +1 -1
- package/src/engine/session.ts +62 -4
package/dist/engine.d.mts
CHANGED
|
@@ -162,6 +162,7 @@ declare function buildIndexingUserMessage(attachment: IndexingAttachmentInfo, op
|
|
|
162
162
|
*/
|
|
163
163
|
declare function getErrorMessage(input: any): string;
|
|
164
164
|
declare function isErrorResponseBody(response: any): boolean;
|
|
165
|
+
declare function isNonRetryableRequestError(input: any): boolean;
|
|
165
166
|
declare function isAuthExpiredError(input: any): boolean;
|
|
166
167
|
|
|
167
168
|
declare var CONTEXT_WINDOW_DEFAULT: Record<string, number>;
|
|
@@ -474,6 +475,8 @@ declare class ChatSession {
|
|
|
474
475
|
private typewriterQueue;
|
|
475
476
|
enqueueTypewrite(idx: number, fullText: string, localId?: string): Promise<any>;
|
|
476
477
|
typewriteLatestReply(key: string): Promise<any>;
|
|
478
|
+
_removeStrayPendingAssistants(): void;
|
|
479
|
+
_clearPendingUserBubble(itemId: string): void;
|
|
477
480
|
resumePendingRequest(token: number): Promise<void>;
|
|
478
481
|
handleHistoryItemResolution(itemId: string, response: any, platform: string): void;
|
|
479
482
|
applyHistoryItemResolution(itemId: string, response: any, platform: string): void;
|
|
@@ -493,4 +496,4 @@ declare class ChatSession {
|
|
|
493
496
|
bumpGate(): void;
|
|
494
497
|
}
|
|
495
498
|
|
|
496
|
-
export { type AttachmentFailureGroup, 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, 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, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isOfficeFile, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
499
|
+
export { type AttachmentFailureGroup, 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, 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, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
package/dist/engine.d.ts
CHANGED
|
@@ -162,6 +162,7 @@ declare function buildIndexingUserMessage(attachment: IndexingAttachmentInfo, op
|
|
|
162
162
|
*/
|
|
163
163
|
declare function getErrorMessage(input: any): string;
|
|
164
164
|
declare function isErrorResponseBody(response: any): boolean;
|
|
165
|
+
declare function isNonRetryableRequestError(input: any): boolean;
|
|
165
166
|
declare function isAuthExpiredError(input: any): boolean;
|
|
166
167
|
|
|
167
168
|
declare var CONTEXT_WINDOW_DEFAULT: Record<string, number>;
|
|
@@ -474,6 +475,8 @@ declare class ChatSession {
|
|
|
474
475
|
private typewriterQueue;
|
|
475
476
|
enqueueTypewrite(idx: number, fullText: string, localId?: string): Promise<any>;
|
|
476
477
|
typewriteLatestReply(key: string): Promise<any>;
|
|
478
|
+
_removeStrayPendingAssistants(): void;
|
|
479
|
+
_clearPendingUserBubble(itemId: string): void;
|
|
477
480
|
resumePendingRequest(token: number): Promise<void>;
|
|
478
481
|
handleHistoryItemResolution(itemId: string, response: any, platform: string): void;
|
|
479
482
|
applyHistoryItemResolution(itemId: string, response: any, platform: string): void;
|
|
@@ -493,4 +496,4 @@ declare class ChatSession {
|
|
|
493
496
|
bumpGate(): void;
|
|
494
497
|
}
|
|
495
498
|
|
|
496
|
-
export { type AttachmentFailureGroup, 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, 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, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isOfficeFile, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
499
|
+
export { type AttachmentFailureGroup, 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, 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, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
package/dist/engine.mjs
CHANGED
|
@@ -193,6 +193,36 @@ function isErrorResponseBody(response) {
|
|
|
193
193
|
}
|
|
194
194
|
return false;
|
|
195
195
|
}
|
|
196
|
+
function isNonRetryableRequestError(input) {
|
|
197
|
+
if (!input || typeof input !== "object") return false;
|
|
198
|
+
var status = typeof input.status_code === "number" ? input.status_code : typeof input.status === "number" ? input.status : void 0;
|
|
199
|
+
var param = void 0;
|
|
200
|
+
var blobs = [];
|
|
201
|
+
var sources = [input.error, input.body && input.body.error, input.body, input];
|
|
202
|
+
for (var i = 0; i < sources.length; i++) {
|
|
203
|
+
var e = sources[i];
|
|
204
|
+
if (!e) continue;
|
|
205
|
+
if (typeof e === "string") {
|
|
206
|
+
blobs.push(e);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (typeof e !== "object") continue;
|
|
210
|
+
if (param === void 0 && e.param != null) param = e.param;
|
|
211
|
+
if (typeof e.code === "string") blobs.push(e.code);
|
|
212
|
+
if (typeof e.type === "string") blobs.push(e.type);
|
|
213
|
+
if (typeof e.message === "string") blobs.push(e.message);
|
|
214
|
+
}
|
|
215
|
+
var hay = blobs.join(" | ").toLowerCase();
|
|
216
|
+
if (hay.indexOf("unknown_parameter") !== -1 || hay.indexOf("unknown parameter") !== -1 || hay.indexOf("unsupported_parameter") !== -1 || hay.indexOf("unsupported parameter") !== -1) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
var isClientReqStatus = status === 400 || status === 422;
|
|
220
|
+
if (isClientReqStatus && param != null && param !== "") return true;
|
|
221
|
+
if (isClientReqStatus && hay.indexOf("invalid_request") !== -1 && (hay.indexOf("parameter") !== -1 || hay.indexOf("param") !== -1)) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
196
226
|
function isAuthExpiredError(input) {
|
|
197
227
|
if (!input) return false;
|
|
198
228
|
var blobs = [];
|
|
@@ -975,10 +1005,10 @@ var ChatSession = class {
|
|
|
975
1005
|
});
|
|
976
1006
|
};
|
|
977
1007
|
var run = sendAndPoll().catch(function(err) {
|
|
978
|
-
if (isAuthExpiredError(err)) return self.host.refreshSession().then(sendAndPoll);
|
|
1008
|
+
if (isAuthExpiredError(err) && !isNonRetryableRequestError(err)) return self.host.refreshSession().then(sendAndPoll);
|
|
979
1009
|
throw err;
|
|
980
1010
|
}).then(function(response) {
|
|
981
|
-
if (isErrorResponseBody(response) && isAuthExpiredError(response)) {
|
|
1011
|
+
if (isErrorResponseBody(response) && isAuthExpiredError(response) && !isNonRetryableRequestError(response)) {
|
|
982
1012
|
return self.host.refreshSession().then(sendAndPoll);
|
|
983
1013
|
}
|
|
984
1014
|
return response;
|
|
@@ -1216,6 +1246,7 @@ var ChatSession = class {
|
|
|
1216
1246
|
this.enqueueTypewrite(aiIdx, answer, lid);
|
|
1217
1247
|
}
|
|
1218
1248
|
}
|
|
1249
|
+
this._removeStrayPendingAssistants();
|
|
1219
1250
|
this.promoteNextQueuedToRunning();
|
|
1220
1251
|
this.updateHistoryCache();
|
|
1221
1252
|
this.host.notify();
|
|
@@ -1258,6 +1289,7 @@ var ChatSession = class {
|
|
|
1258
1289
|
if (thPos2 !== -1) this.state.messages.splice(thPos2, 1);
|
|
1259
1290
|
}
|
|
1260
1291
|
if (serverId) this.cancelledServerIds.delete(serverId);
|
|
1292
|
+
this._removeStrayPendingAssistants();
|
|
1261
1293
|
this.promoteNextQueuedToRunning();
|
|
1262
1294
|
this.updateHistoryCache();
|
|
1263
1295
|
this.host.notify();
|
|
@@ -1271,6 +1303,7 @@ var ChatSession = class {
|
|
|
1271
1303
|
return;
|
|
1272
1304
|
}
|
|
1273
1305
|
this.insertAtTarget({ role: "assistant", content: getErrorMessage(err), isError: true }, targetIdx);
|
|
1306
|
+
this._removeStrayPendingAssistants();
|
|
1274
1307
|
this.promoteNextQueuedToRunning();
|
|
1275
1308
|
this.updateHistoryCache();
|
|
1276
1309
|
this.host.notify();
|
|
@@ -1432,16 +1465,48 @@ var ChatSession = class {
|
|
|
1432
1465
|
if (pendingIdx === -1) return Promise.resolve();
|
|
1433
1466
|
if (latest.isError || !latest.content) {
|
|
1434
1467
|
this.state.messages[pendingIdx] = { role: "assistant", content: latest.content || "", isError: !!latest.isError };
|
|
1468
|
+
this._removeStrayPendingAssistants();
|
|
1435
1469
|
this.host.notify();
|
|
1436
1470
|
this.promoteNextQueuedToRunning();
|
|
1437
1471
|
return Promise.resolve();
|
|
1438
1472
|
}
|
|
1439
1473
|
var lid = this._newLocalId();
|
|
1440
1474
|
this.state.messages[pendingIdx] = { role: "assistant", content: "", isPending: false, _localId: lid };
|
|
1475
|
+
this._removeStrayPendingAssistants();
|
|
1441
1476
|
this.host.notify();
|
|
1442
1477
|
this.promoteNextQueuedToRunning();
|
|
1443
1478
|
return this.enqueueTypewrite(pendingIdx, latest.content, lid);
|
|
1444
1479
|
}
|
|
1480
|
+
// Remove any leftover non-background pending ("Thinking…") assistant bubbles.
|
|
1481
|
+
// There is normally at most ONE such bubble at a time (promoteNext* refuses to
|
|
1482
|
+
// add a second), so any extra is a duplicate — it appears when a concurrent
|
|
1483
|
+
// history refetch re-maps the still-"running" turn into a pending placeholder
|
|
1484
|
+
// (with a real _serverItemId) while the local pending bubble (no _serverItemId)
|
|
1485
|
+
// is rescued and re-appended (see loadHistory rescue below). Each resolve path
|
|
1486
|
+
// only replaces the FIRST pending bubble, so without this a stray "Thinking…"
|
|
1487
|
+
// survives next to the reply/error. MUST run AFTER the resolved bubble has been
|
|
1488
|
+
// made non-pending and BEFORE promoteNext*() (so a freshly-promoted Thinking,
|
|
1489
|
+
// which is added only once no pending assistant remains, is preserved).
|
|
1490
|
+
_removeStrayPendingAssistants() {
|
|
1491
|
+
for (var k = this.state.messages.length - 1; k >= 0; k--) {
|
|
1492
|
+
var m = this.state.messages[k];
|
|
1493
|
+
if (m.isPending && m.role === "assistant" && !m.isBackgroundTask) this.state.messages.splice(k, 1);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
// Drop the pending flags on the resolved turn's USER bubble (preserving its
|
|
1497
|
+
// content + background-task marker). Needed because a bg "Indexing:" turn's user
|
|
1498
|
+
// bubble carries isPendingInProcess; leaving it set keeps the bubble visually
|
|
1499
|
+
// stuck and keeps its bgTaskQueue entry alive forever.
|
|
1500
|
+
_clearPendingUserBubble(itemId) {
|
|
1501
|
+
var uIdx = this.state.messages.findIndex(function(m) {
|
|
1502
|
+
return m.role === "user" && m._serverItemId === itemId && (m.isPendingInProcess || m.isPendingQueued || m.isSendingToServer);
|
|
1503
|
+
});
|
|
1504
|
+
if (uIdx === -1) return;
|
|
1505
|
+
var u = this.state.messages[uIdx];
|
|
1506
|
+
var cleaned = { role: "user", content: u.content, _serverItemId: itemId };
|
|
1507
|
+
if (u.isBackgroundTask) cleaned.isBackgroundTask = true;
|
|
1508
|
+
this.state.messages[uIdx] = cleaned;
|
|
1509
|
+
}
|
|
1445
1510
|
// If an immediate-send request for the current cache key is still in flight
|
|
1446
1511
|
// (e.g. the view unmounted then remounted mid-request), show the sending
|
|
1447
1512
|
// state, await it, then render the reply from the cache. Skipped when the
|
|
@@ -1480,6 +1545,7 @@ var ChatSession = class {
|
|
|
1480
1545
|
return m.isPending && m._serverItemId === itemId;
|
|
1481
1546
|
});
|
|
1482
1547
|
if (idx !== -1) {
|
|
1548
|
+
this._clearPendingUserBubble(itemId);
|
|
1483
1549
|
if (isErr) {
|
|
1484
1550
|
this.state.messages[idx] = { role: "assistant", content: answer, isError: true, _serverItemId: itemId };
|
|
1485
1551
|
this.host.notify();
|
|
@@ -1596,7 +1662,7 @@ var ChatSession = class {
|
|
|
1596
1662
|
return getChatHistory({ service: serviceId, owner, platform }, options);
|
|
1597
1663
|
};
|
|
1598
1664
|
return Promise.resolve().then(fetchHistory).catch(function(err) {
|
|
1599
|
-
if (isAuthExpiredError(err)) return self.host.refreshSession().then(fetchHistory);
|
|
1665
|
+
if (isAuthExpiredError(err) && !isNonRetryableRequestError(err)) return self.host.refreshSession().then(fetchHistory);
|
|
1600
1666
|
throw err;
|
|
1601
1667
|
}).then(function(history) {
|
|
1602
1668
|
if (token !== self.state.gateRefreshToken) return;
|
|
@@ -1629,12 +1695,16 @@ var ChatSession = class {
|
|
|
1629
1695
|
self.state.messages.forEach(function(m) {
|
|
1630
1696
|
if (m.isCancelled && m._serverItemId) locallyCancelled[m._serverItemId] = 1;
|
|
1631
1697
|
});
|
|
1698
|
+
var mappedHasPendingAssistant = mapped.some(function(m) {
|
|
1699
|
+
return m.isPending && m.role === "assistant" && !m.isBackgroundTask;
|
|
1700
|
+
});
|
|
1632
1701
|
var rescued = [];
|
|
1633
1702
|
for (var ri = 0; ri < self.state.messages.length; ri++) {
|
|
1634
1703
|
var mm = self.state.messages[ri];
|
|
1635
1704
|
if (mm.isBackgroundTask) continue;
|
|
1636
1705
|
if (mm._serverItemId && serverIds[mm._serverItemId]) continue;
|
|
1637
1706
|
if (!mm._serverItemId) {
|
|
1707
|
+
if (mappedHasPendingAssistant) continue;
|
|
1638
1708
|
if (mm.isSendingToServer || mm.isPendingQueued || mm.isPendingInProcess || mm.isPending) rescued.push(mm);
|
|
1639
1709
|
else if (self.state.sending && mm.role === "user") {
|
|
1640
1710
|
var next = self.state.messages[ri + 1];
|
|
@@ -1909,6 +1979,6 @@ var ChatSession = class {
|
|
|
1909
1979
|
}
|
|
1910
1980
|
};
|
|
1911
1981
|
|
|
1912
|
-
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, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isOfficeFile, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
1982
|
+
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, MCP_NAME, MIN_INPUT_TOKEN_BUDGET, OUTPUT_TOKEN_RESERVE, POLL_INTERVAL, TOOL_AND_RESPONSE_BUFFER, buildBoundedChatMessages, buildChatSystemPrompt, buildDisplayExpiredAttachmentHref, buildIndexingSystemPrompt, buildIndexingUserMessage, callClaudeWithMcp, callClaudeWithPublicMcp, callOpenAIWithPublicMcp, chatEngineConfig, composeUserMessage, configureChatEngine, createInlineLinkRegex, encodePathSegments, estimateMessageTokens, estimateTextTokens, extractClaudeText, extractLastUserTextFromRequest, extractOpenAIText, extractRemotePathFromAttachmentHref, filterListByClearHorizon, getChatHistory, getContextWindow, getErrorMessage, getExpiredAttachmentVisiblePath, groupAttachmentFailures, isAuthExpiredError, isErrorResponseBody, isNonRetryableRequestError, isOfficeFile, listClaudeModels, listOpenAIModels, makeExtractPlaceholder, mapHistoryListToMessages, normalizeAttachmentPathCandidate, normalizeTextContent, notifyAgentSaveAttachment, safeDecodeURIComponent, sanitizeAttachmentLinksForHistory, stripFileBlocksFromHistory, transformContentWithImages, transformContentWithOpenAIImages, truncateLabelForDisplay };
|
|
1913
1983
|
//# sourceMappingURL=engine.mjs.map
|
|
1914
1984
|
//# sourceMappingURL=engine.mjs.map
|