@resolveio/server-lib 22.3.213 → 22.3.215

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.
@@ -7438,6 +7438,69 @@ 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
+ }
7441
7504
  function extractAssistantDataIntentLikelyFilterText(message, intent) {
7442
7505
  var value = normalizeOptionalString(message);
7443
7506
  if (!value) {
@@ -7466,6 +7529,9 @@ function extractAssistantDataIntentLikelyFilterText(message, intent) {
7466
7529
  });
7467
7530
  value = value.replace(/[^a-z0-9%&.' -]+/gi, ' ');
7468
7531
  value = normalizeOptionalString(value.replace(/\s+/g, ' '));
7532
+ if (!value) {
7533
+ value = extractAssistantLeadingPersonFilterText(message, intent);
7534
+ }
7469
7535
  if (!value || /^(activity|transactions?|movement|movements?|chemicals?|products?|inventory|invoices?|jobs?|work orders?|blends?)$/i.test(value)) {
7470
7536
  return '';
7471
7537
  }
@@ -8047,12 +8113,15 @@ function resolveAssistantDataIntentDateWindow(message) {
8047
8113
  year: now.getUTCFullYear()
8048
8114
  };
8049
8115
  }
8050
- var lastWindowMatch = text.match(/\b(?:last|past)\s+([0-9]+)\s+(days?|weeks?|months?)\b/);
8116
+ var lastWindowMatch = text.match(/\b(?:last|past|previous|over\s+the\s+last)\s+([0-9]+)\s+(days?|weeks?|months?|years?)\b/);
8051
8117
  if (lastWindowMatch) {
8052
8118
  var amount = Math.max(1, Math.min(Number(lastWindowMatch[1]) || 1, 36));
8053
8119
  var unit = lastWindowMatch[2];
8054
8120
  var start = new Date(now.getTime());
8055
- if (/week/.test(unit)) {
8121
+ if (/year/.test(unit)) {
8122
+ start.setUTCFullYear(start.getUTCFullYear() - amount);
8123
+ }
8124
+ else if (/week/.test(unit)) {
8056
8125
  start.setUTCDate(start.getUTCDate() - (amount * 7));
8057
8126
  }
8058
8127
  else if (/month/.test(unit)) {
@@ -8068,6 +8137,24 @@ function resolveAssistantDataIntentDateWindow(message) {
8068
8137
  year: now.getUTCFullYear()
8069
8138
  };
8070
8139
  }
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
+ }
8071
8158
  if (/\b(?:this|current)\s+month\b/.test(text)) {
8072
8159
  return {
8073
8160
  start: new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1, 0, 0, 0, 0)).toISOString(),
@@ -8250,7 +8337,7 @@ function cleanAssistantRequestedDimensionText(value) {
8250
8337
  return normalizeOptionalString(text.replace(/\s+/g, ' ')).toLowerCase();
8251
8338
  }
8252
8339
  function extractAssistantRequestedBreakdownDimensionTexts(message) {
8253
- var e_5, _a;
8340
+ var e_6, _a;
8254
8341
  var text = normalizeOptionalString(message).toLowerCase();
8255
8342
  if (!text) {
8256
8343
  return [];
@@ -8277,12 +8364,12 @@ function extractAssistantRequestedBreakdownDimensionTexts(message) {
8277
8364
  }
8278
8365
  }
8279
8366
  }
8280
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
8367
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
8281
8368
  finally {
8282
8369
  try {
8283
8370
  if (patterns_2_1 && !patterns_2_1.done && (_a = patterns_2.return)) _a.call(patterns_2);
8284
8371
  }
8285
- finally { if (e_5) throw e_5.error; }
8372
+ finally { if (e_6) throw e_6.error; }
8286
8373
  }
8287
8374
  return mergeAssistantHintValues(results);
8288
8375
  }
@@ -9717,6 +9804,25 @@ function buildAssistantDataRequestUnderstanding(message, intent, dateWindow, cla
9717
9804
  ? clampAssistantConfidence(normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.confidence, 0.65)
9718
9805
  : clampAssistantConfidence(normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.confidence, 0.75);
9719
9806
  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
+ }
9720
9826
  var effectiveDateRange = (dateWindow.start || dateWindow.end)
9721
9827
  ? __assign({}, dateWindow) : ((normalizedClassifierContract === null || normalizedClassifierContract === void 0 ? void 0 : normalizedClassifierContract.date_range) || null);
9722
9828
  return {
@@ -9740,7 +9846,7 @@ function buildAssistantDataRequestUnderstanding(message, intent, dateWindow, cla
9740
9846
  };
9741
9847
  }
9742
9848
  function inferAssistantDateWindowYear(value) {
9743
- var e_6, _a;
9849
+ var e_7, _a;
9744
9850
  if (!value) {
9745
9851
  return undefined;
9746
9852
  }
@@ -9756,12 +9862,12 @@ function inferAssistantDateWindowYear(value) {
9756
9862
  }
9757
9863
  }
9758
9864
  }
9759
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
9865
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
9760
9866
  finally {
9761
9867
  try {
9762
9868
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
9763
9869
  }
9764
- finally { if (e_6) throw e_6.error; }
9870
+ finally { if (e_7) throw e_7.error; }
9765
9871
  }
9766
9872
  return undefined;
9767
9873
  }
@@ -9911,7 +10017,7 @@ function normalizeAssistantContractFilterOperator(value) {
9911
10017
  return normalized || 'eq';
9912
10018
  }
9913
10019
  function extractAssistantFilterObjectValue(value) {
9914
- var e_7, _a;
10020
+ var e_8, _a;
9915
10021
  if (!value || typeof value !== 'object' || Array.isArray(value) || value instanceof Date) {
9916
10022
  return {
9917
10023
  operator: 'eq',
@@ -9935,12 +10041,12 @@ function extractAssistantFilterObjectValue(value) {
9935
10041
  };
9936
10042
  }
9937
10043
  }
9938
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
10044
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
9939
10045
  finally {
9940
10046
  try {
9941
10047
  if (operatorKeys_1_1 && !operatorKeys_1_1.done && (_a = operatorKeys_1.return)) _a.call(operatorKeys_1);
9942
10048
  }
9943
- finally { if (e_7) throw e_7.error; }
10049
+ finally { if (e_8) throw e_8.error; }
9944
10050
  }
9945
10051
  return {
9946
10052
  operator: 'eq',
@@ -10217,6 +10323,7 @@ function normalizeAssistantFieldAwareFilterValue(value, candidate) {
10217
10323
  if (isPersonCandidate) {
10218
10324
  normalizedText = normalizedText
10219
10325
  .replace(/\b([a-z][a-z0-9.'-]*)'s\b/gi, '$1')
10326
+ .replace(/\bs\b/gi, ' ')
10220
10327
  .replace(/\b(?:ats|pay|pays|settlement|settlements|driver|drivers|user|users|employee|employees|over)\b/gi, ' ');
10221
10328
  }
10222
10329
  var normalized = normalizeOptionalString(normalizedText
@@ -10865,7 +10972,7 @@ function ensureAssistantDisplayColumns(display, requestedColumns) {
10865
10972
  return __assign(__assign({}, display), { columns: columns, rows: rows });
10866
10973
  }
10867
10974
  function resolveAssistantPipelineTimeGrain(pipeline) {
10868
- var e_8, _a;
10975
+ var e_9, _a;
10869
10976
  if (!Array.isArray(pipeline) || !pipeline.length) {
10870
10977
  return null;
10871
10978
  }
@@ -10927,12 +11034,12 @@ function resolveAssistantPipelineTimeGrain(pipeline) {
10927
11034
  }
10928
11035
  }
10929
11036
  }
10930
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
11037
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
10931
11038
  finally {
10932
11039
  try {
10933
11040
  if (priority_1_1 && !priority_1_1.done && (_a = priority_1.return)) _a.call(priority_1);
10934
11041
  }
10935
- finally { if (e_8) throw e_8.error; }
11042
+ finally { if (e_9) throw e_9.error; }
10936
11043
  }
10937
11044
  return null;
10938
11045
  }
@@ -11926,7 +12033,7 @@ function applyAssistantDatedReportWindow(value, toolResult) {
11926
12033
  return "".concat(line, "\n\n").concat(content).trim();
11927
12034
  }
11928
12035
  function resolveAssistantDatedReportWindow(toolResult) {
11929
- var e_9, _a;
12036
+ var e_10, _a;
11930
12037
  var _b, _c, _d, _e, _f, _g, _h, _j;
11931
12038
  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;
11932
12039
  var verificationStart = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.startDate);
@@ -11992,12 +12099,12 @@ function resolveAssistantDatedReportWindow(toolResult) {
11992
12099
  };
11993
12100
  }
11994
12101
  }
11995
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
12102
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
11996
12103
  finally {
11997
12104
  try {
11998
12105
  if (pipelineCandidates_1_1 && !pipelineCandidates_1_1.done && (_a = pipelineCandidates_1.return)) _a.call(pipelineCandidates_1);
11999
12106
  }
12000
- finally { if (e_9) throw e_9.error; }
12107
+ finally { if (e_10) throw e_10.error; }
12001
12108
  }
12002
12109
  return null;
12003
12110
  }
@@ -12708,7 +12815,7 @@ function getValueAtPath(obj, path) {
12708
12815
  return walk(obj, 0);
12709
12816
  }
12710
12817
  function hasArrayValueAtPath(docs, path) {
12711
- var e_10, _a;
12818
+ var e_11, _a;
12712
12819
  if (!Array.isArray(docs) || !docs.length || !path) {
12713
12820
  return false;
12714
12821
  }
@@ -12721,17 +12828,17 @@ function hasArrayValueAtPath(docs, path) {
12721
12828
  }
12722
12829
  }
12723
12830
  }
