agent-contracts 0.24.1 → 0.25.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/dist/cli.js +57 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +43 -7
- package/dist/index.js +57 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -49690,6 +49690,7 @@ var PrerequisiteSchema = z.object({
|
|
|
49690
49690
|
var AgentSchema = z.object({
|
|
49691
49691
|
role_name: z.string(),
|
|
49692
49692
|
purpose: z.string(),
|
|
49693
|
+
own_artifacts: z.array(z.string()).default([]),
|
|
49693
49694
|
can_read_artifacts: z.array(z.string()).default([]),
|
|
49694
49695
|
can_write_artifacts: z.array(z.string()).default([]),
|
|
49695
49696
|
can_execute_tools: z.array(z.string()).default([]),
|
|
@@ -49923,6 +49924,8 @@ var ExecutionStepSchema = z9.object({
|
|
|
49923
49924
|
uses_tool: z9.string().optional(),
|
|
49924
49925
|
produces_artifact: z9.string().optional(),
|
|
49925
49926
|
reads_artifact: z9.string().optional(),
|
|
49927
|
+
validates_artifact: z9.string().optional(),
|
|
49928
|
+
validation_kind: z9.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]).optional(),
|
|
49926
49929
|
depends_on: z9.array(z9.string()).optional(),
|
|
49927
49930
|
skip_condition: z9.string().optional(),
|
|
49928
49931
|
wait_for_approval: z9.boolean().optional()
|
|
@@ -49990,6 +49993,8 @@ var ToolSchema = z12.object({
|
|
|
49990
49993
|
input_artifacts: z12.array(z12.string()).default([]),
|
|
49991
49994
|
output_artifacts: z12.array(z12.string()).default([]),
|
|
49992
49995
|
invokable_by: z12.array(z12.string()).default([]),
|
|
49996
|
+
cli_contract: z12.string().optional(),
|
|
49997
|
+
artifact_bindings: z12.record(z12.string(), z12.string()).default({}),
|
|
49993
49998
|
side_effects: z12.array(z12.string()).default([]),
|
|
49994
49999
|
commands: z12.array(CommandSchema).default([]),
|
|
49995
50000
|
guardrails: z12.array(z12.string()).optional()
|
|
@@ -50000,8 +50005,8 @@ import { z as z13 } from "zod";
|
|
|
50000
50005
|
var ValidationSchema = z13.object({
|
|
50001
50006
|
target_artifact: z13.string(),
|
|
50002
50007
|
kind: z13.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
50003
|
-
executor_type: z13.enum(["tool", "agent"]),
|
|
50004
|
-
executor: z13.string(),
|
|
50008
|
+
executor_type: z13.enum(["tool", "agent"]).optional(),
|
|
50009
|
+
executor: z13.string().optional(),
|
|
50005
50010
|
blocking: z13.boolean(),
|
|
50006
50011
|
produces_evidence: z13.string().optional(),
|
|
50007
50012
|
description: z13.string().optional()
|
|
@@ -52103,6 +52108,9 @@ function checkReferences(dsl) {
|
|
|
52103
52108
|
}
|
|
52104
52109
|
}
|
|
52105
52110
|
for (const [id, agent] of Object.entries(dsl.agents)) {
|
|
52111
|
+
for (const ref of agent.own_artifacts) {
|
|
52112
|
+
checkExists(ref, artifactIds, "artifacts", `agents.${id}.own_artifacts`);
|
|
52113
|
+
}
|
|
52106
52114
|
for (const ref of agent.can_read_artifacts) {
|
|
52107
52115
|
checkExists(ref, artifactIds, "artifacts", `agents.${id}.can_read_artifacts`);
|
|
52108
52116
|
}
|
|
@@ -52158,7 +52166,7 @@ function checkReferences(dsl) {
|
|
|
52158
52166
|
}
|
|
52159
52167
|
for (const valId of art.required_validations) {
|
|
52160
52168
|
const validation = dsl.validations[valId];
|
|
52161
|
-
if (validation?.executor_type === "tool") {
|
|
52169
|
+
if (validation?.executor_type === "tool" && validation.executor) {
|
|
52162
52170
|
const tool = dsl.tools[validation.executor];
|
|
52163
52171
|
if (tool && tool.invokable_by.length === 0) {
|
|
52164
52172
|
diagnostics.push({
|
|
@@ -52176,12 +52184,15 @@ function checkReferences(dsl) {
|
|
|
52176
52184
|
checkExists(ref, agentIds, "agents", `tools.${id}.invokable_by`);
|
|
52177
52185
|
}
|
|
52178
52186
|
}
|
|
52187
|
+
for (const ref of Object.values(tool.artifact_bindings)) {
|
|
52188
|
+
checkExists(ref, artifactIds, "artifacts", `tools.${id}.artifact_bindings`);
|
|
52189
|
+
}
|
|
52179
52190
|
}
|
|
52180
52191
|
for (const [id, val] of Object.entries(dsl.validations)) {
|
|
52181
52192
|
checkExists(val.target_artifact, artifactIds, "artifacts", `validations.${id}.target_artifact`);
|
|
52182
|
-
if (val.executor_type === "tool") {
|
|
52193
|
+
if (val.executor_type === "tool" && val.executor) {
|
|
52183
52194
|
checkExists(val.executor, toolIds, "tools", `validations.${id}.executor`);
|
|
52184
|
-
} else if (val.executor_type === "agent") {
|
|
52195
|
+
} else if (val.executor_type === "agent" && val.executor) {
|
|
52185
52196
|
checkExists(val.executor, agentIds, "agents", `validations.${id}.executor`);
|
|
52186
52197
|
}
|
|
52187
52198
|
}
|
|
@@ -52605,7 +52616,7 @@ var toolExecutionRule = {
|
|
|
52605
52616
|
}
|
|
52606
52617
|
}
|
|
52607
52618
|
for (const [valId, val] of Object.entries(dsl.validations)) {
|
|
52608
|
-
if (val.executor_type !== "tool") continue;
|
|
52619
|
+
if (val.executor_type !== "tool" || !val.executor) continue;
|
|
52609
52620
|
const hasExecutor = Object.values(dsl.agents).some(
|
|
52610
52621
|
(a3) => a3.can_execute_tools.includes(val.executor)
|
|
52611
52622
|
);
|
|
@@ -53185,6 +53196,7 @@ var validationExecutorNoContextRule = {
|
|
|
53185
53196
|
run(dsl) {
|
|
53186
53197
|
const diagnostics = [];
|
|
53187
53198
|
for (const [validationId, val] of Object.entries(dsl.validations)) {
|
|
53199
|
+
if (!val.executor) continue;
|
|
53188
53200
|
if (val.executor_type === "agent") {
|
|
53189
53201
|
const agent = dsl.agents[val.executor];
|
|
53190
53202
|
if (!agent) continue;
|
|
@@ -53212,6 +53224,40 @@ var validationExecutorNoContextRule = {
|
|
|
53212
53224
|
}
|
|
53213
53225
|
};
|
|
53214
53226
|
|
|
53227
|
+
// src/linter/rules/artifact-ownership-consistency.ts
|
|
53228
|
+
var artifactOwnershipConsistencyRule = {
|
|
53229
|
+
id: "artifact-ownership-consistency",
|
|
53230
|
+
description: "Ensure own_artifacts entries are included in can_read_artifacts and check deprecated owner field consistency",
|
|
53231
|
+
run(dsl) {
|
|
53232
|
+
const diagnostics = [];
|
|
53233
|
+
for (const [agentId, agent] of Object.entries(dsl.agents)) {
|
|
53234
|
+
for (const artId of agent.own_artifacts) {
|
|
53235
|
+
if (!agent.can_read_artifacts.includes(artId)) {
|
|
53236
|
+
diagnostics.push({
|
|
53237
|
+
ruleId: "artifact-ownership-consistency",
|
|
53238
|
+
severity: "warning",
|
|
53239
|
+
path: `agents.${agentId}.own_artifacts`,
|
|
53240
|
+
message: `Agent "${agentId}" owns artifact "${artId}" but does not include it in can_read_artifacts`
|
|
53241
|
+
});
|
|
53242
|
+
}
|
|
53243
|
+
}
|
|
53244
|
+
}
|
|
53245
|
+
for (const [artId, art] of Object.entries(dsl.artifacts)) {
|
|
53246
|
+
if (!art.owner) continue;
|
|
53247
|
+
const ownerAgent = dsl.agents[art.owner];
|
|
53248
|
+
if (ownerAgent && !ownerAgent.own_artifacts.includes(artId)) {
|
|
53249
|
+
diagnostics.push({
|
|
53250
|
+
ruleId: "artifact-ownership-consistency",
|
|
53251
|
+
severity: "warning",
|
|
53252
|
+
path: `artifacts.${artId}.owner`,
|
|
53253
|
+
message: `Artifact "${artId}" has deprecated owner "${art.owner}" but agent does not list it in own_artifacts`
|
|
53254
|
+
});
|
|
53255
|
+
}
|
|
53256
|
+
}
|
|
53257
|
+
return diagnostics;
|
|
53258
|
+
}
|
|
53259
|
+
};
|
|
53260
|
+
|
|
53215
53261
|
// src/linter/rules/extension-consumption.ts
|
|
53216
53262
|
function isRecord4(v2) {
|
|
53217
53263
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
@@ -53399,6 +53445,7 @@ var builtinRules = [
|
|
|
53399
53445
|
entityNoGuardrailsRule,
|
|
53400
53446
|
guardrailOrphanedRule,
|
|
53401
53447
|
validationExecutorNoContextRule,
|
|
53448
|
+
artifactOwnershipConsistencyRule,
|
|
53402
53449
|
extensionDeclaredButUnusedRule,
|
|
53403
53450
|
extensionScopeMismatchRule,
|
|
53404
53451
|
extensionUndeclaredUsageRule
|
|
@@ -54594,8 +54641,8 @@ function collectReferencedIds(workflow, dsl, relatedTasks) {
|
|
|
54594
54641
|
} else if (step.type === "validation") {
|
|
54595
54642
|
const val = dsl.validations[step.validation];
|
|
54596
54643
|
if (val) {
|
|
54597
|
-
if (val.executor_type === "agent") addAgent(val.executor);
|
|
54598
|
-
else tools.add(val.executor);
|
|
54644
|
+
if (val.executor && val.executor_type === "agent") addAgent(val.executor);
|
|
54645
|
+
else if (val.executor) tools.add(val.executor);
|
|
54599
54646
|
artifacts.add(val.target_artifact);
|
|
54600
54647
|
}
|
|
54601
54648
|
}
|
|
@@ -54971,9 +55018,9 @@ function collectPhaseOps(dsl, wfId) {
|
|
|
54971
55018
|
} else if (step.type === "validation") {
|
|
54972
55019
|
const val = dsl.validations[step.validation];
|
|
54973
55020
|
if (val) {
|
|
54974
|
-
if (val.executor_type === "agent") {
|
|
55021
|
+
if (val.executor_type === "agent" && val.executor) {
|
|
54975
55022
|
addOp(agentOps, val.executor, "validate");
|
|
54976
|
-
} else {
|
|
55023
|
+
} else if (val.executor) {
|
|
54977
55024
|
addOp(toolOps, val.executor, "verification");
|
|
54978
55025
|
}
|
|
54979
55026
|
addOp(artifactOps, val.target_artifact, "V");
|