bunnyquery 1.17.0 → 1.17.1

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
@@ -948,6 +948,11 @@ Index the REMAINING windows - one record per row/item, looking at any page image
948
948
  return encodeURIComponent(s);
949
949
  }).join("/");
950
950
  }
951
+ function normalizeStoredPathTarget(value) {
952
+ var p = String(value || "").trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
953
+ if (!/\s/.test(p) && /%[0-9A-Fa-f]{2}/.test(p)) p = safeDecodeURIComponent(p);
954
+ return p;
955
+ }
951
956
  function normalizeAttachmentPathCandidate(value) {
952
957
  return safeDecodeURIComponent((value || "").trim()).replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
953
958
  }
@@ -1107,14 +1112,14 @@ Index the REMAINING windows - one record per row/item, looking at any page image
1107
1112
  tail
1108
1113
  };
1109
1114
  }
1110
- var srcPath = readExpiredAttachmentHref(rawPath) || (srcIsUrl ? extractRemotePathFromAttachmentHref(rawPath, ctx.projectId) || normalizeAttachmentPathCandidate(rawPath) : rawPath.trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/"));
1115
+ var srcPath = readExpiredAttachmentHref(rawPath) || (srcIsUrl ? extractRemotePathFromAttachmentHref(rawPath, ctx.projectId) || normalizeAttachmentPathCandidate(rawPath) : normalizeStoredPathTarget(rawPath));
1111
1116
  var srcBuilt = asStoredFile(srcPath, srcPath);
1112
1117
  return srcBuilt ? { part: srcBuilt.part, tail } : null;
1113
1118
  }
