@osovv/vv-opencode 1.4.3-rc.0 → 1.4.3

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 (53) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +15 -6
  3. package/dist/lib/orchestration.js +9 -5
  4. package/dist/lib/orchestration.js.map +1 -1
  5. package/dist/lib/spec-lint.d.ts +2 -64
  6. package/dist/lib/spec-lint.js +47 -45
  7. package/dist/lib/spec-lint.js.map +1 -1
  8. package/dist/lib/vvoc-preset-registry.d.ts +13 -1
  9. package/dist/lib/vvoc-preset-registry.js +11 -1
  10. package/dist/lib/vvoc-preset-registry.js.map +1 -1
  11. package/dist/lib/workflow-contract.d.ts +277 -0
  12. package/dist/lib/workflow-contract.js +636 -0
  13. package/dist/lib/workflow-contract.js.map +1 -0
  14. package/dist/plugins/system-context-injection/index.js +8 -0
  15. package/dist/plugins/system-context-injection/index.js.map +1 -1
  16. package/dist/plugins/workflow/authority.d.ts +99 -0
  17. package/dist/plugins/workflow/authority.js +435 -0
  18. package/dist/plugins/workflow/authority.js.map +1 -0
  19. package/dist/plugins/workflow/checkpoint-io.d.ts +10 -1
  20. package/dist/plugins/workflow/checkpoint-io.js +22 -3
  21. package/dist/plugins/workflow/checkpoint-io.js.map +1 -1
  22. package/dist/plugins/workflow/checkpoints.d.ts +5 -0
  23. package/dist/plugins/workflow/checkpoints.js +15 -4
  24. package/dist/plugins/workflow/checkpoints.js.map +1 -1
  25. package/dist/plugins/workflow/delegated.d.ts +7 -1
  26. package/dist/plugins/workflow/delegated.js +12 -6
  27. package/dist/plugins/workflow/delegated.js.map +1 -1
  28. package/dist/plugins/workflow/execution.d.ts +361 -0
  29. package/dist/plugins/workflow/execution.js +1807 -0
  30. package/dist/plugins/workflow/execution.js.map +1 -0
  31. package/dist/plugins/workflow/index.js +317 -104
  32. package/dist/plugins/workflow/index.js.map +1 -1
  33. package/dist/plugins/workflow/persistence.d.ts +15 -3
  34. package/dist/plugins/workflow/persistence.js +270 -34
  35. package/dist/plugins/workflow/persistence.js.map +1 -1
  36. package/dist/plugins/workflow/snapshots.js +3 -3
  37. package/dist/plugins/workflow/snapshots.js.map +1 -1
  38. package/dist/plugins/workflow/state.d.ts +13 -0
  39. package/dist/plugins/workflow/state.js +22 -5
  40. package/dist/plugins/workflow/state.js.map +1 -1
  41. package/dist/plugins/workflow/system-instruction.md +15 -1
  42. package/dist/plugins/workflow/tooling.d.ts +46 -1
  43. package/dist/plugins/workflow/tooling.js +822 -6
  44. package/dist/plugins/workflow/tooling.js.map +1 -1
  45. package/dist/plugins/workflow/transactions.d.ts +54 -0
  46. package/dist/plugins/workflow/transactions.js +147 -0
  47. package/dist/plugins/workflow/transactions.js.map +1 -0
  48. package/package.json +1 -1
  49. package/schemas/vvoc/v3.json +1 -1
  50. package/templates/agents/vv-controller.md +12 -7
  51. package/templates/skills/vv-execute/SKILL.md +4 -4
  52. package/templates/skills/vv-plan/SKILL.md +1 -1
  53. package/templates/skills/vv-spec/SKILL.md +2 -2
