@sublang/playbook 15.0.0 → 16.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 (81) hide show
  1. package/README.md +1 -1
  2. package/docs/embedding.md +9 -7
  3. package/package.json +3 -1
  4. package/reference/sdlc/branch.playbook/branch.fsm.d.ts +63 -33
  5. package/reference/sdlc/branch.playbook/branch.fsm.js +190 -108
  6. package/reference/sdlc/branch.playbook/branch.fsm.ts +269 -147
  7. package/reference/sdlc/branch.playbook/branch.gears.md +7 -17
  8. package/reference/sdlc/branch.playbook/branch.playbook.d.ts +12 -16
  9. package/reference/sdlc/branch.playbook/branch.playbook.js +112 -101
  10. package/reference/sdlc/branch.playbook/branch.playbook.ts +128 -171
  11. package/reference/sdlc/branch.playbook/branch.registry.d.ts +3 -2
  12. package/reference/sdlc/branch.playbook/branch.registry.ts +6 -2
  13. package/reference/sdlc/code.playbook/bin/repository-effects.js +54 -13
  14. package/reference/sdlc/code.playbook/code.fsm.d.ts +143 -90
  15. package/reference/sdlc/code.playbook/code.fsm.introspect.d.ts +8 -8
  16. package/reference/sdlc/code.playbook/code.fsm.introspect.ts +13 -13
  17. package/reference/sdlc/code.playbook/code.fsm.js +609 -649
  18. package/reference/sdlc/code.playbook/code.fsm.ts +890 -821
  19. package/reference/sdlc/code.playbook/code.gears.md +39 -29
  20. package/reference/sdlc/code.playbook/code.playbook.d.ts +13 -16
  21. package/reference/sdlc/code.playbook/code.playbook.js +166 -147
  22. package/reference/sdlc/code.playbook/code.playbook.ts +180 -229
  23. package/reference/sdlc/code.playbook/code.registry.d.ts +3 -2
  24. package/reference/sdlc/code.playbook/code.registry.ts +6 -2
  25. package/reference/sdlc/code.playbook/playbook-captain.d.ts +42 -0
  26. package/reference/sdlc/code.playbook/playbook-captain.js +829 -194
  27. package/reference/sdlc/code.playbook/playbook-captain.ts +1227 -220
  28. package/reference/sdlc/decide.md +1 -0
  29. package/reference/sdlc/decide.playbook/decide.fsm.d.ts +270 -154
  30. package/reference/sdlc/decide.playbook/decide.fsm.js +765 -732
  31. package/reference/sdlc/decide.playbook/decide.fsm.ts +1167 -945
  32. package/reference/sdlc/decide.playbook/decide.gears.md +28 -21
  33. package/reference/sdlc/decide.playbook/decide.playbook.d.ts +11 -67
  34. package/reference/sdlc/decide.playbook/decide.playbook.js +155 -3570
  35. package/reference/sdlc/decide.playbook/decide.playbook.ts +186 -5061
  36. package/reference/sdlc/decide.playbook/decide.registry.d.ts +8 -4
  37. package/reference/sdlc/decide.playbook/decide.registry.js +2 -2
  38. package/reference/sdlc/decide.playbook/decide.registry.ts +13 -6
  39. package/reference/sdlc/dev.playbook/dev.fsm.d.ts +113 -131
  40. package/reference/sdlc/dev.playbook/dev.fsm.js +517 -575
  41. package/reference/sdlc/dev.playbook/dev.fsm.ts +667 -787
  42. package/reference/sdlc/dev.playbook/dev.gears.md +52 -54
  43. package/reference/sdlc/dev.playbook/dev.playbook.d.ts +13 -10
  44. package/reference/sdlc/dev.playbook/dev.playbook.js +128 -120
  45. package/reference/sdlc/dev.playbook/dev.playbook.ts +143 -193
  46. package/reference/sdlc/dev.playbook/dev.registry.d.ts +3 -2
  47. package/reference/sdlc/dev.playbook/dev.registry.ts +6 -2
  48. package/reference/sdlc/pr.playbook/pr.fsm.d.ts +92 -85
  49. package/reference/sdlc/pr.playbook/pr.fsm.js +461 -518
  50. package/reference/sdlc/pr.playbook/pr.fsm.ts +533 -663
  51. package/reference/sdlc/pr.playbook/pr.gears.md +47 -63
  52. package/reference/sdlc/pr.playbook/pr.playbook.d.ts +13 -23
  53. package/reference/sdlc/pr.playbook/pr.playbook.js +118 -112
  54. package/reference/sdlc/pr.playbook/pr.playbook.ts +136 -190
  55. package/reference/sdlc/pr.playbook/pr.registry.d.ts +3 -2
  56. package/reference/sdlc/pr.playbook/pr.registry.ts +4 -2
  57. package/reference/sdlc/review.md +3 -3
  58. package/reference/sdlc/review.playbook/review.fsm.d.ts +150 -116
  59. package/reference/sdlc/review.playbook/review.fsm.js +479 -550
  60. package/reference/sdlc/review.playbook/review.fsm.ts +717 -662
  61. package/reference/sdlc/review.playbook/review.gears.md +32 -29
  62. package/reference/sdlc/review.playbook/review.playbook.d.ts +12 -12
  63. package/reference/sdlc/review.playbook/review.playbook.js +180 -155
  64. package/reference/sdlc/review.playbook/review.playbook.ts +190 -230
  65. package/reference/sdlc/review.playbook/review.registry.d.ts +6 -5
  66. package/reference/sdlc/review.playbook/review.registry.js +3 -3
  67. package/reference/sdlc/review.playbook/review.registry.ts +9 -5
  68. package/slc/gears2fsm.md +72 -3
  69. package/slc/link.md +50 -27
  70. package/slc/materialize-link.mjs +51 -13
  71. package/slc/optimize.md +4 -1
  72. package/slc/prefix-prompts.mjs +191 -0
  73. package/slc/prefix.md +203 -0
  74. package/slc/slc.pin-inputs.json +11 -1
  75. package/slc/text2gears.md +71 -11
  76. package/src/xstate-playbook-runtime.d.ts +82 -9
  77. package/src/xstate-playbook-runtime.js +1224 -283
  78. package/src/xstate-playbook-runtime.ts +1671 -338
  79. package/src/xstate-runtime.d.ts +3 -1
  80. package/src/xstate-runtime.js +9 -2
  81. package/src/xstate-runtime.ts +12 -2
