@sublang/playbook 0.9.0 → 1.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 (48) hide show
  1. package/README.md +183 -151
  2. package/package.json +46 -6
  3. package/reference/sdlc/captain.md +102 -0
  4. package/reference/sdlc/captain.playbook/captain.fsm.d.ts +227 -0
  5. package/reference/sdlc/captain.playbook/captain.fsm.js +628 -0
  6. package/reference/sdlc/captain.playbook/captain.fsm.ts +851 -0
  7. package/reference/sdlc/captain.playbook/captain.gears.md +60 -0
  8. package/reference/sdlc/captain.playbook/captain.playbook.d.ts +23 -0
  9. package/reference/sdlc/captain.playbook/captain.playbook.js +1053 -0
  10. package/reference/sdlc/captain.playbook/captain.playbook.ts +1144 -0
  11. package/reference/sdlc/code.playbook/bin/playbook.js +152 -10
  12. package/reference/sdlc/code.playbook/bin/run.js +893 -0
  13. package/reference/sdlc/code.playbook/code.fsm.d.ts +11 -4
  14. package/reference/sdlc/code.playbook/code.fsm.introspect.d.ts +2 -2
  15. package/reference/sdlc/code.playbook/code.fsm.introspect.js +1 -1
  16. package/reference/sdlc/code.playbook/code.fsm.introspect.ts +6 -6
  17. package/reference/sdlc/code.playbook/code.fsm.js +334 -102
  18. package/reference/sdlc/code.playbook/code.fsm.ts +467 -180
  19. package/reference/sdlc/code.playbook/code.gears.md +11 -10
  20. package/reference/sdlc/code.playbook/code.playbook.d.ts +18 -9
  21. package/reference/sdlc/code.playbook/code.playbook.js +1095 -200
  22. package/reference/sdlc/code.playbook/code.playbook.ts +1437 -256
  23. package/reference/sdlc/code.playbook/code.registry.d.ts +0 -3
  24. package/reference/sdlc/code.playbook/code.registry.js +0 -3
  25. package/reference/sdlc/code.playbook/code.registry.ts +0 -6
  26. package/reference/sdlc/code.playbook/playbook-captain.d.ts +9 -4
  27. package/reference/sdlc/code.playbook/playbook-captain.js +889 -210
  28. package/reference/sdlc/code.playbook/playbook-captain.ts +1136 -257
  29. package/reference/sdlc/code.playbook/playbook.config.template.yaml +10 -0
  30. package/reference/sdlc/discuss.playbook/discuss.fsm.d.ts +396 -0
  31. package/reference/sdlc/discuss.playbook/discuss.fsm.js +2066 -0
  32. package/reference/sdlc/discuss.playbook/discuss.fsm.ts +2464 -0
  33. package/reference/sdlc/discuss.playbook/discuss.gears.md +251 -0
  34. package/reference/sdlc/discuss.playbook/discuss.playbook.d.ts +113 -0
  35. package/reference/sdlc/discuss.playbook/discuss.playbook.js +1514 -0
  36. package/reference/sdlc/discuss.playbook/discuss.playbook.ts +1926 -0
  37. package/reference/sdlc/discuss.playbook/discuss.registry.d.ts +58 -0
  38. package/reference/sdlc/discuss.playbook/discuss.registry.js +97 -0
  39. package/reference/sdlc/discuss.playbook/discuss.registry.ts +153 -0
  40. package/slc/gears2fsm.md +557 -57
  41. package/slc/link.md +1097 -80
  42. package/slc/optimize.md +88 -0
  43. package/slc/text2gears.md +247 -5
  44. package/src/runtime.d.ts +145 -3
  45. package/src/runtime.ts +200 -2
  46. package/src/xstate-runtime.d.ts +94 -0
  47. package/src/xstate-runtime.js +1247 -0
  48. package/src/xstate-runtime.ts +1802 -0
