bunnyquery 1.10.5 → 1.10.7

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
@@ -1487,6 +1487,18 @@ Index the REMAINING windows - one record per row/item, looking at any page image
1487
1487
  return "";
1488
1488
  }
1489
1489
  }
1490
+ function formatDuration(ms) {
1491
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
1492
+ var total = Math.floor(ms / 1e3);
1493
+ var h = Math.floor(total / 3600);
1494
+ var m = Math.floor(total % 3600 / 60);
1495
+ var s = total % 60;
1496
+ var out = [];
1497
+ if (h) out.push(h + "h");
1498
+ if (m) out.push(m + "m");
1499
+ out.push(s + "s");
1500
+ return out.join(" ");
1501
+ }
1490
1502
 
1491
1503
  // src/engine/ai_agent.ts
1492
1504
  function normalizePlatform(raw) {
@@ -3037,6 +3049,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
3037
3049
  var serverItemId = item && typeof item.id === "string" && item.id ? item.id : void 0;
3038
3050
  var createdTs = Number(item && item.created);
3039
3051
  var updatedTs = Number(item && item.updated);
3052
+ var executedTs = Number(item && item.executed);
3040
3053
  var userTs = isFinite(createdTs) && createdTs > 0 ? createdTs : isFinite(updatedTs) && updatedTs > 0 ? updatedTs : void 0;
3041
3054
  var replyTs = isFinite(updatedTs) && updatedTs > 0 ? updatedTs : isFinite(createdTs) && createdTs > 0 ? createdTs : void 0;
3042
3055
  if (userText) {
@@ -3105,6 +3118,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
3105
3118
  if (isCompact) okm._compact = true;
3106
3119
  if (serverItemId !== void 0) okm._serverItemId = serverItemId;
3107
3120
  if (replyTs !== void 0) okm._ts = replyTs;
3121
+ if (indexFile && isFinite(executedTs) && executedTs > 0) okm._tsStart = executedTs;
3108
3122
  if (reportedComplete) okm._indexComplete = true;
3109
3123
  mapped.push(okm);
3110
3124
  }
@@ -3499,6 +3513,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
3499
3513
  var LIVE_INDEX_SNAPSHOT_MAX_AGE_MS = 5e3;
3500
3514
  var INDEX_DISPATCH_CLAIM_MS = 2 * 60 * 1e3;
3501
3515
  var WORKER_PASS_ADOPT_ATTEMPTS = [0, 2e3, 6e3];
3516
+ var RECENT_INDEX_PASS_EVIDENCE_MS = 10 * 60 * 1e3;
3502
3517
  var EARLY_PROBE_SCHEDULE_MS = [400, 900, 1700];
3503
3518
  var INDEXING_DRAIN_BUSY_POLL_MS = 8e3;
3504
3519
  var INDEXING_DRAIN_CONFIRM_POLL_MS = 3e3;
@@ -6691,7 +6706,16 @@ Index the REMAINING windows - one record per row/item, looking at any page image
6691
6706
  this.historyItemPolls.forEach(function(h) {
6692
6707
  if (h && h.kind === "bg") found = true;
6693
6708
  });
6694
- return found;
6709
+ if (found) return true;
6710
+ var cutoff = Date.now() - RECENT_INDEX_PASS_EVIDENCE_MS;
6711
+ var msgs = this.state.messages;
6712
+ for (var mi = msgs.length - 1; mi >= 0; mi--) {
6713
+ var m = msgs[mi];
6714
+ if (!m || !m._indexFile) continue;
6715
+ if (typeof m._ts !== "number") continue;
6716
+ if (m._ts >= cutoff) return true;
6717
+ }
6718
+ return false;
6695
6719
  }
6696
6720
  /** Any of these ids still queued or still polled, i.e. surviving work. */
