@sublang/playbook 15.0.0 → 16.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 (81) hide show
  1. package/README.md +1 -1
  2. package/docs/embedding.md +9 -7
  3. package/package.json +3 -1
  4. package/reference/sdlc/branch.playbook/branch.fsm.d.ts +63 -33
  5. package/reference/sdlc/branch.playbook/branch.fsm.js +190 -108
  6. package/reference/sdlc/branch.playbook/branch.fsm.ts +269 -147
  7. package/reference/sdlc/branch.playbook/branch.gears.md +7 -17
  8. package/reference/sdlc/branch.playbook/branch.playbook.d.ts +12 -16
  9. package/reference/sdlc/branch.playbook/branch.playbook.js +112 -101
  10. package/reference/sdlc/branch.playbook/branch.playbook.ts +128 -171
  11. package/reference/sdlc/branch.playbook/branch.registry.d.ts +3 -2
  12. package/reference/sdlc/branch.playbook/branch.registry.ts +6 -2
  13. package/reference/sdlc/code.playbook/bin/repository-effects.js +54 -13
  14. package/reference/sdlc/code.playbook/code.fsm.d.ts +143 -90
  15. package/reference/sdlc/code.playbook/code.fsm.introspect.d.ts +8 -8
  16. package/reference/sdlc/code.playbook/code.fsm.introspect.ts +13 -13
  17. package/reference/sdlc/code.playbook/code.fsm.js +609 -649
  18. package/reference/sdlc/code.playbook/code.fsm.ts +890 -821
  19. package/reference/sdlc/code.playbook/code.gears.md +39 -29
  20. package/reference/sdlc/code.playbook/code.playbook.d.ts +13 -16
  21. package/reference/sdlc/code.playbook/code.playbook.js +166 -147
  22. package/reference/sdlc/code.playbook/code.playbook.ts +180 -229
  23. package/reference/sdlc/code.playbook/code.registry.d.ts +3 -2
  24. package/reference/sdlc/code.playbook/code.registry.ts +6 -2
  25. package/reference/sdlc/code.playbook/playbook-captain.d.ts +42 -0
  26. package/reference/sdlc/code.playbook/playbook-captain.js +829 -194
  27. package/reference/sdlc/code.playbook/playbook-captain.ts +1227 -220
  28. package/reference/sdlc/decide.md +1 -0
  29. package/reference/sdlc/decide.playbook/decide.fsm.d.ts +270 -154
  30. package/reference/sdlc/decide.playbook/decide.fsm.js +765 -732
  31. package/reference/sdlc/decide.playbook/decide.fsm.ts +1167 -945
  32. package/reference/sdlc/decide.playbook/decide.gears.md +28 -21
  33. package/reference/sdlc/decide.playbook/decide.playbook.d.ts +11 -67
  34. package/reference/sdlc/decide.playbook/decide.playbook.js +155 -3570
  35. package/reference/sdlc/decide.playbook/decide.playbook.ts +186 -5061
  36. package/reference/sdlc/decide.playbook/decide.registry.d.ts +8 -4
  37. package/reference/sdlc/decide.playbook/decide.registry.js +2 -2
  38. package/reference/sdlc/decide.playbook/decide.registry.ts +13 -6
  39. package/reference/sdlc/dev.playbook/dev.fsm.d.ts +113 -131
  40. package/reference/sdlc/dev.playbook/dev.fsm.js +517 -575
  41. package/reference/sdlc/dev.playbook/dev.fsm.ts +667 -787
  42. package/reference/sdlc/dev.playbook/dev.gears.md +52 -54
  43. package/reference/sdlc/dev.playbook/dev.playbook.d.ts +13 -10
  44. package/reference/sdlc/dev.playbook/dev.playbook.js +128 -120
  45. package/reference/sdlc/dev.playbook/dev.playbook.ts +143 -193
  46. package/reference/sdlc/dev.playbook/dev.registry.d.ts +3 -2
  47. package/reference/sdlc/dev.playbook/dev.registry.ts +6 -2
  48. package/reference/sdlc/pr.playbook/pr.fsm.d.ts +92 -85
  49. package/reference/sdlc/pr.playbook/pr.fsm.js +461 -518
  50. package/reference/sdlc/pr.playbook/pr.fsm.ts +533 -663
  51. package/reference/sdlc/pr.playbook/pr.gears.md +47 -63
  52. package/reference/sdlc/pr.playbook/pr.playbook.d.ts +13 -23
  53. package/reference/sdlc/pr.playbook/pr.playbook.js +118 -112
  54. package/reference/sdlc/pr.playbook/pr.playbook.ts +136 -190
  55. package/reference/sdlc/pr.playbook/pr.registry.d.ts +3 -2
  56. package/reference/sdlc/pr.playbook/pr.registry.ts +4 -2
  57. package/reference/sdlc/review.md +3 -3
  58. package/reference/sdlc/review.playbook/review.fsm.d.ts +150 -116
  59. package/reference/sdlc/review.playbook/review.fsm.js +479 -550
  60. package/reference/sdlc/review.playbook/review.fsm.ts +717 -662
  61. package/reference/sdlc/review.playbook/review.gears.md +32 -29
  62. package/reference/sdlc/review.playbook/review.playbook.d.ts +12 -12
  63. package/reference/sdlc/review.playbook/review.playbook.js +180 -155
  64. package/reference/sdlc/review.playbook/review.playbook.ts +190 -230
  65. package/reference/sdlc/review.playbook/review.registry.d.ts +6 -5
  66. package/reference/sdlc/review.playbook/review.registry.js +3 -3
  67. package/reference/sdlc/review.playbook/review.registry.ts +9 -5
  68. package/slc/gears2fsm.md +72 -3
  69. package/slc/link.md +50 -27
  70. package/slc/materialize-link.mjs +51 -13
  71. package/slc/optimize.md +4 -1
  72. package/slc/prefix-prompts.mjs +191 -0
  73. package/slc/prefix.md +203 -0
  74. package/slc/slc.pin-inputs.json +11 -1
  75. package/slc/text2gears.md +71 -11
  76. package/src/xstate-playbook-runtime.d.ts +82 -9
  77. package/src/xstate-playbook-runtime.js +1224 -283
  78. package/src/xstate-playbook-runtime.ts +1671 -338
  79. package/src/xstate-runtime.d.ts +3 -1
  80. package/src/xstate-runtime.js +9 -2
  81. package/src/xstate-runtime.ts +12 -2
