@resolveio/server-lib 22.2.30 → 22.2.31

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.
@@ -10013,6 +10013,9 @@ function applyAssistantDatedReportWindow(value, toolResult) {
10013
10013
  if (!startDate || !endDate) {
10014
10014
  return content || value || '';
10015
10015
  }
10016
+ var dateDisplayFormat = resolveAssistantDisplayDateFormatPreference();
10017
+ var startDateDisplay = formatAssistantDateValue(startDate, dateDisplayFormat);
10018
+ var endDateDisplay = formatAssistantDateValue(endDate, dateDisplayFormat);
10016
10019
  var mode = normalizeOptionalString(window === null || window === void 0 ? void 0 : window.mode).toLowerCase();
10017
10020
  var months = normalizeOptionalNumber(window === null || window === void 0 ? void 0 : window.months);
10018
10021
  var monthsText = '';
@@ -10025,9 +10028,11 @@ function applyAssistantDatedReportWindow(value, toolResult) {
10025
10028
  monthsText = "; rolling last ".concat(count, " month").concat(count === 1 ? '' : 's');
10026
10029
  }
10027
10030
  }
10028
- var line = "Report date range (UTC): ".concat(startDate, " to ").concat(endDate).concat(monthsText, ".");
10031
+ var line = "Report date range (UTC): ".concat(startDateDisplay, " to ").concat(endDateDisplay).concat(monthsText, ".");
10029
10032
  var normalizedLower = String(content || '').toLowerCase();
