@linnlabs/linnkit 0.33.0 → 0.35.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cli.cjs +155 -28
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +155 -28
  5. package/dist/cli.js.map +1 -1
  6. package/dist/context-manager.cjs +54 -0
  7. package/dist/context-manager.cjs.map +1 -1
  8. package/dist/context-manager.js +54 -0
  9. package/dist/context-manager.js.map +1 -1
  10. package/dist/index.cjs +175 -43
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.js +175 -43
  13. package/dist/index.js.map +1 -1
  14. package/dist/quickstart.cjs +155 -28
  15. package/dist/quickstart.cjs.map +1 -1
  16. package/dist/quickstart.js +155 -28
  17. package/dist/quickstart.js.map +1 -1
  18. package/dist/runtime-kernel/child-runs/childRunInvoker.d.cts +5 -0
  19. package/dist/runtime-kernel/child-runs/childRunInvoker.d.ts +5 -0
  20. package/dist/runtime-kernel/graph-engine/functions/parseEngineCheckpoint.d.cts +6 -0
  21. package/dist/runtime-kernel/graph-engine/functions/parseEngineCheckpoint.d.ts +6 -0
  22. package/dist/runtime-kernel/graph-engine/index.d.cts +1 -0
  23. package/dist/runtime-kernel/graph-engine/index.d.ts +1 -0
  24. package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.cts +22 -4
  25. package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.ts +22 -4
  26. package/dist/runtime-kernel/run-supervisor/index.d.cts +1 -1
  27. package/dist/runtime-kernel/run-supervisor/index.d.ts +1 -1
  28. package/dist/runtime-kernel/run-supervisor/runSupervisor.d.cts +2 -1
  29. package/dist/runtime-kernel/run-supervisor/runSupervisor.d.ts +2 -1
  30. package/dist/runtime-kernel.cjs +172 -40
  31. package/dist/runtime-kernel.cjs.map +1 -1
  32. package/dist/runtime-kernel.d.cts +1 -0
  33. package/dist/runtime-kernel.d.ts +1 -0
  34. package/dist/runtime-kernel.js +172 -41
  35. package/dist/runtime-kernel.js.map +1 -1
  36. package/dist/testkit.cjs +172 -40
  37. package/dist/testkit.cjs.map +1 -1
  38. package/dist/testkit.js +172 -40
  39. package/dist/testkit.js.map +1 -1
  40. package/docs/integration/child-runs.md +8 -0
  41. package/docs/integration/persistence.md +1 -0
  42. package/docs/integration/run-supervisor.md +3 -0
  43. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -119,6 +119,7 @@ __export(runtime_kernel_exports, {
119
119
  maxStepsForceFinalAnswerTemplate: () => maxStepsForceFinalAnswerTemplate,
120
120
  noopAudit: () => noopAudit,
121
121
  normalizeToolArgs: () => normalizeToolArgs,
122
+ parseEngineCheckpoint: () => parseEngineCheckpoint,
122
123
  parseToolModelInputDeclaration: () => parseToolModelInputDeclaration,
123
124
  periodicProgressReflectionTemplate: () => periodicProgressReflectionTemplate,
124
125
  phaseEqualsTrigger: () => phaseEqualsTrigger,
@@ -168,6 +169,7 @@ __export(graph_engine_exports, {
168
169
  evaluatePrimaryPromptCapacity: () => evaluatePrimaryPromptCapacity,
169
170
  isRunPauseSignal: () => isRunPauseSignal,
170
171
  isRuntimeFailureFact: () => isRuntimeFailureFact,
172
+ parseEngineCheckpoint: () => parseEngineCheckpoint,
171
173
  readCheckpointContextUsage: () => readCheckpointContextUsage,
172
174
  requireEventStoreId: () => requireEventStoreId,
173
175
  resolveEffectivePromptBudget: () => resolveEffectivePromptBudget,
@@ -4144,23 +4146,23 @@ var GraphExecutor = class {
4144
4146
  };
4145
4147
  }
4146
4148
  async saveCheckpoint(checkpointKey, state) {
4147
- const checkpoint = this.sanitize({
4149
+ const checkpoint2 = this.sanitize({
4148
4150
  ...state,
4149
4151
  revision: (state.revision ?? 0) + 1
4150
4152
  });
4151
- await this.commitCheckpoint(checkpointKey, checkpoint);
4152
- return checkpoint;
4153
+ await this.commitCheckpoint(checkpointKey, checkpoint2);
4154
+ return checkpoint2;
4153
4155
  }
4154
- async commitCheckpoint(checkpointKey, checkpoint) {
4156
+ async commitCheckpoint(checkpointKey, checkpoint2) {
4155
4157
  if (this.executionCheckpointPort) {
4156
- await this.executionCheckpointPort.commit(checkpointKey, checkpoint);
4158
+ await this.executionCheckpointPort.commit(checkpointKey, checkpoint2);
4157
4159
  } else {
4158
- await this.checkpointer.save(checkpointKey, checkpoint);
4160
+ await this.checkpointer.save(checkpointKey, checkpoint2);
4159
4161
  }
4160
4162
  }
4161
4163
  async saveCheckpointAndBuildResult(checkpointKey, state, events, stepCount) {
4162
- const checkpoint = await this.saveCheckpoint(checkpointKey, state);
4163
- return { events, checkpoint, stepCount };
4164
+ const checkpoint2 = await this.saveCheckpoint(checkpointKey, state);
4165
+ return { events, checkpoint: checkpoint2, stepCount };
4164
4166
  }
4165
4167
  async runUntilYieldInternal(checkpointKey, initialState, reportStepsUsed, maxSteps) {
4166
4168
  let state = initialState;
@@ -10304,16 +10306,16 @@ function requireEventStoreId(eventStoreId) {
10304
10306
  }
10305
10307
  function createMonotonicEventStoreIdFactory(nowProvider = () => Date.now()) {
10306
10308
  let lastTimestamp = 0;
10307
- let counter = 0;
10309
+ let counter2 = 0;
10308
10310
  return () => {
10309
10311
  const timestamp = Math.max(nowProvider(), lastTimestamp);
10310
10312
  if (timestamp === lastTimestamp) {
10311
- counter += 1;
10313
+ counter2 += 1;
10312
10314
  } else {
10313
10315
  lastTimestamp = timestamp;
10314
- counter = 0;
10316
+ counter2 = 0;
10315
10317
  }
10316
- return `${String(timestamp).padStart(13, "0")}-${String(counter).padStart(4, "0")}`;
10318
+ return `${String(timestamp).padStart(13, "0")}-${String(counter2).padStart(4, "0")}`;
10317
10319
  };
10318
10320
  }
10319
10321
 
@@ -10725,6 +10727,76 @@ function assertNonNegativeSafeInteger(value, field) {
10725
10727
  throw new Error(`${field} \u5FC5\u987B\u662F\u975E\u8D1F\u5B89\u5168\u6574\u6570\u3002`);
10726
10728
  }
10727
10729
  }
10730
+ var counter = z.number().int().nonnegative();
10731
+ var executor = z.object({
10732
+ stepCount: counter,
10733
+ phase: z.string().optional(),
10734
+ maxSteps: counter.optional(),
10735
+ remainingSteps: z.number().int().optional(),
10736
+ finalStepPolicy: z.enum(["final_answer", "force_tools"]).optional(),
10737
+ finalStepForcedTools: z.array(z.string()).optional(),
10738
+ lastStepsHintThreshold: counter.optional(),
10739
+ systemReminderPolicy: AgentSpecSystemReminderPolicy.optional(),
10740
+ toolObservationPolicy: AgentSpecToolObservationGovernancePolicy.optional(),
10741
+ runLockedModelId: z.string().optional(),
10742
+ lastSuccessfulLlmModelId: z.string().optional(),
10743
+ llmInvocationKind: z.enum(["user_initiated", "continuation"]).optional(),
10744
+ llmInvocationCount: counter.optional(),
10745
+ lockRequestedModelId: z.boolean().optional(),
10746
+ contextCompaction: z.object({
10747
+ attemptCount: counter,
10748
+ committedCount: counter,
10749
+ lastCommittedFingerprint: z.string().optional()
10750
+ }).strict().optional()
10751
+ }).strict();
10752
+ var checkpoint = z.object({
10753
+ nodeId: z.string().min(1),
10754
+ schemaVersion: z.literal(ENGINE_STATE_SCHEMA_VERSION).optional(),
10755
+ revision: counter.optional(),
10756
+ executionStatus: z.enum(["ready", "executing", "yielded", "awaiting_user"]).optional(),
10757
+ local: z.object({
10758
+ runId: RunIdSchema.optional(),
10759
+ parentRunId: RunIdSchema.optional(),
10760
+ conversationId: z.string().optional(),
10761
+ turnId: z.string().optional(),
10762
+ request: SerializableJsonRecord.optional(),
10763
+ history: z.array(RuntimeEvent).optional(),
10764
+ newEvents: z.array(RuntimeEvent).optional(),
10765
+ executorLocal: executor.optional(),
10766
+ pendingToolCalls: z.array(z.object({
10767
+ id: ToolCallIdSchema,
10768
+ type: z.literal("function"),
10769
+ function: z.object({ name: z.string().min(1), arguments: z.string() }).strict()
10770
+ }).strict()).optional(),
10771
+ executingToolCallId: ToolCallIdSchema.optional(),
10772
+ toolBatchCompletionMode: z.enum(["continue_to_llm", "yield_after_batch"]).optional(),
10773
+ pendingInteractionSpec: SerializableJsonRecord.optional(),
10774
+ lastToolResult: SerializableJsonRecord.optional(),
10775
+ finalAnswer: z.string().optional(),
10776
+ answerId: z.string().optional(),
10777
+ chunkSeq: counter.optional(),
10778
+ contextUsage: ContextUsageSnapshot.optional()
10779
+ }).passthrough().optional()
10780
+ }).strict();
10781
+ function parseEngineCheckpoint(value) {
10782
+ const result = checkpoint.parse(SerializableJsonRecord.parse(value));
10783
+ for (const key of [
10784
+ "memory",
10785
+ "signal",
10786
+ "toolContext",
10787
+ "runtimeEventSink",
10788
+ "runtimeEventCommitPort",
10789
+ "runtimeFailureFactSink",
10790
+ "summarizationCallbacks",
10791
+ "commitExecutionBoundary",
10792
+ "toolRecoveryPort"
10793
+ ]) {
10794
+ if (result.local && Object.hasOwn(result.local, key)) {
10795
+ throw new Error(`Checkpoint must not contain execution capability: ${key}`);
10796
+ }
10797
+ }
10798
+ return result;
10799
+ }
10728
10800
 
10729
10801
  // src/runtime-kernel/tools/index.ts
10730
10802
  var tools_exports = {};
@@ -11186,14 +11258,14 @@ var EventBusEventPersistence = class {
11186
11258
  checkpointWritesActive;
11187
11259
  checkpointEvents = [];
11188
11260
  /** Graph 的执行边界复用同一有序队列;没有第二条事件写入链。 */
11189
- async commitCheckpoint(checkpointKey, checkpoint) {
11261
+ async commitCheckpoint(checkpointKey, checkpoint2) {
11190
11262
  const writer = this.options.checkpointWriter;
11191
11263
  if (!writer || !this.checkpointWritesActive) throw new Error("Checkpoint writer is not active");
11192
11264
  const events = this.checkpointEvents;
11193
11265
  this.checkpointEvents = [];
11194
11266
  await this.enqueueWrite(() => writer({
11195
11267
  checkpointKey,
11196
- checkpoint,
11268
+ checkpoint: checkpoint2,
11197
11269
  events: events.map((event) => ({ event, eventStoreId: this.options.nextEventStoreId() }))
11198
11270
  }));
11199
11271
  }
@@ -12886,15 +12958,15 @@ function hasSeedHistoryPrefix(history, seedHistory) {
12886
12958
  }
12887
12959
  return true;
12888
12960
  }
12889
- function readCheckpointHistory(checkpoint) {
12890
- if (!checkpoint?.local) return [];
12891
- const history = checkpoint.local.history;
12961
+ function readCheckpointHistory(checkpoint2) {
12962
+ if (!checkpoint2?.local) return [];
12963
+ const history = checkpoint2.local.history;
12892
12964
  if (!Array.isArray(history)) return [];
12893
12965
  return parseRuntimeEvents(history);
12894
12966
  }
12895
12967
  async function recoverChildRunEventsFromCheckpoint(params) {
12896
- const checkpoint = await params.checkpointer.load(params.checkpointKey);
12897
- const history = readCheckpointHistory(checkpoint);
12968
+ const checkpoint2 = await params.checkpointer.load(params.checkpointKey);
12969
+ const history = readCheckpointHistory(checkpoint2);
12898
12970
  if (history.length === 0) {
12899
12971
  return [];
12900
12972
  }
@@ -12940,10 +13012,10 @@ var ChildRunInvoker = class {
12940
13012
  runtimeEventSink,
12941
13013
  runtimeEventCommitPort,
12942
13014
  seedHistoryEvents,
12943
- maxSteps = 8,
12944
13015
  modelId,
12945
13016
  abortSignal
12946
13017
  } = config;
13018
+ const maxSteps = config.initialInput?.request.maxSteps ?? config.maxSteps ?? 8;
12947
13019
  const childRunId = runId ?? generateRunId();
12948
13020
  const internalCheckpointKey = childRunId;
12949
13021
  const resolvedParentRunId = parentRunId ?? parentToolContext.runId;
@@ -12988,7 +13060,8 @@ var ChildRunInvoker = class {
12988
13060
  if (config.persistence?.expectedRevision !== void 0) {
12989
13061
  return this.continueChild(config, childRunId, runtimeConversationId);
12990
13062
  }
12991
- const turnId = generateTurnId();
13063
+ const turnId = config.initialInput?.turnId ?? generateTurnId();
13064
+ if (config.initialInput && (!turnId.trim() || config.initialInput.request.query !== userMessage || config.initialInput.request.promptKey !== agentConfig.promptKey || !config.initialInput.request.model_id)) throw new Error("Child initial input does not match the admitted invocation");
12992
13065
  logger17.info(`\u542F\u52A8 child-run: ${agentConfig.id}`, {
12993
13066
  conversationId: runtimeConversationId,
12994
13067
  checkpointKey: internalCheckpointKey,
@@ -13005,11 +13078,14 @@ var ChildRunInvoker = class {
13005
13078
  });
13006
13079
  const admittedChildUserInput = runtimeEventSink(childUserInput, "ChildRunInvoker.user_input");
13007
13080
  const childModelId = resolveChildRunModelId({
13008
- explicitModelId: modelId,
13081
+ explicitModelId: config.initialInput?.request.model_id ?? modelId,
13009
13082
  agentConfig,
13010
13083
  resolveDefaultModelId: () => this.modelResolver.resolveModelId()
13011
13084
  });
13012
- const request = {
13085
+ const request = config.initialInput ? {
13086
+ ...config.initialInput.request,
13087
+ currentUserEventId: admittedChildUserInput.id
13088
+ } : {
13013
13089
  query: userMessage,
13014
13090
  currentUserEventId: admittedChildUserInput.id,
13015
13091
  promptKey: agentConfig.promptKey,
@@ -13190,9 +13266,9 @@ var ChildRunInvoker = class {
13190
13266
  async continueChild(config, runId, conversationId) {
13191
13267
  const persistence = config.persistence;
13192
13268
  if (!persistence || persistence.expectedRevision === void 0) throw new Error("Missing child continuation contract");
13193
- const checkpoint = await persistence.checkpointer.load(runId);
13194
- if (!checkpoint || checkpoint.local?.conversationId !== conversationId) throw new Error("Child checkpoint identity mismatch");
13195
- const local = readGraphAgentLocal({ ...checkpoint.local, runtimeEventSink: config.runtimeEventSink });
13269
+ const checkpoint2 = await persistence.checkpointer.load(runId);
13270
+ if (!checkpoint2 || checkpoint2.local?.conversationId !== conversationId) throw new Error("Child checkpoint identity mismatch");
13271
+ const local = readGraphAgentLocal({ ...checkpoint2.local, runtimeEventSink: config.runtimeEventSink });
13196
13272
  const request = local.request;
13197
13273
  if (!request || !local.turnId || !request.model_id) throw new Error("Child recovery input is incomplete");
13198
13274
  const context = createChildRunToolContext({
@@ -14469,7 +14545,15 @@ function createRunConcurrencyKeyRegistry() {
14469
14545
  runIdByKey.delete(concurrencyKey);
14470
14546
  }
14471
14547
  }
14472
- return { acquire, release };
14548
+ function transfer(previous, next, concurrencyKey) {
14549
+ if (runIdByKey.get(concurrencyKey) !== previous || keyByRunId.has(next)) {
14550
+ throw new RunConcurrencyKeyOccupiedError(concurrencyKey, runIdByKey.get(concurrencyKey) ?? previous, next);
14551
+ }
14552
+ keyByRunId.delete(previous);
14553
+ keyByRunId.set(next, concurrencyKey);
14554
+ runIdByKey.set(concurrencyKey, next);
14555
+ }
14556
+ return { acquire, release, transfer };
14473
14557
  }
14474
14558
 
14475
14559
  // src/runtime-kernel/run-supervisor/functions/runRegistration.ts
@@ -14718,6 +14802,9 @@ var DefaultRunSupervisor = class {
14718
14802
  });
14719
14803
  }
14720
14804
  async registerRun(spec) {
14805
+ if (spec.replacesPausedRun) {
14806
+ return this.withRunControlLock(spec.replacesPausedRun.runId, () => this.registerPausedReplacement(spec));
14807
+ }
14721
14808
  const runId = spec.runId ?? this.runIdFactory();
14722
14809
  if (this.handles.has(runId) || await this.registryStore.load(runId)) {
14723
14810
  throw new RunAlreadyRegisteredError(runId);
@@ -14728,13 +14815,51 @@ var DefaultRunSupervisor = class {
14728
14815
  forwardParentAbortSignal(controller, spec.parentSignal);
14729
14816
  const record = createInitialRunRecord({ runId, spec, startedAt });
14730
14817
  try {
14731
- await this.registryStore.save(record);
14818
+ if (spec.admissionCommit) await spec.admissionCommit(record);
14819
+ else await this.registryStore.save(record);
14732
14820
  } catch (error) {
14733
14821
  this.releaseRunAdmission(runId);
14734
14822
  throw error;
14735
14823
  }
14736
14824
  return this.attachRun(record, spec, controller);
14737
14825
  }
14826
+ async registerPausedReplacement(spec) {
14827
+ const target = spec.replacesPausedRun;
14828
+ if (!target || !spec.concurrencyKey || !spec.admissionCommit || !this.registryStore.compareAndSwap) {
14829
+ throw new Error("Paused replacement requires concurrency identity and atomic admissionCommit");
14830
+ }
14831
+ this.getHandle(target.runId);
14832
+ const previous = await this.registryStore.load(target.runId);
14833
+ if (!previous || previous.status !== "paused" || previous.pausedAt === void 0 || previous.updatedAt !== target.expectedUpdatedAt || previous.metadata?.executionId !== target.expectedExecutionId || previous.conversationId !== spec.conversationId || previous.parentRunId !== spec.parentRunId) {
14834
+ throw new RunInteractionConflictError(target.runId, "replacement does not match the settled pause");
14835
+ }
14836
+ const runId = spec.runId ?? this.runIdFactory();
14837
+ if (this.handles.has(runId) || await this.registryStore.load(runId)) throw new RunAlreadyRegisteredError(runId);
14838
+ this.runConcurrencyKeys.transfer(previous.runId, runId, spec.concurrencyKey);
14839
+ this.runSlotLimiter.release(previous.runId);
14840
+ this.runSlotLimiter.acquire(runId);
14841
+ const now = this.now();
14842
+ const record = createInitialRunRecord({ runId, spec, startedAt: now });
14843
+ const next = {
14844
+ ...previous,
14845
+ status: "cancelled",
14846
+ updatedAt: now,
14847
+ errorIfAny: { errorCode: "RUN_REPLACED", message: "Replaced by a newly accepted request", recoverable: false }
14848
+ };
14849
+ try {
14850
+ await spec.admissionCommit(record, { previous, next });
14851
+ } catch (error) {
14852
+ this.runSlotLimiter.release(runId);
14853
+ this.runSlotLimiter.acquire(previous.runId);
14854
+ this.runConcurrencyKeys.transfer(runId, previous.runId, spec.concurrencyKey);
14855
+ throw error;
14856
+ }
14857
+ this.cleanupRunResources(previous.runId);
14858
+ this.notifyTerminalWaiters(previous.runId);
14859
+ const controller = new AbortController();
14860
+ forwardParentAbortSignal(controller, spec.parentSignal);
14861
+ return this.attachRun(record, spec, controller);
14862
+ }
14738
14863
  async restoreRun(spec) {
14739
14864
  if (!this.registryStore.compareAndSwap) throw new Error("Run restoration requires atomic registry transitions");
14740
14865
  return this.withRunControlLock(spec.runId, async () => {
@@ -14858,7 +14983,7 @@ var DefaultRunSupervisor = class {
14858
14983
  return this.withRunControlLock(input.runId, async () => {
14859
14984
  const handle = this.getHandle(input.runId);
14860
14985
  const record = await this.registryStore.load(input.runId);
14861
- if (!record || record.status !== "paused" || record.pausedAt === void 0 || record.updatedAt !== input.expectedUpdatedAt) {
14986
+ if (!record || record.status !== "paused" || record.pausedAt === void 0 || record.updatedAt !== input.expectedUpdatedAt || input.expectedExecutionId !== void 0 && record.metadata?.executionId !== input.expectedExecutionId) {
14862
14987
  throw new RunInteractionConflictError(input.runId, "run is not settled at the expected pause");
14863
14988
  }
14864
14989
  await persistRunTransition(this.registryStore, record, {
@@ -14871,6 +14996,7 @@ var DefaultRunSupervisor = class {
14871
14996
  metadata: { ...record.metadata, executionId: input.executionId }
14872
14997
  });
14873
14998
  const controller = new AbortController();
14999
+ forwardParentAbortSignal(controller, input.parentSignal);
14874
15000
  handle.replaceExecutionAbortController(controller, input.executionId);
14875
15001
  handle.attachTransportEventBus(input.eventBus);
14876
15002
  this.controllers.set(input.runId, controller);
@@ -14999,7 +15125,7 @@ var DefaultRunSupervisor = class {
14999
15125
  }
15000
15126
  const awaitingUserWithoutClaim = { ...awaitingUser };
15001
15127
  Reflect.deleteProperty(awaitingUserWithoutClaim, "resumeClaim");
15002
- await persistRunTransition(this.registryStore, record, {
15128
+ const nextRecord = {
15003
15129
  ...record,
15004
15130
  status: "running",
15005
15131
  updatedAt: this.now(),
@@ -15009,6 +15135,10 @@ var DefaultRunSupervisor = class {
15009
15135
  metadata: {
15010
15136
  ...record.metadata ?? {},
15011
15137
  ...execution ? { executionId: execution.executionId } : {},
15138
+ ...execution?.inputEventIds ? { resumeInputs: {
15139
+ eventIds: [...execution.inputEventIds],
15140
+ checkpointRevision: pendingInteraction.checkpointRevision
15141
+ } } : {},
15012
15142
  awaitingUser: {
15013
15143
  ...awaitingUserWithoutClaim,
15014
15144
  interaction: {
@@ -15017,7 +15147,9 @@ var DefaultRunSupervisor = class {
15017
15147
  }
15018
15148
  }
15019
15149
  }
15020
- });
15150
+ };
15151
+ if (execution?.admissionCommit) await execution.admissionCommit(record, nextRecord);
15152
+ else await persistRunTransition(this.registryStore, record, nextRecord);
15021
15153
  const executionController = new AbortController();
15022
15154
  forwardParentAbortSignal(executionController, parentSignal);
15023
15155
  handle.replaceExecutionAbortController(executionController, execution?.executionId ?? (typeof record.metadata?.executionId === "string" ? record.metadata.executionId : void 0));
@@ -15183,13 +15315,13 @@ __export(system_reminder_exports, {
15183
15315
 
15184
15316
  // src/runtime-kernel/testkit/defaultGraphExecutor.ts
15185
15317
  function createDefaultGraphExecutor(options) {
15186
- const executor = new GraphExecutor(
15318
+ const executor2 = new GraphExecutor(
15187
15319
  options.checkpointer ?? new MemoryCheckpointer(),
15188
15320
  { maxSteps: options.maxSteps ?? 8 }
15189
15321
  );
15190
- executor.registerNode(new UserNode());
15191
- executor.registerNode(options.llmNode);
15192
- executor.registerNode(new ToolNode({
15322
+ executor2.registerNode(new UserNode());
15323
+ executor2.registerNode(options.llmNode);
15324
+ executor2.registerNode(new ToolNode({
15193
15325
  toolRuntime: options.toolRuntime,
15194
15326
  observationPreview: options.observationPreview,
15195
15327
  auditPort: options.auditPort,
@@ -15197,8 +15329,8 @@ function createDefaultGraphExecutor(options) {
15197
15329
  modelInputCapabilityValidator: options.modelInputCapabilityValidator,
15198
15330
  modelInputResolver: options.modelInputResolver
15199
15331
  }));
15200
- executor.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
15201
- return executor;
15332
+ executor2.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
15333
+ return executor2;
15202
15334
  }
15203
15335
 
15204
15336
  // src/runtime-kernel/testkit/graphLoopHarness.ts
@@ -15223,7 +15355,7 @@ function createGraphLoopHarness(options) {
15223
15355
  return {
15224
15356
  async run() {
15225
15357
  const checkpointKey = options.runId ?? options.turnId;
15226
- const executor = createDefaultGraphExecutor({
15358
+ const executor2 = createDefaultGraphExecutor({
15227
15359
  llmNode: options.createLlmNode({
15228
15360
  llmCaller: options.llmCaller,
15229
15361
  toolRuntime: options.toolRuntime
@@ -15253,8 +15385,8 @@ function createGraphLoopHarness(options) {
15253
15385
  signal: options.signal ?? options.toolContext.abortSignal,
15254
15386
  executorLocal
15255
15387
  };
15256
- await executor.prime(checkpointKey, local, "user");
15257
- const result = await executor.runUntilYield(checkpointKey);
15388
+ await executor2.prime(checkpointKey, local, "user");
15389
+ const result = await executor2.runUntilYield(checkpointKey);
15258
15390
  return {
15259
15391
  checkpointNodeId: result.checkpoint.nodeId,
15260
15392
  stepCount: result.stepCount,
@@ -15666,7 +15798,7 @@ async function runAgent(agent, options) {
15666
15798
  contextBuilder: new QuickstartContextBuilder(agent),
15667
15799
  telemetryPort
15668
15800
  });
15669
- const executor = createDefaultGraphExecutor({
15801
+ const executor2 = createDefaultGraphExecutor({
15670
15802
  llmNode: new LlmNode({ reasoner }),
15671
15803
  toolRuntime,
15672
15804
  observationPreview: createNoopObservationPreview(),
@@ -15702,7 +15834,7 @@ async function runAgent(agent, options) {
15702
15834
  };
15703
15835
  await handle.markRunning({ currentNode: "user" });
15704
15836
  try {
15705
- await executor.prime(checkpointKey, {
15837
+ await executor2.prime(checkpointKey, {
15706
15838
  conversationId,
15707
15839
  turnId,
15708
15840
  request: {
@@ -15719,7 +15851,7 @@ async function runAgent(agent, options) {
15719
15851
  signal: handle.signal,
15720
15852
  runtimeEventSink: (event, source) => publisher.publish(event, source)
15721
15853
  });
15722
- const result = await executor.runUntilYield(checkpointKey);
15854
+ const result = await executor2.runUntilYield(checkpointKey);
15723
15855
  await Promise.all([callbackTail, persistenceTail]);
15724
15856
  await handle.markCompleted({
15725
15857
  currentNode: result.checkpoint.nodeId,