agent-contracts 0.30.0 → 0.30.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/cli-contract.yaml CHANGED
@@ -3,7 +3,7 @@ cli_contracts: 0.1.0
3
3
 
4
4
  info:
5
5
  title: agent-contracts CLI
6
- version: 0.30.0
6
+ version: 0.30.1
7
7
  description: >-
8
8
  Declarative YAML DSL toolkit for defining, validating, and rendering
9
9
  multi-agent development workflows. Provides static validation,
@@ -15,6 +15,26 @@ info:
15
15
  name: foo-ogawa
16
16
  url: https://github.com/foo-ogawa/agent-contracts
17
17
 
18
+ artifact_slots:
19
+ dsl-definitions:
20
+ description: Agent contracts DSL YAML files (agent-contracts.yaml and extends targets)
21
+ direction: read
22
+ config:
23
+ description: agent-contracts.config.yaml configuration file
24
+ direction: read
25
+ generated-templates:
26
+ description: Rendered output files from Handlebars templates
27
+ direction: write
28
+ generated-guardrails:
29
+ description: Generated guardrail binding files (cursor-rules, AGENTS.md, etc.)
30
+ direction: write
31
+ generated-interface:
32
+ description: Generated team interface YAML/JSON files
33
+ direction: write
34
+ audit-report:
35
+ description: LLM audit result output files
36
+ direction: write
37
+
18
38
  command_sets:
19
39
  agent-contracts:
20
40
  summary: Agent contracts tooling — validate, lint, render DSL files.
@@ -297,13 +317,7 @@ command_sets:
297
317
  effects:
298
318
  risk_level: medium
299
319
  writes:
300
- - target: "configured render output paths"
301
- description: "rendered template files from DSL input"
302
- overwrite: true
303
- idempotent: true
304
- idempotent_note: >-
305
- Output is deterministic from DSL input and templates.
306
- Repeated runs produce identical files.
320
+ - generated-templates
307
321
 
308
322
  options:
309
323
  - name: config
@@ -535,6 +549,11 @@ command_sets:
535
549
 
536
550
  effects:
537
551
  risk_level: medium
552
+ reads:
553
+ - dsl-definitions
554
+ - config
555
+ writes:
556
+ - audit-report
538
557
  network:
539
558
  description: >-
