@sublang/playbook 4.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.
- package/README.md +69 -122
- package/docs/assets/playbook-venn.svg +13 -0
- package/docs/cli.md +43 -26
- package/docs/configuration.md +63 -18
- package/docs/embedding.md +24 -16
- package/package.json +43 -22
- package/reference/sdlc/captain.md +70 -83
- package/reference/sdlc/captain.playbook/captain.fsm.d.ts +127 -142
- package/reference/sdlc/captain.playbook/captain.fsm.js +349 -470
- package/reference/sdlc/captain.playbook/captain.fsm.ts +535 -598
- package/reference/sdlc/captain.playbook/captain.gears.md +37 -41
- package/reference/sdlc/captain.playbook/captain.playbook.d.ts +90 -15
- package/reference/sdlc/captain.playbook/captain.playbook.js +466 -976
- package/reference/sdlc/captain.playbook/captain.playbook.ts +698 -1001
- package/reference/sdlc/code.md +55 -97
- package/reference/sdlc/code.playbook/code.fsm.d.ts +229 -94
- package/reference/sdlc/code.playbook/code.fsm.introspect.d.ts +26 -44
- package/reference/sdlc/code.playbook/code.fsm.introspect.js +61 -66
- package/reference/sdlc/code.playbook/code.fsm.introspect.ts +100 -149
- package/reference/sdlc/code.playbook/code.fsm.js +587 -1347
- package/reference/sdlc/code.playbook/code.fsm.ts +809 -1650
- package/reference/sdlc/code.playbook/code.gears.md +51 -263
- package/reference/sdlc/code.playbook/code.playbook.d.ts +8 -47
- package/reference/sdlc/code.playbook/code.playbook.js +69 -639
- package/reference/sdlc/code.playbook/code.playbook.ts +90 -850
- package/reference/sdlc/code.playbook/code.registry.d.ts +9 -25
- package/reference/sdlc/code.playbook/code.registry.js +20 -78
- package/reference/sdlc/code.playbook/code.registry.ts +58 -122
- package/reference/sdlc/code.playbook/playbook-captain.d.ts +2 -0
- package/reference/sdlc/code.playbook/playbook-captain.js +1877 -251
- package/reference/sdlc/code.playbook/playbook-captain.ts +2385 -352
- package/reference/sdlc/code.playbook/playbook.config.template.yaml +33 -22
- package/reference/sdlc/decide.md +54 -0
- package/reference/sdlc/decide.playbook/decide.fsm.d.ts +261 -0
- package/reference/sdlc/decide.playbook/decide.fsm.js +894 -0
- package/reference/sdlc/decide.playbook/decide.fsm.ts +1152 -0
- package/reference/sdlc/decide.playbook/decide.gears.md +88 -0
- package/reference/sdlc/decide.playbook/decide.playbook.d.ts +67 -0
- package/reference/sdlc/{discuss.playbook/discuss.playbook.js → decide.playbook/decide.playbook.js} +511 -370
- package/reference/sdlc/{discuss.playbook/discuss.playbook.ts → decide.playbook/decide.playbook.ts} +616 -451
- package/reference/sdlc/decide.playbook/decide.registry.d.ts +41 -0
- package/reference/sdlc/decide.playbook/decide.registry.js +60 -0
- package/reference/sdlc/decide.playbook/decide.registry.ts +125 -0
- package/reference/sdlc/review.md +81 -0
- package/reference/sdlc/review.playbook/review.fsm.d.ts +183 -0
- package/reference/sdlc/review.playbook/review.fsm.js +524 -0
- package/reference/sdlc/review.playbook/review.fsm.ts +652 -0
- package/reference/sdlc/review.playbook/review.gears.md +112 -0
- package/reference/sdlc/review.playbook/review.playbook.d.ts +12 -0
- package/reference/sdlc/review.playbook/review.playbook.js +112 -0
- package/reference/sdlc/review.playbook/review.playbook.ts +201 -0
- package/reference/sdlc/review.playbook/review.registry.d.ts +43 -0
- package/reference/sdlc/review.playbook/review.registry.js +73 -0
- package/reference/sdlc/review.playbook/review.registry.ts +138 -0
- package/slc/gears2fsm.md +67 -6
- package/slc/link.md +339 -25
- package/slc/text2gears.md +22 -2
- package/src/runtime.d.ts +36 -1
- package/src/runtime.ts +59 -0
- package/src/xstate-playbook-runtime.d.ts +96 -7
- package/src/xstate-playbook-runtime.js +1018 -49
- package/src/xstate-playbook-runtime.ts +1283 -59
- package/src/xstate-runtime.js +25 -0
- package/src/xstate-runtime.ts +51 -0
- package/reference/sdlc/discuss.md +0 -93
- package/reference/sdlc/discuss.playbook/discuss.fsm.d.ts +0 -396
- package/reference/sdlc/discuss.playbook/discuss.fsm.js +0 -2067
- package/reference/sdlc/discuss.playbook/discuss.fsm.ts +0 -2465
- package/reference/sdlc/discuss.playbook/discuss.gears.md +0 -258
- package/reference/sdlc/discuss.playbook/discuss.playbook.d.ts +0 -113
- package/reference/sdlc/discuss.playbook/discuss.registry.d.ts +0 -58
- package/reference/sdlc/discuss.playbook/discuss.registry.js +0 -97
- package/reference/sdlc/discuss.playbook/discuss.registry.ts +0 -153
|
@@ -1,163 +1,154 @@
|
|
|
1
1
|
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
2
2
|
readonly [key: string]: JsonValue;
|
|
3
3
|
};
|
|
4
|
+
/** One immutable host-catalog entry (id + command + intent only). */
|
|
4
5
|
export type EnabledPlaybook = {
|
|
5
6
|
readonly id: string;
|
|
6
7
|
readonly command: string;
|
|
7
8
|
readonly intent: string;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
readonly value: PlaybookStateValue;
|
|
19
|
-
readonly activeStateIds: readonly string[];
|
|
20
|
-
readonly tags: readonly string[];
|
|
21
|
-
readonly status: 'active' | 'done' | 'error' | 'stopped';
|
|
22
|
-
readonly quiescent: boolean;
|
|
23
|
-
readonly stateId?: string;
|
|
24
|
-
};
|
|
25
|
-
export type CompletedCallResult = {
|
|
10
|
+
/** The closed controller action set (DR-029; stable machine contract). */
|
|
11
|
+
export type DecisionAction = 'respond' | 'start' | 'switch' | 'dismiss' | 'deliver' | 'runtime';
|
|
12
|
+
/**
|
|
13
|
+
* A deterministic parse-resolved acting decision injected by the host
|
|
14
|
+
* (CAPTAIN-7 parse table): the turn's decision object, entering the decision
|
|
15
|
+
* state with no decision model call.
|
|
16
|
+
*/
|
|
17
|
+
export type ParsedActingDecision = {
|
|
18
|
+
readonly action: 'start' | 'switch';
|
|
26
19
|
readonly playbookId: string;
|
|
27
|
-
readonly
|
|
28
|
-
readonly output?: JsonValue;
|
|
20
|
+
readonly input: string;
|
|
29
21
|
} | {
|
|
30
|
-
readonly
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
readonly action: 'deliver';
|
|
23
|
+
};
|
|
24
|
+
/** Compact `{ name, message }` error evidence (never a raw Error). */
|
|
25
|
+
export type CompactError = {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly message: string;
|
|
33
28
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
|
|
29
|
+
/** Receipt evidence of an executed `runtime` action (disposition only). */
|
|
30
|
+
export type SettlementReceiptEvidence = {
|
|
31
|
+
readonly disposition: 'executed' | 'rejected' | 'failed';
|
|
32
|
+
readonly reason?: string;
|
|
33
|
+
readonly error?: CompactError;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The controller-port settlement evidence the machine may retain: status,
|
|
37
|
+
* outcome-report facts, optional rejection reason, receipt disposition, and
|
|
38
|
+
* leaf-state summary — never a session id, call id, child state, stack
|
|
39
|
+
* ledger, resume token, or opaque runtime result (CAPPLAY-10).
|
|
40
|
+
*/
|
|
41
|
+
export type SettlementEvidence = {
|
|
42
|
+
readonly status: 'ok' | 'rejected' | 'failed';
|
|
43
|
+
readonly facts: readonly string[];
|
|
44
|
+
readonly reason?: string;
|
|
45
|
+
readonly receipt?: SettlementReceiptEvidence;
|
|
46
|
+
readonly leafStateSummary?: string;
|
|
40
47
|
};
|
|
41
|
-
export type ResumableStateId = 'routing' | 'reassessing';
|
|
42
48
|
export type CaptainMachineInput = {
|
|
43
49
|
readonly enabledPlaybooks: readonly EnabledPlaybook[];
|
|
44
|
-
readonly selfPlaybookId: string;
|
|
45
|
-
readonly bossIntent?: string;
|
|
46
|
-
};
|
|
47
|
-
export type CaptainMachineOutput = {
|
|
48
|
-
readonly response: string;
|
|
49
50
|
};
|
|
51
|
+
export type CaptainStateId = 'deciding' | 'answeringCommand' | 'reporting';
|
|
52
|
+
export type CaptainSourceItem = 'CAPTAIN-1' | 'CAPTAIN-2' | 'CAPTAIN-3';
|
|
50
53
|
export type CaptainInput = {
|
|
51
|
-
readonly stateId:
|
|
52
|
-
readonly sourceItem:
|
|
54
|
+
readonly stateId: CaptainStateId;
|
|
55
|
+
readonly sourceItem: CaptainSourceItem;
|
|
53
56
|
readonly prompt: string;
|
|
54
57
|
readonly result: Record<string, string>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
readonly
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
/**
|
|
59
|
+
* DR-013 A1 source-owned tool restriction: this playbook's policy forbids
|
|
60
|
+
* tools on every Captain call, so each state requests the empty allowlist.
|
|
61
|
+
*/
|
|
62
|
+
readonly allowedTools: readonly string[];
|
|
63
|
+
/** The injected parse-resolved decision, when the host's parse decided the turn. */
|
|
64
|
+
readonly parsedDecision?: ParsedActingDecision;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Decision-state output: the validated selection under the stable controller
|
|
68
|
+
* guard contract — `respond` | `start` | `switch` | `dismiss` | `deliver` |
|
|
69
|
+
* `runtime`, with the payload fields DR-029 requires — plus the
|
|
70
|
+
* controller-port settlement evidence of the executed submission. The prose
|
|
71
|
+
* states (`answeringCommand`, `reporting`) carry the default single-outcome
|
|
72
|
+
* `done` contract.
|
|
73
|
+
*/
|
|
62
74
|
export type CaptainOutput = {
|
|
63
|
-
readonly guard: '
|
|
64
|
-
readonly
|
|
75
|
+
readonly guard: 'respond';
|
|
76
|
+
readonly text: string;
|
|
77
|
+
readonly settlement: SettlementEvidence;
|
|
65
78
|
} | {
|
|
66
|
-
readonly guard: '
|
|
67
|
-
readonly
|
|
68
|
-
readonly
|
|
69
|
-
readonly
|
|
79
|
+
readonly guard: 'start';
|
|
80
|
+
readonly playbookId: string;
|
|
81
|
+
readonly input: string;
|
|
82
|
+
readonly settlement: SettlementEvidence;
|
|
70
83
|
} | {
|
|
71
|
-
readonly guard: '
|
|
72
|
-
readonly
|
|
84
|
+
readonly guard: 'switch';
|
|
85
|
+
readonly playbookId: string;
|
|
86
|
+
readonly input: string;
|
|
87
|
+
readonly settlement: SettlementEvidence;
|
|
73
88
|
} | {
|
|
74
|
-
readonly guard: '
|
|
75
|
-
readonly
|
|
89
|
+
readonly guard: 'dismiss';
|
|
90
|
+
readonly settlement: SettlementEvidence;
|
|
76
91
|
} | {
|
|
77
|
-
readonly guard: '
|
|
78
|
-
readonly
|
|
79
|
-
readonly nextPlaybookId: string;
|
|
80
|
-
readonly nextPlaybookInput: string;
|
|
92
|
+
readonly guard: 'deliver';
|
|
93
|
+
readonly settlement: SettlementEvidence;
|
|
81
94
|
} | {
|
|
82
|
-
readonly guard: '
|
|
83
|
-
readonly
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
readonly
|
|
87
|
-
readonly sourceItem?: 'CAPTAIN-2';
|
|
88
|
-
readonly playbookId: string;
|
|
89
|
-
readonly text: string;
|
|
90
|
-
readonly playbookIdContext: 'nextPlaybookId';
|
|
91
|
-
readonly textContext: 'nextPlaybookInput';
|
|
95
|
+
readonly guard: 'runtime';
|
|
96
|
+
readonly actionId: string;
|
|
97
|
+
readonly settlement: SettlementEvidence;
|
|
98
|
+
} | {
|
|
99
|
+
readonly guard: 'done';
|
|
92
100
|
};
|
|
93
|
-
export type PlaybookOutput = JsonValue | undefined;
|
|
94
101
|
type Context = {
|
|
95
|
-
readonly bossIntent: string;
|
|
96
102
|
readonly enabledPlaybooks: readonly EnabledPlaybook[];
|
|
97
|
-
readonly
|
|
98
|
-
readonly
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
readonly
|
|
104
|
-
readonly
|
|
105
|
-
readonly
|
|
103
|
+
readonly bossText: string;
|
|
104
|
+
readonly parsedDecision?: ParsedActingDecision;
|
|
105
|
+
readonly selectedAction?: DecisionAction;
|
|
106
|
+
readonly settlementStatus?: 'ok' | 'rejected' | 'failed';
|
|
107
|
+
readonly settlementFacts?: readonly string[];
|
|
108
|
+
readonly settlementReason?: string;
|
|
109
|
+
readonly receiptDisposition?: 'executed' | 'rejected' | 'failed';
|
|
110
|
+
readonly receiptReason?: string;
|
|
111
|
+
readonly receiptError?: CompactError;
|
|
112
|
+
readonly leafStateSummary?: string;
|
|
106
113
|
readonly lastError?: JsonValue;
|
|
107
114
|
};
|
|
108
|
-
type
|
|
109
|
-
readonly type: '
|
|
110
|
-
readonly
|
|
115
|
+
type BossTurnEvent = {
|
|
116
|
+
readonly type: 'BOSS_TURN';
|
|
117
|
+
readonly bossText: string;
|
|
118
|
+
};
|
|
119
|
+
type ParsedRespondEvent = {
|
|
120
|
+
readonly type: 'PARSED_RESPOND';
|
|
121
|
+
readonly bossText: string;
|
|
111
122
|
};
|
|
112
|
-
type
|
|
113
|
-
readonly type: '
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
123
|
+
type ParsedActionEvent = {
|
|
124
|
+
readonly type: 'PARSED_ACTION';
|
|
125
|
+
readonly bossText: string;
|
|
126
|
+
readonly decision: ParsedActingDecision;
|
|
116
127
|
};
|
|
117
|
-
type
|
|
118
|
-
readonly type: '
|
|
119
|
-
readonly answer: string;
|
|
120
|
-
readonly questionId?: string;
|
|
128
|
+
type ShutdownEvent = {
|
|
129
|
+
readonly type: 'SHUTDOWN';
|
|
121
130
|
};
|
|
122
|
-
export
|
|
123
|
-
|
|
131
|
+
export type CaptainMachineEvent = BossTurnEvent | ParsedRespondEvent | ParsedActionEvent | ShutdownEvent;
|
|
132
|
+
export declare const captainMachine: import("xstate").StateMachine<Context, BossTurnEvent | ParsedRespondEvent | ParsedActionEvent | ShutdownEvent, {
|
|
133
|
+
[x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<CaptainOutput, CaptainInput, import("xstate").EventObject>> | undefined;
|
|
124
134
|
}, {
|
|
125
|
-
src: "playbook";
|
|
126
|
-
logic: import("xstate").PromiseActorLogic<PlaybookOutput, PlaybookInput, import("xstate").EventObject>;
|
|
127
|
-
id: string | undefined;
|
|
128
|
-
} | {
|
|
129
135
|
src: "captain";
|
|
130
136
|
logic: import("xstate").PromiseActorLogic<CaptainOutput, CaptainInput, import("xstate").EventObject>;
|
|
131
137
|
id: string | undefined;
|
|
132
138
|
}, {
|
|
133
|
-
type: "
|
|
139
|
+
type: "startDecidedTurn";
|
|
134
140
|
params: import("xstate").NonReducibleUnknown;
|
|
135
141
|
} | {
|
|
136
|
-
type: "
|
|
142
|
+
type: "startCommandTurn";
|
|
137
143
|
params: import("xstate").NonReducibleUnknown;
|
|
138
144
|
} | {
|
|
139
|
-
type: "
|
|
145
|
+
type: "startParsedTurn";
|
|
140
146
|
params: import("xstate").NonReducibleUnknown;
|
|
141
147
|
} | {
|
|
142
|
-
type: "
|
|
148
|
+
type: "recordSettlement";
|
|
143
149
|
params: import("xstate").NonReducibleUnknown;
|
|
144
150
|
} | {
|
|
145
|
-
type: "
|
|
146
|
-
params: import("xstate").NonReducibleUnknown;
|
|
147
|
-
} | {
|
|
148
|
-
type: "appendSuccessfulChildResult";
|
|
149
|
-
params: import("xstate").NonReducibleUnknown;
|
|
150
|
-
} | {
|
|
151
|
-
type: "appendRejectedChildResult";
|
|
152
|
-
params: import("xstate").NonReducibleUnknown;
|
|
153
|
-
} | {
|
|
154
|
-
type: "storeFinalResponse";
|
|
155
|
-
params: import("xstate").NonReducibleUnknown;
|
|
156
|
-
} | {
|
|
157
|
-
type: "setReassessQuestion";
|
|
158
|
-
params: import("xstate").NonReducibleUnknown;
|
|
159
|
-
} | {
|
|
160
|
-
type: "storeContinuingCall";
|
|
151
|
+
type: "recordDecisionReplyFailure";
|
|
161
152
|
params: import("xstate").NonReducibleUnknown;
|
|
162
153
|
} | {
|
|
163
154
|
type: "rememberInvalidActorOutput";
|
|
@@ -166,61 +157,55 @@ export declare const captainMachine: import("xstate").StateMachine<Context, Boss
|
|
|
166
157
|
type: "rememberActorError";
|
|
167
158
|
params: import("xstate").NonReducibleUnknown;
|
|
168
159
|
}, {
|
|
169
|
-
type: "
|
|
170
|
-
params: unknown;
|
|
171
|
-
} | {
|
|
172
|
-
type: "canResumeRouting";
|
|
160
|
+
type: "start";
|
|
173
161
|
params: unknown;
|
|
174
162
|
} | {
|
|
175
|
-
type: "
|
|
163
|
+
type: "respond";
|
|
176
164
|
params: unknown;
|
|
177
165
|
} | {
|
|
178
|
-
type: "
|
|
166
|
+
type: "switch";
|
|
179
167
|
params: unknown;
|
|
180
168
|
} | {
|
|
181
|
-
type: "
|
|
169
|
+
type: "dismiss";
|
|
182
170
|
params: unknown;
|
|
183
171
|
} | {
|
|
184
|
-
type: "
|
|
172
|
+
type: "deliver";
|
|
185
173
|
params: unknown;
|
|
186
174
|
} | {
|
|
187
|
-
type: "
|
|
175
|
+
type: "runtime";
|
|
188
176
|
params: unknown;
|
|
189
177
|
} | {
|
|
190
|
-
type: "
|
|
178
|
+
type: "hasBossTurnText";
|
|
191
179
|
params: unknown;
|
|
192
180
|
} | {
|
|
193
|
-
type: "
|
|
181
|
+
type: "hasCommandRespondText";
|
|
194
182
|
params: unknown;
|
|
195
183
|
} | {
|
|
196
|
-
type: "
|
|
184
|
+
type: "hasParsedActingDecision";
|
|
197
185
|
params: unknown;
|
|
198
186
|
} | {
|
|
199
|
-
type: "
|
|
187
|
+
type: "isDecisionReplyFailure";
|
|
200
188
|
params: unknown;
|
|
201
|
-
}, never, "
|
|
189
|
+
}, never, "failed" | "deciding" | "answeringCommand" | "reporting" | "hub" | "shutdown", string, CaptainMachineInput, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
|
|
202
190
|
id: "captain";
|
|
203
191
|
states: {
|
|
204
|
-
readonly
|
|
205
|
-
id: "
|
|
206
|
-
};
|
|
207
|
-
readonly routing: {
|
|
208
|
-
id: "routing";
|
|
192
|
+
readonly hub: {
|
|
193
|
+
id: "hub";
|
|
209
194
|
};
|
|
210
|
-
readonly
|
|
211
|
-
id: "
|
|
195
|
+
readonly deciding: {
|
|
196
|
+
id: "deciding";
|
|
212
197
|
};
|
|
213
|
-
readonly
|
|
214
|
-
id: "
|
|
198
|
+
readonly answeringCommand: {
|
|
199
|
+
id: "answeringCommand";
|
|
215
200
|
};
|
|
216
|
-
readonly
|
|
217
|
-
id: "
|
|
201
|
+
readonly reporting: {
|
|
202
|
+
id: "reporting";
|
|
218
203
|
};
|
|
219
204
|
readonly failed: {
|
|
220
205
|
id: "failed";
|
|
221
206
|
};
|
|
222
|
-
readonly
|
|
223
|
-
id: "
|
|
207
|
+
readonly shutdown: {
|
|
208
|
+
id: "shutdown";
|
|
224
209
|
};
|
|
225
210
|
};
|
|
226
211
|
}>;
|