opencode-plugin-flow 4.4.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +44 -40
  3. package/dist/application/errors.d.ts +5 -0
  4. package/dist/{runtime/api.d.ts → application/flow-service.d.ts} +89 -57
  5. package/dist/application/ports/session-repository.d.ts +11 -0
  6. package/dist/{runtime → application}/schema.d.ts +291 -371
  7. package/dist/cli.js +283 -2720
  8. package/dist/cli.js.map +7 -6
  9. package/dist/config-shared.d.ts +28 -14
  10. package/dist/config.d.ts +1 -1
  11. package/dist/distribution/legacy-cleanup.d.ts +25 -0
  12. package/dist/domain/feature-id.d.ts +3 -0
  13. package/dist/domain/limits.d.ts +1 -0
  14. package/dist/domain/orchestration-policy.d.ts +27 -0
  15. package/dist/domain/session.d.ts +181 -0
  16. package/dist/domain/transitions.d.ts +80 -0
  17. package/dist/guidance/catalog.d.ts +18 -0
  18. package/dist/guidance/ids.d.ts +4 -0
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +1279 -1102
  21. package/dist/index.js.map +24 -18
  22. package/dist/infrastructure/fs/session-repository.d.ts +2 -0
  23. package/dist/infrastructure/fs/workspace-flow-service.d.ts +9 -0
  24. package/dist/{runtime → infrastructure/fs}/workspace.d.ts +10 -15
  25. package/dist/infrastructure/system/transition-environment.d.ts +2 -0
  26. package/dist/platform/opencode/config.d.ts +2 -0
  27. package/dist/{adapters → platform}/opencode/plugin.d.ts +1 -1
  28. package/dist/{adapters → platform}/opencode/sdk.d.ts +0 -1
  29. package/dist/platform/opencode/tools.d.ts +6 -0
  30. package/dist/prompt-model-evaluation.d.ts +19 -30
  31. package/dist/prompt-quality.d.ts +1 -1
  32. package/dist/version.d.ts +1 -0
  33. package/package.json +16 -11
  34. package/dist/adapters/opencode/config.d.ts +0 -3
  35. package/dist/adapters/opencode/tools.d.ts +0 -322
  36. package/dist/distribution/flow-skill-definitions.d.ts +0 -9
  37. package/dist/distribution/sync.d.ts +0 -69
  38. package/dist/runtime/time.d.ts +0 -2
  39. package/dist/runtime/transitions.d.ts +0 -230
  40. /package/dist/{runtime/json/strict-object.d.ts → infrastructure/fs/strict-json-object.d.ts} +0 -0
  41. /package/dist/{adapters → platform}/opencode/logging.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,63 @@
2
2
 
3
3
  One short entry per release, written for users deciding whether to upgrade.
4
4
 
