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/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ type Prerequisite = z.infer<typeof PrerequisiteSchema>;
|
|
|
46
46
|
declare const AgentSchema: z.ZodObject<{
|
|
47
47
|
role_name: z.ZodString;
|
|
48
48
|
purpose: z.ZodString;
|
|
49
|
+
own_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
50
|
can_read_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
50
51
|
can_write_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
51
52
|
can_execute_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -401,6 +402,7 @@ declare const DslSchema: z.ZodObject<{
|
|
|
401
402
|
agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
402
403
|
role_name: z.ZodString;
|
|
403
404
|
purpose: z.ZodString;
|
|
405
|
+
own_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
404
406
|
can_read_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
405
407
|
can_write_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
406
408
|
can_execute_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -476,6 +478,16 @@ declare const DslSchema: z.ZodObject<{
|
|
|
476
478
|
uses_tool: z.ZodOptional<z.ZodString>;
|
|
477
479
|
produces_artifact: z.ZodOptional<z.ZodString>;
|
|
478
480
|
reads_artifact: z.ZodOptional<z.ZodString>;
|
|
481
|
+
validates_artifact: z.ZodOptional<z.ZodString>;
|
|
482
|
+
validation_kind: z.ZodOptional<z.ZodEnum<{
|
|
483
|
+
schema: "schema";
|
|
484
|
+
mechanical: "mechanical";
|
|
485
|
+
semantic: "semantic";
|
|
486
|
+
approval: "approval";
|
|
487
|
+
provenance: "provenance";
|
|
488
|
+
traceability: "traceability";
|
|
489
|
+
fidelity: "fidelity";
|
|
490
|
+
}>>;
|
|
479
491
|
depends_on: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
480
492
|
skip_condition: z.ZodOptional<z.ZodString>;
|
|
481
493
|
wait_for_approval: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -553,6 +565,8 @@ declare const DslSchema: z.ZodObject<{
|
|
|
553
565
|
input_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
554
566
|
output_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
555
567
|
invokable_by: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
568
|
+
cli_contract: z.ZodOptional<z.ZodString>;
|
|
569
|
+
artifact_bindings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
556
570
|
side_effects: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
557
571
|
commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
558
572
|
command: z.ZodString;
|
|
@@ -574,11 +588,11 @@ declare const DslSchema: z.ZodObject<{
|
|
|
574
588
|
traceability: "traceability";
|
|
575
589
|
fidelity: "fidelity";
|
|
576
590
|
}>;
|
|
577
|
-
executor_type: z.ZodEnum<{
|
|
591
|
+
executor_type: z.ZodOptional<z.ZodEnum<{
|
|
578
592
|
agent: "agent";
|
|
579
593
|
tool: "tool";
|
|
580
|
-
}
|
|
581
|
-
executor: z.ZodString
|
|
594
|
+
}>>;
|
|
595
|
+
executor: z.ZodOptional<z.ZodString>;
|
|
582
596
|
blocking: z.ZodBoolean;
|
|
583
597
|
produces_evidence: z.ZodOptional<z.ZodString>;
|
|
584
598
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -991,6 +1005,16 @@ declare const ExecutionStepSchema: z.ZodObject<{
|
|
|
991
1005
|
uses_tool: z.ZodOptional<z.ZodString>;
|
|
992
1006
|
produces_artifact: z.ZodOptional<z.ZodString>;
|
|
993
1007
|
reads_artifact: z.ZodOptional<z.ZodString>;
|
|
1008
|
+
validates_artifact: z.ZodOptional<z.ZodString>;
|
|
1009
|
+
validation_kind: z.ZodOptional<z.ZodEnum<{
|
|
1010
|
+
schema: "schema";
|
|
1011
|
+
mechanical: "mechanical";
|
|
1012
|
+
semantic: "semantic";
|
|
1013
|
+
approval: "approval";
|
|
1014
|
+
provenance: "provenance";
|
|
1015
|
+
traceability: "traceability";
|
|
1016
|
+
fidelity: "fidelity";
|
|
1017
|
+
}>>;
|
|
994
1018
|
depends_on: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
995
1019
|
skip_condition: z.ZodOptional<z.ZodString>;
|
|
996
1020
|
wait_for_approval: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1016,6 +1040,16 @@ declare const TaskSchema: z.ZodObject<{
|
|
|
1016
1040
|
uses_tool: z.ZodOptional<z.ZodString>;
|
|
1017
1041
|
produces_artifact: z.ZodOptional<z.ZodString>;
|
|
1018
1042
|
reads_artifact: z.ZodOptional<z.ZodString>;
|
|
1043
|
+
validates_artifact: z.ZodOptional<z.ZodString>;
|
|
1044
|
+
validation_kind: z.ZodOptional<z.ZodEnum<{
|
|
1045
|
+
schema: "schema";
|
|
1046
|
+
mechanical: "mechanical";
|
|
1047
|
+
semantic: "semantic";
|
|
1048
|
+
approval: "approval";
|
|
1049
|
+
provenance: "provenance";
|
|
1050
|
+
traceability: "traceability";
|
|
1051
|
+
fidelity: "fidelity";
|
|
1052
|
+
}>>;
|
|
1019
1053
|
depends_on: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1020
1054
|
skip_condition: z.ZodOptional<z.ZodString>;
|
|
1021
1055
|
wait_for_approval: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1072,6 +1106,8 @@ declare const ToolSchema: z.ZodObject<{
|
|
|
1072
1106
|
input_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1073
1107
|
output_artifacts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1074
1108
|
invokable_by: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1109
|
+
cli_contract: z.ZodOptional<z.ZodString>;
|
|
1110
|
+
artifact_bindings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1075
1111
|
side_effects: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1076
1112
|
commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1077
1113
|
command: z.ZodString;
|
|
@@ -1095,11 +1131,11 @@ declare const ValidationSchema: z.ZodObject<{
|
|
|
1095
1131
|
traceability: "traceability";
|
|
1096
1132
|
fidelity: "fidelity";
|
|
1097
1133
|
}>;
|
|
1098
|
-
executor_type: z.ZodEnum<{
|
|
1134
|
+
executor_type: z.ZodOptional<z.ZodEnum<{
|
|
1099
1135
|
agent: "agent";
|
|
1100
1136
|
tool: "tool";
|
|
1101
|
-
}
|
|
1102
|
-
executor: z.ZodString
|
|
1137
|
+
}>>;
|
|
1138
|
+
executor: z.ZodOptional<z.ZodString>;
|
|
1103
1139
|
blocking: z.ZodBoolean;
|
|
1104
1140
|
produces_evidence: z.ZodOptional<z.ZodString>;
|
|
1105
1141
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -1519,7 +1555,7 @@ interface EntityValidationEntry {
|
|
|
1519
1555
|
validation_id: string;
|
|
1520
1556
|
kind: string;
|
|
1521
1557
|
target_artifact: string;
|
|
1522
|
-
executor_type
|
|
1558
|
+
executor_type?: string;
|
|
1523
1559
|
blocking: boolean;
|
|
1524
1560
|
produces_evidence?: string;
|
|
1525
1561
|
}
|
package/dist/index.js
CHANGED
|
@@ -48919,6 +48919,7 @@ var PrerequisiteSchema = z.object({
|
|
|
48919
48919
|
var AgentSchema = z.object({
|
|
48920
48920
|
role_name: z.string(),
|
|
48921
48921
|
purpose: z.string(),
|
|
48922
|
+
own_artifacts: z.array(z.string()).default([]),
|
|
48922
48923
|
can_read_artifacts: z.array(z.string()).default([]),
|
|
48923
48924
|
can_write_artifacts: z.array(z.string()).default([]),
|
|
48924
48925
|
can_execute_tools: z.array(z.string()).default([]),
|
|
@@ -49152,6 +49153,8 @@ var ExecutionStepSchema = z9.object({
|
|
|
49152
49153
|
uses_tool: z9.string().optional(),
|
|
49153
49154
|
produces_artifact: z9.string().optional(),
|
|
49154
49155
|
reads_artifact: z9.string().optional(),
|
|
49156
|
+
validates_artifact: z9.string().optional(),
|
|
49157
|
+
validation_kind: z9.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]).optional(),
|
|
49155
49158
|
depends_on: z9.array(z9.string()).optional(),
|
|
49156
49159
|
skip_condition: z9.string().optional(),
|
|
49157
49160
|
wait_for_approval: z9.boolean().optional()
|
|
@@ -49219,6 +49222,8 @@ var ToolSchema = z12.object({
|
|
|
49219
49222
|
input_artifacts: z12.array(z12.string()).default([]),
|
|
49220
49223
|
output_artifacts: z12.array(z12.string()).default([]),
|
|
49221
49224
|
invokable_by: z12.array(z12.string()).default([]),
|
|
49225
|
+
cli_contract: z12.string().optional(),
|
|
49226
|
+
artifact_bindings: z12.record(z12.string(), z12.string()).default({}),
|
|
49222
49227
|
side_effects: z12.array(z12.string()).default([]),
|
|
49223
49228
|
commands: z12.array(CommandSchema).default([]),
|
|
49224
49229
|
guardrails: z12.array(z12.string()).optional()
|
|
@@ -49229,8 +49234,8 @@ import { z as z13 } from "zod";
|
|
|
49229
49234
|
var ValidationSchema = z13.object({
|
|
49230
49235
|
target_artifact: z13.string(),
|
|
49231
49236
|
kind: z13.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
49232
|
-
executor_type: z13.enum(["tool", "agent"]),
|
|
49233
|
-
executor: z13.string(),
|
|
49237
|
+
executor_type: z13.enum(["tool", "agent"]).optional(),
|
|
49238
|
+
executor: z13.string().optional(),
|
|
49234
49239
|
blocking: z13.boolean(),
|
|
49235
49240
|
produces_evidence: z13.string().optional(),
|
|
49236
49241
|
description: z13.string().optional()
|
|
@@ -50959,6 +50964,9 @@ function checkReferences(dsl) {
|
|
|
50959
50964
|
}
|
|
50960
50965
|
}
|
|
50961
50966
|
for (const [id, agent] of Object.entries(dsl.agents)) {
|
|
50967
|
+
for (const ref of agent.own_artifacts) {
|
|
50968
|
+
checkExists(ref, artifactIds, "artifacts", `agents.${id}.own_artifacts`);
|
|
50969
|
+
}
|
|
50962
50970
|
for (const ref of agent.can_read_artifacts) {
|
|
50963
50971
|
checkExists(ref, artifactIds, "artifacts", `agents.${id}.can_read_artifacts`);
|
|
50964
50972
|
}
|
|
@@ -51014,7 +51022,7 @@ function checkReferences(dsl) {
|
|
|
51014
51022
|
}
|
|
51015
51023
|
for (const valId of art.required_validations) {
|
|
51016
51024
|
const validation = dsl.validations[valId];
|
|
51017
|
-
if (validation?.executor_type === "tool") {
|
|
51025
|
+
if (validation?.executor_type === "tool" && validation.executor) {
|
|
51018
51026
|
const tool = dsl.tools[validation.executor];
|
|
51019
51027
|
if (tool && tool.invokable_by.length === 0) {
|
|
51020
51028
|
diagnostics.push({
|
|
@@ -51032,12 +51040,15 @@ function checkReferences(dsl) {
|
|
|
51032
51040
|
checkExists(ref, agentIds, "agents", `tools.${id}.invokable_by`);
|
|
51033
51041
|
}
|
|
51034
51042
|
}
|
|
51043
|
+
for (const ref of Object.values(tool.artifact_bindings)) {
|
|
51044
|
+
checkExists(ref, artifactIds, "artifacts", `tools.${id}.artifact_bindings`);
|
|
51045
|
+
}
|
|
51035
51046
|
}
|
|
51036
51047
|
for (const [id, val] of Object.entries(dsl.validations)) {
|
|
51037
51048
|
checkExists(val.target_artifact, artifactIds, "artifacts", `validations.${id}.target_artifact`);
|
|
51038
|
-
if (val.executor_type === "tool") {
|
|
51049
|
+
if (val.executor_type === "tool" && val.executor) {
|
|
51039
51050
|
checkExists(val.executor, toolIds, "tools", `validations.${id}.executor`);
|
|
51040
|
-
} else if (val.executor_type === "agent") {
|
|
51051
|
+
} else if (val.executor_type === "agent" && val.executor) {
|
|
51041
51052
|
checkExists(val.executor, agentIds, "agents", `validations.${id}.executor`);
|
|
51042
51053
|
}
|
|
51043
51054
|
}
|
|
@@ -51461,7 +51472,7 @@ var toolExecutionRule = {
|
|
|
51461
51472
|
}
|
|
51462
51473
|
}
|
|
51463
51474
|
for (const [valId, val] of Object.entries(dsl.validations)) {
|
|
51464
|
-
if (val.executor_type !== "tool") continue;
|
|
51475
|
+
if (val.executor_type !== "tool" || !val.executor) continue;
|
|
51465
51476
|
const hasExecutor = Object.values(dsl.agents).some(
|
|
51466
51477
|
(a3) => a3.can_execute_tools.includes(val.executor)
|
|
51467
51478
|
);
|
|
@@ -52041,6 +52052,7 @@ var validationExecutorNoContextRule = {
|
|
|
52041
52052
|
run(dsl) {
|
|
52042
52053
|
const diagnostics = [];
|
|
52043
52054
|
for (const [validationId, val] of Object.entries(dsl.validations)) {
|
|
52055
|
+
if (!val.executor) continue;
|
|
52044
52056
|
if (val.executor_type === "agent") {
|
|
52045
52057
|
const agent = dsl.agents[val.executor];
|
|
52046
52058
|
if (!agent) continue;
|
|
@@ -52068,6 +52080,40 @@ var validationExecutorNoContextRule = {
|
|
|
52068
52080
|
}
|
|
52069
52081
|
};
|
|
52070
52082
|
|
|
52083
|
+
// src/linter/rules/artifact-ownership-consistency.ts
|
|
52084
|
+
var artifactOwnershipConsistencyRule = {
|
|
52085
|
+
id: "artifact-ownership-consistency",
|
|
52086
|
+
description: "Ensure own_artifacts entries are included in can_read_artifacts and check deprecated owner field consistency",
|
|
52087
|
+
run(dsl) {
|
|
52088
|
+
const diagnostics = [];
|
|
52089
|
+
for (const [agentId, agent] of Object.entries(dsl.agents)) {
|
|
52090
|
+
for (const artId of agent.own_artifacts) {
|
|
52091
|
+
if (!agent.can_read_artifacts.includes(artId)) {
|
|
52092
|
+
diagnostics.push({
|
|
52093
|
+
ruleId: "artifact-ownership-consistency",
|
|
52094
|
+
severity: "warning",
|
|
52095
|
+
path: `agents.${agentId}.own_artifacts`,
|
|
52096
|
+
message: `Agent "${agentId}" owns artifact "${artId}" but does not include it in can_read_artifacts`
|
|
52097
|
+
});
|
|
52098
|
+
}
|
|
52099
|
+
}
|
|
52100
|
+
}
|
|
52101
|
+
for (const [artId, art] of Object.entries(dsl.artifacts)) {
|
|
52102
|
+
if (!art.owner) continue;
|
|
52103
|
+
const ownerAgent = dsl.agents[art.owner];
|
|
52104
|
+
if (ownerAgent && !ownerAgent.own_artifacts.includes(artId)) {
|
|
52105
|
+
diagnostics.push({
|
|
52106
|
+
ruleId: "artifact-ownership-consistency",
|
|
52107
|
+
severity: "warning",
|
|
52108
|
+
path: `artifacts.${artId}.owner`,
|
|
52109
|
+
message: `Artifact "${artId}" has deprecated owner "${art.owner}" but agent does not list it in own_artifacts`
|
|
52110
|
+
});
|
|
52111
|
+
}
|
|
52112
|
+
}
|
|
52113
|
+
return diagnostics;
|
|
52114
|
+
}
|
|
52115
|
+
};
|
|
52116
|
+
|
|
52071
52117
|
// src/linter/rules/extension-consumption.ts
|
|
52072
52118
|
function isRecord4(v2) {
|
|
52073
52119
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
@@ -52255,6 +52301,7 @@ var builtinRules = [
|
|
|
52255
52301
|
entityNoGuardrailsRule,
|
|
52256
52302
|
guardrailOrphanedRule,
|
|
52257
52303
|
validationExecutorNoContextRule,
|
|
52304
|
+
artifactOwnershipConsistencyRule,
|
|
52258
52305
|
extensionDeclaredButUnusedRule,
|
|
52259
52306
|
extensionScopeMismatchRule,
|
|
52260
52307
|
extensionUndeclaredUsageRule
|
|
@@ -53465,8 +53512,8 @@ function collectReferencedIds(workflow, dsl, relatedTasks) {
|
|
|
53465
53512
|
} else if (step.type === "validation") {
|
|
53466
53513
|
const val = dsl.validations[step.validation];
|
|
53467
53514
|
if (val) {
|
|
53468
|
-
if (val.executor_type === "agent") addAgent(val.executor);
|
|
53469
|
-
else tools.add(val.executor);
|
|
53515
|
+
if (val.executor && val.executor_type === "agent") addAgent(val.executor);
|
|
53516
|
+
else if (val.executor) tools.add(val.executor);
|
|
53470
53517
|
artifacts.add(val.target_artifact);
|
|
53471
53518
|
}
|
|
53472
53519
|
}
|
|
@@ -53842,9 +53889,9 @@ function collectPhaseOps(dsl, wfId) {
|
|
|
53842
53889
|
} else if (step.type === "validation") {
|
|
53843
53890
|
const val = dsl.validations[step.validation];
|
|
53844
53891
|
if (val) {
|
|
53845
|
-
if (val.executor_type === "agent") {
|
|
53892
|
+
if (val.executor_type === "agent" && val.executor) {
|
|
53846
53893
|
addOp(agentOps, val.executor, "validate");
|
|
53847
|
-
} else {
|
|
53894
|
+
} else if (val.executor) {
|
|
53848
53895
|
addOp(toolOps, val.executor, "verification");
|
|
53849
53896
|
}
|
|
53850
53897
|
addOp(artifactOps, val.target_artifact, "V");
|