@resolveio/server-lib 22.3.241 → 22.3.243

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.
@@ -7411,7 +7411,7 @@ function extractAssistantDataIntentCustomerText(message) {
7411
7411
  value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:few|couple|couple\s+of|several)\s+(?:days?|weeks?|months?|years?)\b/gi, ' ');
7412
7412
  value = value.replace(/\b(?:last|past)\s+[0-9]+\s+(?:days?|weeks?|months?)\b/gi, ' ');
7413
7413
  value = value.replace(/\b(?:this|current)\s+(?:week|month|quarter|year)\b/gi, ' ');
7414
- value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:week|month|quarter|year)\b/gi, ' ');
7414
+ value = value.replace(/\b(?:last|past)\s+(?:week|month|quarter|year)\b/gi, ' ');
7415
7415
  value = value.replace(/\byear\s+to\s+date\b/gi, ' ');
7416
7416
  value = value.replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|amount|quantity|qty|total|totals|for|to|them|their|we|our|us|right|now|by|what|which|were|was|is|are|has|have|had|been|did|do|does|get|report|all)\b/gi, ' ');
7417
7417
  value = value.replace(/\b(work\s*orders?|wos?|jobs?|invoices?|invoice|invoiced|invoicing|billed|billing|revenue|charged|chemicals?|chemical|sent|shipped|shipment|shipments|delivered|planned|inventory|on\s+hand|stock|ytd|status|state|open|completed|reviewed|closed|monthly|month)\b/gi, ' ');
@@ -7438,69 +7438,6 @@ function removeAssistantLiteralPhrase(value, phrase) {
7438
7438
  }
7439
7439
  return value.replace(new RegExp("\\b".concat(escapeRegexValue(normalizedPhrase).replace(/\s+/g, '\\s+'), "\\b"), 'gi'), ' ');
7440
7440
  }
7441
- function isAssistantPersonFilterCandidate(candidate) {
7442
- var terms = __spreadArray(__spreadArray([
7443
- candidate.id
7444
- ], __read((candidate.terms || [])), false), __read((candidate.fields || [])), false).map(function (term) { return cleanAssistantRequestedDimensionText(term); })
7445
- .filter(Boolean);
7446
- return terms.some(function (term) { return [
7447
- 'driver',
7448
- 'drivers',
7449
- 'user',
7450
- 'users',
7451
- 'employee',
7452
- 'employees',
7453
- 'person',
7454
- 'people',
7455
- 'name',
7456
- 'id user',
7457
- 'id_user'
7458
- ].includes(term); });
7459
- }
7460
- function intentHasAssistantPersonFilter(intent) {
7461
- return buildAssistantAppDataFilterCandidates(intent).some(function (candidate) { return isAssistantPersonFilterCandidate(candidate); });
7462
- }
7463
- function extractAssistantLeadingPersonFilterText(message, intent) {
7464
- var e_5, _a;
7465
- if (!intentHasAssistantPersonFilter(intent)) {
7466
- return '';
7467
- }
7468
- var text = normalizeOptionalString(message);
7469
- if (!text) {
7470
- return '';
7471
- }
7472
- var terms = mergeAssistantHintValues(intent.terms || [])
7473
- .sort(function (a, b) { return b.length - a.length; });
7474
- try {
7475
- for (var terms_1 = __values(terms), terms_1_1 = terms_1.next(); !terms_1_1.done; terms_1_1 = terms_1.next()) {
7476
- var term = terms_1_1.value;
7477
- var normalizedTerm = normalizeOptionalString(term);
7478
- if (!normalizedTerm) {
7479
- continue;
7480
- }
7481
- var regex = new RegExp("\\b".concat(escapeRegexValue(normalizedTerm).replace(/\s+/g, '\\s+'), "\\b"), 'i');
7482
- var match = regex.exec(text);
7483
- if (!match || match.index <= 0) {
7484
- continue;
7485
- }
7486
- var prefix = normalizeOptionalString(text.slice(0, match.index)
7487
- .replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|in|from|over|amount|quantity|qty|volume|total|totals|for|to|by|what|which|get|report|reports|all|break\s+down|breakdown)\b/gi, ' ')
7488
- .replace(/[^a-z0-9%&.' -]+/gi, ' ')
7489
- .replace(/\s+/g, ' '));
7490
- if (prefix && (prefix.split(/\s+/).filter(Boolean).length >= 1)) {
7491
- return prefix;
7492
- }
7493
- }
7494
- }
7495
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
7496
- finally {
7497
- try {
7498
- if (terms_1_1 && !terms_1_1.done && (_a = terms_1.return)) _a.call(terms_1);
7499
- }
7500
- finally { if (e_5) throw e_5.error; }
7501
- }
7502
- return '';
7503
- }
7504
7441
  function extractAssistantDataIntentLikelyFilterText(message, intent) {
7505
7442
  var value = normalizeOptionalString(message);
7506
7443
  if (!value) {
@@ -7511,11 +7448,11 @@ function extractAssistantDataIntentLikelyFilterText(message, intent) {
7511
7448
  value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:few|couple|couple\s+of|several)\s+(?:days?|weeks?|months?|years?)\b/gi, ' ');
7512
7449
  value = value.replace(/\b(?:last|past)\s+[0-9]+\s+(?:days?|weeks?|months?)\b/gi, ' ');
7513
7450
  value = value.replace(/\b(?:this|current)\s+(?:week|month|quarter|year)\b/gi, ' ');
7514
- value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:week|month|quarter|year)\b/gi, ' ');
7451
+ value = value.replace(/\b(?:last|past)\s+(?:week|month|quarter|year)\b/gi, ' ');
7515
7452
  value = value.replace(/\b(?:until|through|since)\s+[a-z]+\s+[0-9]{1,2}\b/gi, ' ');
7516
7453
  value = value.replace(/\byear\s+to\s+date\b/gi, ' ');
7517
7454
  value = value.replace(/\b(?:by|per|group(?:ed)?(?:\s+by)?|split(?:\s+by)?)\s+[a-z0-9 _/-]+\b/gi, ' ');
7518
- value = value.replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|in|from|over|amount|quantity|qty|volume|total|totals|for|to|them|their|we|our|us|right|now|by|what|which|were|was|is|are|has|have|had|been|did|do|does|get|report|reports|all|break\s+down|breakdown|activity|activities|transactions?|movement|movements?|chemicals?|chemical|products?|product|inventory|invoices?|invoice|invoiced|invoicing|billed|billing|revenue|charged|usage|monthly|month|current|jobs?|work\s+orders?|blends?|blended|blending|planned|sent|shipped|shipment|shipments|delivered|created|increased?|decreased?|positive|negative|open|closed|completed|reviewed|this)\b/gi, ' ');
7455
+ value = value.replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|in|from|amount|quantity|qty|volume|total|totals|for|to|them|their|we|our|us|right|now|by|what|which|were|was|is|are|has|have|had|been|did|do|does|get|report|reports|all|break\s+down|breakdown|activity|activities|transactions?|movement|movements?|chemicals?|chemical|products?|product|inventory|invoices?|invoice|invoiced|invoicing|billed|billing|revenue|charged|usage|monthly|month|current|jobs?|work\s+orders?|blends?|blended|blending|planned|sent|shipped|shipment|shipments|delivered|created|increased?|decreased?|positive|negative|open|closed|completed|reviewed|this)\b/gi, ' ');
7519
7456
  var filterTerms = new Set();
