@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/CHANGELOG.md CHANGED
@@ -12,6 +12,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
 
13
13
  ---
14
14
 
15
+ ## [Unreleased]
16
+
17
+ ---
18
+
19
+ ## [0.46.0] - 2026-11-26
20
+
21
+ ### Added
22
+
23
+ - `ToolExecutionContext.activeModelId`: the model that will receive this tool
24
+ result, set by ToolNode before each tool runs. It equals `modelId` until a
25
+ cloud quota fallback locks the run to the fallback model, and then names the
26
+ fallback model. Hosts deciding whether a tool result may carry images should
27
+ read it instead of `modelId`; otherwise a text-only fallback model gets an
28
+ image and the next LLM call fails input preflight. It is a runtime-reserved
29
+ key, so Host tool-context patches cannot set it.
30
+
31
+ ### Removed
32
+
33
+ - `ExecutorLocalState.lastSuccessfulLlmModelId` and its `ExecutorLocalPatch`
34
+ key. The LLM stage still wrote it, but nothing has read it since 0.42.0.
35
+ Checkpoints saved by 0.45.0 and earlier that carry the field still load; the
36
+ value is dropped on load.
37
+
38
+ ### Documentation
39
+
40
+ - Tool development guide §7.4 now spells out why the Host must decide about
41
+ returning images before the tool runs: once an image reaches history, every
42
+ later LLM call on a route without image input fails preflight.
43
+
44
+ ---
45
+
15
46
  ## [0.45.0] - 2026-11-21
16
47
 
17
48
  ### Added
package/dist/cli.cjs CHANGED
@@ -5051,13 +5051,11 @@ function createExecuteLlmStage(dependencies) {
5051
5051
  "llmCallStartedAt",
5052
5052
  "llmResp",
5053
5053
  "llmCallDurationMs",
5054
- "executorLocalPatch",
5055
5054
  "contextUsage"
5056
5055
  ],
5057
5056
  async run(ctx) {
5058
5057
  let cloudQuotaFallbackAppliedModelId;
5059
5058
  let modelFallbackAudit;
5060
- let lastSuccessfulLlmModelId;
5061
5059
  let contextUsage;
5062
5060
  const modelFallbackRejections = [];
5063
5061
  const promptBudget = ctx.promptBudget;
@@ -5078,8 +5076,7 @@ function createExecuteLlmStage(dependencies) {
5078
5076
  onCloudQuotaFallbackApplied(fallbackModelId) {
5079
5077
  cloudQuotaFallbackAppliedModelId = readNonEmptyString3(fallbackModelId);
5080
5078
  },
5081
- onLlmAttemptSucceeded(activeModelId, attemptContextUsage) {
5082
- lastSuccessfulLlmModelId = readNonEmptyString3(activeModelId);
5079
+ onLlmAttemptSucceeded(_activeModelId, attemptContextUsage) {
5083
5080
  contextUsage = attemptContextUsage;
5084
5081
  },
5085
5082
  onModelFallbackApplied(info) {
@@ -5180,7 +5177,6 @@ function createExecuteLlmStage(dependencies) {
5180
5177
  llmCallStartedAt,
5181
5178
  llmResp,
5182
5179
  llmCallDurationMs,
5183
- executorLocalPatch: lastSuccessfulLlmModelId ? { lastSuccessfulLlmModelId } : void 0,
5184
5180
  contextUsage
5185
5181
  };
5186
5182
  }
@@ -8362,6 +8358,12 @@ function parseToolArgs(call) {
8362
8358
  };
8363
8359
  }
8364
8360
  }
8361
+ function readRunLockedModelId(local) {
8362
+ const executorLocal = local.executorLocal;
8363
+ if (!isRecord9(executorLocal)) return void 0;
8364
+ const lockedModelId = executorLocal.runLockedModelId;
8365
+ return typeof lockedModelId === "string" && lockedModelId.trim() ? lockedModelId : void 0;
8366
+ }
8365
8367
  function prepareToolNodeContext(state) {
8366
8368
  const local = state.local || {};
8367
8369
  const toolContext = isRecord9(local.toolContext) ? local.toolContext : {};
@@ -8379,6 +8381,7 @@ function prepareToolNodeContext(state) {
8379
8381
  }
8380
8382
  });
8381
8383
  attachWorkingHistoryView({ state, toolContext });
8384
+ toolContext.activeModelId = readRunLockedModelId(local) ?? toolContext.modelId;
8382
8385
  return {
8383
8386
  state,
8384
8387
  local,
@@ -9644,6 +9647,7 @@ var executor = zod.z.object({
9644
9647
  systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
9645
9648
  toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
9646
9649
  runLockedModelId: zod.z.string().optional(),
9650
+ // 0.45 及更早的 checkpoint 可能带这个已删除字段;照常接受,读入时丢弃。
9647
9651
  lastSuccessfulLlmModelId: zod.z.string().optional(),
9648
9652
  llmInvocationKind: zod.z.enum(["user_initiated", "continuation"]).optional(),
9649
9653
  llmInvocationCount: counter.optional(),
@@ -9653,7 +9657,7 @@ var executor = zod.z.object({
9653
9657
  committedCount: counter,
9654
9658
  lastCommittedFingerprint: zod.z.string().optional()
9655
9659
  }).strict().optional()
9656
- }).strict();
9660
+ }).strict().transform(({ lastSuccessfulLlmModelId: _retired, ...state }) => state);
9657
9661
  var checkpoint = zod.z.object({
9658
9662
  nodeId: zod.z.string().min(1),
9659
9663
  schemaVersion: zod.z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),