@sublang/playbook 17.3.0 → 17.4.1
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 +5 -2
- package/docs/configuration.md +45 -4
- package/docs/embedding.md +94 -0
- package/package.json +34 -5
- package/reference/sdlc/captain.md +6 -4
- package/reference/sdlc/captain.playbook/captain.fsm.d.ts +5 -0
- package/reference/sdlc/captain.playbook/captain.fsm.js +4 -3
- package/reference/sdlc/captain.playbook/captain.fsm.ts +9 -4
- package/reference/sdlc/captain.playbook/captain.gears.md +6 -3
- package/reference/sdlc/captain.playbook/captain.playbook.d.ts +2 -0
- package/reference/sdlc/captain.playbook/captain.playbook.js +7 -3
- package/reference/sdlc/captain.playbook/captain.playbook.ts +8 -4
- package/reference/sdlc/code.md +24 -4
- package/reference/sdlc/code.playbook/asset-types.d.ts +32 -0
- package/reference/sdlc/code.playbook/bin/launch-config.js +2 -0
- package/reference/sdlc/code.playbook/bin/portable-codec.js +12 -5
- package/reference/sdlc/code.playbook/bin/run.js +68 -4
- package/reference/sdlc/code.playbook/bin/session-host.js +16 -4
- package/reference/sdlc/code.playbook/bin/session-media.js +46 -0
- package/reference/sdlc/code.playbook/bin/session-store.js +145 -13
- package/reference/sdlc/code.playbook/code.fsm.d.ts +12 -0
- package/reference/sdlc/code.playbook/code.fsm.js +40 -6
- package/reference/sdlc/code.playbook/code.fsm.ts +53 -6
- package/reference/sdlc/code.playbook/code.gears.md +32 -4
- package/reference/sdlc/code.playbook/playbook-captain.d.ts +17 -1
- package/reference/sdlc/code.playbook/playbook-captain.js +201 -19
- package/reference/sdlc/code.playbook/playbook-captain.ts +224 -24
- package/reference/sdlc/code.playbook/playbook.config.template.yaml +16 -3
- package/reference/sdlc/code.playbook/session-assets.d.ts +53 -0
- package/reference/sdlc/code.playbook/session-assets.js +303 -0
- package/reference/sdlc/code.playbook/session-host.d.ts +9 -1
- package/reference/sdlc/code.playbook/session-store.d.ts +26 -2
- package/reference/sdlc/code.playbook/worker-evidence.d.ts +8 -0
- package/reference/sdlc/code.playbook/worker-evidence.js +51 -0
- package/reference/sdlc/inspect.md +40 -0
- package/reference/sdlc/inspect.playbook/inspect.fsm.d.ts +168 -0
- package/reference/sdlc/inspect.playbook/inspect.fsm.js +354 -0
- package/reference/sdlc/inspect.playbook/inspect.fsm.ts +455 -0
- package/reference/sdlc/inspect.playbook/inspect.gears.md +36 -0
- package/reference/sdlc/inspect.playbook/inspect.playbook.d.ts +17 -0
- package/reference/sdlc/inspect.playbook/inspect.playbook.js +142 -0
- package/reference/sdlc/inspect.playbook/inspect.playbook.ts +184 -0
- package/reference/sdlc/inspect.playbook/inspect.registry.d.ts +41 -0
- package/reference/sdlc/inspect.playbook/inspect.registry.js +51 -0
- package/reference/sdlc/inspect.playbook/inspect.registry.ts +110 -0
- package/slc/gears2fsm.md +17 -3
- package/slc/text2gears.md +7 -0
- package/slc/workflow-contracts.json +43 -1
- package/src/xstate-playbook-runtime.js +5 -0
- package/src/xstate-playbook-runtime.ts +7 -0
|
@@ -11,7 +11,7 @@ Roles:
|
|
|
11
11
|
|
|
12
12
|
### CODE-1
|
|
13
13
|
|
|
14
|
-
Each phase ends with exactly one new Coder commit owned by `code`, and no existing commit is rewritten.
|
|
14
|
+
Each completed phase ends with exactly one new Coder commit owned by `code`, and no existing commit is rewritten.
|
|
15
15
|
Captain uses the repository-effect receipt as the authoritative identity of the phase's new commit.
|
|
16
16
|
When the request may continue an existing IR that it does not identify unambiguously, Coder asks Boss before changing files, and Boss's answer resumes this same phase.
|
|
17
17
|
|
|
@@ -28,13 +28,19 @@ When the first coding phase begins for the caller's coding request and any relev
|
|
|
28
28
|
> For an existing IR, read the identified IR and implement exactly its next unfinished task, including corresponding tests or specs if any.
|
|
29
29
|
> Do not implement a later task in this phase.
|
|
30
30
|
> Mark the IR's progress and deliverables when relevant.
|
|
31
|
+
> After implementing an IR task, identify it and state whether any IR task still has unfinished Coder work; if so identify the next unfinished task, otherwise state this was the final IR task's Coder work.
|
|
32
|
+
> Report pending independent REVIEW, owner acceptance and later delivery/workshop steps separately; they imply an unfinished IR task only when the IR assigns that work to a remaining task.
|
|
33
|
+
> Report only what the IR and completed work establish, in ordinary prose without a required marker.
|
|
31
34
|
> If the IR will be finished after this phase, double-check that all acceptance criteria are met.
|
|
32
35
|
>
|
|
33
36
|
> Consult @specs/map.md for relevant context and @specs/meta.md for spec requirements, if needed.
|
|
34
37
|
>
|
|
35
38
|
> Keep to the original intent and follow what it asks.
|
|
36
39
|
> Do not re-run tests or builds whose inputs have not changed since any previous reported run.
|
|
37
|
-
>
|
|
40
|
+
> If a required Boss answer prevents completion of the current phase or IR task, ask that question and return without committing.
|
|
41
|
+
> Preserve permitted uncommitted work for the deferred continuation; do not create a partial or blocker-only commit to meet the one-commit requirement.
|
|
42
|
+
> After the answer allows completion, make exactly one phase-owned commit before REVIEW.
|
|
43
|
+
> When the phase is complete, make its minimal changes and then one new commit, following @specs/packages/git.md; never amend an existing commit.
|
|
38
44
|
> Make the commit message explain concisely what changed and why, including relevant verification.
|
|
39
45
|
> Identify every new commit you make.
|
|
40
46
|
> Credit every AI that contributed to this commit: Coder <coder-llm>.
|
|
@@ -47,6 +53,7 @@ Results:
|
|
|
47
53
|
- `irCommit`: Coder decomposed the new coding intent into a new IR, implemented no IR task, and made its one new commit; Coder's result affirmatively supports this outcome, and no fixed presentation format of the reply is required. Output shall include `coderOutput: <verbatim final text>`, `latestCommit: <commit identity>`, and `irNumber` identifying the created IR.
|
|
48
54
|
- `moreTasks`: Coder continued an existing IR, implemented exactly its next unfinished task, made its one new commit, and at least one IR task remains unfinished; Coder's result affirmatively supports this outcome, and no fixed presentation format of the reply is required. Output shall include `coderOutput: <verbatim final text>`, `latestCommit: <commit identity>`, `irNumber` identifying the continued IR, and `irTask` naming the implemented task.
|
|
49
55
|
- `finalTask`: Coder continued an existing IR, implemented its final unfinished task, and made its one new commit; Coder's result affirmatively supports this outcome, and no fixed presentation format of the reply is required. Output shall include `coderOutput: <verbatim final text>`, `latestCommit: <commit identity>`, `irNumber` identifying the continued IR, and `irTask` naming the implemented task.
|
|
56
|
+
- `needsBossReply`: At the end of this call, Coder has an unanswered clarifying question for Boss whose answer is required to complete the current coding phase. Earlier interim questions resolved or superseded by later affirmative current-phase completion, and prerequisites only for later review, acceptance or release stages, do not establish this outcome. Output shall include `question: <verbatim question text from the acting agent's prose>`.
|
|
50
57
|
|
|
51
58
|
### CODE-2
|
|
52
59
|
|
|
@@ -59,6 +66,10 @@ When a direct implementation or new-IR phase ends with its one new `code`-owned
|
|
|
59
66
|
> > Coder output: <coder-output>
|
|
60
67
|
|
|
61
68
|
A nested `review` passes the phase only when its result applies to that supplied review scope, returns the exact evaluated repository revision, and affirmatively establishes that no unsettled findings remain.
|
|
69
|
+
On each successful nested REVIEW, Captain shall freeze the previous phase review as one record from the canonical child result and the phase's accepted receipt-owned scope: exact phase kind (direct, new intent or IR task), phase outcome, CODE scope commit, REVIEW evaluated revision, and IR/task identity when present.
|
|
70
|
+
CODE scope commit and evaluated revision remain distinct because REVIEW may create fix commits.
|
|
71
|
+
No caller option, player prose or repository status text supplies this record.
|
|
72
|
+
The record survives permitted restoration and the current task's Boss-answer continuation, and a fresh run or explicit Boss interruption clears it.
|
|
62
73
|
When `review` passes a direct implementation phase, `code` is complete and returns to its caller the exact last `code`-owned commit, the exact final evaluated repository revision, and the fact that every phase's review passed with no unsettled findings.
|
|
63
74
|
When `review` passes a new-IR phase, Captain continues with the next unfinished IR-task phase.
|
|
64
75
|
When `review` returns an authored abort or failure, or a terminal result that does not establish that the supplied scope was evaluated with no unsettled findings, `code` starts no further phase and reports the failure and the last `code`-owned commit to its caller.
|
|
@@ -66,7 +77,9 @@ When the nested `review` call fails outside that authored result contract, `code
|
|
|
66
77
|
|
|
67
78
|
### CODE-3
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
When absent, the previous phase review reads "No accepted prior-phase review is available.".
|
|
81
|
+
|
|
82
|
+
Each completed phase ends with exactly one new Coder commit owned by `code`, and no existing commit is rewritten.
|
|
70
83
|
Captain uses the repository-effect receipt as the authoritative identity of the phase's new commit.
|
|
71
84
|
|
|
72
85
|
When a later IR-task phase begins, Captain shall prompt Coder:
|
|
@@ -74,11 +87,20 @@ When a later IR-task phase begins, Captain shall prompt Coder:
|
|
|
74
87
|
> Read the identified IR and implement exactly its next unfinished task, including corresponding tests or specs if any.
|
|
75
88
|
> Do not implement a later task in this phase.
|
|
76
89
|
> Mark the IR's progress and deliverables when relevant.
|
|
90
|
+
> After implementing an IR task, identify it and state whether any IR task still has unfinished Coder work; if so identify the next unfinished task, otherwise state this was the final IR task's Coder work.
|
|
91
|
+
> Report pending independent REVIEW, owner acceptance and later delivery/workshop steps separately; they imply an unfinished IR task only when the IR assigns that work to a remaining task.
|
|
92
|
+
> Report only what the IR and completed work establish, in ordinary prose without a required marker.
|
|
77
93
|
> If the IR will be finished after this phase, double-check that all acceptance criteria are met.
|
|
94
|
+
> Use the quoted previous-phase review only for its exact recorded scope; committed pending-review text may predate that canonical result.
|
|
95
|
+
> Before treating it as current review evidence, verify clean current HEAD equals its evaluatedRevision; a mismatch is not approval.
|
|
96
|
+
> It does not replace independent review of this task or any new owner or release decision.
|
|
78
97
|
>
|
|
79
98
|
> Keep to the original intent and follow what it asks.
|
|
80
99
|
> Do not re-run tests or builds whose inputs have not changed since any previous reported run.
|
|
81
|
-
>
|
|
100
|
+
> If a required Boss answer prevents completion of the current phase or IR task, ask that question and return without committing.
|
|
101
|
+
> Preserve permitted uncommitted work for the deferred continuation; do not create a partial or blocker-only commit to meet the one-commit requirement.
|
|
102
|
+
> After the answer allows completion, make exactly one phase-owned commit before REVIEW.
|
|
103
|
+
> When the phase is complete, make its minimal changes and then one new commit, following @specs/packages/git.md; never amend an existing commit.
|
|
82
104
|
> Make the commit message explain concisely what changed and why, including relevant verification.
|
|
83
105
|
> Identify every new commit you make.
|
|
84
106
|
> Credit every AI that contributed to this commit: Coder <coder-llm>.
|
|
@@ -86,10 +108,12 @@ When a later IR-task phase begins, Captain shall prompt Coder:
|
|
|
86
108
|
> > Original request: <caller-input>
|
|
87
109
|
> > IR number: <ir-number>
|
|
88
110
|
> > Run results: <run-results>
|
|
111
|
+
> > Previous phase review: <previous-phase-review>
|
|
89
112
|
|
|
90
113
|
Results:
|
|
91
114
|
- `moreTasks`: Coder implemented exactly the IR's next unfinished task, made its one new commit, and at least one IR task remains unfinished; Coder's result affirmatively supports this outcome, and no fixed presentation format of the reply is required. Output shall include `coderOutput: <verbatim final text>`, `latestCommit: <commit identity>`, `irNumber` identifying the IR, and `irTask` naming the implemented task.
|
|
92
115
|
- `finalTask`: Coder implemented the IR's final unfinished task and made its one new commit; Coder's result affirmatively supports this outcome, and no fixed presentation format of the reply is required. Output shall include `coderOutput: <verbatim final text>`, `latestCommit: <commit identity>`, `irNumber` identifying the IR, and `irTask` naming the implemented task.
|
|
116
|
+
- `needsBossReply`: At the end of this call, Coder has an unanswered clarifying question for Boss whose answer is required to complete the current coding phase. Earlier interim questions resolved or superseded by later affirmative current-phase completion, and prerequisites only for later review, acceptance or release stages, do not establish this outcome. Output shall include `question: <verbatim question text from the acting agent's prose>`.
|
|
93
117
|
|
|
94
118
|
### CODE-4
|
|
95
119
|
|
|
@@ -104,6 +128,10 @@ When an IR-task phase, including the first phase for an existing IR, ends with i
|
|
|
104
128
|
> > Current IR task: <ir-task>
|
|
105
129
|
|
|
106
130
|
A nested `review` passes the phase only when its result applies to that supplied review scope, returns the exact evaluated repository revision, and affirmatively establishes that no unsettled findings remain.
|
|
131
|
+
On each successful nested REVIEW, Captain shall freeze the previous phase review as one record from the canonical child result and the phase's accepted receipt-owned scope: exact phase kind (direct, new intent or IR task), phase outcome, CODE scope commit, REVIEW evaluated revision, and IR/task identity when present.
|
|
132
|
+
CODE scope commit and evaluated revision remain distinct because REVIEW may create fix commits.
|
|
133
|
+
No caller option, player prose or repository status text supplies this record.
|
|
134
|
+
The record survives permitted restoration and the current task's Boss-answer continuation, and a fresh run or explicit Boss interruption clears it.
|
|
107
135
|
When `review` passes a nonfinal IR-task phase, Captain continues with the next unfinished IR-task phase.
|
|
108
136
|
When `review` passes the final IR-task phase, `code` is complete and returns to its caller the exact last `code`-owned commit, the exact final evaluated repository revision, and the fact that every phase's review passed with no unsettled findings.
|
|
109
137
|
When `review` returns an authored abort or failure, or a terminal result that does not establish that the supplied scope was evaluated with no unsettled findings, `code` starts no further phase and reports the failure and the last `code`-owned commit to its caller.
|
|
@@ -3,7 +3,11 @@ import type { Effort, PermissionPolicy } from '@sublang/cligent';
|
|
|
3
3
|
import type { JsonValue, PlaybookEffectLedger, PlaybookEffectLedgerCommandBatch, PlaybookControlAction, PlaybookFailureCause, PlaybookRuntime, PlaybookRuntimeSnapshot, PlaybookStepRecord } from '@sublang/playbook/runtime';
|
|
4
4
|
import { type CaptainControllerPort } from '../captain.playbook/captain.playbook.js';
|
|
5
5
|
import type { PlaybookSummaryPolicy } from './code.registry.js';
|
|
6
|
+
import type { Attachment } from '@sublang/cligent';
|
|
7
|
+
import type { SessionAssetRef } from './session-assets.js';
|
|
6
8
|
interface SessionAgent {
|
|
9
|
+
/** Mutable next-turn execution capability; never structural identity. */
|
|
10
|
+
readonly browser?: boolean;
|
|
7
11
|
readonly adapter: string;
|
|
8
12
|
readonly model: TuningSelection;
|
|
9
13
|
readonly effort: TuningSelection<Effort>;
|
|
@@ -40,7 +44,7 @@ interface PlaybookCaptainUnresolvedEffectSettlementInput {
|
|
|
40
44
|
readonly rootPlaybookId: string;
|
|
41
45
|
readonly unresolvedEffects: readonly PlaybookCaptainUnresolvedEffect[];
|
|
42
46
|
}
|
|
43
|
-
type SnapshotAgentEnvelope = DeepReadonly<Omit<SessionAgent, TuningKey>>;
|
|
47
|
+
type SnapshotAgentEnvelope = DeepReadonly<Omit<SessionAgent, TuningKey | 'browser'>>;
|
|
44
48
|
type PlayerLedgerSnapshotEntry = DeepReadonly<PlayerLedgerEntry>;
|
|
45
49
|
export interface ProgressChange {
|
|
46
50
|
snapshot?: PlaybookCaptainShellSnapshot | null;
|
|
@@ -48,6 +52,10 @@ export interface ProgressChange {
|
|
|
48
52
|
kind: PlaybookStepRecord['kind'] | 'preparation' | 'completion' | 'answer';
|
|
49
53
|
runtimeSessionId: string;
|
|
50
54
|
playbookId: string;
|
|
55
|
+
workerEvidence?: {
|
|
56
|
+
boundaryId: string;
|
|
57
|
+
playerId: string;
|
|
58
|
+
};
|
|
51
59
|
};
|
|
52
60
|
}
|
|
53
61
|
export interface InterruptedReport {
|
|
@@ -57,6 +65,9 @@ export interface InterruptedReport {
|
|
|
57
65
|
unresolvedEffects?: readonly PlaybookCaptainUnresolvedEffect[];
|
|
58
66
|
}
|
|
59
67
|
export interface PlaybookCaptainDeps {
|
|
68
|
+
onTurnAttachments?: (references: readonly SessionAssetRef[]) => void;
|
|
69
|
+
beginPreparationMedia?: (runtimeSessionId: string) => () => void;
|
|
70
|
+
resolveAttachments?: (references: readonly SessionAssetRef[], signal: AbortSignal) => Promise<readonly Attachment[]>;
|
|
60
71
|
/** Stop the host's active turn, including admitted tool calls, on preparation expiry or a required save failure. */
|
|
61
72
|
abortPreparation?: (reason?: string) => void;
|
|
62
73
|
recordProgress?: (change: ProgressChange) => Promise<void>;
|
|
@@ -164,6 +175,7 @@ export interface PlaybookCaptainFrameSnapshot {
|
|
|
164
175
|
readonly parentCallId?: string;
|
|
165
176
|
readonly request?: string;
|
|
166
177
|
readonly inputs?: readonly string[];
|
|
178
|
+
readonly attachments?: readonly SessionAssetRef[];
|
|
167
179
|
readonly options: JsonValue;
|
|
168
180
|
readonly roleBindings: Readonly<Record<string, string>>;
|
|
169
181
|
readonly runtime: DeepReadonly<PlaybookRuntimeSnapshot>;
|
|
@@ -186,6 +198,7 @@ interface PlaybookCaptainShellSnapshotFields {
|
|
|
186
198
|
readonly journal: number;
|
|
187
199
|
};
|
|
188
200
|
readonly journal: readonly PlaybookCaptainJournalRecord[];
|
|
201
|
+
readonly pendingAttachments?: readonly SessionAssetRef[];
|
|
189
202
|
readonly lastAction?: 'respond' | 'start' | 'switch' | 'resume' | 'dismiss' | 'deliver' | 'runtime' | 'recover';
|
|
190
203
|
readonly lastSettlementStatus?: 'ok' | 'rejected' | 'failed';
|
|
191
204
|
}
|
|
@@ -241,6 +254,9 @@ export interface PlaybookCaptainSettlement {
|
|
|
241
254
|
}
|
|
242
255
|
/** tmux and headless front ends share this one durable Captain shell API. */
|
|
243
256
|
export interface PlaybookCaptainShell extends Captain {
|
|
257
|
+
/** Bind already-owned evidence to the next visible Boss turn without changing its text. */
|
|
258
|
+
setTurnAttachments(references: readonly SessionAssetRef[]): void;
|
|
259
|
+
recordMediaEvidence(reference: SessionAssetRef, runtimeSessionId?: string): void;
|
|
244
260
|
installRetainedGenerations(generations: Readonly<Record<string, PlaybookCaptainRetainedGeneration>>): Promise<void>;
|
|
245
261
|
exportSnapshot(): PlaybookCaptainShellSnapshot | undefined;
|
|
246
262
|
exportSettlement(): PlaybookCaptainSettlement | undefined;
|