opencode-plugin-flow 5.1.1 → 5.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/CHANGELOG.md CHANGED
@@ -2,6 +2,53 @@
2
2
 
3
3
  One short entry per release, written for users deciding whether to upgrade.
4
4
 
5
+ ## [5.2.0] - 2026-07-19
6
+
7
+ Runtime-owned review assignment lore removes the recovery loops seen in long
8
+ Flow runs while preserving independent review and stale-source protection:
9
+
10
+ - Session v4 separates plan features from execution runs. Reset preserves old
11
+ evidence and attempts as audit history but gives restarted work fresh run and
12
+ retry identity. It is the sole supported session contract; every other version
13
+ is generic unsupported input rather than a migration or compatibility path.
14
+ - New manager-only `flow_review_start` records source-bound validation and
15
+ creates a durable reviewer assignment. Reviewers recover only by assignment
16
+ id and no longer invent attempt, pass, packet, evidence, snapshot, start-time,
17
+ or review-depth fields.
18
+ - `flow_feature_complete` now accepts one nested `completed` or `blocked`
19
+ result. Invalid or stale input is mutation-free and leaves its operation id
20
+ reusable; a genuine review blocker is an accepted mutation that consumes the
21
+ bounded run-scoped retry budget.
22
+ - Final assignments retain the exact passing feature-assignment result as a
23
+ durable bound prerequisite. A broad final feature outcome submits only the
24
+ final-assignment result; Flow records both review executions atomically even
25
+ after manager context loss. Same-source final-review retries recover the first
26
+ binding from detail status; compact and reviewer status keep it out.
27
+ - Reported validation and review times must follow active-execution,
28
+ validation, and assignment order and cannot postdate runtime acceptance.
29
+ - Completed, deferred, and abandoned closure are quiescent. If archive
30
+ publication is interrupted, compact status exposes one retry operation id;
31
+ retry needs no reconstructed summary or causal guards. New close ids are
32
+ unique across active and canonical archived mutation history.
33
+ - Saving a different goal never silently archives or replaces an unclosed
34
+ session, including an unapproved draft. Explicit deferred or abandoned close
35
+ owns that disposition before the next goal begins.
36
+ - Archive publication and canonical history now require non-null explicit
37
+ closure; closureless Session v4 archives fail closed.
38
+ - Lifecycle tools expose strict nested `request` unions. Application,
39
+ registered, emitted, executed, prompt, and documented contracts now exercise
40
+ the same semantic request set with no flat compatibility adapter. Registered
41
+ handlers validate again at entry because schema advertisement alone does not
42
+ stop every invalid host invocation.
43
+ - Validation applicability uses source identity plus feature run instead of the
44
+ latest review-ledger revision. Distinct silent validation commands retain
45
+ distinct command identities, while source edits and reset still stale prior
46
+ assignments.
47
+ - Manager, reviewer, recovery, README, lifecycle, causal-state, and maintainer
48
+ contracts now describe the nine-tool assignment handshake and final-feature
49
+ economy order. Deterministic lifecycle, transport-budget, prompt, package,
50
+ persistence, and schema coverage exercise the cutover.
51
+
5
52
  ## [5.1.1] - 2026-07-19
6
53
 
7
54
  Durable ignore publication lore keeps concurrent restricted-evidence setup
package/README.md CHANGED
@@ -17,7 +17,7 @@ Full project documentation is available in the
17
17
  ## Quick start
18
18
 
19
19
  ```bash
20
- opencode plugin opencode-plugin-flow@5.1.1 --global --force
20
+ opencode plugin opencode-plugin-flow@5.2.0 --global --force
21
21
  ```
22
22
 
23
23
  Start or restart OpenCode, then give Flow a goal:
@@ -32,6 +32,10 @@ implement one feature → validate it → review it → record evidence → next
32
32
  feature. `/flow-status` shows where you are at any point, including after a
33
33
  restart.
34
34
 
35
+ `/flow-auto` still respects the scope of the request. If you ask for a plan
36
+ only or explicitly say not to implement, it saves and summarizes the plan and
37
+ stops before `flow_run_start`.
38
+
35
39
  ## What a session looks like
36
40
 