@@ -0,0 +1,636 @@
1
+ // FILE: src/lib/workflow-contract.ts
2
+ // VERSION: 1.0.0
3
+ // START_MODULE_CONTRACT
4
+ // PURPOSE: Dependency-free common execution contract for native-package, provided-plan, and conversation-scoped workflow runs: declared-path normalization, bounded task/checkpoint/boundary contracts, explicit reviewer sets, exact-reference DAG validation, lineage/revision records, and authority/stage provenance shapes.
5
+ // SCOPE: Pure path normalization, bounded identity/text validation, explicit reviewer-set normalization, execution boundary containment, task and checkpoint contract validation, exact reference and acyclic dependency checks, native definition adaptation into common contracts, and structural source/lineage/authority record types. No filesystem access, native XML parsing, SDK transport, task dispatch, or persistence.
6
+ // DEPENDS: [] (deliberately dependency-free so the native adapter and the generic runtime share one contract without a cycle)
7
+ // LINKS: [M-WORKFLOW-CONTRACT, M-SPEC-LINT, M-WORKFLOW-EXECUTION, M-WORKFLOW-AUTHORITY]
8
+ // ROLE: RUNTIME
9
+ // MAP_MODE: EXPORTS
10
+ // END_MODULE_CONTRACT
11
+ //
12
+ // START_MODULE_MAP
13
+ // WORKFLOW_CONTRACT_VERSION - Rule-set version for the common execution contract.
14
+ // WORKFLOW_ID_MAX_CHARS - Maximum accepted workflow identity length.
15
+ // WORKFLOW_TEXT_MAX_CHARS - Maximum accepted bounded contract text length.
16
+ // WORKFLOW_TEXT_MAX_ITEMS - Maximum accepted list length inside one contract field.
17
+ // WorkflowReviewer - Canonical independent reviewer role.
18
+ // WorkflowObligationOrigin - Where a registered obligation came from (source, user, controller).
19
+ // DelegatedReviewer - Canonical delegated checkpoint reviewer roles (spec, code).
20
+ // DelegatedTaskDefinition - Native-extracted task obligation with declared write scope and optional lifted contract text.
21
+ // DelegatedCheckpointDefinition - Native-extracted review checkpoint obligation.
22
+ // DelegatedPlanDefinition - Native typed obligations extracted from a delegated execution section.
23
+ // DelegatedPlanExtractionResult - Success payload or error list returned by native delegated extraction.
24
+ // DeclaredScopePathResult - Normalized workspace-relative path or a rejection reason.
25
+ // normalizeDeclaredScopePath - Text-level canonical normalization for declared scope file paths.
26
+ // normalizeDeclaredDirectoryPath - Text-level normalization for declared directory subtrees.
27
+ // normalizeReviewerSet - Explicit reviewer array normalization; absent or malformed returns undefined.
28
+ // NativePlanMetadata - Structural native definition shape accepted by the common adapter.
29
+ // WorkflowTaskContract - Bounded generic task contract with explicit dependency and reviewer references.
30
+ // WorkflowCheckpointContract - Bounded generic checkpoint obligation with explicit coverage and reviewers.
31
+ // WorkflowExecutionBoundary - Normalized exact files plus explicitly named directory subtrees.
32
+ // WorkflowExecutionSource - Immutable discriminated source identity for one execution.
33
+ // WorkflowExecutionState - Lifecycle of the common execution registry entry.
34
+ // WorkflowExecutionRevision - Monotonic contract revision number.
35
+ // WorkflowLineageKind - Explicit replacement/split lineage classification.
36
+ // WorkflowLineageEntry - One recorded amendment/replacement lineage event.
37
+ // WorkflowAuthorityStage - Delegatable lifecycle stages for advance authority.
38
+ // WorkflowAuthorityProvenance - Truthful origin of a stage approval.
39
+ // WorkflowAuthorityScope - Bounded decision, stage, and file boundary of an authority grant.
40
+ // WorkflowAuthorityExtension - One explicit finite extension of existing authority.
41
+ // WorkflowAuthorityRevocation - Fail-safe narrowing/revocation of future authority use.
42
+ // WorkflowAuthorityRecord - Advance-authority record with finite shared reserve metadata.
43
+ // WorkflowStageApproval - Recorded stage approval bound to an approved artifact hash.
44
+ // WorkflowReserveDebit - One consumed unit of the shared advance-recovery reserve.
45
+ // WorkflowMessageClaim - Session-wide claim that one root-user message already funded a grant.
46
+ // WorkflowContractProblem - One deterministic contract validation problem.
47
+ // WorkflowContractValidation - Validation result carrying a value or deterministic problems.
48
+ // isBoundedWorkflowId - Whether a value is a bounded explicit workflow identity.
49
+ // isPathInExecutionBoundary - Whether a normalized path is contained in an execution boundary.
50
+ // validateWorkflowTaskContract - Validate one generic task contract.
51
+ // validateWorkflowCheckpointContract - Validate one generic checkpoint contract.
52
+ // validateExecutionBoundary - Validate and normalize exact files plus directory subtrees.
53
+ // validateWorkflowContractGraph - Validate unique ids, exact references, containment, and acyclicity.
54
+ // taskContractsFromNativeDefinition - Adapt native task obligations into common task contracts.
55
+ // checkpointContractsFromNativeDefinition - Adapt native checkpoints into common checkpoint contracts.
56
+ // END_MODULE_MAP
57
+ //
58
+ // START_CHANGE_SUMMARY
59
+ // LAST_CHANGE: [C-WORKFLOW-PLAN-INDEPENDENCE - Initial dependency-free common contract extracted from the native spec linter so provided-plan and conversation-scoped execution share one validated contract.]
60
+ // END_CHANGE_SUMMARY
61
+ // START_BLOCK_CONTRACT_CONSTANTS
62
+ export const WORKFLOW_CONTRACT_VERSION = 1;
63
+ export const WORKFLOW_ID_MAX_CHARS = 128;
64
+ export const WORKFLOW_TEXT_MAX_CHARS = 2000;
65
+ export const WORKFLOW_TEXT_MAX_ITEMS = 64;
66
+ /**
67
+ * Text-level canonical normalization for declared scope file paths. The linter
68
+ * and the runtime snapshot fingerprint share this representation so a plan that
69
+ * lints clean cannot declare paths the runtime normalizer rejects on sight.
70
+ * Filesystem-specific checks (existence, symlinks, regular files) stay in the
71
+ * runtime normalizer; this function is deliberately pure.
72
+ */
73
+ export function normalizeDeclaredScopePath(raw) {
74
+ const trimmed = raw.trim();
75
+ if (trimmed === "")
76
+ return { ok: false, reason: "empty path" };
77
+ if (trimmed.includes("\\"))
78
+ return { ok: false, reason: "backslash separator" };
79
+ if (trimmed.startsWith("/"))
80
+ return { ok: false, reason: "absolute path" };
81
+ if (/^[A-Za-z]:/.test(trimmed))
82
+ return { ok: false, reason: "drive-absolute path" };
83
+ if (trimmed.startsWith("~"))
84
+ return { ok: false, reason: "home-relative path" };
85
+ if (/[*?[\]]/.test(trimmed))
86
+ return { ok: false, reason: "wildcard characters" };
87
+ // eslint-disable-next-line no-control-regex
88
+ if (/[\u0000-\u001f\u007f]/.test(trimmed))
89
+ return { ok: false, reason: "control characters" };
90
+ const segments = trimmed.split("/");
91
+ for (const segment of segments) {
92
+ if (segment === "")
93
+ return { ok: false, reason: "empty path segment" };
94
+ if (segment === "." || segment === "..")
95
+ return { ok: false, reason: "traversal segment" };
96
+ }
97
+ return { ok: true, path: segments.join("/") };
98
+ }
99
+ /**
100
+ * Normalize a declared directory subtree. Identical traversal and wildcard
101
+ * rejection as file paths, but one trailing separator is allowed and removed so
102
+ * an explicitly named subtree can never be normalized into an empty segment.
103
+ */
104
+ export function normalizeDeclaredDirectoryPath(raw) {
105
+ const trimmed = raw.trim();
106
+ const withoutTrailing = trimmed.endsWith("/") ? trimmed.slice(0, -1) : trimmed;
107
+ if (withoutTrailing === "")
108
+ return { ok: false, reason: "empty path" };
109
+ return normalizeDeclaredScopePath(withoutTrailing);
110
+ }
111
+ // END_BLOCK_CONTRACT_VALIDATION_TYPES
112
+ // START_BLOCK_ID_AND_TEXT_HELPERS
113
+ const BOUNDED_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/;
114
+ /** Whether a value is a bounded explicit workflow identity (not a native-only pattern). */
115
+ export function isBoundedWorkflowId(value) {
116
+ if (typeof value !== "string")
117
+ return false;
118
+ const trimmed = value.trim();
119
+ if (trimmed === "" || trimmed.length > WORKFLOW_ID_MAX_CHARS)
120
+ return false;
121
+ return BOUNDED_ID_PATTERN.test(trimmed);
122
+ }
123
+ function boundedText(value, field, problems) {
124
+ if (typeof value !== "string") {
125
+ problems.push({ code: "INVALID_TEXT", message: `${field} must be a string` });
126
+ return "";
127
+ }
128
+ const trimmed = value.trim();
129
+ if (trimmed === "") {
130
+ problems.push({ code: "EMPTY_TEXT", message: `${field} must be non-empty` });
131
+ return "";
132
+ }
133
+ if (trimmed.length > WORKFLOW_TEXT_MAX_CHARS) {
134
+ problems.push({
135
+ code: "TEXT_TOO_LONG",
136
+ message: `${field} exceeds ${WORKFLOW_TEXT_MAX_CHARS} characters`,
137
+ });
138
+ return "";
139
+ }
140
+ return trimmed;
141
+ }
142
+ function boundedTextList(value, field, problems, options = { allowEmpty: true }) {
143
+ if (value === undefined || value === null) {
144
+ if (options.allowEmpty)
145
+ return [];
146
+ problems.push({ code: "MISSING_LIST", message: `${field} is required` });
147
+ return [];
148
+ }
149
+ if (!Array.isArray(value)) {
150
+ problems.push({ code: "INVALID_LIST", message: `${field} must be an array` });
151
+ return [];
152
+ }
153
+ if (value.length > WORKFLOW_TEXT_MAX_ITEMS) {
154
+ problems.push({
155
+ code: "LIST_TOO_LONG",
156
+ message: `${field} declares more than ${WORKFLOW_TEXT_MAX_ITEMS} entries`,
157
+ });
158
+ return [];
159
+ }
160
+ const out = [];
161
+ for (const entry of value) {
162
+ if (typeof entry !== "string" || entry.trim() === "") {
163
+ problems.push({
164
+ code: "INVALID_TEXT",
165
+ message: `${field} entries must be non-empty strings`,
166
+ });
167
+ return [];
168
+ }
169
+ const trimmed = entry.trim();
170
+ if (trimmed.length > WORKFLOW_TEXT_MAX_CHARS) {
171
+ problems.push({
172
+ code: "TEXT_TOO_LONG",
173
+ message: `${field} entry exceeds ${WORKFLOW_TEXT_MAX_CHARS} characters`,
174
+ });
175
+ return [];
176
+ }
177
+ out.push(trimmed);
178
+ }
179
+ return out;
180
+ }
181
+ // END_BLOCK_ID_AND_TEXT_HELPERS
182
+ // START_BLOCK_REVIEWER_NORMALIZATION
183
+ function isWorkflowReviewer(value) {
184
+ return value === "spec" || value === "code";
185
+ }
186
+ /**
187
+ * Normalize an explicit reviewer array. Absent, non-array, malformed, or
188
+ * duplicate-bearing input returns undefined so callers cannot silently turn a
189
+ * missing or invalid declaration into "no review". An explicit empty array is
190
+ * preserved as [] because it deliberately means no independent review.
191
+ */
192
+ export function normalizeReviewerSet(value) {
193
+ if (!Array.isArray(value))
194
+ return undefined;
195
+ if (!value.every(isWorkflowReviewer))
196
+ return undefined;
197
+ const unique = new Set(value);
198
+ if (unique.size !== value.length)
199
+ return undefined;
200
+ return [...value].sort((left, right) => (left === right ? 0 : left === "spec" ? -1 : 1));
201
+ }
202
+ // END_BLOCK_REVIEWER_NORMALIZATION
203
+ // START_BLOCK_BOUNDARY_VALIDATION
204
+ function normalizeUniquePaths(raw, field, normalize, problems) {
205
+ if (raw === undefined || raw === null)
206
+ return [];
207
+ if (!Array.isArray(raw)) {
208
+ problems.push({ code: "INVALID_LIST", message: `${field} must be an array` });
209
+ return [];
210
+ }
211
+ const seen = new Set();
212
+ const out = [];
213
+ for (const entry of raw) {
214
+ if (typeof entry !== "string") {
215
+ problems.push({ code: "INVALID_PATH", message: `${field} entries must be strings` });
216
+ return [];
217
+ }
218
+ const normalized = normalize(entry);
219
+ if (!normalized.ok) {
220
+ problems.push({
221
+ code: "INVALID_PATH",
222
+ message: `${field} path ${JSON.stringify(entry)} is malformed (${normalized.reason})`,
223
+ });
224
+ return [];
225
+ }
226
+ if (seen.has(normalized.path)) {
227
+ problems.push({
228
+ code: "DUPLICATE_PATH",
229
+ message: `${field} path ${JSON.stringify(normalized.path)} is declared more than once`,
230
+ });
231
+ return [];
232
+ }
233
+ seen.add(normalized.path);
234
+ out.push(normalized.path);
235
+ }
236
+ return out;
237
+ }
238
+ /** Validate and normalize exact files plus explicitly named directory subtrees. */
239
+ export function validateExecutionBoundary(raw) {
240
+ const problems = [];
241
+ if (raw === null || typeof raw !== "object") {
242
+ return {
243
+ ok: false,
244
+ problems: [{ code: "INVALID_BOUNDARY", message: "execution boundary must be an object" }],
245
+ };
246
+ }
247
+ const candidate = raw;
248
+ const files = normalizeUniquePaths(candidate.files, "boundary.files", normalizeDeclaredScopePath, problems);
249
+ const directories = normalizeUniquePaths(candidate.directories, "boundary.directories", normalizeDeclaredDirectoryPath, problems);
250
+ if (problems.length > 0)
251
+ return { ok: false, problems };
252
+ if (files.length === 0 && directories.length === 0) {
253
+ return {
254
+ ok: false,
255
+ problems: [
256
+ { code: "EMPTY_BOUNDARY", message: "execution boundary declares no files or directories" },
257
+ ],
258
+ };
259
+ }
260
+ return { ok: true, value: { files, directories } };
261
+ }
262
+ /** Whether a normalized path is contained in a normalized execution boundary. */
263
+ export function isPathInExecutionBoundary(path, boundary) {
264
+ if (boundary.files.includes(path))
265
+ return true;
266
+ return boundary.directories.some((directory) => path.startsWith(`${directory}/`));
267
+ }
268
+ // END_BLOCK_BOUNDARY_VALIDATION
269
+ // START_BLOCK_TASK_VALIDATION
270
+ function normalizeBoundaryFiles(raw, field, problems, options) {
271
+ if (raw === undefined || raw === null) {
272
+ if (options.allowEmpty)
273
+ return [];
274
+ problems.push({ code: "MISSING_LIST", message: `${field} is required` });
275
+ return [];
276
+ }
277
+ if (!Array.isArray(raw)) {
278
+ problems.push({ code: "INVALID_LIST", message: `${field} must be an array` });
279
+ return [];
280
+ }
281
+ if (raw.length === 0) {
282
+ if (options.allowEmpty)
283
+ return [];
284
+ problems.push({ code: "EMPTY_LIST", message: `${field} must declare at least one entry` });
285
+ return [];
286
+ }
287
+ return normalizeUniquePaths(raw, field, normalizeDeclaredScopePath, problems);
288
+ }
289
+ function normalizeIdList(raw, field, problems) {
290
+ const values = boundedTextList(raw, field, problems);
291
+ const unique = new Set();
292
+ for (const value of values) {
293
+ if (!isBoundedWorkflowId(value)) {
294
+ problems.push({
295
+ code: "INVALID_ID",
296
+ message: `${field} entry ${JSON.stringify(value)} is not a bounded id`,
297
+ });
298
+ return [];
299
+ }
300
+ if (unique.has(value)) {
301
+ problems.push({
302
+ code: "DUPLICATE_ID",
303
+ message: `${field} entry ${JSON.stringify(value)} is repeated`,
304
+ });
305
+ return [];
306
+ }
307
+ unique.add(value);
308
+ }
309
+ return values;
310
+ }
311
+ /** Validate one generic task contract. */
312
+ export function validateWorkflowTaskContract(raw) {
313
+ const problems = [];
314
+ if (raw === null || typeof raw !== "object") {
315
+ return {
316
+ ok: false,
317
+ problems: [{ code: "INVALID_TASK", message: "task contract must be an object" }],
318
+ };
319
+ }
320
+ const candidate = raw;
321
+ if (!isBoundedWorkflowId(candidate.taskId)) {
322
+ problems.push({ code: "INVALID_ID", message: "taskId must be a bounded workflow identity" });
323
+ }
324
+ const title = boundedText(candidate.title, "title", problems);
325
+ const goal = boundedText(candidate.goal, "goal", problems);
326
+ const acceptanceCriteria = boundedTextList(candidate.acceptanceCriteria, "acceptanceCriteria", problems);
327
+ const verification = boundedTextList(candidate.verification, "verification", problems);
328
+ const writeScope = normalizeBoundaryFiles(candidate.writeScope, "writeScope", problems, {
329
+ allowEmpty: false,
330
+ });
331
+ const dependsOn = normalizeIdList(candidate.dependsOn, "dependsOn", problems);
332
+ const blockedBy = normalizeIdList(candidate.blockedBy, "blockedBy", problems);
333
+ let requiredReviewers = [];
334
+ if (candidate.requiredReviewers === undefined) {
335
+ problems.push({
336
+ code: "MISSING_REVIEWERS",
337
+ message: "requiredReviewers must be declared explicitly (use [] for no independent review)",
338
+ });
339
+ }
340
+ else {
341
+ const normalized = normalizeReviewerSet(candidate.requiredReviewers);
342
+ if (!normalized) {
343
+ problems.push({
344
+ code: "INVALID_REVIEWERS",
345
+ message: "requiredReviewers must be a canonical spec/code set with no duplicates",
346
+ });
347
+ }
348
+ else {
349
+ requiredReviewers = normalized;
350
+ }
351
+ }
352
+ if (problems.length > 0)
353
+ return { ok: false, problems };
354
+ return {
355
+ ok: true,
356
+ value: {
357
+ taskId: candidate.taskId,
358
+ title,
359
+ goal,
360
+ acceptanceCriteria,
361
+ verification,
362
+ writeScope,
363
+ dependsOn,
364
+ blockedBy,
365
+ requiredReviewers,
366
+ },
367
+ };
368
+ }
369
+ // END_BLOCK_TASK_VALIDATION
370
+ // START_BLOCK_CHECKPOINT_VALIDATION
371
+ function isObligationOrigin(value) {
372
+ return value === "source" || value === "user" || value === "controller";
373
+ }
374
+ /** Validate one generic checkpoint contract. */
375
+ export function validateWorkflowCheckpointContract(raw) {
376
+ const problems = [];
377
+ if (raw === null || typeof raw !== "object") {
378
+ return {
379
+ ok: false,
380
+ problems: [{ code: "INVALID_CHECKPOINT", message: "checkpoint contract must be an object" }],
381
+ };
382
+ }
383
+ const candidate = raw;
384
+ if (!isBoundedWorkflowId(candidate.checkpointId)) {
385
+ problems.push({
386
+ code: "INVALID_ID",
387
+ message: "checkpointId must be a bounded workflow identity",
388
+ });
389
+ }
390
+ const kind = candidate.kind === "final" ? "final" : candidate.kind === "milestone" ? "milestone" : undefined;
391
+ if (!kind) {
392
+ problems.push({ code: "INVALID_KIND", message: "kind must be milestone or final" });
393
+ }
394
+ const covers = normalizeIdList(candidate.covers, "covers", problems);
395
+ if (covers.length === 0) {
396
+ problems.push({ code: "EMPTY_COVERS", message: "covers must declare at least one task id" });
397
+ }
398
+ const scope = normalizeBoundaryFiles(candidate.scope, "scope", problems, { allowEmpty: true });
399
+ const acceptance = boundedTextList(candidate.acceptance, "acceptance", problems);
400
+ const verification = boundedTextList(candidate.verification, "verification", problems);
401
+ const dependsOn = normalizeIdList(candidate.dependsOn, "dependsOn", problems);
402
+ let requiredReviewers = [];
403
+ const normalized = normalizeReviewerSet(candidate.requiredReviewers);
404
+ if (!normalized || normalized.length === 0) {
405
+ problems.push({
406
+ code: "INVALID_REVIEWERS",
407
+ message: "an assigned checkpoint requires a non-empty canonical spec/code reviewer set; represent no review with no checkpoint",
408
+ });
409
+ }
410
+ else {
411
+ requiredReviewers = normalized;
412
+ }
413
+ let origin = "source";
414
+ if (!isObligationOrigin(candidate.origin)) {
415
+ problems.push({
416
+ code: "INVALID_ORIGIN",
417
+ message: "origin must be source, user, or controller",
418
+ });
419
+ }
420
+ else {
421
+ origin = candidate.origin;
422
+ }
423
+ if (problems.length > 0)
424
+ return { ok: false, problems };
425
+ return {
426
+ ok: true,
427
+ value: {
428
+ checkpointId: candidate.checkpointId,
429
+ kind: kind,
430
+ covers,
431
+ scope,
432
+ requiredReviewers,
433
+ acceptance,
434
+ verification,
435
+ origin,
436
+ dependsOn,
437
+ },
438
+ };
439
+ }
440
+ // END_BLOCK_CHECKPOINT_VALIDATION
441
+ // START_BLOCK_GRAPH_VALIDATION
442
+ function detectCycle(adjacency) {
443
+ const visiting = new Set();
444
+ const visited = new Set();
445
+ const stack = [];
446
+ let cycle;
447
+ const visit = (node) => {
448
+ if (cycle)
449
+ return;
450
+ if (visiting.has(node)) {
451
+ const start = stack.indexOf(node);
452
+ cycle = [...stack.slice(start), node];
453
+ return;
454
+ }
455
+ if (visited.has(node))
456
+ return;
457
+ visiting.add(node);
458
+ stack.push(node);
459
+ for (const next of adjacency.get(node) ?? [])
460
+ visit(next);
461
+ stack.pop();
462
+ visiting.delete(node);
463
+ visited.add(node);
464
+ };
465
+ for (const node of adjacency.keys())
466
+ visit(node);
467
+ return cycle;
468
+ }
469
+ function exactReference(reference, known, field, owner, problems) {
470
+ if (!known.has(reference)) {
471
+ problems.push({
472
+ code: "UNKNOWN_REFERENCE",
473
+ message: `${owner} ${field} references unknown identity ${JSON.stringify(reference)}`,
474
+ });
475
+ }
476
+ }
477
+ /**
478
+ * Validate unique ids, exact references, boundary containment, and acyclicity
479
+ * across tasks and checkpoints. Same-batch references are validated before any
480
+ * caller publishes an item or key index.
481
+ */
482
+ export function validateWorkflowContractGraph(graph) {
483
+ const problems = [];
484
+ const taskIds = new Set();
485
+ const allIds = new Set();
486
+ for (const task of graph.tasks) {
487
+ if (allIds.has(task.taskId)) {
488
+ problems.push({
489
+ code: "DUPLICATE_ID",
490
+ message: `task id ${JSON.stringify(task.taskId)} is declared more than once`,
491
+ });
492
+ }
493
+ allIds.add(task.taskId);
494
+ taskIds.add(task.taskId);
495
+ }
496
+ const checkpointIds = new Set();
497
+ for (const checkpoint of graph.checkpoints) {
498
+ if (allIds.has(checkpoint.checkpointId)) {
499
+ problems.push({
500
+ code: "DUPLICATE_ID",
501
+ message: `identity ${JSON.stringify(checkpoint.checkpointId)} collides with another task or checkpoint`,
502
+ });
503
+ }
504
+ allIds.add(checkpoint.checkpointId);
505
+ checkpointIds.add(checkpoint.checkpointId);
506
+ }
507
+ for (const task of graph.tasks) {
508
+ for (const dependency of task.dependsOn) {
509
+ exactReference(dependency, taskIds, "dependsOn", `task ${task.taskId}`, problems);
510
+ }
511
+ for (const barrier of task.blockedBy) {
512
+ exactReference(barrier, checkpointIds, "blockedBy", `task ${task.taskId}`, problems);
513
+ }
514
+ for (const path of task.writeScope) {
515
+ if (!isPathInExecutionBoundary(path, graph.boundary)) {
516
+ problems.push({
517
+ code: "OUT_OF_BOUNDARY",
518
+ message: `task ${task.taskId} writeScope ${JSON.stringify(path)} is outside the execution boundary`,
519
+ });
520
+ }
521
+ }
522
+ }
523
+ for (const checkpoint of graph.checkpoints) {
524
+ if (checkpoint.covers.length === 0) {
525
+ problems.push({
526
+ code: "EMPTY_COVERS",
527
+ message: `checkpoint ${checkpoint.checkpointId} covers no tasks`,
528
+ });
529
+ }
530
+ for (const covered of checkpoint.covers) {
531
+ exactReference(covered, taskIds, "covers", `checkpoint ${checkpoint.checkpointId}`, problems);
532
+ }
533
+ for (const dependency of checkpoint.dependsOn) {
534
+ exactReference(dependency, checkpointIds, "dependsOn", `checkpoint ${checkpoint.checkpointId}`, problems);
535
+ }
536
+ for (const path of checkpoint.scope) {
537
+ if (!isPathInExecutionBoundary(path, graph.boundary)) {
538
+ problems.push({
539
+ code: "OUT_OF_BOUNDARY",
540
+ message: `checkpoint ${checkpoint.checkpointId} scope ${JSON.stringify(path)} is outside the execution boundary`,
541
+ });
542
+ }
543
+ }
544
+ }
545
+ if (problems.length === 0) {
546
+ const taskAdjacency = new Map();
547
+ for (const task of graph.tasks) {
548
+ if (task.dependsOn.includes(task.taskId)) {
549
+ problems.push({
550
+ code: "SELF_REFERENCE",
551
+ message: `task ${task.taskId} depends on itself`,
552
+ });
553
+ continue;
554
+ }
555
+ taskAdjacency.set(task.taskId, [...task.dependsOn]);
556
+ }
557
+ const taskCycle = detectCycle(taskAdjacency);
558
+ if (taskCycle) {
559
+ problems.push({
560
+ code: "CYCLIC_DEPENDENCY",
561
+ message: `task dependencies form a cycle: ${taskCycle.join(" -> ")}`,
562
+ });
563
+ }
564
+ const checkpointAdjacency = new Map();
565
+ for (const checkpoint of graph.checkpoints) {
566
+ if (checkpoint.dependsOn.includes(checkpoint.checkpointId)) {
567
+ problems.push({
568
+ code: "SELF_REFERENCE",
569
+ message: `checkpoint ${checkpoint.checkpointId} depends on itself`,
570
+ });
571
+ continue;
572
+ }
573
+ // A checkpoint covering task T is implicitly gated by T's own task
574
+ // dependencies only through declared blockedBy; keep the graph purely
575
+ // structural here so callers own the enforcement order.
576
+ checkpointAdjacency.set(checkpoint.checkpointId, [...checkpoint.dependsOn]);
577
+ }
578
+ const checkpointCycle = detectCycle(checkpointAdjacency);
579
+ if (checkpointCycle) {
580
+ problems.push({
581
+ code: "CYCLIC_DEPENDENCY",
582
+ message: `checkpoint dependencies form a cycle: ${checkpointCycle.join(" -> ")}`,
583
+ });
584
+ }
585
+ }
586
+ if (problems.length > 0)
587
+ return { ok: false, problems };
588
+ return { ok: true, value: { tasks: [...graph.tasks], checkpoints: [...graph.checkpoints] } };
589
+ }
590
+ // END_BLOCK_GRAPH_VALIDATION
591
+ // START_BLOCK_NATIVE_ADAPTER
592
+ /**
593
+ * Adapt native-extracted task obligations into common task contracts, lifting
594
+ * acceptance/verification/dependency text from the validated source instead of
595
+ * inventing generic requirements. The source's own wave barriers remain owned
596
+ * by the native adapter and are not converted into per-task dependencies here.
597
+ */
598
+ export function taskContractsFromNativeDefinition(definition) {
599
+ const taskIds = new Set(definition.tasks.map((task) => task.taskId));
600
+ return definition.tasks.map((task) => {
601
+ const acceptance = (task.acceptance ?? []).map((entry) => entry.trim()).filter(Boolean);
602
+ const verification = (task.verification ?? []).map((entry) => entry.trim()).filter(Boolean);
603
+ const dependsOn = (task.dependsOn ?? [])
604
+ .map((entry) => entry.trim())
605
+ .filter((entry) => taskIds.has(entry));
606
+ return {
607
+ taskId: task.taskId,
608
+ title: (task.title ?? task.taskId).trim() || task.taskId,
609
+ goal: (task.title ?? task.taskId).trim() || task.taskId,
610
+ acceptanceCriteria: acceptance,
611
+ verification,
612
+ writeScope: [...task.writeScope],
613
+ dependsOn: [...new Set(dependsOn)],
614
+ blockedBy: [],
615
+ // Native task-level reviewer sets do not exist; native reviews are
616
+ // checkpoint obligations, so the per-task set is explicitly empty.
617
+ requiredReviewers: [],
618
+ };
619
+ });
620
+ }
621
+ /** Adapt native checkpoints into common checkpoint contracts with source origin. */
622
+ export function checkpointContractsFromNativeDefinition(definition, scope) {
623
+ return definition.checkpoints.map((checkpoint) => ({
624
+ checkpointId: checkpoint.checkpointId,
625
+ kind: checkpoint.kind,
626
+ covers: [...checkpoint.covers],
627
+ scope: [...checkpoint.scope],
628
+ requiredReviewers: [...checkpoint.reviewers],
629
+ acceptance: [...checkpoint.acceptance],
630
+ verification: [...checkpoint.verification],
631
+ origin: scope?.origin ?? "source",
632
+ dependsOn: [...(scope?.dependsOn ?? [])],
633
+ }));
634
+ }
635
+ // END_BLOCK_NATIVE_ADAPTER
636
+ //# sourceMappingURL=workflow-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-contract.js","sourceRoot":"","sources":["../../src/lib/workflow-contract.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,iBAAiB;AACjB,wBAAwB;AACx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