@peopl-health/nexus 2.5.7-fix-truncation → 2.5.7-media-logs

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.
@@ -26,22 +26,46 @@ function convertTwilioToInternalFormat(twilioMessage) {
26
26
 
27
27
  async function downloadMediaFromTwilio(mediaUrl, logger) {
28
28
  try {
29
- logger.info(`Downloading media from: ${mediaUrl}`);
29
+ const authHeader = `Basic ${Buffer.from(
30
+ `${process.env.TWILIO_ACCOUNT_SID}:${process.env.TWILIO_AUTH_TOKEN}`
31
+ ).toString('base64')}`;
32
+
33
+ logger.info('[TwilioMedia] Starting download', {
34
+ url: mediaUrl,
35
+ hasAccountSid: !!process.env.TWILIO_ACCOUNT_SID,
36
+ hasAuthToken: !!process.env.TWILIO_AUTH_TOKEN,
37
+ accountSidLength: process.env.TWILIO_ACCOUNT_SID?.length || 0,
38
+ authHeaderSample: authHeader.substring(0, 20) + '...'
39
+ });
30
40
 
31
41
  const response = await axios({
32
42
  method: 'GET',
33
43
  url: mediaUrl,
34
44
  responseType: 'arraybuffer',
45
+ timeout: 30000,
35
46
  headers: {
36
- 'Authorization': `Basic ${Buffer.from(
37
- `${process.env.TWILIO_ACCOUNT_SID}:${process.env.TWILIO_AUTH_TOKEN}`
38
- ).toString('base64')}`
47
+ 'Authorization': authHeader
39
48
  }
40
49
  });
41
-
50
+
51
+ logger.info('[TwilioMedia] Download successful', {
52
+ status: response.status,
53
+ contentType: response.headers['content-type'],
54
+ contentLength: response.headers['content-length'],
55
+ dataSize: response.data?.length || 0
56
+ });
57
+
42
58
  return Buffer.from(response.data);
43
59
  } catch (error) {
44
- logger.error(`Failed to download media: ${error.message}`);
60
+ logger.error('[TwilioMedia] Download failed', {
61
+ message: error.message,
62
+ status: error.response?.status,
63
+ statusText: error.response?.statusText,
64
+ responseHeaders: error.response?.headers,
65
+ responseData: error.response?.data ? error.response.data.toString().substring(0, 500) : null,
66
+ url: mediaUrl,
67
+ hasCredentials: !!(process.env.TWILIO_ACCOUNT_SID && process.env.TWILIO_AUTH_TOKEN)
68
+ });
45
69
  throw error;
46
70
  }
47
71
  }
@@ -287,7 +287,7 @@ class OpenAIResponsesProvider {
287
287
  instructions: additionalInstructions || instructions,
288
288
  input: inputData,
289
289
  metadata, top_p: topP, temperature, max_output_tokens: maxOutputTokens,
290
- truncation_strategy: truncationStrategy,
290
+ truncation: truncationStrategy,
291
291
  tools: transformToolsForResponsesAPIUtil(this.variant, tools),
292
292
  }), { providerName: PROVIDER_NAME });
293
293
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "2.5.7-fix-truncation",
3
+ "version": "2.5.7-media-logs",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",