37
41
  ```text
@@ -42,14 +46,22 @@ restart.
42
46
  (you approve the plan)
43
47
  flow_plan_approve plan locked — features are now immutable
44
48
  flow_run_start mutation acknowledged
45
- flow_status view: execution, feature: rate-limit-middleware
49
+ flow_status request.view: execution, feature: rate-limit-middleware
46
50
  ... implementation, tests ...
51
+ flow_review_start request.validations: focused checks passed
52
+ request.reviewKind: feature
53
+ request.validationScope: targeted
54
+ assignmentId: review-assignment:runtime-id
55
+ flow_status request.view: reviewer
56
+ request.assignmentId: review-assignment:runtime-id
57
+ ... independent review ...
47
58
  flow_feature_complete
48
- validationRun: "bun test tests/middleware.test.ts" passed
49
- featureReviewDepth: standard
50
- featureReview: passed
59
+ request.result.kind: completed
60
+ request.result.validationScope: targeted
61
+ request.result.featureReview.assignmentId: review-assignment:runtime-id
62
+ request.result.featureReview.verdict: passed
51
63
  flow_run_start mutation acknowledged
52
- flow_status view: execution, feature: per-route-config
64
+ flow_status request.view: execution, feature: per-route-config
53
65
  ...
54
66
 
55
67
  > /flow-status
@@ -59,7 +71,7 @@ restart.
59
71
  workflowData.projection.progress: { completed: 1, total: 3, remaining: 2 }
60
72
 
61
73
  > /flow-run
62
- flow_status view: execution
74
+ flow_status request.view: execution
63
75
  workflowData.projection: full active-feature scope
64
76
  ```
65
77
 
@@ -67,7 +79,9 @@ restart.
67
79
  routing-only, execution is the full active-feature working scope, detail is
68
80
  diagnostic, and reviewer is narrow assignment context. State-changing tools
69
81
  return `workflowData.receipt` acknowledgements; a receipt never replaces a
70
- fresh status projection.
82
+ fresh status projection. Rejected mutations explicitly report
83
+ `operationAccepted: false` and `operationIdConsumed: false`; accepted results,
84
+ including durable review blockers, report the corresponding accepted receipt.
71
85
 
72
86
  Interrupt at any point; `/flow-run` resumes the next approved feature. On the
73
87
  final feature Flow requires broad project-level validation and a final review
@@ -78,7 +92,7 @@ completed.
78
92
 
79
93
  | Command | Purpose |
80
94
  | --- | --- |
81
- | `/flow-auto <goal>` | Drive the full guidance-driven loop. |
95
+ | `/flow-auto <goal>` | Drive the authorized loop; stop after planning when requested. |
82
96
  | `/flow-plan <goal>` | Create or approve a plan. |
83
97
  | `/flow-run` | Execute one approved feature. |
84
98
  | `/flow-review` | Run a read-only review. |
@@ -96,23 +110,37 @@ loop.
96
110
 
97
111
  ## Tools
98
112
 
99
- The plugin exposes eight tools. `flow_guidance` is read-only and returns embedded
100
- Markdown; the other seven form the stateful runtime surface:
113
+ The plugin exposes nine tools. `flow_guidance` is read-only and returns embedded
114
+ Markdown; the other eight form the runtime surface:
101
115
 
102
116
  | Tool | Purpose |
103
117
  | --- | --- |
104
118
  | `flow_guidance` | Load exact package-owned guidance by stable id. |
105
119
  | `flow_status` | Read the active session and next action. |
106
- | `flow_plan_save` | Create a session and/or save a draft plan. |
120
+ | `flow_plan_save` | Create a session or update its active same-goal draft. |
107
121
  | `flow_plan_approve` | Approve the draft plan. |
108
122
  | `flow_run_start` | Start the next runnable feature. |
109
- | `flow_feature_complete` | Record completion or blocker evidence for the active feature. |
123
+ | `flow_review_start` | Bind validation to current source and create a runtime-owned reviewer assignment; final review also binds the passing feature result. |
124
+ | `flow_feature_complete` | Atomically record a completed or blocked assignment result. |
110
125
  | `flow_feature_reset` | Reset one feature and its dependents. |
111
126
  | `flow_session_close` | Archive the active session as completed, deferred, or abandoned. |
112
127
 
113
- Review evidence is part of `flow_feature_complete`: every completed feature
114
- needs a passing `featureReview` at the feature's planned `reviewDepth`, and the
115
- final feature also needs a passing `finalReview`.
128
+ Only the root manager calls `flow_review_start`. Reviewers recover the exact
129
+ assignment with
130
+ `flow_status { request: { view: "reviewer", assignmentId } }` and return only
131
+ the assignment id, verdict, typed findings, reported time, and terminal
132
+ disposition. The runtime derives all attempt, pass, source, packet, run,
133
+ start-time, and required-depth identity. Final assignment creation durably binds
134
+ the exact passing feature-assignment result. The final feature outcome submits
135
+ only the final-assignment result; Flow records both results atomically from the
136
+ durable binding.
137
+
138
+ The first final assignment pins that binding for every same-source final-review
139
+ retry. A manager recovering context loads detail status and copies
140
+ `workflowData.projection.finalReviewRetry.prerequisite.result` unchanged into
141
+ the new final review start's `request.featureReview`. Compact and reviewer views
142
+ omit the aggregate. A mismatch records nothing and leaves its operation id
143
+ reusable; a source edit requires a new targeted feature-review sequence.
116
144
 
117
145
  ## What the runtime enforces
118
146
 
@@ -121,22 +149,47 @@ The runtime owns only safety; judgment lives in package-owned guidance:
121
149
  - `.flow/session.json` is the single source of truth; writes are locked and
122
150
  atomic, and closed sessions are archived under `.flow/history/`.