@@ -1,92 +1,139 @@
1
- type Role = 'coder' | 'reviewer';
2
- type JumpableStateId = 'reviewInitial';
3
- export type ResumableStateId = 'reviewInitial' | 'addressFindings' | 'reviewAfterCommit' | 'reviewAfterRebuttal';
1
+ /** Canonical lowercase local ids of the source roles Coder and Reviewer. */
2
+ export type ReviewRole = 'coder' | 'reviewer';
3
+ /** One role-id array per parallel group; REVIEW declares no parallel group. */
4
+ export declare const concurrentRoleSets: readonly (readonly ReviewRole[])[];
5
+ /** Delegated-player working leaves (REVIEW-1 through REVIEW-4). */
6
+ export type WorkingStateId = 'firstReview' | 'fixFindings' | 'reviewAfterFix' | 'reviewAfterRejection';
7
+ /** Working leaves that may suspend for, and resume from, a Boss reply. */
8
+ export type ResumableStateId = WorkingStateId;
9
+ /** Root `BOSS_INTERRUPT` targets. */
10
+ export type JumpableStateId = WorkingStateId;
11
+ export type ReviewSourceItem = 'REVIEW-1' | 'REVIEW-2' | 'REVIEW-3' | 'REVIEW-4';
12
+ /** Coder's accepted disposition of the latest findings. */
13
+ export type CoderOutcome = 'committed' | 'rejectedAll';
4
14
  export interface PendingBossQuestion {
5
- questionId: ResumableStateId;
6
- resumeStateId: ResumableStateId;
7
- sourceItem: `REVIEW-${1 | 2 | 3 | 4}`;
8
- asker: {
15
+ readonly questionId: ResumableStateId;
16
+ readonly resumeStateId: ResumableStateId;
17
+ readonly sourceItem: ReviewSourceItem;
18
+ readonly asker: {
9
19
  readonly kind: 'role';
10
- readonly roleId: Role;
20
+ readonly roleId: ReviewRole;
11
21
  };
12
- question: string;
22
+ readonly question: string;
13
23
  }
24
+ interface PlayerInputBase {
25
+ /** The source item's full final prompt, verbatim. */
26
+ readonly prompt: string;
27
+ /** This state's local result contract: guard name → description. */
28
+ readonly result: Readonly<Record<string, string>>;
29
+ /** `<caller-input>`: the caller's complete review request. */
30
+ readonly callerInput?: string;
31
+ readonly pendingBossQuestion?: PendingBossQuestion;
32
+ readonly bossReply?: string;
33
+ }
34
+ export interface FirstReviewPlayerInput extends PlayerInputBase {
35
+ readonly stateId: 'firstReview';
36
+ readonly role: 'reviewer';
37
+ readonly sourceItem: 'REVIEW-1';
38
+ }
39
+ export interface FixFindingsPlayerInput extends PlayerInputBase {
40
+ readonly stateId: 'fixFindings';
41
+ readonly role: 'coder';
42
+ readonly sourceItem: 'REVIEW-2';
43
+ /** `<reviewer-output>`: Reviewer's verbatim final text of the latest round. */
44
+ readonly reviewerOutput?: string;
45
+ }
46
+ export interface ReviewAfterFixPlayerInput extends PlayerInputBase {
47
+ readonly stateId: 'reviewAfterFix';
48
+ readonly role: 'reviewer';
49
+ readonly sourceItem: 'REVIEW-3';
50
+ /** `<latest-commit>`: the receipt-owned latest review-fix commit. */
51
+ readonly latestCommit?: string;
52
+ /** `<coder-output>`: Coder's verbatim final text of the latest fix round. */
53
+ readonly coderOutput?: string;
54
+ }
55
+ export interface ReviewAfterRejectionPlayerInput extends PlayerInputBase {
56
+ readonly stateId: 'reviewAfterRejection';
57
+ readonly role: 'reviewer';
58
+ readonly sourceItem: 'REVIEW-4';
59
+ /** `<coder-output>`: Coder's verbatim final text of the latest fix round. */
60
+ readonly coderOutput?: string;
61
+ }
62
+ export type PlayerInput = FirstReviewPlayerInput | FixFindingsPlayerInput | ReviewAfterFixPlayerInput | ReviewAfterRejectionPlayerInput;
63
+ export type NeedsBossReplyOutput = {
64
+ readonly guard: 'needsBossReply';
65
+ readonly question: string;
66
+ };
67
+ /** Reviewer outcomes (REVIEW-1, REVIEW-3, REVIEW-4). */
68
+ export type ReviewerOutput = {
69
+ readonly guard: 'hasFindings';
70
+ readonly reviewerOutput: string;
71
+ } | {
72
+ readonly guard: 'noFindings';
73
+ /** Effect-owned: the exact revision taken from repository authority. */
74
+ readonly evaluatedRevision: string;
75
+ } | NeedsBossReplyOutput;
76
+ /** Coder outcomes (REVIEW-2). */
77
+ export type CoderOutput = {
78
+ readonly guard: 'committed';
79
+ readonly coderOutput: string;
80
+ /** Effect-owned: the runtime fills it from the repository receipt. */
81
+ readonly latestCommit: string;
82
+ } | {
83
+ readonly guard: 'rejectedAll';
84
+ readonly coderOutput: string;
85
+ } | NeedsBossReplyOutput;
86
+ export type PlayerOutput = ReviewerOutput | CoderOutput;
87
+ export interface ErrorRecord {
88
+ readonly name: string;
89
+ readonly message: string;
90
+ readonly stack?: string;
91
+ }
92
+ /** Public output interface of the packaged builtin `review`. */
14
93
  export interface ReviewOutput {
15
- noUnsettledFindings: true;
16
- /**
17
- * Exact receipt-derived repository revision at which the review scope was
18
- * evaluated: the closing clean round's `unchanged` receipt observes it as
19
- * HEAD — the last review-fix commit when one landed, or the caller-supplied
20
- * scope revision when none did (DR-045).
21
- */
22
- evaluatedRevision: string;
94
+ readonly noUnsettledFindings: true;
95
+ readonly evaluatedRevision: string;
23
96
  }
24
- export type ReviewInput = Readonly<Record<string, never>>;
97
+ /** The machine reads no input: the caller input arrives on `START_REVIEW`. */
98
+ export type ReviewInput = Readonly<Record<never, never>>;
25
99
  export interface ReviewContext {
26
- callerInput?: string;
27
- reviewerOutput?: string;
28
- coderOutput?: string;
29
- /** Receipt-derived OID of the latest review-fix commit (never player prose). */
30
- latestCommit?: string;
31
- /** Observed HEAD of the closing clean round's unchanged receipt (DR-045). */
32
- evaluatedRevision?: string;
33
- lastError?: unknown;
34
- pendingBossQuestion?: PendingBossQuestion;
35
- bossReply?: string;
100
+ /** `<caller-input>`: the caller's intent, review scope, and context. */
101
+ readonly callerInput?: string;
102
+ /** `<reviewer-output>`: Reviewer's verbatim final text with findings. */
103
+ readonly reviewerOutput?: string;
104
+ /** `<coder-output>`: Coder's verbatim final text of the latest fix round. */
105
+ readonly coderOutput?: string;
106
+ /** `<latest-commit>`: the accepted, receipt-owned latest review-fix commit. */
107
+ readonly latestCommit?: string;
108
+ /** Coder's accepted disposition of the latest findings. */
109
+ readonly coderOutcome?: CoderOutcome;
110
+ /** Revision evaluated by the clean review round that ended REVIEW. */
111
+ readonly evaluatedRevision?: string;
112
+ readonly lastError?: ErrorRecord;
113
+ readonly pendingBossQuestion?: PendingBossQuestion;
114
+ readonly bossReply?: string;
36
115
  }
37
116
  export type ReviewEvent = {
38
- type: 'START_REVIEW';
39
- callerInput: string;
117
+ readonly type: 'START_REVIEW';
118
+ readonly callerInput: string;
40
119
  } | {
41
- type: 'BOSS_INTERRUPT';
42
- targetId: JumpableStateId;
43
- bossIntent: string;
120
+ readonly type: 'BOSS_INTERRUPT';
121
+ readonly targetId: JumpableStateId;
44
122
  } | {
45
- type: 'BOSS_REPLY';
46
- questionId?: ResumableStateId;
47
- answer: string;
48
- };
49
- export interface PlayerInput {
50
- stateId: ResumableStateId;
51
- sourceItem: `REVIEW-${1 | 2 | 3 | 4}`;
52
- role: Role;
53
- prompt: string;
54
- result: Readonly<Record<string, string>>;
55
- callerInput?: string;
56
- reviewerOutput?: string;
57
- coderOutput?: string;
58
- latestCommit?: string;
59
- pendingBossQuestion?: PendingBossQuestion;
60
- bossReply?: string;
61
- }
62
- export type PlayerOutput = {
63
- guard: 'hasFindings';
64
- reviewerOutput: string;
65
- } | {
66
- guard: 'noFindings';
67
- evaluatedRevision: string;
68
- } | {
69
- guard: 'committed';
70
- coderOutput: string;
71
- latestCommit: string;
72
- } | {
73
- guard: 'rejectedAll';
74
- coderOutput: string;
75
- } | {
76
- guard: 'needsBossReply';
77
- question: string;
123
+ readonly type: 'BOSS_REPLY';
124
+ readonly answer: string;
125
+ readonly questionId?: ResumableStateId;
78
126
  };
79
127
  export declare const reviewMachine: import("xstate").StateMachine<ReviewContext, {
80
- type: "START_REVIEW";
81
- callerInput: string;
128
+ readonly type: "START_REVIEW";
129
+ readonly callerInput: string;
82
130
  } | {
83
- type: "BOSS_INTERRUPT";
84
- targetId: JumpableStateId;
85
- bossIntent: string;
131
+ readonly type: "BOSS_INTERRUPT";
132
+ readonly targetId: JumpableStateId;
86
133
  } | {
87
- type: "BOSS_REPLY";
88
- questionId?: ResumableStateId;
89
- answer: string;
134
+ readonly type: "BOSS_REPLY";
135
+ readonly answer: string;
136
+ readonly questionId?: ResumableStateId;
90
137
  }, {
91
138
  [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>> | undefined;
92
139
  }, {
@@ -104,88 +151,75 @@ export declare const reviewMachine: import("xstate").StateMachine<ReviewContext,
104
151
  type: "rememberActorError";
105
152
  params: import("xstate").NonReducibleUnknown;
106
153
  } | {
107
- type: "rememberBossReply";
108
- params: import("xstate").NonReducibleUnknown;
109
- } | {
110
- type: "rememberEmptyBossReplyError";
154
+ type: "resetForInterrupt";
111
155
  params: import("xstate").NonReducibleUnknown;
112
156
  } | {
113
- type: "copyStartInput";
157
+ type: "rememberBossReply";
114
158
  params: import("xstate").NonReducibleUnknown;
115
159
  } | {
116
- type: "copyInterruptedInput";
160
+ type: "rememberMalformedPlayerOutput";
117
161
  params: import("xstate").NonReducibleUnknown;
118
162
  } | {
119
- type: "rememberReviewerOutput";
163
+ type: "clearBossReplyContext";
120
164
  params: import("xstate").NonReducibleUnknown;
121
165
  } | {
122
- type: "rememberCoderOutput";
123
- params: import("xstate").NonReducibleUnknown;
166
+ type: "setPendingBossQuestion";
167
+ params: {
168
+ readonly resumeStateId: ResumableStateId;
169
+ };
124
170
  } | {
125
- type: "rememberEvaluatedRevision";
171
+ type: "rememberMalformedBossReply";
126
172
  params: import("xstate").NonReducibleUnknown;
127
173
  } | {
128
- type: "setPendingReviewInitial";
174
+ type: "startReview";
129
175
  params: import("xstate").NonReducibleUnknown;
130
176
  } | {
131
- type: "setPendingAddressFindings";
177
+ type: "rememberFindings";
132
178
  params: import("xstate").NonReducibleUnknown;
133
179
  } | {
134
- type: "setPendingReviewAfterCommit";
180
+ type: "rememberCoderDisposition";
135
181
  params: import("xstate").NonReducibleUnknown;
136
182
  } | {
137
- type: "setPendingReviewAfterRebuttal";
183
+ type: "rememberEvaluatedRevision";
138
184
  params: import("xstate").NonReducibleUnknown;
139
185
  }, {
140
- type: "needsBossReply";
141
- params: unknown;
142
- } | {
143
186
  type: "emptyBossReply";
144
187
  params: unknown;
145
188
  } | {
146
- type: "hasFindings";
147
- params: unknown;
148
- } | {
149
- type: "noFindings";
150
- params: unknown;
151
- } | {
152
- type: "committed";
153
- params: unknown;
154
- } | {
155
- type: "rejectedAll";
189
+ type: "validStartReview";
156
190
  params: unknown;
157
191
  } | {
158
- type: "resumeReviewInitial";
192
+ type: "acceptHasFindings";
159
193
  params: unknown;
160
194
  } | {
161
- type: "resumeAddressFindings";
195
+ type: "acceptNoFindings";
162
196
  params: unknown;
163
197
  } | {
164
- type: "resumeReviewAfterCommit";
198
+ type: "acceptCommitted";
165
199
  params: unknown;
166
200
  } | {
167
- type: "resumeReviewAfterRebuttal";
201
+ type: "acceptRejectedAll";
168
202
  params: unknown;
169
203
  } | {
170
- type: "restartInitialReview";
204
+ type: "acceptNeedsBossReply";
171
205
  params: unknown;
172
- }, never, "done" | "failed" | "ready" | "awaitBossReply" | "reviewInitial" | "addressFindings" | "reviewAfterCommit" | "reviewAfterRebuttal", string, Readonly<Record<string, never>>, ReviewOutput, import("xstate").EventObject, import("xstate").MetaObject, {
206
+ }, never, "done" | "failed" | "ready" | "awaitBossReply" | "firstReview" | "fixFindings" | "reviewAfterFix" | "reviewAfterRejection", string, Readonly<Record<never, never>>, ReviewOutput, import("xstate").EventObject, import("xstate").MetaObject, {
173
207
  id: "review";
174
208
  states: {
175
209
  readonly ready: {
176
210
  id: "ready";
177
211
  };
178
- readonly reviewInitial: {
179
- id: "reviewInitial";
212
+ readonly firstReview: {
213
+ id: "firstReview";
180
214
  };
181
- readonly addressFindings: {
182
- id: "addressFindings";
215
+ readonly fixFindings: {
216
+ id: "fixFindings";
183
217
  };
184
- readonly reviewAfterCommit: {
185
- id: "reviewAfterCommit";
218
+ readonly reviewAfterFix: {
219
+ id: "reviewAfterFix";
186
220
  };
187
- readonly reviewAfterRebuttal: {
188
- id: "reviewAfterRebuttal";
221
+ readonly reviewAfterRejection: {
222
+ id: "reviewAfterRejection";
189
223
  };
190
224
  readonly awaitBossReply: {
191
225
  id: "awaitBossReply";
@@ -198,4 +232,4 @@ export declare const reviewMachine: import("xstate").StateMachine<ReviewContext,
198
232
  };
199
233
  };
200
234
  }>;
201
- export {};
235
+ export default reviewMachine;