@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.
@@ -1783,7 +1783,9 @@ var init_LLMRequest = __esm({
1783
1783
  console.error(`Error calling ${actualModelId} (attempt ${attempts}):`, error2);
1784
1784
  await this.logError(state, error2, "api_error", actualModelId, startTime, logId);
1785
1785
  if (attempts < MAX_RETRIES_PER_MODEL) {
1786
- const backoffMs = BACKOFF_BASE * Math.pow(2, attempts - 1);
1786
+ const base = BACKOFF_BASE * Math.pow(2, attempts - 1);
1787
+ const retryAfterMs = typeof error2?.retryAfter === "number" ? error2.retryAfter * 1e3 : 0;
1788
+ const backoffMs = Math.max(base, retryAfterMs);
1787
1789
  await this.sleep(backoffMs);
1788
1790
  previousLogId = logId;
1789
1791
  logId = void 0;
@@ -4352,8 +4354,17 @@ ${errorLines.join("\n")}`);
4352
4354
  responseParts.push(`Other tools run: ${successfulToolNames.join(", ")}`);
4353
4355
  }
4354
4356
  } else {
4355
- if (toolResponseOptions.include_text_response && textContent) {
4356
- responseParts.push(textContent);
4357
+ if (toolResponseOptions.include_text_response) {
4358
+ let responseText = textContent;
4359
+ if (!responseText) {
4360
+ const recovered = await state.storage.sql.exec(
4361
+ `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`,
4362
+ toolMessageId
4363
+ );
4364
+ const recoveredRow = recovered.toArray()[0];
4365
+ if (recoveredRow?.content) responseText = recoveredRow.content;
4366
+ }
4367
+ if (responseText) responseParts.push(responseText);
4357
4368
  }
4358
4369
  if (toolResponseOptions.include_tool_calls || toolResponseOptions.include_errors) {
4359
4370
  const childAssistantMessagesResult = await state.storage.sql.exec(
@@ -43659,7 +43670,7 @@ var init_dist6 = __esm({
43659
43670
  return new ProviderError(error.message, "rate_limit", status, retryAfter);
43660
43671
  }
43661
43672
  if (status === 403 && _OpenAIProvider.isEdgeBlock(anyError)) {
43662
- return new ProviderError(error.message, "server_error", status);
43673
+ return new ProviderError(error.message, "server_error", status, retryAfter ?? 3);
43663
43674
  }
43664
43675
  if (status === 401 || status === 403) {
43665
43676
  return new ProviderError(error.message, "auth_error", status);
@@ -66289,7 +66300,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
66289
66300
  });
66290
66301
 
66291
66302
  // src/version.ts
66292
- var BUILDER_VERSION = "0.27.11".length > 0 ? "0.27.11" : "dev";
66303
+ var BUILDER_VERSION = "0.27.13".length > 0 ? "0.27.13" : "dev";
66293
66304
 
66294
66305
  // src/api/diagnostics.get.ts
66295
66306
  init_LLMRequest();