agent-contracts 0.11.5 → 0.11.6

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/dist/index.js CHANGED
@@ -51876,6 +51876,7 @@ var validationCoverageRule = {
51876
51876
  }
51877
51877
  validationsByArtifact.get(val.target_artifact).add(val.kind);
51878
51878
  }
51879
+ const strictArtifactTypes = ["code", "config", "schema"];
51879
51880
  for (const [artId, art] of Object.entries(dsl.artifacts)) {
51880
51881
  const kinds = validationsByArtifact.get(artId);
51881
51882
  if (!kinds || kinds.size === 0) {
@@ -51887,8 +51888,7 @@ var validationCoverageRule = {
51887
51888
  });
51888
51889
  continue;
51889
51890
  }
51890
- const mechanicalTypes = ["code", "config", "schema"];
51891
- if (mechanicalTypes.includes(art.type) && !kinds.has("mechanical") && !kinds.has("schema")) {
51891
+ if (strictArtifactTypes.includes(art.type) && !kinds.has("mechanical") && !kinds.has("schema")) {
51892
51892
  diagnostics.push({
51893
51893
  ruleId: "validation-coverage",
51894
51894
  severity: "warning",
@@ -51897,6 +51897,16 @@ var validationCoverageRule = {
51897
51897
  });
51898
51898
  }
51899
51899
  }
51900
+ for (const [artId, art] of Object.entries(dsl.artifacts)) {
51901
+ if (art.required_validations.length === 0) {
51902
+ diagnostics.push({
51903
+ ruleId: "validation-coverage",
51904
+ severity: "warning",
51905
+ path: `artifacts.${artId}`,
51906
+ message: `Artifact "${artId}" has empty required_validations`
51907
+ });
51908
+ }
51909
+ }
51900
51910
  const referencedValidations = /* @__PURE__ */ new Set();
51901
51911
  for (const wf of Object.values(dsl.workflow)) {
51902
51912
  for (const step of wf.steps) {
@@ -52283,6 +52293,101 @@ var yamlReservedKeySafetyRule = {
52283
52293
  }
52284
52294
  };
52285
52295
 
52296
+ // src/linter/rules/artifact-required-validation-wiring.ts
52297
+ var artifactRequiredValidationWiringRule = {
52298
+ id: "artifact-required-validation-wiring",
52299
+ description: "Every validation listed in artifact.required_validations must exist, target the artifact, and be referenced in a workflow step or task.",
52300
+ run(dsl) {
52301
+ const diagnostics = [];
52302
+ const referencedValidations = /* @__PURE__ */ new Set();
52303
+ for (const wf of Object.values(dsl.workflow)) {
52304
+ for (const step of wf.steps) {
52305
+ if (step.type === "validation") {
52306
+ referencedValidations.add(step.validation);
52307
+ }
52308
+ }
52309
+ }
52310
+ for (const task of Object.values(dsl.tasks)) {
52311
+ for (const valId of task.validations) {
52312
+ referencedValidations.add(valId);
52313
+ }
52314
+ }
52315
+ for (const [artId, art] of Object.entries(dsl.artifacts)) {
52316
+ for (const reqValId of art.required_validations) {
52317
+ const val = dsl.validations[reqValId];
52318
+ if (!val) {
52319
+ diagnostics.push({
52320
+ ruleId: "artifact-required-validation-wiring",
52321
+ severity: "error",
52322
+ path: `artifacts.${artId}`,
52323
+ message: `required_validation "${reqValId}" does not exist in validations`
52324
+ });
52325
+ continue;
52326
+ }
52327
+ if (val.target_artifact !== artId) {
52328
+ diagnostics.push({
52329
+ ruleId: "artifact-required-validation-wiring",
52330
+ severity: "error",
52331
+ path: `artifacts.${artId}`,
52332
+ message: `required_validation "${reqValId}" has target_artifact "${val.target_artifact}" instead of "${artId}"`
52333
+ });
52334
+ }
52335
+ if (!referencedValidations.has(reqValId)) {
52336
+ diagnostics.push({
52337
+ ruleId: "artifact-required-validation-wiring",
52338
+ severity: "warning",
52339
+ path: `artifacts.${artId}`,
52340
+ message: `required_validation "${reqValId}" is defined but not referenced in any workflow step or task`
52341
+ });
52342
+ }
52343
+ }
52344
+ }
52345
+ return diagnostics;
52346
+ }
52347
+ };
52348
+
52349
+ // src/linter/rules/task-output-validation-completeness.ts
52350
+ var taskOutputValidationCompletenessRule = {
52351
+ id: "task-output-validation-completeness",
52352
+ description: "Tasks producing artifacts should cover those artifacts' required_validations in their validations list.",
52353
+ run(dsl) {
52354
+ const diagnostics = [];
52355
+ for (const [taskId, task] of Object.entries(dsl.tasks)) {
52356
+ const producedArtifacts = /* @__PURE__ */ new Set();
52357
+ if (task.execution_steps) {
52358
+ for (const step of task.execution_steps) {
52359
+ if (step.produces_artifact) {
52360
+ producedArtifacts.add(step.produces_artifact);
52361
+ }
52362
+ }
52363
+ }
52364
+ const agent = dsl.agents[task.target_agent];
52365
+ if (agent) {
52366
+ for (const artId of agent.can_write_artifacts) {
52367
+ producedArtifacts.add(artId);
52368
+ }
52369
+ }
52370
+ const taskValidations = new Set(task.validations);
52371
+ for (const artId of producedArtifacts) {
52372
+ const art = dsl.artifacts[artId];
52373
+ if (!art || art.required_validations.length === 0) continue;
52374
+ const missing = art.required_validations.filter(
52375
+ (v2) => !taskValidations.has(v2)
52376
+ );
52377
+ if (missing.length > 0) {
52378
+ diagnostics.push({
52379
+ ruleId: "task-output-validation-completeness",
52380
+ severity: "warning",
52381
+ path: `tasks.${taskId}`,
52382
+ message: `Task produces artifact "${artId}" which requires validations [${missing.join(", ")}] but task.validations does not include them`
52383
+ });
52384
+ }
52385
+ }
52386
+ }
52387
+ return diagnostics;
52388
+ }
52389
+ };
52390
+
52286
52391
  // src/linter/linter.ts
52287
52392
  var builtinRules = [
52288
52393
  validationCoverageRule,
@@ -52292,7 +52397,9 @@ var builtinRules = [
52292
52397
  artifactOwnershipRule,
52293
52398
  toolCommandsRule,
52294
52399
  guardrailPolicyCoverageRule,
52295
- yamlReservedKeySafetyRule
52400
+ yamlReservedKeySafetyRule,
52401
+ artifactRequiredValidationWiringRule,
52402
+ taskOutputValidationCompletenessRule
52296
52403
  ];
52297
52404
  function lint(dsl, rules = builtinRules) {
52298
52405
  const diagnostics = [];