opencode-plugin-flow 5.2.1 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +6 -5
  3. package/dist/cli.js +10 -1
  4. package/dist/cli.js.map +3 -3
  5. package/dist/index.js +1150 -493
  6. package/dist/index.js.map +15 -15
  7. package/package.json +12 -5
  8. package/dist/application/errors.d.ts +0 -10
  9. package/dist/application/flow-service.d.ts +0 -311
  10. package/dist/application/ports/evidence-artifact-store.d.ts +0 -28
  11. package/dist/application/ports/session-repository.d.ts +0 -22
  12. package/dist/application/ports/source-identity.d.ts +0 -61
  13. package/dist/application/replay/canonical-json.d.ts +0 -7
  14. package/dist/application/replay/contract.d.ts +0 -2130
  15. package/dist/application/replay/engine.d.ts +0 -101
  16. package/dist/application/replay/index.d.ts +0 -7
  17. package/dist/application/replay/privacy.d.ts +0 -14
  18. package/dist/application/schema.d.ts +0 -1813
  19. package/dist/cli.d.ts +0 -1
  20. package/dist/config-shared.d.ts +0 -287
  21. package/dist/config.d.ts +0 -1
  22. package/dist/distribution/legacy-cleanup.d.ts +0 -25
  23. package/dist/domain/feature-id.d.ts +0 -3
  24. package/dist/domain/limits.d.ts +0 -4
  25. package/dist/domain/orchestration-policy.d.ts +0 -27
  26. package/dist/domain/session-invariants.d.ts +0 -8
  27. package/dist/domain/session.d.ts +0 -356
  28. package/dist/domain/transitions.d.ts +0 -275
  29. package/dist/domain/validation-command.d.ts +0 -8
  30. package/dist/guidance/catalog.d.ts +0 -18
  31. package/dist/guidance/ids.d.ts +0 -4
  32. package/dist/infrastructure/fs/evidence-artifact-store.d.ts +0 -5
  33. package/dist/infrastructure/fs/session-repository.d.ts +0 -2
  34. package/dist/infrastructure/fs/source-identity.d.ts +0 -26
  35. package/dist/infrastructure/fs/strict-json-object.d.ts +0 -9
  36. package/dist/infrastructure/fs/workspace-flow-service.d.ts +0 -10
  37. package/dist/infrastructure/fs/workspace.d.ts +0 -63
  38. package/dist/infrastructure/system/transition-environment.d.ts +0 -2
  39. package/dist/platform/opencode/config.d.ts +0 -2
  40. package/dist/platform/opencode/logging.d.ts +0 -3
  41. package/dist/platform/opencode/tools.d.ts +0 -4
  42. package/dist/prompt-baseline-fixtures.d.ts +0 -20
  43. package/dist/prompt-model-evaluation.d.ts +0 -88
  44. package/dist/prompt-quality.d.ts +0 -80
  45. package/dist/prompt-surfaces.d.ts +0 -28
  46. package/dist/version.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-plugin-flow",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "Stateful planning and execution workflow plugin for OpenCode",
5
5
  "type": "module",
6
6
  "repository": {
@@ -20,7 +20,13 @@
20
20
  "opencode-plugin-flow": "./dist/cli.js"
21
21
  },
