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