@sublang/playbook 5.0.0 → 6.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 (65) hide show
  1. package/README.md +11 -7
  2. package/docs/cli.md +38 -35
  3. package/docs/configuration.md +58 -15
  4. package/docs/embedding.md +24 -16
  5. package/package.json +40 -21
  6. package/reference/sdlc/captain.playbook/captain.playbook.js +2 -0
  7. package/reference/sdlc/captain.playbook/captain.playbook.ts +2 -0
  8. package/reference/sdlc/code.md +55 -97
  9. package/reference/sdlc/code.playbook/code.fsm.d.ts +229 -94
  10. package/reference/sdlc/code.playbook/code.fsm.introspect.d.ts +26 -44
  11. package/reference/sdlc/code.playbook/code.fsm.introspect.js +61 -66
  12. package/reference/sdlc/code.playbook/code.fsm.introspect.ts +100 -149
  13. package/reference/sdlc/code.playbook/code.fsm.js +587 -1347
  14. package/reference/sdlc/code.playbook/code.fsm.ts +809 -1650
  15. package/reference/sdlc/code.playbook/code.gears.md +51 -263
  16. package/reference/sdlc/code.playbook/code.playbook.d.ts +8 -47
  17. package/reference/sdlc/code.playbook/code.playbook.js +69 -656
  18. package/reference/sdlc/code.playbook/code.playbook.ts +90 -867
  19. package/reference/sdlc/code.playbook/code.registry.d.ts +9 -25
  20. package/reference/sdlc/code.playbook/code.registry.js +20 -78
  21. package/reference/sdlc/code.playbook/code.registry.ts +58 -122
  22. package/reference/sdlc/code.playbook/playbook-captain.js +93 -15
  23. package/reference/sdlc/code.playbook/playbook-captain.ts +115 -19
  24. package/reference/sdlc/code.playbook/playbook.config.template.yaml +33 -22
  25. package/reference/sdlc/decide.md +54 -0
  26. package/reference/sdlc/decide.playbook/decide.fsm.d.ts +261 -0
  27. package/reference/sdlc/decide.playbook/decide.fsm.js +894 -0
  28. package/reference/sdlc/decide.playbook/decide.fsm.ts +1152 -0
  29. package/reference/sdlc/decide.playbook/decide.gears.md +88 -0
  30. package/reference/sdlc/decide.playbook/decide.playbook.d.ts +67 -0
  31. package/reference/sdlc/{discuss.playbook/discuss.playbook.js → decide.playbook/decide.playbook.js} +471 -362
  32. package/reference/sdlc/{discuss.playbook/discuss.playbook.ts → decide.playbook/decide.playbook.ts} +575 -443
  33. package/reference/sdlc/decide.playbook/decide.registry.d.ts +41 -0
  34. package/reference/sdlc/decide.playbook/decide.registry.js +60 -0
  35. package/reference/sdlc/decide.playbook/decide.registry.ts +125 -0
  36. package/reference/sdlc/review.md +81 -0
  37. package/reference/sdlc/review.playbook/review.fsm.d.ts +183 -0
  38. package/reference/sdlc/review.playbook/review.fsm.js +524 -0
  39. package/reference/sdlc/review.playbook/review.fsm.ts +652 -0
  40. package/reference/sdlc/review.playbook/review.gears.md +112 -0
  41. package/reference/sdlc/review.playbook/review.playbook.d.ts +12 -0
  42. package/reference/sdlc/review.playbook/review.playbook.js +112 -0
  43. package/reference/sdlc/review.playbook/review.playbook.ts +201 -0
  44. package/reference/sdlc/review.playbook/review.registry.d.ts +43 -0
  45. package/reference/sdlc/review.playbook/review.registry.js +73 -0
  46. package/reference/sdlc/review.playbook/review.registry.ts +138 -0
  47. package/slc/gears2fsm.md +13 -4
  48. package/slc/link.md +48 -2
  49. package/slc/text2gears.md +22 -2
  50. package/src/runtime.d.ts +7 -0
  51. package/src/runtime.ts +12 -0
  52. package/src/xstate-playbook-runtime.d.ts +9 -2
  53. package/src/xstate-playbook-runtime.js +255 -21
  54. package/src/xstate-playbook-runtime.ts +333 -28
  55. package/src/xstate-runtime.js +25 -0
  56. package/src/xstate-runtime.ts +51 -0
  57. package/reference/sdlc/discuss.md +0 -93
  58. package/reference/sdlc/discuss.playbook/discuss.fsm.d.ts +0 -396
  59. package/reference/sdlc/discuss.playbook/discuss.fsm.js +0 -2067
  60. package/reference/sdlc/discuss.playbook/discuss.fsm.ts +0 -2465
  61. package/reference/sdlc/discuss.playbook/discuss.gears.md +0 -258
  62. package/reference/sdlc/discuss.playbook/discuss.playbook.d.ts +0 -113
  63. package/reference/sdlc/discuss.playbook/discuss.registry.d.ts +0 -58
  64. package/reference/sdlc/discuss.playbook/discuss.registry.js +0 -97
  65. package/reference/sdlc/discuss.playbook/discuss.registry.ts +0 -153
