opencode-plugin-flow 5.2.1 → 5.3.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 (46) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +96 -19
  3. package/dist/cli.js +1928 -58
  4. package/dist/cli.js.map +7 -6
  5. package/dist/index.js +13440 -8946
  6. package/dist/index.js.map +37 -24
  7. package/package.json +14 -5
  8. package/dist/application/errors.d.ts +0 -10
  9. package/dist/application/flow-service.d.ts +0 -311
  10. package/dist/application/ports/evidence-artifact-store.d.ts +0 -28
  11. package/dist/application/ports/session-repository.d.ts +0 -22
  12. package/dist/application/ports/source-identity.d.ts +0 -61
  13. package/dist/application/replay/canonical-json.d.ts +0 -7
  14. package/dist/application/replay/contract.d.ts +0 -2130
  15. package/dist/application/replay/engine.d.ts +0 -101
  16. package/dist/application/replay/index.d.ts +0 -7
  17. package/dist/application/replay/privacy.d.ts +0 -14
  18. package/dist/application/schema.d.ts +0 -1813
  19. package/dist/cli.d.ts +0 -1
  20. package/dist/config-shared.d.ts +0 -287
  21. package/dist/config.d.ts +0 -1
  22. package/dist/distribution/legacy-cleanup.d.ts +0 -25
  23. package/dist/domain/feature-id.d.ts +0 -3
  24. package/dist/domain/limits.d.ts +0 -4
  25. package/dist/domain/orchestration-policy.d.ts +0 -27
  26. package/dist/domain/session-invariants.d.ts +0 -8
  27. package/dist/domain/session.d.ts +0 -356
  28. package/dist/domain/transitions.d.ts +0 -275
  29. package/dist/domain/validation-command.d.ts +0 -8
  30. package/dist/guidance/catalog.d.ts +0 -18
  31. package/dist/guidance/ids.d.ts +0 -4
  32. package/dist/infrastructure/fs/evidence-artifact-store.d.ts +0 -5
  33. package/dist/infrastructure/fs/session-repository.d.ts +0 -2
  34. package/dist/infrastructure/fs/source-identity.d.ts +0 -26
  35. package/dist/infrastructure/fs/strict-json-object.d.ts +0 -9
  36. package/dist/infrastructure/fs/workspace-flow-service.d.ts +0 -10
  37. package/dist/infrastructure/fs/workspace.d.ts +0 -63
  38. package/dist/infrastructure/system/transition-environment.d.ts +0 -2
  39. package/dist/platform/opencode/config.d.ts +0 -2
  40. package/dist/platform/opencode/logging.d.ts +0 -3
  41. package/dist/platform/opencode/tools.d.ts +0 -4
  42. package/dist/prompt-baseline-fixtures.d.ts +0 -20
  43. package/dist/prompt-model-evaluation.d.ts +0 -88
  44. package/dist/prompt-quality.d.ts +0 -80
  45. package/dist/prompt-surfaces.d.ts +0 -28
  46. package/dist/version.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,75 @@
2
2
 
3
3
  One short entry per release, written for users deciding whether to upgrade.
4
4
 
