@resolveio/server-lib 22.0.12 → 22.0.13

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.
@@ -3319,6 +3319,51 @@ function verifyAssistantAggregateReliability(params) {
3319
3319
  });
3320
3320
  });
3321
3321
  }
3322
+ function normalizeAssistantMonthBucket(value) {
3323
+ var _a, _b;
3324
+ if (value === null || value === undefined || value === '') {
3325
+ return '';
3326
+ }
3327
+ if (value instanceof Date) {
3328
+ if (Number.isNaN(value.getTime())) {
3329
+ return '';
3330
+ }
3331
+ return value.toISOString().slice(0, 7);
3332
+ }
3333
+ if (typeof value === 'string') {
3334
+ var trimmed = normalizeOptionalString(value);
3335
+ if (!trimmed) {
3336
+ return '';
3337
+ }
3338
+ var directMatch = trimmed.match(/^(\d{4})-(\d{2})(?:$|[^0-9])/);
3339
+ if (directMatch) {
3340
+ var month = Number(directMatch[2]);
3341
+ if (Number.isFinite(month) && month >= 1 && month <= 12) {
3342
+ return "".concat(directMatch[1], "-").concat(directMatch[2]);
3343
+ }
3344
+ }
3345
+ var parsed = Date.parse(trimmed);
3346
+ if (!Number.isNaN(parsed)) {
3347
+ return new Date(parsed).toISOString().slice(0, 7);
3348
+ }
3349
+ return '';
3350
+ }
3351
+ if (typeof value === 'object') {
3352
+ var yearRaw = (_a = value === null || value === void 0 ? void 0 : value.year) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value._year;
3353
+ var monthRaw = (_b = value === null || value === void 0 ? void 0 : value.month) !== null && _b !== void 0 ? _b : value === null || value === void 0 ? void 0 : value._month;
3354
+ var year = Number(yearRaw);
3355
+ var month = Number(monthRaw);
3356
+ if (Number.isFinite(year)
3357
+ && Number.isFinite(month)
3358
+ && month >= 1
3359
+ && month <= 12) {
3360
+ var yearText = String(Math.trunc(year)).padStart(4, '0');
3361
+ var monthText = String(Math.trunc(month)).padStart(2, '0');
3362
+ return "".concat(yearText, "-").concat(monthText);
3363
+ }
3364
+ }
3365
+ return '';
3366
+ }
3322
3367
  function resolveAssistantMonthlyKey(documents) {
3323
3368
  var first = Array.isArray(documents) ? documents.find(function (doc) { return doc && typeof doc === 'object'; }) : null;
3324
3369
  if (!first) {
@@ -3326,7 +3371,7 @@ function resolveAssistantMonthlyKey(documents) {
3326
3371
  }
3327
3372
  return Object.keys(first).find(function (key) {
3328
3373
  var value = first[key];
3329
- return typeof value === 'string' && /^\d{4}-\d{2}$/.test(value);
3374
+ return !!normalizeAssistantMonthBucket(value);
3330
3375
  }) || '';
3331
3376
  }
3332
3377
  function resolveAssistantNumericAmountKey(documents, monthKey) {
@@ -3357,8 +3402,8 @@ function resolveAssistantNumericAmountKey(documents, monthKey) {
3357
3402
  function mapAssistantRevenueByMonth(documents, monthKey, valueKey) {
3358
3403
  var mapped = new Map();
3359
3404
  (Array.isArray(documents) ? documents : []).forEach(function (doc) {
3360
- var month = normalizeOptionalString(doc === null || doc === void 0 ? void 0 : doc[monthKey]);
3361
- if (!month || !/^\d{4}-\d{2}$/.test(month)) {
3405
+ var month = normalizeAssistantMonthBucket(doc === null || doc === void 0 ? void 0 : doc[monthKey]);
3406
+ if (!month) {
3362
3407
  return;
3363
3408
  }
3364
3409
  var value = Number(doc === null || doc === void 0 ? void 0 : doc[valueKey]);
@@ -3435,8 +3480,8 @@ function buildAssistantMonthlyRevenueVerificationPipeline(match, dateField) {
3435
3480
  function mapAssistantVerificationDocsByMonth(docs) {
3436
3481
  var mapped = new Map();
3437
3482
  (Array.isArray(docs) ? docs : []).forEach(function (row) {
3438
- var month = normalizeOptionalString(row === null || row === void 0 ? void 0 : row.month);
3439
- if (!month || !/^\d{4}-\d{2}$/.test(month)) {
3483
+ var month = normalizeAssistantMonthBucket(row === null || row === void 0 ? void 0 : row.month);
3484
+ if (!month) {
3440
3485
  return;
3441
3486
  }
3442
3487
  var paid = Number(row === null || row === void 0 ? void 0 : row.paid_total_sum);
@@ -3747,18 +3792,17 @@ function applyAssistantVerificationNotes(value, toolResult) {
3747
3792
  return "".concat(content, "\n\n").concat(noteLines.join('\n')).trim();
3748
3793
  }
3749
3794
  function applyAssistantDatedReportWindow(value, toolResult) {
3750
- var _a, _b, _c;
3751
3795
  var content = normalizeOptionalString(value);
3752
- var window = (_c = (_b = (_a = toolResult === null || toolResult === void 0 ? void 0 : toolResult.output) === null || _a === void 0 ? void 0 : _a.verification) === null || _b === void 0 ? void 0 : _b.metrics) === null || _c === void 0 ? void 0 : _c.window;
3796
+ var window = resolveAssistantDatedReportWindow(toolResult);
3753
3797
  if (!window || typeof window !== 'object') {
3754
3798
  return content || value || '';
3755
3799
  }
3756
- var startDate = normalizeOptionalString(window.startDate);
3757
- var endDate = normalizeOptionalString(window.endDate);
3800
+ var startDate = normalizeOptionalString(window === null || window === void 0 ? void 0 : window.startDate);
3801
+ var endDate = normalizeOptionalString(window === null || window === void 0 ? void 0 : window.endDate);
3758
3802
  if (!startDate || !endDate) {
3759
3803
  return content || value || '';
3760
3804
  }
3761
- var months = normalizeOptionalNumber(window.months);
3805
+ var months = normalizeOptionalNumber(window === null || window === void 0 ? void 0 : window.months);
3762
3806
  var monthsText = months && months > 0 ? "; rolling last ".concat((0, common_1.round)(months), " month").concat((0, common_1.round)(months) === 1 ? '' : 's') : '';
3763
3807
  var line = "Report date range (UTC): ".concat(startDate, " to ").concat(endDate).concat(monthsText, ".");
3764
3808
  var normalizedLower = String(content || '').toLowerCase();
@@ -3770,6 +3814,56 @@ function applyAssistantDatedReportWindow(value, toolResult) {
3770
3814
  }
3771
3815
  return "".concat(line, "\n\n").concat(content).trim();
3772
3816
  }
3817
+ function resolveAssistantDatedReportWindow(toolResult) {
3818
+ var e_1, _a;
3819
+ var _b, _c, _d, _e, _f, _g, _h, _j;
3820
+ 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;
3821
+ var verificationStart = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.startDate);
3822
+ var verificationEnd = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.endDate);
3823
+ if (verificationStart && verificationEnd) {
3824
+ return {
3825
+ startDate: verificationStart,
3826
+ endDate: verificationEnd,
3827
+ months: normalizeOptionalNumber(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.months) || undefined
3828
+ };
3829
+ }
3830
+ var pipelineCandidates = [
3831
+ (_f = (_e = toolResult === null || toolResult === void 0 ? void 0 : toolResult.output) === null || _e === void 0 ? void 0 : _e.debug) === null || _f === void 0 ? void 0 : _f.executedPipeline,
3832
+ (_h = (_g = toolResult === null || toolResult === void 0 ? void 0 : toolResult.output) === null || _g === void 0 ? void 0 : _g.debug) === null || _h === void 0 ? void 0 : _h.originalPipeline,
3833
+ (_j = toolResult === null || toolResult === void 0 ? void 0 : toolResult.input) === null || _j === void 0 ? void 0 : _j.pipeline
3834
+ ];
3835
+ try {
3836
+ for (var pipelineCandidates_1 = __values(pipelineCandidates), pipelineCandidates_1_1 = pipelineCandidates_1.next(); !pipelineCandidates_1_1.done; pipelineCandidates_1_1 = pipelineCandidates_1.next()) {
3837
+ var candidate = pipelineCandidates_1_1.value;
3838
+ if (!Array.isArray(candidate)) {
3839
+ continue;
3840
+ }
3841
+ var rollingWindow = detectAssistantRollingMonthWindow(candidate);
3842
+ if (!(rollingWindow === null || rollingWindow === void 0 ? void 0 : rollingWindow.months) || !(rollingWindow === null || rollingWindow === void 0 ? void 0 : rollingWindow.upperNow)) {
3843
+ continue;
3844
+ }
3845
+ var bounds = resolveAssistantRollingWindowBounds(rollingWindow.months);
3846
+ var startDate = formatAssistantIsoDateOnly(bounds.rollingStart);
3847
+ var endDate = formatAssistantIsoDateOnly(bounds.now);
3848
+ if (!startDate || !endDate) {
3849
+ continue;
3850
+ }
3851
+ return {
3852
+ startDate: startDate,
3853
+ endDate: endDate,
3854
+ months: rollingWindow.months
3855
+ };
3856
+ }
3857
+ }
3858
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3859
+ finally {
3860
+ try {
3861
+ if (pipelineCandidates_1_1 && !pipelineCandidates_1_1.done && (_a = pipelineCandidates_1.return)) _a.call(pipelineCandidates_1);
3862
+ }
3863
+ finally { if (e_1) throw e_1.error; }
3864
+ }
3865
+ return null;
3866
+ }
3773
3867
  function buildAssistantDebugPayload(params) {
3774
3868
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
3775
3869
  var notes = [];
@@ -4334,7 +4428,7 @@ function getValueAtPath(obj, path) {
4334
4428
  return walk(obj, 0);
4335
4429
  }
4336
4430
  function hasArrayValueAtPath(docs, path) {
4337
- var e_1, _a;
4431
+ var e_2, _a;
4338
4432
  if (!Array.isArray(docs) || !docs.length || !path) {
4339
4433
  return false;
4340
4434
  }
@@ -4347,17 +4441,17 @@ function hasArrayValueAtPath(docs, path) {
4347
4441
  }
4348
4442
  }
4349
4443
  }
4350
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
4444
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4351
4445
  finally {
4352
4446
  try {
4353
4447
  if (docs_1_1 && !docs_1_1.done && (_a = docs_1.return)) _a.call(docs_1);
4354
4448
  }
4355
- finally { if (e_1) throw e_1.error; }
4449
+ finally { if (e_2) throw e_2.error; }
4356
4450
  }
4357
4451
  return false;
4358
4452
  }
4359
4453
  function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
4360
- var e_2, _a, e_3, _b;
4454
+ var e_3, _a, e_4, _b;
4361
4455
  if (!Array.isArray(docs) || !fieldPath) {
4362
4456
  return 'unknown';
4363
4457
  }
@@ -4370,7 +4464,7 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
4370
4464
  : doc === null || doc === void 0 ? void 0 : doc[fieldPath];
4371
4465
  var queue = Array.isArray(value) ? value : [value];
4372
4466
  try {
4373
- for (var queue_1 = (e_3 = void 0, __values(queue)), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
4467
+ for (var queue_1 = (e_4 = void 0, __values(queue)), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
4374
4468
  var entry = queue_1_1.value;
4375
4469
  if (entry === null || entry === undefined) {
4376
4470
  continue;
@@ -4383,21 +4477,21 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
4383
4477
  }
4384
4478
  }
4385
4479
  }
4386
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
4480
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
4387
4481
  finally {
4388
4482
  try {
4389
4483
  if (queue_1_1 && !queue_1_1.done && (_b = queue_1.return)) _b.call(queue_1);
4390
4484
  }
4391
- finally { if (e_3) throw e_3.error; }
4485
+ finally { if (e_4) throw e_4.error; }
4392
4486
  }
4393
4487
  }
4394
4488
  }
4395
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
4489
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
4396
4490
  finally {
4397
4491
  try {
4398
4492
  if (docs_2_1 && !docs_2_1.done && (_a = docs_2.return)) _a.call(docs_2);
4399
4493
  }
4400
- finally { if (e_2) throw e_2.error; }
4494
+ finally { if (e_3) throw e_3.error; }
4401
4495
  }
4402
4496
  return sawString ? 'string' : 'unknown';
4403
4497
  }
@@ -4492,7 +4586,7 @@ function normalizeLookupKeyValue(value) {
4492
4586
  return '';
4493
4587
  }
4494
4588
  function collectTopLevelIdFieldValues(docs, options) {
4495
- var e_4, _a, e_5, _b;
4589
+ var e_5, _a, e_6, _b;
4496
4590
  if (!Array.isArray(docs) || !docs.length) {
4497
4591
  return [];
4498
4592
  }
@@ -4540,26 +4634,26 @@ function collectTopLevelIdFieldValues(docs, options) {
4540
4634
  });
4541
4635
  };
4542
4636
  try {
4543
- for (var keys_1 = (e_5 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
4637
+ for (var keys_1 = (e_6 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
4544
4638
  var key = keys_1_1.value;
4545
4639
  _loop_3(key);
4546
4640
  }
4547
4641
  }
4548
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
4642
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
4549
4643
  finally {
4550
4644
  try {
4551
4645
  if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
4552
4646
  }
4553
- finally { if (e_5) throw e_5.error; }
4647
+ finally { if (e_6) throw e_6.error; }
4554
4648
  }
4555
4649
  }
4556
4650
  }
4557
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
4651
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
4558
4652
  finally {
4559
4653
  try {
4560
4654
  if (docs_3_1 && !docs_3_1.done && (_a = docs_3.return)) _a.call(docs_3);
4561
4655
  }
4562
- finally { if (e_4) throw e_4.error; }
4656
+ finally { if (e_5) throw e_5.error; }
4563
4657
  }
4564
4658
  return Array.from(fieldMap.entries()).map(function (_a) {
4565
4659
  var _b = __read(_a, 2), field = _b[0], values = _b[1];
@@ -4570,7 +4664,7 @@ function collectTopLevelIdFieldValues(docs, options) {
4570
4664
  });
4571
4665
  }
4572
4666
  function resolveLookupDisplayField(baseToken, probeDocs, schemaFields) {
4573
- var e_6, _a, e_7, _b;
4667
+ var e_7, _a, e_8, _b;
4574
4668
  var normalizedBase = normalizeOptionalString(baseToken);
4575
4669
  if (!normalizedBase) {
4576
4670
  return null;
@@ -4588,12 +4682,12 @@ function resolveLookupDisplayField(baseToken, probeDocs, schemaFields) {
4588
4682
  }
4589
4683
  }
4590
4684
  }
4591
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
4685
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
4592
4686
  finally {
4593
4687
  try {
4594
4688
  if (schemaCandidates_1_1 && !schemaCandidates_1_1.done && (_a = schemaCandidates_1.return)) _a.call(schemaCandidates_1);
4595
4689
  }
4596
- finally { if (e_6) throw e_6.error; }
4690
+ finally { if (e_7) throw e_7.error; }
4597
4691
  }
4598
4692
  return schemaCandidates[0];
4599
4693
  }
@@ -4606,12 +4700,12 @@ function resolveLookupDisplayField(baseToken, probeDocs, schemaFields) {
4606
4700
  }
4607
4701
  }
4608
4702
  }
4609
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
4703
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
4610
4704
  finally {
4611
4705
  try {
4612
4706
  if (candidates_1_1 && !candidates_1_1.done && (_b = candidates_1.return)) _b.call(candidates_1);
4613
4707
  }
4614
- finally { if (e_7) throw e_7.error; }
4708
+ finally { if (e_8) throw e_8.error; }
4615
4709
  }
4616
4710
  return candidates.length ? candidates[0] : null;
4617
4711
  }
@@ -4624,8 +4718,8 @@ function resolveLookupMappingsForField(field, mappings) {
4624
4718
  }
4625
4719
  function applyIdLookupDisplayEnrichment(params) {
4626
4720
  return __awaiter(this, void 0, void 0, function () {
4627
- var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry, e_8_1;
4628
- var e_8, _a;
4721
+ var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry, e_9_1;
4722
+ var e_9, _a;
4629
4723
  return __generator(this, function (_b) {
4630
4724
  switch (_b.label) {
4631
4725
  case 0:
@@ -4649,8 +4743,8 @@ function applyIdLookupDisplayEnrichment(params) {
4649
4743
  lookupMeta = [];
4650
4744
  enrichedDocs = docs.map(function (doc) { return (__assign({}, doc)); });
4651
4745
  _loop_4 = function (fieldEntry) {
4652
- var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_9_1;
4653
- var e_9, _c;
4746
+ var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_10_1;
4747
+ var e_10, _c;
4654
4748
  return __generator(this, function (_d) {
4655
4749
  switch (_d.label) {
4656
4750
  case 0:
@@ -4799,7 +4893,7 @@ function applyIdLookupDisplayEnrichment(params) {
4799
4893
  _d.label = 1;
4800
4894
  case 1:
4801
4895
  _d.trys.push([1, 6, 7, 8]);
4802
- filteredCandidates_1 = (e_9 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
4896
+ filteredCandidates_1 = (e_10 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
4803
4897
  _d.label = 2;
4804
4898
  case 2:
4805
4899
  if (!!filteredCandidates_1_1.done) return [3 /*break*/, 5];
@@ -4815,14 +4909,14 @@ function applyIdLookupDisplayEnrichment(params) {
4815
4909
  return [3 /*break*/, 2];
4816
4910
  case 5: return [3 /*break*/, 8];
4817
4911
  case 6:
4818
- e_9_1 = _d.sent();
4819
- e_9 = { error: e_9_1 };
4912
+ e_10_1 = _d.sent();
4913
+ e_10 = { error: e_10_1 };
4820
4914
  return [3 /*break*/, 8];
4821
4915
  case 7:
4822
4916
  try {
4823
4917
  if (filteredCandidates_1_1 && !filteredCandidates_1_1.done && (_c = filteredCandidates_1.return)) _c.call(filteredCandidates_1);
4824
4918
  }
4825
- finally { if (e_9) throw e_9.error; }
4919
+ finally { if (e_10) throw e_10.error; }
4826
4920
  return [7 /*endfinally*/];
4827
4921
  case 8: return [2 /*return*/];
4828
4922
  }
@@ -4845,14 +4939,14 @@ function applyIdLookupDisplayEnrichment(params) {
4845
4939
  return [3 /*break*/, 3];
4846
4940
  case 6: return [3 /*break*/, 9];
4847
4941
  case 7:
4848
- e_8_1 = _b.sent();
4849
- e_8 = { error: e_8_1 };
4942
+ e_9_1 = _b.sent();
4943
+ e_9 = { error: e_9_1 };
4850
4944
  return [3 /*break*/, 9];
4851
4945
  case 8:
4852
4946
  try {
4853
4947
  if (idFields_1_1 && !idFields_1_1.done && (_a = idFields_1.return)) _a.call(idFields_1);
4854
4948
  }
4855
- finally { if (e_8) throw e_8.error; }
4949
+ finally { if (e_9) throw e_9.error; }
4856
4950
  return [7 /*endfinally*/];
4857
4951
  case 9:
4858
4952
  if (!lookupMeta.length) {
@@ -4871,7 +4965,7 @@ function applyIdLookupDisplayEnrichment(params) {
4871
4965
  });
4872
4966
  }
4873
4967
  function hasNonEmptyValue(docs, fieldPath, options) {
4874
- var e_10, _a;
4968
+ var e_11, _a;
4875
4969
  if (!Array.isArray(docs) || !fieldPath) {
4876
4970
  return false;
4877
4971
  }
@@ -4888,12 +4982,12 @@ function hasNonEmptyValue(docs, fieldPath, options) {
4888
4982
  }
4889
4983
  }
4890
4984
  }
4891
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
4985
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
4892
4986
  finally {
4893
4987
  try {
4894
4988
  if (docs_4_1 && !docs_4_1.done && (_a = docs_4.return)) _a.call(docs_4);
4895
4989
  }
4896
- finally { if (e_10) throw e_10.error; }
4990
+ finally { if (e_11) throw e_11.error; }
4897
4991
  }
4898
4992
  return false;
4899
4993
  }
@@ -5557,6 +5651,12 @@ function formatAssistantDisplayCell(value, column) {
5557
5651
  }
5558
5652
  }
5559
5653
  var columnKey = String(column || '').toLowerCase();
5654
+ if (columnKey.includes('month')) {
5655
+ var monthBucket = normalizeAssistantMonthBucket(value);
5656
+ if (monthBucket) {
5657
+ return monthBucket;
5658
+ }
5659
+ }
5560
5660
  if (isAssistantDateColumn(columnKey) && isAssistantLikelyDateValue(value)) {
5561
5661
  return formatAssistantDateValue(value);
5562
5662
  }
@@ -6175,7 +6275,7 @@ function matchContainsField(value, field) {
6175
6275
  });
6176
6276
  }
6177
6277
  function resolveAggregateCompletionFallback(pipeline) {
6178
- var e_11, _a;
6278
+ var e_12, _a;
6179
6279
  if (!Array.isArray(pipeline)) {
6180
6280
  return null;
6181
6281
  }
@@ -6188,7 +6288,7 @@ function resolveAggregateCompletionFallback(pipeline) {
6188
6288
  }
6189
6289
  var addFields = stage.$addFields;
6190
6290
  try {
6191
- for (var _b = (e_11 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
6291
+ for (var _b = (e_12 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
6192
6292
  var key = _c.value;
6193
6293
  if (!isCompletionFieldName(key)) {
6194
6294
  continue;
@@ -6202,12 +6302,12 @@ function resolveAggregateCompletionFallback(pipeline) {
6202
6302
  }
6203
6303
  }
6204
6304
  }
6205
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
6305
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
6206
6306
  finally {
6207
6307
  try {
6208
6308
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6209
6309
  }
6210
- finally { if (e_11) throw e_11.error; }
6310
+ finally { if (e_12) throw e_12.error; }
6211
6311
  }
6212
6312
  if (candidateField) {
6213
6313
  break;
@@ -6363,7 +6463,7 @@ function buildCompletionFallbackSources(field) {
6363
6463
  ]);
6364
6464
  }
6365
6465
  function resolveAggregateCompletionExprFallback(pipeline) {
6366
- var e_12, _a;
6466
+ var e_13, _a;
6367
6467
  if (!Array.isArray(pipeline)) {
6368
6468
  return null;
6369
6469
  }
@@ -6383,7 +6483,7 @@ function resolveAggregateCompletionExprFallback(pipeline) {
6383
6483
  }
6384
6484
  if (!candidateField) {
6385
6485
  try {
6386
- for (var _b = (e_12 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
6486
+ for (var _b = (e_13 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
6387
6487
  var key = _c.value;
6388
6488
  if (key.startsWith('$')) {
6389
6489
  continue;
@@ -6398,12 +6498,12 @@ function resolveAggregateCompletionExprFallback(pipeline) {
6398
6498
  }
6399
6499
  }
6400
6500
  }
6401
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
6501
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
6402
6502
  finally {
6403
6503
  try {
6404
6504
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6405
6505
  }
6406
- finally { if (e_12) throw e_12.error; }
6506
+ finally { if (e_13) throw e_13.error; }
6407
6507
  }
6408
6508
  }
6409
6509
  if (!candidateField) {
@@ -6573,7 +6673,7 @@ function isRegexMatchCondition(value) {
6573
6673
  return false;
6574
6674
  }
6575
6675
  function findRegexMatchInMatchObject(match, prefix) {
6576
- var e_13, _a, e_14, _b;
6676
+ var e_14, _a, e_15, _b;
6577
6677
  if (prefix === void 0) { prefix = ''; }
6578
6678
  if (Array.isArray(match)) {
6579
6679
  try {
@@ -6585,12 +6685,12 @@ function findRegexMatchInMatchObject(match, prefix) {
6585
6685
  }
6586
6686
  }
6587
6687
  }
6588
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
6688
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
6589
6689
  finally {
6590
6690
  try {
6591
6691
  if (match_1_1 && !match_1_1.done && (_a = match_1.return)) _a.call(match_1);
6592
6692
  }
6593
- finally { if (e_13) throw e_13.error; }
6693
+ finally { if (e_14) throw e_14.error; }
6594
6694
  }
6595
6695
  return null;
6596
6696
  }
@@ -6621,12 +6721,12 @@ function findRegexMatchInMatchObject(match, prefix) {
6621
6721
  }
6622
6722
  }
6623
6723
  }
6624
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
6724
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
6625
6725
  finally {
6626
6726
  try {
6627
6727
  if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
6628
6728
  }
6629
- finally { if (e_14) throw e_14.error; }
6729
+ finally { if (e_15) throw e_15.error; }
6630
6730
  }
6631
6731
  return null;
6632
6732
  }
@@ -6850,7 +6950,7 @@ function collectMatchFieldsByCondition(match, predicate, prefix) {
6850
6950
  return results;
6851
6951
  }
6852
6952
  function findMatchConditionForField(match, targetField, prefix) {
6853
- var e_15, _a, e_16, _b;
6953
+ var e_16, _a, e_17, _b;
6854
6954
  if (prefix === void 0) { prefix = ''; }
6855
6955
  if (!match || typeof match !== 'object') {
6856
6956
  return undefined;
@@ -6865,12 +6965,12 @@ function findMatchConditionForField(match, targetField, prefix) {
6865
6965
  }
6866
6966
  }
6867
6967
  }
6868
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
6968
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
6869
6969
  finally {
6870
6970
  try {
6871
6971
  if (match_2_1 && !match_2_1.done && (_a = match_2.return)) _a.call(match_2);
6872
6972
  }
6873
- finally { if (e_15) throw e_15.error; }
6973
+ finally { if (e_16) throw e_16.error; }
6874
6974
  }
6875
6975
  return undefined;
6876
6976
  }
@@ -6897,12 +6997,12 @@ function findMatchConditionForField(match, targetField, prefix) {
6897
6997
  }
6898
6998
  }
6899
6999
  }
6900
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
7000
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
6901
7001
  finally {
6902
7002
  try {
6903
7003
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
6904
7004
  }
6905
- finally { if (e_16) throw e_16.error; }
7005
+ finally { if (e_17) throw e_17.error; }
6906
7006
  }
6907
7007
  return undefined;
6908
7008
  }
@@ -6945,7 +7045,7 @@ function detectIdLikeValue(value) {
6945
7045
  return false;
6946
7046
  }
6947
7047
  function detectChemicalIdFromProbe(probeDocs, fields) {
6948
- var e_17, _a, e_18, _b;
7048
+ var e_18, _a, e_19, _b;
6949
7049
  if (!Array.isArray(probeDocs) || !probeDocs.length) {
6950
7050
  return false;
6951
7051
  }
@@ -6957,7 +7057,7 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
6957
7057
  for (var probeDocs_1 = __values(probeDocs), probeDocs_1_1 = probeDocs_1.next(); !probeDocs_1_1.done; probeDocs_1_1 = probeDocs_1.next()) {
6958
7058
  var doc = probeDocs_1_1.value;
6959
7059
  try {
6960
- for (var targets_1 = (e_18 = void 0, __values(targets)), targets_1_1 = targets_1.next(); !targets_1_1.done; targets_1_1 = targets_1.next()) {
7060
+ for (var targets_1 = (e_19 = void 0, __values(targets)), targets_1_1 = targets_1.next(); !targets_1_1.done; targets_1_1 = targets_1.next()) {
6961
7061
  var field = targets_1_1.value;
6962
7062
  var value = getValueAtPath(doc, field);
6963
7063
  if (Array.isArray(value)) {
@@ -6970,21 +7070,21 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
6970
7070
  }
6971
7071
  }
6972
7072
  }
6973
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
7073
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
6974
7074
  finally {
6975
7075
  try {
6976
7076
  if (targets_1_1 && !targets_1_1.done && (_b = targets_1.return)) _b.call(targets_1);
6977
7077
  }
6978
- finally { if (e_18) throw e_18.error; }
7078
+ finally { if (e_19) throw e_19.error; }
6979
7079
  }
6980
7080
  }
6981
7081
  }
6982
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
7082
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
6983
7083
  finally {
6984
7084
  try {
6985
7085
  if (probeDocs_1_1 && !probeDocs_1_1.done && (_a = probeDocs_1.return)) _a.call(probeDocs_1);
6986
7086
  }
6987
- finally { if (e_17) throw e_17.error; }
7087
+ finally { if (e_18) throw e_18.error; }
6988
7088
  }
6989
7089
  return false;
6990
7090
  }
@@ -7205,8 +7305,8 @@ function buildChemicalIdFieldCandidates(field) {
7205
7305
  }
7206
7306
  function applyChemicalNameLookupFallbackToQuery(params) {
7207
7307
  return __awaiter(this, void 0, void 0, function () {
7208
- var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, chemicalFields, targetField, condition, regex, sampleDocs, collectionNames, candidates, _loop_6, candidates_2, candidates_2_1, candidate, state_4, e_19_1;
7209
- var e_19, _a;
7308
+ var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, chemicalFields, targetField, condition, regex, sampleDocs, collectionNames, candidates, _loop_6, candidates_2, candidates_2_1, candidate, state_4, e_20_1;
7309
+ var e_20, _a;
7210
7310
  var _b;
7211
7311
  return __generator(this, function (_c) {
7212
7312
  switch (_c.label) {
@@ -7319,14 +7419,14 @@ function applyChemicalNameLookupFallbackToQuery(params) {
7319
7419
  return [3 /*break*/, 3];
7320
7420
  case 6: return [3 /*break*/, 9];
7321
7421
  case 7:
7322
- e_19_1 = _c.sent();
7323
- e_19 = { error: e_19_1 };
7422
+ e_20_1 = _c.sent();
7423
+ e_20 = { error: e_20_1 };
7324
7424
  return [3 /*break*/, 9];
7325
7425
  case 8:
7326
7426
  try {
7327
7427
  if (candidates_2_1 && !candidates_2_1.done && (_a = candidates_2.return)) _a.call(candidates_2);
7328
7428
  }
7329
- finally { if (e_19) throw e_19.error; }
7429
+ finally { if (e_20) throw e_20.error; }
7330
7430
  return [7 /*endfinally*/];
7331
7431
  case 9: return [2 /*return*/, null];
7332
7432
  }
@@ -7420,8 +7520,8 @@ function lookupIdsForNameMatch(params) {
7420
7520
  }
7421
7521
  function applyIdLookupFallbackToQuery(params) {
7422
7522
  return __awaiter(this, void 0, void 0, function () {
7423
- var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, conditions, collectionNames, _a, conditions_1, conditions_1_1, condition, regex, baseToken, targetFieldType, nextValue, localNameField, candidates, candidates_3, candidates_3_1, candidate, candidateHasClientScope, _b, candidateProbe, lookup, targetFieldType, normalizedIds, idsForQuery, e_20_1, e_21_1;
7424
- var e_21, _c, e_20, _d;
7523
+ var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, conditions, collectionNames, _a, conditions_1, conditions_1_1, condition, regex, baseToken, targetFieldType, nextValue, localNameField, candidates, candidates_3, candidates_3_1, candidate, candidateHasClientScope, _b, candidateProbe, lookup, targetFieldType, normalizedIds, idsForQuery, e_21_1, e_22_1;
7524
+ var e_22, _c, e_21, _d;
7425
7525
  var _e;
7426
7526
  return __generator(this, function (_f) {
7427
7527
  switch (_f.label) {
@@ -7491,7 +7591,7 @@ function applyIdLookupFallbackToQuery(params) {
7491
7591
  _f.label = 5;
7492
7592
  case 5:
7493
7593
  _f.trys.push([5, 14, 15, 16]);
7494
- candidates_3 = (e_20 = void 0, __values(candidates)), candidates_3_1 = candidates_3.next();
7594
+ candidates_3 = (e_21 = void 0, __values(candidates)), candidates_3_1 = candidates_3.next();
7495
7595
  _f.label = 6;
7496
7596
  case 6:
7497
7597
  if (!!candidates_3_1.done) return [3 /*break*/, 13];
@@ -7558,28 +7658,28 @@ function applyIdLookupFallbackToQuery(params) {
7558
7658
  return [3 /*break*/, 6];
7559
7659
  case 13: return [3 /*break*/, 16];
7560
7660
  case 14:
7561
- e_20_1 = _f.sent();
7562
- e_20 = { error: e_20_1 };
7661
+ e_21_1 = _f.sent();
7662
+ e_21 = { error: e_21_1 };
7563
7663
  return [3 /*break*/, 16];
7564
7664
  case 15:
7565
7665
  try {
7566
7666
  if (candidates_3_1 && !candidates_3_1.done && (_d = candidates_3.return)) _d.call(candidates_3);
7567
7667
  }
7568
- finally { if (e_20) throw e_20.error; }
7668
+ finally { if (e_21) throw e_21.error; }
7569
7669
  return [7 /*endfinally*/];
7570
7670
  case 16:
7571
7671
  conditions_1_1 = conditions_1.next();
7572
7672
  return [3 /*break*/, 4];
7573
7673
  case 17: return [3 /*break*/, 20];
7574
7674
  case 18:
7575
- e_21_1 = _f.sent();
7576
- e_21 = { error: e_21_1 };
7675
+ e_22_1 = _f.sent();
7676
+ e_22 = { error: e_22_1 };
7577
7677
  return [3 /*break*/, 20];
7578
7678
  case 19:
7579
7679
  try {
7580
7680
  if (conditions_1_1 && !conditions_1_1.done && (_c = conditions_1.return)) _c.call(conditions_1);
7581
7681
  }
7582
- finally { if (e_21) throw e_21.error; }
7682
+ finally { if (e_22) throw e_22.error; }
7583
7683
  return [7 /*endfinally*/];
7584
7684
  case 20: return [2 /*return*/, null];
7585
7685
  }
@@ -8431,7 +8531,7 @@ function resolveAssistantReportBuilderBridgeCollection(collection) {
8431
8531
  throw new Error('AI assistant report builder bridge: Collection is not configured for report builder.');
8432
8532
  }
8433
8533
  function findQueryDateField(query) {
8434
- var e_22, _a, e_23, _b;
8534
+ var e_23, _a, e_24, _b;
8435
8535
  if (!query || typeof query !== 'object') {
8436
8536
  return null;
8437
8537
  }
@@ -8445,12 +8545,12 @@ function findQueryDateField(query) {
8445
8545
  }
8446
8546
  }
8447
8547
  }
8448
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
8548
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
8449
8549
  finally {
8450
8550
  try {
8451
8551
  if (query_1_1 && !query_1_1.done && (_a = query_1.return)) _a.call(query_1);
8452
8552
  }
8453
- finally { if (e_22) throw e_22.error; }
8553
+ finally { if (e_23) throw e_23.error; }
8454
8554
  }
8455
8555
  return null;
8456
8556
  }
@@ -8469,12 +8569,12 @@ function findQueryDateField(query) {
8469
8569
  }
8470
8570
  }
8471
8571
  }
8472
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
8572
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
8473
8573
  finally {
8474
8574
  try {
8475
8575
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
8476
8576
  }
8477
- finally { if (e_23) throw e_23.error; }
8577
+ finally { if (e_24) throw e_24.error; }
8478
8578
  }
8479
8579
  return null;
8480
8580
  }
@@ -8696,7 +8796,7 @@ function resolveQueryDateFieldFallback(query) {
8696
8796
  return { from: dateField, to: fallback };
8697
8797
  }
8698
8798
  function containsForbiddenMongoOperators(value) {
8699
- var e_24, _a;
8799
+ var e_25, _a;
8700
8800
  if (!value || typeof value !== 'object') {
8701
8801
  return false;
8702
8802
  }
@@ -8715,12 +8815,12 @@ function containsForbiddenMongoOperators(value) {
8715
8815
  }
8716
8816
  }
8717
8817
  }
8718
- catch (e_24_1) { e_24 = { error: e_24_1 }; }
8818
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
8719
8819
  finally {
8720
8820
  try {
8721
8821
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8722
8822
  }
8723
- finally { if (e_24) throw e_24.error; }
8823
+ finally { if (e_25) throw e_25.error; }
8724
8824
  }
8725
8825
  return false;
8726
8826
  }
@@ -9096,8 +9196,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
9096
9196
  }
9097
9197
  function waitForCodexWorkerMessage(worker, streamStatusHandler) {
9098
9198
  return __awaiter(this, void 0, void 0, function () {
9099
- var _a, _b, _c, _d, message, payload, status_1, e_25_1;
9100
- var _e, e_25, _f, _g;
9199
+ var _a, _b, _c, _d, message, payload, status_1, e_26_1;
9200
+ var _e, e_26, _f, _g;
9101
9201
  return __generator(this, function (_h) {
9102
9202
  switch (_h.label) {
9103
9203
  case 0:
@@ -9124,8 +9224,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
9124
9224
  return [3 /*break*/, 1];
9125
9225
  case 4: return [3 /*break*/, 11];
9126
9226
  case 5:
9127
- e_25_1 = _h.sent();
9128
- e_25 = { error: e_25_1 };
9227
+ e_26_1 = _h.sent();
9228
+ e_26 = { error: e_26_1 };
9129
9229
  return [3 /*break*/, 11];
9130
9230
  case 6:
9131
9231
  _h.trys.push([6, , 9, 10]);
@@ -9136,7 +9236,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
9136
9236
  _h.label = 8;
9137
9237
  case 8: return [3 /*break*/, 10];
9138
9238
  case 9:
9139
- if (e_25) throw e_25.error;
9239
+ if (e_26) throw e_26.error;
9140
9240
  return [7 /*endfinally*/];
9141
9241
  case 10: return [7 /*endfinally*/];
9142
9242
  case 11: throw new CodexWorkerBootstrapError('Codex worker exited before completing.');
@@ -9598,7 +9698,7 @@ function resolveAssistantPlannerEnabled() {
9598
9698
  return raw === undefined ? true : raw === true;
9599
9699
  }
9600
9700
  function resolveAssistantPlannerKnownRoutes() {
9601
- var e_26, _a;
9701
+ var e_27, _a;
9602
9702
  var _b;
9603
9703
  var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
9604
9704
  var unique = new Set();
@@ -9611,12 +9711,12 @@ function resolveAssistantPlannerKnownRoutes() {
9611
9711
  }
9612
9712
  }
9613
9713
  }
9614
- catch (e_26_1) { e_26 = { error: e_26_1 }; }
9714
+ catch (e_27_1) { e_27 = { error: e_27_1 }; }
9615
9715
  finally {
9616
9716
  try {
9617
9717
  if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
9618
9718
  }
9619
- finally { if (e_26) throw e_26.error; }
9719
+ finally { if (e_27) throw e_27.error; }
9620
9720
  }
9621
9721
  return Array.from(unique).slice(0, AI_ASSISTANT_PLANNER_MAX_ROUTES);
9622
9722
  }
@@ -9859,7 +9959,7 @@ function normalizeRouteMatchKey(value) {
9859
9959
  return normalizeRouteKey(value).toLowerCase();
9860
9960
  }
9861
9961
  function buildClientRouteIndex() {
9862
- var e_27, _a;
9962
+ var e_28, _a;
9863
9963
  var _b;
9864
9964
  var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
9865
9965
  var set = new Set();
@@ -9878,12 +9978,12 @@ function buildClientRouteIndex() {
9878
9978
  }
9879
9979
  }
9880
9980
  }
9881
- catch (e_27_1) { e_27 = { error: e_27_1 }; }
9981
+ catch (e_28_1) { e_28 = { error: e_28_1 }; }
9882
9982
  finally {
9883
9983
  try {
9884
9984
  if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
9885
9985
  }
9886
- finally { if (e_27) throw e_27.error; }
9986
+ finally { if (e_28) throw e_28.error; }
9887
9987
  }
9888
9988
  return { set: set, map: map, size: routes.length };
9889
9989
  }
@@ -10024,7 +10124,7 @@ function sanitizeAssistantResponse(value) {
10024
10124
  return normalizeAssistantRoutes(normalizedCurrency);
10025
10125
  }
10026
10126
  function evaluateAssistantGuardrails(message) {
10027
- var e_28, _a;
10127
+ var e_29, _a;
10028
10128
  var normalized = String(message || '').toLowerCase();
10029
10129
  var patterns = [
10030
10130
  {
@@ -10070,12 +10170,12 @@ function evaluateAssistantGuardrails(message) {
10070
10170
  }
10071
10171
  }
10072
10172
  }
10073
- catch (e_28_1) { e_28 = { error: e_28_1 }; }
10173
+ catch (e_29_1) { e_29 = { error: e_29_1 }; }
10074
10174
  finally {
10075
10175
  try {
10076
10176
  if (patterns_1_1 && !patterns_1_1.done && (_a = patterns_1.return)) _a.call(patterns_1);
10077
10177
  }
10078
- finally { if (e_28) throw e_28.error; }
10178
+ finally { if (e_29) throw e_29.error; }
10079
10179
  }
10080
10180
  return null;
10081
10181
  }
@@ -10190,7 +10290,7 @@ function tokenizeArithmeticExpression(expression) {
10190
10290
  return tokens;
10191
10291
  }
10192
10292
  function evaluateArithmeticExpression(expression) {
10193
- var e_29, _a, e_30, _b;
10293
+ var e_30, _a, e_31, _b;
10194
10294
  var tokens = tokenizeArithmeticExpression(expression);
10195
10295
  if (!tokens || !tokens.length) {
10196
10296
  return null;
@@ -10247,12 +10347,12 @@ function evaluateArithmeticExpression(expression) {
10247
10347
  prevToken = token;
10248
10348
  }
10249
10349
  }
10250
- catch (e_29_1) { e_29 = { error: e_29_1 }; }
10350
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
10251
10351
  finally {
10252
10352
  try {
10253
10353
  if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
10254
10354
  }
10255
- finally { if (e_29) throw e_29.error; }
10355
+ finally { if (e_30) throw e_30.error; }
10256
10356
  }
10257
10357
  while (ops.length) {
10258
10358
  var op = ops.pop();
@@ -10292,12 +10392,12 @@ function evaluateArithmeticExpression(expression) {
10292
10392
  stack.push(Number(token));
10293
10393
  }
10294
10394
  }
10295
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
10395
+ catch (e_31_1) { e_31 = { error: e_31_1 }; }
10296
10396
  finally {
10297
10397
  try {
10298
10398
  if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
10299
10399
  }
10300
- finally { if (e_30) throw e_30.error; }
10400
+ finally { if (e_31) throw e_31.error; }
10301
10401
  }
10302
10402
  if (stack.length !== 1 || Number.isNaN(stack[0])) {
10303
10403
  return null;
@@ -10481,8 +10581,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
10481
10581
  }
10482
10582
  function readAttachmentContents(attachments) {
10483
10583
  return __awaiter(this, void 0, void 0, function () {
10484
- var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a, e_31_1;
10485
- var e_31, _b;
10584
+ var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a, e_32_1;
10585
+ var e_32, _b;
10486
10586
  return __generator(this, function (_c) {
10487
10587
  switch (_c.label) {
10488
10588
  case 0:
@@ -10561,14 +10661,14 @@ function readAttachmentContents(attachments) {
10561
10661
  return [3 /*break*/, 2];
10562
10662
  case 10: return [3 /*break*/, 13];
10563
10663
  case 11:
10564
- e_31_1 = _c.sent();
10565
- e_31 = { error: e_31_1 };
10664
+ e_32_1 = _c.sent();
10665
+ e_32 = { error: e_32_1 };
10566
10666
  return [3 /*break*/, 13];
10567
10667
  case 12:
10568
10668
  try {
10569
10669
  if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
10570
10670
  }
10571
- finally { if (e_31) throw e_31.error; }
10671
+ finally { if (e_32) throw e_32.error; }
10572
10672
  return [7 /*endfinally*/];
10573
10673
  case 13: return [2 /*return*/, {
10574
10674
  promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
@@ -10756,7 +10856,7 @@ function estimateUsage(messages, responseText, model) {
10756
10856
  };
10757
10857
  }
10758
10858
  function evaluateGuardrails(message) {
10759
- var e_32, _a;
10859
+ var e_33, _a;
10760
10860
  var normalized = String(message || '').toLowerCase();
10761
10861
  var patterns = [
10762
10862
  { pattern: /\b(source\s*code|full\s*code|entire\s*code|repo\s*dump|repository|git\s*clone)\b/i, reason: 'Code access is restricted.' },
@@ -10778,12 +10878,12 @@ function evaluateGuardrails(message) {
10778
10878
  }
10779
10879
  }
10780
10880
  }
10781
- catch (e_32_1) { e_32 = { error: e_32_1 }; }
10881
+ catch (e_33_1) { e_33 = { error: e_33_1 }; }
10782
10882
  finally {
10783
10883
  try {
10784
10884
  if (patterns_2_1 && !patterns_2_1.done && (_a = patterns_2.return)) _a.call(patterns_2);
10785
10885
  }
10786
- finally { if (e_32) throw e_32.error; }
10886
+ finally { if (e_33) throw e_33.error; }
10787
10887
  }
10788
10888
  return null;
10789
10889
  }