@@ -1,105 +1,63 @@
1
1
  <!-- SPDX-License-Identifier: Apache-2.0 -->
2
2
  <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- AI agents: do not edit this file without human approval. -->
3
4
 
4
5
  # Code
5
6
 
6
7
  Players:
7
8
 
8
9
  - Coder
9
- - Reviewer
10
- - Committer = Coder | Reviewer
11
-
12
- ## Coder
13
-
14
- When Boss gives a coding intent, Captain shall relay it to Coder along with the following prompt:
15
- > Assess whether this can be completed in a single commit, following best practices.
16
- > If yes, implement and test, updating both code and specs; otherwise, decompose into tasks as a new IR under @specs/intents (or @specs/iterations in older scaffolds) and stop without implementing any IR task.
17
- > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
18
- > Ensure @specs/map.md reflects the changes.
19
- > Do not commit.
20
- The resulting changes are regarded as Initial Changes.
21
-
22
- When Reviewer raises any findings, Captain shall relay them to Coder along with the following prompt:
23
- > For each review item below for the above changes, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
24
- > Stage all current changes that belong in the repo before making any edits, and leave your edits unstaged/untracked.
25
-
26
- When a new IR or IR task passes review and is committed, Captain shall prompt Coder:
27
- > Continue to implement IR-<#> if not all deliverables and tasks are done.
28
- > Implement one task at a time (including corresponding tests if any).
29
- > Stop after each task for review do not commit yet.
30
- > If relevant, mark progress in the IR.
31
- The resulting changes are regarded as Initial Changes.
32
-
33
- When an IR is done, Captain shall prompt Coder:
34
- > Read IR-<#> and corresponding commits.
35
- > According to @specs/meta.md, add or update spec items to fully capture:
36
- >
37
- > - the external behavior users rely on,
38
- > - the internal system behavior, and
39
- > - the integration/system test cases.
40
- >
41
- > The spec items should be the *minimal* set needed to reimplement code without the IR.
42
- > The set should be complete and coherent.
43
- > Avoid implementation specifics.
44
- > Avoid redundant spec items.
45
- > Ensure @specs/map.md reflects the changes.
46
-
47
- ## Reviewer
48
-
49
- For each finding in a review round, Coder either addresses it with changes or challenges it with a rebuttal.
50
- Any code change to address findings starts a new round of review, even if some findings are also rebutted.
51
- Rounds continue until Reviewer raises no findings.
52
-
53
- Spec item files are the files under @specs/ that hold spec items — @specs/packages/ and @specs/compositions/ in the current layout, or @specs/user/, @specs/dev/, and @specs/test/ in the legacy one; decision and intent records (iteration records in older scaffolds), @specs/map.md, and @specs/meta.md are not spec item files.
54
-
55
- When Reviewer begins the first review round on changes from a Boss coding intent, Captain shall relay the intent to Reviewer.
56
-
57
- When Reviewer begins the first review round on changes from an IR task, Captain shall relay the IR's task description to Reviewer.
58
-
59
- When Committer commits Initial Changes, Captain shall prompt Reviewer to begin a review round:
60
- > Review the latest commit.
61
- > Refer to the commit message.
62
-
63
- When any changes are made by Coder but not reviewed (outside of any Initial Changes), Captain shall prompt Reviewer to begin a review round:
64
- > Review the unstaged and untracked changes in the context of the staged changes.
65
- > Understand the intent.
66
-
67
- When Reviewer begins a review round involving spec item files, Captain shall prompt Reviewer:
68
- > Verify any affected spec items are:
69
- >
70
- > - Complete & coherent: sufficient for you to reimplement code.
71
- > - Right level: external behavior users rely on or internal system behavior (organized per @specs/meta.md), not implementation specifics; integration/system testing, not unit testing.
72
- > - Minimal: essential and concise; every item earns its place; also check with other items.
73
- > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
74
- >
75
- > Flag anything missing, redundant, over-specified, or under-specified.
76
-
77
- When Reviewer begins a review round involving any changes outside spec item files, Captain shall prompt Reviewer:
78
- > Flag any issues or improvements (numbered; no duplication).
79
- > Think thoroughly — don't just approve or reject.
80
-
81
- When Reviewer begins any review round, Captain shall prompt Reviewer:
82
- > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
83
- > Verify @specs/map.md reflects the changes.
84
- > If the change is ready to commit or push, don't raise nitpicks.
85
- > Do not edit files or commit; report findings only.
86
-
87
- When Coder raises any rebuttals, Captain shall relay them to Reviewer along with the following prompt:
88
- > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
89
- > Do not edit files or commit; report findings only.
90
-
91
- ## Committer
92
-
93
- When Coder makes any Initial Changes or Reviewer raises no findings on uncommitted changes, Captain shall prompt Committer:
94
- > Make a commit of the changes that belong in the repo, following @specs/packages/git.md (reread if necessary).
95
- > If that spec is absent, follow the legacy @specs/dev/git.md; if neither exists, follow the repository's existing commit conventions and do not search elsewhere.
96
- > Write the commit message concisely.
97
-
98
- When Captain prompts Committer and only Coder has played since the last commit, Captain shall also append:
99
- > Coder is \<coder-llm\>.
100
-
101
- When Captain prompts Committer and both Coder and Reviewer have played since the last commit, Captain shall also append:
102
- > Coder is \<coder-llm\>; Reviewer is \<reviewer-llm\>.
103
-
104
- When Captain prompts Committer, Captain shall also append:
105
- > Format the `Co-authored-by` `<model>` token as the conventional human form of the substituted id (e.g., `claude-opus-4-7` → `Claude-Opus-4.7`, `gpt-5.5` → `GPT-5.5`).
10
+
11
+ The caller supplies the coding intent including any specific context.
12
+
13
+ A coding intent follows either one direct implementation phase or an IR sequence consisting of a new-IR phase and one phase for each IR task.
14
+ Each phase ends with one new Coder commit (owned by `code`).
15
+ After each `code`-owned commit, Captain shall call the `review` playbook and wait until it passes with no unsettled findings.
16
+ Playbook `review` owns every review round and every review-fix commit.
17
+ Do not amend any reviewed commit.
18
+
19
+ When `review` passes a direct implementation phase, `code` is complete.
20
+ When `review` passes a new IR or a nonfinal IR-task phase, Captain shall continue with the next unfinished IR-task phase.
21
+ When `review` passes the final IR-task phase, `code` is complete.
22
+ When `review` returns an authored abort or failure, or a terminal result that does not prove exact approval, `code` shall start no further phase and shall report the failure and the last `code`-owned commit to its caller.
23
+ When the nested `review` call fails outside that authored result contract, `code` shall park as failed and retain the control-plane error instead of reporting an authored review outcome.
24
+
25
+ At the start of the first phase, Captain shall relay to Coder the complete caller input and any relevant run results in quotes (`>`), along with the following instruction:
26
+
27
+ ```markdown
28
+ Assess whether the coding intent can be completed well in one commit.
29
+ If yes, implement and test it, update the affected specs, and ensure @specs/map.md remains accurate.
30
+ Otherwise, decompose it into tasks sized to exactly one commit each, add a new IR under @specs/intents, and do not implement any IR task in this phase.
31
+ Plan affected spec updates before, with, or after their corresponding code changes, either as standalone IR tasks or as explicit work within related tasks.
32
+
33
+ Consult @specs/map.md for relevant context and @specs/meta.md for spec requirements, if needed.
34
+ ```
35
+
36
+ At the start of every IR-task phase, Captain shall relay to Coder the exact next task and any relevant run results in quotes (`>`), along with the following instruction:
37
+
38
+ ```markdown
39
+ Read IR-<#> and implement exactly the next unfinished task, including corresponding tests or specs if any.
40
+ Do not implement a later task in this phase.
41
+ Mark the IR's progress and deliverables when relevant.
42
+ If the IR will be finished after this phase, double-check that all acceptance criteria are met.
43
+ ```
44
+
45
+ At the start of *every* phase, Captain shall append the following instruction:
46
+
47
+ ```markdown
48
+ Do not re-run tests or builds whose inputs have not changed since any previous reported run.
49
+ Make the phase's minimal changes and then one new commit, following @specs/packages/git.md; never amend an existing commit.
50
+ Make the commit message explain concisely what changed and why, including relevant verification.
51
+ Report it as exactly one final-response line beginning `Commit: `, followed only by the exact commit identity.
52
+ Coder is <coder-llm>; format the model token in conventional human form.
53
+ ```
54
+
55
+ After the first phase (either direct implementation or a new-IR phase), Captain shall call playbook `review` and input the following in quotes (`>`):
56
+
57
+ > Initial intent: \<caller-input\>
58
+ > Coder output: \<coder-output\>
59
+
60
+ After every IR-task phase, Captain shall call playbook `review` and input the following in quotes (`>`):
61
+
62
+ > IR task: \<ir-task\>
63
+ > Coder output: \<coder-output\>
@@ -1,112 +1,247 @@
1
- type Player = 'Coder' | 'Reviewer' | 'Committer';
2
- type JumpableStateId = 'ready' | 'planAndImplement' | 'respondToReview' | 'continueIr' | 'summarizeSpecs' | 'reviewBossCommitSpecs' | 'reviewBossCommitCode' | 'reviewBossCommitMixed' | 'reviewIrTaskCommitSpecs' | 'reviewIrTaskCommitCode' | 'reviewIrTaskCommitMixed' | 'reviewChangesSpecs' | 'reviewChangesCode' | 'reviewChangesMixed' | 'reviewChangesAndChallengesSpecs' | 'reviewChangesAndChallengesCode' | 'reviewChangesAndChallengesMixed' | 'adjudicateChallenges' | 'commitCoderInitial' | 'commitJoint' | 'failed';
3
- type WorkflowKind = 'singleCommit' | 'iteration' | 'specSummary';
4
- type ChangeOrigin = 'bossIntent' | 'irTask';
5
- type ReviewSubject = 'commit' | 'changes';
6
- type AfterReview = 'continueIr' | 'summarizeSpecs' | 'done';
7
- type ResumableStateId = Exclude<JumpableStateId, 'ready' | 'failed'>;
8
- type PendingBossQuestion = {
9
- questionId: ResumableStateId;
10
- resumeStateId: ResumableStateId;
11
- sourceItem: string;
12
- player: Player;
13
- question: string;
1
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
2
+ readonly [key: string]: JsonValue;
14
3
  };
