bunnyquery 1.4.4 → 1.4.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 +11 -1
- package/dist/engine.cjs +10 -0
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.mjs +10 -0
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/session.ts +18 -0
package/bunnyquery.js
CHANGED
|
@@ -1090,11 +1090,17 @@ ${options.inlineContentPlaceholder}
|
|
|
1090
1090
|
}
|
|
1091
1091
|
dispatchAgentRequest(params) {
|
|
1092
1092
|
var self = this;
|
|
1093
|
+
var dispatchItemId;
|
|
1093
1094
|
var sendAndPoll = function() {
|
|
1094
1095
|
return Promise.resolve(
|
|
1095
1096
|
self._callProviderFor(params.aiPlatform, params.text, params.boundedMessages, params.systemPrompt, params.aiModel, params.userId, params.extractContent)
|
|
1096
1097
|
).then(function(initial) {
|
|
1097
1098
|
if (initial && initial.poll && (initial.status === "pending" || initial.status === "running")) {
|
|
1099
|
+
if (initial.id) {
|
|
1100
|
+
if (dispatchItemId && dispatchItemId !== initial.id) self.historyItemPolls.delete(dispatchItemId);
|
|
1101
|
+
dispatchItemId = initial.id;
|
|
1102
|
+
self.historyItemPolls.set(initial.id, true);
|
|
1103
|
+
}
|
|
1098
1104
|
return initial.poll({ latency: POLL_INTERVAL });
|
|
1099
1105
|
}
|
|
1100
1106
|
return initial;
|
|
@@ -1117,6 +1123,7 @@ ${options.inlineContentPlaceholder}
|
|
|
1117
1123
|
return { content: getErrorMessage(err), isError: true };
|
|
1118
1124
|
}).then(function(result) {
|
|
1119
1125
|
delete self.pendingAgentRequests[params.key];
|
|
1126
|
+
if (dispatchItemId) self.historyItemPolls.delete(dispatchItemId);
|
|
1120
1127
|
var existing = self.aiChatHistoryCache[params.key] || { messages: [], endOfList: false, startKeyHistory: [] };
|
|
1121
1128
|
var reply = { role: "assistant", content: result.content, isError: result.isError };
|
|
1122
1129
|
var onThisVisibleChat = self.host.isViewMounted() && self.getHistoryCacheKey() === params.key;
|
|
@@ -1200,6 +1207,7 @@ ${options.inlineContentPlaceholder}
|
|
|
1200
1207
|
self.host.notify();
|
|
1201
1208
|
}
|
|
1202
1209
|
if (result && result.poll && (result.status === "pending" || result.status === "running")) {
|
|
1210
|
+
if (serverId) self.historyItemPolls.set(serverId, true);
|
|
1203
1211
|
return result.poll({ latency: POLL_INTERVAL }).then(function(res) {
|
|
1204
1212
|
return self.onQueuedSendResponse(capturedComposed, res, capturedPlatform, serverId);
|
|
1205
1213
|
}).catch(function(err) {
|
|
@@ -1339,6 +1347,7 @@ ${options.inlineContentPlaceholder}
|
|
|
1339
1347
|
else this.state.messages.push(msg);
|
|
1340
1348
|
}
|
|
1341
1349
|
onQueuedSendResponse(_composed, response, platform, serverId) {
|
|
1350
|
+
if (serverId) this.historyItemPolls.delete(serverId);
|
|
1342
1351
|
var targetIdx = this.resolveQueuedUserBubble(serverId);
|
|
1343
1352
|
if (targetIdx === void 0) {
|
|
1344
1353
|
this.host.notify();
|
|
@@ -1373,6 +1382,7 @@ ${options.inlineContentPlaceholder}
|
|
|
1373
1382
|
this.host.scrollToBottom(true);
|
|
1374
1383
|
}
|
|
1375
1384
|
onQueuedSendError(_composed, err, serverId) {
|
|
1385
|
+
if (serverId) this.historyItemPolls.delete(serverId);
|
|
1376
1386
|
var isNotExists = err && (err.code === "NOT_EXISTS" || err.body && err.body.code === "NOT_EXISTS");
|
|
1377
1387
|
if (isNotExists) {
|
|
1378
1388
|
var userIdx = serverId ? this.state.messages.findIndex(function(m) {
|
|
@@ -2108,7 +2118,7 @@ ${options.inlineContentPlaceholder}
|
|
|
2108
2118
|
(function() {
|
|
2109
2119
|
var MCP_PROD = "https://mcp.broadwayinc.computer";
|
|
2110
2120
|
var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
|
|
2111
|
-
var BQ_VERSION = "1.4.
|
|
2121
|
+
var BQ_VERSION = "1.4.5" ;
|
|
2112
2122
|
var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
|
|
2113
2123
|
var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
2114
2124
|
var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
package/dist/engine.cjs
CHANGED
|
@@ -1124,11 +1124,17 @@ var ChatSession = class {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
dispatchAgentRequest(params) {
|
|
1126
1126
|
var self = this;
|
|
1127
|
+
var dispatchItemId;
|
|
1127
1128
|
var sendAndPoll = function() {
|
|
1128
1129
|
return Promise.resolve(
|
|
1129
1130
|
self._callProviderFor(params.aiPlatform, params.text, params.boundedMessages, params.systemPrompt, params.aiModel, params.userId, params.extractContent)
|
|
1130
1131
|
).then(function(initial) {
|
|
1131
1132
|
if (initial && initial.poll && (initial.status === "pending" || initial.status === "running")) {
|
|
1133
|
+
if (initial.id) {
|
|
1134
|
+
if (dispatchItemId && dispatchItemId !== initial.id) self.historyItemPolls.delete(dispatchItemId);
|
|
1135
|
+
dispatchItemId = initial.id;
|
|
1136
|
+
self.historyItemPolls.set(initial.id, true);
|
|
1137
|
+
}
|
|
1132
1138
|
return initial.poll({ latency: POLL_INTERVAL });
|
|
1133
1139
|
}
|
|
1134
1140
|
return initial;
|
|
@@ -1151,6 +1157,7 @@ var ChatSession = class {
|
|
|
1151
1157
|
return { content: getErrorMessage(err), isError: true };
|
|
1152
1158
|
}).then(function(result) {
|
|
1153
1159
|
delete self.pendingAgentRequests[params.key];
|
|
1160
|
+
if (dispatchItemId) self.historyItemPolls.delete(dispatchItemId);
|
|
1154
1161
|
var existing = self.aiChatHistoryCache[params.key] || { messages: [], endOfList: false, startKeyHistory: [] };
|
|
1155
1162
|
var reply = { role: "assistant", content: result.content, isError: result.isError };
|
|
1156
1163
|
var onThisVisibleChat = self.host.isViewMounted() && self.getHistoryCacheKey() === params.key;
|
|
@@ -1234,6 +1241,7 @@ var ChatSession = class {
|
|
|
1234
1241
|
self.host.notify();
|
|
1235
1242
|
}
|
|
1236
1243
|
if (result && result.poll && (result.status === "pending" || result.status === "running")) {
|
|
1244
|
+
if (serverId) self.historyItemPolls.set(serverId, true);
|
|
1237
1245
|
return result.poll({ latency: POLL_INTERVAL }).then(function(res) {
|
|
1238
1246
|
return self.onQueuedSendResponse(capturedComposed, res, capturedPlatform, serverId);
|
|
1239
1247
|
}).catch(function(err) {
|
|
@@ -1373,6 +1381,7 @@ var ChatSession = class {
|
|
|
1373
1381
|
else this.state.messages.push(msg);
|
|
1374
1382
|
}
|
|
1375
1383
|
onQueuedSendResponse(_composed, response, platform, serverId) {
|
|
1384
|
+
if (serverId) this.historyItemPolls.delete(serverId);
|
|
1376
1385
|
var targetIdx = this.resolveQueuedUserBubble(serverId);
|
|
1377
1386
|
if (targetIdx === void 0) {
|
|
1378
1387
|
this.host.notify();
|
|
@@ -1407,6 +1416,7 @@ var ChatSession = class {
|
|
|
1407
1416
|
this.host.scrollToBottom(true);
|
|
1408
1417
|
}
|
|
1409
1418
|
onQueuedSendError(_composed, err, serverId) {
|
|
1419
|
+
if (serverId) this.historyItemPolls.delete(serverId);
|
|
1410
1420
|
var isNotExists = err && (err.code === "NOT_EXISTS" || err.body && err.body.code === "NOT_EXISTS");
|
|
1411
1421
|
if (isNotExists) {
|
|
1412
1422
|
var userIdx = serverId ? this.state.messages.findIndex(function(m) {
|