5
+ ## [5.0.0] - 2026-07-18
6
+
7
+ TypeScript 7 hard-cutover lore makes Flow 5 smaller, stricter, and easier to
8
+ recover without carrying a v4 compatibility layer:
9
+
10
+ - The compiler is TypeScript 7.0.2; the pinned toolchain is Bun 1.3.14,
11
+ Biome 2.5.4, OpenCode plugin 1.18.3, and Zod 4.4.3. Published code now
12
+ requires Node.js 24 or newer and CI covers Node 24 and 26.
13
+ - Source code now follows `domain -> application -> infrastructure ->
14
+ platform`: pure transitions use injected time and IDs, application use cases
15
+ depend on repository ports, filesystem state is an outer implementation,
16
+ and OpenCode owns only host transport and rendering.
17
+ - OpenCode's embedded validator is private to the host adapter. Flow's core
18
+ schemas use its direct Zod dependency, shared fixtures keep both wire
19
+ contracts aligned, and declaration emit no longer leaks package-manager or
20
+ nested-validator paths.
21
+ - Persisted sessions use schema version 3. Version 2 sessions are not migrated;
22
+ they are reported as unsupported and preserved in quarantine so a new v5
23
+ session can start safely.
24
+ - Public use-case results have an explicit typed operation status. Repository-
25
+ and caller-controlled prose is confined to `workflowData`; top-level
26
+ summaries, next actions, and recovery fields remain plugin-authored. Feature
27
+ and session IDs are branded, feature IDs are consistently lowercase
28
+ kebab-case at every input boundary, and all superseded `src/runtime` and
29
+ `src/adapters` entrypoints are removed.
30
+ - Source and declaration imports follow NodeNext ESM rules with explicit `.js`
31
+ specifiers, and the packed-package smoke test compiles a strict NodeNext
32
+ consumer without skipping library checks before importing the plugin in Node.
33
+ - Workspace roots are canonicalized and every Flow-managed directory and file
34
+ rejects symbolic links before read or mutation. Archive publication is
35
+ no-clobber and retry-safe, while lock contention and malformed owner metadata
36
+ fail closed for manual inspection instead of using age or liveness to steal a
37
+ lock. Completion outcomes require an explicit discriminator, and domain
38
+ transitions copy caller-owned plan and evidence collections before recording
39
+ them.
40
+ - Flow no longer synchronizes Markdown into OpenCode's global skill registry.
41
+ Core command guidance and optional helpers are embedded in the plugin;
42
+ `flow_guidance` returns exact package-versioned documents by stable id, plugin
43
+ startup performs no global skill filesystem work, and `flow_status` no longer
44
+ carries setup/restart health.
45
+ - Plugin configuration only registers commands and agents; it performs no
46
+ workspace filesystem I/O and maintains no ambient instruction projection.
47
+ `/flow-review` validates OpenCode's native subtask identity and agent before
48
+ rewriting only its prompt, so malformed dispatch fails closed.
49
+ - Orchestration telemetry retains at most 50 recent pass records and accepts at
50
+ most 50 per completion. Deduplication is scoped to that retained telemetry
51
+ window, and failed completion mutations now update `timestamps.updatedAt`
52
+ from the same instant recorded in `lastError`.
53
+ - The experimental compaction hook, token telemetry, phase boundaries, resume
54
+ packets, and acknowledgement protocol are gone. Review retry exhaustion uses
55
+ the ordinary blocked-feature/reset path, while a recorded closure makes the
56
+ session archive-only until retry-safe publication succeeds.
57
+ - The old doctor/sync/uninstall CLI is replaced by explicit
58
+ `legacy-cleanup --dry-run|--apply`. Apply never deletes: it moves only
59
+ marker-proven pristine v4 folders to a recovery archive and refuses
60
+ foreign, edited, extra, malformed, or symlinked content.
61
+
5
62
  ## [4.4.0] - 2026-07-17
6
63
 
7
64
  Prompt economy lore makes Flow's instructions smaller, more role-specific, and
package/README.md CHANGED
@@ -6,10 +6,10 @@ then implement one feature at a time with enforced validation and review
6
6
  evidence. State lives in `.flow/session.json`, so a session survives restarts,
7
7
  model switches, and context loss.
8
8
 
9
- The design is skills-first: the skills carry planning, execution, validation,
10
- review, and orchestration judgment, while the plugin runtime stays deliberately
11
- small — it keeps the session ledger and enforces the hard gates prompts should
12
- not be trusted to remember.
9
+ The design is guidance-first: package-owned Markdown carries planning,
10
+ execution, validation, review, and orchestration judgment, while the plugin
11
+ runtime stays deliberately small — it keeps the session ledger and enforces the
12
+ hard gates prompts should not be trusted to remember.
13
13
 
14
14
  Full project documentation is available in the
