opencode-plugin-flow 4.4.0 → 5.1.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 (52) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +60 -43
  3. package/dist/application/errors.d.ts +5 -0
  4. package/dist/application/flow-service.d.ts +339 -0
  5. package/dist/application/ports/evidence-artifact-store.d.ts +28 -0
  6. package/dist/application/ports/session-repository.d.ts +18 -0
  7. package/dist/application/ports/source-identity.d.ts +61 -0
  8. package/dist/application/replay/canonical-json.d.ts +7 -0
  9. package/dist/application/replay/contract.d.ts +2007 -0
  10. package/dist/application/replay/engine.d.ts +101 -0
  11. package/dist/application/replay/index.d.ts +7 -0
  12. package/dist/application/replay/privacy.d.ts +14 -0
  13. package/dist/{runtime → application}/schema.d.ts +1176 -370
  14. package/dist/cli.js +295 -2721
  15. package/dist/cli.js.map +7 -6
  16. package/dist/config-shared.d.ts +28 -14
  17. package/dist/config.d.ts +1 -1
  18. package/dist/distribution/legacy-cleanup.d.ts +25 -0
  19. package/dist/domain/feature-id.d.ts +3 -0
  20. package/dist/domain/limits.d.ts +1 -0
  21. package/dist/domain/orchestration-policy.d.ts +27 -0
  22. package/dist/domain/session.d.ts +355 -0
  23. package/dist/domain/transitions.d.ts +163 -0
  24. package/dist/domain/validation-command.d.ts +8 -0
  25. package/dist/guidance/catalog.d.ts +18 -0
  26. package/dist/guidance/ids.d.ts +4 -0
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +4495 -1817
  29. package/dist/index.js.map +30 -18
  30. package/dist/infrastructure/fs/evidence-artifact-store.d.ts +5 -0
  31. package/dist/infrastructure/fs/session-repository.d.ts +2 -0
  32. package/dist/infrastructure/fs/source-identity.d.ts +26 -0
  33. package/dist/infrastructure/fs/workspace-flow-service.d.ts +9 -0
  34. package/dist/{runtime → infrastructure/fs}/workspace.d.ts +12 -15
  35. package/dist/infrastructure/system/transition-environment.d.ts +2 -0
  36. package/dist/platform/opencode/config.d.ts +2 -0
  37. package/dist/{adapters → platform}/opencode/plugin.d.ts +1 -1
  38. package/dist/{adapters → platform}/opencode/sdk.d.ts +0 -1
  39. package/dist/platform/opencode/tools.d.ts +6 -0
  40. package/dist/prompt-model-evaluation.d.ts +19 -30
  41. package/dist/prompt-quality.d.ts +1 -1
  42. package/dist/version.d.ts +1 -0
  43. package/package.json +18 -11
  44. package/dist/adapters/opencode/config.d.ts +0 -3
  45. package/dist/adapters/opencode/tools.d.ts +0 -322
  46. package/dist/distribution/flow-skill-definitions.d.ts +0 -9
  47. package/dist/distribution/sync.d.ts +0 -69
  48. package/dist/runtime/api.d.ts +0 -211
  49. package/dist/runtime/time.d.ts +0 -2
  50. package/dist/runtime/transitions.d.ts +0 -230
  51. /package/dist/{runtime/json/strict-object.d.ts → infrastructure/fs/strict-json-object.d.ts} +0 -0
  52. /package/dist/{adapters → platform}/opencode/logging.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,96 @@
2
2
 
3
3
  One short entry per release, written for users deciding whether to upgrade.
4
4
 
