agent-contracts 0.19.4 → 0.20.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.
@@ -0,0 +1,182 @@
1
+ dsl-task-request:
2
+ version: 1
3
+ description: Request to execute a DSL management task
4
+ schema:
5
+ type: object
6
+ properties:
7
+ task_id:
8
+ type: string
9
+ description: Identifier of the task to execute
10
+ scope:
11
+ type: string
12
+ description: Scope of changes (agents, tasks, artifacts, workflow, bindings, etc.)
13
+ context:
14
+ type: string
15
+ description: Background and purpose of the change
16
+ required:
17
+ - task_id
18
+
19
+ dsl-task-result:
20
+ version: 3
21
+ description: Result of a DSL management task execution
22
+ schema:
23
+ type: object
24
+ properties:
25
+ changed_files:
26
+ type: array
27
+ items:
28
+ type: string
29
+ description: List of changed file paths
30
+ validation_result:
31
+ type: string
32
+ enum:
33
+ - pass
34
+ - fail
35
+ description: Result of agent-contracts validate
36
+ lint_result:
37
+ type: string
38
+ enum:
39
+ - pass
40
+ - fail
41
+ - skipped
42
+ description: Result of agent-contracts lint (separate from validate)
43
+ generate_result:
44
+ type: string
45
+ enum:
46
+ - pass
47
+ - fail
48
+ - skipped
49
+ description: >-
50
+ Result of agent-contracts generate guardrails (binding task).
51
+ Used by post-binding gate to block render on failure.
52
+ render_result:
53
+ type: string
54
+ enum:
55
+ - pass
56
+ - fail
57
+ - skipped
58
+ description: >-
59
+ Result of agent-contracts render execution.
60
+ Distinct from drift_detected — captures whether render itself succeeded.
61
+ drift_detected:
62
+ type: boolean
63
+ description: >-
64
+ True if render --check detected drift between DSL source
65
+ and generated outputs
66
+ cross_reference_check:
67
+ type: string
68
+ enum:
69
+ - pass
70
+ - fail
71
+ - skipped
72
+ description: >-
73
+ Result of cross-reference integrity verification for newly
74
+ added entities (update-dsl-definitions completion criterion).
75
+ score:
76
+ type: number
77
+ description: Score command result (0-100)
78
+ score_dimensions:
79
+ type: object
80
+ description: Per-dimension score breakdown
81
+ notes:
82
+ type: string
83
+ description: Additional notes or improvement suggestions
84
+ required:
85
+ - validation_result
86
+
87
+ audit-result:
88
+ version: 1
89
+ description: >-
90
+ Generic audit result for tool/agent execution.
91
+ Uses canonical agent-audit-result schema from components.schemas.
92
+ schema:
93
+ $ref: "#/components/schemas/agent-audit-result"
94
+
95
+ dsl-audit-result:
96
+ version: 3
97
+ description: Result of DSL audit (completeness, semantic design, or prompt fidelity)
98
+ schema:
99
+ type: object
100
+ properties:
101
+ audit_type:
102
+ type: string
103
+ enum:
104
+ - completeness
105
+ - semantic
106
+ - prompt
107
+ description: Which audit task produced this result
108
+ total_dimensions:
109
+ type: integer
110
+ description: Number of dimensions inspected
111
+ pass_count:
112
+ type: integer
113
+ description: Number of PASS dimensions
114
+ miss_count:
115
+ type: integer
116
+ description: Number of MISS dimensions
117
+ partial_count:
118
+ type: integer
119
+ description: Number of PARTIAL dimensions
120
+ agents_reviewed:
121
+ type: integer
122
+ description: Number of agents reviewed (semantic and prompt audits)
123
+ prompts_reviewed:
124
+ type: integer
125
+ description: Number of generated prompts compared (prompt audit)
126
+ gate_analysis_complete:
127
+ type: boolean
128
+ description: >-
129
+ True when workflow gate placement analysis has been performed
130
+ (semantic audit completion criterion).
131
+ guardrail_enforcement_verified:
132
+ type: boolean
133
+ description: >-
134
+ True when all declared guardrails have been verified to exist
135
+ in execution paths (semantic audit completion criterion).
136
+ critical_gaps:
137
+ type: array
138
+ items:
139
+ type: object
140
+ properties:
141
+ dimension:
142
+ type: string
143
+ agent:
144
+ type: string
145
+ gap_type:
146
+ type: string
147
+ enum:
148
+ - template_gap
149
+ - data_gap
150
+ - dsl_gap
151
+ severity:
152
+ type: string
153
+ enum:
154
+ - critical
155
+ - warning
156
+ - info
157
+ description: List of detected gaps
158
+ recommendations:
159
+ type: array
160
+ items:
161
+ type: object
162
+ properties:
163
+ priority:
164
+ type: string
165
+ enum:
166
+ - P0
167
+ - P1
168
+ - P2
169
+ description:
170
+ type: string
171
+ fix_type:
172
+ type: string
173
+ enum:
174
+ - template_fix
175
+ - dsl_fix
176
+ - regeneration
177
+ description: Prioritized improvement recommendation list
178
+ required:
179
+ - audit_type
180
+ - total_dimensions
181
+ - pass_count
182
+ - miss_count
@@ -0,0 +1,269 @@
1
+ # === DSL Update Tasks ===
2
+
3
+ update-dsl-definitions:
4
+ description: Create new or update existing agent-contracts DSL definitions
5
+ target_agent: dsl-designer
6
+ allowed_from_agents:
7
+ - dsl-designer
8
+ workflow: dsl-update
9
+ input_artifacts:
10
+ - dsl-source
11
+ invocation_handoff: dsl-task-request
12
+ result_handoff: dsl-task-result
13
+ validations:
14
+ - dsl-schema-validation
15
+ - dsl-lint-validation
16
+ responsibilities:
17
+ - Create and update DSL YAML files
18
+ - Define agents, tasks, artifacts, tools, validations, handoff_types, workflow, guardrails
19
+ - Configure system section
20
+ completion_criteria:
21
+ - agent-contracts validate succeeds
22
+ - agent-contracts lint reports no errors
23
+ - Cross-references for newly added entities are correct
24
+ execution_steps:
25
+ - id: read-current-dsl
26
+ action: Read current DSL definitions and understand the structure
27
+ reads_artifact: dsl-source
28
+ required: true
29
+ - id: update-dsl
30
+ action: Create or update DSL definitions
31
+ produces_artifact: dsl-source
32
+ - id: validate
33
+ action: Run agent-contracts validate
34
+ uses_tool: agent-contracts-cli
35
+ required: true
36
+ - id: lint
37
+ action: Run agent-contracts lint
38
+ uses_tool: agent-contracts-cli
39
+ escalation_criteria:
40
+ - condition: Schema errors from validate cannot be resolved
41
+ action: stop_and_report
42
+
43
+ update-dsl-binding:
44
+ description: Create new or update existing software bindings
45
+ target_agent: dsl-designer
46
+ allowed_from_agents:
47
+ - dsl-designer
48
+ workflow: dsl-update
49
+ input_artifacts:
50
+ - dsl-source
51
+ invocation_handoff: dsl-task-request
52
+ result_handoff: dsl-task-result
53
+ validations:
54
+ - dsl-schema-validation
55
+ responsibilities:
56
+ - Add and update guardrail_impl check definitions
57
+ - Configure outputs section templates and inline templates
58
+ - Set up binding extends inheritance
59
+ completion_criteria:
60
+ - Binding YAML conforms to the correct schema
61
+ - guardrail_impl hook_event / matcher values are valid
62
+ - agent-contracts generate guardrails succeeds
63
+ execution_steps:
64
+ - id: read-guardrails
65
+ action: Review target guardrail definitions and policies
66
+ reads_artifact: dsl-source
67
+ required: true
68
+ - id: update-binding
69
+ action: Create or update binding YAML
70
+ produces_artifact: dsl-source
71
+ - id: generate
72
+ action: Run agent-contracts generate guardrails to verify
73
+ uses_tool: agent-contracts-cli
74
+ required: true
75
+ escalation_criteria:
76
+ - condition: Binding guardrail_impl is inconsistent with DSL guardrails
77
+ action: stop_and_report
78
+
79
+ render-dsl-outputs:
80
+ description: Render prompts and documents from DSL and check for drift
81
+ target_agent: dsl-designer
82
+ allowed_from_agents:
83
+ - dsl-designer
84
+ workflow: dsl-update
85
+ input_artifacts:
86
+ - dsl-source
87
+ invocation_handoff: dsl-task-request
88
+ result_handoff: dsl-task-result
89
+ validations:
90
+ - dsl-schema-validation
91
+ responsibilities:
92
+ - Generate prompts and documents via agent-contracts render
93
+ - Detect and resolve drift using render --check
94
+ completion_criteria:
95
+ - render succeeds
96
+ - render --check reports no drift
97
+ execution_steps:
98
+ - id: render
99
+ action: Run agent-contracts render
100
+ uses_tool: agent-contracts-cli
101
+ produces_artifact: dsl-generated-output
102
+ required: true
103
+ - id: check-drift
104
+ action: Run agent-contracts render --check to verify no drift
105
+ uses_tool: agent-contracts-cli
106
+ escalation_criteria:
107
+ - condition: Unresolved template errors during render
108
+ action: stop_and_report
109
+
110
+ check-dsl-score:
111
+ description: Check DSL completeness score and identify improvement areas
112
+ target_agent: dsl-designer
113
+ allowed_from_agents:
114
+ - dsl-designer
115
+ workflow: dsl-update
116
+ input_artifacts:
117
+ - dsl-source
118
+ invocation_handoff: dsl-task-request
119
+ result_handoff: dsl-task-result
120
+ validations:
121
+ - dsl-score-validation
122
+ - dsl-score-report-validation
123
+ responsibilities:
124
+ - Review score across 7 dimensions and identify weaknesses
125
+ - List entities that need improvement
126
+ completion_criteria:
127
+ - Score results have been reviewed
128
+ - Improvement areas have been identified
129
+ execution_steps:
130
+ - id: run-score
131
+ action: Run agent-contracts score
132
+ uses_tool: agent-contracts-cli
133
+ required: true
134
+ - id: analyze
135
+ action: Analyze score weaknesses and formulate improvement plan
136
+ produces_artifact: dsl-score-report
137
+ escalation_criteria:
138
+ - condition: Score is significantly below threshold with no clear improvement path
139
+ action: stop_and_report
140
+
141
+ # === DSL Audit Tasks ===
142
+
143
+ audit-dsl-completeness:
144
+ description: Audit completeness of DSL definitions against generated prompts
145
+ target_agent: dsl-auditor
146
+ allowed_from_agents:
147
+ - dsl-auditor
148
+ workflow: dsl-audit
149
+ input_artifacts:
150
+ - dsl-source
151
+ - dsl-generated-output
152
+ invocation_handoff: dsl-task-request
153
+ result_handoff: dsl-audit-result
154
+ validations:
155
+ - dsl-completeness-audit
156
+ - dsl-audit-report-validation
157
+ responsibilities:
158
+ - Cross-check across 19 dimensions per audit procedure
159
+ - Classify gaps as template gap, data gap, or DSL gap
160
+ - Present improvement recommendations
161
+ completion_criteria:
162
+ - All dimensions inspected for all agents
163
+ - Detected gaps are classified
164
+ - Improvement recommendations are presented with priority
165
+ execution_steps:
166
+ - id: collect-sources
167
+ action: Collect DSL definitions, generated prompts, and templates
168
+ reads_artifact: dsl-source
169
+ required: true
170
+ - id: collect-outputs
171
+ action: Collect generated prompts
172
+ reads_artifact: dsl-generated-output
173
+ required: true
174
+ - id: run-audit
175
+ action: Execute 19-dimension cross-check
176
+ - id: analyze-gaps
177
+ action: Analyze root causes of detected gaps
178
+ - id: produce-report
179
+ action: Produce audit report and improvement recommendations
180
+ produces_artifact: dsl-audit-report
181
+ escalation_criteria:
182
+ - condition: 3 or more critical-level gaps detected
183
+ action: stop_and_report
184
+
185
+ audit-semantic-design:
186
+ description: Audit DSL design for semantic coherence
187
+ target_agent: dsl-auditor
188
+ allowed_from_agents:
189
+ - dsl-auditor
190
+ workflow: dsl-audit
191
+ input_artifacts:
192
+ - dsl-source
193
+ invocation_handoff: dsl-task-request
194
+ result_handoff: dsl-audit-result
195
+ validations:
196
+ - dsl-completeness-audit
197
+ - dsl-audit-report-validation
198
+ responsibilities:
199
+ - Check dispatch_only agents for implementation responsibilities
200
+ - Detect agents with overly broad scope
201
+ - Identify role overlap between agents
202
+ - Verify handoff schemas carry sufficient fields for task completion_criteria
203
+ - Check workflow gates are placed effectively
204
+ - Detect guardrails declared but absent from execution path
205
+ - Check semantic validations are distributed across phases
206
+ completion_criteria:
207
+ - All agents reviewed for scope and overlap
208
+ - Workflow gate placement analyzed
209
+ - Guardrail enforcement path verified
210
+ - Findings classified with severity and category
211
+ execution_steps:
212
+ - id: load-dsl
213
+ action: Load resolved DSL definitions
214
+ reads_artifact: dsl-source
215
+ required: true
216
+ - id: analyze-agents
217
+ action: Review agent responsibilities, permissions, and role boundaries
218
+ - id: analyze-workflows
219
+ action: Analyze workflow structure, gate placement, and validation coverage
220
+ - id: analyze-guardrails
221
+ action: Verify guardrail enforcement paths
222
+ - id: produce-report
223
+ action: Produce semantic design audit report
224
+ produces_artifact: dsl-audit-report
225
+ escalation_criteria:
226
+ - condition: 3 or more critical-level design issues detected
227
+ action: stop_and_report
228
+
229
+ audit-generated-prompts:
230
+ description: Audit generated prompts against DSL intent
231
+ target_agent: dsl-auditor
232
+ allowed_from_agents:
233
+ - dsl-auditor
234
+ workflow: dsl-audit
235
+ input_artifacts:
236
+ - dsl-source
237
+ - dsl-generated-output
238
+ invocation_handoff: dsl-task-request
239
+ result_handoff: dsl-audit-result
240
+ validations:
241
+ - dsl-completeness-audit
242
+ - dsl-audit-report-validation
243
+ responsibilities:
244
+ - Compare generated prompt content against DSL agent definitions
245
+ - Detect missing requirements from DSL
246
+ - Detect hallucinated permissions not in DSL
247
+ - Identify ambiguous or unsafe instructions
248
+ - Verify consistency between prompt and handoff schema expectations
249
+ completion_criteria:
250
+ - All generated prompts compared against DSL definitions
251
+ - Missing, hallucinated, and ambiguous instructions identified
252
+ - Findings classified with severity and category
253
+ execution_steps:
254
+ - id: collect-sources
255
+ action: Collect DSL agent definitions and related entities
256
+ reads_artifact: dsl-source
257
+ required: true
258
+ - id: collect-prompts
259
+ action: Collect generated prompt files
260
+ reads_artifact: dsl-generated-output
261
+ required: true
262
+ - id: compare
263
+ action: Compare each prompt against its DSL definition
264
+ - id: produce-report
265
+ action: Produce prompt audit report
266
+ produces_artifact: dsl-audit-report
267
+ escalation_criteria:
268
+ - condition: Hallucinated permissions detected in generated prompts
269
+ action: stop_and_report
@@ -0,0 +1,50 @@
1
+ agent-contracts-cli:
2
+ kind: cli
3
+ description: >-
4
+ agent-contracts CLI — execute resolve, validate, lint, render, score,
5
+ check, and generate commands for the DSL.
6
+ input_artifacts:
7
+ - dsl-source
8
+ output_artifacts:
9
+ - dsl-generated-output
10
+ - dsl-score-report
11
+ invokable_by:
12
+ - dsl-designer
13
+ - dsl-auditor
14
+ side_effects: []
15
+ commands:
16
+ - command: "npx agent-contracts validate"
17
+ category: verification
18
+ reads: [dsl-source]
19
+ writes: []
20
+ purpose: DSL schema validation and reference checks
21
+ - command: "npx agent-contracts lint"
22
+ category: verification
23
+ reads: [dsl-source]
24
+ writes: []
25
+ purpose: Semantic lint
26
+ - command: "npx agent-contracts render -c agent-contracts.config.yaml"
27
+ category: generation
28
+ reads: [dsl-source]
29
+ writes: [dsl-generated-output]
30
+ purpose: Template rendering (prompt and document generation)
31
+ - command: "npx agent-contracts render -c agent-contracts.config.yaml --check"
32
+ category: verification
33
+ reads: [dsl-source, dsl-generated-output]
34
+ writes: []
35
+ purpose: Drift detection (source vs generated output)
36
+ - command: "npx agent-contracts score"
37
+ category: verification
38
+ reads: [dsl-source]
39
+ writes: [dsl-score-report]
40
+ purpose: DSL completeness score calculation (7 dimensions)
41
+ - command: "npx agent-contracts check -c agent-contracts.config.yaml"
42
+ category: verification
43
+ reads: [dsl-source]
44
+ writes: []
45
+ purpose: Pipeline — resolve → validate → lint → render --check
46
+ - command: "npx agent-contracts generate guardrails"
47
+ category: generation
48
+ reads: [dsl-source]
49
+ writes: [dsl-generated-output]
50
+ purpose: Generate guardrail runtime artifacts
@@ -0,0 +1,66 @@
1
+ dsl-schema-validation:
2
+ target_artifact: dsl-source
3
+ kind: schema
4
+ executor_type: tool
5
+ executor: agent-contracts-cli
6
+ blocking: true
7
+ x-description: >-
8
+ DSL schema validation via agent-contracts validate command.
9
+ Performs type checks on all entities, verifies required fields,
10
+ and checks cross-reference integrity.
11
+
12
+ dsl-lint-validation:
13
+ target_artifact: dsl-source
14
+ kind: semantic
15
+ executor_type: tool
16
+ executor: agent-contracts-cli
17
+ blocking: false
18
+ x-description: >-
19
+ Semantic validation via agent-contracts lint command.
20
+ Checks naming conventions, unused entities, circular references,
21
+ and other design quality aspects.
22
+
23
+ dsl-score-validation:
24
+ target_artifact: dsl-source
25
+ kind: semantic
26
+ executor_type: tool
27
+ executor: agent-contracts-cli
28
+ blocking: false
29
+ x-description: >-
30
+ Completeness evaluation via agent-contracts score command.
31
+ Scores across 7 dimensions: artifact validation coverage,
32
+ task validation coverage, guardrail policy coverage,
33
+ workflow validation integration, schema completeness,
34
+ cross-reference bidirectionality, guardrail scope resolution.
35
+
36
+ dsl-completeness-audit:
37
+ target_artifact: dsl-generated-output
38
+ kind: semantic
39
+ executor_type: agent
40
+ executor: dsl-auditor
41
+ blocking: false
42
+ produces_evidence: dsl-audit-report
43
+ x-description: >-
44
+ 19-dimension cross-check audit of DSL definitions against generated
45
+ prompts. Verifies that all items defined in the DSL are correctly
46
+ reflected in generated output.
47
+
48
+ dsl-score-report-validation:
49
+ target_artifact: dsl-score-report
50
+ kind: semantic
51
+ executor_type: tool
52
+ executor: agent-contracts-cli
53
+ blocking: false
54
+ x-description: >-
55
+ Validates that dsl-score-report has been produced and contains
56
+ a valid score across all 7 dimensions.
57
+
58
+ dsl-audit-report-validation:
59
+ target_artifact: dsl-audit-report
60
+ kind: semantic
61
+ executor_type: agent
62
+ executor: dsl-auditor
63
+ blocking: false
64
+ x-description: >-
65
+ Validates that dsl-audit-report contains findings classified
66
+ as PASS/MISS/PARTIAL for all inspected dimensions.
@@ -0,0 +1,91 @@
1
+ dsl-update:
2
+ description: >-
3
+ DSL Update — create and update agent-contracts DSL definitions and
4
+ bindings, verify quality via validate / lint / render / score.
5
+ Executed by DSL Designer.
6
+ entry_conditions:
7
+ - A DSL definition change request exists
8
+ trigger: >-
9
+ Execute when new DSL definitions need to be created, existing definitions
10
+ need updating, or bindings need to be added or modified.
11
+ steps:
12
+ - type: delegate
13
+ task: update-dsl-definitions
14
+ from_agent: dsl-designer
15
+ description: >-
16
+ DSL Designer creates or updates DSL definitions and verifies
17
+ via validate / lint.
18
+ - type: gate
19
+ gate_kind: dsl-task-result
20
+ description: >-
21
+ Block if validation_result or lint_result did not pass in
22
+ update-dsl-definitions.
23
+ - type: delegate
24
+ task: update-dsl-binding
25
+ from_agent: dsl-designer
26
+ description: >-
27
+ DSL Designer adds or updates bindings and verifies via generate.
28
+ - type: gate
29
+ gate_kind: dsl-task-result
30
+ description: >-
31
+ Block if generate_result is not 'pass' in update-dsl-binding.
32
+ Prevents render-dsl-outputs from executing against invalid bindings.
33
+ - type: delegate
34
+ task: render-dsl-outputs
35
+ from_agent: dsl-designer
36
+ description: >-
37
+ DSL Designer renders prompts and documents and checks for drift.
38
+ - type: gate
39
+ gate_kind: dsl-task-result
40
+ description: >-
41
+ Block if render_result is not 'pass' or drift_detected is true
42
+ in render-dsl-outputs result.
43
+ - type: delegate
44
+ task: check-dsl-score
45
+ from_agent: dsl-designer
46
+ description: >-
47
+ DSL Designer checks completeness score and identifies improvement areas.
48
+
49
+ dsl-audit:
50
+ description: >-
51
+ DSL Audit — audit completeness of DSL definitions against generated
52
+ prompts, detect gaps, and present improvement recommendations.
53
+ Executed by DSL Auditor. Supports three audit types: render (semantic
54
+ diff), dsl (design coherence), and prompt (prompt fidelity).
55
+ entry_conditions:
56
+ - DSL definition rendering is complete
57
+ trigger: >-
58
+ Execute when DSL completeness audit is needed. Typically run as a
59
+ quality check after DSL updates.
60
+ steps:
61
+ - type: delegate
62
+ task: audit-dsl-completeness
63
+ from_agent: dsl-auditor
64
+ description: >-
65
+ DSL Auditor executes 19-dimension cross-check and produces
66
+ audit report with improvement recommendations.
67
+ - type: gate
68
+ gate_kind: dsl-audit-result
69
+ description: >-
70
+ Block if audit-dsl-completeness detected 3 or more
71
+ critical-level gaps (triggers stop_and_report escalation).
72
+ - type: delegate
73
+ task: audit-semantic-design
74
+ from_agent: dsl-auditor
75
+ description: >-
76
+ DSL Auditor reviews DSL design for semantic coherence —
77
+ role overlap, scope breadth, gate placement, guardrail
78
+ enforcement paths.
79
+ - type: delegate
80
+ task: audit-generated-prompts
81
+ from_agent: dsl-auditor
82
+ description: >-
83
+ DSL Auditor compares generated prompts against DSL intent —
84
+ detects missing requirements, hallucinated permissions,
85
+ ambiguous instructions.
86
+ - type: gate
87
+ gate_kind: dsl-audit-result
88
+ description: >-
89
+ Terminal gate — block if audit-generated-prompts detected
90
+ hallucinated permissions (enforces dsl-no-hallucinated-permissions
91
+ guardrail at workflow level via stop_and_report escalation).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-contracts",
3
- "version": "0.19.4",
3
+ "version": "0.20.0",
4
4
  "description": "Declarative YAML DSL toolkit for defining, validating, and rendering multi-agent development workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "dsl_base",
19
20
  "cli-contract.yaml",
20
21
  "docs/cli-reference.md",
21
22
  "README.md",
@@ -76,7 +77,7 @@
76
77
  "@openai/agents": "^0.11.1",
77
78
  "@types/node": "^25.6.0",
78
79
  "agent-contracts-runtime": "^0.12.0",
79
- "cli-contracts": "^0.5.1",
80
+ "cli-contracts": "^0.5.2",
80
81
  "eslint": "^10.2.0",
81
82
  "globals": "^17.5.0",
82
83
  "prettier": "^3.8.2",