22
22
  "files": [
23
- "dist",
23
+ "dist/index.js",
24
+ "dist/index.js.map",
25
+ "dist/index.d.ts",
26
+ "dist/platform/opencode/plugin.d.ts",
27
+ "dist/platform/opencode/sdk.d.ts",
28
+ "dist/cli.js",
29
+ "dist/cli.js.map",
24
30
  "LICENSE",
25
31
  "README.md",
26
32
  "CHANGELOG.md"
@@ -29,11 +35,12 @@
29
35
  "build": "bun run clean && bun run build:plugin && bun run build:cli && bun run build:types",
30
36
  "build:plugin": "bun build --target=node --outdir=./dist --entry-naming=index.js --external=@opencode-ai/plugin --external=zod --sourcemap=external ./src/index.ts",
31
37
  "build:cli": "bun build --target=node --outdir=./dist --entry-naming=cli.js --banner='#!/usr/bin/env node' --sourcemap=external ./src/cli.ts",
32
- "build:types": "tsc -p tsconfig.types.json",
38
+ "build:types": "tsc -p tsconfig.types.json && bun run scripts/prune-dist-declarations.ts",
33
39
  "clean": "bun run scripts/clean-dist.ts",
34
- "lint": "bunx biome check src tests scripts --files-ignore-unknown=true --vcs-use-ignore-file=true",
40
+ "lint": "bunx biome check biome.json src tests scripts --files-ignore-unknown=true --vcs-use-ignore-file=true",
35
41
  "prompt:quality": "bun run scripts/prompt-quality.ts",
36
42
  "prompt:model-eval": "bun run scripts/prompt-model-eval.ts",
43
+ "release:metadata": "bun run scripts/release-metadata.ts",
37
44
  "replay:report": "bun run scripts/replay-report.ts",
38
45
  "transport:report": "bun run scripts/causal-transport-report.ts",
39
46
  "package:smoke": "bun test tests/package-smoke.test.ts",
@@ -45,7 +52,7 @@
45
52
  "verify:lifecycle": "bun run test:lifecycle:invariants && bun run test:lifecycle:recovery && bun run test:contracts",
46
53
  "test": "bun test tests",
47
54
  "typecheck": "tsc --noEmit",
48
- "check": "bun run typecheck && bun run lint && bun run prompt:quality && bun run build && bun run test"
55
+ "check": "bun run typecheck && bun run lint && bun run release:metadata && bun run prompt:quality && bun run build && bun run test"
49
56
  },
