@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/index.cjs CHANGED
@@ -6200,13 +6200,11 @@ function createExecuteLlmStage(dependencies) {
6200
6200
  "llmCallStartedAt",
6201
6201
  "llmResp",
6202
6202
  "llmCallDurationMs",
6203
- "executorLocalPatch",
6204
6203
  "contextUsage"
6205
6204
  ],
6206
6205
  async run(ctx) {
6207
6206
  let cloudQuotaFallbackAppliedModelId;
6208
6207
  let modelFallbackAudit;
6209
- let lastSuccessfulLlmModelId;
6210
6208
  let contextUsage;
6211
6209
  const modelFallbackRejections = [];
6212
6210
  const promptBudget = ctx.promptBudget;
@@ -6227,8 +6225,7 @@ function createExecuteLlmStage(dependencies) {
6227
6225
  onCloudQuotaFallbackApplied(fallbackModelId) {
6228
6226
  cloudQuotaFallbackAppliedModelId = readNonEmptyString3(fallbackModelId);
6229
6227
  },
6230
- onLlmAttemptSucceeded(activeModelId, attemptContextUsage) {
6231
- lastSuccessfulLlmModelId = readNonEmptyString3(activeModelId);
6228
+ onLlmAttemptSucceeded(_activeModelId, attemptContextUsage) {
6232
6229
  contextUsage = attemptContextUsage;
6233
6230
  },
6234
6231
  onModelFallbackApplied(info) {
@@ -6329,7 +6326,6 @@ function createExecuteLlmStage(dependencies) {
6329
6326
  llmCallStartedAt,
6330
6327
  llmResp,
6331
6328
  llmCallDurationMs,
6332
- executorLocalPatch: lastSuccessfulLlmModelId ? { lastSuccessfulLlmModelId } : void 0,
6333
6329
  contextUsage
6334
6330
  };
6335
6331
  }
@@ -9238,6 +9234,7 @@ var TOOL_CONTEXT_RUNTIME_RESERVED_KEYS = [
9238
9234
  "conversationView",
9239
9235
  "userQuery",
9240
9236
  "modelId",
9237
+ "activeModelId",
9241
9238
  "conversationId",
9242
9239
  "turnId",
9243
9240
  "runId",
@@ -9571,6 +9568,12 @@ function parseToolArgs(call) {
9571
9568
  };
9572
9569
  }
9573
9570
  }
9571
+ function readRunLockedModelId(local) {
9572
+ const executorLocal = local.executorLocal;
9573
+ if (!isRecord9(executorLocal)) return void 0;
9574
+ const lockedModelId = executorLocal.runLockedModelId;
9575
+ return typeof lockedModelId === "string" && lockedModelId.trim() ? lockedModelId : void 0;
9576
+ }
9574
9577
  function prepareToolNodeContext(state) {
9575
9578
  const local = state.local || {};
9576
9579
  const toolContext = isRecord9(local.toolContext) ? local.toolContext : {};
@@ -9588,6 +9591,7 @@ function prepareToolNodeContext(state) {
9588
9591
  }
9589
9592
  });
9590
9593
  attachWorkingHistoryView({ state, toolContext });
9594
+ toolContext.activeModelId = readRunLockedModelId(local) ?? toolContext.modelId;
9591
9595
  return {
9592
9596
  state,
9593
9597
  local,
@@ -10860,6 +10864,7 @@ var executor = zod.z.object({
10860
10864
  systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
10861
10865
  toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
10862
10866
  runLockedModelId: zod.z.string().optional(),
10867
+ // 0.45 及更早的 checkpoint 可能带这个已删除字段;照常接受,读入时丢弃。
10863
10868
  lastSuccessfulLlmModelId: zod.z.string().optional(),
10864
10869
  llmInvocationKind: zod.z.enum(["user_initiated", "continuation"]).optional(),
10865
10870
  llmInvocationCount: counter.optional(),
@@ -10869,7 +10874,7 @@ var executor = zod.z.object({
10869
10874
  committedCount: counter,
10870
10875
  lastCommittedFingerprint: zod.z.string().optional()
10871
10876
  }).strict().optional()
10872
- }).strict();
10877
+ }).strict().transform(({ lastSuccessfulLlmModelId: _retired, ...state }) => state);
10873
10878
  var checkpoint = zod.z.object({
10874
10879
  nodeId: zod.z.string().min(1),
10875
10880
  schemaVersion: zod.z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),