15
- export type CaptainInput = {
16
- stateId: ResumableStateId;
17
- sourceItem: string;
18
- prompt: string;
19
- result: Record<string, string>;
20
- intent?: string;
21
- irNumber?: string;
22
- taskDescription?: string;
23
- reviews?: string;
24
- challenges?: string;
25
- coderPlayer?: string;
26
- reviewerPlayer?: string;
27
- committerPlayer?: string;
28
- pendingBossQuestion?: PendingBossQuestion;
29
- bossReply?: string;
4
+ export type CodeStateId = 'runFirstPhase' | 'reviewFirstCommit' | 'runIrTask' | 'reviewIrTask';
5
+ export type CodeSourceItem = 'CODE-1' | 'CODE-2' | 'CODE-3' | 'CODE-4';
6
+ export type CodePhase = 'direct' | 'ir-created' | 'ir-task-more' | 'ir-task-final';
7
+ export type PendingBossQuestion = {
8
+ readonly questionId: 'runFirstPhase' | 'runIrTask';
9
+ readonly resumeStateId: 'runFirstPhase' | 'runIrTask';
10
+ readonly sourceItem: 'CODE-1' | 'CODE-3';
11
+ readonly player: 'Coder';
12
+ readonly question: string;
30
13
  };
31
- export type PlayerInput = CaptainInput & {
32
- player: Player;
14
+ export type PlayerInput = {
15
+ readonly stateId: 'runFirstPhase' | 'runIrTask';
16
+ readonly player: 'Coder';
17
+ readonly sourceItem: 'CODE-1' | 'CODE-3';
18
+ readonly prompt: string;
19
+ readonly result: Readonly<Record<string, string>>;
20
+ readonly callerInput: string;
21
+ readonly runResults: string;
22
+ readonly coderPlayer: string;
23
+ readonly irNumber?: string;
24
+ readonly irTask?: string;
25
+ readonly pendingBossQuestion?: PendingBossQuestion;
26
+ readonly bossReply?: string;
33
27
  };
34
- export type CaptainOutput = {
35
- guard: string;
36
- irNumber?: string;
37
- taskDescription?: string;
38
- reviews?: string;
39
- challenges?: string;
40
- summary?: string;
41
- question?: string;
42
- [k: string]: unknown;
28
+ export type PlayerOutput = {
29
+ readonly guard: 'directCommit';
30
+ readonly coderOutput: string;
31
+ readonly latestCommit: string;
32
+ } | {
33
+ readonly guard: 'irCommit';
34
+ readonly coderOutput: string;
35
+ readonly latestCommit: string;
36
+ readonly irNumber: string;
37
+ readonly irTask: string;
38
+ } | {
39
+ readonly guard: 'moreTasks';
40
+ readonly coderOutput: string;
41
+ readonly latestCommit: string;
42
+ readonly irTask: string;
43
+ } | {
44
+ readonly guard: 'finalTask';
45
+ readonly coderOutput: string;
46
+ readonly latestCommit: string;
47
+ } | {
48
+ readonly guard: 'needsBossReply';
49
+ readonly question: string;
50
+ };
51
+ export type PlaybookInput = {
52
+ readonly stateId: 'reviewFirstCommit' | 'reviewIrTask';
53
+ readonly sourceItem: 'CODE-2' | 'CODE-4';
54
+ readonly playbookId: 'review';
55
+ readonly text: string;
56
+ };
57
+ export type ReviewOutput = {
58
+ readonly approvedCommit: 'latest';
59
+ readonly noUnsettledFindings: true;
60
+ };
61
+ export type CompactError = {
62
+ readonly name: string;
63
+ readonly message: string;
64
+ };
65
+ export type CodePlaybookOutput = {
66
+ readonly status: 'complete';
67
+ /** Exact identity of the latest CODE-owned commit. */
68
+ readonly lastCodeCommit: string;
69
+ /** Exact Coder final text produced after that commit. */
70
+ readonly lastCodeOutput: string;
71
+ } | {
72
+ readonly status: 'review-failed';
73
+ /** Exact identity of the latest CODE-owned commit. */
74
+ readonly lastCodeCommit: string;
75
+ /** Exact Coder final text produced after that commit. */
76
+ readonly lastCodeOutput: string;
77
+ readonly error: CompactError;
43
78
  };
44
- export type PlayerOutput = CaptainOutput;
45
79
  export type CodingInput = {
46
- intent?: string;
47
- irNumber?: string;
48
- coderPlayer?: string;
49
- reviewerPlayer?: string;
50
- committerPlayer?: string;
80
+ readonly coderPlayer?: string;
81
+ readonly runResults?: string;
51
82
  };
52
- export type CodingContext = CodingInput & {
53
- workflow?: WorkflowKind;
54
- changeOrigin?: ChangeOrigin;
55
- reviewSubject?: ReviewSubject;
56
- afterReview?: AfterReview;
57
- taskDescription?: string;
58
- reviews?: string;
59
- challenges?: string;
60
- lastResult?: CaptainOutput;
61
- lastError?: unknown;
62
- pendingBossQuestion?: PendingBossQuestion;
63
- bossReply?: string;
83
+ export type CodingContext = {
84
+ readonly coderPlayer: string;
85
+ readonly runResults: string;
86
+ readonly callerInput?: string;
87
+ readonly coderOutput?: string;
88
+ readonly latestCommit?: string;
89
+ readonly irNumber?: string;
90
+ readonly irTask?: string;
91
+ readonly nextIrTask?: string;
92
+ readonly phase?: CodePhase;
93
+ readonly completion?: 'complete' | 'review-failed';
94
+ readonly reviewError?: CompactError;
95
+ readonly lastError?: unknown;
96
+ readonly pendingBossQuestion?: PendingBossQuestion;
97
+ readonly bossReply?: string;
64
98
  };
65
99
  export type CodingEvent = {
66
- type: 'START_CODING';
67
- intent: string;
100
+ readonly type: 'START_CODE';
101
+ readonly callerInput: string;
102
+ } | {
103
+ readonly type: 'BOSS_REPLY';
104
+ readonly answer: string;
105
+ readonly questionId?: 'runFirstPhase' | 'runIrTask';
106
+ };
107
+ export declare const codingMachine: import("xstate").StateMachine<CodingContext, {
108
+ readonly type: "START_CODE";
109
+ readonly callerInput: string;
68
110
  } | {
69
- type: 'CONTINUE_IR';
70
- irNumber: string;
111
+ readonly type: "BOSS_REPLY";
112
+ readonly answer: string;
113
+ readonly questionId?: "runFirstPhase" | "runIrTask";
114
+ }, {
115
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<JsonValue | undefined, PlaybookInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>> | undefined;
116
+ }, {
117
+ src: "playbook";
118
+ logic: import("xstate").PromiseActorLogic<JsonValue | undefined, PlaybookInput, import("xstate").EventObject>;
119
+ id: string | undefined;
71
120
  } | {
72
- type: 'SUMMARIZE_IR';
73
- irNumber: string;
121
+ src: "player";
122
+ logic: import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>;
123
+ id: string | undefined;
124
+ }, {
125
+ type: "rememberActorError";
126
+ params: import("xstate").NonReducibleUnknown;
74
127
  } | {
75
- type: 'BOSS_INTERRUPT';
76
- targetId: JumpableStateId;
77
- intent?: string;
78
- irNumber?: string;
128
+ type: "startCoding";
129
+ params: import("xstate").NonReducibleUnknown;
79
130
  } | {
80
- type: 'BOSS_REPLY';
81
- answer: string;
82
- questionId?: ResumableStateId;
83
- };
84
- export declare const codingMachine: import("xstate").StateMachine<CodingContext, {
85
- type: "START_CODING";
86
- intent: string;
131
+ type: "rememberDirectCommit";
132
+ params: import("xstate").NonReducibleUnknown;
87
133
  } | {
88
- type: "CONTINUE_IR";
89
- irNumber: string;
134
+ type: "rememberIrCommit";
135
+ params: import("xstate").NonReducibleUnknown;
90
136
  } | {
91
- type: "SUMMARIZE_IR";
92
- irNumber: string;
137
+ type: "rememberMoreTasks";
138
+ params: import("xstate").NonReducibleUnknown;
93
139
  } | {
94
- type: "BOSS_INTERRUPT";
95
- targetId: JumpableStateId;
96
- intent?: string;
97
- irNumber?: string;
140
+ type: "rememberFinalTask";
141
+ params: import("xstate").NonReducibleUnknown;
98
142
  } | {
99
- type: "BOSS_REPLY";
100
- answer: string;
101
- questionId?: ResumableStateId;
102
- }, {
103
- [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<CaptainOutput, PlayerInput, import("xstate").EventObject>> | undefined;
143
+ type: "advanceToNextIrTask";
144
+ params: import("xstate").NonReducibleUnknown;
145
+ } | {
146
+ type: "rememberPendingQuestion";
147
+ params: import("xstate").NonReducibleUnknown;
148
+ } | {
149
+ type: "rememberBossReply";
150
+ params: import("xstate").NonReducibleUnknown;
151
+ } | {
152
+ type: "rememberEmptyBossReplyError";
153
+ params: import("xstate").NonReducibleUnknown;
154
+ } | {
155
+ type: "completeSuccessfully";
156
+ params: import("xstate").NonReducibleUnknown;
157
+ } | {
158
+ type: "completeWithReviewFailure";
159
+ params: import("xstate").NonReducibleUnknown;
160
+ } | {
161
+ type: "completeWithInvalidReviewOutput";
162
+ params: import("xstate").NonReducibleUnknown;
163
+ } | {
164
+ type: "rememberMalformedPlayerOutput";
165
+ params: import("xstate").NonReducibleUnknown;
104
166
  }, {
105
- src: "player";
106
- logic: import("xstate").PromiseActorLogic<CaptainOutput, PlayerInput, import("xstate").EventObject>;
107
- id: string | undefined;
108
- }, never, never, never, {}, string, CodingInput, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
109
- states?: {} | undefined;
110
- id?: string | undefined | undefined;
167
+ type: "needsBossReply";
168
+ params: unknown;
169
+ } | {
170
+ type: "isDirectCommit";
171
+ params: unknown;
172
+ } | {
173
+ type: "isIrCommit";
174
+ params: unknown;
175
+ } | {
176
+ type: "isMoreTasks";
177
+ params: unknown;
178
+ } | {
179
+ type: "isFinalTask";
180
+ params: unknown;
181
+ } | {
182
+ type: "authoredReviewFailure";
183
+ params: unknown;
184
+ } | {
185
+ type: "reviewApprovedDirect";
186
+ params: unknown;
187
+ } | {
188
+ type: "reviewApprovedIrCreated";
189
+ params: unknown;
190
+ } | {
191
+ type: "reviewApprovedMoreTasks";
192
+ params: unknown;
193
+ } | {
194
+ type: "reviewApprovedFinalTask";
195
+ params: unknown;
196
+ } | {
197
+ type: "emptyBossReply";
198
+ params: unknown;
199
+ } | {
200
+ type: "resumesFirstPhase";
201
+ params: unknown;
202
+ } | {
203
+ type: "resumesIrTask";
204
+ params: unknown;
205
+ }, never, "done" | "failed" | "awaitBossReply" | "ready" | "runFirstPhase" | "reviewFirstCommit" | "runIrTask" | "reviewIrTask", string, CodingInput, {
206
+ readonly status: "complete";
207
+ /** Exact identity of the latest CODE-owned commit. */
208
+ readonly lastCodeCommit: string;
209
+ /** Exact Coder final text produced after that commit. */
210
+ readonly lastCodeOutput: string;
211
+ } | {
212
+ readonly status: "review-failed";
213
+ /** Exact identity of the latest CODE-owned commit. */
214
+ readonly lastCodeCommit: string;
215
+ /** Exact Coder final text produced after that commit. */
216
+ readonly lastCodeOutput: string;
217
+ readonly error: CompactError;
218
+ }, import("xstate").EventObject, import("xstate").MetaObject, {
219
+ id: "code";
220
+ states: {
221
+ readonly ready: {
222
+ id: "ready";
223
+ };
224
+ readonly runFirstPhase: {
225
+ id: "runFirstPhase";
226
+ };
227
+ readonly reviewFirstCommit: {
228
+ id: "reviewFirstCommit";
229
+ };
230
+ readonly runIrTask: {
231
+ id: "runIrTask";
232
+ };
233
+ readonly reviewIrTask: {
234
+ id: "reviewIrTask";
235
+ };
236
+ readonly awaitBossReply: {
237
+ id: "awaitBossReply";
238
+ };
239
+ readonly failed: {
240
+ id: "failed";
241
+ };
242
+ readonly done: {
243
+ id: "done";
244
+ };
245
+ };
111
246
  }>;
112
- export {};
247
+ export default codingMachine;
@@ -1,54 +1,36 @@
1
- import type { CodingContext, PlayerInput, codingMachine } from './code.fsm.js';
2
- export interface CaptainStateInfo {
3
- readonly stateId: string;
4
- readonly sourceItem: string;
5
- readonly getInput: (context: Partial<CodingContext>) => PlayerInput;
6
- readonly transitions: ReadonlyArray<CaptainTransition>;
7
- }
8
- export interface CaptainTransition {
1
+ import type { CodingContext, PlaybookInput, PlayerInput, codingMachine } from './code.fsm.js';
2
+ export type TransitionGuard = (args: {
3
+ context: CodingContext;
4
+ event: unknown;
5
+ }) => boolean;
6
+ export interface InvokingTransition {
9
7
  readonly index: number;
10
8
  readonly target: string;
11
- readonly guard: TransitionGuard;
9
+ readonly guard?: TransitionGuard;
12
10
  readonly actions: unknown;
13
11
  }
14
- export interface AwaitBossReplyInfo {
12
+ export interface PlayerStateInfo {
15
13
  readonly stateId: string;
16
- readonly bossReplyTransitions: ReadonlyArray<BossReplyTransition>;
17
- readonly transitions: ReadonlyArray<AwaitBossReplyTransition>;
14
+ readonly sourceItem: string;
15
+ readonly getInput: (context: CodingContext) => PlayerInput;
16
+ readonly transitions: readonly InvokingTransition[];
18
17
  }
19
- export interface BossReplyTransition {
20
- readonly index: number;
21
- readonly target: string;
22
- readonly guard: TransitionGuard;
23
- readonly actions: unknown;
18
+ export interface NestedPlaybookStateInfo {
19
+ readonly stateId: string;
20
+ readonly sourceItem: string;
21
+ readonly getInput: (context: CodingContext) => PlaybookInput;
22
+ readonly transitions: readonly InvokingTransition[];
24
23
  }
25
- export interface AwaitBossReplyTransition {
26
- readonly eventType: string;
27
- readonly index: number;
28
- readonly target: string;
29
- readonly guard: TransitionGuard;
30
- readonly actions: unknown;
24
+ export interface AwaitBossReplyInfo {
25
+ readonly stateId: 'awaitBossReply';
26
+ readonly bossReplyTransitions: readonly InvokingTransition[];
31
27
  }
32
- export type TransitionGuard = (args: {
33
- context: CodingContext;
34
- event: unknown;
35
- }) => boolean;
36
- export interface RootEventTable {
37
- readonly startCoding: {
38
- readonly target: string;
39
- };
40
- readonly continueIr: {
41
- readonly target: string;
42
- };
43
- readonly summarizeIr: {
28
+ export declare function enumeratePlayerStates(machine: typeof codingMachine): readonly PlayerStateInfo[];
29
+ export declare const enumerateCaptainStates: typeof enumeratePlayerStates;
30
+ export declare function enumerateNestedPlaybookStates(machine: typeof codingMachine): readonly NestedPlaybookStateInfo[];
31
+ export declare function enumerateAwaitBossReply(machine: typeof codingMachine): AwaitBossReplyInfo;
32
+ export declare function enumerateRootEvents(machine: typeof codingMachine): {
33
+ readonly startCode: {
44
34
  readonly target: string;
45
35
  };
46
- readonly bossInterruptTargets: ReadonlyArray<string>;
47
- readonly bossInterruptTargetDescriptions: ReadonlyArray<{
48
- readonly stateId: string;
49
- readonly description: string;
50
- }>;
51
- }
52
- export declare function enumerateCaptainStates(machine: typeof codingMachine): readonly CaptainStateInfo[];
53
- export declare function enumerateRootEvents(machine: typeof codingMachine): RootEventTable;
54
- export declare function enumerateAwaitBossReply(machine: typeof codingMachine): AwaitBossReplyInfo;
36
+ };