@@ -3,32 +3,32 @@
3
3
 
4
4
  # Decide
5
5
 
6
- ## Roles
6
+ Roles:
7
7
 
8
8
  - Coder
9
9
  - Reviewer
10
10
 
11
- ## Independent proposals
11
+ The caller supplies the topic including any specific context.
12
+ No transition shall depend on a fixed presentation format of either player's reply.
12
13
 
13
- The caller supplies a topic as `callerTopic`.
14
- Coder and Reviewer receive the complete topic concurrently and independently.
15
- Neither role's player receives the other role's proposal before both proposals are complete.
16
- A proposal is complete only when its player affirmatively provides a complete design proposal; a progress report, status update, or promise of a later proposal supports no proposal outcome.
17
- A Boss interrupt during the parallel proposal pair restarts the complete pair with the new `callerTopic`.
14
+ ## Independent proposals
18
15
 
19
16
  ### DECIDE-1
20
17
 
21
18
  Parallel group: independent-proposals
22
19
 
23
- When the caller gives a topic, Captain shall relay the complete topic to Coder in quotes and prompt Coder:
20
+ Captain shall not wait for Reviewer's proposal before requesting Coder's, and Coder's player shall not receive Reviewer's proposal until both proposals are complete.
21
+ A Boss interrupt during the parallel proposal pair restarts the whole pair so both players receive the same new topic and remain independent.
22
+
23
+ When the caller gives a topic, or when a Boss interrupt restarts the parallel proposal pair with a new topic, Captain shall relay the complete topic to Coder in quotes and prompt Coder:
24
24
 
25
- > > Original topic: <caller-topic>
26
- >
27
25
  > Assess whether the topic is better expressed as a few spec items under @specs/packages/ or requires one or more DRs under @specs/decisions/.