7520
7457
  buildAssistantAppDataFilterCandidates(intent).forEach(function (filterField) {
7521
7458
  (filterField.terms || []).forEach(function (term) { return filterTerms.add(normalizeOptionalString(term).toLowerCase()); });
@@ -7529,9 +7466,6 @@ function extractAssistantDataIntentLikelyFilterText(message, intent) {
7529
7466
  });
7530
7467
  value = value.replace(/[^a-z0-9%&.' -]+/gi, ' ');
7531
7468
  value = normalizeOptionalString(value.replace(/\s+/g, ' '));
7532
- if (!value) {
7533
- value = extractAssistantLeadingPersonFilterText(message, intent);
7534
- }
7535
7469
  if (!value || /^(activity|transactions?|movement|movements?|chemicals?|products?|inventory|invoices?|jobs?|work orders?|blends?)$/i.test(value)) {
7536
7470
  return '';
7537
7471
  }
@@ -8113,15 +8047,12 @@ function resolveAssistantDataIntentDateWindow(message) {
8113
8047
  year: now.getUTCFullYear()
8114
8048
  };
8115
8049
  }
8116
- var lastWindowMatch = text.match(/\b(?:last|past|previous|over\s+the\s+last)\s+([0-9]+)\s+(days?|weeks?|months?|years?)\b/);
8050
+ var lastWindowMatch = text.match(/\b(?:last|past)\s+([0-9]+)\s+(days?|weeks?|months?)\b/);
8117
8051
  if (lastWindowMatch) {
8118
8052
  var amount = Math.max(1, Math.min(Number(lastWindowMatch[1]) || 1, 36));
8119
8053
  var unit = lastWindowMatch[2];
8120
8054
  var start = new Date(now.getTime());
8121
- if (/year/.test(unit)) {
8122
- start.setUTCFullYear(start.getUTCFullYear() - amount);
8123
- }
8124
- else if (/week/.test(unit)) {
8055
+ if (/week/.test(unit)) {
8125
8056
  start.setUTCDate(start.getUTCDate() - (amount * 7));
8126
8057
  }
8127
8058
  else if (/month/.test(unit)) {
@@ -8137,24 +8068,6 @@ function resolveAssistantDataIntentDateWindow(message) {
8137
8068
  year: now.getUTCFullYear()
8138
8069
  };
8139
8070
  }
8140
- if (/\b(?:over\s+the\s+last|past)\s+year\b/.test(text)) {
8141
- var start = new Date(now.getTime());
8142
- start.setUTCFullYear(start.getUTCFullYear() - 1);
8143
- start.setUTCHours(0, 0, 0, 0);
8144
- return {
8145
- start: start.toISOString(),
8146
- end: new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 23, 59, 59, 999)).toISOString(),
8147
- year: now.getUTCFullYear()
8148
- };
8149
- }
8150
- if (/\b(?:last|previous)\s+year\b/.test(text)) {
8151
- var year_5 = now.getUTCFullYear() - 1;
8152
- return {
8153
- start: new Date(Date.UTC(year_5, 0, 1, 0, 0, 0, 0)).toISOString(),
8154
- end: new Date(Date.UTC(year_5, 11, 31, 23, 59, 59, 999)).toISOString(),
8155
- year: year_5
8156
- };
8157
- }
8158
8071
  if (/\b(?:this|current)\s+month\b/.test(text)) {
8159
8072
  return {
8160
8073
  start: new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1, 0, 0, 0, 0)).toISOString(),
@@ -8337,7 +8250,7 @@ function cleanAssistantRequestedDimensionText(value) {
8337
8250
  return normalizeOptionalString(text.replace(/\s+/g, ' ')).toLowerCase();
8338
8251
  }
8339
8252
  function extractAssistantRequestedBreakdownDimensionTexts(message) {
8340
- var e_6, _a;
8253
+ var e_5, _a;
8341
8254
  var text = normalizeOptionalString(message).toLowerCase();
8342
8255
  if (!text) {
8343
8256
  return [];
@@ -8364,12 +8277,12 @@ function extractAssistantRequestedBreakdownDimensionTexts(message) {
8364
8277
  }
8365
8278
  }
8366
8279
  }
8367
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
8280
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
8368
8281
  finally {
8369
8282
  try {
8370
8283
  if (patterns_2_1 && !patterns_2_1.done && (_a = patterns_2.return)) _a.call(patterns_2);
8371
8284
  }
8372
- finally { if (e_6) throw e_6.error; }
8285
+ finally { if (e_5) throw e_5.error; }
8373
8286
  }
8374
8287
  return mergeAssistantHintValues(results);
8375
8288
  }
@@ -9804,25 +9717,6 @@ function buildAssistantDataRequestUnderstanding(message, intent, dateWindow, cla
9804
9717
  ? clampAssistantConfidence(normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.confidence, 0.65)
9805
9718
  : clampAssistantConfidence(normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.confidence, 0.75);
9806
9719
  var filters = appendAssistantImplicitStatusConstraintFilters(message, intent, appendAssistantImplicitNumericConstraintFilters(message, intent, removeAssistantGenericBreakdownEntityFilters(preserveAssistantDataIntentFilterQualifiers(message, intent, (normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.filters) || []), requestedBreakdowns)));
9807
- if (!filters.length) {
9808
- var personText = extractAssistantLeadingPersonFilterText(message, intent);
9809
- var personCandidate = personText
9810
- ? buildAssistantAppDataFilterCandidates(intent).find(function (candidate) { return isAssistantPersonFilterCandidate(candidate); })
9811
- : null;
9812
- if (personText && personCandidate) {
9813
- var operator = personCandidate.operators.includes('contains') || !personCandidate.operators.length
9814
- ? 'contains'
9815
- : personCandidate.operators.includes('eq')
9816
- ? 'eq'
9817
- : personCandidate.operators[0];
9818
- filters = [{
9819
- field: personCandidate.id,
9820
- operator: operator,
9821
- value: personText,
9822
- source: 'leading_person_filter_text'
9823
- }];
9824
- }
9825
- }
9826
9720
  var effectiveDateRange = (dateWindow.start || dateWindow.end)
9827
9721
  ? __assign({}, dateWindow) : ((normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.date_range) || null);
9828
9722
  return {
@@ -9846,7 +9740,7 @@ function buildAssistantDataRequestUnderstanding(message, intent, dateWindow, cla
9846
9740
  };
9847
9741
  }
9848
9742
  function inferAssistantDateWindowYear(value) {
9849
- var e_7, _a;
9743
+ var e_6, _a;
9850
9744
  if (!value) {
9851
9745
  return undefined;
9852
9746
  }
@@ -9862,12 +9756,12 @@ function inferAssistantDateWindowYear(value) {
9862
9756
  }
9863
9757
  }
9864
9758
  }
9865
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
9759
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
9866
9760
  finally {
9867
9761
  try {
9868
9762
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
9869
9763
  }
9870
- finally { if (e_7) throw e_7.error; }
9764
+ finally { if (e_6) throw e_6.error; }
9871
9765
  }
9872
9766
  return undefined;
9873
9767
  }
@@ -10017,7 +9911,7 @@ function normalizeAssistantContractFilterOperator(value) {
10017
9911
  return normalized || 'eq';
10018
9912
  }
10019
9913
  function extractAssistantFilterObjectValue(value) {
10020
- var e_8, _a;
9914
+ var e_7, _a;
10021
9915
  if (!value || typeof value !== 'object' || Array.isArray(value) || value instanceof Date) {
10022
9916
  return {
10023
9917
  operator: 'eq',
@@ -10041,12 +9935,12 @@ function extractAssistantFilterObjectValue(value) {
10041
9935
  };
10042
9936
  }
10043
9937
  }
10044
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
9938
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
10045
9939
  finally {
10046
9940
  try {
10047
9941
  if (operatorKeys_1_1 && !operatorKeys_1_1.done && (_a = operatorKeys_1.return)) _a.call(operatorKeys_1);
10048
9942
  }
10049
- finally { if (e_8) throw e_8.error; }
9943
+ finally { if (e_7) throw e_7.error; }
10050
9944
  }
10051
9945
  return {
10052
9946
  operator: 'eq',
@@ -10273,15 +10167,7 @@ function buildAssistantFieldFilterCondition(value, operator, type) {
10273
10167
  if (type === 'boolean') {
10274
10168
  return coerced;
10275
10169
  }
10276
- var rawString = String(coerced);
10277
- var escaped = normalizedOperator === 'contains'
10278
- ? rawString
10279
- .split(/[^a-z0-9%&]+/i)
10280
- .map(function (token) { return normalizeOptionalString(token); })
10281
- .filter(function (token) { return token.length > 1 || /[0-9%&]/.test(token); })
10282
- .map(function (token) { return escapeRegexValue(token); })
10283
- .join('.*')
10284
- : escapeRegexValue(rawString);
10170
+ var escaped = escapeRegexValue(String(coerced));
10285
10171
  if (!escaped) {
10286
10172
  return undefined;
10287
10173
  }
@@ -10296,37 +10182,15 @@ function normalizeAssistantFieldAwareFilterValue(value, candidate) {
10296
10182
  ], __read((candidate.terms || [])), false), __read((candidate.fields || [])), false).map(function (term) { return cleanAssistantRequestedDimensionText(term); })
10297
10183
  .filter(Boolean);
10298
10184
  var isDivisionCandidate = candidateTerms.some(function (term) { return term === 'division' || term === 'divisions' || term.endsWith(' division'); });
10299
- var isPersonCandidate = candidateTerms.some(function (term) { return [
10300
- 'driver',
10301
- 'drivers',
10302
- 'user',
10303
- 'users',
10304
- 'employee',
10305
- 'employees',
10306
- 'person',
10307
- 'people',
10308
- 'name',
10309
- 'id user',
10310
- 'id_user'
10311
- ].includes(term); });
10312
- if (!isDivisionCandidate && !isPersonCandidate) {
10185
+ if (!isDivisionCandidate) {
10313
10186
  return value;
10314
10187
  }
10315
10188
  var text = normalizeOptionalString(value);
10316
10189
  if (!text) {
10317
10190
  return value;
10318
10191
  }
10319
- var normalizedText = text;
10320
- if (isDivisionCandidate) {
10321
- normalizedText = normalizedText.replace(/\bdivision(?:s)?\b/gi, ' ');
10322
- }
10323
- if (isPersonCandidate) {
10324
- normalizedText = normalizedText
10325
- .replace(/\b([a-z][a-z0-9.'-]*)'s\b/gi, '$1')
10326
- .replace(/\bs\b/gi, ' ')
10327
- .replace(/\b(?:ats|pay|pays|settlement|settlements|driver|drivers|user|users|employee|employees|over)\b/gi, ' ');
10328
- }
10329
- var normalized = normalizeOptionalString(normalizedText
10192
+ var normalized = normalizeOptionalString(text
10193
+ .replace(/\bdivision(?:s)?\b/gi, ' ')
10330
10194
  .replace(/\s+/g, ' '));
10331
10195
  return normalized || value;
10332
10196
  }
@@ -10972,7 +10836,7 @@ function ensureAssistantDisplayColumns(display, requestedColumns) {
10972
10836
  return __assign(__assign({}, display), { columns: columns, rows: rows });
10973
10837
  }
10974
10838
  function resolveAssistantPipelineTimeGrain(pipeline) {
10975
- var e_9, _a;
10839
+ var e_8, _a;
10976
10840
  if (!Array.isArray(pipeline) || !pipeline.length) {
10977
10841
  return null;
10978
10842
  }
@@ -11034,12 +10898,12 @@ function resolveAssistantPipelineTimeGrain(pipeline) {
11034
10898
  }
11035
10899
  }
11036
10900
  }
11037
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
10901
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
11038
10902
  finally {
11039
10903
  try {
11040
10904
  if (priority_1_1 && !priority_1_1.done && (_a = priority_1.return)) _a.call(priority_1);
11041
10905
  }
11042
- finally { if (e_9) throw e_9.error; }
10906
+ finally { if (e_8) throw e_8.error; }
11043
10907
  }
11044
10908
  return null;
11045
10909
  }
@@ -12033,7 +11897,7 @@ function applyAssistantDatedReportWindow(value, toolResult) {
12033
11897
  return "".concat(line, "\n\n").concat(content).trim();
12034
11898
  }
12035
11899
  function resolveAssistantDatedReportWindow(toolResult) {
12036
- var e_10, _a;
11900
+ var e_9, _a;
12037
11901
  var _b, _c, _d, _e, _f, _g, _h, _j;
12038
11902
  var verificationWindow = (_d = (_c = (_b = toolResult === null || toolResult === void 0 ? void 0 : toolResult.output) === null || _b === void 0 ? void 0 : _b.verification) === null || _c === void 0 ? void 0 : _c.metrics) === null || _d === void 0 ? void 0 : _d.window;
12039
11903
  var verificationStart = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.startDate);
@@ -12099,12 +11963,12 @@ function resolveAssistantDatedReportWindow(toolResult) {
12099
11963
  };
12100
11964
  }
12101
11965
  }
12102
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
11966
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
12103
11967
  finally {
12104
11968
  try {
12105
11969
  if (pipelineCandidates_1_1 && !pipelineCandidates_1_1.done && (_a = pipelineCandidates_1.return)) _a.call(pipelineCandidates_1);
12106
11970
  }
12107
- finally { if (e_10) throw e_10.error; }
11971
+ finally { if (e_9) throw e_9.error; }
12108
11972
  }
12109
11973
  return null;
12110
11974
  }
@@ -12815,7 +12679,7 @@ function getValueAtPath(obj, path) {
12815
12679
  return walk(obj, 0);
12816
12680
  }