5
+ ## [5.1.0] - 2026-07-18
6
+
7
+ Causal evidence and review truth lore makes long-running Flow work compact,
8
+ retry-safe, and auditable without putting raw evidence into model-visible state:
9
+
10
+ - Session v3 gains additive revision and snapshot identity, an authenticated
11
+ mutation ledger, and guarded idempotent operations. Existing sparse v3
12
+ sessions hydrate to the canonical revision-zero state without a migration.
13
+ - `flow_status` now separates compact routing, complete execution, bounded
14
+ detail, reviewer, and revision-delta projections. Mutations return receipts
15
+ instead of the full session; the checked-in six-feature fixture preserves all
16
+ transition decisions while reducing measured stateful response bytes by
17
+ 93.95%, with the unavailable historical same-corpus gate reported as such.
18
+ - Validation evidence is bound to a deterministic source digest. Optional raw
19
+ output lives in an owner-only, hash-addressed `.flow/evidence` store with
20
+ strict size, permission, symlink, integrity, and no-clobber checks; ordinary
21
+ state records only typed digest and length references, and concurrent
22
+ publishers converge on the same ignore policy across platforms.
23
+ - Review executions are durable independently of completion, with stable
24
+ attempt and logical-pass identity, typed finding fingerprints, append-only
25
+ failed-to-passed retry history, contradiction checks, and explicit final-
26
+ feature chronology. Malformed optional orchestration telemetry can no longer
27
+ erase valid core review evidence.
28
+ - A provider-neutral sanitized replay oracle derives terminal and retry truth
29
+ from event causality, rejects private or unsafe fixture content, and keeps
30
+ host facts, Flow-ledger claims, supplied observations, and replay-derived
31
+ facts distinct. New `replay:report` and `transport:report` commands expose the
32
+ reproducible local reports.
33
+ - Manager and reviewer guidance now routes from compact status to exact
34
+ execution context, records every observed review attempt, performs final
35
+ feature validation and reviews in economy order, and closes only from a
36
+ refreshed compact projection.
37
+
38
+ ## [5.0.0] - 2026-07-18
39
+
40
+ TypeScript 7 hard-cutover lore makes Flow 5 smaller, stricter, and easier to
41
+ recover without carrying a v4 compatibility layer:
42
+
43
+ - The compiler is TypeScript 7.0.2; the pinned toolchain is Bun 1.3.14,
44
+ Biome 2.5.4, OpenCode plugin 1.18.3, and Zod 4.4.3. Published code now
45
+ requires Node.js 24 or newer and CI covers Node 24 and 26.
46
+ - Source code now follows `domain -> application -> infrastructure ->
47
+ platform`: pure transitions use injected time and IDs, application use cases
48
+ depend on repository ports, filesystem state is an outer implementation,
49
+ and OpenCode owns only host transport and rendering.
50
+ - OpenCode's embedded validator is private to the host adapter. Flow's core
51
+ schemas use its direct Zod dependency, shared fixtures keep both wire
52
+ contracts aligned, and declaration emit no longer leaks package-manager or
53
+ nested-validator paths.
54
+ - Persisted sessions use schema version 3. Version 2 sessions are not migrated;
55
+ they are reported as unsupported and preserved in quarantine so a new v5
56
+ session can start safely.
57
+ - Public use-case results have an explicit typed operation status. Repository-
58
+ and caller-controlled prose is confined to `workflowData`; top-level
59
+ summaries, next actions, and recovery fields remain plugin-authored. Feature
60
+ and session IDs are branded, feature IDs are consistently lowercase
61
+ kebab-case at every input boundary, and all superseded `src/runtime` and
62
+ `src/adapters` entrypoints are removed.
63
+ - Source and declaration imports follow NodeNext ESM rules with explicit `.js`
64
+ specifiers, and the packed-package smoke test compiles a strict NodeNext
65
+ consumer without skipping library checks before importing the plugin in Node.
66
+ - Workspace roots are canonicalized and every Flow-managed directory and file
67
+ rejects symbolic links before read or mutation. Archive publication is
68
+ no-clobber and retry-safe, while lock contention and malformed owner metadata
69
+ fail closed for manual inspection instead of using age or liveness to steal a
70
+ lock. Completion outcomes require an explicit discriminator, and domain
71
+ transitions copy caller-owned plan and evidence collections before recording
72
+ them.
73
+ - Flow no longer synchronizes Markdown into OpenCode's global skill registry.
74
+ Core command guidance and optional helpers are embedded in the plugin;
75
+ `flow_guidance` returns exact package-versioned documents by stable id, plugin
76
+ startup performs no global skill filesystem work, and `flow_status` no longer
77
+ carries setup/restart health.
78
+ - Plugin configuration only registers commands and agents; it performs no
79
+ workspace filesystem I/O and maintains no ambient instruction projection.
80
+ `/flow-review` validates OpenCode's native subtask identity and agent before
81
+ rewriting only its prompt, so malformed dispatch fails closed.
82
+ - Orchestration telemetry retains at most 50 recent pass records and accepts at
83
+ most 50 per completion. Deduplication is scoped to that retained telemetry
84
+ window, and failed completion mutations now update `timestamps.updatedAt`
85
+ from the same instant recorded in `lastError`.
86
+ - The experimental compaction hook, token telemetry, phase boundaries, resume
87
+ packets, and acknowledgement protocol are gone. Review retry exhaustion uses
88
+ the ordinary blocked-feature/reset path, while a recorded closure makes the
89
+ session archive-only until retry-safe publication succeeds.
90
+ - The old doctor/sync/uninstall CLI is replaced by explicit
91
+ `legacy-cleanup --dry-run|--apply`. Apply never deletes: it moves only
92
+ marker-proven pristine v4 folders to a recovery archive and refuses
93
+ foreign, edited, extra, malformed, or symlinked content.
94
+
5
95
  ## [4.4.0] - 2026-07-17
