@sublang/playbook 15.1.0 → 17.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.
- package/README.md +2 -0
- package/docs/cli.md +36 -18
- package/docs/configuration.md +7 -5
- package/docs/embedding.md +28 -7
- package/package.json +4 -4
- package/reference/sdlc/branch.playbook/branch.fsm.d.ts +63 -33
- package/reference/sdlc/branch.playbook/branch.fsm.js +190 -108
- package/reference/sdlc/branch.playbook/branch.fsm.ts +269 -147
- package/reference/sdlc/branch.playbook/branch.gears.md +7 -17
- package/reference/sdlc/branch.playbook/branch.playbook.d.ts +12 -16
- package/reference/sdlc/branch.playbook/branch.playbook.js +112 -101
- package/reference/sdlc/branch.playbook/branch.playbook.ts +128 -171
- package/reference/sdlc/branch.playbook/branch.registry.d.ts +3 -2
- package/reference/sdlc/branch.playbook/branch.registry.ts +6 -2
- package/reference/sdlc/captain.md +19 -10
- package/reference/sdlc/captain.playbook/captain.fsm.d.ts +6 -2
- package/reference/sdlc/captain.playbook/captain.fsm.js +19 -7
- package/reference/sdlc/captain.playbook/captain.fsm.ts +25 -10
- package/reference/sdlc/captain.playbook/captain.gears.md +16 -8
- package/reference/sdlc/captain.playbook/captain.playbook.d.ts +1 -1
- package/reference/sdlc/captain.playbook/captain.playbook.js +3 -2
- package/reference/sdlc/captain.playbook/captain.playbook.ts +4 -3
- package/reference/sdlc/code.playbook/bin/interactive-session.js +14 -1
- package/reference/sdlc/code.playbook/bin/portable-codec.js +3 -0
- package/reference/sdlc/code.playbook/bin/repository-effects.js +1 -0
- package/reference/sdlc/code.playbook/bin/run.js +128 -85
- package/reference/sdlc/code.playbook/bin/session-host.js +40 -8
- package/reference/sdlc/code.playbook/bin/session-store.js +162 -34
- package/reference/sdlc/code.playbook/code.fsm.d.ts +146 -93
- package/reference/sdlc/code.playbook/code.fsm.introspect.d.ts +8 -8
- package/reference/sdlc/code.playbook/code.fsm.introspect.ts +13 -13
- package/reference/sdlc/code.playbook/code.fsm.js +609 -649
- package/reference/sdlc/code.playbook/code.fsm.ts +890 -821
- package/reference/sdlc/code.playbook/code.gears.md +39 -29
- package/reference/sdlc/code.playbook/code.playbook.d.ts +13 -16
- package/reference/sdlc/code.playbook/code.playbook.js +166 -147
- package/reference/sdlc/code.playbook/code.playbook.ts +180 -229
- package/reference/sdlc/code.playbook/code.registry.d.ts +3 -2
- package/reference/sdlc/code.playbook/code.registry.ts +6 -2
- package/reference/sdlc/code.playbook/host-capabilities.d.ts +3 -0
- package/reference/sdlc/code.playbook/playbook-captain.d.ts +74 -2
- package/reference/sdlc/code.playbook/playbook-captain.js +1548 -468
- package/reference/sdlc/code.playbook/playbook-captain.ts +1993 -573
- package/reference/sdlc/code.playbook/session-host.d.ts +4 -1
- package/reference/sdlc/code.playbook/session-store.d.ts +17 -0
- package/reference/sdlc/code.playbook/session-store.js +1 -0
- package/reference/sdlc/decide.md +1 -0
- package/reference/sdlc/decide.playbook/decide.fsm.d.ts +273 -157
- package/reference/sdlc/decide.playbook/decide.fsm.js +765 -732
- package/reference/sdlc/decide.playbook/decide.fsm.ts +1167 -945
- package/reference/sdlc/decide.playbook/decide.gears.md +28 -21
- package/reference/sdlc/decide.playbook/decide.playbook.d.ts +11 -59
- package/reference/sdlc/decide.playbook/decide.playbook.js +155 -3696
- package/reference/sdlc/decide.playbook/decide.playbook.ts +186 -5244
- package/reference/sdlc/decide.playbook/decide.registry.d.ts +8 -4
- package/reference/sdlc/decide.playbook/decide.registry.js +2 -2
- package/reference/sdlc/decide.playbook/decide.registry.ts +13 -6
- package/reference/sdlc/dev.playbook/dev.fsm.d.ts +116 -134
- package/reference/sdlc/dev.playbook/dev.fsm.js +517 -575
- package/reference/sdlc/dev.playbook/dev.fsm.ts +667 -787
- package/reference/sdlc/dev.playbook/dev.gears.md +52 -54
- package/reference/sdlc/dev.playbook/dev.playbook.d.ts +13 -10
- package/reference/sdlc/dev.playbook/dev.playbook.js +128 -120
- package/reference/sdlc/dev.playbook/dev.playbook.ts +143 -193
- package/reference/sdlc/dev.playbook/dev.registry.d.ts +3 -2
- package/reference/sdlc/dev.playbook/dev.registry.ts +6 -2
- package/reference/sdlc/pr.playbook/pr.fsm.d.ts +95 -88
- package/reference/sdlc/pr.playbook/pr.fsm.js +461 -518
- package/reference/sdlc/pr.playbook/pr.fsm.ts +533 -663
- package/reference/sdlc/pr.playbook/pr.gears.md +47 -63
- package/reference/sdlc/pr.playbook/pr.playbook.d.ts +13 -23
- package/reference/sdlc/pr.playbook/pr.playbook.js +118 -112
- package/reference/sdlc/pr.playbook/pr.playbook.ts +136 -190
- package/reference/sdlc/pr.playbook/pr.registry.d.ts +3 -2
- package/reference/sdlc/pr.playbook/pr.registry.ts +4 -2
- package/reference/sdlc/review.md +3 -3
- package/reference/sdlc/review.playbook/review.fsm.d.ts +150 -116
- package/reference/sdlc/review.playbook/review.fsm.js +479 -550
- package/reference/sdlc/review.playbook/review.fsm.ts +717 -662
- package/reference/sdlc/review.playbook/review.gears.md +32 -29
- package/reference/sdlc/review.playbook/review.playbook.d.ts +12 -12
- package/reference/sdlc/review.playbook/review.playbook.js +180 -155
- package/reference/sdlc/review.playbook/review.playbook.ts +190 -230
- package/reference/sdlc/review.playbook/review.registry.d.ts +6 -5
- package/reference/sdlc/review.playbook/review.registry.js +3 -3
- package/reference/sdlc/review.playbook/review.registry.ts +9 -5
- package/slc/gears2fsm.md +77 -8
- package/slc/link.md +127 -60
- package/slc/materialize-link.mjs +51 -13
- package/slc/optimize.md +4 -1
- package/slc/prefix-prompts.mjs +29 -28
- package/slc/prefix.md +27 -24
- package/slc/slc.pin-inputs.json +11 -2
- package/slc/text2gears.md +71 -11
- package/src/runtime.d.ts +46 -2
- package/src/runtime.ts +42 -2
- package/src/xstate-playbook-runtime.d.ts +63 -23
- package/src/xstate-playbook-runtime.js +1637 -475
- package/src/xstate-playbook-runtime.ts +2105 -532
- package/src/xstate-runtime.d.ts +3 -4
- package/src/xstate-runtime.js +52 -0
- package/src/xstate-runtime.ts +59 -4
|
@@ -1,31 +1,58 @@
|
|
|
1
|
+
import type { PlaybookCallResult } from '@sublang/playbook/runtime';
|
|
1
2
|
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
2
3
|
readonly [key: string]: JsonValue;
|
|
3
4
|
};
|
|
4
|
-
|
|
5
|
+
/** Canonical lowercase local id of the source role Coder. */
|
|
6
|
+
export type CodeRole = 'coder';
|
|
7
|
+
/** One role-id array per parallel group; CODE declares no parallel group. */
|
|
8
|
+
export declare const concurrentRoleSets: readonly (readonly CodeRole[])[];
|
|
9
|
+
/** Delegated-player working leaves (CODE-1, CODE-3). */
|
|
10
|
+
export type WorkingStateId = 'firstPhase' | 'irTaskPhase';
|
|
11
|
+
/** Working leaves that may suspend for, and resume from, a Boss reply. */
|
|
12
|
+
export type ResumableStateId = WorkingStateId;
|
|
13
|
+
/** Root `BOSS_INTERRUPT` targets. */
|
|
14
|
+
export type JumpableStateId = WorkingStateId;
|
|
15
|
+
/** Nested `review` call states (CODE-2, CODE-4). */
|
|
16
|
+
export type ReviewStateId = 'reviewNewIntentPhase' | 'reviewIrTaskPhase';
|
|
5
17
|
export type CodeSourceItem = 'CODE-1' | 'CODE-2' | 'CODE-3' | 'CODE-4';
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
/** The accepted phase outcome whose `review` call decides the next step. */
|
|
19
|
+
export type PhaseOutcome = 'directCommit' | 'irCommit' | 'moreTasks' | 'finalTask';
|
|
20
|
+
/** The literal nested-call target shared by both call states and guards. */
|
|
21
|
+
declare const REVIEW_PLAYBOOK_ID = "review";
|
|
22
|
+
export interface PendingBossQuestion {
|
|
23
|
+
readonly questionId: ResumableStateId;
|
|
24
|
+
readonly resumeStateId: ResumableStateId;
|
|
10
25
|
readonly sourceItem: 'CODE-1' | 'CODE-3';
|
|
11
26
|
readonly asker: {
|
|
12
27
|
readonly kind: 'role';
|
|
13
|
-
readonly roleId:
|
|
28
|
+
readonly roleId: CodeRole;
|
|
14
29
|
};
|
|
15
30
|
readonly question: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
readonly sourceItem: 'CODE-1' | 'CODE-3';
|
|
31
|
+
}
|
|
32
|
+
interface PlayerInputBase {
|
|
33
|
+
readonly role: CodeRole;
|
|
34
|
+
/** The source item's full final prompt, verbatim. */
|
|
21
35
|
readonly prompt: string;
|
|
36
|
+
/** This state's local result contract: guard name → description. */
|
|
22
37
|
readonly result: Readonly<Record<string, string>>;
|
|
23
|
-
|
|
38
|
+
/** `<caller-input>`: the caller's complete coding request. */
|
|
39
|
+
readonly callerInput?: string;
|
|
40
|
+
/** `<run-results>`: relevant run results; empty when none were supplied. */
|
|
24
41
|
readonly runResults: string;
|
|
25
|
-
readonly irNumber?: string;
|
|
26
42
|
readonly pendingBossQuestion?: PendingBossQuestion;
|
|
27
43
|
readonly bossReply?: string;
|
|
28
|
-
}
|
|
44
|
+
}
|
|
45
|
+
export interface FirstPhasePlayerInput extends PlayerInputBase {
|
|
46
|
+
readonly stateId: 'firstPhase';
|
|
47
|
+
readonly sourceItem: 'CODE-1';
|
|
48
|
+
}
|
|
49
|
+
export interface IrTaskPhasePlayerInput extends PlayerInputBase {
|
|
50
|
+
readonly stateId: 'irTaskPhase';
|
|
51
|
+
readonly sourceItem: 'CODE-3';
|
|
52
|
+
/** `<ir-number>`: the IR whose next unfinished task this phase implements. */
|
|
53
|
+
readonly irNumber?: string;
|
|
54
|
+
}
|
|
55
|
+
export type PlayerInput = FirstPhasePlayerInput | IrTaskPhasePlayerInput;
|
|
29
56
|
export type PlayerOutput = {
|
|
30
57
|
readonly guard: 'directCommit';
|
|
31
58
|
readonly coderOutput: string;
|
|
@@ -51,82 +78,116 @@ export type PlayerOutput = {
|
|
|
51
78
|
readonly guard: 'needsBossReply';
|
|
52
79
|
readonly question: string;
|
|
53
80
|
};
|
|
54
|
-
export
|
|
55
|
-
readonly stateId:
|
|
81
|
+
export interface PlaybookInput {
|
|
82
|
+
readonly stateId: ReviewStateId;
|
|
56
83
|
readonly sourceItem: 'CODE-2' | 'CODE-4';
|
|
57
|
-
readonly playbookId:
|
|
84
|
+
readonly playbookId: typeof REVIEW_PLAYBOOK_ID;
|
|
58
85
|
readonly text: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
86
|
+
}
|
|
87
|
+
/** A successful call yields the child's own JSON-safe machine output. */
|
|
88
|
+
export type PlaybookOutput = JsonValue | undefined;
|
|
89
|
+
/** Public output interface of the packaged builtin `review`. */
|
|
90
|
+
export interface ReviewPassOutput {
|
|
61
91
|
readonly noUnsettledFindings: true;
|
|
62
|
-
/**
|
|
63
|
-
* Exact repository revision at which the review scope was evaluated:
|
|
64
|
-
* the last review-fix commit when one landed, otherwise the clean
|
|
65
|
-
* round's receipt-observed HEAD (DR-045). Always present.
|
|
66
|
-
*/
|
|
67
92
|
readonly evaluatedRevision: string;
|
|
68
|
-
}
|
|
69
|
-
export
|
|
93
|
+
}
|
|
94
|
+
export interface CompactError {
|
|
70
95
|
readonly name: string;
|
|
71
96
|
readonly message: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ErrorRecord {
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly message: string;
|
|
101
|
+
readonly stack?: string;
|
|
102
|
+
}
|
|
103
|
+
/** Sanitized completed-result evidence of the `review` call that ended CODE. */
|
|
104
|
+
export type CompletedReviewResult = {
|
|
105
|
+
readonly playbookId: typeof REVIEW_PLAYBOOK_ID;
|
|
106
|
+
readonly status: 'ok';
|
|
107
|
+
readonly output?: JsonValue;
|
|
108
|
+
} | {
|
|
109
|
+
readonly playbookId: typeof REVIEW_PLAYBOOK_ID;
|
|
110
|
+
readonly status: 'aborted' | 'error';
|
|
111
|
+
readonly error: CompactError;
|
|
72
112
|
};
|
|
73
|
-
|
|
113
|
+
/** Public output interface of the packaged builtin `code`. */
|
|
114
|
+
export type CodeOutput = {
|
|
74
115
|
readonly status: 'complete';
|
|
75
|
-
/** Exact identity of the last CODE-owned commit. */
|
|
76
116
|
readonly lastCodeCommit: string;
|
|
77
|
-
/** Exact repository revision the final passing review evaluated. */
|
|
78
117
|
readonly finalEvaluatedRevision: string;
|
|
79
|
-
/** Every phase's review passed with no unsettled findings. */
|
|
80
118
|
readonly allReviewsPassed: true;
|
|
81
119
|
} | {
|
|
82
120
|
readonly status: 'review-failed';
|
|
83
|
-
/** Exact identity of the last CODE-owned commit. */
|
|
84
121
|
readonly lastCodeCommit: string;
|
|
85
122
|
readonly error: CompactError;
|
|
86
123
|
};
|
|
87
|
-
export
|
|
124
|
+
export interface CodeInput {
|
|
125
|
+
/** Optional seed for `<run-results>`; `START_CODE` may supply its own. */
|
|
88
126
|
readonly runResults?: string;
|
|
89
|
-
}
|
|
90
|
-
export
|
|
127
|
+
}
|
|
128
|
+
export interface CodeContext {
|
|
129
|
+
/** `<run-results>`: relevant run results relayed to every phase. */
|
|
91
130
|
readonly runResults: string;
|
|
131
|
+
/** `<caller-input>`: the caller's coding request and relevant context. */
|
|
92
132
|
readonly callerInput?: string;
|
|
133
|
+
/** `<code-commit>`: the accepted `latestCommit` of the latest phase. */
|
|
134
|
+
readonly codeCommit?: string;
|
|
135
|
+
/** `<coder-output>`: Coder's verbatim final text for the latest phase. */
|
|
93
136
|
readonly coderOutput?: string;
|
|
94
|
-
|
|
137
|
+
/** `<ir-number>`: the created or continued IR. */
|
|
95
138
|
readonly irNumber?: string;
|
|
139
|
+
/** `<ir-task>`: the IR task the latest IR-task phase implemented. */
|
|
96
140
|
readonly irTask?: string;
|
|
141
|
+
/** The accepted outcome of the phase under review. */
|
|
142
|
+
readonly phaseOutcome?: PhaseOutcome;
|
|
143
|
+
/** Revision evaluated by the latest passing review. */
|
|
97
144
|
readonly evaluatedRevision?: string;
|
|
98
|
-
|
|
99
|
-
readonly completion?: 'complete' | 'review-failed';
|
|
145
|
+
/** Compact failure CODE reports when review did not pass a phase. */
|
|
100
146
|
readonly reviewError?: CompactError;
|
|
101
|
-
|
|
147
|
+
/** Sanitized evidence of the review result that ended CODE. */
|
|
148
|
+
readonly reviewEvidence?: CompletedReviewResult;
|
|
149
|
+
readonly lastError?: ErrorRecord;
|
|
102
150
|
readonly pendingBossQuestion?: PendingBossQuestion;
|
|
103
151
|
readonly bossReply?: string;
|
|
104
|
-
}
|
|
105
|
-
export type
|
|
152
|
+
}
|
|
153
|
+
export type CodeEvent = {
|
|
106
154
|
readonly type: 'START_CODE';
|
|
107
155
|
readonly callerInput: string;
|
|
156
|
+
readonly runResults?: string;
|
|
157
|
+
} | {
|
|
158
|
+
readonly type: 'BOSS_INTERRUPT';
|
|
159
|
+
readonly targetId: JumpableStateId;
|
|
108
160
|
} | {
|
|
109
161
|
readonly type: 'BOSS_REPLY';
|
|
110
162
|
readonly answer: string;
|
|
111
|
-
readonly questionId?:
|
|
163
|
+
readonly questionId?: ResumableStateId;
|
|
112
164
|
};
|
|
113
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Recognizes an authored rejected child result: an aborted or error call, or
|
|
167
|
+
* a child that completed at its own authored failure terminal.
|
|
168
|
+
*/
|
|
169
|
+
export declare function authoredChildResult(error: unknown, expectedPlaybookId: string): PlaybookCallResult | undefined;
|
|
170
|
+
export declare const codeMachine: import("xstate").StateMachine<CodeContext, {
|
|
114
171
|
readonly type: "START_CODE";
|
|
115
172
|
readonly callerInput: string;
|
|
173
|
+
readonly runResults?: string;
|
|
174
|
+
} | {
|
|
175
|
+
readonly type: "BOSS_INTERRUPT";
|
|
176
|
+
readonly targetId: JumpableStateId;
|
|
116
177
|
} | {
|
|
117
178
|
readonly type: "BOSS_REPLY";
|
|
118
179
|
readonly answer: string;
|
|
119
|
-
readonly questionId?:
|
|
180
|
+
readonly questionId?: ResumableStateId;
|
|
120
181
|
}, {
|
|
121
|
-
[x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<
|
|
182
|
+
[x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<PlaybookOutput, PlaybookInput, import("xstate").EventObject>> | undefined;
|
|
122
183
|
}, {
|
|
123
|
-
src: "playbook";
|
|
124
|
-
logic: import("xstate").PromiseActorLogic<JsonValue | undefined, PlaybookInput, import("xstate").EventObject>;
|
|
125
|
-
id: string | undefined;
|
|
126
|
-
} | {
|
|
127
184
|
src: "player";
|
|
128
185
|
logic: import("xstate").PromiseActorLogic<PlayerOutput, PlayerInput, import("xstate").EventObject>;
|
|
129
186
|
id: string | undefined;
|
|
187
|
+
} | {
|
|
188
|
+
src: "playbook";
|
|
189
|
+
logic: import("xstate").PromiseActorLogic<PlaybookOutput, PlaybookInput, import("xstate").EventObject>;
|
|
190
|
+
id: string | undefined;
|
|
130
191
|
}, {
|
|
131
192
|
type: "playbook.acceptedOutcome";
|
|
132
193
|
params: {
|
|
@@ -138,91 +199,83 @@ export declare const codingMachine: import("xstate").StateMachine<CodingContext,
|
|
|
138
199
|
type: "rememberActorError";
|
|
139
200
|
params: import("xstate").NonReducibleUnknown;
|
|
140
201
|
} | {
|
|
141
|
-
type: "
|
|
202
|
+
type: "resetForInterrupt";
|
|
142
203
|
params: import("xstate").NonReducibleUnknown;
|
|
143
204
|
} | {
|
|
144
|
-
type: "
|
|
145
|
-
params: import("xstate").NonReducibleUnknown;
|
|
146
|
-
} | {
|
|
147
|
-
type: "rememberIrCommit";
|
|
205
|
+
type: "rememberBossReply";
|
|
148
206
|
params: import("xstate").NonReducibleUnknown;
|
|
149
207
|
} | {
|
|
150
|
-
type: "
|
|
208
|
+
type: "rememberMalformedPlayerOutput";
|
|
151
209
|
params: import("xstate").NonReducibleUnknown;
|
|
152
210
|
} | {
|
|
153
|
-
type: "
|
|
211
|
+
type: "clearBossReplyContext";
|
|
154
212
|
params: import("xstate").NonReducibleUnknown;
|
|
155
213
|
} | {
|
|
156
|
-
type: "
|
|
214
|
+
type: "rememberAuthoredReviewFailure";
|
|
157
215
|
params: import("xstate").NonReducibleUnknown;
|
|
158
216
|
} | {
|
|
159
|
-
type: "
|
|
217
|
+
type: "startCode";
|
|
160
218
|
params: import("xstate").NonReducibleUnknown;
|
|
161
219
|
} | {
|
|
162
|
-
type: "
|
|
220
|
+
type: "rememberPhaseCommit";
|
|
163
221
|
params: import("xstate").NonReducibleUnknown;
|
|
164
222
|
} | {
|
|
165
|
-
type: "
|
|
166
|
-
params:
|
|
223
|
+
type: "setPendingBossQuestion";
|
|
224
|
+
params: {
|
|
225
|
+
readonly resumeStateId: ResumableStateId;
|
|
226
|
+
};
|
|
167
227
|
} | {
|
|
168
|
-
type: "
|
|
228
|
+
type: "rememberReviewPass";
|
|
169
229
|
params: import("xstate").NonReducibleUnknown;
|
|
170
230
|
} | {
|
|
171
|
-
type: "
|
|
231
|
+
type: "rememberReviewNotPassed";
|
|
172
232
|
params: import("xstate").NonReducibleUnknown;
|
|
173
233
|
} | {
|
|
174
|
-
type: "
|
|
234
|
+
type: "rememberMalformedBossReply";
|
|
175
235
|
params: import("xstate").NonReducibleUnknown;
|
|
176
236
|
}, {
|
|
177
|
-
type: "
|
|
237
|
+
type: "acceptDirectCommit";
|
|
178
238
|
params: unknown;
|
|
179
239
|
} | {
|
|
180
|
-
type: "
|
|
240
|
+
type: "acceptIrCommit";
|
|
181
241
|
params: unknown;
|
|
182
242
|
} | {
|
|
183
|
-
type: "
|
|
243
|
+
type: "acceptMoreTasks";
|
|
184
244
|
params: unknown;
|
|
185
245
|
} | {
|
|
186
|
-
type: "
|
|
187
|
-
params: unknown;
|
|
188
|
-
} | {
|
|
189
|
-
type: "isFinalTask";
|
|
246
|
+
type: "acceptFinalTask";
|
|
190
247
|
params: unknown;
|
|
191
248
|
} | {
|
|
192
249
|
type: "authoredReviewFailure";
|
|
193
250
|
params: unknown;
|
|
194
251
|
} | {
|
|
195
|
-
type: "
|
|
252
|
+
type: "needsBossReplyWithQuestion";
|
|
196
253
|
params: unknown;
|
|
197
254
|
} | {
|
|
198
|
-
type: "
|
|
255
|
+
type: "validStartCode";
|
|
199
256
|
params: unknown;
|
|
200
257
|
} | {
|
|
201
|
-
type: "
|
|
258
|
+
type: "emptyBossReply";
|
|
202
259
|
params: unknown;
|
|
203
260
|
} | {
|
|
204
|
-
type: "
|
|
261
|
+
type: "reviewPassedDirect";
|
|
205
262
|
params: unknown;
|
|
206
263
|
} | {
|
|
207
|
-
type: "
|
|
264
|
+
type: "reviewPassedNewIr";
|
|
208
265
|
params: unknown;
|
|
209
266
|
} | {
|
|
210
|
-
type: "
|
|
267
|
+
type: "reviewPassedNonfinalTask";
|
|
211
268
|
params: unknown;
|
|
212
269
|
} | {
|
|
213
|
-
type: "
|
|
270
|
+
type: "reviewPassedFinalTask";
|
|
214
271
|
params: unknown;
|
|
215
|
-
}, never, "done" | "failed" | "ready" | "awaitBossReply" | "
|
|
272
|
+
}, never, "done" | "failed" | "ready" | "awaitBossReply" | "firstPhase" | "irTaskPhase" | "reviewNewIntentPhase" | "reviewIrTaskPhase" | "reviewFailed", string, CodeInput, {
|
|
216
273
|
readonly status: "complete";
|
|
217
|
-
/** Exact identity of the last CODE-owned commit. */
|
|
218
274
|
readonly lastCodeCommit: string;
|
|
219
|
-
/** Exact repository revision the final passing review evaluated. */
|
|
220
275
|
readonly finalEvaluatedRevision: string;
|
|
221
|
-
/** Every phase's review passed with no unsettled findings. */
|
|
222
276
|
readonly allReviewsPassed: true;
|
|
223
277
|
} | {
|
|
224
278
|
readonly status: "review-failed";
|
|
225
|
-
/** Exact identity of the last CODE-owned commit. */
|
|
226
279
|
readonly lastCodeCommit: string;
|
|
227
280
|
readonly error: CompactError;
|
|
228
281
|
}, import("xstate").EventObject, import("xstate").MetaObject, {
|
|
@@ -231,17 +284,17 @@ export declare const codingMachine: import("xstate").StateMachine<CodingContext,
|
|
|
231
284
|
readonly ready: {
|
|
232
285
|
id: "ready";
|
|
233
286
|
};
|
|
234
|
-
readonly
|
|
235
|
-
id: "
|
|
287
|
+
readonly firstPhase: {
|
|
288
|
+
id: "firstPhase";
|
|
236
289
|
};
|
|
237
|
-
readonly
|
|
238
|
-
id: "
|
|
290
|
+
readonly reviewNewIntentPhase: {
|
|
291
|
+
id: "reviewNewIntentPhase";
|
|
239
292
|
};
|
|
240
|
-
readonly
|
|
241
|
-
id: "
|
|
293
|
+
readonly irTaskPhase: {
|
|
294
|
+
id: "irTaskPhase";
|
|
242
295
|
};
|
|
243
|
-
readonly
|
|
244
|
-
id: "
|
|
296
|
+
readonly reviewIrTaskPhase: {
|
|
297
|
+
id: "reviewIrTaskPhase";
|
|
245
298
|
};
|
|
246
299
|
readonly awaitBossReply: {
|
|
247
300
|
id: "awaitBossReply";
|
|
@@ -249,12 +302,12 @@ export declare const codingMachine: import("xstate").StateMachine<CodingContext,
|
|
|
249
302
|
readonly failed: {
|
|
250
303
|
id: "failed";
|
|
251
304
|
};
|
|
252
|
-
readonly
|
|
253
|
-
id: "
|
|
305
|
+
readonly reviewFailed: {
|
|
306
|
+
id: "reviewFailed";
|
|
254
307
|
};
|
|
255
308
|
readonly done: {
|
|
256
309
|
id: "done";
|
|
257
310
|
};
|
|
258
311
|
};
|
|
259
312
|
}>;
|
|
260
|
-
export default
|
|
313
|
+
export default codeMachine;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CodeContext, PlaybookInput, PlayerInput, codeMachine } from './code.fsm.js';
|
|
2
2
|
export type TransitionGuard = (args: {
|
|
3
|
-
context:
|
|
3
|
+
context: CodeContext;
|
|
4
4
|
event: unknown;
|
|
5
5
|
}) => boolean;
|
|
6
6
|
export interface InvokingTransition {
|
|
@@ -12,24 +12,24 @@ export interface InvokingTransition {
|
|
|
12
12
|
export interface PlayerStateInfo {
|
|
13
13
|
readonly stateId: string;
|
|
14
14
|
readonly sourceItem: string;
|
|
15
|
-
readonly getInput: (context:
|
|
15
|
+
readonly getInput: (context: CodeContext) => PlayerInput;
|
|
16
16
|
readonly transitions: readonly InvokingTransition[];
|
|
17
17
|
}
|
|
18
18
|
export interface NestedPlaybookStateInfo {
|
|
19
19
|
readonly stateId: string;
|
|
20
20
|
readonly sourceItem: string;
|
|
21
|
-
readonly getInput: (context:
|
|
21
|
+
readonly getInput: (context: CodeContext) => PlaybookInput;
|
|
22
22
|
readonly transitions: readonly InvokingTransition[];
|
|
23
23
|
}
|
|
24
24
|
export interface AwaitBossReplyInfo {
|
|
25
25
|
readonly stateId: 'awaitBossReply';
|
|
26
26
|
readonly bossReplyTransitions: readonly InvokingTransition[];
|
|
27
27
|
}
|
|
28
|
-
export declare function enumeratePlayerStates(machine: typeof
|
|
28
|
+
export declare function enumeratePlayerStates(machine: typeof codeMachine): readonly PlayerStateInfo[];
|
|
29
29
|
export declare const enumerateCaptainStates: typeof enumeratePlayerStates;
|
|
30
|
-
export declare function enumerateNestedPlaybookStates(machine: typeof
|
|
31
|
-
export declare function enumerateAwaitBossReply(machine: typeof
|
|
32
|
-
export declare function enumerateRootEvents(machine: typeof
|
|
30
|
+
export declare function enumerateNestedPlaybookStates(machine: typeof codeMachine): readonly NestedPlaybookStateInfo[];
|
|
31
|
+
export declare function enumerateAwaitBossReply(machine: typeof codeMachine): AwaitBossReplyInfo;
|
|
32
|
+
export declare function enumerateRootEvents(machine: typeof codeMachine): {
|
|
33
33
|
readonly startCode: {
|
|
34
34
|
readonly target: string;
|
|
35
35
|
};
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
-
|
|
5
|
+
CodeContext,
|
|
6
6
|
PlaybookInput,
|
|
7
7
|
PlayerInput,
|
|
8
|
-
|
|
8
|
+
codeMachine,
|
|
9
9
|
} from './code.fsm.js';
|
|
10
10
|
|
|
11
11
|
export type TransitionGuard = (args: {
|
|
12
|
-
context:
|
|
12
|
+
context: CodeContext;
|
|
13
13
|
event: unknown;
|
|
14
14
|
}) => boolean;
|
|
15
15
|
|
|
@@ -23,14 +23,14 @@ export interface InvokingTransition {
|
|
|
23
23
|
export interface PlayerStateInfo {
|
|
24
24
|
readonly stateId: string;
|
|
25
25
|
readonly sourceItem: string;
|
|
26
|
-
readonly getInput: (context:
|
|
26
|
+
readonly getInput: (context: CodeContext) => PlayerInput;
|
|
27
27
|
readonly transitions: readonly InvokingTransition[];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface NestedPlaybookStateInfo {
|
|
31
31
|
readonly stateId: string;
|
|
32
32
|
readonly sourceItem: string;
|
|
33
|
-
readonly getInput: (context:
|
|
33
|
+
readonly getInput: (context: CodeContext) => PlaybookInput;
|
|
34
34
|
readonly transitions: readonly InvokingTransition[];
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -41,7 +41,7 @@ export interface AwaitBossReplyInfo {
|
|
|
41
41
|
|
|
42
42
|
type RawInvoke = {
|
|
43
43
|
src?: unknown;
|
|
44
|
-
input?: (args: { context:
|
|
44
|
+
input?: (args: { context: CodeContext }) => PlayerInput | PlaybookInput;
|
|
45
45
|
onDone?: unknown;
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -60,7 +60,7 @@ type RawConfig = {
|
|
|
60
60
|
states?: Readonly<Record<string, RawState>>;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
function rawConfig(machine: typeof
|
|
63
|
+
function rawConfig(machine: typeof codeMachine): RawConfig {
|
|
64
64
|
return (machine as unknown as { config: RawConfig }).config;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -84,13 +84,13 @@ function transitions(value: unknown): readonly InvokingTransition[] {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export function enumeratePlayerStates(
|
|
87
|
-
machine: typeof
|
|
87
|
+
machine: typeof codeMachine,
|
|
88
88
|
): readonly PlayerStateInfo[] {
|
|
89
89
|
const states = rawConfig(machine).states ?? {};
|
|
90
90
|
return Object.entries(states).flatMap(([stateId, state]) => {
|
|
91
91
|
const invoke = state.invoke;
|
|
92
92
|
if (invoke?.src !== 'player' || invoke.input === undefined) return [];
|
|
93
|
-
const getInput = (context:
|
|
93
|
+
const getInput = (context: CodeContext): PlayerInput =>
|
|
94
94
|
invoke.input?.({ context }) as PlayerInput;
|
|
95
95
|
const input = getInput({ runResults: '' });
|
|
96
96
|
return [
|
|
@@ -108,13 +108,13 @@ export function enumeratePlayerStates(
|
|
|
108
108
|
export const enumerateCaptainStates = enumeratePlayerStates;
|
|
109
109
|
|
|
110
110
|
export function enumerateNestedPlaybookStates(
|
|
111
|
-
machine: typeof
|
|
111
|
+
machine: typeof codeMachine,
|
|
112
112
|
): readonly NestedPlaybookStateInfo[] {
|
|
113
113
|
const states = rawConfig(machine).states ?? {};
|
|
114
114
|
return Object.entries(states).flatMap(([stateId, state]) => {
|
|
115
115
|
const invoke = state.invoke;
|
|
116
116
|
if (invoke?.src !== 'playbook' || invoke.input === undefined) return [];
|
|
117
|
-
const getInput = (context:
|
|
117
|
+
const getInput = (context: CodeContext): PlaybookInput =>
|
|
118
118
|
invoke.input?.({ context }) as PlaybookInput;
|
|
119
119
|
const input = getInput({ runResults: '' });
|
|
120
120
|
return [
|
|
@@ -129,7 +129,7 @@ export function enumerateNestedPlaybookStates(
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
export function enumerateAwaitBossReply(
|
|
132
|
-
machine: typeof
|
|
132
|
+
machine: typeof codeMachine,
|
|
133
133
|
): AwaitBossReplyInfo {
|
|
134
134
|
const on = rawConfig(machine).states?.awaitBossReply?.on ?? {};
|
|
135
135
|
return {
|
|
@@ -138,7 +138,7 @@ export function enumerateAwaitBossReply(
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
export function enumerateRootEvents(machine: typeof
|
|
141
|
+
export function enumerateRootEvents(machine: typeof codeMachine): {
|
|
142
142
|
readonly startCode: { readonly target: string };
|
|
143
143
|
} {
|
|
144
144
|
const on = rawConfig(machine).states?.ready?.on ?? {};
|