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