@linnlabs/linnkit 0.46.0 → 0.47.0

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/cli.cjs +64 -246
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +64 -246
  5. package/dist/cli.js.map +1 -1
  6. package/dist/context-manager.cjs +7 -7
  7. package/dist/context-manager.cjs.map +1 -1
  8. package/dist/context-manager.js +7 -7
  9. package/dist/context-manager.js.map +1 -1
  10. package/dist/index.cjs +74 -257
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.js +74 -257
  13. package/dist/index.js.map +1 -1
  14. package/dist/ports/llm-call.d.cts +2 -16
  15. package/dist/ports/llm-call.d.ts +2 -16
  16. package/dist/quickstart.cjs +64 -246
  17. package/dist/quickstart.cjs.map +1 -1
  18. package/dist/quickstart.js +64 -246
  19. package/dist/quickstart.js.map +1 -1
  20. package/dist/runtime-kernel/graph-engine/executor.d.cts +0 -2
  21. package/dist/runtime-kernel/graph-engine/executor.d.ts +0 -2
  22. package/dist/runtime-kernel/graph-engine/types.d.cts +1 -2
  23. package/dist/runtime-kernel/graph-engine/types.d.ts +1 -2
  24. package/dist/runtime-kernel/llm/definitions/llmFallbackObserver.d.cts +1 -2
  25. package/dist/runtime-kernel/llm/definitions/llmFallbackObserver.d.ts +1 -2
  26. package/dist/runtime-kernel/llm/modelCatalog.d.cts +2 -3
  27. package/dist/runtime-kernel/llm/modelCatalog.d.ts +2 -3
  28. package/dist/runtime-kernel/tools/toolContextRuntime.d.cts +1 -1
  29. package/dist/runtime-kernel/tools/toolContextRuntime.d.ts +1 -1
  30. package/dist/runtime-kernel/tools/toolExecutionContext.d.cts +0 -10
  31. package/dist/runtime-kernel/tools/toolExecutionContext.d.ts +0 -10
  32. package/dist/runtime-kernel.cjs +74 -257
  33. package/dist/runtime-kernel.cjs.map +1 -1
  34. package/dist/runtime-kernel.js +74 -257
  35. package/dist/runtime-kernel.js.map +1 -1
  36. package/dist/testkit.cjs +82 -265
  37. package/dist/testkit.cjs.map +1 -1
  38. package/dist/testkit.js +82 -265
  39. package/dist/testkit.js.map +1 -1
  40. package/docs/integration/llm-provider.md +1 -1
  41. package/docs/integration/tool-development-guide.md +1 -1
  42. package/package.json +1 -1
@@ -2334,18 +2334,6 @@ var ErrorClassifier = class {
2334
2334
  });
2335
2335
  }
2336
2336
  }
2337
- const quotaPatterns = ["\u5DF2\u8FBE\u4E0A\u9650", "\u514D\u8D39\u671F\u5DF2\u7ED3\u675F"];
2338
- for (const pattern of quotaPatterns) {
2339
- if (errorMessage.includes(pattern)) {
2340
- logClassification(context, "\u68C0\u6D4B\u5230\u4E91\u7AEF\u989D\u5EA6\u9650\u5236\uFF0C\u4E0D\u91CD\u8BD5", { matchedPattern: pattern });
2341
- return createClassification("non_retryable" /* NON_RETRYABLE */, `\u4E91\u7AEF\u989D\u5EA6\u9650\u5236: ${pattern}`, null, {
2342
- errorCode: ENGINE_ERROR_CODES.LLM_PROVIDER_DOWN,
2343
- recoverable: false,
2344
- hint: "check_billing_or_provider_status",
2345
- metadata: { matchedPattern: pattern }
2346
- });
2347
- }
2348
- }
2349
2337
  const authPatterns = [
2350
2338
  { pattern: "unauthorized", code: "401" },
2351
2339
  { pattern: "forbidden", code: "403" },
@@ -2600,17 +2588,6 @@ var ErrorClassifier = class {
2600
2588
  }
2601
2589
  return Math.max(baseDelay, classification.suggestedDelay ?? 0);
2602
2590
  }
2603
- static isCloudQuotaError(error) {
2604
- const msg = (error.message || "").toLowerCase();
2605
- const patterns = [
2606
- "\u989D\u5EA6\u4E0A\u9650",
2607
- "\u5DF2\u8FBE\u4E0A\u9650",
2608
- "\u514D\u8D39\u671F\u5DF2\u7ED3\u675F",
2609
- "\u8BE5\u6A21\u578B\u6682\u4E0D\u53EF\u7528",
2610
- "cloud_quota_exhausted"
2611
- ];
2612
- return patterns.some((pattern) => msg.includes(pattern));
2613
- }
2614
2591
  };
2615
2592
 
2616
2593
  // src/shared/engineErrorEvent.ts
@@ -4094,8 +4071,8 @@ var TokenCalculator = class {
4094
4071
  return;
4095
4072
  }
4096
4073
  this.failedEncodingWarnings.add(requestedEncoding);
4097
- const logger19 = new Logger("TokenCalculator");
4098
- logger19.warn("tiktoken encoding unavailable, falling back to avgCharsPerToken estimator", {
4074
+ const logger18 = new Logger("TokenCalculator");
4075
+ logger18.warn("tiktoken encoding unavailable, falling back to avgCharsPerToken estimator", {
4099
4076
  requestedEncoding,
4100
4077
  error
4101
4078
  });
@@ -4187,49 +4164,6 @@ var llmTelemetryMiddleware = async (ctx, stage, next) => {
4187
4164
  });
4188
4165
  };
4189
4166
 
4190
- // src/runtime-kernel/graph-engine/functions/runModelLock.ts
4191
- function readNonEmptyString4(value) {
4192
- if (typeof value !== "string") return void 0;
4193
- const trimmed = value.trim();
4194
- return trimmed.length > 0 ? trimmed : void 0;
4195
- }
4196
- function decideRunModelLockPatch(params) {
4197
- if (params.stageId !== "execute_llm") {
4198
- return { shouldLog: false };
4199
- }
4200
- const normalized = readNonEmptyString4(params.appliedFallbackModelId);
4201
- if (!normalized) {
4202
- return { shouldLog: false };
4203
- }
4204
- if (readNonEmptyString4(params.currentRunLockedModelId) === normalized) {
4205
- return { shouldLog: false };
4206
- }
4207
- return {
4208
- executorLocalPatch: { runLockedModelId: normalized },
4209
- shouldLog: true
4210
- };
4211
- }
4212
-
4213
- // src/runtime-kernel/graph-engine/tick-pipeline/middlewares/runModelLockMiddleware.ts
4214
- var logger4 = new Logger("GraphAgentExecutor");
4215
- var runModelLockMiddleware = async (ctx, stage, next) => {
4216
- await next();
4217
- const decision = decideRunModelLockPatch({
4218
- stageId: stage.id,
4219
- appliedFallbackModelId: ctx.cloudQuotaFallbackAppliedModelId,
4220
- currentRunLockedModelId: ctx.executorLocalPatch?.runLockedModelId ?? ctx.executorLocal?.runLockedModelId
4221
- });
4222
- if (!decision.executorLocalPatch) {
4223
- return;
4224
- }
4225
- if (decision.shouldLog) {
4226
- logger4.warn(`\u68C0\u6D4B\u5230\u4E91\u7AEF\u989D\u5EA6\u964D\u7EA7\uFF0C\u5DF2\u9501\u5B9A\u672C run \u540E\u7EED\u6A21\u578B: ${ctx.modelId} -> ${decision.executorLocalPatch.runLockedModelId}`);
4227
- }
4228
- return {
4229
- executorLocalPatch: decision.executorLocalPatch
4230
- };
4231
- };
4232
-
4233
4167
  // src/runtime-kernel/graph-engine/tick-pipeline/runTickPipeline.ts
