agent-contracts 0.11.7 → 0.11.8
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/README.md +26 -0
- package/dist/cli.js +65 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +65 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -346,6 +346,9 @@ declare const DslSchema: z.ZodObject<{
|
|
|
346
346
|
mechanical: "mechanical";
|
|
347
347
|
semantic: "semantic";
|
|
348
348
|
approval: "approval";
|
|
349
|
+
provenance: "provenance";
|
|
350
|
+
traceability: "traceability";
|
|
351
|
+
fidelity: "fidelity";
|
|
349
352
|
}>;
|
|
350
353
|
executor_type: z.ZodEnum<{
|
|
351
354
|
tool: "tool";
|
|
@@ -731,6 +734,9 @@ declare const ValidationSchema: z.ZodObject<{
|
|
|
731
734
|
mechanical: "mechanical";
|
|
732
735
|
semantic: "semantic";
|
|
733
736
|
approval: "approval";
|
|
737
|
+
provenance: "provenance";
|
|
738
|
+
traceability: "traceability";
|
|
739
|
+
fidelity: "fidelity";
|
|
734
740
|
}>;
|
|
735
741
|
executor_type: z.ZodEnum<{
|
|
736
742
|
tool: "tool";
|
package/dist/index.js
CHANGED
|
@@ -50660,7 +50660,7 @@ var ToolSchema = z9.object({
|
|
|
50660
50660
|
import { z as z10 } from "zod";
|
|
50661
50661
|
var ValidationSchema = z10.object({
|
|
50662
50662
|
target_artifact: z10.string(),
|
|
50663
|
-
kind: z10.enum(["schema", "mechanical", "semantic", "approval"]),
|
|
50663
|
+
kind: z10.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
50664
50664
|
executor_type: z10.enum(["tool", "agent"]),
|
|
50665
50665
|
executor: z10.string(),
|
|
50666
50666
|
blocking: z10.boolean(),
|
|
@@ -52388,6 +52388,68 @@ var taskOutputValidationCompletenessRule = {
|
|
|
52388
52388
|
}
|
|
52389
52389
|
};
|
|
52390
52390
|
|
|
52391
|
+
// src/linter/rules/semantic-validation-phase-coverage.ts
|
|
52392
|
+
var SEMANTIC_KINDS = /* @__PURE__ */ new Set(["semantic", "fidelity"]);
|
|
52393
|
+
var semanticValidationPhaseCoverageRule = {
|
|
52394
|
+
id: "semantic-validation-phase-coverage",
|
|
52395
|
+
description: "Semantic and fidelity validations should appear in early workflow phases, not only in late phases.",
|
|
52396
|
+
run(dsl) {
|
|
52397
|
+
const diagnostics = [];
|
|
52398
|
+
const semanticValIds = /* @__PURE__ */ new Set();
|
|
52399
|
+
for (const [valId, val] of Object.entries(dsl.validations)) {
|
|
52400
|
+
if (SEMANTIC_KINDS.has(val.kind)) {
|
|
52401
|
+
semanticValIds.add(valId);
|
|
52402
|
+
}
|
|
52403
|
+
}
|
|
52404
|
+
if (semanticValIds.size === 0) {
|
|
52405
|
+
return diagnostics;
|
|
52406
|
+
}
|
|
52407
|
+
const phaseOrder = dsl.system.default_workflow_order;
|
|
52408
|
+
if (phaseOrder.length < 2) {
|
|
52409
|
+
return diagnostics;
|
|
52410
|
+
}
|
|
52411
|
+
const phaseValidations = /* @__PURE__ */ new Map();
|
|
52412
|
+
for (const phase of phaseOrder) {
|
|
52413
|
+
phaseValidations.set(phase, /* @__PURE__ */ new Set());
|
|
52414
|
+
}
|
|
52415
|
+
for (const [phase, wf] of Object.entries(dsl.workflow)) {
|
|
52416
|
+
if (!phaseValidations.has(phase)) continue;
|
|
52417
|
+
for (const step of wf.steps) {
|
|
52418
|
+
if (step.type === "validation" && semanticValIds.has(step.validation)) {
|
|
52419
|
+
phaseValidations.get(phase).add(step.validation);
|
|
52420
|
+
}
|
|
52421
|
+
}
|
|
52422
|
+
}
|
|
52423
|
+
for (const task of Object.values(dsl.tasks)) {
|
|
52424
|
+
const phase = task.workflow;
|
|
52425
|
+
if (!phaseValidations.has(phase)) continue;
|
|
52426
|
+
for (const valId of task.validations) {
|
|
52427
|
+
if (semanticValIds.has(valId)) {
|
|
52428
|
+
phaseValidations.get(phase).add(valId);
|
|
52429
|
+
}
|
|
52430
|
+
}
|
|
52431
|
+
}
|
|
52432
|
+
const earlyBoundary = Math.ceil(phaseOrder.length / 2);
|
|
52433
|
+
const earlyPhases = phaseOrder.slice(0, earlyBoundary);
|
|
52434
|
+
const latePhases = phaseOrder.slice(earlyBoundary);
|
|
52435
|
+
const earlyHasAny = earlyPhases.some(
|
|
52436
|
+
(p2) => (phaseValidations.get(p2)?.size ?? 0) > 0
|
|
52437
|
+
);
|
|
52438
|
+
const lateWithSemantic = latePhases.filter(
|
|
52439
|
+
(p2) => (phaseValidations.get(p2)?.size ?? 0) > 0
|
|
52440
|
+
);
|
|
52441
|
+
if (!earlyHasAny && lateWithSemantic.length > 0) {
|
|
52442
|
+
diagnostics.push({
|
|
52443
|
+
ruleId: "semantic-validation-phase-coverage",
|
|
52444
|
+
severity: "warning",
|
|
52445
|
+
path: "validations",
|
|
52446
|
+
message: `Semantic validations are only referenced in workflow phases [${lateWithSemantic.join(", ")}]. Consider adding semantic review to earlier phases [${earlyPhases.join(", ")}] to catch issues before implementation.`
|
|
52447
|
+
});
|
|
52448
|
+
}
|
|
52449
|
+
return diagnostics;
|
|
52450
|
+
}
|
|
52451
|
+
};
|
|
52452
|
+
|
|
52391
52453
|
// src/linter/linter.ts
|
|
52392
52454
|
var builtinRules = [
|
|
52393
52455
|
validationCoverageRule,
|
|
@@ -52399,7 +52461,8 @@ var builtinRules = [
|
|
|
52399
52461
|
guardrailPolicyCoverageRule,
|
|
52400
52462
|
yamlReservedKeySafetyRule,
|
|
52401
52463
|
artifactRequiredValidationWiringRule,
|
|
52402
|
-
taskOutputValidationCompletenessRule
|
|
52464
|
+
taskOutputValidationCompletenessRule,
|
|
52465
|
+
semanticValidationPhaseCoverageRule
|
|
52403
52466
|
];
|
|
52404
52467
|
function lint(dsl, rules = builtinRules) {
|
|
52405
52468
|
const diagnostics = [];
|