5
+ ## [5.3.0] - 2026-07-20
6
+
7
+ Single-version harness lore makes the installed package, runtime authority,
8
+ validation evidence, correction review, and audit promotion path explicit:
9
+
10
+ - `activation-check` inventories Flow activation across OpenCode config,
11
+ plugin directories, and package cache. `activation-apply` plans by default,
12
+ then uses an exact canonical pin, backups, quarantine, and a recovery journal
13
+ with `--apply`; ambiguous or externally managed sources require manual
14
+ remediation. Post-mutation failure attempts exact safe rollback and records
15
+ whether recovery converged or needs journal-backed manual repair.
16
+ - Process-global runtime leadership permits one operational Flow instance.
17
+ Duplicate versions fail closed; a deterministic highest-version identity is
18
+ diagnostic only and cannot silently take control.
19
+ - Three bounded harness profiles (`control`, `standard`, and `assurance`) and
20
+ three rollout modes (`control`, `observe`, and `enforce`) now drive optional
21
+ worker admission through a trusted runtime-policy footer. Worker model and
22
+ current OpenCode `steps` routing are configurable by role.
23
+ - Validation is runtime-attested: `flow_validation_start` binds the current run
24
+ and source to the exact next Bash command, which emits an immutable receipt
25
+ reference consumed through `flow_review_start.request.validationRefs`.
26
+ Failed, incomplete, stale, altered, or duplicate receipts cannot become
27
+ review evidence.
28
+ - Correction review binds the latest recorded failure to authoritative source
29
+ manifests and a deterministic delta. Narrow correction context is used only
30
+ when complete and safe; broad, security-sensitive, persistence-sensitive,
31
+ missing, unavailable, or oversized context falls back to full review. A
32
+ bounded correction-only public-contract/cross-layer hint can elevate semantic
33
+ scope to full without overriding more specific runtime reasons. The existing
34
+ two-failure run-scoped cap remains authoritative.
35
+ - `AuditLedgerV1` now provides bounded typed findings, conservative severity
36
+ rules, explicit refutations and falsifiers, derived summaries, and
37
+ deterministic reconciled Markdown through `flow_audit_render`.
38
+ - Privacy-safe bounded host observation and the sanitized full-repository audit
39
+ oracle separate observed zero from unavailable data and require same-source,
40
+ same-model quality parity plus lower observed work before a candidate profile
41
+ can be promoted. The checked-in standard and assurance observations remain
42
+ unavailable, so enforcement is not yet a release claim.
43
+
44
+ ## [5.2.2] - 2026-07-19
45
+
46
+ Code-quality and persistence-hardening lore makes Flow safer at its input,
47
+ replay, packaging, and filesystem boundaries without changing valid Session v4
48
+ workflows:
49
+
50
+ - Lifecycle admission now applies exact UTF-8 and collection bounds before
51
+ state I/O, reserves reachable execution and reviewer projections including
52
+ the longest persisted run identity, validates dependency graphs iteratively,
53
+ rejects duplicate pending assignments, and requires explicit timestamp
54
+ offsets.
55
+ - Optional orchestration telemetry has bounded raw and retained collections,
56
+ keeps malformed optional records warning-only, and saturates aggregate
57
+ counters instead of allowing valid large observations to corrupt persisted
58
+ state.
59
+ - Replay validates session identity, complete mutation sequencing, crash and
60
+ recovery revision ownership, and monotonic durable revision, digest, and
61
+ status observations while preserving deterministic report bytes.
62
+ - Source and evidence persistence use bounded descriptor reads, identity and
63
+ topology revalidation, streaming traversal, exact filename checks, and
64
+ deterministic publication, collision, growth, and ancestor-substitution
65
+ probes.
66
+ - Release and package gates validate exact metadata, prune internal declaration
67
+ output, assert the complete packed-file allowlist, audit high-severity
68
+ advisories separately, pin workflow tooling, and keep Linux, macOS, Windows,
69
+ Node 24/26, and the real OpenCode host as blocking compatibility signals.
70
+ - Maintained documentation is indexed and source-checked; stale guidance,
71
+ confirmed dead exports and aliases, debug-era wrappers, and test cleanup
72
+ leaks are removed while uncertain external surfaces remain intact.
73
+
5
74
  ## [5.2.1] - 2026-07-19
6
75
 
7
76
  Desktop helper runtime lore restores durable session closure under OpenCode
package/README.md CHANGED
@@ -8,18 +8,36 @@ model switches, and context loss.
8
8
 
9
9
  The design is guidance-first: package-owned Markdown carries planning,
10
10
  execution, validation, review, and orchestration judgment, while the plugin
11
- runtime stays deliberately small — it keeps the session ledger and enforces the
12
- hard gates prompts should not be trusted to remember.
11
+ runtime stays bounded and policy-focused — it keeps the session ledger and
12
+ enforces the hard gates prompts should not be trusted to remember.
13
13
 
