@sublang/playbook 7.0.0 → 9.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.
Files changed (62) hide show
  1. package/README.md +20 -7
  2. package/docs/cli.md +88 -43
  3. package/docs/configuration.md +221 -119
  4. package/docs/embedding.md +78 -27
  5. package/package.json +4 -3
  6. package/reference/sdlc/captain.playbook/captain.playbook.js +16 -5
  7. package/reference/sdlc/captain.playbook/captain.playbook.ts +20 -6
  8. package/reference/sdlc/code.md +1 -1
  9. package/reference/sdlc/code.playbook/bin/interactive-session.js +816 -0
  10. package/reference/sdlc/code.playbook/bin/launch-config.js +1078 -116
  11. package/reference/sdlc/code.playbook/bin/playbook.js +489 -34
  12. package/reference/sdlc/code.playbook/bin/run.js +283 -298
  13. package/reference/sdlc/code.playbook/bin/session-store.js +818 -26
  14. package/reference/sdlc/code.playbook/code.fsm.d.ts +9 -6
  15. package/reference/sdlc/code.playbook/code.fsm.introspect.js +2 -2
  16. package/reference/sdlc/code.playbook/code.fsm.introspect.ts +2 -2
  17. package/reference/sdlc/code.playbook/code.fsm.js +18 -15
  18. package/reference/sdlc/code.playbook/code.fsm.ts +21 -21
  19. package/reference/sdlc/code.playbook/code.gears.md +1 -1
  20. package/reference/sdlc/code.playbook/code.playbook.d.ts +2 -1
  21. package/reference/sdlc/code.playbook/code.playbook.js +25 -15
  22. package/reference/sdlc/code.playbook/code.playbook.ts +34 -17
  23. package/reference/sdlc/code.playbook/code.registry.d.ts +5 -13
  24. package/reference/sdlc/code.playbook/code.registry.js +3 -10
  25. package/reference/sdlc/code.playbook/code.registry.ts +7 -32
  26. package/reference/sdlc/code.playbook/playbook-captain.d.ts +39 -14
  27. package/reference/sdlc/code.playbook/playbook-captain.js +1014 -299
  28. package/reference/sdlc/code.playbook/playbook-captain.ts +1450 -406
  29. package/reference/sdlc/code.playbook/playbook.config.template.yaml +41 -49
  30. package/reference/sdlc/decide.md +4 -4
  31. package/reference/sdlc/decide.playbook/decide.fsm.d.ts +10 -10
  32. package/reference/sdlc/decide.playbook/decide.fsm.js +21 -14
  33. package/reference/sdlc/decide.playbook/decide.fsm.ts +27 -23
  34. package/reference/sdlc/decide.playbook/decide.gears.md +3 -5
  35. package/reference/sdlc/decide.playbook/decide.playbook.d.ts +11 -13
  36. package/reference/sdlc/decide.playbook/decide.playbook.js +465 -246
  37. package/reference/sdlc/decide.playbook/decide.playbook.ts +623 -283
  38. package/reference/sdlc/decide.playbook/decide.registry.d.ts +5 -13
  39. package/reference/sdlc/decide.playbook/decide.registry.js +3 -9
  40. package/reference/sdlc/decide.playbook/decide.registry.ts +7 -31
  41. package/reference/sdlc/review.md +4 -5
  42. package/reference/sdlc/review.playbook/review.fsm.d.ts +9 -11
  43. package/reference/sdlc/review.playbook/review.fsm.js +30 -24
  44. package/reference/sdlc/review.playbook/review.fsm.ts +39 -35
  45. package/reference/sdlc/review.playbook/review.gears.md +6 -5
  46. package/reference/sdlc/review.playbook/review.playbook.d.ts +2 -1
  47. package/reference/sdlc/review.playbook/review.playbook.js +29 -23
  48. package/reference/sdlc/review.playbook/review.playbook.ts +38 -28
  49. package/reference/sdlc/review.playbook/review.registry.d.ts +5 -13
  50. package/reference/sdlc/review.playbook/review.registry.js +3 -16
  51. package/reference/sdlc/review.playbook/review.registry.ts +7 -38
  52. package/slc/gears2fsm.md +45 -24
  53. package/slc/link.md +297 -135
  54. package/slc/text2gears.md +19 -18
  55. package/src/runtime.d.ts +21 -16
  56. package/src/runtime.ts +20 -23
  57. package/src/xstate-playbook-runtime.d.ts +34 -20
  58. package/src/xstate-playbook-runtime.js +973 -400
  59. package/src/xstate-playbook-runtime.ts +1203 -457
  60. package/src/xstate-runtime.d.ts +17 -7
  61. package/src/xstate-runtime.js +198 -81
  62. package/src/xstate-runtime.ts +339 -112