6
96
 
7
97
  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.1.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
@@ -42,20 +41,34 @@ restart.
42
41
  features: rate-limit-middleware, per-route-config, docs-update
43
42
  (you approve the plan)
44
43
  flow_plan_approve plan locked — features are now immutable
45
- flow_run_start feature: rate-limit-middleware
44
+ flow_run_start mutation acknowledged
45
+ flow_status view: execution, feature: rate-limit-middleware
46
46
  ... implementation, tests ...
47
47
  flow_feature_complete
48
48
  validationRun: "bun test tests/middleware.test.ts" passed
49
49
  featureReviewDepth: standard
50
50
  featureReview: passed
51
- flow_run_start feature: per-route-config
51
+ flow_run_start mutation acknowledged
52
+ flow_status view: execution, feature: per-route-config
52
53
  ...
53
54
 
54
55
  > /flow-status
55
- status: running, 1/3 features completed
56
- nextAction: complete feature "per-route-config"
56
+ status: ok
57
+ workflowData.projection.view: compact
58
+ workflowData.projection.status: running
59
+ workflowData.projection.progress: { completed: 1, total: 3, remaining: 2 }
60
+
61
+ > /flow-run
62
+ flow_status view: execution
63
+ workflowData.projection: full active-feature scope
57
64
  ```
58
65
 
66
+ `flow_status` returns workflow state under `workflowData.projection`: compact is
67
+ routing-only, execution is the full active-feature working scope, detail is
68
+ diagnostic, and reviewer is narrow assignment context. State-changing tools
69
+ return `workflowData.receipt` acknowledgements; a receipt never replaces a
70
+ fresh status projection.
71
+
59
72
  Interrupt at any point; `/flow-run` resumes the next approved feature. On the
60
73
  final feature Flow requires broad project-level validation and a final review
61
74
  whose depth matches the approved plan before the session can close as
@@ -65,7 +78,7 @@ completed.
65
78
 
66
79
  | Command | Purpose |
67
80
  | --- | --- |
68
- | `/flow-auto <goal>` | Drive the full skill-guided loop. |
81
+ | `/flow-auto <goal>` | Drive the full guidance-driven loop. |
69
82
  | `/flow-plan <goal>` | Create or approve a plan. |
70
83
  | `/flow-run` | Execute one approved feature. |
71
84
  | `/flow-review` | Run a read-only review. |
@@ -73,20 +86,22 @@ completed.
73
86
 
74
87
  Commands are compiled entrypoints: manager commands carry only their applicable
75
88
  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)).
89
+ role-specific agent contract. Flow does not install files into OpenCode's
90
+ global skill registry and does not depend on native skill discovery.
79
91
 
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.
92
+ `flow-test`, `flow-deslop`, `flow-ui-quality`, and `flow-commit` are optional
93
+ package-owned guides loaded on demand through `flow_guidance`, not public
94
+ commands. `flow-commit` is user-triggered only and stays outside the autonomous
95
+ loop.
83
96
 
84
97
  ## Tools
85
98
 
86
- The runtime exposes seven tools:
99
+ The plugin exposes eight tools. `flow_guidance` is read-only and returns embedded
100
+ Markdown; the other seven form the stateful runtime surface:
87
101
 
88
102
  | Tool | Purpose |
89
103
  | --- | --- |
104
+ | `flow_guidance` | Load exact package-owned guidance by stable id. |
90
105
  | `flow_status` | Read the active session and next action. |
91
106
  | `flow_plan_save` | Create a session and/or save a draft plan. |
92
107
  | `flow_plan_approve` | Approve the draft plan. |
@@ -101,7 +116,7 @@ final feature also needs a passing `finalReview`.
101
116
 
102
117
  ## What the runtime enforces
103
118
 
104
- The runtime owns only safety; judgment lives in the skills:
119
+ The runtime owns only safety; judgment lives in package-owned guidance:
105
120
 
106
121
  - `.flow/session.json` is the single source of truth; writes are locked and
107
122
  atomic, and closed sessions are archived under `.flow/history/`.
@@ -114,19 +129,18 @@ The runtime owns only safety; judgment lives in the skills:
114
129
  that is shallower than the approved feature requires.
115
130
  - Failed reviews are bounded: a failed review pauses by default, and autonomous
116
131
  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.
132
+ - Review exhaustion uses the ordinary blocked-feature state; continuing requires
133
+ an explicit `flow_feature_reset`, not a second checkpoint protocol.
134
+ - Once a closure is recorded, the session is archive-only. If publication fails,
135
+ retry `flow_session_close`; no run, reset, approval, or replan can reopen it.
123
136
  - 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.
137
+ - Session locks fail closed: Flow never guesses that an old lock is abandoned,
138
+ and only the unique owner may release it. Unreadable session files are
139
+ quarantined with recovery guidance, never silently deleted.
127
140
  - 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.
141
+ - `.flow/session.json` is the only active-state representation. Canonical Flow
142
+ commands call `flow_status` before acting; plugin configuration does not read,
143
+ refresh, or project workspace state.
130
144
 
131
145
  ## Hidden workers
132
146
 
@@ -153,27 +167,29 @@ For broad implementation, the manager records whether work stayed serial,
153
167
  used exact-path candidate workers, used isolated worktrees, ran a tournament, or
154
168
  skipped eligible candidates. Feature completion can carry bounded
155
169
  `orchestrationPasses` with candidate eligibility, decision, and structured
156
- factors; `flow_status` reports the aggregate under
157
- `session.budget.orchestration`.
170
+ factors. Bounded projections report the relevant aggregate while full worker
171
+ handoffs remain outside `.flow/**`.
158
172
 
159
- ## Install details, doctor, repair, uninstall
173
+ ## Install details and legacy cleanup
160
174
 
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).
175
+ See [docs/troubleshooting.md](docs/troubleshooting.md) for updates,
176
+ older-OpenCode install fallback, stuck session recovery, and removal of global
177
+ Flow skill folders left by v4.
164
178
 
165
- To update a pinned Flow version, rerun the install command with the new
166
- version. To inspect skill health:
179
+ To update a pinned Flow version, rerun the install command with the new version.
180
+ Flow starts with the new package-owned guidance immediately; no second restart
181
+ or sync command is required. To preview recoverable migration of pristine v4
182
+ global skill folders:
167
183
 
168
184
  ```bash
169
- npx -y opencode-plugin-flow@4.4.0 doctor
185
+ npx -y opencode-plugin-flow@5.1.0 legacy-cleanup --dry-run
170
186
  ```
171
187
 
172
188
  ## Development
173
189
 
174
190
  ```bash
175
191
  bun install
176
- bun run check # typecheck + lint + build + tests
192
+ bun run check # typecheck + lint + prompt quality + build + tests
177
193
  bun run smoke:live # boots a real OpenCode server against the packed tarball
178
194
  ```
179
195
 
@@ -185,7 +201,8 @@ import flowPlugin from "opencode-plugin-flow";
185
201
 
186
202
  See [docs/development.md](docs/development.md) and
187
203
  [docs/maintainer-contract.md](docs/maintainer-contract.md) for the
188
- runtime/skills split and release process.
204
+ v5 domain/application/infrastructure/platform boundaries, guidance split, and
205
+ release process.
189
206
 
190
207
  ## Credits
191
208
 
@@ -195,5 +212,5 @@ work on parallel agent workflows. Flow also draws conceptual inspiration from
195
212
  emphasis on codebase orientation, context engineering, agent orchestration,
196
213
  and reviewable handoffs.
197
214
 
198
- The Flow version is its own OpenCode-native design: skills-first,
215
+ The Flow version is its own OpenCode-native design: package-owned guidance,
199
216
  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
+ }
@@ -0,0 +1,339 @@
1
+ import { z } from "zod";
2
+ import type { Session, SessionId } from "../domain/session.js";
3
+ import { mutationReceiptProjection, type TransitionEnvironment } from "../domain/transitions.js";
4
+ import type { SessionRepository } from "./ports/session-repository.js";
5
+ type WorkflowData = {
6
+ projection?: unknown;
7
+ receipt?: ReturnType<typeof mutationReceiptProjection>;
8
+ failure?: {
9
+ summary: string;
10
+ recovery?: string;
11
+ };
12
+ archive?: {
13
+ sessionId: SessionId;
14
+ closure: Session["closure"];
15
+ };
16
+ quarantine?: {
17
+ reason: string;
18
+ preservedAt?: string;
19
+ };
20
+ };
21
+ type ResponseContext = {
22
+ statusSummary?: string;
23
+ nextAction?: string;
24
+ dataNote?: string;
25
+ warnings?: string[];
26
+ workflowData?: WorkflowData;
27
+ recovery?: string;
28
+ };
29
+ export type FlowResponse = ResponseContext & {
30
+ status: "ok" | "error" | "missing_goal" | "missing_session";
31
+ summary: string;
32
+ };
33
+ export type FlowService = {
34
+ status(input?: unknown): Promise<FlowResponse>;
35
+ planSave(input: unknown): Promise<FlowResponse>;
36
+ planApprove(): Promise<FlowResponse>;
37
+ runStart(input: unknown): Promise<FlowResponse>;
38
+ featureComplete(input: unknown): Promise<FlowResponse>;
39
+ featureReset(input: unknown): Promise<FlowResponse>;
40
+ sessionClose(input: unknown): Promise<FlowResponse>;
41
+ };
42
+ export declare const FlowStatusSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
43
+ view: z.ZodLiteral<"reviewer">;
44
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
45
+ packetHash: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
46
+ evidenceRefs: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>>;
47
+ expectedRevision: z.ZodNumber;
48
+ expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
49
+ reviewKind: z.ZodLiteral<"feature">;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ view: z.ZodLiteral<"reviewer">;
52
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
53
+ packetHash: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
54
+ evidenceRefs: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>>;
55
+ expectedRevision: z.ZodNumber;
56
+ expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
57
+ reviewKind: z.ZodLiteral<"final">;
58
+ }, z.core.$strict>], "reviewKind">, z.ZodObject<{
59
+ view: z.ZodLiteral<"execution">;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ view: z.ZodLiteral<"detail">;
62
+ sinceRevision: z.ZodOptional<z.ZodNumber>;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ view: z.ZodDefault<z.ZodLiteral<"compact">>;
65
+ sinceRevision: z.ZodOptional<z.ZodNumber>;
66
+ }, z.core.$strict>]>;
67
+ export declare const FlowPlanSaveSchema: z.ZodObject<{
68
+ goal: z.ZodOptional<z.ZodString>;
69
+ plan: z.ZodOptional<z.ZodObject<{
70
+ summary: z.ZodString;
71
+ overview: z.ZodString;
72
+ requirements: z.ZodDefault<z.ZodArray<z.ZodString>>;
73
+ decisions: z.ZodDefault<z.ZodArray<z.ZodString>>;
74
+ finalReviewPolicy: z.ZodOptional<z.ZodEnum<{
75
+ broad: "broad";
76
+ detailed: "detailed";
77
+ }>>;
78
+ features: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
80
+ title: z.ZodString;
81
+ summary: z.ZodString;
82
+ status: z.ZodOptional<z.ZodEnum<{
83
+ blocked: "blocked";
84
+ completed: "completed";
85
+ in_progress: "in_progress";
86
+ pending: "pending";
87
+ }>>;
88
+ reviewDepth: z.ZodOptional<z.ZodEnum<{
89
+ detailed: "detailed";
90
+ quick: "quick";
91
+ standard: "standard";
92
+ }>>;
93
+ targets: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ validation: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>>>;
96
+ }, z.core.$strict>>;
97
+ }, z.core.$strict>>;
98
+ }, z.core.$strict>;
99
+ export declare const FlowRunStartSchema: z.ZodObject<{
100
+ featureId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>>;
101
+ }, z.core.$strict>;
102
+ export declare const FlowFeatureResetSchema: z.ZodObject<{
103
+ operationId: z.ZodString;
104
+ expectedRevision: z.ZodNumber;
105
+ expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
106
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
107
+ }, z.core.$strict>;
108
+ export declare const FlowSessionCloseSchema: z.ZodObject<{
109
+ operationId: z.ZodString;
110
+ expectedRevision: z.ZodNumber;
111
+ expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
112
+ kind: z.ZodEnum<{
113
+ abandoned: "abandoned";
114
+ completed: "completed";
115
+ deferred: "deferred";
116
+ }>;
117
+ summary: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strict>;
119
+ export declare const FlowFeatureCompleteToolSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ operationId: z.ZodString;
121
+ expectedRevision: z.ZodNumber;
122
+ expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
123
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
124
+ summary: z.ZodString;
125
+ status: z.ZodLiteral<"ok">;
126
+ artifactsChanged: z.ZodDefault<z.ZodArray<z.ZodObject<{
127
+ path: z.ZodString;
128
+ }, z.core.$strict>>>;
129
+ validations: z.ZodArray<z.ZodObject<{
130
+ startedAt: z.ZodString;
131
+ completedAt: z.ZodString;
132
+ command: z.ZodString;
133
+ summary: z.ZodString;
134
+ exitCode: z.ZodNumber;
135
+ outputDigest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
136
+ artifactRef: z.ZodOptional<z.ZodObject<{
137
+ kind: z.ZodLiteral<"restricted_evidence_v1">;
138
+ digest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
139
+ byteLength: z.ZodNumber;
140
+ }, z.core.$strict>>;
141
+ environmentKeys: z.ZodArray<z.ZodString>;
142
+ }, z.core.$strict>>;
143
+ validationScope: z.ZodEnum<{
144
+ broad: "broad";
145
+ targeted: "targeted";
146
+ }>;
147
+ featureReviewDepth: z.ZodEnum<{
148
+ detailed: "detailed";
149
+ quick: "quick";
150
+ standard: "standard";
151
+ }>;
152
+ featureReview: z.ZodObject<{
153
+ status: z.ZodEnum<{
154
+ failed: "failed";
155
+ passed: "passed";
156
+ }>;
157
+ summary: z.ZodString;
158
+ blockingFindings: z.ZodDefault<z.ZodArray<z.ZodObject<{
159
+ summary: z.ZodString;
160
+ severity: z.ZodDefault<z.ZodEnum<{
161
+ advisory: "advisory";
162
+ blocking: "blocking";
163
+ }>>;
164
+ }, z.core.$strict>>>;
165
+ }, z.core.$strict>;
166
+ finalReview: z.ZodOptional<z.ZodObject<{
167
+ status: z.ZodEnum<{
168
+ failed: "failed";
169
+ passed: "passed";
170
+ }>;
171
+ summary: z.ZodString;
172
+ blockingFindings: z.ZodDefault<z.ZodArray<z.ZodObject<{
173
+ summary: z.ZodString;
174
+ severity: z.ZodDefault<z.ZodEnum<{
175
+ advisory: "advisory";
176
+ blocking: "blocking";
177
+ }>>;
178
+ }, z.core.$strict>>>;
179
+ reviewDepth: z.ZodEnum<{
180
+ broad: "broad";
181
+ detailed: "detailed";
182
+ }>;
183
+ }, z.core.$strict>>;
184
+ reviewExecutions: z.ZodArray<z.ZodObject<{
185
+ attemptId: z.ZodString;
186
+ logicalPassId: z.ZodString;
187
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
188
+ reviewKind: z.ZodEnum<{
189
+ feature: "feature";
190
+ final: "final";
191
+ }>;
192
+ reviewSnapshotId: z.ZodPipe<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>>;
193
+ verdict: z.ZodEnum<{
194
+ failed: "failed";
195
+ passed: "passed";
196
+ }>;
197
+ startedAt: z.ZodString;
198
+ completedAt: z.ZodString;
199
+ terminalDisposition: z.ZodEnum<{
200
+ observed_unsubmitted: "observed_unsubmitted";
201
+ submitted: "submitted";
202
+ }>;
203
+ findings: z.ZodArray<z.ZodObject<{
204
+ taxonomy: z.ZodEnum<{
205
+ advisory: "advisory";
206
+ evidence_gap: "evidence_gap";
207
+ implementation_defect: "implementation_defect";
208
+ regression_coverage_gap: "regression_coverage_gap";
209
+ }>;
210
+ subject: z.ZodString;
211
+ requirementOrRisk: z.ZodString;
212
+ evidenceLocator: z.ZodString;
213
+ summary: z.ZodString;
214
+ severity: z.ZodEnum<{
215
+ advisory: "advisory";
216
+ blocking: "blocking";
217
+ }>;
218
+ }, z.core.$strict>>;
219
+ }, z.core.$strict>>;
220
+ outcome: z.ZodOptional<z.ZodObject<{
221
+ kind: z.ZodLiteral<"completed">;
222
+ summary: z.ZodOptional<z.ZodString>;
223
+ resolutionHint: z.ZodOptional<z.ZodString>;
224
+ }, z.core.$strict>>;
225
+ orchestrationPasses: z.ZodOptional<z.ZodUnknown>;
226
+ }, z.core.$strict>, z.ZodObject<{
227
+ operationId: z.ZodString;
228
+ expectedRevision: z.ZodNumber;
229
+ expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
230
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
231
+ summary: z.ZodString;
232
+ status: z.ZodLiteral<"needs_input">;
233
+ artifactsChanged: z.ZodDefault<z.ZodArray<z.ZodObject<{
234
+ path: z.ZodString;
235
+ }, z.core.$strict>>>;
236
+ validations: z.ZodDefault<z.ZodArray<z.ZodObject<{
237
+ startedAt: z.ZodString;
238
+ completedAt: z.ZodString;
239
+ command: z.ZodString;
240
+ summary: z.ZodString;
241
+ exitCode: z.ZodNumber;
242
+ outputDigest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
243
+ artifactRef: z.ZodOptional<z.ZodObject<{
244
+ kind: z.ZodLiteral<"restricted_evidence_v1">;
245
+ digest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
246
+ byteLength: z.ZodNumber;
247
+ }, z.core.$strict>>;
248
+ environmentKeys: z.ZodArray<z.ZodString>;
249
+ }, z.core.$strict>>>;
250
+ validationScope: z.ZodOptional<z.ZodEnum<{
251
+ broad: "broad";
252
+ targeted: "targeted";
253
+ }>>;
254
+ featureReviewDepth: z.ZodOptional<z.ZodEnum<{
255
+ detailed: "detailed";
256
+ quick: "quick";
257
+ standard: "standard";
258
+ }>>;
259
+ featureReview: z.ZodOptional<z.ZodObject<{
260
+ status: z.ZodEnum<{
261
+ failed: "failed";
262
+ passed: "passed";
263
+ }>;
264
+ summary: z.ZodString;
265
+ blockingFindings: z.ZodDefault<z.ZodArray<z.ZodObject<{
266
+ summary: z.ZodString;
267
+ severity: z.ZodDefault<z.ZodEnum<{
268
+ advisory: "advisory";
269
+ blocking: "blocking";
270
+ }>>;
271
+ }, z.core.$strict>>>;
272
+ }, z.core.$strict>>;
273
+ finalReview: z.ZodOptional<z.ZodObject<{
274
+ status: z.ZodEnum<{
275
+ failed: "failed";
276
+ passed: "passed";
277
+ }>;
278
+ summary: z.ZodString;
279
+ blockingFindings: z.ZodDefault<z.ZodArray<z.ZodObject<{
280
+ summary: z.ZodString;
281
+ severity: z.ZodDefault<z.ZodEnum<{
282
+ advisory: "advisory";
283
+ blocking: "blocking";
284
+ }>>;
285
+ }, z.core.$strict>>>;
286
+ reviewDepth: z.ZodEnum<{
287
+ broad: "broad";
288
+ detailed: "detailed";
289
+ }>;
290
+ }, z.core.$strict>>;
291
+ reviewExecutions: z.ZodDefault<z.ZodArray<z.ZodObject<{
292
+ attemptId: z.ZodString;
293
+ logicalPassId: z.ZodString;
294
+ featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
295
+ reviewKind: z.ZodEnum<{
296
+ feature: "feature";
297
+ final: "final";
298
+ }>;
299
+ reviewSnapshotId: z.ZodPipe<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>>;
300
+ verdict: z.ZodEnum<{
301
+ failed: "failed";
302
+ passed: "passed";
303
+ }>;
304
+ startedAt: z.ZodString;
305
+ completedAt: z.ZodString;
306
+ terminalDisposition: z.ZodEnum<{
307
+ observed_unsubmitted: "observed_unsubmitted";
308
+ submitted: "submitted";
309
+ }>;
310
+ findings: z.ZodArray<z.ZodObject<{
311
+ taxonomy: z.ZodEnum<{
312
+ advisory: "advisory";
313
+ evidence_gap: "evidence_gap";
314
+ implementation_defect: "implementation_defect";
315
+ regression_coverage_gap: "regression_coverage_gap";
316
+ }>;
317
+ subject: z.ZodString;
318
+ requirementOrRisk: z.ZodString;
319
+ evidenceLocator: z.ZodString;
320
+ summary: z.ZodString;
321
+ severity: z.ZodEnum<{
322
+ advisory: "advisory";
323
+ blocking: "blocking";
324
+ }>;
325
+ }, z.core.$strict>>;
326
+ }, z.core.$strict>>>;
327
+ outcome: z.ZodObject<{
328
+ kind: z.ZodEnum<{
329
+ blocked: "blocked";
330
+ needs_input: "needs_input";
331
+ replan_required: "replan_required";
332
+ }>;
333
+ summary: z.ZodString;
334
+ resolutionHint: z.ZodOptional<z.ZodString>;
335
+ }, z.core.$strict>;
336
+ orchestrationPasses: z.ZodOptional<z.ZodUnknown>;
337
+ }, z.core.$strict>], "status">;
338
+ export declare function createFlowService(repository: SessionRepository, environment: TransitionEnvironment): FlowService;
339
+ export {};
@@ -0,0 +1,28 @@
1
+ import type { EvidenceArtifactRef } from "../../domain/session.js";
2
+ export declare const MAX_EVIDENCE_ARTIFACT_BYTES: number;
3
+ export type EvidenceArtifactDigest = `sha256:${string}`;
4
+ export type { EvidenceArtifactRef } from "../../domain/session.js";
5
+ export interface EvidenceArtifactStore {
6
+ publishEvidenceArtifact(bytes: Uint8Array): Promise<EvidenceArtifactRef>;
7
+ readEvidenceArtifact(ref: EvidenceArtifactRef): Promise<Uint8Array>;
8
+ }
9
+ export declare class InvalidEvidenceArtifactReferenceError extends Error {
10
+ readonly code = "FLOW_EVIDENCE_INVALID_REFERENCE";
11
+ constructor(message: string, options?: ErrorOptions);
12
+ }
13
+ export declare class EvidenceArtifactNotFoundError extends Error {
14
+ readonly code = "FLOW_EVIDENCE_NOT_FOUND";
15
+ constructor(message: string, options?: ErrorOptions);
16
+ }
17
+ export declare class EvidenceArtifactIntegrityError extends Error {
18
+ readonly code = "FLOW_EVIDENCE_INTEGRITY";
19
+ constructor(message: string, options?: ErrorOptions);
20
+ }
21
+ export declare class EvidenceArtifactCollisionError extends Error {
22
+ readonly code = "FLOW_EVIDENCE_COLLISION";
23
+ constructor(message: string, options?: ErrorOptions);
24
+ }
25
+ export declare class EvidenceArtifactTooLargeError extends Error {
26
+ readonly code = "FLOW_EVIDENCE_TOO_LARGE";
27
+ constructor(message: string, options?: ErrorOptions);
28
+ }