a2acalling 0.6.37 → 0.6.39

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a2acalling",
3
- "version": "0.6.37",
3
+ "version": "0.6.39",
4
4
  "description": "Agent-to-agent calling for OpenClaw - A2A agent communication",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  * 9. Call A2AClient.end() and conclude locally
14
14
  */
15
15
 
16
+ const crypto = require('crypto');
16
17
  const { A2AClient } = require('./client');
17
18
  const {
18
19
  buildAdaptiveConnectionPrompt,
@@ -141,7 +142,7 @@ Be concise but specific. No filler.`;
141
142
  confidence: 0.25
142
143
  };
143
144
 
144
- // Don't start conversation in DB yet - wait for remote's conversation ID
145
+ // Placeholder until we get a real ID from the remote (or generate one)
145
146
  conversationId = `conv_${Date.now()}_local`;
146
147
 
147
148
  let nextMessage = openingMessage;
@@ -162,24 +163,26 @@ Be concise but specific. No filler.`;
162
163
  break;
163
164
  }
164
165
 
165
- // Update conversation ID from remote if first turn and start DB conversation
166
- if (turn === 0 && remoteResponse.conversation_id) {
167
- conversationId = remoteResponse.conversation_id;
166
+ // Start DB conversation on first turn
167
+ if (turn === 0 && this.convStore && !dbConversationStarted) {
168
+ // Prefer remote's conversation ID, fall back to generated local one
169
+ if (remoteResponse.conversation_id) {
170
+ conversationId = remoteResponse.conversation_id;
171
+ } else {
172
+ conversationId = `conv_${Date.now()}_${crypto.randomBytes(4).toString('hex')}`;
173
+ }
168
174
 
169
- // Now start the conversation in DB with the remote's ID
170
- if (this.convStore) {
171
- const convResult = this.convStore.startConversation({
172
- id: conversationId,
173
- direction: 'outbound'
175
+ const convResult = this.convStore.startConversation({
176
+ id: conversationId,
177
+ direction: 'outbound'
178
+ });
179
+ if (convResult.success === false) {
180
+ logger.warn('Failed to start conversation in DB', {
181
+ event: 'driver_start_conversation_failed',
182
+ error: convResult.error
174
183
  });
175
- if (convResult.success === false) {
176
- logger.warn('Failed to start conversation in DB', {
177
- event: 'driver_start_conversation_failed',
178
- error: convResult.error
179
- });
180
- } else {
181
- dbConversationStarted = true;
182
- }
184
+ } else {
185
+ dbConversationStarted = true;
183
186
  }
184
187
  }
185
188