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/index.js
CHANGED
|
@@ -6292,7 +6292,7 @@ var init_index_es = __esm({
|
|
|
6292
6292
|
return { drive: t4.toLowerCase() + ":" };
|
|
6293
6293
|
}, k2 = function() {
|
|
6294
6294
|
return { drive: null };
|
|
6295
|
-
},
|
|
6295
|
+
}, z18 = function() {
|
|
6296
6296
|
return { drive: null };
|
|
6297
6297
|
}, B2 = function(t4) {
|
|
6298
6298
|
return { protocol: null, origin: null, absolute: false, drive: null, ...t4 };
|
|
@@ -6333,7 +6333,7 @@ var init_index_es = __esm({
|
|
|
6333
6333
|
var t4, n4, r4, e4, o4;
|
|
6334
6334
|
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() {
|
|
6335
6335
|
var t5;
|
|
6336
|
-
return (t5 = x3) !== c2 && (t5 =
|
|
6336
|
+
return (t5 = x3) !== c2 && (t5 = z18()), t5;
|
|
6337
6337
|
})()) !== c2 ? (n4 = f2(n4, r4, e4), t4 = n4) : (K2 = t4, t4 = c2)), t4;
|
|
6338
6338
|
})()) === c2 && (n3 = (function() {
|
|
6339
6339
|
var n4, r4, e4, o4;
|
|
@@ -8022,7 +8022,7 @@ __export(index_es_exports2, {
|
|
|
8022
8022
|
resolveExternalRef: () => ye,
|
|
8023
8023
|
resolveExternalRefWithLocation: () => ge,
|
|
8024
8024
|
resolveInlineRef: () => B,
|
|
8025
|
-
resolveInlineRefWithLocation: () =>
|
|
8025
|
+
resolveInlineRefWithLocation: () => z16,
|
|
8026
8026
|
safeParse: () => de,
|
|
8027
8027
|
safeStringify: () => ve,
|
|
8028
8028
|
startsWith: () => be,
|
|
@@ -8066,9 +8066,9 @@ function* L(e3, t3, r3) {
|
|
|
8066
8066
|
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]);
|
|
8067
8067
|
}
|
|
8068
8068
|
function B(e3, t3) {
|
|
8069
|
-
return
|
|
8069
|
+
return z16(e3, t3).value;
|
|
8070
8070
|
}
|
|
8071
|
-
function
|
|
8071
|
+
function z16(e3, t3) {
|
|
8072
8072
|
return (function e4(t4, r3, n3, o3) {
|
|
8073
8073
|
if (null !== V(r3)) throw new ReferenceError("Cannot resolve external references");
|
|
8074
8074
|
const i3 = K(r3);
|
|
@@ -16898,7 +16898,7 @@ var require_immer_cjs_production_min = __commonJS({
|
|
|
16898
16898
|
var t4 = n4[H2];
|
|
16899
16899
|
return (t4 ? s2(t4) : n4)[r4];
|
|
16900
16900
|
}
|
|
16901
|
-
function
|
|
16901
|
+
function z18(n4, r4) {
|
|
16902
16902
|
if (r4 in n4) for (var t4 = Object.getPrototypeOf(n4); t4; ) {
|
|
16903
16903
|
var e4 = Object.getOwnPropertyDescriptor(t4, r4);
|
|
16904
16904
|
if (e4) return e4;
|
|
@@ -17291,7 +17291,7 @@ var require_immer_cjs_production_min = __commonJS({
|
|
|
17291
17291
|
if (r4 === H2) return n4;
|
|
17292
17292
|
var e4 = s2(n4);
|
|
17293
17293
|
if (!u2(e4, r4)) return (function(n5, r5, t4) {
|
|
17294
|
-
var e5, i5 =
|
|
17294
|
+
var e5, i5 = z18(r5, t4);
|
|
17295
17295
|
return i5 ? "value" in i5 ? i5.value : null === (e5 = i5.get) || void 0 === e5 ? void 0 : e5.call(n5.k) : void 0;
|
|
17296
17296
|
})(n4, e4, r4);
|
|
17297
17297
|
var i4 = e4[r4];
|
|
@@ -17301,7 +17301,7 @@ var require_immer_cjs_production_min = __commonJS({
|
|
|
17301
17301
|
}, ownKeys: function(n4) {
|
|
17302
17302
|
return Reflect.ownKeys(s2(n4));
|
|
17303
17303
|
}, set: function(n4, r4, t4) {
|
|
17304
|
-
var e4 =
|
|
17304
|
+
var e4 = z18(s2(n4), r4);
|
|
17305
17305
|
if (null == e4 ? void 0 : e4.set) return e4.set.call(n4.k, t4), true;
|
|
17306
17306
|
if (!n4.g) {
|
|
17307
17307
|
var i4 = A2(s2(n4), r4), o4 = null == i4 ? void 0 : i4[H2];
|
|
@@ -35640,11 +35640,11 @@ var require_brace_expansion = __commonJS({
|
|
|
35640
35640
|
if (pad) {
|
|
35641
35641
|
var need = width - c2.length;
|
|
35642
35642
|
if (need > 0) {
|
|
35643
|
-
var
|
|
35643
|
+
var z18 = new Array(need + 1).join("0");
|
|
35644
35644
|
if (i3 < 0)
|
|
35645
|
-
c2 = "-" +
|
|
35645
|
+
c2 = "-" + z18 + c2.slice(1);
|
|
35646
35646
|
else
|
|
35647
|
-
c2 =
|
|
35647
|
+
c2 = z18 + c2;
|
|
35648
35648
|
}
|
|
35649
35649
|
}
|
|
35650
35650
|
}
|
|
@@ -49168,7 +49168,7 @@ var require_dist10 = __commonJS({
|
|
|
49168
49168
|
var getSiblings = (parent) => (node) => getChildren(parent).filter(not(eq(node)));
|
|
49169
49169
|
var concatAll = (
|
|
49170
49170
|
/*::<T>*/
|
|
49171
|
-
(xs) => (ys) => ys.reduce((zs,
|
|
49171
|
+
(xs) => (ys) => ys.reduce((zs, z18) => zs.concat(z18), xs)
|
|
49172
49172
|
);
|
|
49173
49173
|
function getLastSegment(instancePath) {
|
|
49174
49174
|
const index4 = instancePath.lastIndexOf("/");
|
|
@@ -50463,6 +50463,12 @@ var AgentSchema = z.object({
|
|
|
50463
50463
|
rules: z.array(RuleSchema).optional(),
|
|
50464
50464
|
anti_patterns: z.array(z.string()).optional(),
|
|
50465
50465
|
escalation_criteria: z.array(EscalationCriterionSchema).optional(),
|
|
50466
|
+
sections: z.array(
|
|
50467
|
+
z.object({
|
|
50468
|
+
title: z.string(),
|
|
50469
|
+
content: z.string()
|
|
50470
|
+
})
|
|
50471
|
+
).optional(),
|
|
50466
50472
|
prerequisites: z.array(PrerequisiteSchema).optional(),
|
|
50467
50473
|
guardrails: z.array(z.string()).optional()
|
|
50468
50474
|
}).passthrough();
|
|
@@ -50483,44 +50489,66 @@ var ArtifactSchema = z2.object({
|
|
|
50483
50489
|
}).passthrough();
|
|
50484
50490
|
|
|
50485
50491
|
// src/schema/binding.ts
|
|
50492
|
+
import { z as z4 } from "zod";
|
|
50493
|
+
|
|
50494
|
+
// src/schema/context-type.ts
|
|
50486
50495
|
import { z as z3 } from "zod";
|
|
50487
|
-
var
|
|
50488
|
-
|
|
50489
|
-
|
|
50496
|
+
var CONTEXT_TYPES = [
|
|
50497
|
+
"agent",
|
|
50498
|
+
"task",
|
|
50499
|
+
"artifact",
|
|
50500
|
+
"tool",
|
|
50501
|
+
"validation",
|
|
50502
|
+
"handoff_type",
|
|
50503
|
+
"workflow",
|
|
50504
|
+
"policy",
|
|
50505
|
+
"guardrail",
|
|
50506
|
+
"guardrail_policy",
|
|
50507
|
+
"system"
|
|
50508
|
+
];
|
|
50509
|
+
var ContextTypeSchema = z3.enum(CONTEXT_TYPES);
|
|
50510
|
+
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
50511
|
+
(t3) => t3 !== "system"
|
|
50512
|
+
);
|
|
50513
|
+
|
|
50514
|
+
// src/schema/binding.ts
|
|
50515
|
+
var CommandRegexMatcherSchema = z4.object({
|
|
50516
|
+
type: z4.literal("command_regex"),
|
|
50517
|
+
pattern: z4.string()
|
|
50490
50518
|
}).passthrough();
|
|
50491
|
-
var ContentRegexMatcherSchema =
|
|
50492
|
-
type:
|
|
50493
|
-
pattern:
|
|
50494
|
-
file_glob:
|
|
50495
|
-
exclude_glob:
|
|
50519
|
+
var ContentRegexMatcherSchema = z4.object({
|
|
50520
|
+
type: z4.literal("content_regex"),
|
|
50521
|
+
pattern: z4.string(),
|
|
50522
|
+
file_glob: z4.string().optional(),
|
|
50523
|
+
exclude_glob: z4.string().optional()
|
|
50496
50524
|
}).passthrough();
|
|
50497
|
-
var FileGlobMatcherSchema =
|
|
50498
|
-
type:
|
|
50499
|
-
pattern:
|
|
50500
|
-
exclude_glob:
|
|
50525
|
+
var FileGlobMatcherSchema = z4.object({
|
|
50526
|
+
type: z4.literal("file_glob"),
|
|
50527
|
+
pattern: z4.string(),
|
|
50528
|
+
exclude_glob: z4.string().optional()
|
|
50501
50529
|
}).passthrough();
|
|
50502
|
-
var MatcherSchema =
|
|
50530
|
+
var MatcherSchema = z4.discriminatedUnion("type", [
|
|
50503
50531
|
CommandRegexMatcherSchema,
|
|
50504
50532
|
ContentRegexMatcherSchema,
|
|
50505
50533
|
FileGlobMatcherSchema
|
|
50506
50534
|
]);
|
|
50507
|
-
var CheckSchema =
|
|
50535
|
+
var CheckSchema = z4.object({
|
|
50508
50536
|
matcher: MatcherSchema.optional(),
|
|
50509
|
-
script:
|
|
50510
|
-
message:
|
|
50537
|
+
script: z4.string().optional(),
|
|
50538
|
+
message: z4.string().optional()
|
|
50511
50539
|
}).passthrough();
|
|
50512
|
-
var BindingOutputSchema =
|
|
50513
|
-
target:
|
|
50514
|
-
template:
|
|
50515
|
-
inline_template:
|
|
50516
|
-
source:
|
|
50517
|
-
mode:
|
|
50518
|
-
format:
|
|
50519
|
-
patch_strategy:
|
|
50520
|
-
array_merge_key:
|
|
50521
|
-
group_by:
|
|
50522
|
-
executable:
|
|
50523
|
-
skip_empty:
|
|
50540
|
+
var BindingOutputSchema = z4.object({
|
|
50541
|
+
target: z4.string(),
|
|
50542
|
+
template: z4.string().optional(),
|
|
50543
|
+
inline_template: z4.string().optional(),
|
|
50544
|
+
source: z4.string().optional(),
|
|
50545
|
+
mode: z4.enum(["write", "patch"]).default("write"),
|
|
50546
|
+
format: z4.enum(["json", "yaml", "text"]).optional(),
|
|
50547
|
+
patch_strategy: z4.enum(["deep_merge", "append"]).optional(),
|
|
50548
|
+
array_merge_key: z4.string().optional(),
|
|
50549
|
+
group_by: z4.string().optional(),
|
|
50550
|
+
executable: z4.boolean().optional(),
|
|
50551
|
+
skip_empty: z4.boolean().optional()
|
|
50524
50552
|
}).passthrough().refine(
|
|
50525
50553
|
(data) => {
|
|
50526
50554
|
const count = [data.template, data.inline_template, data.source].filter(Boolean).length;
|
|
@@ -50528,225 +50556,253 @@ var BindingOutputSchema = z3.object({
|
|
|
50528
50556
|
},
|
|
50529
50557
|
{ message: "Only one of template, inline_template, or source may be specified" }
|
|
50530
50558
|
);
|
|
50531
|
-
var ReportingSchema =
|
|
50532
|
-
commands:
|
|
50533
|
-
fail_open:
|
|
50534
|
-
timeout_ms:
|
|
50559
|
+
var ReportingSchema = z4.object({
|
|
50560
|
+
commands: z4.record(z4.string(), z4.string()),
|
|
50561
|
+
fail_open: z4.boolean().default(true),
|
|
50562
|
+
timeout_ms: z4.number().default(5e3)
|
|
50535
50563
|
}).passthrough();
|
|
50536
|
-
var GuardrailImplSchema =
|
|
50537
|
-
checks:
|
|
50538
|
-
});
|
|
50539
|
-
var
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50564
|
+
var GuardrailImplSchema = z4.object({
|
|
50565
|
+
checks: z4.array(CheckSchema)
|
|
50566
|
+
});
|
|
50567
|
+
var BindingRenderTargetSchema = z4.object({
|
|
50568
|
+
template: z4.string().optional(),
|
|
50569
|
+
inline_template: z4.string().optional(),
|
|
50570
|
+
context: ContextTypeSchema,
|
|
50571
|
+
output: z4.string(),
|
|
50572
|
+
include: z4.array(z4.string()).optional(),
|
|
50573
|
+
exclude: z4.array(z4.string()).optional(),
|
|
50574
|
+
skip_empty: z4.boolean().optional(),
|
|
50575
|
+
executable: z4.boolean().optional()
|
|
50576
|
+
}).passthrough().refine(
|
|
50577
|
+
(data) => {
|
|
50578
|
+
const count = [data.template, data.inline_template].filter(Boolean).length;
|
|
50579
|
+
return count === 1;
|
|
50580
|
+
},
|
|
50581
|
+
{ message: "Exactly one of template or inline_template must be specified" }
|
|
50582
|
+
).refine(
|
|
50583
|
+
(data) => !(data.include && data.exclude),
|
|
50584
|
+
{ message: "include and exclude are mutually exclusive" }
|
|
50585
|
+
).refine(
|
|
50586
|
+
(data) => {
|
|
50587
|
+
if (data.context === "system" && (data.include || data.exclude)) {
|
|
50588
|
+
return false;
|
|
50589
|
+
}
|
|
50590
|
+
return true;
|
|
50591
|
+
},
|
|
50592
|
+
{ message: "include/exclude cannot be used with context: system" }
|
|
50593
|
+
);
|
|
50594
|
+
var SoftwareBindingSchema = z4.object({
|
|
50595
|
+
software: z4.string(),
|
|
50596
|
+
version: z4.literal(1),
|
|
50597
|
+
extends: z4.string().optional(),
|
|
50598
|
+
guardrail_impl: z4.record(z4.string(), GuardrailImplSchema).optional(),
|
|
50599
|
+
outputs: z4.record(z4.string(), BindingOutputSchema).optional(),
|
|
50600
|
+
renders: z4.array(BindingRenderTargetSchema).optional(),
|
|
50545
50601
|
reporting: ReportingSchema.optional()
|
|
50546
50602
|
}).passthrough();
|
|
50547
50603
|
|
|
50548
50604
|
// src/schema/dsl.ts
|
|
50549
|
-
import { z as
|
|
50605
|
+
import { z as z13 } from "zod";
|
|
50550
50606
|
|
|
50551
50607
|
// src/schema/handoff-type.ts
|
|
50552
|
-
import { z as
|
|
50553
|
-
var HandoffTypeSchema =
|
|
50554
|
-
version:
|
|
50555
|
-
description:
|
|
50556
|
-
schema:
|
|
50557
|
-
example:
|
|
50608
|
+
import { z as z5 } from "zod";
|
|
50609
|
+
var HandoffTypeSchema = z5.object({
|
|
50610
|
+
version: z5.number(),
|
|
50611
|
+
description: z5.string().optional(),
|
|
50612
|
+
schema: z5.record(z5.string(), z5.any()),
|
|
50613
|
+
example: z5.record(z5.string(), z5.any()).optional()
|
|
50558
50614
|
}).passthrough();
|
|
50559
50615
|
|
|
50560
50616
|
// src/schema/guardrail.ts
|
|
50561
|
-
import { z as
|
|
50562
|
-
var GuardrailScopeSchema =
|
|
50563
|
-
agents:
|
|
50564
|
-
tasks:
|
|
50565
|
-
tools:
|
|
50566
|
-
artifacts:
|
|
50567
|
-
workflows:
|
|
50617
|
+
import { z as z6 } from "zod";
|
|
50618
|
+
var GuardrailScopeSchema = z6.object({
|
|
50619
|
+
agents: z6.array(z6.string()).optional(),
|
|
50620
|
+
tasks: z6.array(z6.string()).optional(),
|
|
50621
|
+
tools: z6.array(z6.string()).optional(),
|
|
50622
|
+
artifacts: z6.array(z6.string()).optional(),
|
|
50623
|
+
workflows: z6.array(z6.string()).optional()
|
|
50568
50624
|
}).passthrough();
|
|
50569
|
-
var GuardrailSchema =
|
|
50570
|
-
description:
|
|
50625
|
+
var GuardrailSchema = z6.object({
|
|
50626
|
+
description: z6.string(),
|
|
50571
50627
|
scope: GuardrailScopeSchema,
|
|
50572
|
-
rationale:
|
|
50573
|
-
tags:
|
|
50574
|
-
exemptions:
|
|
50628
|
+
rationale: z6.string().optional(),
|
|
50629
|
+
tags: z6.array(z6.string()).default([]),
|
|
50630
|
+
exemptions: z6.array(z6.string()).optional()
|
|
50575
50631
|
}).passthrough();
|
|
50576
|
-
var GuardrailPolicyRuleEscalationSchema =
|
|
50577
|
-
target:
|
|
50578
|
-
condition:
|
|
50632
|
+
var GuardrailPolicyRuleEscalationSchema = z6.object({
|
|
50633
|
+
target: z6.string(),
|
|
50634
|
+
condition: z6.string().optional()
|
|
50579
50635
|
}).passthrough();
|
|
50580
|
-
var GuardrailPolicyRuleSchema =
|
|
50581
|
-
guardrail:
|
|
50582
|
-
severity:
|
|
50583
|
-
action:
|
|
50584
|
-
allow_override:
|
|
50585
|
-
override_requires:
|
|
50636
|
+
var GuardrailPolicyRuleSchema = z6.object({
|
|
50637
|
+
guardrail: z6.string(),
|
|
50638
|
+
severity: z6.enum(["critical", "mandatory", "warning", "info"]),
|
|
50639
|
+
action: z6.enum(["block", "warn", "shadow", "info"]),
|
|
50640
|
+
allow_override: z6.boolean().default(false),
|
|
50641
|
+
override_requires: z6.array(z6.string()).optional(),
|
|
50586
50642
|
escalation: GuardrailPolicyRuleEscalationSchema.optional()
|
|
50587
50643
|
}).passthrough();
|
|
50588
|
-
var GuardrailPolicySchema =
|
|
50589
|
-
description:
|
|
50590
|
-
rules:
|
|
50644
|
+
var GuardrailPolicySchema = z6.object({
|
|
50645
|
+
description: z6.string().optional(),
|
|
50646
|
+
rules: z6.array(GuardrailPolicyRuleSchema)
|
|
50591
50647
|
}).passthrough();
|
|
50592
50648
|
|
|
50593
50649
|
// src/schema/policy.ts
|
|
50594
|
-
import { z as
|
|
50595
|
-
var PolicyWhenSchema =
|
|
50596
|
-
artifact_type:
|
|
50597
|
-
workflow:
|
|
50650
|
+
import { z as z7 } from "zod";
|
|
50651
|
+
var PolicyWhenSchema = z7.object({
|
|
50652
|
+
artifact_type: z7.string().optional(),
|
|
50653
|
+
workflow: z7.string().optional()
|
|
50598
50654
|
}).passthrough();
|
|
50599
|
-
var PolicySchema =
|
|
50655
|
+
var PolicySchema = z7.object({
|
|
50600
50656
|
when: PolicyWhenSchema,
|
|
50601
|
-
requires_validations:
|
|
50602
|
-
requires:
|
|
50657
|
+
requires_validations: z7.array(z7.string()).optional(),
|
|
50658
|
+
requires: z7.array(z7.string()).optional()
|
|
50603
50659
|
}).passthrough();
|
|
50604
50660
|
|
|
50605
50661
|
// src/schema/system.ts
|
|
50606
|
-
import { z as z7 } from "zod";
|
|
50607
|
-
var VersionLiteralSchema = z7.literal(1);
|
|
50608
|
-
var ExtendsSchema = z7.string().optional();
|
|
50609
|
-
var SystemSchema = z7.object({
|
|
50610
|
-
id: z7.string(),
|
|
50611
|
-
name: z7.string(),
|
|
50612
|
-
default_workflow_order: z7.array(z7.string())
|
|
50613
|
-
}).passthrough();
|
|
50614
|
-
|
|
50615
|
-
// src/schema/task.ts
|
|
50616
50662
|
import { z as z8 } from "zod";
|
|
50617
|
-
var
|
|
50663
|
+
var VersionLiteralSchema = z8.literal(1);
|
|
50664
|
+
var ExtendsSchema = z8.string().optional();
|
|
50665
|
+
var SystemSchema = z8.object({
|
|
50618
50666
|
id: z8.string(),
|
|
50619
|
-
|
|
50620
|
-
|
|
50621
|
-
required: z8.boolean().optional(),
|
|
50622
|
-
abort_on_failure: z8.boolean().optional(),
|
|
50623
|
-
uses_tool: z8.string().optional(),
|
|
50624
|
-
produces_artifact: z8.string().optional(),
|
|
50625
|
-
reads_artifact: z8.string().optional(),
|
|
50626
|
-
depends_on: z8.array(z8.string()).optional(),
|
|
50627
|
-
skip_condition: z8.string().optional(),
|
|
50628
|
-
wait_for_approval: z8.boolean().optional()
|
|
50629
|
-
}).passthrough();
|
|
50630
|
-
var TaskSchema = z8.object({
|
|
50631
|
-
description: z8.string(),
|
|
50632
|
-
target_agent: z8.string(),
|
|
50633
|
-
allowed_from_agents: z8.array(z8.string()),
|
|
50634
|
-
workflow: z8.string(),
|
|
50635
|
-
input_artifacts: z8.array(z8.string()),
|
|
50636
|
-
invocation_handoff: z8.string(),
|
|
50637
|
-
result_handoff: z8.string(),
|
|
50638
|
-
default_priority: z8.string().optional(),
|
|
50639
|
-
responsibilities: z8.array(z8.string()).optional(),
|
|
50640
|
-
constraints: z8.array(z8.string()).optional(),
|
|
50641
|
-
execution_steps: z8.array(ExecutionStepSchema).optional(),
|
|
50642
|
-
completion_criteria: z8.array(z8.string()).optional(),
|
|
50643
|
-
rules: z8.array(RuleSchema).optional(),
|
|
50644
|
-
anti_patterns: z8.array(z8.string()).optional(),
|
|
50645
|
-
escalation_criteria: z8.array(EscalationCriterionSchema).optional(),
|
|
50646
|
-
validations: z8.array(z8.string()).default([]),
|
|
50647
|
-
guardrails: z8.array(z8.string()).optional()
|
|
50667
|
+
name: z8.string(),
|
|
50668
|
+
default_workflow_order: z8.array(z8.string())
|
|
50648
50669
|
}).passthrough();
|
|
50649
50670
|
|
|
50650
|
-
// src/schema/
|
|
50671
|
+
// src/schema/task.ts
|
|
50651
50672
|
import { z as z9 } from "zod";
|
|
50652
|
-
var
|
|
50653
|
-
|
|
50654
|
-
|
|
50655
|
-
reads: z9.array(z9.string()).default([]),
|
|
50656
|
-
writes: z9.array(z9.string()).default([]),
|
|
50657
|
-
purpose: z9.string().optional()
|
|
50658
|
-
});
|
|
50659
|
-
var ToolSchema = z9.object({
|
|
50660
|
-
kind: z9.string(),
|
|
50673
|
+
var ExecutionStepSchema = z9.object({
|
|
50674
|
+
id: z9.string(),
|
|
50675
|
+
action: z9.string(),
|
|
50661
50676
|
description: z9.string().optional(),
|
|
50662
|
-
|
|
50663
|
-
|
|
50664
|
-
|
|
50665
|
-
|
|
50666
|
-
|
|
50677
|
+
required: z9.boolean().optional(),
|
|
50678
|
+
abort_on_failure: z9.boolean().optional(),
|
|
50679
|
+
uses_tool: z9.string().optional(),
|
|
50680
|
+
produces_artifact: z9.string().optional(),
|
|
50681
|
+
reads_artifact: z9.string().optional(),
|
|
50682
|
+
depends_on: z9.array(z9.string()).optional(),
|
|
50683
|
+
skip_condition: z9.string().optional(),
|
|
50684
|
+
wait_for_approval: z9.boolean().optional()
|
|
50685
|
+
}).passthrough();
|
|
50686
|
+
var TaskSchema = z9.object({
|
|
50687
|
+
description: z9.string(),
|
|
50688
|
+
target_agent: z9.string(),
|
|
50689
|
+
allowed_from_agents: z9.array(z9.string()),
|
|
50690
|
+
workflow: z9.string(),
|
|
50691
|
+
input_artifacts: z9.array(z9.string()),
|
|
50692
|
+
invocation_handoff: z9.string(),
|
|
50693
|
+
result_handoff: z9.string(),
|
|
50694
|
+
default_priority: z9.string().optional(),
|
|
50695
|
+
responsibilities: z9.array(z9.string()).optional(),
|
|
50696
|
+
constraints: z9.array(z9.string()).optional(),
|
|
50697
|
+
execution_steps: z9.array(ExecutionStepSchema).optional(),
|
|
50698
|
+
completion_criteria: z9.array(z9.string()).optional(),
|
|
50699
|
+
rules: z9.array(RuleSchema).optional(),
|
|
50700
|
+
anti_patterns: z9.array(z9.string()).optional(),
|
|
50701
|
+
escalation_criteria: z9.array(EscalationCriterionSchema).optional(),
|
|
50702
|
+
validations: z9.array(z9.string()).default([]),
|
|
50667
50703
|
guardrails: z9.array(z9.string()).optional()
|
|
50668
50704
|
}).passthrough();
|
|
50669
50705
|
|
|
50670
|
-
// src/schema/
|
|
50706
|
+
// src/schema/tool.ts
|
|
50671
50707
|
import { z as z10 } from "zod";
|
|
50672
|
-
var
|
|
50673
|
-
|
|
50674
|
-
|
|
50675
|
-
|
|
50676
|
-
|
|
50677
|
-
|
|
50678
|
-
|
|
50708
|
+
var CommandSchema = z10.object({
|
|
50709
|
+
command: z10.string(),
|
|
50710
|
+
category: z10.string(),
|
|
50711
|
+
reads: z10.array(z10.string()).default([]),
|
|
50712
|
+
writes: z10.array(z10.string()).default([]),
|
|
50713
|
+
purpose: z10.string().optional()
|
|
50714
|
+
});
|
|
50715
|
+
var ToolSchema = z10.object({
|
|
50716
|
+
kind: z10.string(),
|
|
50717
|
+
description: z10.string().optional(),
|
|
50718
|
+
input_artifacts: z10.array(z10.string()).default([]),
|
|
50719
|
+
output_artifacts: z10.array(z10.string()).default([]),
|
|
50720
|
+
invokable_by: z10.array(z10.string()),
|
|
50721
|
+
side_effects: z10.array(z10.string()).default([]),
|
|
50722
|
+
commands: z10.array(CommandSchema).default([]),
|
|
50723
|
+
guardrails: z10.array(z10.string()).optional()
|
|
50679
50724
|
}).passthrough();
|
|
50680
50725
|
|
|
50681
|
-
// src/schema/
|
|
50726
|
+
// src/schema/validation.ts
|
|
50682
50727
|
import { z as z11 } from "zod";
|
|
50683
|
-
var
|
|
50684
|
-
|
|
50685
|
-
|
|
50686
|
-
|
|
50687
|
-
|
|
50688
|
-
|
|
50689
|
-
|
|
50690
|
-
|
|
50691
|
-
|
|
50692
|
-
|
|
50693
|
-
}
|
|
50694
|
-
var
|
|
50695
|
-
|
|
50696
|
-
|
|
50697
|
-
|
|
50698
|
-
|
|
50699
|
-
|
|
50728
|
+
var ValidationSchema = z11.object({
|
|
50729
|
+
target_artifact: z11.string(),
|
|
50730
|
+
kind: z11.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
50731
|
+
executor_type: z11.enum(["tool", "agent"]),
|
|
50732
|
+
executor: z11.string(),
|
|
50733
|
+
blocking: z11.boolean(),
|
|
50734
|
+
produces_evidence: z11.string().optional()
|
|
50735
|
+
}).passthrough();
|
|
50736
|
+
|
|
50737
|
+
// src/schema/workflow.ts
|
|
50738
|
+
import { z as z12 } from "zod";
|
|
50739
|
+
var RetrySchema = z12.object({
|
|
50740
|
+
condition: z12.string(),
|
|
50741
|
+
fix_task: z12.string(),
|
|
50742
|
+
revalidate_task: z12.string().optional()
|
|
50743
|
+
});
|
|
50744
|
+
var ExternalParticipantSchema = z12.object({
|
|
50745
|
+
id: z12.string(),
|
|
50746
|
+
kind: z12.enum(["actor", "participant"]),
|
|
50747
|
+
label: z12.string(),
|
|
50748
|
+
description: z12.string().optional()
|
|
50749
|
+
});
|
|
50750
|
+
var WorkflowDelegateStepSchema = z12.object({
|
|
50751
|
+
type: z12.literal("delegate"),
|
|
50752
|
+
description: z12.string().optional(),
|
|
50753
|
+
task: z12.string(),
|
|
50754
|
+
from_agent: z12.string(),
|
|
50755
|
+
group: z12.string().optional(),
|
|
50700
50756
|
retry: RetrySchema.optional()
|
|
50701
50757
|
}).passthrough();
|
|
50702
|
-
var WorkflowGateStepSchema =
|
|
50703
|
-
type:
|
|
50704
|
-
description:
|
|
50705
|
-
gate_kind:
|
|
50706
|
-
group:
|
|
50758
|
+
var WorkflowGateStepSchema = z12.object({
|
|
50759
|
+
type: z12.literal("gate"),
|
|
50760
|
+
description: z12.string().optional(),
|
|
50761
|
+
gate_kind: z12.string(),
|
|
50762
|
+
group: z12.string().optional()
|
|
50707
50763
|
}).passthrough();
|
|
50708
|
-
var WorkflowHandoffStepSchema =
|
|
50709
|
-
type:
|
|
50710
|
-
description:
|
|
50711
|
-
handoff_kind:
|
|
50712
|
-
task:
|
|
50713
|
-
from_agent:
|
|
50714
|
-
group:
|
|
50764
|
+
var WorkflowHandoffStepSchema = z12.object({
|
|
50765
|
+
type: z12.literal("handoff"),
|
|
50766
|
+
description: z12.string().optional(),
|
|
50767
|
+
handoff_kind: z12.string(),
|
|
50768
|
+
task: z12.string().optional(),
|
|
50769
|
+
from_agent: z12.string().optional(),
|
|
50770
|
+
group: z12.string().optional(),
|
|
50715
50771
|
retry: RetrySchema.optional()
|
|
50716
50772
|
}).passthrough();
|
|
50717
|
-
var WorkflowValidationStepSchema =
|
|
50718
|
-
type:
|
|
50719
|
-
description:
|
|
50720
|
-
validation:
|
|
50721
|
-
group:
|
|
50773
|
+
var WorkflowValidationStepSchema = z12.object({
|
|
50774
|
+
type: z12.literal("validation"),
|
|
50775
|
+
description: z12.string().optional(),
|
|
50776
|
+
validation: z12.string(),
|
|
50777
|
+
group: z12.string().optional()
|
|
50722
50778
|
}).passthrough();
|
|
50723
|
-
var WorkflowDecisionStepSchema =
|
|
50724
|
-
type:
|
|
50725
|
-
description:
|
|
50779
|
+
var WorkflowDecisionStepSchema = z12.object({
|
|
50780
|
+
type: z12.literal("decision"),
|
|
50781
|
+
description: z12.string().optional(),
|
|
50726
50782
|
/** @deprecated Use `routing_key` instead. `on` is kept for backward compatibility. */
|
|
50727
|
-
on:
|
|
50728
|
-
routing_key:
|
|
50729
|
-
branches:
|
|
50730
|
-
group:
|
|
50783
|
+
on: z12.string().optional(),
|
|
50784
|
+
routing_key: z12.string().optional(),
|
|
50785
|
+
branches: z12.record(z12.string(), z12.array(z12.string())),
|
|
50786
|
+
group: z12.string().optional()
|
|
50731
50787
|
}).passthrough();
|
|
50732
|
-
var WorkflowStepSchema =
|
|
50788
|
+
var WorkflowStepSchema = z12.discriminatedUnion("type", [
|
|
50733
50789
|
WorkflowDelegateStepSchema,
|
|
50734
50790
|
WorkflowGateStepSchema,
|
|
50735
50791
|
WorkflowHandoffStepSchema,
|
|
50736
50792
|
WorkflowValidationStepSchema,
|
|
50737
50793
|
WorkflowDecisionStepSchema
|
|
50738
50794
|
]);
|
|
50739
|
-
var WorkflowSchema =
|
|
50740
|
-
description:
|
|
50741
|
-
entry_conditions:
|
|
50742
|
-
trigger:
|
|
50743
|
-
steps:
|
|
50744
|
-
external_participants:
|
|
50795
|
+
var WorkflowSchema = z12.object({
|
|
50796
|
+
description: z12.string().optional(),
|
|
50797
|
+
entry_conditions: z12.array(z12.string()).default([]),
|
|
50798
|
+
trigger: z12.string().optional(),
|
|
50799
|
+
steps: z12.array(WorkflowStepSchema),
|
|
50800
|
+
external_participants: z12.array(ExternalParticipantSchema).default([])
|
|
50745
50801
|
}).passthrough();
|
|
50746
50802
|
|
|
50747
50803
|
// src/schema/dsl.ts
|
|
50748
|
-
var ComponentsSchema =
|
|
50749
|
-
schemas:
|
|
50804
|
+
var ComponentsSchema = z13.object({
|
|
50805
|
+
schemas: z13.record(z13.string(), z13.record(z13.string(), z13.any())).default({})
|
|
50750
50806
|
}).passthrough();
|
|
50751
50807
|
var SCOPE_NODE_TYPES = [
|
|
50752
50808
|
"root",
|
|
@@ -50768,32 +50824,32 @@ var SCOPE_NODE_TYPES = [
|
|
|
50768
50824
|
"escalation_criterion",
|
|
50769
50825
|
"prerequisite"
|
|
50770
50826
|
];
|
|
50771
|
-
var ScopeNodeTypeSchema =
|
|
50772
|
-
var XExtensionDeclSchema =
|
|
50773
|
-
type:
|
|
50774
|
-
items:
|
|
50775
|
-
description:
|
|
50776
|
-
scope:
|
|
50777
|
-
schema:
|
|
50778
|
-
required:
|
|
50779
|
-
});
|
|
50780
|
-
var DslSchema =
|
|
50781
|
-
version:
|
|
50782
|
-
extends:
|
|
50827
|
+
var ScopeNodeTypeSchema = z13.enum(SCOPE_NODE_TYPES);
|
|
50828
|
+
var XExtensionDeclSchema = z13.object({
|
|
50829
|
+
type: z13.string(),
|
|
50830
|
+
items: z13.string().optional(),
|
|
50831
|
+
description: z13.string().optional(),
|
|
50832
|
+
scope: z13.array(ScopeNodeTypeSchema).optional(),
|
|
50833
|
+
schema: z13.record(z13.string(), z13.any()).optional(),
|
|
50834
|
+
required: z13.boolean().default(false)
|
|
50835
|
+
});
|
|
50836
|
+
var DslSchema = z13.object({
|
|
50837
|
+
version: z13.literal(1),
|
|
50838
|
+
extends: z13.string().optional(),
|
|
50783
50839
|
system: SystemSchema,
|
|
50784
|
-
agents:
|
|
50785
|
-
tasks:
|
|
50786
|
-
artifacts:
|
|
50787
|
-
tools:
|
|
50788
|
-
validations:
|
|
50789
|
-
handoff_types:
|
|
50790
|
-
workflow:
|
|
50791
|
-
policies:
|
|
50792
|
-
guardrails:
|
|
50793
|
-
guardrail_policies:
|
|
50840
|
+
agents: z13.record(z13.string(), AgentSchema).default({}),
|
|
50841
|
+
tasks: z13.record(z13.string(), TaskSchema).default({}),
|
|
50842
|
+
artifacts: z13.record(z13.string(), ArtifactSchema).default({}),
|
|
50843
|
+
tools: z13.record(z13.string(), ToolSchema).default({}),
|
|
50844
|
+
validations: z13.record(z13.string(), ValidationSchema).default({}),
|
|
50845
|
+
handoff_types: z13.record(z13.string(), HandoffTypeSchema).default({}),
|
|
50846
|
+
workflow: z13.record(z13.string(), WorkflowSchema).default({}),
|
|
50847
|
+
policies: z13.record(z13.string(), PolicySchema).default({}),
|
|
50848
|
+
guardrails: z13.record(z13.string(), GuardrailSchema).default({}),
|
|
50849
|
+
guardrail_policies: z13.record(z13.string(), GuardrailPolicySchema).default({}),
|
|
50794
50850
|
components: ComponentsSchema.default({ schemas: {} }),
|
|
50795
|
-
extensions:
|
|
50796
|
-
extensions_strict:
|
|
50851
|
+
extensions: z13.record(z13.string(), XExtensionDeclSchema).default({}),
|
|
50852
|
+
extensions_strict: z13.boolean().default(false)
|
|
50797
50853
|
}).passthrough();
|
|
50798
50854
|
|
|
50799
50855
|
// src/schema/json-schema-utils.ts
|
|
@@ -50845,22 +50901,22 @@ function resolveAllOf(schema) {
|
|
|
50845
50901
|
}
|
|
50846
50902
|
|
|
50847
50903
|
// src/schema/merge-operators.ts
|
|
50848
|
-
import { z as
|
|
50849
|
-
var AppendOperatorSchema =
|
|
50850
|
-
$append:
|
|
50904
|
+
import { z as z14 } from "zod";
|
|
50905
|
+
var AppendOperatorSchema = z14.object({
|
|
50906
|
+
$append: z14.record(z14.string(), z14.any())
|
|
50851
50907
|
});
|
|
50852
|
-
var PrependOperatorSchema =
|
|
50853
|
-
$prepend:
|
|
50908
|
+
var PrependOperatorSchema = z14.object({
|
|
50909
|
+
$prepend: z14.record(z14.string(), z14.any())
|
|
50854
50910
|
});
|
|
50855
|
-
var InsertAfterOperatorSchema =
|
|
50856
|
-
$insert_after:
|
|
50857
|
-
after:
|
|
50858
|
-
entries:
|
|
50911
|
+
var InsertAfterOperatorSchema = z14.object({
|
|
50912
|
+
$insert_after: z14.object({
|
|
50913
|
+
after: z14.string(),
|
|
50914
|
+
entries: z14.record(z14.string(), z14.any())
|
|
50859
50915
|
})
|
|
50860
50916
|
});
|
|
50861
|
-
var ReplaceOperatorSchema =
|
|
50862
|
-
var RemoveOperatorSchema =
|
|
50863
|
-
$remove:
|
|
50917
|
+
var ReplaceOperatorSchema = z14.object({ $replace: z14.any() });
|
|
50918
|
+
var RemoveOperatorSchema = z14.object({
|
|
50919
|
+
$remove: z14.array(z14.string())
|
|
50864
50920
|
});
|
|
50865
50921
|
|
|
50866
50922
|
// src/loader/loader.ts
|
|
@@ -51476,16 +51532,16 @@ function expandDefaults(data) {
|
|
|
51476
51532
|
|
|
51477
51533
|
// src/validator/schema-validator.ts
|
|
51478
51534
|
import Ajv from "ajv";
|
|
51479
|
-
import { z as
|
|
51535
|
+
import { z as z15 } from "zod";
|
|
51480
51536
|
function unwrap(schema) {
|
|
51481
|
-
if (schema instanceof
|
|
51482
|
-
if (schema instanceof
|
|
51483
|
-
if (schema instanceof
|
|
51537
|
+
if (schema instanceof z15.ZodOptional) return unwrap(schema.unwrap());
|
|
51538
|
+
if (schema instanceof z15.ZodDefault) return unwrap(schema.removeDefault());
|
|
51539
|
+
if (schema instanceof z15.ZodNullable) return unwrap(schema.unwrap());
|
|
51484
51540
|
return schema;
|
|
51485
51541
|
}
|
|
51486
51542
|
function checkCustomPropsRecursive(data, schema, path) {
|
|
51487
51543
|
const inner = unwrap(schema);
|
|
51488
|
-
if (inner instanceof
|
|
51544
|
+
if (inner instanceof z15.ZodObject) {
|
|
51489
51545
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51490
51546
|
const obj = data;
|
|
51491
51547
|
const shape = inner.shape;
|
|
@@ -51506,7 +51562,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51506
51562
|
}
|
|
51507
51563
|
return diagnostics;
|
|
51508
51564
|
}
|
|
51509
|
-
if (inner instanceof
|
|
51565
|
+
if (inner instanceof z15.ZodRecord) {
|
|
51510
51566
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51511
51567
|
const valueSchema = inner._def.valueType;
|
|
51512
51568
|
const diagnostics = [];
|
|
@@ -51515,7 +51571,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51515
51571
|
}
|
|
51516
51572
|
return diagnostics;
|
|
51517
51573
|
}
|
|
51518
|
-
if (inner instanceof
|
|
51574
|
+
if (inner instanceof z15.ZodArray) {
|
|
51519
51575
|
if (!Array.isArray(data)) return [];
|
|
51520
51576
|
const diagnostics = [];
|
|
51521
51577
|
for (let i3 = 0; i3 < data.length; i3++) {
|
|
@@ -51523,14 +51579,14 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51523
51579
|
}
|
|
51524
51580
|
return diagnostics;
|
|
51525
51581
|
}
|
|
51526
|
-
if (inner instanceof
|
|
51582
|
+
if (inner instanceof z15.ZodDiscriminatedUnion) {
|
|
51527
51583
|
if (typeof data !== "object" || data === null) return [];
|
|
51528
51584
|
const obj = data;
|
|
51529
51585
|
const disc = inner._def.discriminator;
|
|
51530
51586
|
const discValue = obj[disc];
|
|
51531
51587
|
const match = inner.options.find((opt) => {
|
|
51532
51588
|
const shape = opt.shape;
|
|
51533
|
-
return shape[disc] instanceof
|
|
51589
|
+
return shape[disc] instanceof z15.ZodLiteral && shape[disc].value === discValue;
|
|
51534
51590
|
});
|
|
51535
51591
|
if (match) return checkCustomPropsRecursive(data, match, path);
|
|
51536
51592
|
return [];
|
|
@@ -55339,31 +55395,14 @@ import { resolve as resolve4, dirname as dirname4 } from "path";
|
|
|
55339
55395
|
import { parse as parseYaml2 } from "yaml";
|
|
55340
55396
|
|
|
55341
55397
|
// src/config/types.ts
|
|
55342
|
-
import { z as
|
|
55343
|
-
var
|
|
55344
|
-
|
|
55345
|
-
"task",
|
|
55346
|
-
"artifact",
|
|
55347
|
-
"tool",
|
|
55348
|
-
"validation",
|
|
55349
|
-
"handoff_type",
|
|
55350
|
-
"workflow",
|
|
55351
|
-
"policy",
|
|
55352
|
-
"guardrail",
|
|
55353
|
-
"guardrail_policy",
|
|
55354
|
-
"system"
|
|
55355
|
-
];
|
|
55356
|
-
var ContextTypeSchema = z16.enum(CONTEXT_TYPES);
|
|
55357
|
-
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
55358
|
-
(t3) => t3 !== "system"
|
|
55359
|
-
);
|
|
55360
|
-
var RenderTargetSchema = z16.object({
|
|
55361
|
-
template: z16.string(),
|
|
55398
|
+
import { z as z17 } from "zod";
|
|
55399
|
+
var RenderTargetSchema = z17.object({
|
|
55400
|
+
template: z17.string(),
|
|
55362
55401
|
context: ContextTypeSchema,
|
|
55363
|
-
output:
|
|
55364
|
-
include:
|
|
55365
|
-
exclude:
|
|
55366
|
-
skip_empty:
|
|
55402
|
+
output: z17.string(),
|
|
55403
|
+
include: z17.array(z17.string()).optional(),
|
|
55404
|
+
exclude: z17.array(z17.string()).optional(),
|
|
55405
|
+
skip_empty: z17.boolean().optional()
|
|
55367
55406
|
}).refine(
|
|
55368
55407
|
(data) => !(data.include && data.exclude),
|
|
55369
55408
|
{ message: "include and exclude are mutually exclusive" }
|
|
@@ -55376,13 +55415,13 @@ var RenderTargetSchema = z16.object({
|
|
|
55376
55415
|
},
|
|
55377
55416
|
{ message: "include/exclude cannot be used with context: system" }
|
|
55378
55417
|
);
|
|
55379
|
-
var AgentContractsConfigSchema =
|
|
55380
|
-
dsl:
|
|
55381
|
-
vars:
|
|
55382
|
-
renders:
|
|
55383
|
-
bindings:
|
|
55384
|
-
active_guardrail_policy:
|
|
55385
|
-
paths:
|
|
55418
|
+
var AgentContractsConfigSchema = z17.object({
|
|
55419
|
+
dsl: z17.string(),
|
|
55420
|
+
vars: z17.record(z17.string(), z17.string()).optional(),
|
|
55421
|
+
renders: z17.array(RenderTargetSchema).default([]),
|
|
55422
|
+
bindings: z17.array(z17.string()).default([]),
|
|
55423
|
+
active_guardrail_policy: z17.string().optional(),
|
|
55424
|
+
paths: z17.record(z17.string(), z17.string()).optional()
|
|
55386
55425
|
});
|
|
55387
55426
|
|
|
55388
55427
|
// src/config/loader.ts
|
|
@@ -55473,11 +55512,12 @@ function resolveDslPath(dirArg, dirArgDefault, config) {
|
|
|
55473
55512
|
function isRecord4(v2) {
|
|
55474
55513
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
55475
55514
|
}
|
|
55476
|
-
var
|
|
55515
|
+
var BINDING_MAP_MERGE_SECTIONS = ["guardrail_impl", "outputs"];
|
|
55516
|
+
var BINDING_ARRAY_MERGE_SECTIONS = ["renders"];
|
|
55477
55517
|
function mergeBinding(base, project) {
|
|
55478
55518
|
const hasExtends = typeof project["extends"] === "string";
|
|
55479
55519
|
const result = { ...base, ...project };
|
|
55480
|
-
for (const section of
|
|
55520
|
+
for (const section of BINDING_MAP_MERGE_SECTIONS) {
|
|
55481
55521
|
const baseVal = base[section];
|
|
55482
55522
|
const projVal = project[section];
|
|
55483
55523
|
if (projVal === void 0) {
|
|
@@ -55491,6 +55531,14 @@ function mergeBinding(base, project) {
|
|
|
55491
55531
|
hasExtends
|
|
55492
55532
|
);
|
|
55493
55533
|
}
|
|
55534
|
+
for (const section of BINDING_ARRAY_MERGE_SECTIONS) {
|
|
55535
|
+
const baseVal = base[section];
|
|
55536
|
+
const projVal = project[section];
|
|
55537
|
+
if (projVal === void 0) continue;
|
|
55538
|
+
const baseArr = Array.isArray(baseVal) ? baseVal : [];
|
|
55539
|
+
const projArr = Array.isArray(projVal) ? projVal : [];
|
|
55540
|
+
result[section] = [...baseArr, ...projArr];
|
|
55541
|
+
}
|
|
55494
55542
|
if (project["reporting"] !== void 0 && isRecord4(base["reporting"]) && isRecord4(project["reporting"])) {
|
|
55495
55543
|
result["reporting"] = deepMergeEntities(
|
|
55496
55544
|
base["reporting"],
|
|
@@ -56113,7 +56161,7 @@ async function generateGuardrails(options) {
|
|
|
56113
56161
|
if (filterBindings && !filterBindings.includes(binding.software)) {
|
|
56114
56162
|
continue;
|
|
56115
56163
|
}
|
|
56116
|
-
if (!binding.outputs) continue;
|
|
56164
|
+
if (!binding.outputs && !binding.renders) continue;
|
|
56117
56165
|
const checkResult = resolveChecks(dsl, binding, policy);
|
|
56118
56166
|
diagnostics.push(...checkResult.diagnostics);
|
|
56119
56167
|
const ctx = {
|
|
@@ -56125,9 +56173,14 @@ async function generateGuardrails(options) {
|
|
|
56125
56173
|
vars,
|
|
56126
56174
|
paths,
|
|
56127
56175
|
reporting,
|
|
56128
|
-
resolved_checks: checkResult.resolved
|
|
56129
|
-
|
|
56130
|
-
|
|
56176
|
+
resolved_checks: checkResult.resolved,
|
|
56177
|
+
tasks: dsl.tasks,
|
|
56178
|
+
artifacts: dsl.artifacts,
|
|
56179
|
+
agents: dsl.agents,
|
|
56180
|
+
handoff_types: dsl.handoff_types,
|
|
56181
|
+
workflow: dsl.workflow
|
|
56182
|
+
};
|
|
56183
|
+
for (const [outputId, outputDef] of Object.entries(binding.outputs ?? {})) {
|
|
56131
56184
|
const pathResult = resolveBindingTargetPath(
|
|
56132
56185
|
outputDef.target,
|
|
56133
56186
|
paths,
|
|
@@ -56257,9 +56310,98 @@ async function generateGuardrails(options) {
|
|
|
56257
56310
|
}
|
|
56258
56311
|
}
|
|
56259
56312
|
}
|
|
56313
|
+
for (const renderTarget of binding.renders ?? []) {
|
|
56314
|
+
let templateContent;
|
|
56315
|
+
if (renderTarget.inline_template) {
|
|
56316
|
+
templateContent = renderTarget.inline_template;
|
|
56317
|
+
} else if (renderTarget.template) {
|
|
56318
|
+
const templatePath = resolve6(config.configDir, renderTarget.template);
|
|
56319
|
+
try {
|
|
56320
|
+
templateContent = await readFile5(templatePath, "utf8");
|
|
56321
|
+
} catch {
|
|
56322
|
+
diagnostics.push({
|
|
56323
|
+
path: `binding.${binding.software}.renders`,
|
|
56324
|
+
message: `Template file not found: ${templatePath}`,
|
|
56325
|
+
severity: "error"
|
|
56326
|
+
});
|
|
56327
|
+
continue;
|
|
56328
|
+
}
|
|
56329
|
+
} else {
|
|
56330
|
+
diagnostics.push({
|
|
56331
|
+
path: `binding.${binding.software}.renders`,
|
|
56332
|
+
message: "Render target has neither template nor inline_template",
|
|
56333
|
+
severity: "error"
|
|
56334
|
+
});
|
|
56335
|
+
continue;
|
|
56336
|
+
}
|
|
56337
|
+
const compiled = Handlebars2.compile(templateContent, { noEscape: true });
|
|
56338
|
+
const shouldSkipEmpty = renderTarget.skip_empty === true;
|
|
56339
|
+
const context = renderTarget.context;
|
|
56340
|
+
if (context === "system") {
|
|
56341
|
+
const sysCtx = buildSystemContext(dsl);
|
|
56342
|
+
const mergedCtx = { ...sysCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56343
|
+
const rendered = compiled(mergedCtx);
|
|
56344
|
+
const resolvedOutput = resolveBindingRenderOutputPath(renderTarget.output, paths);
|
|
56345
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56346
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56347
|
+
if (!dryRun) {
|
|
56348
|
+
try {
|
|
56349
|
+
await unlink2(outputPath);
|
|
56350
|
+
} catch {
|
|
56351
|
+
}
|
|
56352
|
+
}
|
|
56353
|
+
continue;
|
|
56354
|
+
}
|
|
56355
|
+
if (!dryRun) {
|
|
56356
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56357
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56358
|
+
if (renderTarget.executable) {
|
|
56359
|
+
await chmod(outputPath, 493);
|
|
56360
|
+
}
|
|
56361
|
+
}
|
|
56362
|
+
outputFiles.push(outputPath);
|
|
56363
|
+
} else {
|
|
56364
|
+
const section = getDslSection(dsl, context);
|
|
56365
|
+
const allIds = Object.keys(section);
|
|
56366
|
+
const ids = filterIds(allIds, renderTarget.include, renderTarget.exclude);
|
|
56367
|
+
for (const entityId of ids) {
|
|
56368
|
+
const entityCtx = buildEntityContext(dsl, context, entityId);
|
|
56369
|
+
const mergedCtx = { ...entityCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56370
|
+
const rendered = compiled(mergedCtx);
|
|
56371
|
+
const resolvedOutput = resolveBindingRenderOutputPath(
|
|
56372
|
+
expandOutputPath(renderTarget.output, context, entityId),
|
|
56373
|
+
paths
|
|
56374
|
+
);
|
|
56375
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56376
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56377
|
+
if (!dryRun) {
|
|
56378
|
+
try {
|
|
56379
|
+
await unlink2(outputPath);
|
|
56380
|
+
} catch {
|
|
56381
|
+
}
|
|
56382
|
+
}
|
|
56383
|
+
continue;
|
|
56384
|
+
}
|
|
56385
|
+
if (!dryRun) {
|
|
56386
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56387
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56388
|
+
if (renderTarget.executable) {
|
|
56389
|
+
await chmod(outputPath, 493);
|
|
56390
|
+
}
|
|
56391
|
+
}
|
|
56392
|
+
outputFiles.push(outputPath);
|
|
56393
|
+
}
|
|
56394
|
+
}
|
|
56395
|
+
}
|
|
56260
56396
|
}
|
|
56261
56397
|
return { outputFiles, diagnostics };
|
|
56262
56398
|
}
|
|
56399
|
+
function resolveBindingRenderOutputPath(output, paths) {
|
|
56400
|
+
return output.replace(/\{(\w+)\}/g, (match, varName) => {
|
|
56401
|
+
const value = paths[varName];
|
|
56402
|
+
return value !== void 0 ? value : match;
|
|
56403
|
+
});
|
|
56404
|
+
}
|
|
56263
56405
|
export {
|
|
56264
56406
|
AgentContractsConfigSchema,
|
|
56265
56407
|
AgentSchema,
|
|
@@ -56267,6 +56409,7 @@ export {
|
|
|
56267
56409
|
ArtifactSchema,
|
|
56268
56410
|
BaseResolveError,
|
|
56269
56411
|
BindingOutputSchema,
|
|
56412
|
+
BindingRenderTargetSchema,
|
|
56270
56413
|
CONTEXT_TYPES,
|
|
56271
56414
|
CheckSchema,
|
|
56272
56415
|
CommandSchema,
|
|
@@ -56284,6 +56427,7 @@ export {
|
|
|
56284
56427
|
GuardrailSchema,
|
|
56285
56428
|
GuardrailScopeSchema,
|
|
56286
56429
|
HandoffTypeSchema,
|
|
56430
|
+
ITERABLE_CONTEXT_TYPES,
|
|
56287
56431
|
InsertAfterOperatorSchema,
|
|
56288
56432
|
MatcherSchema,
|
|
56289
56433
|
MergeError,
|