12817
12681
  function hasArrayValueAtPath(docs, path) {
12818
- var e_11, _a;
12682
+ var e_10, _a;
12819
12683
  if (!Array.isArray(docs) || !docs.length || !path) {
12820
12684
  return false;
12821
12685
  }
@@ -12828,17 +12692,17 @@ function hasArrayValueAtPath(docs, path) {
12828
12692
  }
12829
12693
  }
12830
12694
  }
12831
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
12695
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
12832
12696
  finally {
12833
12697
  try {
12834
12698
  if (docs_1_1 && !docs_1_1.done && (_a = docs_1.return)) _a.call(docs_1);
12835
12699
  }
12836
- finally { if (e_11) throw e_11.error; }
12700
+ finally { if (e_10) throw e_10.error; }
12837
12701
  }
12838
12702
  return false;
12839
12703
  }
12840
12704
  function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
12841
- var e_12, _a, e_13, _b;
12705
+ var e_11, _a, e_12, _b;
12842
12706
  if (!Array.isArray(docs) || !fieldPath) {
12843
12707
  return 'unknown';
12844
12708
  }
@@ -12851,7 +12715,7 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
12851
12715
  : doc === null || doc === void 0 ? void 0 : doc[fieldPath];
12852
12716
  var queue = Array.isArray(value) ? value : [value];
12853
12717
  try {
12854
- for (var queue_1 = (e_13 = void 0, __values(queue)), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
12718
+ for (var queue_1 = (e_12 = void 0, __values(queue)), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
12855
12719
  var entry = queue_1_1.value;
12856
12720
  if (entry === null || entry === undefined) {
12857
12721
  continue;
@@ -12864,21 +12728,21 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
12864
12728
  }
12865
12729
  }
12866
12730
  }
12867
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
12731
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
12868
12732
  finally {
12869
12733
  try {
12870
12734
  if (queue_1_1 && !queue_1_1.done && (_b = queue_1.return)) _b.call(queue_1);
12871
12735
  }
12872
- finally { if (e_13) throw e_13.error; }
12736
+ finally { if (e_12) throw e_12.error; }
12873
12737
  }
12874
12738
  }
12875
12739
  }
12876
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
12740
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
12877
12741
  finally {
12878
12742
  try {
12879
12743
  if (docs_2_1 && !docs_2_1.done && (_a = docs_2.return)) _a.call(docs_2);
12880
12744
  }
12881
- finally { if (e_12) throw e_12.error; }
12745
+ finally { if (e_11) throw e_11.error; }
12882
12746
  }
12883
12747
  return sawString ? 'string' : 'unknown';
12884
12748
  }
@@ -12973,7 +12837,7 @@ function normalizeLookupKeyValue(value) {
12973
12837
  return '';
12974
12838
  }
12975
12839
  function collectTopLevelIdFieldValues(docs, options) {
12976
- var e_14, _a, e_15, _b;
12840
+ var e_13, _a, e_14, _b;
12977
12841
  if (!Array.isArray(docs) || !docs.length) {
12978
12842
  return [];
12979
12843
  }
@@ -13021,26 +12885,26 @@ function collectTopLevelIdFieldValues(docs, options) {
13021
12885
  });
13022
12886
  };
