bunnyquery 1.21.3 → 1.21.4

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 CHANGED
@@ -3020,6 +3020,57 @@ Index the REMAINING windows - one record per row/item, looking at any page image
3020
3020
  return `[POST]${url.toLowerCase()}#${service}:${itemId}`;
3021
3021
  }
3022
3022
 
3023
+ // src/engine/time.ts
3024
+ function wallClockNow() {
3025
+ return Date.now();
3026
+ }
3027
+ function formatChatTimestamp(ms) {
3028
+ if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
3029
+ try {
3030
+ return new Date(ms).toLocaleString(void 0, {
3031
+ year: "numeric",
3032
+ month: "short",
3033
+ day: "numeric",
3034
+ hour: "numeric",
3035
+ minute: "2-digit",
3036
+ second: "2-digit"
3037
+ });
3038
+ } catch (e) {
3039
+ return "";
3040
+ }
3041
+ }
3042
+ function formatDuration(ms) {
3043
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
3044
+ var total = Math.floor(ms / 1e3);
3045
+ var h = Math.floor(total / 3600);
3046
+ var m = Math.floor(total % 3600 / 60);
3047
+ var s = total % 60;
3048
+ var out = [];
3049
+ if (h) out.push(h + "h");
3050
+ if (m) out.push(m + "m");
3051
+ out.push(s + "s");
3052
+ return out.join(" ");
3053
+ }
3054
+ function requestIdTimeMs(rid) {
3055
+ if (typeof rid !== "string") return 0;
3056
+ var stamp = rid.split(":")[0] || "";
3057
+ if (stamp.length !== 13) return 0;
3058
+ var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
3059
+ var v = 0;
3060
+ for (var i = 0; i < stamp.length; i++) {
3061
+ var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
3062
+ if (d < 0) return 0;
3063
+ v = v * 32 + d;
3064
+ }
3065
+ return Math.floor(v / 2 / 1e6);
3066
+ }
3067
+ function messageTimeMs(m) {
3068
+ if (!m) return 0;
3069
+ var r = typeof m._serverItemId === "string" ? requestIdTimeMs(m._serverItemId) : 0;
3070
+ if (r > 0) return r;
3071
+ return typeof m._ts === "number" && m._ts > 0 ? m._ts : 0;
3072
+ }
3073
+
3023
3074
  // src/engine/indexing_groups.ts
