opencode-plugin-flow 6.7.0 → 6.8.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 +44 -0
- package/README.md +65 -19
- package/dist/index.js +742 -581
- package/dist/index.js.map +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,153 +6,103 @@ description: Drive a Flow goal from planning through implementation, validation,
|
|
|
6
6
|
|
|
7
7
|
# Flow
|
|
8
8
|
|
|
9
|
-
Flow
|
|
10
|
-
|
|
11
|
-
Do not silently fall back to ordinary non-Flow coding. The root manager owns
|
|
12
|
-
the session, integration, validation, review dispatch, reset, closure, and every
|
|
13
|
-
manager-owned lifecycle mutation. Bounded \`flow-worker\`
|
|
14
|
-
instances may contribute disjoint work inside the active feature. The reserved
|
|
15
|
-
\`flow-reviewer\` independently reviews and submits its own result through
|
|
16
|
-
\`flow_feature_complete\`; it cannot edit the workspace or make any other
|
|
17
|
-
lifecycle mutation. Do not dispatch generic or general-purpose agents for
|
|
18
|
-
active Flow planning, implementation, evidence gathering, or review. Use only
|
|
19
|
-
the root manager and the two reserved Flow roles.
|
|
9
|
+
Flow's active goal is authoritative until completed, deferred, or abandoned;
|
|
10
|
+
never silently fall back.
|
|
20
11
|
|
|
21
12
|
## Route from status
|
|
22
13
|
|
|
23
14
|
1. Call \`flow_status { request: { view: "compact" } }\` first. Trust its
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
unconfirmed
|
|
31
|
-
|
|
32
|
-
Before
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
4. If an approved feature is ready, running, or blocked, call
|
|
52
|
-
\`flow_guidance { id: "flow-run" }\` and follow that contract for exactly that
|
|
53
|
-
feature, including its retry and checkpoint routing.
|
|
54
|
-
5. After applying \`flow-run\` to one feature, read compact status again. Reuse
|
|
55
|
-
its one detail projection for any blocked checkpoint. Under \`/flow-auto\`,
|
|
56
|
-
a passing feature and a compact status of \`ready\` or \`completed\` are loop
|
|
57
|
-
states, not handoff states: immediately apply \`flow-run\` to the next ready
|
|
58
|
-
feature, or close the completed session with one \`flow_session_close\`
|
|
59
|
-
request. Do not return “ready for the next feature,” offer \`/flow-run\`, or
|
|
60
|
-
wait for another user turn while an authorized next action is runnable. For
|
|
61
|
-
a blocked outcome, follow the loaded \`flow-run\` retry and checkpoint
|
|
62
|
-
contract.
|
|
15
|
+
\`nextAction\` as the durable default, not added authority.
|
|
16
|
+
If the top-level response is an error, report its exact summary and recovery;
|
|
17
|
+
when delivery is present, handle its bounded map under **Recovery**. Stop
|
|
18
|
+
without another mutation.
|
|
19
|
+
For \`archiveRetry\`, call the projected \`flow_session_close\` request
|
|
20
|
+
byte-for-byte and handle its delivery under **Recovery**. Refresh compact status;
|
|
21
|
+
stop if publication remains unconfirmed, otherwise continue from the
|
|
22
|
+
refreshed projection. This cleanup precedes goal alignment and grants no work.
|
|
23
|
+
Before another manager mutation, align the compact-projected goal with the
|
|
24
|
+
request. Continue only for the same goal or a narrowing that preserves every
|
|
25
|
+
outcome. Close a completed session as completed before new work. If the user
|
|
26
|
+
explicitly chooses deferred or abandoned closure for a non-completed session,
|
|
27
|
+
call \`flow_session_close\` with compact session id/revision, fresh operation
|
|
28
|
+
id, that kind, and optional summary; handle **Recovery**, follow a projected
|
|
29
|
+
exact \`archiveRetry\`, and stop. Otherwise new or expanded work makes no
|
|
30
|
+
mutation: say it has not started and offer continue, defer, or abandon. Keep
|
|
31
|
+
alignment conversational. On revision conflict, refresh compact status and
|
|
32
|
+
retry only after confirming the same session and goal and that status still
|
|
33
|
+
permits the selected closure kind; never close a replacement.
|
|
34
|
+
2. For a plan-only request with an approved same-goal session, read detail once,
|
|
35
|
+
report the immutable plan and progress, and stop.
|
|
36
|
+
3. With no session or a draft, load \`flow_guidance { id: "flow-plan" }\`; stop
|
|
37
|
+
after planning if implementation was not authorized.
|
|
38
|
+
4. For an approved ready, running, or blocked feature, load
|
|
39
|
+
\`flow_guidance { id: "flow-run" }\` and follow it for exactly that feature.
|
|
40
|
+
5. After \`flow-run\`, reload compact status. Route blocked outcomes through the
|
|
41
|
+
loaded retry and checkpoint contract; otherwise continue **End-to-end loop**.
|
|
63
42
|
|
|
64
43
|
## End-to-end loop
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
\`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
passing feature outcome without asking again. For a blocked outcome, follow the
|
|
86
|
-
loaded \`flow-run\` retry and checkpoint contract. The session remains
|
|
87
|
-
authoritative while blocked. Never implicitly select a feature whose latest
|
|
88
|
-
relevant reviewed outcome remains failed. Untouched dependency-independent
|
|
89
|
-
features may continue; if only retry-required candidates remain, wait at
|
|
90
|
-
\`await-user-direction\` for the exact choice. If status is blocked, carry the
|
|
91
|
-
authorized retry or independent choice atomically as \`nextFeatureId\` on
|
|
92
|
-
\`flow_feature_reset\`. If status is ready, the failed run is already superseded:
|
|
93
|
-
load detail once and use \`flow_run_start\` with the explicitly authorized
|
|
94
|
-
retry's exact \`featureId\`. Never reset from ready status, and add no hold or
|
|
95
|
-
retry ledger.
|
|
96
|
-
|
|
97
|
-
Pause only for a convergence checkpoint, a material product or scope choice,
|
|
98
|
-
missing authority for an external Git or release action,
|
|
99
|
-
a hard operational failure, or the user's explicit choice of deferred or
|
|
100
|
-
abandoned closure. Only the user may choose either non-completed kind.
|
|
101
|
-
|
|
102
|
-
Core contracts are bundled in the plugin; load them through \`flow_guidance\` and
|
|
103
|
-
do not depend on native skill discovery. If a required Flow tool is unavailable,
|
|
104
|
-
report that the plugin is not fully loaded instead of simulating state changes.
|
|
45
|
+
\`/flow-auto\` loops \`ready\`/\`completed\` only after a same-host non-replayed
|
|
46
|
+
\`flow_plan_save\` owns idle session creation, or an active baseline advances in
|
|
47
|
+
that session. The latter temporal gate admits a pending reviewer result;
|
|
48
|
+
unchanged ready or replacement fails closed;
|
|
49
|
+
conversational \`flow_plan_approve\` and blocked or ready \`await-user-direction\`
|
|
50
|
+
resume only when the reply's same-host accepted mutation advances it.
|
|
51
|
+
|
|
52
|
+
For \`ready\`, apply \`flow-run\`; after every recorded result reload compact. For \`completed\`,
|
|
53
|
+
close and handle **Recovery** plus exact \`archiveRetry\`.
|
|
54
|
+
\`flow_run_start\` and intermediate progress are not terminal: never return “ready
|
|
55
|
+
for the next feature” or wait while an action is authorized. Return only after closure
|
|
56
|
+
or a checkpoint. Direct \`/flow-run\` stops after one feature.
|
|
57
|
+
|
|
58
|
+
For blocked work, follow \`flow-run\` routing. Never implicitly select a feature
|
|
59
|
+
whose latest relevant reviewed outcome remains failed.
|
|
60
|
+
Untouched independent features may continue; if only retries remain, wait at
|
|
61
|
+
\`await-user-direction\`. Otherwise pause only for a material
|
|
62
|
+
choice, missing Git/release authority, hard failure, or user-chosen closure.
|
|
63
|
+
If a Flow tool is absent, report an incomplete plugin load; never simulate state.
|
|
105
64
|
|
|
106
65
|
## Invariants
|
|
107
66
|
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
pass.
|
|
119
|
-
- A failed review is recorded honestly. Any retry is a fresh run with full
|
|
120
|
-
validation and review.
|
|
121
|
-
- Use runtime revisions and operation ids for ordering and idempotency. Supply
|
|
122
|
-
only fields requested by the current tool schema.
|
|
123
|
-
- Do not create reports or sidecars outside \`.flow/**\` unless the user asks for
|
|
124
|
-
a durable artifact. Prefer one readable Markdown file; JSON is opt-in.
|
|
125
|
-
- Do not stage, commit, push, publish, or mutate releases unless the user
|
|
126
|
-
explicitly asks for that Git or release action.
|
|
127
|
-
|
|
128
|
-
## Blocked handoff
|
|
129
|
-
|
|
130
|
-
A blocked handoff must be self-contained and label the result overall
|
|
131
|
-
incomplete. Use the one detail projection for a failed-review block. Report the
|
|
132
|
-
goal and progress; blocked feature, attempt, failure count, findings; completed
|
|
133
|
-
and untouched features; validation and artifact evidence; Git and release
|
|
134
|
-
mutation status; and whether the newest request started and matched the active
|
|
135
|
-
goal.
|
|
67
|
+
- Plans are immutable. Out-of-plan work stops; finish or explicitly close, never
|
|
68
|
+
replan in place.
|
|
69
|
+
- One durable feature run exists at a time; worker waves add no Flow state.
|
|
70
|
+
- Preserve unrelated work and stay inside the active feature.
|
|
71
|
+
- Passing requires current-source validation and one independent review; the
|
|
72
|
+
final feature uses broad validation, not another review.
|
|
73
|
+
- Record failures honestly; retries are fresh full runs.
|
|
74
|
+
- Use runtime revisions, fresh operation ids, and current-schema fields.
|
|
75
|
+
- Do not create reports/sidecars, Git changes, or release mutations unless
|
|
76
|
+
requested; reports default to Markdown and JSON is opt-in.
|
|
136
77
|
|
|
137
78
|
## Recovery
|
|
138
79
|
|
|
139
|
-
On
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
80
|
+
On interruption, read compact status; load \`flow-run\` for an active or blocked feature
|
|
81
|
+
and use execution or reviewer status, never prose, for lifecycle truth.
|
|
82
|
+
|
|
83
|
+
Summaries keep plan/source IDs \`verified\` or \`incomplete\`. A prior finding is
|
|
84
|
+
terminally \`fixed\` only when review passes with current evidence. A failed
|
|
85
|
+
verdict carries every prior ID forward: report a proven repair as \`terminal
|
|
86
|
+
fixed pending pass\` with concise evidence, an
|
|
87
|
+
unproven repair as unverified-fixed, a recurrence as \`recurring\`, or a confirmed
|
|
88
|
+
nonblocker as \`residual\`. Blockers stay terminal.
|
|
89
|
+
|
|
90
|
+
For an accepted close, map only \`workflowData.delivery\`
|
|
91
|
+
\`outcomeSummary\`/\`terminalFindings\`.
|
|
92
|
+
Requirements are proven \`verified\`, otherwise \`incomplete\` or explicit
|
|
93
|
+
\`deferred\`. Apply the finding rules above, using \`incomplete\` for an unproven
|
|
94
|
+
terminal claim; \`abandoned\` stays the kind. Missing IDs are unavailable: never
|
|
95
|
+
invent or read detail solely for closure. Without delivery, report exact
|
|
96
|
+
recovery and no map.
|
|
97
|
+
|
|
98
|
+
Unresolved blockers forbid completed closure. Fresh close: projected session
|
|
99
|
+
id/revision, fresh operation id, kind, optional summary. Replay byte-for-byte
|
|
100
|
+
only the \`archiveRetry\` of a durably accepted close. Rejected revision conflict:
|
|
101
|
+
refresh compact, confirm the same session/goal, then build a fresh request.
|
|
102
|
+
From delivery report each feature's attempt count, latest outcome, terminal
|
|
103
|
+
findings, and Flow-reported latest/superseded artifacts. Report external prerequisites only
|
|
104
|
+
from terminal text; otherwise mark them unavailable. Artifacts are not an exact
|
|
105
|
+
Git delta. Create no other ledger or report.
|
|
156
106
|
`;
|
|
157
107
|
|
|
158
108
|
// skills/flow-plan/SKILL.md
|
|
@@ -163,37 +113,46 @@ description: Create, revise, or approve a concise Flow plan before implementatio
|
|
|
163
113
|
|
|
164
114
|
# Flow Plan
|
|
165
115
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
it without rediscovering the goal.
|
|
116
|
+
Inspect determining repository facts. Keep the plan scannable and executable
|
|
117
|
+
without rediscovering the goal.
|
|
169
118
|
|
|
170
119
|
## Start
|
|
171
120
|
|
|
172
121
|
- Call \`flow_status { request: { view: "compact" } }\` first.
|
|
173
|
-
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
122
|
+
- On top-level error, report exact summary/recovery and, if
|
|
123
|
+
\`workflowData.delivery\` exists, the handoff below. State this initial read
|
|
124
|
+
made no lifecycle, Git, or release mutation; stop.
|
|
125
|
+
- For \`archiveRetry\`, replay the projected \`flow_session_close\` request
|
|
126
|
+
byte-for-byte. Report delivery; if absent, report exact recovery and no map.
|
|
127
|
+
Refresh only if publication is unconfirmed; continue from the confirmed
|
|
128
|
+
projection or stop without saving. This precedes alignment and grants no work.
|
|
129
|
+
- On close conflict, refresh compact and retry only for the same session/goal
|
|
130
|
+
while status permits that kind; never close a replacement.
|
|
131
|
+
- Before mutation, align the projected goal with \`/flow-plan\`; continue only for
|
|
132
|
+
the same goal or a method/emphasis narrowing that preserves every requested
|
|
133
|
+
outcome, and close completed work. For a non-completed session, an
|
|
134
|
+
explicit deferred/abandoned choice calls
|
|
135
|
+
\`flow_session_close\` with compact id/revision, fresh operation id, that kind,
|
|
136
|
+
and optional summary; report delivery, follow exact \`archiveRetry\`, and stop.
|
|
137
|
+
Other new scope makes no mutation; conversationally offer continue, defer, or
|
|
138
|
+
abandon.
|
|
139
|
+
- Delivery handoff: goal; closure kind/summary; progress; per-feature
|
|
140
|
+
ID/title/attempts/latest state/outcome summary/terminal findings; and
|
|
141
|
+
\`reportedArtifacts.latestAttempts\` plus
|
|
142
|
+
\`reportedArtifacts.supersededAttemptsOnly\`, qualified as Flow-reported
|
|
143
|
+
caller-declared artifacts, not an exact/exhaustive Git delta. Map IDs only
|
|
144
|
+
from \`outcomeSummary\`/\`terminalFindings\`: \`verified\` only when proven,
|
|
145
|
+
otherwise \`incomplete\` or explicit \`deferred\`; \`fixed\` needs passing review
|
|
146
|
+
plus current evidence, \`recurring\` current confirmation, \`residual\` a
|
|
147
|
+
confirmed nonblocker, and \`abandoned\` stays the closure kind. Missing history
|
|
148
|
+
is unavailable; never read detail solely for closure or invent it.
|
|
187
149
|
- If the user asked only for a plan and an approved same-goal session already
|
|
188
|
-
exists,
|
|
189
|
-
|
|
190
|
-
or run anything.
|
|
191
|
-
- Do not replace an unclosed different goal. Close or finish it explicitly.
|
|
150
|
+
exists, read detail once, report its immutable plan/progress, and stop without
|
|
151
|
+
saving, approving, or running.
|
|
192
152
|
- If \`flow_plan_save\` or \`flow_plan_approve\` is unavailable, stop and report
|
|
193
|
-
|
|
194
|
-
- Inspect relevant code, tests, docs,
|
|
195
|
-
|
|
196
|
-
product choice would materially change the outcome.
|
|
153
|
+
an incomplete plugin load.
|
|
154
|
+
- Inspect relevant code, tests, docs, scripts, and conventions. Ask only for a
|
|
155
|
+
missing product choice that materially changes the outcome.
|
|
197
156
|
|
|
198
157
|
## Plan contract
|
|
199
158
|
|
|
@@ -206,27 +165,21 @@ Save one plan with:
|
|
|
206
165
|
- \`features\`: ordered outcome slices, each with a stable \`id\`, \`title\`,
|
|
207
166
|
\`summary\`, bounded \`targets\`, concrete \`validation\`, and \`dependsOn\` ids.
|
|
208
167
|
|
|
209
|
-
Each feature
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
When a \`validation\` entry names an executable command, record the exact
|
|
225
|
-
plan-listed command byte-for-byte. Behavior-oriented prose that has never run
|
|
226
|
-
as an exact command remains reviewer judgment rather than a fabricated command
|
|
227
|
-
result. Name any required operating system, architecture, service, credential,
|
|
228
|
-
external setting, hardware, or other evidence environment explicitly enough
|
|
229
|
-
that \`flow-run\` can preflight it before implementation.
|
|
168
|
+
Each feature needs one observable outcome judgeable from bounded evidence and
|
|
169
|
+
focused validation. Split only independent failures or true dependencies; file
|
|
170
|
+
overlap decides neither. Separate a race or state-machine invariant from
|
|
171
|
+
independently acceptable UI, persistence, or accessibility outcomes; merge only
|
|
172
|
+
under one indivisible invariant. Avoid step-shaped features and vague checks.
|
|
173
|
+
|
|
174
|
+
Preserve stable finding, issue, or requirement IDs exactly in the saved feature
|
|
175
|
+
\`summary\` or \`validation\`; each stays traceable from the immutable plan to one
|
|
176
|
+
outcome and its evidence.
|
|
177
|
+
|
|
178
|
+
When \`validation\` names an executable command, record the exact plan-listed
|
|
179
|
+
command byte-for-byte. Unrun behavior prose remains reviewer judgment, never a
|
|
180
|
+
fabricated command result. Explicitly name any required operating system,
|
|
181
|
+
architecture, service, credential, external setting, hardware, or evidence
|
|
182
|
+
environment for \`flow-run\` to preflight before implementation.
|
|
230
183
|
|
|
231
184
|
Before saving, confirm:
|
|
232
185
|
|
|
@@ -240,15 +193,14 @@ Before saving, confirm:
|
|
|
240
193
|
|
|
241
194
|
## Save and approve
|
|
242
195
|
|
|
243
|
-
Call \`flow_plan_save\` with one nested request
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
the same Flow session.
|
|
196
|
+
Call \`flow_plan_save\` with one nested request: stable operation id, current
|
|
197
|
+
revision (\`0\` for new), goal, and complete draft. Summarize outcome, feature
|
|
198
|
+
order, validation, and material decisions. Call \`flow_plan_approve\` with a fresh
|
|
199
|
+
operation id/current revision only after explicit approval or prior autonomous
|
|
200
|
+
implementation authority. Approval locks the plan. Ask conversational
|
|
201
|
+
\`/flow-auto\` approval without requiring a second command; a reply may resume its
|
|
202
|
+
same process-local interaction only after approval advances the same Flow
|
|
203
|
+
session.
|
|
252
204
|
|
|
253
205
|
Do not begin implementation during a plan-only request. Do not create a plan
|
|
254
206
|
document in the repository unless the user explicitly requests one.
|
|
@@ -277,8 +229,8 @@ bounded packet, assignment-linked validations, approved-plan context, and
|
|
|
277
229
|
completed feature IDs instead of reconstructing feature, source,
|
|
278
230
|
revision, validation, or lifecycle data from conversation memory.
|
|
279
231
|
|
|
280
|
-
If the reviewer projection is available but evidence required to
|
|
281
|
-
|
|
232
|
+
If the reviewer projection is available but evidence required to approve the
|
|
233
|
+
outcome is missing, submit a failed result with an ordinary blocking finding
|
|
282
234
|
that precisely identifies the missing evidence.
|
|
283
235
|
If the assignment itself is unavailable, report that failure without another
|
|
284
236
|
state change so the manager can inspect compact status. Never invent validation,
|
|
@@ -302,6 +254,26 @@ the manager's summary. Check that:
|
|
|
302
254
|
- persistence, concurrency, security, migration, compatibility, package, UI,
|
|
303
255
|
and recovery risks were examined when relevant.
|
|
304
256
|
|
|
257
|
+
Finish the supplied feature-specific risk checklist, represented by a bounded
|
|
258
|
+
matrix for concurrency or state-machine work. Continue that matrix after finding
|
|
259
|
+
one blocker so independently detectable interleavings arrive in the same review
|
|
260
|
+
cohort.
|
|
261
|
+
|
|
262
|
+
Scope plan/source IDs by assignment kind. An ordinary feature review records
|
|
263
|
+
dispositions only for IDs mapped to the active feature or explicitly supplied
|
|
264
|
+
in its feature packet; unrelated IDs visible in approved-plan context are
|
|
265
|
+
context, not review claims. A final review traces and records dispositions for
|
|
266
|
+
every approved requirement and feature. Regardless of kind, verify every
|
|
267
|
+
still-live prior disposition against current source and evidence. Terminal \`fixed\`
|
|
268
|
+
requires this review to pass and current evidence to prove the repair. On a
|
|
269
|
+
failed verdict, preserve every prior ID: report a proven repair as
|
|
270
|
+
\`repair proven; terminal fixed pending pass\` with a concise evidence reference
|
|
271
|
+
and carry it into the next attempt. An unproven blocking repair fails under the same ID;
|
|
272
|
+
an unproven advisory repair stays advisory under that ID with its fixed claim
|
|
273
|
+
unverified. Call it \`residual\` only when current evidence confirms the nonblocker
|
|
274
|
+
remains. Escalate only when current evidence makes it outcome-blocking. A
|
|
275
|
+
confirmed blocking recurrence stays blocking under the same ID.
|
|
276
|
+
|
|
305
277
|
Use the manager-supplied baseline inventory in the assignment for Git-only
|
|
306
278
|
metadata, and independently inspect the projected changed artifacts with your
|
|
307
279
|
read-only access. It is evidence, not a verdict. Lack of shell access alone is
|
|
@@ -314,27 +286,34 @@ for the delivered state. Flow deliberately projects no raw command output; use
|
|
|
314
286
|
the durable command, exit code, completeness, digest, source binding, and your
|
|
315
287
|
workspace inspection. A weak or unclear coverage claim is an evidence gap.
|
|
316
288
|
|
|
317
|
-
For a final assignment, also
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
289
|
+
For a final assignment, also inspect broad validation and confirm docs,
|
|
290
|
+
commands, package surfaces, and remaining gaps are consistent with completion.
|
|
291
|
+
The final assignment is the feature's one review, not a second review layered
|
|
292
|
+
on top.
|
|
293
|
+
|
|
294
|
+
Start every ordinary finding summary with
|
|
295
|
+
\`finding <feature-id>.R<assignment-createdRevision>-<NN> — …\`; for example,
|
|
296
|
+
\`finding frontend-integrity.R12-01 — …\`. Reuse a prior ID for recurrence and
|
|
297
|
+
use the current assignment revision plus local sequence for a new issue, so
|
|
298
|
+
dropped history after a qualifying pass cannot cause reuse. Preserve
|
|
299
|
+
source-provided IDs in summary or evidence. Use \`severity: "blocking"\` only
|
|
300
|
+
for a concrete issue that invalidates the approved outcome; otherwise use
|
|
301
|
+
\`advisory\`. Only a blocking issue whose repair requires material work outside
|
|
302
|
+
the approved plan uses the exception grammar
|
|
303
|
+
\`[scope-blocker] finding <feature-id>.R<assignment-createdRevision>-<NN> — …\`;
|
|
304
|
+
identify the boundary in
|
|
305
|
+
\`evidence\`. The marker is forbidden on advisory findings and is the only
|
|
306
|
+
bracketed routing marker. Missing outcome evidence is an ordinary, precise
|
|
307
|
+
blocking finding, not a \`[scope-blocker]\`.
|
|
329
308
|
|
|
330
309
|
Every blocker must map to an approved requirement, changed behavior, or exact
|
|
331
310
|
missing evidence. Keep its summary precise. In \`evidence\`, cite a changed
|
|
332
311
|
artifact and location or identify the exact missing evidence or unmet approved
|
|
333
312
|
requirement.
|
|
334
313
|
|
|
335
|
-
For missing
|
|
336
|
-
scenario, command or environment, and expected observable
|
|
337
|
-
conditionally or ask the manager to proxy your verdict.
|
|
314
|
+
For proof missing from the approved outcome, fail with a precise blocker naming
|
|
315
|
+
the manager-owned scenario, command or environment, and expected observable
|
|
316
|
+
result. Do not pass conditionally or ask the manager to proxy your verdict.
|
|
338
317
|
|
|
339
318
|
## Submit one result
|
|
340
319
|
|
|
@@ -342,6 +321,18 @@ Call \`flow_feature_complete\` directly with the assignment id, current reviewer
|
|
|
342
321
|
projection revision and feature id, a fresh operation id, a concise summary,
|
|
343
322
|
and exactly one assignment result:
|
|
344
323
|
|
|
324
|
+
Keep the summary bounded. For an ordinary review, list as proven \`verified\` or
|
|
325
|
+
\`incomplete\` only plan/source IDs mapped to the active feature or explicitly
|
|
326
|
+
supplied in its feature packet; for a final review, list every approved
|
|
327
|
+
requirement/feature ID. For every still-live supplied prior-finding ID, preserve
|
|
328
|
+
its ID, report current severity and any change from the supplied severity, and
|
|
329
|
+
state confirmed \`recurring\`, confirmed \`residual\` only for a nonblocker, or that
|
|
330
|
+
its fixed claim is unverified. Only a passing result may state proven \`fixed\`. A
|
|
331
|
+
failed result carries every prior ID forward; for a proven repair use
|
|
332
|
+
\`repair proven; terminal fixed pending pass\` plus a concise evidence reference. Copy no
|
|
333
|
+
evidence prose; recurring blockers remain findings. Only IDs fixed by a passing
|
|
334
|
+
review leave the live carry-forward set.
|
|
335
|
+
|
|
345
336
|
\`\`\`json
|
|
346
337
|
{
|
|
347
338
|
"request": {
|
|
@@ -383,46 +374,40 @@ description: Implement, validate, independently review, and record one approved
|
|
|
383
374
|
|
|
384
375
|
# Flow Run
|
|
385
376
|
|
|
386
|
-
Work on exactly one approved feature.
|
|
387
|
-
integration, validation, review dispatch, reset, closure, and every
|
|
388
|
-
manager-owned lifecycle mutation. Bounded \`flow-worker\`
|
|
389
|
-
instances may contribute disjoint work; the reserved \`flow-reviewer\` owns the
|
|
390
|
-
independent review and submits its own result. Never use generic or
|
|
391
|
-
general-purpose agents for active Flow work.
|
|
377
|
+
Work on exactly one approved feature.
|
|
392
378
|
|
|
393
379
|
## Start and scope
|
|
394
380
|
|
|
395
381
|
1. Call \`flow_status { request: { view: "compact" } }\` first. Treat
|
|
396
382
|
\`nextAction\` as the durable default workflow direction, not as permission.
|
|
397
383
|
2. If the top-level response status is \`error\`, report its exact summary and
|
|
398
|
-
recovery when present
|
|
399
|
-
|
|
400
|
-
|
|
384
|
+
recovery when present and, if \`workflowData.delivery\` exists, the handoff
|
|
385
|
+
below. State this initial read made no lifecycle, Git, or release mutation;
|
|
386
|
+
stop and never route its \`nextAction\`.
|
|
401
387
|
3. If compact status contains \`archiveRetry\`, call \`flow_session_close\` once
|
|
402
|
-
with
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
work and therefore precedes goal alignment.
|
|
388
|
+
with the projected request byte-for-byte. Report delivery under the contract
|
|
389
|
+
below. Refresh only if publication is unconfirmed. Stop after this cleanup
|
|
390
|
+
outcome either way; it precedes goal alignment and grants no work.
|
|
406
391
|
4. When the projection contains an active goal, align it with the current
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
392
|
+
\`/flow-run\` request before another manager lifecycle mutation. Continue only
|
|
393
|
+
for the same goal or a method/emphasis narrowing that preserves all outcomes;
|
|
394
|
+
close completed work. Unless step 5 applies, new/expanded work makes no
|
|
395
|
+
mutation: say it has not started and offer continue, defer, or abandon. Add no
|
|
396
|
+
classifier or state.
|
|
397
|
+
5. If the aligned request explicitly chooses deferred or abandoned closure for
|
|
398
|
+
a non-completed session, call \`flow_session_close\` with compact session id and
|
|
399
|
+
revision, fresh operation id, that kind, and optional summary. Report delivery
|
|
400
|
+
under the contract below, follow a projected exact \`archiveRetry\`, and stop.
|
|
401
|
+
6. If status is \`idle\` or \`planning\`, report its projected planning action,
|
|
416
402
|
explain that \`/flow-run\` requires an approved feature, and stop without
|
|
417
403
|
mutation.
|
|
418
404
|
|
|
419
405
|
Route every compact projection in this order:
|
|
420
406
|
|
|
421
|
-
- \`flow_session_close\`: close
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
fabricate a run.
|
|
407
|
+
- \`flow_session_close\`: close completed work with its projected session
|
|
408
|
+
id/revision, fresh operation id, and \`kind: "completed"\`. Report delivery
|
|
409
|
+
under the contract below, follow one exact \`archiveRetry\` if needed, and stop.
|
|
410
|
+
New work may enter planning afterward; do not fabricate a run.
|
|
426
411
|
- \`await-user-direction\` or blocked \`flow_feature_reset\`: call
|
|
427
412
|
\`flow_status { request: { view: "detail" } }\` exactly once, then distinguish
|
|
428
413
|
the projected status:
|
|
@@ -455,86 +440,92 @@ Route every compact projection in this order:
|
|
|
455
440
|
- Any other action: report it and stop unless the runtime explicitly identifies
|
|
456
441
|
an active execution path.
|
|
457
442
|
|
|
458
|
-
Use execution status
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
443
|
+
Use execution status for active scope/revision guards. Before editing, read the
|
|
444
|
+
feature summary, targets, validation, dependencies, requirements, and decisions.
|
|
445
|
+
If a projected action fails an environment-sensitive guard, refresh compact and
|
|
446
|
+
handle that rejection; never force it.
|
|
447
|
+
|
|
448
|
+
When resuming attempt 2 or later and prior findings are not already available,
|
|
449
|
+
read detail once and recover still-live IDs from superseded attempts' latest
|
|
450
|
+
relevant failure before preflight.
|
|
451
|
+
|
|
452
|
+
Summaries keep plan/source IDs \`verified\` or \`incomplete\`. A prior finding
|
|
453
|
+
\`fixed\` needs passing review plus current evidence. A failed review carries
|
|
454
|
+
every prior ID forward: use \`terminal fixed pending pass\` plus concise evidence
|
|
455
|
+
for a proven repair, unverified-fixed for an unproven repair, \`recurring\` when
|
|
456
|
+
confirmed, or \`residual\` for a confirmed nonblocker. Blockers remain terminal.
|
|
457
|
+
Delivery handoff: goal; closure kind/summary; progress; per-feature
|
|
458
|
+
ID/title/attempts/latest state/outcome summary/terminal findings; and
|
|
459
|
+
\`reportedArtifacts.latestAttempts\` plus
|
|
460
|
+
\`reportedArtifacts.supersededAttemptsOnly\`, qualified as Flow-reported
|
|
461
|
+
caller-declared artifacts, not an exact/exhaustive Git delta. Map IDs only from
|
|
462
|
+
delivery \`outcomeSummary\`/\`terminalFindings\`; requirements are \`verified\`,
|
|
463
|
+
\`incomplete\`, or explicitly \`deferred\`, and \`abandoned\` remains the kind.
|
|
464
|
+
If delivery is absent, report exact recovery and no map; never invent or read
|
|
465
|
+
detail solely for closure. On revision conflict, refresh compact; retry only for
|
|
466
|
+
the same session and goal while status still permits the selected closure kind;
|
|
467
|
+
never close a replacement.
|
|
468
|
+
|
|
469
|
+
Preserve unrelated work and stay inside the feature. Out-of-plan work stops;
|
|
470
|
+
finish or obtain explicit deferred/abandoned closure before a new plan. Never
|
|
471
|
+
replan in place. Use \`flow_feature_reset\` for a wrong design or assumption; do
|
|
472
|
+
not layer retries.
|
|
471
473
|
|
|
472
474
|
## Evidence and risk preflight
|
|
473
475
|
|
|
474
476
|
Before editing or dispatching a worker, perform one preflight from the approved
|
|
475
477
|
feature and current worktree:
|
|
476
478
|
|
|
477
|
-
- Preserve every named finding
|
|
478
|
-
|
|
479
|
-
- Inventory exact commands
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
-
|
|
483
|
-
types, and executable modes.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
479
|
+
- Preserve every named finding/requirement and still-live prior review ID; map
|
|
480
|
+
each to an observable acceptance outcome.
|
|
481
|
+
- Inventory exact commands, behavior evidence, required operating system,
|
|
482
|
+
architecture, service, credential, external setting, or hardware, and an
|
|
483
|
+
authorized path for each.
|
|
484
|
+
- Reuse one conversational run baseline of unrelated work, deletions, renames,
|
|
485
|
+
file types, and executable modes. Refresh changed facts; give each review only
|
|
486
|
+
facts the feature changes or depends on, and give final review the full
|
|
487
|
+
inventory.
|
|
488
|
+
- Write one concise adversarial checklist covering failure and cleanup ordering,
|
|
489
|
+
adjacent states, repetition, retry, interruption, concurrency, overlapping
|
|
490
|
+
invariants, and relevant platform or persistence risks. For concurrency or
|
|
491
|
+
state-machine work, express it as a compact matrix with \`state/interleaving\`,
|
|
492
|
+
\`event\`, \`expected outcome\`, \`cleanup/invariant\`, and \`evidence\` columns.
|
|
493
|
+
|
|
494
|
+
Carry the checklist/IDs through workers and review; on retry preserve still-live
|
|
495
|
+
prior IDs/dispositions. Required evidence needing user or external authority
|
|
496
|
+
stops before implementation. If skipped or unavailable, it forbids
|
|
497
|
+
\`flow_review_start\`; a substitute pass cannot cure it. Flow persists no
|
|
498
|
+
skipped-evidence ledger; the reviewer blocks the gap.
|
|
495
499
|
|
|
496
500
|
## Implement
|
|
497
501
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
+
Make the smallest change satisfying the approved outcome and repository
|
|
503
|
+
boundaries. Create no lifecycle, validation, audit, or handoff sidecars. A
|
|
504
|
+
durable user-requested report is normally one stable Markdown artifact; JSON
|
|
505
|
+
requires an explicit request.
|
|
502
506
|
|
|
503
|
-
Do not stage, commit, push, publish, or mutate releases unless
|
|
504
|
-
that separate action.
|
|
507
|
+
Do not stage, commit, push, publish, or mutate releases unless asked separately.
|
|
505
508
|
|
|
506
509
|
## Bounded worker waves
|
|
507
510
|
|
|
508
|
-
Work serially by default
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
recommended manager checks, gaps and risks, and integration notes. Workers do
|
|
527
|
-
not run Bash; all executable checks remain manager-owned. Missing, partial, or
|
|
528
|
-
blocked output remains an explicit coverage gap.
|
|
529
|
-
|
|
530
|
-
After all workers stop, compare actual changed paths with every assigned scope,
|
|
531
|
-
then inspect the combined diff and evidence and reconcile unexpected paths or
|
|
532
|
-
conflicts before validation. At most one targeted follow-up wave may address a
|
|
533
|
-
failed slice, newly unlocked dependency, or material claim verification. Do
|
|
534
|
-
not start an automatic third wave. Coordination stays in the conversation:
|
|
535
|
-
create no manifest, sidecar, Session field, durable handoff, or recovery ledger.
|
|
536
|
-
After an interruption, inspect Flow status and the worktree and treat partial
|
|
537
|
-
worker edits as untrusted.
|
|
511
|
+
Work serially by default; existing authority covers a qualifying worker wave.
|
|
512
|
+
After manager orientation, fan out only two or three genuinely independent,
|
|
513
|
+
non-overlapping slices with clear benefit. Issue one cohort's Task calls in the
|
|
514
|
+
same assistant tool-use turn; report host serialization as serial. Each
|
|
515
|
+
assignment names a stable id, exact outcome/read-write scope, coverage, manager
|
|
516
|
+
checks, dependencies, stop condition, and preflight risk checklist. The worker
|
|
517
|
+
must receive the checklist before it codes. Shared contracts, lockfiles, and generated
|
|
518
|
+
output stay manager-owned unless wholly assigned to one worker.
|
|
519
|
+
|
|
520
|
+
Workers call no Flow tools, spawn no children, and run no Bash. Each returns
|
|
521
|
+
status, scope/coverage, evidence/changed paths, manager checks, gaps/risks, and
|
|
522
|
+
integration notes; missing or blocked output is a coverage gap.
|
|
523
|
+
|
|
524
|
+
After workers stop, reconcile paths/scopes and inspect combined diff/evidence
|
|
525
|
+
before validation. At most one targeted follow-up wave may repair a slice,
|
|
526
|
+
unlock a dependency, or verify a material claim; never a third. Create no
|
|
527
|
+
coordination ledger/sidecar. After interruption, inspect status/worktree and
|
|
528
|
+
treat partial worker edits as untrusted.
|
|
538
529
|
|
|
539
530
|
## Validate
|
|
540
531
|
|
|
@@ -552,15 +543,13 @@ checks from the changed behavior and risk:
|
|
|
552
543
|
for the repository's canonical applicable gate or a justified equivalent
|
|
553
544
|
that covers the delivered repository state.
|
|
554
545
|
|
|
555
|
-
Immediately before each Bash command
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
durable evidence is the command, exit code, output completeness, and output
|
|
563
|
-
digest, while the manager must inspect the live output.
|
|
546
|
+
Immediately before each evidence Bash command, call \`flow_validation_start\`
|
|
547
|
+
with current revision, feature id, exact command, and \`scope\` (\`focused\` or
|
|
548
|
+
\`broad\`). Run it byte-for-byte next and inspect the complete outcome. Flow
|
|
549
|
+
records the host observation; copy no host-observed fields into a later request.
|
|
550
|
+
The command is durable, so include no secrets. Raw output is neither persisted
|
|
551
|
+
nor projected: durable evidence is command, exit code, completeness, and digest;
|
|
552
|
+
the manager inspects live output.
|
|
564
553
|
|
|
565
554
|
Exact plan-listed gate commands are recorded byte-for-byte.
|
|
566
555
|
A failed, incomplete, or source-drifted exact plan-listed observation creates a
|
|
@@ -609,26 +598,29 @@ changed no repository artifact. Flow selects current applicable validation
|
|
|
609
598
|
automatically and derives \`feature\` versus \`final\` review from plan progress;
|
|
610
599
|
callers do not supply the review kind.
|
|
611
600
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
601
|
+
Keep the packet bounded. Map IDs to current-source commands or scenarios,
|
|
602
|
+
environment, and results. Put the feature-specific risk checklist under
|
|
603
|
+
\`Risks/Matrix:\`, representing it as a transition matrix for concurrency or
|
|
604
|
+
state-machine work. Include \`Baseline:\` facts only when this feature changes or
|
|
605
|
+
depends on them, except that final review receives the full inventory. Under
|
|
606
|
+
\`Prior findings:\`, preserve each still-live prior ID's original severity and
|
|
607
|
+
current \`terminal fixed pending pass\`, \`recurring\`, \`residual\`, or
|
|
608
|
+
unverified-fixed state. Ordinary-review plan/source IDs are limited to
|
|
609
|
+
active-feature mappings or IDs explicitly supplied for its packet; final review
|
|
610
|
+
includes every approved requirement/feature ID. Always carry still-live prior
|
|
611
|
+
findings. Omit empty optional sections; state \`none\` only for a relevant
|
|
612
|
+
inspected absence. Never hide a gap.
|
|
613
|
+
|
|
614
|
+
Dispatch only to reserved \`flow-reviewer\`; never review, copy, or submit its
|
|
615
|
+
verdict in manager context. It reads the assignment/workspace and calls
|
|
616
|
+
\`flow_feature_complete\` directly; runtime verifies the caller. It stays
|
|
617
|
+
workspace-read-only, with that result submission as its sole lifecycle mutation.
|
|
618
|
+
|
|
619
|
+
After dispatch, read compact status. On top-level error, report exact
|
|
620
|
+
summary/recovery, say the latest lifecycle state could not be confirmed, and
|
|
621
|
+
stop without further mutation. Do not claim this invocation made no lifecycle
|
|
622
|
+
mutation: review may have started or recorded a result. Never invent or submit a
|
|
623
|
+
verdict. If status remains running, apply the
|
|
632
624
|
\`dispatch-flow-reviewer\` or running \`flow_feature_reset\` route above. If status
|
|
633
625
|
is blocked, load detail through the single blocked route above. A recorded pass
|
|
634
626
|
completes the feature.
|
|
@@ -638,10 +630,11 @@ completes the feature.
|
|
|
638
630
|
Use compact \`blockedFeature.failedReviewCount\` with the one detail projection.
|
|
639
631
|
|
|
640
632
|
- A \`[scope-blocker]\` checkpoints immediately. Do not reset automatically.
|
|
641
|
-
-
|
|
642
|
-
permits one automatic \`flow_feature_reset\`
|
|
643
|
-
\`nextFeatureId\`. That call atomically starts
|
|
644
|
-
blocking findings, then run full validation
|
|
633
|
+
- Only when \`failedReviewCount === 1\` and there is no \`[scope-blocker]\`,
|
|
634
|
+
existing implementation authority permits one automatic \`flow_feature_reset\`
|
|
635
|
+
with the blocked \`featureId\` as \`nextFeatureId\`. That call atomically starts
|
|
636
|
+
the fresh full retry. Fix only its blocking findings, then run full validation
|
|
637
|
+
and full independent review.
|
|
645
638
|
- A feature whose latest relevant reviewed outcome remains failed is never
|
|
646
639
|
selected implicitly. \`/flow-auto\` may still continue an untouched,
|
|
647
640
|
dependency-independent feature. When every runnable candidate requires a
|
|
@@ -649,7 +642,7 @@ Use compact \`blockedFeature.failedReviewCount\` with the one detail projection.
|
|
|
649
642
|
has already been superseded: after explicit direction, read detail once and
|
|
650
643
|
call \`flow_run_start\` with the exact retry feature ID. Do not reset from that
|
|
651
644
|
ready checkpoint.
|
|
652
|
-
-
|
|
645
|
+
- When \`failedReviewCount >= 2\`, retry only when the current aligned request
|
|
653
646
|
explicitly authorizes one additional attempt. Pass the blocked feature as
|
|
654
647
|
\`nextFeatureId\` on \`flow_feature_reset\`; if that attempt fails, checkpoint
|
|
655
648
|
again.
|
|
@@ -659,13 +652,12 @@ Use compact \`blockedFeature.failedReviewCount\` with the one detail projection.
|
|
|
659
652
|
attempts and starts that exact run in one transaction. Do not reset first,
|
|
660
653
|
call \`flow_run_start\` separately, or rely on default selection.
|
|
661
654
|
|
|
662
|
-
When stopping blocked, label
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
requires explicit authorization.
|
|
655
|
+
When stopping blocked, label overall incomplete. Report the latest repair proved
|
|
656
|
+
pending a passing review; recurring and new blockers; goal/progress; blocked
|
|
657
|
+
feature, attempt, and failure count; completed/untouched features; latest
|
|
658
|
+
validations and \`artifactsChanged\` as Flow-reported artifact evidence; Git/release
|
|
659
|
+
mutation status; whether this request started and matched the goal; exact
|
|
660
|
+
\`nextAction\`; and whether another attempt requires explicit authorization.
|
|
669
661
|
|
|
670
662
|
Use that already-loaded compact status after every recorded outcome. Direct
|
|
671
663
|
\`/flow-run\` reports this one feature's cumulative outcome and \`nextAction\`, then
|
|
@@ -682,10 +674,38 @@ var FLOW_GUIDANCE_TOPICS = [
|
|
|
682
674
|
var FLOW_GUIDANCE_IDS = FLOW_GUIDANCE_TOPICS;
|
|
683
675
|
|
|
684
676
|
// src/guidance/catalog.ts
|
|
677
|
+
var FLOW_MANAGER_KERNEL = [
|
|
678
|
+
"## Flow manager kernel",
|
|
679
|
+
"",
|
|
680
|
+
[
|
|
681
|
+
"- The root manager owns manager lifecycle mutations, integration, validation, and review dispatch;",
|
|
682
|
+
"the independent reviewer submits only its own result."
|
|
683
|
+
].join(" "),
|
|
684
|
+
[
|
|
685
|
+
"- Delegate active Flow work only to `flow-worker` and independent review only to `flow-reviewer`;",
|
|
686
|
+
"never use generic or general-purpose agents."
|
|
687
|
+
].join(" "),
|
|
688
|
+
[
|
|
689
|
+
"- Make one automatic fresh full retry only when `failedReviewCount === 1`",
|
|
690
|
+
"and no `[scope-blocker]` is present; otherwise checkpoint."
|
|
691
|
+
].join(" "),
|
|
692
|
+
[
|
|
693
|
+
"- Before review, require current-source evidence appropriate to the changed outcome,",
|
|
694
|
+
"including behavior evidence when behavior changes, plus relevant base-diff, deletion,",
|
|
695
|
+
"rename, file-type, and executable-mode facts."
|
|
696
|
+
].join(" ")
|
|
697
|
+
].join(`
|
|
698
|
+
`);
|
|
685
699
|
var GUIDANCE_CONTENT = {
|
|
686
|
-
flow: SKILL_default
|
|
700
|
+
flow: `${SKILL_default.trimEnd()}
|
|
701
|
+
|
|
702
|
+
${FLOW_MANAGER_KERNEL}
|
|
703
|
+
`,
|
|
687
704
|
"flow-plan": SKILL_default2,
|
|
688
|
-
"flow-run": SKILL_default4
|
|
705
|
+
"flow-run": `${SKILL_default4.trimEnd()}
|
|
706
|
+
|
|
707
|
+
${FLOW_MANAGER_KERNEL}
|
|
708
|
+
`,
|
|
689
709
|
"flow-review": SKILL_default3
|
|
690
710
|
};
|
|
691
711
|
var FLOW_GUIDANCE_DOCUMENTS = FLOW_GUIDANCE_TOPICS.map((name) => ({
|
|
@@ -706,47 +726,99 @@ if (FLOW_GUIDANCE_BY_ID.size !== FLOW_GUIDANCE_IDS.length) {
|
|
|
706
726
|
}
|
|
707
727
|
|
|
708
728
|
// src/prompt-surfaces.ts
|
|
709
|
-
var FLOW_WORKER_PROMPT =
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
## Scope and authority
|
|
716
|
-
|
|
717
|
-
- Use the manager assignment as your only source of Flow lifecycle context.
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
- Do not
|
|
721
|
-
-
|
|
722
|
-
-
|
|
723
|
-
-
|
|
724
|
-
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
729
|
+
var FLOW_WORKER_PROMPT = [
|
|
730
|
+
"# Flow bounded worker",
|
|
731
|
+
[
|
|
732
|
+
"You are one hidden Flow worker supporting the root manager inside one active feature.",
|
|
733
|
+
"Own only the assigned slice, preserve unrelated work, and do not broaden it or enter a sibling's scope."
|
|
734
|
+
].join(" "),
|
|
735
|
+
"## Scope and authority",
|
|
736
|
+
[
|
|
737
|
+
"- Use the manager assignment as your only source of Flow lifecycle context.",
|
|
738
|
+
"Do not call any `flow_*` tool, including `flow_status`."
|
|
739
|
+
].join(" "),
|
|
740
|
+
"- Do not delegate, spawn subtasks, or load skills.",
|
|
741
|
+
"- Do not stage, commit, push, publish, or create a release.",
|
|
742
|
+
"- Do not run Bash commands. The manager owns every executable check.",
|
|
743
|
+
"- Never edit .flow or .git metadata paths; the host denies those paths.",
|
|
744
|
+
"- A read-only evidence slice must not edit files.",
|
|
745
|
+
[
|
|
746
|
+
"- The assignment must include an adversarial acceptance and risk checklist,",
|
|
747
|
+
"represented as a transition matrix for concurrency or state-machine work, prepared before coding.",
|
|
748
|
+
"If it is missing, stop without editing and report the gap."
|
|
749
|
+
].join(" "),
|
|
750
|
+
[
|
|
751
|
+
"- An implementation slice may edit only the exact, non-overlapping write paths explicitly assigned by the manager.",
|
|
752
|
+
"If required work would escape those paths, stop and return a partial or blocked handoff",
|
|
753
|
+
"instead of expanding scope."
|
|
754
|
+
].join(" "),
|
|
755
|
+
[
|
|
756
|
+
"- The manager owns integration, focused checks, and authoritative combined validation",
|
|
757
|
+
"after all workers have stopped."
|
|
758
|
+
].join(" "),
|
|
759
|
+
[
|
|
760
|
+
"Before editing, apply the supplied risk coverage through its matrix rows when present:",
|
|
761
|
+
"primary behavior, failure and cleanup ordering, adjacent state transitions,",
|
|
762
|
+
"repeated or interrupted operation, overlapping invariants, and relevant persistence,",
|
|
763
|
+
"concurrency, security, compatibility, or file-metadata risks.",
|
|
764
|
+
"Preserve every named finding, requirement, or prior review ID in your handoff."
|
|
765
|
+
].join(" "),
|
|
766
|
+
"## Handoff",
|
|
767
|
+
[
|
|
768
|
+
"Return exactly one concise handoff with `Status` (success, partial, or blocked),",
|
|
769
|
+
"`Scope & coverage`, `Findings / changed paths`, `Recommended manager checks`,",
|
|
770
|
+
"`Gaps & risks`, and `Integration notes`."
|
|
771
|
+
].join(" ")
|
|
772
|
+
].join(`
|
|
773
|
+
`);
|
|
774
|
+
var FLOW_STATUS_PROMPT = [
|
|
775
|
+
'Call `flow_status { request: { view: "compact" } }` first.',
|
|
776
|
+
"Do not mutate.",
|
|
777
|
+
"If the top-level response status is `error`, report its exact summary and",
|
|
778
|
+
"`workflowData.failure.recovery` when present; otherwise say no recovery guidance was supplied.",
|
|
779
|
+
"When `workflowData.delivery` is present, also report its goal; closure kind and summary;",
|
|
780
|
+
"progress; for every feature, `id`, `title`, `attempts`, `latestState`, `outcomeSummary`,",
|
|
781
|
+
"and `terminalFindings`; and `reportedArtifacts.latestAttempts` plus",
|
|
782
|
+
"`reportedArtifacts.supersededAttemptsOnly`, qualified as Flow-reported caller-declared artifacts,",
|
|
783
|
+
"not an exact or exhaustive Git delta.",
|
|
784
|
+
"For the terminal ID map use only `outcomeSummary` and `terminalFindings`: IDs are `verified`",
|
|
785
|
+
"only when proven, otherwise `incomplete` or explicitly `deferred`; `fixed` needs later passing",
|
|
786
|
+
"review plus current evidence, `recurring` current confirmation, `residual` a confirmed nonblocker,",
|
|
787
|
+
"and `abandoned` remains the closure kind.",
|
|
788
|
+
"Missing IDs are unavailable.",
|
|
789
|
+
"State that `/flow-status` made no Git or release mutation, report any lifecycle state effect",
|
|
790
|
+
"disclosed by the response, and stop.",
|
|
791
|
+
"Do not interpret recovery guidance as a blocked review.",
|
|
792
|
+
"If `projection.status` is `blocked` or `projection.nextAction` is `await-user-direction`,",
|
|
793
|
+
'call `flow_status { request: { view: "detail" } }` exactly once and label the result overall incomplete.',
|
|
794
|
+
"From that detail projection, report the goal and progress; any blocked feature, attempt,",
|
|
795
|
+
"`failedReviewCount`, and findings; every retry-required feature whose latest relevant reviewed",
|
|
796
|
+
"outcome remains failed; completed and untouched features; validations and `artifactsChanged`",
|
|
797
|
+
"as Flow-reported artifact evidence; and the exact status and `nextAction`.",
|
|
798
|
+
"For a blocked first failed review, explain that `flow_feature_reset` is only the default and",
|
|
799
|
+
"`/flow-run` must inspect any `[scope-blocker]` before reset.",
|
|
800
|
+
"For blocked `await-user-direction`, explain that an authorized retry or independent choice",
|
|
801
|
+
"uses atomic `flow_feature_reset` with `nextFeatureId`.",
|
|
802
|
+
"For ready `await-user-direction`, explain that no blocked run remains, so an authorized retry",
|
|
803
|
+
"uses `flow_run_start` with an explicit `featureId`, never reset or default selection.",
|
|
804
|
+
"When `workflowData.autoTiming` is present, report `activeMs` as non-authoritative process-local",
|
|
805
|
+
"wall time classified active, not CPU or pure work, and `waitingForUserMs` as only projected",
|
|
806
|
+
"`flow_plan_approve` plus `await-user-direction` time for the latest `/flow-auto`.",
|
|
807
|
+
"State that paused, inactive, errored, and unprojected waits are excluded.",
|
|
808
|
+
"Otherwise report the compact projection and its exact `nextAction`, state that `/flow-status`",
|
|
809
|
+
"made no lifecycle, Git, or release mutation, and stop."
|
|
810
|
+
].join(" ");
|
|
811
|
+
var FLOW_REVIEW_PROMPT = [
|
|
812
|
+
"# Flow review command",
|
|
813
|
+
[
|
|
814
|
+
"Run this assignment only as the reserved `flow-reviewer`.",
|
|
815
|
+
"The reviewer is independent and workspace-read-only; it may read reviewer status",
|
|
816
|
+
"and submit only its own result through `flow_feature_complete`."
|
|
817
|
+
].join(" "),
|
|
818
|
+
"Assignment: $ARGUMENTS"
|
|
819
|
+
].join(`
|
|
747
820
|
|
|
748
|
-
|
|
749
|
-
- What the manager must verify or integrate, or none`;
|
|
821
|
+
`);
|
|
750
822
|
function skillBody(id) {
|
|
751
823
|
return getFlowGuidance(id).content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trim();
|
|
752
824
|
}
|
|
@@ -779,26 +851,9 @@ function compileFlowPromptSurface(surface) {
|
|
|
779
851
|
case "flow-run":
|
|
780
852
|
return managerCommand(surface);
|
|
781
853
|
case "flow-status":
|
|
782
|
-
return
|
|
783
|
-
'Call `flow_status { request: { view: "compact" } }` first.',
|
|
784
|
-
"Do not mutate.",
|
|
785
|
-
"If the top-level response status is `error`, report its exact summary and `workflowData.failure.recovery` when present; otherwise say no recovery guidance was supplied. State that `/flow-status` made no Git or release mutation, report any lifecycle state effect disclosed by the response, and stop. Do not interpret recovery guidance as a blocked review.",
|
|
786
|
-
'If `projection.status` is `blocked` or `projection.nextAction` is `await-user-direction`, call `flow_status { request: { view: "detail" } }` exactly once and label the result overall incomplete.',
|
|
787
|
-
"From that detail projection, report the goal and progress; any blocked feature, attempt, `failedReviewCount`, and findings; every retry-required feature whose latest relevant reviewed outcome remains failed; completed and untouched features; validations and `artifactsChanged` as Flow-reported artifact evidence; and the exact status and `nextAction`.",
|
|
788
|
-
"For a blocked first failed review, explain that `flow_feature_reset` is only the default and `/flow-run` must inspect any `[scope-blocker]` before reset.",
|
|
789
|
-
"For blocked `await-user-direction`, explain that an authorized retry or independent choice uses atomic `flow_feature_reset` with `nextFeatureId`. For ready `await-user-direction`, explain that no blocked run remains, so an authorized retry uses `flow_run_start` with an explicit `featureId`, never reset or default selection.",
|
|
790
|
-
"When `workflowData.autoTiming` is present, report `activeMs` as non-authoritative process-local wall time classified active, not CPU or pure work, and `waitingForUserMs` as only projected `flow_plan_approve` plus `await-user-direction` time for the latest `/flow-auto`. State that paused, inactive, errored, and unprojected waits are excluded.",
|
|
791
|
-
"Otherwise report the compact projection and its exact `nextAction`, state that `/flow-status` made no lifecycle, Git, or release mutation, and stop."
|
|
792
|
-
].join(" ");
|
|
854
|
+
return FLOW_STATUS_PROMPT;
|
|
793
855
|
case "flow-review":
|
|
794
|
-
return
|
|
795
|
-
"# Flow review command",
|
|
796
|
-
"",
|
|
797
|
-
"Run this assignment only as the reserved `flow-reviewer`. The reviewer is independent and workspace-read-only; it may read reviewer status and submit only its own result through `flow_feature_complete`.",
|
|
798
|
-
"",
|
|
799
|
-
"Assignment: $ARGUMENTS"
|
|
800
|
-
].join(`
|
|
801
|
-
`);
|
|
856
|
+
return FLOW_REVIEW_PROMPT;
|
|
802
857
|
case "flow-reviewer":
|
|
803
858
|
return skillBody("flow-review");
|
|
804
859
|
case "flow-worker":
|
|
@@ -3479,20 +3534,37 @@ function resolveFlowPluginVersion() {
|
|
|
3479
3534
|
|
|
3480
3535
|
// src/platform/opencode/auto-drive.ts
|
|
3481
3536
|
var FLOW_AUTO_METADATA_KEY = "opencode-plugin-flow/auto";
|
|
3482
|
-
|
|
3537
|
+
var STOP = /^(?:(?:stop|cancel) \/flow-auto|\/flow-auto (?:stop|cancel))$/i;
|
|
3538
|
+
var CONTINUATION_ROUTE = [
|
|
3539
|
+
"Load flow-run guidance before any feature or closure route;",
|
|
3540
|
+
"for a fresh close use compact session id/revision plus a fresh operation id,",
|
|
3541
|
+
"and replay archiveRetry exactly from its projected request."
|
|
3542
|
+
].join(" ");
|
|
3543
|
+
function inspectMessage(parts) {
|
|
3544
|
+
let token = null;
|
|
3545
|
+
let text = "";
|
|
3546
|
+
let user = false;
|
|
3483
3547
|
for (const part of parts) {
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3548
|
+
if (part.synthetic === true) {
|
|
3549
|
+
const value = part.metadata?.[FLOW_AUTO_METADATA_KEY];
|
|
3550
|
+
if (typeof value === "string")
|
|
3551
|
+
token = value;
|
|
3552
|
+
} else {
|
|
3553
|
+
user = true;
|
|
3554
|
+
text += ` ${part.text ?? ""}`;
|
|
3555
|
+
}
|
|
3487
3556
|
}
|
|
3488
|
-
return
|
|
3557
|
+
return { token, user, text: text.trim().replace(/\s+/g, " ") };
|
|
3489
3558
|
}
|
|
3490
3559
|
function isMechanical(projection) {
|
|
3491
|
-
return projection.status === "ready"
|
|
3560
|
+
return projection.nextAction === "flow_run_start" ? projection.status === "ready" : projection.nextAction === "flow_session_close" && (projection.status === "completed" || projection.status === "closed");
|
|
3492
3561
|
}
|
|
3493
3562
|
function isCheckpoint(projection) {
|
|
3494
3563
|
return ["flow_plan_approve", "await-user-direction"].includes(projection.nextAction ?? "");
|
|
3495
3564
|
}
|
|
3565
|
+
function isPendingReviewer(projection) {
|
|
3566
|
+
return projection.status === "running" && projection.nextAction === "dispatch-flow-reviewer";
|
|
3567
|
+
}
|
|
3496
3568
|
|
|
3497
3569
|
class AutoDriveCoordinator {
|
|
3498
3570
|
#lease = null;
|
|
@@ -3525,16 +3597,26 @@ class AutoDriveCoordinator {
|
|
|
3525
3597
|
#stop(lease, warning) {
|
|
3526
3598
|
if (this.#lease !== lease)
|
|
3527
3599
|
return;
|
|
3528
|
-
this
|
|
3529
|
-
this.#setTiming("inactive");
|
|
3600
|
+
this.deactivate(lease.hostSessionId);
|
|
3530
3601
|
if (warning)
|
|
3531
3602
|
this.#warn(warning);
|
|
3532
3603
|
}
|
|
3604
|
+
#rejectOrigin(lease, kind) {
|
|
3605
|
+
this.#stop(lease, `Flow: ${kind} origin was unavailable.`);
|
|
3606
|
+
}
|
|
3607
|
+
#waitAt(lease, revision) {
|
|
3608
|
+
const current = lease.checkpoint;
|
|
3609
|
+
lease.checkpoint = current?.revision === revision ? current : { revision, answered: false };
|
|
3610
|
+
lease.checkpoint.answered = false;
|
|
3611
|
+
lease.messageId = null;
|
|
3612
|
+
lease.lastPromptedRevision = null;
|
|
3613
|
+
this.#setTiming("waiting-for-user");
|
|
3614
|
+
}
|
|
3533
3615
|
async#read(lease) {
|
|
3534
3616
|
try {
|
|
3535
3617
|
return await this.#options.readProjection();
|
|
3536
3618
|
} catch (error) {
|
|
3537
|
-
this.#stop(lease, `Flow auto
|
|
3619
|
+
this.#stop(lease, `Flow auto status failed: ${String(error)}`);
|
|
3538
3620
|
return null;
|
|
3539
3621
|
}
|
|
3540
3622
|
}
|
|
@@ -3550,12 +3632,16 @@ class AutoDriveCoordinator {
|
|
|
3550
3632
|
hostSessionId,
|
|
3551
3633
|
token,
|
|
3552
3634
|
baseline: null,
|
|
3553
|
-
flowSessionId: null,
|
|
3554
3635
|
delivery: null,
|
|
3555
3636
|
lastPromptedRevision: null,
|
|
3556
3637
|
checkpoint: null,
|
|
3557
|
-
pendingReply:
|
|
3558
|
-
inFlight: null
|
|
3638
|
+
pendingReply: false,
|
|
3639
|
+
inFlight: null,
|
|
3640
|
+
idlePending: false,
|
|
3641
|
+
messageId: null,
|
|
3642
|
+
assistantParents: new Map,
|
|
3643
|
+
lastAssistantParent: null,
|
|
3644
|
+
compaction: null
|
|
3559
3645
|
};
|
|
3560
3646
|
const lease = this.#lease;
|
|
3561
3647
|
const baseline = await this.#read(lease);
|
|
@@ -3563,15 +3649,15 @@ class AutoDriveCoordinator {
|
|
|
3563
3649
|
throw new Error("Flow auto-drive compact status failed.");
|
|
3564
3650
|
lease.baseline = baseline;
|
|
3565
3651
|
if (this.#lease !== lease)
|
|
3566
|
-
throw new Error("Flow auto-drive
|
|
3567
|
-
|
|
3652
|
+
throw new Error("Flow auto-drive superseded.");
|
|
3653
|
+
if (!isPendingReviewer(baseline))
|
|
3654
|
+
lease.checkpoint = { revision: baseline.revision, answered: false };
|
|
3568
3655
|
return { [FLOW_AUTO_METADATA_KEY]: token };
|
|
3569
3656
|
}
|
|
3570
3657
|
deactivate(hostSessionId) {
|
|
3571
3658
|
if (this.#lease?.hostSessionId !== hostSessionId)
|
|
3572
3659
|
return false;
|
|
3573
|
-
this
|
|
3574
|
-
this.#setTiming("inactive");
|
|
3660
|
+
this.clear();
|
|
3575
3661
|
return true;
|
|
3576
3662
|
}
|
|
3577
3663
|
clear() {
|
|
@@ -3579,38 +3665,115 @@ class AutoDriveCoordinator {
|
|
|
3579
3665
|
this.#setTiming("inactive");
|
|
3580
3666
|
this.#lease = null;
|
|
3581
3667
|
}
|
|
3582
|
-
async observeMessage(hostSessionId, delivery, parts) {
|
|
3668
|
+
async observeMessage(hostSessionId, delivery, parts, messageId) {
|
|
3583
3669
|
const lease = this.#lease;
|
|
3584
|
-
const
|
|
3585
|
-
if (
|
|
3586
|
-
|
|
3670
|
+
const message = inspectMessage(parts);
|
|
3671
|
+
if (lease?.hostSessionId === hostSessionId && STOP.test(message.text)) {
|
|
3672
|
+
this.deactivate(hostSessionId);
|
|
3673
|
+
return "accepted";
|
|
3674
|
+
}
|
|
3675
|
+
if (message.token !== null) {
|
|
3676
|
+
if (!lease || lease.hostSessionId !== hostSessionId || lease.token !== message.token)
|
|
3587
3677
|
return "stale-continuation";
|
|
3588
|
-
}
|
|
3589
3678
|
lease.delivery = delivery;
|
|
3679
|
+
lease.messageId = messageId;
|
|
3680
|
+
if (!lease.checkpoint && lease.lastPromptedRevision !== null)
|
|
3681
|
+
lease.checkpoint = {
|
|
3682
|
+
revision: lease.lastPromptedRevision,
|
|
3683
|
+
answered: false
|
|
3684
|
+
};
|
|
3590
3685
|
this.#setTiming("active");
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3686
|
+
return "accepted";
|
|
3687
|
+
}
|
|
3688
|
+
if (lease?.hostSessionId !== hostSessionId || !message.user)
|
|
3689
|
+
return "accepted";
|
|
3690
|
+
if (lease.checkpoint?.answered || lease.pendingReply) {
|
|
3691
|
+
this.deactivate(hostSessionId);
|
|
3692
|
+
return "accepted";
|
|
3693
|
+
}
|
|
3694
|
+
if (lease.checkpoint)
|
|
3695
|
+
delete lease.checkpoint.advance;
|
|
3696
|
+
if (!lease.checkpoint && lease.inFlight !== "status")
|
|
3697
|
+
this.deactivate(hostSessionId);
|
|
3698
|
+
else {
|
|
3699
|
+
lease.messageId = messageId;
|
|
3700
|
+
lease.delivery = delivery;
|
|
3701
|
+
lease.pendingReply = true;
|
|
3702
|
+
if (!lease.inFlight)
|
|
3703
|
+
await this.onIdle(hostSessionId);
|
|
3609
3704
|
}
|
|
3610
3705
|
return "accepted";
|
|
3611
3706
|
}
|
|
3612
3707
|
compactionContext(hostSessionId) {
|
|
3613
|
-
|
|
3708
|
+
if (this.#lease?.hostSessionId !== hostSessionId)
|
|
3709
|
+
return null;
|
|
3710
|
+
const context = [
|
|
3711
|
+
"An in-memory /flow-auto continuation remains active.",
|
|
3712
|
+
"Read compact Flow state first.",
|
|
3713
|
+
CONTINUATION_ROUTE,
|
|
3714
|
+
"Do not expand the approved goal; stop for required user direction, a hard blocker, or confirmed closure."
|
|
3715
|
+
].join(" ");
|
|
3716
|
+
return `${context}
|
|
3717
|
+
|
|
3718
|
+
${FLOW_MANAGER_KERNEL}`;
|
|
3719
|
+
}
|
|
3720
|
+
observeHostMessage(host, message) {
|
|
3721
|
+
const lease = this.#lease;
|
|
3722
|
+
if (lease?.hostSessionId !== host)
|
|
3723
|
+
return;
|
|
3724
|
+
if (message.role === "assistant" && message.parentID !== undefined) {
|
|
3725
|
+
lease.assistantParents.set(message.id, message.parentID);
|
|
3726
|
+
if (message.summary !== true) {
|
|
3727
|
+
lease.lastAssistantParent = message.parentID;
|
|
3728
|
+
if (lease.compaction)
|
|
3729
|
+
lease.compaction = null;
|
|
3730
|
+
} else if (lease.compaction) {
|
|
3731
|
+
if (message.parentID === lease.compaction.user && lease.messageId === lease.compaction.authority)
|
|
3732
|
+
lease.compaction.summary = message.id;
|
|
3733
|
+
else
|
|
3734
|
+
lease.compaction = null;
|
|
3735
|
+
}
|
|
3736
|
+
} else if (message.role === "user" && lease.compaction) {
|
|
3737
|
+
const compaction = lease.compaction;
|
|
3738
|
+
if (compaction.summary && (!compaction.successor || compaction.successor === message.id))
|
|
3739
|
+
compaction.successor = message.id;
|
|
3740
|
+
else
|
|
3741
|
+
lease.compaction = null;
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
observeHostPart(host, part) {
|
|
3745
|
+
const lease = this.#lease;
|
|
3746
|
+
if (lease?.hostSessionId !== host || part.type !== "compaction" || part.auto !== true)
|
|
3747
|
+
return;
|
|
3748
|
+
lease.compaction = lease.lastAssistantParent && lease.lastAssistantParent === lease.messageId ? { authority: lease.lastAssistantParent, user: part.messageID } : null;
|
|
3749
|
+
}
|
|
3750
|
+
observeCompaction(host) {
|
|
3751
|
+
const lease = this.#lease;
|
|
3752
|
+
if (lease?.hostSessionId !== host || lease.messageId === null)
|
|
3753
|
+
return;
|
|
3754
|
+
const compaction = lease.compaction;
|
|
3755
|
+
lease.compaction = null;
|
|
3756
|
+
if (!compaction?.successor || lease.messageId !== compaction.authority)
|
|
3757
|
+
return void this.#rejectOrigin(lease, "compaction");
|
|
3758
|
+
lease.messageId = compaction.successor;
|
|
3759
|
+
}
|
|
3760
|
+
observeMutation(host, revision, created, assistantId, reviewerPending) {
|
|
3761
|
+
const lease = this.#lease;
|
|
3762
|
+
if (lease?.hostSessionId !== host || !lease.messageId)
|
|
3763
|
+
return;
|
|
3764
|
+
const origin = lease.assistantParents.get(assistantId);
|
|
3765
|
+
if (origin === undefined)
|
|
3766
|
+
return void this.#rejectOrigin(lease, "mutation");
|
|
3767
|
+
if (origin !== lease.messageId)
|
|
3768
|
+
return;
|
|
3769
|
+
const baseline = lease.baseline;
|
|
3770
|
+
if (baseline && baseline.sessionId === undefined && created)
|
|
3771
|
+
lease.baseline = { ...baseline, sessionId: created };
|
|
3772
|
+
const point = lease.checkpoint;
|
|
3773
|
+
if (!point)
|
|
3774
|
+
return;
|
|
3775
|
+
if (revision > point.revision)
|
|
3776
|
+
point.advance = revision + Number(reviewerPending);
|
|
3614
3777
|
}
|
|
3615
3778
|
timingSnapshot() {
|
|
3616
3779
|
const timing = this.#timing;
|
|
@@ -3628,9 +3791,14 @@ class AutoDriveCoordinator {
|
|
|
3628
3791
|
}
|
|
3629
3792
|
async onIdle(hostSessionId) {
|
|
3630
3793
|
const lease = this.#lease;
|
|
3631
|
-
if (!lease || lease.hostSessionId !== hostSessionId
|
|
3794
|
+
if (!lease || lease.hostSessionId !== hostSessionId)
|
|
3632
3795
|
return;
|
|
3633
|
-
lease.inFlight
|
|
3796
|
+
if (lease.inFlight) {
|
|
3797
|
+
if (lease.inFlight !== "reply-status" || !lease.pendingReply || lease.checkpoint?.advance !== undefined)
|
|
3798
|
+
lease.idlePending = true;
|
|
3799
|
+
return;
|
|
3800
|
+
}
|
|
3801
|
+
lease.inFlight = lease.pendingReply ? "reply-status" : "status";
|
|
3634
3802
|
try {
|
|
3635
3803
|
const projection = await this.#read(lease);
|
|
3636
3804
|
if (!projection)
|
|
@@ -3638,88 +3806,72 @@ class AutoDriveCoordinator {
|
|
|
3638
3806
|
if (this.#lease !== lease)
|
|
3639
3807
|
return;
|
|
3640
3808
|
const baseline = lease.baseline;
|
|
3641
|
-
if (!baseline)
|
|
3642
|
-
this.#stop(lease);
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
return;
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
}
|
|
3653
|
-
lease.flowSessionId = projection.sessionId ?? lease.flowSessionId;
|
|
3809
|
+
if (!baseline)
|
|
3810
|
+
return this.#stop(lease);
|
|
3811
|
+
const anchored = lease.checkpoint !== null;
|
|
3812
|
+
if (projection.status === "idle" || projection.nextAction === null)
|
|
3813
|
+
return void this.deactivate(hostSessionId);
|
|
3814
|
+
if (projection.sessionId !== baseline.sessionId)
|
|
3815
|
+
return this.#stop(lease, "Flow auto-drive stopped: unowned session.");
|
|
3816
|
+
const checkpoint = lease.checkpoint;
|
|
3817
|
+
const boundary = isCheckpoint(projection);
|
|
3818
|
+
const advance = checkpoint?.advance;
|
|
3819
|
+
const mutationAdvanced = advance !== undefined && projection.revision === advance && isMechanical(projection);
|
|
3654
3820
|
if (lease.pendingReply) {
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
return;
|
|
3660
|
-
|
|
3661
|
-
lease.checkpoint = {
|
|
3662
|
-
revision: projection.revision,
|
|
3663
|
-
answered: true
|
|
3664
|
-
};
|
|
3665
|
-
lease.delivery = delivery;
|
|
3821
|
+
lease.pendingReply = false;
|
|
3822
|
+
if (boundary && (!checkpoint || projection.revision > checkpoint.revision))
|
|
3823
|
+
return void this.#waitAt(lease, projection.revision);
|
|
3824
|
+
if (!checkpoint || !boundary && !mutationAdvanced)
|
|
3825
|
+
return void this.deactivate(hostSessionId);
|
|
3826
|
+
checkpoint.answered = true;
|
|
3666
3827
|
this.#setTiming("active");
|
|
3667
3828
|
return;
|
|
3668
3829
|
}
|
|
3669
|
-
if (
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
this.deactivate(hostSessionId);
|
|
3674
|
-
return;
|
|
3675
|
-
}
|
|
3676
|
-
if (isCheckpoint(projection)) {
|
|
3677
|
-
lease.checkpoint = { revision: projection.revision, answered: false };
|
|
3678
|
-
this.#setTiming("waiting-for-user");
|
|
3679
|
-
return;
|
|
3680
|
-
}
|
|
3681
|
-
if (!isMechanical(projection)) {
|
|
3682
|
-
this.deactivate(hostSessionId);
|
|
3683
|
-
return;
|
|
3684
|
-
}
|
|
3685
|
-
lease.checkpoint = null;
|
|
3686
|
-
}
|
|
3687
|
-
if (!isMechanical(projection)) {
|
|
3688
|
-
if (isCheckpoint(projection)) {
|
|
3689
|
-
lease.checkpoint = { revision: projection.revision, answered: false };
|
|
3690
|
-
lease.lastPromptedRevision = null;
|
|
3691
|
-
this.#setTiming("waiting-for-user");
|
|
3692
|
-
} else {
|
|
3693
|
-
this.deactivate(hostSessionId);
|
|
3694
|
-
}
|
|
3695
|
-
return;
|
|
3830
|
+
if (boundary) {
|
|
3831
|
+
if (checkpoint && projection.revision < checkpoint.revision)
|
|
3832
|
+
return void this.deactivate(hostSessionId);
|
|
3833
|
+
return void this.#waitAt(lease, projection.revision);
|
|
3696
3834
|
}
|
|
3697
|
-
if (
|
|
3698
|
-
|
|
3699
|
-
|
|
3835
|
+
if (checkpoint) {
|
|
3836
|
+
if (projection.revision <= checkpoint.revision || !mutationAdvanced)
|
|
3837
|
+
return void this.deactivate(hostSessionId);
|
|
3838
|
+
lease.checkpoint = null;
|
|
3700
3839
|
}
|
|
3840
|
+
if (!isMechanical(projection))
|
|
3841
|
+
return void this.deactivate(hostSessionId);
|
|
3701
3842
|
if (lease.lastPromptedRevision === projection.revision) {
|
|
3702
3843
|
this.#setTiming("paused");
|
|
3703
|
-
this.#warn(`Flow auto-drive paused after revision ${projection.revision} made no lifecycle progress.`);
|
|
3704
|
-
return;
|
|
3705
|
-
}
|
|
3706
|
-
if (!lease.delivery) {
|
|
3707
|
-
this.#stop(lease, "Flow auto-drive stopped: originating delivery was unavailable.");
|
|
3708
|
-
return;
|
|
3844
|
+
return this.#warn(`Flow auto-drive paused after revision ${projection.revision} made no lifecycle progress.`);
|
|
3709
3845
|
}
|
|
3846
|
+
if (baseline.sessionId ? projection.revision <= baseline.revision || !anchored && !isPendingReviewer(baseline) : projection.sessionId === undefined)
|
|
3847
|
+
return this.#stop(lease, "Flow auto-drive stopped: no progress.");
|
|
3848
|
+
if (!lease.delivery)
|
|
3849
|
+
return this.#stop(lease, "Flow auto-drive stopped: no delivery.");
|
|
3710
3850
|
lease.lastPromptedRevision = projection.revision;
|
|
3851
|
+
lease.messageId = null;
|
|
3711
3852
|
this.#setTiming("active");
|
|
3712
3853
|
lease.inFlight = "prompt";
|
|
3713
3854
|
try {
|
|
3714
|
-
|
|
3855
|
+
const continuation = [
|
|
3856
|
+
`Continue the same user-authorized /flow-auto lifecycle from compact revision ${projection.revision}.`,
|
|
3857
|
+
"Call flow_status with the compact view first.",
|
|
3858
|
+
CONTINUATION_ROUTE,
|
|
3859
|
+
`Then follow ${projection.nextAction} without expanding the approved goal.`
|
|
3860
|
+
].join(" ");
|
|
3861
|
+
await this.#options.prompt(hostSessionId, `${continuation}
|
|
3862
|
+
|
|
3863
|
+
${FLOW_MANAGER_KERNEL}`, lease.delivery, { [FLOW_AUTO_METADATA_KEY]: lease.token });
|
|
3715
3864
|
} catch (error) {
|
|
3716
|
-
|
|
3717
|
-
this.#stop(lease, `Flow auto-drive stopped because continuation could not be enqueued: ${error instanceof Error ? error.message : String(error)}`);
|
|
3718
|
-
}
|
|
3865
|
+
this.#stop(lease, `Flow auto prompt failed: ${String(error)}`);
|
|
3719
3866
|
}
|
|
3720
3867
|
} finally {
|
|
3721
|
-
if (this.#lease === lease)
|
|
3868
|
+
if (this.#lease === lease) {
|
|
3869
|
+
const rerun = lease.idlePending;
|
|
3870
|
+
lease.idlePending = false;
|
|
3722
3871
|
lease.inFlight = null;
|
|
3872
|
+
if (rerun)
|
|
3873
|
+
await this.onIdle(hostSessionId);
|
|
3874
|
+
}
|
|
3723
3875
|
}
|
|
3724
3876
|
}
|
|
3725
3877
|
}
|
|
@@ -4294,11 +4446,29 @@ class ValidationCaptureCoordinator {
|
|
|
4294
4446
|
}
|
|
4295
4447
|
|
|
4296
4448
|
// src/platform/opencode/plugin.ts
|
|
4449
|
+
var MUTATION = /^flow_(?:plan_save|plan_approve|run_start|review_start|feature_complete|feature_reset|session_close)$/;
|
|
4450
|
+
var AUTO_STOPPED = "Flow auto stopped.";
|
|
4297
4451
|
function isFlowCommand(command) {
|
|
4298
4452
|
return Object.hasOwn(FLOW_CORE_COMMANDS, command);
|
|
4299
4453
|
}
|
|
4300
|
-
function
|
|
4301
|
-
|
|
4454
|
+
function acceptedMutation(tool2, output) {
|
|
4455
|
+
if (!MUTATION.test(tool2))
|
|
4456
|
+
return null;
|
|
4457
|
+
try {
|
|
4458
|
+
const response = JSON.parse(output);
|
|
4459
|
+
const data = response.workflowData;
|
|
4460
|
+
const closeAccepted = tool2 === "flow_session_close" && response.status === "error" && data?.closeState?.durableAccepted === true;
|
|
4461
|
+
const revision2 = data?.projection?.revision;
|
|
4462
|
+
if (data?.operation?.replayed !== false || response.status !== "ok" && !closeAccepted || typeof revision2 !== "number" || !Number.isSafeInteger(revision2))
|
|
4463
|
+
return null;
|
|
4464
|
+
const sessionId = data.projection?.sessionId;
|
|
4465
|
+
return {
|
|
4466
|
+
revision: revision2,
|
|
4467
|
+
sessionId: typeof sessionId === "string" ? sessionId : undefined
|
|
4468
|
+
};
|
|
4469
|
+
} catch {
|
|
4470
|
+
return null;
|
|
4471
|
+
}
|
|
4302
4472
|
}
|
|
4303
4473
|
function textPart(text2, synthetic = false, metadata) {
|
|
4304
4474
|
return {
|
|
@@ -4308,69 +4478,71 @@ function textPart(text2, synthetic = false, metadata) {
|
|
|
4308
4478
|
...metadata ? { metadata } : {}
|
|
4309
4479
|
};
|
|
4310
4480
|
}
|
|
4311
|
-
function
|
|
4312
|
-
|
|
4313
|
-
|
|
4481
|
+
function rewriteCommand(command, args, output) {
|
|
4482
|
+
const config = FLOW_CORE_COMMANDS[command];
|
|
4483
|
+
const promptArgs = config.subtask ? args : "the preceding non-synthetic Flow request";
|
|
4484
|
+
const prompt = config.template.split("$ARGUMENTS").join(promptArgs);
|
|
4485
|
+
if (!config.subtask) {
|
|
4486
|
+
if (output.parts.some((part) => part.type === "subtask"))
|
|
4487
|
+
throw new Error("Flow manager commands cannot contain subtask parts.");
|
|
4488
|
+
const preserved = output.parts.filter((part) => part.type !== "text");
|
|
4489
|
+
output.parts.splice(0, output.parts.length, textPart(args.trim() ? `Flow ${command}: ${args}` : `Flow ${command}`), textPart(prompt, true), ...preserved);
|
|
4490
|
+
return;
|
|
4314
4491
|
}
|
|
4315
|
-
|
|
4316
|
-
output.parts.splice(0, output.parts.length, textPart(args.trim() ? `Flow ${command}: ${args.trim()}` : `Flow ${command}`), textPart(commandPrompt(command, args), true), ...preserved);
|
|
4317
|
-
}
|
|
4318
|
-
function rewriteReviewerCommand(command, args, output) {
|
|
4319
|
-
if (output.parts.length !== 1 || output.parts[0]?.type !== "subtask") {
|
|
4492
|
+
if (output.parts.length !== 1 || output.parts[0]?.type !== "subtask")
|
|
4320
4493
|
throw new Error(`/${command} requires exactly one reviewer subtask.`);
|
|
4321
|
-
}
|
|
4322
4494
|
const subtask = output.parts[0];
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
}
|
|
4327
|
-
if (subtask.command?.replace(/^\/+/, "") !== command) {
|
|
4495
|
+
if (subtask.agent !== config.agent)
|
|
4496
|
+
throw new Error(`/${command} must dispatch to '${config.agent}'.`);
|
|
4497
|
+
if (subtask.command?.replace(/^\/+/, "") !== command)
|
|
4328
4498
|
throw new Error(`/${command} subtask identity did not match.`);
|
|
4329
|
-
|
|
4330
|
-
subtask.prompt = commandPrompt(command, args);
|
|
4499
|
+
subtask.prompt = prompt;
|
|
4331
4500
|
}
|
|
4332
4501
|
function createCommandHook(assertOperational, autoDrive) {
|
|
4333
4502
|
return async (input, output) => {
|
|
4334
4503
|
const command = input.command.replace(/^\/+/, "");
|
|
4335
4504
|
if (!isFlowCommand(command))
|
|
4336
4505
|
return;
|
|
4337
|
-
|
|
4338
|
-
if (
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4506
|
+
const action = input.arguments.trim();
|
|
4507
|
+
if (command === "flow-auto" && /^(?:stop|cancel)$/i.test(action)) {
|
|
4508
|
+
const confirmed = output.parts.some((part) => part.type === "text" && part.text === AUTO_STOPPED);
|
|
4509
|
+
const response = autoDrive.deactivate(input.sessionID) || confirmed ? AUTO_STOPPED : "No Flow auto lease was active in this OpenCode session.";
|
|
4510
|
+
output.parts[0] = textPart(response);
|
|
4511
|
+
output.parts.length = 1;
|
|
4512
|
+
return;
|
|
4342
4513
|
}
|
|
4343
|
-
|
|
4514
|
+
assertOperational(`execute /${command}`);
|
|
4515
|
+
rewriteCommand(command, input.arguments, output);
|
|
4516
|
+
if (command !== "flow-auto")
|
|
4517
|
+
return void autoDrive.deactivate(input.sessionID);
|
|
4518
|
+
const metadata = await autoDrive.activate(input.sessionID);
|
|
4519
|
+
const instruction = output.parts.find((part) => part.type === "text" && part.synthetic === true);
|
|
4520
|
+
if (!instruction) {
|
|
4344
4521
|
autoDrive.deactivate(input.sessionID);
|
|
4345
|
-
|
|
4346
|
-
const metadata = await autoDrive.activate(input.sessionID);
|
|
4347
|
-
const instruction = output.parts.find((part) => part.type === "text" && part.synthetic === true);
|
|
4348
|
-
if (!instruction) {
|
|
4349
|
-
autoDrive.deactivate(input.sessionID);
|
|
4350
|
-
throw new Error("/flow-auto is missing its synthetic instruction.");
|
|
4351
|
-
}
|
|
4352
|
-
instruction.metadata = {
|
|
4353
|
-
...instruction.metadata ?? {},
|
|
4354
|
-
...metadata
|
|
4355
|
-
};
|
|
4522
|
+
throw new Error("/flow-auto is missing its synthetic instruction.");
|
|
4356
4523
|
}
|
|
4524
|
+
instruction.metadata = { ...instruction.metadata, ...metadata };
|
|
4357
4525
|
};
|
|
4358
4526
|
}
|
|
4359
|
-
function guardTools(tools, runtimeGuard) {
|
|
4527
|
+
function guardTools(tools, runtimeGuard, autoDrive) {
|
|
4360
4528
|
return Object.fromEntries(Object.entries(tools).map(([name, definition]) => [
|
|
4361
4529
|
name,
|
|
4362
4530
|
{
|
|
4363
4531
|
...definition,
|
|
4364
4532
|
execute: async (...args) => {
|
|
4365
4533
|
const status = runtimeGuard.query();
|
|
4366
|
-
if (!status.operational)
|
|
4534
|
+
if (!status.operational)
|
|
4367
4535
|
return JSON.stringify({
|
|
4368
4536
|
status: "error",
|
|
4369
4537
|
summary: status.message,
|
|
4370
4538
|
workflowData: { runtimeGuard: status }
|
|
4371
4539
|
});
|
|
4372
|
-
|
|
4373
|
-
|
|
4540
|
+
const output = await definition.execute(...args);
|
|
4541
|
+
const mutation = acceptedMutation(name, String(output));
|
|
4542
|
+
const context = args[1];
|
|
4543
|
+
if (mutation)
|
|
4544
|
+
autoDrive.observeMutation(context.sessionID, mutation.revision, name === "flow_plan_save" && mutation.revision === 1 ? mutation.sessionId : undefined, context.messageID, name === "flow_review_start");
|
|
4545
|
+
return output;
|
|
4374
4546
|
}
|
|
4375
4547
|
}
|
|
4376
4548
|
]));
|
|
@@ -4385,7 +4557,8 @@ var FlowPlugin = async (ctx) => {
|
|
|
4385
4557
|
instanceId: createFlowPluginInstanceId()
|
|
4386
4558
|
});
|
|
4387
4559
|
const initial = runtimeGuard.query();
|
|
4388
|
-
|
|
4560
|
+
const level = initial.operational ? "info" : "error";
|
|
4561
|
+
log(level, `Flow ${version}: ${initial.message}`);
|
|
4389
4562
|
const workspace = ctx.worktree ?? ctx.directory;
|
|
4390
4563
|
const autoDrive = new AutoDriveCoordinator({
|
|
4391
4564
|
readProjection: async () => {
|
|
@@ -4411,14 +4584,7 @@ var FlowPlugin = async (ctx) => {
|
|
|
4411
4584
|
body: {
|
|
4412
4585
|
agent: delivery.agent,
|
|
4413
4586
|
model: delivery.model,
|
|
4414
|
-
parts: [
|
|
4415
|
-
{
|
|
4416
|
-
type: "text",
|
|
4417
|
-
text: prompt,
|
|
4418
|
-
synthetic: true,
|
|
4419
|
-
metadata: { ...metadata }
|
|
4420
|
-
}
|
|
4421
|
-
]
|
|
4587
|
+
parts: [textPart(prompt, true, metadata)]
|
|
4422
4588
|
},
|
|
4423
4589
|
throwOnError: true
|
|
4424
4590
|
});
|
|
@@ -4437,16 +4603,15 @@ var FlowPlugin = async (ctx) => {
|
|
|
4437
4603
|
config: createConfigHook(ctx, {
|
|
4438
4604
|
assertOperational: (action) => runtimeGuard.assertOperational(action)
|
|
4439
4605
|
}),
|
|
4440
|
-
tool: guardTools(tools, runtimeGuard),
|
|
4606
|
+
tool: guardTools(tools, runtimeGuard, autoDrive),
|
|
4441
4607
|
"command.execute.before": createCommandHook((action) => runtimeGuard.assertOperational(action), autoDrive),
|
|
4442
4608
|
"chat.message": async (input, output) => {
|
|
4443
4609
|
const observed = await autoDrive.observeMessage(input.sessionID, {
|
|
4444
4610
|
agent: output.message.agent,
|
|
4445
4611
|
model: output.message.model
|
|
4446
|
-
}, output.parts);
|
|
4447
|
-
if (observed === "stale-continuation")
|
|
4612
|
+
}, output.parts, output.message.id);
|
|
4613
|
+
if (observed === "stale-continuation")
|
|
4448
4614
|
throw new Error("Discarded a stale Flow auto continuation.");
|
|
4449
|
-
}
|
|
4450
4615
|
},
|
|
4451
4616
|
"experimental.session.compacting": async (input, output) => {
|
|
4452
4617
|
const context = autoDrive.compactionContext(input.sessionID);
|
|
@@ -4455,32 +4620,28 @@ var FlowPlugin = async (ctx) => {
|
|
|
4455
4620
|
},
|
|
4456
4621
|
event: async (input) => {
|
|
4457
4622
|
const event = input.event;
|
|
4623
|
+
if (event.type === "message.updated")
|
|
4624
|
+
return autoDrive.observeHostMessage(event.properties.info.sessionID, event.properties.info);
|
|
4625
|
+
if (event.type === "message.part.updated")
|
|
4626
|
+
return autoDrive.observeHostPart(event.properties.part.sessionID, event.properties.part);
|
|
4458
4627
|
if (event.type === "session.deleted" || event.type === "session.error") {
|
|
4459
4628
|
const sessionID2 = event.type === "session.deleted" ? event.properties.info.id : event.properties.sessionID;
|
|
4460
|
-
if (sessionID2)
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
autoDrive.clear();
|
|
4465
|
-
}
|
|
4466
|
-
return;
|
|
4629
|
+
if (!sessionID2)
|
|
4630
|
+
return autoDrive.clear();
|
|
4631
|
+
validation.cancel(sessionID2);
|
|
4632
|
+
return void autoDrive.deactivate(sessionID2);
|
|
4467
4633
|
}
|
|
4468
|
-
if (event.type !== "session.idle" && event.type !== "session.compacted")
|
|
4634
|
+
if (event.type !== "session.idle" && event.type !== "session.compacted")
|
|
4469
4635
|
return;
|
|
4470
|
-
}
|
|
4471
4636
|
const sessionID = event.properties?.sessionID;
|
|
4472
4637
|
validation.cancel(sessionID);
|
|
4473
|
-
if (event.type === "session.
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
}
|
|
4479
|
-
}
|
|
4480
|
-
},
|
|
4481
|
-
"tool.execute.before": async (input, output) => {
|
|
4482
|
-
validation.observeToolBefore(input, output);
|
|
4638
|
+
if (event.type === "session.compacted")
|
|
4639
|
+
return autoDrive.observeCompaction(sessionID);
|
|
4640
|
+
if (runtimeGuard.query().operational)
|
|
4641
|
+
return autoDrive.onIdle(sessionID);
|
|
4642
|
+
autoDrive.deactivate(sessionID);
|
|
4483
4643
|
},
|
|
4644
|
+
"tool.execute.before": async (input, output) => validation.observeToolBefore(input, output),
|
|
4484
4645
|
"tool.execute.after": async (input, output) => {
|
|
4485
4646
|
try {
|
|
4486
4647
|
await validation.observeToolAfter(input, output);
|
|
@@ -4503,4 +4664,4 @@ export {
|
|
|
4503
4664
|
plugin_default as default
|
|
4504
4665
|
};
|
|
4505
4666
|
|
|
4506
|
-
//# debugId=
|
|
4667
|
+
//# debugId=454D701E6238F47E64756E2164756E21
|