agent-contracts 0.22.9 → 0.23.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/dist/cli.js +175 -158
- package/dist/cli.js.map +1 -1
- package/dist/index.js +98 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50829,12 +50829,18 @@ var MergeError = class extends Error {
|
|
|
50829
50829
|
function isRecord2(v2) {
|
|
50830
50830
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
50831
50831
|
}
|
|
50832
|
-
function hasOperator(obj) {
|
|
50832
|
+
function hasOperator(obj, path) {
|
|
50833
50833
|
const ops = ["$append", "$prepend", "$insert_after", "$replace", "$remove"];
|
|
50834
|
+
const found = [];
|
|
50834
50835
|
for (const op of ops) {
|
|
50835
|
-
if (op in obj)
|
|
50836
|
+
if (op in obj) found.push(op);
|
|
50836
50837
|
}
|
|
50837
|
-
|
|
50838
|
+
if (found.length > 1) {
|
|
50839
|
+
throw new MergeError(
|
|
50840
|
+
`Multiple merge operators in the same object at ${path ?? "unknown"}: ${found.join(", ")}`
|
|
50841
|
+
);
|
|
50842
|
+
}
|
|
50843
|
+
return found.length === 1 ? found[0] : null;
|
|
50838
50844
|
}
|
|
50839
50845
|
function findIndexByIdOrValue(arr, target) {
|
|
50840
50846
|
return arr.findIndex((item) => {
|
|
@@ -50845,7 +50851,7 @@ function findIndexByIdOrValue(arr, target) {
|
|
|
50845
50851
|
});
|
|
50846
50852
|
}
|
|
50847
50853
|
function applyArrayMergeOperator(baseArray, operatorObj, path) {
|
|
50848
|
-
const op = hasOperator(operatorObj);
|
|
50854
|
+
const op = hasOperator(operatorObj, path);
|
|
50849
50855
|
if (!op) return baseArray;
|
|
50850
50856
|
switch (op) {
|
|
50851
50857
|
case "$append": {
|
|
@@ -50919,9 +50925,13 @@ function applyArrayMergeOperator(baseArray, operatorObj, path) {
|
|
|
50919
50925
|
}
|
|
50920
50926
|
}
|
|
50921
50927
|
function orderedInsertAfter(base, afterKey, entries) {
|
|
50928
|
+
const entryKeys = new Set(Object.keys(entries));
|
|
50922
50929
|
const result = {};
|
|
50923
50930
|
let inserted = false;
|
|
50924
50931
|
for (const key of Object.keys(base)) {
|
|
50932
|
+
if (inserted && entryKeys.has(key)) {
|
|
50933
|
+
continue;
|
|
50934
|
+
}
|
|
50925
50935
|
result[key] = base[key];
|
|
50926
50936
|
if (key === afterKey) {
|
|
50927
50937
|
for (const [ek, ev] of Object.entries(entries)) {
|
|
@@ -50930,13 +50940,10 @@ function orderedInsertAfter(base, afterKey, entries) {
|
|
|
50930
50940
|
inserted = true;
|
|
50931
50941
|
}
|
|
50932
50942
|
}
|
|
50933
|
-
if (!inserted) {
|
|
50934
|
-
return result;
|
|
50935
|
-
}
|
|
50936
50943
|
return result;
|
|
50937
50944
|
}
|
|
50938
50945
|
function applyMapMergeOperator(baseMap, operatorObj, path) {
|
|
50939
|
-
const op = hasOperator(operatorObj);
|
|
50946
|
+
const op = hasOperator(operatorObj, path);
|
|
50940
50947
|
if (!op) return baseMap;
|
|
50941
50948
|
switch (op) {
|
|
50942
50949
|
case "$append": {
|
|
@@ -50987,7 +50994,7 @@ function deepMergeEntities(base, project, path, hasExtends) {
|
|
|
50987
50994
|
for (const key of Object.keys(project)) {
|
|
50988
50995
|
const baseVal = result[key];
|
|
50989
50996
|
const projVal = project[key];
|
|
50990
|
-
if (isRecord2(projVal) && hasOperator(projVal)) {
|
|
50997
|
+
if (isRecord2(projVal) && hasOperator(projVal, `${path}.${key}`)) {
|
|
50991
50998
|
if (!hasExtends) {
|
|
50992
50999
|
throw new MergeError(
|
|
50993
51000
|
`Merge operator used without extends at ${path}.${key}`
|
|
@@ -50998,7 +51005,12 @@ function deepMergeEntities(base, project, path, hasExtends) {
|
|
|
50998
51005
|
} else if (isRecord2(baseVal)) {
|
|
50999
51006
|
result[key] = applyMapMergeOperator(baseVal, projVal, `${path}.${key}`);
|
|
51000
51007
|
} else {
|
|
51001
|
-
|
|
51008
|
+
const op = hasOperator(projVal, `${path}.${key}`);
|
|
51009
|
+
if (op === "$replace") {
|
|
51010
|
+
result[key] = projVal["$replace"];
|
|
51011
|
+
} else {
|
|
51012
|
+
result[key] = applyArrayMergeOperator([], projVal, `${path}.${key}`);
|
|
51013
|
+
}
|
|
51002
51014
|
}
|
|
51003
51015
|
} else if (isRecord2(projVal) && isRecord2(baseVal) && !Array.isArray(projVal) && !Array.isArray(baseVal)) {
|
|
51004
51016
|
result[key] = deepMergeEntities(
|
|
@@ -51014,10 +51026,44 @@ function deepMergeEntities(base, project, path, hasExtends) {
|
|
|
51014
51026
|
return result;
|
|
51015
51027
|
}
|
|
51016
51028
|
var OPERATOR_KEYS = /* @__PURE__ */ new Set(["$append", "$prepend", "$insert_after", "$replace", "$remove"]);
|
|
51029
|
+
function mergeSection(base, project, path, hasExtends, mode) {
|
|
51030
|
+
switch (mode) {
|
|
51031
|
+
case "map": {
|
|
51032
|
+
const baseMap = isRecord2(base) ? base : {};
|
|
51033
|
+
return mergeEntityMaps(baseMap, project, path, hasExtends);
|
|
51034
|
+
}
|
|
51035
|
+
case "array": {
|
|
51036
|
+
const baseArr = Array.isArray(base) ? base : [];
|
|
51037
|
+
if (isRecord2(project) && hasOperator(project, path)) {
|
|
51038
|
+
if (!hasExtends) {
|
|
51039
|
+
throw new MergeError(
|
|
51040
|
+
`Merge operator used without extends at ${path}`
|
|
51041
|
+
);
|
|
51042
|
+
}
|
|
51043
|
+
return applyArrayMergeOperator(baseArr, project, path);
|
|
51044
|
+
}
|
|
51045
|
+
const projArr = Array.isArray(project) ? project : [];
|
|
51046
|
+
return [...baseArr, ...projArr];
|
|
51047
|
+
}
|
|
51048
|
+
case "object": {
|
|
51049
|
+
const baseObj = isRecord2(base) ? base : {};
|
|
51050
|
+
const projObj = isRecord2(project) ? project : {};
|
|
51051
|
+
if (hasOperator(projObj, path)) {
|
|
51052
|
+
if (!hasExtends) {
|
|
51053
|
+
throw new MergeError(
|
|
51054
|
+
`Merge operator used without extends at ${path}`
|
|
51055
|
+
);
|
|
51056
|
+
}
|
|
51057
|
+
return applyMapMergeOperator(baseObj, projObj, path);
|
|
51058
|
+
}
|
|
51059
|
+
return deepMergeEntities(baseObj, projObj, path, hasExtends);
|
|
51060
|
+
}
|
|
51061
|
+
}
|
|
51062
|
+
}
|
|
51017
51063
|
function mergeEntityMaps(baseMap, projectMap, path, hasExtends) {
|
|
51018
51064
|
let result;
|
|
51019
51065
|
if (isRecord2(projectMap) && !Array.isArray(projectMap)) {
|
|
51020
|
-
const op = hasOperator(projectMap);
|
|
51066
|
+
const op = hasOperator(projectMap, path);
|
|
51021
51067
|
if (op) {
|
|
51022
51068
|
if (!hasExtends) {
|
|
51023
51069
|
throw new MergeError(
|
|
@@ -51034,9 +51080,10 @@ function mergeEntityMaps(baseMap, projectMap, path, hasExtends) {
|
|
|
51034
51080
|
for (const [key, projVal] of Object.entries(projectMap)) {
|
|
51035
51081
|
if (OPERATOR_KEYS.has(key)) continue;
|
|
51036
51082
|
const baseVal = result[key];
|
|
51037
|
-
if (
|
|
51083
|
+
if (isRecord2(projVal) && !Array.isArray(projVal)) {
|
|
51084
|
+
const baseObj = isRecord2(baseVal) ? baseVal : {};
|
|
51038
51085
|
result[key] = deepMergeEntities(
|
|
51039
|
-
|
|
51086
|
+
baseObj,
|
|
51040
51087
|
projVal,
|
|
51041
51088
|
`${path}.${key}`,
|
|
51042
51089
|
hasExtends
|
|
@@ -51047,44 +51094,33 @@ function mergeEntityMaps(baseMap, projectMap, path, hasExtends) {
|
|
|
51047
51094
|
}
|
|
51048
51095
|
return result;
|
|
51049
51096
|
}
|
|
51050
|
-
var
|
|
51051
|
-
|
|
51052
|
-
|
|
51053
|
-
|
|
51054
|
-
|
|
51055
|
-
|
|
51056
|
-
|
|
51057
|
-
|
|
51058
|
-
|
|
51059
|
-
|
|
51060
|
-
|
|
51061
|
-
|
|
51062
|
-
|
|
51063
|
-
|
|
51064
|
-
|
|
51097
|
+
var DSL_SECTIONS = {
|
|
51098
|
+
agents: "map",
|
|
51099
|
+
tasks: "map",
|
|
51100
|
+
artifacts: "map",
|
|
51101
|
+
tools: "map",
|
|
51102
|
+
validations: "map",
|
|
51103
|
+
handoff_types: "map",
|
|
51104
|
+
imports: "map",
|
|
51105
|
+
workflow: "map",
|
|
51106
|
+
policies: "map",
|
|
51107
|
+
guardrails: "map",
|
|
51108
|
+
guardrail_policies: "map",
|
|
51109
|
+
components: "map",
|
|
51110
|
+
extensions: "map",
|
|
51111
|
+
system: "object"
|
|
51112
|
+
};
|
|
51065
51113
|
function mergeDsl(base, project) {
|
|
51066
51114
|
const hasExtends = typeof project["extends"] === "string";
|
|
51067
51115
|
const result = { ...base, ...project };
|
|
51068
|
-
|
|
51069
|
-
|
|
51070
|
-
|
|
51071
|
-
|
|
51072
|
-
|
|
51073
|
-
hasExtends
|
|
51074
|
-
);
|
|
51075
|
-
}
|
|
51076
|
-
for (const section of MERGE_SECTIONS) {
|
|
51077
|
-
const baseVal = base[section];
|
|
51078
|
-
const projVal = project[section];
|
|
51079
|
-
if (projVal === void 0) {
|
|
51080
|
-
continue;
|
|
51081
|
-
}
|
|
51082
|
-
const baseMap = isRecord2(baseVal) ? baseVal : {};
|
|
51083
|
-
result[section] = mergeEntityMaps(
|
|
51084
|
-
baseMap,
|
|
51085
|
-
projVal,
|
|
51116
|
+
for (const [section, mode] of Object.entries(DSL_SECTIONS)) {
|
|
51117
|
+
if (project[section] === void 0) continue;
|
|
51118
|
+
result[section] = mergeSection(
|
|
51119
|
+
base[section],
|
|
51120
|
+
project[section],
|
|
51086
51121
|
section,
|
|
51087
|
-
hasExtends
|
|
51122
|
+
hasExtends,
|
|
51123
|
+
mode
|
|
51088
51124
|
);
|
|
51089
51125
|
}
|
|
51090
51126
|
delete result["extends"];
|
|
@@ -51181,42 +51217,23 @@ function expandDefaults(data) {
|
|
|
51181
51217
|
}
|
|
51182
51218
|
|
|
51183
51219
|
// src/config/binding-merger.ts
|
|
51184
|
-
|
|
51185
|
-
|
|
51186
|
-
|
|
51187
|
-
|
|
51188
|
-
|
|
51220
|
+
var BINDING_SECTIONS = {
|
|
51221
|
+
guardrail_impl: "map",
|
|
51222
|
+
outputs: "map",
|
|
51223
|
+
renders: "array",
|
|
51224
|
+
reporting: "object"
|
|
51225
|
+
};
|
|
51189
51226
|
function mergeBinding(base, project) {
|
|
51190
51227
|
const hasExtends = typeof project["extends"] === "string";
|
|
51191
51228
|
const result = { ...base, ...project };
|
|
51192
|
-
for (const section of
|
|
51193
|
-
|
|
51194
|
-
|
|
51195
|
-
|
|
51196
|
-
|
|
51197
|
-
}
|
|
51198
|
-
const baseMap = isRecord3(baseVal) ? baseVal : {};
|
|
51199
|
-
result[section] = mergeEntityMaps(
|
|
51200
|
-
baseMap,
|
|
51201
|
-
projVal,
|
|
51229
|
+
for (const [section, mode] of Object.entries(BINDING_SECTIONS)) {
|
|
51230
|
+
if (project[section] === void 0) continue;
|
|
51231
|
+
result[section] = mergeSection(
|
|
51232
|
+
base[section],
|
|
51233
|
+
project[section],
|
|
51202
51234
|
section,
|
|
51203
|
-
hasExtends
|
|
51204
|
-
|
|
51205
|
-
}
|
|
51206
|
-
for (const section of BINDING_ARRAY_MERGE_SECTIONS) {
|
|
51207
|
-
const baseVal = base[section];
|
|
51208
|
-
const projVal = project[section];
|
|
51209
|
-
if (projVal === void 0) continue;
|
|
51210
|
-
const baseArr = Array.isArray(baseVal) ? baseVal : [];
|
|
51211
|
-
const projArr = Array.isArray(projVal) ? projVal : [];
|
|
51212
|
-
result[section] = [...baseArr, ...projArr];
|
|
51213
|
-
}
|
|
51214
|
-
if (project["reporting"] !== void 0 && isRecord3(base["reporting"]) && isRecord3(project["reporting"])) {
|
|
51215
|
-
result["reporting"] = deepMergeEntities(
|
|
51216
|
-
base["reporting"],
|
|
51217
|
-
project["reporting"],
|
|
51218
|
-
"reporting",
|
|
51219
|
-
hasExtends
|
|
51235
|
+
hasExtends,
|
|
51236
|
+
mode
|
|
51220
51237
|
);
|
|
51221
51238
|
}
|
|
51222
51239
|
delete result["extends"];
|
|
@@ -51430,7 +51447,7 @@ function checkDecisionStepRoutingKey(data) {
|
|
|
51430
51447
|
}
|
|
51431
51448
|
return diagnostics;
|
|
51432
51449
|
}
|
|
51433
|
-
function
|
|
51450
|
+
function isRecord3(v2) {
|
|
51434
51451
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
51435
51452
|
}
|
|
51436
51453
|
function* enumerateEntitiesByType(data, nodeType) {
|
|
@@ -51440,41 +51457,41 @@ function* enumerateEntitiesByType(data, nodeType) {
|
|
|
51440
51457
|
return;
|
|
51441
51458
|
case "system": {
|
|
51442
51459
|
const sys = data["system"];
|
|
51443
|
-
if (
|
|
51460
|
+
if (isRecord3(sys)) yield { path: "system", obj: sys };
|
|
51444
51461
|
return;
|
|
51445
51462
|
}
|
|
51446
51463
|
case "agent": {
|
|
51447
51464
|
const agents = data["agents"];
|
|
51448
|
-
if (!
|
|
51465
|
+
if (!isRecord3(agents)) return;
|
|
51449
51466
|
for (const [id, a3] of Object.entries(agents)) {
|
|
51450
|
-
if (
|
|
51467
|
+
if (isRecord3(a3)) yield { path: `agents.${id}`, obj: a3 };
|
|
51451
51468
|
}
|
|
51452
51469
|
return;
|
|
51453
51470
|
}
|
|
51454
51471
|
case "rule": {
|
|
51455
51472
|
const agents = data["agents"];
|
|
51456
|
-
if (!
|
|
51473
|
+
if (!isRecord3(agents)) return;
|
|
51457
51474
|
for (const [aid, a3] of Object.entries(agents)) {
|
|
51458
|
-
if (!
|
|
51475
|
+
if (!isRecord3(a3)) continue;
|
|
51459
51476
|
const rules = a3["rules"];
|
|
51460
51477
|
if (!Array.isArray(rules)) continue;
|
|
51461
51478
|
for (let i3 = 0; i3 < rules.length; i3++) {
|
|
51462
51479
|
const r3 = rules[i3];
|
|
51463
|
-
if (
|
|
51480
|
+
if (isRecord3(r3)) yield { path: `agents.${aid}.rules[${i3}]`, obj: r3 };
|
|
51464
51481
|
}
|
|
51465
51482
|
}
|
|
51466
51483
|
return;
|
|
51467
51484
|
}
|
|
51468
51485
|
case "escalation_criterion": {
|
|
51469
51486
|
const agents = data["agents"];
|
|
51470
|
-
if (!
|
|
51487
|
+
if (!isRecord3(agents)) return;
|
|
51471
51488
|
for (const [aid, a3] of Object.entries(agents)) {
|
|
51472
|
-
if (!
|
|
51489
|
+
if (!isRecord3(a3)) continue;
|
|
51473
51490
|
const esc = a3["escalation_criteria"];
|
|
51474
51491
|
if (!Array.isArray(esc)) continue;
|
|
51475
51492
|
for (let i3 = 0; i3 < esc.length; i3++) {
|
|
51476
51493
|
const e3 = esc[i3];
|
|
51477
|
-
if (
|
|
51494
|
+
if (isRecord3(e3)) {
|
|
51478
51495
|
yield {
|
|
51479
51496
|
path: `agents.${aid}.escalation_criteria[${i3}]`,
|
|
51480
51497
|
obj: e3
|
|
@@ -51486,14 +51503,14 @@ function* enumerateEntitiesByType(data, nodeType) {
|
|
|
51486
51503
|
}
|
|
51487
51504
|
case "prerequisite": {
|
|
51488
51505
|
const agents = data["agents"];
|
|
51489
|
-
if (!
|
|
51506
|
+
if (!isRecord3(agents)) return;
|
|
51490
51507
|
for (const [aid, a3] of Object.entries(agents)) {
|
|
51491
|
-
if (!
|
|
51508
|
+
if (!isRecord3(a3)) continue;
|
|
51492
51509
|
const pre = a3["prerequisites"];
|
|
51493
51510
|
if (!Array.isArray(pre)) continue;
|
|
51494
51511
|
for (let i3 = 0; i3 < pre.length; i3++) {
|
|
51495
51512
|
const p2 = pre[i3];
|
|
51496
|
-
if (
|
|
51513
|
+
if (isRecord3(p2)) {
|
|
51497
51514
|
yield { path: `agents.${aid}.prerequisites[${i3}]`, obj: p2 };
|
|
51498
51515
|
}
|
|
51499
51516
|
}
|
|
@@ -51502,22 +51519,22 @@ function* enumerateEntitiesByType(data, nodeType) {
|
|
|
51502
51519
|
}
|
|
51503
51520
|
case "task": {
|
|
51504
51521
|
const tasks = data["tasks"];
|
|
51505
|
-
if (!
|
|
51522
|
+
if (!isRecord3(tasks)) return;
|
|
51506
51523
|
for (const [id, t3] of Object.entries(tasks)) {
|
|
51507
|
-
if (
|
|
51524
|
+
if (isRecord3(t3)) yield { path: `tasks.${id}`, obj: t3 };
|
|
51508
51525
|
}
|
|
51509
51526
|
return;
|
|
51510
51527
|
}
|
|
51511
51528
|
case "execution_step": {
|
|
51512
51529
|
const tasks = data["tasks"];
|
|
51513
|
-
if (!
|
|
51530
|
+
if (!isRecord3(tasks)) return;
|
|
51514
51531
|
for (const [tid, t3] of Object.entries(tasks)) {
|
|
51515
|
-
if (!
|
|
51532
|
+
if (!isRecord3(t3)) continue;
|
|
51516
51533
|
const steps = t3["execution_steps"];
|
|
51517
51534
|
if (!Array.isArray(steps)) continue;
|
|
51518
51535
|
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
51519
51536
|
const s2 = steps[i3];
|
|
51520
|
-
if (
|
|
51537
|
+
if (isRecord3(s2)) {
|
|
51521
51538
|
yield {
|
|
51522
51539
|
path: `tasks.${tid}.execution_steps[${i3}]`,
|
|
51523
51540
|
obj: s2
|
|
@@ -51529,30 +51546,30 @@ function* enumerateEntitiesByType(data, nodeType) {
|
|
|
51529
51546
|
}
|
|
51530
51547
|
case "artifact": {
|
|
51531
51548
|
const arts = data["artifacts"];
|
|
51532
|
-
if (!
|
|
51549
|
+
if (!isRecord3(arts)) return;
|
|
51533
51550
|
for (const [id, a3] of Object.entries(arts)) {
|
|
51534
|
-
if (
|
|
51551
|
+
if (isRecord3(a3)) yield { path: `artifacts.${id}`, obj: a3 };
|
|
51535
51552
|
}
|
|
51536
51553
|
return;
|
|
51537
51554
|
}
|
|
51538
51555
|
case "tool": {
|
|
51539
51556
|
const tools = data["tools"];
|
|
51540
|
-
if (!
|
|
51557
|
+
if (!isRecord3(tools)) return;
|
|
51541
51558
|
for (const [id, t3] of Object.entries(tools)) {
|
|
51542
|
-
if (
|
|
51559
|
+
if (isRecord3(t3)) yield { path: `tools.${id}`, obj: t3 };
|
|
51543
51560
|
}
|
|
51544
51561
|
return;
|
|
51545
51562
|
}
|
|
51546
51563
|
case "tool_command": {
|
|
51547
51564
|
const tools = data["tools"];
|
|
51548
|
-
if (!
|
|
51565
|
+
if (!isRecord3(tools)) return;
|
|
51549
51566
|
for (const [tid, t3] of Object.entries(tools)) {
|
|
51550
|
-
if (!
|
|
51567
|
+
if (!isRecord3(t3)) continue;
|
|
51551
51568
|
const cmds = t3["commands"];
|
|
51552
51569
|
if (!Array.isArray(cmds)) continue;
|
|
51553
51570
|
for (let i3 = 0; i3 < cmds.length; i3++) {
|
|
51554
51571
|
const c2 = cmds[i3];
|
|
51555
|
-
if (
|
|
51572
|
+
if (isRecord3(c2)) {
|
|
51556
51573
|
yield { path: `tools.${tid}.commands[${i3}]`, obj: c2 };
|
|
51557
51574
|
}
|
|
51558
51575
|
}
|
|
@@ -51561,38 +51578,38 @@ function* enumerateEntitiesByType(data, nodeType) {
|
|
|
51561
51578
|
}
|
|
51562
51579
|
case "validation": {
|
|
51563
51580
|
const vals = data["validations"];
|
|
51564
|
-
if (!
|
|
51581
|
+
if (!isRecord3(vals)) return;
|
|
51565
51582
|
for (const [id, v2] of Object.entries(vals)) {
|
|
51566
|
-
if (
|
|
51583
|
+
if (isRecord3(v2)) yield { path: `validations.${id}`, obj: v2 };
|
|
51567
51584
|
}
|
|
51568
51585
|
return;
|
|
51569
51586
|
}
|
|
51570
51587
|
case "handoff_type": {
|
|
51571
51588
|
const ht = data["handoff_types"];
|
|
51572
|
-
if (!
|
|
51589
|
+
if (!isRecord3(ht)) return;
|
|
51573
51590
|
for (const [id, h2] of Object.entries(ht)) {
|
|
51574
|
-
if (
|
|
51591
|
+
if (isRecord3(h2)) yield { path: `handoff_types.${id}`, obj: h2 };
|
|
51575
51592
|
}
|
|
51576
51593
|
return;
|
|
51577
51594
|
}
|
|
51578
51595
|
case "workflow": {
|
|
51579
51596
|
const wf = data["workflow"];
|
|
51580
|
-
if (!
|
|
51597
|
+
if (!isRecord3(wf)) return;
|
|
51581
51598
|
for (const [id, w2] of Object.entries(wf)) {
|
|
51582
|
-
if (
|
|
51599
|
+
if (isRecord3(w2)) yield { path: `workflow.${id}`, obj: w2 };
|
|
51583
51600
|
}
|
|
51584
51601
|
return;
|
|
51585
51602
|
}
|
|
51586
51603
|
case "workflow_step": {
|
|
51587
51604
|
const wf = data["workflow"];
|
|
51588
|
-
if (!
|
|
51605
|
+
if (!isRecord3(wf)) return;
|
|
51589
51606
|
for (const [wid, w2] of Object.entries(wf)) {
|
|
51590
|
-
if (!
|
|
51607
|
+
if (!isRecord3(w2)) continue;
|
|
51591
51608
|
const steps = w2["steps"];
|
|
51592
51609
|
if (!Array.isArray(steps)) continue;
|
|
51593
51610
|
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
51594
51611
|
const s2 = steps[i3];
|
|
51595
|
-
if (
|
|
51612
|
+
if (isRecord3(s2)) {
|
|
51596
51613
|
yield { path: `workflow.${wid}.steps[${i3}]`, obj: s2 };
|
|
51597
51614
|
}
|
|
51598
51615
|
}
|
|
@@ -51601,25 +51618,25 @@ function* enumerateEntitiesByType(data, nodeType) {
|
|
|
51601
51618
|
}
|
|
51602
51619
|
case "policy": {
|
|
51603
51620
|
const pol = data["policies"];
|
|
51604
|
-
if (!
|
|
51621
|
+
if (!isRecord3(pol)) return;
|
|
51605
51622
|
for (const [id, p2] of Object.entries(pol)) {
|
|
51606
|
-
if (
|
|
51623
|
+
if (isRecord3(p2)) yield { path: `policies.${id}`, obj: p2 };
|
|
51607
51624
|
}
|
|
51608
51625
|
return;
|
|
51609
51626
|
}
|
|
51610
51627
|
case "guardrail": {
|
|
51611
51628
|
const gr = data["guardrails"];
|
|
51612
|
-
if (!
|
|
51629
|
+
if (!isRecord3(gr)) return;
|
|
51613
51630
|
for (const [id, g2] of Object.entries(gr)) {
|
|
51614
|
-
if (
|
|
51631
|
+
if (isRecord3(g2)) yield { path: `guardrails.${id}`, obj: g2 };
|
|
51615
51632
|
}
|
|
51616
51633
|
return;
|
|
51617
51634
|
}
|
|
51618
51635
|
case "guardrail_policy": {
|
|
51619
51636
|
const gp = data["guardrail_policies"];
|
|
51620
|
-
if (!
|
|
51637
|
+
if (!isRecord3(gp)) return;
|
|
51621
51638
|
for (const [id, p2] of Object.entries(gp)) {
|
|
51622
|
-
if (
|
|
51639
|
+
if (isRecord3(p2)) yield { path: `guardrail_policies.${id}`, obj: p2 };
|
|
51623
51640
|
}
|
|
51624
51641
|
return;
|
|
51625
51642
|
}
|
|
@@ -51668,7 +51685,7 @@ function validateDeclaredExtension(parentPath, nodeType, key, val, declMap, diag
|
|
|
51668
51685
|
}
|
|
51669
51686
|
}
|
|
51670
51687
|
function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInstance, strict) {
|
|
51671
|
-
if (!
|
|
51688
|
+
if (!isRecord3(value)) return;
|
|
51672
51689
|
const obj = value;
|
|
51673
51690
|
for (const key of Object.keys(obj)) {
|
|
51674
51691
|
if (key === "extensions" || key === "extensions_strict" || key === "x-extensions" || key === "x-extensions-strict") {
|
|
@@ -51690,7 +51707,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51690
51707
|
switch (nodeType) {
|
|
51691
51708
|
case "root": {
|
|
51692
51709
|
const sys = obj["system"];
|
|
51693
|
-
if (
|
|
51710
|
+
if (isRecord3(sys)) {
|
|
51694
51711
|
walkExtensionNodes(
|
|
51695
51712
|
sys,
|
|
51696
51713
|
"system",
|
|
@@ -51702,9 +51719,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51702
51719
|
);
|
|
51703
51720
|
}
|
|
51704
51721
|
const agents = obj["agents"];
|
|
51705
|
-
if (
|
|
51722
|
+
if (isRecord3(agents)) {
|
|
51706
51723
|
for (const [id, a3] of Object.entries(agents)) {
|
|
51707
|
-
if (
|
|
51724
|
+
if (isRecord3(a3)) {
|
|
51708
51725
|
walkExtensionNodes(
|
|
51709
51726
|
a3,
|
|
51710
51727
|
`agents.${id}`,
|
|
@@ -51718,9 +51735,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51718
51735
|
}
|
|
51719
51736
|
}
|
|
51720
51737
|
const tasks = obj["tasks"];
|
|
51721
|
-
if (
|
|
51738
|
+
if (isRecord3(tasks)) {
|
|
51722
51739
|
for (const [id, t3] of Object.entries(tasks)) {
|
|
51723
|
-
if (
|
|
51740
|
+
if (isRecord3(t3)) {
|
|
51724
51741
|
walkExtensionNodes(
|
|
51725
51742
|
t3,
|
|
51726
51743
|
`tasks.${id}`,
|
|
@@ -51734,9 +51751,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51734
51751
|
}
|
|
51735
51752
|
}
|
|
51736
51753
|
const artifacts = obj["artifacts"];
|
|
51737
|
-
if (
|
|
51754
|
+
if (isRecord3(artifacts)) {
|
|
51738
51755
|
for (const [id, a3] of Object.entries(artifacts)) {
|
|
51739
|
-
if (
|
|
51756
|
+
if (isRecord3(a3)) {
|
|
51740
51757
|
walkExtensionNodes(
|
|
51741
51758
|
a3,
|
|
51742
51759
|
`artifacts.${id}`,
|
|
@@ -51750,9 +51767,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51750
51767
|
}
|
|
51751
51768
|
}
|
|
51752
51769
|
const tools = obj["tools"];
|
|
51753
|
-
if (
|
|
51770
|
+
if (isRecord3(tools)) {
|
|
51754
51771
|
for (const [id, t3] of Object.entries(tools)) {
|
|
51755
|
-
if (
|
|
51772
|
+
if (isRecord3(t3)) {
|
|
51756
51773
|
walkExtensionNodes(
|
|
51757
51774
|
t3,
|
|
51758
51775
|
`tools.${id}`,
|
|
@@ -51766,9 +51783,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51766
51783
|
}
|
|
51767
51784
|
}
|
|
51768
51785
|
const validations = obj["validations"];
|
|
51769
|
-
if (
|
|
51786
|
+
if (isRecord3(validations)) {
|
|
51770
51787
|
for (const [id, v2] of Object.entries(validations)) {
|
|
51771
|
-
if (
|
|
51788
|
+
if (isRecord3(v2)) {
|
|
51772
51789
|
walkExtensionNodes(
|
|
51773
51790
|
v2,
|
|
51774
51791
|
`validations.${id}`,
|
|
@@ -51782,9 +51799,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51782
51799
|
}
|
|
51783
51800
|
}
|
|
51784
51801
|
const handoffTypes = obj["handoff_types"];
|
|
51785
|
-
if (
|
|
51802
|
+
if (isRecord3(handoffTypes)) {
|
|
51786
51803
|
for (const [id, h2] of Object.entries(handoffTypes)) {
|
|
51787
|
-
if (
|
|
51804
|
+
if (isRecord3(h2)) {
|
|
51788
51805
|
walkExtensionNodes(
|
|
51789
51806
|
h2,
|
|
51790
51807
|
`handoff_types.${id}`,
|
|
@@ -51798,9 +51815,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51798
51815
|
}
|
|
51799
51816
|
}
|
|
51800
51817
|
const workflow = obj["workflow"];
|
|
51801
|
-
if (
|
|
51818
|
+
if (isRecord3(workflow)) {
|
|
51802
51819
|
for (const [id, w2] of Object.entries(workflow)) {
|
|
51803
|
-
if (
|
|
51820
|
+
if (isRecord3(w2)) {
|
|
51804
51821
|
walkExtensionNodes(
|
|
51805
51822
|
w2,
|
|
51806
51823
|
`workflow.${id}`,
|
|
@@ -51814,9 +51831,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51814
51831
|
}
|
|
51815
51832
|
}
|
|
51816
51833
|
const policies = obj["policies"];
|
|
51817
|
-
if (
|
|
51834
|
+
if (isRecord3(policies)) {
|
|
51818
51835
|
for (const [id, p2] of Object.entries(policies)) {
|
|
51819
|
-
if (
|
|
51836
|
+
if (isRecord3(p2)) {
|
|
51820
51837
|
walkExtensionNodes(
|
|
51821
51838
|
p2,
|
|
51822
51839
|
`policies.${id}`,
|
|
@@ -51830,9 +51847,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51830
51847
|
}
|
|
51831
51848
|
}
|
|
51832
51849
|
const guardrails = obj["guardrails"];
|
|
51833
|
-
if (
|
|
51850
|
+
if (isRecord3(guardrails)) {
|
|
51834
51851
|
for (const [id, g2] of Object.entries(guardrails)) {
|
|
51835
|
-
if (
|
|
51852
|
+
if (isRecord3(g2)) {
|
|
51836
51853
|
walkExtensionNodes(
|
|
51837
51854
|
g2,
|
|
51838
51855
|
`guardrails.${id}`,
|
|
@@ -51846,9 +51863,9 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51846
51863
|
}
|
|
51847
51864
|
}
|
|
51848
51865
|
const guardrailPolicies = obj["guardrail_policies"];
|
|
51849
|
-
if (
|
|
51866
|
+
if (isRecord3(guardrailPolicies)) {
|
|
51850
51867
|
for (const [id, p2] of Object.entries(guardrailPolicies)) {
|
|
51851
|
-
if (
|
|
51868
|
+
if (isRecord3(p2)) {
|
|
51852
51869
|
walkExtensionNodes(
|
|
51853
51870
|
p2,
|
|
51854
51871
|
`guardrail_policies.${id}`,
|
|
@@ -51868,7 +51885,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51868
51885
|
if (Array.isArray(rules)) {
|
|
51869
51886
|
for (let i3 = 0; i3 < rules.length; i3++) {
|
|
51870
51887
|
const r3 = rules[i3];
|
|
51871
|
-
if (
|
|
51888
|
+
if (isRecord3(r3)) {
|
|
51872
51889
|
walkExtensionNodes(
|
|
51873
51890
|
r3,
|
|
51874
51891
|
`${path}.rules[${i3}]`,
|
|
@@ -51885,7 +51902,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51885
51902
|
if (Array.isArray(esc)) {
|
|
51886
51903
|
for (let i3 = 0; i3 < esc.length; i3++) {
|
|
51887
51904
|
const e3 = esc[i3];
|
|
51888
|
-
if (
|
|
51905
|
+
if (isRecord3(e3)) {
|
|
51889
51906
|
walkExtensionNodes(
|
|
51890
51907
|
e3,
|
|
51891
51908
|
`${path}.escalation_criteria[${i3}]`,
|
|
@@ -51902,7 +51919,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51902
51919
|
if (Array.isArray(pre)) {
|
|
51903
51920
|
for (let i3 = 0; i3 < pre.length; i3++) {
|
|
51904
51921
|
const p2 = pre[i3];
|
|
51905
|
-
if (
|
|
51922
|
+
if (isRecord3(p2)) {
|
|
51906
51923
|
walkExtensionNodes(
|
|
51907
51924
|
p2,
|
|
51908
51925
|
`${path}.prerequisites[${i3}]`,
|
|
@@ -51922,7 +51939,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51922
51939
|
if (Array.isArray(steps)) {
|
|
51923
51940
|
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
51924
51941
|
const s2 = steps[i3];
|
|
51925
|
-
if (
|
|
51942
|
+
if (isRecord3(s2)) {
|
|
51926
51943
|
walkExtensionNodes(
|
|
51927
51944
|
s2,
|
|
51928
51945
|
`${path}.execution_steps[${i3}]`,
|
|
@@ -51942,7 +51959,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51942
51959
|
if (Array.isArray(cmds)) {
|
|
51943
51960
|
for (let i3 = 0; i3 < cmds.length; i3++) {
|
|
51944
51961
|
const c2 = cmds[i3];
|
|
51945
|
-
if (
|
|
51962
|
+
if (isRecord3(c2)) {
|
|
51946
51963
|
walkExtensionNodes(
|
|
51947
51964
|
c2,
|
|
51948
51965
|
`${path}.commands[${i3}]`,
|
|
@@ -51962,7 +51979,7 @@ function walkExtensionNodes(value, path, nodeType, declMap, diagnostics, ajvInst
|
|
|
51962
51979
|
if (Array.isArray(steps)) {
|
|
51963
51980
|
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
51964
51981
|
const s2 = steps[i3];
|
|
51965
|
-
if (
|
|
51982
|
+
if (isRecord3(s2)) {
|
|
51966
51983
|
walkExtensionNodes(
|
|
51967
51984
|
s2,
|
|
51968
51985
|
`${path}.steps[${i3}]`,
|
|
@@ -51985,7 +52002,7 @@ function checkExtensionValidation(data) {
|
|
|
51985
52002
|
const strict = data["extensions_strict"] === true;
|
|
51986
52003
|
const raw = data["extensions"];
|
|
51987
52004
|
let declMap;
|
|
51988
|
-
if (!
|
|
52005
|
+
if (!isRecord3(raw) || Object.keys(raw).length === 0) {
|
|
51989
52006
|
if (!strict) return [];
|
|
51990
52007
|
declMap = {};
|
|
51991
52008
|
} else {
|
|
@@ -53178,7 +53195,7 @@ var validationExecutorNoContextRule = {
|
|
|
53178
53195
|
};
|
|
53179
53196
|
|
|
53180
53197
|
// src/linter/rules/extension-consumption.ts
|
|
53181
|
-
function
|
|
53198
|
+
function isRecord4(v2) {
|
|
53182
53199
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
53183
53200
|
}
|
|
53184
53201
|
function collectXUsages(dsl) {
|
|
@@ -53199,7 +53216,7 @@ function collectXUsages(dsl) {
|
|
|
53199
53216
|
}
|
|
53200
53217
|
}
|
|
53201
53218
|
walkObj(dsl, "", "root");
|
|
53202
|
-
if (
|
|
53219
|
+
if (isRecord4(dsl.system)) {
|
|
53203
53220
|
walkObj(dsl.system, "system", "system");
|
|
53204
53221
|
}
|
|
53205
53222
|
for (const [id, agent] of Object.entries(dsl.agents)) {
|
|
@@ -53208,19 +53225,19 @@ function collectXUsages(dsl) {
|
|
|
53208
53225
|
if (Array.isArray(agentObj["rules"])) {
|
|
53209
53226
|
for (let i3 = 0; i3 < agentObj["rules"].length; i3++) {
|
|
53210
53227
|
const r3 = agentObj["rules"][i3];
|
|
53211
|
-
if (
|
|
53228
|
+
if (isRecord4(r3)) walkObj(r3, `agents.${id}.rules[${i3}]`, "rule");
|
|
53212
53229
|
}
|
|
53213
53230
|
}
|
|
53214
53231
|
if (Array.isArray(agentObj["escalation_criteria"])) {
|
|
53215
53232
|
for (let i3 = 0; i3 < agentObj["escalation_criteria"].length; i3++) {
|
|
53216
53233
|
const e3 = agentObj["escalation_criteria"][i3];
|
|
53217
|
-
if (
|
|
53234
|
+
if (isRecord4(e3)) walkObj(e3, `agents.${id}.escalation_criteria[${i3}]`, "escalation_criterion");
|
|
53218
53235
|
}
|
|
53219
53236
|
}
|
|
53220
53237
|
if (Array.isArray(agentObj["prerequisites"])) {
|
|
53221
53238
|
for (let i3 = 0; i3 < agentObj["prerequisites"].length; i3++) {
|
|
53222
53239
|
const p2 = agentObj["prerequisites"][i3];
|
|
53223
|
-
if (
|
|
53240
|
+
if (isRecord4(p2)) walkObj(p2, `agents.${id}.prerequisites[${i3}]`, "prerequisite");
|
|
53224
53241
|
}
|
|
53225
53242
|
}
|
|
53226
53243
|
}
|
|
@@ -53230,7 +53247,7 @@ function collectXUsages(dsl) {
|
|
|
53230
53247
|
if (Array.isArray(taskObj["execution_steps"])) {
|
|
53231
53248
|
for (let i3 = 0; i3 < taskObj["execution_steps"].length; i3++) {
|
|
53232
53249
|
const s2 = taskObj["execution_steps"][i3];
|
|
53233
|
-
if (
|
|
53250
|
+
if (isRecord4(s2)) walkObj(s2, `tasks.${id}.execution_steps[${i3}]`, "execution_step");
|
|
53234
53251
|
}
|
|
53235
53252
|
}
|
|
53236
53253
|
}
|
|
@@ -53243,7 +53260,7 @@ function collectXUsages(dsl) {
|
|
|
53243
53260
|
if (Array.isArray(toolObj["commands"])) {
|
|
53244
53261
|
for (let i3 = 0; i3 < toolObj["commands"].length; i3++) {
|
|
53245
53262
|
const c2 = toolObj["commands"][i3];
|
|
53246
|
-
if (
|
|
53263
|
+
if (isRecord4(c2)) walkObj(c2, `tools.${id}.commands[${i3}]`, "tool_command");
|
|
53247
53264
|
}
|
|
53248
53265
|
}
|
|
53249
53266
|
}
|
|
@@ -53259,7 +53276,7 @@ function collectXUsages(dsl) {
|
|
|
53259
53276
|
if (Array.isArray(wfObj["steps"])) {
|
|
53260
53277
|
for (let i3 = 0; i3 < wfObj["steps"].length; i3++) {
|
|
53261
53278
|
const s2 = wfObj["steps"][i3];
|
|
53262
|
-
if (
|
|
53279
|
+
if (isRecord4(s2)) walkObj(s2, `workflow.${id}.steps[${i3}]`, "workflow_step");
|
|
53263
53280
|
}
|
|
53264
53281
|
}
|
|
53265
53282
|
}
|
|
@@ -56299,7 +56316,7 @@ function formatDslOverview(dsl) {
|
|
|
56299
56316
|
`- Validations: ${Object.keys(dsl.validations).join(", ")}`
|
|
56300
56317
|
].join("\n");
|
|
56301
56318
|
}
|
|
56302
|
-
function
|
|
56319
|
+
function isRecord5(v2) {
|
|
56303
56320
|
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
56304
56321
|
}
|
|
56305
56322
|
function collectAllXUsages(dsl) {
|
|
@@ -56312,7 +56329,7 @@ function collectAllXUsages(dsl) {
|
|
|
56312
56329
|
}
|
|
56313
56330
|
}
|
|
56314
56331
|
walk2(dsl, "", "root");
|
|
56315
|
-
if (
|
|
56332
|
+
if (isRecord5(dsl.system)) walk2(dsl.system, "system", "system");
|
|
56316
56333
|
for (const [id, a3] of Object.entries(dsl.agents))
|
|
56317
56334
|
walk2(a3, `agents.${id}`, "agent");
|
|
56318
56335
|
for (const [id, t3] of Object.entries(dsl.tasks))
|