@sublang/playbook 1.0.0 → 2.0.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.
@@ -1,5 +1,6 @@
1
1
  import { type AnyActorRef, type PromiseActorLogic, type SnapshotFrom } from 'xstate';
2
2
  import type { CaptainResult, JsonValue, NormalizedError, PlaybookCallRequest, PlaybookCallResult, PlaybookCallStart, PlaybookPendingCall, PlaybookRuntimeSnapshot, PlaybookSession, PlaybookState, PlayerResult } from './runtime.js';
3
+ export * from './xstate-playbook-runtime.js';
3
4
  /**
4
5
  * Compose invocation-lifetime and imperative-boundary cancellation without
5
6
  * installing a second forwarding listener in each generated runtime.
@@ -1,6 +1,10 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
3
  import { fromPromise, waitFor, } from 'xstate';
4
+ // DR-019: the generic linked-runtime factory and its strategy helpers live
5
+ // in the sibling module and are re-exported here so linked artifacts import
6
+ // one shared engine surface.
7
+ export * from './xstate-playbook-runtime.js';
4
8
  const BUSY_TAG = 'playbook.busy';
5
9
  const SUSPENDED_TAG = 'playbook.suspended';
6
10
  function deferred() {
@@ -514,6 +518,13 @@ export function assertPlaybookRuntimeSnapshot(value, expectedPlaybookId) {
514
518
  }
515
519
  sequences[key] = sequence;
516
520
  }
521
+ const captainCall = value.sequences.captainCall;
522
+ if (captainCall !== undefined) {
523
+ if (!Number.isSafeInteger(captainCall) || captainCall < 0) {
524
+ throw new TypeError('runtime snapshot sequences.captainCall must be a non-negative integer');
525
+ }
526
+ sequences.captainCall = captainCall;
527
+ }
517
528
  validateState(value.state, 'runtime snapshot state');
518
529
  const state = snapshotJsonValue(value.state, 'runtime snapshot state');
519
530
  if (!Array.isArray(value.pendingBossQuestions)) {
@@ -25,6 +25,11 @@ import type {
25
25
  PlayerResult,
26
26
  } from './runtime.js';
27
27
 
28
+ // DR-019: the generic linked-runtime factory and its strategy helpers live
29
+ // in the sibling module and are re-exported here so linked artifacts import
30
+ // one shared engine surface.
31
+ export * from './xstate-playbook-runtime.js';
32
+
28
33
  const BUSY_TAG = 'playbook.busy';
29
34
  const SUSPENDED_TAG = 'playbook.suspended';
30
35
 
@@ -738,6 +743,15 @@ export function assertPlaybookRuntimeSnapshot(
738
743
  }
739
744
  sequences[key] = sequence as number;
740
745
  }
746
+ const captainCall = value.sequences.captainCall;
747
+ if (captainCall !== undefined) {
748
+ if (!Number.isSafeInteger(captainCall) || (captainCall as number) < 0) {
749
+ throw new TypeError(
750
+ 'runtime snapshot sequences.captainCall must be a non-negative integer',
751
+ );
752
+ }
753
+ sequences.captainCall = captainCall as number;
754
+ }
741
755
  validateState(value.state, 'runtime snapshot state');
742
756
  const state = snapshotJsonValue(
743
757
  value.state,