12724
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
12831
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
12725
12832
  finally {
12726
12833
  try {
12727
12834
  if (docs_1_1 && !docs_1_1.done && (_a = docs_1.return)) _a.call(docs_1);
12728
12835
  }
12729
- finally { if (e_10) throw e_10.error; }
12836
+ finally { if (e_11) throw e_11.error; }
12730
12837
  }
12731
12838
  return false;
12732
12839
  }
12733
12840
  function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
12734
- var e_11, _a, e_12, _b;
12841
+ var e_12, _a, e_13, _b;
12735
12842
  if (!Array.isArray(docs) || !fieldPath) {
12736
12843
  return 'unknown';
12737
12844
  }
@@ -12744,7 +12851,7 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
12744
12851
  : doc === null || doc === void 0 ? void 0 : doc[fieldPath];
12745
12852
  var queue = Array.isArray(value) ? value : [value];
12746
12853
  try {
12747
- 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()) {
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()) {
12748
12855
  var entry = queue_1_1.value;
12749
12856
  if (entry === null || entry === undefined) {
12750
12857
  continue;
@@ -12757,21 +12864,21 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
12757
12864
  }
12758
12865
  }
12759
12866
  }
12760
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
12867
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
12761
12868
  finally {
12762
12869
  try {
12763
12870
  if (queue_1_1 && !queue_1_1.done && (_b = queue_1.return)) _b.call(queue_1);
12764
12871
  }
12765
- finally { if (e_12) throw e_12.error; }
12872
+ finally { if (e_13) throw e_13.error; }
12766
12873
  }
12767
12874
  }
12768
12875
  }
12769
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
12876
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
12770
12877
  finally {
12771
12878
  try {
12772
12879
  if (docs_2_1 && !docs_2_1.done && (_a = docs_2.return)) _a.call(docs_2);
12773
12880
  }
12774
- finally { if (e_11) throw e_11.error; }
12881
+ finally { if (e_12) throw e_12.error; }
12775
12882
  }
12776
12883
  return sawString ? 'string' : 'unknown';
12777
12884
  }
@@ -12866,7 +12973,7 @@ function normalizeLookupKeyValue(value) {
12866
12973
  return '';
12867
12974
  }
12868
12975
  function collectTopLevelIdFieldValues(docs, options) {
12869
- var e_13, _a, e_14, _b;
12976
+ var e_14, _a, e_15, _b;
12870
12977
  if (!Array.isArray(docs) || !docs.length) {
12871
12978
  return [];
12872
12979
  }
@@ -12914,26 +13021,26 @@ function collectTopLevelIdFieldValues(docs, options) {
12914
13021
  });
12915
13022
  };
12916
13023
  try {
12917
- 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()) {
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()) {
12918
13025
  var key = keys_1_1.value;
12919
13026
  _loop_3(key);
12920
13027
  }
12921
13028
  }
12922
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
13029
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
12923
13030
  finally {
12924
13031
  try {
12925
13032
  if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
12926
13033
  }
12927
- finally { if (e_14) throw e_14.error; }
13034
+ finally { if (e_15) throw e_15.error; }
12928
13035
  }
12929
13036
  }
12930
13037
  }
12931
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
13038
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
12932
13039
  finally {
12933
13040
  try {
12934
13041
  if (docs_3_1 && !docs_3_1.done && (_a = docs_3.return)) _a.call(docs_3);
12935
13042
  }
12936
- finally { if (e_13) throw e_13.error; }
13043
+ finally { if (e_14) throw e_14.error; }
12937
13044
  }
