@sublang/playbook 0.1.3 → 0.4.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 (20) hide show
  1. package/README.md +98 -30
  2. package/package.json +24 -23
  3. package/reference/sdlc/code.playbook/bin/playbook-code.js +278 -0
  4. package/{code.fsm.d.ts → reference/sdlc/code.playbook/code.fsm.d.ts} +18 -0
  5. package/{code.fsm.introspect.d.ts → reference/sdlc/code.playbook/code.fsm.introspect.d.ts} +24 -0
  6. package/{code.fsm.introspect.js → reference/sdlc/code.playbook/code.fsm.introspect.js} +28 -1
  7. package/{code.fsm.introspect.ts → reference/sdlc/code.playbook/code.fsm.introspect.ts} +73 -6
  8. package/{code.fsm.js → reference/sdlc/code.playbook/code.fsm.js} +264 -115
  9. package/{code.fsm.ts → reference/sdlc/code.playbook/code.fsm.ts} +327 -119
  10. package/{code.gears.md → reference/sdlc/code.playbook/code.gears.md} +17 -16
  11. package/{code.playbook.d.ts → reference/sdlc/code.playbook/code.playbook.d.ts} +16 -6
  12. package/{code.playbook.js → reference/sdlc/code.playbook/code.playbook.js} +228 -129
  13. package/{code.playbook.ts → reference/sdlc/code.playbook/code.playbook.ts} +316 -122
  14. package/{code.tmux-play.js → reference/sdlc/code.playbook/code.tmux-play.js} +22 -10
  15. package/{code.tmux-play.ts → reference/sdlc/code.playbook/code.tmux-play.ts} +26 -13
  16. package/reference/sdlc/code.playbook/playbook-code.config.template.yaml +38 -0
  17. package/{tmux-play.config.yaml → reference/sdlc/code.playbook/tmux-play.config.yaml} +14 -10
  18. package/{tmux-play.production.config.yaml → reference/sdlc/code.playbook/tmux-play.production.config.yaml} +7 -4
  19. package/bin/playbook-code.js +0 -43
  20. /package/{code.tmux-play.d.ts → reference/sdlc/code.playbook/code.tmux-play.d.ts} +0 -0
@@ -16,9 +16,8 @@ Players:
16
16
  When Boss gives a coding intent, Captain shall relay it to Coder along with the following prompt:
17
17
  > Assess whether this can be completed in a single commit, following best practices.
18
18
  > If yes, implement and test, updating both code and specs; otherwise, decompose into tasks as a new IR under @specs/iterations.
19
- > Consult @specs/map.md for relevant context if needed; ensure it reflects the changes.
19
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; ensure @specs/map.md reflects the changes.
20
20
  > Do not commit.
21
-
22
21
  The resulting changes are Initial Changes.
23
22
 
24
23
  ### CODE-2
@@ -34,7 +33,6 @@ When a new IR or IR task passes review and is committed, Captain shall prompt Co
34
33
  > Implement one task at a time (including corresponding tests if any).
35
34
  > Stop after each task for review — do not commit yet.
36
35
  > If relevant, mark progress in the IR.
37
-
38
36
  The resulting changes are Initial Changes.
39
37
 
40
38
  ### CODE-4
@@ -52,7 +50,6 @@ When an IR is done, Captain shall prompt Coder:
52
50
  > Avoid implementation specifics.
53
51
  > Avoid redundant spec items.
54
52
  > Consult @specs/map.md for relevant context and update it to reflect your changes.
55
-
56
53
  ## Reviewer
57
54
 
58
55
  For each finding in a review round, Coder either addresses it with changes or challenges it with a rebuttal.
@@ -71,7 +68,7 @@ When Committer commits Initial Changes from a Boss coding intent involving chang
71
68
  > - Minimal: essential and concise; every item earns its place; also check with other items.
72
69
  >
73
70
  > Flag anything missing, redundant, over-specified, or under-specified.
74
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
71
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
75
72
  > If the change is ready to commit or push, don't raise nitpicks.
76
73
 
77
74
  ### CODE-6
@@ -81,7 +78,7 @@ When Committer commits Initial Changes from a Boss coding intent involving chang
81
78
  > Refer to the commit message.
