@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.
package/dist/cli.js CHANGED
@@ -3085,13 +3085,21 @@ var GraphExecutor = class {
3085
3085
  if (existing) {
3086
3086
  throw new Error(`Graph checkpoint already exists: ${checkpointKey}`);
3087
3087
  }
3088
- this.ephemeralLocals.set(checkpointKey, { ...local });
3088
+ const initialLocal = this.executionCheckpointPort ? {
3089
+ ...local,
3090
+ executorLocal: {
3091
+ ...isRecord4(local.executorLocal) ? local.executorLocal : {},
3092
+ stepCount: 0,
3093
+ maxSteps: options.maxSteps ?? this.config.maxSteps
3094
+ }
3095
+ } : local;
3096
+ this.ephemeralLocals.set(checkpointKey, { ...initialLocal });
3089
3097
  await this.commitCheckpoint(checkpointKey, {
3090
3098
  nodeId,
3091
3099
  ...this.executionCheckpointPort ? { executionStatus: "ready" } : {},
3092
3100
  revision: 1,
3093
3101
  schemaVersion: ENGINE_STATE_SCHEMA_VERSION,
3094
- local: sanitizeCheckpointLocal(local)
3102
+ local: sanitizeCheckpointLocal(initialLocal)
3095
3103
  });
3096
3104
  return this.runUntilYieldQueued(
3097
3105
  checkpointKey,
@@ -11935,7 +11943,7 @@ function createAwaitingUserWatcher(options) {
11935
11943
  const onClose = () => {
11936
11944
  dispose();
11937
11945
  };
11938
- eventBus.on("event", onEvent);
11946
+ if (options.stateOwner !== "host") eventBus.on("event", onEvent);
11939
11947
  eventBus.on("close", onClose);
11940
11948
  return dispose;
11941
11949
  }
@@ -12411,6 +12419,7 @@ var DefaultRunSupervisor = class {
12411
12419
  this.runSlotLimiter = createRunSlotLimiter({ maxActiveRuns: options.maxActiveRuns });
12412
12420
  this.runConcurrencyKeys = createRunConcurrencyKeyRegistry();
12413
12421
  this.awaitingUserWatcher = createAwaitingUserWatcher({
12422
+ stateOwner: options.awaitingUserStateOwner,
12414
12423
  markAwaitingUser: (runId, patch) => this.getHandle(runId).markAwaitingUser(patch),
12415
12424
  onDisposed: (runId) => {
12416
12425
  this.eventWatchDisposers.delete(runId);
@@ -12607,8 +12616,17 @@ var DefaultRunSupervisor = class {
12607
12616
  canRestoreRun: this.canRestoreRun
12608
12617
  });
12609
12618
  }
12610
- async pause(runId, reason) {
12611
- await this.withRunControlLock(runId, () => this.getHandle(runId).pause(reason));
12619
+ async pause(runId, reason, expectedExecutionId) {
12620
+ await this.withRunControlLock(runId, async () => {
12621
+ const handle = this.getHandle(runId);
12622
+ if (expectedExecutionId !== void 0) {
12623
+ const record = await this.registryStore.load(runId);
12624
+ if (record?.metadata?.executionId !== expectedExecutionId) {
12625
+ throw new RunInteractionConflictError(runId, "pause execution ownership has changed");
12626
+ }
12627
+ }
12628
+ await handle.pause(reason);
12629
+ });
12612
12630
  }
12613
12631
  async resumePausedRun(input) {
12614
12632
  return this.withRunControlLock(input.runId, async () => {