3024
3075
  function canonIndexKey(s) {
3025
3076
  return typeof s === "string" && s ? s.trim() : "";
@@ -3130,8 +3181,9 @@ Index the REMAINING windows - one record per row/item, looking at any page image
3130
3181
  var alreadySeen = !!(msg._serverItemId && runByItemId[msg._serverItemId]);
3131
3182
  var openId = openRunOfKey[key];
3132
3183
  var notLater = false;
3133
- if (openId && typeof msg._ts === "number" && typeof newestTsOfRun[openId] === "number") {
3134
- notLater = msg._ts <= newestTsOfRun[openId];
3184
+ var msgTime = messageTimeMs(msg);
3185
+ if (openId && msgTime > 0 && typeof newestTsOfRun[openId] === "number") {
3186
+ notLater = msgTime <= newestTsOfRun[openId];
3135
3187
  }
3136
3188
  if (!ref.continued && !alreadySeen && !notLater && openRunOfKey[key]) delete openRunOfKey[key];
3137
3189
  runId = openRunOfKey[key];
@@ -3145,9 +3197,10 @@ Index the REMAINING windows - one record per row/item, looking at any page image
3145
3197
  runId = runOfIndex[i - 1];
3146
3198
  }
3147
3199
  if (!runId) continue;
3148
- if (typeof msg._ts === "number") {
3200
+ var memberTime = messageTimeMs(msg);
3201
+ if (memberTime > 0) {
3149
3202
  var prevTs = newestTsOfRun[runId];
3150
- if (typeof prevTs !== "number" || msg._ts > prevTs) newestTsOfRun[runId] = msg._ts;
3203
+ if (typeof prevTs !== "number" || memberTime > prevTs) newestTsOfRun[runId] = memberTime;
3151
3204
  }
3152
3205
  var g = groups[runId];
3153
3206
  if (!g) {
@@ -4052,38 +4105,6 @@ Index the REMAINING windows - one record per row/item, looking at any page image
4052
4105
  return closest.call(img, PREVIEW_LAYOUT_BOX_SELECTOR) || img;
4053
4106
  }
4054
4107
 
4055
- // src/engine/time.ts
4056
- function wallClockNow() {
4057
- return Date.now();
4058
- }
4059
- function formatChatTimestamp(ms) {
4060
- if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
4061
- try {
4062
- return new Date(ms).toLocaleString(void 0, {
4063
- year: "numeric",
4064
- month: "short",
4065
- day: "numeric",
4066
- hour: "numeric",
4067
- minute: "2-digit",
4068
- second: "2-digit"
4069
- });
4070
- } catch (e) {
4071
- return "";
4072
- }
4073
- }
4074
- function formatDuration(ms) {
4075
- if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
4076
- var total = Math.floor(ms / 1e3);
4077
- var h = Math.floor(total / 3600);
4078
- var m = Math.floor(total % 3600 / 60);
4079
- var s = total % 60;
4080
- var out = [];
4081
- if (h) out.push(h + "h");
4082
- if (m) out.push(m + "m");
4083
- out.push(s + "s");
4084
- return out.join(" ");
4085
- }
4086
-
4087
4108
  // src/engine/ai_agent.ts
4088
4109
  function normalizePlatform(raw) {
4089
4110
  var p = (raw || "").trim().toLowerCase();
@@ -5647,19 +5668,6 @@ Index the REMAINING windows - one record per row/item, looking at any page image
5647
5668
  }
5648
5669
  var LIVE_PAINT_MIN_MS = 250;
5649
5670
  var LIVE_TYPE_MAX_STEP = 1200;
5650
- function requestIdTimeMs(rid) {
5651
- if (typeof rid !== "string") return 0;
5652
- var stamp = rid.split(":")[0] || "";
5653
- if (stamp.length !== 13) return 0;
5654
- var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
5655
- var v = 0;
5656
- for (var i = 0; i < stamp.length; i++) {
5657
- var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
5658
- if (d < 0) return 0;
5659
- v = v * 32 + d;
5660
- }
5661
- return Math.floor(v / 2 / 1e6);
5662
- }
5663
5671
  var WRONG_ANSWER_MESSAGE = "This answer seems wrong. Please check it again against the documents.";
5664
5672
  var WRONG_ANSWER_LABEL = "Wrong answer?";
5665
5673
  function canReportWrongAnswer(msg) {
@@ -11587,15 +11595,18 @@ Index the REMAINING windows - one record per row/item, looking at any page image
11587
11595
  self.updateHistoryCache();
11588
11596
  });
11589
11597
  }
