@peopl-health/nexus 3.2.3 → 3.2.5-fix

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.
@@ -775,8 +775,10 @@ class NexusMessaging {
775
775
  logger.error('[CheckAfter] Error processing messages:', { chatId, error: error.message });
776
776
  } finally {
777
777
  if (typingInterval) clearInterval(typingInterval);
778
- this.processingLocks.delete(chatId);
779
- this.activeRequests.delete(chatId);
778
+ if (this.activeRequests.get(chatId) === runId) {
779
+ this.processingLocks.delete(chatId);
780
+ this.activeRequests.delete(chatId);
781
+ }
780
782
  if (this.abandonedRuns.size > 100) {
781
783
  this.abandonedRuns.clear();
782
784
  }
@@ -300,6 +300,7 @@ class OpenAIResponsesProvider {
300
300
  this.client.responses.create({
301
301
  prompt: promptConfig,
302
302
  input: inputData,
303
+ instructions: instructions || additionalInstructions,
303
304
  truncation: truncationStrategy,
304
305
  }), { providerName: PROVIDER_NAME });
305
306
 
@@ -161,10 +161,12 @@ const replyAssistantCore = async (code, message_ = null, thread_ = null, runOpti
161
161
  const messagesStart = Date.now();
162
162
  const beforeCheckpoint = message_?.createdAt ?
163
163
  (message_.createdAt.$date ? new Date(message_.createdAt.$date) : message_.createdAt) : null;
164
- const lastMessage = await getLastNMessages(code, 1, beforeCheckpoint);
164
+ const lastMessage = await getLastNMessages(code, 1, beforeCheckpoint, {
165
+ query: { from_me: false }
166
+ });
165
167
  timings.get_messages_ms = Date.now() - messagesStart;
166
168
 
167
- if (!lastMessage || lastMessage.length === 0 || lastMessage[0].from_me) {
169
+ if (!lastMessage || lastMessage.length === 0) {
168
170
  logger.info('[replyAssistantCore] No relevant data found for this assistant.');
169
171
  return null;
170
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "3.2.3",
3
+ "version": "3.2.5-fix",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",