@ai-dev-orchestrator/artifacts 0.1.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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/domain/agreement-artifacts/errors.d.ts +16 -0
- package/dist/domain/agreement-artifacts/errors.js +23 -0
- package/dist/domain/agreement-artifacts/index.d.ts +1 -0
- package/dist/domain/agreement-artifacts/index.js +1 -0
- package/dist/domain/artifact-system/artifact-content-schemas.d.ts +487 -0
- package/dist/domain/artifact-system/artifact-content-schemas.js +464 -0
- package/dist/domain/artifact-system/artifact-descriptors.d.ts +9 -0
- package/dist/domain/artifact-system/artifact-descriptors.js +165 -0
- package/dist/domain/artifact-system/constants.d.ts +7 -0
- package/dist/domain/artifact-system/constants.js +29 -0
- package/dist/domain/artifact-system/errors.d.ts +55 -0
- package/dist/domain/artifact-system/errors.js +75 -0
- package/dist/domain/artifact-system/index.d.ts +5 -0
- package/dist/domain/artifact-system/index.js +4 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -0
- package/dist/infrastructure/agreement-artifacts/agreement-gate.d.ts +27 -0
- package/dist/infrastructure/agreement-artifacts/agreement-gate.js +105 -0
- package/dist/infrastructure/agreement-artifacts/agreement-generator.d.ts +28 -0
- package/dist/infrastructure/agreement-artifacts/agreement-generator.js +89 -0
- package/dist/infrastructure/agreement-artifacts/agreement-validator.d.ts +7 -0
- package/dist/infrastructure/agreement-artifacts/agreement-validator.js +38 -0
- package/dist/infrastructure/agreement-artifacts/index.d.ts +3 -0
- package/dist/infrastructure/agreement-artifacts/index.js +3 -0
- package/dist/infrastructure/artifact-system/artifact-type-validator.d.ts +6 -0
- package/dist/infrastructure/artifact-system/artifact-type-validator.js +38 -0
- package/dist/infrastructure/artifact-system/checksum-engine.d.ts +4 -0
- package/dist/infrastructure/artifact-system/checksum-engine.js +9 -0
- package/dist/infrastructure/artifact-system/content-parser.d.ts +26 -0
- package/dist/infrastructure/artifact-system/content-parser.js +64 -0
- package/dist/infrastructure/artifact-system/default-ownership-registry.d.ts +14 -0
- package/dist/infrastructure/artifact-system/default-ownership-registry.js +65 -0
- package/dist/infrastructure/artifact-system/disk-reader.d.ts +7 -0
- package/dist/infrastructure/artifact-system/disk-reader.js +22 -0
- package/dist/infrastructure/artifact-system/disk-writer.d.ts +3 -0
- package/dist/infrastructure/artifact-system/disk-writer.js +21 -0
- package/dist/infrastructure/artifact-system/filesystem-artifact-store.d.ts +26 -0
- package/dist/infrastructure/artifact-system/filesystem-artifact-store.js +191 -0
- package/dist/infrastructure/artifact-system/index.d.ts +8 -0
- package/dist/infrastructure/artifact-system/index.js +7 -0
- package/dist/infrastructure/artifact-system/inventory-manager.d.ts +18 -0
- package/dist/infrastructure/artifact-system/inventory-manager.js +142 -0
- package/dist/infrastructure/artifact-system/version-manager.d.ts +12 -0
- package/dist/infrastructure/artifact-system/version-manager.js +42 -0
- package/dist/infrastructure/shared/hash.d.ts +2 -0
- package/dist/infrastructure/shared/hash.js +10 -0
- package/package.json +47 -0
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { agreementTypeSchema, approvalStatusSchema, approvalTypeSchema, escalationTriggerSchema, intakeVerdictSchema, } from '@ai-dev-orchestrator/schemas';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
import { REVIEW_ARTIFACT_TYPES } from './constants';
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Shared sub-schemas
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
const artifactRefSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
type: z.string().optional(),
|
|
10
|
+
name: z.string().optional(),
|
|
11
|
+
version: z.coerce.number().optional(),
|
|
12
|
+
})
|
|
13
|
+
.loose();
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Content schemas — one per artifact shape
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
export const canonicalSpecificationContentSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
id: z.string(),
|
|
20
|
+
version: z.number().min(1),
|
|
21
|
+
title: z.string().min(1).max(200),
|
|
22
|
+
businessGoal: z.string().min(1).max(1000),
|
|
23
|
+
createdAt: z.string(),
|
|
24
|
+
updatedAt: z.string(),
|
|
25
|
+
previousVersion: z.string().optional(),
|
|
26
|
+
sources: z.array(z.unknown()).optional(),
|
|
27
|
+
analysis: z.looseObject({}).optional(),
|
|
28
|
+
feasibility: z
|
|
29
|
+
.object({
|
|
30
|
+
feasible: z.boolean(),
|
|
31
|
+
reason: z.string().optional(),
|
|
32
|
+
})
|
|
33
|
+
.optional(),
|
|
34
|
+
})
|
|
35
|
+
.loose();
|
|
36
|
+
const planTaskSchema = z.object({
|
|
37
|
+
taskId: z.string().min(1),
|
|
38
|
+
description: z.string().min(1),
|
|
39
|
+
files: z.array(z.string()),
|
|
40
|
+
dependencies: z.array(z.string()),
|
|
41
|
+
});
|
|
42
|
+
function validateTaskDag(tasks) {
|
|
43
|
+
const errors = [];
|
|
44
|
+
const taskIds = new Set();
|
|
45
|
+
for (const task of tasks) {
|
|
46
|
+
if (taskIds.has(task.taskId)) {
|
|
47
|
+
errors.push(`duplicate taskId: ${task.taskId}`);
|
|
48
|
+
}
|
|
49
|
+
taskIds.add(task.taskId);
|
|
50
|
+
}
|
|
51
|
+
for (const task of tasks) {
|
|
52
|
+
for (const dep of task.dependencies) {
|
|
53
|
+
if (!taskIds.has(dep)) {
|
|
54
|
+
errors.push(`task "${task.taskId}" references unknown dependency "${dep}"`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const WHITE = 0;
|
|
59
|
+
const GRAY = 1;
|
|
60
|
+
const BLACK = 2;
|
|
61
|
+
const color = new Map();
|
|
62
|
+
for (const task of tasks) {
|
|
63
|
+
color.set(task.taskId, WHITE);
|
|
64
|
+
}
|
|
65
|
+
const depMap = new Map();
|
|
66
|
+
for (const task of tasks) {
|
|
67
|
+
depMap.set(task.taskId, task.dependencies);
|
|
68
|
+
}
|
|
69
|
+
function visit(taskId, path) {
|
|
70
|
+
color.set(taskId, GRAY);
|
|
71
|
+
path.push(taskId);
|
|
72
|
+
for (const dep of depMap.get(taskId) ?? []) {
|
|
73
|
+
if (color.get(dep) === GRAY) {
|
|
74
|
+
const cycleStart = path.indexOf(dep);
|
|
75
|
+
const cycle = path.slice(cycleStart).concat(dep);
|
|
76
|
+
errors.push(`dependency cycle detected: ${cycle.join(' → ')}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (color.get(dep) === WHITE) {
|
|
80
|
+
visit(dep, path);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
path.pop();
|
|
84
|
+
color.set(taskId, BLACK);
|
|
85
|
+
}
|
|
86
|
+
for (const task of tasks) {
|
|
87
|
+
if (color.get(task.taskId) === WHITE) {
|
|
88
|
+
visit(task.taskId, []);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return errors;
|
|
92
|
+
}
|
|
93
|
+
export const planContentSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
version: z.number().min(1),
|
|
96
|
+
specificationRef: artifactRefSchema,
|
|
97
|
+
previousVersion: z.string().optional(),
|
|
98
|
+
createdAt: z.string(),
|
|
99
|
+
summary: z.string().min(1),
|
|
100
|
+
tasks: z.array(planTaskSchema).min(1),
|
|
101
|
+
})
|
|
102
|
+
.loose()
|
|
103
|
+
.superRefine((data, ctx) => {
|
|
104
|
+
for (const message of validateTaskDag(data.tasks)) {
|
|
105
|
+
ctx.addIssue({ code: 'custom', path: ['tasks'], message });
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const reviewAttributionSchema = z.enum(['introduced', 'worsened', 'propagated', 'pre-existing']);
|
|
109
|
+
const reviewFindingSchema = z.object({
|
|
110
|
+
id: z.string(),
|
|
111
|
+
category: z.string(),
|
|
112
|
+
severity: z.string(),
|
|
113
|
+
description: z.string(),
|
|
114
|
+
file: z.string().optional(),
|
|
115
|
+
line: z.number().optional(),
|
|
116
|
+
suggestion: z.string().optional(),
|
|
117
|
+
evidence: z.string().optional(),
|
|
118
|
+
attribution: reviewAttributionSchema.optional(),
|
|
119
|
+
});
|
|
120
|
+
export const reviewContentSchema = z
|
|
121
|
+
.object({
|
|
122
|
+
version: z.number().min(1),
|
|
123
|
+
approved: z.boolean(),
|
|
124
|
+
summary: z.string().min(1),
|
|
125
|
+
findings: z.array(reviewFindingSchema),
|
|
126
|
+
reviewType: z.enum([...REVIEW_ARTIFACT_TYPES]).optional(),
|
|
127
|
+
reviewedArtifactRef: artifactRefSchema.optional(),
|
|
128
|
+
previousVersion: z.string().optional(),
|
|
129
|
+
role: z.string().optional(),
|
|
130
|
+
createdAt: z.string(),
|
|
131
|
+
})
|
|
132
|
+
.loose();
|
|
133
|
+
const reviewReportFindingSchema = z.object({
|
|
134
|
+
id: z.string(),
|
|
135
|
+
category: z.enum([
|
|
136
|
+
'correctness',
|
|
137
|
+
'maintainability',
|
|
138
|
+
'security',
|
|
139
|
+
'performance',
|
|
140
|
+
'design',
|
|
141
|
+
'style',
|
|
142
|
+
]),
|
|
143
|
+
severity: z.enum(['critical', 'major', 'minor']),
|
|
144
|
+
description: z.string(),
|
|
145
|
+
sources: z.array(z.string()).optional(),
|
|
146
|
+
file: z.string().nullish(),
|
|
147
|
+
line: z.number().nullish(),
|
|
148
|
+
suggestion: z.string().nullish(),
|
|
149
|
+
evidence: z.string().nullish(),
|
|
150
|
+
attribution: reviewAttributionSchema.optional(),
|
|
151
|
+
});
|
|
152
|
+
export const reviewReportContentSchema = z
|
|
153
|
+
.object({
|
|
154
|
+
version: z.number().min(1),
|
|
155
|
+
approved: z.boolean(),
|
|
156
|
+
summary: z.string().min(1),
|
|
157
|
+
findings: z.array(reviewReportFindingSchema),
|
|
158
|
+
verdict: z.enum(['approve', 'request_changes']),
|
|
159
|
+
reviewSummary: z
|
|
160
|
+
.object({
|
|
161
|
+
totalFindings: z.number().optional(),
|
|
162
|
+
critical: z.number().optional(),
|
|
163
|
+
major: z.number().optional(),
|
|
164
|
+
minor: z.number().optional(),
|
|
165
|
+
})
|
|
166
|
+
.optional(),
|
|
167
|
+
createdAt: z.string(),
|
|
168
|
+
})
|
|
169
|
+
.loose();
|
|
170
|
+
export const testPlanContentSchema = z
|
|
171
|
+
.object({
|
|
172
|
+
version: z.number().min(1),
|
|
173
|
+
specificationRef: artifactRefSchema,
|
|
174
|
+
planRef: artifactRefSchema,
|
|
175
|
+
summary: z.string().optional(),
|
|
176
|
+
previousVersion: z.string().optional(),
|
|
177
|
+
createdAt: z.string(),
|
|
178
|
+
})
|
|
179
|
+
.loose();
|
|
180
|
+
const implementationSummarySchema = z.union([
|
|
181
|
+
z.string(),
|
|
182
|
+
z
|
|
183
|
+
.object({
|
|
184
|
+
filesCreated: z.number().optional(),
|
|
185
|
+
filesModified: z.number().optional(),
|
|
186
|
+
filesDeleted: z.number().optional(),
|
|
187
|
+
totalTestsWritten: z.number().optional(),
|
|
188
|
+
totalTestsPassed: z.number().optional(),
|
|
189
|
+
totalTestsFailed: z.number().optional(),
|
|
190
|
+
deviationsFromPlan: z.number().optional(),
|
|
191
|
+
})
|
|
192
|
+
.loose(),
|
|
193
|
+
]);
|
|
194
|
+
export const implementationContentSchema = z
|
|
195
|
+
.object({
|
|
196
|
+
version: z.number().min(1),
|
|
197
|
+
planRef: artifactRefSchema,
|
|
198
|
+
testPlanRef: artifactRefSchema,
|
|
199
|
+
summary: implementationSummarySchema.optional(),
|
|
200
|
+
steps: z.array(z.looseObject({})).optional(),
|
|
201
|
+
previousVersion: z.string().optional(),
|
|
202
|
+
createdAt: z.string(),
|
|
203
|
+
})
|
|
204
|
+
.loose();
|
|
205
|
+
const verificationFailureSchema = z.object({
|
|
206
|
+
type: z.enum(['test', 'lint', 'type_check', 'build', 'other']),
|
|
207
|
+
fixable: z.boolean(),
|
|
208
|
+
description: z.string(),
|
|
209
|
+
file: z.string().optional(),
|
|
210
|
+
});
|
|
211
|
+
export const verificationContentSchema = z
|
|
212
|
+
.object({
|
|
213
|
+
version: z.number().min(1),
|
|
214
|
+
passed: z.boolean(),
|
|
215
|
+
summary: z.string().min(1),
|
|
216
|
+
failures: z.array(verificationFailureSchema),
|
|
217
|
+
implementationRef: artifactRefSchema.optional(),
|
|
218
|
+
testPlanRef: artifactRefSchema.optional(),
|
|
219
|
+
specificationRef: artifactRefSchema.optional(),
|
|
220
|
+
previousVersion: z.string().optional(),
|
|
221
|
+
createdAt: z.string(),
|
|
222
|
+
})
|
|
223
|
+
.loose();
|
|
224
|
+
export const agreementContentSchema = z
|
|
225
|
+
.object({
|
|
226
|
+
version: z.number().min(1),
|
|
227
|
+
agreementType: agreementTypeSchema,
|
|
228
|
+
runId: z.string(),
|
|
229
|
+
stageId: z.string(),
|
|
230
|
+
createdAt: z.string(),
|
|
231
|
+
approvalStatus: approvalStatusSchema,
|
|
232
|
+
approvalType: approvalTypeSchema,
|
|
233
|
+
})
|
|
234
|
+
.loose();
|
|
235
|
+
export const judgeDecisionContentSchema = z
|
|
236
|
+
.object({
|
|
237
|
+
version: z.number().min(1),
|
|
238
|
+
approved: z.boolean(),
|
|
239
|
+
rationale: z.string(),
|
|
240
|
+
directives: z.array(z.string()),
|
|
241
|
+
reviewArtifactsConsidered: z.array(z.string()),
|
|
242
|
+
planLevelIssue: z.boolean().optional(),
|
|
243
|
+
createdAt: z.string(),
|
|
244
|
+
})
|
|
245
|
+
.loose();
|
|
246
|
+
export const escalationContextContentSchema = z
|
|
247
|
+
.object({
|
|
248
|
+
version: z.number().min(1),
|
|
249
|
+
runId: z.string(),
|
|
250
|
+
escalationTrigger: escalationTriggerSchema,
|
|
251
|
+
stateAtEscalation: z.string(),
|
|
252
|
+
createdAt: z.string(),
|
|
253
|
+
})
|
|
254
|
+
.loose();
|
|
255
|
+
export const runManifestContentSchema = z
|
|
256
|
+
.object({
|
|
257
|
+
runId: z.string().regex(/^\d{8}-\d{6}-[a-z0-9]{6}$/),
|
|
258
|
+
version: z.string(),
|
|
259
|
+
repository: z.looseObject({}),
|
|
260
|
+
workflow: z.looseObject({}),
|
|
261
|
+
timing: z.looseObject({}),
|
|
262
|
+
status: z.enum(['completed', 'aborted', 'failed']),
|
|
263
|
+
finalState: z.string(),
|
|
264
|
+
abortReason: z.string().optional(),
|
|
265
|
+
})
|
|
266
|
+
.loose();
|
|
267
|
+
export const intakeAnalysisContentSchema = z
|
|
268
|
+
.object({
|
|
269
|
+
completenessScore: z.number().min(0).max(1),
|
|
270
|
+
ambiguityCount: z.number().min(0).optional(),
|
|
271
|
+
riskCount: z.number().min(0).optional(),
|
|
272
|
+
unvalidatedAssumptionCount: z.number().min(0).optional(),
|
|
273
|
+
readinessVerdict: intakeVerdictSchema,
|
|
274
|
+
analystNotes: z.string().optional(),
|
|
275
|
+
})
|
|
276
|
+
.loose();
|
|
277
|
+
const clarificationAnswerEntrySchema = z.object({
|
|
278
|
+
questionId: z.string().optional(),
|
|
279
|
+
question: z.string().optional(),
|
|
280
|
+
answer: z.string(),
|
|
281
|
+
});
|
|
282
|
+
export const clarificationAnswersContentSchema = z
|
|
283
|
+
.object({
|
|
284
|
+
answers: z.array(clarificationAnswerEntrySchema).optional(),
|
|
285
|
+
})
|
|
286
|
+
.loose();
|
|
287
|
+
export const releaseSummaryContentSchema = z
|
|
288
|
+
.object({
|
|
289
|
+
version: z.number().min(1),
|
|
290
|
+
commitMessage: z.string().min(1),
|
|
291
|
+
prDescription: z.string().min(1),
|
|
292
|
+
humanSummary: z.string().min(1),
|
|
293
|
+
createdAt: z.string(),
|
|
294
|
+
})
|
|
295
|
+
.loose();
|
|
296
|
+
export const reviewFindingsContentSchema = z
|
|
297
|
+
.object({
|
|
298
|
+
version: z.number().min(1),
|
|
299
|
+
title: z.string().optional(),
|
|
300
|
+
summary: z.string().optional(),
|
|
301
|
+
acceptanceCriteria: z
|
|
302
|
+
.object({
|
|
303
|
+
addressed: z
|
|
304
|
+
.array(z.object({
|
|
305
|
+
criterion: z.string(),
|
|
306
|
+
evidence: z.string().optional(),
|
|
307
|
+
}))
|
|
308
|
+
.optional(),
|
|
309
|
+
partiallyAddressed: z
|
|
310
|
+
.array(z.object({
|
|
311
|
+
criterion: z.string(),
|
|
312
|
+
note: z.string().optional(),
|
|
313
|
+
}))
|
|
314
|
+
.optional(),
|
|
315
|
+
notAddressed: z
|
|
316
|
+
.array(z.object({
|
|
317
|
+
criterion: z.string(),
|
|
318
|
+
note: z.string().optional(),
|
|
319
|
+
}))
|
|
320
|
+
.optional(),
|
|
321
|
+
})
|
|
322
|
+
.optional(),
|
|
323
|
+
untrackedChanges: z.array(z.object({ file: z.string(), description: z.string() })).optional(),
|
|
324
|
+
risks: z.array(z.string()).optional(),
|
|
325
|
+
findings: z.array(z
|
|
326
|
+
.object({
|
|
327
|
+
description: z.string().min(1),
|
|
328
|
+
file: z.string().min(1).optional(),
|
|
329
|
+
actionability: z.enum(['actionable', 'advisory']).optional(),
|
|
330
|
+
suggestion: z.string().min(1).optional(),
|
|
331
|
+
evidence: z.string().optional(),
|
|
332
|
+
})
|
|
333
|
+
.loose()),
|
|
334
|
+
createdAt: z.string(),
|
|
335
|
+
})
|
|
336
|
+
.loose();
|
|
337
|
+
export const intakeRequirementsContentSchema = z
|
|
338
|
+
.object({
|
|
339
|
+
title: z.string().optional(),
|
|
340
|
+
description: z.string().optional(),
|
|
341
|
+
rawFields: z.record(z.string(), z.unknown()).optional(),
|
|
342
|
+
sourceMetadata: z
|
|
343
|
+
.object({
|
|
344
|
+
fetchedAt: z.string(),
|
|
345
|
+
checksum: z.string(),
|
|
346
|
+
})
|
|
347
|
+
.optional(),
|
|
348
|
+
})
|
|
349
|
+
.loose();
|
|
350
|
+
export const codebaseContextContentSchema = z
|
|
351
|
+
.object({
|
|
352
|
+
version: z.number().min(1),
|
|
353
|
+
specificationRef: artifactRefSchema.optional(),
|
|
354
|
+
projectStructure: z.string().min(1),
|
|
355
|
+
conventions: z.array(z.string()),
|
|
356
|
+
techStack: z.array(z.string()),
|
|
357
|
+
affectedFiles: z.array(z.object({
|
|
358
|
+
path: z.string(),
|
|
359
|
+
reason: z.string(),
|
|
360
|
+
signatures: z.string().nullable().optional(),
|
|
361
|
+
})),
|
|
362
|
+
existingPatterns: z.array(z.string()).optional(),
|
|
363
|
+
createdAt: z.string(),
|
|
364
|
+
})
|
|
365
|
+
.loose();
|
|
366
|
+
export const testSuiteContentSchema = z
|
|
367
|
+
.object({
|
|
368
|
+
version: z.number().min(1),
|
|
369
|
+
planRef: artifactRefSchema.optional(),
|
|
370
|
+
implementationRef: artifactRefSchema.optional(),
|
|
371
|
+
testsWritten: z.array(z.object({
|
|
372
|
+
file: z.string(),
|
|
373
|
+
description: z.string(),
|
|
374
|
+
type: z.enum(['unit', 'integration', 'e2e', 'other']).optional(),
|
|
375
|
+
})),
|
|
376
|
+
coverageTargets: z.array(z.string()).optional(),
|
|
377
|
+
edgeCases: z.array(z.string()).optional(),
|
|
378
|
+
createdAt: z.string(),
|
|
379
|
+
})
|
|
380
|
+
.loose();
|
|
381
|
+
export const remediationPlanContentSchema = z
|
|
382
|
+
.object({
|
|
383
|
+
version: z.number().min(1),
|
|
384
|
+
summary: z.string().min(1),
|
|
385
|
+
planLevelIssue: z.boolean(),
|
|
386
|
+
needsHuman: z.boolean(),
|
|
387
|
+
actionItems: z.array(z.object({
|
|
388
|
+
id: z.string(),
|
|
389
|
+
findingRef: z.string(),
|
|
390
|
+
action: z.enum(['fix', 'defer', 'dismiss', 'escalate']),
|
|
391
|
+
description: z.string(),
|
|
392
|
+
priority: z.enum(['critical', 'high', 'medium', 'low']),
|
|
393
|
+
file: z.string().nullish(),
|
|
394
|
+
})),
|
|
395
|
+
dismissedFindings: z
|
|
396
|
+
.array(z.object({
|
|
397
|
+
findingId: z.string(),
|
|
398
|
+
reason: z.string(),
|
|
399
|
+
}))
|
|
400
|
+
.optional(),
|
|
401
|
+
createdAt: z.string(),
|
|
402
|
+
})
|
|
403
|
+
.loose();
|
|
404
|
+
export const acceptanceValidationContentSchema = z
|
|
405
|
+
.object({
|
|
406
|
+
version: z.number().min(1),
|
|
407
|
+
passed: z.boolean(),
|
|
408
|
+
summary: z.string().min(1),
|
|
409
|
+
criteriaResults: z.array(z.object({
|
|
410
|
+
requirementId: z.string(),
|
|
411
|
+
description: z.string(),
|
|
412
|
+
status: z.enum(['passed', 'failed', 'not_covered']),
|
|
413
|
+
evidence: z.string().optional(),
|
|
414
|
+
})),
|
|
415
|
+
uncoveredCriteria: z.array(z.string()).optional(),
|
|
416
|
+
specificationRef: artifactRefSchema.optional(),
|
|
417
|
+
verificationRef: artifactRefSchema.optional(),
|
|
418
|
+
createdAt: z.string(),
|
|
419
|
+
})
|
|
420
|
+
.loose();
|
|
421
|
+
export const taskBreakdownContentSchema = z
|
|
422
|
+
.object({
|
|
423
|
+
version: z.number().min(1),
|
|
424
|
+
tasks: z.array(z.unknown()),
|
|
425
|
+
})
|
|
426
|
+
.loose();
|
|
427
|
+
export const decompositionReviewContentSchema = z
|
|
428
|
+
.object({
|
|
429
|
+
version: z.number().min(1),
|
|
430
|
+
approved: z.boolean(),
|
|
431
|
+
})
|
|
432
|
+
.loose();
|
|
433
|
+
export const taskSpecificationsContentSchema = z
|
|
434
|
+
.object({
|
|
435
|
+
version: z.number().min(1),
|
|
436
|
+
specifications: z.array(z.unknown()),
|
|
437
|
+
})
|
|
438
|
+
.loose();
|
|
439
|
+
export const prDiffContextContentSchema = z
|
|
440
|
+
.object({
|
|
441
|
+
version: z.number().min(1),
|
|
442
|
+
prNumber: z.number().optional(),
|
|
443
|
+
baseRef: z.string().min(1),
|
|
444
|
+
headRef: z.string().min(1),
|
|
445
|
+
repositoryUrl: z.string().optional(),
|
|
446
|
+
diff: z.string().min(1),
|
|
447
|
+
changedFiles: z.array(z.object({
|
|
448
|
+
path: z.string(),
|
|
449
|
+
status: z.enum(['added', 'modified', 'deleted', 'renamed']),
|
|
450
|
+
additions: z.number().optional(),
|
|
451
|
+
deletions: z.number().optional(),
|
|
452
|
+
})),
|
|
453
|
+
createdAt: z.string(),
|
|
454
|
+
})
|
|
455
|
+
.loose();
|
|
456
|
+
// ---------------------------------------------------------------------------
|
|
457
|
+
// Standalone plan structure validation (for guards that only check DAG shape)
|
|
458
|
+
// ---------------------------------------------------------------------------
|
|
459
|
+
export function validatePlanStructure(content) {
|
|
460
|
+
if (!content.tasks || content.tasks.length === 0) {
|
|
461
|
+
return ['tasks must be non-empty'];
|
|
462
|
+
}
|
|
463
|
+
return validateTaskDag(content.tasks);
|
|
464
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArtifactType } from '@ai-dev-orchestrator/schemas';
|
|
2
|
+
import { type z } from 'zod/v4';
|
|
3
|
+
export interface ArtifactDescriptor {
|
|
4
|
+
readonly contentSchema: z.ZodType;
|
|
5
|
+
readonly defaultOwners: readonly string[];
|
|
6
|
+
readonly producerLabel?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ARTIFACT_DESCRIPTORS: Readonly<Record<ArtifactType, ArtifactDescriptor>>;
|
|
9
|
+
export declare const ARTIFACT_SCHEMA_MAP: Readonly<Record<ArtifactType, z.ZodType>>;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {} from 'zod/v4';
|
|
2
|
+
import { acceptanceValidationContentSchema, remediationPlanContentSchema, agreementContentSchema, canonicalSpecificationContentSchema, clarificationAnswersContentSchema, codebaseContextContentSchema, decompositionReviewContentSchema, escalationContextContentSchema, implementationContentSchema, intakeAnalysisContentSchema, intakeRequirementsContentSchema, judgeDecisionContentSchema, planContentSchema, prDiffContextContentSchema, releaseSummaryContentSchema, reviewContentSchema, reviewFindingsContentSchema, reviewReportContentSchema, runManifestContentSchema, taskBreakdownContentSchema, taskSpecificationsContentSchema, testPlanContentSchema, testSuiteContentSchema, verificationContentSchema, } from './artifact-content-schemas';
|
|
3
|
+
export const ARTIFACT_DESCRIPTORS = {
|
|
4
|
+
intake_requirements: {
|
|
5
|
+
contentSchema: intakeRequirementsContentSchema,
|
|
6
|
+
defaultOwners: ['human'],
|
|
7
|
+
producerLabel: 'human',
|
|
8
|
+
},
|
|
9
|
+
canonical_specification: {
|
|
10
|
+
contentSchema: canonicalSpecificationContentSchema,
|
|
11
|
+
defaultOwners: ['requirements_analyst', 'context_analyst'],
|
|
12
|
+
producerLabel: 'requirements_analyst',
|
|
13
|
+
},
|
|
14
|
+
clarification_questions: {
|
|
15
|
+
contentSchema: intakeAnalysisContentSchema,
|
|
16
|
+
defaultOwners: ['requirements_analyst'],
|
|
17
|
+
producerLabel: 'requirements_analyst',
|
|
18
|
+
},
|
|
19
|
+
clarification_answers: {
|
|
20
|
+
contentSchema: clarificationAnswersContentSchema,
|
|
21
|
+
defaultOwners: ['human'],
|
|
22
|
+
},
|
|
23
|
+
plan: {
|
|
24
|
+
contentSchema: planContentSchema,
|
|
25
|
+
defaultOwners: ['planner'],
|
|
26
|
+
producerLabel: 'planner',
|
|
27
|
+
},
|
|
28
|
+
plan_review: {
|
|
29
|
+
contentSchema: reviewContentSchema,
|
|
30
|
+
defaultOwners: ['plan_reviewer'],
|
|
31
|
+
producerLabel: 'plan_reviewer',
|
|
32
|
+
},
|
|
33
|
+
test_plan: {
|
|
34
|
+
contentSchema: testPlanContentSchema,
|
|
35
|
+
defaultOwners: ['implementer'],
|
|
36
|
+
producerLabel: 'implementer',
|
|
37
|
+
},
|
|
38
|
+
implementation: {
|
|
39
|
+
contentSchema: implementationContentSchema,
|
|
40
|
+
defaultOwners: ['implementer'],
|
|
41
|
+
producerLabel: 'implementer',
|
|
42
|
+
},
|
|
43
|
+
static_review: {
|
|
44
|
+
contentSchema: reviewContentSchema,
|
|
45
|
+
defaultOwners: ['static_reviewer'],
|
|
46
|
+
producerLabel: 'static_reviewer',
|
|
47
|
+
},
|
|
48
|
+
security_review: {
|
|
49
|
+
contentSchema: reviewContentSchema,
|
|
50
|
+
defaultOwners: ['security_reviewer'],
|
|
51
|
+
producerLabel: 'security_reviewer',
|
|
52
|
+
},
|
|
53
|
+
performance_review: {
|
|
54
|
+
contentSchema: reviewContentSchema,
|
|
55
|
+
defaultOwners: ['performance_reviewer'],
|
|
56
|
+
producerLabel: 'performance_reviewer',
|
|
57
|
+
},
|
|
58
|
+
adversarial_review: {
|
|
59
|
+
contentSchema: reviewContentSchema,
|
|
60
|
+
defaultOwners: ['adversarial_reviewer'],
|
|
61
|
+
producerLabel: 'adversarial_reviewer',
|
|
62
|
+
},
|
|
63
|
+
design_review: {
|
|
64
|
+
contentSchema: reviewContentSchema,
|
|
65
|
+
defaultOwners: ['design_reviewer'],
|
|
66
|
+
producerLabel: 'design_reviewer',
|
|
67
|
+
},
|
|
68
|
+
docs_review: {
|
|
69
|
+
contentSchema: reviewContentSchema,
|
|
70
|
+
defaultOwners: ['docs_reviewer'],
|
|
71
|
+
producerLabel: 'docs_reviewer',
|
|
72
|
+
},
|
|
73
|
+
ux_review: {
|
|
74
|
+
contentSchema: reviewContentSchema,
|
|
75
|
+
defaultOwners: ['ux_reviewer'],
|
|
76
|
+
producerLabel: 'ux_reviewer',
|
|
77
|
+
},
|
|
78
|
+
review_report: {
|
|
79
|
+
contentSchema: reviewReportContentSchema,
|
|
80
|
+
defaultOwners: ['report_synthesizer'],
|
|
81
|
+
producerLabel: 'report_synthesizer',
|
|
82
|
+
},
|
|
83
|
+
remediation_plan: {
|
|
84
|
+
contentSchema: remediationPlanContentSchema,
|
|
85
|
+
defaultOwners: ['remediation_triage'],
|
|
86
|
+
producerLabel: 'remediation_triage',
|
|
87
|
+
},
|
|
88
|
+
verification: {
|
|
89
|
+
contentSchema: verificationContentSchema,
|
|
90
|
+
defaultOwners: ['verifier'],
|
|
91
|
+
producerLabel: 'verifier',
|
|
92
|
+
},
|
|
93
|
+
judge_decision: {
|
|
94
|
+
contentSchema: judgeDecisionContentSchema,
|
|
95
|
+
defaultOwners: ['judge'],
|
|
96
|
+
producerLabel: 'judge',
|
|
97
|
+
},
|
|
98
|
+
planning_agreement: {
|
|
99
|
+
contentSchema: agreementContentSchema,
|
|
100
|
+
defaultOwners: ['governance'],
|
|
101
|
+
},
|
|
102
|
+
implementation_agreement: {
|
|
103
|
+
contentSchema: agreementContentSchema,
|
|
104
|
+
defaultOwners: ['governance'],
|
|
105
|
+
},
|
|
106
|
+
verification_agreement: {
|
|
107
|
+
contentSchema: agreementContentSchema,
|
|
108
|
+
defaultOwners: ['governance'],
|
|
109
|
+
},
|
|
110
|
+
release_agreement: {
|
|
111
|
+
contentSchema: agreementContentSchema,
|
|
112
|
+
defaultOwners: ['governance'],
|
|
113
|
+
},
|
|
114
|
+
escalation_context: {
|
|
115
|
+
contentSchema: escalationContextContentSchema,
|
|
116
|
+
defaultOwners: ['governance'],
|
|
117
|
+
},
|
|
118
|
+
run_manifest: {
|
|
119
|
+
contentSchema: runManifestContentSchema,
|
|
120
|
+
defaultOwners: ['workflow_engine'],
|
|
121
|
+
},
|
|
122
|
+
release_summary: {
|
|
123
|
+
contentSchema: releaseSummaryContentSchema,
|
|
124
|
+
defaultOwners: ['summary_writer'],
|
|
125
|
+
producerLabel: 'summary_writer',
|
|
126
|
+
},
|
|
127
|
+
review_findings: {
|
|
128
|
+
contentSchema: reviewFindingsContentSchema,
|
|
129
|
+
defaultOwners: ['review_findings_writer', 'script'],
|
|
130
|
+
producerLabel: 'review_findings_writer',
|
|
131
|
+
},
|
|
132
|
+
codebase_context: {
|
|
133
|
+
contentSchema: codebaseContextContentSchema,
|
|
134
|
+
defaultOwners: ['codebase_analyst'],
|
|
135
|
+
},
|
|
136
|
+
test_suite: {
|
|
137
|
+
contentSchema: testSuiteContentSchema,
|
|
138
|
+
defaultOwners: ['test_engineer'],
|
|
139
|
+
},
|
|
140
|
+
acceptance_validation: {
|
|
141
|
+
contentSchema: acceptanceValidationContentSchema,
|
|
142
|
+
defaultOwners: ['acceptance_validator'],
|
|
143
|
+
},
|
|
144
|
+
task_breakdown: {
|
|
145
|
+
contentSchema: taskBreakdownContentSchema,
|
|
146
|
+
defaultOwners: ['decomposer'],
|
|
147
|
+
producerLabel: 'decomposer',
|
|
148
|
+
},
|
|
149
|
+
decomposition_review: {
|
|
150
|
+
contentSchema: decompositionReviewContentSchema,
|
|
151
|
+
defaultOwners: ['decomposition_reviewer'],
|
|
152
|
+
producerLabel: 'decomposition_reviewer',
|
|
153
|
+
},
|
|
154
|
+
task_specifications: {
|
|
155
|
+
contentSchema: taskSpecificationsContentSchema,
|
|
156
|
+
defaultOwners: ['task_spec_writer'],
|
|
157
|
+
producerLabel: 'task_spec_writer',
|
|
158
|
+
},
|
|
159
|
+
pr_diff_context: {
|
|
160
|
+
contentSchema: prDiffContextContentSchema,
|
|
161
|
+
defaultOwners: ['script'],
|
|
162
|
+
producerLabel: 'compute-pr-diff',
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
export const ARTIFACT_SCHEMA_MAP = Object.fromEntries(Object.entries(ARTIFACT_DESCRIPTORS).map(([k, v]) => [k, v.contentSchema]));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArtifactType } from '@ai-dev-orchestrator/schemas';
|
|
2
|
+
/** Artifact types that represent code/plan reviews. */
|
|
3
|
+
export declare const REVIEW_ARTIFACT_TYPES: ReadonlySet<ArtifactType>;
|
|
4
|
+
/** Artifact types that represent governance agreements. */
|
|
5
|
+
export declare const AGREEMENT_ARTIFACT_TYPES: ReadonlySet<ArtifactType>;
|
|
6
|
+
/** Artifact types that carry a pass/fail or approved/rejected verdict. */
|
|
7
|
+
export declare const VERDICT_ARTIFACT_TYPES: ReadonlySet<ArtifactType>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Artifact types that represent code/plan reviews. */
|
|
2
|
+
export const REVIEW_ARTIFACT_TYPES = new Set([
|
|
3
|
+
'plan_review',
|
|
4
|
+
'static_review',
|
|
5
|
+
'security_review',
|
|
6
|
+
'performance_review',
|
|
7
|
+
'adversarial_review',
|
|
8
|
+
'design_review',
|
|
9
|
+
'docs_review',
|
|
10
|
+
'ux_review',
|
|
11
|
+
'decomposition_review',
|
|
12
|
+
]);
|
|
13
|
+
/** Artifact types that represent governance agreements. */
|
|
14
|
+
export const AGREEMENT_ARTIFACT_TYPES = new Set([
|
|
15
|
+
'planning_agreement',
|
|
16
|
+
'implementation_agreement',
|
|
17
|
+
'verification_agreement',
|
|
18
|
+
'release_agreement',
|
|
19
|
+
]);
|
|
20
|
+
/** Artifact types that carry a pass/fail or approved/rejected verdict. */
|
|
21
|
+
export const VERDICT_ARTIFACT_TYPES = new Set([
|
|
22
|
+
...REVIEW_ARTIFACT_TYPES,
|
|
23
|
+
...AGREEMENT_ARTIFACT_TYPES,
|
|
24
|
+
'review_report',
|
|
25
|
+
'review_findings',
|
|
26
|
+
'judge_decision',
|
|
27
|
+
'verification',
|
|
28
|
+
'acceptance_validation',
|
|
29
|
+
]);
|