@discomedia/utils 1.0.15 → 1.0.17

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.
@@ -7392,7 +7392,7 @@ const makeResponsesAPICall = async (input, options = {}) => {
7392
7392
  * });
7393
7393
  */
7394
7394
  async function makeLLMCall(input, options = {}) {
7395
- const { apiKey, model = DEFAULT_MODEL$1, responseFormat = 'text', tools, useCodeInterpreter = false, useWebSearch = false, imageBase64, imageDetail = 'high', context } = options;
7395
+ const { apiKey, model = DEFAULT_MODEL$1, responseFormat = 'text', tools, useCodeInterpreter = false, useWebSearch = false, imageBase64, imageDetail = 'high', context, } = options;
7396
7396
  // Validate model
7397
7397
  const normalizedModel = normalizeModelName(model);
7398
7398
  if (!isSupportedModel(normalizedModel)) {
@@ -7408,7 +7408,7 @@ async function makeLLMCall(input, options = {}) {
7408
7408
  conversationMessages.push({
7409
7409
  role: contextMsg.role,
7410
7410
  content: contextMsg.content,
7411
- type: 'message'
7411
+ type: 'message',
7412
7412
  });
7413
7413
  }
7414
7414
  // Add current input message
@@ -7422,9 +7422,9 @@ async function makeLLMCall(input, options = {}) {
7422
7422
  type: 'input_image',
7423
7423
  detail: imageDetail,
7424
7424
  image_url: imageBase64.startsWith('data:') ? imageBase64 : `data:image/webp;base64,${imageBase64}`,
7425
- }
7425
+ },
7426
7426
  ],
7427
- type: 'message'
7427
+ type: 'message',
7428
7428
  });
7429
7429
  }
7430
7430
  else {
@@ -7432,7 +7432,7 @@ async function makeLLMCall(input, options = {}) {
7432
7432
  conversationMessages.push({
7433
7433
  role: 'user',
7434
7434
  content: input,
7435
- type: 'message'
7435
+ type: 'message',
7436
7436
  });
7437
7437
  }
7438
7438
  processedInput = conversationMessages;
@@ -7448,10 +7448,10 @@ async function makeLLMCall(input, options = {}) {
7448
7448
  type: 'input_image',
7449
7449
  detail: imageDetail,
7450
7450
  image_url: imageBase64.startsWith('data:') ? imageBase64 : `data:image/webp;base64,${imageBase64}`,
7451
- }
7451
+ },
7452
7452
  ],
7453
- type: 'message'
7454
- }
7453
+ type: 'message',
7454
+ },
7455
7455
  ];
7456
7456
  }
7457
7457
  else {
@@ -13741,16 +13741,24 @@ class MarketTimeCalculator {
13741
13741
  /**
13742
13742
  * Get the last full trading date
13743
13743
  */
13744
- getLastFullTradingDate(currentDate = new Date()) {
13744
+ getLastFullTradingDate(currentDate = new Date(), extendedHours = true) {
13745
13745
  const nowET = dateFnsTz.toZonedTime(currentDate, this.timezone);
13746
- // If today is a market day and we're after extended hours close, return today
13747
13746
  if (this.calendar.isMarketDay(nowET)) {
13748
13747
  const timeInMinutes = nowET.getHours() * 60 + nowET.getMinutes();
13749
- let extendedEndMinutes = MARKET_CONFIG.TIMES.EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EXTENDED_END.minute;
13750
- if (this.calendar.isEarlyCloseDay(nowET)) {
13751
- extendedEndMinutes = MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute;
13748
+ let endMinutes;
13749
+ if (extendedHours) {
13750
+ endMinutes = MARKET_CONFIG.TIMES.EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EXTENDED_END.minute;
13751
+ if (this.calendar.isEarlyCloseDay(nowET)) {
13752
+ endMinutes = MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute;
13753
+ }
13754
+ }
13755
+ else {
13756
+ endMinutes = MARKET_CONFIG.TIMES.MARKET_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.MARKET_CLOSE.minute;
13757
+ if (this.calendar.isEarlyCloseDay(nowET)) {
13758
+ endMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
13759
+ }
13752
13760
  }
13753
- if (timeInMinutes >= extendedEndMinutes) {
13761
+ if (timeInMinutes >= endMinutes) {
13754
13762
  return dateFnsTz.fromZonedTime(dateFns.set(nowET, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }), this.timezone);
13755
13763
  }
13756
13764
  }