agent-contracts 0.9.0 → 0.10.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
@@ -94,6 +94,16 @@ declare const ArtifactSchema: z.ZodObject<{
94
94
  }, z.core.$loose>;
95
95
  type Artifact = z.infer<typeof ArtifactSchema>;
96
96
 
97
+ /**
98
+ * Reusable schema components, following the OpenAPI `components` pattern.
99
+ *
100
+ * `schemas` is a map of named JSON Schema fragments that can be referenced
101
+ * from anywhere in the document via `$ref: "#/components/schemas/<name>"`.
102
+ */
103
+ declare const ComponentsSchema: z.ZodObject<{
104
+ schemas: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
105
+ }, z.core.$loose>;
106
+ type Components = z.infer<typeof ComponentsSchema>;
97
107
  declare const DslSchema: z.ZodObject<{
98
108
  version: z.ZodLiteral<1>;
99
109
  extends: z.ZodOptional<z.ZodString>;
@@ -243,7 +253,7 @@ declare const DslSchema: z.ZodObject<{
243
253
  handoff_types: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
244
254
  version: z.ZodNumber;
245
255
  description: z.ZodOptional<z.ZodString>;
246
- payload: z.ZodRecord<z.ZodString, z.ZodAny>;
256
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
247
257
  example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
248
258
  }, z.core.$loose>>>;
249
259
  workflow: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -308,17 +318,35 @@ declare const DslSchema: z.ZodObject<{
308
318
  requires_validations: z.ZodOptional<z.ZodArray<z.ZodString>>;
309
319
  requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
310
320
  }, z.core.$loose>>>;
321
+ components: z.ZodDefault<z.ZodObject<{
322
+ schemas: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
323
+ }, z.core.$loose>>;
311
324
  }, z.core.$loose>;
312
325
  type Dsl = z.infer<typeof DslSchema>;
313
326
 
327
+ /**
328
+ * Zod schema for a handoff type definition.
329
+ *
330
+ * `schema` holds a JSON Schema object describing the full message structure
331
+ * for this handoff type. It may use `allOf` to compose shared fragments
332
+ * (e.g., from `components.schemas`) with type-specific properties.
333
+ */
314
334
  declare const HandoffTypeSchema: z.ZodObject<{
315
335
  version: z.ZodNumber;
316
336
  description: z.ZodOptional<z.ZodString>;
317
- payload: z.ZodRecord<z.ZodString, z.ZodAny>;
337
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
318
338
  example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
319
339
  }, z.core.$loose>;
320
340
  type HandoffType = z.infer<typeof HandoffTypeSchema>;
321
341
 
342
+ type AnyRecord$1 = Record<string, unknown>;
343
+ /**
344
+ * Shallow-merge an array of JSON Schema subschemas from an `allOf`.
345
+ * Merges `properties`, `required`, and top-level scalars (`type`, `description`, etc.).
346
+ * Handles one level of nesting only (sufficient for handoff schema composition).
347
+ */
348
+ declare function resolveAllOf(schema: AnyRecord$1): AnyRecord$1;
349
+
322
350
  declare const AppendOperatorSchema: z.ZodObject<{
323
351
  $append: z.ZodRecord<z.ZodString, z.ZodAny>;
324
352
  }, z.core.$strip>;
@@ -651,6 +679,15 @@ interface ReferenceDiagnostic {
651
679
  }
652
680
  declare function checkReferences(dsl: Dsl): ReferenceDiagnostic[];
653
681
 
682
+ /**
683
+ * Meta-validate all `handoff_types.*.schema` entries as valid JSON Schema.
684
+ *
685
+ * Uses ajv's `validateSchema` to check that each schema is structurally
686
+ * valid according to the JSON Schema specification. Returns diagnostics
687
+ * with code `"invalid-handoff-schema"` for any violations.
688
+ */
689
+ declare function validateHandoffSchemas(dsl: Dsl): ReferenceDiagnostic[];
690
+
654
691
  type Severity = "error" | "warning" | "info";
655
692
  interface LintDiagnostic {
656
693
  ruleId: string;
@@ -892,4 +929,4 @@ declare class ConfigLoadError extends Error {
892
929
  declare function loadConfig(configPath?: string): Promise<ResolvedConfig | null>;
893
930
  declare function resolveDslPath(dirArg: string | undefined, dirArgDefault: string, config: ResolvedConfig | null): string;
894
931
 
895
- export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, ArtifactSchema, BaseResolveError, CONTEXT_TYPES, type Command, CommandSchema, ConfigLoadError, type ContextType, ContextTypeSchema, type DelegatableTaskView, type DiagnosticMessage, type Dsl, DslLoadError, DslSchema, type EscalationCriterion, EscalationCriterionSchema, type ExecutionStep, ExecutionStepSchema, type Extends, ExtendsSchema, type ExternalParticipant, type GlobalContext, type HandoffType, HandoffTypeSchema, type InsertAfterOperator, InsertAfterOperatorSchema, type LintDiagnostic, type LintRule, type LoadResult, MergeError, type MergeableRecord, type MergedBehavioralSpec, type PerAgentContext, type PerArtifactContext, 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 ResolveResult, type ResolvedConfig, type ResolvedRenderTarget, type Retry, type Rule, RuleSchema, type SchemaValidationResult, type Severity, type System, type SystemContext, SystemSchema, type Task, TaskSchema, type Tool, ToolSchema, type Validation, ValidationSchema, type VersionLiteral, VersionLiteralSchema, type Workflow, WorkflowSchema, type WorkflowStep, WorkflowStepSchema, buildArtifactContext, buildGlobalContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, lint, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveBase, resolveDslPath, spectralLint, validateSchema };
932
+ export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, ArtifactSchema, BaseResolveError, CONTEXT_TYPES, type Command, CommandSchema, type Components, ComponentsSchema, ConfigLoadError, type ContextType, ContextTypeSchema, type DelegatableTaskView, type DiagnosticMessage, type Dsl, DslLoadError, DslSchema, type EscalationCriterion, EscalationCriterionSchema, type ExecutionStep, ExecutionStepSchema, type Extends, ExtendsSchema, type ExternalParticipant, type GlobalContext, type HandoffType, HandoffTypeSchema, type InsertAfterOperator, InsertAfterOperatorSchema, type LintDiagnostic, type LintRule, type LoadResult, MergeError, type MergeableRecord, type MergedBehavioralSpec, type PerAgentContext, type PerArtifactContext, 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 ResolveResult, type ResolvedConfig, type ResolvedRenderTarget, type Retry, type Rule, RuleSchema, type SchemaValidationResult, type Severity, type System, type SystemContext, SystemSchema, type Task, TaskSchema, type Tool, ToolSchema, type Validation, ValidationSchema, type VersionLiteral, VersionLiteralSchema, type Workflow, WorkflowSchema, type WorkflowStep, WorkflowStepSchema, buildArtifactContext, buildGlobalContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, lint, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveDslPath, spectralLint, validateHandoffSchemas, validateSchema };