@standardagents/builder 0.27.11 → 0.27.13

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
@@ -1767,7 +1767,9 @@ var init_LLMRequest = __esm({
1767
1767
  console.error(`Error calling ${actualModelId} (attempt ${attempts}):`, error2);
1768
1768
  await this.logError(state, error2, "api_error", actualModelId, startTime, logId);
1769
1769
  if (attempts < MAX_RETRIES_PER_MODEL) {
1770
- const backoffMs = BACKOFF_BASE * Math.pow(2, attempts - 1);
1770
+ const base = BACKOFF_BASE * Math.pow(2, attempts - 1);
1771
+ const retryAfterMs = typeof error2?.retryAfter === "number" ? error2.retryAfter * 1e3 : 0;
1772
+ const backoffMs = Math.max(base, retryAfterMs);
1771
1773
  await this.sleep(backoffMs);
1772
1774
  previousLogId = logId;
1773
1775
  logId = void 0;
@@ -4336,8 +4338,17 @@ ${errorLines.join("\n")}`);
4336
4338
  responseParts.push(`Other tools run: ${successfulToolNames.join(", ")}`);
4337
4339
  }
4338
4340
  } else {
4339
- if (toolResponseOptions.include_text_response && textContent) {
4340
- responseParts.push(textContent);
4341
+ if (toolResponseOptions.include_text_response) {
4342
+ let responseText = textContent;
4343
+ if (!responseText) {
4344
+ const recovered = await state.storage.sql.exec(
4345
+ `SELECT content FROM messages WHERE parent_id = ? AND role = 'assistant' AND content IS NOT NULL AND content != '' AND (tool_calls IS NULL OR tool_calls = '') ORDER BY created_at DESC LIMIT 1`,
4346
+ toolMessageId
4347
+ );
4348
+ const recoveredRow = recovered.toArray()[0];
4349
+ if (recoveredRow?.content) responseText = recoveredRow.content;
4350
+ }
4351
+ if (responseText) responseParts.push(responseText);
4341
4352
  }
4342
4353
  if (toolResponseOptions.include_tool_calls || toolResponseOptions.include_errors) {
4343
4354
  const childAssistantMessagesResult = await state.storage.sql.exec(