agent-contracts 0.13.0 → 0.14.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 +71 -1
- package/dist/cli.js +423 -287
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +109 -55
- package/dist/index.js +425 -287
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1166,7 +1166,7 @@ guardrail_policies:
|
|
|
1166
1166
|
|
|
1167
1167
|
### Software bindings
|
|
1168
1168
|
|
|
1169
|
-
Bindings define software-specific check implementations:
|
|
1169
|
+
Bindings define software-specific check implementations, output generation, and rendering:
|
|
1170
1170
|
|
|
1171
1171
|
````yaml
|
|
1172
1172
|
# bindings/cursor.yaml
|
|
@@ -1188,6 +1188,19 @@ outputs:
|
|
|
1188
1188
|
mode: write
|
|
1189
1189
|
executable: true
|
|
1190
1190
|
template: ./templates/cursor-hook-wrapper.sh.hbs
|
|
1191
|
+
|
|
1192
|
+
renders:
|
|
1193
|
+
- context: agent
|
|
1194
|
+
output: "{cursor_root}/agent-team/{agent.id}.md"
|
|
1195
|
+
template: ./templates/agent-prompt.md.hbs
|
|
1196
|
+
exclude:
|
|
1197
|
+
- architect
|
|
1198
|
+
- context: system
|
|
1199
|
+
output: "{cursor_root}/rules/agent-team.mdc"
|
|
1200
|
+
inline_template: |
|
|
1201
|
+
{{#each agents}}
|
|
1202
|
+
- {{@key}}: {{this.role_name}}
|
|
1203
|
+
{{/each}}
|
|
1191
1204
|
````
|
|
1192
1205
|
|
|
1193
1206
|
### Binding inheritance
|
|
@@ -1244,6 +1257,7 @@ Merge behavior:
|
|
|
1244
1257
|
| `software` | Project wins |
|
|
1245
1258
|
| `guardrail_impl` | Map merge by guardrail ID (new IDs added; same ID deep-merged) |
|
|
1246
1259
|
| `outputs` | Map merge by output ID (project overrides base) |
|
|
1260
|
+
| `renders` | Array concatenation (base renders + project renders) |
|
|
1247
1261
|
| `reporting` | Deep merge (project fields override base) |
|
|
1248
1262
|
| passthrough fields | Project wins |
|
|
1249
1263
|
|
|
@@ -1275,6 +1289,62 @@ paths:
|
|
|
1275
1289
|
git_hooks_root: scripts/git-hooks
|
|
1276
1290
|
````
|
|
1277
1291
|
|
|
1292
|
+
### Binding template context
|
|
1293
|
+
|
|
1294
|
+
Both `outputs` and `renders` templates have access to the full binding generation context:
|
|
1295
|
+
|
|
1296
|
+
| Variable | Type | Description |
|
|
1297
|
+
|----------|------|-------------|
|
|
1298
|
+
| `system` | `{ id, name }` | System metadata |
|
|
1299
|
+
| `guardrails` | `Record<string, Guardrail>` | All guardrail definitions |
|
|
1300
|
+
| `policy` | `GuardrailPolicy` | Active guardrail policy |
|
|
1301
|
+
| `binding` | `SoftwareBinding` | Current binding |
|
|
1302
|
+
| `all_bindings` | `Record<string, SoftwareBinding>` | All loaded bindings |
|
|
1303
|
+
| `vars` | `Record<string, string>` | Variables from `config.vars` |
|
|
1304
|
+
| `paths` | `Record<string, string>` | Path variables from `config.paths` |
|
|
1305
|
+
| `reporting` | `{ commands, fail_open, timeout_ms } \| null` | Reporting config |
|
|
1306
|
+
| `resolved_checks` | `ResolvedCheck[]` | Resolved guardrail checks |
|
|
1307
|
+
| `tasks` | `Record<string, Task>` | All DSL tasks |
|
|
1308
|
+
| `artifacts` | `Record<string, Artifact>` | All DSL artifacts |
|
|
1309
|
+
| `agents` | `Record<string, Agent>` | All DSL agents |
|
|
1310
|
+
| `handoff_types` | `Record<string, HandoffType>` | All DSL handoff types |
|
|
1311
|
+
| `workflow` | `Record<string, Workflow>` | All DSL workflows |
|
|
1312
|
+
|
|
1313
|
+
DSL entities include passthrough fields (`x-*` extensions), so custom metadata defined in the DSL is accessible in templates (e.g., `{{agents.implementer.x-team}}`).
|
|
1314
|
+
|
|
1315
|
+
### Binding renders
|
|
1316
|
+
|
|
1317
|
+
Binding `renders` provide entity-iteration rendering with full DSL context — the same capability as config-level `renders`, but defined within binding YAML files.
|
|
1318
|
+
|
|
1319
|
+
Each render target specifies a `context` type and an `output` path pattern:
|
|
1320
|
+
|
|
1321
|
+
| Field | Required | Description |
|
|
1322
|
+
|-------|----------|-------------|
|
|
1323
|
+
| `context` | yes | Entity type: `agent`, `task`, `artifact`, `tool`, `workflow`, `system`, etc. |
|
|
1324
|
+
| `output` | yes | Output path with `{entity.id}` and `{paths_var}` expansion |
|
|
1325
|
+
| `template` | one of | Path to external `.hbs` template file |
|
|
1326
|
+
| `inline_template` | one of | Inline Handlebars template string |
|
|
1327
|
+
| `include` | no | Only render these entity IDs |
|
|
1328
|
+
| `exclude` | no | Skip these entity IDs |
|
|
1329
|
+
| `skip_empty` | no | Delete target if rendered output is empty |
|
|
1330
|
+
| `executable` | no | Set file permissions to 0755 |
|
|
1331
|
+
|
|
1332
|
+
For non-`system` contexts, one file is generated per entity (filtered by `include`/`exclude`). The output path supports two types of variable expansion:
|
|
1333
|
+
|
|
1334
|
+
- `{agent.id}`, `{task.id}`, etc. — replaced with the current entity ID
|
|
1335
|
+
- `{cursor_root}`, `{observability_root}`, etc. — replaced from `config.paths`
|
|
1336
|
+
|
|
1337
|
+
**When to use binding renders vs config renders vs binding outputs:**
|
|
1338
|
+
|
|
1339
|
+
| Use case | Recommended |
|
|
1340
|
+
|----------|-------------|
|
|
1341
|
+
| Generate per-entity files (agent prompts, workflow docs) | Binding `renders` or config `renders` |
|
|
1342
|
+
| Generate guardrail/policy runtime artifacts | Binding `outputs` |
|
|
1343
|
+
| Generate files using DSL data + guardrail data | Binding `renders` (has both) |
|
|
1344
|
+
| Simple config without bindings | Config `renders` |
|
|
1345
|
+
|
|
1346
|
+
Config `renders` remains supported and is not deprecated. Binding `renders` offers the advantage of co-locating templates with their binding definition and having access to the full binding context (`vars`, `paths`, `resolved_checks`, etc.) in addition to DSL entities.
|
|
1347
|
+
|
|
1278
1348
|
### Generate command
|
|
1279
1349
|
|
|
1280
1350
|
````bash
|