@linnlabs/linnkit 0.45.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 (40) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/cli.cjs +65 -243
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +65 -243
  5. package/dist/cli.js.map +1 -1
  6. package/dist/context-manager.cjs +7 -6
  7. package/dist/context-manager.cjs.map +1 -1
  8. package/dist/context-manager.js +7 -6
  9. package/dist/context-manager.js.map +1 -1
  10. package/dist/index.cjs +75 -253
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.js +75 -253
  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 +65 -243
  17. package/dist/quickstart.cjs.map +1 -1
  18. package/dist/quickstart.js +65 -243
  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 -4
  23. package/dist/runtime-kernel/graph-engine/types.d.ts +1 -4
  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.cjs +75 -253
  29. package/dist/runtime-kernel.cjs.map +1 -1
  30. package/dist/runtime-kernel.js +75 -253
  31. package/dist/runtime-kernel.js.map +1 -1
  32. package/dist/testkit.cjs +83 -261
  33. package/dist/testkit.cjs.map +1 -1
  34. package/dist/testkit.js +83 -261
  35. package/dist/testkit.js.map +1 -1
  36. package/docs/integration/agent-registration-guide.md +1 -1
  37. package/docs/integration/context-engineering.md +5 -5
  38. package/docs/integration/llm-provider.md +1 -1
  39. package/docs/integration/tool-development-guide.md +4 -2
  40. package/package.json +2 -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,18 +5092,14 @@ function createExecuteLlmStage(dependencies) {
5159
5092
  "turnId"
5160
5093
  ],
5161
5094
  writes: [
5162
- "cloudQuotaFallbackAppliedModelId",
5163
5095
  "modelFallbackAudit",
5164
5096
  "llmCallStartedAt",
5165
5097
  "llmResp",
5166
5098
  "llmCallDurationMs",
5167
- "executorLocalPatch",
5168
5099
  "contextUsage"
5169
5100
  ],