15
15
  [Flow OpenCode wiki](https://github.com/ddv1982/flow-opencode/wiki).
@@ -17,11 +17,10 @@ Full project documentation is available in the
17
17
  ## Quick start
18
18
 
19
19
  ```bash
20
- opencode plugin opencode-plugin-flow@4.4.0 --global --force
21
- npx -y opencode-plugin-flow@4.4.0 sync
20
+ opencode plugin opencode-plugin-flow@5.0.0 --global --force
22
21
  ```
23
22
 
24
- Restart OpenCode, then give Flow a goal:
23
+ Start or restart OpenCode, then give Flow a goal:
25
24
 
26
25
  ```text
27
26
  /flow-auto add rate limiting to the public API
@@ -52,8 +51,9 @@ restart.
52
51
  ...
53
52
 
54
53
  > /flow-status
55
- status: running, 1/3 features completed
56
- nextAction: complete feature "per-route-config"
54
+ status: ok
55
+ workflowData.session.status: running, 1/3 features completed
56
+ nextAction: complete the feature under workflowData.session.activeFeature
57
57
  ```
58
58
 
59
59
  Interrupt at any point; `/flow-run` resumes the next approved feature. On the
@@ -65,7 +65,7 @@ completed.
65
65
 
66
66
  | Command | Purpose |
67
67
  | --- | --- |
68
- | `/flow-auto <goal>` | Drive the full skill-guided loop. |
68
+ | `/flow-auto <goal>` | Drive the full guidance-driven loop. |
69
69
  | `/flow-plan <goal>` | Create or approve a plan. |
70
70
  | `/flow-run` | Execute one approved feature. |
71
71
  | `/flow-review` | Run a read-only review. |
@@ -73,20 +73,22 @@ completed.
73
73
 
74
74
  Commands are compiled entrypoints: manager commands carry only their applicable
75
75
  core instructions, while `/flow-review` runs against the reserved reviewer's
76
- role-specific agent contract. They keep working even when OpenCode's native
77
- skill discovery lags behind a fresh install (see
78
- [docs/troubleshooting.md](docs/troubleshooting.md)).
76
+ role-specific agent contract. Flow does not install files into OpenCode's
77
+ global skill registry and does not depend on native skill discovery.
79
78
 
80
- `flow-test`, `flow-deslop`, `flow-ui-quality`, and `flow-commit` are managed
81
- helper skills, not public commands.
82
- `flow-commit` is user-triggered only and stays outside the autonomous loop.
79
+ `flow-test`, `flow-deslop`, `flow-ui-quality`, and `flow-commit` are optional
80
+ package-owned guides loaded on demand through `flow_guidance`, not public
81
+ commands. `flow-commit` is user-triggered only and stays outside the autonomous
82
+ loop.
83
83
 
84
84
  ## Tools
85
85
 
86
- The runtime exposes seven tools:
86
+ The plugin exposes eight tools. `flow_guidance` is read-only and returns embedded
87
+ Markdown; the other seven form the stateful runtime surface:
87
88
 
88
89
  | Tool | Purpose |
89
90
  | --- | --- |
91
+ | `flow_guidance` | Load exact package-owned guidance by stable id. |
90
92
  | `flow_status` | Read the active session and next action. |
91
93
  | `flow_plan_save` | Create a session and/or save a draft plan. |
92
94
  | `flow_plan_approve` | Approve the draft plan. |
@@ -101,7 +103,7 @@ final feature also needs a passing `finalReview`.
101
103
 
102
104
  ## What the runtime enforces
103
105
 
104
- The runtime owns only safety; judgment lives in the skills:
106
+ The runtime owns only safety; judgment lives in package-owned guidance:
105
107
 
106
108
  - `.flow/session.json` is the single source of truth; writes are locked and
107
109
  atomic, and closed sessions are archived under `.flow/history/`.
@@ -114,19 +116,18 @@ The runtime owns only safety; judgment lives in the skills:
114
116
  that is shallower than the approved feature requires.
115
117
  - Failed reviews are bounded: a failed review pauses by default, and autonomous
116
118
  repair is limited to one repair plus one retry before the feature blocks.
117
- - Completed feature counts are telemetry only; Flow does not stop an approved
118
- plan just because several features have completed. Review retry boundaries
119
- still return a bounded resume packet and require explicit `phaseBoundaryAck`
120
- before starting the next feature.
121
- - Skills do not estimate context pressure or request host compaction. Only a
122
- runtime-issued phase boundary stops the current loop for a fresh invocation.
119
+ - Review exhaustion uses the ordinary blocked-feature state; continuing requires
120
+ an explicit `flow_feature_reset`, not a second checkpoint protocol.
121
+ - Once a closure is recorded, the session is archive-only. If publication fails,
122
+ retry `flow_session_close`; no run, reset, approval, or replan can reopen it.
123
123
  - A session can close as `completed` only after final completion has passed.
124
- - Crash recovery is built in: stale session locks expire automatically and
125
- unreadable session files are quarantined with recovery guidance, never
126
- silently deleted.
124
+ - Session locks fail closed: Flow never guesses that an old lock is abandoned,
125
+ and only the unique owner may release it. Unreadable session files are
126
+ quarantined with recovery guidance, never silently deleted.
127
127
  - Flow writes `.flow/.gitignore` so session state stays out of Git by default.
128
- - `.flow/opencode-instructions.md` is a generated projection of the active
129
- session that keeps ambient context accurate; do not edit it.
128
+ - `.flow/session.json` is the only active-state representation. Canonical Flow
129
+ commands call `flow_status` before acting; plugin configuration does not read,
130
+ refresh, or project workspace state.
130
131
 
131
132
  ## Hidden workers
132
133
 
@@ -154,26 +155,28 @@ used exact-path candidate workers, used isolated worktrees, ran a tournament, or
154
155
  skipped eligible candidates. Feature completion can carry bounded
155
156
  `orchestrationPasses` with candidate eligibility, decision, and structured
156
157
  factors; `flow_status` reports the aggregate under
157
- `session.budget.orchestration`.
158
+ `workflowData.session.budget.orchestration`.
158
159
 
159
- ## Install details, doctor, repair, uninstall
160
+ ## Install details and legacy cleanup
160
161
 
161
- See [docs/troubleshooting.md](docs/troubleshooting.md) for skill sync
162
- mechanics, the `doctor`/`sync` CLI, older-OpenCode install fallback, stuck
163
- session recovery, and uninstall (`uninstall --dry-run` previews removals).
162
+ See [docs/troubleshooting.md](docs/troubleshooting.md) for updates,
163
+ older-OpenCode install fallback, stuck session recovery, and removal of global
164
+ Flow skill folders left by v4.
164
165
 
165
- To update a pinned Flow version, rerun the install command with the new
166
- version. To inspect skill health:
166
+ To update a pinned Flow version, rerun the install command with the new version.
167
+ Flow starts with the new package-owned guidance immediately; no second restart
168
+ or sync command is required. To preview recoverable migration of pristine v4
169
+ global skill folders:
167
170
 
168
171
  ```bash
169
- npx -y opencode-plugin-flow@4.4.0 doctor
172
+ npx -y opencode-plugin-flow@5.0.0 legacy-cleanup --dry-run
170
173
  ```
171
174
 
172
175
  ## Development
173
176
 
174
177
  ```bash
175
178
  bun install
176
- bun run check # typecheck + lint + build + tests
179
+ bun run check # typecheck + lint + prompt quality + build + tests
177
180
  bun run smoke:live # boots a real OpenCode server against the packed tarball
178
181
  ```
179
182
 
@@ -185,7 +188,8 @@ import flowPlugin from "opencode-plugin-flow";
185
188
 
186
189
  See [docs/development.md](docs/development.md) and
187
190
  [docs/maintainer-contract.md](docs/maintainer-contract.md) for the
188
- runtime/skills split and release process.
191
+ v5 domain/application/infrastructure/platform boundaries, guidance split, and
192
+ release process.
189
193
 
190
194
  ## Credits
191
195
 
@@ -195,5 +199,5 @@ work on parallel agent workflows. Flow also draws conceptual inspiration from
195
199
  emphasis on codebase orientation, context engineering, agent orchestration,
196
200
  and reviewable handoffs.
197
201
 
198
- The Flow version is its own OpenCode-native design: skills-first,
202
+ The Flow version is its own OpenCode-native design: package-owned guidance,
199
203
  manager-owned state, hidden workers, and no extra runtime ledger.
@@ -0,0 +1,5 @@
1
+ export declare class UnreadableFlowSessionError extends Error {
2
+ readonly code = "UNREADABLE_FLOW_SESSION";
3
+ readonly reason: string;
4
+ constructor(message: string, reason: string);
5
+ }
@@ -1,5 +1,48 @@
1
1
  import { z } from "zod";
2
- export type RuntimeResponse = Record<string, unknown>;
2
+ import type { Feature, Session, SessionId } from "../domain/session.js";
3
+ import { summarizeSession, type TransitionEnvironment } from "../domain/transitions.js";
4
+ import type { SessionRepository } from "./ports/session-repository.js";
5
+ type StatusResponse = ReturnType<typeof summarizeSession>;
6
+ type ActiveStatusResponse = Extract<StatusResponse, {
7
+ workflowData: unknown;
8
+ }>;
9
+ type SessionWorkflowData = ActiveStatusResponse["workflowData"]["session"];
10
+ type WorkflowData = {
11
+ session?: SessionWorkflowData;
12
+ failure?: {
13
+ summary: string;
14
+ recovery?: string;
15
+ };
16
+ startedFeature?: Feature;
17
+ archive?: {
18
+ sessionId: SessionId;
19
+ closure: Session["closure"];
20
+ };
21
+ quarantine?: {
22
+ reason: string;
23
+ preservedAt?: string;
24
+ };
25
+ };
26
+ type ResponseContext = {
27
+ statusSummary?: string;
28
+ nextAction?: string;
29
+ dataNote?: string;
30
+ workflowData?: WorkflowData;
31
+ recovery?: string;
32
+ };
33
+ export type FlowResponse = ResponseContext & {
34
+ status: "ok" | "error" | "missing_goal" | "missing_session";
35
+ summary: string;
36
+ };
37
+ export type FlowService = {
38
+ status(): Promise<FlowResponse>;
39
+ planSave(input: unknown): Promise<FlowResponse>;
40
+ planApprove(): Promise<FlowResponse>;
41
+ runStart(input: unknown): Promise<FlowResponse>;
42
+ featureComplete(input: unknown): Promise<FlowResponse>;
43
+ featureReset(input: unknown): Promise<FlowResponse>;
44
+ sessionClose(input: unknown): Promise<FlowResponse>;
45
+ };
3
46
  export declare const FlowPlanSaveSchema: z.ZodObject<{
4
47
  goal: z.ZodOptional<z.ZodString>;
5
48
  plan: z.ZodOptional<z.ZodObject<{
@@ -12,47 +55,46 @@ export declare const FlowPlanSaveSchema: z.ZodObject<{
12
55
  detailed: "detailed";
13
56
  }>>;
14
57
  features: z.ZodArray<z.ZodObject<{
15
- summary: z.ZodString;
16
- id: z.ZodString;
58
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
17
59
  title: z.ZodString;
60
+ summary: z.ZodString;
18
61
  status: z.ZodOptional<z.ZodEnum<{
19
- pending: "pending";
20
- in_progress: "in_progress";
21
- completed: "completed";
22
62
  blocked: "blocked";
63
+ completed: "completed";
64
+ in_progress: "in_progress";
65
+ pending: "pending";
23
66
  }>>;
24
67
  reviewDepth: z.ZodOptional<z.ZodEnum<{
68
+ detailed: "detailed";
25
69
  quick: "quick";
26
70
  standard: "standard";
27
- detailed: "detailed";
28
71
  }>>;
29
72
  targets: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
73
  validation: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
- dependsOn: z.ZodOptional<z.ZodArray<z.ZodString>>;
74
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>>>;
32
75
  }, z.core.$strict>>;
33
76
  }, z.core.$strict>>;
34
77
  }, z.core.$strict>;
35
78
  export declare const FlowRunStartSchema: z.ZodObject<{
36
- featureId: z.ZodOptional<z.ZodString>;
37
- phaseBoundaryAck: z.ZodOptional<z.ZodBoolean>;
79
+ featureId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>>;
38
80
  }, z.core.$strict>;
39
81
  export declare const FlowFeatureResetSchema: z.ZodObject<{
40
- featureId: z.ZodString;
82
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
41
83
  }, z.core.$strict>;
42
84
  export declare const FlowSessionCloseSchema: z.ZodObject<{
43
85
  kind: z.ZodEnum<{
86
+ abandoned: "abandoned";
44
87
  completed: "completed";
45
88
  deferred: "deferred";
46
- abandoned: "abandoned";
47
89
  }>;
48
90
  summary: z.ZodOptional<z.ZodString>;
49
91
  }, z.core.$strict>;
50
92
  export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
51
93
  status: z.ZodEnum<{
52
- ok: "ok";
53
94
  needs_input: "needs_input";
95
+ ok: "ok";
54
96
  }>;
55
- featureId: z.ZodString;
97
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
56
98
  summary: z.ZodString;
57
99
  artifactsChanged: z.ZodOptional<z.ZodArray<z.ZodObject<{
58
100
  path: z.ZodString;
@@ -60,45 +102,45 @@ export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
60
102
  validationRun: z.ZodOptional<z.ZodArray<z.ZodObject<{
61
103
  command: z.ZodString;
62
104
  status: z.ZodEnum<{
63
- passed: "passed";
64
105
  failed: "failed";
106
+ passed: "passed";
65
107
  }>;
66
108
  summary: z.ZodString;
67
109
  }, z.core.$strict>>>;
68
110
  validationScope: z.ZodOptional<z.ZodEnum<{
69
- targeted: "targeted";
70
111
  broad: "broad";
112
+ targeted: "targeted";
71
113
  }>>;
72
114
  featureReviewDepth: z.ZodOptional<z.ZodEnum<{
115
+ detailed: "detailed";
73
116
  quick: "quick";
74
117
  standard: "standard";
75
- detailed: "detailed";
76
118
  }>>;
77
119
  featureReview: z.ZodOptional<z.ZodObject<{
78
120
  status: z.ZodEnum<{
79
- passed: "passed";
80
121
  failed: "failed";
122
+ passed: "passed";
81
123
  }>;
82
124
  summary: z.ZodString;
83
125
  blockingFindings: z.ZodDefault<z.ZodArray<z.ZodObject<{
84
126
  summary: z.ZodString;
85
127
  severity: z.ZodDefault<z.ZodEnum<{
86
- blocking: "blocking";
87
128
  advisory: "advisory";
129
+ blocking: "blocking";
88
130
  }>>;
89
131
  }, z.core.$strict>>>;
90
132
  }, z.core.$strict>>;
91
133
  finalReview: z.ZodOptional<z.ZodObject<{
92
134
  status: z.ZodEnum<{
93
- passed: "passed";
94
135
  failed: "failed";
136
+ passed: "passed";
95
137
  }>;
96
138
  summary: z.ZodString;
97
139
  blockingFindings: z.ZodDefault<z.ZodArray<z.ZodObject<{
98
140
  summary: z.ZodString;
99
141
  severity: z.ZodDefault<z.ZodEnum<{
100
- blocking: "blocking";
101
142
  advisory: "advisory";
143
+ blocking: "blocking";
102
144
  }>>;
103
145
  }, z.core.$strict>>>;
104
146
  reviewDepth: z.ZodEnum<{
@@ -106,42 +148,37 @@ export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
106
148
  detailed: "detailed";
107
149
  }>;
108
150
  }, z.core.$strict>>;
109
- outcome: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
110
- kind: z.ZodDefault<z.ZodEnum<{
111
- completed: "completed";
112
- blocked: "blocked";
113
- needs_input: "needs_input";
114
- replan_required: "replan_required";
115
- }>>;
151
+ outcome: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
152
+ kind: z.ZodLiteral<"completed">;
116
153
  summary: z.ZodOptional<z.ZodString>;
117
154
  resolutionHint: z.ZodOptional<z.ZodString>;
118
155
  }, z.core.$strict>, z.ZodObject<{
119
- kind: z.ZodDefault<z.ZodEnum<{
156
+ kind: z.ZodEnum<{
120
157
  blocked: "blocked";
121
158
  needs_input: "needs_input";
122
159
  replan_required: "replan_required";
123
- }>>;
160
+ }>;
124
161
  summary: z.ZodString;
125
162
  resolutionHint: z.ZodOptional<z.ZodString>;
126
- }, z.core.$strict>]>>;
163
+ }, z.core.$strict>], "kind">>;
127
164
  orchestrationPasses: z.ZodOptional<z.ZodArray<z.ZodObject<{
128
165
  id: z.ZodString;
129
166
  kind: z.ZodEnum<{
130
- validation: "validation";
131
167
  audit: "audit";
132
168
  candidate: "candidate";
133
169
  discovery: "discovery";
170
+ "implementation-decision": "implementation-decision";
134
171
  review: "review";
172
+ validation: "validation";
135
173
  verification: "verification";
136
- "implementation-decision": "implementation-decision";
137
174
  }>;
138
175
  decision: z.ZodOptional<z.ZodEnum<{
139
- parallel: "parallel";
140
- serial: "serial";
141
176
  "candidate-exact-path": "candidate-exact-path";
142
177
  "candidate-worktree": "candidate-worktree";
143
- tournament: "tournament";
178
+ parallel: "parallel";
179
+ serial: "serial";
144
180
  skipped: "skipped";
181
+ tournament: "tournament";
145
182
  }>>;
146
183
  decisionReason: z.ZodOptional<z.ZodString>;
147
184
  candidateEligibility: z.ZodDefault<z.ZodEnum<{
@@ -150,25 +187,25 @@ export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
150
187
  unknown: "unknown";
151
188
  }>>;
152
189
  candidateDecision: z.ZodOptional<z.ZodEnum<{
190
+ serial_required: "serial_required";
153
191
  skipped: "skipped";
154
192
  used: "used";
155
- serial_required: "serial_required";
156
193
  }>>;
157
194
  decisionFactors: z.ZodDefault<z.ZodArray<z.ZodEnum<{
158
- shared_state: "shared_state";
195
+ independent_surface: "independent_surface";
196
+ needs_manager_judgment: "needs_manager_judgment";
159
197
  overlapping_files: "overlapping_files";
198
+ shared_state: "shared_state";
160
199
  small_slice: "small_slice";
161
- needs_manager_judgment: "needs_manager_judgment";
162
- independent_surface: "independent_surface";
163
200
  validation_available: "validation_available";
164
201
  }>>>;
165
202
  modes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
203
+ audit: "audit";
204
+ "candidate-implementation": "candidate-implementation";
166
205
  evidence: "evidence";
206
+ review: "review";
167
207
  validation: "validation";
168
- audit: "audit";
169
208
  verifier: "verifier";
170
- review: "review";
171
- "candidate-implementation": "candidate-implementation";
172
209
  }>>>;