package/slc/text2gears.md CHANGED
@@ -18,24 +18,24 @@ The second phase (spec items → state machine) is out of scope.
18
18
  | source | text | .md |
19
19
  | target | gears | .md |
20
20
 
21
- ## Players
21
+ ## Roles
22
22
 
23
- Players name AI agents and the user.
23
+ Roles name playbook-local delegated work functions.
24
24
 
25
- Two default players:
25
+ Two fixed actors remain outside the role list:
26
26
 
27
27
  - Boss: the human user
28
28
  - Captain: the coordinating agent
29
29
 
30
- Source may declare additional players in an opening `Players:` section.
31
- A player may alias other players with `=` and `|`; Boss picks one at runtime.
30
+ Source may declare delegated roles in an opening `Roles:` section.
31
+ Each role shall be unique and shall not alias another role; concrete player selection and sharing belong to explicit host configuration.
32
+ Role names shall also be unique after canonical lowercase-id derivation, so declarations such as `Coder` and `coder` reject rather than collapse to one manifest role.
32
33
  E.g.:
33
34
 
34
35
  - Coder
35
36
  - Reviewer
36
- - Committer = Coder | Reviewer
37
37
 
38
- Capitalize English player names (e.g., `Writer`); quote non-English names (e.g., `作者`) when needed to distinguish from prose.
38
+ Capitalize English role names (e.g., `Writer`); quote non-English names (e.g., `作者`) when needed to distinguish from prose.
39
39
 
40
40
  ## Behaviors
41
41
 
@@ -47,15 +47,15 @@ will not be visible to downstream compilers or verification.
47
47
  The behavior kind shall be one of:
48
48
 
49
49
  - direct Captain work, written `Captain shall <behavior>:` without naming a
50
- delegated player;
51
- - delegated player work, written `Captain shall prompt <Player>:` or the
52
- existing `Captain shall relay ... to <Player> ...:` form; or
50
+ delegated role;
51
+ - delegated-role work, written `Captain shall prompt <Role>:` or the
52
+ existing `Captain shall relay ... to <Role> ...:` form; or
53
53
  - a literal or dynamic nested playbook call as defined below.
54
54
 
55
55
  Direct Captain work means the coordinating Captain performs the behavior
56
56
  itself. It shall not be rewritten as `Captain shall prompt Captain`, because
57
- Captain is a distinct runtime actor rather than a player binding.
58
- Delegated work shall name the declared player that receives the prompt.
57
+ Captain is a distinct runtime actor rather than a role binding.
58
+ Delegated work shall name the declared role that receives the prompt.
59
59
  Prompts shall be blockquoted, one point per line.
60
60
  When Source already supplies the complete blockquoted acting prompt for a