5170
5101
  async run(ctx) {
5171
- let cloudQuotaFallbackAppliedModelId;
5172
5102
  let modelFallbackAudit;
5173
- let lastSuccessfulLlmModelId;
5174
5103
  let contextUsage;
5175
5104
  const modelFallbackRejections = [];
5176
5105
  const promptBudget = ctx.promptBudget;
@@ -5188,11 +5117,7 @@ function createExecuteLlmStage(dependencies) {
5188
5117
  streamEventHandler,
5189
5118
  ctx.signal,
5190
5119
  {
5191
- onCloudQuotaFallbackApplied(fallbackModelId) {
5192
- cloudQuotaFallbackAppliedModelId = readNonEmptyString3(fallbackModelId);
5193
- },
5194
- onLlmAttemptSucceeded(activeModelId, attemptContextUsage) {
5195
- lastSuccessfulLlmModelId = readNonEmptyString3(activeModelId);
5120
+ onLlmAttemptSucceeded(_activeModelId, attemptContextUsage) {
5196
5121
  contextUsage = attemptContextUsage;
5197
5122
  },
5198
5123
  onModelFallbackApplied(info) {
@@ -5288,12 +5213,10 @@ function createExecuteLlmStage(dependencies) {
5288
5213
  });
5289
5214
  }
5290
5215
  return {
5291
- cloudQuotaFallbackAppliedModelId,
5292
5216
  modelFallbackAudit,
5293
5217
  llmCallStartedAt,
5294
5218
  llmResp,
5295
5219
  llmCallDurationMs,
5296
- executorLocalPatch: lastSuccessfulLlmModelId ? { lastSuccessfulLlmModelId } : void 0,
5297
5220
  contextUsage
5298
5221
  };
5299
5222
  }
@@ -6210,18 +6133,16 @@ function createPrepareCallStage(dependencies) {
6210
6133
  "toolDefinitionTokens"
6211
6134
  ],
6212
6135
  async run(ctx) {
6213
- const lockedRunModelId = readNonEmptyString3(ctx.executorLocal?.runLockedModelId);
6214
- const requestedModelId = lockedRunModelId ?? ctx.request.model_id;
6136
+ const requestedModelId = ctx.request.model_id;
6215
6137
  const modelId = dependencies.modelResolver.resolveModelId(requestedModelId);
6216
6138
  await emitAuditEnvelope(ctx.audit, {
6217
6139
  action: "model.select",
6218
6140
  actor: { kind: "system" },
6219
6141
  decision: {
6220
6142
  outcome: "recorded",
6221
- reason: lockedRunModelId ? "run model lock" : requestedModelId ? "request model id" : "default model resolver",
6143
+ reason: requestedModelId ? "request model id" : "default model resolver",
6222
6144
  metadata: {
6223
6145
  requestedModelId,
6224
- lockedRunModelId,
6225
6146
  selectedModelId: modelId
6226
6147
  }
6227
6148
  },
@@ -6268,10 +6189,6 @@ function createPrepareCallStage(dependencies) {
6268
6189
  if (ctx.executorLocal?.lockRequestedModelId === true) {
6269
6190
  llmOptions.allow_model_fallback = false;
6270
6191
  }
6271
- const isRunContinuation = ctx.executorLocal?.llmInvocationKind === "continuation";
6272
- if (dependencies.cloudQuotaFallbackModelId && modelConfig?.billing_mode === "cloud" && modelId !== dependencies.cloudQuotaFallbackModelId && isRunContinuation && ctx.executorLocal?.lockRequestedModelId !== true) {
6273
- llmOptions.cloud_quota_fallback_model_id = dependencies.cloudQuotaFallbackModelId;
6274
- }
6275
6192
  const effectiveEffort = resolveEffectiveEffort(
6276
6193
  ctx.request.reasoning_effort,
6277
6194
  modelConfig?.reasoning
@@ -6388,12 +6305,11 @@ function applyCalibration(rawLocalTotal, imageInputTokens, coefficient) {
6388
6305
  }
6389
6306
 
6390
6307
  // src/runtime-kernel/graph-engine/executor.ts
6391
- var logger6 = new Logger("GraphAgentExecutor");
6308
+ var logger5 = new Logger("GraphAgentExecutor");
6392
6309
  var GraphAgentExecutor = class {
6393
6310
  llmCaller;
6394
6311
  toolRuntime;
6395
6312
  contextBuilder;
6396
- cloudQuotaFallbackModelId;
6397
6313
  modelResolver;
6398
6314
  modelCatalog;
6399
6315
  telemetryPort;
@@ -6405,7 +6321,6 @@ var GraphAgentExecutor = class {
6405
6321
  this.llmCaller = dependencies.llmCaller;
6406
6322
  this.toolRuntime = dependencies.toolRuntime;
6407
6323
  this.contextBuilder = dependencies.contextBuilder;
6408
- this.cloudQuotaFallbackModelId = readNonEmptyString3(dependencies.cloudQuotaFallbackModelId);
6409
6324
  this.modelCatalog = dependencies.modelCatalog ?? createEmptyModelCatalog();
6410
6325
  this.modelResolver = dependencies.modelResolver ?? new ModelResolver({
6411
6326
  modelCatalog: this.modelCatalog
@@ -6422,8 +6337,7 @@ var GraphAgentExecutor = class {
6422
6337
  createPrepareCallStage({
6423
6338
  modelResolver: this.modelResolver,
6424
6339
  modelCatalog: this.modelCatalog,
6425
- toolCatalog: this.toolRuntime,
6426
- cloudQuotaFallbackModelId: this.cloudQuotaFallbackModelId
6340
+ toolCatalog: this.toolRuntime
6427
6341
  }),
6428
6342
  createBuildContextStage({
6429
6343
  contextBuilder: this.contextBuilder
@@ -6445,7 +6359,7 @@ var GraphAgentExecutor = class {
6445
6359
  }),
6446
6360
  createBuildDecisionStage()
6447
6361
  ];
6448
- this.middlewares = [llmTelemetryMiddleware, runModelLockMiddleware];
6362
+ this.middlewares = [llmTelemetryMiddleware];
6449
6363
  }
6450
6364
  async tick(input, eventHandler) {
6451
6365
  const ctx = {
@@ -6470,7 +6384,7 @@ var GraphAgentExecutor = class {
6470
6384
  audit: this.auditPort,
6471
6385
  tokenizer: this.tokenizer
6472
6386
  };
6473
- logger6.info("[GraphAgentExecutor] tick \u8C03\u7528", {
6387
+ logger5.info("[GraphAgentExecutor] tick \u8C03\u7528", {
6474
6388
  stream: input.stream === true,
6475
6389
  hasEventHandler: Boolean(eventHandler),
6476
6390
  hasSummarizationCallbacks: Boolean(input.summarizationCallbacks)
@@ -7493,7 +7407,7 @@ var LlmNodeEventBridge = class {
7493
7407
  };
7494
7408
 
7495
7409
  // src/runtime-kernel/graph-engine/nodes/llmNode.ts
7496
- var logger7 = new Logger("LlmNode");
7410
+ var logger6 = new Logger("LlmNode");
7497
7411
  var LlmNode = class {
7498
7412
  id = "llm";
7499
7413
  reasoner;
@@ -7502,7 +7416,7 @@ var LlmNode = class {
7502
7416
  }
7503
7417
  async run(state) {
7504
7418
  const local = state.local ?? {};
7505
- logger7.info("[LlmNode] \u5F00\u59CB\u6267\u884C LLM \u8282\u70B9", {
7419
+ logger6.info("[LlmNode] \u5F00\u59CB\u6267\u884C LLM \u8282\u70B9", {
7506
7420
  localKeys: Object.keys(local)
7507
7421
  });
7508
7422
  const graphLocal = readGraphAgentLocal(state.local);
@@ -7517,12 +7431,12 @@ var LlmNode = class {
7517
7431
  signal,
7518
7432
  history
7519
7433
  } = graphLocal;
7520
- logger7.info("[LlmNode] \u5DF2\u52A0\u8F7D\u5386\u53F2\u4E8B\u4EF6", {
7434
+ logger6.info("[LlmNode] \u5DF2\u52A0\u8F7D\u5386\u53F2\u4E8B\u4EF6", {
7521
7435
  historyCount: history.length,
7522
7436
  hasSummarizationCallbacks: Boolean(summarizationCallbacks)
7523
7437
  });
7524
7438
  if (!request) {
7525
- logger7.warn("Request object is missing, yielding.");
7439
+ logger6.warn("Request object is missing, yielding.");
7526
7440
  return { kind: "yield", events: [] };
7527
7441
  }
7528
7442
  const turnId = requireRuntimeIdentity(graphLocal.turnId, "turnId");
@@ -7615,12 +7529,12 @@ var LlmNode = class {
7615
7529
  ...nodeState.streamRuntimeEvents,
7616
7530
  ...contextUsageEvent ? [contextUsageEvent] : []
7617
7531
  ];
7618
- logger7.info("[LlmNode] \u5386\u53F2\u4E8B\u4EF6\u5DF2\u66F4\u65B0", {
7532
+ logger6.info("[LlmNode] \u5386\u53F2\u4E8B\u4EF6\u5DF2\u66F4\u65B0", {
7619
7533
  previousCount: history.length,
7620
7534
  nextCount: patch.history.length,
7621
7535
  streamedEventCount: nodeState.streamRuntimeEvents.length
7622
7536
  });
7623
- logger7.info("[LlmNode] \u6267\u884C\u5668\u51B3\u7B56\u5B8C\u6210", {
7537
+ logger6.info("[LlmNode] \u6267\u884C\u5668\u51B3\u7B56\u5B8C\u6210", {
7624
7538
  decisionKind: decision.kind,
7625
7539
  emittedEventCount: combinedEvents.length
7626
7540
  });
@@ -7642,7 +7556,7 @@ var LlmNode = class {
7642
7556
  }
7643
7557
  case "error": {
7644
7558
  const { name, message, stack } = decision.error;
7645
- logger7.error("[LlmNode] Executor returned an error", { name, message, stack });
7559
+ logger6.error("[LlmNode] Executor returned an error", { name, message, stack });
7646
7560
  return { kind: "yield", events: combinedEvents };
7647
7561
  }
7648
7562
  default: {
@@ -7748,7 +7662,7 @@ async function resolveToolModelInput(input) {
7748
7662
  }
7749
7663
 
7750
7664
  // src/runtime-kernel/graph-engine/nodes/toolNode.finalAnswerProjector.ts
7751
- function readNonEmptyString5(value) {
7665
+ function readNonEmptyString4(value) {
7752
7666
  if (typeof value !== "string") {
7753
7667
  return void 0;
7754
7668
  }
@@ -7756,7 +7670,7 @@ function readNonEmptyString5(value) {
7756
7670
  return normalized.length > 0 ? normalized : void 0;
7757
7671
  }
7758
7672
  function resolveFinalAnswerFromToolControl(finalAnswer) {
7759
- return readNonEmptyString5(finalAnswer);
7673
+ return readNonEmptyString4(finalAnswer);
7760
7674
  }
7761
7675
 
7762
7676
  // src/runtime-kernel/graph-engine/nodes/toolNode.helpers.ts
@@ -8012,7 +7926,7 @@ function buildErrorLocalState(params) {
8012
7926
  }
8013
7927
 
8014
7928
  // src/runtime-kernel/tools/argNormalizer.ts
8015
- var logger8 = new Logger("ToolArgNormalizer");
7929
+ var logger7 = new Logger("ToolArgNormalizer");
8016
7930
  function isRecord10(v) {
8017
7931
  return !!v && typeof v === "object" && !Array.isArray(v);
8018
7932
  }
@@ -8032,7 +7946,7 @@ function joinPath(basePath, segment) {
8032
7946
  function logJsonEncodedNormalization(expectedType, options) {
8033
7947
  const toolPrefix = options.toolName ? `${options.toolName}.` : "";
8034
7948
  const path = options.path ?? "<root>";
8035
- logger8.warn("normalized JSON-encoded tool argument", {
7949
+ logger7.warn("normalized JSON-encoded tool argument", {
8036
7950
  expectedType,
8037
7951
  path: `${toolPrefix}${path}`
8038
7952
  });
@@ -8328,7 +8242,7 @@ function ensureToolContextRuntimeCapability(params) {
8328
8242
  }
8329
8243
 
8330
8244
  // src/runtime-kernel/graph-engine/nodes/toolNode.eventBridge.ts
8331
- var logger9 = new Logger("ToolNode");
8245
+ var logger8 = new Logger("ToolNode");
8332
8246
  var ToolNodeEventBridge = class {
8333
8247
  constructor(deps) {
8334
8248
  this.deps = deps;
@@ -8350,7 +8264,7 @@ var ToolNodeEventBridge = class {
8350
8264
  status,
8351
8265
  payload: { ...payload }
8352
8266
  };
8353
- logger9.info("[ToolNode] \u53D1\u51FA tool_process \u4E8B\u4EF6", {
8267
+ logger8.info("[ToolNode] \u53D1\u51FA tool_process \u4E8B\u4EF6", {
8354
8268
  phase,
8355
8269
  status,
8356
8270
  toolName: this.deps.toolName,
@@ -8390,7 +8304,7 @@ var ToolNodeEventBridge = class {
8390
8304
  const answerId = generateAnswerSegmentId();
8391
8305
  const id = answerId;
8392
8306
  const timestamp = Date.now();
8393
- 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", {
8394
8308
  sourceToolName: params.sourceToolName,
8395
8309
  toolCallId: this.deps.toolCallId,
8396
8310
  conversationId: this.deps.conversationId,
@@ -8448,7 +8362,7 @@ var ToolNodeEventBridge = class {
8448
8362
  };
8449
8363
 
8450
8364
  // src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
8451
- var logger10 = new Logger("ToolNode");
8365
+ var logger9 = new Logger("ToolNode");
8452
8366
  function parseToolArgs(call) {
8453
8367
  const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
8454
8368
  if (!rawArguments.trim()) {
@@ -8468,7 +8382,7 @@ function parseToolArgs(call) {
8468
8382
  return { ok: true, value: parsed };
8469
8383
  } catch (error) {
8470
8384
  const reason = error instanceof Error ? error.message : "Unknown JSON parse error";
8471
- logger10.warn("failed to parse tool arguments", { error });
8385
+ logger9.warn("failed to parse tool arguments", { error });
8472
8386
  return {
8473
8387
  ok: false,
8474
8388
  error: `Tool arguments are not valid JSON: ${reason}`
@@ -8862,7 +8776,7 @@ async function claimPendingUserInputs(state, result) {
8862
8776
  }
8863
8777
 
8864
8778
  // src/runtime-kernel/graph-engine/nodes/toolNode.ts
8865
- var logger11 = new Logger("ToolNode");
8779
+ var logger10 = new Logger("ToolNode");
8866
8780
  function isAbortSignal(value) {
8867
8781
  return value !== null && typeof value === "object" && "aborted" in value;
8868
8782
  }
@@ -9075,7 +8989,7 @@ var ToolNode = class {
9075
8989
  throw abortError;
9076
8990
  }
9077
8991
  const prepared = prepareToolNodeContext(state);
9078
- logger11.info("[ToolNode] \u5F00\u59CB\u6267\u884C\u5DE5\u5177\u8282\u70B9", {
8992
+ logger10.info("[ToolNode] \u5F00\u59CB\u6267\u884C\u5DE5\u5177\u8282\u70B9", {
9079
8993
  conversationId: prepared.conversationId,
9080
8994
  turnId: prepared.turnId,
9081
8995
  pendingCallCount: calls.length
@@ -9090,7 +9004,7 @@ var ToolNode = class {
9090
9004
  toolCatalog: this.toolRuntime
9091
9005
  });
9092
9006
  if (!execution) {
9093
- logger11.warn("no tool name found in call");
9007
+ logger10.warn("no tool name found in call");
9094
9008
  return { kind: "yield", events: [] };
9095
9009
  }
9096
9010
  if (typeof execution.protocolError === "string") {
@@ -9130,7 +9044,7 @@ var ToolNode = class {
9130
9044
  call,
9131
9045
  context: prepared.toolContext,
9132
9046
  abortGraceMs: this.abortGraceMs,
9133
- 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", {
9134
9048
  toolName: execution.toolName,
9135
9049
  toolCallId: execution.toolCallId,
9136
9050
  conversationId: prepared.conversationId,
@@ -9300,7 +9214,7 @@ var ToolNode = class {
9300
9214
  runtimeEvents: context.bridge.getRuntimeEvents()
9301
9215
  });
9302
9216
  if (control?.terminateRun) {
9303
- 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", {
9304
9218
  toolName: context.toolName,
9305
9219
  toolCallId: context.toolCallId,
9306
9220
  conversationId: context.conversationId,
@@ -9309,7 +9223,7 @@ var ToolNode = class {
9309
9223
  return { kind: "yield", events: context.bridge.getRuntimeEvents() };
9310
9224
  }
9311
9225
  if (remainingCalls.length === 0 && context.local.toolBatchCompletionMode === "yield_after_batch") {
9312
- 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", {
9313
9227
  toolName: context.toolName,
9314
9228
  toolCallId: context.toolCallId,
9315
9229
  conversationId: context.conversationId,
@@ -9756,6 +9670,8 @@ var executor = zod.z.object({
9756
9670
  lastStepsHintThreshold: counter.optional(),
9757
9671
  systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
9758
9672
  toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
9673
+ // 已删除字段:0.45 及更早的 checkpoint 可能带 lastSuccessfulLlmModelId,0.46 及更早的可能带云端额度兜底留下的
9674
+ // runLockedModelId;照常接受,读入时丢弃(兜底已移除,恢复后按请求的模型继续)。
9759
9675
  runLockedModelId: zod.z.string().optional(),
9760
9676
  lastSuccessfulLlmModelId: zod.z.string().optional(),
9761
9677
  llmInvocationKind: zod.z.enum(["user_initiated", "continuation"]).optional(),
@@ -9766,7 +9682,7 @@ var executor = zod.z.object({
9766
9682
  committedCount: counter,
9767
9683
  lastCommittedFingerprint: zod.z.string().optional()
9768
9684
  }).strict().optional()
9769
- }).strict();
9685
+ }).strict().transform(({ lastSuccessfulLlmModelId: _retired, runLockedModelId: _retiredLock, ...state }) => state);
9770
9686
  var checkpoint = zod.z.object({
9771
9687
  nodeId: zod.z.string().min(1),
9772
9688
  schemaVersion: zod.z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),
@@ -9828,7 +9744,7 @@ __export(execution_exports, {
9828
9744
  });
9829
9745
 
9830
9746
  // src/runtime-kernel/execution/event-bus.ts
9831
- var logger12 = new Logger("EventBus");
9747
+ var logger11 = new Logger("EventBus");
9832
9748
  var TypedEventEmitter = class {
9833
9749
  listeners = /* @__PURE__ */ new Map();
9834
9750
  maxListeners = 10;
@@ -9836,7 +9752,7 @@ var TypedEventEmitter = class {
9836
9752
  const listeners = this.getListeners(event);
9837
9753
  listeners.add(listener);
9838
9754
  if (listeners.size > this.maxListeners) {
9839
- logger12.warn("EventBus listener count exceeds configured max", {
9755
+ logger11.warn("EventBus listener count exceeds configured max", {
9840
9756
  event: String(event),
9841
9757
  count: listeners.size,
9842
9758
  maxListeners: this.maxListeners
@@ -9896,7 +9812,7 @@ var EventBus = class extends TypedEventEmitter {
9896
9812
  super();
9897
9813
  this.executionId = executionId;
9898
9814
  this.setMaxListeners(30);
9899
- logger12.info(`EventBus created for execution ${this.executionId}`);
9815
+ logger11.info(`EventBus created for execution ${this.executionId}`);
9900
9816
  }
9901
9817
  /**
9902
9818
  * 发布一个事件到总线
@@ -9905,7 +9821,7 @@ var EventBus = class extends TypedEventEmitter {
9905
9821
  publish(envelope) {
9906
9822
  if (envelope.trace.execution_id !== this.executionId) {
9907
9823
  const error = new Error("EventEnvelope execution_id does not match EventBus instance.");
9908
- logger12.error("Mismatched execution_id", {
9824
+ logger11.error("Mismatched execution_id", {
9909
9825
  busExecutionId: this.executionId,
9910
9826
  eventExecutionId: envelope.trace.execution_id,
9911
9827
  eventSeq: envelope.seq
@@ -9917,7 +9833,7 @@ var EventBus = class extends TypedEventEmitter {
9917
9833
  const error = new Error(
9918
9834
  "EventBus only accepts RuntimeEvent with formal run routing identity."
9919
9835
  );
9920
- logger12.error("RuntimeEvent is missing formal run routing identity", {
9836
+ logger11.error("RuntimeEvent is missing formal run routing identity", {
9921
9837
  executionId: this.executionId,
9922
9838
  eventId: envelope.payload.id,
9923
9839
  eventType: envelope.payload.type
@@ -9931,14 +9847,14 @@ var EventBus = class extends TypedEventEmitter {
9931
9847
  * 关闭总线,清理所有监听器
9932
9848
  */
9933
9849
  close() {
9934
- logger12.info(`Closing EventBus for execution ${this.executionId}`);
9850
+ logger11.info(`Closing EventBus for execution ${this.executionId}`);
9935
9851
  this.emit("close");
9936
9852
  this.removeAllListeners();
9937
9853
  }
9938
9854
  };
9939
9855
 
9940
9856
  // src/runtime-kernel/execution/sequencer.ts
9941
- var logger13 = new Logger("EventSequencer");
9857
+ var logger12 = new Logger("EventSequencer");
9942
9858
  var EventSequencer = class {
9943
9859
  executionId;
9944
9860
  traceId;
@@ -9946,7 +9862,7 @@ var EventSequencer = class {
9946
9862
  constructor(conversationId, traceId) {
9947
9863
  this.executionId = generateExecutionId();
9948
9864
  this.traceId = traceId || generateTraceId();
9949
- logger13.info(`EventSequencer created for conversation ${conversationId}`, {
9865
+ logger12.info(`EventSequencer created for conversation ${conversationId}`, {
9950
9866
  executionId: this.executionId,
9951
9867
  traceId: this.traceId
9952
9868
  });
@@ -10759,7 +10675,7 @@ var ThoughtStreamSegmenter = class {
10759
10675
  };
10760
10676
 
10761
10677
  // src/runtime-kernel/llm/streaming-adapter.ts
10762
- var logger14 = new Logger("LlmCaller");
10678
+ var logger13 = new Logger("LlmCaller");
10763
10679
  var CanonicalInferenceFailureError = class extends Error {
10764
10680
  errorCode;
10765
10681
  recoverable;
@@ -10983,7 +10899,7 @@ async function callLlmStream(params) {
10983
10899
  } catch (error) {
10984
10900
  const normalized = error instanceof Error ? error : new Error(String(error));
10985
10901
  if (normalized.name === "AbortError") {
10986
- 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 });
10987
10903
  throw normalized;
10988
10904
  }
10989
10905
  const classification = ErrorClassifier.classify(normalized, {
@@ -11059,7 +10975,7 @@ var LlmRetryEpisode = class {
11059
10975
  };
11060
10976
 
11061
10977
  // src/runtime-kernel/llm/retry-fallback-routing.ts
11062
- var logger15 = new Logger("LlmCaller");
10978
+ var logger14 = new Logger("LlmCaller");
11063
10979
  function tryPolicyModelSwitch(deps, activeModelId, excludedModelIds, requirement, fallbackObserver, error, evaluateFallbackPromptCapacity2) {
11064
10980
  deps.modelCatalog.getModelById(activeModelId);
11065
10981
  const policyDecision = deps.policyEngine.decideOnError(error, {
@@ -11089,81 +11005,16 @@ function tryPolicyModelSwitch(deps, activeModelId, excludedModelIds, requirement
11089
11005
  reason: "no_eligible_fallback_candidate",
11090
11006
  requiredPlacements: requirement.placements
11091
11007
  });
11092
- 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");
11093
11009
  return null;
11094
11010
  }
11095
- logger15.warn("Policy \u5207\u6362\u6A21\u578B\u7EE7\u7EED", {
11011
+ logger14.warn("Policy \u5207\u6362\u6A21\u578B\u7EE7\u7EED", {
11096
11012
  reason: policyDecision.reason,
11097
11013
  activeModelId,
11098
11014
  fallbackModelId
11099
11015
  });
11100
11016
  return fallbackModelId;
11101
11017
  }
11102
- function tryCloudQuotaFallback({
11103
- deps,
11104
- activeModelId,
11105
- options,
11106
- excludedModelIds,
11107
- requirement,
11108
- error,
11109
- fallbackObserver,
11110
- evaluateFallbackPromptCapacity: evaluateFallbackPromptCapacity2
11111
- }) {
11112
- const fallbackModelId = options.cloud_quota_fallback_model_id;
11113
- if (!fallbackModelId || !ErrorClassifier.isCloudQuotaError(error) || excludedModelIds.has(fallbackModelId)) {
11114
- return null;
11115
- }
11116
- const fallbackConfig = deps.modelCatalog.getModelById(fallbackModelId);
11117
- if (!fallbackConfig?.api_key) {
11118
- fallbackObserver?.onModelFallbackRejected?.({
11119
- fromModelId: activeModelId,
11120
- candidateModelId: fallbackModelId,
11121
- policy: "cloud-quota",
11122
- reason: "fallback_model_unavailable",
11123
- requiredPlacements: requirement.placements
11124
- });
11125
- logger15.warn("\u4E91\u7AEF\u9650\u989D\u964D\u7EA7\u76EE\u6807\u4E0D\u53EF\u7528\uFF08\u672A\u6CE8\u518C\u6216\u7F3A\u5C11 API Key\uFF09", { fallbackModelId });
11126
- return null;
11127
- }
11128
- const compatibility = evaluateModelInputCompatibility(fallbackConfig, requirement);
11129
- if (!compatibility.compatible) {
11130
- fallbackObserver?.onModelFallbackRejected?.({
11131
- fromModelId: activeModelId,
11132
- candidateModelId: fallbackModelId,
11133
- policy: "cloud-quota",
11134
- reason: compatibility.reason,
11135
- requiredPlacements: requirement.placements
11136
- });
11137
- 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", {
11138
- fallbackModelId,
11139
- requiredPlacements: requirement.placements,
11140
- reason: compatibility.reason
11141
- });
11142
- return null;
11143
- }
11144
- const capacityAdmission = evaluateFallbackPromptCapacity2?.(fallbackModelId);
11145
- if (capacityAdmission && !capacityAdmission.admitted) {
11146
- fallbackObserver?.onModelFallbackRejected?.({
11147
- fromModelId: activeModelId,
11148
- candidateModelId: fallbackModelId,
11149
- policy: "cloud-quota",
11150
- reason: capacityAdmission.reason,
11151
- requiredPlacements: requirement.placements
11152
- });
11153
- 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", {
11154
- fallbackModelId,
11155
- reason: capacityAdmission.reason
11156
- });
11157
- return null;
11158
- }
11159
- logger15.warn("\u4E91\u7AEF\u9650\u989D\u964D\u7EA7\uFF08run \u5185\u7EED\u8DD1\uFF09", {
11160
- activeModelId,
11161
- fallbackModelId,
11162
- reason: error.message
11163
- });
11164
- fallbackObserver?.onCloudQuotaFallbackApplied?.(fallbackModelId);
11165
- return fallbackModelId;
11166
- }
11167
11018
 
11168
11019
  // src/runtime-kernel/llm/usage-telemetry.ts
11169
11020
  async function callPlainCompletion(inferencePort, modelId, messages, options = {}, signal, traceId) {
@@ -11266,7 +11117,7 @@ async function runLlmInputPreflight(params) {
11266
11117
  }
11267
11118
 
11268
11119
  // src/runtime-kernel/llm/retry-fallback.ts
11269
- var logger16 = new Logger("LlmCaller");
11120
+ var logger15 = new Logger("LlmCaller");
11270
11121
  async function callWithRetryFallback(params) {
11271
11122
  const {
11272
11123
  deps,
@@ -11294,11 +11145,9 @@ async function callWithRetryFallback(params) {
11294
11145
  const retryEpisode = new LlmRetryEpisode(traceId, eventHandler);
11295
11146
  let previousAttemptTracker;
11296
11147
  if (!clientRetryEnabled) {
11297
- const activeCfg = deps.modelCatalog.getModelById(modelId);
11298
- logger16.debug("\u5BA2\u6237\u7AEF\u91CD\u8BD5\u5DF2\u7981\u7528", {
11148
+ logger15.debug("\u5BA2\u6237\u7AEF\u91CD\u8BD5\u5DF2\u7981\u7528", {
11299
11149
  modelId,
11300
- billing_mode: activeCfg?.billing_mode,
11301
- 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"
11302
11151
  });
11303
11152
  }
11304
11153
  try {
@@ -11334,7 +11183,7 @@ async function callWithRetryFallback(params) {
11334
11183
  }) : void 0;
11335
11184
  try {
11336
11185
  if (isRetry) {
11337
- logger16.info("LLM \u8C03\u7528\u91CD\u8BD5", { attempt, configuredMaxRetries });
11186
+ logger15.info("LLM \u8C03\u7528\u91CD\u8BD5", { attempt, configuredMaxRetries });
11338
11187
  }
11339
11188
  actualAttempts++;
11340
11189
  retryEpisode.retrying(actualAttempts);
@@ -11363,7 +11212,7 @@ async function callWithRetryFallback(params) {
11363
11212
  if (deps.retryConfig.enableEmptyResponseRetry && !responseContent?.trim() && !toolCallsFromLLM?.length) {
11364
11213
  throw new Error("LLM\u8FD4\u56DE\u4E86\u7A7A\u54CD\u5E94");
11365
11214
  }
11366
- logger16.debug("LLM \u8C03\u7528\u6210\u529F", { attempts: actualAttempts, maxTotalAttempts });
11215
+ logger15.debug("LLM \u8C03\u7528\u6210\u529F", { attempts: actualAttempts, maxTotalAttempts });
11367
11216
  if (attemptContextUsage) {
11368
11217
  fallbackObserver?.onLlmAttemptSucceeded?.(activeModelId, attemptContextUsage);
11369
11218
  } else {
@@ -11374,7 +11223,7 @@ async function callWithRetryFallback(params) {
11374
11223
  } catch (error) {
11375
11224
  lastError = error instanceof Error ? error : new Error(String(error));
11376
11225
  if (lastError.name === "AbortError") {
11377
- 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", {
11378
11227
  attempt: attempt + 1,
11379
11228
  actualAttempts,
11380
11229
  maxTotalAttempts,
@@ -11393,7 +11242,7 @@ async function callWithRetryFallback(params) {
11393
11242
  total_attempts: actualAttempts,
11394
11243
  error_code: classification.errorCode
11395
11244
  };
11396
- logger16.error("LLM \u8C03\u7528\u5931\u8D25", {
11245
+ logger15.error("LLM \u8C03\u7528\u5931\u8D25", {
11397
11246
  attempt: attempt + 1,
11398
11247
  maxAttempts: currentMaxRetries + 1,
11399
11248
  actualAttempts,
@@ -11402,7 +11251,7 @@ async function callWithRetryFallback(params) {
11402
11251
  });
11403
11252
  previousAttemptTracker = attemptTracker;
11404
11253
  if (!hasLlmAttemptBudgetRemaining({ actualAttempts, maxTotalAttempts })) {
11405
- 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", {
11406
11255
  actualAttempts,
11407
11256
  maxTotalAttempts
11408
11257
  });
@@ -11432,37 +11281,15 @@ async function callWithRetryFallback(params) {
11432
11281
  attempt -= 1;
11433
11282
  continue;
11434
11283
  }
11435
- const quotaFallbackModelId = tryCloudQuotaFallback({
11436
- deps,
11437
- activeModelId,
11438
- options,
11439
- excludedModelIds,
11440
- requirement,
11441
- error: lastError,
11442
- fallbackObserver,
11443
- evaluateFallbackPromptCapacity: invocationContext?.evaluateFallbackPromptCapacity
11444
- });
11445
- if (quotaFallbackModelId) {
11446
- fallbackObserver?.onModelFallbackApplied?.({
11447
- fromModelId: activeModelId,
11448
- toModelId: quotaFallbackModelId,
11449
- reason: lastError.message,
11450
- policy: "cloud-quota"
11451
- });
11452
- activeModelId = quotaFallbackModelId;
11453
- excludedModelIds.add(quotaFallbackModelId);
11454
- attempt -= 1;
11455
- continue;
11456
- }
11457
11284
  }
11458
11285
  if (classification.category === "non_retryable" /* NON_RETRYABLE */) {
11459
- 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 });
11460
11287
  retryEpisode.finish("failed", failedRetryState);
11461
11288
  emitFinalError(eventHandler, pendingErrorEvent, lastError, classification, retryEpisode.activeId);
11462
11289
  throw lastError;
11463
11290
  }
11464
11291
  if (attempt >= configuredMaxRetries || categoryRetries[category] >= currentMaxRetries) {
11465
- 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 });
11466
11293
  retryEpisode.finish("exhausted", failedRetryState);
11467
11294
  emitFinalError(eventHandler, pendingErrorEvent, lastError, classification, retryEpisode.activeId);
11468
11295
  throw lastError;
@@ -11474,9 +11301,9 @@ async function callWithRetryFallback(params) {
11474
11301
  6e4
11475
11302
  );
11476
11303
  if (classification.category === "rate_limit" /* RATE_LIMIT */) {
11477
- 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 });
11478
11305
  } else if (classification.category === "retryable" /* RETRYABLE */) {
11479
- 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 });
11480
11307
  }
11481
11308
  throwIfAborted(signal, "\u5EF6\u8FDF\u7B49\u5F85\u524D\u68C0\u6D4B\u5230\u53D6\u6D88\u4FE1\u53F7\uFF0C\u505C\u6B62\u91CD\u8BD5");
11482
11309
  categoryRetries[category] += 1;
@@ -11513,16 +11340,11 @@ function waitForRetry(delayMs, signal) {
11513
11340
  }
11514
11341
  function isClientRetryEnabledForModel(modelCatalog, modelId, options) {
11515
11342
  if (options.retry_policy === "none") return false;
11516
- const cfg = modelCatalog.getModelById(modelId);
11517
- if (cfg?.billing_mode === "cloud") return false;
11518
- if (options.retry_policy === "client") return true;
11519
- if (!cfg) return true;
11520
- if (cfg.enable_client_retry === false) return false;
11521
- return true;
11343
+ return modelCatalog.getModelById(modelId)?.enable_client_retry !== false;
11522
11344
  }
11523
11345
  function throwIfAborted(signal, message) {
11524
11346
  if (!signal?.aborted) return;
11525
- logger16.info(message);
11347
+ logger15.info(message);
11526
11348
  const reason = signal.reason;
11527
11349
  if (reason instanceof Error && reason.name === "AbortError") throw reason;
11528
11350
  const reasonText = typeof reason === "string" && reason.trim().length > 0 ? reason : "stream_interrupted";
@@ -12205,7 +12027,7 @@ function runMetaFromRecord(record) {
12205
12027
  }
12206
12028
 
12207
12029
  // src/runtime-kernel/run-supervisor/functions/awaitingUserWatcher.ts
12208
- var logger18 = new Logger("RunSupervisorAwaitingUserWatcher");
12030
+ var logger17 = new Logger("RunSupervisorAwaitingUserWatcher");
12209
12031
  function isRecord16(value) {
12210
12032
  return typeof value === "object" && value !== null && !Array.isArray(value);
12211
12033
  }
@@ -12250,7 +12072,7 @@ function createAwaitingUserWatcher(options) {
12250
12072
  resumeToken: event.resume_token
12251
12073
  }
12252
12074
  }).catch((error) => {
12253
- 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 });
12254
12076
  });
12255
12077
  };
12256
12078
  const dispose = () => {