@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.
@@ -5173,13 +5173,11 @@ function createExecuteLlmStage(dependencies) {
5173
5173
  "llmCallStartedAt",
5174
5174
  "llmResp",
5175
5175
  "llmCallDurationMs",
5176
- "executorLocalPatch",
5177
5176
  "contextUsage"
5178
5177
  ],
5179
5178
  async run(ctx) {
5180
5179
  let cloudQuotaFallbackAppliedModelId;
5181
5180
  let modelFallbackAudit;
5182
- let lastSuccessfulLlmModelId;
5183
5181
  let contextUsage;
5184
5182
  const modelFallbackRejections = [];
5185
5183
  const promptBudget = ctx.promptBudget;
@@ -5200,8 +5198,7 @@ function createExecuteLlmStage(dependencies) {
5200
5198
  onCloudQuotaFallbackApplied(fallbackModelId) {
5201
5199
  cloudQuotaFallbackAppliedModelId = readNonEmptyString3(fallbackModelId);
5202
5200
  },
5203
- onLlmAttemptSucceeded(activeModelId, attemptContextUsage) {
5204
- lastSuccessfulLlmModelId = readNonEmptyString3(activeModelId);
5201
+ onLlmAttemptSucceeded(_activeModelId, attemptContextUsage) {
5205
5202
  contextUsage = attemptContextUsage;
5206
5203
  },
5207
5204
  onModelFallbackApplied(info) {
@@ -5302,7 +5299,6 @@ function createExecuteLlmStage(dependencies) {
5302
5299
  llmCallStartedAt,
5303
5300
  llmResp,
5304
5301
  llmCallDurationMs,
5305
- executorLocalPatch: lastSuccessfulLlmModelId ? { lastSuccessfulLlmModelId } : void 0,
5306
5302
  contextUsage
5307
5303
  };
5308
5304
  }
@@ -8211,6 +8207,7 @@ var TOOL_CONTEXT_RUNTIME_RESERVED_KEYS = [
8211
8207
  "conversationView",
8212
8208
  "userQuery",
8213
8209
  "modelId",
8210
+ "activeModelId",
8214
8211
  "conversationId",
8215
8212
  "turnId",
8216
8213
  "runId",
@@ -8544,6 +8541,12 @@ function parseToolArgs(call) {
8544
8541
  };
8545
8542
  }
8546
8543
  }
8544
+ function readRunLockedModelId(local) {
8545
+ const executorLocal = local.executorLocal;
8546
+ if (!isRecord9(executorLocal)) return void 0;
8547
+ const lockedModelId = executorLocal.runLockedModelId;
8548
+ return typeof lockedModelId === "string" && lockedModelId.trim() ? lockedModelId : void 0;
8549
+ }
8547
8550
  function prepareToolNodeContext(state) {
8548
8551
  const local = state.local || {};
8549
8552
  const toolContext = isRecord9(local.toolContext) ? local.toolContext : {};
@@ -8561,6 +8564,7 @@ function prepareToolNodeContext(state) {
8561
8564
  }
8562
8565
  });
8563
8566
  attachWorkingHistoryView({ state, toolContext });
8567
+ toolContext.activeModelId = readRunLockedModelId(local) ?? toolContext.modelId;
8564
8568
  return {
8565
8569
  state,
8566
8570
  local,
@@ -9826,6 +9830,7 @@ var executor = z.object({
9826
9830
  systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
9827
9831
  toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
9828
9832
  runLockedModelId: z.string().optional(),
9833
+ // 0.45 及更早的 checkpoint 可能带这个已删除字段;照常接受,读入时丢弃。
9829
9834
  lastSuccessfulLlmModelId: z.string().optional(),
9830
9835
  llmInvocationKind: z.enum(["user_initiated", "continuation"]).optional(),
9831
9836
  llmInvocationCount: counter.optional(),
@@ -9835,7 +9840,7 @@ var executor = z.object({
9835
9840
  committedCount: counter,
9836
9841
  lastCommittedFingerprint: z.string().optional()
9837
9842
  }).strict().optional()
9838
- }).strict();
9843
+ }).strict().transform(({ lastSuccessfulLlmModelId: _retired, ...state }) => state);
9839
9844
  var checkpoint = z.object({
9840
9845
  nodeId: z.string().min(1),
9841
9846
  schemaVersion: z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),