14
- Full project documentation is available in the
15
- [Flow OpenCode wiki](https://github.com/ddv1982/flow-opencode/wiki).
14
+ The maintained documentation starts at [docs/index.md](docs/index.md). The
15
+ tracked `droid-wiki/` tree is an archived generated snapshot and is not a
16
+ current product or contributor contract.
16
17
 
17
18
  ## Quick start
18
19
 
19
20
  ```bash
20
- opencode plugin opencode-plugin-flow@5.2.1 --global --force
21
+ npx -y opencode-plugin-flow@5.3.0 activation-apply \
22
+ --project "$PWD" --scope global
23
+ npx -y opencode-plugin-flow@5.3.0 activation-apply \
24
+ --project "$PWD" --scope global --apply
25
+ npx -y opencode-plugin-flow@5.3.0 activation-check --project "$PWD"
21
26
  ```
22
27
 
28
+ The first command is a read-only plan. Review it before running the second;
29
+ the final check must report exactly one active `opencode-plugin-flow@5.3.0`
30
+ source and no proven inactive Flow cache artifacts. Use `--scope project` when
31
+ the one canonical pin should live with the project instead of in global config.
32
+ Flow refuses ambiguous local wrappers, cache entries, unsafe links, and config
33
+ it cannot change conservatively rather than guessing which copy is authoritative.
34
+
35
+ To select npm's current release instead of this release-pinned example, replace
36
+ `@5.3.0` with `@latest` on the `npx` invocations; do not pass
37
+ `--target latest`. The fetched CLI resolves its own embedded exact version and
38
+ converges every mutable Flow activation to that one pin, so latest replaces an
39
+ older active version rather than loading beside it.
40
+
23
41
  Start or restart OpenCode, then give Flow a goal:
24
42
 
25
43
  ```text
@@ -48,7 +66,12 @@ stops before `flow_run_start`.
48
66
  flow_run_start mutation acknowledged
49
67
  flow_status request.view: execution, feature: rate-limit-middleware
50
68
  ... implementation, tests ...
51
- flow_review_start request.validations: focused checks passed
69
+ flow_validation_start
70
+ command: exact next Bash command
71
+ coverageScope: focused
72
+ bash exact armed command
73
+ [flow-validation-receipt] immutable receipt reference
74
+ flow_review_start request.validationRefs: [receipt reference]
52
75
  request.reviewKind: feature
53
76
  request.validationScope: targeted
54
77
  assignmentId: review-assignment:runtime-id
@@ -110,8 +133,9 @@ loop.
110
133
 
111
134
  ## Tools
112
135
 
113
- The plugin exposes nine tools. `flow_guidance` is read-only and returns embedded
114
- Markdown; the other eight form the runtime surface:
136
+ The plugin exposes 12 tools. Nine own the durable lifecycle; three add bounded
137
+ harness admission, runtime-attested validation, and deterministic audit
138
+ rendering:
115
139
 
116
140
  | Tool | Purpose |
117
141
  | --- | --- |
@@ -124,6 +148,9 @@ Markdown; the other eight form the runtime surface:
124
148
  | `flow_feature_complete` | Atomically record a completed or blocked assignment result. |
125
149
  | `flow_feature_reset` | Reset one feature and its dependents. |
126
150
  | `flow_session_close` | Archive the active session as completed, deferred, or abandoned. |
151
+ | `flow_orchestration_admit` | Evaluate and arm one bounded optional-worker proposal for the active harness profile. |
152
+ | `flow_validation_start` | Arm capture for the exact next Bash command against current causal guards, feature run, and source. |
153
+ | `flow_audit_render` | Validate `AuditLedgerV1` and render its reconciled Markdown deterministically. |
127
154
 
128
155
  Only the root manager calls `flow_review_start`. Reviewers recover the exact
129
156
  assignment with
@@ -135,6 +162,15 @@ the exact passing feature-assignment result. The final feature outcome submits
135
162
  only the final-assignment result; Flow records both results atomically from the
136
163
  durable binding.
137
164
 
165
+ Validation input is no longer a caller-authored success claim. Immediately
166
+ before a check, call `flow_validation_start` with the exact command and current
167
+ guards, execute that exact command as the next Bash call, and copy the emitted
168
+ immutable receipt reference into `flow_review_start.request.validationRefs`.
169
+ Flow verifies receipt bytes, run, feature, current source, host-observed exit,
170
+ output completeness, and scope before materializing Session v4 evidence. A
171
+ failed, truncated, missing, stale, altered, or duplicate receipt is rejected
172
+ without consuming the review-start operation id.
173
+
138
174
  The first final assignment pins that binding for every same-source final-review
139
175
  retry. A manager recovering context loads detail status and copies
140
176
  `workflowData.projection.finalReviewRetry.prerequisite.result` unchanged into
@@ -157,6 +193,9 @@ The runtime owns only safety; judgment lives in package-owned guidance:
157
193
  - Reviewer assignment requires source-bound passing validation: `targeted` for
158
194
  feature review and `broad` for final review. A source edit invalidates stale
159
195
  pending review work when its replacement is created.
196
+ - Validation receipts are host-attested from the exact next Bash execution.
197
+ Callers cannot supply validation timestamps, exit status, command class, or
198
+ output digest to `flow_review_start`.
160
199
  - Feature outcome uses a nested `completed` or `blocked` result. Invalid or stale
161
200
  input records nothing and does not consume its operation id.
162
201
  - Each OpenCode handler validates the registered nested schema again at entry;
@@ -184,8 +223,8 @@ The runtime owns only safety; judgment lives in package-owned guidance:
184
223
  - Every closure is quiescent: no active execution or pending review assignment
185
224
  remains. A session can close as `completed` only after the final feature
186
225
  outcome has passed.
187
- - Actor-reported validation and review times must follow run, validation, and
188
- assignment order and cannot postdate the runtime acceptance time.
226
+ - Host-observed validation times and reviewer-reported result times must follow
227
+ run, validation, and assignment order and cannot postdate runtime acceptance.
189
228
  - Session locks fail closed: Flow never guesses that an old lock is abandoned,
190
229
  and only the unique owner may release it. Only a valid Session v4 document can
191
230
  become active state; canonical history additionally requires explicit
@@ -194,6 +233,9 @@ The runtime owns only safety; judgment lives in package-owned guidance:
194
233
  - `.flow/session.json` is the only active-state representation. Canonical Flow
195
234
  commands call `flow_status` before acting; plugin configuration does not read,
196
235
  refresh, or project workspace state.
236
+ - Exactly one Flow runtime instance may operate in an OpenCode process. If
237
+ duplicate copies load, every copy fails closed; the highest semantic version
238
+ is named only as a diagnostic leader and does not become operational.
197
239
 
198
240
  ## Hidden workers
199
241
 
@@ -216,6 +258,27 @@ that contract. Inspect rendered surfaces and static contracts with
216
258
  see
217
259
  [docs/prompt-quality.md](docs/prompt-quality.md).
218
260
 
261
+ The trusted command footer selects one harness profile with
262
+ `OPENCODE_FLOW_HARNESS_PROFILE=control|standard|assurance` (default
263
+ `standard`) and one admission rollout with
264
+ `OPENCODE_FLOW_ROLLOUT_MODE=control|observe|enforce` (default `observe`).
265
+ `control` preserves discretionary optional-worker behavior without admission
266
+ ceremony. `standard` admits a small bounded discovery/challenge path;
267
+ `assurance` permits broader bounded evidence and audit coverage when risk
268
+ justifies it. In `observe`, a policy violation is reported but does not block;
269
+ in `enforce`, the exact admitted optional worker class and count must be
270
+ dispatched. Lifecycle-required reviewer and validation workers are not optional
271
+ passes and do not use orchestration admission. Validation receipts remain
272
+ mandatory in every profile.
273
+
274
+ Hidden worker routing can be tuned without changing the domain contract. Set
275
+ `OPENCODE_FLOW_READONLY_WORKER_MODEL`,
276
+ `OPENCODE_FLOW_REVIEW_WORKER_MODEL`, or
277
+ `OPENCODE_FLOW_CANDIDATE_WORKER_MODEL`, with
278
+ `OPENCODE_FLOW_WORKER_MODEL` as the fallback. Matching `*_WORKER_STEPS`
279
+ variables set OpenCode's current `steps` limit; values must be integers from 1
280
+ through 1000.
281
+
219
282
  For broad implementation, the manager records whether work stayed serial,
220
283
  used exact-path candidate workers, used isolated worktrees, ran a tournament, or
221
284
  skipped eligible candidates. Feature completion can carry bounded
@@ -226,23 +289,37 @@ handoffs remain outside `.flow/**`.
226
289
  ## Install details and legacy cleanup
227
290
 
228
291
  See [docs/troubleshooting.md](docs/troubleshooting.md) for updates,
229
- older-OpenCode install fallback, stuck session recovery, and removal of global
230
- Flow skill folders left by v4.
231
-
232
- To update a pinned Flow version, rerun the install command with the new version.
233
- Flow starts with the new package-owned guidance immediately; no second restart
234
- or sync command is required. To preview recoverable migration of pristine v4
235
- global skill folders:
292
+ activation refusal and duplicate-runtime recovery, stuck session recovery, and
293
+ removal of global Flow skill folders left by v4.
294
+
295
+ To update, run the same `activation-apply` dry-run/apply/check sequence with the
296
+ new exact package version. The activator inventories OpenCode's global, project,
297
+ `.opencode`, custom, inline, and readable managed configuration; singular and
298
+ plural plugin directories; and the Flow package cache. It preserves unrelated
299
+ plugins, removes recognized Flow config entries outside the selected canonical
300
+ scope, and moves only marker-proven wrappers and proven inactive cache artifacts
301
+ to recovery locations. Applied changes receive backups and a recovery journal.
302
+ Sources that cannot be proved safe—including unknown wrappers, ambiguous cache
303
+ artifacts, JSONC that would require a lossy rewrite, inline config, and
304
+ administrator-managed config—produce manual remediation instead of mutation.
305
+ If an applied multi-source change fails, Flow attempts exact safe rollback and
306
+ records either `rolled-back` or `rollback-failed` in the recovery journal;
307
+ concurrent or unsafe state is preserved for manual recovery. Remote and
308
+ managed-preference sources that cannot be decoded offline remain covered by
309
+ fail-closed runtime leadership.
310
+
311
+ To preview recoverable migration of pristine v4 global skill folders:
236
312
 
237
313
  ```bash
238
- npx -y opencode-plugin-flow@5.2.1 legacy-cleanup --dry-run
314
+ npx -y opencode-plugin-flow@5.3.0 legacy-cleanup --dry-run
239
315
  ```
240
316
 
241
317
  ## Development
242
318
 
243
319
  ```bash
244
320
  bun install
245
- bun run check # typecheck + lint + prompt quality + build + tests
321
+ bun run check # typecheck + lint + release metadata + prompt quality + build + tests
322
+ bun run harness:report # sanitized control/candidate resource and quality status
246
323
  bun run smoke:live # boots a real OpenCode server against the packed tarball
247
324
  ```
248
325