540
559
  LLM API calls to configured adapter (e.g. OpenAI,
@@ -713,16 +732,9 @@ command_sets:
713
732
  effects:
714
733
  risk_level: low
715
734
  writes:
716
- - target: "configured render, guardrail, and interface output paths"
717
- description: >-
718
- template files, guardrail binding files, and/or team
719
- interface files generated from DSL input
720
- overwrite: true
721
- idempotent: true
722
- idempotent_note: >-
723
- Output is deterministic from DSL input, templates,
724
- policies, and bindings. Repeated runs produce
725
- identical files.
735
+ - generated-templates
736
+ - generated-guardrails
737
+ - generated-interface
726
738
 
727
739
  arguments:
728
740
  - name: type
package/dist/cli.js CHANGED
@@ -40342,17 +40342,19 @@ var require_errors = __commonJS({
40342
40342
  exports.convertAjvErrors = exports.RulesetValidationError = void 0;
40343
40343
  var isAggregateError_1 = require_isAggregateError();
40344
40344
  var RulesetValidationError = class extends Error {
40345
- constructor(code, message, path) {
40345
+ constructor(code, message, path, location2) {
40346
40346
  super(message);
40347
40347
  this.code = code;
40348
40348
  this.message = message;
40349
40349
  this.path = path;
40350
+ this.range = location2 === null || location2 === void 0 ? void 0 : location2.range;
40351
+ this.source = location2 === null || location2 === void 0 ? void 0 : location2.source;
40350
40352
  }
40351
40353
  };
40352
40354
  exports.RulesetValidationError = RulesetValidationError;
40353
40355
  var RULE_INSTANCE_PATH = /^\/rules\/[^/]+/;
40354
40356
  var GENERIC_INSTANCE_PATH = /^\/(?:aliases|extends|overrides(?:\/\d+\/extends)?)/;
40355
- function convertAjvErrors(errors) {
40357
+ function convertAjvErrors(errors, sourceContext) {
40356
40358
  const sortedErrors = [...errors].sort((errorA, errorB) => {
40357
40359
  const diff = errorA.instancePath.length - errorB.instancePath.length;
40358
40360
  return diff === 0 ? errorA.keyword === "errorMessage" && errorB.keyword !== "errorMessage" ? -1 : 0 : diff;
@@ -40385,10 +40387,12 @@ var require_errors = __commonJS({
40385
40387
  return filteredErrors.flatMap((error) => {
40386
40388
  var _a;
40387
40389
  if (error.keyword === "x-spectral-runtime") {
40388
- return flatErrors(error.params.errors);
40390
+ const flat = flatErrors(error.params.errors);
40391
+ const list = Array.isArray(flat) ? flat : [flat];
40392
+ return list.map((e3) => enrichWithLocation(e3, sourceContext));
40389
40393
  }
40390
40394
  const path = error.instancePath.slice(1).split("/");
40391
- return new RulesetValidationError(inferErrorCode(path, error.keyword), (_a = error.message) !== null && _a !== void 0 ? _a : "unknown error", path);
40395
+ return new RulesetValidationError(inferErrorCode(path, error.keyword), (_a = error.message) !== null && _a !== void 0 ? _a : "unknown error", path, resolveLocation(path, sourceContext));
40392
40396
  });
40393
40397
  }
40394
40398
  exports.convertAjvErrors = convertAjvErrors;
@@ -40398,6 +40402,22 @@ var require_errors = __commonJS({
40398
40402
  }
40399
40403
  return error;
40400
40404
  }
40405
+ function resolveLocation(path, sourceContext) {
40406
+ var _a;
40407
+ if (sourceContext === void 0) {
40408
+ return void 0;
40409
+ }
40410
+ return {
40411
+ source: sourceContext.source,
40412
+ range: (_a = sourceContext.getLocationForJsonPath(path)) === null || _a === void 0 ? void 0 : _a.range
40413
+ };
40414
+ }
40415
+ function enrichWithLocation(error, sourceContext) {
40416
+ if (sourceContext === void 0 || error.source !== void 0 || error.range !== void 0) {
40417
+ return error;
40418
+ }
40419
+ return new RulesetValidationError(error.code, error.message, error.path, resolveLocation(error.path, sourceContext));
40420
+ }
40401
40421
  function inferErrorCode(path, keyword) {
40402
40422
  if (path.length === 0) {
40403
40423
  return "generic-validation-error";
@@ -45918,17 +45938,17 @@ var require_assertions = __commonJS({
45918
45938
  var ajv_1 = require_ajv();
45919
45939
  var errors_1 = require_errors();
45920
45940
  var es_aggregate_error_1 = (0, tslib_1.__importDefault)(require_es_aggregate_error());
45921
- function assertValidRuleset(ruleset2, format2 = "js") {
45922
- var _a;
45941
+ function assertValidRuleset(ruleset2, format2 = "js", sourceContext) {
45942
+ var _a, _b;
45923
45943
  if (!(0, json_1.isPlainObject)(ruleset2)) {
45924
- throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Provided ruleset is not an object", []);
45944
+ throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Provided ruleset is not an object", [], sourceContext === void 0 ? void 0 : { source: sourceContext.source });
45925
45945
  }
45926
45946
  if (!("rules" in ruleset2) && !("extends" in ruleset2) && !("overrides" in ruleset2)) {
45927
- throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Ruleset must have rules or extends or overrides defined", []);
45947
+ throw new errors_1.RulesetValidationError("invalid-ruleset-definition", "Ruleset must have rules or extends or overrides defined", [], sourceContext === void 0 ? void 0 : { source: sourceContext.source, range: (_a = sourceContext.getLocationForJsonPath([])) === null || _a === void 0 ? void 0 : _a.range });
45928
45948
  }
45929
45949
  const validate = (0, ajv_1.createValidator)(format2);
45930
45950
  if (!validate(ruleset2)) {
45931
- throw new es_aggregate_error_1.default((0, errors_1.convertAjvErrors)((_a = validate.errors) !== null && _a !== void 0 ? _a : []));
45951
+ throw new es_aggregate_error_1.default((0, errors_1.convertAjvErrors)((_b = validate.errors) !== null && _b !== void 0 ? _b : [], sourceContext));
45932
45952
  }
45933
45953
  }
45934
45954
  exports.assertValidRuleset = assertValidRuleset;
@@ -46098,10 +46118,10 @@ var require_ruleset = __commonJS({
46098
46118
  let definition;
46099
46119
  if ((0, json_1.isPlainObject)(maybeDefinition) && "extends" in maybeDefinition) {
46100
46120
  const { extends: _2, ...def } = maybeDefinition;
46101
- (0, index_1.assertValidRuleset)({ extends: [], ...def }, "js");
46121
+ (0, index_1.assertValidRuleset)({ extends: [], ...def }, "js", context === null || context === void 0 ? void 0 : context.sourceContext);
46102
46122
  definition = maybeDefinition;
46103
46123
  } else {
46104
- (0, index_1.assertValidRuleset)(maybeDefinition, "js");
46124
+ (0, index_1.assertValidRuleset)(maybeDefinition, "js", context === null || context === void 0 ? void 0 : context.sourceContext);
46105
46125
  definition = maybeDefinition;
46106
46126
  }
46107
46127
  this.definition = definition;
@@ -49224,13 +49244,7 @@ var commandDefinitions = {
49224
49244
  "effects": {
49225
49245
  "risk_level": "medium",
49226
49246
  "writes": [
49227
- {
49228
- "target": "configured render output paths",
49229
- "description": "rendered template files from DSL input",
49230
- "overwrite": true,
49231
- "idempotent": true,
49232
- "idempotent_note": "Output is deterministic from DSL input and templates. Repeated runs produce identical files."
49233
- }
49247
+ "generated-templates"
49234
49248
  ]
49235
49249
  },
49236
49250
  "options": [
@@ -49357,6 +49371,13 @@ var commandDefinitions = {
49357
49371
  "audit": {
49358
49372
  "effects": {
49359
49373
  "risk_level": "medium",
49374
+ "reads": [
49375
+ "dsl-definitions",
49376
+ "config"
49377
+ ],
49378
+ "writes": [
49379
+ "audit-report"
49380
+ ],
49360
49381
  "network": {
49361
49382
  "description": "LLM API calls to configured adapter (e.g. OpenAI, Gemini, Cursor). Incurs token cost and sends DSL content to the LLM provider.",
49362
49383
  "idempotent": false,
@@ -49460,13 +49481,9 @@ var commandDefinitions = {
49460
49481
  "effects": {
49461
49482
  "risk_level": "low",
49462
49483
  "writes": [
49463
- {
49464
- "target": "configured render, guardrail, and interface output paths",
49465
- "description": "template files, guardrail binding files, and/or team interface files generated from DSL input",
49466
- "overwrite": true,
49467
- "idempotent": true,
49468
- "idempotent_note": "Output is deterministic from DSL input, templates, policies, and bindings. Repeated runs produce identical files."
49469
- }
49484
+ "generated-templates",
49485
+ "generated-guardrails",
49486
+ "generated-interface"
49470
49487
  ]
49471
49488
  },
49472
49489
  "options": [