agent-contracts 0.12.4 → 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 +120 -12
- package/dist/cli.js +1104 -322
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +156 -34
- package/dist/index.js +1091 -319
- 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("/");
|
|
@@ -49863,7 +49863,7 @@ var require_dist12 = __commonJS({
|
|
|
49863
49863
|
var draft4MetaSchema = require_json_schema_draft_04();
|
|
49864
49864
|
var META_SUPPORT_DATA = ["/properties"];
|
|
49865
49865
|
var META_SCHEMA_ID = "http://json-schema.org/draft-04/schema";
|
|
49866
|
-
var
|
|
49866
|
+
var Ajv3 = class extends core_1.default {
|
|
49867
49867
|
constructor(opts = {}) {
|
|
49868
49868
|
super({
|
|
49869
49869
|
...opts,
|
|
@@ -49888,9 +49888,9 @@ var require_dist12 = __commonJS({
|
|
|
49888
49888
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
|
|
49889
49889
|
}
|
|
49890
49890
|
};
|
|
49891
|
-
module.exports = exports =
|
|
49891
|
+
module.exports = exports = Ajv3;
|
|
49892
49892
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49893
|
-
exports.default =
|
|
49893
|
+
exports.default = Ajv3;
|
|
49894
49894
|
var core_2 = __require("ajv/dist/core");
|
|
49895
49895
|
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
|
|
49896
49896
|
return core_2.KeywordCxt;
|
|
@@ -50087,8 +50087,8 @@ var require_ajv2 = __commonJS({
|
|
|
50087
50087
|
log: console.log,
|
|
50088
50088
|
error: console.error
|
|
50089
50089
|
};
|
|
50090
|
-
function createAjvInstance(
|
|
50091
|
-
const ajv2 = new
|
|
50090
|
+
function createAjvInstance(Ajv3, allErrors) {
|
|
50091
|
+
const ajv2 = new Ajv3({
|
|
50092
50092
|
allErrors,
|
|
50093
50093
|
meta: true,
|
|
50094
50094
|
messages: true,
|
|
@@ -50101,22 +50101,22 @@ var require_ajv2 = __commonJS({
|
|
|
50101
50101
|
if (allErrors) {
|
|
50102
50102
|
(0, ajv_errors_1.default)(ajv2);
|
|
50103
50103
|
}
|
|
50104
|
-
if (
|
|
50104
|
+
if (Ajv3 === ajv_1.default) {
|
|
50105
50105
|
ajv2.addSchema(draft4MetaSchema);
|
|
50106
50106
|
ajv2.addSchema(draft6MetaSchema);
|
|
50107
50107
|
}
|
|
50108
50108
|
return ajv2;
|
|
50109
50109
|
}
|
|
50110
|
-
function _createAjvInstances(
|
|
50110
|
+
function _createAjvInstances(Ajv3) {
|
|
50111
50111
|
let _default;
|
|
50112
50112
|
let _allErrors;
|
|
50113
50113
|
return {
|
|
50114
50114
|
get default() {
|
|
50115
|
-
_default !== null && _default !== void 0 ? _default : _default = createAjvInstance(
|
|
50115
|
+
_default !== null && _default !== void 0 ? _default : _default = createAjvInstance(Ajv3, false);
|
|
50116
50116
|
return _default;
|
|
50117
50117
|
},
|
|
50118
50118
|
get allErrors() {
|
|
50119
|
-
_allErrors !== null && _allErrors !== void 0 ? _allErrors : _allErrors = createAjvInstance(
|
|
50119
|
+
_allErrors !== null && _allErrors !== void 0 ? _allErrors : _allErrors = createAjvInstance(Ajv3, true);
|
|
50120
50120
|
return _allErrors;
|
|
50121
50121
|
}
|
|
50122
50122
|
};
|
|
@@ -50483,44 +50483,66 @@ var ArtifactSchema = z2.object({
|
|
|
50483
50483
|
}).passthrough();
|
|
50484
50484
|
|
|
50485
50485
|
// src/schema/binding.ts
|
|
50486
|
+
import { z as z4 } from "zod";
|
|
50487
|
+
|
|
50488
|
+
// src/schema/context-type.ts
|
|
50486
50489
|
import { z as z3 } from "zod";
|
|
50487
|
-
var
|
|
50488
|
-
|
|
50489
|
-
|
|
50490
|
+
var CONTEXT_TYPES = [
|
|
50491
|
+
"agent",
|
|
50492
|
+
"task",
|
|
50493
|
+
"artifact",
|
|
50494
|
+
"tool",
|
|
50495
|
+
"validation",
|
|
50496
|
+
"handoff_type",
|
|
50497
|
+
"workflow",
|
|
50498
|
+
"policy",
|
|
50499
|
+
"guardrail",
|
|
50500
|
+
"guardrail_policy",
|
|
50501
|
+
"system"
|
|
50502
|
+
];
|
|
50503
|
+
var ContextTypeSchema = z3.enum(CONTEXT_TYPES);
|
|
50504
|
+
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
50505
|
+
(t3) => t3 !== "system"
|
|
50506
|
+
);
|
|
50507
|
+
|
|
50508
|
+
// src/schema/binding.ts
|
|
50509
|
+
var CommandRegexMatcherSchema = z4.object({
|
|
50510
|
+
type: z4.literal("command_regex"),
|
|
50511
|
+
pattern: z4.string()
|
|
50490
50512
|
}).passthrough();
|
|
50491
|
-
var ContentRegexMatcherSchema =
|
|
50492
|
-
type:
|
|
50493
|
-
pattern:
|
|
50494
|
-
file_glob:
|
|
50495
|
-
exclude_glob:
|
|
50513
|
+
var ContentRegexMatcherSchema = z4.object({
|
|
50514
|
+
type: z4.literal("content_regex"),
|
|
50515
|
+
pattern: z4.string(),
|
|
50516
|
+
file_glob: z4.string().optional(),
|
|
50517
|
+
exclude_glob: z4.string().optional()
|
|
50496
50518
|
}).passthrough();
|
|
50497
|
-
var FileGlobMatcherSchema =
|
|
50498
|
-
type:
|
|
50499
|
-
pattern:
|
|
50500
|
-
exclude_glob:
|
|
50519
|
+
var FileGlobMatcherSchema = z4.object({
|
|
50520
|
+
type: z4.literal("file_glob"),
|
|
50521
|
+
pattern: z4.string(),
|
|
50522
|
+
exclude_glob: z4.string().optional()
|
|
50501
50523
|
}).passthrough();
|
|
50502
|
-
var MatcherSchema =
|
|
50524
|
+
var MatcherSchema = z4.discriminatedUnion("type", [
|
|
50503
50525
|
CommandRegexMatcherSchema,
|
|
50504
50526
|
ContentRegexMatcherSchema,
|
|
50505
50527
|
FileGlobMatcherSchema
|
|
50506
50528
|
]);
|
|
50507
|
-
var CheckSchema =
|
|
50529
|
+
var CheckSchema = z4.object({
|
|
50508
50530
|
matcher: MatcherSchema.optional(),
|
|
50509
|
-
script:
|
|
50510
|
-
message:
|
|
50531
|
+
script: z4.string().optional(),
|
|
50532
|
+
message: z4.string().optional()
|
|
50511
50533
|
}).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:
|
|
50534
|
+
var BindingOutputSchema = z4.object({
|
|
50535
|
+
target: z4.string(),
|
|
50536
|
+
template: z4.string().optional(),
|
|
50537
|
+
inline_template: z4.string().optional(),
|
|
50538
|
+
source: z4.string().optional(),
|
|
50539
|
+
mode: z4.enum(["write", "patch"]).default("write"),
|
|
50540
|
+
format: z4.enum(["json", "yaml", "text"]).optional(),
|
|
50541
|
+
patch_strategy: z4.enum(["deep_merge", "append"]).optional(),
|
|
50542
|
+
array_merge_key: z4.string().optional(),
|
|
50543
|
+
group_by: z4.string().optional(),
|
|
50544
|
+
executable: z4.boolean().optional(),
|
|
50545
|
+
skip_empty: z4.boolean().optional()
|
|
50524
50546
|
}).passthrough().refine(
|
|
50525
50547
|
(data) => {
|
|
50526
50548
|
const count = [data.template, data.inline_template, data.source].filter(Boolean).length;
|
|
@@ -50528,247 +50550,300 @@ var BindingOutputSchema = z3.object({
|
|
|
50528
50550
|
},
|
|
50529
50551
|
{ message: "Only one of template, inline_template, or source may be specified" }
|
|
50530
50552
|
);
|
|
50531
|
-
var ReportingSchema =
|
|
50532
|
-
commands:
|
|
50533
|
-
fail_open:
|
|
50534
|
-
timeout_ms:
|
|
50553
|
+
var ReportingSchema = z4.object({
|
|
50554
|
+
commands: z4.record(z4.string(), z4.string()),
|
|
50555
|
+
fail_open: z4.boolean().default(true),
|
|
50556
|
+
timeout_ms: z4.number().default(5e3)
|
|
50535
50557
|
}).passthrough();
|
|
50536
|
-
var GuardrailImplSchema =
|
|
50537
|
-
checks:
|
|
50538
|
-
});
|
|
50539
|
-
var
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50558
|
+
var GuardrailImplSchema = z4.object({
|
|
50559
|
+
checks: z4.array(CheckSchema)
|
|
50560
|
+
});
|
|
50561
|
+
var BindingRenderTargetSchema = z4.object({
|
|
50562
|
+
template: z4.string().optional(),
|
|
50563
|
+
inline_template: z4.string().optional(),
|
|
50564
|
+
context: ContextTypeSchema,
|
|
50565
|
+
output: z4.string(),
|
|
50566
|
+
include: z4.array(z4.string()).optional(),
|
|
50567
|
+
exclude: z4.array(z4.string()).optional(),
|
|
50568
|
+
skip_empty: z4.boolean().optional(),
|
|
50569
|
+
executable: z4.boolean().optional()
|
|
50570
|
+
}).passthrough().refine(
|
|
50571
|
+
(data) => {
|
|
50572
|
+
const count = [data.template, data.inline_template].filter(Boolean).length;
|
|
50573
|
+
return count === 1;
|
|
50574
|
+
},
|
|
50575
|
+
{ message: "Exactly one of template or inline_template must be specified" }
|
|
50576
|
+
).refine(
|
|
50577
|
+
(data) => !(data.include && data.exclude),
|
|
50578
|
+
{ message: "include and exclude are mutually exclusive" }
|
|
50579
|
+
).refine(
|
|
50580
|
+
(data) => {
|
|
50581
|
+
if (data.context === "system" && (data.include || data.exclude)) {
|
|
50582
|
+
return false;
|
|
50583
|
+
}
|
|
50584
|
+
return true;
|
|
50585
|
+
},
|
|
50586
|
+
{ message: "include/exclude cannot be used with context: system" }
|
|
50587
|
+
);
|
|
50588
|
+
var SoftwareBindingSchema = z4.object({
|
|
50589
|
+
software: z4.string(),
|
|
50590
|
+
version: z4.literal(1),
|
|
50591
|
+
extends: z4.string().optional(),
|
|
50592
|
+
guardrail_impl: z4.record(z4.string(), GuardrailImplSchema).optional(),
|
|
50593
|
+
outputs: z4.record(z4.string(), BindingOutputSchema).optional(),
|
|
50594
|
+
renders: z4.array(BindingRenderTargetSchema).optional(),
|
|
50545
50595
|
reporting: ReportingSchema.optional()
|
|
50546
50596
|
}).passthrough();
|
|
50547
50597
|
|
|
50548
50598
|
// src/schema/dsl.ts
|
|
50549
|
-
import { z as
|
|
50599
|
+
import { z as z13 } from "zod";
|
|
50550
50600
|
|
|
50551
50601
|
// src/schema/handoff-type.ts
|
|
50552
|
-
import { z as
|
|
50553
|
-
var HandoffTypeSchema =
|
|
50554
|
-
version:
|
|
50555
|
-
description:
|
|
50556
|
-
schema:
|
|
50557
|
-
example:
|
|
50602
|
+
import { z as z5 } from "zod";
|
|
50603
|
+
var HandoffTypeSchema = z5.object({
|
|
50604
|
+
version: z5.number(),
|
|
50605
|
+
description: z5.string().optional(),
|
|
50606
|
+
schema: z5.record(z5.string(), z5.any()),
|
|
50607
|
+
example: z5.record(z5.string(), z5.any()).optional()
|
|
50558
50608
|
}).passthrough();
|
|
50559
50609
|
|
|
50560
50610
|
// src/schema/guardrail.ts
|
|
50561
|
-
import { z as
|
|
50562
|
-
var GuardrailScopeSchema =
|
|
50563
|
-
agents:
|
|
50564
|
-
tasks:
|
|
50565
|
-
tools:
|
|
50566
|
-
artifacts:
|
|
50567
|
-
workflows:
|
|
50611
|
+
import { z as z6 } from "zod";
|
|
50612
|
+
var GuardrailScopeSchema = z6.object({
|
|
50613
|
+
agents: z6.array(z6.string()).optional(),
|
|
50614
|
+
tasks: z6.array(z6.string()).optional(),
|
|
50615
|
+
tools: z6.array(z6.string()).optional(),
|
|
50616
|
+
artifacts: z6.array(z6.string()).optional(),
|
|
50617
|
+
workflows: z6.array(z6.string()).optional()
|
|
50568
50618
|
}).passthrough();
|
|
50569
|
-
var GuardrailSchema =
|
|
50570
|
-
description:
|
|
50619
|
+
var GuardrailSchema = z6.object({
|
|
50620
|
+
description: z6.string(),
|
|
50571
50621
|
scope: GuardrailScopeSchema,
|
|
50572
|
-
rationale:
|
|
50573
|
-
tags:
|
|
50574
|
-
exemptions:
|
|
50622
|
+
rationale: z6.string().optional(),
|
|
50623
|
+
tags: z6.array(z6.string()).default([]),
|
|
50624
|
+
exemptions: z6.array(z6.string()).optional()
|
|
50575
50625
|
}).passthrough();
|
|
50576
|
-
var GuardrailPolicyRuleEscalationSchema =
|
|
50577
|
-
target:
|
|
50578
|
-
condition:
|
|
50626
|
+
var GuardrailPolicyRuleEscalationSchema = z6.object({
|
|
50627
|
+
target: z6.string(),
|
|
50628
|
+
condition: z6.string().optional()
|
|
50579
50629
|
}).passthrough();
|
|
50580
|
-
var GuardrailPolicyRuleSchema =
|
|
50581
|
-
guardrail:
|
|
50582
|
-
severity:
|
|
50583
|
-
action:
|
|
50584
|
-
allow_override:
|
|
50585
|
-
override_requires:
|
|
50630
|
+
var GuardrailPolicyRuleSchema = z6.object({
|
|
50631
|
+
guardrail: z6.string(),
|
|
50632
|
+
severity: z6.enum(["critical", "mandatory", "warning", "info"]),
|
|
50633
|
+
action: z6.enum(["block", "warn", "shadow", "info"]),
|
|
50634
|
+
allow_override: z6.boolean().default(false),
|
|
50635
|
+
override_requires: z6.array(z6.string()).optional(),
|
|
50586
50636
|
escalation: GuardrailPolicyRuleEscalationSchema.optional()
|
|
50587
50637
|
}).passthrough();
|
|
50588
|
-
var GuardrailPolicySchema =
|
|
50589
|
-
description:
|
|
50590
|
-
rules:
|
|
50638
|
+
var GuardrailPolicySchema = z6.object({
|
|
50639
|
+
description: z6.string().optional(),
|
|
50640
|
+
rules: z6.array(GuardrailPolicyRuleSchema)
|
|
50591
50641
|
}).passthrough();
|
|
50592
50642
|
|
|
50593
50643
|
// src/schema/policy.ts
|
|
50594
|
-
import { z as
|
|
50595
|
-
var PolicyWhenSchema =
|
|
50596
|
-
artifact_type:
|
|
50597
|
-
workflow:
|
|
50644
|
+
import { z as z7 } from "zod";
|
|
50645
|
+
var PolicyWhenSchema = z7.object({
|
|
50646
|
+
artifact_type: z7.string().optional(),
|
|
50647
|
+
workflow: z7.string().optional()
|
|
50598
50648
|
}).passthrough();
|
|
50599
|
-
var PolicySchema =
|
|
50649
|
+
var PolicySchema = z7.object({
|
|
50600
50650
|
when: PolicyWhenSchema,
|
|
50601
|
-
requires_validations:
|
|
50602
|
-
requires:
|
|
50651
|
+
requires_validations: z7.array(z7.string()).optional(),
|
|
50652
|
+
requires: z7.array(z7.string()).optional()
|
|
50603
50653
|
}).passthrough();
|
|
50604
50654
|
|
|
50605
50655
|
// 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
50656
|
import { z as z8 } from "zod";
|
|
50617
|
-
var
|
|
50657
|
+
var VersionLiteralSchema = z8.literal(1);
|
|
50658
|
+
var ExtendsSchema = z8.string().optional();
|
|
50659
|
+
var SystemSchema = z8.object({
|
|
50618
50660
|
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()
|
|
50661
|
+
name: z8.string(),
|
|
50662
|
+
default_workflow_order: z8.array(z8.string())
|
|
50648
50663
|
}).passthrough();
|
|
50649
50664
|
|
|
50650
|
-
// src/schema/
|
|
50665
|
+
// src/schema/task.ts
|
|
50651
50666
|
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(),
|
|
50667
|
+
var ExecutionStepSchema = z9.object({
|
|
50668
|
+
id: z9.string(),
|
|
50669
|
+
action: z9.string(),
|
|
50661
50670
|
description: z9.string().optional(),
|
|
50662
|
-
|
|
50663
|
-
|
|
50664
|
-
|
|
50665
|
-
|
|
50666
|
-
|
|
50671
|
+
required: z9.boolean().optional(),
|
|
50672
|
+
abort_on_failure: z9.boolean().optional(),
|
|
50673
|
+
uses_tool: z9.string().optional(),
|
|
50674
|
+
produces_artifact: z9.string().optional(),
|
|
50675
|
+
reads_artifact: z9.string().optional(),
|
|
50676
|
+
depends_on: z9.array(z9.string()).optional(),
|
|
50677
|
+
skip_condition: z9.string().optional(),
|
|
50678
|
+
wait_for_approval: z9.boolean().optional()
|
|
50679
|
+
}).passthrough();
|
|
50680
|
+
var TaskSchema = z9.object({
|
|
50681
|
+
description: z9.string(),
|
|
50682
|
+
target_agent: z9.string(),
|
|
50683
|
+
allowed_from_agents: z9.array(z9.string()),
|
|
50684
|
+
workflow: z9.string(),
|
|
50685
|
+
input_artifacts: z9.array(z9.string()),
|
|
50686
|
+
invocation_handoff: z9.string(),
|
|
50687
|
+
result_handoff: z9.string(),
|
|
50688
|
+
default_priority: z9.string().optional(),
|
|
50689
|
+
responsibilities: z9.array(z9.string()).optional(),
|
|
50690
|
+
constraints: z9.array(z9.string()).optional(),
|
|
50691
|
+
execution_steps: z9.array(ExecutionStepSchema).optional(),
|
|
50692
|
+
completion_criteria: z9.array(z9.string()).optional(),
|
|
50693
|
+
rules: z9.array(RuleSchema).optional(),
|
|
50694
|
+
anti_patterns: z9.array(z9.string()).optional(),
|
|
50695
|
+
escalation_criteria: z9.array(EscalationCriterionSchema).optional(),
|
|
50696
|
+
validations: z9.array(z9.string()).default([]),
|
|
50667
50697
|
guardrails: z9.array(z9.string()).optional()
|
|
50668
50698
|
}).passthrough();
|
|
50669
50699
|
|
|
50670
|
-
// src/schema/
|
|
50700
|
+
// src/schema/tool.ts
|
|
50671
50701
|
import { z as z10 } from "zod";
|
|
50672
|
-
var
|
|
50673
|
-
|
|
50674
|
-
|
|
50675
|
-
|
|
50676
|
-
|
|
50677
|
-
|
|
50678
|
-
|
|
50702
|
+
var CommandSchema = z10.object({
|
|
50703
|
+
command: z10.string(),
|
|
50704
|
+
category: z10.string(),
|
|
50705
|
+
reads: z10.array(z10.string()).default([]),
|
|
50706
|
+
writes: z10.array(z10.string()).default([]),
|
|
50707
|
+
purpose: z10.string().optional()
|
|
50708
|
+
});
|
|
50709
|
+
var ToolSchema = z10.object({
|
|
50710
|
+
kind: z10.string(),
|
|
50711
|
+
description: z10.string().optional(),
|
|
50712
|
+
input_artifacts: z10.array(z10.string()).default([]),
|
|
50713
|
+
output_artifacts: z10.array(z10.string()).default([]),
|
|
50714
|
+
invokable_by: z10.array(z10.string()),
|
|
50715
|
+
side_effects: z10.array(z10.string()).default([]),
|
|
50716
|
+
commands: z10.array(CommandSchema).default([]),
|
|
50717
|
+
guardrails: z10.array(z10.string()).optional()
|
|
50679
50718
|
}).passthrough();
|
|
50680
50719
|
|
|
50681
|
-
// src/schema/
|
|
50720
|
+
// src/schema/validation.ts
|
|
50682
50721
|
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
|
-
|
|
50722
|
+
var ValidationSchema = z11.object({
|
|
50723
|
+
target_artifact: z11.string(),
|
|
50724
|
+
kind: z11.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
|
|
50725
|
+
executor_type: z11.enum(["tool", "agent"]),
|
|
50726
|
+
executor: z11.string(),
|
|
50727
|
+
blocking: z11.boolean(),
|
|
50728
|
+
produces_evidence: z11.string().optional()
|
|
50729
|
+
}).passthrough();
|
|
50730
|
+
|
|
50731
|
+
// src/schema/workflow.ts
|
|
50732
|
+
import { z as z12 } from "zod";
|
|
50733
|
+
var RetrySchema = z12.object({
|
|
50734
|
+
condition: z12.string(),
|
|
50735
|
+
fix_task: z12.string(),
|
|
50736
|
+
revalidate_task: z12.string().optional()
|
|
50737
|
+
});
|
|
50738
|
+
var ExternalParticipantSchema = z12.object({
|
|
50739
|
+
id: z12.string(),
|
|
50740
|
+
kind: z12.enum(["actor", "participant"]),
|
|
50741
|
+
label: z12.string(),
|
|
50742
|
+
description: z12.string().optional()
|
|
50743
|
+
});
|
|
50744
|
+
var WorkflowDelegateStepSchema = z12.object({
|
|
50745
|
+
type: z12.literal("delegate"),
|
|
50746
|
+
description: z12.string().optional(),
|
|
50747
|
+
task: z12.string(),
|
|
50748
|
+
from_agent: z12.string(),
|
|
50749
|
+
group: z12.string().optional(),
|
|
50700
50750
|
retry: RetrySchema.optional()
|
|
50701
50751
|
}).passthrough();
|
|
50702
|
-
var WorkflowGateStepSchema =
|
|
50703
|
-
type:
|
|
50704
|
-
description:
|
|
50705
|
-
gate_kind:
|
|
50706
|
-
group:
|
|
50752
|
+
var WorkflowGateStepSchema = z12.object({
|
|
50753
|
+
type: z12.literal("gate"),
|
|
50754
|
+
description: z12.string().optional(),
|
|
50755
|
+
gate_kind: z12.string(),
|
|
50756
|
+
group: z12.string().optional()
|
|
50707
50757
|
}).passthrough();
|
|
50708
|
-
var WorkflowHandoffStepSchema =
|
|
50709
|
-
type:
|
|
50710
|
-
description:
|
|
50711
|
-
handoff_kind:
|
|
50712
|
-
task:
|
|
50713
|
-
from_agent:
|
|
50714
|
-
group:
|
|
50758
|
+
var WorkflowHandoffStepSchema = z12.object({
|
|
50759
|
+
type: z12.literal("handoff"),
|
|
50760
|
+
description: z12.string().optional(),
|
|
50761
|
+
handoff_kind: z12.string(),
|
|
50762
|
+
task: z12.string().optional(),
|
|
50763
|
+
from_agent: z12.string().optional(),
|
|
50764
|
+
group: z12.string().optional(),
|
|
50715
50765
|
retry: RetrySchema.optional()
|
|
50716
50766
|
}).passthrough();
|
|
50717
|
-
var WorkflowValidationStepSchema =
|
|
50718
|
-
type:
|
|
50719
|
-
description:
|
|
50720
|
-
validation:
|
|
50721
|
-
group:
|
|
50767
|
+
var WorkflowValidationStepSchema = z12.object({
|
|
50768
|
+
type: z12.literal("validation"),
|
|
50769
|
+
description: z12.string().optional(),
|
|
50770
|
+
validation: z12.string(),
|
|
50771
|
+
group: z12.string().optional()
|
|
50722
50772
|
}).passthrough();
|
|
50723
|
-
var WorkflowDecisionStepSchema =
|
|
50724
|
-
type:
|
|
50725
|
-
description:
|
|
50773
|
+
var WorkflowDecisionStepSchema = z12.object({
|
|
50774
|
+
type: z12.literal("decision"),
|
|
50775
|
+
description: z12.string().optional(),
|
|
50726
50776
|
/** @deprecated Use `routing_key` instead. `on` is kept for backward compatibility. */
|
|
50727
|
-
on:
|
|
50728
|
-
routing_key:
|
|
50729
|
-
branches:
|
|
50730
|
-
group:
|
|
50777
|
+
on: z12.string().optional(),
|
|
50778
|
+
routing_key: z12.string().optional(),
|
|
50779
|
+
branches: z12.record(z12.string(), z12.array(z12.string())),
|
|
50780
|
+
group: z12.string().optional()
|
|
50731
50781
|
}).passthrough();
|
|
50732
|
-
var WorkflowStepSchema =
|
|
50782
|
+
var WorkflowStepSchema = z12.discriminatedUnion("type", [
|
|
50733
50783
|
WorkflowDelegateStepSchema,
|
|
50734
50784
|
WorkflowGateStepSchema,
|
|
50735
50785
|
WorkflowHandoffStepSchema,
|
|
50736
50786
|
WorkflowValidationStepSchema,
|
|
50737
50787
|
WorkflowDecisionStepSchema
|
|
50738
50788
|
]);
|
|
50739
|
-
var WorkflowSchema =
|
|
50740
|
-
description:
|
|
50741
|
-
entry_conditions:
|
|
50742
|
-
trigger:
|
|
50743
|
-
steps:
|
|
50744
|
-
external_participants:
|
|
50789
|
+
var WorkflowSchema = z12.object({
|
|
50790
|
+
description: z12.string().optional(),
|
|
50791
|
+
entry_conditions: z12.array(z12.string()).default([]),
|
|
50792
|
+
trigger: z12.string().optional(),
|
|
50793
|
+
steps: z12.array(WorkflowStepSchema),
|
|
50794
|
+
external_participants: z12.array(ExternalParticipantSchema).default([])
|
|
50745
50795
|
}).passthrough();
|
|
50746
50796
|
|
|
50747
50797
|
// src/schema/dsl.ts
|
|
50748
|
-
var ComponentsSchema =
|
|
50749
|
-
schemas:
|
|
50798
|
+
var ComponentsSchema = z13.object({
|
|
50799
|
+
schemas: z13.record(z13.string(), z13.record(z13.string(), z13.any())).default({})
|
|
50750
50800
|
}).passthrough();
|
|
50751
|
-
var
|
|
50752
|
-
|
|
50753
|
-
|
|
50754
|
-
|
|
50755
|
-
|
|
50756
|
-
|
|
50757
|
-
|
|
50758
|
-
|
|
50801
|
+
var SCOPE_NODE_TYPES = [
|
|
50802
|
+
"root",
|
|
50803
|
+
"system",
|
|
50804
|
+
"agent",
|
|
50805
|
+
"task",
|
|
50806
|
+
"execution_step",
|
|
50807
|
+
"artifact",
|
|
50808
|
+
"tool",
|
|
50809
|
+
"tool_command",
|
|
50810
|
+
"validation",
|
|
50811
|
+
"handoff_type",
|
|
50812
|
+
"workflow",
|
|
50813
|
+
"workflow_step",
|
|
50814
|
+
"policy",
|
|
50815
|
+
"guardrail",
|
|
50816
|
+
"guardrail_policy",
|
|
50817
|
+
"rule",
|
|
50818
|
+
"escalation_criterion",
|
|
50819
|
+
"prerequisite"
|
|
50820
|
+
];
|
|
50821
|
+
var ScopeNodeTypeSchema = z13.enum(SCOPE_NODE_TYPES);
|
|
50822
|
+
var XExtensionDeclSchema = z13.object({
|
|
50823
|
+
type: z13.string(),
|
|
50824
|
+
items: z13.string().optional(),
|
|
50825
|
+
description: z13.string().optional(),
|
|
50826
|
+
scope: z13.array(ScopeNodeTypeSchema).optional(),
|
|
50827
|
+
schema: z13.record(z13.string(), z13.any()).optional(),
|
|
50828
|
+
required: z13.boolean().default(false)
|
|
50829
|
+
});
|
|
50830
|
+
var DslSchema = z13.object({
|
|
50831
|
+
version: z13.literal(1),
|
|
50832
|
+
extends: z13.string().optional(),
|
|
50759
50833
|
system: SystemSchema,
|
|
50760
|
-
agents:
|
|
50761
|
-
tasks:
|
|
50762
|
-
artifacts:
|
|
50763
|
-
tools:
|
|
50764
|
-
validations:
|
|
50765
|
-
handoff_types:
|
|
50766
|
-
workflow:
|
|
50767
|
-
policies:
|
|
50768
|
-
guardrails:
|
|
50769
|
-
guardrail_policies:
|
|
50834
|
+
agents: z13.record(z13.string(), AgentSchema).default({}),
|
|
50835
|
+
tasks: z13.record(z13.string(), TaskSchema).default({}),
|
|
50836
|
+
artifacts: z13.record(z13.string(), ArtifactSchema).default({}),
|
|
50837
|
+
tools: z13.record(z13.string(), ToolSchema).default({}),
|
|
50838
|
+
validations: z13.record(z13.string(), ValidationSchema).default({}),
|
|
50839
|
+
handoff_types: z13.record(z13.string(), HandoffTypeSchema).default({}),
|
|
50840
|
+
workflow: z13.record(z13.string(), WorkflowSchema).default({}),
|
|
50841
|
+
policies: z13.record(z13.string(), PolicySchema).default({}),
|
|
50842
|
+
guardrails: z13.record(z13.string(), GuardrailSchema).default({}),
|
|
50843
|
+
guardrail_policies: z13.record(z13.string(), GuardrailPolicySchema).default({}),
|
|
50770
50844
|
components: ComponentsSchema.default({ schemas: {} }),
|
|
50771
|
-
|
|
50845
|
+
extensions: z13.record(z13.string(), XExtensionDeclSchema).default({}),
|
|
50846
|
+
extensions_strict: z13.boolean().default(false)
|
|
50772
50847
|
}).passthrough();
|
|
50773
50848
|
|
|
50774
50849
|
// src/schema/json-schema-utils.ts
|
|
@@ -50820,22 +50895,22 @@ function resolveAllOf(schema) {
|
|
|
50820
50895
|
}
|
|
50821
50896
|
|
|
50822
50897
|
// src/schema/merge-operators.ts
|
|
50823
|
-
import { z as
|
|
50824
|
-
var AppendOperatorSchema =
|
|
50825
|
-
$append:
|
|
50898
|
+
import { z as z14 } from "zod";
|
|
50899
|
+
var AppendOperatorSchema = z14.object({
|
|
50900
|
+
$append: z14.record(z14.string(), z14.any())
|
|
50826
50901
|
});
|
|
50827
|
-
var PrependOperatorSchema =
|
|
50828
|
-
$prepend:
|
|
50902
|
+
var PrependOperatorSchema = z14.object({
|
|
50903
|
+
$prepend: z14.record(z14.string(), z14.any())
|
|
50829
50904
|
});
|
|
50830
|
-
var InsertAfterOperatorSchema =
|
|
50831
|
-
$insert_after:
|
|
50832
|
-
after:
|
|
50833
|
-
entries:
|
|
50905
|
+
var InsertAfterOperatorSchema = z14.object({
|
|
50906
|
+
$insert_after: z14.object({
|
|
50907
|
+
after: z14.string(),
|
|
50908
|
+
entries: z14.record(z14.string(), z14.any())
|
|
50834
50909
|
})
|
|
50835
50910
|
});
|
|
50836
|
-
var ReplaceOperatorSchema =
|
|
50837
|
-
var RemoveOperatorSchema =
|
|
50838
|
-
$remove:
|
|
50911
|
+
var ReplaceOperatorSchema = z14.object({ $replace: z14.any() });
|
|
50912
|
+
var RemoveOperatorSchema = z14.object({
|
|
50913
|
+
$remove: z14.array(z14.string())
|
|
50839
50914
|
});
|
|
50840
50915
|
|
|
50841
50916
|
// src/loader/loader.ts
|
|
@@ -51387,7 +51462,8 @@ var MERGE_SECTIONS = [
|
|
|
51387
51462
|
"policies",
|
|
51388
51463
|
"guardrails",
|
|
51389
51464
|
"guardrail_policies",
|
|
51390
|
-
"components"
|
|
51465
|
+
"components",
|
|
51466
|
+
"extensions"
|
|
51391
51467
|
];
|
|
51392
51468
|
function mergeDsl(base, project) {
|
|
51393
51469
|
const hasExtends = typeof project["extends"] === "string";
|
|
@@ -51449,16 +51525,17 @@ function expandDefaults(data) {
|
|
|
51449
51525
|
}
|
|
51450
51526
|
|
|
51451
51527
|
// src/validator/schema-validator.ts
|
|
51452
|
-
import
|
|
51528
|
+
import Ajv from "ajv";
|
|
51529
|
+
import { z as z15 } from "zod";
|
|
51453
51530
|
function unwrap(schema) {
|
|
51454
|
-
if (schema instanceof
|
|
51455
|
-
if (schema instanceof
|
|
51456
|
-
if (schema instanceof
|
|
51531
|
+
if (schema instanceof z15.ZodOptional) return unwrap(schema.unwrap());
|
|
51532
|
+
if (schema instanceof z15.ZodDefault) return unwrap(schema.removeDefault());
|
|
51533
|
+
if (schema instanceof z15.ZodNullable) return unwrap(schema.unwrap());
|
|
51457
51534
|
return schema;
|
|
51458
51535
|
}
|
|
51459
51536
|
function checkCustomPropsRecursive(data, schema, path) {
|
|
51460
51537
|
const inner = unwrap(schema);
|
|
51461
|
-
if (inner instanceof
|
|
51538
|
+
if (inner instanceof z15.ZodObject) {
|
|
51462
51539
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51463
51540
|
const obj = data;
|
|
51464
51541
|
const shape = inner.shape;
|
|
@@ -51479,7 +51556,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51479
51556
|
}
|
|
51480
51557
|
return diagnostics;
|
|
51481
51558
|
}
|
|
51482
|
-
if (inner instanceof
|
|
51559
|
+
if (inner instanceof z15.ZodRecord) {
|
|
51483
51560
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51484
51561
|
const valueSchema = inner._def.valueType;
|
|
51485
51562
|
const diagnostics = [];
|
|
@@ -51488,7 +51565,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51488
51565
|
}
|
|
51489
51566
|
return diagnostics;
|
|
51490
51567
|
}
|
|
51491
|
-
if (inner instanceof
|
|
51568
|
+
if (inner instanceof z15.ZodArray) {
|
|
51492
51569
|
if (!Array.isArray(data)) return [];
|
|
51493
51570
|
const diagnostics = [];
|
|
51494
51571
|
for (let i3 = 0; i3 < data.length; i3++) {
|
|
@@ -51496,28 +51573,28 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51496
51573
|
}
|
|
51497
51574
|
return diagnostics;
|
|
51498
51575
|
}
|
|
51499
|
-
if (inner instanceof
|
|
51576
|
+
if (inner instanceof z15.ZodDiscriminatedUnion) {
|
|
51500
51577
|
if (typeof data !== "object" || data === null) return [];
|
|
51501
51578
|
const obj = data;
|
|
51502
51579
|
const disc = inner._def.discriminator;
|
|
51503
51580
|
const discValue = obj[disc];
|
|
51504
51581
|
const match = inner.options.find((opt) => {
|
|
51505
51582
|
const shape = opt.shape;
|
|
51506
|
-
return shape[disc] instanceof
|
|
51583
|
+
return shape[disc] instanceof z15.ZodLiteral && shape[disc].value === discValue;
|
|
51507
51584
|
});
|
|
51508
51585
|
if (match) return checkCustomPropsRecursive(data, match, path);
|
|
51509
51586
|
return [];
|
|
51510
51587
|
}
|
|
51511
51588
|
return [];
|
|
51512
51589
|
}
|
|
51513
|
-
function
|
|
51514
|
-
const extensions = data["
|
|
51590
|
+
function checkExtensionsKeys(data) {
|
|
51591
|
+
const extensions = data["extensions"];
|
|
51515
51592
|
if (typeof extensions !== "object" || extensions === null) return [];
|
|
51516
51593
|
const diagnostics = [];
|
|
51517
51594
|
for (const key of Object.keys(extensions)) {
|
|
51518
51595
|
if (!key.startsWith("x-")) {
|
|
51519
51596
|
diagnostics.push({
|
|
51520
|
-
path: `
|
|
51597
|
+
path: `extensions.${key}`,
|
|
51521
51598
|
message: `Extension key "${key}" must start with "x-" prefix.`,
|
|
51522
51599
|
code: "x-extension-key-prefix"
|
|
51523
51600
|
});
|
|
@@ -51551,29 +51628,634 @@ function checkDecisionStepRoutingKey(data) {
|
|
|
51551
51628
|
}
|
|
51552
51629
|
return diagnostics;
|
|
51553
51630
|
}
|
|
51554
|
-
function
|
|
51555
|
-
|
|
51556
|
-
|
|
51557
|
-
|
|
51558
|
-
|
|
51559
|
-
|
|
51560
|
-
|
|
51561
|
-
|
|
51562
|
-
|
|
51631
|
+
function isRecord3(v2) {
|
|
51632
|
+
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
51633
|
+
}
|
|
51634
|
+
function* enumerateEntitiesByType(data, nodeType) {
|
|
51635
|
+
switch (nodeType) {
|
|
51636
|
+
case "root":
|
|
51637
|
+
yield { path: "", obj: data };
|
|
51638
|
+
return;
|
|
51639
|
+
case "system": {
|
|
51640
|
+
const sys = data["system"];
|
|
51641
|
+
if (isRecord3(sys)) yield { path: "system", obj: sys };
|
|
51642
|
+
return;
|
|
51643
|
+
}
|
|
51644
|
+
case "agent": {
|
|
51645
|
+
const agents = data["agents"];
|
|
51646
|
+
if (!isRecord3(agents)) return;
|
|
51647
|
+
for (const [id, a3] of Object.entries(agents)) {
|
|
51648
|
+
if (isRecord3(a3)) yield { path: `agents.${id}`, obj: a3 };
|
|
51649
|
+
}
|
|
51650
|
+
return;
|
|
51651
|
+
}
|
|
51652
|
+
case "rule": {
|
|
51653
|
+
const agents = data["agents"];
|
|
51654
|
+
if (!isRecord3(agents)) return;
|
|
51655
|
+
for (const [aid, a3] of Object.entries(agents)) {
|
|
51656
|
+
if (!isRecord3(a3)) continue;
|
|
51657
|
+
const rules = a3["rules"];
|
|
51658
|
+
if (!Array.isArray(rules)) continue;
|
|
51659
|
+
for (let i3 = 0; i3 < rules.length; i3++) {
|
|
51660
|
+
const r3 = rules[i3];
|
|
51661
|
+
if (isRecord3(r3)) yield { path: `agents.${aid}.rules[${i3}]`, obj: r3 };
|
|
51662
|
+
}
|
|
51663
|
+
}
|
|
51664
|
+
return;
|
|
51665
|
+
}
|
|
51666
|
+
case "escalation_criterion": {
|
|
51667
|
+
const agents = data["agents"];
|
|
51668
|
+
if (!isRecord3(agents)) return;
|
|
51669
|
+
for (const [aid, a3] of Object.entries(agents)) {
|
|
51670
|
+
if (!isRecord3(a3)) continue;
|
|
51671
|
+
const esc = a3["escalation_criteria"];
|
|
51672
|
+
if (!Array.isArray(esc)) continue;
|
|
51673
|
+
for (let i3 = 0; i3 < esc.length; i3++) {
|
|
51674
|
+
const e3 = esc[i3];
|
|
51675
|
+
if (isRecord3(e3)) {
|
|
51676
|
+
yield {
|
|
51677
|
+
path: `agents.${aid}.escalation_criteria[${i3}]`,
|
|
51678
|
+
obj: e3
|
|
51679
|
+
};
|
|
51680
|
+
}
|
|
51681
|
+
}
|
|
51682
|
+
}
|
|
51683
|
+
return;
|
|
51684
|
+
}
|
|
51685
|
+
case "prerequisite": {
|
|
51686
|
+
const agents = data["agents"];
|
|
51687
|
+
if (!isRecord3(agents)) return;
|
|
51688
|
+
for (const [aid, a3] of Object.entries(agents)) {
|
|
51689
|
+
if (!isRecord3(a3)) continue;
|
|
51690
|
+
const pre = a3["prerequisites"];
|
|
51691
|
+
if (!Array.isArray(pre)) continue;
|
|
51692
|
+
for (let i3 = 0; i3 < pre.length; i3++) {
|
|
51693
|
+
const p2 = pre[i3];
|
|
51694
|
+
if (isRecord3(p2)) {
|
|
51695
|
+
yield { path: `agents.${aid}.prerequisites[${i3}]`, obj: p2 };
|
|
51696
|
+
}
|
|
51697
|
+
}
|
|
51698
|
+
}
|
|
51699
|
+
return;
|
|
51700
|
+
}
|
|
51701
|
+
case "task": {
|
|
51702
|
+
const tasks = data["tasks"];
|
|
51703
|
+
if (!isRecord3(tasks)) return;
|
|
51704
|
+
for (const [id, t3] of Object.entries(tasks)) {
|
|
51705
|
+
if (isRecord3(t3)) yield { path: `tasks.${id}`, obj: t3 };
|
|
51706
|
+
}
|
|
51707
|
+
return;
|
|
51708
|
+
}
|
|
51709
|
+
case "execution_step": {
|
|
51710
|
+
const tasks = data["tasks"];
|
|
51711
|
+
if (!isRecord3(tasks)) return;
|
|
51712
|
+
for (const [tid, t3] of Object.entries(tasks)) {
|
|
51713
|
+
if (!isRecord3(t3)) continue;
|
|
51714
|
+
const steps = t3["execution_steps"];
|
|
51715
|
+
if (!Array.isArray(steps)) continue;
|
|
51716
|
+
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
51717
|
+
const s2 = steps[i3];
|
|
51718
|
+
if (isRecord3(s2)) {
|
|
51719
|
+
yield {
|
|
51720
|
+
path: `tasks.${tid}.execution_steps[${i3}]`,
|
|
51721
|
+
obj: s2
|
|
51722
|
+
};
|
|
51723
|
+
}
|
|
51724
|
+
}
|
|
51725
|
+
}
|
|
51726
|
+
return;
|
|
51727
|
+
}
|
|
51728
|
+
case "artifact": {
|
|
51729
|
+
const arts = data["artifacts"];
|
|
51730
|
+
if (!isRecord3(arts)) return;
|
|
51731
|
+
for (const [id, a3] of Object.entries(arts)) {
|
|
51732
|
+
if (isRecord3(a3)) yield { path: `artifacts.${id}`, obj: a3 };
|
|
51733
|
+
}
|
|
51734
|
+
return;
|
|
51735
|
+
}
|
|
51736
|
+
case "tool": {
|
|
51737
|
+
const tools = data["tools"];
|
|
51738
|
+
if (!isRecord3(tools)) return;
|
|
51739
|
+
for (const [id, t3] of Object.entries(tools)) {
|
|
51740
|
+
if (isRecord3(t3)) yield { path: `tools.${id}`, obj: t3 };
|
|
51741
|
+
}
|
|
51742
|
+
return;
|
|
51743
|
+
}
|
|
51744
|
+
case "tool_command": {
|
|
51745
|
+
const tools = data["tools"];
|
|
51746
|
+
if (!isRecord3(tools)) return;
|
|
51747
|
+
for (const [tid, t3] of Object.entries(tools)) {
|
|
51748
|
+
if (!isRecord3(t3)) continue;
|
|
51749
|
+
const cmds = t3["commands"];
|
|
51750
|
+
if (!Array.isArray(cmds)) continue;
|
|
51751
|
+
for (let i3 = 0; i3 < cmds.length; i3++) {
|
|
51752
|
+
const c2 = cmds[i3];
|
|
51753
|
+
if (isRecord3(c2)) {
|
|
51754
|
+
yield { path: `tools.${tid}.commands[${i3}]`, obj: c2 };
|
|
51755
|
+
}
|
|
51756
|
+
}
|
|
51757
|
+
}
|
|
51758
|
+
return;
|
|
51759
|
+
}
|
|
51760
|
+
case "validation": {
|
|
51761
|
+
const vals = data["validations"];
|
|
51762
|
+
if (!isRecord3(vals)) return;
|
|
51763
|
+
for (const [id, v2] of Object.entries(vals)) {
|
|
51764
|
+
if (isRecord3(v2)) yield { path: `validations.${id}`, obj: v2 };
|
|
51765
|
+
}
|
|
51766
|
+
return;
|
|
51767
|
+
}
|
|
51768
|
+
case "handoff_type": {
|
|
51769
|
+
const ht = data["handoff_types"];
|
|
51770
|
+
if (!isRecord3(ht)) return;
|
|
51771
|
+
for (const [id, h2] of Object.entries(ht)) {
|
|
51772
|
+
if (isRecord3(h2)) yield { path: `handoff_types.${id}`, obj: h2 };
|
|
51773
|
+
}
|
|
51774
|
+
return;
|
|
51775
|
+
}
|
|
51776
|
+
case "workflow": {
|
|
51777
|
+
const wf = data["workflow"];
|
|
51778
|
+
if (!isRecord3(wf)) return;
|
|
51779
|
+
for (const [id, w2] of Object.entries(wf)) {
|
|
51780
|
+
if (isRecord3(w2)) yield { path: `workflow.${id}`, obj: w2 };
|
|
51781
|
+
}
|
|
51782
|
+
return;
|
|
51783
|
+
}
|
|
51784
|
+
case "workflow_step": {
|
|
51785
|
+
const wf = data["workflow"];
|
|
51786
|
+
if (!isRecord3(wf)) return;
|
|
51787
|
+
for (const [wid, w2] of Object.entries(wf)) {
|
|
51788
|
+
if (!isRecord3(w2)) continue;
|
|
51789
|
+
const steps = w2["steps"];
|
|
51790
|
+
if (!Array.isArray(steps)) continue;
|
|
51791
|
+
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
51792
|
+
const s2 = steps[i3];
|
|
51793
|
+
if (isRecord3(s2)) {
|
|
51794
|
+
yield { path: `workflow.${wid}.steps[${i3}]`, obj: s2 };
|
|
51795
|
+
}
|
|
51796
|
+
}
|
|
51797
|
+
}
|
|
51798
|
+
return;
|
|
51799
|
+
}
|
|
51800
|
+
case "policy": {
|
|
51801
|
+
const pol = data["policies"];
|
|
51802
|
+
if (!isRecord3(pol)) return;
|
|
51803
|
+
for (const [id, p2] of Object.entries(pol)) {
|
|
51804
|
+
if (isRecord3(p2)) yield { path: `policies.${id}`, obj: p2 };
|
|
51805
|
+
}
|
|
51806
|
+
return;
|
|
51807
|
+
}
|
|
51808
|
+
case "guardrail": {
|
|
51809
|
+
const gr = data["guardrails"];
|
|
51810
|
+
if (!isRecord3(gr)) return;
|
|
51811
|
+
for (const [id, g2] of Object.entries(gr)) {
|
|
51812
|
+
if (isRecord3(g2)) yield { path: `guardrails.${id}`, obj: g2 };
|
|
51813
|
+
}
|
|
51814
|
+
return;
|
|
51815
|
+
}
|
|
51816
|
+
case "guardrail_policy": {
|
|
51817
|
+
const gp = data["guardrail_policies"];
|
|
51818
|
+
if (!isRecord3(gp)) return;
|
|
51819
|
+
for (const [id, p2] of Object.entries(gp)) {
|
|
51820
|
+
if (isRecord3(p2)) yield { path: `guardrail_policies.${id}`, obj: p2 };
|
|
51821
|
+
}
|
|
51822
|
+
return;
|
|
51823
|
+
}
|
|
51824
|
+
default:
|
|
51825
|
+
return;
|
|
51563
51826
|
}
|
|
51564
|
-
|
|
51565
|
-
|
|
51566
|
-
|
|
51827
|
+
}
|
|
51828
|
+
function validateDeclaredExtension(parentPath, nodeType, key, val, declMap, diagnostics, ajvInstance, strict) {
|
|
51829
|
+
const path = parentPath ? `${parentPath}.${key}` : key;
|
|
51830
|
+
const decl = declMap[key];
|
|
51831
|
+
if (decl === void 0) {
|
|
51832
|
+
diagnostics.push({
|
|
51833
|
+
path,
|
|
51834
|
+
message: `Extension "${key}" is not declared in extensions.`,
|
|
51835
|
+
code: "undeclared-extension",
|
|
51836
|
+
...!strict ? { severity: "warning" } : {}
|
|
51837
|
+
});
|
|
51838
|
+
return;
|
|
51567
51839
|
}
|
|
51568
|
-
const
|
|
51569
|
-
if (
|
|
51570
|
-
|
|
51840
|
+
const scope = decl.scope;
|
|
51841
|
+
if (scope && scope.length > 0 && !scope.includes(nodeType)) {
|
|
51842
|
+
diagnostics.push({
|
|
51843
|
+
path,
|
|
51844
|
+
message: `Extension "${key}" is not allowed on ${nodeType} (declared scope: ${scope.join(", ")}).`,
|
|
51845
|
+
code: "extension-scope-mismatch"
|
|
51846
|
+
});
|
|
51847
|
+
return;
|
|
51571
51848
|
}
|
|
51572
|
-
|
|
51573
|
-
|
|
51574
|
-
|
|
51849
|
+
if (decl.schema && typeof decl.schema === "object" && decl.schema !== null && Object.keys(decl.schema).length > 0) {
|
|
51850
|
+
try {
|
|
51851
|
+
const validate = ajvInstance.compile(decl.schema);
|
|
51852
|
+
if (!validate(val)) {
|
|
51853
|
+
diagnostics.push({
|
|
51854
|
+
path,
|
|
51855
|
+
message: `Extension "${key}" value does not match declared schema: ${ajvInstance.errorsText(validate.errors)}`,
|
|
51856
|
+
code: "extension-schema-violation"
|
|
51857
|
+
});
|
|
51858
|
+
}
|
|
51859
|
+
} catch (e3) {
|
|
51860
|
+
diagnostics.push({
|
|
51861
|
+
path,
|
|
51862
|
+
message: `Extension "${key}" has invalid JSON Schema in declaration: ${e3 instanceof Error ? e3.message : String(e3)}`,
|
|
51863
|
+
code: "extension-schema-violation"
|
|
51864
|
+
});
|
|
51865
|
+
}
|
|
51575
51866
|
}
|
|
51576
|
-
|
|
51867
|
+
}
|
|
51868
|
+
function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInstance, strict) {
|
|
51869
|
+
if (!isRecord3(value)) return;
|
|
51870
|
+
const obj = value;
|
|
51871
|
+
for (const key of Object.keys(obj)) {
|
|
51872
|
+
if (key === "extensions" || key === "extensions_strict" || key === "x-extensions" || key === "x-extensions-strict") {
|
|
51873
|
+
continue;
|
|
51874
|
+
}
|
|
51875
|
+
if (key.startsWith("x-")) {
|
|
51876
|
+
validateDeclaredExtension(
|
|
51877
|
+
path,
|
|
51878
|
+
nodeType,
|
|
51879
|
+
key,
|
|
51880
|
+
obj[key],
|
|
51881
|
+
declMap,
|
|
51882
|
+
diagnostics,
|
|
51883
|
+
ajvInstance,
|
|
51884
|
+
strict
|
|
51885
|
+
);
|
|
51886
|
+
}
|
|
51887
|
+
}
|
|
51888
|
+
switch (nodeType) {
|
|
51889
|
+
case "root": {
|
|
51890
|
+
const sys = obj["system"];
|
|
51891
|
+
if (isRecord3(sys)) {
|
|
51892
|
+
walkExtensionNodes(
|
|
51893
|
+
sys,
|
|
51894
|
+
"system",
|
|
51895
|
+
"system",
|
|
51896
|
+
declMap,
|
|
51897
|
+
diagnostics,
|
|
51898
|
+
ajvInstance,
|
|
51899
|
+
strict
|
|
51900
|
+
);
|
|
51901
|
+
}
|
|
51902
|
+
const agents = obj["agents"];
|
|
51903
|
+
if (isRecord3(agents)) {
|
|
51904
|
+
for (const [id, a3] of Object.entries(agents)) {
|
|
51905
|
+
if (isRecord3(a3)) {
|
|
51906
|
+
walkExtensionNodes(
|
|
51907
|
+
a3,
|
|
51908
|
+
`agents.${id}`,
|
|
51909
|
+
"agent",
|
|
51910
|
+
declMap,
|
|
51911
|
+
diagnostics,
|
|
51912
|
+
ajvInstance,
|
|
51913
|
+
strict
|
|
51914
|
+
);
|
|
51915
|
+
}
|
|
51916
|
+
}
|
|
51917
|
+
}
|
|
51918
|
+
const tasks = obj["tasks"];
|
|
51919
|
+
if (isRecord3(tasks)) {
|
|
51920
|
+
for (const [id, t3] of Object.entries(tasks)) {
|
|
51921
|
+
if (isRecord3(t3)) {
|
|
51922
|
+
walkExtensionNodes(
|
|
51923
|
+
t3,
|
|
51924
|
+
`tasks.${id}`,
|
|
51925
|
+
"task",
|
|
51926
|
+
declMap,
|
|
51927
|
+
diagnostics,
|
|
51928
|
+
ajvInstance,
|
|
51929
|
+
strict
|
|
51930
|
+
);
|
|
51931
|
+
}
|
|
51932
|
+
}
|
|
51933
|
+
}
|
|
51934
|
+
const artifacts = obj["artifacts"];
|
|
51935
|
+
if (isRecord3(artifacts)) {
|
|
51936
|
+
for (const [id, a3] of Object.entries(artifacts)) {
|
|
51937
|
+
if (isRecord3(a3)) {
|
|
51938
|
+
walkExtensionNodes(
|
|
51939
|
+
a3,
|
|
51940
|
+
`artifacts.${id}`,
|
|
51941
|
+
"artifact",
|
|
51942
|
+
declMap,
|
|
51943
|
+
diagnostics,
|
|
51944
|
+
ajvInstance,
|
|
51945
|
+
strict
|
|
51946
|
+
);
|
|
51947
|
+
}
|
|
51948
|
+
}
|
|
51949
|
+
}
|
|
51950
|
+
const tools = obj["tools"];
|
|
51951
|
+
if (isRecord3(tools)) {
|
|
51952
|
+
for (const [id, t3] of Object.entries(tools)) {
|
|
51953
|
+
if (isRecord3(t3)) {
|
|
51954
|
+
walkExtensionNodes(
|
|
51955
|
+
t3,
|
|
51956
|
+
`tools.${id}`,
|
|
51957
|
+
"tool",
|
|
51958
|
+
declMap,
|
|
51959
|
+
diagnostics,
|
|
51960
|
+
ajvInstance,
|
|
51961
|
+
strict
|
|
51962
|
+
);
|
|
51963
|
+
}
|
|
51964
|
+
}
|
|
51965
|
+
}
|
|
51966
|
+
const validations = obj["validations"];
|
|
51967
|
+
if (isRecord3(validations)) {
|
|
51968
|
+
for (const [id, v2] of Object.entries(validations)) {
|
|
51969
|
+
if (isRecord3(v2)) {
|
|
51970
|
+
walkExtensionNodes(
|
|
51971
|
+
v2,
|
|
51972
|
+
`validations.${id}`,
|
|
51973
|
+
"validation",
|
|
51974
|
+
declMap,
|
|
51975
|
+
diagnostics,
|
|
51976
|
+
ajvInstance,
|
|
51977
|
+
strict
|
|
51978
|
+
);
|
|
51979
|
+
}
|
|
51980
|
+
}
|
|
51981
|
+
}
|
|
51982
|
+
const handoffTypes = obj["handoff_types"];
|
|
51983
|
+
if (isRecord3(handoffTypes)) {
|
|
51984
|
+
for (const [id, h2] of Object.entries(handoffTypes)) {
|
|
51985
|
+
if (isRecord3(h2)) {
|
|
51986
|
+
walkExtensionNodes(
|
|
51987
|
+
h2,
|
|
51988
|
+
`handoff_types.${id}`,
|
|
51989
|
+
"handoff_type",
|
|
51990
|
+
declMap,
|
|
51991
|
+
diagnostics,
|
|
51992
|
+
ajvInstance,
|
|
51993
|
+
strict
|
|
51994
|
+
);
|
|
51995
|
+
}
|
|
51996
|
+
}
|
|
51997
|
+
}
|
|
51998
|
+
const workflow = obj["workflow"];
|
|
51999
|
+
if (isRecord3(workflow)) {
|
|
52000
|
+
for (const [id, w2] of Object.entries(workflow)) {
|
|
52001
|
+
if (isRecord3(w2)) {
|
|
52002
|
+
walkExtensionNodes(
|
|
52003
|
+
w2,
|
|
52004
|
+
`workflow.${id}`,
|
|
52005
|
+
"workflow",
|
|
52006
|
+
declMap,
|
|
52007
|
+
diagnostics,
|
|
52008
|
+
ajvInstance,
|
|
52009
|
+
strict
|
|
52010
|
+
);
|
|
52011
|
+
}
|
|
52012
|
+
}
|
|
52013
|
+
}
|
|
52014
|
+
const policies = obj["policies"];
|
|
52015
|
+
if (isRecord3(policies)) {
|
|
52016
|
+
for (const [id, p2] of Object.entries(policies)) {
|
|
52017
|
+
if (isRecord3(p2)) {
|
|
52018
|
+
walkExtensionNodes(
|
|
52019
|
+
p2,
|
|
52020
|
+
`policies.${id}`,
|
|
52021
|
+
"policy",
|
|
52022
|
+
declMap,
|
|
52023
|
+
diagnostics,
|
|
52024
|
+
ajvInstance,
|
|
52025
|
+
strict
|
|
52026
|
+
);
|
|
52027
|
+
}
|
|
52028
|
+
}
|
|
52029
|
+
}
|
|
52030
|
+
const guardrails = obj["guardrails"];
|
|
52031
|
+
if (isRecord3(guardrails)) {
|
|
52032
|
+
for (const [id, g2] of Object.entries(guardrails)) {
|
|
52033
|
+
if (isRecord3(g2)) {
|
|
52034
|
+
walkExtensionNodes(
|
|
52035
|
+
g2,
|
|
52036
|
+
`guardrails.${id}`,
|
|
52037
|
+
"guardrail",
|
|
52038
|
+
declMap,
|
|
52039
|
+
diagnostics,
|
|
52040
|
+
ajvInstance,
|
|
52041
|
+
strict
|
|
52042
|
+
);
|
|
52043
|
+
}
|
|
52044
|
+
}
|
|
52045
|
+
}
|
|
52046
|
+
const guardrailPolicies = obj["guardrail_policies"];
|
|
52047
|
+
if (isRecord3(guardrailPolicies)) {
|
|
52048
|
+
for (const [id, p2] of Object.entries(guardrailPolicies)) {
|
|
52049
|
+
if (isRecord3(p2)) {
|
|
52050
|
+
walkExtensionNodes(
|
|
52051
|
+
p2,
|
|
52052
|
+
`guardrail_policies.${id}`,
|
|
52053
|
+
"guardrail_policy",
|
|
52054
|
+
declMap,
|
|
52055
|
+
diagnostics,
|
|
52056
|
+
ajvInstance,
|
|
52057
|
+
strict
|
|
52058
|
+
);
|
|
52059
|
+
}
|
|
52060
|
+
}
|
|
52061
|
+
}
|
|
52062
|
+
break;
|
|
52063
|
+
}
|
|
52064
|
+
case "agent": {
|
|
52065
|
+
const rules = obj["rules"];
|
|
52066
|
+
if (Array.isArray(rules)) {
|
|
52067
|
+
for (let i3 = 0; i3 < rules.length; i3++) {
|
|
52068
|
+
const r3 = rules[i3];
|
|
52069
|
+
if (isRecord3(r3)) {
|
|
52070
|
+
walkExtensionNodes(
|
|
52071
|
+
r3,
|
|
52072
|
+
`${path}.rules[${i3}]`,
|
|
52073
|
+
"rule",
|
|
52074
|
+
declMap,
|
|
52075
|
+
diagnostics,
|
|
52076
|
+
ajvInstance,
|
|
52077
|
+
strict
|
|
52078
|
+
);
|
|
52079
|
+
}
|
|
52080
|
+
}
|
|
52081
|
+
}
|
|
52082
|
+
const esc = obj["escalation_criteria"];
|
|
52083
|
+
if (Array.isArray(esc)) {
|
|
52084
|
+
for (let i3 = 0; i3 < esc.length; i3++) {
|
|
52085
|
+
const e3 = esc[i3];
|
|
52086
|
+
if (isRecord3(e3)) {
|
|
52087
|
+
walkExtensionNodes(
|
|
52088
|
+
e3,
|
|
52089
|
+
`${path}.escalation_criteria[${i3}]`,
|
|
52090
|
+
"escalation_criterion",
|
|
52091
|
+
declMap,
|
|
52092
|
+
diagnostics,
|
|
52093
|
+
ajvInstance,
|
|
52094
|
+
strict
|
|
52095
|
+
);
|
|
52096
|
+
}
|
|
52097
|
+
}
|
|
52098
|
+
}
|
|
52099
|
+
const pre = obj["prerequisites"];
|
|
52100
|
+
if (Array.isArray(pre)) {
|
|
52101
|
+
for (let i3 = 0; i3 < pre.length; i3++) {
|
|
52102
|
+
const p2 = pre[i3];
|
|
52103
|
+
if (isRecord3(p2)) {
|
|
52104
|
+
walkExtensionNodes(
|
|
52105
|
+
p2,
|
|
52106
|
+
`${path}.prerequisites[${i3}]`,
|
|
52107
|
+
"prerequisite",
|
|
52108
|
+
declMap,
|
|
52109
|
+
diagnostics,
|
|
52110
|
+
ajvInstance,
|
|
52111
|
+
strict
|
|
52112
|
+
);
|
|
52113
|
+
}
|
|
52114
|
+
}
|
|
52115
|
+
}
|
|
52116
|
+
break;
|
|
52117
|
+
}
|
|
52118
|
+
case "task": {
|
|
52119
|
+
const steps = obj["execution_steps"];
|
|
52120
|
+
if (Array.isArray(steps)) {
|
|
52121
|
+
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
52122
|
+
const s2 = steps[i3];
|
|
52123
|
+
if (isRecord3(s2)) {
|
|
52124
|
+
walkExtensionNodes(
|
|
52125
|
+
s2,
|
|
52126
|
+
`${path}.execution_steps[${i3}]`,
|
|
52127
|
+
"execution_step",
|
|
52128
|
+
declMap,
|
|
52129
|
+
diagnostics,
|
|
52130
|
+
ajvInstance,
|
|
52131
|
+
strict
|
|
52132
|
+
);
|
|
52133
|
+
}
|
|
52134
|
+
}
|
|
52135
|
+
}
|
|
52136
|
+
break;
|
|
52137
|
+
}
|
|
52138
|
+
case "tool": {
|
|
52139
|
+
const cmds = obj["commands"];
|
|
52140
|
+
if (Array.isArray(cmds)) {
|
|
52141
|
+
for (let i3 = 0; i3 < cmds.length; i3++) {
|
|
52142
|
+
const c2 = cmds[i3];
|
|
52143
|
+
if (isRecord3(c2)) {
|
|
52144
|
+
walkExtensionNodes(
|
|
52145
|
+
c2,
|
|
52146
|
+
`${path}.commands[${i3}]`,
|
|
52147
|
+
"tool_command",
|
|
52148
|
+
declMap,
|
|
52149
|
+
diagnostics,
|
|
52150
|
+
ajvInstance,
|
|
52151
|
+
strict
|
|
52152
|
+
);
|
|
52153
|
+
}
|
|
52154
|
+
}
|
|
52155
|
+
}
|
|
52156
|
+
break;
|
|
52157
|
+
}
|
|
52158
|
+
case "workflow": {
|
|
52159
|
+
const steps = obj["steps"];
|
|
52160
|
+
if (Array.isArray(steps)) {
|
|
52161
|
+
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
52162
|
+
const s2 = steps[i3];
|
|
52163
|
+
if (isRecord3(s2)) {
|
|
52164
|
+
walkExtensionNodes(
|
|
52165
|
+
s2,
|
|
52166
|
+
`${path}.steps[${i3}]`,
|
|
52167
|
+
"workflow_step",
|
|
52168
|
+
declMap,
|
|
52169
|
+
diagnostics,
|
|
52170
|
+
ajvInstance,
|
|
52171
|
+
strict
|
|
52172
|
+
);
|
|
52173
|
+
}
|
|
52174
|
+
}
|
|
52175
|
+
}
|
|
52176
|
+
break;
|
|
52177
|
+
}
|
|
52178
|
+
default:
|
|
52179
|
+
break;
|
|
52180
|
+
}
|
|
52181
|
+
}
|
|
52182
|
+
function checkExtensionValidation(data) {
|
|
52183
|
+
const strict = data["extensions_strict"] === true;
|
|
52184
|
+
const raw = data["extensions"];
|
|
52185
|
+
let declMap;
|
|
52186
|
+
if (!isRecord3(raw) || Object.keys(raw).length === 0) {
|
|
52187
|
+
if (!strict) return [];
|
|
52188
|
+
declMap = {};
|
|
52189
|
+
} else {
|
|
52190
|
+
declMap = raw;
|
|
52191
|
+
}
|
|
52192
|
+
const diagnostics = [];
|
|
52193
|
+
const ajvInstance = new Ajv({ allErrors: true, strict: false });
|
|
52194
|
+
walkExtensionNodes(data, "", "root", declMap, diagnostics, ajvInstance, strict);
|
|
52195
|
+
for (const [extKey, decl] of Object.entries(declMap)) {
|
|
52196
|
+
if (!decl.required) continue;
|
|
52197
|
+
const applicableTypes = decl.scope && decl.scope.length > 0 ? decl.scope : [...SCOPE_NODE_TYPES];
|
|
52198
|
+
for (const t3 of applicableTypes) {
|
|
52199
|
+
for (const { path, obj } of enumerateEntitiesByType(data, t3)) {
|
|
52200
|
+
if (!(extKey in obj)) {
|
|
52201
|
+
diagnostics.push({
|
|
52202
|
+
path,
|
|
52203
|
+
message: `Required extension "${extKey}" is missing on ${t3}.`,
|
|
52204
|
+
code: "extension-required-missing"
|
|
52205
|
+
});
|
|
52206
|
+
}
|
|
52207
|
+
}
|
|
52208
|
+
}
|
|
52209
|
+
}
|
|
52210
|
+
return diagnostics;
|
|
52211
|
+
}
|
|
52212
|
+
function hasBlockingDiagnostic(diagnostics) {
|
|
52213
|
+
return diagnostics.some((d2) => d2.severity !== "warning");
|
|
52214
|
+
}
|
|
52215
|
+
function validateSchema(data) {
|
|
52216
|
+
const deprecationWarnings = [];
|
|
52217
|
+
if ("x-extensions" in data && !("extensions" in data)) {
|
|
52218
|
+
data["extensions"] = data["x-extensions"];
|
|
52219
|
+
deprecationWarnings.push({
|
|
52220
|
+
path: "x-extensions",
|
|
52221
|
+
message: '"x-extensions" is deprecated. Use "extensions" instead.',
|
|
52222
|
+
code: "deprecated-property",
|
|
52223
|
+
severity: "warning"
|
|
52224
|
+
});
|
|
52225
|
+
}
|
|
52226
|
+
if ("x-extensions-strict" in data && !("extensions_strict" in data)) {
|
|
52227
|
+
data["extensions_strict"] = data["x-extensions-strict"];
|
|
52228
|
+
deprecationWarnings.push({
|
|
52229
|
+
path: "x-extensions-strict",
|
|
52230
|
+
message: '"x-extensions-strict" is deprecated. Use "extensions_strict" instead.',
|
|
52231
|
+
code: "deprecated-property",
|
|
52232
|
+
severity: "warning"
|
|
52233
|
+
});
|
|
52234
|
+
}
|
|
52235
|
+
const result = DslSchema.safeParse(data);
|
|
52236
|
+
if (!result.success) {
|
|
52237
|
+
const diagnostics2 = [
|
|
52238
|
+
...deprecationWarnings,
|
|
52239
|
+
...result.error.issues.map((issue) => ({
|
|
52240
|
+
path: issue.path.join("."),
|
|
52241
|
+
message: issue.message,
|
|
52242
|
+
code: "schema-validation"
|
|
52243
|
+
}))
|
|
52244
|
+
];
|
|
52245
|
+
return { success: false, diagnostics: diagnostics2 };
|
|
52246
|
+
}
|
|
52247
|
+
const diagnostics = [
|
|
52248
|
+
...deprecationWarnings,
|
|
52249
|
+
...checkCustomPropsRecursive(data, DslSchema, ""),
|
|
52250
|
+
...checkDecisionStepRoutingKey(data),
|
|
52251
|
+
...checkExtensionsKeys(data),
|
|
52252
|
+
...checkExtensionValidation(data)
|
|
52253
|
+
];
|
|
52254
|
+
return {
|
|
52255
|
+
success: !hasBlockingDiagnostic(diagnostics),
|
|
52256
|
+
data: result.data,
|
|
52257
|
+
diagnostics
|
|
52258
|
+
};
|
|
51577
52259
|
}
|
|
51578
52260
|
|
|
51579
52261
|
// src/validator/reference-resolver.ts
|
|
@@ -51881,8 +52563,8 @@ function checkReferences(dsl) {
|
|
|
51881
52563
|
}
|
|
51882
52564
|
|
|
51883
52565
|
// src/validator/handoff-schema-validator.ts
|
|
51884
|
-
import
|
|
51885
|
-
var ajv = new
|
|
52566
|
+
import Ajv2 from "ajv";
|
|
52567
|
+
var ajv = new Ajv2({ allErrors: true, strict: false });
|
|
51886
52568
|
function validateHandoffSchemas(dsl) {
|
|
51887
52569
|
const diagnostics = [];
|
|
51888
52570
|
for (const [kind, ht] of Object.entries(dsl.handoff_types)) {
|
|
@@ -54707,31 +55389,14 @@ import { resolve as resolve4, dirname as dirname4 } from "path";
|
|
|
54707
55389
|
import { parse as parseYaml2 } from "yaml";
|
|
54708
55390
|
|
|
54709
55391
|
// src/config/types.ts
|
|
54710
|
-
import { z as
|
|
54711
|
-
var
|
|
54712
|
-
|
|
54713
|
-
"task",
|
|
54714
|
-
"artifact",
|
|
54715
|
-
"tool",
|
|
54716
|
-
"validation",
|
|
54717
|
-
"handoff_type",
|
|
54718
|
-
"workflow",
|
|
54719
|
-
"policy",
|
|
54720
|
-
"guardrail",
|
|
54721
|
-
"guardrail_policy",
|
|
54722
|
-
"system"
|
|
54723
|
-
];
|
|
54724
|
-
var ContextTypeSchema = z16.enum(CONTEXT_TYPES);
|
|
54725
|
-
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
54726
|
-
(t3) => t3 !== "system"
|
|
54727
|
-
);
|
|
54728
|
-
var RenderTargetSchema = z16.object({
|
|
54729
|
-
template: z16.string(),
|
|
55392
|
+
import { z as z17 } from "zod";
|
|
55393
|
+
var RenderTargetSchema = z17.object({
|
|
55394
|
+
template: z17.string(),
|
|
54730
55395
|
context: ContextTypeSchema,
|
|
54731
|
-
output:
|
|
54732
|
-
include:
|
|
54733
|
-
exclude:
|
|
54734
|
-
skip_empty:
|
|
55396
|
+
output: z17.string(),
|
|
55397
|
+
include: z17.array(z17.string()).optional(),
|
|
55398
|
+
exclude: z17.array(z17.string()).optional(),
|
|
55399
|
+
skip_empty: z17.boolean().optional()
|
|
54735
55400
|
}).refine(
|
|
54736
55401
|
(data) => !(data.include && data.exclude),
|
|
54737
55402
|
{ message: "include and exclude are mutually exclusive" }
|
|
@@ -54744,13 +55409,13 @@ var RenderTargetSchema = z16.object({
|
|
|
54744
55409
|
},
|
|
54745
55410
|
{ message: "include/exclude cannot be used with context: system" }
|
|
54746
55411
|
);
|
|
54747
|
-
var AgentContractsConfigSchema =
|
|
54748
|
-
dsl:
|
|
54749
|
-
vars:
|
|
54750
|
-
renders:
|
|
54751
|
-
bindings:
|
|
54752
|
-
active_guardrail_policy:
|
|
54753
|
-
paths:
|
|
55412
|
+
var AgentContractsConfigSchema = z17.object({
|
|
55413
|
+
dsl: z17.string(),
|
|
55414
|
+
vars: z17.record(z17.string(), z17.string()).optional(),
|
|
55415
|
+
renders: z17.array(RenderTargetSchema).default([]),
|
|
55416
|
+
bindings: z17.array(z17.string()).default([]),
|
|
55417
|
+
active_guardrail_policy: z17.string().optional(),
|
|
55418
|
+
paths: z17.record(z17.string(), z17.string()).optional()
|
|
54754
55419
|
});
|
|
54755
55420
|
|
|
54756
55421
|
// src/config/loader.ts
|
|
@@ -54838,20 +55503,21 @@ function resolveDslPath(dirArg, dirArgDefault, config) {
|
|
|
54838
55503
|
}
|
|
54839
55504
|
|
|
54840
55505
|
// src/config/binding-merger.ts
|
|
54841
|
-
function
|
|
55506
|
+
function isRecord4(v2) {
|
|
54842
55507
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
54843
55508
|
}
|
|
54844
|
-
var
|
|
55509
|
+
var BINDING_MAP_MERGE_SECTIONS = ["guardrail_impl", "outputs"];
|
|
55510
|
+
var BINDING_ARRAY_MERGE_SECTIONS = ["renders"];
|
|
54845
55511
|
function mergeBinding(base, project) {
|
|
54846
55512
|
const hasExtends = typeof project["extends"] === "string";
|
|
54847
55513
|
const result = { ...base, ...project };
|
|
54848
|
-
for (const section of
|
|
55514
|
+
for (const section of BINDING_MAP_MERGE_SECTIONS) {
|
|
54849
55515
|
const baseVal = base[section];
|
|
54850
55516
|
const projVal = project[section];
|
|
54851
55517
|
if (projVal === void 0) {
|
|
54852
55518
|
continue;
|
|
54853
55519
|
}
|
|
54854
|
-
const baseMap =
|
|
55520
|
+
const baseMap = isRecord4(baseVal) ? baseVal : {};
|
|
54855
55521
|
result[section] = mergeEntityMaps(
|
|
54856
55522
|
baseMap,
|
|
54857
55523
|
projVal,
|
|
@@ -54859,7 +55525,15 @@ function mergeBinding(base, project) {
|
|
|
54859
55525
|
hasExtends
|
|
54860
55526
|
);
|
|
54861
55527
|
}
|
|
54862
|
-
|
|
55528
|
+
for (const section of BINDING_ARRAY_MERGE_SECTIONS) {
|
|
55529
|
+
const baseVal = base[section];
|
|
55530
|
+
const projVal = project[section];
|
|
55531
|
+
if (projVal === void 0) continue;
|
|
55532
|
+
const baseArr = Array.isArray(baseVal) ? baseVal : [];
|
|
55533
|
+
const projArr = Array.isArray(projVal) ? projVal : [];
|
|
55534
|
+
result[section] = [...baseArr, ...projArr];
|
|
55535
|
+
}
|
|
55536
|
+
if (project["reporting"] !== void 0 && isRecord4(base["reporting"]) && isRecord4(project["reporting"])) {
|
|
54863
55537
|
result["reporting"] = deepMergeEntities(
|
|
54864
55538
|
base["reporting"],
|
|
54865
55539
|
project["reporting"],
|
|
@@ -55481,7 +56155,7 @@ async function generateGuardrails(options) {
|
|
|
55481
56155
|
if (filterBindings && !filterBindings.includes(binding.software)) {
|
|
55482
56156
|
continue;
|
|
55483
56157
|
}
|
|
55484
|
-
if (!binding.outputs) continue;
|
|
56158
|
+
if (!binding.outputs && !binding.renders) continue;
|
|
55485
56159
|
const checkResult = resolveChecks(dsl, binding, policy);
|
|
55486
56160
|
diagnostics.push(...checkResult.diagnostics);
|
|
55487
56161
|
const ctx = {
|
|
@@ -55493,9 +56167,14 @@ async function generateGuardrails(options) {
|
|
|
55493
56167
|
vars,
|
|
55494
56168
|
paths,
|
|
55495
56169
|
reporting,
|
|
55496
|
-
resolved_checks: checkResult.resolved
|
|
55497
|
-
|
|
55498
|
-
|
|
56170
|
+
resolved_checks: checkResult.resolved,
|
|
56171
|
+
tasks: dsl.tasks,
|
|
56172
|
+
artifacts: dsl.artifacts,
|
|
56173
|
+
agents: dsl.agents,
|
|
56174
|
+
handoff_types: dsl.handoff_types,
|
|
56175
|
+
workflow: dsl.workflow
|
|
56176
|
+
};
|
|
56177
|
+
for (const [outputId, outputDef] of Object.entries(binding.outputs ?? {})) {
|
|
55499
56178
|
const pathResult = resolveBindingTargetPath(
|
|
55500
56179
|
outputDef.target,
|
|
55501
56180
|
paths,
|
|
@@ -55625,9 +56304,98 @@ async function generateGuardrails(options) {
|
|
|
55625
56304
|
}
|
|
55626
56305
|
}
|
|
55627
56306
|
}
|
|
56307
|
+
for (const renderTarget of binding.renders ?? []) {
|
|
56308
|
+
let templateContent;
|
|
56309
|
+
if (renderTarget.inline_template) {
|
|
56310
|
+
templateContent = renderTarget.inline_template;
|
|
56311
|
+
} else if (renderTarget.template) {
|
|
56312
|
+
const templatePath = resolve6(config.configDir, renderTarget.template);
|
|
56313
|
+
try {
|
|
56314
|
+
templateContent = await readFile5(templatePath, "utf8");
|
|
56315
|
+
} catch {
|
|
56316
|
+
diagnostics.push({
|
|
56317
|
+
path: `binding.${binding.software}.renders`,
|
|
56318
|
+
message: `Template file not found: ${templatePath}`,
|
|
56319
|
+
severity: "error"
|
|
56320
|
+
});
|
|
56321
|
+
continue;
|
|
56322
|
+
}
|
|
56323
|
+
} else {
|
|
56324
|
+
diagnostics.push({
|
|
56325
|
+
path: `binding.${binding.software}.renders`,
|
|
56326
|
+
message: "Render target has neither template nor inline_template",
|
|
56327
|
+
severity: "error"
|
|
56328
|
+
});
|
|
56329
|
+
continue;
|
|
56330
|
+
}
|
|
56331
|
+
const compiled = Handlebars2.compile(templateContent, { noEscape: true });
|
|
56332
|
+
const shouldSkipEmpty = renderTarget.skip_empty === true;
|
|
56333
|
+
const context = renderTarget.context;
|
|
56334
|
+
if (context === "system") {
|
|
56335
|
+
const sysCtx = buildSystemContext(dsl);
|
|
56336
|
+
const mergedCtx = { ...sysCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56337
|
+
const rendered = compiled(mergedCtx);
|
|
56338
|
+
const resolvedOutput = resolveBindingRenderOutputPath(renderTarget.output, paths);
|
|
56339
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56340
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56341
|
+
if (!dryRun) {
|
|
56342
|
+
try {
|
|
56343
|
+
await unlink2(outputPath);
|
|
56344
|
+
} catch {
|
|
56345
|
+
}
|
|
56346
|
+
}
|
|
56347
|
+
continue;
|
|
56348
|
+
}
|
|
56349
|
+
if (!dryRun) {
|
|
56350
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56351
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56352
|
+
if (renderTarget.executable) {
|
|
56353
|
+
await chmod(outputPath, 493);
|
|
56354
|
+
}
|
|
56355
|
+
}
|
|
56356
|
+
outputFiles.push(outputPath);
|
|
56357
|
+
} else {
|
|
56358
|
+
const section = getDslSection(dsl, context);
|
|
56359
|
+
const allIds = Object.keys(section);
|
|
56360
|
+
const ids = filterIds(allIds, renderTarget.include, renderTarget.exclude);
|
|
56361
|
+
for (const entityId of ids) {
|
|
56362
|
+
const entityCtx = buildEntityContext(dsl, context, entityId);
|
|
56363
|
+
const mergedCtx = { ...entityCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
|
|
56364
|
+
const rendered = compiled(mergedCtx);
|
|
56365
|
+
const resolvedOutput = resolveBindingRenderOutputPath(
|
|
56366
|
+
expandOutputPath(renderTarget.output, context, entityId),
|
|
56367
|
+
paths
|
|
56368
|
+
);
|
|
56369
|
+
const outputPath = resolve6(config.configDir, resolvedOutput);
|
|
56370
|
+
if (shouldSkipEmpty && rendered.trim().length === 0) {
|
|
56371
|
+
if (!dryRun) {
|
|
56372
|
+
try {
|
|
56373
|
+
await unlink2(outputPath);
|
|
56374
|
+
} catch {
|
|
56375
|
+
}
|
|
56376
|
+
}
|
|
56377
|
+
continue;
|
|
56378
|
+
}
|
|
56379
|
+
if (!dryRun) {
|
|
56380
|
+
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
56381
|
+
await writeFile2(outputPath, rendered, "utf8");
|
|
56382
|
+
if (renderTarget.executable) {
|
|
56383
|
+
await chmod(outputPath, 493);
|
|
56384
|
+
}
|
|
56385
|
+
}
|
|
56386
|
+
outputFiles.push(outputPath);
|
|
56387
|
+
}
|
|
56388
|
+
}
|
|
56389
|
+
}
|
|
55628
56390
|
}
|
|
55629
56391
|
return { outputFiles, diagnostics };
|
|
55630
56392
|
}
|
|
56393
|
+
function resolveBindingRenderOutputPath(output, paths) {
|
|
56394
|
+
return output.replace(/\{(\w+)\}/g, (match, varName) => {
|
|
56395
|
+
const value = paths[varName];
|
|
56396
|
+
return value !== void 0 ? value : match;
|
|
56397
|
+
});
|
|
56398
|
+
}
|
|
55631
56399
|
export {
|
|
55632
56400
|
AgentContractsConfigSchema,
|
|
55633
56401
|
AgentSchema,
|
|
@@ -55635,6 +56403,7 @@ export {
|
|
|
55635
56403
|
ArtifactSchema,
|
|
55636
56404
|
BaseResolveError,
|
|
55637
56405
|
BindingOutputSchema,
|
|
56406
|
+
BindingRenderTargetSchema,
|
|
55638
56407
|
CONTEXT_TYPES,
|
|
55639
56408
|
CheckSchema,
|
|
55640
56409
|
CommandSchema,
|
|
@@ -55652,6 +56421,7 @@ export {
|
|
|
55652
56421
|
GuardrailSchema,
|
|
55653
56422
|
GuardrailScopeSchema,
|
|
55654
56423
|
HandoffTypeSchema,
|
|
56424
|
+
ITERABLE_CONTEXT_TYPES,
|
|
55655
56425
|
InsertAfterOperatorSchema,
|
|
55656
56426
|
MatcherSchema,
|
|
55657
56427
|
MergeError,
|
|
@@ -55664,6 +56434,8 @@ export {
|
|
|
55664
56434
|
ReplaceOperatorSchema,
|
|
55665
56435
|
ReportingSchema,
|
|
55666
56436
|
RuleSchema,
|
|
56437
|
+
SCOPE_NODE_TYPES,
|
|
56438
|
+
ScopeNodeTypeSchema,
|
|
55667
56439
|
SoftwareBindingSchema,
|
|
55668
56440
|
SystemSchema,
|
|
55669
56441
|
TaskSchema,
|