61
61
  behavior, text2gears shall preserve those prompt lines exactly (apart from the
@@ -210,10 +210,11 @@ heading.
210
210
  Every item in one parallel group shall receive the same completed-prior-group
211
211
  inputs; no item prompt may depend on another member's result from the current
212
212
  group.
213
- Every member shall delegate to a named player, and the source shall permit
214
- those members to resolve to distinct players. Direct-Captain work shares one
213
+ Every member shall delegate to a distinct named role; a group that repeats one canonical role is malformed because one role resolves to one player.
214
+ Direct-Captain work shares one
215
215
  Captain session and nested calls share one pending-child stack slot, so neither
216
- kind may receive parallel-group metadata. If Source explicitly requires either
216
+ kind may receive parallel-group metadata.
217
+ If Source explicitly requires either
217
218
  unsupported kind to run concurrently, text2gears shall report that the source
218
219
  cannot be represented rather than silently serialize it or emit metadata the
219
220
  next phase cannot compile.
@@ -311,15 +312,15 @@ prose, acting prompts, and result descriptions follow the Source language,
311
312
  read per the matching localization of the GEARS definition [[1]].
312
313
  The four `Captain shall` acting-clause forms defined above (direct,
313
314
  delegated, nested playbook call, and script), guard names, and the
314
- `Players:` and `Results:` labels are fixed machine syntax and stay in this
315
+ `Roles:` and `Results:` labels are fixed machine syntax and stay in this
315
316
  exact English form regardless of Source language.
316
317
 
317
318
  ## Transformation-spec sources
318
319
 
319
320
  A Source may itself be the normative specification of a transformation — e.g., a compiler phase definition, as when a meta pipeline compiles this file.
320
- Such a Source declares no players and prompts none; its implied procedure is that Captain performs the specified transformation on request.
321
+ Such a Source declares no roles and prompts none; its implied procedure is that Captain performs the specified transformation on request.
321
322
  Compose Captain-acting spec items for it: when a transformation request names the specification's source and target, Captain shall carry out the transformation as specified.
322
- Prompts shall carry the specification's normative requirements as instructions to Captain — deduplicated, one point per line — without inventing players, triggers, or requirements the specification does not state.
323
+ Prompts shall carry the specification's normative requirements as instructions to Captain — deduplicated, one point per line — without inventing roles, triggers, or requirements the specification does not state.
323
324
 
324
325
  ## Composition
325
326
 
package/src/runtime.d.ts CHANGED
@@ -8,11 +8,15 @@ export interface PlayerCallOptions {
8
8
  resume: string | false;
9
9
  }
10
10
  export interface PlayerSessionStore {
11
- select(playerId: string): string | false;
12
- update(playerId: string, resumeToken?: string): void;
11
+ select(roleId: string): string | false;
12
+ update(roleId: string, resumeToken?: string): void;
13
13
  snapshot(): Readonly<Record<string, string>>;
14
14
  restore(tokens: Readonly<Record<string, string>>): void;
15
15
  }
16
+ export interface PlaybookRoleBinding {
17
+ readonly playerId: string;
18
+ readonly promptIdentity: string;
19
+ }
16
20
  export interface CaptainCallOptions {
17
21
  visibility: 'visible' | 'hidden';
18
22
  resume: string | false;
@@ -93,6 +97,7 @@ export type PlaybookRunResult = {
93
97
  } | {
94
98
  outcome: 'terminal';
95
99
  state: PlaybookState;
100
+ stateDescription?: string;
96
101
  output?: JsonValue;
97
102
  } | {
98
103
  outcome: 'suspended';
@@ -100,7 +105,7 @@ export type PlaybookRunResult = {
100
105
  pendingCall: PlaybookPendingCall;
101
106
  };
102
107
  export interface PlaybookPorts {
103
- callPlayer(playerId: string, prompt: string, signal: AbortSignal, options: PlayerCallOptions): Promise<PlayerResult>;
108
+ callPlayer(roleId: string, prompt: string, signal: AbortSignal, options: PlayerCallOptions): Promise<PlayerResult>;
104
109
  callCaptain(prompt: string, signal: AbortSignal, options: CaptainCallOptions): Promise<CaptainResult>;
105
110
  callJudge(prompt: string, signal: AbortSignal): Promise<string>;
106
111
  callPlaybook(request: PlaybookCallRequest, signal: AbortSignal): Promise<PlaybookCallStart>;
@@ -117,12 +122,13 @@ export interface PlaybookSession {
117
122
  parentSessionId?: string;
118
123
  parentCallId?: string;
119
124
  depth: number;
125
+ roleBindings?: Readonly<Record<string, PlaybookRoleBinding>>;
120
126
  playerSessions?: PlayerSessionStore;
121
127
  ports: PlaybookPorts;
122
128
  }
123
129
  export type PlaybookTraceType = 'session.started' | 'boss.input.received' | 'judge.call.started' | 'judge.call.finished' | 'player.call.started' | 'player.call.finished' | 'captain.call.started' | 'captain.call.finished' | 'playbook.call.started' | 'playbook.call.finished' | 'apply.started' | 'apply.finished' | 'fsm.transition' | 'status.emitted' | 'boss.input.settled' | 'session.disposed';
124
130
  export interface PlaybookTraceEvent {
125
- schemaVersion: 2;
131
+ schemaVersion: 3;
126
132
  sessionId: string;
127
133
  playbookId: string;
128
134
  rootSessionId: string;
@@ -138,15 +144,21 @@ export interface PlaybookTraceEvent {
138
144
  }
139
145
  export interface PlaybookPendingBossQuestion {
140
146
  questionId: string;
141
- player: string;
147
+ asker: {
148
+ kind: 'captain';
149
+ } | {
150
+ kind: 'role';
151
+ roleId: string;
152
+ };
142
153
  question: string;
143
154
  sourceItem?: string;
144
155
  }
145
- interface PlaybookRuntimeSnapshotFields {
156
+ export interface PlaybookRuntimeSnapshot {
157
+ schemaVersion: 3;
146
158
  playbookId: string;
147
159
  machine: JsonValue;
148
- playerResumeTokens: {
149
- readonly [playerId: string]: string;
160
+ roleResumeTokens: {
161
+ readonly [roleId: string]: string;
150
162
  };
151
163
  sequences: {
152
164
  trace: number;
@@ -158,14 +170,8 @@ interface PlaybookRuntimeSnapshotFields {
158
170
  };
159
171
  state: PlaybookState;
160
172
  pendingBossQuestions: readonly PlaybookPendingBossQuestion[];
161
- }
162
- export type PlaybookRuntimeSnapshot = PlaybookRuntimeSnapshotFields & ({
163
- schemaVersion: 1;
164
- suspendedCall?: never;
165
- } | {
166
- schemaVersion: 2;
167
173
  suspendedCall?: PlaybookSuspendedCall;
168
- });
174
+ }
169
175
  export interface PlaybookControlAction {
170
176
  id: string;
171
177
  label: string;
@@ -210,4 +216,3 @@ export interface PlaybookRuntime {
210
216
  dispose(): Promise<void>;
211
217
  }
212
218
  export type PlaybookRuntimeFactory<Options = unknown> = (options: Options) => PlaybookRuntime;
213
- export {};
package/src/runtime.ts CHANGED
@@ -19,17 +19,22 @@ export interface PlayerCallOptions {
19
19
  resume: string | false;
20
20
  }
21
21
 
22
- // DR-030: a composing host may supply one frame-local view of the root
23
- // engagement's player continuation. The runtime selects through this store
22
+ // DR-032: a composing host may supply one frame-local role view of the
23
+ // Captain session's player continuation. The runtime selects through this store
24
24
  // before tracing/calling and updates it from the validated result. Hosts that
25
25
  // omit it retain the runtime's private per-session store.
26
26
  export interface PlayerSessionStore {
27
- select(playerId: string): string | false;
28
- update(playerId: string, resumeToken?: string): void;
27
+ select(roleId: string): string | false;
28
+ update(roleId: string, resumeToken?: string): void;
29
29
  snapshot(): Readonly<Record<string, string>>;
30
30
  restore(tokens: Readonly<Record<string, string>>): void;
31
31
  }
32
32
 
33
+ export interface PlaybookRoleBinding {
34
+ readonly playerId: string;
35
+ readonly promptIdentity: string;
36
+ }
37
+
33
38
  export interface CaptainCallOptions {
34
39
  visibility: 'visible' | 'hidden';
35
40
  resume: string | false;
@@ -127,6 +132,7 @@ export type PlaybookRunResult =
127
132
  | {
128
133
  outcome: 'terminal';
129
134
  state: PlaybookState;
135
+ stateDescription?: string;
130
136
  output?: JsonValue;
131
137
  }
132
138
  | {
@@ -137,7 +143,7 @@ export type PlaybookRunResult =
137
143
 
138
144
  export interface PlaybookPorts {
139
145
  callPlayer(
140
- playerId: string,
146
+ roleId: string,
141
147
  prompt: string,
142
148
  signal: AbortSignal,
143
149
  options: PlayerCallOptions,
@@ -163,6 +169,7 @@ export interface PlaybookSession {
163
169
  parentSessionId?: string;
164
170
  parentCallId?: string;
165
171
  depth: number;
172
+ roleBindings?: Readonly<Record<string, PlaybookRoleBinding>>;
166
173
  playerSessions?: PlayerSessionStore;
167
174
  ports: PlaybookPorts;
168
175
  }
@@ -186,7 +193,7 @@ export type PlaybookTraceType =
186
193
  | 'session.disposed';
187
194
 
188
195
  export interface PlaybookTraceEvent {
189
- schemaVersion: 2;
196
+ schemaVersion: 3;
190
197
  sessionId: string;
191
198
  playbookId: string;
192
199
  rootSessionId: string;
@@ -203,19 +210,20 @@ export interface PlaybookTraceEvent {
203
210
 
204
211
  export interface PlaybookPendingBossQuestion {
205
212
  questionId: string;
206
- player: string;
213
+ asker: { kind: 'captain' } | { kind: 'role'; roleId: string };
207
214
  question: string;
208
215
  sourceItem?: string;
209
216
  }
210
217
 
211
- // DR-014 §1 / DR-031 §5: JSON-safe capture of a parked or nested-call
218
+ // DR-014 §1 / DR-031 §5 / DR-032: JSON-safe capture of a parked or nested-call
212
219
  // suspended session. `machine` is the opaque XState persisted snapshot;
213
- // pending Boss questions and a schema-2 suspended call are first-class so a
220
+ // pending Boss questions and a suspended call are first-class so a
214
221
  // host never has to reconstruct durable ownership from presentation records.
215
- interface PlaybookRuntimeSnapshotFields {
222
+ export interface PlaybookRuntimeSnapshot {
223
+ schemaVersion: 3;
216
224
  playbookId: string;
217
225
  machine: JsonValue;
218
- playerResumeTokens: { readonly [playerId: string]: string };
226
+ roleResumeTokens: { readonly [roleId: string]: string };
219
227
  sequences: {
220
228
  trace: number;
221
229
  turn: number;
@@ -226,20 +234,9 @@ interface PlaybookRuntimeSnapshotFields {
226
234
  };
227
235
  state: PlaybookState;
228
236
  pendingBossQuestions: readonly PlaybookPendingBossQuestion[];
237
+ suspendedCall?: PlaybookSuspendedCall;
229
238
  }
230
239
 
231
- export type PlaybookRuntimeSnapshot = PlaybookRuntimeSnapshotFields &
232
- (
233
- | {
234
- schemaVersion: 1;
235
- suspendedCall?: never;
236
- }
237
- | {
238
- schemaVersion: 2;
239
- suspendedCall?: PlaybookSuspendedCall;
240
- }
241
- );
242
-
243
240
  // DR-029: one currently valid, runtime-advertised control action. The id
244
241
  // is stable within the returned view; the label is runtime-written,
245
242
  // Boss-appropriate text derived from source state descriptions.
@@ -4,12 +4,17 @@ export interface PlaybookPendingBossQuestionContext {
4
4
  questionId: string;
5
5
  resumeStateId: string;
6
6
  sourceItem: string;
7
- player: string;
7
+ asker: {
8
+ kind: 'captain';
9
+ } | {
10
+ kind: 'role';
11
+ roleId: string;
12
+ };
8
13
  question: string;
9
14
  }
10
15
  export interface PlaybookPlayerInput {
11
16
  stateId: string;
12
- player: string;
17
+ role: string;
13
18
  sourceItem: string;
14
19
  prompt: string;
15
20
  result: Readonly<Record<string, string>>;
@@ -46,7 +51,7 @@ export type JudgePurpose = 'boss-input-classification' | 'player-output-adjudica
46
51
  * exercise composition/adjudication without a live runtime.
47
52
  */
48
53
  export interface RuntimeBoundaryCalls {
49
- callPlayer(input: PlaybookPlayerInput, playerId: string, prompt: string, signal: AbortSignal): Promise<PlayerResult>;
54
+ callPlayer(input: PlaybookPlayerInput, roleId: string, prompt: string, signal: AbortSignal): Promise<PlayerResult>;
50
55
  callJudge(purpose: JudgePurpose, stateId: string | undefined, prompt: string, signal: AbortSignal): Promise<string>;
51
56
  callCaptain?(input: PlaybookCaptainInput, prompt: string, signal: AbortSignal, callOptions?: XStateCaptainCallOptions): Promise<CaptainResult>;
52
57
  }
@@ -68,10 +73,12 @@ export interface ScheduledStatus {
68
73
  data?: JsonValue;
69
74
  }
70
75
  /** Boss-facing identity for one FSM state whose invoked actor is `player`. */
71
- export interface XStatePlayerStateStatus {
72
- player: string;
76
+ export interface XStateRoleStateStatus {
77
+ role: string;
73
78
  label: string;
74
79
  }
80
+ /** Invocation-scoped lookup exposed only while composing a player prompt. */
81
+ export type XStatePromptIdentity = (roleId: string) => string;
75
82
  export interface XStateBossEventFieldSpec {
76
83
  /** The judge supplies routing data; the runtime supplies exact Boss text. */
77
84
  source: 'judge' | 'text';
@@ -144,8 +151,8 @@ export interface XStatePlaybookRuntimeSpec<TOptions> {
144
151
  label?: string;
145
152
  /**
146
153
  * Link-time compatibility declaration checked at construction against the
147
- * loaded engine's self-report (DR-022). Absent: a legacy artifact emitted
148
- * before the contract constructed with no compatibility check.
154
+ * loaded engine's self-report (DR-022). Absent declarations reject because
155
+ * their overloaded player metadata has no safe local-role interpretation.
149
156
  */
150
157
  compat?: XStatePlaybookRuntimeCompat;
151
158
  /** Validate and JSON-snapshot the caller's per-run options. */
@@ -161,6 +168,15 @@ export interface XStatePlaybookRuntimeSpec<TOptions> {
161
168
  entryEvent?: {
162
169
  type: string;
163
170
  textField: string;
171
+ /**
172
+ * DR-034: the FSM context member this machine's entry action copies the
173
+ * exact Boss text into. Where it is named, the failure-state retry
174
+ * builds its payload from that member of the live snapshot instead of
175
+ * from the process-local recorded event, so the action derives the same
176
+ * before and after `restore`. Absent: the recorded event stays the
177
+ * source and the action lives only as long as the process.
178
+ */
179
+ contextField?: string;
164
180
  };
165
181
  /**
166
182
  * Exact flat Boss-event contracts whose non-text fields the judge may
@@ -182,14 +198,12 @@ export interface XStatePlaybookRuntimeSpec<TOptions> {
182
198
  * recoverable FSM-result failures instead.
183
199
  */
184
200
  captainStrategy?: XStateCaptainStrategy<TOptions>;
185
- /** Status line emitted after classification; canonical metadata defaults to the event type, legacy artifacts to none. */
201
+ /** Status line emitted after classification; metadata defaults to the event type. */
186
202
  classificationStatus?: (event: EventObject) => string | undefined;
187
- /** Complete FSM-derived Boss-facing metadata for every `player` state; its presence selects the canonical status profile. */
188
- playerStates?: Readonly<Record<string, XStatePlayerStateStatus>>;
189
- /** Map a player-invoking state's input to the host player id. Default: lowercased player name. */
190
- resolvePlayerId?: (input: PlaybookPlayerInput, options: TOptions) => string;
203
+ /** Complete FSM-derived Boss-facing metadata for every `player` state. */
204
+ roleStates?: Readonly<Record<string, XStateRoleStateStatus>>;
191
205
  /** Compose the player prompt. Default: continuation blocks + `<field>` placeholder substitution. */
192
- composePlayerPrompt?: (input: PlaybookPlayerInput) => string;
206
+ composePlayerPrompt?: (input: PlaybookPlayerInput, promptIdentity: XStatePromptIdentity) => string;
193
207
  /** Compose the direct-Captain prompt. Default: continuation blocks + placeholder substitution with deterministic JSON rendering. */
194
208
  composeCaptainPrompt?: (input: PlaybookCaptainInput) => string;
195
209
  /** Linker-known exceptions to the default kebab-token → camel-field mapping. */
@@ -253,8 +267,6 @@ export declare function defaultComposePlayerPrompt(input: PlaybookPlayerInput, p
253
267
  * with lexicographically sorted keys at every depth.
254
268
  */
255
269
  export declare function defaultComposeCaptainPrompt(input: PlaybookCaptainInput, placeholderFields?: Readonly<Record<string, string>>): string;
256
- /** Default player binding: each player to its lowercased name. */
257
- export declare function defaultResolvePlayerId(input: PlaybookPlayerInput): string;
258
270
  /**
259
271
  * Default required-field extraction (slc/link.md §Captain adjudication).
260
272
  * Limited to the description's `Output shall include` / `输出应包含` clause;
@@ -278,8 +290,8 @@ export interface PlayerAdjudicationSpec {
278
290
  * long-form prose through judge JSON.
279
291
  */
280
292
  export declare function adjudicatePlayerOutput(spec: PlayerAdjudicationSpec, input: PlaybookPlayerInput, finalText: string, ports: PlaybookPorts, signal: AbortSignal, boundary?: RuntimeBoundaryCalls): Promise<PlaybookActorOutput>;
281
- export interface PlayerBridgeSpec {
282
- resolvePlayerId: (input: PlaybookPlayerInput) => string;
293
+ interface PlayerBridgeSpec {
294
+ resolveRoleId: (input: PlaybookPlayerInput) => string;
283
295
  composePlayerPrompt: (input: PlaybookPlayerInput) => string;
284
296
  adjudication: PlayerAdjudicationSpec;
285
297
  resumableStateIds: ReadonlySet<string>;
@@ -310,8 +322,10 @@ export declare function stateDescriptionsFromMachine(machine: AnyStateMachine):
310
322
  * (literal and dynamic) — and implements the full runtime lifecycle including
311
323
  * the optional parked-session snapshot capability (DR-014).
312
324
  *
313
- * Scope: machines that declare no parallel state (each snapshot exposes
314
- * exactly one playbook state id). Parallel-region FSMs keep their own linked
315
- * runtimes.
325
+ * Scope: flat single-region machines no parallel state, no compound
326
+ * child states, and every root state's `meta.playbook.stateId` equal to its
327
+ * state key — so each snapshot exposes exactly one playbook state id.
328
+ * Parallel-region FSMs keep their own linked runtimes.
316
329
  */
317
330
  export declare function createXStatePlaybookRuntime<TOptions>(machine: AnyStateMachine, spec: XStatePlaybookRuntimeSpec<TOptions>): PlaybookRuntimeFactory<TOptions>;
331
+ export {};