10030
- if (normalizedLower.includes(startDate.toLowerCase()) && normalizedLower.includes(endDate.toLowerCase())) {
10033
+ var hasRawDates = normalizedLower.includes(startDate.toLowerCase()) && normalizedLower.includes(endDate.toLowerCase());
10034
+ var hasDisplayDates = normalizedLower.includes(startDateDisplay.toLowerCase()) && normalizedLower.includes(endDateDisplay.toLowerCase());
10035
+ if (hasRawDates || hasDisplayDates) {
10031
10036
  return content || value || '';
10032
10037
  }
10033
10038
  if (!content) {
@@ -12200,28 +12205,38 @@ function isAssistantLikelyDateValue(value) {
12200
12205
  }
12201
12206
  return false;
12202
12207
  }
12203
- function formatAssistantDateValue(value) {
12208
+ function resolveAssistantDisplayDateFormatPreference() {
12209
+ var profile = resolveAssistantAppHeuristicProfile();
12210
+ return profile.displayDateFormat || 'mdy';
12211
+ }
12212
+ function formatAssistantDateValue(value, dateDisplayFormat) {
12213
+ if (dateDisplayFormat === void 0) { dateDisplayFormat = 'iso'; }
12204
12214
  var dateValue = value instanceof Date ? value : new Date(value);
12205
12215
  if (Number.isNaN(dateValue.getTime())) {
12206
12216
  return String(value);
12207
12217
  }
12208
- var iso = dateValue.toISOString();
12209
- var _a = __read(iso.split('T'), 2), datePart = _a[0], timePart = _a[1];
12210
- if (!timePart) {
12211
- return datePart || iso;
12212
- }
12213
- var trimmed = timePart.replace('Z', '');
12214
- if (trimmed.startsWith('00:00:00')) {
12218
+ var year = dateValue.getUTCFullYear();
12219
+ var month = "".concat(dateValue.getUTCMonth() + 1).padStart(2, '0');
12220
+ var day = "".concat(dateValue.getUTCDate()).padStart(2, '0');
12221
+ var datePart = dateDisplayFormat === 'mdy'
12222
+ ? "".concat(month, "/").concat(day, "/").concat(year)
12223
+ : "".concat(year, "-").concat(month, "-").concat(day);
12224
+ var hours = "".concat(dateValue.getUTCHours()).padStart(2, '0');
12225
+ var minutes = "".concat(dateValue.getUTCMinutes()).padStart(2, '0');
12226
+ var seconds = "".concat(dateValue.getUTCSeconds()).padStart(2, '0');
12227
+ var millis = dateValue.getUTCMilliseconds();
12228
+ if (hours === '00' && minutes === '00' && seconds === '00' && millis === 0) {
12215
12229
  return datePart;
12216
12230
  }
12217
- return "".concat(datePart, " ").concat(trimmed.slice(0, 5));
12231
+ return "".concat(datePart, " ").concat(hours, ":").concat(minutes);
12218
12232
  }
12219
- function formatAssistantDisplayCell(value, column) {
12233
+ function formatAssistantDisplayCell(value, column, dateDisplayFormat) {
12234
+ if (dateDisplayFormat === void 0) { dateDisplayFormat = 'iso'; }
12220
12235
  if (value === null || value === undefined || value === '') {
12221
12236
  return '';
12222
12237
  }
12223
12238
  if (Array.isArray(value)) {
12224
- return value.map(function (item) { return formatAssistantDisplayCell(item, column); }).filter(Boolean).join(', ');
12239
+ return value.map(function (item) { return formatAssistantDisplayCell(item, column, dateDisplayFormat); }).filter(Boolean).join(', ');
12225
12240
  }
12226
12241
  if (typeof value === 'string') {
12227
12242
  var normalizedCurrency = normalizeAssistantCurrencyText(value);
@@ -12237,7 +12252,7 @@ function formatAssistantDisplayCell(value, column) {
12237
12252
  }
12238
12253
  }
12239
12254
  if (isAssistantDateColumn(columnKey) && isAssistantLikelyDateValue(value)) {
12240
- return formatAssistantDateValue(value);
12255
+ return formatAssistantDateValue(value, dateDisplayFormat);
12241
12256
  }
12242
12257
  var numericValue = resolveAssistantNumericValue(value);
12243
12258
  if (numericValue !== null) {
@@ -12266,7 +12281,7 @@ function formatAssistantDisplayCell(value, column) {
12266
12281
  }
12267
12282
  }
12268
12283
  if (isAssistantLikelyDateValue(value) && isAssistantDateColumn(columnKey)) {
12269
- return formatAssistantDateValue(value);
12284
+ return formatAssistantDateValue(value, dateDisplayFormat);
12270
12285
  }
12271
12286
  return String(value);
12272
12287
  }
@@ -12281,12 +12296,13 @@ function formatDisplayTableMarkdown(display) {
12281
12296
  if (!display || !Array.isArray(display.columns) || !display.columns.length) {
12282
12297
  return '';
12283
12298
  }
12299
+ var dateDisplayFormat = resolveAssistantDisplayDateFormatPreference();
12284
12300
  var header = "| ".concat(display.columns.join(' | '), " |");
12285
12301
  var separator = "| ".concat(display.columns.map(function () { return '---'; }).join(' | '), " |");
12286
12302
  var rows = (display.rows || []).map(function (row) {
12287
12303
  var cells = display.columns.map(function (column) {
12288
12304
  var rawValue = row === null || row === void 0 ? void 0 : row[column];
12289
- var formatted = formatAssistantDisplayCell(rawValue, column);
12305
+ var formatted = formatAssistantDisplayCell(rawValue, column, dateDisplayFormat);
12290
12306
  return escapeMarkdownCell(formatted);
12291
12307
  });
12292
12308
  return "| ".concat(cells.join(' | '), " |");
@@ -17421,7 +17437,8 @@ function cloneAssistantHeuristicProfile(profile) {
17421
17437
  }); })
17422
17438
  : [],
17423
17439
  enabledDeterministicHeuristics: new Set(Array.from((profile === null || profile === void 0 ? void 0 : profile.enabledDeterministicHeuristics) || [])),
17424
- disabledDeterministicHeuristics: new Set(Array.from((profile === null || profile === void 0 ? void 0 : profile.disabledDeterministicHeuristics) || []))
17440
+ disabledDeterministicHeuristics: new Set(Array.from((profile === null || profile === void 0 ? void 0 : profile.disabledDeterministicHeuristics) || [])),
17441
+ displayDateFormat: profile === null || profile === void 0 ? void 0 : profile.displayDateFormat
17425
17442
  };
17426
17443
  }
17427
17444
  function mergeAssistantHeuristicProfiles(base, override) {
@@ -17448,8 +17465,28 @@ function mergeAssistantHeuristicProfiles(base, override) {
17448
17465
  merged.collectionTermHints = __spreadArray(__spreadArray([], __read(merged.collectionTermHints), false), __read((Array.isArray(override.collectionTermHints) ? override.collectionTermHints : [])), false);
17449
17466
  Array.from(override.enabledDeterministicHeuristics || []).forEach(function (value) { return merged.enabledDeterministicHeuristics.add(value); });
17450
17467
  Array.from(override.disabledDeterministicHeuristics || []).forEach(function (value) { return merged.disabledDeterministicHeuristics.add(value); });
17468
+ if (override.displayDateFormat) {
17469
+ merged.displayDateFormat = override.displayDateFormat;
17470
+ }
17451
17471
  return merged;
17452
17472
  }
17473
+ function normalizeAssistantDisplayDateFormat(value) {
17474
+ var normalized = normalizeOptionalString(value).toLowerCase();
17475
+ if (!normalized) {
17476
+ return undefined;
17477
+ }
17478
+ var compact = normalized.replace(/[^a-z0-9]/g, '');
17479
+ if (!compact) {
17480
+ return undefined;
17481
+ }
17482
+ if (compact === 'iso' || compact === 'isodate' || compact === 'yearfirst' || compact === 'yyyymmdd') {
17483
+ return 'iso';
17484
+ }
17485
+ if (compact === 'mdy' || compact === 'short' || compact === 'shortdate' || compact === 'mmddyyyy' || compact === 'datepipeshort') {
17486
+ return 'mdy';
17487
+ }
17488
+ return undefined;
17489
+ }
17453
17490
  function normalizeAssistantHeuristicStringList(value) {
17454
17491
  if (Array.isArray(value)) {
17455
17492
  return mergeAssistantHintValues(value.map(function (entry) { return normalizeOptionalString(entry).toLowerCase(); }));
@@ -17530,6 +17567,12 @@ function normalizeAssistantAppHeuristicProfile(value) {
17530
17567
  || value.collectionTermHints
17531
17568
  || value.term_hints
17532
17569
  || value.termHints);
17570
+ profile.displayDateFormat = normalizeAssistantDisplayDateFormat(value.display_date_format
17571
+ || value.displayDateFormat
17572
+ || value.date_display_format
17573
+ || value.dateDisplayFormat
17574
+ || value.table_date_format
17575
+ || value.tableDateFormat);
17533
17576
  var enabled = normalizeAssistantHeuristicStringList(value.enabled_deterministic_heuristics
17534
17577
  || value.enabledDeterministicHeuristics
17535
17578
  || value.enabled_heuristics