@sublang/playbook 17.4.0 → 17.5.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/cli.md CHANGED
@@ -181,6 +181,7 @@ stderr, and `--verbose` adds only telemetry topic names to stderr.
181
181
  | Flag | Meaning |
182
182
  | --- | --- |
183
183
  | `--with <path>` | overlay current config for a fresh session or compatible ordinary reopen; repeatable |
184
+ | `--module <id>=<specifier>` | supply playbook `<id>`'s registry module ahead of its `playbooks.<id>.from`; repeatable, one per id; a relative path resolves against the current directory |
184
185
  | `--no-provision` | do not create missing engine links for configured filesystem registries |
185
186
  | `--json` | print exactly one `sessionId` / `reply` object |
186
187
  | `--verbose` | add Captain telemetry topic names to stderr |
@@ -243,6 +244,26 @@ A directory where both imports already resolve is untouched, and
243
244
  module's directory is a git repository, add `node_modules/` to its
244
245
  `.gitignore` so provisioned links never enter player commits.
245
246
 
247
+ A launch can also supply a playbook's module, which is never written back to
248
+ your config files, for example when an embedding host keeps each playbook
249
+ installed in an environment of its own. `--module <id>=<specifier>` (or
250
+ `--module=<id>=<specifier>`) is accepted by `playbook`, `playbook --session`,
251
+ `--list`, `--theme-diagnostics`, and fresh or continuing `playbook run`, and
252
+ wins over that playbook's `from` the way a `--with` fragment wins over the
253
+ file. An absolute path becomes a file URL, a relative path resolves against
254
+ the directory where you run the command, and a file URL or package specifier
255
+ is kept. The flag is never forwarded to tmux-play or sent as Boss input; it is
256
+ refused beside a raw `--config`, during uncertain-turn recovery, for an id
257
+ given twice, and for an id the config does not enable
258
+ ([[playbook-cli-94](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-94)],
259
+ [[playbook-cli-96](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-96)],
260
+ [DR-083](https://github.com/sublang-ai/playbook/blob/main/specs/decisions/083-module-locations-supplied-at-launch.md)).
261
+
262
+ ```sh
263
+ playbook --module code=/opt/env/code/registry.mjs
264
+ playbook run --module review=@sublang/playbook/review/registry "/review the last commit"
265
+ ```
266
+
246
267
  ### Continuing a Captain session
247
268
 
248
269
  Interactive and headless commands write the same logical-session records in
@@ -279,9 +300,15 @@ competing front end fails closed instead of forking the history.
279
300
 
280
301
  An ordinary reopen reads current config and any opening `--with` fragments,
281
302
  projects them to the stored catalog and player roster, and requires the stored
282
- role bindings plus every structural setting to remain exact. Compatible
283
- current `model`, `effort`, and optional `fastMode`, `subagentModel`, and
284
- `subagentEffort` settings apply to the next call. Boolean `false` explicitly
303
+ role bindings plus every structural setting to remain exact. A playbook whose
304
+ current config names no `from` and receives no `--module` keeps the module the
305
+ session records. Otherwise the module so taken — the supplied one, else a
306
+ present `from` — must equal the stored module; a present `from` beside a
307
+ supplied module is checked for form only. A `--module` for a playbook your
308
+ config enables but the session does not hold is ignored, while one naming no
309
+ playbook of your config is refused. Compatible current `model`, `effort`, and
310
+ optional `fastMode`, `subagentModel`, and `subagentEffort` settings apply to
311
+ the next call. Boolean `false` explicitly
285
312
  resets model, effort, subagent model, or subagent effort to the provider
286
313
  default, but `fastMode: false` is a literal
287
314
  disabled request; omission selects the provider default or inherits the player
@@ -57,8 +57,11 @@ preflight their auth.
57
57
 
58
58
  Within a `playbooks.<id>` block, `from` (the registry module), `command` (an
59
59
  optional slash-command override), and `roles` are launcher-owned; every other
60
- key is that playbook's option slice. Every manifest role must be present
61
- exactly once. The launcher injects the rest — you do not write host wiring by
60
+ key is that playbook's option slice. `from` is required unless the launch
61
+ supplies that playbook's module with `--module <id>=<specifier>` (or an
62
+ embedding host's `modules` option), or a reopened session already records
63
+ one; see [Modules supplied at launch](#modules-supplied-at-launch). Every
64
+ manifest role must be present exactly once. The launcher injects the rest — you do not write host wiring by
62
65
  hand.
63
66
 
64
67
  The launcher seeds one adapter for the Captain and all stable players from
@@ -422,6 +425,33 @@ Before either front end imports a filesystem registry, the shared launcher
422
425
  checks and, unless `--no-provision` is set, provisions its runtime engine
423
426
  links as described in [Using the CLI](cli.md#external-playbooks-and-engine-provisioning).
424
427
 
428
+ ### Modules supplied at launch
429
+
430
+ A config may leave `playbooks.<id>.from` out when the launch supplies the
431
+ module instead, so the shared file names no machine-specific path:
432
+
433
+ ```yaml
434
+ playbooks:
435
+ my-workflow:
436
+ roles:
437
+ worker: my.worker
438
+ ```
439
+
440
+ ```sh
441
+ playbook run --module my-workflow=/opt/env/my-workflow.js "/my-workflow perform the task"
442
+ ```
443
+
444
+ A supplied module wins over a `from` the file does carry, and it is never
445
+ written back to your config files. A playbook with neither is refused before any import:
446
+ `playbooks.<id> names no module: set playbooks.<id>.from or supply a module for
447
+ <id> (--module <id>=<specifier>)`. A malformed `from` is still refused even
448
+ when a module is supplied. Reopening a recorded session needs neither: with
449
+ no `from` and no `--module`, it uses the module the session already records.
450
+ Otherwise the module so taken — the supplied one, else a present `from` — must
451
+ equal the stored module; a present `from` beside a supplied module is checked
452
+ for form only
453
+ ([DR-083](https://github.com/sublang-ai/playbook/blob/main/specs/decisions/083-module-locations-supplied-at-launch.md)).
454
+
425
455
  ## Migrating per-playbook players
426
456
 
427
457
  The former `playbooks.<id>.players` shape made agent configuration and local
package/docs/embedding.md CHANGED
@@ -402,6 +402,35 @@ The controller owns uncertainty, reconciliation, settlement and lease release;
402
402
  observers receive presentation events or exact appended envelopes through
403
403
  `onStoredRecord`. Keep the controller open for successive turns.
404
404
 
405
+ `loadLaunchPlan()` and `normalizeLaunchPlan()` accept an optional `modules`
406
+ option, a read-only record from playbook id to module specifier. A host that
407
+ keeps each playbook installed somewhere of its own hands the module locations
408
+ there instead of writing them into the shared config, whose
409
+ `playbooks.<id>.from` may then be left out:
410
+
411
+ ```ts
412
+ import { loadLaunchPlan } from '@sublang/playbook/session-host';
413
+
414
+ const plan = await loadLaunchPlan({
415
+ userConfigPath,
416
+ modules: { code: '/opt/env/code/registry.mjs', review: '@sublang/playbook/review/registry' },
417
+ });
418
+ ```
419
+
420
+ Each enabled playbook takes `modules[id]` ahead of its `from`. An absolute
421
+ path becomes a file URL, while a file URL or package specifier is kept; a
422
+ relative path is refused, so resolve it against your own working directory
423
+ first. On a new launch, a module naming no enabled playbook is refused before
424
+ any import; with `selectedMembers`, one for a current playbook outside the
425
+ selection is skipped, while one naming no current playbook is still refused.
426
+ These loaders hold no stored session record, so they refuse a playbook with
427
+ neither a supplied module nor `from`, with or without `selectedMembers`; only
428
+ the CLI's reopen of a recorded session falls back to the module that record
429
+ holds. The preparation hook, single import, registry checks and the plan's
430
+ canonical `from` are unchanged, and a supplied module is never written back to
431
+ your config files
432
+ ([DR-083](https://github.com/sublang-ai/playbook/blob/main/specs/decisions/083-module-locations-supplied-at-launch.md)).
433
+
405
434
  `shared.readLeaseState(sessionId)` reports `active`, `idle` or `unknown` without
406
435
  changing files. Use it for presentation; mutations still require a lease.
407
436
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublang/playbook",
3
- "version": "17.4.0",
3
+ "version": "17.5.0",
4
4
  "type": "module",
5
5
  "description": "Composable XState v5 playbook runtime with compiled Captain, CODE, REVIEW, DECIDE, DEV, BRANCH, PR, and INSPECT workflows driven by GEARS specs.",
6
6
  "license": "Apache-2.0",
@@ -272,7 +272,7 @@
272
272
  "provenance": true
273
273
  },
274
274
  "dependencies": {
275
- "@sublang/cligent": "^0.33.1",
275
+ "@sublang/cligent": "^0.33.2",
276
276
  "@sublang/spex": "^3.0.0",
277
277
  "p-queue": "^9.3.1",
278
278
  "xstate": "^5.19.4",
@@ -12,7 +12,7 @@ The caller supplies a coding request together with any relevant context.
12
12
 
13
13
  A new coding intent follows either one direct implementation phase or an IR sequence consisting of a new-IR phase followed by one phase for each IR task.
14
14
  An existing IR follows one IR-task phase for each remaining unfinished task, starting with its next unfinished task.
15
- Each phase ends with one new Coder commit (owned by `code`).
15
+ Each completed phase ends with one new Coder commit (owned by `code`).
16
16
  After each `code`-owned commit, Captain shall call the `review` playbook and wait until it passes with no unsettled findings.
17
17
  Playbook `review` owns every review round and every review-fix commit.
18
18
  Do not rewrite any existing commit.
@@ -40,22 +40,37 @@ Plan affected spec updates before, with, or after their corresponding code chang
40
40
  For an existing IR, read the identified IR and implement exactly its next unfinished task, including corresponding tests or specs if any.
41
41
  Do not implement a later task in this phase.
42
42
  Mark the IR's progress and deliverables when relevant.
43
+ 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.
44
+ 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.
45
+ Report only what the IR and completed work establish, in ordinary prose without a required marker.
43
46
  If the IR will be finished after this phase, double-check that all acceptance criteria are met.
44
47
 
45
48
  Consult @specs/map.md for relevant context and @specs/meta.md for spec requirements, if needed.
46
49
  ```
47
50
 
48
- At the start of every later IR-task phase, Captain shall relay to Coder the original caller input, the IR identity, and any relevant run results in quotes (`>`), along with the following instruction:
51
+ 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.
52
+ CODE scope commit and evaluated revision remain distinct because REVIEW may create fix commits.
53
+ No caller option, player prose or repository status text supplies this record.
54
+ The record survives permitted restoration and the current task's Boss-answer continuation, and a fresh run or explicit Boss interruption clears it.
55
+
56
+ At the start of every later IR-task phase, Captain shall relay to Coder the original caller input, the IR identity, any relevant run results, and that previous phase review as quoted evidence in quotes (`>`), along with the following instruction; when absent, the record reads "No accepted prior-phase review is available.":
49
57
 
50
58
  > Original request: <caller-input>
51
59
  > IR number: <ir-number>
52
60
  > Run results: <run-results>
61
+ > Previous phase review: <previous-phase-review>
53
62
 
54
63
  ```markdown
55
64
  Read the identified IR and implement exactly its next unfinished task, including corresponding tests or specs if any.
56
65
  Do not implement a later task in this phase.
57
66
  Mark the IR's progress and deliverables when relevant.
67
+ 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.
68
+ 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.
69
+ Report only what the IR and completed work establish, in ordinary prose without a required marker.
58
70
  If the IR will be finished after this phase, double-check that all acceptance criteria are met.
71
+ Use the quoted previous-phase review only for its exact recorded scope; committed pending-review text may predate that canonical result.
72
+ Before treating it as current review evidence, verify clean current HEAD equals its evaluatedRevision; a mismatch is not approval.
73
+ It does not replace independent review of this task or any new owner or release decision.
59
74
  ```
60
75
 
61
76
  At the start of *every* phase, Captain shall append the following instruction:
@@ -63,7 +78,10 @@ At the start of *every* phase, Captain shall append the following instruction:
63
78
  ```markdown
64
79
  Keep to the original intent and follow what it asks.
65
80
  Do not re-run tests or builds whose inputs have not changed since any previous reported run.
66
- Make the phase's minimal changes and then one new commit, following @specs/packages/git.md; never amend an existing commit.
81
+ If a required Boss answer prevents completion of the current phase or IR task, ask that question and return without committing.
82
+ Preserve permitted uncommitted work for the deferred continuation; do not create a partial or blocker-only commit to meet the one-commit requirement.
83
+ After the answer allows completion, make exactly one phase-owned commit before REVIEW.
84
+ When the phase is complete, make its minimal changes and then one new commit, following @specs/packages/git.md; never amend an existing commit.
67
85
  Make the commit message explain concisely what changed and why, including relevant verification.
68
86
  Identify every new commit you make.
69
87
  Credit every AI that contributed to this commit: Coder <coder-llm>.
@@ -73,9 +91,11 @@ Every new-intent phase has two semantic outcomes: direct implementation and new
73
91
  Every IR-task phase, including the first phase for an existing IR, identifies the IR and the implemented task, and has two semantic outcomes: more tasks and final task.
74
92
  The first phase therefore has four semantic outcomes — direct implementation, new IR, more tasks, and final task — plus the Boss question when the continued IR is ambiguous.
75
93
  Each semantic outcome requires affirmative support in Coder's result, but no phase transition shall depend on a fixed presentation format of Coder's reply.
94
+ The Boss-question outcome means that, 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.
95
+ A commit statement alone does not establish semantic completion, and contradictory or insufficient evidence supports no forced commit outcome.
76
96
  Captain shall use the repository-effect receipt as the authoritative identity of the phase's new commit.
77
97
 
78
- At the end of every phase, Captain shall call playbook `review` and input the following in quotes (`>`):
98
+ At the end of every completed phase, Captain shall call playbook `review` and input the following in quotes (`>`):
79
99
 
80
100
  > Original intent: \<caller-input\>
81
101
  > Review scope: the commit \<code-commit\> from this coding phase and its resulting repository state.