@linnlabs/linnkit 0.45.0 → 0.46.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.
package/dist/testkit.cjs CHANGED
@@ -5363,13 +5363,11 @@ function createExecuteLlmStage(dependencies) {
5363
5363
  "llmCallStartedAt",
5364
5364
  "llmResp",
5365
5365
  "llmCallDurationMs",
5366
- "executorLocalPatch",
5367
5366
  "contextUsage"
5368
5367
  ],
5369
5368
  async run(ctx) {
5370
5369
  let cloudQuotaFallbackAppliedModelId;
5371
5370
  let modelFallbackAudit;
5372
- let lastSuccessfulLlmModelId;
5373
5371
  let contextUsage;
5374
5372
  const modelFallbackRejections = [];
5375
5373
  const promptBudget = ctx.promptBudget;
@@ -5390,8 +5388,7 @@ function createExecuteLlmStage(dependencies) {
5390
5388
  onCloudQuotaFallbackApplied(fallbackModelId) {
5391
5389
  cloudQuotaFallbackAppliedModelId = readNonEmptyString3(fallbackModelId);
5392
5390
  },
5393
- onLlmAttemptSucceeded(activeModelId, attemptContextUsage) {
5394
- lastSuccessfulLlmModelId = readNonEmptyString3(activeModelId);
5391
+ onLlmAttemptSucceeded(_activeModelId, attemptContextUsage) {
5395
5392
  contextUsage = attemptContextUsage;
5396
5393
  },
5397
5394
  onModelFallbackApplied(info) {
@@ -5492,7 +5489,6 @@ function createExecuteLlmStage(dependencies) {
5492
5489
  llmCallStartedAt,
5493
5490
  llmResp,
5494
5491
  llmCallDurationMs,
5495
- executorLocalPatch: lastSuccessfulLlmModelId ? { lastSuccessfulLlmModelId } : void 0,
5496
5492
  contextUsage
5497
5493
  };
5498
5494
  }
@@ -8401,6 +8397,7 @@ var TOOL_CONTEXT_RUNTIME_RESERVED_KEYS = [
8401
8397
  "conversationView",
8402
8398
  "userQuery",
8403
8399
  "modelId",
8400
+ "activeModelId",
8404
8401
  "conversationId",
8405
8402
  "turnId",
8406
8403
  "runId",
@@ -8734,6 +8731,12 @@ function parseToolArgs(call) {
8734
8731
  };
8735
8732
  }
8736
8733
  }
8734
+ function readRunLockedModelId(local) {
8735
+ const executorLocal = local.executorLocal;
8736
+ if (!isRecord9(executorLocal)) return void 0;
8737
+ const lockedModelId = executorLocal.runLockedModelId;
8738
+ return typeof lockedModelId === "string" && lockedModelId.trim() ? lockedModelId : void 0;
8739
+ }
8737
8740
  function prepareToolNodeContext(state) {
8738
8741
  const local = state.local || {};
8739
8742
  const toolContext = isRecord9(local.toolContext) ? local.toolContext : {};
@@ -8751,6 +8754,7 @@ function prepareToolNodeContext(state) {
8751
8754
  }
8752
8755
  });
8753
8756
  attachWorkingHistoryView({ state, toolContext });
8757
+ toolContext.activeModelId = readRunLockedModelId(local) ?? toolContext.modelId;
8754
8758
  return {
8755
8759
  state,
8756
8760
  local,
@@ -10016,6 +10020,7 @@ var executor = zod.z.object({
10016
10020
  systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
10017
10021
  toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
10018
10022
  runLockedModelId: zod.z.string().optional(),
10023
+ // 0.45 及更早的 checkpoint 可能带这个已删除字段;照常接受,读入时丢弃。
10019
10024
  lastSuccessfulLlmModelId: zod.z.string().optional(),
10020
10025
  llmInvocationKind: zod.z.enum(["user_initiated", "continuation"]).optional(),
10021
10026
  llmInvocationCount: counter.optional(),
@@ -10025,7 +10030,7 @@ var executor = zod.z.object({
10025
10030
  committedCount: counter,
10026
10031
  lastCommittedFingerprint: zod.z.string().optional()
10027
10032
  }).strict().optional()
10028
- }).strict();
10033
+ }).strict().transform(({ lastSuccessfulLlmModelId: _retired, ...state }) => state);
10029
10034
  var checkpoint = zod.z.object({
10030
10035
  nodeId: zod.z.string().min(1),
10031
10036
  schemaVersion: zod.z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),