82
79
  > Flag any issues or improvements (numbered; no duplication).
83
80
  > Think thoroughly — don't just approve or reject.
84
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
81
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
85
82
  > If the change is ready to commit or push, don't raise nitpicks.
86
83
 
87
84
  ### CODE-7
@@ -98,7 +95,7 @@ When Committer commits Initial Changes from a Boss coding intent involving chang
98
95
  > Flag anything missing, redundant, over-specified, or under-specified.
99
96
  > Flag any issues or improvements (numbered; no duplication).
100
97
  > Think thoroughly — don't just approve or reject.
101
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
98
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
102
99
  > If the change is ready to commit or push, don't raise nitpicks.
103
100
 
104
101
  ### CODE-8
@@ -113,7 +110,7 @@ When Committer commits Initial Changes from an IR task involving changes only in
113
110
  > - Minimal: essential and concise; every item earns its place; also check with other items.
114
111
  >
115
112
  > Flag anything missing, redundant, over-specified, or under-specified.
116
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
113
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
117
114
  > If the change is ready to commit or push, don't raise nitpicks.
118
115
 
119
116
  ### CODE-9
@@ -123,7 +120,7 @@ When Committer commits Initial Changes from an IR task involving changes only ou
123
120
  > Refer to the commit message.
124
121
  > Flag any issues or improvements (numbered; no duplication).
125
122
  > Think thoroughly — don't just approve or reject.
126
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
123
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
127
124
  > If the change is ready to commit or push, don't raise nitpicks.
128
125
 
129
126
  ### CODE-10
@@ -140,7 +137,7 @@ When Committer commits Initial Changes from an IR task involving changes both in
140
137
  > Flag anything missing, redundant, over-specified, or under-specified.
141
138
  > Flag any issues or improvements (numbered; no duplication).
142
139
  > Think thoroughly — don't just approve or reject.
143
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
140
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
144
141
  > If the change is ready to commit or push, don't raise nitpicks.
145
142
 
146
143
  ### CODE-11
@@ -155,7 +152,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
155
152
  > - Minimal: essential and concise; every item earns its place; also check with other items.
156
153
  >
157
154
  > Flag anything missing, redundant, over-specified, or under-specified.
158
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
155
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
159
156
  > If the change is ready to commit or push, don't raise nitpicks.
160
157
 
161
158
  ### CODE-12
@@ -165,7 +162,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
165
162
  > Understand the intent.
166
163
  > Flag any issues or improvements (numbered; no duplication).
167
164
  > Think thoroughly — don't just approve or reject.
168
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
165
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
169
166
  > If the change is ready to commit or push, don't raise nitpicks.
170
167
 
171
168
  ### CODE-13
@@ -182,7 +179,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
182
179
  > Flag anything missing, redundant, over-specified, or under-specified.
183
180
  > Flag any issues or improvements (numbered; no duplication).
184
181
  > Think thoroughly — don't just approve or reject.
185
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
182
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
186
183
  > If the change is ready to commit or push, don't raise nitpicks.
187
184
 
188
185
  ### CODE-14
@@ -202,7 +199,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
202
199
  > - Minimal: essential and concise; every item earns its place; also check with other items.
203
200
  >
204
201
  > Flag anything missing, redundant, over-specified, or under-specified.
205
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
202
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
206
203
  > If the change is ready to commit or push, don't raise nitpicks.
207
204
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
208
205
 
@@ -213,7 +210,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
213
210
  > Understand the intent.
214
211
  > Flag any issues or improvements (numbered; no duplication).
215
212
  > Think thoroughly — don't just approve or reject.
216
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
213
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
217
214
  > If the change is ready to commit or push, don't raise nitpicks.
218
215
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
219
216
 
@@ -231,7 +228,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
231
228
  > Flag anything missing, redundant, over-specified, or under-specified.
232
229
  > Flag any issues or improvements (numbered; no duplication).
233
230
  > Think thoroughly — don't just approve or reject.
234
- > Consult @specs/map.md for relevant context if needed; verify it reflects the changes.
231
+ > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
235
232
  > If the change is ready to commit or push, don't raise nitpicks.
236
233
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
237
234
 