50
57
  "keywords": [
51
58
  "opencode",
@@ -1,10 +0,0 @@
1
- export declare class UnreadableFlowSessionError extends Error {
2
- readonly code = "UNREADABLE_FLOW_SESSION";
3
- readonly reason: string;
4
- constructor(message: string, reason: string);
5
- }
6
- export declare class UnsupportedFlowSessionVersionError extends Error {
7
- readonly code = "UNSUPPORTED_FLOW_SESSION_VERSION";
8
- readonly actualVersion: unknown;
9
- constructor(actualVersion: unknown);
10
- }
@@ -1,311 +0,0 @@
1
- import { z } from "zod";
2
- import type { Session, SessionId } from "../domain/session.js";
3
- import { mutationReceiptProjection, rejectedMutationReceiptProjection, 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> | ReturnType<typeof rejectedMutationReceiptProjection>;
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
- reviewStart(input: unknown): Promise<FlowResponse>;
39
- featureComplete(input: unknown): Promise<FlowResponse>;
40
- featureReset(input: unknown): Promise<FlowResponse>;
41
- sessionClose(input: unknown): Promise<FlowResponse>;
42
- };
43
- export declare const FlowStatusSchema: z.ZodObject<{
44
- request: z.ZodDiscriminatedUnion<[z.ZodObject<{
45
- view: z.ZodLiteral<"reviewer">;
46
- assignmentId: z.ZodString;
47
- }, z.core.$strict>, z.ZodObject<{
48
- view: z.ZodLiteral<"execution">;
49
- }, z.core.$strict>, z.ZodObject<{
50
- view: z.ZodLiteral<"detail">;
51
- sinceRevision: z.ZodOptional<z.ZodNumber>;
52
- }, z.core.$strict>, z.ZodObject<{
53
- view: z.ZodLiteral<"compact">;
54
- sinceRevision: z.ZodOptional<z.ZodNumber>;
55
- }, z.core.$strict>], "view">;
56
- }, z.core.$strict>;
57
- export declare const FlowPlanSaveSchema: z.ZodObject<{
58
- goal: z.ZodOptional<z.ZodString>;
59
- plan: z.ZodOptional<z.ZodObject<{
60
- summary: z.ZodString;
61
- overview: z.ZodString;
62
- requirements: z.ZodDefault<z.ZodArray<z.ZodString>>;
63
- decisions: z.ZodDefault<z.ZodArray<z.ZodString>>;
64
- finalReviewPolicy: z.ZodOptional<z.ZodEnum<{
65
- broad: "broad";
66
- detailed: "detailed";
67
- }>>;
68
- features: z.ZodArray<z.ZodObject<{
69
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
70
- title: z.ZodString;
71
- summary: z.ZodString;
72
- status: z.ZodOptional<z.ZodEnum<{
73
- blocked: "blocked";
74
- completed: "completed";
75
- in_progress: "in_progress";
76
- pending: "pending";
77
- }>>;
78
- reviewDepth: z.ZodOptional<z.ZodEnum<{
79
- detailed: "detailed";
80
- quick: "quick";
81
- standard: "standard";
82
- }>>;
83
- targets: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
- validation: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
- dependsOn: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>>>;
86
- }, z.core.$strict>>;
87
- }, z.core.$strict>>;
88
- }, z.core.$strict>;
89
- export declare const FlowRunStartSchema: z.ZodObject<{
90
- featureId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>>;
91
- }, z.core.$strict>;
92
- export declare const FlowFeatureResetSchema: z.ZodObject<{
93
- operationId: z.ZodString;
94
- expectedRevision: z.ZodNumber;
95
- expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
96
- featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
97
- }, z.core.$strict>;
98
- export declare const FlowSessionCloseSchema: z.ZodObject<{
99
- request: z.ZodDiscriminatedUnion<[z.ZodObject<{
100
- mode: z.ZodLiteral<"start">;
101
- operationId: z.ZodString;
102
- expectedRevision: z.ZodNumber;
103
- expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
104
- kind: z.ZodEnum<{
105
- abandoned: "abandoned";
106
- completed: "completed";
107
- deferred: "deferred";
108
- }>;
109
- summary: z.ZodOptional<z.ZodString>;
110
- }, z.core.$strict>, z.ZodObject<{
111
- mode: z.ZodLiteral<"retry">;
112
- operationId: z.ZodString;
113
- }, z.core.$strict>], "mode">;
114
- }, z.core.$strict>;
115
- export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
116
- request: z.ZodObject<{
117
- operationId: z.ZodString;
118
- expectedRevision: z.ZodNumber;
119
- expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
120
- featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
121
- result: z.ZodUnion<readonly [z.ZodObject<{
122
- kind: z.ZodLiteral<"completed">;
123
- summary: z.ZodString;
124
- artifactsChanged: z.ZodDefault<z.ZodArray<z.ZodObject<{
125
- path: z.ZodString;
126
- }, z.core.$strict>>>;
127
- orchestrationPasses: z.ZodOptional<z.ZodUnknown>;
128
- validationScope: z.ZodLiteral<"targeted">;
129
- featureReview: z.ZodObject<{
130
- assignmentId: z.ZodString;
131
- verdict: z.ZodEnum<{
132
- failed: "failed";
133
- passed: "passed";
134
- }>;
135
- findings: z.ZodArray<z.ZodObject<{
136
- taxonomy: z.ZodEnum<{
137
- advisory: "advisory";
138
- evidence_gap: "evidence_gap";
139
- implementation_defect: "implementation_defect";
140
- regression_coverage_gap: "regression_coverage_gap";
141
- }>;
142
- subject: z.ZodString;
143
- requirementOrRisk: z.ZodString;
144
- evidenceLocator: z.ZodString;
145
- summary: z.ZodString;
146
- severity: z.ZodEnum<{
147
- advisory: "advisory";
148
- blocking: "blocking";
149
- }>;
150
- }, z.core.$strict>>;
151
- completedAt: z.ZodString;
152
- terminalDisposition: z.ZodEnum<{
153
- observed_unsubmitted: "observed_unsubmitted";
154
- submitted: "submitted";
155
- }>;
156
- }, z.core.$strict>;
157
- }, z.core.$strict>, z.ZodObject<{
158
- kind: z.ZodLiteral<"completed">;
159
- summary: z.ZodString;
160
- artifactsChanged: z.ZodDefault<z.ZodArray<z.ZodObject<{
161
- path: z.ZodString;
162
- }, z.core.$strict>>>;
163
- orchestrationPasses: z.ZodOptional<z.ZodUnknown>;
164
- validationScope: z.ZodLiteral<"broad">;
165
- finalReview: z.ZodObject<{
166
- assignmentId: z.ZodString;
167
- verdict: z.ZodEnum<{
168
- failed: "failed";
169
- passed: "passed";
170
- }>;
171
- findings: z.ZodArray<z.ZodObject<{
172
- taxonomy: z.ZodEnum<{
173
- advisory: "advisory";
174
- evidence_gap: "evidence_gap";
175
- implementation_defect: "implementation_defect";
176
- regression_coverage_gap: "regression_coverage_gap";
177
- }>;
178
- subject: z.ZodString;
179
- requirementOrRisk: z.ZodString;
180
- evidenceLocator: z.ZodString;
181
- summary: z.ZodString;
182
- severity: z.ZodEnum<{
183
- advisory: "advisory";
184
- blocking: "blocking";
185
- }>;
186
- }, z.core.$strict>>;
187
- completedAt: z.ZodString;
188
- terminalDisposition: z.ZodEnum<{
189
- observed_unsubmitted: "observed_unsubmitted";
190
- submitted: "submitted";
191
- }>;
192
- }, z.core.$strict>;
193
- }, z.core.$strict>, z.ZodObject<{
194
- kind: z.ZodLiteral<"blocked">;
195
- summary: z.ZodString;
196
- review: z.ZodObject<{
197
- assignmentId: z.ZodString;
198
- verdict: z.ZodEnum<{
199
- failed: "failed";
200
- passed: "passed";
201
- }>;
202
- findings: z.ZodArray<z.ZodObject<{
203
- taxonomy: z.ZodEnum<{
204
- advisory: "advisory";
205
- evidence_gap: "evidence_gap";
206
- implementation_defect: "implementation_defect";
207
- regression_coverage_gap: "regression_coverage_gap";
208
- }>;
209
- subject: z.ZodString;
210
- requirementOrRisk: z.ZodString;
211
- evidenceLocator: z.ZodString;
212
- summary: z.ZodString;
213
- severity: z.ZodEnum<{
214
- advisory: "advisory";
215
- blocking: "blocking";
216
- }>;
217
- }, z.core.$strict>>;
218
- completedAt: z.ZodString;
219
- terminalDisposition: z.ZodEnum<{
220
- observed_unsubmitted: "observed_unsubmitted";
221
- submitted: "submitted";
222
- }>;
223
- }, z.core.$strict>;
224
- resolutionHint: z.ZodOptional<z.ZodString>;
225
- orchestrationPasses: z.ZodOptional<z.ZodUnknown>;
226
- }, z.core.$strict>]>;
227
- }, z.core.$strict>;
228
- }, z.core.$strict>;
229
- export declare const FlowReviewStartSchema: z.ZodObject<{
230
- request: z.ZodDiscriminatedUnion<[z.ZodObject<{
231
- operationId: z.ZodString;
232
- expectedRevision: z.ZodNumber;
233
- expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
234
- featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
235
- packet: z.ZodObject<{
236
- summary: z.ZodString;
237
- riskLenses: z.ZodDefault<z.ZodArray<z.ZodString>>;
238
- }, z.core.$strict>;
239
- validations: z.ZodArray<z.ZodObject<{
240
- startedAt: z.ZodString;
241
- completedAt: z.ZodString;
242
- command: z.ZodString;
243
- summary: z.ZodString;
244
- exitCode: z.ZodNumber;
245
- outputDigest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
246
- artifactRef: z.ZodOptional<z.ZodObject<{
247
- kind: z.ZodLiteral<"restricted_evidence_v1">;
248
- digest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
249
- byteLength: z.ZodNumber;
250
- }, z.core.$strict>>;
251
- environmentKeys: z.ZodArray<z.ZodString>;
252
- }, z.core.$strict>>;
253
- reviewKind: z.ZodLiteral<"feature">;
254
- validationScope: z.ZodLiteral<"targeted">;
255
- }, z.core.$strict>, z.ZodObject<{
256
- operationId: z.ZodString;
257
- expectedRevision: z.ZodNumber;
258
- expectedSnapshotId: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
259
- featureId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../domain/session.js").FeatureId, string>>;
260
- packet: z.ZodObject<{
261
- summary: z.ZodString;
262
- riskLenses: z.ZodDefault<z.ZodArray<z.ZodString>>;
263
- }, z.core.$strict>;
264
- validations: z.ZodArray<z.ZodObject<{
265
- startedAt: z.ZodString;
266
- completedAt: z.ZodString;
267
- command: z.ZodString;
268
- summary: z.ZodString;
269
- exitCode: z.ZodNumber;
270
- outputDigest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
271
- artifactRef: z.ZodOptional<z.ZodObject<{
272
- kind: z.ZodLiteral<"restricted_evidence_v1">;
273
- digest: z.ZodPipe<z.ZodString, z.ZodTransform<`sha256:${string}`, string>>;
274
- byteLength: z.ZodNumber;
275
- }, z.core.$strict>>;
276
- environmentKeys: z.ZodArray<z.ZodString>;
277
- }, z.core.$strict>>;
278
- reviewKind: z.ZodLiteral<"final">;
279
- validationScope: z.ZodLiteral<"broad">;
280
- featureReview: z.ZodObject<{
281
- assignmentId: z.ZodString;
282
- verdict: z.ZodEnum<{
283
- failed: "failed";
284
- passed: "passed";
285
- }>;
286
- findings: z.ZodArray<z.ZodObject<{
287
- taxonomy: z.ZodEnum<{
288
- advisory: "advisory";
289
- evidence_gap: "evidence_gap";
290
- implementation_defect: "implementation_defect";
291
- regression_coverage_gap: "regression_coverage_gap";
292
- }>;
293
- subject: z.ZodString;
294
- requirementOrRisk: z.ZodString;
295
- evidenceLocator: z.ZodString;
296
- summary: z.ZodString;
297
- severity: z.ZodEnum<{
298
- advisory: "advisory";
299
- blocking: "blocking";
300
- }>;
301
- }, z.core.$strict>>;
302
- completedAt: z.ZodString;
303
- terminalDisposition: z.ZodEnum<{
304
- observed_unsubmitted: "observed_unsubmitted";
305
- submitted: "submitted";
306
- }>;
307
- }, z.core.$strict>;
308
- }, z.core.$strict>], "reviewKind">;
309
- }, z.core.$strict>;
310
- export declare function createFlowService(repository: SessionRepository, environment: TransitionEnvironment): FlowService;
311
- export {};
@@ -1,28 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
1
- import type { Session } from "../../domain/session.js";
2
- import type { EvidenceArtifactStore } from "./evidence-artifact-store.js";
3
- import type { SourceIdentityProvider } from "./source-identity.js";
4
- export declare class ArchivedSessionLookupError extends Error {
5
- readonly code = "FLOW_ARCHIVE_LOOKUP_FAILED";
6
- readonly failureKind: "history-integrity" | "helper-runtime";
7
- constructor(message: string, options?: ErrorOptions & {
8
- failureKind?: "history-integrity" | "helper-runtime";
9
- });
10
- }
11
- export type SessionTransaction = EvidenceArtifactStore & SourceIdentityProvider & {
12
- load(): Promise<Session | null>;
13
- findArchivedByCloseRetryOperationId(operationId: string): Promise<Session | null>;
14
- findArchivedByOperationId(operationId: string): Promise<Session | null>;
15
- save(session: Session): Promise<Session>;
16
- archiveAndClear(session: Session): Promise<void>;
17
- quarantineUnreadable(): Promise<string | null>;
18
- };
19
- export interface SessionRepository {
20
- read(): Promise<Session | null>;
21
- transact<T>(task: (transaction: SessionTransaction) => Promise<T>): Promise<T>;
22
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * Application port for the authoritative source/worktree identity boundary.
3
- *
4
- * The provider derives a canonical, deterministic digest of the workspace
5
- * source state (the "A1 canonical source digest"). It is the single trusted
6
- * producer of source identity used by the transactional completion boundary.
7
- * Callers never assert source identity; Flow recomputes it and binds evidence
8
- * to it. The source-v2 manifest is materialization-sensitive:
9
- * an indexed sparse-checkout path absent from disk is distinct from the same
10
- * path materialized in a dense worktree.
11
- */
12
- export type SourceDigest = `sha256:${string}`;
13
- export type SourceIdentity = {
14
- /** Canonical lowercase SHA-256 digest of the source state. */
15
- readonly digest: SourceDigest;
16
- /** Whether the digest was derived from a Git manifest or a full-tree walk. */
17
- readonly mode: "git" | "non-git";
18
- /** Number of source entries that contributed to the digest. */
19
- readonly entryCount: number;
20
- };
21
- export interface SourceIdentityProvider {
22
- /**
23
- * Compute the canonical source digest for the workspace. Implementations
24
- * must fail closed on unsafe symlinks, unreadable entries, resource limits,
25
- * or a workspace mutation observed while the source is being measured.
26
- */
27
- computeSourceIdentity(): Promise<SourceIdentity>;
28
- }
29
- /**
30
- * Base class for source-identity failures. The message never carries absolute
31
- * paths, file contents, or command output; only a bounded, safe reason.
32
- */
33
- export declare class SourceIdentityError extends Error {
34
- readonly code: string;
35
- constructor(message: string, options?: ErrorOptions);
36
- }
37
- /** A symlink whose target escapes the workspace root or is absolute. */
38
- export declare class SourceIdentityUnsafeSymlinkError extends SourceIdentityError {
39
- readonly code = "FLOW_SOURCE_IDENTITY_UNSAFE_SYMLINK";
40
- constructor(message: string, options?: ErrorOptions);
41
- }
42
- /** An entry that could not be read; measurement never silently skips state. */
43
- export declare class SourceIdentityUnreadableError extends SourceIdentityError {
44
- readonly code = "FLOW_SOURCE_IDENTITY_UNREADABLE";
45
- constructor(message: string, options?: ErrorOptions);
46
- }
47
- /** The source exceeded the bounded file-count or byte budget. */
48
- export declare class SourceIdentityOverflowError extends SourceIdentityError {
49
- readonly code = "FLOW_SOURCE_IDENTITY_OVERFLOW";
50
- constructor(message: string, options?: ErrorOptions);
51
- }
52
- /** The workspace changed while it was being measured. */
53
- export declare class SourceIdentityRaceError extends SourceIdentityError {
54
- readonly code = "FLOW_SOURCE_IDENTITY_RACE";
55
- constructor(message: string, options?: ErrorOptions);
56
- }
57
- /** Git enumeration failed for a Git workspace. */
58
- export declare class SourceIdentityGitError extends SourceIdentityError {
59
- readonly code = "FLOW_SOURCE_IDENTITY_GIT";
60
- constructor(message: string, options?: ErrorOptions);
61
- }
@@ -1,7 +0,0 @@
1
- export type CanonicalJsonValue = null | boolean | number | string | readonly CanonicalJsonValue[] | {
2
- readonly [key: string]: CanonicalJsonValue;
3
- };
4
- /** Stable, whitespace-free JSON with recursively sorted object keys. */
5
- export declare function canonicalizeReplayJson(value: CanonicalJsonValue): string;
6
- export declare const canonicalizeJson: typeof canonicalizeReplayJson;
7
- export declare const canonicalReplayJson: typeof canonicalizeReplayJson;