agent-contracts 0.8.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/README.md +144 -18
- package/dist/cli.js +12107 -19696
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +90 -3
- package/dist/index.js +12102 -19692
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
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>;
|
|
@@ -196,6 +206,7 @@ declare const DslSchema: z.ZodObject<{
|
|
|
196
206
|
wait_for_approval: "wait_for_approval";
|
|
197
207
|
}>;
|
|
198
208
|
}, z.core.$loose>>>;
|
|
209
|
+
validations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
199
210
|
}, z.core.$loose>>>;
|
|
200
211
|
artifacts: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
201
212
|
type: z.ZodString;
|
|
@@ -242,7 +253,7 @@ declare const DslSchema: z.ZodObject<{
|
|
|
242
253
|
handoff_types: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
243
254
|
version: z.ZodNumber;
|
|
244
255
|
description: z.ZodOptional<z.ZodString>;
|
|
245
|
-
|
|
256
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
246
257
|
example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
247
258
|
}, z.core.$loose>>>;
|
|
248
259
|
workflow: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -250,6 +261,22 @@ declare const DslSchema: z.ZodObject<{
|
|
|
250
261
|
entry_conditions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
251
262
|
trigger: z.ZodOptional<z.ZodString>;
|
|
252
263
|
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
264
|
+
type: z.ZodLiteral<"delegate">;
|
|
265
|
+
description: z.ZodOptional<z.ZodString>;
|
|
266
|
+
task: z.ZodString;
|
|
267
|
+
from_agent: z.ZodString;
|
|
268
|
+
group: z.ZodOptional<z.ZodString>;
|
|
269
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
270
|
+
condition: z.ZodString;
|
|
271
|
+
fix_task: z.ZodString;
|
|
272
|
+
revalidate_task: z.ZodOptional<z.ZodString>;
|
|
273
|
+
}, z.core.$strip>>;
|
|
274
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
275
|
+
type: z.ZodLiteral<"gate">;
|
|
276
|
+
description: z.ZodOptional<z.ZodString>;
|
|
277
|
+
gate_kind: z.ZodString;
|
|
278
|
+
group: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
253
280
|
type: z.ZodLiteral<"handoff">;
|
|
254
281
|
description: z.ZodOptional<z.ZodString>;
|
|
255
282
|
handoff_kind: z.ZodString;
|
|
@@ -291,17 +318,35 @@ declare const DslSchema: z.ZodObject<{
|
|
|
291
318
|
requires_validations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
292
319
|
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
293
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>>;
|
|
294
324
|
}, z.core.$loose>;
|
|
295
325
|
type Dsl = z.infer<typeof DslSchema>;
|
|
296
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
|
+
*/
|
|
297
334
|
declare const HandoffTypeSchema: z.ZodObject<{
|
|
298
335
|
version: z.ZodNumber;
|
|
299
336
|
description: z.ZodOptional<z.ZodString>;
|
|
300
|
-
|
|
337
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
301
338
|
example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
302
339
|
}, z.core.$loose>;
|
|
303
340
|
type HandoffType = z.infer<typeof HandoffTypeSchema>;
|
|
304
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
|
+
|
|
305
350
|
declare const AppendOperatorSchema: z.ZodObject<{
|
|
306
351
|
$append: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
307
352
|
}, z.core.$strip>;
|
|
@@ -427,6 +472,7 @@ declare const TaskSchema: z.ZodObject<{
|
|
|
427
472
|
wait_for_approval: "wait_for_approval";
|
|
428
473
|
}>;
|
|
429
474
|
}, z.core.$loose>>>;
|
|
475
|
+
validations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
430
476
|
}, z.core.$loose>;
|
|
431
477
|
type Task = z.infer<typeof TaskSchema>;
|
|
432
478
|
|
|
@@ -490,6 +536,22 @@ declare const ExternalParticipantSchema: z.ZodObject<{
|
|
|
490
536
|
}, z.core.$strip>;
|
|
491
537
|
type ExternalParticipant = z.infer<typeof ExternalParticipantSchema>;
|
|
492
538
|
declare const WorkflowStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
539
|
+
type: z.ZodLiteral<"delegate">;
|
|
540
|
+
description: z.ZodOptional<z.ZodString>;
|
|
541
|
+
task: z.ZodString;
|
|
542
|
+
from_agent: z.ZodString;
|
|
543
|
+
group: z.ZodOptional<z.ZodString>;
|
|
544
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
545
|
+
condition: z.ZodString;
|
|
546
|
+
fix_task: z.ZodString;
|
|
547
|
+
revalidate_task: z.ZodOptional<z.ZodString>;
|
|
548
|
+
}, z.core.$strip>>;
|
|
549
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
550
|
+
type: z.ZodLiteral<"gate">;
|
|
551
|
+
description: z.ZodOptional<z.ZodString>;
|
|
552
|
+
gate_kind: z.ZodString;
|
|
553
|
+
group: z.ZodOptional<z.ZodString>;
|
|
554
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
493
555
|
type: z.ZodLiteral<"handoff">;
|
|
494
556
|
description: z.ZodOptional<z.ZodString>;
|
|
495
557
|
handoff_kind: z.ZodString;
|
|
@@ -519,6 +581,22 @@ declare const WorkflowSchema: z.ZodObject<{
|
|
|
519
581
|
entry_conditions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
520
582
|
trigger: z.ZodOptional<z.ZodString>;
|
|
521
583
|
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
584
|
+
type: z.ZodLiteral<"delegate">;
|
|
585
|
+
description: z.ZodOptional<z.ZodString>;
|
|
586
|
+
task: z.ZodString;
|
|
587
|
+
from_agent: z.ZodString;
|
|
588
|
+
group: z.ZodOptional<z.ZodString>;
|
|
589
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
590
|
+
condition: z.ZodString;
|
|
591
|
+
fix_task: z.ZodString;
|
|
592
|
+
revalidate_task: z.ZodOptional<z.ZodString>;
|
|
593
|
+
}, z.core.$strip>>;
|
|
594
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
595
|
+
type: z.ZodLiteral<"gate">;
|
|
596
|
+
description: z.ZodOptional<z.ZodString>;
|
|
597
|
+
gate_kind: z.ZodString;
|
|
598
|
+
group: z.ZodOptional<z.ZodString>;
|
|
599
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
522
600
|
type: z.ZodLiteral<"handoff">;
|
|
523
601
|
description: z.ZodOptional<z.ZodString>;
|
|
524
602
|
handoff_kind: z.ZodString;
|
|
@@ -601,6 +679,15 @@ interface ReferenceDiagnostic {
|
|
|
601
679
|
}
|
|
602
680
|
declare function checkReferences(dsl: Dsl): ReferenceDiagnostic[];
|
|
603
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
|
+
|
|
604
691
|
type Severity = "error" | "warning" | "info";
|
|
605
692
|
interface LintDiagnostic {
|
|
606
693
|
ruleId: string;
|
|
@@ -842,4 +929,4 @@ declare class ConfigLoadError extends Error {
|
|
|
842
929
|
declare function loadConfig(configPath?: string): Promise<ResolvedConfig | null>;
|
|
843
930
|
declare function resolveDslPath(dirArg: string | undefined, dirArgDefault: string, config: ResolvedConfig | null): string;
|
|
844
931
|
|
|
845
|
-
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 };
|