agent-contracts 0.12.3 → 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/dist/index.d.ts CHANGED
@@ -222,6 +222,28 @@ declare const ComponentsSchema: z.ZodObject<{
222
222
  schemas: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
223
223
  }, z.core.$loose>;
224
224
  type Components = z.infer<typeof ComponentsSchema>;
225
+ declare const SCOPE_NODE_TYPES: readonly ["root", "system", "agent", "task", "execution_step", "artifact", "tool", "tool_command", "validation", "handoff_type", "workflow", "workflow_step", "policy", "guardrail", "guardrail_policy", "rule", "escalation_criterion", "prerequisite"];
226
+ type ScopeNodeType = (typeof SCOPE_NODE_TYPES)[number];
227
+ declare const ScopeNodeTypeSchema: z.ZodEnum<{
228
+ guardrail: "guardrail";
229
+ workflow: "workflow";
230
+ tool: "tool";
231
+ agent: "agent";
232
+ task: "task";
233
+ validation: "validation";
234
+ root: "root";
235
+ system: "system";
236
+ execution_step: "execution_step";
237
+ artifact: "artifact";
238
+ tool_command: "tool_command";
239
+ handoff_type: "handoff_type";
240
+ workflow_step: "workflow_step";
241
+ policy: "policy";
242
+ guardrail_policy: "guardrail_policy";
243
+ rule: "rule";
244
+ escalation_criterion: "escalation_criterion";
245
+ prerequisite: "prerequisite";
246
+ }>;
225
247
  /**
226
248
  * Declaration of project-specific `x-*` extension fields.
227
249
  * Each key must start with `x-` and describes the expected type/shape
@@ -231,6 +253,28 @@ declare const XExtensionDeclSchema: z.ZodObject<{
231
253
  type: z.ZodString;
232
254
  items: z.ZodOptional<z.ZodString>;
233
255
  description: z.ZodOptional<z.ZodString>;
256
+ scope: z.ZodOptional<z.ZodArray<z.ZodEnum<{
257
+ guardrail: "guardrail";
258
+ workflow: "workflow";
259
+ tool: "tool";
260
+ agent: "agent";
261
+ task: "task";
262
+ validation: "validation";
263
+ root: "root";
264
+ system: "system";
265
+ execution_step: "execution_step";
266
+ artifact: "artifact";
267
+ tool_command: "tool_command";
268
+ handoff_type: "handoff_type";
269
+ workflow_step: "workflow_step";
270
+ policy: "policy";
271
+ guardrail_policy: "guardrail_policy";
272
+ rule: "rule";
273
+ escalation_criterion: "escalation_criterion";
274
+ prerequisite: "prerequisite";
275
+ }>>>;
276
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
277
+ required: z.ZodDefault<z.ZodBoolean>;
234
278
  }, z.core.$strip>;
235
279
  type XExtensionDecl = z.infer<typeof XExtensionDeclSchema>;
236
280
  declare const DslSchema: z.ZodObject<{
@@ -495,11 +539,34 @@ declare const DslSchema: z.ZodObject<{
495
539
  components: z.ZodDefault<z.ZodObject<{
496
540
  schemas: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
497
541
  }, z.core.$loose>>;
498
- "x-extensions": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
542
+ extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
499
543
  type: z.ZodString;
500
544
  items: z.ZodOptional<z.ZodString>;
501
545
  description: z.ZodOptional<z.ZodString>;
546
+ scope: z.ZodOptional<z.ZodArray<z.ZodEnum<{
547
+ guardrail: "guardrail";
548
+ workflow: "workflow";
549
+ tool: "tool";
550
+ agent: "agent";
551
+ task: "task";
552
+ validation: "validation";
553
+ root: "root";
554
+ system: "system";
555
+ execution_step: "execution_step";
556
+ artifact: "artifact";
557
+ tool_command: "tool_command";
558
+ handoff_type: "handoff_type";
559
+ workflow_step: "workflow_step";
560
+ policy: "policy";
561
+ guardrail_policy: "guardrail_policy";
562
+ rule: "rule";
563
+ escalation_criterion: "escalation_criterion";
564
+ prerequisite: "prerequisite";
565
+ }>>>;
566
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
567
+ required: z.ZodDefault<z.ZodBoolean>;
502
568
  }, z.core.$strip>>>;
569
+ extensions_strict: z.ZodDefault<z.ZodBoolean>;
503
570
  }, z.core.$loose>;
504
571
  type Dsl = z.infer<typeof DslSchema>;
505
572
 
@@ -934,6 +1001,7 @@ interface DiagnosticMessage {
934
1001
  path: string;
935
1002
  message: string;
936
1003
  code: string;
1004
+ severity?: "error" | "warning";
937
1005
  }
938
1006
  interface SchemaValidationResult {
939
1007
  success: boolean;
@@ -991,9 +1059,9 @@ declare const ContextTypeSchema: z.ZodEnum<{
991
1059
  task: "task";
992
1060
  validation: "validation";
993
1061
  system: "system";
994
- policy: "policy";
995
1062
  artifact: "artifact";
996
1063
  handoff_type: "handoff_type";
1064
+ policy: "policy";
997
1065
  guardrail_policy: "guardrail_policy";
998
1066
  }>;
999
1067
  type ContextType = z.infer<typeof ContextTypeSchema>;
@@ -1007,9 +1075,9 @@ declare const RenderTargetSchema: z.ZodObject<{
1007
1075
  task: "task";
1008
1076
  validation: "validation";
1009
1077
  system: "system";
1010
- policy: "policy";
1011
1078
  artifact: "artifact";
1012
1079
  handoff_type: "handoff_type";
1080
+ policy: "policy";
1013
1081
  guardrail_policy: "guardrail_policy";
1014
1082
  }>;
1015
1083
  output: z.ZodString;
@@ -1031,9 +1099,9 @@ declare const AgentContractsConfigSchema: z.ZodObject<{
1031
1099
  task: "task";
1032
1100
  validation: "validation";
1033
1101
  system: "system";
1034
- policy: "policy";
1035
1102
  artifact: "artifact";
1036
1103
  handoff_type: "handoff_type";
1104
+ policy: "policy";
1037
1105
  guardrail_policy: "guardrail_policy";
1038
1106
  }>;
1039
1107
  output: z.ZodString;
@@ -1128,6 +1196,14 @@ interface EntityGuardrailEntry {
1128
1196
  severity?: string;
1129
1197
  action?: string;
1130
1198
  }
1199
+ interface EntityValidationEntry {
1200
+ validation_id: string;
1201
+ kind: string;
1202
+ target_artifact: string;
1203
+ executor_type: string;
1204
+ blocking: boolean;
1205
+ produces_evidence?: string;
1206
+ }
1131
1207
  interface PerTaskContext {
1132
1208
  task: Task & {
1133
1209
  id: string;
@@ -1136,6 +1212,7 @@ interface PerTaskContext {
1136
1212
  id: string;
1137
1213
  }) | null;
1138
1214
  relatedGuardrails: EntityGuardrailEntry[];
1215
+ relatedValidations: EntityValidationEntry[];
1139
1216
  dsl: Dsl;
1140
1217
  [key: string]: unknown;
1141
1218
  }
@@ -1161,6 +1238,7 @@ interface PerToolContext {
1161
1238
  inputArtifactDetails: Dsl["artifacts"];
1162
1239
  outputArtifactDetails: Dsl["artifacts"];
1163
1240
  relatedGuardrails: EntityGuardrailEntry[];
1241
+ relatedValidations: EntityValidationEntry[];
1164
1242
  dsl: Dsl;
1165
1243
  [key: string]: unknown;
1166
1244
  }
@@ -1252,6 +1330,7 @@ interface PerAgentContext {
1252
1330
  relatedHandoffTypes: Dsl["handoff_types"];
1253
1331
  mergedBehavior: MergedBehavioralSpec;
1254
1332
  relatedGuardrails: EntityGuardrailEntry[];
1333
+ relatedValidations: EntityValidationEntry[];
1255
1334
  dsl: Dsl;
1256
1335
  [key: string]: unknown;
1257
1336
  }
@@ -1262,6 +1341,11 @@ declare function buildSystemContext(dsl: Dsl, options?: {
1262
1341
  }): SystemContext;
1263
1342
  type EntityType = "agents" | "tasks" | "tools" | "artifacts";
1264
1343
  declare function resolveEffectiveGuardrails(dsl: Dsl, entityType: EntityType, entityId: string): EntityGuardrailEntry[];
1344
+ /**
1345
+ * Resolves validation IDs for an agent, task, or tool into full entries for prompts.
1346
+ * For tools, includes validations where executor_type is "tool" and executor is the tool id.
1347
+ */
1348
+ declare function resolveEntityValidations(dsl: Dsl, entityType: "agents" | "tasks" | "tools", entityId: string): EntityValidationEntry[];
1265
1349
  declare function buildTaskContext(dsl: Dsl, taskId: string): PerTaskContext;
