@linnlabs/linnkit 0.35.0 → 0.36.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.
@@ -3201,13 +3201,21 @@ var GraphExecutor = class {
3201
3201
  if (existing) {
3202
3202
  throw new Error(`Graph checkpoint already exists: ${checkpointKey}`);
3203
3203
  }
3204
- this.ephemeralLocals.set(checkpointKey, { ...local });
3204
+ const initialLocal = this.executionCheckpointPort ? {
3205
+ ...local,
3206
+ executorLocal: {
3207
+ ...isRecord4(local.executorLocal) ? local.executorLocal : {},
3208
+ stepCount: 0,
3209
+ maxSteps: options.maxSteps ?? this.config.maxSteps
3210
+ }
3211
+ } : local;
3212
+ this.ephemeralLocals.set(checkpointKey, { ...initialLocal });
3205
3213
  await this.commitCheckpoint(checkpointKey, {
3206
3214
  nodeId,
3207
3215
  ...this.executionCheckpointPort ? { executionStatus: "ready" } : {},
3208
3216
  revision: 1,
3209
3217
  schemaVersion: ENGINE_STATE_SCHEMA_VERSION,
3210
- local: sanitizeCheckpointLocal(local)
3218
+ local: sanitizeCheckpointLocal(initialLocal)
3211
3219
  });
3212
3220
  return this.runUntilYieldQueued(
3213
3221
  checkpointKey,
@@ -12051,7 +12059,7 @@ function createAwaitingUserWatcher(options) {
12051
12059
  const onClose = () => {
12052
12060
  dispose();
12053
12061
  };
12054
- eventBus.on("event", onEvent);
12062
+ if (options.stateOwner !== "host") eventBus.on("event", onEvent);
12055
12063
  eventBus.on("close", onClose);
12056
12064
  return dispose;
12057
12065
  }
@@ -12527,6 +12535,7 @@ var DefaultRunSupervisor = class {
12527
12535
  this.runSlotLimiter = createRunSlotLimiter({ maxActiveRuns: options.maxActiveRuns });
12528
12536
  this.runConcurrencyKeys = createRunConcurrencyKeyRegistry();
12529
12537
  this.awaitingUserWatcher = createAwaitingUserWatcher({
12538
+ stateOwner: options.awaitingUserStateOwner,
12530
12539
  markAwaitingUser: (runId, patch) => this.getHandle(runId).markAwaitingUser(patch),
12531
12540
  onDisposed: (runId) => {
12532
12541
  this.eventWatchDisposers.delete(runId);
@@ -12723,8 +12732,17 @@ var DefaultRunSupervisor = class {
12723
12732
  canRestoreRun: this.canRestoreRun
12724
12733
  });
12725
12734
  }
12726
- async pause(runId, reason) {
12727
- await this.withRunControlLock(runId, () => this.getHandle(runId).pause(reason));
12735
+ async pause(runId, reason, expectedExecutionId) {
12736
+ await this.withRunControlLock(runId, async () => {
12737
+ const handle = this.getHandle(runId);
12738
+ if (expectedExecutionId !== void 0) {
12739
+ const record = await this.registryStore.load(runId);
12740
+ if (record?.metadata?.executionId !== expectedExecutionId) {
12741
+ throw new RunInteractionConflictError(runId, "pause execution ownership has changed");
12742
+ }
12743
+ }
12744
+ await handle.pause(reason);
12745
+ });
12728
12746
  }
12729
12747
  async resumePausedRun(input) {
12730
12748
  return this.withRunControlLock(input.runId, async () => {