28
26
  > Propose your design.
29
27
  > Keep your proposal coherent, focused, and concise.
30
28
  > Consult @specs/map.md for relevant context and @specs/meta.md for spec requirements, if needed.
31
29
  > Do not change any files.
30
+ >
31
+ > > Original topic: <caller-topic>
32
32
 
33
33
  Results:
34
34
  - `proposed`: Coder affirmatively provided a complete design proposal; a progress report, status update, or promise of a later proposal supports no proposal outcome. Output shall include `coderProposal: <verbatim final text>`.
@@ -37,15 +37,18 @@ Results:
37
37
 
38
38
  Parallel group: independent-proposals
39
39
 
40
- When the caller gives a topic, Captain shall relay the complete topic to Reviewer in quotes and prompt Reviewer:
40
+ Captain shall not wait for Coder's proposal before requesting Reviewer's, and Reviewer's player shall not receive Coder's proposal until both proposals are complete.
41
+ A Boss interrupt during the parallel proposal pair restarts the whole pair so both players receive the same new topic and remain independent.
42
+
43
+ When the caller gives a topic, or when a Boss interrupt restarts the parallel proposal pair with a new topic, Captain shall relay the complete topic to Reviewer in quotes and prompt Reviewer:
41
44
 
42
- > > Original topic: <caller-topic>
43
- >
44
45
  > Assess whether the topic is better expressed as a few spec items under @specs/packages/ or requires one or more DRs under @specs/decisions/.
45
46
  > Propose your design.
46
47
  > Keep your proposal coherent, focused, and concise.
47
48
  > Consult @specs/map.md for relevant context and @specs/meta.md for spec requirements, if needed.
48
49
  > Do not change any files.
50
+ >
51
+ > > Original topic: <caller-topic>
49
52
 
50
53
  Results:
51
54
  - `proposed`: Reviewer affirmatively provided a complete design proposal; a progress report, status update, or promise of a later proposal supports no proposal outcome. Output shall include `reviewerProposal: <verbatim final text>`.
@@ -54,7 +57,10 @@ Results:
54
57
 
55
58
  ### DECIDE-3
56
59
 
57
- When both independent proposals are complete, Captain shall relay the complete topic and Reviewer's complete proposal to Coder under their own labels in quotes and prompt Coder:
60
+ No transition shall depend on a fixed presentation format of Coder's reply.
61
+ Captain shall use the repository-effect receipt as the authoritative identity of Coder's new `decide`-owned commit.
62
+
63
+ When both proposals are complete, Captain shall relay the complete topic and Reviewer's complete proposal to Coder under their own labels in quotes and prompt Coder:
58
64
 
59
65
  > Synthesize your independent proposal with Reviewer's proposal below.
60
66
  > Keep to the original topic below and follow what it asks.
@@ -72,20 +78,21 @@ When both independent proposals are complete, Captain shall relay the complete t
72
78
  > > Reviewer's independent proposal: <reviewer-proposal>
73
79
 
74
80
  Results:
75
- - `committed`: Coder synthesized both proposals and committed the resulting design as one new commit. Output shall include `coderOutput: <verbatim final text>` and `latestCommit: <commit identity>`.
76
-
77
- No transition depends on a fixed presentation format of either player's reply; the repository-effect receipt is the authoritative identity of Coder's new `decide`-owned commit.
81
+ - `committed`: Coder synthesized the proposals into the necessary DRs and/or spec items and committed the result as one new commit. Output shall include `coderOutput: <verbatim final text>` and `latestCommit: <commit identity>`.
78
82
 
79
83
  ## Review
80
84
 
81
85
  ### DECIDE-4
82
86
 
83
- When Coder commits, Captain shall call playbook `review` with the following input in quotes:
87
+ When Coder has committed, Captain shall call playbook `review`:
84
88
 
85
89
  > > Original intent: <caller-topic>
86
90
  > > Review scope: the `decide`-owned commit <decide-commit> and its resulting repository state.
91
+ > > Coder's independent proposal: <coder-proposal>
87
92
  > > Coder output: <coder-output>
88
93
 
