@sublang/playbook 13.0.0 → 13.2.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 +7 -5
- package/docs/cli.md +28 -9
- package/docs/configuration.md +21 -5
- package/docs/embedding.md +1 -1
- package/package.json +41 -3
- package/reference/sdlc/branch.md +37 -0
- package/reference/sdlc/branch.playbook/branch.fsm.d.ts +169 -0
- package/reference/sdlc/branch.playbook/branch.fsm.js +325 -0
- package/reference/sdlc/branch.playbook/branch.fsm.ts +458 -0
- package/reference/sdlc/branch.playbook/branch.gears.md +44 -0
- package/reference/sdlc/branch.playbook/branch.playbook.d.ts +20 -0
- package/reference/sdlc/branch.playbook/branch.playbook.js +121 -0
- package/reference/sdlc/branch.playbook/branch.playbook.ts +217 -0
- package/reference/sdlc/branch.playbook/branch.registry.d.ts +40 -0
- package/reference/sdlc/branch.playbook/branch.registry.js +63 -0
- package/reference/sdlc/branch.playbook/branch.registry.ts +121 -0
- package/reference/sdlc/code.md +7 -0
- package/reference/sdlc/code.playbook/code.fsm.js +5 -5
- package/reference/sdlc/code.playbook/code.fsm.ts +5 -5
- package/reference/sdlc/code.playbook/code.gears.md +5 -5
- package/reference/sdlc/code.playbook/code.playbook.d.ts +1 -1
- package/reference/sdlc/code.playbook/code.playbook.js +6 -16
- package/reference/sdlc/code.playbook/code.playbook.ts +7 -17
- package/reference/sdlc/code.playbook/playbook-captain.js +4 -1
- package/reference/sdlc/code.playbook/playbook-captain.ts +4 -1
- package/reference/sdlc/code.playbook/playbook.config.template.yaml +16 -2
- package/reference/sdlc/decide.md +2 -0
- package/reference/sdlc/decide.playbook/decide.fsm.js +1 -1
- package/reference/sdlc/decide.playbook/decide.fsm.ts +1 -1
- package/reference/sdlc/decide.playbook/decide.gears.md +2 -2
- package/reference/sdlc/decide.playbook/decide.playbook.d.ts +1 -2
- package/reference/sdlc/decide.playbook/decide.playbook.js +8 -22
- package/reference/sdlc/decide.playbook/decide.playbook.ts +8 -25
- package/reference/sdlc/dev.md +45 -4
- package/reference/sdlc/dev.playbook/dev.fsm.d.ts +100 -9
- package/reference/sdlc/dev.playbook/dev.fsm.js +245 -28
- package/reference/sdlc/dev.playbook/dev.fsm.ts +381 -37
- package/reference/sdlc/dev.playbook/dev.gears.md +60 -22
- package/reference/sdlc/dev.playbook/dev.playbook.d.ts +1 -1
- package/reference/sdlc/dev.playbook/dev.playbook.js +20 -18
- package/reference/sdlc/dev.playbook/dev.playbook.ts +21 -21
- package/reference/sdlc/dev.playbook/dev.registry.d.ts +1 -1
- package/reference/sdlc/dev.playbook/dev.registry.js +7 -2
- package/reference/sdlc/dev.playbook/dev.registry.ts +7 -2
- package/reference/sdlc/pr.md +108 -0
- package/reference/sdlc/pr.playbook/pr.fsm.d.ts +352 -0
- package/reference/sdlc/pr.playbook/pr.fsm.js +902 -0
- package/reference/sdlc/pr.playbook/pr.fsm.ts +1251 -0
- package/reference/sdlc/pr.playbook/pr.gears.md +155 -0
- package/reference/sdlc/pr.playbook/pr.playbook.d.ts +27 -0
- package/reference/sdlc/pr.playbook/pr.playbook.js +133 -0
- package/reference/sdlc/pr.playbook/pr.playbook.ts +235 -0
- package/reference/sdlc/pr.playbook/pr.registry.d.ts +40 -0
- package/reference/sdlc/pr.playbook/pr.registry.js +68 -0
- package/reference/sdlc/pr.playbook/pr.registry.ts +124 -0
- package/reference/sdlc/review.md +18 -0
- package/reference/sdlc/review.playbook/review.fsm.js +8 -8
- package/reference/sdlc/review.playbook/review.fsm.ts +8 -8
- package/reference/sdlc/review.playbook/review.gears.md +8 -8
- package/reference/sdlc/review.playbook/review.playbook.d.ts +1 -1
- package/reference/sdlc/review.playbook/review.playbook.js +5 -15
- package/reference/sdlc/review.playbook/review.playbook.ts +6 -16
- package/slc/link.md +12 -24
- package/src/runtime.d.ts +2 -0
- package/src/runtime.ts +2 -0
- package/src/xstate-playbook-runtime.d.ts +4 -2
- package/src/xstate-playbook-runtime.js +18 -13
- package/src/xstate-playbook-runtime.ts +26 -14
|
@@ -776,6 +776,7 @@ interface XStatePlaybookRuntimeSpecBase<TOptions> {
|
|
|
776
776
|
composePlayerPrompt?: (
|
|
777
777
|
input: PlaybookPlayerInput,
|
|
778
778
|
promptIdentity: XStatePromptIdentity,
|
|
779
|
+
resuming?: boolean,
|
|
779
780
|
) => string;
|
|
780
781
|
/** Compose the direct-Captain prompt. Default: continuation blocks + placeholder substitution with deterministic JSON rendering. */
|
|
781
782
|
composeCaptainPrompt?: (input: PlaybookCaptainInput) => string;
|
|
@@ -1064,22 +1065,31 @@ export function pendingBossQuestionFromContext(
|
|
|
1064
1065
|
// ---------------------------------------------------------------------------
|
|
1065
1066
|
|
|
1066
1067
|
const CONTINUATION_PREAMBLE =
|
|
1067
|
-
'
|
|
1068
|
+
'Continue the same task using Boss’s reply below.';
|
|
1068
1069
|
|
|
1069
1070
|
function continuationBlocks(input: {
|
|
1070
1071
|
pendingBossQuestion?: { readonly question: string };
|
|
1071
1072
|
bossReply?: string;
|
|
1072
|
-
}): string[] {
|
|
1073
|
+
}, resuming = false): string[] {
|
|
1073
1074
|
if (input.pendingBossQuestion === undefined || input.bossReply === undefined) {
|
|
1074
1075
|
return [];
|
|
1075
1076
|
}
|
|
1076
1077
|
return [
|
|
1077
1078
|
CONTINUATION_PREAMBLE,
|
|
1078
|
-
`
|
|
1079
|
+
...(resuming ? [] : [`Your previous question:\n${input.pendingBossQuestion.question}`]),
|
|
1079
1080
|
`Boss reply:\n${input.bossReply}`,
|
|
1080
1081
|
];
|
|
1081
1082
|
}
|
|
1082
1083
|
|
|
1084
|
+
/** Add clarification context without repeating the question in a live conversation. */
|
|
1085
|
+
export function composePlayerContinuation(
|
|
1086
|
+
input: Pick<PlaybookPlayerInput, 'pendingBossQuestion' | 'bossReply'>,
|
|
1087
|
+
body: string,
|
|
1088
|
+
resuming = false,
|
|
1089
|
+
): string {
|
|
1090
|
+
return [...continuationBlocks(input, resuming), body].join('\n\n');
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1083
1093
|
const PLACEHOLDER_PATTERN = /<(#|[A-Za-z_$][A-Za-z0-9_$-]*)>/g;
|
|
1084
1094
|
|
|
1085
1095
|
function placeholderFieldName(
|
|
@@ -1104,16 +1114,15 @@ function placeholderFieldName(
|
|
|
1104
1114
|
export function defaultComposePlayerPrompt(
|
|
1105
1115
|
input: PlaybookPlayerInput,
|
|
1106
1116
|
placeholderFields: Readonly<Record<string, string>> = {},
|
|
1117
|
+
resuming = false,
|
|
1107
1118
|
): string {
|
|
1108
|
-
const blocks = continuationBlocks(input);
|
|
1109
1119
|
const fields = input as unknown as Record<string, unknown>;
|
|
1110
1120
|
const body = input.prompt.replace(PLACEHOLDER_PATTERN, (match, token) => {
|
|
1111
1121
|
const value =
|
|
1112
1122
|
fields[placeholderFieldName(token as string, placeholderFields)];
|
|
1113
1123
|
return typeof value === 'string' ? value : match;
|
|
1114
1124
|
});
|
|
1115
|
-
|
|
1116
|
-
return blocks.join('\n\n');
|
|
1125
|
+
return composePlayerContinuation(input, body, resuming);
|
|
1117
1126
|
}
|
|
1118
1127
|
|
|
1119
1128
|
function sortJson(value: JsonValue): JsonValue {
|
|
@@ -3158,8 +3167,8 @@ export function createXStatePlaybookRuntime<
|
|
|
3158
3167
|
}
|
|
3159
3168
|
const composePlayerPrompt =
|
|
3160
3169
|
spec.composePlayerPrompt ??
|
|
3161
|
-
((input: PlaybookPlayerInput) =>
|
|
3162
|
-
defaultComposePlayerPrompt(input, spec.placeholderFields));
|
|
3170
|
+
((input: PlaybookPlayerInput, _identity: XStatePromptIdentity, resuming = false) =>
|
|
3171
|
+
defaultComposePlayerPrompt(input, spec.placeholderFields, resuming));
|
|
3163
3172
|
const composeCaptainPrompt =
|
|
3164
3173
|
spec.composeCaptainPrompt ??
|
|
3165
3174
|
((input: PlaybookCaptainInput) =>
|
|
@@ -4074,7 +4083,7 @@ export function createXStatePlaybookRuntime<
|
|
|
4074
4083
|
return session?.roleBindings?.[roleId]?.promptIdentity ?? roleId;
|
|
4075
4084
|
}
|
|
4076
4085
|
|
|
4077
|
-
function composeBoundPlayerPrompt(input: PlaybookPlayerInput): string {
|
|
4086
|
+
function composeBoundPlayerPrompt(input: PlaybookPlayerInput, resuming = false): string {
|
|
4078
4087
|
let active = true;
|
|
4079
4088
|
const lookup: XStatePromptIdentity = (roleId) => {
|
|
4080
4089
|
if (!active) {
|
|
@@ -4085,7 +4094,7 @@ export function createXStatePlaybookRuntime<
|
|
|
4085
4094
|
return promptIdentity(roleId);
|
|
4086
4095
|
};
|
|
4087
4096
|
try {
|
|
4088
|
-
return composePlayerPrompt(input, lookup);
|
|
4097
|
+
return composePlayerPrompt(input, lookup, resuming);
|
|
4089
4098
|
} finally {
|
|
4090
4099
|
active = false;
|
|
4091
4100
|
}
|
|
@@ -5321,7 +5330,7 @@ export function createXStatePlaybookRuntime<
|
|
|
5321
5330
|
async callPlayer(
|
|
5322
5331
|
input,
|
|
5323
5332
|
roleId,
|
|
5324
|
-
|
|
5333
|
+
freshPrompt,
|
|
5325
5334
|
signal,
|
|
5326
5335
|
): Promise<PlayerResult> {
|
|
5327
5336
|
// State-entry telemetry/status must precede the call they describe.
|
|
@@ -5356,6 +5365,8 @@ export function createXStatePlaybookRuntime<
|
|
|
5356
5365
|
if (!isAbortFailure(error, signal)) controlPlaneError ??= error;
|
|
5357
5366
|
throw error;
|
|
5358
5367
|
}
|
|
5368
|
+
const prompt = selectedResume === false
|
|
5369
|
+
? freshPrompt : composeBoundPlayerPrompt(input, true);
|
|
5359
5370
|
const callId =
|
|
5360
5371
|
deferredContinuation?.effectBoundary.callId ??
|
|
5361
5372
|
`player-${++playerCallSequence}`;
|
|
@@ -5401,10 +5412,11 @@ export function createXStatePlaybookRuntime<
|
|
|
5401
5412
|
resume: string | false = selectedResume,
|
|
5402
5413
|
): Promise<PlayerResult> => {
|
|
5403
5414
|
const identity = callIdentity(resume);
|
|
5415
|
+
const callPrompt = resume === false ? freshPrompt : prompt;
|
|
5404
5416
|
await emitCallStarted(
|
|
5405
5417
|
'player.call.started',
|
|
5406
5418
|
'player.call.finished',
|
|
5407
|
-
{ ...identity, prompt },
|
|
5419
|
+
{ ...identity, prompt: callPrompt },
|
|
5408
5420
|
position,
|
|
5409
5421
|
signal,
|
|
5410
5422
|
);
|
|
@@ -5418,9 +5430,9 @@ export function createXStatePlaybookRuntime<
|
|
|
5418
5430
|
signal.throwIfAborted();
|
|
5419
5431
|
rawResult = await requireHostPorts().callPlayer(
|
|
5420
5432
|
roleId,
|
|
5421
|
-
|
|
5433
|
+
callPrompt,
|
|
5422
5434
|
signal,
|
|
5423
|
-
{ resume },
|
|
5435
|
+
{ resume, ...(callPrompt === freshPrompt ? {} : { freshPrompt }) },
|
|
5424
5436
|
);
|
|
5425
5437
|
// A host promise is not required to honor cancellation. Do not
|
|
5426
5438
|
// let a late result mutate continuity or publish a successful
|