@@ -243,8 +240,12 @@ When Coder makes any Initial Changes and Reviewer has not played since the last
243
240
  > Make a commit of the changes that belong in the repo, following @specs/dev/git.md (reread if necessary).
244
241
  > Coder is <coder-llm>.
245
242
 
243
+ Result guard: `needsBossInput` — Committing requires additional Boss input or rescoping rather than a specific answer to resume this same state.
244
+
246
245
  ### CODE-19
247
246
 
248
247
  When Coder makes any Initial Changes and Reviewer has played since the last commit, or Reviewer raises no findings on uncommitted changes and Coder has played since the last commit, Captain shall prompt Committer:
249
248
  > Make a commit of the changes that belong in the repo, following @specs/dev/git.md (reread if necessary).
250
249
  > Coder is <coder-llm>; Reviewer is <reviewer-llm>.
250
+
251
+ Result guard: `needsBossInput` — Committing requires additional Boss input or rescoping rather than a specific answer to resume this same state.
@@ -25,17 +25,25 @@ export type CodePlaybookOptions = CodingInput;
25
25
  declare function composePlayerPrompt(input: CaptainInput): string;
26
26
  declare function resolvePlayerId(input: CaptainInput): string;
27
27
  declare function adjudicate(input: CaptainInput, finalText: string, ports: PlaybookPorts, signal: AbortSignal): Promise<CaptainOutput>;
28
- declare function classifyBossText(text: string, ports: PlaybookPorts, signal: AbortSignal): Promise<CodingEvent | undefined>;
28
+ declare function classifyBossText(text: string, ports: PlaybookPorts, signal: AbortSignal, snapshotOrState?: unknown): Promise<CodingEvent | undefined>;
29
29
  declare function captainBridge(ports: PlaybookPorts, getActiveSignal?: () => AbortSignal | undefined): import("xstate").PromiseActorLogic<CaptainOutput, CaptainInput, import("xstate").EventObject>;
30
30
  interface StateMetadata {
31
31
  player: CaptainInput['player'];
32
32
  sourceItem: string;
33
33
  label: string;
34
34
  }
35
- declare function formatStateEntry(stateId: string): string;
35
+ interface PendingBossQuestionForStatus {
36
+ resumeStateId: string;
37
+ sourceItem: string;
38
+ player: string;
39
+ question: string;
40
+ }
41
+ declare function pendingBossQuestionFromContext(context: Record<string, unknown>): PendingBossQuestionForStatus | undefined;
42
+ declare function formatAwaitBossReplyEntry(context: Record<string, unknown>): string;
43
+ declare function formatStateEntry(stateId: string, context?: Record<string, unknown>): string | undefined;
36
44
  declare function formatTransition(event: unknown): string | undefined;
37
- declare function formatBossEcho(text: string, eventType?: string): string;
38
- declare function formatRiders(context: Record<string, unknown>): string;
45
+ declare function formatClassification(eventType: string): string;
46
+ declare function stateTelemetryPayload(from: unknown, to: string, event: unknown, context: Record<string, unknown>): Record<string, unknown>;
39
47
  export declare const _internal: {
40
48
  composePlayerPrompt: typeof composePlayerPrompt;
41
49
  resolvePlayerId: typeof resolvePlayerId;
@@ -44,10 +52,12 @@ export declare const _internal: {
44
52
  captainBridge: typeof captainBridge;
45
53
  STATE_LABELS: Readonly<Record<string, string>>;
46
54
  stateMetadata: ReadonlyMap<string, StateMetadata>;
55
+ pendingBossQuestionFromContext: typeof pendingBossQuestionFromContext;
56
+ formatAwaitBossReplyEntry: typeof formatAwaitBossReplyEntry;
47
57
  formatStateEntry: typeof formatStateEntry;
48
58
  formatTransition: typeof formatTransition;
49
- formatBossEcho: typeof formatBossEcho;
50
- formatRiders: typeof formatRiders;
59
+ formatClassification: typeof formatClassification;
60
+ stateTelemetryPayload: typeof stateTelemetryPayload;
51
61
  };
52
62
  export default function createPlaybookRuntime(options: CodePlaybookOptions): PlaybookRuntime;
53
63
  export {};