agent-contracts 0.12.4 → 0.13.0
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 +49 -11
- package/dist/cli.js +688 -42
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +73 -5
- package/dist/index.js +673 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -332,7 +332,7 @@ Design regressions become testable.
|
|
|
332
332
|
* **Guardrail generation** from DSL + policy + bindings via `generate guardrails`
|
|
333
333
|
* **Flexible file splitting** via `$ref` (replacement), `$refs` (import + deep-merge), and JSON Pointer `$ref` (in-document)
|
|
334
334
|
* **YAML safety linting** for reserved word collision detection across YAML 1.1/1.2
|
|
335
|
-
* **`
|
|
335
|
+
* **`extensions` declarations** with scope, schema validation, and strict enforcement for custom `x-*` fields
|
|
336
336
|
* **`resolve --expand-defaults`** to materialize all Zod schema defaults in output
|
|
337
337
|
* **DSL completeness scoring** with 7 dimensions, text/JSON output, and `--threshold` CI gate
|
|
338
338
|
* **JSON Schema for editor support and external tooling**
|
|
@@ -373,15 +373,20 @@ guardrail_policies: {}
|
|
|
373
373
|
components:
|
|
374
374
|
schemas: {}
|
|
375
375
|
|
|
376
|
-
|
|
377
|
-
x-extensions:
|
|
376
|
+
extensions:
|
|
378
377
|
x-flags:
|
|
379
378
|
type: array
|
|
380
379
|
items: string
|
|
381
380
|
description: "CLI flags for tool commands"
|
|
382
|
-
x-
|
|
381
|
+
x-path-hint:
|
|
383
382
|
type: string
|
|
384
|
-
description: "
|
|
383
|
+
description: "Filesystem path hint"
|
|
384
|
+
scope: [artifact]
|
|
385
|
+
schema:
|
|
386
|
+
type: string
|
|
387
|
+
minLength: 1
|
|
388
|
+
required: true
|
|
389
|
+
extensions_strict: false
|
|
385
390
|
````
|
|
386
391
|
|
|
387
392
|
This makes definitions easy to merge, extend, and reference by stable identifiers.
|
|
@@ -612,22 +617,53 @@ tasks:
|
|
|
612
617
|
`x-` prefixed custom properties work at any nesting level — including inside
|
|
613
618
|
`execution_steps`, `rules`, `workflow.steps`, and other nested objects.
|
|
614
619
|
|
|
615
|
-
###
|
|
620
|
+
### Extension declarations
|
|
616
621
|
|
|
617
|
-
Projects can
|
|
622
|
+
Projects can declare their custom `x-*` extension fields in the DSL using `extensions`. This makes extensions discoverable, self-documenting, and — optionally — machine-validated:
|
|
618
623
|
|
|
619
624
|
````yaml
|
|
620
|
-
|
|
625
|
+
extensions:
|
|
621
626
|
x-flags:
|
|
622
627
|
type: array
|
|
623
628
|
items: string
|
|
624
629
|
description: "CLI flags for tool commands"
|
|
625
|
-
x-
|
|
630
|
+
x-path-hint:
|
|
626
631
|
type: string
|
|
627
|
-
description: "
|
|
632
|
+
description: "Filesystem path hint"
|
|
633
|
+
scope: [artifact]
|
|
634
|
+
schema:
|
|
635
|
+
type: string
|
|
636
|
+
minLength: 1
|
|
637
|
+
required: true
|
|
638
|
+
|
|
639
|
+
extensions_strict: true # undeclared x-* properties become errors
|
|
628
640
|
````
|
|
629
641
|
|
|
630
|
-
Each key must start with `x-` (validated at schema level). The
|
|
642
|
+
Each key must start with `x-` (validated at schema level). The declaration supports:
|
|
643
|
+
|
|
644
|
+
| Field | Type | Default | Description |
|
|
645
|
+
|-------|------|---------|-------------|
|
|
646
|
+
| `type` | `string` | *(required)* | Informational type descriptor |
|
|
647
|
+
| `items` | `string` | — | Item type (for array-typed extensions) |
|
|
648
|
+
| `description` | `string` | — | Human-readable description |
|
|
649
|
+
| `scope` | `string[]` | all node types | Restricts which DSL node types this extension may appear on |
|
|
650
|
+
| `schema` | `object` | — | JSON Schema to validate the extension value |
|
|
651
|
+
| `required` | `boolean` | `false` | Whether the extension must be present on every in-scope entity |
|
|
652
|
+
|
|
653
|
+
**Scope values**: `root`, `system`, `agent`, `task`, `execution_step`, `artifact`, `tool`, `tool_command`, `validation`, `handoff_type`, `workflow`, `workflow_step`, `policy`, `guardrail`, `guardrail_policy`, `rule`, `escalation_criterion`, `prerequisite`
|
|
654
|
+
|
|
655
|
+
**`extensions_strict`**: When `true`, any `x-*` property not declared in `extensions` is an error. When `false` (default), undeclared extensions produce a warning.
|
|
656
|
+
|
|
657
|
+
**Diagnostics**:
|
|
658
|
+
|
|
659
|
+
| Code | Severity | Trigger |
|
|
660
|
+
|------|----------|---------|
|
|
661
|
+
| `extension-scope-mismatch` | error | Extension used on a node type outside its declared `scope` |
|
|
662
|
+
| `extension-schema-violation` | error | Extension value fails the declared JSON Schema |
|
|
663
|
+
| `extension-required-missing` | error | Required extension missing on an in-scope entity |
|
|
664
|
+
| `undeclared-extension` | warning/error | Extension not declared in `extensions` (error when `extensions_strict: true`) |
|
|
665
|
+
|
|
666
|
+
> **Backward compatibility:** `x-extensions` and `x-extensions-strict` are still accepted as deprecated aliases. They produce a `deprecated-property` warning and are normalized to `extensions` / `extensions_strict` during validation.
|
|
631
667
|
|
|
632
668
|
---
|
|
633
669
|
|
|
@@ -1263,6 +1299,8 @@ Checks:
|
|
|
1263
1299
|
* handoff schema shape (meta-validated as valid JSON Schema via ajv)
|
|
1264
1300
|
* `allOf` composition in handoff schemas
|
|
1265
1301
|
* invalid custom properties without `x-` prefix (checked at all nesting levels)
|
|
1302
|
+
* `extensions` declaration validation — scope, schema, required, and undeclared checks
|
|
1303
|
+
* `extensions_strict` enforcement — reject undeclared `x-*` properties when enabled
|
|
1266
1304
|
|
|
1267
1305
|
Custom properties with `x-` prefix are allowed on any object in the DSL — top-level entities (agents, tasks, artifacts, …), nested objects (rules, execution steps, workflow steps, …), and the root DSL itself.
|
|
1268
1306
|
|