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