12938
13045
  return Array.from(fieldMap.entries()).map(function (_a) {
12939
13046
  var _b = __read(_a, 2), field = _b[0], values = _b[1];
@@ -13054,8 +13161,8 @@ function resolveLookupMappingsForField(field, mappings) {
13054
13161
  }
13055
13162
  function applyIdLookupDisplayEnrichment(params) {
13056
13163
  return __awaiter(this, void 0, void 0, function () {
13057
- 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;
13058
- var e_15, _a;
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;
13059
13166
  return __generator(this, function (_b) {
13060
13167
  switch (_b.label) {
13061
13168
  case 0:
@@ -13079,8 +13186,8 @@ function applyIdLookupDisplayEnrichment(params) {
13079
13186
  lookupMeta = [];
13080
13187
  enrichedDocs = docs.map(function (doc) { return (__assign({}, doc)); });
13081
13188
  _loop_4 = function (fieldEntry) {
13082
- var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_16_1;
13083
- var e_16, _c;
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;
13084
13191
  return __generator(this, function (_d) {
13085
13192
  switch (_d.label) {
13086
13193
  case 0:
@@ -13254,7 +13361,7 @@ function applyIdLookupDisplayEnrichment(params) {
13254
13361
  _d.label = 1;
13255
13362
  case 1:
13256
13363
  _d.trys.push([1, 6, 7, 8]);
13257
- filteredCandidates_1 = (e_16 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
13364
+ filteredCandidates_1 = (e_17 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
13258
13365
  _d.label = 2;
13259
13366
  case 2:
13260
13367
  if (!!filteredCandidates_1_1.done) return [3 /*break*/, 5];
@@ -13270,14 +13377,14 @@ function applyIdLookupDisplayEnrichment(params) {
13270
13377
  return [3 /*break*/, 2];
13271
13378
  case 5: return [3 /*break*/, 8];
13272
13379
  case 6:
13273
- e_16_1 = _d.sent();
13274
- e_16 = { error: e_16_1 };
13380
+ e_17_1 = _d.sent();
13381
+ e_17 = { error: e_17_1 };
13275
13382
  return [3 /*break*/, 8];
13276
13383
  case 7:
13277
13384
  try {
13278
13385
  if (filteredCandidates_1_1 && !filteredCandidates_1_1.done && (_c = filteredCandidates_1.return)) _c.call(filteredCandidates_1);
13279
13386
  }
13280
- finally { if (e_16) throw e_16.error; }
13387
+ finally { if (e_17) throw e_17.error; }
13281
13388
  return [7 /*endfinally*/];
13282
13389
  case 8: return [2 /*return*/];
13283
13390
  }
@@ -13300,14 +13407,14 @@ function applyIdLookupDisplayEnrichment(params) {
13300
13407
  return [3 /*break*/, 3];
13301
13408
  case 6: return [3 /*break*/, 9];
13302
13409
  case 7:
13303
- e_15_1 = _b.sent();
13304
- e_15 = { error: e_15_1 };
13410
+ e_16_1 = _b.sent();
13411
+ e_16 = { error: e_16_1 };
13305
13412
  return [3 /*break*/, 9];
13306
13413
  case 8:
13307
13414
  try {
13308
13415
  if (idFields_1_1 && !idFields_1_1.done && (_a = idFields_1.return)) _a.call(idFields_1);
13309
13416
  }
13310
- finally { if (e_15) throw e_15.error; }
13417
+ finally { if (e_16) throw e_16.error; }
13311
13418
  return [7 /*endfinally*/];
13312
13419
  case 9:
13313
13420
  if (!lookupMeta.length) {
@@ -13326,7 +13433,7 @@ function applyIdLookupDisplayEnrichment(params) {
13326
13433
  });
13327
13434
  }
13328
13435
  function hasNonEmptyValue(docs, fieldPath, options) {
13329
- var e_17, _a;
13436
+ var e_18, _a;
13330
13437
  if (!Array.isArray(docs) || !fieldPath) {
13331
13438
  return false;
13332
13439
  }
@@ -13343,12 +13450,12 @@ function hasNonEmptyValue(docs, fieldPath, options) {
13343
13450
  }
13344
13451
  }
13345
13452
  }
13346
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
13453
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
13347
13454
  finally {
13348
13455
  try {
13349
13456
  if (docs_4_1 && !docs_4_1.done && (_a = docs_4.return)) _a.call(docs_4);
13350
13457
  }
13351
- finally { if (e_17) throw e_17.error; }
13458
+ finally { if (e_18) throw e_18.error; }
13352
13459
  }
13353
13460
  return false;
13354
13461
  }
@@ -15964,7 +16071,7 @@ function flattenAssistantExprClauses(expr) {
15964
16071
  return [expr];
15965
16072
  }
15966
16073
  function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
15967
- var e_18, _a;
16074
+ var e_19, _a;
15968
16075
  var clauses = flattenAssistantExprClauses(expr);
15969
16076
  if (!clauses.length) {
15970
16077
  return null;
@@ -16038,12 +16145,12 @@ function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
16038
16145
  return state_4.value;
16039
16146
  }
16040
16147
  }
16041
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
16148
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
16042
16149
  finally {
16043
16150
  try {
16044
16151
  if (lowerClauses_1_1 && !lowerClauses_1_1.done && (_a = lowerClauses_1.return)) _a.call(lowerClauses_1);
16045
16152
  }
16046
- finally { if (e_18) throw e_18.error; }
16153
+ finally { if (e_19) throw e_19.error; }
16047
16154
  }
16048
16155
  return null;
16049
16156
  }
@@ -16106,7 +16213,7 @@ function resolveAssistantMonthlyGroupDateFields(pipeline) {
16106
16213
  return fields;
16107
16214
  }
16108
16215
  function detectAssistantMonthWindowFromPipeline(pipeline) {
16109
- var e_19, _a;
16216
+ var e_20, _a;
16110
16217
  var _b;
16111
16218
  var monthlyFields = resolveAssistantMonthlyGroupDateFields(pipeline);
16112
16219
  var scanMatch = function (match) {
@@ -16134,12 +16241,12 @@ function detectAssistantMonthWindowFromPipeline(pipeline) {
16134
16241
  }
16135
16242
  }
16136
16243
  }
16137
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
16244
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
16138
16245
  finally {
16139
16246
  try {
16140
16247
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
16141
16248
  }
16142
- finally { if (e_19) throw e_19.error; }
16249
+ finally { if (e_20) throw e_20.error; }
16143
16250
  }
16144
16251
  return null;
16145
16252
  }
@@ -16419,7 +16526,7 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
16419
16526
  var nextProject = __assign({}, project);
16420
16527
  var stageChanged = false;
16421
16528
  Object.keys(nextProject).forEach(function (field) {
16422
- var e_20, _a;
16529
+ var e_21, _a;
16423
16530
  var expression = nextProject[field];
16424
16531
  if (typeof expression !== 'string') {
16425
16532
  return;
@@ -16455,12 +16562,12 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
16455
16562
  break;
16456
16563
  }
16457
16564
  }
16458
- catch (e_20_1) { e_20 = { error: e_20_1 }; }
16565
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
16459
16566
  finally {
16460
16567
  try {
16461
16568
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
16462
16569
  }
16463
- finally { if (e_20) throw e_20.error; }
16570
+ finally { if (e_21) throw e_21.error; }
16464
16571
  }
16465
16572
  });
16466
16573
  if (stageChanged) {
@@ -16633,7 +16740,7 @@ function matchContainsField(value, field) {
16633
16740
  });
16634
16741
  }
16635
16742
  function resolveAggregateCompletionFallback(pipeline) {
16636
- var e_21, _a;
16743
+ var e_22, _a;
16637
16744
  if (!Array.isArray(pipeline)) {
16638
16745
  return null;
16639
16746
  }
@@ -16646,7 +16753,7 @@ function resolveAggregateCompletionFallback(pipeline) {
16646
16753
  }
16647
16754
  var addFields = stage.$addFields;
16648
16755
  try {
16649
- for (var _b = (e_21 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
16756
+ for (var _b = (e_22 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
16650
16757
  var key = _c.value;
16651
16758
  if (!isCompletionFieldName(key)) {
16652
16759
  continue;
@@ -16660,12 +16767,12 @@ function resolveAggregateCompletionFallback(pipeline) {
16660
16767
  }
16661
16768
  }
16662
16769
  }
16663
- catch (e_21_1) { e_21 = { error: e_21_1 }; }
16770
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
16664
16771
  finally {
16665
16772
  try {
16666
16773
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
16667
16774
  }
16668
- finally { if (e_21) throw e_21.error; }
16775
+ finally { if (e_22) throw e_22.error; }
16669
16776
  }
16670
16777
  if (candidateField) {
16671
16778
  break;
@@ -16821,7 +16928,7 @@ function buildCompletionFallbackSources(field) {
16821
16928
  ]);
16822
16929
  }
16823
16930
  function resolveAggregateCompletionExprFallback(pipeline) {
16824
- var e_22, _a;
16931
+ var e_23, _a;
16825
16932
  if (!Array.isArray(pipeline)) {
16826
16933
  return null;
16827
16934
  }
@@ -16841,7 +16948,7 @@ function resolveAggregateCompletionExprFallback(pipeline) {
16841
16948
  }
16842
16949
  if (!candidateField) {
16843
16950
  try {
16844
- for (var _b = (e_22 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
16951
+ for (var _b = (e_23 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
16845
16952
  var key = _c.value;
16846
16953
  if (key.startsWith('$')) {
16847
16954
  continue;
@@ -16856,12 +16963,12 @@ function resolveAggregateCompletionExprFallback(pipeline) {
16856
16963
  }
16857
16964
  }
16858
16965
  }
16859
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
16966
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
16860
16967
  finally {
16861
16968
  try {
16862
16969
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
16863
16970
  }
16864
- finally { if (e_22) throw e_22.error; }
16971
+ finally { if (e_23) throw e_23.error; }
16865
16972
  }
16866
16973
  }
16867
16974
  if (!candidateField) {
@@ -17063,7 +17170,7 @@ function hasAssistantDateGroupingOperator(value) {
17063
17170
  return Object.keys(value).some(function (key) { return hasAssistantDateGroupingOperator(value[key]); });
17064
17171
  }
17065
17172
  function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths) {
17066
- var e_23, _a, e_24, _b;
17173
+ var e_24, _a, e_25, _b;
17067
17174
  if (!Array.isArray(pipeline) || groupIndex <= 0 || !groupPaths.length) {
17068
17175
  return false;
17069
17176
  }
@@ -17089,14 +17196,14 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
17089
17196
  continue;
17090
17197
  }
17091
17198
  try {
17092
- 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()) {
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()) {
17093
17200
  var stageKey = stageKeys_1_1.value;
17094
17201
  var payload = stage[stageKey];
17095
17202
  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
17096
17203
  continue;
17097
17204
  }
17098
17205
  try {
17099
- 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()) {
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()) {
17100
17207
  var groupField = groupFields_1_1.value;
17101
17208
  if (!Object.prototype.hasOwnProperty.call(payload, groupField)) {
17102
17209
  continue;
@@ -17106,21 +17213,21 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
17106
17213
  }
17107
17214
  }
17108
17215
  }
17109
- catch (e_24_1) { e_24 = { error: e_24_1 }; }
17216
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
17110
17217
  finally {
17111
17218
  try {
17112
17219
  if (groupFields_1_1 && !groupFields_1_1.done && (_b = groupFields_1.return)) _b.call(groupFields_1);
17113
17220
  }
17114
- finally { if (e_24) throw e_24.error; }
17221
+ finally { if (e_25) throw e_25.error; }
17115
17222
  }
17116
17223
  }
17117
17224
  }
17118
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
17225
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
17119
17226
  finally {
17120
17227
  try {
17121
17228
  if (stageKeys_1_1 && !stageKeys_1_1.done && (_a = stageKeys_1.return)) _a.call(stageKeys_1);
17122
17229
  }
17123
- finally { if (e_23) throw e_23.error; }
17230
+ finally { if (e_24) throw e_24.error; }
17124
17231
  }
17125
17232
  }
17126
17233
  return false;
@@ -17227,7 +17334,7 @@ function isRegexMatchCondition(value) {
17227
17334
  return false;
17228
17335
  }
17229
17336
  function findRegexMatchInMatchObject(match, prefix) {
17230
- var e_25, _a, e_26, _b;
17337
+ var e_26, _a, e_27, _b;
17231
17338
  if (prefix === void 0) { prefix = ''; }
17232
17339
  if (Array.isArray(match)) {
17233
17340
  try {
@@ -17239,12 +17346,12 @@ function findRegexMatchInMatchObject(match, prefix) {
17239
17346
  }
17240
17347
  }
17241
17348
  }
17242
- catch (e_25_1) { e_25 = { error: e_25_1 }; }
17349
+ catch (e_26_1) { e_26 = { error: e_26_1 }; }
17243
17350
  finally {
17244
17351
  try {
17245
17352
  if (match_1_1 && !match_1_1.done && (_a = match_1.return)) _a.call(match_1);
17246
17353
  }
17247
- finally { if (e_25) throw e_25.error; }
17354
+ finally { if (e_26) throw e_26.error; }
17248
17355
  }
17249
17356
  return null;
17250
17357
  }
@@ -17275,12 +17382,12 @@ function findRegexMatchInMatchObject(match, prefix) {
17275
17382
  }
17276
17383
  }
17277
17384
  }
17278
- catch (e_26_1) { e_26 = { error: e_26_1 }; }
17385
+ catch (e_27_1) { e_27 = { error: e_27_1 }; }
17279
17386
  finally {
17280
17387
  try {
17281
17388
  if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
17282
17389
  }
17283
- finally { if (e_26) throw e_26.error; }
17390
+ finally { if (e_27) throw e_27.error; }
17284
17391
  }
17285
17392
  return null;
17286
17393
  }
@@ -17669,7 +17776,7 @@ function collectMatchFieldsByCondition(match, predicate, prefix) {
17669
17776
  return results;
17670
17777
  }
17671
17778
  function findMatchConditionForField(match, targetField, prefix) {
17672
- var e_27, _a, e_28, _b;
17779
+ var e_28, _a, e_29, _b;
17673
17780
  if (prefix === void 0) { prefix = ''; }
17674
17781
  if (!match || typeof match !== 'object') {
17675
17782
  return undefined;
@@ -17684,12 +17791,12 @@ function findMatchConditionForField(match, targetField, prefix) {
17684
17791
  }
17685
17792
  }
17686
17793
  }
17687
- catch (e_27_1) { e_27 = { error: e_27_1 }; }
17794
+ catch (e_28_1) { e_28 = { error: e_28_1 }; }
17688
17795
  finally {
17689
17796
  try {
17690
17797
  if (match_2_1 && !match_2_1.done && (_a = match_2.return)) _a.call(match_2);
17691
17798
  }
17692
- finally { if (e_27) throw e_27.error; }
17799
+ finally { if (e_28) throw e_28.error; }
17693
17800
  }
17694
17801
  return undefined;
17695
17802
  }
@@ -17716,12 +17823,12 @@ function findMatchConditionForField(match, targetField, prefix) {
17716
17823
  }
17717
17824
  }
17718
17825
  }
17719
- catch (e_28_1) { e_28 = { error: e_28_1 }; }
17826
+ catch (e_29_1) { e_29 = { error: e_29_1 }; }
17720
17827
  finally {
17721
17828
  try {
17722
17829
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
17723
17830
  }
17724
- finally { if (e_28) throw e_28.error; }
17831
+ finally { if (e_29) throw e_29.error; }
17725
17832
  }
17726
17833
  return undefined;
17727
17834
  }
@@ -17954,7 +18061,7 @@ function detectIdLikeValue(value) {
17954
18061
  return false;
17955
18062
  }
17956
18063
  function detectChemicalIdFromProbe(probeDocs, fields) {
17957
- var e_29, _a, e_30, _b;
18064
+ var e_30, _a, e_31, _b;
17958
18065
  if (!Array.isArray(probeDocs) || !probeDocs.length) {
17959
18066
  return false;
17960
18067
  }
@@ -17966,7 +18073,7 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
17966
18073
  for (var probeDocs_1 = __values(probeDocs), probeDocs_1_1 = probeDocs_1.next(); !probeDocs_1_1.done; probeDocs_1_1 = probeDocs_1.next()) {
17967
18074
  var doc = probeDocs_1_1.value;
17968
18075
  try {
17969
- 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()) {
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()) {
17970
18077
  var field = targets_1_1.value;
17971
18078
  var value = getValueAtPath(doc, field);
17972
18079
  if (Array.isArray(value)) {
@@ -17979,21 +18086,21 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
17979
18086
  }
17980
18087
  }
17981
18088
  }
17982
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
18089
+ catch (e_31_1) { e_31 = { error: e_31_1 }; }
17983
18090
  finally {
17984
18091
  try {
17985
18092
  if (targets_1_1 && !targets_1_1.done && (_b = targets_1.return)) _b.call(targets_1);
17986
18093
  }
17987
- finally { if (e_30) throw e_30.error; }
18094
+ finally { if (e_31) throw e_31.error; }
17988
18095
  }
17989
18096
  }
17990
18097
  }
17991
- catch (e_29_1) { e_29 = { error: e_29_1 }; }
18098
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
17992
18099
  finally {
17993
18100
  try {
17994
18101
  if (probeDocs_1_1 && !probeDocs_1_1.done && (_a = probeDocs_1.return)) _a.call(probeDocs_1);
17995
18102
  }
17996
- finally { if (e_29) throw e_29.error; }
18103
+ finally { if (e_30) throw e_30.error; }
17997
18104
  }
17998
18105
  return false;
17999
18106
  }
@@ -18214,8 +18321,8 @@ function buildChemicalIdFieldCandidates(field) {
18214
18321
  }
18215
18322
  function applyChemicalNameLookupFallbackToQuery(params) {
18216
18323
  return __awaiter(this, void 0, void 0, function () {
18217
- 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;
18218
- var e_31, _a;
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;
18219
18326
  var _b;
18220
18327
  return __generator(this, function (_c) {
18221
18328
  switch (_c.label) {
@@ -18328,14 +18435,14 @@ function applyChemicalNameLookupFallbackToQuery(params) {
18328
18435
  return [3 /*break*/, 3];
18329
18436
  case 6: return [3 /*break*/, 9];
18330
18437
  case 7:
18331
- e_31_1 = _c.sent();
18332
- e_31 = { error: e_31_1 };
18438
+ e_32_1 = _c.sent();
18439
+ e_32 = { error: e_32_1 };
18333
18440
  return [3 /*break*/, 9];
18334
18441
  case 8:
18335
18442
  try {
18336
18443
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
18337
18444
  }
18338
- finally { if (e_31) throw e_31.error; }
18445
+ finally { if (e_32) throw e_32.error; }
18339
18446
  return [7 /*endfinally*/];
18340
18447
  case 9: return [2 /*return*/, null];
18341
18448
  }
@@ -18435,8 +18542,8 @@ function lookupIdsForNameMatch(params) {
18435
18542
  }
18436
18543
  function applyIdLookupFallbackToQuery(params) {
18437
18544
  return __awaiter(this, void 0, void 0, function () {
18438
- 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;
18439
- var e_33, _c, e_32, _d;
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;
18440
18547
  var _e;
18441
18548
  return __generator(this, function (_f) {
18442
18549
  switch (_f.label) {
@@ -18506,7 +18613,7 @@ function applyIdLookupFallbackToQuery(params) {
18506
18613
  _f.label = 5;
18507
18614
  case 5:
18508
18615
  _f.trys.push([5, 14, 15, 16]);
18509
- candidates_2 = (e_32 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
18616
+ candidates_2 = (e_33 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
18510
18617
  _f.label = 6;
18511
18618
  case 6:
18512
18619
  if (!!candidates_2_1.done) return [3 /*break*/, 13];
@@ -18573,28 +18680,28 @@ function applyIdLookupFallbackToQuery(params) {
18573
18680
  return [3 /*break*/, 6];
18574
18681
  case 13: return [3 /*break*/, 16];
18575
18682
  case 14:
18576
- e_32_1 = _f.sent();
18577
- e_32 = { error: e_32_1 };
18683
+ e_33_1 = _f.sent();
18684
+ e_33 = { error: e_33_1 };
18578
18685
  return [3 /*break*/, 16];
18579
18686
  case 15:
18580
18687
  try {
18581
18688
  if (candidates_2_1 && !candidates_2_1.done && (_d = candidates_2.return)) _d.call(candidates_2);
18582
18689
  }
18583
- finally { if (e_32) throw e_32.error; }
18690
+ finally { if (e_33) throw e_33.error; }
18584
18691
  return [7 /*endfinally*/];
18585
18692
  case 16:
18586
18693
  conditions_1_1 = conditions_1.next();
18587
18694
  return [3 /*break*/, 4];
18588
18695
  case 17: return [3 /*break*/, 20];
18589
18696
  case 18:
18590
- e_33_1 = _f.sent();
18591
- e_33 = { error: e_33_1 };
18697
+ e_34_1 = _f.sent();
18698
+ e_34 = { error: e_34_1 };
18592
18699
  return [3 /*break*/, 20];
18593
18700
  case 19:
18594
18701
  try {
18595
18702
  if (conditions_1_1 && !conditions_1_1.done && (_c = conditions_1.return)) _c.call(conditions_1);
18596
18703
  }
18597
- finally { if (e_33) throw e_33.error; }
18704
+ finally { if (e_34) throw e_34.error; }
18598
18705
  return [7 /*endfinally*/];
18599
18706
  case 20: return [2 /*return*/, null];
18600
18707
  }
@@ -19039,8 +19146,8 @@ function resolveAssistantSurfaceFileCandidates(baseName) {
19039
19146
  }
19040
19147
  function readFirstAssistantSurfaceFile(candidates) {
19041
19148
  return __awaiter(this, void 0, void 0, function () {
19042
- var candidates_3, candidates_3_1, candidate, normalized, _a, e_34_1;
19043
- var e_34, _b;
19149
+ var candidates_3, candidates_3_1, candidate, normalized, _a, e_35_1;
19150
+ var e_35, _b;
19044
19151
  return __generator(this, function (_c) {
19045
19152
  switch (_c.label) {
19046
19153
  case 0:
@@ -19067,14 +19174,14 @@ function readFirstAssistantSurfaceFile(candidates) {
19067
19174
  return [3 /*break*/, 1];
19068
19175
  case 6: return [3 /*break*/, 9];
19069
19176
  case 7:
19070
- e_34_1 = _c.sent();
19071
- e_34 = { error: e_34_1 };
19177
+ e_35_1 = _c.sent();
19178
+ e_35 = { error: e_35_1 };
19072
19179
  return [3 /*break*/, 9];
19073
19180
  case 8:
19074
19181
  try {
19075
19182
  if (candidates_3_1 && !candidates_3_1.done && (_b = candidates_3.return)) _b.call(candidates_3);
19076
19183
  }
19077
- finally { if (e_34) throw e_34.error; }
19184
+ finally { if (e_35) throw e_35.error; }
19078
19185
  return [7 /*endfinally*/];
19079
19186
  case 9: return [2 /*return*/, ''];
19080
19187
  }
@@ -20809,7 +20916,7 @@ function doesAssistantPreserveAnyTermMatch(text, terms) {
20809
20916
  return (Array.isArray(terms) ? terms : []).some(function (term) { return doesAssistantPreserveTermMatch(text, term); });
20810
20917
  }
20811
20918
  function shouldPreserveAssistantCollectionForRouteFromRules(params) {
20812
- var e_35, _a;
20919
+ var e_36, _a;
20813
20920
  var _b, _c, _d, _e, _f, _g, _h;
20814
20921
  var routePreferred = normalizeAssistantCollectionOverrideName(params.routePreferredName);
20815
20922
  var requested = normalizeAssistantCollectionOverrideName(params.requestedCollection);
@@ -20841,12 +20948,12 @@ function shouldPreserveAssistantCollectionForRouteFromRules(params) {
20841
20948
  return true;
20842
20949
  }
20843
20950
  }
20844
- catch (e_35_1) { e_35 = { error: e_35_1 }; }
20951
+ catch (e_36_1) { e_36 = { error: e_36_1 }; }
20845
20952
  finally {
20846
20953
  try {
20847
20954
  if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
20848
20955
  }
20849
- finally { if (e_35) throw e_35.error; }
20956
+ finally { if (e_36) throw e_36.error; }
20850
20957
  }
20851
20958
  return false;
20852
20959
  }
@@ -21737,7 +21844,7 @@ function resolveAssistantNestedPrefixCollectionCandidates(params) {
21737
21844
  function resolveAssistantNestedAggregateFallbacks(params) {
21738
21845
  return __awaiter(this, void 0, void 0, function () {
21739
21846
  var prefixes, collectionNames, fallbacks, seen, prefixes_1, prefixes_1_1, prefix, rewrite, candidates, candidates_4, candidates_4_1, candidate, normalizedPipeline, key;
21740
- var e_36, _a, e_37, _b;
21847
+ var e_37, _a, e_38, _b;
21741
21848
  return __generator(this, function (_c) {
21742
21849
  switch (_c.label) {
21743
21850
  case 0:
@@ -21767,7 +21874,7 @@ function resolveAssistantNestedAggregateFallbacks(params) {
21767
21874
  triedCollections: params.triedCollections
21768
21875
  });
21769
21876
  try {
21770
- 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()) {
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()) {
21771
21878
  candidate = candidates_4_1.value;
21772
21879
  normalizedPipeline = normalizeAssistantAggregatePipeline(rewrite.pipeline, candidate);
21773
21880
  if (!normalizedPipeline.length || containsForbiddenMongoOperators(normalizedPipeline)) {
@@ -21789,21 +21896,21 @@ function resolveAssistantNestedAggregateFallbacks(params) {
21789
21896
  }
21790
21897
  }
21791
21898
  }
21792
- catch (e_37_1) { e_37 = { error: e_37_1 }; }
21899
+ catch (e_38_1) { e_38 = { error: e_38_1 }; }
21793
21900
  finally {
21794
21901
  try {
21795
21902
  if (candidates_4_1 && !candidates_4_1.done && (_b = candidates_4.return)) _b.call(candidates_4);
21796
21903
  }
21797
- finally { if (e_37) throw e_37.error; }
21904
+ finally { if (e_38) throw e_38.error; }
21798
21905
  }
21799
21906
  }
21800
21907
  }
21801
- catch (e_36_1) { e_36 = { error: e_36_1 }; }
21908
+ catch (e_37_1) { e_37 = { error: e_37_1 }; }
21802
21909
  finally {
21803
21910
  try {
21804
21911
  if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
21805
21912
  }
21806
- finally { if (e_36) throw e_36.error; }
21913
+ finally { if (e_37) throw e_37.error; }
21807
21914
  }
21808
21915
  return [2 /*return*/, fallbacks];
21809
21916
  }
@@ -21935,8 +22042,8 @@ function resolveAssistantBridgeCollectionHintCandidates(requestedCollection, req
21935
22042
  }
21936
22043
  function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
21937
22044
  return __awaiter(this, arguments, void 0, function (collection, db, dbName, options) {
21938
- 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;
21939
- var e_40, _b, e_41, _c, e_38, _d, e_39, _e, e_42, _f;
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;
21940
22047
  var _g, _h;
21941
22048
  if (dbName === void 0) { dbName = ''; }
21942
22049
  return __generator(this, function (_j) {
@@ -22010,12 +22117,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22010
22117
  }
22011
22118
  }
22012
22119
  }
22013
- catch (e_40_1) { e_40 = { error: e_40_1 }; }
22120
+ catch (e_41_1) { e_41 = { error: e_41_1 }; }
22014
22121
  finally {
22015
22122
  try {
22016
22123
  if (candidates_5_1 && !candidates_5_1.done && (_b = candidates_5.return)) _b.call(candidates_5);
22017
22124
  }
22018
- finally { if (e_40) throw e_40.error; }
22125
+ finally { if (e_41) throw e_41.error; }
22019
22126
  }
22020
22127
  }
22021
22128
  if (configuredCollectionNames.length) {
@@ -22030,12 +22137,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22030
22137
  }
22031
22138
  }
22032
22139
  }
22033
- catch (e_41_1) { e_41 = { error: e_41_1 }; }
22140
+ catch (e_42_1) { e_42 = { error: e_42_1 }; }
22034
22141
  finally {
22035
22142
  try {
22036
22143
  if (candidates_6_1 && !candidates_6_1.done && (_c = candidates_6.return)) _c.call(candidates_6);
22037
22144
  }
22038
- finally { if (e_41) throw e_41.error; }
22145
+ finally { if (e_42) throw e_42.error; }
22039
22146
  }
22040
22147
  }
22041
22148
  primaryCollectionHint = normalizeOptionalString((_h = requestHints === null || requestHints === void 0 ? void 0 : requestHints.collectionHints) === null || _h === void 0 ? void 0 : _h[0]);
@@ -22096,14 +22203,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22096
22203
  return [3 /*break*/, 2];
22097
22204
  case 7: return [3 /*break*/, 10];
22098
22205
  case 8:
22099
- e_38_1 = _j.sent();
22100
- e_38 = { error: e_38_1 };
22206
+ e_39_1 = _j.sent();
22207
+ e_39 = { error: e_39_1 };
22101
22208
  return [3 /*break*/, 10];
22102
22209
  case 9:
22103
22210
  try {
22104
22211
  if (resolverTargets_1_1 && !resolverTargets_1_1.done && (_d = resolverTargets_1.return)) _d.call(resolverTargets_1);
22105
22212
  }
22106
- finally { if (e_38) throw e_38.error; }
22213
+ finally { if (e_39) throw e_39.error; }
22107
22214
  return [7 /*endfinally*/];
22108
22215
  case 10:
22109
22216
  if (!db) return [3 /*break*/, 18];
@@ -22129,14 +22236,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22129
22236
  return [3 /*break*/, 12];
22130
22237
  case 15: return [3 /*break*/, 18];
22131
22238
  case 16:
22132
- e_39_1 = _j.sent();
22133
- e_39 = { error: e_39_1 };
22239
+ e_40_1 = _j.sent();
22240
+ e_40 = { error: e_40_1 };
22134
22241
  return [3 /*break*/, 18];
22135
22242
  case 17:
22136
22243
  try {
22137
22244
  if (candidates_7_1 && !candidates_7_1.done && (_e = candidates_7.return)) _e.call(candidates_7);
22138
22245
  }
22139
- finally { if (e_39) throw e_39.error; }
22246
+ finally { if (e_40) throw e_40.error; }
22140
22247
  return [7 /*endfinally*/];
22141
22248
  case 18:
22142
22249
  try {
@@ -22147,12 +22254,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22147
22254
  }
22148
22255
  }
22149
22256
  }
22150
- catch (e_42_1) { e_42 = { error: e_42_1 }; }
22257
+ catch (e_43_1) { e_43 = { error: e_43_1 }; }
22151
22258
  finally {
22152
22259
  try {
22153
22260
  if (candidates_8_1 && !candidates_8_1.done && (_f = candidates_8.return)) _f.call(candidates_8);
22154
22261
  }
22155
- finally { if (e_42) throw e_42.error; }
22262
+ finally { if (e_43) throw e_43.error; }
22156
22263
  }
22157
22264
  throw new Error('AI assistant report builder bridge: No queryable collection could be resolved.');
22158
22265
  }
@@ -22160,7 +22267,7 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
22160
22267
  });
22161
22268
  }
22162
22269
  function findQueryDateField(query) {
22163
- var e_43, _a, e_44, _b;
22270
+ var e_44, _a, e_45, _b;
22164
22271
  if (!query || typeof query !== 'object') {
22165
22272
  return null;
22166
22273
  }
@@ -22174,12 +22281,12 @@ function findQueryDateField(query) {
22174
22281
  }
22175
22282
  }
22176
22283
  }
22177
- catch (e_43_1) { e_43 = { error: e_43_1 }; }
22284
+ catch (e_44_1) { e_44 = { error: e_44_1 }; }
22178
22285
  finally {
22179
22286
  try {
22180
22287
  if (query_1_1 && !query_1_1.done && (_a = query_1.return)) _a.call(query_1);
22181
22288
  }
22182
- finally { if (e_43) throw e_43.error; }
22289
+ finally { if (e_44) throw e_44.error; }
22183
22290
  }
22184
22291
  return null;
22185
22292
  }
@@ -22198,12 +22305,12 @@ function findQueryDateField(query) {
22198
22305
  }
22199
22306
  }
22200
22307
  }
22201
- catch (e_44_1) { e_44 = { error: e_44_1 }; }
22308
+ catch (e_45_1) { e_45 = { error: e_45_1 }; }
22202
22309
  finally {
22203
22310
  try {
22204
22311
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
22205
22312
  }
22206
- finally { if (e_44) throw e_44.error; }
22313
+ finally { if (e_45) throw e_45.error; }
22207
22314
  }
22208
22315
  return null;
22209
22316
  }
@@ -22491,7 +22598,7 @@ function resolveQueryDateFieldFallback(query) {
22491
22598
  return { from: dateField, to: fallback };
22492
22599
  }
22493
22600
  function containsForbiddenMongoOperators(value) {
22494
- var e_45, _a;
22601
+ var e_46, _a;
22495
22602
  if (!value || typeof value !== 'object') {
22496
22603
  return false;
22497
22604
  }
@@ -22510,12 +22617,12 @@ function containsForbiddenMongoOperators(value) {
22510
22617
  }
22511
22618
  }
22512
22619
  }
22513
- catch (e_45_1) { e_45 = { error: e_45_1 }; }
22620
+ catch (e_46_1) { e_46 = { error: e_46_1 }; }
22514
22621
  finally {
22515
22622
  try {
22516
22623
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
22517
22624
  }
22518
- finally { if (e_45) throw e_45.error; }
22625
+ finally { if (e_46) throw e_46.error; }
22519
22626
  }
22520
22627
  return false;
22521
22628
  }
@@ -22700,7 +22807,7 @@ function splitAssistantPermissionTokenSets(value) {
22700
22807
  };
22701
22808
  }
22702
22809
  function isAssistantTokenSetSubset(subset, superset) {
22703
- var e_46, _a;
22810
+ var e_47, _a;
22704
22811
  if (!subset.size) {
22705
22812
  return false;
22706
22813
  }
@@ -22712,12 +22819,12 @@ function isAssistantTokenSetSubset(subset, superset) {
22712
22819
  }
22713
22820
  }
22714
22821
  }
22715
- catch (e_46_1) { e_46 = { error: e_46_1 }; }
22822
+ catch (e_47_1) { e_47 = { error: e_47_1 }; }
22716
22823
  finally {
22717
22824
  try {
22718
22825
  if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1);
22719
22826
  }
22720
- finally { if (e_46) throw e_46.error; }
22827
+ finally { if (e_47) throw e_47.error; }
22721
22828
  }
22722
22829
  return true;
22723
22830
  }
@@ -23252,8 +23359,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
23252
23359
  }
23253
23360
  function waitForCodexWorkerMessage(worker, streamStatusHandler) {
23254
23361
  return __awaiter(this, void 0, void 0, function () {
23255
- var _a, _b, _c, _d, message, payload, status_1, e_47_1;
23256
- var _e, e_47, _f, _g;
23362
+ var _a, _b, _c, _d, message, payload, status_1, e_48_1;
23363
+ var _e, e_48, _f, _g;
23257
23364
  return __generator(this, function (_h) {
23258
23365
  switch (_h.label) {
23259
23366
  case 0:
@@ -23280,8 +23387,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
23280
23387
  return [3 /*break*/, 1];
23281
23388
  case 4: return [3 /*break*/, 11];
23282
23389
  case 5:
23283
- e_47_1 = _h.sent();
23284
- e_47 = { error: e_47_1 };
23390
+ e_48_1 = _h.sent();
23391
+ e_48 = { error: e_48_1 };
23285
23392
  return [3 /*break*/, 11];
23286
23393
  case 6:
23287
23394
  _h.trys.push([6, , 9, 10]);
@@ -23292,7 +23399,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
23292
23399
  _h.label = 8;
23293
23400
  case 8: return [3 /*break*/, 10];
23294
23401
  case 9:
23295
- if (e_47) throw e_47.error;
23402
+ if (e_48) throw e_48.error;
23296
23403
  return [7 /*endfinally*/];
23297
23404
  case 10: return [7 /*endfinally*/];
23298
23405
  case 11: throw new CodexWorkerBootstrapError('AI worker exited before completing.');
@@ -23636,8 +23743,8 @@ function buildAssistantWorkspaceRootCandidates(params) {
23636
23743
  }
23637
23744
  function resolveAssistantWorkspaceRoot() {
23638
23745
  return __awaiter(this, void 0, void 0, function () {
23639
- var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_48_1;
23640
- var e_48, _b;
23746
+ var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_49_1;
23747
+ var e_49, _b;
23641
23748
  return __generator(this, function (_c) {
23642
23749
  switch (_c.label) {
23643
23750
  case 0:
@@ -23684,14 +23791,14 @@ function resolveAssistantWorkspaceRoot() {
23684
23791
  return [3 /*break*/, 2];
23685
23792
  case 8: return [3 /*break*/, 11];
23686
23793
  case 9:
23687
- e_48_1 = _c.sent();
23688
- e_48 = { error: e_48_1 };
23794
+ e_49_1 = _c.sent();
23795
+ e_49 = { error: e_49_1 };
23689
23796
  return [3 /*break*/, 11];
23690
23797
  case 10:
23691
23798
  try {
23692
23799
  if (candidates_9_1 && !candidates_9_1.done && (_b = candidates_9.return)) _b.call(candidates_9);
23693
23800
  }
23694
- finally { if (e_48) throw e_48.error; }
23801
+ finally { if (e_49) throw e_49.error; }
23695
23802
  return [7 /*endfinally*/];
23696
23803
  case 11:
23697
23804
  if (firstNestedGitRoot) {
@@ -24134,7 +24241,7 @@ var AI_ASSISTANT_BREAKDOWN_DIMENSION_STOPWORDS = new Set([
24134
24241
  'by'
24135
24242
  ]);
24136
24243
  function normalizeAssistantBreakdownDimension(value) {
24137
- var e_49, _a;
24244
+ var e_50, _a;
24138
24245
  var normalized = normalizeOptionalString(value)
24139
24246
  .toLowerCase()
24140
24247
  .replace(/[^a-z0-9_\s-]+/g, ' ')
@@ -24166,12 +24273,12 @@ function normalizeAssistantBreakdownDimension(value) {
24166
24273
  }
24167
24274
  }
24168
24275
  }
24169
- catch (e_49_1) { e_49 = { error: e_49_1 }; }
24276
+ catch (e_50_1) { e_50 = { error: e_50_1 }; }
24170
24277
  finally {
24171
24278
  try {
24172
24279
  if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
24173
24280
  }
24174
- finally { if (e_49) throw e_49.error; }
24281
+ finally { if (e_50) throw e_50.error; }
24175
24282
  }
24176
24283
  if (!kept.length) {
24177
24284
  return '';
@@ -24376,7 +24483,7 @@ function resolveAssistantPlannerEnabled(config) {
24376
24483
  return raw === undefined ? false : raw === true;
24377
24484
  }
24378
24485
  function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
24379
- var e_50, _a;
24486
+ var e_51, _a;
24380
24487
  var _b;
24381
24488
  if (isSuperAdmin === void 0) { isSuperAdmin = false; }
24382
24489
  var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
@@ -24390,12 +24497,12 @@ function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
24390
24497
  }
24391
24498
  }
24392
24499
  }
24393
- catch (e_50_1) { e_50 = { error: e_50_1 }; }
24500
+ catch (e_51_1) { e_51 = { error: e_51_1 }; }
24394
24501
  finally {
24395
24502
  try {
24396
24503
  if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
24397
24504
  }
24398
- finally { if (e_50) throw e_50.error; }
24505
+ finally { if (e_51) throw e_51.error; }
24399
24506
  }
24400
24507
  var normalizedRoutes = Array.from(unique);
24401
24508
  var allowedRoutes = collectAssistantAllowedRoutesForUser(user, normalizedRoutes, isSuperAdmin);
@@ -24771,7 +24878,7 @@ function normalizeRouteMatchKey(value) {
24771
24878
  return normalizeRouteKey(value).toLowerCase();
24772
24879
  }
24773
24880
  function buildClientRouteIndex() {
24774
- var e_51, _a;
24881
+ var e_52, _a;
24775
24882
  var _b;
24776
24883
  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);
24777
24884
  var set = new Set();
@@ -24790,12 +24897,12 @@ function buildClientRouteIndex() {
24790
24897
  }
24791
24898
  }
24792
24899
  }
24793
- catch (e_51_1) { e_51 = { error: e_51_1 }; }
24900
+ catch (e_52_1) { e_52 = { error: e_52_1 }; }
24794
24901
  finally {
24795
24902
  try {
24796
24903
  if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
24797
24904
  }
24798
- finally { if (e_51) throw e_51.error; }
24905
+ finally { if (e_52) throw e_52.error; }
24799
24906
  }
24800
24907
  return { set: set, map: map, size: routes.length };
24801
24908
  }
@@ -25686,8 +25793,8 @@ function shouldSkipAssistantGitDiscoveryDirectory(name) {
25686
25793
  }
25687
25794
  function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25688
25795
  return __awaiter(this, void 0, void 0, function () {
25689
- 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;
25690
- var e_52, _e, e_53, _f;
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;
25691
25798
  var _g;
25692
25799
  return __generator(this, function (_h) {
25693
25800
  switch (_h.label) {
@@ -25732,14 +25839,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25732
25839
  return [3 /*break*/, 3];
25733
25840
  case 6: return [3 /*break*/, 9];
25734
25841
  case 7:
25735
- e_52_1 = _h.sent();
25736
- e_52 = { error: e_52_1 };
25842
+ e_53_1 = _h.sent();
25843
+ e_53 = { error: e_53_1 };
25737
25844
  return [3 /*break*/, 9];
25738
25845
  case 8:
25739
25846
  try {
25740
25847
  if (configuredRoots_1_1 && !configuredRoots_1_1.done && (_e = configuredRoots_1.return)) _e.call(configuredRoots_1);
25741
25848
  }
25742
- finally { if (e_52) throw e_52.error; }
25849
+ finally { if (e_53) throw e_53.error; }
25743
25850
  return [7 /*endfinally*/];
25744
25851
  case 9:
25745
25852
  queue = [];
@@ -25779,7 +25886,7 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25779
25886
  return [3 /*break*/, 14];
25780
25887
  case 14:
25781
25888
  _h.trys.push([14, 21, 22, 23]);
25782
- entries_1 = (e_53 = void 0, __values(entries)), entries_1_1 = entries_1.next();
25889
+ entries_1 = (e_54 = void 0, __values(entries)), entries_1_1 = entries_1.next();
25783
25890
  _h.label = 15;
25784
25891
  case 15:
25785
25892
  if (!!entries_1_1.done) return [3 /*break*/, 20];
@@ -25818,14 +25925,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
25818
25925
  return [3 /*break*/, 15];
25819
25926
  case 20: return [3 /*break*/, 23];
25820
25927
  case 21:
25821
- e_53_1 = _h.sent();
25822
- e_53 = { error: e_53_1 };
25928
+ e_54_1 = _h.sent();
25929
+ e_54 = { error: e_54_1 };
25823
25930
  return [3 /*break*/, 23];
25824
25931
  case 22:
25825
25932
  try {
25826
25933
  if (entries_1_1 && !entries_1_1.done && (_f = entries_1.return)) _f.call(entries_1);
25827
25934
  }
25828
- finally { if (e_53) throw e_53.error; }
25935
+ finally { if (e_54) throw e_54.error; }
25829
25936
  return [7 /*endfinally*/];
25830
25937
  case 23: return [3 /*break*/, 10];
25831
25938
  case 24: return [2 /*return*/, roots];
@@ -26165,8 +26272,8 @@ function syncAssistantGitMirror(repoUrl) {
26165
26272
  }
26166
26273
  function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
26167
26274
  return __awaiter(this, void 0, void 0, function () {
26168
- var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_54_1;
26169
- var e_54, _a;
26275
+ var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_55_1;
26276
+ var e_55, _a;
26170
26277
  return __generator(this, function (_b) {
26171
26278
  switch (_b.label) {
26172
26279
  case 0: return [4 /*yield*/, resolveAssistantWorkspaceGitRoots(workspaceRoot)];
@@ -26200,14 +26307,14 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
26200
26307
  return [3 /*break*/, 3];
26201
26308
  case 6: return [3 /*break*/, 9];
26202
26309
  case 7:
26203
- e_54_1 = _b.sent();
26204
- e_54 = { error: e_54_1 };
26310
+ e_55_1 = _b.sent();
26311
+ e_55 = { error: e_55_1 };
26205
26312
  return [3 /*break*/, 9];
26206
26313
  case 8:
26207
26314
  try {
26208
26315
  if (repoUrls_1_1 && !repoUrls_1_1.done && (_a = repoUrls_1.return)) _a.call(repoUrls_1);
26209
26316
  }
26210
- finally { if (e_54) throw e_54.error; }
26317
+ finally { if (e_55) throw e_55.error; }
26211
26318
  return [7 /*endfinally*/];
26212
26319
  case 9: return [2 /*return*/, mirroredRoots];
26213
26320
  }
@@ -26216,8 +26323,8 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
26216
26323
  }
26217
26324
  function resolveAssistantChangeHistoryFastPathResponse(params) {
26218
26325
  return __awaiter(this, void 0, void 0, function () {
26219
- 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;
26220
- var e_55, _f;
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;
26221
26328
  return __generator(this, function (_g) {
26222
26329
  switch (_g.label) {
26223
26330
  case 0:
@@ -26339,14 +26446,14 @@ function resolveAssistantChangeHistoryFastPathResponse(params) {
26339
26446
  return [3 /*break*/, 7];
26340
26447
  case 20: return [3 /*break*/, 23];
26341
26448
  case 21:
26342
- e_55_1 = _g.sent();
26343
- e_55 = { error: e_55_1 };
26449
+ e_56_1 = _g.sent();
26450
+ e_56 = { error: e_56_1 };
26344
26451
  return [3 /*break*/, 23];
26345
26452
  case 22:
26346
26453
  try {
26347
26454
  if (gitRoots_1_1 && !gitRoots_1_1.done && (_f = gitRoots_1.return)) _f.call(gitRoots_1);
26348
26455
  }
26349
- finally { if (e_55) throw e_55.error; }
26456
+ finally { if (e_56) throw e_56.error; }
26350
26457
  return [7 /*endfinally*/];
26351
26458
  case 23:
26352
26459
  if (bestFallback) {
@@ -26527,7 +26634,7 @@ function sanitizeAssistantResponse(value) {
26527
26634
  return normalizeAssistantRoutes(normalizedCurrency);
26528
26635
  }
26529
26636
  function evaluateAssistantGuardrails(message) {
26530
- var e_56, _a;
26637
+ var e_57, _a;
26531
26638
  var normalized = String(message || '').toLowerCase();
26532
26639
  var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
26533
26640
  if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
@@ -26572,12 +26679,12 @@ function evaluateAssistantGuardrails(message) {
26572
26679
  }
26573
26680
  }
26574
26681
  }
26575
- catch (e_56_1) { e_56 = { error: e_56_1 }; }
26682
+ catch (e_57_1) { e_57 = { error: e_57_1 }; }
26576
26683
  finally {
26577
26684
  try {
26578
26685
  if (patterns_3_1 && !patterns_3_1.done && (_a = patterns_3.return)) _a.call(patterns_3);
26579
26686
  }
26580
- finally { if (e_56) throw e_56.error; }
26687
+ finally { if (e_57) throw e_57.error; }
26581
26688
  }
26582
26689
  return null;
26583
26690
  }
@@ -26682,7 +26789,7 @@ function tokenizeArithmeticExpression(expression) {
26682
26789
  return tokens;
26683
26790
  }
26684
26791
  function evaluateArithmeticExpression(expression) {
26685
- var e_57, _a, e_58, _b;
26792
+ var e_58, _a, e_59, _b;
26686
26793
  var tokens = tokenizeArithmeticExpression(expression);
26687
26794
  if (!tokens || !tokens.length) {
26688
26795
  return null;
@@ -26739,12 +26846,12 @@ function evaluateArithmeticExpression(expression) {
26739
26846
  prevToken = token;
26740
26847
  }
26741
26848
  }
26742
- catch (e_57_1) { e_57 = { error: e_57_1 }; }
26849
+ catch (e_58_1) { e_58 = { error: e_58_1 }; }
26743
26850
  finally {
26744
26851
  try {
26745
26852
  if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
26746
26853
  }
26747
- finally { if (e_57) throw e_57.error; }
26854
+ finally { if (e_58) throw e_58.error; }
26748
26855
  }
26749
26856
  while (ops.length) {
26750
26857
  var op = ops.pop();
@@ -26784,12 +26891,12 @@ function evaluateArithmeticExpression(expression) {
26784
26891
  stack.push(Number(token));
26785
26892
  }
26786
26893
  }
26787
- catch (e_58_1) { e_58 = { error: e_58_1 }; }
26894
+ catch (e_59_1) { e_59 = { error: e_59_1 }; }
26788
26895
  finally {
26789
26896
  try {
26790
26897
  if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
26791
26898
  }
26792
- finally { if (e_58) throw e_58.error; }
26899
+ finally { if (e_59) throw e_59.error; }
26793
26900
  }
26794
26901
  if (stack.length !== 1 || Number.isNaN(stack[0])) {
26795
26902
  return null;
@@ -26973,8 +27080,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
26973
27080
  }
26974
27081
  function readAttachmentContents(attachments) {
26975
27082
  return __awaiter(this, void 0, void 0, function () {
26976
- 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;
26977
- var e_59, _b;
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;
26978
27085
  return __generator(this, function (_c) {
26979
27086
  switch (_c.label) {
26980
27087
  case 0:
@@ -27053,14 +27160,14 @@ function readAttachmentContents(attachments) {
27053
27160
  return [3 /*break*/, 2];
27054
27161
  case 10: return [3 /*break*/, 13];
27055
27162
  case 11:
27056
- e_59_1 = _c.sent();
27057
- e_59 = { error: e_59_1 };
27163
+ e_60_1 = _c.sent();
27164
+ e_60 = { error: e_60_1 };
27058
27165
  return [3 /*break*/, 13];
27059
27166
  case 12:
27060
27167
  try {
27061
27168
  if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
27062
27169
  }
27063
- finally { if (e_59) throw e_59.error; }
27170
+ finally { if (e_60) throw e_60.error; }
27064
27171
  return [7 /*endfinally*/];
27065
27172
  case 13: return [2 /*return*/, {
27066
27173
  promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
@@ -27485,7 +27592,7 @@ function sanitizeAssistantMessageSetPayload(setPayload) {
27485
27592
  return next;
27486
27593
  }
27487
27594
  function sanitizeMongoSafeObject(value) {
27488
- var e_60, _a;
27595
+ var e_61, _a;
27489
27596
  if (value === null || value === undefined) {
27490
27597
  return value;
27491
27598
  }
@@ -27509,17 +27616,17 @@ function sanitizeMongoSafeObject(value) {
27509
27616
  out[key] = sanitizeMongoSafeObject(rawValue);
27510
27617
  }
27511
27618
  }
27512
- catch (e_60_1) { e_60 = { error: e_60_1 }; }
27619
+ catch (e_61_1) { e_61 = { error: e_61_1 }; }
27513
27620
  finally {
27514
27621
  try {
27515
27622
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
27516
27623
  }
27517
- finally { if (e_60) throw e_60.error; }
27624
+ finally { if (e_61) throw e_61.error; }
27518
27625
  }
27519
27626
  return out;
27520
27627
  }
27521
27628
  function restoreMongoSafeObject(value) {
27522
- var e_61, _a;
27629
+ var e_62, _a;
27523
27630
  if (value === null || value === undefined) {
27524
27631
  return value;
27525
27632
  }
@@ -27543,12 +27650,12 @@ function restoreMongoSafeObject(value) {
27543
27650
  out[key] = restoreMongoSafeObject(rawValue);
27544
27651
  }
27545
27652
  }
27546
- catch (e_61_1) { e_61 = { error: e_61_1 }; }
27653
+ catch (e_62_1) { e_62 = { error: e_62_1 }; }
27547
27654
  finally {
27548
27655
  try {
27549
27656
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
27550
27657
  }
27551
- finally { if (e_61) throw e_61.error; }
27658
+ finally { if (e_62) throw e_62.error; }
27552
27659
  }
27553
27660
  return out;
27554
27661
  }
@@ -27726,7 +27833,7 @@ function recordAssistantAnswerAIRun(input) {
27726
27833
  });
27727
27834
  }
27728
27835
  function evaluateGuardrails(message) {
27729
- var e_62, _a;
27836
+ var e_63, _a;
27730
27837
  var normalized = String(message || '').toLowerCase();
27731
27838
  var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
27732
27839
  if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
@@ -27752,12 +27859,12 @@ function evaluateGuardrails(message) {
27752
27859
  }
27753
27860
  }
27754
27861
  }
27755
- catch (e_62_1) { e_62 = { error: e_62_1 }; }
27862
+ catch (e_63_1) { e_63 = { error: e_63_1 }; }
27756
27863
  finally {
27757
27864
  try {
27758
27865
  if (patterns_4_1 && !patterns_4_1.done && (_a = patterns_4.return)) _a.call(patterns_4);
27759
27866
  }
27760
- finally { if (e_62) throw e_62.error; }
27867
+ finally { if (e_63) throw e_63.error; }
27761
27868
  }
27762
27869
  return null;
27763
27870
  }