173
210
  workerCount: z.ZodDefault<z.ZodNumber>;
174
211
  candidateWorkerCount: z.ZodDefault<z.ZodNumber>;
@@ -176,36 +213,31 @@ export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
176
213
  sliceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
177
214
  dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
178
215
  writeScope: z.ZodDefault<z.ZodEnum<{
179
- none: "none";
180
- "manager-serial": "manager-serial";
181
216
  "exact-path": "exact-path";
182
217
  "isolated-worktree": "isolated-worktree";
218
+ "manager-serial": "manager-serial";
183
219
  mixed: "mixed";
220
+ none: "none";
184
221
  }>>;
185
222
  handoffRefs: z.ZodDefault<z.ZodArray<z.ZodString>>;
186
223
  verificationStatus: z.ZodDefault<z.ZodEnum<{
187
- pending: "pending";
188
- passed: "passed";
224
+ downgraded: "downgraded";
189
225
  failed: "failed";
190
226
  mixed: "mixed";
191
227
  "not-needed": "not-needed";
192
- downgraded: "downgraded";
228
+ passed: "passed";
229
+ pending: "pending";
193
230
  }>>;
194
231
  outcome: z.ZodDefault<z.ZodEnum<{
195
232
  accepted: "accepted";
196
233
  modified: "modified";
197
- rejected: "rejected";
198
- partial: "partial";
199
234
  "not-covered": "not-covered";
235
+ partial: "partial";
236
+ rejected: "rejected";
200
237
  superseded: "superseded";
201
238
  }>>;
