@osovv/vv-opencode 1.4.2 → 1.4.3-rc.1
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 +20 -0
- package/README.md +20 -6
- package/dist/lib/orchestration.js +12 -3
- package/dist/lib/orchestration.js.map +1 -1
- package/dist/lib/spec-lint.d.ts +2 -64
- package/dist/lib/spec-lint.js +47 -45
- package/dist/lib/spec-lint.js.map +1 -1
- package/dist/lib/workflow-contract.d.ts +277 -0
- package/dist/lib/workflow-contract.js +636 -0
- package/dist/lib/workflow-contract.js.map +1 -0
- package/dist/plugins/system-context-injection/index.js +15 -7
- package/dist/plugins/system-context-injection/index.js.map +1 -1
- package/dist/plugins/workflow/authority.d.ts +99 -0
- package/dist/plugins/workflow/authority.js +435 -0
- package/dist/plugins/workflow/authority.js.map +1 -0
- package/dist/plugins/workflow/checkpoint-io.d.ts +10 -1
- package/dist/plugins/workflow/checkpoint-io.js +22 -3
- package/dist/plugins/workflow/checkpoint-io.js.map +1 -1
- package/dist/plugins/workflow/checkpoints.d.ts +58 -1
- package/dist/plugins/workflow/checkpoints.js +362 -34
- package/dist/plugins/workflow/checkpoints.js.map +1 -1
- package/dist/plugins/workflow/delegated.d.ts +150 -2
- package/dist/plugins/workflow/delegated.js +551 -15
- package/dist/plugins/workflow/delegated.js.map +1 -1
- package/dist/plugins/workflow/execution.d.ts +361 -0
- package/dist/plugins/workflow/execution.js +1807 -0
- package/dist/plugins/workflow/execution.js.map +1 -0
- package/dist/plugins/workflow/index.js +539 -80
- package/dist/plugins/workflow/index.js.map +1 -1
- package/dist/plugins/workflow/persistence.d.ts +18 -4
- package/dist/plugins/workflow/persistence.js +439 -42
- package/dist/plugins/workflow/persistence.js.map +1 -1
- package/dist/plugins/workflow/repair.d.ts +2 -0
- package/dist/plugins/workflow/repair.js +16 -8
- package/dist/plugins/workflow/repair.js.map +1 -1
- package/dist/plugins/workflow/snapshots.js +3 -3
- package/dist/plugins/workflow/snapshots.js.map +1 -1
- package/dist/plugins/workflow/state.d.ts +13 -0
- package/dist/plugins/workflow/state.js +37 -7
- package/dist/plugins/workflow/state.js.map +1 -1
- package/dist/plugins/workflow/system-instruction.md +15 -1
- package/dist/plugins/workflow/tooling.d.ts +81 -6
- package/dist/plugins/workflow/tooling.js +956 -23
- package/dist/plugins/workflow/tooling.js.map +1 -1
- package/dist/plugins/workflow/transactions.d.ts +54 -0
- package/dist/plugins/workflow/transactions.js +147 -0
- package/dist/plugins/workflow/transactions.js.map +1 -0
- package/package.json +1 -1
- package/schemas/vvoc/v3.json +1 -1
- package/templates/agents/vv-code-reviewer.md +1 -0
- package/templates/agents/vv-controller.md +26 -13
- package/templates/agents/vv-implementer.md +1 -0
- package/templates/agents/vv-spec-reviewer.md +1 -0
- package/templates/skills/vv-execute/SKILL.md +6 -5
- package/templates/skills/vv-plan/SKILL.md +1 -1
- package/templates/skills/vv-review/SKILL.md +1 -0
- package/templates/skills/vv-spec/SKILL.md +2 -2
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
export declare const WORKFLOW_CONTRACT_VERSION = 1;
|
|
2
|
+
export declare const WORKFLOW_ID_MAX_CHARS = 128;
|
|
3
|
+
export declare const WORKFLOW_TEXT_MAX_CHARS = 2000;
|
|
4
|
+
export declare const WORKFLOW_TEXT_MAX_ITEMS = 64;
|
|
5
|
+
/** Normalized workspace-relative path, or the reason a declared path is malformed. */
|
|
6
|
+
export type DeclaredScopePathResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
path: string;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
reason: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Text-level canonical normalization for declared scope file paths. The linter
|
|
15
|
+
* and the runtime snapshot fingerprint share this representation so a plan that
|
|
16
|
+
* lints clean cannot declare paths the runtime normalizer rejects on sight.
|
|
17
|
+
* Filesystem-specific checks (existence, symlinks, regular files) stay in the
|
|
18
|
+
* runtime normalizer; this function is deliberately pure.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeDeclaredScopePath(raw: string): DeclaredScopePathResult;
|
|
21
|
+
/**
|
|
22
|
+
* Normalize a declared directory subtree. Identical traversal and wildcard
|
|
23
|
+
* rejection as file paths, but one trailing separator is allowed and removed so
|
|
24
|
+
* an explicitly named subtree can never be normalized into an empty segment.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeDeclaredDirectoryPath(raw: string): DeclaredScopePathResult;
|
|
27
|
+
/** Canonical reviewer roles accepted inside a delegated checkpoint's reviewer set. */
|
|
28
|
+
export type DelegatedReviewer = "spec" | "code";
|
|
29
|
+
/** Typed delegated obligation for one declared plan task. */
|
|
30
|
+
export interface DelegatedTaskDefinition {
|
|
31
|
+
/** Canonical task id used by depends_on and checkpoint coverage (e.g. "T-001"). */
|
|
32
|
+
taskId: string;
|
|
33
|
+
/** Declaring identity element name (e.g. "TASK-T-001"). */
|
|
34
|
+
taskElement: string;
|
|
35
|
+
/** Declaring wave id in document order (e.g. "WAVE-1"). */
|
|
36
|
+
wave: string;
|
|
37
|
+
/** Normalized workspace-relative write scope files declared for the task. */
|
|
38
|
+
writeScope: string[];
|
|
39
|
+
/** Declared task title lifted from the validated source, when present. */
|
|
40
|
+
title?: string;
|
|
41
|
+
/** Declared acceptance criterion texts lifted from the validated source. */
|
|
42
|
+
acceptance?: string[];
|
|
43
|
+
/** Declared verification command texts lifted from the validated source. */
|
|
44
|
+
verification?: string[];
|
|
45
|
+
/** Declared task dependency ids lifted from the validated source. */
|
|
46
|
+
dependsOn?: string[];
|
|
47
|
+
}
|
|
48
|
+
/** Typed delegated obligation for one declared review checkpoint. */
|
|
49
|
+
export interface DelegatedCheckpointDefinition {
|
|
50
|
+
/** Declared checkpoint identity (e.g. "CHECKPOINT-R-001"). */
|
|
51
|
+
checkpointId: string;
|
|
52
|
+
kind: "milestone" | "final";
|
|
53
|
+
/** Wave barrier that must be accepted before the checkpoint may start. */
|
|
54
|
+
afterWave: string;
|
|
55
|
+
/** Canonical task ids covered by the checkpoint. */
|
|
56
|
+
covers: string[];
|
|
57
|
+
/** Normalized workspace-relative files reviewed by the checkpoint. */
|
|
58
|
+
scope: string[];
|
|
59
|
+
/** Declared reviewer roles; every role must pass for the checkpoint to pass. */
|
|
60
|
+
reviewers: DelegatedReviewer[];
|
|
61
|
+
/** Acceptance criterion texts recorded in the plan. */
|
|
62
|
+
acceptance: string[];
|
|
63
|
+
/** Verification command texts recorded in the plan. */
|
|
64
|
+
verification: string[];
|
|
65
|
+
}
|
|
66
|
+
/** Typed obligations extracted from a plan's delegated execution section. */
|
|
67
|
+
export interface DelegatedPlanDefinition {
|
|
68
|
+
mode: "delegated";
|
|
69
|
+
/** Declared wave ids in document order. */
|
|
70
|
+
waves: string[];
|
|
71
|
+
tasks: DelegatedTaskDefinition[];
|
|
72
|
+
checkpoints: DelegatedCheckpointDefinition[];
|
|
73
|
+
}
|
|
74
|
+
/** Either a typed delegated definition or the collected validation errors. */
|
|
75
|
+
export type DelegatedPlanExtractionResult = {
|
|
76
|
+
ok: true;
|
|
77
|
+
definition: DelegatedPlanDefinition;
|
|
78
|
+
} | {
|
|
79
|
+
ok: false;
|
|
80
|
+
errors: string[];
|
|
81
|
+
};
|
|
82
|
+
export type WorkflowReviewer = DelegatedReviewer;
|
|
83
|
+
/** Where a registered obligation came from: the selected source, the user, or the controller. */
|
|
84
|
+
export type WorkflowObligationOrigin = "source" | "user" | "controller";
|
|
85
|
+
/** Structural native definition shape accepted by the common adapter. */
|
|
86
|
+
export interface NativePlanMetadata {
|
|
87
|
+
mode: "delegated";
|
|
88
|
+
waves: string[];
|
|
89
|
+
tasks: DelegatedTaskDefinition[];
|
|
90
|
+
checkpoints: DelegatedCheckpointDefinition[];
|
|
91
|
+
}
|
|
92
|
+
/** Bounded generic task contract with explicit dependencies, scope, and reviewer set. */
|
|
93
|
+
export interface WorkflowTaskContract {
|
|
94
|
+
taskId: string;
|
|
95
|
+
title: string;
|
|
96
|
+
goal: string;
|
|
97
|
+
acceptanceCriteria: string[];
|
|
98
|
+
verification: string[];
|
|
99
|
+
/** Normalized workspace-relative exact files the task may write. */
|
|
100
|
+
writeScope: string[];
|
|
101
|
+
/** Task ids that must be accepted before this task may launch. */
|
|
102
|
+
dependsOn: string[];
|
|
103
|
+
/** Checkpoint ids that must pass before this task may launch. */
|
|
104
|
+
blockedBy: string[];
|
|
105
|
+
/** Explicit reviewer set; [] deliberately means no independent review. */
|
|
106
|
+
requiredReviewers: WorkflowReviewer[];
|
|
107
|
+
}
|
|
108
|
+
/** Bounded generic checkpoint obligation with explicit coverage and reviewer set. */
|
|
109
|
+
export interface WorkflowCheckpointContract {
|
|
110
|
+
checkpointId: string;
|
|
111
|
+
kind: "milestone" | "final";
|
|
112
|
+
/** Task ids covered by the checkpoint. */
|
|
113
|
+
covers: string[];
|
|
114
|
+
/** Normalized workspace-relative exact files under review. */
|
|
115
|
+
scope: string[];
|
|
116
|
+
/** Explicit reviewer set; a checkpoint with an empty set is invalid. */
|
|
117
|
+
requiredReviewers: WorkflowReviewer[];
|
|
118
|
+
acceptance: string[];
|
|
119
|
+
verification: string[];
|
|
120
|
+
origin: WorkflowObligationOrigin;
|
|
121
|
+
/** Checkpoint ids that must pass before this checkpoint may start. */
|
|
122
|
+
dependsOn: string[];
|
|
123
|
+
}
|
|
124
|
+
/** Normalized exact files plus explicitly named directory subtrees. */
|
|
125
|
+
export interface WorkflowExecutionBoundary {
|
|
126
|
+
files: string[];
|
|
127
|
+
directories: string[];
|
|
128
|
+
}
|
|
129
|
+
export type WorkflowExecutionSource = {
|
|
130
|
+
kind: "native-package";
|
|
131
|
+
planPath: string;
|
|
132
|
+
specPath: string;
|
|
133
|
+
planSha256: string;
|
|
134
|
+
specSha256: string;
|
|
135
|
+
definition: NativePlanMetadata;
|
|
136
|
+
} | {
|
|
137
|
+
kind: "provided-plan";
|
|
138
|
+
reference: string;
|
|
139
|
+
sha256?: string;
|
|
140
|
+
} | {
|
|
141
|
+
kind: "conversation-scoped";
|
|
142
|
+
};
|
|
143
|
+
export type WorkflowExecutionState = "preparing" | "active" | "sealed";
|
|
144
|
+
/** Monotonic contract revision number for one execution. */
|
|
145
|
+
export type WorkflowExecutionRevision = number;
|
|
146
|
+
export type WorkflowLineageKind = "initial" | "amendment" | "replacement" | "split";
|
|
147
|
+
/** One recorded amendment/replacement/split lineage event. */
|
|
148
|
+
export interface WorkflowLineageEntry {
|
|
149
|
+
lineageId: string;
|
|
150
|
+
kind: WorkflowLineageKind;
|
|
151
|
+
amendmentId: string;
|
|
152
|
+
parentTaskId?: string;
|
|
153
|
+
childTaskIds: string[];
|
|
154
|
+
previousRevision: WorkflowExecutionRevision;
|
|
155
|
+
newRevision: WorkflowExecutionRevision;
|
|
156
|
+
rationale: string;
|
|
157
|
+
createdAt: string;
|
|
158
|
+
}
|
|
159
|
+
/** Lifecycle stages that advance authority may cover. */
|
|
160
|
+
export type WorkflowAuthorityStage = "specification" | "planning" | "implementation" | "verification";
|
|
161
|
+
export type WorkflowAuthorityProvenance = "controller_delegated" | "user_observed" | "unspecified";
|
|
162
|
+
/** Bounded decision, stage, and file boundary of one authority grant. */
|
|
163
|
+
export interface WorkflowAuthorityScope {
|
|
164
|
+
stages: WorkflowAuthorityStage[];
|
|
165
|
+
decisionScope: string;
|
|
166
|
+
fileBoundary: string[];
|
|
167
|
+
reservedStops: WorkflowAuthorityStage[];
|
|
168
|
+
}
|
|
169
|
+
export interface WorkflowAuthorityExtension {
|
|
170
|
+
extensionId: string;
|
|
171
|
+
messageId: string;
|
|
172
|
+
messageCreatedMs: number;
|
|
173
|
+
units: number;
|
|
174
|
+
createdAt: string;
|
|
175
|
+
}
|
|
176
|
+
export interface WorkflowAuthorityRevocation {
|
|
177
|
+
revocationId: string;
|
|
178
|
+
/** "narrow" disables out-of-scope credits; "revoke" disables all future credits. */
|
|
179
|
+
kind: "narrow" | "revoke";
|
|
180
|
+
reason: string;
|
|
181
|
+
/** Surviving stages after a narrowing; absent for a full revocation. */
|
|
182
|
+
narrowedStages?: WorkflowAuthorityStage[];
|
|
183
|
+
revokedAt: string;
|
|
184
|
+
}
|
|
185
|
+
/** Advance-authority record with its finite shared reserve metadata. */
|
|
186
|
+
export interface WorkflowAuthorityRecord {
|
|
187
|
+
authorityId: string;
|
|
188
|
+
/** Owning common execution; a second initial grant for the same run cannot add reserve. */
|
|
189
|
+
runId: string;
|
|
190
|
+
rootSessionId: string;
|
|
191
|
+
grantedByMessageId: string;
|
|
192
|
+
messageCreatedMs: number;
|
|
193
|
+
scope: WorkflowAuthorityScope;
|
|
194
|
+
initialUnits: number;
|
|
195
|
+
extensions: WorkflowAuthorityExtension[];
|
|
196
|
+
revocations: WorkflowAuthorityRevocation[];
|
|
197
|
+
createdAt: string;
|
|
198
|
+
}
|
|
199
|
+
/** Recorded stage approval bound to an approved artifact hash and provenance. */
|
|
200
|
+
export interface WorkflowStageApproval {
|
|
201
|
+
approvalId: string;
|
|
202
|
+
authorityId: string;
|
|
203
|
+
stage: WorkflowAuthorityStage;
|
|
204
|
+
artifactPath: string;
|
|
205
|
+
artifactSha256: string;
|
|
206
|
+
provenance: WorkflowAuthorityProvenance;
|
|
207
|
+
recordedAt: string;
|
|
208
|
+
}
|
|
209
|
+
/** One consumed unit of the shared advance-recovery reserve, bound to its exact target. */
|
|
210
|
+
export interface WorkflowReserveDebit {
|
|
211
|
+
recoveryId: string;
|
|
212
|
+
authorityId: string;
|
|
213
|
+
targetKind: "task" | "checkpoint";
|
|
214
|
+
targetId: string;
|
|
215
|
+
units: number;
|
|
216
|
+
debitedAt: string;
|
|
217
|
+
}
|
|
218
|
+
/** Session-wide claim that one root-user message already funded an authority grant. */
|
|
219
|
+
export interface WorkflowMessageClaim {
|
|
220
|
+
messageId: string;
|
|
221
|
+
runId: string;
|
|
222
|
+
authorityId: string;
|
|
223
|
+
claimedAt: string;
|
|
224
|
+
}
|
|
225
|
+
export interface WorkflowContractProblem {
|
|
226
|
+
code: string;
|
|
227
|
+
message: string;
|
|
228
|
+
}
|
|
229
|
+
export type WorkflowContractValidation<T> = {
|
|
230
|
+
ok: true;
|
|
231
|
+
value: T;
|
|
232
|
+
} | {
|
|
233
|
+
ok: false;
|
|
234
|
+
problems: WorkflowContractProblem[];
|
|
235
|
+
};
|
|
236
|
+
/** Whether a value is a bounded explicit workflow identity (not a native-only pattern). */
|
|
237
|
+
export declare function isBoundedWorkflowId(value: unknown): value is string;
|
|
238
|
+
/**
|
|
239
|
+
* Normalize an explicit reviewer array. Absent, non-array, malformed, or
|
|
240
|
+
* duplicate-bearing input returns undefined so callers cannot silently turn a
|
|
241
|
+
* missing or invalid declaration into "no review". An explicit empty array is
|
|
242
|
+
* preserved as [] because it deliberately means no independent review.
|
|
243
|
+
*/
|
|
244
|
+
export declare function normalizeReviewerSet(value: unknown): WorkflowReviewer[] | undefined;
|
|
245
|
+
/** Validate and normalize exact files plus explicitly named directory subtrees. */
|
|
246
|
+
export declare function validateExecutionBoundary(raw: unknown): WorkflowContractValidation<WorkflowExecutionBoundary>;
|
|
247
|
+
/** Whether a normalized path is contained in a normalized execution boundary. */
|
|
248
|
+
export declare function isPathInExecutionBoundary(path: string, boundary: WorkflowExecutionBoundary): boolean;
|
|
249
|
+
/** Validate one generic task contract. */
|
|
250
|
+
export declare function validateWorkflowTaskContract(raw: unknown): WorkflowContractValidation<WorkflowTaskContract>;
|
|
251
|
+
/** Validate one generic checkpoint contract. */
|
|
252
|
+
export declare function validateWorkflowCheckpointContract(raw: unknown): WorkflowContractValidation<WorkflowCheckpointContract>;
|
|
253
|
+
/**
|
|
254
|
+
* Validate unique ids, exact references, boundary containment, and acyclicity
|
|
255
|
+
* across tasks and checkpoints. Same-batch references are validated before any
|
|
256
|
+
* caller publishes an item or key index.
|
|
257
|
+
*/
|
|
258
|
+
export declare function validateWorkflowContractGraph(graph: {
|
|
259
|
+
tasks: readonly WorkflowTaskContract[];
|
|
260
|
+
checkpoints: readonly WorkflowCheckpointContract[];
|
|
261
|
+
boundary: WorkflowExecutionBoundary;
|
|
262
|
+
}): WorkflowContractValidation<{
|
|
263
|
+
tasks: WorkflowTaskContract[];
|
|
264
|
+
checkpoints: WorkflowCheckpointContract[];
|
|
265
|
+
}>;
|
|
266
|
+
/**
|
|
267
|
+
* Adapt native-extracted task obligations into common task contracts, lifting
|
|
268
|
+
* acceptance/verification/dependency text from the validated source instead of
|
|
269
|
+
* inventing generic requirements. The source's own wave barriers remain owned
|
|
270
|
+
* by the native adapter and are not converted into per-task dependencies here.
|
|
271
|
+
*/
|
|
272
|
+
export declare function taskContractsFromNativeDefinition(definition: NativePlanMetadata): WorkflowTaskContract[];
|
|
273
|
+
/** Adapt native checkpoints into common checkpoint contracts with source origin. */
|
|
274
|
+
export declare function checkpointContractsFromNativeDefinition(definition: NativePlanMetadata, scope?: {
|
|
275
|
+
origin?: WorkflowObligationOrigin;
|
|
276
|
+
dependsOn?: string[];
|
|
277
|
+
}): WorkflowCheckpointContract[];
|