89
- `decide` is complete only when `review` returns a result that applies to the supplied review scope, gives the exact evaluated repository revision, and affirmatively establishes that no unsettled findings remain; `decide` then returns the `decide`-owned commit and that evaluated revision to the caller.
90
- An authored `review` abort or failure, or a terminal result that does not establish those facts, terminates with the failure and the last `decide`-owned commit reported to the caller.
91
- Any other nested-call error parks `decide` as failed and retains the control-plane error.
94
+ The input is relayed to `review` in quotes (`>`); `<decide-commit>` is the `decide`-owned commit identified by the repository-effect receipt.
95
+ `decide` is complete only when `review` returns a result that applies to the supplied review scope, gives the exact evaluated repository revision, and affirmatively establishes that no unsettled findings remain.
96
+ It then returns the `decide`-owned commit and that evaluated revision to its caller.
97
+ When `review` returns an authored abort or failure, or a terminal result that does not establish those facts, `decide` shall report the failure and the last `decide`-owned commit to its caller.
98
+ When the nested `review` call fails outside that authored result contract, `decide` shall park as failed and retain the control-plane error instead of reporting an authored review outcome.
@@ -1,72 +1,16 @@
1
- import { type PlayerInput, type DecideEvent, type DecideInput, type PendingBossQuestion } from './decide.fsm.js';
2
- import type { PlaybookHostConstructionCapabilities } from '../code.playbook/playbook-captain.js';
3
- import type { CaptainCallOptions, CaptainResult, JsonValue, NormalizedError, PlayerCallOptions, PlayerResult, PlayerSessionStore, PlaybookCallRequest, PlaybookCallResult, PlaybookCallStart, PlaybookControlAction, PlaybookControlReceipt, PlaybookControlView, PlaybookPendingCall, PlaybookPorts, PlaybookRunResult, PlaybookRuntime, PlaybookRuntimeFactory, PlaybookRuntimeSnapshot, PlaybookSession, PlaybookState, PlaybookStateValue, PlaybookTraceEvent, PlaybookTraceType } from '@sublang/playbook/runtime';
4
- export type { CaptainCallOptions, CaptainResult, JsonValue, NormalizedError, PlayerCallOptions, PlayerResult, PlayerSessionStore, PlaybookCallRequest, PlaybookCallResult, PlaybookCallStart, PlaybookControlAction, PlaybookControlReceipt, PlaybookControlView, PlaybookPendingCall, PlaybookPorts, PlaybookRunResult, PlaybookRuntime, PlaybookRuntimeFactory, PlaybookRuntimeSnapshot, PlaybookSession, PlaybookState, PlaybookStateValue, PlaybookTraceEvent, PlaybookTraceType, };
5
- type RoleId = 'coder' | 'reviewer';
6
- export type PlaybookRuntimeOptions = DecideInput;
7
- export type DecidePlaybookHostCapabilities = PlaybookHostConstructionCapabilities;
8
- export interface DecidePlaybookRuntimeConstruction {
9
- readonly configuredOptions: PlaybookRuntimeOptions;
10
- readonly hostCapabilities: DecidePlaybookHostCapabilities;
1
+ import { type XStatePromptIdentity, type PlaybookPlayerInput, type XStatePlaybookRuntimeConstruction, type XStatePlaybookRuntimeFactory } from '@sublang/playbook/xstate-runtime';
2
+ export type { PlayerResult, PlayerCallOptions, PlayerSessionStore, CaptainResult, CaptainCallOptions, JsonValue, NormalizedError, PlaybookCallRequest, PlaybookCallResult, PlaybookCallStart, PlaybookStateValue, PlaybookState, PlaybookPendingCall, PlaybookRunResult, PlaybookRuntime, PlaybookRuntimeFactory, PlaybookRuntimeSnapshot, PlaybookSession, PlaybookPorts, PlaybookTraceEvent, PlaybookTraceType, PlaybookControlReceipt, PlaybookControlView, } from '@sublang/playbook/runtime';
3
+ export interface PlaybookRuntimeOptions {
11
4
  }
12
- type PromptIdentity = (roleId: RoleId) => string;
13
- declare function composePlayerPrompt(input: PlayerInput, promptIdentity: PromptIdentity, resuming?: boolean): string;
14
- declare function requiredFieldsFor(description: string): string[];
15
- declare function extractJson(raw: string): Record<string, unknown> | null;
16
- declare function buildClassifierPrompt(text: string, ctx: {
17
- state: PlaybookState;
18
- pendingQuestions: readonly PendingBossQuestion[];
19
- }): string;
20
- declare function parseClassification(raw: string, text: string, pendingQuestionIds?: readonly string[]): DecideEvent | {
21
- type: 'NO_ACTION';
22
- } | null;
23
- declare function buildAdjudicatorPrompt(input: PlayerInput, playerOutput: string, correction?: {
24
- readonly reply: string;
25
- readonly error: string;
26
- }): string;
27
- declare function combineSignals(a: AbortSignal | undefined, b: AbortSignal | undefined): AbortSignal;
28
- declare function normalizeErrorCompact(err: unknown): {
29
- name: string;
30
- message: string;
31
- } | undefined;
32
- declare function normalizeErrorFull(err: unknown): {
33
- name: string;
34
- message: string;
35
- stack?: string;
36
- } | undefined;
37
- declare function pendingQuestionsFromContext(context: Record<string, unknown>): PendingBossQuestion[];
38
- declare function pendingQuestionsForState(state: PlaybookState, context: Record<string, unknown>): PendingBossQuestion[];
39
- export declare const createPlaybookRuntime: PlaybookRuntimeFactory<DecidePlaybookRuntimeConstruction>;
5
+ export type PlaybookHostCapabilities = XStatePlaybookRuntimeConstruction<PlaybookRuntimeOptions, {
6
+ readonly authority: object;
7
+ }>['hostCapabilities'];
8
+ export declare function validateOptions(value: unknown): PlaybookRuntimeOptions;
40
9
  export declare const _internal: {
41
- composePlayerPrompt: typeof composePlayerPrompt;
42
- requiredFieldsFor: typeof requiredFieldsFor;
43
- extractJson: typeof extractJson;
44
- buildClassifierPrompt: typeof buildClassifierPrompt;
45
- parseClassification: typeof parseClassification;
46
- buildAdjudicatorPrompt: typeof buildAdjudicatorPrompt;
47
- combineSignals: typeof combineSignals;
48
- pendingQuestionsFromContext: typeof pendingQuestionsFromContext;
49
- pendingQuestionsForState: typeof pendingQuestionsForState;
50
- normalizeErrorCompact: typeof normalizeErrorCompact;
51
- normalizeErrorFull: typeof normalizeErrorFull;
52
- STATE_DESCRIPTIONS: Readonly<Record<string, string>>;
53
- ROLE_STATES: readonly [{
54
- readonly stateId: "askCoderProposal";
55
- readonly role: "coder";
56
- readonly sourceItem: "DECIDE-1";
57
- }, {
58
- readonly stateId: "askReviewerProposal";
59
- readonly role: "reviewer";
60
- readonly sourceItem: "DECIDE-2";
61
- }, {
62
- readonly stateId: "commitCoderProposal";
63
- readonly role: "coder";
64
- readonly sourceItem: "DECIDE-3";
65
- }];
66
- ROLE_STATE_IDS: ReadonlySet<string>;
67
- VERBATIM_PAYLOAD_FIELDS: ReadonlySet<string>;
68
- BOSS_INTERRUPT_TARGETS: readonly ["independentProposals"];
10
+ composePlayerPrompt: (input: PlaybookPlayerInput, promptIdentity: XStatePromptIdentity, resuming?: boolean) => string;
11
+ RESUMABLE_STATE_IDS: ReadonlySet<string>;
69
12
  UNFINISHED_FINAL_STATE_IDS: ReadonlySet<string>;
70
- TELEMETRY_TOPIC: string;
13
+ VERBATIM_PAYLOAD_FIELDS: ReadonlySet<string>;
71
14
  };
15
+ declare const createPlaybookRuntime: XStatePlaybookRuntimeFactory<XStatePlaybookRuntimeConstruction<PlaybookRuntimeOptions, PlaybookHostCapabilities>, 3>;
72
16
  export default createPlaybookRuntime;