123
151
  - Plans cannot be changed after approval.
124
- - Only one feature can be active at a time.
125
- - Completion requires passing validation evidence: `targeted` scope for
126
- ordinary features, `broad` scope plus a passing final review for the last
127
- one.
128
- - Completion records `featureReviewDepth`; the runtime rejects review evidence
129
- that is shallower than the approved feature requires.
130
- - Failed reviews are bounded: a failed review pauses by default, and autonomous
131
- repair is limited to one repair plus one retry before the feature blocks.
152
+ - A different-goal plan save cannot replace an unclosed session, including an
153
+ unapproved draft. Close it explicitly as `deferred` or `abandoned` and finish
154
+ archive publication before saving the new goal.
155
+ - Only one feature run can be active at a time; reset preserves its audit
156
+ history but the next start receives a fresh run id.
157
+ - Reviewer assignment requires source-bound passing validation: `targeted` for
158
+ feature review and `broad` for final review. A source edit invalidates stale
159
+ pending review work when its replacement is created.
160
+ - Feature outcome uses a nested `completed` or `blocked` result. Invalid or stale
161
+ input records nothing and does not consume its operation id.
162
+ - Each OpenCode handler validates the registered nested schema again at entry;
163
+ invalid host invocations fail as tool errors before Flow state I/O.
164
+ - The runtime derives review depth from the approved plan and owns assignment,
165
+ attempt, logical-pass, packet, source, and start-time identity.
166
+ - Failed reviews are bounded: an accepted blocker returns operation status
167
+ `ok`, and autonomous repair is limited to one repair plus one retry before
168
+ the feature blocks.
132
169
  - Review exhaustion uses the ordinary blocked-feature state; continuing requires
133
170
  an explicit `flow_feature_reset`, not a second checkpoint protocol.
171
+ - A passing final feature outcome marks progress completed but leaves closure null;
172
+ `flow_session_close` exclusively records and archives it.
134
173
  - Once a closure is recorded, the session is archive-only. If publication fails,
135
- retry `flow_session_close`; no run, reset, approval, or replan can reopen it.
136
- - A session can close as `completed` only after final completion has passed.
174
+ compact status supplies `closure.retryOperationId`; retry only with
175
+ `flow_session_close { request: { mode: "retry", operationId } }`. No new
176
+ close, run, reset, approval, or replan can reopen or adopt it.
177
+ - A new close operation id must be absent from the active causal chain and every
178
+ mutation in canonical Session v4 workspace history. Any archived match is a
179
+ collision; malformed or ambiguous canonical history fails closed before
180
+ active state changes.
181
+ - Archive publication requires explicit non-null closure. Closureless Session
182
+ v4 state may remain active, but it is rejected as canonical history and makes
183
+ canonical lookup fail closed if found there.
184
+ - Every closure is quiescent: no active execution or pending review assignment
185
+ remains. A session can close as `completed` only after the final feature
186
+ 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.
137
189
  - Session locks fail closed: Flow never guesses that an old lock is abandoned,
138
- and only the unique owner may release it. Unreadable session files are
139
- quarantined with recovery guidance, never silently deleted.
190
+ and only the unique owner may release it. Only a valid Session v4 document can
191
+ become active state; canonical history additionally requires explicit
192
+ non-null closure.
140
193
  - Flow writes `.flow/.gitignore` so session state stays out of Git by default.
141
194
  - `.flow/session.json` is the only active-state representation. Canonical Flow
142
195
  commands call `flow_status` before acting; plugin configuration does not read,
@@ -166,7 +219,7 @@ see
166
219
  For broad implementation, the manager records whether work stayed serial,
167
220
  used exact-path candidate workers, used isolated worktrees, ran a tournament, or
168
221
  skipped eligible candidates. Feature completion can carry bounded
169
- `orchestrationPasses` with candidate eligibility, decision, and structured
222
+ `result.orchestrationPasses` with candidate eligibility, decision, and structured
170
223
  factors. Bounded projections report the relevant aggregate while full worker
171
224
  handoffs remain outside `.flow/**`.
172
225
 
@@ -182,7 +235,7 @@ or sync command is required. To preview recoverable migration of pristine v4
182
235
  global skill folders:
183
236
 
184
237
  ```bash
185
- npx -y opencode-plugin-flow@5.1.1 legacy-cleanup --dry-run
238
+ npx -y opencode-plugin-flow@5.2.0 legacy-cleanup --dry-run
186
239
  ```
187
240
 
188
241
  ## Development
@@ -3,3 +3,8 @@ export declare class UnreadableFlowSessionError extends Error {
3
3
  readonly reason: string;
4
4
  constructor(message: string, reason: string);
5
5
  }
6
+ export declare class UnsupportedFlowSessionVersionError extends Error {
7
+ readonly code = "UNSUPPORTED_FLOW_SESSION_VERSION";
8
+ readonly actualVersion: unknown;
9
+ constructor(actualVersion: unknown);
10
+ }