1114
1119
  if (g4 && g5) {
1115
1120
  var dbTarget = /^db:(.+)$/i.exec(g5.trim());
1116
1121
  if (dbTarget) {
1117
- var rawDbPath = dbTarget[1].trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
1122
+ var rawDbPath = normalizeStoredPathTarget(dbTarget[1].replace(/\s+"[^"\n]*"\s*$/, ""));
1118
1123
  var declared = asStoredFile(rawDbPath, g4);
1119
1124
  if (!declared) return null;
1120
1125
  declared.part.label = truncateLabelForDisplay(g4);
@@ -1370,12 +1375,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
1370
1375
  function retrievalNoteFromText(text) {
1371
1376
  if (typeof text !== "string" || !text) return null;
1372
1377
  var note = emptyNote("answer");
1373
- var link = /\]\(db:([^)\s"]+)/g;
1378
+ var link = /\]\(db:((?:[^()\n"]|\([^()\n"]*\))+)(?:"[^"\n]*")?\)/g;
1374
1379
  var m;
1375
- while ((m = link.exec(text)) !== null) pushUnique(note.files, m[1]);
1376
- var src = /src::([^\s"'`<>)\]]+)/g;
1380
+ while ((m = link.exec(text)) !== null) pushUnique(note.files, normalizeStoredPathTarget(m[1]));
1381
+ var src = /src::(\S+)/g;
1377
1382
  while ((m = src.exec(text)) !== null) {
1378
- pushUnique(note.files, m[1].replace(/[.,;:!?]+$/, ""));
1383
+ pushUnique(note.files, normalizeStoredPathTarget(normalizeTrailingInlineToken(m[1])));
1379
1384
  }
1380
1385
  return noteHasContent(note) ? note : null;
1381
1386
  }
@@ -9162,7 +9167,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
9162
9167
  (function() {
9163
9168
  var MCP_PROD = "https://mcp.broadwayinc.computer";
9164
9169
  var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
9165
- var BQ_VERSION = "1.17.0" ;
9170
+ var BQ_VERSION = "1.17.1" ;
9166
9171
  var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
9167
9172
  var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
9168
9173
  var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
package/dist/engine.cjs CHANGED
@@ -1025,6 +1025,11 @@ function encodePathSegments(path) {
1025
1025
  return encodeURIComponent(s);
1026
1026
  }).join("/");
1027
1027
  }
1028
+ function normalizeStoredPathTarget(value) {
1029
+ var p = String(value || "").trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
1030
+ if (!/\s/.test(p) && /%[0-9A-Fa-f]{2}/.test(p)) p = safeDecodeURIComponent(p);
1031
+ return p;
1032
+ }
1028
1033
  function normalizeAttachmentPathCandidate(value) {
1029
1034
  return safeDecodeURIComponent((value || "").trim()).replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
1030
1035
  }
@@ -1190,14 +1195,14 @@ function classifyInlineLink(full, groups, ctx) {
1190
1195
  tail
1191
1196
  };
1192
1197
  }
1193
- var srcPath = readExpiredAttachmentHref(rawPath) || (srcIsUrl ? extractRemotePathFromAttachmentHref(rawPath, ctx.projectId) || normalizeAttachmentPathCandidate(rawPath) : rawPath.trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/"));
1198
+ var srcPath = readExpiredAttachmentHref(rawPath) || (srcIsUrl ? extractRemotePathFromAttachmentHref(rawPath, ctx.projectId) || normalizeAttachmentPathCandidate(rawPath) : normalizeStoredPathTarget(rawPath));
1194
1199
  var srcBuilt = asStoredFile(srcPath, srcPath);
1195
1200
  return srcBuilt ? { part: srcBuilt.part, tail } : null;
1196
1201
  }
1197
1202
  if (g4 && g5) {
1198
1203
  var dbTarget = /^db:(.+)$/i.exec(g5.trim());
1199
1204
  if (dbTarget) {
1200
- var rawDbPath = dbTarget[1].trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
1205
+ var rawDbPath = normalizeStoredPathTarget(dbTarget[1].replace(/\s+"[^"\n]*"\s*$/, ""));
1201
1206
  var declared = asStoredFile(rawDbPath, g4);
1202
1207
  if (!declared) return null;
1203
1208
  declared.part.label = truncateLabelForDisplay(g4);
@@ -1453,12 +1458,12 @@ function noteFromToolBlocks(body) {
1453
1458
  function retrievalNoteFromText(text) {
1454
1459
  if (typeof text !== "string" || !text) return null;
1455
1460
  var note = emptyNote("answer");
1456
- var link = /\]\(db:([^)\s"]+)/g;
1461
+ var link = /\]\(db:((?:[^()\n"]|\([^()\n"]*\))+)(?:"[^"\n]*")?\)/g;
1457
1462
  var m;
1458
- while ((m = link.exec(text)) !== null) pushUnique(note.files, m[1]);
1459
- var src = /src::([^\s"'`<>)\]]+)/g;
1463
+ while ((m = link.exec(text)) !== null) pushUnique(note.files, normalizeStoredPathTarget(m[1]));
1464
+ var src = /src::(\S+)/g;
1460
1465
  while ((m = src.exec(text)) !== null) {
1461
- pushUnique(note.files, m[1].replace(/[.,;:!?]+$/, ""));
1466
+ pushUnique(note.files, normalizeStoredPathTarget(normalizeTrailingInlineToken(m[1])));
1462
1467
  }
1463
1468
  return noteHasContent(note) ? note : null;
1464
1469
  }
@@ -9536,6 +9541,7 @@ exports.normalizeChatGreeting = normalizeChatGreeting;
9536
9541
  exports.normalizeExt = normalizeExt;
9537
9542
  exports.normalizeProjectAccessSetting = normalizeProjectAccessSetting;
9538
9543
  exports.normalizeSkipDuplicateFiles = normalizeSkipDuplicateFiles;
9544
+ exports.normalizeStoredPathTarget = normalizeStoredPathTarget;
9539
9545
  exports.normalizeTextContent = normalizeTextContent;
9540
9546
  exports.normalizeTrailingInlineToken = normalizeTrailingInlineToken;
9541
9547
  exports.normalizeUploadAccessGroup = normalizeUploadAccessGroup;