4234
4168
  var tickPipelineContextKeys = [
4235
4169
  "input",
@@ -4265,7 +4199,6 @@ var tickPipelineContextKeys = [
4265
4199
  "decision",
4266
4200
  "systemReminderHitRuleIds",
4267
4201
  "contextTrace",
4268
- "cloudQuotaFallbackAppliedModelId",
4269
4202
  "modelFallbackAudit",
4270
4203
  "telemetry",
4271
4204
  "audit",
@@ -4604,7 +4537,7 @@ ${normalized}
4604
4537
  }
4605
4538
 
4606
4539
  // src/runtime-kernel/system-reminder/apply.ts
4607
- var logger5 = new Logger("SystemReminder");
4540
+ var logger4 = new Logger("SystemReminder");
4608
4541
  var readString2 = (v) => {
4609
4542
  if (typeof v !== "string") return void 0;
4610
4543
  const s = v;
@@ -4667,7 +4600,7 @@ function applySystemReminders(params) {
4667
4600
  } catch {
4668
4601
  }
4669
4602
  }
4670
- logger5.info("SystemReminder \u5DF2\u6CE8\u5165\u5230 LLM \u8F93\u5165\u672B\u5C3E", {
4603
+ logger4.info("SystemReminder \u5DF2\u6CE8\u5165\u5230 LLM \u8F93\u5165\u672B\u5C3E", {
4671
4604
  ruleIds: injectedRuleIds.length > 0 ? injectedRuleIds : Array.from(seenRuleIds),
4672
4605
  promptKey: ctx.request.promptKey,
4673
4606
  executorLocal: {
@@ -5159,7 +5092,6 @@ function createExecuteLlmStage(dependencies) {
5159
5092
  "turnId"
5160
5093
  ],
5161
5094
  writes: [
5162
- "cloudQuotaFallbackAppliedModelId",
5163
5095
  "modelFallbackAudit",
5164
5096
  "llmCallStartedAt",
5165
5097
  "llmResp",
@@ -5167,7 +5099,6 @@ function createExecuteLlmStage(dependencies) {
5167
5099
  "contextUsage"
5168
5100
  ],
5169
5101
  async run(ctx) {
5170
- let cloudQuotaFallbackAppliedModelId;
5171
5102
  let modelFallbackAudit;
5172
5103
  let contextUsage;
5173
5104
  const modelFallbackRejections = [];
@@ -5186,9 +5117,6 @@ function createExecuteLlmStage(dependencies) {
5186
5117
  streamEventHandler,
5187
5118
  ctx.signal,
5188
5119
  {
5189
- onCloudQuotaFallbackApplied(fallbackModelId) {
5190
- cloudQuotaFallbackAppliedModelId = readNonEmptyString3(fallbackModelId);
5191
- },
5192
5120
  onLlmAttemptSucceeded(_activeModelId, attemptContextUsage) {
5193
5121
  contextUsage = attemptContextUsage;
5194
5122
  },
@@ -5285,7 +5213,6 @@ function createExecuteLlmStage(dependencies) {
5285
5213
  });
5286
5214
  }
5287
5215
  return {
5288
- cloudQuotaFallbackAppliedModelId,
5289
5216
  modelFallbackAudit,
5290
5217
  llmCallStartedAt,
5291
5218
  llmResp,
@@ -6206,18 +6133,16 @@ function createPrepareCallStage(dependencies) {
6206
6133
  "toolDefinitionTokens"
6207
6134
  ],
6208
6135
  async run(ctx) {
6209
- const lockedRunModelId = readNonEmptyString3(ctx.executorLocal?.runLockedModelId);
6210
- const requestedModelId = lockedRunModelId ?? ctx.request.model_id;
6136
+ const requestedModelId = ctx.request.model_id;
6211
6137
  const modelId = dependencies.modelResolver.resolveModelId(requestedModelId);
6212
6138
  await emitAuditEnvelope(ctx.audit, {
6213
6139
  action: "model.select",
6214
6140
  actor: { kind: "system" },
6215
6141
  decision: {
6216
6142
  outcome: "recorded",
6217
- reason: lockedRunModelId ? "run model lock" : requestedModelId ? "request model id" : "default model resolver",
6143
+ reason: requestedModelId ? "request model id" : "default model resolver",
6218
6144
  metadata: {
6219
6145
  requestedModelId,
6220
- lockedRunModelId,
6221
6146
  selectedModelId: modelId
6222
6147
  }
6223
6148
  },
@@ -6264,10 +6189,6 @@ function createPrepareCallStage(dependencies) {
6264
6189
  if (ctx.executorLocal?.lockRequestedModelId === true) {
6265
6190
  llmOptions.allow_model_fallback = false;
6266
6191
  }
6267
- const isRunContinuation = ctx.executorLocal?.llmInvocationKind === "continuation";
6268
- if (dependencies.cloudQuotaFallbackModelId && modelConfig?.billing_mode === "cloud" && modelId !== dependencies.cloudQuotaFallbackModelId && isRunContinuation && ctx.executorLocal?.lockRequestedModelId !== true) {
6269
- llmOptions.cloud_quota_fallback_model_id = dependencies.cloudQuotaFallbackModelId;
6270
- }
6271
6192
  const effectiveEffort = resolveEffectiveEffort(
6272
6193
  ctx.request.reasoning_effort,
6273
6194
  modelConfig?.reasoning
@@ -6384,12 +6305,11 @@ function applyCalibration(rawLocalTotal, imageInputTokens, coefficient) {
6384
6305
  }
6385
6306
 
6386
6307
  // src/runtime-kernel/graph-engine/executor.ts
6387
- var logger6 = new Logger("GraphAgentExecutor");
6308
+ var logger5 = new Logger("GraphAgentExecutor");
6388
6309
  var GraphAgentExecutor = class {
6389
6310
  llmCaller;
6390
6311
  toolRuntime;
6391
6312
  contextBuilder;
6392
- cloudQuotaFallbackModelId;
6393
6313
  modelResolver;
6394
6314
  modelCatalog;
6395
6315
  telemetryPort;
@@ -6401,7 +6321,6 @@ var GraphAgentExecutor = class {
6401
6321
  this.llmCaller = dependencies.llmCaller;
6402
6322
  this.toolRuntime = dependencies.toolRuntime;
6403
6323
  this.contextBuilder = dependencies.contextBuilder;
6404
- this.cloudQuotaFallbackModelId = readNonEmptyString3(dependencies.cloudQuotaFallbackModelId);
6405
6324
  this.modelCatalog = dependencies.modelCatalog ?? createEmptyModelCatalog();
6406
6325
  this.modelResolver = dependencies.modelResolver ?? new ModelResolver({
6407
6326
  modelCatalog: this.modelCatalog
@@ -6418,8 +6337,7 @@ var GraphAgentExecutor = class {
6418
6337
  createPrepareCallStage({
6419
6338
  modelResolver: this.modelResolver,
6420
6339
  modelCatalog: this.modelCatalog,
6421
- toolCatalog: this.toolRuntime,
6422
- cloudQuotaFallbackModelId: this.cloudQuotaFallbackModelId
6340
+ toolCatalog: this.toolRuntime
6423
6341
  }),
6424
6342
  createBuildContextStage({
6425
6343
  contextBuilder: this.contextBuilder
@@ -6441,7 +6359,7 @@ var GraphAgentExecutor = class {
6441
6359
  }),
6442
6360
  createBuildDecisionStage()
6443
6361
  ];
6444
- this.middlewares = [llmTelemetryMiddleware, runModelLockMiddleware];
6362
+ this.middlewares = [llmTelemetryMiddleware];
6445
6363
  }
6446
6364
  async tick(input, eventHandler) {
6447
6365
  const ctx = {
@@ -6466,7 +6384,7 @@ var GraphAgentExecutor = class {
6466
6384
  audit: this.auditPort,
6467
6385
  tokenizer: this.tokenizer
6468
6386
  };
6469
- logger6.info("[GraphAgentExecutor] tick \u8C03\u7528", {
6387
+ logger5.info("[GraphAgentExecutor] tick \u8C03\u7528", {
6470
6388
  stream: input.stream === true,
6471
6389
  hasEventHandler: Boolean(eventHandler),
6472
6390
  hasSummarizationCallbacks: Boolean(input.summarizationCallbacks)
@@ -7489,7 +7407,7 @@ var LlmNodeEventBridge = class {
7489
7407
  };
7490
7408
 
7491
7409
  // src/runtime-kernel/graph-engine/nodes/llmNode.ts
7492
- var logger7 = new Logger("LlmNode");
7410
+ var logger6 = new Logger("LlmNode");
7493
7411
  var LlmNode = class {
7494
7412
  id = "llm";
7495
7413
  reasoner;
@@ -7498,7 +7416,7 @@ var LlmNode = class {
7498
7416
  }
7499
7417
  async run(state) {
7500
7418
  const local = state.local ?? {};
7501
- logger7.info("[LlmNode] \u5F00\u59CB\u6267\u884C LLM \u8282\u70B9", {
7419
+ logger6.info("[LlmNode] \u5F00\u59CB\u6267\u884C LLM \u8282\u70B9", {
7502
7420
  localKeys: Object.keys(local)
7503
7421
  });
7504
7422
  const graphLocal = readGraphAgentLocal(state.local);
@@ -7513,12 +7431,12 @@ var LlmNode = class {
7513
7431
  signal,
7514
7432
  history
7515
7433
  } = graphLocal;
7516
- logger7.info("[LlmNode] \u5DF2\u52A0\u8F7D\u5386\u53F2\u4E8B\u4EF6", {
7434
+ logger6.info("[LlmNode] \u5DF2\u52A0\u8F7D\u5386\u53F2\u4E8B\u4EF6", {
7517
7435
  historyCount: history.length,
7518
7436
  hasSummarizationCallbacks: Boolean(summarizationCallbacks)
7519
7437
  });
7520
7438
  if (!request) {
7521
- logger7.warn("Request object is missing, yielding.");
7439
+ logger6.warn("Request object is missing, yielding.");
7522
7440
  return { kind: "yield", events: [] };
7523
7441
  }
7524
7442
  const turnId = requireRuntimeIdentity(graphLocal.turnId, "turnId");
@@ -7611,12 +7529,12 @@ var LlmNode = class {
7611
7529
  ...nodeState.streamRuntimeEvents,
7612
7530
  ...contextUsageEvent ? [contextUsageEvent] : []
7613
7531
  ];
7614
- logger7.info("[LlmNode] \u5386\u53F2\u4E8B\u4EF6\u5DF2\u66F4\u65B0", {
7532
+ logger6.info("[LlmNode] \u5386\u53F2\u4E8B\u4EF6\u5DF2\u66F4\u65B0", {
7615
7533
  previousCount: history.length,
7616
7534
  nextCount: patch.history.length,
7617
7535
  streamedEventCount: nodeState.streamRuntimeEvents.length
7618
7536
  });
7619
- logger7.info("[LlmNode] \u6267\u884C\u5668\u51B3\u7B56\u5B8C\u6210", {
7537
+ logger6.info("[LlmNode] \u6267\u884C\u5668\u51B3\u7B56\u5B8C\u6210", {
7620
7538
  decisionKind: decision.kind,
7621
7539
  emittedEventCount: combinedEvents.length
7622
7540
  });
@@ -7638,7 +7556,7 @@ var LlmNode = class {
7638
7556
  }
7639
7557
  case "error": {
7640
7558
  const { name, message, stack } = decision.error;
7641
- logger7.error("[LlmNode] Executor returned an error", { name, message, stack });
7559
+ logger6.error("[LlmNode] Executor returned an error", { name, message, stack });
7642
7560
  return { kind: "yield", events: combinedEvents };
7643
7561
  }
7644
7562
  default: {
@@ -7744,7 +7662,7 @@ async function resolveToolModelInput(input) {
7744
7662
  }
7745
7663
 
7746
7664
  // src/runtime-kernel/graph-engine/nodes/toolNode.finalAnswerProjector.ts
7747
- function readNonEmptyString5(value) {
7665
+ function readNonEmptyString4(value) {
7748
7666
  if (typeof value !== "string") {
7749
7667
  return void 0;
7750
7668
  }
@@ -7752,7 +7670,7 @@ function readNonEmptyString5(value) {
7752
7670
  return normalized.length > 0 ? normalized : void 0;
7753
7671
  }
7754
7672
  function resolveFinalAnswerFromToolControl(finalAnswer) {
7755
- return readNonEmptyString5(finalAnswer);
7673
+ return readNonEmptyString4(finalAnswer);
7756
7674
  }
7757
7675
 
7758
7676
  // src/runtime-kernel/graph-engine/nodes/toolNode.helpers.ts
@@ -8008,7 +7926,7 @@ function buildErrorLocalState(params) {
8008
7926
  }
8009
7927
 
8010
7928
  // src/runtime-kernel/tools/argNormalizer.ts
8011
- var logger8 = new Logger("ToolArgNormalizer");
7929
+ var logger7 = new Logger("ToolArgNormalizer");
8012
7930
  function isRecord10(v) {
8013
7931
  return !!v && typeof v === "object" && !Array.isArray(v);
8014
7932
  }
@@ -8028,7 +7946,7 @@ function joinPath(basePath, segment) {
8028
7946
  function logJsonEncodedNormalization(expectedType, options) {
8029
7947
  const toolPrefix = options.toolName ? `${options.toolName}.` : "";
8030
7948
  const path = options.path ?? "<root>";
8031
- logger8.warn("normalized JSON-encoded tool argument", {
7949
+ logger7.warn("normalized JSON-encoded tool argument", {
8032
7950
  expectedType,
8033
7951
  path: `${toolPrefix}${path}`
8034
7952
  });
@@ -8324,7 +8242,7 @@ function ensureToolContextRuntimeCapability(params) {
8324
8242
  }
8325
8243
 
8326
8244
  // src/runtime-kernel/graph-engine/nodes/toolNode.eventBridge.ts
8327
- var logger9 = new Logger("ToolNode");
8245
+ var logger8 = new Logger("ToolNode");
8328
8246
  var ToolNodeEventBridge = class {
8329
8247
  constructor(deps) {
8330
8248
  this.deps = deps;
@@ -8346,7 +8264,7 @@ var ToolNodeEventBridge = class {
8346
8264
  status,
8347
8265
  payload: { ...payload }
8348
8266
  };
8349
- logger9.info("[ToolNode] \u53D1\u51FA tool_process \u4E8B\u4EF6", {
8267
+ logger8.info("[ToolNode] \u53D1\u51FA tool_process \u4E8B\u4EF6", {
8350
8268
  phase,
8351
8269
  status,
8352
8270
  toolName: this.deps.toolName,
@@ -8386,7 +8304,7 @@ var ToolNodeEventBridge = class {
8386
8304
  const answerId = generateAnswerSegmentId();
8387
8305
  const id = answerId;
8388
8306
  const timestamp = Date.now();
8389
- logger9.info("[ToolNode] \u5DE5\u5177\u8F93\u51FA\u6620\u5C04\u4E3A final_answer", {
8307
+ logger8.info("[ToolNode] \u5DE5\u5177\u8F93\u51FA\u6620\u5C04\u4E3A final_answer", {
8390
8308
  sourceToolName: params.sourceToolName,
8391
8309
  toolCallId: this.deps.toolCallId,
8392
8310
  conversationId: this.deps.conversationId,
@@ -8444,7 +8362,7 @@ var ToolNodeEventBridge = class {
8444
8362
  };
8445
8363
 
8446
8364
  // src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
8447
- var logger10 = new Logger("ToolNode");
8365
+ var logger9 = new Logger("ToolNode");
8448
8366
  function parseToolArgs(call) {
8449
8367
  const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
8450
8368
  if (!rawArguments.trim()) {
@@ -8464,19 +8382,13 @@ function parseToolArgs(call) {
8464
8382
  return { ok: true, value: parsed };
8465
8383
  } catch (error) {
8466
8384
  const reason = error instanceof Error ? error.message : "Unknown JSON parse error";
8467
- logger10.warn("failed to parse tool arguments", { error });
8385
+ logger9.warn("failed to parse tool arguments", { error });
8468
8386
  return {
8469
8387
  ok: false,
8470
8388
  error: `Tool arguments are not valid JSON: ${reason}`
8471
8389
  };
8472
8390
  }
8473
8391
  }
8474
- function readRunLockedModelId(local) {
8475
- const executorLocal = local.executorLocal;
8476
- if (!isRecord9(executorLocal)) return void 0;
8477
- const lockedModelId = executorLocal.runLockedModelId;
8478
- return typeof lockedModelId === "string" && lockedModelId.trim() ? lockedModelId : void 0;
8479
- }
8480
8392
  function prepareToolNodeContext(state) {
8481
8393
  const local = state.local || {};
8482
8394
  const toolContext = isRecord9(local.toolContext) ? local.toolContext : {};
@@ -8494,7 +8406,6 @@ function prepareToolNodeContext(state) {
8494
8406
  }
8495
8407
  });
8496
8408
  attachWorkingHistoryView({ state, toolContext });
8497
- toolContext.activeModelId = readRunLockedModelId(local) ?? toolContext.modelId;
8498
8409
  return {
8499
8410
  state,
8500
8411
  local,
@@ -8865,7 +8776,7 @@ async function claimPendingUserInputs(state, result) {
8865
8776
  }
8866
8777
 
8867
8778
  // src/runtime-kernel/graph-engine/nodes/toolNode.ts
8868
- var logger11 = new Logger("ToolNode");
8779
+ var logger10 = new Logger("ToolNode");
8869
8780
  function isAbortSignal(value) {
8870
8781
  return value !== null && typeof value === "object" && "aborted" in value;
8871
8782
  }
@@ -9078,7 +8989,7 @@ var ToolNode = class {
9078
8989
  throw abortError;
9079
8990
  }
9080
8991
  const prepared = prepareToolNodeContext(state);
9081
- logger11.info("[ToolNode] \u5F00\u59CB\u6267\u884C\u5DE5\u5177\u8282\u70B9", {
8992
+ logger10.info("[ToolNode] \u5F00\u59CB\u6267\u884C\u5DE5\u5177\u8282\u70B9", {
9082
8993
  conversationId: prepared.conversationId,
9083
8994
  turnId: prepared.turnId,
9084
8995
  pendingCallCount: calls.length
@@ -9093,7 +9004,7 @@ var ToolNode = class {
9093
9004
  toolCatalog: this.toolRuntime
9094
9005
  });
9095
9006
  if (!execution) {
9096
- logger11.warn("no tool name found in call");
9007
+ logger10.warn("no tool name found in call");
9097
9008
  return { kind: "yield", events: [] };
9098
9009
  }
9099
9010
  if (typeof execution.protocolError === "string") {
@@ -9133,7 +9044,7 @@ var ToolNode = class {
9133
9044
  call,
9134
9045
  context: prepared.toolContext,
9135
9046
  abortGraceMs: this.abortGraceMs,
9136
- onAbandon: () => logger11.warn("[ToolNode] \u5DE5\u5177\u672A\u5728\u505C\u6B62\u671F\u9650\u5185\u7ED3\u675F\uFF0C\u6309\u4E2D\u65AD\u5904\u7406\u5E76\u4E22\u5F03\u8FDF\u5230\u7ED3\u679C", {
9047
+ onAbandon: () => logger10.warn("[ToolNode] \u5DE5\u5177\u672A\u5728\u505C\u6B62\u671F\u9650\u5185\u7ED3\u675F\uFF0C\u6309\u4E2D\u65AD\u5904\u7406\u5E76\u4E22\u5F03\u8FDF\u5230\u7ED3\u679C", {
9137
9048
  toolName: execution.toolName,
9138
9049
  toolCallId: execution.toolCallId,
9139
9050
  conversationId: prepared.conversationId,
@@ -9303,7 +9214,7 @@ var ToolNode = class {
9303
9214
  runtimeEvents: context.bridge.getRuntimeEvents()
9304
9215
  });
9305
9216
  if (control?.terminateRun) {
9306
- logger11.info("[ToolNode] \u6536\u5230 control.terminateRun\uFF0C\u6267\u884C\u5B8C\u5DE5\u5177\u540E\u76F4\u63A5 yield \u7ED3\u675F\u672C\u8F6E run", {
9217
+ logger10.info("[ToolNode] \u6536\u5230 control.terminateRun\uFF0C\u6267\u884C\u5B8C\u5DE5\u5177\u540E\u76F4\u63A5 yield \u7ED3\u675F\u672C\u8F6E run", {
9307
9218
  toolName: context.toolName,
9308
9219
  toolCallId: context.toolCallId,
9309
9220
  conversationId: context.conversationId,
@@ -9312,7 +9223,7 @@ var ToolNode = class {
9312
9223
  return { kind: "yield", events: context.bridge.getRuntimeEvents() };
9313
9224
  }
9314
9225
  if (remainingCalls.length === 0 && context.local.toolBatchCompletionMode === "yield_after_batch") {
9315
- logger11.info("[ToolNode] \u5DE5\u5177\u6279\u6B21\u5DF2\u7ED3\u7B97\uFF0C\u6309 Host \u7B56\u7565\u76F4\u63A5 yield", {
9226
+ logger10.info("[ToolNode] \u5DE5\u5177\u6279\u6B21\u5DF2\u7ED3\u7B97\uFF0C\u6309 Host \u7B56\u7565\u76F4\u63A5 yield", {
9316
9227
  toolName: context.toolName,
9317
9228
  toolCallId: context.toolCallId,
9318
9229
  conversationId: context.conversationId,
@@ -9759,8 +9670,9 @@ var executor = zod.z.object({
9759
9670
  lastStepsHintThreshold: counter.optional(),
9760
9671
  systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
9761
9672
  toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
9673
+ // 已删除字段:0.45 及更早的 checkpoint 可能带 lastSuccessfulLlmModelId,0.46 及更早的可能带云端额度兜底留下的
9674
+ // runLockedModelId;照常接受,读入时丢弃(兜底已移除,恢复后按请求的模型继续)。
9762
9675
  runLockedModelId: zod.z.string().optional(),
9763
- // 0.45 及更早的 checkpoint 可能带这个已删除字段;照常接受,读入时丢弃。
9764
9676
  lastSuccessfulLlmModelId: zod.z.string().optional(),
9765
9677
  llmInvocationKind: zod.z.enum(["user_initiated", "continuation"]).optional(),
9766
9678
  llmInvocationCount: counter.optional(),
@@ -9770,7 +9682,7 @@ var executor = zod.z.object({
9770
9682
  committedCount: counter,
9771
9683
  lastCommittedFingerprint: zod.z.string().optional()
9772
9684
  }).strict().optional()
9773
- }).strict().transform(({ lastSuccessfulLlmModelId: _retired, ...state }) => state);
9685
+ }).strict().transform(({ lastSuccessfulLlmModelId: _retired, runLockedModelId: _retiredLock, ...state }) => state);
9774
9686
  var checkpoint = zod.z.object({
9775
9687
  nodeId: zod.z.string().min(1),
9776
9688
  schemaVersion: zod.z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),
@@ -9832,7 +9744,7 @@ __export(execution_exports, {
9832
9744
  });
9833
9745
 
9834
9746
  // src/runtime-kernel/execution/event-bus.ts
9835
- var logger12 = new Logger("EventBus");
9747
+ var logger11 = new Logger("EventBus");
9836
9748
  var TypedEventEmitter = class {
9837
9749
  listeners = /* @__PURE__ */ new Map();
9838
9750
  maxListeners = 10;
@@ -9840,7 +9752,7 @@ var TypedEventEmitter = class {
9840
9752
  const listeners = this.getListeners(event);
9841
9753
  listeners.add(listener);
9842
9754
  if (listeners.size > this.maxListeners) {
9843
- logger12.warn("EventBus listener count exceeds configured max", {
9755
+ logger11.warn("EventBus listener count exceeds configured max", {
9844
9756
  event: String(event),
9845
9757
  count: listeners.size,
9846
9758
  maxListeners: this.maxListeners
@@ -9900,7 +9812,7 @@ var EventBus = class extends TypedEventEmitter {
9900
9812
  super();
9901
9813
  this.executionId = executionId;
9902
9814
  this.setMaxListeners(30);
9903
- logger12.info(`EventBus created for execution ${this.executionId}`);
9815
+ logger11.info(`EventBus created for execution ${this.executionId}`);
9904
9816
  }
9905
9817
  /**
9906
9818
  * 发布一个事件到总线
@@ -9909,7 +9821,7 @@ var EventBus = class extends TypedEventEmitter {
9909
9821
  publish(envelope) {
9910
9822
  if (envelope.trace.execution_id !== this.executionId) {
9911
9823
  const error = new Error("EventEnvelope execution_id does not match EventBus instance.");
9912
- logger12.error("Mismatched execution_id", {
9824
+ logger11.error("Mismatched execution_id", {
9913
9825
  busExecutionId: this.executionId,
9914
9826
  eventExecutionId: envelope.trace.execution_id,
9915
9827
  eventSeq: envelope.seq
@@ -9921,7 +9833,7 @@ var EventBus = class extends TypedEventEmitter {
9921
9833
  const error = new Error(
9922
9834
  "EventBus only accepts RuntimeEvent with formal run routing identity."
9923
9835
  );
9924
- logger12.error("RuntimeEvent is missing formal run routing identity", {
9836
+ logger11.error("RuntimeEvent is missing formal run routing identity", {
9925
9837
  executionId: this.executionId,
9926
9838
  eventId: envelope.payload.id,
9927
9839
  eventType: envelope.payload.type
@@ -9935,14 +9847,14 @@ var EventBus = class extends TypedEventEmitter {
9935
9847
  * 关闭总线,清理所有监听器
9936
9848
  */
9937
9849
  close() {
9938
- logger12.info(`Closing EventBus for execution ${this.executionId}`);
9850
+ logger11.info(`Closing EventBus for execution ${this.executionId}`);
9939
9851
  this.emit("close");
9940
9852
  this.removeAllListeners();
9941
9853
  }
9942
9854
  };
9943
9855
 
9944
9856
  // src/runtime-kernel/execution/sequencer.ts
9945
- var logger13 = new Logger("EventSequencer");
9857
+ var logger12 = new Logger("EventSequencer");
9946
9858
  var EventSequencer = class {
9947
9859
  executionId;
9948
9860
  traceId;
@@ -9950,7 +9862,7 @@ var EventSequencer = class {
9950
9862
  constructor(conversationId, traceId) {
9951
9863
  this.executionId = generateExecutionId();
9952
9864
  this.traceId = traceId || generateTraceId();
9953
- logger13.info(`EventSequencer created for conversation ${conversationId}`, {
9865
+ logger12.info(`EventSequencer created for conversation ${conversationId}`, {
9954
9866
  executionId: this.executionId,
9955
9867
  traceId: this.traceId
9956
9868
  });
@@ -10763,7 +10675,7 @@ var ThoughtStreamSegmenter = class {
10763
10675
  };
10764
10676
 
10765
10677
  // src/runtime-kernel/llm/streaming-adapter.ts
10766
- var logger14 = new Logger("LlmCaller");
10678
+ var logger13 = new Logger("LlmCaller");
10767
10679
  var CanonicalInferenceFailureError = class extends Error {
10768
10680
  errorCode;
10769
10681
  recoverable;
@@ -10987,7 +10899,7 @@ async function callLlmStream(params) {
10987
10899
  } catch (error) {
10988
10900
  const normalized = error instanceof Error ? error : new Error(String(error));
10989
10901
  if (normalized.name === "AbortError") {
10990
- logger14.info("Canonical inference \u6536\u5230\u53D6\u6D88\u7EC8\u6001\uFF0C\u4E0D\u53D1\u5E03\u666E\u901A error event", { modelId });
10902
+ logger13.info("Canonical inference \u6536\u5230\u53D6\u6D88\u7EC8\u6001\uFF0C\u4E0D\u53D1\u5E03\u666E\u901A error event", { modelId });
10991
10903
  throw normalized;
10992
10904
  }
10993
10905
  const classification = ErrorClassifier.classify(normalized, {
@@ -11063,7 +10975,7 @@ var LlmRetryEpisode = class {
11063
10975
  };
11064
10976
 
11065
10977
  // src/runtime-kernel/llm/retry-fallback-routing.ts
11066
- var logger15 = new Logger("LlmCaller");
10978
+ var logger14 = new Logger("LlmCaller");
11067
10979
  function tryPolicyModelSwitch(deps, activeModelId, excludedModelIds, requirement, fallbackObserver, error, evaluateFallbackPromptCapacity2) {
11068
10980
  deps.modelCatalog.getModelById(activeModelId);
11069
10981
  const policyDecision = deps.policyEngine.decideOnError(error, {
@@ -11093,81 +11005,16 @@ function tryPolicyModelSwitch(deps, activeModelId, excludedModelIds, requirement
11093
11005
  reason: "no_eligible_fallback_candidate",
11094
11006
  requiredPlacements: requirement.placements
11095
11007
  });
11096
- logger15.warn("Policy\u8981\u6C42\u5207\u6362\u6A21\u578B\uFF0C\u4F46\u672A\u627E\u5230\u53EF\u7528\u5907\u7528\u6A21\u578B\uFF08\u53EF\u80FD\u672A\u914D\u7F6E API Key\uFF09");
11008
+ logger14.warn("Policy\u8981\u6C42\u5207\u6362\u6A21\u578B\uFF0C\u4F46\u672A\u627E\u5230\u53EF\u7528\u5907\u7528\u6A21\u578B\uFF08\u53EF\u80FD\u672A\u914D\u7F6E API Key\uFF09");
11097
11009
  return null;
11098
11010
  }
11099
- logger15.warn("Policy \u5207\u6362\u6A21\u578B\u7EE7\u7EED", {
11011
+ logger14.warn("Policy \u5207\u6362\u6A21\u578B\u7EE7\u7EED", {
11100
11012
  reason: policyDecision.reason,
11101
11013
  activeModelId,
11102
11014
  fallbackModelId
11103
11015
  });
11104
11016
  return fallbackModelId;
11105
11017
  }
11106
- function tryCloudQuotaFallback({
11107
- deps,
11108
- activeModelId,
11109
- options,
11110
- excludedModelIds,
11111
- requirement,
11112
- error,
11113
- fallbackObserver,
11114
- evaluateFallbackPromptCapacity: evaluateFallbackPromptCapacity2
11115
- }) {
11116
- const fallbackModelId = options.cloud_quota_fallback_model_id;
11117
- if (!fallbackModelId || !ErrorClassifier.isCloudQuotaError(error) || excludedModelIds.has(fallbackModelId)) {
11118
- return null;
11119
- }
11120
- const fallbackConfig = deps.modelCatalog.getModelById(fallbackModelId);
11121
- if (!fallbackConfig?.api_key) {
11122
- fallbackObserver?.onModelFallbackRejected?.({
11123
- fromModelId: activeModelId,
11124
- candidateModelId: fallbackModelId,
11125
- policy: "cloud-quota",
11126
- reason: "fallback_model_unavailable",
11127
- requiredPlacements: requirement.placements
11128
- });
11129
- logger15.warn("\u4E91\u7AEF\u9650\u989D\u964D\u7EA7\u76EE\u6807\u4E0D\u53EF\u7528\uFF08\u672A\u6CE8\u518C\u6216\u7F3A\u5C11 API Key\uFF09", { fallbackModelId });
11130
- return null;
11131
- }
11132
- const compatibility = evaluateModelInputCompatibility(fallbackConfig, requirement);
11133
- if (!compatibility.compatible) {
11134
- fallbackObserver?.onModelFallbackRejected?.({
11135
- fromModelId: activeModelId,
11136
- candidateModelId: fallbackModelId,
11137
- policy: "cloud-quota",
11138
- reason: compatibility.reason,
11139
- requiredPlacements: requirement.placements
11140
- });
11141
- logger15.warn("\u4E91\u7AEF\u9650\u989D\u964D\u7EA7\u76EE\u6807\u4E0D\u6EE1\u8DB3\u5F53\u524D\u8F93\u5165\u80FD\u529B\uFF0C\u4FDD\u7559\u539F\u59CB\u9519\u8BEF", {
11142
- fallbackModelId,
11143
- requiredPlacements: requirement.placements,
11144
- reason: compatibility.reason
11145
- });
11146
- return null;
11147
- }
11148
- const capacityAdmission = evaluateFallbackPromptCapacity2?.(fallbackModelId);
11149
- if (capacityAdmission && !capacityAdmission.admitted) {
11150
- fallbackObserver?.onModelFallbackRejected?.({
11151
- fromModelId: activeModelId,
11152
- candidateModelId: fallbackModelId,
11153
- policy: "cloud-quota",
11154
- reason: capacityAdmission.reason,
11155
- requiredPlacements: requirement.placements
11156
- });
11157
- logger15.warn("\u4E91\u7AEF\u9650\u989D\u964D\u7EA7\u76EE\u6807\u4E0D\u6EE1\u8DB3\u5F53\u524D Prompt \u5BB9\u91CF\u8981\u6C42\uFF0C\u4FDD\u7559\u539F\u59CB\u9519\u8BEF", {
11158
- fallbackModelId,
11159
- reason: capacityAdmission.reason
11160
- });
11161
- return null;
11162
- }
11163
- logger15.warn("\u4E91\u7AEF\u9650\u989D\u964D\u7EA7\uFF08run \u5185\u7EED\u8DD1\uFF09", {
11164
- activeModelId,
11165
- fallbackModelId,
11166
- reason: error.message
11167
- });
11168
- fallbackObserver?.onCloudQuotaFallbackApplied?.(fallbackModelId);
11169
- return fallbackModelId;
11170
- }
11171
11018
 
11172
11019
  // src/runtime-kernel/llm/usage-telemetry.ts
11173
11020
  async function callPlainCompletion(inferencePort, modelId, messages, options = {}, signal, traceId) {
@@ -11270,7 +11117,7 @@ async function runLlmInputPreflight(params) {
11270
11117
  }
11271
11118
 
11272
11119
  // src/runtime-kernel/llm/retry-fallback.ts
11273
- var logger16 = new Logger("LlmCaller");
11120
+ var logger15 = new Logger("LlmCaller");
11274
11121
  async function callWithRetryFallback(params) {
11275
11122
  const {
11276
11123
  deps,
@@ -11298,11 +11145,9 @@ async function callWithRetryFallback(params) {
11298
11145
  const retryEpisode = new LlmRetryEpisode(traceId, eventHandler);
11299
11146
  let previousAttemptTracker;
11300
11147
  if (!clientRetryEnabled) {
11301
- const activeCfg = deps.modelCatalog.getModelById(modelId);
11302
- logger16.debug("\u5BA2\u6237\u7AEF\u91CD\u8BD5\u5DF2\u7981\u7528", {
11148
+ logger15.debug("\u5BA2\u6237\u7AEF\u91CD\u8BD5\u5DF2\u7981\u7528", {
11303
11149
  modelId,
11304
- billing_mode: activeCfg?.billing_mode,
11305
- reason: options.retry_policy === "none" ? "options.retry_policy=none" : "model config (cloud billing or enable_client_retry=false)"
11150
+ reason: options.retry_policy === "none" ? "options.retry_policy=none" : "model config enable_client_retry=false"
11306
11151
  });
11307
11152
  }
11308
11153
  try {
@@ -11338,7 +11183,7 @@ async function callWithRetryFallback(params) {
11338
11183
  }) : void 0;
11339
11184
  try {
11340
11185
  if (isRetry) {
11341
- logger16.info("LLM \u8C03\u7528\u91CD\u8BD5", { attempt, configuredMaxRetries });
11186
+ logger15.info("LLM \u8C03\u7528\u91CD\u8BD5", { attempt, configuredMaxRetries });
11342
11187
  }
11343
11188
  actualAttempts++;
11344
11189
  retryEpisode.retrying(actualAttempts);
@@ -11367,7 +11212,7 @@ async function callWithRetryFallback(params) {
11367
11212
  if (deps.retryConfig.enableEmptyResponseRetry && !responseContent?.trim() && !toolCallsFromLLM?.length) {
11368
11213
  throw new Error("LLM\u8FD4\u56DE\u4E86\u7A7A\u54CD\u5E94");
11369
11214
  }
11370
- logger16.debug("LLM \u8C03\u7528\u6210\u529F", { attempts: actualAttempts, maxTotalAttempts });
11215
+ logger15.debug("LLM \u8C03\u7528\u6210\u529F", { attempts: actualAttempts, maxTotalAttempts });
11371
11216
  if (attemptContextUsage) {
11372
11217
  fallbackObserver?.onLlmAttemptSucceeded?.(activeModelId, attemptContextUsage);
11373
11218
  } else {
@@ -11378,7 +11223,7 @@ async function callWithRetryFallback(params) {
11378
11223
  } catch (error) {
11379
11224
  lastError = error instanceof Error ? error : new Error(String(error));
11380
11225
  if (lastError.name === "AbortError") {
11381
- logger16.info("LLM \u8C03\u7528\u5DF2\u53D6\u6D88\uFF0C\u4E0D\u8FDB\u5165 provider failure \u5206\u7C7B\u4E0E\u91CD\u8BD5\u6D41\u7A0B", {
11226
+ logger15.info("LLM \u8C03\u7528\u5DF2\u53D6\u6D88\uFF0C\u4E0D\u8FDB\u5165 provider failure \u5206\u7C7B\u4E0E\u91CD\u8BD5\u6D41\u7A0B", {
11382
11227
  attempt: attempt + 1,
11383
11228
  actualAttempts,
11384
11229
  maxTotalAttempts,
@@ -11397,7 +11242,7 @@ async function callWithRetryFallback(params) {
11397
11242
  total_attempts: actualAttempts,
11398
11243
  error_code: classification.errorCode
11399
11244
  };
11400
- logger16.error("LLM \u8C03\u7528\u5931\u8D25", {
11245
+ logger15.error("LLM \u8C03\u7528\u5931\u8D25", {
11401
11246
  attempt: attempt + 1,
11402
11247
  maxAttempts: currentMaxRetries + 1,
11403
11248
  actualAttempts,
@@ -11406,7 +11251,7 @@ async function callWithRetryFallback(params) {
11406
11251
  });
11407
11252
  previousAttemptTracker = attemptTracker;
11408
11253
  if (!hasLlmAttemptBudgetRemaining({ actualAttempts, maxTotalAttempts })) {
11409
- logger16.error("\u5DF2\u8FBE\u5230 LLM \u603B\u8C03\u7528\u6B21\u6570\u4E0A\u9650\uFF0C\u505C\u6B62\u91CD\u8BD5/\u5207\u6A21\u578B", {
11254
+ logger15.error("\u5DF2\u8FBE\u5230 LLM \u603B\u8C03\u7528\u6B21\u6570\u4E0A\u9650\uFF0C\u505C\u6B62\u91CD\u8BD5/\u5207\u6A21\u578B", {
11410
11255
  actualAttempts,
11411
11256
  maxTotalAttempts
11412
11257
  });
@@ -11436,37 +11281,15 @@ async function callWithRetryFallback(params) {
11436
11281
  attempt -= 1;
11437
11282
  continue;
11438
11283
  }
11439
- const quotaFallbackModelId = tryCloudQuotaFallback({
11440
- deps,
11441
- activeModelId,
11442
- options,
11443
- excludedModelIds,
11444
- requirement,
11445
- error: lastError,
11446
- fallbackObserver,
11447
- evaluateFallbackPromptCapacity: invocationContext?.evaluateFallbackPromptCapacity
11448
- });
11449
- if (quotaFallbackModelId) {
11450
- fallbackObserver?.onModelFallbackApplied?.({
11451
- fromModelId: activeModelId,
11452
- toModelId: quotaFallbackModelId,
11453
- reason: lastError.message,
11454
- policy: "cloud-quota"
11455
- });
11456
- activeModelId = quotaFallbackModelId;
11457
- excludedModelIds.add(quotaFallbackModelId);
11458
- attempt -= 1;
11459
- continue;
11460
- }
11461
11284
  }
11462
11285
  if (classification.category === "non_retryable" /* NON_RETRYABLE */) {
11463
- logger16.error("\u9519\u8BEF\u4E0D\u53EF\u91CD\u8BD5\uFF0C\u76F4\u63A5\u5931\u8D25", { reason: classification.reason });
11286
+ logger15.error("\u9519\u8BEF\u4E0D\u53EF\u91CD\u8BD5\uFF0C\u76F4\u63A5\u5931\u8D25", { reason: classification.reason });
11464
11287
  retryEpisode.finish("failed", failedRetryState);
11465
11288
  emitFinalError(eventHandler, pendingErrorEvent, lastError, classification, retryEpisode.activeId);
11466
11289
  throw lastError;
11467
11290
  }
11468
11291
  if (attempt >= configuredMaxRetries || categoryRetries[category] >= currentMaxRetries) {
11469
- logger16.error("\u5DF2\u8FBE\u5230\u6700\u5927\u91CD\u8BD5\u6B21\u6570\uFF0C\u653E\u5F03\u91CD\u8BD5", { maxRetries: currentMaxRetries });
11292
+ logger15.error("\u5DF2\u8FBE\u5230\u6700\u5927\u91CD\u8BD5\u6B21\u6570\uFF0C\u653E\u5F03\u91CD\u8BD5", { maxRetries: currentMaxRetries });
11470
11293
  retryEpisode.finish("exhausted", failedRetryState);
11471
11294
  emitFinalError(eventHandler, pendingErrorEvent, lastError, classification, retryEpisode.activeId);
11472
11295
  throw lastError;
@@ -11478,9 +11301,9 @@ async function callWithRetryFallback(params) {
11478
11301
  6e4
11479
11302
  );
11480
11303
  if (classification.category === "rate_limit" /* RATE_LIMIT */) {
11481
- logger16.warn("\u901F\u7387\u9650\u5236\u9519\u8BEF\uFF0C\u5EF6\u8FDF\u540E\u91CD\u8BD5", { retryDelay, reason: classification.reason });
11304
+ logger15.warn("\u901F\u7387\u9650\u5236\u9519\u8BEF\uFF0C\u5EF6\u8FDF\u540E\u91CD\u8BD5", { retryDelay, reason: classification.reason });
11482
11305
  } else if (classification.category === "retryable" /* RETRYABLE */) {
11483
- logger16.warn("\u53EF\u91CD\u8BD5\u9519\u8BEF\uFF0C\u5EF6\u8FDF\u540E\u91CD\u8BD5", { retryDelay, reason: classification.reason });
11306
+ logger15.warn("\u53EF\u91CD\u8BD5\u9519\u8BEF\uFF0C\u5EF6\u8FDF\u540E\u91CD\u8BD5", { retryDelay, reason: classification.reason });
11484
11307
  }
11485
11308
  throwIfAborted(signal, "\u5EF6\u8FDF\u7B49\u5F85\u524D\u68C0\u6D4B\u5230\u53D6\u6D88\u4FE1\u53F7\uFF0C\u505C\u6B62\u91CD\u8BD5");
11486
11309
  categoryRetries[category] += 1;
@@ -11517,16 +11340,11 @@ function waitForRetry(delayMs, signal) {
11517
11340
  }
11518
11341
  function isClientRetryEnabledForModel(modelCatalog, modelId, options) {
11519
11342
  if (options.retry_policy === "none") return false;
11520
- const cfg = modelCatalog.getModelById(modelId);
11521
- if (cfg?.billing_mode === "cloud") return false;
11522
- if (options.retry_policy === "client") return true;
11523
- if (!cfg) return true;
11524
- if (cfg.enable_client_retry === false) return false;
11525
- return true;
11343
+ return modelCatalog.getModelById(modelId)?.enable_client_retry !== false;
11526
11344
  }
11527
11345
  function throwIfAborted(signal, message) {
11528
11346
  if (!signal?.aborted) return;
11529
- logger16.info(message);
11347
+ logger15.info(message);
11530
11348
  const reason = signal.reason;
11531
11349
  if (reason instanceof Error && reason.name === "AbortError") throw reason;
11532
11350
  const reasonText = typeof reason === "string" && reason.trim().length > 0 ? reason : "stream_interrupted";
@@ -12209,7 +12027,7 @@ function runMetaFromRecord(record) {
12209
12027
  }
12210
12028
 
12211
12029
  // src/runtime-kernel/run-supervisor/functions/awaitingUserWatcher.ts
12212
- var logger18 = new Logger("RunSupervisorAwaitingUserWatcher");
12030
+ var logger17 = new Logger("RunSupervisorAwaitingUserWatcher");
12213
12031
  function isRecord16(value) {
12214
12032
  return typeof value === "object" && value !== null && !Array.isArray(value);
12215
12033
  }
@@ -12254,7 +12072,7 @@ function createAwaitingUserWatcher(options) {
12254
12072
  resumeToken: event.resume_token
12255
12073
  }
12256
12074
  }).catch((error) => {
12257
- logger18.warn("failed to mark awaiting_user from requires_user_interaction", { error });
12075
+ logger17.warn("failed to mark awaiting_user from requires_user_interaction", { error });
12258
12076
  });
12259
12077
  };
12260
12078
  const dispose = () => {