11590
- /** Insert bubbles before the first message that is newer than them (by `_ts`); messages
11591
- * without a time are skipped over, and the end of the list takes them otherwise. */
11598
+ /** Insert bubbles before the first message that is newer than them; messages whose time
11599
+ * is unknown are skipped over, and the end of the list takes them otherwise. A message's
11600
+ * time is its `_ts`, else (2026-11-25) the time in its request id: a live worker pass
11601
+ * adopted from the queue carries no `_ts`, and a file's older passes loaded by opening its
11602
+ * row (loadRunPasses) used to land AFTER it, which split one run into two rows. */
11592
11603
  _insertByTime(bubbles) {
11593
- var at = bubbles[0] && bubbles[0]._ts;
11604
+ var at = messageTimeMs(bubbles[0]);
11594
11605
  var idx = this.state.messages.length;
11595
- if (typeof at === "number") {
11606
+ if (at > 0) {
11596
11607
  for (var i = 0; i < this.state.messages.length; i++) {
11597
- var t = this.state.messages[i] && this.state.messages[i]._ts;
11598
- if (typeof t === "number" && t > at) {
11608
+ var t = messageTimeMs(this.state.messages[i]);
11609
+ if (t > 0 && t > at) {
11599
11610
  idx = i;
11600
11611
  break;
11601
11612
  }
@@ -13159,7 +13170,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
13159
13170
  (function() {
13160
13171
  var MCP_PROD = "https://mcp.skapi.com";
13161
13172
  var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
13162
- var BQ_VERSION = "1.21.3" ;
13173
+ var BQ_VERSION = "1.21.4" ;
13163
13174
  var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
13164
13175
  var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
13165
13176
  var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
package/dist/engine.cjs CHANGED
@@ -3172,6 +3172,57 @@ function buildHistoryItemFullId(platform, service, itemId) {
3172
3172
  return `[POST]${url.toLowerCase()}#${service}:${itemId}`;
3173
3173
  }
3174
3174
 
3175
+ // src/engine/time.ts
3176
+ function wallClockNow() {
3177
+ return Date.now();
3178
+ }
3179
+ function formatChatTimestamp(ms) {
3180
+ if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
3181
+ try {
3182
+ return new Date(ms).toLocaleString(void 0, {
3183
+ year: "numeric",
3184
+ month: "short",
3185
+ day: "numeric",
3186
+ hour: "numeric",
3187
+ minute: "2-digit",
3188
+ second: "2-digit"
3189
+ });
3190
+ } catch (e) {
3191
+ return "";
3192
+ }
3193
+ }
3194
+ function formatDuration(ms) {
3195
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
3196
+ var total = Math.floor(ms / 1e3);
3197
+ var h = Math.floor(total / 3600);
3198
+ var m = Math.floor(total % 3600 / 60);
3199
+ var s = total % 60;
3200
+ var out = [];
3201
+ if (h) out.push(h + "h");
3202
+ if (m) out.push(m + "m");
3203
+ out.push(s + "s");
3204
+ return out.join(" ");
3205
+ }
3206
+ function requestIdTimeMs(rid) {
3207
+ if (typeof rid !== "string") return 0;
3208
+ var stamp = rid.split(":")[0] || "";
3209
+ if (stamp.length !== 13) return 0;
3210
+ var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
3211
+ var v = 0;
3212
+ for (var i = 0; i < stamp.length; i++) {
3213
+ var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
3214
+ if (d < 0) return 0;
3215
+ v = v * 32 + d;
3216
+ }
3217
+ return Math.floor(v / 2 / 1e6);
3218
+ }
3219
+ function messageTimeMs(m) {
3220
+ if (!m) return 0;
3221
+ var r = typeof m._serverItemId === "string" ? requestIdTimeMs(m._serverItemId) : 0;
3222
+ if (r > 0) return r;
3223
+ return typeof m._ts === "number" && m._ts > 0 ? m._ts : 0;
3224
+ }
3225
+
3175
3226
  // src/engine/indexing_groups.ts
3176
3227
  function canonIndexKey(s) {
3177
3228
  return typeof s === "string" && s ? s.trim() : "";
@@ -3282,8 +3333,9 @@ function buildChatDisplayList(messages, opts) {
3282
3333
  var alreadySeen = !!(msg._serverItemId && runByItemId[msg._serverItemId]);
3283
3334
  var openId = openRunOfKey[key];
3284
3335
  var notLater = false;
3285
- if (openId && typeof msg._ts === "number" && typeof newestTsOfRun[openId] === "number") {
3286
- notLater = msg._ts <= newestTsOfRun[openId];
3336
+ var msgTime = messageTimeMs(msg);
3337
+ if (openId && msgTime > 0 && typeof newestTsOfRun[openId] === "number") {
3338
+ notLater = msgTime <= newestTsOfRun[openId];
3287
3339
  }
3288
3340
  if (!ref.continued && !alreadySeen && !notLater && openRunOfKey[key]) delete openRunOfKey[key];
3289
3341
  runId = openRunOfKey[key];
@@ -3297,9 +3349,10 @@ function buildChatDisplayList(messages, opts) {
3297
3349
  runId = runOfIndex[i - 1];
3298
3350
  }
3299
3351
  if (!runId) continue;
3300
- if (typeof msg._ts === "number") {
3352
+ var memberTime = messageTimeMs(msg);
3353
+ if (memberTime > 0) {
3301
3354
  var prevTs = newestTsOfRun[runId];
3302
- if (typeof prevTs !== "number" || msg._ts > prevTs) newestTsOfRun[runId] = msg._ts;
3355
+ if (typeof prevTs !== "number" || memberTime > prevTs) newestTsOfRun[runId] = memberTime;
3303
3356
  }
3304
3357
  var g = groups[runId];
3305
3358
  if (!g) {
@@ -4213,38 +4266,6 @@ function previewLayoutBox(img) {
4213
4266
  return closest.call(img, PREVIEW_LAYOUT_BOX_SELECTOR) || img;
4214
4267
  }
4215
4268
 
4216
- // src/engine/time.ts
4217
- function wallClockNow() {
4218
- return Date.now();
4219
- }
4220
- function formatChatTimestamp(ms) {
4221
- if (typeof ms !== "number" || !isFinite(ms) || ms <= 0) return "";
4222
- try {
4223
- return new Date(ms).toLocaleString(void 0, {
4224
- year: "numeric",
4225
- month: "short",
4226
- day: "numeric",
4227
- hour: "numeric",
4228
- minute: "2-digit",
4229
- second: "2-digit"
4230
- });
4231
- } catch (e) {
4232
- return "";
4233
- }
4234
- }
4235
- function formatDuration(ms) {
4236
- if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
4237
- var total = Math.floor(ms / 1e3);
4238
- var h = Math.floor(total / 3600);
4239
- var m = Math.floor(total % 3600 / 60);
4240
- var s = total % 60;
4241
- var out = [];
4242
- if (h) out.push(h + "h");
4243
- if (m) out.push(m + "m");
4244
- out.push(s + "s");
4245
- return out.join(" ");
4246
- }
4247
-
4248
4269
  // src/engine/ai_agent.ts
4249
4270
  function normalizePlatform(raw) {
4250
4271
  var p = (raw || "").trim().toLowerCase();
@@ -5826,19 +5847,6 @@ function streamRecoveryLabels(phase) {
5826
5847
  }
5827
5848
  var LIVE_PAINT_MIN_MS = 250;
5828
5849
  var LIVE_TYPE_MAX_STEP = 1200;
5829
- function requestIdTimeMs(rid) {
5830
- if (typeof rid !== "string") return 0;
5831
- var stamp = rid.split(":")[0] || "";
5832
- if (stamp.length !== 13) return 0;
5833
- var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
5834
- var v = 0;
5835
- for (var i = 0; i < stamp.length; i++) {
5836
- var d = alphabet.indexOf(stamp.charAt(i).toUpperCase());
5837
- if (d < 0) return 0;
5838
- v = v * 32 + d;
5839
- }
5840
- return Math.floor(v / 2 / 1e6);
5841
- }
5842
5850
  var WRONG_ANSWER_MESSAGE = "This answer seems wrong. Please check it again against the documents.";
5843
5851
  var WRONG_ANSWER_LABEL = "Wrong answer?";
5844
5852
  function canReportWrongAnswer(msg) {
@@ -11766,15 +11774,18 @@ var _ChatSession = class _ChatSession {
11766
11774
  self.updateHistoryCache();
11767
11775
  });
11768
11776
  }
11769
- /** Insert bubbles before the first message that is newer than them (by `_ts`); messages
11770
- * without a time are skipped over, and the end of the list takes them otherwise. */
11777
+ /** Insert bubbles before the first message that is newer than them; messages whose time
11778
+ * is unknown are skipped over, and the end of the list takes them otherwise. A message's
11779
+ * time is its `_ts`, else (2026-11-25) the time in its request id: a live worker pass
11780
+ * adopted from the queue carries no `_ts`, and a file's older passes loaded by opening its
11781
+ * row (loadRunPasses) used to land AFTER it, which split one run into two rows. */
11771
11782
  _insertByTime(bubbles) {
11772
- var at = bubbles[0] && bubbles[0]._ts;
11783
+ var at = messageTimeMs(bubbles[0]);
11773
11784
  var idx = this.state.messages.length;
11774
- if (typeof at === "number") {
11785
+ if (at > 0) {
11775
11786
  for (var i = 0; i < this.state.messages.length; i++) {
11776
- var t = this.state.messages[i] && this.state.messages[i]._ts;
11777
- if (typeof t === "number" && t > at) {
11787
+ var t = messageTimeMs(this.state.messages[i]);
11788
+ if (t > 0 && t > at) {
11778
11789
  idx = i;
11779
11790
  break;
11780
11791
  }
@@ -13548,6 +13559,7 @@ exports.makeExtractPlaceholder = makeExtractPlaceholder;
13548
13559
  exports.mapHistoryListToMessages = mapHistoryListToMessages;
13549
13560
  exports.markImagePreviewStale = markImagePreviewStale;
13550
13561
  exports.mayKeepStreamedAnswer = mayKeepStreamedAnswer;
13562
+ exports.messageTimeMs = messageTimeMs;
13551
13563
  exports.mintCacheBustStamp = mintCacheBustStamp;
13552
13564
  exports.needsBomForExt = needsBomForExt;
13553
13565
  exports.newClientRef = newClientRef;
@@ -13593,6 +13605,7 @@ exports.registerModelContextWindows = registerModelContextWindows;
13593
13605
  exports.renderInlineLinkHtml = renderInlineLinkHtml;
13594
13606
  exports.repairUrlEntities = repairUrlEntities;
13595
13607
  exports.repairUrlWhitespace = repairUrlWhitespace;
13608
+ exports.requestIdTimeMs = requestIdTimeMs;
13596
13609
  exports.resetFileIndexOnServer = resetFileIndexOnServer;
13597
13610
  exports.resolveAnswerMode = resolveAnswerMode;
13598
13611
  exports.resolveImagePreviewUrl = resolveImagePreviewUrl;