@@ -0,0 +1,227 @@
1
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
2
+ readonly [key: string]: JsonValue;
3
+ };
4
+ export type EnabledPlaybook = {
5
+ readonly id: string;
6
+ readonly command: string;
7
+ readonly intent: string;
8
+ };
9
+ export type NormalizedError = {
10
+ readonly name: string;
11
+ readonly message: string;
12
+ readonly stack?: string;
13
+ };
14
+ export type PlaybookStateValue = string | {
15
+ readonly [key: string]: PlaybookStateValue;
16
+ };
17
+ export type PlaybookState = {
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 = {
26
+ readonly playbookId: string;
27
+ readonly status: 'ok';
28
+ readonly output?: JsonValue;
29
+ } | {
30
+ readonly playbookId: string;
31
+ readonly status: 'aborted' | 'error';
32
+ readonly error: NormalizedError;
33
+ };
34
+ export type PendingBossQuestion = {
35
+ readonly questionId: ResumableStateId;
36
+ readonly resumeStateId: ResumableStateId;
37
+ readonly sourceItem: 'CAPTAIN-1' | 'CAPTAIN-3';
38
+ readonly player: 'Captain';
39
+ readonly question: string;
40
+ };
41
+ export type ResumableStateId = 'routing' | 'reassessing';
42
+ export type CaptainMachineInput = {
43
+ readonly enabledPlaybooks: readonly EnabledPlaybook[];
44
+ readonly selfPlaybookId: string;
45
+ readonly bossIntent?: string;
46
+ };
47
+ export type CaptainMachineOutput = {
48
+ readonly response: string;
49
+ };
50
+ export type CaptainInput = {
51
+ readonly stateId: ResumableStateId;
52
+ readonly sourceItem: 'CAPTAIN-1' | 'CAPTAIN-3';
53
+ readonly prompt: string;
54
+ readonly result: Record<string, string>;
55
+ readonly bossIntent: string;
56
+ readonly enabledPlaybooks: readonly EnabledPlaybook[];
57
+ readonly remainingPlan?: readonly JsonValue[];
58
+ readonly completedCallResults?: readonly CompletedCallResult[];
59
+ readonly pendingBossQuestion?: PendingBossQuestion;
60
+ readonly bossReply?: string;
61
+ };
62
+ export type CaptainOutput = {
63
+ readonly guard: 'question';
64
+ readonly question: string;
65
+ } | {
66
+ readonly guard: 'delegation';
67
+ readonly remainingPlan: readonly JsonValue[];
68
+ readonly nextPlaybookId: string;
69
+ readonly nextPlaybookInput: string;
70
+ } | {
71
+ readonly guard: 'final';
72
+ readonly response: string;
73
+ } | {
74
+ readonly guard: 'followUpQuestion';
75
+ readonly question: string;
76
+ } | {
77
+ readonly guard: 'continuing';
78
+ readonly remainingPlan: readonly JsonValue[];
79
+ readonly nextPlaybookId: string;
80
+ readonly nextPlaybookInput: string;
81
+ } | {
82
+ readonly guard: 'needsBossReply';
83
+ readonly question: string;
84
+ };
85
+ export type PlaybookInput = {
86
+ readonly stateId: 'callPlaybook';
87
+ readonly sourceItem?: 'CAPTAIN-2';
88
+ readonly playbookId: string;
89
+ readonly text: string;
90
+ readonly playbookIdContext: 'nextPlaybookId';
91
+ readonly textContext: 'nextPlaybookInput';
92
+ };
93
+ export type PlaybookOutput = JsonValue | undefined;
94
+ type Context = {
95
+ readonly bossIntent: string;
96
+ readonly enabledPlaybooks: readonly EnabledPlaybook[];
97
+ readonly selfPlaybookId: string;
98
+ readonly remainingPlan: readonly JsonValue[];
99
+ readonly completedCallResults: readonly CompletedCallResult[];
100
+ readonly nextPlaybookId: string;
101
+ readonly nextPlaybookInput: string;
102
+ readonly callHistory: readonly string[];
103
+ readonly response?: string;
104
+ readonly pendingBossQuestion?: PendingBossQuestion;
105
+ readonly bossReply?: string;
106
+ readonly lastError?: JsonValue;
107
+ };
108
+ type BossIntentEvent = {
109
+ readonly type: 'BOSS_INTENT';
110
+ readonly bossIntent: string;
111
+ };
112
+ type BossInterruptEvent = {
113
+ readonly type: 'BOSS_INTERRUPT';
114
+ readonly targetId: 'routing';
115
+ readonly bossIntent: string;
116
+ };
117
+ type BossReplyEvent = {
118
+ readonly type: 'BOSS_REPLY';
119
+ readonly answer: string;
120
+ readonly questionId?: string;
121
+ };
122
+ export declare const captainMachine: import("xstate").StateMachine<Context, BossIntentEvent | BossInterruptEvent | BossReplyEvent, {
123
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<PlaybookOutput, PlaybookInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<CaptainOutput, CaptainInput, import("xstate").EventObject>> | undefined;
124
+ }, {
125
+ src: "playbook";
126
+ logic: import("xstate").PromiseActorLogic<PlaybookOutput, PlaybookInput, import("xstate").EventObject>;
127
+ id: string | undefined;
128
+ } | {
129
+ src: "captain";
130
+ logic: import("xstate").PromiseActorLogic<CaptainOutput, CaptainInput, import("xstate").EventObject>;
131
+ id: string | undefined;
132
+ }, {
133
+ type: "startRoutingFromBoss";
134
+ params: import("xstate").NonReducibleUnknown;
135
+ } | {
136
+ type: "storeBossReply";
137
+ params: import("xstate").NonReducibleUnknown;
138
+ } | {
139
+ type: "rememberInvalidBossReply";
140
+ params: import("xstate").NonReducibleUnknown;
141
+ } | {
142
+ type: "setRoutingQuestion";
143
+ params: import("xstate").NonReducibleUnknown;
144
+ } | {
145
+ type: "storeRoutingDelegation";
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";
161
+ params: import("xstate").NonReducibleUnknown;
162
+ } | {
163
+ type: "rememberInvalidActorOutput";
164
+ params: import("xstate").NonReducibleUnknown;
165
+ } | {
166
+ type: "rememberActorError";
167
+ params: import("xstate").NonReducibleUnknown;
168
+ }, {
169
+ type: "isRoutingInterrupt";
170
+ params: unknown;
171
+ } | {
172
+ type: "canResumeRouting";
173
+ params: unknown;
174
+ } | {
175
+ type: "canResumeReassessing";
176
+ params: unknown;
177
+ } | {
178
+ type: "hasBossIntent";
179
+ params: unknown;
180
+ } | {
181
+ type: "isRoutingQuestion";
182
+ params: unknown;
183
+ } | {
184
+ type: "isRoutingDelegation";
185
+ params: unknown;
186
+ } | {
187
+ type: "isReassessFinal";
188
+ params: unknown;
189
+ } | {
190
+ type: "isReassessQuestion";
191
+ params: unknown;
192
+ } | {
193
+ type: "isReassessContinuing";
194
+ params: unknown;
195
+ } | {
196
+ type: "isPlaybookSuccessOutput";
197
+ params: unknown;
198
+ } | {
199
+ type: "isAuthoredChildError";
200
+ params: unknown;
201
+ }, never, "done" | "failed" | "callPlaybook" | "routing" | "reassessing" | "ready" | "awaitBossReply", string, CaptainMachineInput, CaptainMachineOutput, import("xstate").EventObject, import("xstate").MetaObject, {
202
+ id: "captain";
203
+ states: {
204
+ readonly ready: {
205
+ id: "ready";
206
+ };
207
+ readonly routing: {
208
+ id: "routing";
209
+ };
210
+ readonly callPlaybook: {
211
+ id: "callPlaybook";
212
+ };
213
+ readonly reassessing: {
214
+ id: "reassessing";
215
+ };
216
+ readonly awaitBossReply: {
217
+ id: "awaitBossReply";
218
+ };
219
+ readonly failed: {
220
+ id: "failed";
221
+ };
222
+ readonly done: {
223
+ id: "done";
224
+ };
225
+ };
226
+ }>;
227
+ export {};