@superatomai/sdk-node 0.0.20-mds → 0.0.21-mds

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/dist/index.js CHANGED
@@ -5133,17 +5133,14 @@ async function withProgressHeartbeat(operation, progressMessage, streamBuffer, i
5133
5133
  const startTime = Date.now();
5134
5134
  await streamDelay(30);
5135
5135
  streamBuffer.write(`\u23F3 ${progressMessage}`);
5136
- const heartbeatInterval = setInterval(() => {
5137
- const elapsedSeconds = Math.floor((Date.now() - startTime) / 1e3);
5138
- if (elapsedSeconds >= 1) {
5139
- streamBuffer.write(` (${elapsedSeconds}s)`);
5140
- }
5141
- }, intervalMs);
5142
5136
  try {
5143
5137
  const result = await operation();
5144
5138
  return result;
5145
5139
  } finally {
5146
- clearInterval(heartbeatInterval);
5140
+ const totalSeconds = Math.floor((Date.now() - startTime) / 1e3);
5141
+ if (totalSeconds >= 1) {
5142
+ streamBuffer.write(` (${totalSeconds}s)`);
5143
+ }
5147
5144
  streamBuffer.write("\n\n");
5148
5145
  }
5149
5146
  }
@@ -7120,11 +7117,17 @@ ${queryDisplay}
7120
7117
  await streamDelay();
7121
7118
  }
7122
7119
  try {
7123
- const result = await withProgressHeartbeat(
7124
- () => this.tool.fn(cappedInput),
7125
- `Executing query`,
7126
- this.streamBuffer
7127
- );
7120
+ if (this.streamBuffer.hasCallback()) {
7121
+ this.streamBuffer.write(`__QUERY_TIMER_START_Executing query__`);
7122
+ }
7123
+ const queryStartTime = Date.now();
7124
+ const result = await this.tool.fn(cappedInput);
7125
+ if (this.streamBuffer.hasCallback()) {
7126
+ const querySeconds = ((Date.now() - queryStartTime) / 1e3).toFixed(1);
7127
+ this.streamBuffer.write(`__QUERY_TIMER_DONE_${querySeconds}__
7128
+
7129
+ `);
7130
+ }
7128
7131
  if (result && result.error) {
7129
7132
  const errorMsg = typeof result.error === "string" ? result.error : JSON.stringify(result.error);
7130
7133
  logger.warn(`[SourceAgent:${this.tool.name}] Tool returned error (attempt ${this.attempts}/${this.config.maxRetries}): ${errorMsg}`);