202
239
  synthesisRef: z.ZodOptional<z.ZodString>;
203
240
  }, z.core.$strict>>>;
204
241
  }, z.core.$strict>;
205
- export declare function flowStatus(worktree: string): Promise<RuntimeResponse>;
206
- export declare function flowPlanSave(worktree: string, input: unknown): Promise<RuntimeResponse>;
207
- export declare function flowPlanApprove(worktree: string): Promise<RuntimeResponse>;
208
- export declare function flowRunStart(worktree: string, input: unknown): Promise<RuntimeResponse>;
209
- export declare function flowFeatureComplete(worktree: string, input: unknown): Promise<RuntimeResponse>;
210
- export declare function flowFeatureReset(worktree: string, input: unknown): Promise<RuntimeResponse>;
211
- export declare function flowSessionClose(worktree: string, input: unknown): Promise<RuntimeResponse>;
242
+ export declare function createFlowService(repository: SessionRepository, environment: TransitionEnvironment): FlowService;
243
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Session } from "../../domain/session.js";
2
+ export type SessionTransaction = {
3
+ load(): Promise<Session | null>;
4
+ save(session: Session): Promise<Session>;
5
+ archiveAndClear(session: Session): Promise<void>;
6
+ quarantineUnreadable(): Promise<string | null>;
7
+ };
8
+ export interface SessionRepository {
9
+ read(): Promise<Session | null>;
10
+ transact<T>(task: (transaction: SessionTransaction) => Promise<T>): Promise<T>;
11
+ }