agent-contracts 0.9.0 → 0.11.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 +266 -18
- package/dist/cli.js +10854 -18000
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +336 -7
- package/dist/index.js +10761 -17976
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -94,6 +94,105 @@ declare const ArtifactSchema: z.ZodObject<{
|
|
|
94
94
|
}, z.core.$loose>;
|
|
95
95
|
type Artifact = z.infer<typeof ArtifactSchema>;
|
|
96
96
|
|
|
97
|
+
declare const MatcherSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"command_regex">;
|
|
99
|
+
pattern: z.ZodString;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"content_regex">;
|
|
102
|
+
pattern: z.ZodString;
|
|
103
|
+
file_glob: z.ZodOptional<z.ZodString>;
|
|
104
|
+
exclude_glob: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"file_glob">;
|
|
107
|
+
pattern: z.ZodString;
|
|
108
|
+
}, z.core.$strip>], "type">;
|
|
109
|
+
type Matcher = z.infer<typeof MatcherSchema>;
|
|
110
|
+
declare const CheckSchema: z.ZodObject<{
|
|
111
|
+
matcher: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"command_regex">;
|
|
113
|
+
pattern: z.ZodString;
|
|
114
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
115
|
+
type: z.ZodLiteral<"content_regex">;
|
|
116
|
+
pattern: z.ZodString;
|
|
117
|
+
file_glob: z.ZodOptional<z.ZodString>;
|
|
118
|
+
exclude_glob: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"file_glob">;
|
|
121
|
+
pattern: z.ZodString;
|
|
122
|
+
}, z.core.$strip>], "type">>;
|
|
123
|
+
script: z.ZodOptional<z.ZodString>;
|
|
124
|
+
message: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$loose>;
|
|
126
|
+
type Check = z.infer<typeof CheckSchema>;
|
|
127
|
+
declare const BindingOutputSchema: z.ZodObject<{
|
|
128
|
+
target: z.ZodString;
|
|
129
|
+
template: z.ZodOptional<z.ZodString>;
|
|
130
|
+
inline_template: z.ZodOptional<z.ZodString>;
|
|
131
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
132
|
+
write: "write";
|
|
133
|
+
patch: "patch";
|
|
134
|
+
}>>;
|
|
135
|
+
group_by: z.ZodOptional<z.ZodString>;
|
|
136
|
+
executable: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
}, z.core.$loose>;
|
|
138
|
+
type BindingOutput = z.infer<typeof BindingOutputSchema>;
|
|
139
|
+
declare const ReportingSchema: z.ZodObject<{
|
|
140
|
+
commands: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
141
|
+
fail_open: z.ZodDefault<z.ZodBoolean>;
|
|
142
|
+
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
143
|
+
}, z.core.$loose>;
|
|
144
|
+
type Reporting = z.infer<typeof ReportingSchema>;
|
|
145
|
+
declare const SoftwareBindingSchema: z.ZodObject<{
|
|
146
|
+
software: z.ZodString;
|
|
147
|
+
version: z.ZodLiteral<1>;
|
|
148
|
+
extends: z.ZodOptional<z.ZodString>;
|
|
149
|
+
guardrail_impl: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
150
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
151
|
+
matcher: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"command_regex">;
|
|
153
|
+
pattern: z.ZodString;
|
|
154
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
155
|
+
type: z.ZodLiteral<"content_regex">;
|
|
156
|
+
pattern: z.ZodString;
|
|
157
|
+
file_glob: z.ZodOptional<z.ZodString>;
|
|
158
|
+
exclude_glob: z.ZodOptional<z.ZodString>;
|
|
159
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"file_glob">;
|
|
161
|
+
pattern: z.ZodString;
|
|
162
|
+
}, z.core.$strip>], "type">>;
|
|
163
|
+
script: z.ZodOptional<z.ZodString>;
|
|
164
|
+
message: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$loose>>;
|
|
166
|
+
}, z.core.$strip>>>;
|
|
167
|
+
outputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
168
|
+
target: z.ZodString;
|
|
169
|
+
template: z.ZodOptional<z.ZodString>;
|
|
170
|
+
inline_template: z.ZodOptional<z.ZodString>;
|
|
171
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
172
|
+
write: "write";
|
|
173
|
+
patch: "patch";
|
|
174
|
+
}>>;
|
|
175
|
+
group_by: z.ZodOptional<z.ZodString>;
|
|
176
|
+
executable: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
}, z.core.$loose>>>;
|
|
178
|
+
reporting: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
commands: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
180
|
+
fail_open: z.ZodDefault<z.ZodBoolean>;
|
|
181
|
+
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
182
|
+
}, z.core.$loose>>;
|
|
183
|
+
}, z.core.$loose>;
|
|
184
|
+
type SoftwareBinding = z.infer<typeof SoftwareBindingSchema>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Reusable schema components, following the OpenAPI `components` pattern.
|
|
188
|
+
*
|
|
189
|
+
* `schemas` is a map of named JSON Schema fragments that can be referenced
|
|
190
|
+
* from anywhere in the document via `$ref: "#/components/schemas/<name>"`.
|
|
191
|
+
*/
|
|
192
|
+
declare const ComponentsSchema: z.ZodObject<{
|
|
193
|
+
schemas: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
194
|
+
}, z.core.$loose>;
|
|
195
|
+
type Components = z.infer<typeof ComponentsSchema>;
|
|
97
196
|
declare const DslSchema: z.ZodObject<{
|
|
98
197
|
version: z.ZodLiteral<1>;
|
|
99
198
|
extends: z.ZodOptional<z.ZodString>;
|
|
@@ -243,7 +342,7 @@ declare const DslSchema: z.ZodObject<{
|
|
|
243
342
|
handoff_types: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
244
343
|
version: z.ZodNumber;
|
|
245
344
|
description: z.ZodOptional<z.ZodString>;
|
|
246
|
-
|
|
345
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
247
346
|
example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
248
347
|
}, z.core.$loose>>>;
|
|
249
348
|
workflow: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -308,17 +407,147 @@ declare const DslSchema: z.ZodObject<{
|
|
|
308
407
|
requires_validations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
309
408
|
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
310
409
|
}, z.core.$loose>>>;
|
|
410
|
+
guardrails: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
411
|
+
description: z.ZodString;
|
|
412
|
+
scope: z.ZodObject<{
|
|
413
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
414
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
415
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
416
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
417
|
+
workflows: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
418
|
+
}, z.core.$loose>;
|
|
419
|
+
rationale: z.ZodOptional<z.ZodString>;
|
|
420
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
421
|
+
exemptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
422
|
+
}, z.core.$loose>>>;
|
|
423
|
+
guardrail_policies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
424
|
+
description: z.ZodOptional<z.ZodString>;
|
|
425
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
426
|
+
guardrail: z.ZodString;
|
|
427
|
+
severity: z.ZodEnum<{
|
|
428
|
+
mandatory: "mandatory";
|
|
429
|
+
critical: "critical";
|
|
430
|
+
warning: "warning";
|
|
431
|
+
info: "info";
|
|
432
|
+
}>;
|
|
433
|
+
action: z.ZodEnum<{
|
|
434
|
+
info: "info";
|
|
435
|
+
block: "block";
|
|
436
|
+
warn: "warn";
|
|
437
|
+
shadow: "shadow";
|
|
438
|
+
}>;
|
|
439
|
+
allow_override: z.ZodDefault<z.ZodBoolean>;
|
|
440
|
+
override_requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
441
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
442
|
+
target: z.ZodString;
|
|
443
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
444
|
+
}, z.core.$loose>>;
|
|
445
|
+
}, z.core.$loose>>;
|
|
446
|
+
}, z.core.$loose>>>;
|
|
447
|
+
components: z.ZodDefault<z.ZodObject<{
|
|
448
|
+
schemas: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
449
|
+
}, z.core.$loose>>;
|
|
311
450
|
}, z.core.$loose>;
|
|
312
451
|
type Dsl = z.infer<typeof DslSchema>;
|
|
313
452
|
|
|
453
|
+
/**
|
|
454
|
+
* Zod schema for a handoff type definition.
|
|
455
|
+
*
|
|
456
|
+
* `schema` holds a JSON Schema object describing the full message structure
|
|
457
|
+
* for this handoff type. It may use `allOf` to compose shared fragments
|
|
458
|
+
* (e.g., from `components.schemas`) with type-specific properties.
|
|
459
|
+
*/
|
|
314
460
|
declare const HandoffTypeSchema: z.ZodObject<{
|
|
315
461
|
version: z.ZodNumber;
|
|
316
462
|
description: z.ZodOptional<z.ZodString>;
|
|
317
|
-
|
|
463
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
318
464
|
example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
319
465
|
}, z.core.$loose>;
|
|
320
466
|
type HandoffType = z.infer<typeof HandoffTypeSchema>;
|
|
321
467
|
|
|
468
|
+
declare const GuardrailScopeSchema: z.ZodObject<{
|
|
469
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
470
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
471
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
472
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
473
|
+
workflows: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
474
|
+
}, z.core.$loose>;
|
|
475
|
+
type GuardrailScope = z.infer<typeof GuardrailScopeSchema>;
|
|
476
|
+
declare const GuardrailSchema: z.ZodObject<{
|
|
477
|
+
description: z.ZodString;
|
|
478
|
+
scope: z.ZodObject<{
|
|
479
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
480
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
481
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
482
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
483
|
+
workflows: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
484
|
+
}, z.core.$loose>;
|
|
485
|
+
rationale: z.ZodOptional<z.ZodString>;
|
|
486
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
487
|
+
exemptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
488
|
+
}, z.core.$loose>;
|
|
489
|
+
type Guardrail = z.infer<typeof GuardrailSchema>;
|
|
490
|
+
declare const GuardrailPolicyRuleEscalationSchema: z.ZodObject<{
|
|
491
|
+
target: z.ZodString;
|
|
492
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
493
|
+
}, z.core.$loose>;
|
|
494
|
+
type GuardrailPolicyRuleEscalation = z.infer<typeof GuardrailPolicyRuleEscalationSchema>;
|
|
495
|
+
declare const GuardrailPolicyRuleSchema: z.ZodObject<{
|
|
496
|
+
guardrail: z.ZodString;
|
|
497
|
+
severity: z.ZodEnum<{
|
|
498
|
+
mandatory: "mandatory";
|
|
499
|
+
critical: "critical";
|
|
500
|
+
warning: "warning";
|
|
501
|
+
info: "info";
|
|
502
|
+
}>;
|
|
503
|
+
action: z.ZodEnum<{
|
|
504
|
+
info: "info";
|
|
505
|
+
block: "block";
|
|
506
|
+
warn: "warn";
|
|
507
|
+
shadow: "shadow";
|
|
508
|
+
}>;
|
|
509
|
+
allow_override: z.ZodDefault<z.ZodBoolean>;
|
|
510
|
+
override_requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
511
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
512
|
+
target: z.ZodString;
|
|
513
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
514
|
+
}, z.core.$loose>>;
|
|
515
|
+
}, z.core.$loose>;
|
|
516
|
+
type GuardrailPolicyRule = z.infer<typeof GuardrailPolicyRuleSchema>;
|
|
517
|
+
declare const GuardrailPolicySchema: z.ZodObject<{
|
|
518
|
+
description: z.ZodOptional<z.ZodString>;
|
|
519
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
520
|
+
guardrail: z.ZodString;
|
|
521
|
+
severity: z.ZodEnum<{
|
|
522
|
+
mandatory: "mandatory";
|
|
523
|
+
critical: "critical";
|
|
524
|
+
warning: "warning";
|
|
525
|
+
info: "info";
|
|
526
|
+
}>;
|
|
527
|
+
action: z.ZodEnum<{
|
|
528
|
+
info: "info";
|
|
529
|
+
block: "block";
|
|
530
|
+
warn: "warn";
|
|
531
|
+
shadow: "shadow";
|
|
532
|
+
}>;
|
|
533
|
+
allow_override: z.ZodDefault<z.ZodBoolean>;
|
|
534
|
+
override_requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
535
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
536
|
+
target: z.ZodString;
|
|
537
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
538
|
+
}, z.core.$loose>>;
|
|
539
|
+
}, z.core.$loose>>;
|
|
540
|
+
}, z.core.$loose>;
|
|
541
|
+
type GuardrailPolicy = z.infer<typeof GuardrailPolicySchema>;
|
|
542
|
+
|
|
543
|
+
type AnyRecord$1 = Record<string, unknown>;
|
|
544
|
+
/**
|
|
545
|
+
* Shallow-merge an array of JSON Schema subschemas from an `allOf`.
|
|
546
|
+
* Merges `properties`, `required`, and top-level scalars (`type`, `description`, etc.).
|
|
547
|
+
* Handles one level of nesting only (sufficient for handoff schema composition).
|
|
548
|
+
*/
|
|
549
|
+
declare function resolveAllOf(schema: AnyRecord$1): AnyRecord$1;
|
|
550
|
+
|
|
322
551
|
declare const AppendOperatorSchema: z.ZodObject<{
|
|
323
552
|
$append: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
324
553
|
}, z.core.$strip>;
|
|
@@ -651,6 +880,15 @@ interface ReferenceDiagnostic {
|
|
|
651
880
|
}
|
|
652
881
|
declare function checkReferences(dsl: Dsl): ReferenceDiagnostic[];
|
|
653
882
|
|
|
883
|
+
/**
|
|
884
|
+
* Meta-validate all `handoff_types.*.schema` entries as valid JSON Schema.
|
|
885
|
+
*
|
|
886
|
+
* Uses ajv's `validateSchema` to check that each schema is structurally
|
|
887
|
+
* valid according to the JSON Schema specification. Returns diagnostics
|
|
888
|
+
* with code `"invalid-handoff-schema"` for any violations.
|
|
889
|
+
*/
|
|
890
|
+
declare function validateHandoffSchemas(dsl: Dsl): ReferenceDiagnostic[];
|
|
891
|
+
|
|
654
892
|
type Severity = "error" | "warning" | "info";
|
|
655
893
|
interface LintDiagnostic {
|
|
656
894
|
ruleId: string;
|
|
@@ -673,31 +911,35 @@ declare function lint(dsl: Dsl, rules?: LintRule[]): LintDiagnostic[];
|
|
|
673
911
|
*/
|
|
674
912
|
declare function spectralLint(dslObject: Record<string, unknown>): Promise<LintDiagnostic[]>;
|
|
675
913
|
|
|
676
|
-
declare const CONTEXT_TYPES: readonly ["agent", "task", "artifact", "tool", "validation", "handoff_type", "workflow", "policy", "system"];
|
|
914
|
+
declare const CONTEXT_TYPES: readonly ["agent", "task", "artifact", "tool", "validation", "handoff_type", "workflow", "policy", "guardrail", "guardrail_policy", "system"];
|
|
677
915
|
declare const ContextTypeSchema: z.ZodEnum<{
|
|
916
|
+
guardrail: "guardrail";
|
|
678
917
|
workflow: "workflow";
|
|
679
918
|
tool: "tool";
|
|
680
919
|
agent: "agent";
|
|
681
920
|
task: "task";
|
|
682
921
|
validation: "validation";
|
|
683
922
|
system: "system";
|
|
923
|
+
policy: "policy";
|
|
684
924
|
artifact: "artifact";
|
|
685
925
|
handoff_type: "handoff_type";
|
|
686
|
-
|
|
926
|
+
guardrail_policy: "guardrail_policy";
|
|
687
927
|
}>;
|
|
688
928
|
type ContextType = z.infer<typeof ContextTypeSchema>;
|
|
689
929
|
declare const RenderTargetSchema: z.ZodObject<{
|
|
690
930
|
template: z.ZodString;
|
|
691
931
|
context: z.ZodEnum<{
|
|
932
|
+
guardrail: "guardrail";
|
|
692
933
|
workflow: "workflow";
|
|
693
934
|
tool: "tool";
|
|
694
935
|
agent: "agent";
|
|
695
936
|
task: "task";
|
|
696
937
|
validation: "validation";
|
|
697
938
|
system: "system";
|
|
939
|
+
policy: "policy";
|
|
698
940
|
artifact: "artifact";
|
|
699
941
|
handoff_type: "handoff_type";
|
|
700
|
-
|
|
942
|
+
guardrail_policy: "guardrail_policy";
|
|
701
943
|
}>;
|
|
702
944
|
output: z.ZodString;
|
|
703
945
|
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -710,20 +952,25 @@ declare const AgentContractsConfigSchema: z.ZodObject<{
|
|
|
710
952
|
renders: z.ZodArray<z.ZodObject<{
|
|
711
953
|
template: z.ZodString;
|
|
712
954
|
context: z.ZodEnum<{
|
|
955
|
+
guardrail: "guardrail";
|
|
713
956
|
workflow: "workflow";
|
|
714
957
|
tool: "tool";
|
|
715
958
|
agent: "agent";
|
|
716
959
|
task: "task";
|
|
717
960
|
validation: "validation";
|
|
718
961
|
system: "system";
|
|
962
|
+
policy: "policy";
|
|
719
963
|
artifact: "artifact";
|
|
720
964
|
handoff_type: "handoff_type";
|
|
721
|
-
|
|
965
|
+
guardrail_policy: "guardrail_policy";
|
|
722
966
|
}>;
|
|
723
967
|
output: z.ZodString;
|
|
724
968
|
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
725
969
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
726
970
|
}, z.core.$strip>>;
|
|
971
|
+
bindings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
972
|
+
active_guardrail_policy: z.ZodOptional<z.ZodString>;
|
|
973
|
+
paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
727
974
|
}, z.core.$strip>;
|
|
728
975
|
type AgentContractsConfig = z.infer<typeof AgentContractsConfigSchema>;
|
|
729
976
|
interface ResolvedRenderTarget {
|
|
@@ -738,6 +985,9 @@ interface ResolvedConfig {
|
|
|
738
985
|
vars?: Record<string, string>;
|
|
739
986
|
renders: ResolvedRenderTarget[];
|
|
740
987
|
configDir: string;
|
|
988
|
+
bindings: string[];
|
|
989
|
+
activeGuardrailPolicy?: string;
|
|
990
|
+
paths?: Record<string, string>;
|
|
741
991
|
}
|
|
742
992
|
|
|
743
993
|
declare function renderFromConfig(dsl: Dsl, renderTargets: ResolvedRenderTarget[]): Promise<string[]>;
|
|
@@ -756,6 +1006,8 @@ interface GlobalContext {
|
|
|
756
1006
|
handoff_types: Dsl["handoff_types"];
|
|
757
1007
|
workflow: Dsl["workflow"];
|
|
758
1008
|
policies: Dsl["policies"];
|
|
1009
|
+
guardrails: Dsl["guardrails"];
|
|
1010
|
+
guardrail_policies: Dsl["guardrail_policies"];
|
|
759
1011
|
[key: string]: unknown;
|
|
760
1012
|
}
|
|
761
1013
|
interface SystemContext {
|
|
@@ -834,6 +1086,20 @@ interface PerPolicyContext {
|
|
|
834
1086
|
dsl: Dsl;
|
|
835
1087
|
[key: string]: unknown;
|
|
836
1088
|
}
|
|
1089
|
+
interface PerGuardrailContext {
|
|
1090
|
+
guardrail: Guardrail & {
|
|
1091
|
+
id: string;
|
|
1092
|
+
};
|
|
1093
|
+
dsl: Dsl;
|
|
1094
|
+
[key: string]: unknown;
|
|
1095
|
+
}
|
|
1096
|
+
interface PerGuardrailPolicyContext {
|
|
1097
|
+
guardrail_policy: GuardrailPolicy & {
|
|
1098
|
+
id: string;
|
|
1099
|
+
};
|
|
1100
|
+
dsl: Dsl;
|
|
1101
|
+
[key: string]: unknown;
|
|
1102
|
+
}
|
|
837
1103
|
interface MergedBehavioralSpec {
|
|
838
1104
|
responsibilities: string[];
|
|
839
1105
|
constraints: string[];
|
|
@@ -881,10 +1147,18 @@ declare function buildValidationContext(dsl: Dsl, validationId: string): PerVali
|
|
|
881
1147
|
declare function buildHandoffTypeContext(dsl: Dsl, handoffTypeId: string): PerHandoffTypeContext;
|
|
882
1148
|
declare function buildWorkflowContext(dsl: Dsl, workflowId: string): PerWorkflowContext;
|
|
883
1149
|
declare function buildPolicyContext(dsl: Dsl, policyId: string): PerPolicyContext;
|
|
1150
|
+
declare function buildGuardrailContext(dsl: Dsl, guardrailId: string): PerGuardrailContext;
|
|
1151
|
+
declare function buildGuardrailPolicyContext(dsl: Dsl, policyId: string): PerGuardrailPolicyContext;
|
|
884
1152
|
declare function buildPerAgentContext(dsl: Dsl, agent: Agent & {
|
|
885
1153
|
id: string;
|
|
886
1154
|
}): PerAgentContext;
|
|
887
1155
|
|
|
1156
|
+
interface LoadedBinding {
|
|
1157
|
+
filePath: string;
|
|
1158
|
+
binding: SoftwareBinding;
|
|
1159
|
+
}
|
|
1160
|
+
declare function loadBindings(bindingPaths: string[]): Promise<LoadedBinding[]>;
|
|
1161
|
+
|
|
888
1162
|
declare class ConfigLoadError extends Error {
|
|
889
1163
|
readonly filePath?: string | undefined;
|
|
890
1164
|
constructor(message: string, filePath?: string | undefined);
|
|
@@ -892,4 +1166,59 @@ declare class ConfigLoadError extends Error {
|
|
|
892
1166
|
declare function loadConfig(configPath?: string): Promise<ResolvedConfig | null>;
|
|
893
1167
|
declare function resolveDslPath(dirArg: string | undefined, dirArgDefault: string, config: ResolvedConfig | null): string;
|
|
894
1168
|
|
|
895
|
-
|
|
1169
|
+
interface ResolvedCheck {
|
|
1170
|
+
guardrail_id: string;
|
|
1171
|
+
guardrail: Guardrail;
|
|
1172
|
+
policy_rule: GuardrailPolicyRule;
|
|
1173
|
+
check: Check;
|
|
1174
|
+
}
|
|
1175
|
+
interface GuardrailGenerationContext {
|
|
1176
|
+
system: {
|
|
1177
|
+
id: string;
|
|
1178
|
+
name: string;
|
|
1179
|
+
};
|
|
1180
|
+
guardrails: Record<string, Guardrail>;
|
|
1181
|
+
policy: GuardrailPolicy;
|
|
1182
|
+
binding: SoftwareBinding;
|
|
1183
|
+
all_bindings: Record<string, SoftwareBinding>;
|
|
1184
|
+
vars: Record<string, string>;
|
|
1185
|
+
paths: Record<string, string>;
|
|
1186
|
+
reporting: {
|
|
1187
|
+
commands: Record<string, string>;
|
|
1188
|
+
fail_open: boolean;
|
|
1189
|
+
timeout_ms: number;
|
|
1190
|
+
} | null;
|
|
1191
|
+
resolved_checks: ResolvedCheck[];
|
|
1192
|
+
}
|
|
1193
|
+
interface GenerateResult {
|
|
1194
|
+
outputFiles: string[];
|
|
1195
|
+
diagnostics: GenerateDiagnostic[];
|
|
1196
|
+
}
|
|
1197
|
+
interface GenerateDiagnostic {
|
|
1198
|
+
path: string;
|
|
1199
|
+
message: string;
|
|
1200
|
+
severity: "error" | "warning" | "info";
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
interface GenerateGuardrailsOptions {
|
|
1204
|
+
dsl: Dsl;
|
|
1205
|
+
config: ResolvedConfig;
|
|
1206
|
+
loadedBindings: LoadedBinding[];
|
|
1207
|
+
filterBindings?: string[];
|
|
1208
|
+
dryRun?: boolean;
|
|
1209
|
+
}
|
|
1210
|
+
declare function generateGuardrails(options: GenerateGuardrailsOptions): Promise<GenerateResult>;
|
|
1211
|
+
|
|
1212
|
+
interface ResolveChecksResult {
|
|
1213
|
+
resolved: ResolvedCheck[];
|
|
1214
|
+
diagnostics: GenerateDiagnostic[];
|
|
1215
|
+
}
|
|
1216
|
+
declare function resolveChecks(dsl: Dsl, binding: SoftwareBinding, policy: GuardrailPolicy): ResolveChecksResult;
|
|
1217
|
+
|
|
1218
|
+
interface PathResolveResult {
|
|
1219
|
+
resolved: string;
|
|
1220
|
+
diagnostics: GenerateDiagnostic[];
|
|
1221
|
+
}
|
|
1222
|
+
declare function resolveBindingTargetPath(target: string, paths: Record<string, string>, bindingSoftware: string): PathResolveResult;
|
|
1223
|
+
|
|
1224
|
+
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 Dsl, DslLoadError, DslSchema, 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 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, buildArtifactContext, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, spectralLint, validateHandoffSchemas, validateSchema };
|