1266
1350
  declare function buildArtifactContext(dsl: Dsl, artifactId: string): PerArtifactContext;
1267
1351
  declare function buildToolContext(dsl: Dsl, toolId: string): PerToolContext;
@@ -1353,4 +1437,4 @@ interface PathResolveResult {
1353
1437
  }
1354
1438
  declare function resolveBindingTargetPath(target: string, paths: Record<string, string>, bindingSoftware: string): PathResolveResult;
1355
1439
 
1356
- export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, ArtifactSchema, BaseResolveError, type BindingOutput, BindingOutputSchema, CONTEXT_TYPES, type Check, CheckSchema, type Command, CommandSchema, type Components, ComponentsSchema, ConfigLoadError, type ContextType, ContextTypeSchema, type DelegatableTaskView, type DiagnosticMessage, type DimensionResult, type Dsl, DslLoadError, DslSchema, type EntityGuardrailEntry, type EscalationCriterion, EscalationCriterionSchema, type ExecutionStep, ExecutionStepSchema, type Extends, ExtendsSchema, type ExternalParticipant, type GenerateDiagnostic, type GenerateGuardrailsOptions, type GenerateResult, type GlobalContext, type Guardrail, type GuardrailGenerationContext, type GuardrailPolicy, type GuardrailPolicyRule, type GuardrailPolicyRuleEscalation, GuardrailPolicyRuleEscalationSchema, GuardrailPolicyRuleSchema, GuardrailPolicySchema, GuardrailSchema, type GuardrailScope, GuardrailScopeSchema, type HandoffType, HandoffTypeSchema, type InsertAfterOperator, InsertAfterOperatorSchema, type LintDiagnostic, type LintRule, type LoadResult, type LoadedBinding, type Matcher, MatcherSchema, MergeError, type MergeableRecord, type MergedBehavioralSpec, type PathResolveResult, type PerAgentContext, type PerArtifactContext, type PerGuardrailContext, type PerGuardrailPolicyContext, type PerHandoffTypeContext, type PerPolicyContext, type PerTaskContext, type PerToolContext, type PerValidationContext, type PerWorkflowContext, type Policy, PolicySchema, type PolicyWhen, PolicyWhenSchema, type PrependOperator, PrependOperatorSchema, type Prerequisite, PrerequisiteSchema, type ReferenceDiagnostic, type RemoveOperator, RemoveOperatorSchema, type RenderTarget, RenderTargetSchema, type ReplaceOperator, ReplaceOperatorSchema, type Reporting, ReportingSchema, type ResolveChecksResult, type ResolveResult, type ResolvedCheck, type ResolvedConfig, type ResolvedRenderTarget, type Retry, type Rule, RuleSchema, type SchemaValidationResult, type ScoreResult, type Severity, type SoftwareBinding, SoftwareBindingSchema, type System, type SystemContext, SystemSchema, type Task, TaskSchema, type Tool, ToolSchema, type Validation, ValidationSchema, type VersionLiteral, VersionLiteralSchema, type Workflow, WorkflowSchema, type WorkflowStep, WorkflowStepSchema, type XExtensionDecl, XExtensionDeclSchema, buildArtifactContext, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, expandDefaults, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, resolveEffectiveGuardrails, score, spectralLint, validateHandoffSchemas, validateSchema, yamlReservedKeySafetyRule };
1440
+ export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, ArtifactSchema, BaseResolveError, type BindingOutput, BindingOutputSchema, CONTEXT_TYPES, type Check, CheckSchema, type Command, CommandSchema, type Components, ComponentsSchema, ConfigLoadError, type ContextType, ContextTypeSchema, type DelegatableTaskView, type DiagnosticMessage, type DimensionResult, type Dsl, DslLoadError, DslSchema, type EntityGuardrailEntry, type EntityValidationEntry, type EscalationCriterion, EscalationCriterionSchema, type ExecutionStep, ExecutionStepSchema, type Extends, ExtendsSchema, type ExternalParticipant, type GenerateDiagnostic, type GenerateGuardrailsOptions, type GenerateResult, type GlobalContext, type Guardrail, type GuardrailGenerationContext, type GuardrailPolicy, type GuardrailPolicyRule, type GuardrailPolicyRuleEscalation, GuardrailPolicyRuleEscalationSchema, GuardrailPolicyRuleSchema, GuardrailPolicySchema, GuardrailSchema, type GuardrailScope, GuardrailScopeSchema, type HandoffType, HandoffTypeSchema, type InsertAfterOperator, InsertAfterOperatorSchema, type LintDiagnostic, type LintRule, type LoadResult, type LoadedBinding, type Matcher, MatcherSchema, MergeError, type MergeableRecord, type MergedBehavioralSpec, type PathResolveResult, type PerAgentContext, type PerArtifactContext, type PerGuardrailContext, type PerGuardrailPolicyContext, type PerHandoffTypeContext, type PerPolicyContext, type PerTaskContext, type PerToolContext, type PerValidationContext, type PerWorkflowContext, type Policy, PolicySchema, type PolicyWhen, PolicyWhenSchema, type PrependOperator, PrependOperatorSchema, type Prerequisite, PrerequisiteSchema, type ReferenceDiagnostic, type RemoveOperator, RemoveOperatorSchema, type RenderTarget, RenderTargetSchema, type ReplaceOperator, ReplaceOperatorSchema, type Reporting, ReportingSchema, type ResolveChecksResult, type ResolveResult, type ResolvedCheck, type ResolvedConfig, type ResolvedRenderTarget, type Retry, type Rule, RuleSchema, SCOPE_NODE_TYPES, type SchemaValidationResult, type ScopeNodeType, ScopeNodeTypeSchema, type ScoreResult, type Severity, type SoftwareBinding, SoftwareBindingSchema, type System, type SystemContext, SystemSchema, type Task, TaskSchema, type Tool, ToolSchema, type Validation, ValidationSchema, type VersionLiteral, VersionLiteralSchema, type Workflow, WorkflowSchema, type WorkflowStep, WorkflowStepSchema, type XExtensionDecl, XExtensionDeclSchema, buildArtifactContext, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, expandDefaults, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, resolveEffectiveGuardrails, resolveEntityValidations, score, spectralLint, validateHandoffSchemas, validateSchema, yamlReservedKeySafetyRule };