13023
12887
  try {
13024
- for (var keys_1 = (e_15 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
12888
+ for (var keys_1 = (e_14 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
13025
12889
  var key = keys_1_1.value;
13026
12890
  _loop_3(key);
13027
12891
  }
13028
12892
  }
13029
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
12893
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
13030
12894
  finally {
13031
12895
  try {
13032
12896
  if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
13033
12897
  }
13034
- finally { if (e_15) throw e_15.error; }
12898
+ finally { if (e_14) throw e_14.error; }
13035
12899
  }
13036
12900
  }
13037
12901
  }
13038
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
12902
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
13039
12903
  finally {
13040
12904
  try {
13041
12905
  if (docs_3_1 && !docs_3_1.done && (_a = docs_3.return)) _a.call(docs_3);
13042
12906
  }
13043
- finally { if (e_14) throw e_14.error; }
12907
+ finally { if (e_13) throw e_13.error; }
13044
12908
  }
13045
12909
  return Array.from(fieldMap.entries()).map(function (_a) {
13046
12910
  var _b = __read(_a, 2), field = _b[0], values = _b[1];
@@ -13161,8 +13025,8 @@ function resolveLookupMappingsForField(field, mappings) {
13161
13025
  }
13162
13026
  function applyIdLookupDisplayEnrichment(params) {
13163
13027
  return __awaiter(this, void 0, void 0, function () {
13164
- var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry, e_16_1;
13165
- var e_16, _a;
13028
+ var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry, e_15_1;
13029
+ var e_15, _a;
13166
13030
  return __generator(this, function (_b) {
13167
13031
  switch (_b.label) {
13168
13032
  case 0:
@@ -13186,8 +13050,8 @@ function applyIdLookupDisplayEnrichment(params) {
13186
13050
  lookupMeta = [];
13187
13051
  enrichedDocs = docs.map(function (doc) { return (__assign({}, doc)); });
13188
13052
  _loop_4 = function (fieldEntry) {
13189
- var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_17_1;
13190
- var e_17, _c;
13053
+ var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_16_1;
13054
+ var e_16, _c;
13191
13055
  return __generator(this, function (_d) {
13192
13056
  switch (_d.label) {
13193
13057
  case 0:
@@ -13361,7 +13225,7 @@ function applyIdLookupDisplayEnrichment(params) {
13361
13225
  _d.label = 1;
13362
13226
  case 1:
13363
13227
  _d.trys.push([1, 6, 7, 8]);
13364
- filteredCandidates_1 = (e_17 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
13228
+ filteredCandidates_1 = (e_16 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
13365
13229
  _d.label = 2;
13366
13230
  case 2:
13367
13231
  if (!!filteredCandidates_1_1.done) return [3 /*break*/, 5];
@@ -13377,14 +13241,14 @@ function applyIdLookupDisplayEnrichment(params) {
13377
13241
  return [3 /*break*/, 2];
13378
13242
  case 5: return [3 /*break*/, 8];
13379
13243
  case 6:
13380
- e_17_1 = _d.sent();
13381
- e_17 = { error: e_17_1 };
13244
+ e_16_1 = _d.sent();
13245
+ e_16 = { error: e_16_1 };
13382
13246
  return [3 /*break*/, 8];
13383
13247
  case 7:
13384
13248
  try {
13385
13249
  if (filteredCandidates_1_1 && !filteredCandidates_1_1.done && (_c = filteredCandidates_1.return)) _c.call(filteredCandidates_1);
13386
13250
  }
13387
- finally { if (e_17) throw e_17.error; }
13251
+ finally { if (e_16) throw e_16.error; }
13388
13252
  return [7 /*endfinally*/];
13389
13253
  case 8: return [2 /*return*/];
13390
13254
  }
@@ -13407,14 +13271,14 @@ function applyIdLookupDisplayEnrichment(params) {
13407
13271
  return [3 /*break*/, 3];
13408
13272
  case 6: return [3 /*break*/, 9];
13409
13273
  case 7:
13410
- e_16_1 = _b.sent();
13411
- e_16 = { error: e_16_1 };
13274
+ e_15_1 = _b.sent();
13275
+ e_15 = { error: e_15_1 };
13412
13276
  return [3 /*break*/, 9];
13413
13277
  case 8:
13414
13278
  try {
13415
13279
  if (idFields_1_1 && !idFields_1_1.done && (_a = idFields_1.return)) _a.call(idFields_1);
13416
13280
  }
13417
- finally { if (e_16) throw e_16.error; }
13281
+ finally { if (e_15) throw e_15.error; }
13418
13282
  return [7 /*endfinally*/];
13419
13283
  case 9:
13420
13284
  if (!lookupMeta.length) {
@@ -13433,7 +13297,7 @@ function applyIdLookupDisplayEnrichment(params) {
13433
13297
  });
13434
13298
  }
13435
13299
  function hasNonEmptyValue(docs, fieldPath, options) {
13436
- var e_18, _a;
13300
+ var e_17, _a;
13437
13301
  if (!Array.isArray(docs) || !fieldPath) {
13438
13302
  return false;
13439
13303
  }
@@ -13450,12 +13314,12 @@ function hasNonEmptyValue(docs, fieldPath, options) {
13450
13314
  }
13451
13315
  }
13452
13316
  }
13453
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
13317
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
13454
13318
  finally {
13455
13319
  try {
13456
13320
  if (docs_4_1 && !docs_4_1.done && (_a = docs_4.return)) _a.call(docs_4);
13457
13321
  }
13458
- finally { if (e_18) throw e_18.error; }
13322
+ finally { if (e_17) throw e_17.error; }
13459
13323
  }
13460
13324
  return false;
13461
13325
  }
@@ -16071,7 +15935,7 @@ function flattenAssistantExprClauses(expr) {
16071
15935
  return [expr];
16072
15936
  }
16073
15937
  function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
16074
- var e_19, _a;
15938
+ var e_18, _a;
16075
15939
  var clauses = flattenAssistantExprClauses(expr);
16076
15940
  if (!clauses.length) {
16077
15941
  return null;
@@ -16145,12 +16009,12 @@ function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
16145
16009
  return state_4.value;
16146
16010
  }
16147
16011
  }
16148
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
16012
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
16149
16013
  finally {
16150
16014
  try {
16151
16015
  if (lowerClauses_1_1 && !lowerClauses_1_1.done && (_a = lowerClauses_1.return)) _a.call(lowerClauses_1);
16152
16016
  }
16153
- finally { if (e_19) throw e_19.error; }
16017
+ finally { if (e_18) throw e_18.error; }
16154
16018
  }
16155
16019
  return null;
16156
16020
  }
@@ -16213,7 +16077,7 @@ function resolveAssistantMonthlyGroupDateFields(pipeline) {
16213
16077
  return fields;
16214
16078
  }
16215
16079
  function detectAssistantMonthWindowFromPipeline(pipeline) {
16216
- var e_20, _a;
16080
+ var e_19, _a;
16217
16081
  var _b;
16218
16082
  var monthlyFields = resolveAssistantMonthlyGroupDateFields(pipeline);
16219
16083
  var scanMatch = function (match) {
@@ -16241,12 +16105,12 @@ function detectAssistantMonthWindowFromPipeline(pipeline) {
16241
16105
  }
16242
16106
  }
16243
16107
  }
16244
- catch (e_20_1) { e_20 = { error: e_20_1 }; }
16108
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
16245
16109
  finally {
16246
16110
  try {
16247
16111
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
16248
16112
  }
16249
- finally { if (e_20) throw e_20.error; }
16113
+ finally { if (e_19) throw e_19.error; }
16250
16114
  }
16251
16115
  return null;
16252
16116
  }
@@ -16526,7 +16390,7 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
16526
16390
  var nextProject = __assign({}, project);
16527
16391
  var stageChanged = false;
16528
16392
  Object.keys(nextProject).forEach(function (field) {
16529
- var e_21, _a;
16393
+ var e_20, _a;
16530
16394
  var expression = nextProject[field];
16531
16395
  if (typeof expression !== 'string') {
16532
16396
  return;
@@ -16562,12 +16426,12 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
16562
16426
  break;
16563
16427
  }
16564
16428
  }
16565
- catch (e_21_1) { e_21 = { error: e_21_1 }; }
16429
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
16566
16430
  finally {
16567
16431
  try {
16568
16432
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
16569
16433
  }
16570
- finally { if (e_21) throw e_21.error; }
16434
+ finally { if (e_20) throw e_20.error; }
16571
16435
  }
16572
16436
  });
16573
16437
  if (stageChanged) {
@@ -16740,7 +16604,7 @@ function matchContainsField(value, field) {
16740
16604
  });
16741
16605
  }
16742
16606
  function resolveAggregateCompletionFallback(pipeline) {
16743
- var e_22, _a;
16607
+ var e_21, _a;
16744
16608
  if (!Array.isArray(pipeline)) {
16745
16609
  return null;
16746
16610
  }
@@ -16753,7 +16617,7 @@ function resolveAggregateCompletionFallback(pipeline) {
16753
16617
  }
16754
16618
  var addFields = stage.$addFields;
16755
16619
  try {
16756
- for (var _b = (e_22 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
16620
+ for (var _b = (e_21 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
16757
16621
  var key = _c.value;
16758
16622
  if (!isCompletionFieldName(key)) {
16759
16623
  continue;
@@ -16767,12 +16631,12 @@ function resolveAggregateCompletionFallback(pipeline) {
16767
16631
  }
16768
16632
  }
16769
16633
  }
16770
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
16634
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
16771
16635
  finally {
16772
16636
  try {
16773
16637
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
16774
16638
  }
16775
- finally { if (e_22) throw e_22.error; }
16639
+ finally { if (e_21) throw e_21.error; }
16776
16640
  }
16777
16641
  if (candidateField) {
16778
16642
  break;
@@ -16928,7 +16792,7 @@ function buildCompletionFallbackSources(field) {
16928
16792
  ]);
16929
16793
  }
16930
16794
  function resolveAggregateCompletionExprFallback(pipeline) {
16931
- var e_23, _a;
16795
+ var e_22, _a;
16932
16796
  if (!Array.isArray(pipeline)) {
16933
16797
  return null;
16934
16798
  }
@@ -16948,7 +16812,7 @@ function resolveAggregateCompletionExprFallback(pipeline) {
16948
16812
  }
16949
16813
  if (!candidateField) {
16950
16814
  try {
16951
- for (var _b = (e_23 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
16815
+ for (var _b = (e_22 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
16952
16816
  var key = _c.value;
16953
16817
  if (key.startsWith('$')) {
16954
16818
  continue;
@@ -16963,12 +16827,12 @@ function resolveAggregateCompletionExprFallback(pipeline) {
16963
16827
  }
16964
16828
  }
16965
16829
  }
16966
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
16830
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
16967
16831
  finally {
16968
16832
  try {
16969
16833
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
16970
16834
  }
16971
- finally { if (e_23) throw e_23.error; }
16835
+ finally { if (e_22) throw e_22.error; }
16972
16836
  }
16973
16837
  }
16974
16838
  if (!candidateField) {
@@ -17170,7 +17034,7 @@ function hasAssistantDateGroupingOperator(value) {
17170
17034
  return Object.keys(value).some(function (key) { return hasAssistantDateGroupingOperator(value[key]); });
17171
17035
  }
17172
17036
  function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths) {
17173
- var e_24, _a, e_25, _b;
17037
+ var e_23, _a, e_24, _b;
17174
17038
  if (!Array.isArray(pipeline) || groupIndex <= 0 || !groupPaths.length) {
17175
17039
  return false;
17176
17040
  }
@@ -17196,14 +17060,14 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
17196
17060
  continue;
17197
17061
  }
17198
17062
  try {
17199
- for (var stageKeys_1 = (e_24 = void 0, __values(stageKeys)), stageKeys_1_1 = stageKeys_1.next(); !stageKeys_1_1.done; stageKeys_1_1 = stageKeys_1.next()) {
17063
+ for (var stageKeys_1 = (e_23 = void 0, __values(stageKeys)), stageKeys_1_1 = stageKeys_1.next(); !stageKeys_1_1.done; stageKeys_1_1 = stageKeys_1.next()) {
17200
17064
  var stageKey = stageKeys_1_1.value;
17201
17065
  var payload = stage[stageKey];
17202
17066
  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
17203
17067
  continue;
17204
17068
  }
17205
17069
  try {
17206
- for (var groupFields_1 = (e_25 = void 0, __values(groupFields)), groupFields_1_1 = groupFields_1.next(); !groupFields_1_1.done; groupFields_1_1 = groupFields_1.next()) {
17070
+ for (var groupFields_1 = (e_24 = void 0, __values(groupFields)), groupFields_1_1 = groupFields_1.next(); !groupFields_1_1.done; groupFields_1_1 = groupFields_1.next()) {
17207
17071
  var groupField = groupFields_1_1.value;
17208
17072
  if (!Object.prototype.hasOwnProperty.call(payload, groupField)) {
17209
17073
  continue;
@@ -17213,21 +17077,21 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
17213
17077
  }
17214
17078
  }
17215
17079
  }
17216
- catch (e_25_1) { e_25 = { error: e_25_1 }; }
17080
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
17217
17081
  finally {
17218
17082
  try {
17219
17083
  if (groupFields_1_1 && !groupFields_1_1.done && (_b = groupFields_1.return)) _b.call(groupFields_1);
17220
17084
  }
17221
- finally { if (e_25) throw e_25.error; }
17085
+ finally { if (e_24) throw e_24.error; }
17222
17086
  }
17223
17087
  }
17224
17088
  }
17225
- catch (e_24_1) { e_24 = { error: e_24_1 }; }
17089
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
17226
17090
  finally {
17227
17091
  try {
17228
17092
  if (stageKeys_1_1 && !stageKeys_1_1.done && (_a = stageKeys_1.return)) _a.call(stageKeys_1);
17229
17093
  }
17230
- finally { if (e_24) throw e_24.error; }
17094
+ finally { if (e_23) throw e_23.error; }
17231
17095
  }
17232
17096
  }
17233
17097
  return false;
@@ -17334,7 +17198,7 @@ function isRegexMatchCondition(value) {
17334
17198
  return false;
17335
17199
  }
17336
17200
  function findRegexMatchInMatchObject(match, prefix) {
17337
- var e_26, _a, e_27, _b;
17201
+ var e_25, _a, e_26, _b;
17338
17202
  if (prefix === void 0) { prefix = ''; }
17339
17203
  if (Array.isArray(match)) {
17340
17204
  try {
@@ -17346,12 +17210,12 @@ function findRegexMatchInMatchObject(match, prefix) {
17346
17210
  }
17347
17211
  }
17348
17212
  }
17349
- catch (e_26_1) { e_26 = { error: e_26_1 }; }
17213
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
17350
17214
  finally {
17351
17215
  try {
17352
17216
  if (match_1_1 && !match_1_1.done && (_a = match_1.return)) _a.call(match_1);
17353
17217
  }
17354
- finally { if (e_26) throw e_26.error; }
17218
+ finally { if (e_25) throw e_25.error; }
17355
17219
  }
17356
17220
  return null;
17357
17221
  }
@@ -17382,12 +17246,12 @@ function findRegexMatchInMatchObject(match, prefix) {
17382
17246
  }
17383
17247
  }
17384
17248
  }
17385
- catch (e_27_1) { e_27 = { error: e_27_1 }; }
17249
+ catch (e_26_1) { e_26 = { error: e_26_1 }; }
17386
17250
  finally {
17387
17251
  try {
17388
17252
  if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
17389
17253
  }
17390
- finally { if (e_27) throw e_27.error; }
17254
+ finally { if (e_26) throw e_26.error; }
17391
17255
  }
17392
17256
  return null;
17393
17257
  }
@@ -17776,7 +17640,7 @@ function collectMatchFieldsByCondition(match, predicate, prefix) {
17776
17640
  return results;
17777
17641
  }
17778
17642
  function findMatchConditionForField(match, targetField, prefix) {
17779
- var e_28, _a, e_29, _b;
17643
+ var e_27, _a, e_28, _b;
17780
17644
  if (prefix === void 0) { prefix = ''; }
17781
17645
  if (!match || typeof match !== 'object') {
17782
17646
  return undefined;
@@ -17791,12 +17655,12 @@ function findMatchConditionForField(match, targetField, prefix) {
17791
17655
  }
17792
17656
  }
17793
17657
  }
17794
- catch (e_28_1) { e_28 = { error: e_28_1 }; }
17658
+ catch (e_27_1) { e_27 = { error: e_27_1 }; }
17795
17659
  finally {
17796
17660
  try {
17797
17661
  if (match_2_1 && !match_2_1.done && (_a = match_2.return)) _a.call(match_2);
17798
17662
  }
17799
- finally { if (e_28) throw e_28.error; }
17663
+ finally { if (e_27) throw e_27.error; }
17800
17664
  }
17801
17665
  return undefined;
17802
17666
  }
@@ -17823,12 +17687,12 @@ function findMatchConditionForField(match, targetField, prefix) {
17823
17687
  }
17824
17688
  }
17825
17689
  }
17826
- catch (e_29_1) { e_29 = { error: e_29_1 }; }
17690
+ catch (e_28_1) { e_28 = { error: e_28_1 }; }
17827
17691
  finally {
17828
17692
  try {
17829
17693
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
17830
17694
  }
17831
- finally { if (e_29) throw e_29.error; }
17695
+ finally { if (e_28) throw e_28.error; }
17832
17696
  }
17833
17697
  return undefined;
17834
17698
  }
@@ -18061,7 +17925,7 @@ function detectIdLikeValue(value) {
18061
17925
  return false;
18062
17926
  }
18063
17927
  function detectChemicalIdFromProbe(probeDocs, fields) {
18064
- var e_30, _a, e_31, _b;
17928
+ var e_29, _a, e_30, _b;
18065
17929
  if (!Array.isArray(probeDocs) || !probeDocs.length) {
18066
17930
  return false;
18067
17931
  }
@@ -18073,7 +17937,7 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
18073
17937
  for (var probeDocs_1 = __values(probeDocs), probeDocs_1_1 = probeDocs_1.next(); !probeDocs_1_1.done; probeDocs_1_1 = probeDocs_1.next()) {
18074
17938
  var doc = probeDocs_1_1.value;
18075
17939
  try {
18076
- for (var targets_1 = (e_31 = void 0, __values(targets)), targets_1_1 = targets_1.next(); !targets_1_1.done; targets_1_1 = targets_1.next()) {
17940
+ for (var targets_1 = (e_30 = void 0, __values(targets)), targets_1_1 = targets_1.next(); !targets_1_1.done; targets_1_1 = targets_1.next()) {
18077
17941
  var field = targets_1_1.value;
18078
17942
  var value = getValueAtPath(doc, field);
18079
17943
  if (Array.isArray(value)) {
@@ -18086,21 +17950,21 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
18086
17950
  }
18087
17951
  }
18088
17952
  }
18089
- catch (e_31_1) { e_31 = { error: e_31_1 }; }
17953
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
18090
17954
  finally {
18091
17955
  try {
18092
17956
  if (targets_1_1 && !targets_1_1.done && (_b = targets_1.return)) _b.call(targets_1);
18093
17957
  }
18094
- finally { if (e_31) throw e_31.error; }
17958
+ finally { if (e_30) throw e_30.error; }
18095
17959
  }
18096
17960
  }
18097
17961
  }
18098
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
17962
+ catch (e_29_1) { e_29 = { error: e_29_1 }; }
18099
17963
  finally {
18100
17964
  try {
18101
17965
  if (probeDocs_1_1 && !probeDocs_1_1.done && (_a = probeDocs_1.return)) _a.call(probeDocs_1);
18102
17966
  }
18103
- finally { if (e_30) throw e_30.error; }
17967
+ finally { if (e_29) throw e_29.error; }
18104
17968
  }
18105
17969
  return false;
18106
17970
  }
@@ -18321,8 +18185,8 @@ function buildChemicalIdFieldCandidates(field) {
18321
18185
  }
18322
18186
  function applyChemicalNameLookupFallbackToQuery(params) {
18323
18187
  return __awaiter(this, void 0, void 0, function () {
18324
- var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, chemicalFields, targetField, condition, regex, sampleDocs, collectionNames, candidates, _loop_8, candidates_1, candidates_1_1, candidate, state_5, e_32_1;
18325
- var e_32, _a;
18188
+ var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, chemicalFields, targetField, condition, regex, sampleDocs, collectionNames, candidates, _loop_8, candidates_1, candidates_1_1, candidate, state_5, e_31_1;
18189
+ var e_31, _a;
18326
18190
  var _b;
18327
18191
  return __generator(this, function (_c) {
18328
18192
  switch (_c.label) {
@@ -18435,14 +18299,14 @@ function applyChemicalNameLookupFallbackToQuery(params) {
18435
18299
  return [3 /*break*/, 3];
18436
18300
  case 6: return [3 /*break*/, 9];
18437
18301
  case 7:
18438
- e_32_1 = _c.sent();
18439
- e_32 = { error: e_32_1 };
18302
+ e_31_1 = _c.sent();
18303
+ e_31 = { error: e_31_1 };
18440
18304
  return [3 /*break*/, 9];
18441
18305
  case 8:
18442
18306
  try {
18443
18307
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
18444
18308
  }
18445
- finally { if (e_32) throw e_32.error; }
18309
+ finally { if (e_31) throw e_31.error; }
18446
18310
  return [7 /*endfinally*/];
18447
18311
  case 9: return [2 /*return*/, null];
18448
18312
  }
@@ -18542,8 +18406,8 @@ function lookupIdsForNameMatch(params) {
18542
18406
  }
18543
18407
  function applyIdLookupFallbackToQuery(params) {
18544
18408
  return __awaiter(this, void 0, void 0, function () {
18545
- var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, conditions, collectionNames, _a, conditions_1, conditions_1_1, condition, regex, baseToken, targetFieldType, nextValue, localNameField, candidates, candidates_2, candidates_2_1, candidate, candidateHasClientScope, _b, candidateProbe, lookup, targetFieldType, normalizedIds, idsForQuery, e_33_1, e_34_1;
18546
- var e_34, _c, e_33, _d;
18409
+ var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, conditions, collectionNames, _a, conditions_1, conditions_1_1, condition, regex, baseToken, targetFieldType, nextValue, localNameField, candidates, candidates_2, candidates_2_1, candidate, candidateHasClientScope, _b, candidateProbe, lookup, targetFieldType, normalizedIds, idsForQuery, e_32_1, e_33_1;
18410
+ var e_33, _c, e_32, _d;
18547
18411
  var _e;
18548
18412
  return __generator(this, function (_f) {
18549
18413
  switch (_f.label) {
@@ -18613,7 +18477,7 @@ function applyIdLookupFallbackToQuery(params) {
18613
18477
  _f.label = 5;
18614
18478
  case 5:
18615
18479
  _f.trys.push([5, 14, 15, 16]);
18616
- candidates_2 = (e_33 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
18480
+ candidates_2 = (e_32 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
18617
18481
  _f.label = 6;
18618
18482
  case 6:
18619
18483
  if (!!candidates_2_1.done) return [3 /*break*/, 13];
@@ -18680,28 +18544,28 @@ function applyIdLookupFallbackToQuery(params) {
18680
18544
  return [3 /*break*/, 6];
18681
18545
  case 13: return [3 /*break*/, 16];
18682
18546
  case 14:
18683
- e_33_1 = _f.sent();
18684
- e_33 = { error: e_33_1 };
18547
+ e_32_1 = _f.sent();
18548
+ e_32 = { error: e_32_1 };
18685
18549
  return [3 /*break*/, 16];
18686
18550
  case 15:
18687
18551
  try {
18688
18552
  if (candidates_2_1 && !candidates_2_1.done && (_d = candidates_2.return)) _d.call(candidates_2);
18689
18553
  }
18690
- finally { if (e_33) throw e_33.error; }
18554
+ finally { if (e_32) throw e_32.error; }
18691
18555
  return [7 /*endfinally*/];
18692
18556
  case 16:
18693
18557
  conditions_1_1 = conditions_1.next();
18694
18558
  return [3 /*break*/, 4];
18695
18559
  case 17: return [3 /*break*/, 20];
18696
18560
  case 18:
18697
- e_34_1 = _f.sent();
18698
- e_34 = { error: e_34_1 };
18561
+ e_33_1 = _f.sent();
18562
+ e_33 = { error: e_33_1 };
18699
18563
  return [3 /*break*/, 20];
18700
18564
  case 19:
18701
18565
  try {
18702
18566
  if (conditions_1_1 && !conditions_1_1.done && (_c = conditions_1.return)) _c.call(conditions_1);
18703
18567
  }
18704
- finally { if (e_34) throw e_34.error; }
18568
+ finally { if (e_33) throw e_33.error; }
18705
18569
  return [7 /*endfinally*/];
18706
18570
  case 20: return [2 /*return*/, null];
18707
18571
  }
@@ -19146,8 +19010,8 @@ function resolveAssistantSurfaceFileCandidates(baseName) {
19146
19010
  }
19147
19011
  function readFirstAssistantSurfaceFile(candidates) {
19148
19012
  return __awaiter(this, void 0, void 0, function () {
19149
- var candidates_3, candidates_3_1, candidate, normalized, _a, e_35_1;
19150
- var e_35, _b;
19013
+ var candidates_3, candidates_3_1, candidate, normalized, _a, e_34_1;
19014
+ var e_34, _b;
19151
19015
  return __generator(this, function (_c) {
19152
19016
  switch (_c.label) {
19153
19017
  case 0:
@@ -19174,14 +19038,14 @@ function readFirstAssistantSurfaceFile(candidates) {
19174
19038
  return [3 /*break*/, 1];
19175
19039
  case 6: return [3 /*break*/, 9];
19176
19040
  case 7:
19177
- e_35_1 = _c.sent();
19178
- e_35 = { error: e_35_1 };
19041
+ e_34_1 = _c.sent();
19042
+ e_34 = { error: e_34_1 };
19179
19043
  return [3 /*break*/, 9];
19180
19044
  case 8:
19181
19045
  try {
19182
19046
  if (candidates_3_1 && !candidates_3_1.done && (_b = candidates_3.return)) _b.call(candidates_3);
19183
19047
  }
19184
- finally { if (e_35) throw e_35.error; }
19048
+ finally { if (e_34) throw e_34.error; }
19185
19049
  return [7 /*endfinally*/];
19186
19050
  case 9: return [2 /*return*/, ''];
19187
19051
  }
@@ -20916,7 +20780,7 @@ function doesAssistantPreserveAnyTermMatch(text, terms) {
20916
20780
  return (Array.isArray(terms) ? terms : []).some(function (term) { return doesAssistantPreserveTermMatch(text, term); });
20917
20781
  }
20918
20782
  function shouldPreserveAssistantCollectionForRouteFromRules(params) {
20919
- var e_36, _a;
20783
+ var e_35, _a;
20920
20784
  var _b, _c, _d, _e, _f, _g, _h;
20921
20785
  var routePreferred = normalizeAssistantCollectionOverrideName(params.routePreferredName);
20922
20786
  var requested = normalizeAssistantCollectionOverrideName(params.requestedCollection);
@@ -20948,12 +20812,12 @@ function shouldPreserveAssistantCollectionForRouteFromRules(params) {
20948
20812
  return true;
20949
20813
  }
20950
20814
  }
20951
- catch (e_36_1) { e_36 = { error: e_36_1 }; }
20815
+ catch (e_35_1) { e_35 = { error: e_35_1 }; }
20952
20816
  finally {
20953
20817
  try {
20954
20818
  if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
20955
20819
  }
20956
- finally { if (e_36) throw e_36.error; }
20820
+ finally { if (e_35) throw e_35.error; }
20957
20821
  }
20958
20822
  return false;
20959
20823
  }
@@ -21844,7 +21708,7 @@ function resolveAssistantNestedPrefixCollectionCandidates(params) {
21844
21708
  function resolveAssistantNestedAggregateFallbacks(params) {
21845
21709
  return __awaiter(this, void 0, void 0, function () {
21846
21710
  var prefixes, collectionNames, fallbacks, seen, prefixes_1, prefixes_1_1, prefix, rewrite, candidates, candidates_4, candidates_4_1, candidate, normalizedPipeline, key;
21847
- var e_37, _a, e_38, _b;
21711
+ var e_36, _a, e_37, _b;
21848
21712
  return __generator(this, function (_c) {
21849
21713
  switch (_c.label) {
21850
21714
  case 0:
@@ -21874,7 +21738,7 @@ function resolveAssistantNestedAggregateFallbacks(params) {
21874
21738
  triedCollections: params.triedCollections
21875
21739
  });
21876
21740
  try {
21877
- for (candidates_4 = (e_38 = void 0, __values(candidates)), candidates_4_1 = candidates_4.next(); !candidates_4_1.done; candidates_4_1 = candidates_4.next()) {
21741
+ for (candidates_4 = (e_37 = void 0, __values(candidates)), candidates_4_1 = candidates_4.next(); !candidates_4_1.done; candidates_4_1 = candidates_4.next()) {
21878
21742
  candidate = candidates_4_1.value;
21879
21743
  normalizedPipeline = normalizeAssistantAggregatePipeline(rewrite.pipeline, candidate);
21880
21744
  if (!normalizedPipeline.length || containsForbiddenMongoOperators(normalizedPipeline)) {
@@ -21896,21 +21760,21 @@ function resolveAssistantNestedAggregateFallbacks(params) {
21896
21760
  }
21897
21761
  }
21898
21762
  }
21899
- catch (e_38_1) { e_38 = { error: e_38_1 }; }
21763
+ catch (e_37_1) { e_37 = { error: e_37_1 }; }
21900
21764
  finally {
21901
21765
  try {
21902
21766
  if (candidates_4_1 && !candidates_4_1.done && (_b = candidates_4.return)) _b.call(candidates_4);
21903
21767
  }
21904
- finally { if (e_38) throw e_38.error; }
21768
+ finally { if (e_37) throw e_37.error; }
21905
21769
  }
21906
21770
  }
21907
21771
  }
21908
- catch (e_37_1) { e_37 = { error: e_37_1 }; }
21772
+ catch (e_36_1) { e_36 = { error: e_36_1 }; }
21909
21773
  finally {
21910
21774
  try {
21911
21775
  if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
21912
21776
  }
21913
- finally { if (e_37) throw e_37.error; }
21777
+ finally { if (e_36) throw e_36.error; }
21914
21778
  }
21915
21779
  return [2 /*return*/, fallbacks];
21916
21780
  }
@@ -22042,8 +21906,8 @@ function resolveAssistantBridgeCollectionHintCandidates(requestedCollection, req
22042
21906
  }
22043
21907
  function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22044
21908
  return __awaiter(this, arguments, void 0, function (collection, db, dbName, options) {
22045
- var normalized, resolutionPath, pushResolutionStep, finalizeResolution, requestHints, appId, requestedTokens, requestedTokenWeights, aliasCandidates, hintCandidates, alias, manager, hasManager, configuredCollectionNames, isConfiguredCollection, candidates, pushCandidate, base, reportCandidate, candidates_5, candidates_5_1, candidate, model, candidates_6, candidates_6_1, candidate, primaryCollectionHint, resolverTargets, resolverErrorLogged, resolverTargets_1, resolverTargets_1_1, resolverTarget, resolved, resolvedName, resolvedScore, resolvedModel, _a, e_39_1, candidates_7, candidates_7_1, candidate, e_40_1, candidates_8, candidates_8_1, candidate;
22046
- var e_41, _b, e_42, _c, e_39, _d, e_40, _e, e_43, _f;
21909
+ var normalized, resolutionPath, pushResolutionStep, finalizeResolution, requestHints, appId, requestedTokens, requestedTokenWeights, aliasCandidates, hintCandidates, alias, manager, hasManager, configuredCollectionNames, isConfiguredCollection, candidates, pushCandidate, base, reportCandidate, candidates_5, candidates_5_1, candidate, model, candidates_6, candidates_6_1, candidate, primaryCollectionHint, resolverTargets, resolverErrorLogged, resolverTargets_1, resolverTargets_1_1, resolverTarget, resolved, resolvedName, resolvedScore, resolvedModel, _a, e_38_1, candidates_7, candidates_7_1, candidate, e_39_1, candidates_8, candidates_8_1, candidate;
21910
+ var e_40, _b, e_41, _c, e_38, _d, e_39, _e, e_42, _f;
22047
21911
  var _g, _h;
22048
21912
  if (dbName === void 0) { dbName = ''; }
22049
21913
  return __generator(this, function (_j) {
@@ -22117,12 +21981,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22117
21981
  }
22118
21982
  }
22119
21983
  }
22120
- catch (e_41_1) { e_41 = { error: e_41_1 }; }
21984
+ catch (e_40_1) { e_40 = { error: e_40_1 }; }
22121
21985
  finally {
22122
21986
  try {
22123
21987
  if (candidates_5_1 && !candidates_5_1.done && (_b = candidates_5.return)) _b.call(candidates_5);
22124
21988
  }
22125
- finally { if (e_41) throw e_41.error; }
21989
+ finally { if (e_40) throw e_40.error; }
22126
21990
  }
22127
21991
  }
22128
21992
  if (configuredCollectionNames.length) {
@@ -22137,12 +22001,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22137
22001
  }
22138
22002
  }
22139
22003
  }
22140
- catch (e_42_1) { e_42 = { error: e_42_1 }; }
22004
+ catch (e_41_1) { e_41 = { error: e_41_1 }; }
22141
22005
  finally {
22142
22006
  try {
22143
22007
  if (candidates_6_1 && !candidates_6_1.done && (_c = candidates_6.return)) _c.call(candidates_6);
22144
22008
  }
22145
- finally { if (e_42) throw e_42.error; }
22009
+ finally { if (e_41) throw e_41.error; }
22146
22010
  }
22147
22011
  }
22148
22012
  primaryCollectionHint = normalizeOptionalString((_h = requestHints === null || requestHints === void 0 ? void 0 : requestHints.collectionHints) === null || _h === void 0 ? void 0 : _h[0]);
@@ -22203,14 +22067,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22203
22067
  return [3 /*break*/, 2];
22204
22068
  case 7: return [3 /*break*/, 10];
22205
22069
  case 8:
22206
- e_39_1 = _j.sent();
22207
- e_39 = { error: e_39_1 };
22070
+ e_38_1 = _j.sent();
22071
+ e_38 = { error: e_38_1 };
22208
22072
  return [3 /*break*/, 10];
22209
22073
  case 9:
22210
22074
  try {
22211
22075
  if (resolverTargets_1_1 && !resolverTargets_1_1.done && (_d = resolverTargets_1.return)) _d.call(resolverTargets_1);
22212
22076
  }
22213
- finally { if (e_39) throw e_39.error; }
22077
+ finally { if (e_38) throw e_38.error; }
22214
22078
  return [7 /*endfinally*/];
22215
22079
  case 10:
22216
22080
  if (!db) return [3 /*break*/, 18];
@@ -22236,14 +22100,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22236
22100
  return [3 /*break*/, 12];
22237
22101
  case 15: return [3 /*break*/, 18];
22238
22102
  case 16:
22239
- e_40_1 = _j.sent();
22240
- e_40 = { error: e_40_1 };
22103
+ e_39_1 = _j.sent();
22104
+ e_39 = { error: e_39_1 };
22241
22105
  return [3 /*break*/, 18];
22242
22106
  case 17:
22243
22107
  try {
22244
22108
  if (candidates_7_1 && !candidates_7_1.done && (_e = candidates_7.return)) _e.call(candidates_7);
22245
22109
  }
22246
- finally { if (e_40) throw e_40.error; }
22110
+ finally { if (e_39) throw e_39.error; }
22247
22111
  return [7 /*endfinally*/];
22248
22112
  case 18:
22249
22113
  try {
@@ -22254,12 +22118,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22254
22118
  }
22255
22119
  }
22256
22120
  }
22257
- catch (e_43_1) { e_43 = { error: e_43_1 }; }
22121
+ catch (e_42_1) { e_42 = { error: e_42_1 }; }
22258
22122
  finally {
22259
22123
  try {
22260
22124
  if (candidates_8_1 && !candidates_8_1.done && (_f = candidates_8.return)) _f.call(candidates_8);
22261
22125
  }
22262
- finally { if (e_43) throw e_43.error; }
22126
+ finally { if (e_42) throw e_42.error; }
22263
22127
  }
22264
22128
  throw new Error('AI assistant report builder bridge: No queryable collection could be resolved.');
22265
22129
  }
@@ -22267,7 +22131,7 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22267
22131
  });
22268
22132
  }
22269
22133
  function findQueryDateField(query) {
22270
- var e_44, _a, e_45, _b;
22134
+ var e_43, _a, e_44, _b;
22271
22135
  if (!query || typeof query !== 'object') {
22272
22136
  return null;
22273
22137
  }
@@ -22281,12 +22145,12 @@ function findQueryDateField(query) {
22281
22145
  }
22282
22146
  }
22283
22147
  }
22284
- catch (e_44_1) { e_44 = { error: e_44_1 }; }
22148
+ catch (e_43_1) { e_43 = { error: e_43_1 }; }
22285
22149
  finally {
22286
22150
  try {
22287
22151
  if (query_1_1 && !query_1_1.done && (_a = query_1.return)) _a.call(query_1);
22288
22152
  }
22289
- finally { if (e_44) throw e_44.error; }
22153
+ finally { if (e_43) throw e_43.error; }
22290
22154
  }
22291
22155
  return null;
22292
22156
  }
@@ -22305,12 +22169,12 @@ function findQueryDateField(query) {
22305
22169
  }
22306
22170
  }
22307
22171
  }
22308
- catch (e_45_1) { e_45 = { error: e_45_1 }; }
22172
+ catch (e_44_1) { e_44 = { error: e_44_1 }; }
22309
22173
  finally {
22310
22174
  try {
22311
22175
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
22312
22176
  }
22313
- finally { if (e_45) throw e_45.error; }
22177
+ finally { if (e_44) throw e_44.error; }
22314
22178
  }
22315
22179
  return null;
22316
22180
  }
@@ -22598,7 +22462,7 @@ function resolveQueryDateFieldFallback(query) {
22598
22462
  return { from: dateField, to: fallback };
22599
22463
  }
22600
22464
  function containsForbiddenMongoOperators(value) {
22601
- var e_46, _a;
22465
+ var e_45, _a;
22602
22466
  if (!value || typeof value !== 'object') {
22603
22467
  return false;
22604
22468
  }
@@ -22617,12 +22481,12 @@ function containsForbiddenMongoOperators(value) {
22617
22481
  }
22618
22482
  }
22619
22483
  }
22620
- catch (e_46_1) { e_46 = { error: e_46_1 }; }
22484
+ catch (e_45_1) { e_45 = { error: e_45_1 }; }
22621
22485
  finally {
22622
22486
  try {
22623
22487
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
22624
22488
  }
22625
- finally { if (e_46) throw e_46.error; }
22489
+ finally { if (e_45) throw e_45.error; }
22626
22490
  }
22627
22491
  return false;
22628
22492
  }
@@ -22807,7 +22671,7 @@ function splitAssistantPermissionTokenSets(value) {
22807
22671
  };
22808
22672
  }
22809
22673
  function isAssistantTokenSetSubset(subset, superset) {
22810
- var e_47, _a;
22674
+ var e_46, _a;
22811
22675
  if (!subset.size) {
22812
22676
  return false;
22813
22677
  }
@@ -22819,12 +22683,12 @@ function isAssistantTokenSetSubset(subset, superset) {
22819
22683
  }
22820
22684
  }
22821
22685
  }
22822
- catch (e_47_1) { e_47 = { error: e_47_1 }; }
22686
+ catch (e_46_1) { e_46 = { error: e_46_1 }; }
22823
22687
  finally {
22824
22688
  try {
22825
22689
  if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1);
22826
22690
  }
22827
- finally { if (e_47) throw e_47.error; }
22691
+ finally { if (e_46) throw e_46.error; }
22828
22692
  }
22829
22693
  return true;
22830
22694
  }
@@ -23359,8 +23223,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
23359
23223
  }
23360
23224
  function waitForCodexWorkerMessage(worker, streamStatusHandler) {
23361
23225
  return __awaiter(this, void 0, void 0, function () {
23362
- var _a, _b, _c, _d, message, payload, status_1, e_48_1;
23363
- var _e, e_48, _f, _g;
23226
+ var _a, _b, _c, _d, message, payload, status_1, e_47_1;
23227
+ var _e, e_47, _f, _g;
23364
23228
  return __generator(this, function (_h) {
23365
23229
  switch (_h.label) {
23366
23230
  case 0:
@@ -23387,8 +23251,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
23387
23251
  return [3 /*break*/, 1];
23388
23252
  case 4: return [3 /*break*/, 11];
23389
23253
  case 5:
23390
- e_48_1 = _h.sent();
23391
- e_48 = { error: e_48_1 };
23254
+ e_47_1 = _h.sent();
23255
+ e_47 = { error: e_47_1 };
23392
23256
  return [3 /*break*/, 11];
23393
23257
  case 6:
23394
23258
  _h.trys.push([6, , 9, 10]);
@@ -23399,7 +23263,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
23399
23263
  _h.label = 8;
23400
23264
  case 8: return [3 /*break*/, 10];
23401
23265
  case 9:
23402
- if (e_48) throw e_48.error;
23266
+ if (e_47) throw e_47.error;
23403
23267
  return [7 /*endfinally*/];
23404
23268
  case 10: return [7 /*endfinally*/];
23405
23269
  case 11: throw new CodexWorkerBootstrapError('AI worker exited before completing.');
@@ -23743,8 +23607,8 @@ function buildAssistantWorkspaceRootCandidates(params) {
23743
23607
  }
23744
23608
  function resolveAssistantWorkspaceRoot() {
23745
23609
  return __awaiter(this, void 0, void 0, function () {
23746
- var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_49_1;
23747
- var e_49, _b;
23610
+ var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_48_1;
23611
+ var e_48, _b;
23748
23612
  return __generator(this, function (_c) {
23749
23613
  switch (_c.label) {
23750
23614
  case 0:
@@ -23791,14 +23655,14 @@ function resolveAssistantWorkspaceRoot() {
23791
23655
  return [3 /*break*/, 2];
23792
23656
  case 8: return [3 /*break*/, 11];
23793
23657
  case 9:
23794
- e_49_1 = _c.sent();
23795
- e_49 = { error: e_49_1 };
23658
+ e_48_1 = _c.sent();
23659
+ e_48 = { error: e_48_1 };
23796
23660
  return [3 /*break*/, 11];
23797
23661
  case 10:
23798
23662
  try {
23799
23663
  if (candidates_9_1 && !candidates_9_1.done && (_b = candidates_9.return)) _b.call(candidates_9);
23800
23664
  }
23801
- finally { if (e_49) throw e_49.error; }
23665
+ finally { if (e_48) throw e_48.error; }
23802
23666
  return [7 /*endfinally*/];
23803
23667
  case 11:
23804
23668
  if (firstNestedGitRoot) {
@@ -24241,7 +24105,7 @@ var AI_ASSISTANT_BREAKDOWN_DIMENSION_STOPWORDS = new Set([
24241
24105
  'by'
24242
24106
  ]);
24243
24107
  function normalizeAssistantBreakdownDimension(value) {
24244
- var e_50, _a;
24108
+ var e_49, _a;
24245
24109
  var normalized = normalizeOptionalString(value)
24246
24110
  .toLowerCase()
24247
24111
  .replace(/[^a-z0-9_\s-]+/g, ' ')
@@ -24273,12 +24137,12 @@ function normalizeAssistantBreakdownDimension(value) {
24273
24137
  }
24274
24138
  }
24275
24139
  }
24276
- catch (e_50_1) { e_50 = { error: e_50_1 }; }
24140
+ catch (e_49_1) { e_49 = { error: e_49_1 }; }
24277
24141
  finally {
24278
24142
  try {
24279
24143
  if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
24280
24144
  }
24281
- finally { if (e_50) throw e_50.error; }
24145
+ finally { if (e_49) throw e_49.error; }
24282
24146
  }
24283
24147
  if (!kept.length) {
24284
24148
  return '';
@@ -24483,7 +24347,7 @@ function resolveAssistantPlannerEnabled(config) {
24483
24347
  return raw === undefined ? false : raw === true;
24484
24348
  }
24485
24349
  function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
24486
- var e_51, _a;
24350
+ var e_50, _a;
24487
24351
  var _b;
24488
24352
  if (isSuperAdmin === void 0) { isSuperAdmin = false; }
24489
24353
  var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
@@ -24497,12 +24361,12 @@ function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
24497
24361
  }
24498
24362
  }
24499
24363
  }
24500
- catch (e_51_1) { e_51 = { error: e_51_1 }; }
24364
+ catch (e_50_1) { e_50 = { error: e_50_1 }; }
24501
24365
  finally {
24502
24366
  try {
24503
24367
  if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
24504
24368
  }
24505
- finally { if (e_51) throw e_51.error; }
24369
+ finally { if (e_50) throw e_50.error; }
24506
24370
  }
24507
24371
  var normalizedRoutes = Array.from(unique);
24508
24372
  var allowedRoutes = collectAssistantAllowedRoutesForUser(user, normalizedRoutes, isSuperAdmin);
@@ -24878,7 +24742,7 @@ function normalizeRouteMatchKey(value) {
24878
24742
  return normalizeRouteKey(value).toLowerCase();
24879
24743
  }
24880
24744
  function buildClientRouteIndex() {
24881
- var e_52, _a;
24745
+ var e_51, _a;
24882
24746
  var _b;
24883
24747
  var routes = mergeAssistantHintValues(((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [], AI_ASSISTANT_CORE_PUBLIC_ROUTES);
24884
24748
  var set = new Set();
@@ -24897,12 +24761,12 @@ function buildClientRouteIndex() {
24897
24761
  }
24898
24762
  }
24899
24763
  }
24900
- catch (e_52_1) { e_52 = { error: e_52_1 }; }
24764
+ catch (e_51_1) { e_51 = { error: e_51_1 }; }
24901
24765
  finally {
24902
24766
  try {
24903
24767
  if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
24904
24768
  }
24905
- finally { if (e_52) throw e_52.error; }
24769
+ finally { if (e_51) throw e_51.error; }
24906
24770
  }
24907
24771
  return { set: set, map: map, size: routes.length };
24908
24772
  }
@@ -25793,8 +25657,8 @@ function shouldSkipAssistantGitDiscoveryDirectory(name) {
25793
25657
  }
25794
25658
  function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25795
25659
  return __awaiter(this, void 0, void 0, function () {
25796
- var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b, e_53_1, queue, queued, enqueue, next, entries, _c, entries_1, entries_1_1, entry, childName, candidate, gitPath, _d, e_54_1;
25797
- var e_53, _e, e_54, _f;
25660
+ var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b, e_52_1, queue, queued, enqueue, next, entries, _c, entries_1, entries_1_1, entry, childName, candidate, gitPath, _d, e_53_1;
25661
+ var e_52, _e, e_53, _f;
25798
25662
  var _g;
25799
25663
  return __generator(this, function (_h) {
25800
25664
  switch (_h.label) {
@@ -25839,14 +25703,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25839
25703
  return [3 /*break*/, 3];
25840
25704
  case 6: return [3 /*break*/, 9];
25841
25705
  case 7:
25842
- e_53_1 = _h.sent();
25843
- e_53 = { error: e_53_1 };
25706
+ e_52_1 = _h.sent();
25707
+ e_52 = { error: e_52_1 };
25844
25708
  return [3 /*break*/, 9];
25845
25709
  case 8:
25846
25710
  try {
25847
25711
  if (configuredRoots_1_1 && !configuredRoots_1_1.done && (_e = configuredRoots_1.return)) _e.call(configuredRoots_1);
25848
25712
  }
25849
- finally { if (e_53) throw e_53.error; }
25713
+ finally { if (e_52) throw e_52.error; }
25850
25714
  return [7 /*endfinally*/];
25851
25715
  case 9:
25852
25716
  queue = [];
@@ -25886,7 +25750,7 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25886
25750
  return [3 /*break*/, 14];
25887
25751
  case 14:
25888
25752
  _h.trys.push([14, 21, 22, 23]);
25889
- entries_1 = (e_54 = void 0, __values(entries)), entries_1_1 = entries_1.next();
25753
+ entries_1 = (e_53 = void 0, __values(entries)), entries_1_1 = entries_1.next();
25890
25754
  _h.label = 15;
25891
25755
  case 15:
25892
25756
  if (!!entries_1_1.done) return [3 /*break*/, 20];
@@ -25925,14 +25789,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25925
25789
  return [3 /*break*/, 15];
25926
25790
  case 20: return [3 /*break*/, 23];
25927
25791
  case 21:
25928
- e_54_1 = _h.sent();
25929
- e_54 = { error: e_54_1 };
25792
+ e_53_1 = _h.sent();
25793
+ e_53 = { error: e_53_1 };
25930
25794
  return [3 /*break*/, 23];
25931
25795
  case 22:
25932
25796
  try {
25933
25797
  if (entries_1_1 && !entries_1_1.done && (_f = entries_1.return)) _f.call(entries_1);
25934
25798
  }
25935
- finally { if (e_54) throw e_54.error; }
25799
+ finally { if (e_53) throw e_53.error; }
25936
25800
  return [7 /*endfinally*/];
25937
25801
  case 23: return [3 /*break*/, 10];
25938
25802
  case 24: return [2 /*return*/, roots];
@@ -26272,8 +26136,8 @@ function syncAssistantGitMirror(repoUrl) {
26272
26136
  }
26273
26137
  function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
26274
26138
  return __awaiter(this, void 0, void 0, function () {
26275
- var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_55_1;
26276
- var e_55, _a;
26139
+ var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_54_1;
26140
+ var e_54, _a;
26277
26141
  return __generator(this, function (_b) {
26278
26142
  switch (_b.label) {
26279
26143
  case 0: return [4 /*yield*/, resolveAssistantWorkspaceGitRoots(workspaceRoot)];
@@ -26307,14 +26171,14 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
26307
26171
  return [3 /*break*/, 3];
26308
26172
  case 6: return [3 /*break*/, 9];
26309
26173
  case 7:
26310
- e_55_1 = _b.sent();
26311
- e_55 = { error: e_55_1 };
26174
+ e_54_1 = _b.sent();
26175
+ e_54 = { error: e_54_1 };
26312
26176
  return [3 /*break*/, 9];
26313
26177
  case 8:
26314
26178
  try {
26315
26179
  if (repoUrls_1_1 && !repoUrls_1_1.done && (_a = repoUrls_1.return)) _a.call(repoUrls_1);
26316
26180
  }
26317
- finally { if (e_55) throw e_55.error; }
26181
+ finally { if (e_54) throw e_54.error; }
26318
26182
  return [7 /*endfinally*/];
26319
26183
  case 9: return [2 /*return*/, mirroredRoots];
26320
26184
  }
@@ -26323,8 +26187,8 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
26323
26187
  }
26324
26188
  function resolveAssistantChangeHistoryFastPathResponse(params) {
26325
26189
  return __awaiter(this, void 0, void 0, function () {
26326
- var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e, e_56_1;
26327
- var e_56, _f;
26190
+ var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e, e_55_1;
26191
+ var e_55, _f;
26328
26192
  return __generator(this, function (_g) {
26329
26193
  switch (_g.label) {
26330
26194
  case 0:
@@ -26446,14 +26310,14 @@ function resolveAssistantChangeHistoryFastPathResponse(params) {
26446
26310
  return [3 /*break*/, 7];
26447
26311
  case 20: return [3 /*break*/, 23];
26448
26312
  case 21:
26449
- e_56_1 = _g.sent();
26450
- e_56 = { error: e_56_1 };
26313
+ e_55_1 = _g.sent();
26314
+ e_55 = { error: e_55_1 };
26451
26315
  return [3 /*break*/, 23];
26452
26316
  case 22:
26453
26317
  try {
26454
26318
  if (gitRoots_1_1 && !gitRoots_1_1.done && (_f = gitRoots_1.return)) _f.call(gitRoots_1);
26455
26319
  }
26456
- finally { if (e_56) throw e_56.error; }
26320
+ finally { if (e_55) throw e_55.error; }
26457
26321
  return [7 /*endfinally*/];
26458
26322
  case 23:
26459
26323
  if (bestFallback) {
@@ -26634,7 +26498,7 @@ function sanitizeAssistantResponse(value) {
26634
26498
  return normalizeAssistantRoutes(normalizedCurrency);
26635
26499
  }
26636
26500
  function evaluateAssistantGuardrails(message) {
26637
- var e_57, _a;
26501
+ var e_56, _a;
26638
26502
  var normalized = String(message || '').toLowerCase();
26639
26503
  var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
26640
26504
  if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
@@ -26679,12 +26543,12 @@ function evaluateAssistantGuardrails(message) {
26679
26543
  }
26680
26544
  }
26681
26545
  }
26682
- catch (e_57_1) { e_57 = { error: e_57_1 }; }
26546
+ catch (e_56_1) { e_56 = { error: e_56_1 }; }
26683
26547
  finally {
26684
26548
  try {
26685
26549
  if (patterns_3_1 && !patterns_3_1.done && (_a = patterns_3.return)) _a.call(patterns_3);
26686
26550
  }
26687
- finally { if (e_57) throw e_57.error; }
26551
+ finally { if (e_56) throw e_56.error; }
26688
26552
  }
26689
26553
  return null;
26690
26554
  }
@@ -26789,7 +26653,7 @@ function tokenizeArithmeticExpression(expression) {
26789
26653
  return tokens;
26790
26654
  }
26791
26655
  function evaluateArithmeticExpression(expression) {
26792
- var e_58, _a, e_59, _b;
26656
+ var e_57, _a, e_58, _b;
26793
26657
  var tokens = tokenizeArithmeticExpression(expression);
26794
26658
  if (!tokens || !tokens.length) {
26795
26659
  return null;
@@ -26846,12 +26710,12 @@ function evaluateArithmeticExpression(expression) {
26846
26710
  prevToken = token;
26847
26711
  }
26848
26712
  }
26849
- catch (e_58_1) { e_58 = { error: e_58_1 }; }
26713
+ catch (e_57_1) { e_57 = { error: e_57_1 }; }
26850
26714
  finally {
26851
26715
  try {
26852
26716
  if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
26853
26717
  }
26854
- finally { if (e_58) throw e_58.error; }
26718
+ finally { if (e_57) throw e_57.error; }
26855
26719
  }
26856
26720
  while (ops.length) {
26857
26721
  var op = ops.pop();
@@ -26891,12 +26755,12 @@ function evaluateArithmeticExpression(expression) {
26891
26755
  stack.push(Number(token));
26892
26756
  }
26893
26757
  }
26894
- catch (e_59_1) { e_59 = { error: e_59_1 }; }
26758
+ catch (e_58_1) { e_58 = { error: e_58_1 }; }
26895
26759
  finally {
26896
26760
  try {
26897
26761
  if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
26898
26762
  }
26899
- finally { if (e_59) throw e_59.error; }
26763
+ finally { if (e_58) throw e_58.error; }
26900
26764
  }
26901
26765
  if (stack.length !== 1 || Number.isNaN(stack[0])) {
26902
26766
  return null;
@@ -27080,8 +26944,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
27080
26944
  }
27081
26945
  function readAttachmentContents(attachments) {
27082
26946
  return __awaiter(this, void 0, void 0, function () {
27083
- var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a, e_60_1;
27084
- var e_60, _b;
26947
+ var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a, e_59_1;
26948
+ var e_59, _b;
27085
26949
  return __generator(this, function (_c) {
27086
26950
  switch (_c.label) {
27087
26951
  case 0:
@@ -27160,14 +27024,14 @@ function readAttachmentContents(attachments) {
27160
27024
  return [3 /*break*/, 2];
27161
27025
  case 10: return [3 /*break*/, 13];
27162
27026
  case 11:
27163
- e_60_1 = _c.sent();
27164
- e_60 = { error: e_60_1 };
27027
+ e_59_1 = _c.sent();
27028
+ e_59 = { error: e_59_1 };
27165
27029
  return [3 /*break*/, 13];
27166
27030
  case 12:
27167
27031
  try {
27168
27032
  if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
27169
27033
  }
27170
- finally { if (e_60) throw e_60.error; }
27034
+ finally { if (e_59) throw e_59.error; }
27171
27035
  return [7 /*endfinally*/];
27172
27036
  case 13: return [2 /*return*/, {
27173
27037
  promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
@@ -27592,7 +27456,7 @@ function sanitizeAssistantMessageSetPayload(setPayload) {
27592
27456
  return next;
27593
27457
  }
27594
27458
  function sanitizeMongoSafeObject(value) {
27595
- var e_61, _a;
27459
+ var e_60, _a;
27596
27460
  if (value === null || value === undefined) {
27597
27461
  return value;
27598
27462
  }
@@ -27616,17 +27480,17 @@ function sanitizeMongoSafeObject(value) {
27616
27480
  out[key] = sanitizeMongoSafeObject(rawValue);
27617
27481
  }
27618
27482
  }
27619
- catch (e_61_1) { e_61 = { error: e_61_1 }; }
27483
+ catch (e_60_1) { e_60 = { error: e_60_1 }; }
27620
27484
  finally {
27621
27485
  try {
27622
27486
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
27623
27487
  }
27624
- finally { if (e_61) throw e_61.error; }
27488
+ finally { if (e_60) throw e_60.error; }
27625
27489
  }
27626
27490
  return out;
27627
27491
  }
27628
27492
  function restoreMongoSafeObject(value) {
27629
- var e_62, _a;
27493
+ var e_61, _a;
27630
27494
  if (value === null || value === undefined) {
27631
27495
  return value;
27632
27496
  }
@@ -27650,12 +27514,12 @@ function restoreMongoSafeObject(value) {
27650
27514
  out[key] = restoreMongoSafeObject(rawValue);
27651
27515
  }
27652
27516
  }
27653
- catch (e_62_1) { e_62 = { error: e_62_1 }; }
27517
+ catch (e_61_1) { e_61 = { error: e_61_1 }; }
27654
27518
  finally {
27655
27519
  try {
27656
27520
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
27657
27521
  }
27658
- finally { if (e_62) throw e_62.error; }
27522
+ finally { if (e_61) throw e_61.error; }
27659
27523
  }
27660
27524
  return out;
27661
27525
  }
@@ -27833,7 +27697,7 @@ function recordAssistantAnswerAIRun(input) {
27833
27697
  });
27834
27698
  }
27835
27699
  function evaluateGuardrails(message) {
27836
- var e_63, _a;
27700
+ var e_62, _a;
27837
27701
  var normalized = String(message || '').toLowerCase();
27838
27702
  var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
27839
27703
  if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
@@ -27859,12 +27723,12 @@ function evaluateGuardrails(message) {
27859
27723
  }
27860
27724
  }
27861
27725
  }
27862
- catch (e_63_1) { e_63 = { error: e_63_1 }; }
27726
+ catch (e_62_1) { e_62 = { error: e_62_1 }; }
27863
27727
  finally {
27864
27728
  try {
27865
27729
  if (patterns_4_1 && !patterns_4_1.done && (_a = patterns_4.return)) _a.call(patterns_4);
27866
27730
  }
27867
- finally { if (e_63) throw e_63.error; }
27731
+ finally { if (e_62) throw e_62.error; }
27868
27732
  }
27869
27733
  return null;
27870
27734
  }