@lingjingai/scriptctl 0.63.10 → 0.63.11

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.
@@ -0,0 +1,4 @@
1
+ # 0.63.11
2
+
3
+ - 审核 HTTP 连接统一由调用方 AbortSignal 控制超时,避免 Undici 默认五分钟超时提前中断长模型请求。
4
+ - 模型路由失败记录底层网络错误原因。
@@ -2329,7 +2329,7 @@ import { APICallError } from "@ai-sdk/provider";
2329
2329
  import { z as z2 } from "zod";
2330
2330
 
2331
2331
  // packages/review-agent/src/media/net.ts
2332
- import { ProxyAgent } from "undici";
2332
+ import { Agent, ProxyAgent } from "undici";
2333
2333
  var cached;
2334
2334
  function proxyUrl() {
2335
2335
  for (const name of ["https_proxy", "HTTPS_PROXY", "http_proxy", "HTTP_PROXY"]) {
@@ -2341,21 +2341,21 @@ function proxyUrl() {
2341
2341
  function dispatcher() {
2342
2342
  if (cached === void 0) {
2343
2343
  const url = proxyUrl();
2344
- cached = url ? new ProxyAgent(url) : null;
2344
+ const timeouts = { headersTimeout: 0, bodyTimeout: 0 };
2345
+ cached = url ? new ProxyAgent({ uri: url, ...timeouts }) : new Agent(timeouts);
2345
2346
  }
2346
- return cached ?? void 0;
2347
+ return cached;
2347
2348
  }
2348
2349
  var proxyFetch = (input, init) => {
2349
2350
  const proxy = dispatcher();
2350
2351
  return globalThis.fetch(input, { ...init, ...proxy ? { dispatcher: proxy } : {} });
2351
2352
  };
2352
2353
  async function post(url, body, timeoutMs = 18e4, headers = {}) {
2353
- return fetch(url, {
2354
+ return proxyFetch(url, {
2354
2355
  method: "POST",
2355
2356
  headers: { "Content-Type": "application/json", ...headers },
2356
2357
  body: JSON.stringify(body),
2357
- signal: AbortSignal.timeout(timeoutMs),
2358
- ...dispatcher() ? { dispatcher: dispatcher() } : {}
2358
+ signal: AbortSignal.timeout(timeoutMs)
2359
2359
  });
2360
2360
  }
2361
2361
 
@@ -2497,7 +2497,8 @@ async function generateReviewJson(request) {
2497
2497
  raw = await response.text();
2498
2498
  } catch (error) {
2499
2499
  if (!transientNetwork(error)) throw error;
2500
- failures.push(`${route.provider}/${route.model} attempt ${attempt}: ${String(error)}`);
2500
+ const cause = error instanceof Error && error.cause instanceof Error ? `; ${error.cause.name}: ${error.cause.message}` : "";
2501
+ failures.push(`${route.provider}/${route.model} attempt ${attempt}: ${String(error)}${cause}`);
2501
2502
  if (attempt < route.maxAttempts) await new Promise((resolve2) => setTimeout(resolve2, attempt * 1e3));
2502
2503
  continue;
2503
2504
  }
@@ -3176,7 +3177,7 @@ function buildTools(ctx) {
3176
3177
  }
3177
3178
 
3178
3179
  // packages/review-agent/src/agent.ts
3179
- import { Agent } from "@mastra/core/agent";
3180
+ import { Agent as Agent2 } from "@mastra/core/agent";
3180
3181
  import { z as z6 } from "zod";
3181
3182
  function seriesCard(doc) {
3182
3183
  return read(doc, "").split("\nepisodes\n")[0].trim();
@@ -3233,7 +3234,7 @@ async function reviewUnit(doc, episode, video, config, asr) {
3233
3234
  };
3234
3235
  const usage = [];
3235
3236
  const modelFailures = [];
3236
- const agent = new Agent({
3237
+ const agent = new Agent2({
3237
3238
  id: `review-ep${episode}`,
3238
3239
  name: `Script review \xB7 episode ${episode}`,
3239
3240
  instructions: systemPrompt(input),