6697
6721
  _isTrackingAny(ids) {
@@ -8253,7 +8277,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
8253
8277
  (function() {
8254
8278
  var MCP_PROD = "https://mcp.broadwayinc.computer";
8255
8279
  var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
8256
- var BQ_VERSION = "1.10.5" ;
8280
+ var BQ_VERSION = "1.10.7" ;
8257
8281
  var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
8258
8282
  var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
8259
8283
  var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
@@ -11530,6 +11554,10 @@ Index the REMAINING windows - one record per row/item, looking at any page image
11530
11554
  if (msg.isCancelled) bubble.appendChild(h("span", { class: "bq-cancel-error", text: "(cancelled)" }));
11531
11555
  if (msg._cancelError) bubble.appendChild(h("span", { class: "bq-cancel-error", text: msg._cancelError }));
11532
11556
  var ts = msg.isPending ? "" : formatChatTimestamp(msg._ts);
11557
+ if (ts && typeof msg._ts === "number" && typeof msg._tsStart === "number") {
11558
+ var dur = formatDuration(msg._ts - msg._tsStart);
11559
+ if (dur) ts += " (" + dur + ")";
11560
+ }
11533
11561
  if (ts) bubble.appendChild(h("time", { class: "bq-msg-time", text: ts }));
11534
11562
  }
11535
11563
  return h("div", { class: cls.join(" "), dataset: { msgIndex: String(idx) } }, bubble);
package/dist/engine.cjs CHANGED
@@ -1561,6 +1561,18 @@ function formatChatTimestamp(ms) {
1561
1561
  return "";
1562
1562
  }
1563
1563
  }
1564
+ function formatDuration(ms) {
1565
+ if (typeof ms !== "number" || !isFinite(ms) || ms < 1e3) return "";
1566
+ var total = Math.floor(ms / 1e3);
1567
+ var h = Math.floor(total / 3600);
1568
+ var m = Math.floor(total % 3600 / 60);
1569
+ var s = total % 60;
1570
+ var out = [];
1571
+ if (h) out.push(h + "h");
1572
+ if (m) out.push(m + "m");
1573
+ out.push(s + "s");
1574
+ return out.join(" ");
1575
+ }
1564
1576
 
1565
1577
  // src/engine/ai_agent.ts
1566
1578
  function normalizePlatform(raw) {
@@ -3181,6 +3193,7 @@ function mapHistoryListToMessages(list, platform, opts) {
3181
3193
  var serverItemId = item && typeof item.id === "string" && item.id ? item.id : void 0;
3182
3194
  var createdTs = Number(item && item.created);
3183
3195
  var updatedTs = Number(item && item.updated);
3196
+ var executedTs = Number(item && item.executed);
3184
3197
  var userTs = isFinite(createdTs) && createdTs > 0 ? createdTs : isFinite(updatedTs) && updatedTs > 0 ? updatedTs : void 0;
3185
3198
  var replyTs = isFinite(updatedTs) && updatedTs > 0 ? updatedTs : isFinite(createdTs) && createdTs > 0 ? createdTs : void 0;
3186
3199
  if (userText) {
@@ -3249,6 +3262,7 @@ function mapHistoryListToMessages(list, platform, opts) {
3249
3262
  if (isCompact) okm._compact = true;
3250
3263
  if (serverItemId !== void 0) okm._serverItemId = serverItemId;
3251
3264
  if (replyTs !== void 0) okm._ts = replyTs;
3265
+ if (indexFile && isFinite(executedTs) && executedTs > 0) okm._tsStart = executedTs;
3252
3266
  if (reportedComplete) okm._indexComplete = true;
3253
3267
  mapped.push(okm);
3254
3268
  }
@@ -3643,6 +3657,7 @@ var WORKER_PASS_ADOPT_LIMIT = 20;
3643
3657
  var LIVE_INDEX_SNAPSHOT_MAX_AGE_MS = 5e3;
3644
3658
  var INDEX_DISPATCH_CLAIM_MS = 2 * 60 * 1e3;
3645
3659
  var WORKER_PASS_ADOPT_ATTEMPTS = [0, 2e3, 6e3];
3660
+ var RECENT_INDEX_PASS_EVIDENCE_MS = 10 * 60 * 1e3;
3646
3661
  var EARLY_PROBE_SCHEDULE_MS = [400, 900, 1700];
3647
3662
  var INDEXING_DRAIN_BUSY_POLL_MS = 8e3;
3648
3663
  var INDEXING_DRAIN_CONFIRM_POLL_MS = 3e3;
@@ -6835,7 +6850,16 @@ var ChatSession = class {
6835
6850
  this.historyItemPolls.forEach(function(h) {
6836
6851
  if (h && h.kind === "bg") found = true;
6837
6852
  });
6838
- return found;
6853
+ if (found) return true;
6854
+ var cutoff = Date.now() - RECENT_INDEX_PASS_EVIDENCE_MS;
6855
+ var msgs = this.state.messages;
6856
+ for (var mi = msgs.length - 1; mi >= 0; mi--) {
6857
+ var m = msgs[mi];
6858
+ if (!m || !m._indexFile) continue;
6859
+ if (typeof m._ts !== "number") continue;
6860
+ if (m._ts >= cutoff) return true;
6861
+ }
6862
+ return false;
6839
6863
  }
6840
6864
  /** Any of these ids still queued or still polled, i.e. surviving work. */
6841
6865
  _isTrackingAny(ids) {
@@ -8541,6 +8565,7 @@ exports.fillHistoryViewport = fillHistoryViewport;
8541
8565
  exports.filterListByClearHorizon = filterListByClearHorizon;
8542
8566
  exports.findAttachmentParser = findAttachmentParser;
8543
8567
  exports.formatChatTimestamp = formatChatTimestamp;
8568
+ exports.formatDuration = formatDuration;
8544
8569
  exports.getAttachmentParsers = getAttachmentParsers;
8545
8570
  exports.getChatHistory = getChatHistory;
8546
8571
  exports.getContextWindow = getContextWindow;