agent-contracts 0.13.0 → 0.14.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 +71 -1
- package/dist/cli.js +423 -287
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +109 -55
- package/dist/index.js +425 -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("/");
|
|
@@ -50499,44 +50499,66 @@ var ArtifactSchema = z2.object({
|
|
|
50499
50499
|
}).passthrough();
|
|
50500
50500
|
|
|
50501
50501
|
// src/schema/binding.ts
|
|
50502
|
+
import { z as z4 } from "zod";
|
|
50503
|
+
|
|
50504
|
+
// src/schema/context-type.ts
|
|
50502
50505
|
import { z as z3 } from "zod";
|
|
50503
|
-
var
|
|
50504
|
-
|
|
50505
|
-
|
|
50506
|
+
var CONTEXT_TYPES = [
|
|
50507
|
+
"agent",
|
|
50508
|
+
"task",
|
|
50509
|
+
"artifact",
|
|
50510
|
+
"tool",
|
|
50511
|
+
"validation",
|
|
50512
|
+
"handoff_type",
|
|
50513
|
+
"workflow",
|
|
50514
|
+
"policy",
|
|
50515
|
+
"guardrail",
|
|
50516
|
+
"guardrail_policy",
|
|
50517
|
+
"system"
|
|
50518
|
+
];
|
|
50519
|
+
var ContextTypeSchema = z3.enum(CONTEXT_TYPES);
|
|
50520
|
+
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
50521
|
+
(t3) => t3 !== "system"
|
|
50522
|
+
);
|
|
50523
|
+
|
|
50524
|
+
// src/schema/binding.ts
|
|
50525
|
+
var CommandRegexMatcherSchema = z4.object({
|
|
50526
|
+
type: z4.literal("command_regex"),
|
|
50527
|
+
pattern: z4.string()
|
|
50506
50528
|
}).passthrough();
|
|
50507
|
-
var ContentRegexMatcherSchema =
|
|
50508
|
-
type:
|
|
50509
|
-
pattern:
|
|
50510
|
-
file_glob:
|
|
50511
|
-
exclude_glob:
|
|
50529
|
+
var ContentRegexMatcherSchema = z4.object({
|
|
50530
|
+
type: z4.literal("content_regex"),
|
|
50531
|
+
pattern: z4.string(),
|
|
50532
|
+
file_glob: z4.string().optional(),
|
|
50533
|
+
exclude_glob: z4.string().optional()
|
|
50512
50534
|
}).passthrough();
|
|
50513
|
-
var FileGlobMatcherSchema =
|
|
50514
|
-
type:
|
|
50515
|
-
pattern:
|
|
50516
|
-
exclude_glob:
|
|
50535
|
+
var FileGlobMatcherSchema = z4.object({
|
|
50536
|
+
type: z4.literal("file_glob"),
|
|
50537
|
+
pattern: z4.string(),
|
|
50538
|
+
exclude_glob: z4.string().optional()
|
|
50517
50539
|
}).passthrough();
|
|
50518
|
-
var MatcherSchema =
|
|
50540
|
+
var MatcherSchema = z4.discriminatedUnion("type", [
|
|
50519
50541
|
CommandRegexMatcherSchema,
|
|
50520
50542
|
ContentRegexMatcherSchema,
|
|
50521
50543
|
FileGlobMatcherSchema
|
|
50522
50544
|
]);
|
|
50523
|
-
var CheckSchema =
|
|
50545
|
+
var CheckSchema = z4.object({
|
|
50524
50546
|
matcher: MatcherSchema.optional(),
|
|
50525
|
-
script:
|
|
50526
|
-
message:
|
|
50547
|
+
script: z4.string().optional(),
|
|
50548
|
+
message: z4.string().optional()
|
|
50527
50549
|
}).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:
|
|
50550
|
+
var BindingOutputSchema = z4.object({
|
|
50551
|
+
target: z4.string(),
|
|
50552
|
+
template: z4.string().optional(),
|
|
50553
|
+
inline_template: z4.string().optional(),
|
|
50554
|
+
source: z4.string().optional(),
|
|
50555
|
+
mode: z4.enum(["write", "patch"]).default("write"),
|
|
50556
|
+
format: z4.enum(["json", "yaml", "text"]).optional(),
|
|
50557
|
+
patch_strategy: z4.enum(["deep_merge", "append"]).optional(),
|
|
50558
|
+
array_merge_key: z4.string().optional(),
|
|
50559
|
+
group_by: z4.string().optional(),
|
|
50560
|
+
executable: z4.boolean().optional(),
|
|
50561
|
+
skip_empty: z4.boolean().optional()
|
|
50540
50562
|
}).passthrough().refine(
|
|
50541
50563
|
(data) => {
|
|
50542
50564
|
const count = [data.template, data.inline_template, data.source].filter(Boolean).length;
|
|
@@ -50544,225 +50566,253 @@ var BindingOutputSchema = z3.object({
|
|
|
50544
50566
|
},
|
|
50545
50567
|
{ message: "Only one of template, inline_template, or source may be specified" }
|
|
50546
50568
|
);
|
|
50547
|
-
var ReportingSchema =
|
|
50548
|
-
commands:
|
|
50549
|
-
fail_open:
|
|
50550
|
-
timeout_ms:
|
|
50569
|
+
var ReportingSchema = z4.object({
|
|
50570
|
+
commands: z4.record(z4.string(), z4.string()),
|
|
50571
|
+
fail_open: z4.boolean().default(true),
|
|
50572
|
+
timeout_ms: z4.number().default(5e3)
|
|
50551
50573
|
}).passthrough();
|
|
50552
|
-
var GuardrailImplSchema =
|
|
50553
|
-
checks:
|
|
50554
|
-
});
|
|
50555
|
-
var
|
|
50556
|
-
|
|
50557
|
-
|
|
50558
|
-
|
|
50559
|
-
|
|
50560
|
-
|
|
50574
|
+
var GuardrailImplSchema = z4.object({
|
|
50575
|
+
checks: z4.array(CheckSchema)
|
|
50576
|
+
});
|
|
50577
|
+
var BindingRenderTargetSchema = z4.object({
|
|
50578
|
+
template: z4.string().optional(),
|
|
50579
|
+
inline_template: z4.string().optional(),
|
|
50580
|
+
context: ContextTypeSchema,
|
|
50581
|
+
output: z4.string(),
|
|
50582
|
+
include: z4.array(z4.string()).optional(),
|
|
50583
|
+
exclude: z4.array(z4.string()).optional(),
|
|
50584
|
+
skip_empty: z4.boolean().optional(),
|
|
50585
|
+
executable: z4.boolean().optional()
|
|
50586
|
+
}).passthrough().refine(
|
|
50587
|
+
(data) => {
|
|
50588
|
+
const count = [data.template, data.inline_template].filter(Boolean).length;
|
|
50589
|
+
return count === 1;
|
|
50590
|
+
},
|
|
50591
|
+
{ message: "Exactly one of template or inline_template must be specified" }
|
|
50592
|
+
).refine(
|
|
50593
|
+
(data) => !(data.include && data.exclude),
|
|
50594
|
+
{ message: "include and exclude are mutually exclusive" }
|
|
50595
|
+
).refine(
|
|
50596
|
+
(data) => {
|
|
50597
|
+
if (data.context === "system" && (data.include || data.exclude)) {
|
|
50598
|
+
return false;
|
|
50599
|
+
}
|
|
50600
|
+
return true;
|
|
50601
|
+
},
|
|
50602
|
+
{ message: "include/exclude cannot be used with context: system" }
|
|
50603
|
+
);
|
|
50604
|
+
var SoftwareBindingSchema = z4.object({
|
|
50605
|
+
software: z4.string(),
|
|
50606
|
+
version: z4.literal(1),
|
|
50607
|
+
extends: z4.string().optional(),
|
|
50608
|
+
guardrail_impl: z4.record(z4.string(), GuardrailImplSchema).optional(),
|
|
50609
|
+
outputs: z4.record(z4.string(), BindingOutputSchema).optional(),
|
|
50610
|
+
renders: z4.array(BindingRenderTargetSchema).optional(),
|
|
50561
50611
|
reporting: ReportingSchema.optional()
|
|
50562
50612
|
}).passthrough();
|
|
50563
50613
|
|
|
50564
50614
|
// src/schema/dsl.ts
|
|
50565
|
-
import { z as
|
|
50615
|
+
import { z as z13 } from "zod";
|
|
50566
50616
|
|
|
50567
50617
|
// src/schema/handoff-type.ts
|
|
50568
|
-
import { z as
|
|
50569
|
-
var HandoffTypeSchema =
|
|
50570
|
-
version:
|
|
50571
|
-
description:
|
|
50572
|
-
schema:
|
|
50573
|
-
example:
|
|
50618
|
+
import { z as z5 } from "zod";
|
|
50619
|
+
var HandoffTypeSchema = z5.object({
|
|
50620
|
+
version: z5.number(),
|
|
50621
|
+
description: z5.string().optional(),
|
|
50622
|
+
schema: z5.record(z5.string(), z5.any()),
|
|
50623
|
+
example: z5.record(z5.string(), z5.any()).optional()
|
|
50574
50624
|
}).passthrough();
|
|
50575
50625
|
|
|
50576
50626
|
// src/schema/guardrail.ts
|
|
50577
|
-
import { z as
|
|
50578
|
-
var GuardrailScopeSchema =
|
|
50579
|
-
agents:
|
|
50580
|
-
tasks:
|
|
50581
|
-
tools:
|
|
50582
|
-
artifacts:
|
|
50583
|
-
workflows:
|
|
50627
|
+
import { z as z6 } from "zod";
|
|
50628
|
+
var GuardrailScopeSchema = z6.object({
|
|
50629
|
+
agents: z6.array(z6.string()).optional(),
|
|
50630
|
+
tasks: z6.array(z6.string()).optional(),
|
|
50631
|
+
tools: z6.array(z6.string()).optional(),
|
|
50632
|
+
artifacts: z6.array(z6.string()).optional(),
|
|
50633
|
+
workflows: z6.array(z6.string()).optional()
|
|
50584
50634
|
}).passthrough();
|
|
50585
|
-
var GuardrailSchema =
|
|
50586
|
-
description:
|
|
50635
|
+
var GuardrailSchema = z6.object({
|
|
50636
|
+
description: z6.string(),
|
|
50587
50637
|
scope: GuardrailScopeSchema,
|
|
50588
|
-
rationale:
|
|
50589
|
-
tags:
|
|
50590
|
-
exemptions:
|
|
50638
|
+
rationale: z6.string().optional(),
|
|
50639
|
+
tags: z6.array(z6.string()).default([]),
|
|
50640
|
+
exemptions: z6.array(z6.string()).optional()
|
|
50591
50641
|
}).passthrough();
|
|
50592
|
-
var GuardrailPolicyRuleEscalationSchema =
|
|
50593
|
-
target:
|
|
50594
|
-
condition:
|
|
50642
|
+
var GuardrailPolicyRuleEscalationSchema = z6.object({
|
|
50643
|
+
target: z6.string(),
|
|
50644
|
+
condition: z6.string().optional()
|
|
50595
50645
|
}).passthrough();
|
|
50596
|
-
var GuardrailPolicyRuleSchema =
|
|
50597
|
-
guardrail:
|
|
50598
|
-
severity:
|
|
50599
|
-
action:
|
|
50600
|
-
allow_override:
|
|
50601
|
-
override_requires:
|
|
50646
|
+
var GuardrailPolicyRuleSchema = z6.object({
|
|
50647
|
+
guardrail: z6.string(),
|
|
50648
|
+
severity: z6.enum(["critical", "mandatory", "warning", "info"]),
|
|
50649
|
+
action: z6.enum(["block", "warn", "shadow", "info"]),
|
|
50650
|
+
allow_override: z6.boolean().default(false),
|
|
50651
|
+
override_requires: z6.array(z6.string()).optional(),
|
|
50602
50652
|
escalation: GuardrailPolicyRuleEscalationSchema.optional()
|
|
50603
50653
|
}).passthrough();
|
|
50604
|
-
var GuardrailPolicySchema =
|
|
50605
|
-
description:
|
|
50606
|
-
rules:
|
|
50654
|
+
var GuardrailPolicySchema = z6.object({
|
|
50655
|
+
description: z6.string().optional(),
|
|
50656
|
+
rules: z6.array(GuardrailPolicyRuleSchema)
|
|
50607
50657
|
}).passthrough();
|
|
50608
50658
|
|
|
50609
50659
|
// src/schema/policy.ts
|
|
50610
|
-
import { z as
|
|
50611
|
-
var PolicyWhenSchema =
|
|
50612
|
-
artifact_type:
|
|
50613
|
-
workflow:
|
|
50660
|
+
import { z as z7 } from "zod";
|
|
50661
|
+
var PolicyWhenSchema = z7.object({
|
|
50662
|
+
artifact_type: z7.string().optional(),
|
|
50663
|
+
workflow: z7.string().optional()
|
|
50614
50664
|
}).passthrough();
|
|
50615
|
-
var PolicySchema =
|
|
50665
|
+
var PolicySchema = z7.object({
|
|
50616
50666
|
when: PolicyWhenSchema,
|
|
50617
|
-
requires_validations:
|
|
50618
|
-
requires:
|
|
50667
|
+
requires_validations: z7.array(z7.string()).optional(),
|
|
50668
|
+
requires: z7.array(z7.string()).optional()
|
|
50619
50669
|
}).passthrough();
|
|
50620
50670
|
|
|
50621
50671
|
// 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
50672
|
import { z as z8 } from "zod";
|
|
50633
|
-
var
|
|
50673
|
+
var VersionLiteralSchema = z8.literal(1);
|
|
50674
|
+
var ExtendsSchema = z8.string().optional();
|
|
50675
|
+
var SystemSchema = z8.object({
|
|
50634
50676
|
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()
|
|
50677
|
+
name: z8.string(),
|
|
50678
|
+
default_workflow_order: z8.array(z8.string())
|
|
50664
50679
|
}).passthrough();
|
|
50665
50680
|
|
|
50666
|
-
// src/schema/
|
|
50681
|
+
// src/schema/task.ts
|
|
50667
50682
|
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(),
|
|
50683
|
+
var ExecutionStepSchema = z9.object({
|
|
50684
|
+
id: z9.string(),
|
|
50685
|
+
action: z9.string(),
|
|
50677
50686
|
description: z9.string().optional(),
|
|
50678
|
-
|
|
50679
|
-
|
|
50680
|
-
|
|
50681
|
-
|
|
50682
|
-
|
|
50687
|
+
required: z9.boolean().optional(),
|
|
50688
|
+
abort_on_failure: z9.boolean().optional(),
|
|
50689
|
+
uses_tool: z9.string().optional(),
|
|
50690
|
+
produces_artifact: z9.string().optional(),
|
|
50691
|
+
reads_artifact: z9.string().optional(),
|
|
50692
|
+
depends_on: z9.array(z9.string()).optional(),
|
|
50693
|
+
skip_condition: z9.string().optional(),
|
|
50694
|
+
wait_for_approval: z9.boolean().optional()
|
|
50695
|
+
}).passthrough();
|
|
50696
|
+
var TaskSchema = z9.object({
|
|
50697
|
+
description: z9.string(),
|
|
50698
|
+
target_agent: z9.string(),
|
|
50699
|
+
allowed_from_agents: z9.array(z9.string()),
|
|
50700
|
+
workflow: z9.string(),
|
|
50701
|
+
input_artifacts: z9.array(z9.string()),
|
|
50702
|
+
invocation_handoff: z9.string(),
|
|
50703
|
+
result_handoff: z9.string(),
|
|
50704
|
+
default_priority: z9.string().optional(),
|
|
50705
|
+
responsibilities: z9.array(z9.string()).optional(),
|
|
50706
|
+
constraints: z9.array(z9.string()).optional(),
|
|
50707
|
+
execution_steps: z9.array(ExecutionStepSchema).optional(),
|
|
50708
|
+
completion_criteria: z9.array(z9.string()).optional(),
|
|
50709
|
+
rules: z9.array(RuleSchema).optional(),
|
|
50710
|
+
anti_patterns: z9.array(z9.string()).optional(),
|
|
50711
|
+
escalation_criteria: z9.array(EscalationCriterionSchema).optional(),
|
|
50712
|
+
validations: z9.array(z9.string()).default([]),
|
|
50683
50713
|
guardrails: z9.array(z9.string()).optional()
|
|
50684
50714
|
}).passthrough();
|
|
50685
50715
|
|
|
50686
|
-
// src/schema/
|
|
50716
|
+
// src/schema/tool.ts
|
|
50687
50717
|
import { z as z10 } from "zod";
|
|
50688
|
-
var
|
|
50689
|
-
|
|
50690
|
-
|
|
50691
|
-
|
|
50692
|
-
|
|
50693
|
-
|
|
50694
|
-
|
|
50718
|
+
var CommandSchema = z10.object({
|
|
50719
|
+
command: z10.string(),
|
|
50720
|
+
category: z10.string(),
|
|
50721
|
+
reads: z10.array(z10.string()).default([]),
|
|
50722
|
+
writes: z10.array(z10.string()).default([]),
|
|
50723
|
+
purpose: z10.string().optional()
|
|
50724
|
+
});
|
|
50725
|
+
var ToolSchema = z10.object({
|
|
50726
|
+
kind: z10.string(),
|
|
50727
|
+
description: z10.string().optional(),
|
|
50728
|
+
input_artifacts: z10.array(z10.string()).default([]),
|
|
50729
|
+
output_artifacts: z10.array(z10.string()).default([]),
|
|
50730
|
+
invokable_by: z10.array(z10.string()),
|
|
50731
|
+
side_effects: z10.array(z10.string()).default([]),
|
|
50732
|
+
commands: z10.array(CommandSchema).default([]),
|
|
50733
|
+
guardrails: z10.array(z10.string()).optional()
|
|
50695
50734
|
}).passthrough();
|
|
50696
50735
|
|
|
50697
|
-
// src/schema/
|
|
50736
|
+
// src/schema/validation.ts
|
|
50698
50737
|
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
|
-
|
|
50738
|
+
var ValidationSchema = z11.object({
|
|
50739
|
+
target_artifact: z11.string(),
|
|
50740
|
+
kind: z11.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
50741
|
+
executor_type: z11.enum(["tool", "agent"]),
|
|
50742
|
+
executor: z11.string(),
|
|
50743
|
+
blocking: z11.boolean(),
|
|
50744
|
+
produces_evidence: z11.string().optional()
|
|
50745
|
+
}).passthrough();
|
|
50746
|
+
|
|
50747
|
+
// src/schema/workflow.ts
|
|
50748
|
+
import { z as z12 } from "zod";
|
|
50749
|
+
var RetrySchema = z12.object({
|
|
50750
|
+
condition: z12.string(),
|
|
50751
|
+
fix_task: z12.string(),
|
|
50752
|
+
revalidate_task: z12.string().optional()
|
|
50753
|
+
});
|
|
50754
|
+
var ExternalParticipantSchema = z12.object({
|
|
50755
|
+
id: z12.string(),
|
|
50756
|
+
kind: z12.enum(["actor", "participant"]),
|
|
50757
|
+
label: z12.string(),
|
|
50758
|
+
description: z12.string().optional()
|
|
50759
|
+
});
|
|
50760
|
+
var WorkflowDelegateStepSchema = z12.object({
|
|
50761
|
+
type: z12.literal("delegate"),
|
|
50762
|
+
description: z12.string().optional(),
|
|
50763
|
+
task: z12.string(),
|
|
50764
|
+
from_agent: z12.string(),
|
|
50765
|
+
group: z12.string().optional(),
|
|
50716
50766
|
retry: RetrySchema.optional()
|
|
50717
50767
|
}).passthrough();
|
|
50718
|
-
var WorkflowGateStepSchema =
|
|
50719
|
-
type:
|
|
50720
|
-
description:
|
|
50721
|
-
gate_kind:
|
|
50722
|
-
group:
|
|
50768
|
+
var WorkflowGateStepSchema = z12.object({
|
|
50769
|
+
type: z12.literal("gate"),
|
|
50770
|
+
description: z12.string().optional(),
|
|
50771
|
+
gate_kind: z12.string(),
|
|
50772
|
+
group: z12.string().optional()
|
|
50723
50773
|
}).passthrough();
|
|
50724
|
-
var WorkflowHandoffStepSchema =
|
|
50725
|
-
type:
|
|
50726
|
-
description:
|
|
50727
|
-
handoff_kind:
|
|
50728
|
-
task:
|
|
50729
|
-
from_agent:
|
|
50730
|
-
group:
|
|
50774
|
+
var WorkflowHandoffStepSchema = z12.object({
|
|
50775
|
+
type: z12.literal("handoff"),
|
|
50776
|
+
description: z12.string().optional(),
|
|
50777
|
+
handoff_kind: z12.string(),
|
|
50778
|
+
task: z12.string().optional(),
|
|
50779
|
+
from_agent: z12.string().optional(),
|
|
50780
|
+
group: z12.string().optional(),
|
|
50731
50781
|
retry: RetrySchema.optional()
|
|
50732
50782
|
}).passthrough();
|
|
50733
|
-
var WorkflowValidationStepSchema =
|
|
50734
|
-
type:
|
|
50735
|
-
description:
|
|
50736
|
-
validation:
|
|
50737
|
-
group:
|
|
50783
|
+
var WorkflowValidationStepSchema = z12.object({
|
|
50784
|
+
type: z12.literal("validation"),
|
|
50785
|
+
description: z12.string().optional(),
|
|
50786
|
+
validation: z12.string(),
|
|
50787
|
+
group: z12.string().optional()
|
|
50738
50788
|
}).passthrough();
|
|
50739
|
-
var WorkflowDecisionStepSchema =
|
|
50740
|
-
type:
|
|
50741
|
-
description:
|
|
50789
|
+
var WorkflowDecisionStepSchema = z12.object({
|
|
50790
|
+
type: z12.literal("decision"),
|
|
50791
|
+
description: z12.string().optional(),
|
|
50742
50792
|
/** @deprecated Use `routing_key` instead. `on` is kept for backward compatibility. */
|
|
50743
|
-
on:
|
|
50744
|
-
routing_key:
|
|
50745
|
-
branches:
|
|
50746
|
-
group:
|
|
50793
|
+
on: z12.string().optional(),
|
|
50794
|
+
routing_key: z12.string().optional(),
|
|
50795
|
+
branches: z12.record(z12.string(), z12.array(z12.string())),
|
|
50796
|
+
group: z12.string().optional()
|
|
50747
50797
|
}).passthrough();
|
|
50748
|
-
var WorkflowStepSchema =
|
|
50798
|
+
var WorkflowStepSchema = z12.discriminatedUnion("type", [
|
|
50749
50799
|
WorkflowDelegateStepSchema,
|
|
50750
50800
|
WorkflowGateStepSchema,
|
|
50751
50801
|
WorkflowHandoffStepSchema,
|
|
50752
50802
|
WorkflowValidationStepSchema,
|
|
50753
50803
|
WorkflowDecisionStepSchema
|
|
50754
50804
|
]);
|
|
50755
|
-
var WorkflowSchema =
|
|
50756
|
-
description:
|
|
50757
|
-
entry_conditions:
|
|
50758
|
-
trigger:
|
|
50759
|
-
steps:
|
|
50760
|
-
external_participants:
|
|
50805
|
+
var WorkflowSchema = z12.object({
|
|
50806
|
+
description: z12.string().optional(),
|
|
50807
|
+
entry_conditions: z12.array(z12.string()).default([]),
|
|
50808
|
+
trigger: z12.string().optional(),
|
|
50809
|
+
steps: z12.array(WorkflowStepSchema),
|
|
50810
|
+
external_participants: z12.array(ExternalParticipantSchema).default([])
|
|
50761
50811
|
}).passthrough();
|
|
50762
50812
|
|
|
50763
50813
|
// src/schema/dsl.ts
|
|
50764
|
-
var ComponentsSchema =
|
|
50765
|
-
schemas:
|
|
50814
|
+
var ComponentsSchema = z13.object({
|
|
50815
|
+
schemas: z13.record(z13.string(), z13.record(z13.string(), z13.any())).default({})
|
|
50766
50816
|
}).passthrough();
|
|
50767
50817
|
var SCOPE_NODE_TYPES = [
|
|
50768
50818
|
"root",
|
|
@@ -50784,32 +50834,32 @@ var SCOPE_NODE_TYPES = [
|
|
|
50784
50834
|
"escalation_criterion",
|
|
50785
50835
|
"prerequisite"
|
|
50786
50836
|
];
|
|
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:
|
|
50837
|
+
var ScopeNodeTypeSchema = z13.enum(SCOPE_NODE_TYPES);
|
|
50838
|
+
var XExtensionDeclSchema = z13.object({
|
|
50839
|
+
type: z13.string(),
|
|
50840
|
+
items: z13.string().optional(),
|
|
50841
|
+
description: z13.string().optional(),
|
|
50842
|
+
scope: z13.array(ScopeNodeTypeSchema).optional(),
|
|
50843
|
+
schema: z13.record(z13.string(), z13.any()).optional(),
|
|
50844
|
+
required: z13.boolean().default(false)
|
|
50845
|
+
});
|
|
50846
|
+
var DslSchema = z13.object({
|
|
50847
|
+
version: z13.literal(1),
|
|
50848
|
+
extends: z13.string().optional(),
|
|
50799
50849
|
system: SystemSchema,
|
|
50800
|
-
agents:
|
|
50801
|
-
tasks:
|
|
50802
|
-
artifacts:
|
|
50803
|
-
tools:
|
|
50804
|
-
validations:
|
|
50805
|
-
handoff_types:
|
|
50806
|
-
workflow:
|
|
50807
|
-
policies:
|
|
50808
|
-
guardrails:
|
|
50809
|
-
guardrail_policies:
|
|
50850
|
+
agents: z13.record(z13.string(), AgentSchema).default({}),
|
|
50851
|
+
tasks: z13.record(z13.string(), TaskSchema).default({}),
|
|
50852
|
+
artifacts: z13.record(z13.string(), ArtifactSchema).default({}),
|
|
50853
|
+
tools: z13.record(z13.string(), ToolSchema).default({}),
|
|
50854
|
+
validations: z13.record(z13.string(), ValidationSchema).default({}),
|
|
50855
|
+
handoff_types: z13.record(z13.string(), HandoffTypeSchema).default({}),
|
|
50856
|
+
workflow: z13.record(z13.string(), WorkflowSchema).default({}),
|
|
50857
|
+
policies: z13.record(z13.string(), PolicySchema).default({}),
|
|
50858
|
+
guardrails: z13.record(z13.string(), GuardrailSchema).default({}),
|
|
50859
|
+
guardrail_policies: z13.record(z13.string(), GuardrailPolicySchema).default({}),
|
|
50810
50860
|
components: ComponentsSchema.default({ schemas: {} }),
|
|
50811
|
-
extensions:
|
|
50812
|
-
extensions_strict:
|
|
50861
|
+
extensions: z13.record(z13.string(), XExtensionDeclSchema).default({}),
|
|
50862
|
+
extensions_strict: z13.boolean().default(false)
|
|
50813
50863
|
}).passthrough();
|
|
50814
50864
|
|
|
50815
50865
|
// src/schema/json-schema-utils.ts
|
|
@@ -50861,22 +50911,22 @@ function resolveAllOf(schema) {
|
|
|
50861
50911
|
}
|
|
50862
50912
|
|
|
50863
50913
|
// src/schema/merge-operators.ts
|
|
50864
|
-
import { z as
|
|
50865
|
-
var AppendOperatorSchema =
|
|
50866
|
-
$append:
|
|
50914
|
+
import { z as z14 } from "zod";
|
|
50915
|
+
var AppendOperatorSchema = z14.object({
|
|
50916
|
+
$append: z14.record(z14.string(), z14.any())
|
|
50867
50917
|
});
|
|
50868
|
-
var PrependOperatorSchema =
|
|
50869
|
-
$prepend:
|
|
50918
|
+
var PrependOperatorSchema = z14.object({
|
|
50919
|
+
$prepend: z14.record(z14.string(), z14.any())
|
|
50870
50920
|
});
|
|
50871
|
-
var InsertAfterOperatorSchema =
|
|
50872
|
-
$insert_after:
|
|
50873
|
-
after:
|
|
50874
|
-
entries:
|
|
50921
|
+
var InsertAfterOperatorSchema = z14.object({
|
|
50922
|
+
$insert_after: z14.object({
|
|
50923
|
+
after: z14.string(),
|
|
50924
|
+
entries: z14.record(z14.string(), z14.any())
|
|
50875
50925
|
})
|
|
50876
50926
|
});
|
|
50877
|
-
var ReplaceOperatorSchema =
|
|
50878
|
-
var RemoveOperatorSchema =
|
|
50879
|
-
$remove:
|
|
50927
|
+
var ReplaceOperatorSchema = z14.object({ $replace: z14.any() });
|
|
50928
|
+
var RemoveOperatorSchema = z14.object({
|
|
50929
|
+
$remove: z14.array(z14.string())
|
|
50880
50930
|
});
|
|
50881
50931
|
|
|
50882
50932
|
// src/config/loader.ts
|
|
@@ -50885,31 +50935,14 @@ import { resolve, dirname } from "path";
|
|
|
50885
50935
|
import { parse as parseYaml } from "yaml";
|
|
50886
50936
|
|
|
50887
50937
|
// 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(),
|
|
50938
|
+
import { z as z15 } from "zod";
|
|
50939
|
+
var RenderTargetSchema = z15.object({
|
|
50940
|
+
template: z15.string(),
|
|
50908
50941
|
context: ContextTypeSchema,
|
|
50909
|
-
output:
|
|
50910
|
-
include:
|
|
50911
|
-
exclude:
|
|
50912
|
-
skip_empty:
|
|
50942
|
+
output: z15.string(),
|
|
50943
|
+
include: z15.array(z15.string()).optional(),
|
|
50944
|
+
exclude: z15.array(z15.string()).optional(),
|
|
50945
|
+
skip_empty: z15.boolean().optional()
|
|
50913
50946
|
}).refine(
|
|
50914
50947
|
(data) => !(data.include && data.exclude),
|
|
50915
50948
|
{ message: "include and exclude are mutually exclusive" }
|
|
@@ -50922,13 +50955,13 @@ var RenderTargetSchema = z14.object({
|
|
|
50922
50955
|
},
|
|
50923
50956
|
{ message: "include/exclude cannot be used with context: system" }
|
|
50924
50957
|
);
|
|
50925
|
-
var AgentContractsConfigSchema =
|
|
50926
|
-
dsl:
|
|
50927
|
-
vars:
|
|
50928
|
-
renders:
|
|
50929
|
-
bindings:
|
|
50930
|
-
active_guardrail_policy:
|
|
50931
|
-
paths:
|
|
50958
|
+
var AgentContractsConfigSchema = z15.object({
|
|
50959
|
+
dsl: z15.string(),
|
|
50960
|
+
vars: z15.record(z15.string(), z15.string()).optional(),
|
|
50961
|
+
renders: z15.array(RenderTargetSchema).default([]),
|
|
50962
|
+
bindings: z15.array(z15.string()).default([]),
|
|
50963
|
+
active_guardrail_policy: z15.string().optional(),
|
|
50964
|
+
paths: z15.record(z15.string(), z15.string()).optional()
|
|
50932
50965
|
});
|
|
50933
50966
|
|
|
50934
50967
|
// src/config/loader.ts
|
|
@@ -51676,11 +51709,12 @@ function expandDefaults(data) {
|
|
|
51676
51709
|
function isRecord3(v2) {
|
|
51677
51710
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
51678
51711
|
}
|
|
51679
|
-
var
|
|
51712
|
+
var BINDING_MAP_MERGE_SECTIONS = ["guardrail_impl", "outputs"];
|
|
51713
|
+
var BINDING_ARRAY_MERGE_SECTIONS = ["renders"];
|
|
51680
51714
|
function mergeBinding(base, project) {
|
|
51681
51715
|
const hasExtends = typeof project["extends"] === "string";
|
|
51682
51716
|
const result = { ...base, ...project };
|
|
51683
|
-
for (const section of
|
|
51717
|
+
for (const section of BINDING_MAP_MERGE_SECTIONS) {
|
|
51684
51718
|
const baseVal = base[section];
|
|
51685
51719
|
const projVal = project[section];
|
|
51686
51720
|
if (projVal === void 0) {
|
|
@@ -51694,6 +51728,14 @@ function mergeBinding(base, project) {
|
|
|
51694
51728
|
hasExtends
|
|
51695
51729
|
);
|
|
51696
51730
|
}
|
|
51731
|
+
for (const section of BINDING_ARRAY_MERGE_SECTIONS) {
|
|
51732
|
+
const baseVal = base[section];
|
|
51733
|
+
const projVal = project[section];
|
|
51734
|
+
if (projVal === void 0) continue;
|
|
51735
|
+
const baseArr = Array.isArray(baseVal) ? baseVal : [];
|
|
51736
|
+
const projArr = Array.isArray(projVal) ? projVal : [];
|
|
51737
|
+
result[section] = [...baseArr, ...projArr];
|
|
51738
|
+
}
|
|
51697
51739
|
if (project["reporting"] !== void 0 && isRecord3(base["reporting"]) && isRecord3(project["reporting"])) {
|
|
51698
51740
|
result["reporting"] = deepMergeEntities(
|
|
51699
51741
|
base["reporting"],
|
|
@@ -51839,16 +51881,16 @@ import { Command as Command2 } from "commander";
|
|
|
51839
51881
|
|
|
51840
51882
|
// src/validator/schema-validator.ts
|
|
51841
51883
|
import Ajv from "ajv";
|
|
51842
|
-
import { z as
|
|
51884
|
+
import { z as z16 } from "zod";
|
|
51843
51885
|
function unwrap(schema) {
|
|
51844
|
-
if (schema instanceof
|
|
51845
|
-
if (schema instanceof
|
|
51846
|
-
if (schema instanceof
|
|
51886
|
+
if (schema instanceof z16.ZodOptional) return unwrap(schema.unwrap());
|
|
51887
|
+
if (schema instanceof z16.ZodDefault) return unwrap(schema.removeDefault());
|
|
51888
|
+
if (schema instanceof z16.ZodNullable) return unwrap(schema.unwrap());
|
|
51847
51889
|
return schema;
|
|
51848
51890
|
}
|
|
51849
51891
|
function checkCustomPropsRecursive(data, schema, path) {
|
|
51850
51892
|
const inner = unwrap(schema);
|
|
51851
|
-
if (inner instanceof
|
|
51893
|
+
if (inner instanceof z16.ZodObject) {
|
|
51852
51894
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51853
51895
|
const obj = data;
|
|
51854
51896
|
const shape = inner.shape;
|
|
@@ -51869,7 +51911,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51869
51911
|
}
|
|
51870
51912
|
return diagnostics;
|
|
51871
51913
|
}
|
|
51872
|
-
if (inner instanceof
|
|
51914
|
+
if (inner instanceof z16.ZodRecord) {
|
|
51873
51915
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51874
51916
|
const valueSchema = inner._def.valueType;
|
|
51875
51917
|
const diagnostics = [];
|
|
@@ -51878,7 +51920,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51878
51920
|
}
|
|
51879
51921
|
return diagnostics;
|
|
51880
51922
|
}
|
|
51881
|
-
if (inner instanceof
|
|
51923
|
+
if (inner instanceof z16.ZodArray) {
|
|
51882
51924
|
if (!Array.isArray(data)) return [];
|
|
51883
51925
|
const diagnostics = [];
|
|
51884
51926
|
for (let i3 = 0; i3 < data.length; i3++) {
|
|
@@ -51886,14 +51928,14 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51886
51928
|
}
|
|
51887
51929
|
return diagnostics;
|
|
51888
51930
|
}
|
|
51889
|
-
if (inner instanceof
|
|
51931
|
+
if (inner instanceof z16.ZodDiscriminatedUnion) {
|
|
51890
51932
|
if (typeof data !== "object" || data === null) return [];
|
|
51891
51933
|
const obj = data;
|
|
51892
51934
|
const disc = inner._def.discriminator;
|
|
51893
51935
|
const discValue = obj[disc];
|
|
51894
51936
|
const match = inner.options.find((opt) => {
|
|
51895
51937
|
const shape = opt.shape;
|
|
51896
|
-
return shape[disc] instanceof
|
|
51938
|
+
return shape[disc] instanceof z16.ZodLiteral && shape[disc].value === discValue;
|
|
51897
51939
|
});
|
|
51898
51940
|
if (match) return checkCustomPropsRecursive(data, match, path);
|
|
51899
51941
|
return [];
|
|
@@ -56150,7 +56192,7 @@ async function generateGuardrails(options) {
|
|
|
56150
56192
|
if (filterBindings && !filterBindings.includes(binding.software)) {
|
|
56151
56193
|
continue;
|
|
56152
56194
|
}
|
|
56153
|
-
if (!binding.outputs) continue;
|
|
56195
|
+
if (!binding.outputs && !binding.renders) continue;
|
|
56154
56196
|
const checkResult = resolveChecks(dsl, binding, policy);
|
|
56155
56197
|
diagnostics.push(...checkResult.diagnostics);
|
|
56156
56198
|
const ctx = {
|
|
@@ -56162,9 +56204,14 @@ async function generateGuardrails(options) {
|
|
|
56162
56204
|
vars,
|
|
56163
56205
|
paths,
|
|
56164
56206
|
reporting,
|
|
56165
|
-
resolved_checks: checkResult.resolved
|
|
56166
|
-
|
|
56167
|
-
|
|
56207
|
+
resolved_checks: checkResult.resolved,
|
|
56208
|
+
tasks: dsl.tasks,
|
|
56209
|
+
artifacts: dsl.artifacts,
|
|
56210
|
+
agents: dsl.agents,
|
|
56211
|
+
handoff_types: dsl.handoff_types,
|
|
56212
|
+
workflow: dsl.workflow
|
|
56213
|
+
};
|
|
56214
|
+
for (const [outputId, outputDef] of Object.entries(binding.outputs ?? {})) {
|
|
56168
56215
|
const pathResult = resolveBindingTargetPath(
|
|
56169
56216
|
outputDef.target,
|
|
56170
56217
|
paths,
|
|
@@ -56294,9 +56341,98 @@ async function generateGuardrails(options) {
|
|
|
56294
56341
|
}
|
|
56295
56342
|
}
|
|
56296
56343
|
}
|
|
56344
|
+
for (const renderTarget of binding.renders ?? []) {
|
|
56345
|
+
let templateContent;
|
|
56346
|
+
if (renderTarget.inline_template) {
|
|
56347
|
+
templateContent = renderTarget.inline_template;
|
|
56348
|
+
} else if (renderTarget.template) {
|
|
56349
|
+
const templatePath = resolve6(config.configDir, renderTarget.template);
|
|
56350
|
+
try {
|
|
56351
|
+
templateContent = await readFile5(templatePath, "utf8");
|
|
56352
|
+
} catch {
|
|
56353
|
+
diagnostics.push({
|
|
56354
|
+
path: `binding.${binding.software}.renders`,
|
|
56355
|
+
message: `Template file not found: ${templatePath}`,
|
|
56356
|
+
severity: "error"
|
|
56357
|
+
});
|
|
56358
|
+
continue;
|
|
56359
|
+
}
|
|
56360
|
+
} else {
|
|
56361
|
+
diagnostics.push({
|
|
56362
|
+
path: `binding.${binding.software}.renders`,
|
|
56363
|
+
message: "Render target has neither template nor inline_template",
|
|
56364
|
+
severity: "error"
|
|
56365
|
+
});
|
|
56366
|
+
continue;
|
|
56367
|
+
}
|
|
56368
|
+
const compiled = Handlebars2.compile(templateContent, { noEscape: true });
|
|
56369
|
+
const shouldSkipEmpty = renderTarget.skip_empty === true;
|
|
56370
|
+
const context = renderTarget.context;
|
|
56371
|
+
if (context === "system") {
|
|
56372
|
+
const sysCtx = buildSystemContext(dsl);
|
|
56373
|
+
const mergedCtx = { ...sysCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56374
|
+
const rendered = compiled(mergedCtx);
|
|
56375
|
+
const resolvedOutput = resolveBindingRenderOutputPath(renderTarget.output, paths);
|
|
56376
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56377
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56378
|
+
if (!dryRun) {
|
|
56379
|
+
try {
|
|
56380
|
+
await unlink2(outputPath);
|
|
56381
|
+
} catch {
|
|
56382
|
+
}
|
|
56383
|
+
}
|
|
56384
|
+
continue;
|
|
56385
|
+
}
|
|
56386
|
+
if (!dryRun) {
|
|
56387
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56388
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56389
|
+
if (renderTarget.executable) {
|
|
56390
|
+
await chmod(outputPath, 493);
|
|
56391
|
+
}
|
|
56392
|
+
}
|
|
56393
|
+
outputFiles.push(outputPath);
|
|
56394
|
+
} else {
|
|
56395
|
+
const section = getDslSection(dsl, context);
|
|
56396
|
+
const allIds = Object.keys(section);
|
|
56397
|
+
const ids = filterIds(allIds, renderTarget.include, renderTarget.exclude);
|
|
56398
|
+
for (const entityId of ids) {
|
|
56399
|
+
const entityCtx = buildEntityContext(dsl, context, entityId);
|
|
56400
|
+
const mergedCtx = { ...entityCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56401
|
+
const rendered = compiled(mergedCtx);
|
|
56402
|
+
const resolvedOutput = resolveBindingRenderOutputPath(
|
|
56403
|
+
expandOutputPath(renderTarget.output, context, entityId),
|
|
56404
|
+
paths
|
|
56405
|
+
);
|
|
56406
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56407
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56408
|
+
if (!dryRun) {
|
|
56409
|
+
try {
|
|
56410
|
+
await unlink2(outputPath);
|
|
56411
|
+
} catch {
|
|
56412
|
+
}
|
|
56413
|
+
}
|
|
56414
|
+
continue;
|
|
56415
|
+
}
|
|
56416
|
+
if (!dryRun) {
|
|
56417
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56418
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56419
|
+
if (renderTarget.executable) {
|
|
56420
|
+
await chmod(outputPath, 493);
|
|
56421
|
+
}
|
|
56422
|
+
}
|
|
56423
|
+
outputFiles.push(outputPath);
|
|
56424
|
+
}
|
|
56425
|
+
}
|
|
56426
|
+
}
|
|
56297
56427
|
}
|
|
56298
56428
|
return { outputFiles, diagnostics };
|
|
56299
56429
|
}
|
|
56430
|
+
function resolveBindingRenderOutputPath(output, paths) {
|
|
56431
|
+
return output.replace(/\{(\w+)\}/g, (match, varName) => {
|
|
56432
|
+
const value = paths[varName];
|
|
56433
|
+
return value !== void 0 ? value : match;
|
|
56434
|
+
});
|
|
56435
|
+
}
|
|
56300
56436
|
|
|
56301
56437
|
// src/cli/commands/generate-guardrails.ts
|
|
56302
56438
|
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(
|