@sublang/playbook 12.0.0 → 12.1.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/docs/embedding.md +83 -1
- package/package.json +7 -1
- package/reference/sdlc/code.playbook/bin/repository-effects.js +501 -170
- package/reference/sdlc/code.playbook/bin/session-store.js +4 -1
- package/reference/sdlc/code.playbook/host-capabilities.d.ts +291 -0
- package/reference/sdlc/code.playbook/host-capabilities.js +40 -0
- package/slc/gears2fsm.md +20 -0
- package/slc/link.md +16 -0
- package/slc/text2gears.md +18 -1
package/docs/embedding.md
CHANGED
|
@@ -153,7 +153,9 @@ const playbookSessionId = randomUUID();
|
|
|
153
153
|
// session lease and resolving the canonical Git worktree. Their authority
|
|
154
154
|
// must name this playbook/session/working directory and their repository and
|
|
155
155
|
// effect-ledger operations must stay live; never put them in configuration,
|
|
156
|
-
// machine input, or a persisted snapshot.
|
|
156
|
+
// machine input, or a persisted snapshot. A host outside the CLI constructs
|
|
157
|
+
// the repository and effect-ledger members through the facade described in
|
|
158
|
+
// "Constructing worktree host capabilities" below.
|
|
157
159
|
declare const hostCapabilities: ReviewPlaybookHostCapabilities;
|
|
158
160
|
|
|
159
161
|
const runtime = createPlaybookRuntime({
|
|
@@ -220,6 +222,86 @@ capability functions never enter Boss-visible status text or configured
|
|
|
220
222
|
options. Because trace observers do receive opaque resume tokens, persisted
|
|
221
223
|
traces should be protected as sensitive data.
|
|
222
224
|
|
|
225
|
+
## Constructing worktree host capabilities
|
|
226
|
+
|
|
227
|
+
A schema-3 artifact takes live `{ repository, effectLedger }` capabilities
|
|
228
|
+
beside its configured options. Rather than reimplementing the engine's
|
|
229
|
+
observation, claim, receipt, and ledger contract, construct them through the
|
|
230
|
+
narrow, semver-stable `@sublang/playbook/host-capabilities` facade. It is the
|
|
231
|
+
CLI host's own implementation, re-exported: every classification the engine
|
|
232
|
+
makes for `playbook run` is the one your host makes too.
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import {
|
|
236
|
+
createFailClosedHostCapabilities,
|
|
237
|
+
createWorktreeHostCapabilities,
|
|
238
|
+
} from '@sublang/playbook/host-capabilities';
|
|
239
|
+
|
|
240
|
+
declare const workdir: string;
|
|
241
|
+
declare const createPlaybookRuntime: (construction: {
|
|
242
|
+
configuredOptions: object;
|
|
243
|
+
hostCapabilities: object;
|
|
244
|
+
}) => unknown;
|
|
245
|
+
|
|
246
|
+
// One capability per playbook and Git worktree, constructed after the
|
|
247
|
+
// working directory is resolved and before the runtime is. The roles are the
|
|
248
|
+
// artifact's declared roles; an undeclared role is refused at boundary start.
|
|
249
|
+
const hostCapabilities = await createWorktreeHostCapabilities({
|
|
250
|
+
cwd: workdir,
|
|
251
|
+
playbookId: 'workflow',
|
|
252
|
+
requiredRoleIds: ['coder', 'reviewer'],
|
|
253
|
+
});
|
|
254
|
+
const runtime = createPlaybookRuntime({
|
|
255
|
+
configuredOptions: {},
|
|
256
|
+
hostCapabilities,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// An artifact declaring no governed player state needs no worktree at all:
|
|
260
|
+
// every repository operation and ledger write rejects, and the ledger stays
|
|
261
|
+
// empty.
|
|
262
|
+
const inert = createPlaybookRuntime({
|
|
263
|
+
configuredOptions: {},
|
|
264
|
+
hostCapabilities: createFailClosedHostCapabilities(),
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
`createWorktreeHostCapabilities()` requires only that `cwd` exist and returns
|
|
269
|
+
exactly `repository: { identity, observe, runExclusive, runDeferred }` and
|
|
270
|
+
`effectLedger: { snapshot, writeAhead }`. The governed worktree is bound at
|
|
271
|
+
every governed call and observation rather than fixed at construction: it is
|
|
272
|
+
the canonical root of the nearest Git worktree containing `cwd`, or — when
|
|
273
|
+
there is none — `cwd` itself as the prospective root `{ worktree, gitDir:
|
|
274
|
+
worktree/.git }` that a later `git init` there binds unchanged. A directory
|
|
275
|
+
that is not a repository yet observes as the null (all-zero) HEAD over its
|
|
276
|
+
non-ignored content, exactly as `git init` would then see it, and an unborn
|
|
277
|
+
HEAD observes as the null OID too; so a workflow whose first step runs
|
|
278
|
+
`test -e .git || git init` in its working directory receives `unchanged`, and
|
|
279
|
+
its first root commit receives `one-descendant-commit` with that commit's OID.
|
|
280
|
+
`identity` is the binding at construction; each boundary records the binding
|
|
281
|
+
its baseline observed. The ledger is in memory and starts from the optional
|
|
282
|
+
`effectLedger` seed, so a host that wants durability keeps
|
|
283
|
+
`effectLedger.snapshot()` at its own boundaries and seeds the next
|
|
284
|
+
construction from it; each construction is one attempt over its seed.
|
|
285
|
+
`runExclusive` and `runDeferred` hold the same cross-process worktree claim the
|
|
286
|
+
CLI uses (process-local until the repository exists, since there is no `.git`
|
|
287
|
+
to publish it in), observe before and after the operation, apply the engine's
|
|
288
|
+
correction-budget `writeAhead` mid-completion, and bind, park, continue, and
|
|
289
|
+
restore deferred Boss questions with the engine's exact checkpoint semantics.
|
|
290
|
+
Overlapping calls on one worktree run one at a time, in no guaranteed order.
|
|
291
|
+
A write the ledger rejects after a boundary has started leaves the worktree
|
|
292
|
+
claim quarantined, exactly as it would under `playbook run`: treat that
|
|
293
|
+
rejection as terminal for the worktree in this process.
|
|
294
|
+
|
|
295
|
+
The module functions `observeGitRepository(cwd)`,
|
|
296
|
+
`captureRepositoryReceipt(baseline, { allowedDispositions })`, and
|
|
297
|
+
`classifyRepositoryReceipt(baseline, after, { allowedDispositions })` expose
|
|
298
|
+
the same observation and receipt classification for a host that inspects a
|
|
299
|
+
worktree outside a governed call. The declaration is self-contained — it
|
|
300
|
+
re-declares the ledger, receipt, observation, and question types of
|
|
301
|
+
`@sublang/playbook/runtime` name for name — and the facade carries no session
|
|
302
|
+
lease, session record, resume credential, catalog, or recovery member
|
|
303
|
+
([[playbook-cli-87](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-87)]).
|
|
304
|
+
|
|
223
305
|
## Sharing the CLI session store
|
|
224
306
|
|
|
225
307
|
An external host that needs the CLI's canonical session validation and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sublang/playbook",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Composable XState v5 playbook runtime with compiled Captain, CODE, REVIEW, DECIDE, and DEV workflows driven by GEARS specs.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
"reference/sdlc/code.playbook/playbook-captain.d.ts",
|
|
71
71
|
"reference/sdlc/code.playbook/session-store.js",
|
|
72
72
|
"reference/sdlc/code.playbook/session-store.d.ts",
|
|
73
|
+
"reference/sdlc/code.playbook/host-capabilities.js",
|
|
74
|
+
"reference/sdlc/code.playbook/host-capabilities.d.ts",
|
|
73
75
|
"reference/sdlc/code.playbook/code.gears.md",
|
|
74
76
|
"reference/sdlc/code.playbook/playbook.config.template.yaml",
|
|
75
77
|
"reference/sdlc/code.playbook/bin/playbook.js",
|
|
@@ -145,6 +147,10 @@
|
|
|
145
147
|
"types": "./reference/sdlc/code.playbook/session-store.d.ts",
|
|
146
148
|
"default": "./reference/sdlc/code.playbook/session-store.js"
|
|
147
149
|
},
|
|
150
|
+
"./host-capabilities": {
|
|
151
|
+
"types": "./reference/sdlc/code.playbook/host-capabilities.d.ts",
|
|
152
|
+
"default": "./reference/sdlc/code.playbook/host-capabilities.js"
|
|
153
|
+
},
|
|
148
154
|
"./slc/*": "./slc/*",
|
|
149
155
|
"./review/playbook": {
|
|
150
156
|
"types": "./reference/sdlc/review.playbook/review.playbook.d.ts",
|