agent-contracts 0.13.0 → 0.14.1
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 +78 -4
- package/dist/cli.js +429 -287
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +117 -55
- package/dist/index.js +431 -287
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6293,7 +6293,7 @@ var init_index_es = __esm({
|
|
|
6293
6293
|
return { drive: t4.toLowerCase() + ":" };
|
|
6294
6294
|
}, k2 = function() {
|
|
6295
6295
|
return { drive: null };
|
|
6296
|
-
},
|
|
6296
|
+
}, z18 = function() {
|
|
6297
6297
|
return { drive: null };
|
|
6298
6298
|
}, B2 = function(t4) {
|
|
6299
6299
|
return { protocol: null, origin: null, absolute: false, drive: null, ...t4 };
|
|
@@ -6334,7 +6334,7 @@ var init_index_es = __esm({
|
|
|
6334
6334
|
var t4, n4, r4, e4, o4;
|
|
6335
6335
|
return t4 = K2, (n4 = rt()) !== c2 && (r4 = et()) !== c2 && (e4 = ut()) !== c2 && (o4 = it()) !== c2 ? (n4 = s2(n4, r4, e4, o4), t4 = n4) : (K2 = t4, t4 = c2), t4 === c2 && (t4 = K2, (n4 = rt()) !== c2 && (r4 = et()) !== c2 && (e4 = (function() {
|
|
6336
6336
|
var t5;
|
|
6337
|
-
return (t5 = x3) !== c2 && (t5 =
|
|
6337
|
+
return (t5 = x3) !== c2 && (t5 = z18()), t5;
|
|
6338
6338
|
})()) !== c2 ? (n4 = f2(n4, r4, e4), t4 = n4) : (K2 = t4, t4 = c2)), t4;
|
|
6339
6339
|
})()) === c2 && (n3 = (function() {
|
|
6340
6340
|
var n4, r4, e4, o4;
|
|
@@ -8023,7 +8023,7 @@ __export(index_es_exports2, {
|
|
|
8023
8023
|
resolveExternalRef: () => ye,
|
|
8024
8024
|
resolveExternalRefWithLocation: () => ge,
|
|
8025
8025
|
resolveInlineRef: () => B,
|
|
8026
|
-
resolveInlineRefWithLocation: () =>
|
|
8026
|
+
resolveInlineRefWithLocation: () => z17,
|
|
8027
8027
|
safeParse: () => de,
|
|
8028
8028
|
safeStringify: () => ve,
|
|
8029
8029
|
startsWith: () => be,
|
|
@@ -8067,9 +8067,9 @@ function* L(e3, t3, r3) {
|
|
|
8067
8067
|
for (const [n3, o3] of t3.entries()) O(e3.value, o3, r3), e3.value = e3.value[o3], A(e3.value) && (j(e3.value), yield [n3, e3.value]);
|
|
8068
8068
|
}
|
|
8069
8069
|
function B(e3, t3) {
|
|
8070
|
-
return
|
|
8070
|
+
return z17(e3, t3).value;
|
|
8071
8071
|
}
|
|
8072
|
-
function
|
|
8072
|
+
function z17(e3, t3) {
|
|
8073
8073
|
return (function e4(t4, r3, n3, o3) {
|
|
8074
8074
|
if (null !== V(r3)) throw new ReferenceError("Cannot resolve external references");
|
|
8075
8075
|
const i3 = K(r3);
|
|
@@ -16899,7 +16899,7 @@ var require_immer_cjs_production_min = __commonJS({
|
|
|
16899
16899
|
var t4 = n4[H2];
|
|
16900
16900
|
return (t4 ? s2(t4) : n4)[r4];
|
|
16901
16901
|
}
|
|
16902
|
-
function
|
|
16902
|
+
function z18(n4, r4) {
|
|
16903
16903
|
if (r4 in n4) for (var t4 = Object.getPrototypeOf(n4); t4; ) {
|
|
16904
16904
|
var e4 = Object.getOwnPropertyDescriptor(t4, r4);
|
|
16905
16905
|
if (e4) return e4;
|
|
@@ -17292,7 +17292,7 @@ var require_immer_cjs_production_min = __commonJS({
|
|
|
17292
17292
|
if (r4 === H2) return n4;
|
|
17293
17293
|
var e4 = s2(n4);
|
|
17294
17294
|
if (!u2(e4, r4)) return (function(n5, r5, t4) {
|
|
17295
|
-
var e5, i5 =
|
|
17295
|
+
var e5, i5 = z18(r5, t4);
|
|
17296
17296
|
return i5 ? "value" in i5 ? i5.value : null === (e5 = i5.get) || void 0 === e5 ? void 0 : e5.call(n5.k) : void 0;
|
|
17297
17297
|
})(n4, e4, r4);
|
|
17298
17298
|
var i4 = e4[r4];
|
|
@@ -17302,7 +17302,7 @@ var require_immer_cjs_production_min = __commonJS({
|
|
|
17302
17302
|
}, ownKeys: function(n4) {
|
|
17303
17303
|
return Reflect.ownKeys(s2(n4));
|
|
17304
17304
|
}, set: function(n4, r4, t4) {
|
|
17305
|
-
var e4 =
|
|
17305
|
+
var e4 = z18(s2(n4), r4);
|
|
17306
17306
|
if (null == e4 ? void 0 : e4.set) return e4.set.call(n4.k, t4), true;
|
|
17307
17307
|
if (!n4.g) {
|
|
17308
17308
|
var i4 = A2(s2(n4), r4), o4 = null == i4 ? void 0 : i4[H2];
|
|
@@ -35641,11 +35641,11 @@ var require_brace_expansion = __commonJS({
|
|
|
35641
35641
|
if (pad) {
|
|
35642
35642
|
var need = width - c2.length;
|
|
35643
35643
|
if (need > 0) {
|
|
35644
|
-
var
|
|
35644
|
+
var z18 = new Array(need + 1).join("0");
|
|
35645
35645
|
if (i3 < 0)
|
|
35646
|
-
c2 = "-" +
|
|
35646
|
+
c2 = "-" + z18 + c2.slice(1);
|
|
35647
35647
|
else
|
|
35648
|
-
c2 =
|
|
35648
|
+
c2 = z18 + c2;
|
|
35649
35649
|
}
|
|
35650
35650
|
}
|
|
35651
35651
|
}
|
|
@@ -49169,7 +49169,7 @@ var require_dist10 = __commonJS({
|
|
|
49169
49169
|
var getSiblings = (parent) => (node) => getChildren(parent).filter(not(eq(node)));
|
|
49170
49170
|
var concatAll = (
|
|
49171
49171
|
/*::<T>*/
|
|
49172
|
-
(xs) => (ys) => ys.reduce((zs,
|
|
49172
|
+
(xs) => (ys) => ys.reduce((zs, z18) => zs.concat(z18), xs)
|
|
49173
49173
|
);
|
|
49174
49174
|
function getLastSegment(instancePath) {
|
|
49175
49175
|
const index4 = instancePath.lastIndexOf("/");
|
|
@@ -50479,6 +50479,12 @@ var AgentSchema = z.object({
|
|
|
50479
50479
|
rules: z.array(RuleSchema).optional(),
|
|
50480
50480
|
anti_patterns: z.array(z.string()).optional(),
|
|
50481
50481
|
escalation_criteria: z.array(EscalationCriterionSchema).optional(),
|
|
50482
|
+
sections: z.array(
|
|
50483
|
+
z.object({
|
|
50484
|
+
title: z.string(),
|
|
50485
|
+
content: z.string()
|
|
50486
|
+
})
|
|
50487
|
+
).optional(),
|
|
50482
50488
|
prerequisites: z.array(PrerequisiteSchema).optional(),
|
|
50483
50489
|
guardrails: z.array(z.string()).optional()
|
|
50484
50490
|
}).passthrough();
|
|
@@ -50499,44 +50505,66 @@ var ArtifactSchema = z2.object({
|
|
|
50499
50505
|
}).passthrough();
|
|
50500
50506
|
|
|
50501
50507
|
// src/schema/binding.ts
|
|
50508
|
+
import { z as z4 } from "zod";
|
|
50509
|
+
|
|
50510
|
+
// src/schema/context-type.ts
|
|
50502
50511
|
import { z as z3 } from "zod";
|
|
50503
|
-
var
|
|
50504
|
-
|
|
50505
|
-
|
|
50512
|
+
var CONTEXT_TYPES = [
|
|
50513
|
+
"agent",
|
|
50514
|
+
"task",
|
|
50515
|
+
"artifact",
|
|
50516
|
+
"tool",
|
|
50517
|
+
"validation",
|
|
50518
|
+
"handoff_type",
|
|
50519
|
+
"workflow",
|
|
50520
|
+
"policy",
|
|
50521
|
+
"guardrail",
|
|
50522
|
+
"guardrail_policy",
|
|
50523
|
+
"system"
|
|
50524
|
+
];
|
|
50525
|
+
var ContextTypeSchema = z3.enum(CONTEXT_TYPES);
|
|
50526
|
+
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
50527
|
+
(t3) => t3 !== "system"
|
|
50528
|
+
);
|
|
50529
|
+
|
|
50530
|
+
// src/schema/binding.ts
|
|
50531
|
+
var CommandRegexMatcherSchema = z4.object({
|
|
50532
|
+
type: z4.literal("command_regex"),
|
|
50533
|
+
pattern: z4.string()
|
|
50506
50534
|
}).passthrough();
|
|
50507
|
-
var ContentRegexMatcherSchema =
|
|
50508
|
-
type:
|
|
50509
|
-
pattern:
|
|
50510
|
-
file_glob:
|
|
50511
|
-
exclude_glob:
|
|
50535
|
+
var ContentRegexMatcherSchema = z4.object({
|
|
50536
|
+
type: z4.literal("content_regex"),
|
|
50537
|
+
pattern: z4.string(),
|
|
50538
|
+
file_glob: z4.string().optional(),
|
|
50539
|
+
exclude_glob: z4.string().optional()
|
|
50512
50540
|
}).passthrough();
|
|
50513
|
-
var FileGlobMatcherSchema =
|
|
50514
|
-
type:
|
|
50515
|
-
pattern:
|
|
50516
|
-
exclude_glob:
|
|
50541
|
+
var FileGlobMatcherSchema = z4.object({
|
|
50542
|
+
type: z4.literal("file_glob"),
|
|
50543
|
+
pattern: z4.string(),
|
|
50544
|
+
exclude_glob: z4.string().optional()
|
|
50517
50545
|
}).passthrough();
|
|
50518
|
-
var MatcherSchema =
|
|
50546
|
+
var MatcherSchema = z4.discriminatedUnion("type", [
|
|
50519
50547
|
CommandRegexMatcherSchema,
|
|
50520
50548
|
ContentRegexMatcherSchema,
|
|
50521
50549
|
FileGlobMatcherSchema
|
|
50522
50550
|
]);
|
|
50523
|
-
var CheckSchema =
|
|
50551
|
+
var CheckSchema = z4.object({
|
|
50524
50552
|
matcher: MatcherSchema.optional(),
|
|
50525
|
-
script:
|
|
50526
|
-
message:
|
|
50553
|
+
script: z4.string().optional(),
|
|
50554
|
+
message: z4.string().optional()
|
|
50527
50555
|
}).passthrough();
|
|
50528
|
-
var BindingOutputSchema =
|
|
50529
|
-
target:
|
|
50530
|
-
template:
|
|
50531
|
-
inline_template:
|
|
50532
|
-
source:
|
|
50533
|
-
mode:
|
|
50534
|
-
format:
|
|
50535
|
-
patch_strategy:
|
|
50536
|
-
array_merge_key:
|
|
50537
|
-
group_by:
|
|
50538
|
-
executable:
|
|
50539
|
-
skip_empty:
|
|
50556
|
+
var BindingOutputSchema = z4.object({
|
|
50557
|
+
target: z4.string(),
|
|
50558
|
+
template: z4.string().optional(),
|
|
50559
|
+
inline_template: z4.string().optional(),
|
|
50560
|
+
source: z4.string().optional(),
|
|
50561
|
+
mode: z4.enum(["write", "patch"]).default("write"),
|
|
50562
|
+
format: z4.enum(["json", "yaml", "text"]).optional(),
|
|
50563
|
+
patch_strategy: z4.enum(["deep_merge", "append"]).optional(),
|
|
50564
|
+
array_merge_key: z4.string().optional(),
|
|
50565
|
+
group_by: z4.string().optional(),
|
|
50566
|
+
executable: z4.boolean().optional(),
|
|
50567
|
+
skip_empty: z4.boolean().optional()
|
|
50540
50568
|
}).passthrough().refine(
|
|
50541
50569
|
(data) => {
|
|
50542
50570
|
const count = [data.template, data.inline_template, data.source].filter(Boolean).length;
|
|
@@ -50544,225 +50572,253 @@ var BindingOutputSchema = z3.object({
|
|
|
50544
50572
|
},
|
|
50545
50573
|
{ message: "Only one of template, inline_template, or source may be specified" }
|
|
50546
50574
|
);
|
|
50547
|
-
var ReportingSchema =
|
|
50548
|
-
commands:
|
|
50549
|
-
fail_open:
|
|
50550
|
-
timeout_ms:
|
|
50575
|
+
var ReportingSchema = z4.object({
|
|
50576
|
+
commands: z4.record(z4.string(), z4.string()),
|
|
50577
|
+
fail_open: z4.boolean().default(true),
|
|
50578
|
+
timeout_ms: z4.number().default(5e3)
|
|
50551
50579
|
}).passthrough();
|
|
50552
|
-
var GuardrailImplSchema =
|
|
50553
|
-
checks:
|
|
50554
|
-
});
|
|
50555
|
-
var
|
|
50556
|
-
|
|
50557
|
-
|
|
50558
|
-
|
|
50559
|
-
|
|
50560
|
-
|
|
50580
|
+
var GuardrailImplSchema = z4.object({
|
|
50581
|
+
checks: z4.array(CheckSchema)
|
|
50582
|
+
});
|
|
50583
|
+
var BindingRenderTargetSchema = z4.object({
|
|
50584
|
+
template: z4.string().optional(),
|
|
50585
|
+
inline_template: z4.string().optional(),
|
|
50586
|
+
context: ContextTypeSchema,
|
|
50587
|
+
output: z4.string(),
|
|
50588
|
+
include: z4.array(z4.string()).optional(),
|
|
50589
|
+
exclude: z4.array(z4.string()).optional(),
|
|
50590
|
+
skip_empty: z4.boolean().optional(),
|
|
50591
|
+
executable: z4.boolean().optional()
|
|
50592
|
+
}).passthrough().refine(
|
|
50593
|
+
(data) => {
|
|
50594
|
+
const count = [data.template, data.inline_template].filter(Boolean).length;
|
|
50595
|
+
return count === 1;
|
|
50596
|
+
},
|
|
50597
|
+
{ message: "Exactly one of template or inline_template must be specified" }
|
|
50598
|
+
).refine(
|
|
50599
|
+
(data) => !(data.include && data.exclude),
|
|
50600
|
+
{ message: "include and exclude are mutually exclusive" }
|
|
50601
|
+
).refine(
|
|
50602
|
+
(data) => {
|
|
50603
|
+
if (data.context === "system" && (data.include || data.exclude)) {
|
|
50604
|
+
return false;
|
|
50605
|
+
}
|
|
50606
|
+
return true;
|
|
50607
|
+
},
|
|
50608
|
+
{ message: "include/exclude cannot be used with context: system" }
|
|
50609
|
+
);
|
|
50610
|
+
var SoftwareBindingSchema = z4.object({
|
|
50611
|
+
software: z4.string(),
|
|
50612
|
+
version: z4.literal(1),
|
|
50613
|
+
extends: z4.string().optional(),
|
|
50614
|
+
guardrail_impl: z4.record(z4.string(), GuardrailImplSchema).optional(),
|
|
50615
|
+
outputs: z4.record(z4.string(), BindingOutputSchema).optional(),
|
|
50616
|
+
renders: z4.array(BindingRenderTargetSchema).optional(),
|
|
50561
50617
|
reporting: ReportingSchema.optional()
|
|
50562
50618
|
}).passthrough();
|
|
50563
50619
|
|
|
50564
50620
|
// src/schema/dsl.ts
|
|
50565
|
-
import { z as
|
|
50621
|
+
import { z as z13 } from "zod";
|
|
50566
50622
|
|
|
50567
50623
|
// src/schema/handoff-type.ts
|
|
50568
|
-
import { z as
|
|
50569
|
-
var HandoffTypeSchema =
|
|
50570
|
-
version:
|
|
50571
|
-
description:
|
|
50572
|
-
schema:
|
|
50573
|
-
example:
|
|
50624
|
+
import { z as z5 } from "zod";
|
|
50625
|
+
var HandoffTypeSchema = z5.object({
|
|
50626
|
+
version: z5.number(),
|
|
50627
|
+
description: z5.string().optional(),
|
|
50628
|
+
schema: z5.record(z5.string(), z5.any()),
|
|
50629
|
+
example: z5.record(z5.string(), z5.any()).optional()
|
|
50574
50630
|
}).passthrough();
|
|
50575
50631
|
|
|
50576
50632
|
// src/schema/guardrail.ts
|
|
50577
|
-
import { z as
|
|
50578
|
-
var GuardrailScopeSchema =
|
|
50579
|
-
agents:
|
|
50580
|
-
tasks:
|
|
50581
|
-
tools:
|
|
50582
|
-
artifacts:
|
|
50583
|
-
workflows:
|
|
50633
|
+
import { z as z6 } from "zod";
|
|
50634
|
+
var GuardrailScopeSchema = z6.object({
|
|
50635
|
+
agents: z6.array(z6.string()).optional(),
|
|
50636
|
+
tasks: z6.array(z6.string()).optional(),
|
|
50637
|
+
tools: z6.array(z6.string()).optional(),
|
|
50638
|
+
artifacts: z6.array(z6.string()).optional(),
|
|
50639
|
+
workflows: z6.array(z6.string()).optional()
|
|
50584
50640
|
}).passthrough();
|
|
50585
|
-
var GuardrailSchema =
|
|
50586
|
-
description:
|
|
50641
|
+
var GuardrailSchema = z6.object({
|
|
50642
|
+
description: z6.string(),
|
|
50587
50643
|
scope: GuardrailScopeSchema,
|
|
50588
|
-
rationale:
|
|
50589
|
-
tags:
|
|
50590
|
-
exemptions:
|
|
50644
|
+
rationale: z6.string().optional(),
|
|
50645
|
+
tags: z6.array(z6.string()).default([]),
|
|
50646
|
+
exemptions: z6.array(z6.string()).optional()
|
|
50591
50647
|
}).passthrough();
|
|
50592
|
-
var GuardrailPolicyRuleEscalationSchema =
|
|
50593
|
-
target:
|
|
50594
|
-
condition:
|
|
50648
|
+
var GuardrailPolicyRuleEscalationSchema = z6.object({
|
|
50649
|
+
target: z6.string(),
|
|
50650
|
+
condition: z6.string().optional()
|
|
50595
50651
|
}).passthrough();
|
|
50596
|
-
var GuardrailPolicyRuleSchema =
|
|
50597
|
-
guardrail:
|
|
50598
|
-
severity:
|
|
50599
|
-
action:
|
|
50600
|
-
allow_override:
|
|
50601
|
-
override_requires:
|
|
50652
|
+
var GuardrailPolicyRuleSchema = z6.object({
|
|
50653
|
+
guardrail: z6.string(),
|
|
50654
|
+
severity: z6.enum(["critical", "mandatory", "warning", "info"]),
|
|
50655
|
+
action: z6.enum(["block", "warn", "shadow", "info"]),
|
|
50656
|
+
allow_override: z6.boolean().default(false),
|
|
50657
|
+
override_requires: z6.array(z6.string()).optional(),
|
|
50602
50658
|
escalation: GuardrailPolicyRuleEscalationSchema.optional()
|
|
50603
50659
|
}).passthrough();
|
|
50604
|
-
var GuardrailPolicySchema =
|
|
50605
|
-
description:
|
|
50606
|
-
rules:
|
|
50660
|
+
var GuardrailPolicySchema = z6.object({
|
|
50661
|
+
description: z6.string().optional(),
|
|
50662
|
+
rules: z6.array(GuardrailPolicyRuleSchema)
|
|
50607
50663
|
}).passthrough();
|
|
50608
50664
|
|
|
50609
50665
|
// src/schema/policy.ts
|
|
50610
|
-
import { z as
|
|
50611
|
-
var PolicyWhenSchema =
|
|
50612
|
-
artifact_type:
|
|
50613
|
-
workflow:
|
|
50666
|
+
import { z as z7 } from "zod";
|
|
50667
|
+
var PolicyWhenSchema = z7.object({
|
|
50668
|
+
artifact_type: z7.string().optional(),
|
|
50669
|
+
workflow: z7.string().optional()
|
|
50614
50670
|
}).passthrough();
|
|
50615
|
-
var PolicySchema =
|
|
50671
|
+
var PolicySchema = z7.object({
|
|
50616
50672
|
when: PolicyWhenSchema,
|
|
50617
|
-
requires_validations:
|
|
50618
|
-
requires:
|
|
50673
|
+
requires_validations: z7.array(z7.string()).optional(),
|
|
50674
|
+
requires: z7.array(z7.string()).optional()
|
|
50619
50675
|
}).passthrough();
|
|
50620
50676
|
|
|
50621
50677
|
// src/schema/system.ts
|
|
50622
|
-
import { z as z7 } from "zod";
|
|
50623
|
-
var VersionLiteralSchema = z7.literal(1);
|
|
50624
|
-
var ExtendsSchema = z7.string().optional();
|
|
50625
|
-
var SystemSchema = z7.object({
|
|
50626
|
-
id: z7.string(),
|
|
50627
|
-
name: z7.string(),
|
|
50628
|
-
default_workflow_order: z7.array(z7.string())
|
|
50629
|
-
}).passthrough();
|
|
50630
|
-
|
|
50631
|
-
// src/schema/task.ts
|
|
50632
50678
|
import { z as z8 } from "zod";
|
|
50633
|
-
var
|
|
50679
|
+
var VersionLiteralSchema = z8.literal(1);
|
|
50680
|
+
var ExtendsSchema = z8.string().optional();
|
|
50681
|
+
var SystemSchema = z8.object({
|
|
50634
50682
|
id: z8.string(),
|
|
50635
|
-
|
|
50636
|
-
|
|
50637
|
-
required: z8.boolean().optional(),
|
|
50638
|
-
abort_on_failure: z8.boolean().optional(),
|
|
50639
|
-
uses_tool: z8.string().optional(),
|
|
50640
|
-
produces_artifact: z8.string().optional(),
|
|
50641
|
-
reads_artifact: z8.string().optional(),
|
|
50642
|
-
depends_on: z8.array(z8.string()).optional(),
|
|
50643
|
-
skip_condition: z8.string().optional(),
|
|
50644
|
-
wait_for_approval: z8.boolean().optional()
|
|
50645
|
-
}).passthrough();
|
|
50646
|
-
var TaskSchema = z8.object({
|
|
50647
|
-
description: z8.string(),
|
|
50648
|
-
target_agent: z8.string(),
|
|
50649
|
-
allowed_from_agents: z8.array(z8.string()),
|
|
50650
|
-
workflow: z8.string(),
|
|
50651
|
-
input_artifacts: z8.array(z8.string()),
|
|
50652
|
-
invocation_handoff: z8.string(),
|
|
50653
|
-
result_handoff: z8.string(),
|
|
50654
|
-
default_priority: z8.string().optional(),
|
|
50655
|
-
responsibilities: z8.array(z8.string()).optional(),
|
|
50656
|
-
constraints: z8.array(z8.string()).optional(),
|
|
50657
|
-
execution_steps: z8.array(ExecutionStepSchema).optional(),
|
|
50658
|
-
completion_criteria: z8.array(z8.string()).optional(),
|
|
50659
|
-
rules: z8.array(RuleSchema).optional(),
|
|
50660
|
-
anti_patterns: z8.array(z8.string()).optional(),
|
|
50661
|
-
escalation_criteria: z8.array(EscalationCriterionSchema).optional(),
|
|
50662
|
-
validations: z8.array(z8.string()).default([]),
|
|
50663
|
-
guardrails: z8.array(z8.string()).optional()
|
|
50683
|
+
name: z8.string(),
|
|
50684
|
+
default_workflow_order: z8.array(z8.string())
|
|
50664
50685
|
}).passthrough();
|
|
50665
50686
|
|
|
50666
|
-
// src/schema/
|
|
50687
|
+
// src/schema/task.ts
|
|
50667
50688
|
import { z as z9 } from "zod";
|
|
50668
|
-
var
|
|
50669
|
-
|
|
50670
|
-
|
|
50671
|
-
reads: z9.array(z9.string()).default([]),
|
|
50672
|
-
writes: z9.array(z9.string()).default([]),
|
|
50673
|
-
purpose: z9.string().optional()
|
|
50674
|
-
});
|
|
50675
|
-
var ToolSchema = z9.object({
|
|
50676
|
-
kind: z9.string(),
|
|
50689
|
+
var ExecutionStepSchema = z9.object({
|
|
50690
|
+
id: z9.string(),
|
|
50691
|
+
action: z9.string(),
|
|
50677
50692
|
description: z9.string().optional(),
|
|
50678
|
-
|
|
50679
|
-
|
|
50680
|
-
|
|
50681
|
-
|
|
50682
|
-
|
|
50693
|
+
required: z9.boolean().optional(),
|
|
50694
|
+
abort_on_failure: z9.boolean().optional(),
|
|
50695
|
+
uses_tool: z9.string().optional(),
|
|
50696
|
+
produces_artifact: z9.string().optional(),
|
|
50697
|
+
reads_artifact: z9.string().optional(),
|
|
50698
|
+
depends_on: z9.array(z9.string()).optional(),
|
|
50699
|
+
skip_condition: z9.string().optional(),
|
|
50700
|
+
wait_for_approval: z9.boolean().optional()
|
|
50701
|
+
}).passthrough();
|
|
50702
|
+
var TaskSchema = z9.object({
|
|
50703
|
+
description: z9.string(),
|
|
50704
|
+
target_agent: z9.string(),
|
|
50705
|
+
allowed_from_agents: z9.array(z9.string()),
|
|
50706
|
+
workflow: z9.string(),
|
|
50707
|
+
input_artifacts: z9.array(z9.string()),
|
|
50708
|
+
invocation_handoff: z9.string(),
|
|
50709
|
+
result_handoff: z9.string(),
|
|
50710
|
+
default_priority: z9.string().optional(),
|
|
50711
|
+
responsibilities: z9.array(z9.string()).optional(),
|
|
50712
|
+
constraints: z9.array(z9.string()).optional(),
|
|
50713
|
+
execution_steps: z9.array(ExecutionStepSchema).optional(),
|
|
50714
|
+
completion_criteria: z9.array(z9.string()).optional(),
|
|
50715
|
+
rules: z9.array(RuleSchema).optional(),
|
|
50716
|
+
anti_patterns: z9.array(z9.string()).optional(),
|
|
50717
|
+
escalation_criteria: z9.array(EscalationCriterionSchema).optional(),
|
|
50718
|
+
validations: z9.array(z9.string()).default([]),
|
|
50683
50719
|
guardrails: z9.array(z9.string()).optional()
|
|
50684
50720
|
}).passthrough();
|
|
50685
50721
|
|
|
50686
|
-
// src/schema/
|
|
50722
|
+
// src/schema/tool.ts
|
|
50687
50723
|
import { z as z10 } from "zod";
|
|
50688
|
-
var
|
|
50689
|
-
|
|
50690
|
-
|
|
50691
|
-
|
|
50692
|
-
|
|
50693
|
-
|
|
50694
|
-
|
|
50724
|
+
var CommandSchema = z10.object({
|
|
50725
|
+
command: z10.string(),
|
|
50726
|
+
category: z10.string(),
|
|
50727
|
+
reads: z10.array(z10.string()).default([]),
|
|
50728
|
+
writes: z10.array(z10.string()).default([]),
|
|
50729
|
+
purpose: z10.string().optional()
|
|
50730
|
+
});
|
|
50731
|
+
var ToolSchema = z10.object({
|
|
50732
|
+
kind: z10.string(),
|
|
50733
|
+
description: z10.string().optional(),
|
|
50734
|
+
input_artifacts: z10.array(z10.string()).default([]),
|
|
50735
|
+
output_artifacts: z10.array(z10.string()).default([]),
|
|
50736
|
+
invokable_by: z10.array(z10.string()),
|
|
50737
|
+
side_effects: z10.array(z10.string()).default([]),
|
|
50738
|
+
commands: z10.array(CommandSchema).default([]),
|
|
50739
|
+
guardrails: z10.array(z10.string()).optional()
|
|
50695
50740
|
}).passthrough();
|
|
50696
50741
|
|
|
50697
|
-
// src/schema/
|
|
50742
|
+
// src/schema/validation.ts
|
|
50698
50743
|
import { z as z11 } from "zod";
|
|
50699
|
-
var
|
|
50700
|
-
|
|
50701
|
-
|
|
50702
|
-
|
|
50703
|
-
|
|
50704
|
-
|
|
50705
|
-
|
|
50706
|
-
|
|
50707
|
-
|
|
50708
|
-
|
|
50709
|
-
}
|
|
50710
|
-
var
|
|
50711
|
-
|
|
50712
|
-
|
|
50713
|
-
|
|
50714
|
-
|
|
50715
|
-
|
|
50744
|
+
var ValidationSchema = z11.object({
|
|
50745
|
+
target_artifact: z11.string(),
|
|
50746
|
+
kind: z11.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
50747
|
+
executor_type: z11.enum(["tool", "agent"]),
|
|
50748
|
+
executor: z11.string(),
|
|
50749
|
+
blocking: z11.boolean(),
|
|
50750
|
+
produces_evidence: z11.string().optional()
|
|
50751
|
+
}).passthrough();
|
|
50752
|
+
|
|
50753
|
+
// src/schema/workflow.ts
|
|
50754
|
+
import { z as z12 } from "zod";
|
|
50755
|
+
var RetrySchema = z12.object({
|
|
50756
|
+
condition: z12.string(),
|
|
50757
|
+
fix_task: z12.string(),
|
|
50758
|
+
revalidate_task: z12.string().optional()
|
|
50759
|
+
});
|
|
50760
|
+
var ExternalParticipantSchema = z12.object({
|
|
50761
|
+
id: z12.string(),
|
|
50762
|
+
kind: z12.enum(["actor", "participant"]),
|
|
50763
|
+
label: z12.string(),
|
|
50764
|
+
description: z12.string().optional()
|
|
50765
|
+
});
|
|
50766
|
+
var WorkflowDelegateStepSchema = z12.object({
|
|
50767
|
+
type: z12.literal("delegate"),
|
|
50768
|
+
description: z12.string().optional(),
|
|
50769
|
+
task: z12.string(),
|
|
50770
|
+
from_agent: z12.string(),
|
|
50771
|
+
group: z12.string().optional(),
|
|
50716
50772
|
retry: RetrySchema.optional()
|
|
50717
50773
|
}).passthrough();
|
|
50718
|
-
var WorkflowGateStepSchema =
|
|
50719
|
-
type:
|
|
50720
|
-
description:
|
|
50721
|
-
gate_kind:
|
|
50722
|
-
group:
|
|
50774
|
+
var WorkflowGateStepSchema = z12.object({
|
|
50775
|
+
type: z12.literal("gate"),
|
|
50776
|
+
description: z12.string().optional(),
|
|
50777
|
+
gate_kind: z12.string(),
|
|
50778
|
+
group: z12.string().optional()
|
|
50723
50779
|
}).passthrough();
|
|
50724
|
-
var WorkflowHandoffStepSchema =
|
|
50725
|
-
type:
|
|
50726
|
-
description:
|
|
50727
|
-
handoff_kind:
|
|
50728
|
-
task:
|
|
50729
|
-
from_agent:
|
|
50730
|
-
group:
|
|
50780
|
+
var WorkflowHandoffStepSchema = z12.object({
|
|
50781
|
+
type: z12.literal("handoff"),
|
|
50782
|
+
description: z12.string().optional(),
|
|
50783
|
+
handoff_kind: z12.string(),
|
|
50784
|
+
task: z12.string().optional(),
|
|
50785
|
+
from_agent: z12.string().optional(),
|
|
50786
|
+
group: z12.string().optional(),
|
|
50731
50787
|
retry: RetrySchema.optional()
|
|
50732
50788
|
}).passthrough();
|
|
50733
|
-
var WorkflowValidationStepSchema =
|
|
50734
|
-
type:
|
|
50735
|
-
description:
|
|
50736
|
-
validation:
|
|
50737
|
-
group:
|
|
50789
|
+
var WorkflowValidationStepSchema = z12.object({
|
|
50790
|
+
type: z12.literal("validation"),
|
|
50791
|
+
description: z12.string().optional(),
|
|
50792
|
+
validation: z12.string(),
|
|
50793
|
+
group: z12.string().optional()
|
|
50738
50794
|
}).passthrough();
|
|
50739
|
-
var WorkflowDecisionStepSchema =
|
|
50740
|
-
type:
|
|
50741
|
-
description:
|
|
50795
|
+
var WorkflowDecisionStepSchema = z12.object({
|
|
50796
|
+
type: z12.literal("decision"),
|
|
50797
|
+
description: z12.string().optional(),
|
|
50742
50798
|
/** @deprecated Use `routing_key` instead. `on` is kept for backward compatibility. */
|
|
50743
|
-
on:
|
|
50744
|
-
routing_key:
|
|
50745
|
-
branches:
|
|
50746
|
-
group:
|
|
50799
|
+
on: z12.string().optional(),
|
|
50800
|
+
routing_key: z12.string().optional(),
|
|
50801
|
+
branches: z12.record(z12.string(), z12.array(z12.string())),
|
|
50802
|
+
group: z12.string().optional()
|
|
50747
50803
|
}).passthrough();
|
|
50748
|
-
var WorkflowStepSchema =
|
|
50804
|
+
var WorkflowStepSchema = z12.discriminatedUnion("type", [
|
|
50749
50805
|
WorkflowDelegateStepSchema,
|
|
50750
50806
|
WorkflowGateStepSchema,
|
|
50751
50807
|
WorkflowHandoffStepSchema,
|
|
50752
50808
|
WorkflowValidationStepSchema,
|
|
50753
50809
|
WorkflowDecisionStepSchema
|
|
50754
50810
|
]);
|
|
50755
|
-
var WorkflowSchema =
|
|
50756
|
-
description:
|
|
50757
|
-
entry_conditions:
|
|
50758
|
-
trigger:
|
|
50759
|
-
steps:
|
|
50760
|
-
external_participants:
|
|
50811
|
+
var WorkflowSchema = z12.object({
|
|
50812
|
+
description: z12.string().optional(),
|
|
50813
|
+
entry_conditions: z12.array(z12.string()).default([]),
|
|
50814
|
+
trigger: z12.string().optional(),
|
|
50815
|
+
steps: z12.array(WorkflowStepSchema),
|
|
50816
|
+
external_participants: z12.array(ExternalParticipantSchema).default([])
|
|
50761
50817
|
}).passthrough();
|
|
50762
50818
|
|
|
50763
50819
|
// src/schema/dsl.ts
|
|
50764
|
-
var ComponentsSchema =
|
|
50765
|
-
schemas:
|
|
50820
|
+
var ComponentsSchema = z13.object({
|
|
50821
|
+
schemas: z13.record(z13.string(), z13.record(z13.string(), z13.any())).default({})
|
|
50766
50822
|
}).passthrough();
|
|
50767
50823
|
var SCOPE_NODE_TYPES = [
|
|
50768
50824
|
"root",
|
|
@@ -50784,32 +50840,32 @@ var SCOPE_NODE_TYPES = [
|
|
|
50784
50840
|
"escalation_criterion",
|
|
50785
50841
|
"prerequisite"
|
|
50786
50842
|
];
|
|
50787
|
-
var ScopeNodeTypeSchema =
|
|
50788
|
-
var XExtensionDeclSchema =
|
|
50789
|
-
type:
|
|
50790
|
-
items:
|
|
50791
|
-
description:
|
|
50792
|
-
scope:
|
|
50793
|
-
schema:
|
|
50794
|
-
required:
|
|
50795
|
-
});
|
|
50796
|
-
var DslSchema =
|
|
50797
|
-
version:
|
|
50798
|
-
extends:
|
|
50843
|
+
var ScopeNodeTypeSchema = z13.enum(SCOPE_NODE_TYPES);
|
|
50844
|
+
var XExtensionDeclSchema = z13.object({
|
|
50845
|
+
type: z13.string(),
|
|
50846
|
+
items: z13.string().optional(),
|
|
50847
|
+
description: z13.string().optional(),
|
|
50848
|
+
scope: z13.array(ScopeNodeTypeSchema).optional(),
|
|
50849
|
+
schema: z13.record(z13.string(), z13.any()).optional(),
|
|
50850
|
+
required: z13.boolean().default(false)
|
|
50851
|
+
});
|
|
50852
|
+
var DslSchema = z13.object({
|
|
50853
|
+
version: z13.literal(1),
|
|
50854
|
+
extends: z13.string().optional(),
|
|
50799
50855
|
system: SystemSchema,
|
|
50800
|
-
agents:
|
|
50801
|
-
tasks:
|
|
50802
|
-
artifacts:
|
|
50803
|
-
tools:
|
|
50804
|
-
validations:
|
|
50805
|
-
handoff_types:
|
|
50806
|
-
workflow:
|
|
50807
|
-
policies:
|
|
50808
|
-
guardrails:
|
|
50809
|
-
guardrail_policies:
|
|
50856
|
+
agents: z13.record(z13.string(), AgentSchema).default({}),
|
|
50857
|
+
tasks: z13.record(z13.string(), TaskSchema).default({}),
|
|
50858
|
+
artifacts: z13.record(z13.string(), ArtifactSchema).default({}),
|
|
50859
|
+
tools: z13.record(z13.string(), ToolSchema).default({}),
|
|
50860
|
+
validations: z13.record(z13.string(), ValidationSchema).default({}),
|
|
50861
|
+
handoff_types: z13.record(z13.string(), HandoffTypeSchema).default({}),
|
|
50862
|
+
workflow: z13.record(z13.string(), WorkflowSchema).default({}),
|
|
50863
|
+
policies: z13.record(z13.string(), PolicySchema).default({}),
|
|
50864
|
+
guardrails: z13.record(z13.string(), GuardrailSchema).default({}),
|
|
50865
|
+
guardrail_policies: z13.record(z13.string(), GuardrailPolicySchema).default({}),
|
|
50810
50866
|
components: ComponentsSchema.default({ schemas: {} }),
|
|
50811
|
-
extensions:
|
|
50812
|
-
extensions_strict:
|
|
50867
|
+
extensions: z13.record(z13.string(), XExtensionDeclSchema).default({}),
|
|
50868
|
+
extensions_strict: z13.boolean().default(false)
|
|
50813
50869
|
}).passthrough();
|
|
50814
50870
|
|
|
50815
50871
|
// src/schema/json-schema-utils.ts
|
|
@@ -50861,22 +50917,22 @@ function resolveAllOf(schema) {
|
|
|
50861
50917
|
}
|
|
50862
50918
|
|
|
50863
50919
|
// src/schema/merge-operators.ts
|
|
50864
|
-
import { z as
|
|
50865
|
-
var AppendOperatorSchema =
|
|
50866
|
-
$append:
|
|
50920
|
+
import { z as z14 } from "zod";
|
|
50921
|
+
var AppendOperatorSchema = z14.object({
|
|
50922
|
+
$append: z14.record(z14.string(), z14.any())
|
|
50867
50923
|
});
|
|
50868
|
-
var PrependOperatorSchema =
|
|
50869
|
-
$prepend:
|
|
50924
|
+
var PrependOperatorSchema = z14.object({
|
|
50925
|
+
$prepend: z14.record(z14.string(), z14.any())
|
|
50870
50926
|
});
|
|
50871
|
-
var InsertAfterOperatorSchema =
|
|
50872
|
-
$insert_after:
|
|
50873
|
-
after:
|
|
50874
|
-
entries:
|
|
50927
|
+
var InsertAfterOperatorSchema = z14.object({
|
|
50928
|
+
$insert_after: z14.object({
|
|
50929
|
+
after: z14.string(),
|
|
50930
|
+
entries: z14.record(z14.string(), z14.any())
|
|
50875
50931
|
})
|
|
50876
50932
|
});
|
|
50877
|
-
var ReplaceOperatorSchema =
|
|
50878
|
-
var RemoveOperatorSchema =
|
|
50879
|
-
$remove:
|
|
50933
|
+
var ReplaceOperatorSchema = z14.object({ $replace: z14.any() });
|
|
50934
|
+
var RemoveOperatorSchema = z14.object({
|
|
50935
|
+
$remove: z14.array(z14.string())
|
|
50880
50936
|
});
|
|
50881
50937
|
|
|
50882
50938
|
// src/config/loader.ts
|
|
@@ -50885,31 +50941,14 @@ import { resolve, dirname } from "path";
|
|
|
50885
50941
|
import { parse as parseYaml } from "yaml";
|
|
50886
50942
|
|
|
50887
50943
|
// src/config/types.ts
|
|
50888
|
-
import { z as
|
|
50889
|
-
var
|
|
50890
|
-
|
|
50891
|
-
"task",
|
|
50892
|
-
"artifact",
|
|
50893
|
-
"tool",
|
|
50894
|
-
"validation",
|
|
50895
|
-
"handoff_type",
|
|
50896
|
-
"workflow",
|
|
50897
|
-
"policy",
|
|
50898
|
-
"guardrail",
|
|
50899
|
-
"guardrail_policy",
|
|
50900
|
-
"system"
|
|
50901
|
-
];
|
|
50902
|
-
var ContextTypeSchema = z14.enum(CONTEXT_TYPES);
|
|
50903
|
-
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
50904
|
-
(t3) => t3 !== "system"
|
|
50905
|
-
);
|
|
50906
|
-
var RenderTargetSchema = z14.object({
|
|
50907
|
-
template: z14.string(),
|
|
50944
|
+
import { z as z15 } from "zod";
|
|
50945
|
+
var RenderTargetSchema = z15.object({
|
|
50946
|
+
template: z15.string(),
|
|
50908
50947
|
context: ContextTypeSchema,
|
|
50909
|
-
output:
|
|
50910
|
-
include:
|
|
50911
|
-
exclude:
|
|
50912
|
-
skip_empty:
|
|
50948
|
+
output: z15.string(),
|
|
50949
|
+
include: z15.array(z15.string()).optional(),
|
|
50950
|
+
exclude: z15.array(z15.string()).optional(),
|
|
50951
|
+
skip_empty: z15.boolean().optional()
|
|
50913
50952
|
}).refine(
|
|
50914
50953
|
(data) => !(data.include && data.exclude),
|
|
50915
50954
|
{ message: "include and exclude are mutually exclusive" }
|
|
@@ -50922,13 +50961,13 @@ var RenderTargetSchema = z14.object({
|
|
|
50922
50961
|
},
|
|
50923
50962
|
{ message: "include/exclude cannot be used with context: system" }
|
|
50924
50963
|
);
|
|
50925
|
-
var AgentContractsConfigSchema =
|
|
50926
|
-
dsl:
|
|
50927
|
-
vars:
|
|
50928
|
-
renders:
|
|
50929
|
-
bindings:
|
|
50930
|
-
active_guardrail_policy:
|
|
50931
|
-
paths:
|
|
50964
|
+
var AgentContractsConfigSchema = z15.object({
|
|
50965
|
+
dsl: z15.string(),
|
|
50966
|
+
vars: z15.record(z15.string(), z15.string()).optional(),
|
|
50967
|
+
renders: z15.array(RenderTargetSchema).default([]),
|
|
50968
|
+
bindings: z15.array(z15.string()).default([]),
|
|
50969
|
+
active_guardrail_policy: z15.string().optional(),
|
|
50970
|
+
paths: z15.record(z15.string(), z15.string()).optional()
|
|
50932
50971
|
});
|
|
50933
50972
|
|
|
50934
50973
|
// src/config/loader.ts
|
|
@@ -51676,11 +51715,12 @@ function expandDefaults(data) {
|
|
|
51676
51715
|
function isRecord3(v2) {
|
|
51677
51716
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
51678
51717
|
}
|
|
51679
|
-
var
|
|
51718
|
+
var BINDING_MAP_MERGE_SECTIONS = ["guardrail_impl", "outputs"];
|
|
51719
|
+
var BINDING_ARRAY_MERGE_SECTIONS = ["renders"];
|
|
51680
51720
|
function mergeBinding(base, project) {
|
|
51681
51721
|
const hasExtends = typeof project["extends"] === "string";
|
|
51682
51722
|
const result = { ...base, ...project };
|
|
51683
|
-
for (const section of
|
|
51723
|
+
for (const section of BINDING_MAP_MERGE_SECTIONS) {
|
|
51684
51724
|
const baseVal = base[section];
|
|
51685
51725
|
const projVal = project[section];
|
|
51686
51726
|
if (projVal === void 0) {
|
|
@@ -51694,6 +51734,14 @@ function mergeBinding(base, project) {
|
|
|
51694
51734
|
hasExtends
|
|
51695
51735
|
);
|
|
51696
51736
|
}
|
|
51737
|
+
for (const section of BINDING_ARRAY_MERGE_SECTIONS) {
|
|
51738
|
+
const baseVal = base[section];
|
|
51739
|
+
const projVal = project[section];
|
|
51740
|
+
if (projVal === void 0) continue;
|
|
51741
|
+
const baseArr = Array.isArray(baseVal) ? baseVal : [];
|
|
51742
|
+
const projArr = Array.isArray(projVal) ? projVal : [];
|
|
51743
|
+
result[section] = [...baseArr, ...projArr];
|
|
51744
|
+
}
|
|
51697
51745
|
if (project["reporting"] !== void 0 && isRecord3(base["reporting"]) && isRecord3(project["reporting"])) {
|
|
51698
51746
|
result["reporting"] = deepMergeEntities(
|
|
51699
51747
|
base["reporting"],
|
|
@@ -51839,16 +51887,16 @@ import { Command as Command2 } from "commander";
|
|
|
51839
51887
|
|
|
51840
51888
|
// src/validator/schema-validator.ts
|
|
51841
51889
|
import Ajv from "ajv";
|
|
51842
|
-
import { z as
|
|
51890
|
+
import { z as z16 } from "zod";
|
|
51843
51891
|
function unwrap(schema) {
|
|
51844
|
-
if (schema instanceof
|
|
51845
|
-
if (schema instanceof
|
|
51846
|
-
if (schema instanceof
|
|
51892
|
+
if (schema instanceof z16.ZodOptional) return unwrap(schema.unwrap());
|
|
51893
|
+
if (schema instanceof z16.ZodDefault) return unwrap(schema.removeDefault());
|
|
51894
|
+
if (schema instanceof z16.ZodNullable) return unwrap(schema.unwrap());
|
|
51847
51895
|
return schema;
|
|
51848
51896
|
}
|
|
51849
51897
|
function checkCustomPropsRecursive(data, schema, path) {
|
|
51850
51898
|
const inner = unwrap(schema);
|
|
51851
|
-
if (inner instanceof
|
|
51899
|
+
if (inner instanceof z16.ZodObject) {
|
|
51852
51900
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51853
51901
|
const obj = data;
|
|
51854
51902
|
const shape = inner.shape;
|
|
@@ -51869,7 +51917,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51869
51917
|
}
|
|
51870
51918
|
return diagnostics;
|
|
51871
51919
|
}
|
|
51872
|
-
if (inner instanceof
|
|
51920
|
+
if (inner instanceof z16.ZodRecord) {
|
|
51873
51921
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51874
51922
|
const valueSchema = inner._def.valueType;
|
|
51875
51923
|
const diagnostics = [];
|
|
@@ -51878,7 +51926,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51878
51926
|
}
|
|
51879
51927
|
return diagnostics;
|
|
51880
51928
|
}
|
|
51881
|
-
if (inner instanceof
|
|
51929
|
+
if (inner instanceof z16.ZodArray) {
|
|
51882
51930
|
if (!Array.isArray(data)) return [];
|
|
51883
51931
|
const diagnostics = [];
|
|
51884
51932
|
for (let i3 = 0; i3 < data.length; i3++) {
|
|
@@ -51886,14 +51934,14 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51886
51934
|
}
|
|
51887
51935
|
return diagnostics;
|
|
51888
51936
|
}
|
|
51889
|
-
if (inner instanceof
|
|
51937
|
+
if (inner instanceof z16.ZodDiscriminatedUnion) {
|
|
51890
51938
|
if (typeof data !== "object" || data === null) return [];
|
|
51891
51939
|
const obj = data;
|
|
51892
51940
|
const disc = inner._def.discriminator;
|
|
51893
51941
|
const discValue = obj[disc];
|
|
51894
51942
|
const match = inner.options.find((opt) => {
|
|
51895
51943
|
const shape = opt.shape;
|
|
51896
|
-
return shape[disc] instanceof
|
|
51944
|
+
return shape[disc] instanceof z16.ZodLiteral && shape[disc].value === discValue;
|
|
51897
51945
|
});
|
|
51898
51946
|
if (match) return checkCustomPropsRecursive(data, match, path);
|
|
51899
51947
|
return [];
|
|
@@ -56150,7 +56198,7 @@ async function generateGuardrails(options) {
|
|
|
56150
56198
|
if (filterBindings && !filterBindings.includes(binding.software)) {
|
|
56151
56199
|
continue;
|
|
56152
56200
|
}
|
|
56153
|
-
if (!binding.outputs) continue;
|
|
56201
|
+
if (!binding.outputs && !binding.renders) continue;
|
|
56154
56202
|
const checkResult = resolveChecks(dsl, binding, policy);
|
|
56155
56203
|
diagnostics.push(...checkResult.diagnostics);
|
|
56156
56204
|
const ctx = {
|
|
@@ -56162,9 +56210,14 @@ async function generateGuardrails(options) {
|
|
|
56162
56210
|
vars,
|
|
56163
56211
|
paths,
|
|
56164
56212
|
reporting,
|
|
56165
|
-
resolved_checks: checkResult.resolved
|
|
56166
|
-
|
|
56167
|
-
|
|
56213
|
+
resolved_checks: checkResult.resolved,
|
|
56214
|
+
tasks: dsl.tasks,
|
|
56215
|
+
artifacts: dsl.artifacts,
|
|
56216
|
+
agents: dsl.agents,
|
|
56217
|
+
handoff_types: dsl.handoff_types,
|
|
56218
|
+
workflow: dsl.workflow
|
|
56219
|
+
};
|
|
56220
|
+
for (const [outputId, outputDef] of Object.entries(binding.outputs ?? {})) {
|
|
56168
56221
|
const pathResult = resolveBindingTargetPath(
|
|
56169
56222
|
outputDef.target,
|
|
56170
56223
|
paths,
|
|
@@ -56294,9 +56347,98 @@ async function generateGuardrails(options) {
|
|
|
56294
56347
|
}
|
|
56295
56348
|
}
|
|
56296
56349
|
}
|
|
56350
|
+
for (const renderTarget of binding.renders ?? []) {
|
|
56351
|
+
let templateContent;
|
|
56352
|
+
if (renderTarget.inline_template) {
|
|
56353
|
+
templateContent = renderTarget.inline_template;
|
|
56354
|
+
} else if (renderTarget.template) {
|
|
56355
|
+
const templatePath = resolve6(config.configDir, renderTarget.template);
|
|
56356
|
+
try {
|
|
56357
|
+
templateContent = await readFile5(templatePath, "utf8");
|
|
56358
|
+
} catch {
|
|
56359
|
+
diagnostics.push({
|
|
56360
|
+
path: `binding.${binding.software}.renders`,
|
|
56361
|
+
message: `Template file not found: ${templatePath}`,
|
|
56362
|
+
severity: "error"
|
|
56363
|
+
});
|
|
56364
|
+
continue;
|
|
56365
|
+
}
|
|
56366
|
+
} else {
|
|
56367
|
+
diagnostics.push({
|
|
56368
|
+
path: `binding.${binding.software}.renders`,
|
|
56369
|
+
message: "Render target has neither template nor inline_template",
|
|
56370
|
+
severity: "error"
|
|
56371
|
+
});
|
|
56372
|
+
continue;
|
|
56373
|
+
}
|
|
56374
|
+
const compiled = Handlebars2.compile(templateContent, { noEscape: true });
|
|
56375
|
+
const shouldSkipEmpty = renderTarget.skip_empty === true;
|
|
56376
|
+
const context = renderTarget.context;
|
|
56377
|
+
if (context === "system") {
|
|
56378
|
+
const sysCtx = buildSystemContext(dsl);
|
|
56379
|
+
const mergedCtx = { ...sysCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56380
|
+
const rendered = compiled(mergedCtx);
|
|
56381
|
+
const resolvedOutput = resolveBindingRenderOutputPath(renderTarget.output, paths);
|
|
56382
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56383
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56384
|
+
if (!dryRun) {
|
|
56385
|
+
try {
|
|
56386
|
+
await unlink2(outputPath);
|
|
56387
|
+
} catch {
|
|
56388
|
+
}
|
|
56389
|
+
}
|
|
56390
|
+
continue;
|
|
56391
|
+
}
|
|
56392
|
+
if (!dryRun) {
|
|
56393
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56394
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56395
|
+
if (renderTarget.executable) {
|
|
56396
|
+
await chmod(outputPath, 493);
|
|
56397
|
+
}
|
|
56398
|
+
}
|
|
56399
|
+
outputFiles.push(outputPath);
|
|
56400
|
+
} else {
|
|
56401
|
+
const section = getDslSection(dsl, context);
|
|
56402
|
+
const allIds = Object.keys(section);
|
|
56403
|
+
const ids = filterIds(allIds, renderTarget.include, renderTarget.exclude);
|
|
56404
|
+
for (const entityId of ids) {
|
|
56405
|
+
const entityCtx = buildEntityContext(dsl, context, entityId);
|
|
56406
|
+
const mergedCtx = { ...entityCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56407
|
+
const rendered = compiled(mergedCtx);
|
|
56408
|
+
const resolvedOutput = resolveBindingRenderOutputPath(
|
|
56409
|
+
expandOutputPath(renderTarget.output, context, entityId),
|
|
56410
|
+
paths
|
|
56411
|
+
);
|
|
56412
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56413
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56414
|
+
if (!dryRun) {
|
|
56415
|
+
try {
|
|
56416
|
+
await unlink2(outputPath);
|
|
56417
|
+
} catch {
|
|
56418
|
+
}
|
|
56419
|
+
}
|
|
56420
|
+
continue;
|
|
56421
|
+
}
|
|
56422
|
+
if (!dryRun) {
|
|
56423
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56424
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56425
|
+
if (renderTarget.executable) {
|
|
56426
|
+
await chmod(outputPath, 493);
|
|
56427
|
+
}
|
|
56428
|
+
}
|
|
56429
|
+
outputFiles.push(outputPath);
|
|
56430
|
+
}
|
|
56431
|
+
}
|
|
56432
|
+
}
|
|
56297
56433
|
}
|
|
56298
56434
|
return { outputFiles, diagnostics };
|
|
56299
56435
|
}
|
|
56436
|
+
function resolveBindingRenderOutputPath(output, paths) {
|
|
56437
|
+
return output.replace(/\{(\w+)\}/g, (match, varName) => {
|
|
56438
|
+
const value = paths[varName];
|
|
56439
|
+
return value !== void 0 ? value : match;
|
|
56440
|
+
});
|
|
56441
|
+
}
|
|
56300
56442
|
|
|
56301
56443
|
// src/cli/commands/generate-guardrails.ts
|
|
56302
56444
|
var generateGuardrailsCommand = new Command6("generate").description("Generate guardrail runtime artifacts from DSL, policies, and bindings").argument("[type]", "Type of artifacts to generate", "guardrails").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--binding <name...>", "Filter to specific software binding(s)").option("--dry-run", "Print what would be generated without writing files", false).option("--quiet", "Suppress output on success", false).action(
|