agent-contracts 0.10.0 → 0.11.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 +122 -0
- package/dist/cli.js +962 -401
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +297 -5
- package/dist/index.js +726 -233
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -158,11 +158,11 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
158
158
|
}
|
|
159
159
|
function __awaiter(thisArg, _arguments, P2, generator) {
|
|
160
160
|
function adopt(value) {
|
|
161
|
-
return value instanceof P2 ? value : new P2(function(
|
|
162
|
-
|
|
161
|
+
return value instanceof P2 ? value : new P2(function(resolve6) {
|
|
162
|
+
resolve6(value);
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
return new (P2 || (P2 = Promise))(function(
|
|
165
|
+
return new (P2 || (P2 = Promise))(function(resolve6, reject) {
|
|
166
166
|
function fulfilled(value) {
|
|
167
167
|
try {
|
|
168
168
|
step(generator.next(value));
|
|
@@ -178,7 +178,7 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
function step(result) {
|
|
181
|
-
result.done ?
|
|
181
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
182
182
|
}
|
|
183
183
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
184
184
|
});
|
|
@@ -369,14 +369,14 @@ function __asyncValues(o3) {
|
|
|
369
369
|
}, i3);
|
|
370
370
|
function verb(n3) {
|
|
371
371
|
i3[n3] = o3[n3] && function(v2) {
|
|
372
|
-
return new Promise(function(
|
|
373
|
-
v2 = o3[n3](v2), settle(
|
|
372
|
+
return new Promise(function(resolve6, reject) {
|
|
373
|
+
v2 = o3[n3](v2), settle(resolve6, reject, v2.done, v2.value);
|
|
374
374
|
});
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
|
-
function settle(
|
|
377
|
+
function settle(resolve6, reject, d2, v2) {
|
|
378
378
|
Promise.resolve(v2).then(function(v3) {
|
|
379
|
-
|
|
379
|
+
resolve6({ value: v3, done: d2 });
|
|
380
380
|
}, reject);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
@@ -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
|
+
}, z17 = 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 = z17()), 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: () => z15,
|
|
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 z15(e3, t3).value;
|
|
8070
8070
|
}
|
|
8071
|
-
function
|
|
8071
|
+
function z15(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);
|
|
@@ -12936,13 +12936,13 @@ var require_yaml2 = __commonJS({
|
|
|
12936
12936
|
function getLocationForJsonPath(result, path) {
|
|
12937
12937
|
return (0, yaml_1.getLocationForJsonPath)(result, path);
|
|
12938
12938
|
}
|
|
12939
|
-
var
|
|
12939
|
+
var parseYaml4 = (input) => (0, yaml_1.parseWithPointers)(input, {
|
|
12940
12940
|
ignoreDuplicateKeys: false,
|
|
12941
12941
|
mergeKeys: true,
|
|
12942
12942
|
preserveKeyOrder: true,
|
|
12943
12943
|
attachComments: false
|
|
12944
12944
|
});
|
|
12945
|
-
exports.parseYaml =
|
|
12945
|
+
exports.parseYaml = parseYaml4;
|
|
12946
12946
|
exports.Yaml = {
|
|
12947
12947
|
parse: exports.parseYaml,
|
|
12948
12948
|
getLocationForJsonPath,
|
|
@@ -13032,11 +13032,11 @@ function __metadata2(metadataKey, metadataValue) {
|
|
|
13032
13032
|
}
|
|
13033
13033
|
function __awaiter2(thisArg, _arguments, P2, generator) {
|
|
13034
13034
|
function adopt(value) {
|
|
13035
|
-
return value instanceof P2 ? value : new P2(function(
|
|
13036
|
-
|
|
13035
|
+
return value instanceof P2 ? value : new P2(function(resolve6) {
|
|
13036
|
+
resolve6(value);
|
|
13037
13037
|
});
|
|
13038
13038
|
}
|
|
13039
|
-
return new (P2 || (P2 = Promise))(function(
|
|
13039
|
+
return new (P2 || (P2 = Promise))(function(resolve6, reject) {
|
|
13040
13040
|
function fulfilled(value) {
|
|
13041
13041
|
try {
|
|
13042
13042
|
step(generator.next(value));
|
|
@@ -13052,7 +13052,7 @@ function __awaiter2(thisArg, _arguments, P2, generator) {
|
|
|
13052
13052
|
}
|
|
13053
13053
|
}
|
|
13054
13054
|
function step(result) {
|
|
13055
|
-
result.done ?
|
|
13055
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
13056
13056
|
}
|
|
13057
13057
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13058
13058
|
});
|
|
@@ -13230,14 +13230,14 @@ function __asyncValues2(o3) {
|
|
|
13230
13230
|
}, i3);
|
|
13231
13231
|
function verb(n3) {
|
|
13232
13232
|
i3[n3] = o3[n3] && function(v2) {
|
|
13233
|
-
return new Promise(function(
|
|
13234
|
-
v2 = o3[n3](v2), settle(
|
|
13233
|
+
return new Promise(function(resolve6, reject) {
|
|
13234
|
+
v2 = o3[n3](v2), settle(resolve6, reject, v2.done, v2.value);
|
|
13235
13235
|
});
|
|
13236
13236
|
};
|
|
13237
13237
|
}
|
|
13238
|
-
function settle(
|
|
13238
|
+
function settle(resolve6, reject, d2, v2) {
|
|
13239
13239
|
Promise.resolve(v2).then(function(v3) {
|
|
13240
|
-
|
|
13240
|
+
resolve6({ value: v3, done: d2 });
|
|
13241
13241
|
}, reject);
|
|
13242
13242
|
}
|
|
13243
13243
|
}
|
|
@@ -15151,7 +15151,7 @@ function consumeBody() {
|
|
|
15151
15151
|
let accum = [];
|
|
15152
15152
|
let accumBytes = 0;
|
|
15153
15153
|
let abort = false;
|
|
15154
|
-
return new Body.Promise(function(
|
|
15154
|
+
return new Body.Promise(function(resolve6, reject) {
|
|
15155
15155
|
let resTimeout;
|
|
15156
15156
|
if (_this4.timeout) {
|
|
15157
15157
|
resTimeout = setTimeout(function() {
|
|
@@ -15185,7 +15185,7 @@ function consumeBody() {
|
|
|
15185
15185
|
}
|
|
15186
15186
|
clearTimeout(resTimeout);
|
|
15187
15187
|
try {
|
|
15188
|
-
|
|
15188
|
+
resolve6(Buffer.concat(accum, accumBytes));
|
|
15189
15189
|
} catch (err) {
|
|
15190
15190
|
reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
|
|
15191
15191
|
}
|
|
@@ -15448,7 +15448,7 @@ function fetch(url, opts) {
|
|
|
15448
15448
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
15449
15449
|
}
|
|
15450
15450
|
Body.Promise = fetch.Promise;
|
|
15451
|
-
return new fetch.Promise(function(
|
|
15451
|
+
return new fetch.Promise(function(resolve6, reject) {
|
|
15452
15452
|
const request = new Request(url, opts);
|
|
15453
15453
|
const options = getNodeRequestOptions(request);
|
|
15454
15454
|
const send = (options.protocol === "https:" ? https : http).request;
|
|
@@ -15581,7 +15581,7 @@ function fetch(url, opts) {
|
|
|
15581
15581
|
requestOpts.body = void 0;
|
|
15582
15582
|
requestOpts.headers.delete("content-length");
|
|
15583
15583
|
}
|
|
15584
|
-
|
|
15584
|
+
resolve6(fetch(new Request(locationURL, requestOpts)));
|
|
15585
15585
|
finalize();
|
|
15586
15586
|
return;
|
|
15587
15587
|
}
|
|
@@ -15602,7 +15602,7 @@ function fetch(url, opts) {
|
|
|
15602
15602
|
const codings = headers.get("Content-Encoding");
|
|
15603
15603
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
15604
15604
|
response = new Response(body, response_options);
|
|
15605
|
-
|
|
15605
|
+
resolve6(response);
|
|
15606
15606
|
return;
|
|
15607
15607
|
}
|
|
15608
15608
|
const zlibOptions = {
|
|
@@ -15612,7 +15612,7 @@ function fetch(url, opts) {
|
|
|
15612
15612
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
15613
15613
|
body = body.pipe(zlib.createGunzip(zlibOptions));
|
|
15614
15614
|
response = new Response(body, response_options);
|
|
15615
|
-
|
|
15615
|
+
resolve6(response);
|
|
15616
15616
|
return;
|
|
15617
15617
|
}
|
|
15618
15618
|
if (codings == "deflate" || codings == "x-deflate") {
|
|
@@ -15624,12 +15624,12 @@ function fetch(url, opts) {
|
|
|
15624
15624
|
body = body.pipe(zlib.createInflateRaw());
|
|
15625
15625
|
}
|
|
15626
15626
|
response = new Response(body, response_options);
|
|
15627
|
-
|
|
15627
|
+
resolve6(response);
|
|
15628
15628
|
});
|
|
15629
15629
|
raw.on("end", function() {
|
|
15630
15630
|
if (!response) {
|
|
15631
15631
|
response = new Response(body, response_options);
|
|
15632
|
-
|
|
15632
|
+
resolve6(response);
|
|
15633
15633
|
}
|
|
15634
15634
|
});
|
|
15635
15635
|
return;
|
|
@@ -15637,11 +15637,11 @@ function fetch(url, opts) {
|
|
|
15637
15637
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
15638
15638
|
body = body.pipe(zlib.createBrotliDecompress());
|
|
15639
15639
|
response = new Response(body, response_options);
|
|
15640
|
-
|
|
15640
|
+
resolve6(response);
|
|
15641
15641
|
return;
|
|
15642
15642
|
}
|
|
15643
15643
|
response = new Response(body, response_options);
|
|
15644
|
-
|
|
15644
|
+
resolve6(response);
|
|
15645
15645
|
});
|
|
15646
15646
|
writeToStream(req, request);
|
|
15647
15647
|
});
|
|
@@ -16354,13 +16354,13 @@ var require_file = __commonJS({
|
|
|
16354
16354
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16355
16355
|
var fs_1 = __require("fs");
|
|
16356
16356
|
function resolveFile(ref) {
|
|
16357
|
-
return new Promise((
|
|
16357
|
+
return new Promise((resolve6, reject) => {
|
|
16358
16358
|
const path = ref.href();
|
|
16359
16359
|
fs_1.readFile(path, "utf8", (err, data) => {
|
|
16360
16360
|
if (err) {
|
|
16361
16361
|
reject(err);
|
|
16362
16362
|
} else {
|
|
16363
|
-
|
|
16363
|
+
resolve6(data);
|
|
16364
16364
|
}
|
|
16365
16365
|
});
|
|
16366
16366
|
});
|
|
@@ -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 z17(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 = z17(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 = z17(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];
|
|
@@ -23932,7 +23932,7 @@ var require_reader = __commonJS({
|
|
|
23932
23932
|
var lodash_1 = require_lodash();
|
|
23933
23933
|
var fetch_1 = (0, tslib_1.__importDefault)(require_fetch());
|
|
23934
23934
|
var printError_1 = require_printError();
|
|
23935
|
-
async function
|
|
23935
|
+
async function readFile6(name, opts) {
|
|
23936
23936
|
if ((0, path_1.isURL)(name)) {
|
|
23937
23937
|
let response;
|
|
23938
23938
|
let timeout = null;
|
|
@@ -23963,12 +23963,12 @@ var require_reader = __commonJS({
|
|
|
23963
23963
|
}
|
|
23964
23964
|
} else {
|
|
23965
23965
|
try {
|
|
23966
|
-
return await new Promise((
|
|
23966
|
+
return await new Promise((resolve6, reject) => {
|
|
23967
23967
|
fs.readFile(name, opts.encoding, (err, data) => {
|
|
23968
23968
|
if (err !== null) {
|
|
23969
23969
|
reject(err);
|
|
23970
23970
|
} else {
|
|
23971
|
-
|
|
23971
|
+
resolve6(data);
|
|
23972
23972
|
}
|
|
23973
23973
|
});
|
|
23974
23974
|
});
|
|
@@ -23977,10 +23977,10 @@ var require_reader = __commonJS({
|
|
|
23977
23977
|
}
|
|
23978
23978
|
}
|
|
23979
23979
|
}
|
|
23980
|
-
exports.readFile =
|
|
23980
|
+
exports.readFile = readFile6;
|
|
23981
23981
|
async function readParsable(name, opts) {
|
|
23982
23982
|
try {
|
|
23983
|
-
return await
|
|
23983
|
+
return await readFile6(name, opts);
|
|
23984
23984
|
} catch (ex) {
|
|
23985
23985
|
throw new Error(`Could not parse ${name}: ${(0, printError_1.printError)(ex)}`);
|
|
23986
23986
|
}
|
|
@@ -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 z17 = new Array(need + 1).join("0");
|
|
35644
35644
|
if (i3 < 0)
|
|
35645
|
-
c2 = "-" +
|
|
35645
|
+
c2 = "-" + z17 + c2.slice(1);
|
|
35646
35646
|
else
|
|
35647
|
-
c2 =
|
|
35647
|
+
c2 = z17 + c2;
|
|
35648
35648
|
}
|
|
35649
35649
|
}
|
|
35650
35650
|
}
|
|
@@ -40853,14 +40853,14 @@ var require_AsyncFromSyncIteratorContinuation = __commonJS({
|
|
|
40853
40853
|
if (!$Promise) {
|
|
40854
40854
|
throw new $SyntaxError("This environment does not support Promises.");
|
|
40855
40855
|
}
|
|
40856
|
-
return new $Promise(function(
|
|
40856
|
+
return new $Promise(function(resolve6) {
|
|
40857
40857
|
var done = IteratorComplete(result);
|
|
40858
40858
|
var value = IteratorValue(result);
|
|
40859
40859
|
var valueWrapper = PromiseResolve($Promise, value);
|
|
40860
40860
|
var onFulfilled = function(value2) {
|
|
40861
40861
|
return CreateIteratorResultObject(value2, done);
|
|
40862
40862
|
};
|
|
40863
|
-
|
|
40863
|
+
resolve6($then(valueWrapper, onFulfilled));
|
|
40864
40864
|
});
|
|
40865
40865
|
};
|
|
40866
40866
|
}
|
|
@@ -41408,7 +41408,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
|
|
|
41408
41408
|
var O2 = this;
|
|
41409
41409
|
SLOT.assert(O2, "[[SyncIteratorRecord]]");
|
|
41410
41410
|
var argsLength = arguments.length;
|
|
41411
|
-
return new $Promise(function(
|
|
41411
|
+
return new $Promise(function(resolve6) {
|
|
41412
41412
|
var syncIteratorRecord = SLOT.get(O2, "[[SyncIteratorRecord]]");
|
|
41413
41413
|
var result;
|
|
41414
41414
|
if (argsLength > 0) {
|
|
@@ -41416,7 +41416,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
|
|
|
41416
41416
|
} else {
|
|
41417
41417
|
result = IteratorNext(syncIteratorRecord);
|
|
41418
41418
|
}
|
|
41419
|
-
|
|
41419
|
+
resolve6(AsyncFromSyncIteratorContinuation(result));
|
|
41420
41420
|
});
|
|
41421
41421
|
},
|
|
41422
41422
|
"return": function() {
|
|
@@ -41427,12 +41427,12 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
|
|
|
41427
41427
|
SLOT.assert(O2, "[[SyncIteratorRecord]]");
|
|
41428
41428
|
var valueIsPresent = arguments.length > 0;
|
|
41429
41429
|
var value = valueIsPresent ? arguments[0] : void 0;
|
|
41430
|
-
return new $Promise(function(
|
|
41430
|
+
return new $Promise(function(resolve6, reject) {
|
|
41431
41431
|
var syncIterator = SLOT.get(O2, "[[SyncIteratorRecord]]")["[[Iterator]]"];
|
|
41432
41432
|
var iteratorReturn = GetMethod(syncIterator, "return");
|
|
41433
41433
|
if (typeof iteratorReturn === "undefined") {
|
|
41434
41434
|
var iterResult = CreateIteratorResultObject(value, true);
|
|
41435
|
-
Call(
|
|
41435
|
+
Call(resolve6, void 0, [iterResult]);
|
|
41436
41436
|
return;
|
|
41437
41437
|
}
|
|
41438
41438
|
var result;
|
|
@@ -41445,7 +41445,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
|
|
|
41445
41445
|
Call(reject, void 0, [new $TypeError("Iterator `return` method returned a non-object value.")]);
|
|
41446
41446
|
return;
|
|
41447
41447
|
}
|
|
41448
|
-
|
|
41448
|
+
resolve6(AsyncFromSyncIteratorContinuation(result));
|
|
41449
41449
|
});
|
|
41450
41450
|
},
|
|
41451
41451
|
"throw": function() {
|
|
@@ -41456,7 +41456,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
|
|
|
41456
41456
|
SLOT.assert(O2, "[[SyncIteratorRecord]]");
|
|
41457
41457
|
var valueIsPresent = arguments.length > 0;
|
|
41458
41458
|
var value = valueIsPresent ? arguments[0] : void 0;
|
|
41459
|
-
return new $Promise(function(
|
|
41459
|
+
return new $Promise(function(resolve6, reject) {
|
|
41460
41460
|
var syncIterator = SLOT.get(O2, "[[SyncIteratorRecord]]")["[[Iterator]]"];
|
|
41461
41461
|
var throwMethod = GetMethod(syncIterator, "throw");
|
|
41462
41462
|
if (typeof throwMethod === "undefined") {
|
|
@@ -41473,7 +41473,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
|
|
|
41473
41473
|
Call(reject, void 0, [new $TypeError("Iterator `throw` method returned a non-object value.")]);
|
|
41474
41474
|
return;
|
|
41475
41475
|
}
|
|
41476
|
-
|
|
41476
|
+
resolve6(AsyncFromSyncIteratorContinuation(
|
|
41477
41477
|
result
|
|
41478
41478
|
/* , promiseCapability */
|
|
41479
41479
|
));
|
|
@@ -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, z17) => zs.concat(z17), xs)
|
|
49172
49172
|
);
|
|
49173
49173
|
function getLastSegment(instancePath) {
|
|
49174
49174
|
const index4 = instancePath.lastIndexOf("/");
|
|
@@ -50480,184 +50480,273 @@ var ArtifactSchema = z2.object({
|
|
|
50480
50480
|
visibility: z2.string().optional()
|
|
50481
50481
|
}).passthrough();
|
|
50482
50482
|
|
|
50483
|
+
// src/schema/binding.ts
|
|
50484
|
+
import { z as z3 } from "zod";
|
|
50485
|
+
var CommandRegexMatcherSchema = z3.object({
|
|
50486
|
+
type: z3.literal("command_regex"),
|
|
50487
|
+
pattern: z3.string()
|
|
50488
|
+
});
|
|
50489
|
+
var ContentRegexMatcherSchema = z3.object({
|
|
50490
|
+
type: z3.literal("content_regex"),
|
|
50491
|
+
pattern: z3.string(),
|
|
50492
|
+
file_glob: z3.string().optional(),
|
|
50493
|
+
exclude_glob: z3.string().optional()
|
|
50494
|
+
});
|
|
50495
|
+
var FileGlobMatcherSchema = z3.object({
|
|
50496
|
+
type: z3.literal("file_glob"),
|
|
50497
|
+
pattern: z3.string()
|
|
50498
|
+
});
|
|
50499
|
+
var MatcherSchema = z3.discriminatedUnion("type", [
|
|
50500
|
+
CommandRegexMatcherSchema,
|
|
50501
|
+
ContentRegexMatcherSchema,
|
|
50502
|
+
FileGlobMatcherSchema
|
|
50503
|
+
]);
|
|
50504
|
+
var CheckSchema = z3.object({
|
|
50505
|
+
matcher: MatcherSchema.optional(),
|
|
50506
|
+
script: z3.string().optional(),
|
|
50507
|
+
message: z3.string().optional()
|
|
50508
|
+
}).passthrough();
|
|
50509
|
+
var BindingOutputSchema = z3.object({
|
|
50510
|
+
target: z3.string(),
|
|
50511
|
+
template: z3.string().optional(),
|
|
50512
|
+
inline_template: z3.string().optional(),
|
|
50513
|
+
mode: z3.enum(["write", "patch"]).default("write"),
|
|
50514
|
+
group_by: z3.string().optional(),
|
|
50515
|
+
executable: z3.boolean().optional()
|
|
50516
|
+
}).passthrough().refine(
|
|
50517
|
+
(data) => !(data.template && data.inline_template),
|
|
50518
|
+
{ message: "template and inline_template are mutually exclusive" }
|
|
50519
|
+
);
|
|
50520
|
+
var ReportingSchema = z3.object({
|
|
50521
|
+
commands: z3.record(z3.string(), z3.string()),
|
|
50522
|
+
fail_open: z3.boolean().default(true),
|
|
50523
|
+
timeout_ms: z3.number().default(5e3)
|
|
50524
|
+
}).passthrough();
|
|
50525
|
+
var GuardrailImplSchema = z3.object({
|
|
50526
|
+
checks: z3.array(CheckSchema)
|
|
50527
|
+
});
|
|
50528
|
+
var SoftwareBindingSchema = z3.object({
|
|
50529
|
+
software: z3.string(),
|
|
50530
|
+
version: z3.literal(1),
|
|
50531
|
+
extends: z3.string().optional(),
|
|
50532
|
+
guardrail_impl: z3.record(z3.string(), GuardrailImplSchema).optional(),
|
|
50533
|
+
outputs: z3.record(z3.string(), BindingOutputSchema).optional(),
|
|
50534
|
+
reporting: ReportingSchema.optional()
|
|
50535
|
+
}).passthrough();
|
|
50536
|
+
|
|
50483
50537
|
// src/schema/dsl.ts
|
|
50484
|
-
import { z as
|
|
50538
|
+
import { z as z12 } from "zod";
|
|
50485
50539
|
|
|
50486
50540
|
// src/schema/handoff-type.ts
|
|
50487
|
-
import { z as
|
|
50488
|
-
var HandoffTypeSchema =
|
|
50489
|
-
version:
|
|
50490
|
-
description:
|
|
50491
|
-
schema:
|
|
50492
|
-
example:
|
|
50541
|
+
import { z as z4 } from "zod";
|
|
50542
|
+
var HandoffTypeSchema = z4.object({
|
|
50543
|
+
version: z4.number(),
|
|
50544
|
+
description: z4.string().optional(),
|
|
50545
|
+
schema: z4.record(z4.string(), z4.any()),
|
|
50546
|
+
example: z4.record(z4.string(), z4.any()).optional()
|
|
50547
|
+
}).passthrough();
|
|
50548
|
+
|
|
50549
|
+
// src/schema/guardrail.ts
|
|
50550
|
+
import { z as z5 } from "zod";
|
|
50551
|
+
var GuardrailScopeSchema = z5.object({
|
|
50552
|
+
agents: z5.array(z5.string()).optional(),
|
|
50553
|
+
tasks: z5.array(z5.string()).optional(),
|
|
50554
|
+
tools: z5.array(z5.string()).optional(),
|
|
50555
|
+
artifacts: z5.array(z5.string()).optional(),
|
|
50556
|
+
workflows: z5.array(z5.string()).optional()
|
|
50557
|
+
}).passthrough();
|
|
50558
|
+
var GuardrailSchema = z5.object({
|
|
50559
|
+
description: z5.string(),
|
|
50560
|
+
scope: GuardrailScopeSchema,
|
|
50561
|
+
rationale: z5.string().optional(),
|
|
50562
|
+
tags: z5.array(z5.string()).default([]),
|
|
50563
|
+
exemptions: z5.array(z5.string()).optional()
|
|
50564
|
+
}).passthrough();
|
|
50565
|
+
var GuardrailPolicyRuleEscalationSchema = z5.object({
|
|
50566
|
+
target: z5.string(),
|
|
50567
|
+
condition: z5.string().optional()
|
|
50568
|
+
}).passthrough();
|
|
50569
|
+
var GuardrailPolicyRuleSchema = z5.object({
|
|
50570
|
+
guardrail: z5.string(),
|
|
50571
|
+
severity: z5.enum(["critical", "mandatory", "warning", "info"]),
|
|
50572
|
+
action: z5.enum(["block", "warn", "shadow", "info"]),
|
|
50573
|
+
allow_override: z5.boolean().default(false),
|
|
50574
|
+
override_requires: z5.array(z5.string()).optional(),
|
|
50575
|
+
escalation: GuardrailPolicyRuleEscalationSchema.optional()
|
|
50576
|
+
}).passthrough();
|
|
50577
|
+
var GuardrailPolicySchema = z5.object({
|
|
50578
|
+
description: z5.string().optional(),
|
|
50579
|
+
rules: z5.array(GuardrailPolicyRuleSchema)
|
|
50493
50580
|
}).passthrough();
|
|
50494
50581
|
|
|
50495
50582
|
// src/schema/policy.ts
|
|
50496
|
-
import { z as
|
|
50497
|
-
var PolicyWhenSchema =
|
|
50498
|
-
artifact_type:
|
|
50499
|
-
workflow:
|
|
50583
|
+
import { z as z6 } from "zod";
|
|
50584
|
+
var PolicyWhenSchema = z6.object({
|
|
50585
|
+
artifact_type: z6.string().optional(),
|
|
50586
|
+
workflow: z6.string().optional()
|
|
50500
50587
|
}).passthrough();
|
|
50501
|
-
var PolicySchema =
|
|
50588
|
+
var PolicySchema = z6.object({
|
|
50502
50589
|
when: PolicyWhenSchema,
|
|
50503
|
-
requires_validations:
|
|
50504
|
-
requires:
|
|
50590
|
+
requires_validations: z6.array(z6.string()).optional(),
|
|
50591
|
+
requires: z6.array(z6.string()).optional()
|
|
50505
50592
|
}).passthrough();
|
|
50506
50593
|
|
|
50507
50594
|
// src/schema/system.ts
|
|
50508
|
-
import { z as
|
|
50509
|
-
var VersionLiteralSchema =
|
|
50510
|
-
var ExtendsSchema =
|
|
50511
|
-
var SystemSchema =
|
|
50512
|
-
id:
|
|
50513
|
-
name:
|
|
50514
|
-
default_workflow_order:
|
|
50595
|
+
import { z as z7 } from "zod";
|
|
50596
|
+
var VersionLiteralSchema = z7.literal(1);
|
|
50597
|
+
var ExtendsSchema = z7.string().optional();
|
|
50598
|
+
var SystemSchema = z7.object({
|
|
50599
|
+
id: z7.string(),
|
|
50600
|
+
name: z7.string(),
|
|
50601
|
+
default_workflow_order: z7.array(z7.string())
|
|
50515
50602
|
}).passthrough();
|
|
50516
50603
|
|
|
50517
50604
|
// src/schema/task.ts
|
|
50518
|
-
import { z as
|
|
50519
|
-
var ExecutionStepSchema =
|
|
50520
|
-
id:
|
|
50521
|
-
action:
|
|
50522
|
-
description:
|
|
50523
|
-
required:
|
|
50524
|
-
abort_on_failure:
|
|
50525
|
-
uses_tool:
|
|
50526
|
-
produces_artifact:
|
|
50527
|
-
reads_artifact:
|
|
50528
|
-
depends_on:
|
|
50529
|
-
skip_condition:
|
|
50530
|
-
wait_for_approval:
|
|
50605
|
+
import { z as z8 } from "zod";
|
|
50606
|
+
var ExecutionStepSchema = z8.object({
|
|
50607
|
+
id: z8.string(),
|
|
50608
|
+
action: z8.string(),
|
|
50609
|
+
description: z8.string().optional(),
|
|
50610
|
+
required: z8.boolean().optional(),
|
|
50611
|
+
abort_on_failure: z8.boolean().optional(),
|
|
50612
|
+
uses_tool: z8.string().optional(),
|
|
50613
|
+
produces_artifact: z8.string().optional(),
|
|
50614
|
+
reads_artifact: z8.string().optional(),
|
|
50615
|
+
depends_on: z8.array(z8.string()).optional(),
|
|
50616
|
+
skip_condition: z8.string().optional(),
|
|
50617
|
+
wait_for_approval: z8.boolean().optional()
|
|
50531
50618
|
}).passthrough();
|
|
50532
|
-
var TaskSchema =
|
|
50533
|
-
description:
|
|
50534
|
-
target_agent:
|
|
50535
|
-
allowed_from_agents:
|
|
50536
|
-
workflow:
|
|
50537
|
-
input_artifacts:
|
|
50538
|
-
invocation_handoff:
|
|
50539
|
-
result_handoff:
|
|
50540
|
-
default_priority:
|
|
50541
|
-
responsibilities:
|
|
50542
|
-
constraints:
|
|
50543
|
-
execution_steps:
|
|
50544
|
-
completion_criteria:
|
|
50545
|
-
rules:
|
|
50546
|
-
anti_patterns:
|
|
50547
|
-
escalation_criteria:
|
|
50548
|
-
validations:
|
|
50619
|
+
var TaskSchema = z8.object({
|
|
50620
|
+
description: z8.string(),
|
|
50621
|
+
target_agent: z8.string(),
|
|
50622
|
+
allowed_from_agents: z8.array(z8.string()),
|
|
50623
|
+
workflow: z8.string(),
|
|
50624
|
+
input_artifacts: z8.array(z8.string()),
|
|
50625
|
+
invocation_handoff: z8.string(),
|
|
50626
|
+
result_handoff: z8.string(),
|
|
50627
|
+
default_priority: z8.string().optional(),
|
|
50628
|
+
responsibilities: z8.array(z8.string()).optional(),
|
|
50629
|
+
constraints: z8.array(z8.string()).optional(),
|
|
50630
|
+
execution_steps: z8.array(ExecutionStepSchema).optional(),
|
|
50631
|
+
completion_criteria: z8.array(z8.string()).optional(),
|
|
50632
|
+
rules: z8.array(RuleSchema).optional(),
|
|
50633
|
+
anti_patterns: z8.array(z8.string()).optional(),
|
|
50634
|
+
escalation_criteria: z8.array(EscalationCriterionSchema).optional(),
|
|
50635
|
+
validations: z8.array(z8.string()).default([])
|
|
50549
50636
|
}).passthrough();
|
|
50550
50637
|
|
|
50551
50638
|
// src/schema/tool.ts
|
|
50552
|
-
import { z as
|
|
50553
|
-
var CommandSchema =
|
|
50554
|
-
command:
|
|
50555
|
-
category:
|
|
50556
|
-
reads:
|
|
50557
|
-
writes:
|
|
50558
|
-
purpose:
|
|
50559
|
-
});
|
|
50560
|
-
var ToolSchema =
|
|
50561
|
-
kind:
|
|
50562
|
-
description:
|
|
50563
|
-
input_artifacts:
|
|
50564
|
-
output_artifacts:
|
|
50565
|
-
invokable_by:
|
|
50566
|
-
side_effects:
|
|
50567
|
-
commands:
|
|
50639
|
+
import { z as z9 } from "zod";
|
|
50640
|
+
var CommandSchema = z9.object({
|
|
50641
|
+
command: z9.string(),
|
|
50642
|
+
category: z9.string(),
|
|
50643
|
+
reads: z9.array(z9.string()).default([]),
|
|
50644
|
+
writes: z9.array(z9.string()).default([]),
|
|
50645
|
+
purpose: z9.string().optional()
|
|
50646
|
+
});
|
|
50647
|
+
var ToolSchema = z9.object({
|
|
50648
|
+
kind: z9.string(),
|
|
50649
|
+
description: z9.string().optional(),
|
|
50650
|
+
input_artifacts: z9.array(z9.string()).default([]),
|
|
50651
|
+
output_artifacts: z9.array(z9.string()).default([]),
|
|
50652
|
+
invokable_by: z9.array(z9.string()),
|
|
50653
|
+
side_effects: z9.array(z9.string()).default([]),
|
|
50654
|
+
commands: z9.array(CommandSchema).default([])
|
|
50568
50655
|
}).passthrough();
|
|
50569
50656
|
|
|
50570
50657
|
// src/schema/validation.ts
|
|
50571
|
-
import { z as
|
|
50572
|
-
var ValidationSchema =
|
|
50573
|
-
target_artifact:
|
|
50574
|
-
kind:
|
|
50575
|
-
executor_type:
|
|
50576
|
-
executor:
|
|
50577
|
-
blocking:
|
|
50578
|
-
produces_evidence:
|
|
50658
|
+
import { z as z10 } from "zod";
|
|
50659
|
+
var ValidationSchema = z10.object({
|
|
50660
|
+
target_artifact: z10.string(),
|
|
50661
|
+
kind: z10.enum(["schema", "mechanical", "semantic", "approval"]),
|
|
50662
|
+
executor_type: z10.enum(["tool", "agent"]),
|
|
50663
|
+
executor: z10.string(),
|
|
50664
|
+
blocking: z10.boolean(),
|
|
50665
|
+
produces_evidence: z10.string().optional()
|
|
50579
50666
|
}).passthrough();
|
|
50580
50667
|
|
|
50581
50668
|
// src/schema/workflow.ts
|
|
50582
|
-
import { z as
|
|
50583
|
-
var RetrySchema =
|
|
50584
|
-
condition:
|
|
50585
|
-
fix_task:
|
|
50586
|
-
revalidate_task:
|
|
50587
|
-
});
|
|
50588
|
-
var ExternalParticipantSchema =
|
|
50589
|
-
id:
|
|
50590
|
-
kind:
|
|
50591
|
-
label:
|
|
50592
|
-
description:
|
|
50593
|
-
});
|
|
50594
|
-
var WorkflowDelegateStepSchema =
|
|
50595
|
-
type:
|
|
50596
|
-
description:
|
|
50597
|
-
task:
|
|
50598
|
-
from_agent:
|
|
50599
|
-
group:
|
|
50669
|
+
import { z as z11 } from "zod";
|
|
50670
|
+
var RetrySchema = z11.object({
|
|
50671
|
+
condition: z11.string(),
|
|
50672
|
+
fix_task: z11.string(),
|
|
50673
|
+
revalidate_task: z11.string().optional()
|
|
50674
|
+
});
|
|
50675
|
+
var ExternalParticipantSchema = z11.object({
|
|
50676
|
+
id: z11.string(),
|
|
50677
|
+
kind: z11.enum(["actor", "participant"]),
|
|
50678
|
+
label: z11.string(),
|
|
50679
|
+
description: z11.string().optional()
|
|
50680
|
+
});
|
|
50681
|
+
var WorkflowDelegateStepSchema = z11.object({
|
|
50682
|
+
type: z11.literal("delegate"),
|
|
50683
|
+
description: z11.string().optional(),
|
|
50684
|
+
task: z11.string(),
|
|
50685
|
+
from_agent: z11.string(),
|
|
50686
|
+
group: z11.string().optional(),
|
|
50600
50687
|
retry: RetrySchema.optional()
|
|
50601
50688
|
}).passthrough();
|
|
50602
|
-
var WorkflowGateStepSchema =
|
|
50603
|
-
type:
|
|
50604
|
-
description:
|
|
50605
|
-
gate_kind:
|
|
50606
|
-
group:
|
|
50689
|
+
var WorkflowGateStepSchema = z11.object({
|
|
50690
|
+
type: z11.literal("gate"),
|
|
50691
|
+
description: z11.string().optional(),
|
|
50692
|
+
gate_kind: z11.string(),
|
|
50693
|
+
group: z11.string().optional()
|
|
50607
50694
|
}).passthrough();
|
|
50608
|
-
var WorkflowHandoffStepSchema =
|
|
50609
|
-
type:
|
|
50610
|
-
description:
|
|
50611
|
-
handoff_kind:
|
|
50612
|
-
task:
|
|
50613
|
-
from_agent:
|
|
50614
|
-
group:
|
|
50695
|
+
var WorkflowHandoffStepSchema = z11.object({
|
|
50696
|
+
type: z11.literal("handoff"),
|
|
50697
|
+
description: z11.string().optional(),
|
|
50698
|
+
handoff_kind: z11.string(),
|
|
50699
|
+
task: z11.string().optional(),
|
|
50700
|
+
from_agent: z11.string().optional(),
|
|
50701
|
+
group: z11.string().optional(),
|
|
50615
50702
|
retry: RetrySchema.optional()
|
|
50616
50703
|
}).passthrough();
|
|
50617
|
-
var WorkflowValidationStepSchema =
|
|
50618
|
-
type:
|
|
50619
|
-
description:
|
|
50620
|
-
validation:
|
|
50621
|
-
group:
|
|
50704
|
+
var WorkflowValidationStepSchema = z11.object({
|
|
50705
|
+
type: z11.literal("validation"),
|
|
50706
|
+
description: z11.string().optional(),
|
|
50707
|
+
validation: z11.string(),
|
|
50708
|
+
group: z11.string().optional()
|
|
50622
50709
|
}).passthrough();
|
|
50623
|
-
var WorkflowDecisionStepSchema =
|
|
50624
|
-
type:
|
|
50625
|
-
description:
|
|
50626
|
-
on:
|
|
50627
|
-
branches:
|
|
50628
|
-
group:
|
|
50710
|
+
var WorkflowDecisionStepSchema = z11.object({
|
|
50711
|
+
type: z11.literal("decision"),
|
|
50712
|
+
description: z11.string().optional(),
|
|
50713
|
+
on: z11.string(),
|
|
50714
|
+
branches: z11.record(z11.string(), z11.array(z11.string())),
|
|
50715
|
+
group: z11.string().optional()
|
|
50629
50716
|
}).passthrough();
|
|
50630
|
-
var WorkflowStepSchema =
|
|
50717
|
+
var WorkflowStepSchema = z11.discriminatedUnion("type", [
|
|
50631
50718
|
WorkflowDelegateStepSchema,
|
|
50632
50719
|
WorkflowGateStepSchema,
|
|
50633
50720
|
WorkflowHandoffStepSchema,
|
|
50634
50721
|
WorkflowValidationStepSchema,
|
|
50635
50722
|
WorkflowDecisionStepSchema
|
|
50636
50723
|
]);
|
|
50637
|
-
var WorkflowSchema =
|
|
50638
|
-
description:
|
|
50639
|
-
entry_conditions:
|
|
50640
|
-
trigger:
|
|
50641
|
-
steps:
|
|
50642
|
-
external_participants:
|
|
50724
|
+
var WorkflowSchema = z11.object({
|
|
50725
|
+
description: z11.string().optional(),
|
|
50726
|
+
entry_conditions: z11.array(z11.string()).default([]),
|
|
50727
|
+
trigger: z11.string().optional(),
|
|
50728
|
+
steps: z11.array(WorkflowStepSchema),
|
|
50729
|
+
external_participants: z11.array(ExternalParticipantSchema).default([])
|
|
50643
50730
|
}).passthrough();
|
|
50644
50731
|
|
|
50645
50732
|
// src/schema/dsl.ts
|
|
50646
|
-
var ComponentsSchema =
|
|
50647
|
-
schemas:
|
|
50733
|
+
var ComponentsSchema = z12.object({
|
|
50734
|
+
schemas: z12.record(z12.string(), z12.record(z12.string(), z12.any())).default({})
|
|
50648
50735
|
}).passthrough();
|
|
50649
|
-
var DslSchema =
|
|
50650
|
-
version:
|
|
50651
|
-
extends:
|
|
50736
|
+
var DslSchema = z12.object({
|
|
50737
|
+
version: z12.literal(1),
|
|
50738
|
+
extends: z12.string().optional(),
|
|
50652
50739
|
system: SystemSchema,
|
|
50653
|
-
agents:
|
|
50654
|
-
tasks:
|
|
50655
|
-
artifacts:
|
|
50656
|
-
tools:
|
|
50657
|
-
validations:
|
|
50658
|
-
handoff_types:
|
|
50659
|
-
workflow:
|
|
50660
|
-
policies:
|
|
50740
|
+
agents: z12.record(z12.string(), AgentSchema).default({}),
|
|
50741
|
+
tasks: z12.record(z12.string(), TaskSchema).default({}),
|
|
50742
|
+
artifacts: z12.record(z12.string(), ArtifactSchema).default({}),
|
|
50743
|
+
tools: z12.record(z12.string(), ToolSchema).default({}),
|
|
50744
|
+
validations: z12.record(z12.string(), ValidationSchema).default({}),
|
|
50745
|
+
handoff_types: z12.record(z12.string(), HandoffTypeSchema).default({}),
|
|
50746
|
+
workflow: z12.record(z12.string(), WorkflowSchema).default({}),
|
|
50747
|
+
policies: z12.record(z12.string(), PolicySchema).default({}),
|
|
50748
|
+
guardrails: z12.record(z12.string(), GuardrailSchema).default({}),
|
|
50749
|
+
guardrail_policies: z12.record(z12.string(), GuardrailPolicySchema).default({}),
|
|
50661
50750
|
components: ComponentsSchema.default({ schemas: {} })
|
|
50662
50751
|
}).passthrough();
|
|
50663
50752
|
|
|
@@ -50710,22 +50799,22 @@ function resolveAllOf(schema) {
|
|
|
50710
50799
|
}
|
|
50711
50800
|
|
|
50712
50801
|
// src/schema/merge-operators.ts
|
|
50713
|
-
import { z as
|
|
50714
|
-
var AppendOperatorSchema =
|
|
50715
|
-
$append:
|
|
50802
|
+
import { z as z13 } from "zod";
|
|
50803
|
+
var AppendOperatorSchema = z13.object({
|
|
50804
|
+
$append: z13.record(z13.string(), z13.any())
|
|
50716
50805
|
});
|
|
50717
|
-
var PrependOperatorSchema =
|
|
50718
|
-
$prepend:
|
|
50806
|
+
var PrependOperatorSchema = z13.object({
|
|
50807
|
+
$prepend: z13.record(z13.string(), z13.any())
|
|
50719
50808
|
});
|
|
50720
|
-
var InsertAfterOperatorSchema =
|
|
50721
|
-
$insert_after:
|
|
50722
|
-
after:
|
|
50723
|
-
entries:
|
|
50809
|
+
var InsertAfterOperatorSchema = z13.object({
|
|
50810
|
+
$insert_after: z13.object({
|
|
50811
|
+
after: z13.string(),
|
|
50812
|
+
entries: z13.record(z13.string(), z13.any())
|
|
50724
50813
|
})
|
|
50725
50814
|
});
|
|
50726
|
-
var ReplaceOperatorSchema =
|
|
50727
|
-
var RemoveOperatorSchema =
|
|
50728
|
-
$remove:
|
|
50815
|
+
var ReplaceOperatorSchema = z13.object({ $replace: z13.any() });
|
|
50816
|
+
var RemoveOperatorSchema = z13.object({
|
|
50817
|
+
$remove: z13.array(z13.string())
|
|
50729
50818
|
});
|
|
50730
50819
|
|
|
50731
50820
|
// src/loader/loader.ts
|
|
@@ -51275,6 +51364,8 @@ var MERGE_SECTIONS = [
|
|
|
51275
51364
|
"handoff_types",
|
|
51276
51365
|
"workflow",
|
|
51277
51366
|
"policies",
|
|
51367
|
+
"guardrails",
|
|
51368
|
+
"guardrail_policies",
|
|
51278
51369
|
"components"
|
|
51279
51370
|
];
|
|
51280
51371
|
function mergeDsl(base, project) {
|
|
@@ -51330,16 +51421,16 @@ async function resolve3(projectDirOrFile) {
|
|
|
51330
51421
|
}
|
|
51331
51422
|
|
|
51332
51423
|
// src/validator/schema-validator.ts
|
|
51333
|
-
import { z as
|
|
51424
|
+
import { z as z14 } from "zod";
|
|
51334
51425
|
function unwrap(schema) {
|
|
51335
|
-
if (schema instanceof
|
|
51336
|
-
if (schema instanceof
|
|
51337
|
-
if (schema instanceof
|
|
51426
|
+
if (schema instanceof z14.ZodOptional) return unwrap(schema.unwrap());
|
|
51427
|
+
if (schema instanceof z14.ZodDefault) return unwrap(schema.removeDefault());
|
|
51428
|
+
if (schema instanceof z14.ZodNullable) return unwrap(schema.unwrap());
|
|
51338
51429
|
return schema;
|
|
51339
51430
|
}
|
|
51340
51431
|
function checkCustomPropsRecursive(data, schema, path) {
|
|
51341
51432
|
const inner = unwrap(schema);
|
|
51342
|
-
if (inner instanceof
|
|
51433
|
+
if (inner instanceof z14.ZodObject) {
|
|
51343
51434
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51344
51435
|
const obj = data;
|
|
51345
51436
|
const shape = inner.shape;
|
|
@@ -51360,7 +51451,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51360
51451
|
}
|
|
51361
51452
|
return diagnostics;
|
|
51362
51453
|
}
|
|
51363
|
-
if (inner instanceof
|
|
51454
|
+
if (inner instanceof z14.ZodRecord) {
|
|
51364
51455
|
if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
|
|
51365
51456
|
const valueSchema = inner._def.valueType;
|
|
51366
51457
|
const diagnostics = [];
|
|
@@ -51369,7 +51460,7 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51369
51460
|
}
|
|
51370
51461
|
return diagnostics;
|
|
51371
51462
|
}
|
|
51372
|
-
if (inner instanceof
|
|
51463
|
+
if (inner instanceof z14.ZodArray) {
|
|
51373
51464
|
if (!Array.isArray(data)) return [];
|
|
51374
51465
|
const diagnostics = [];
|
|
51375
51466
|
for (let i3 = 0; i3 < data.length; i3++) {
|
|
@@ -51377,14 +51468,14 @@ function checkCustomPropsRecursive(data, schema, path) {
|
|
|
51377
51468
|
}
|
|
51378
51469
|
return diagnostics;
|
|
51379
51470
|
}
|
|
51380
|
-
if (inner instanceof
|
|
51471
|
+
if (inner instanceof z14.ZodDiscriminatedUnion) {
|
|
51381
51472
|
if (typeof data !== "object" || data === null) return [];
|
|
51382
51473
|
const obj = data;
|
|
51383
51474
|
const disc = inner._def.discriminator;
|
|
51384
51475
|
const discValue = obj[disc];
|
|
51385
51476
|
const match = inner.options.find((opt) => {
|
|
51386
51477
|
const shape = opt.shape;
|
|
51387
|
-
return shape[disc] instanceof
|
|
51478
|
+
return shape[disc] instanceof z14.ZodLiteral && shape[disc].value === discValue;
|
|
51388
51479
|
});
|
|
51389
51480
|
if (match) return checkCustomPropsRecursive(data, match, path);
|
|
51390
51481
|
return [];
|
|
@@ -51418,12 +51509,13 @@ function checkReferences(dsl) {
|
|
|
51418
51509
|
const handoffKinds = new Set(Object.keys(dsl.handoff_types));
|
|
51419
51510
|
const taskIds = new Set(Object.keys(dsl.tasks));
|
|
51420
51511
|
const workflowIds = new Set(dsl.system.default_workflow_order);
|
|
51421
|
-
|
|
51512
|
+
const guardrailIds = new Set(Object.keys(dsl.guardrails));
|
|
51513
|
+
function checkExists(value, validSet, entityType, path, code = "reference-not-found") {
|
|
51422
51514
|
if (!validSet.has(value)) {
|
|
51423
51515
|
diagnostics.push({
|
|
51424
51516
|
path,
|
|
51425
51517
|
message: `Reference "${value}" not found in ${entityType}`,
|
|
51426
|
-
code
|
|
51518
|
+
code
|
|
51427
51519
|
});
|
|
51428
51520
|
}
|
|
51429
51521
|
}
|
|
@@ -51611,6 +51703,75 @@ function checkReferences(dsl) {
|
|
|
51611
51703
|
}
|
|
51612
51704
|
}
|
|
51613
51705
|
}
|
|
51706
|
+
for (const [id, guardrail] of Object.entries(dsl.guardrails)) {
|
|
51707
|
+
if (guardrail.scope.agents) {
|
|
51708
|
+
for (const ref of guardrail.scope.agents) {
|
|
51709
|
+
checkExists(
|
|
51710
|
+
ref,
|
|
51711
|
+
agentIds,
|
|
51712
|
+
"agents",
|
|
51713
|
+
`guardrails.${id}.scope.agents`,
|
|
51714
|
+
"guardrail-scope-ref-not-found"
|
|
51715
|
+
);
|
|
51716
|
+
}
|
|
51717
|
+
}
|
|
51718
|
+
if (guardrail.scope.tasks) {
|
|
51719
|
+
for (const ref of guardrail.scope.tasks) {
|
|
51720
|
+
checkExists(
|
|
51721
|
+
ref,
|
|
51722
|
+
taskIds,
|
|
51723
|
+
"tasks",
|
|
51724
|
+
`guardrails.${id}.scope.tasks`,
|
|
51725
|
+
"guardrail-scope-ref-not-found"
|
|
51726
|
+
);
|
|
51727
|
+
}
|
|
51728
|
+
}
|
|
51729
|
+
if (guardrail.scope.tools) {
|
|
51730
|
+
for (const ref of guardrail.scope.tools) {
|
|
51731
|
+
checkExists(
|
|
51732
|
+
ref,
|
|
51733
|
+
toolIds,
|
|
51734
|
+
"tools",
|
|
51735
|
+
`guardrails.${id}.scope.tools`,
|
|
51736
|
+
"guardrail-scope-ref-not-found"
|
|
51737
|
+
);
|
|
51738
|
+
}
|
|
51739
|
+
}
|
|
51740
|
+
if (guardrail.scope.artifacts) {
|
|
51741
|
+
for (const ref of guardrail.scope.artifacts) {
|
|
51742
|
+
checkExists(
|
|
51743
|
+
ref,
|
|
51744
|
+
artifactIds,
|
|
51745
|
+
"artifacts",
|
|
51746
|
+
`guardrails.${id}.scope.artifacts`,
|
|
51747
|
+
"guardrail-scope-ref-not-found"
|
|
51748
|
+
);
|
|
51749
|
+
}
|
|
51750
|
+
}
|
|
51751
|
+
if (guardrail.scope.workflows) {
|
|
51752
|
+
for (const ref of guardrail.scope.workflows) {
|
|
51753
|
+
checkExists(
|
|
51754
|
+
ref,
|
|
51755
|
+
workflowIds,
|
|
51756
|
+
"system.default_workflow_order",
|
|
51757
|
+
`guardrails.${id}.scope.workflows`,
|
|
51758
|
+
"guardrail-scope-ref-not-found"
|
|
51759
|
+
);
|
|
51760
|
+
}
|
|
51761
|
+
}
|
|
51762
|
+
}
|
|
51763
|
+
for (const [policyId, policy] of Object.entries(dsl.guardrail_policies)) {
|
|
51764
|
+
for (let i3 = 0; i3 < policy.rules.length; i3++) {
|
|
51765
|
+
const rule = policy.rules[i3];
|
|
51766
|
+
checkExists(
|
|
51767
|
+
rule.guardrail,
|
|
51768
|
+
guardrailIds,
|
|
51769
|
+
"guardrails",
|
|
51770
|
+
`guardrail_policies.${policyId}.rules[${i3}].guardrail`,
|
|
51771
|
+
"guardrail-policy-ref-not-found"
|
|
51772
|
+
);
|
|
51773
|
+
}
|
|
51774
|
+
}
|
|
51614
51775
|
return diagnostics;
|
|
51615
51776
|
}
|
|
51616
51777
|
|
|
@@ -51985,6 +52146,32 @@ var toolCommandsRule = {
|
|
|
51985
52146
|
}
|
|
51986
52147
|
};
|
|
51987
52148
|
|
|
52149
|
+
// src/linter/rules/guardrail-policy-coverage.ts
|
|
52150
|
+
var guardrailPolicyCoverageRule = {
|
|
52151
|
+
id: "guardrail-no-policy-rule",
|
|
52152
|
+
description: "Every guardrail should be referenced by at least one policy rule in guardrail_policies",
|
|
52153
|
+
run(dsl) {
|
|
52154
|
+
const diagnostics = [];
|
|
52155
|
+
const referencedGuardrails = /* @__PURE__ */ new Set();
|
|
52156
|
+
for (const policy of Object.values(dsl.guardrail_policies)) {
|
|
52157
|
+
for (const rule of policy.rules) {
|
|
52158
|
+
referencedGuardrails.add(rule.guardrail);
|
|
52159
|
+
}
|
|
52160
|
+
}
|
|
52161
|
+
for (const guardrailId of Object.keys(dsl.guardrails)) {
|
|
52162
|
+
if (!referencedGuardrails.has(guardrailId)) {
|
|
52163
|
+
diagnostics.push({
|
|
52164
|
+
ruleId: "guardrail-no-policy-rule",
|
|
52165
|
+
severity: "warning",
|
|
52166
|
+
path: `guardrails.${guardrailId}`,
|
|
52167
|
+
message: `Guardrail "${guardrailId}" is not referenced by any policy rule in guardrail_policies`
|
|
52168
|
+
});
|
|
52169
|
+
}
|
|
52170
|
+
}
|
|
52171
|
+
return diagnostics;
|
|
52172
|
+
}
|
|
52173
|
+
};
|
|
52174
|
+
|
|
51988
52175
|
// src/linter/linter.ts
|
|
51989
52176
|
var builtinRules = [
|
|
51990
52177
|
validationCoverageRule,
|
|
@@ -51992,7 +52179,8 @@ var builtinRules = [
|
|
|
51992
52179
|
taskAgentBindingRule,
|
|
51993
52180
|
mergeIntegrityRule,
|
|
51994
52181
|
artifactOwnershipRule,
|
|
51995
|
-
toolCommandsRule
|
|
52182
|
+
toolCommandsRule,
|
|
52183
|
+
guardrailPolicyCoverageRule
|
|
51996
52184
|
];
|
|
51997
52185
|
function lint(dsl, rules = builtinRules) {
|
|
51998
52186
|
const diagnostics = [];
|
|
@@ -52654,7 +52842,9 @@ function buildGlobalContext(dsl) {
|
|
|
52654
52842
|
validations: dsl.validations,
|
|
52655
52843
|
handoff_types: dsl.handoff_types,
|
|
52656
52844
|
workflow: dsl.workflow,
|
|
52657
|
-
policies: dsl.policies
|
|
52845
|
+
policies: dsl.policies,
|
|
52846
|
+
guardrails: dsl.guardrails,
|
|
52847
|
+
guardrail_policies: dsl.guardrail_policies
|
|
52658
52848
|
};
|
|
52659
52849
|
}
|
|
52660
52850
|
function buildSystemContext(dsl) {
|
|
@@ -52865,6 +53055,16 @@ function buildPolicyContext(dsl, policyId) {
|
|
|
52865
53055
|
const policy = { ...policyDef, id: policyId };
|
|
52866
53056
|
return { policy, dsl };
|
|
52867
53057
|
}
|
|
53058
|
+
function buildGuardrailContext(dsl, guardrailId) {
|
|
53059
|
+
const guardrailDef = dsl.guardrails[guardrailId];
|
|
53060
|
+
const guardrail = { ...guardrailDef, id: guardrailId };
|
|
53061
|
+
return { guardrail, dsl };
|
|
53062
|
+
}
|
|
53063
|
+
function buildGuardrailPolicyContext(dsl, policyId) {
|
|
53064
|
+
const policyDef = dsl.guardrail_policies[policyId];
|
|
53065
|
+
const guardrail_policy = { ...policyDef, id: policyId };
|
|
53066
|
+
return { guardrail_policy, dsl };
|
|
53067
|
+
}
|
|
52868
53068
|
function mergeRules(agentRules, taskRules) {
|
|
52869
53069
|
const result = [...agentRules];
|
|
52870
53070
|
const existingIds = new Set(result.map((r3) => r3["id"]));
|
|
@@ -53712,7 +53912,9 @@ function getDslSection(dsl, context) {
|
|
|
53712
53912
|
validation: dsl.validations,
|
|
53713
53913
|
handoff_type: dsl.handoff_types,
|
|
53714
53914
|
workflow: dsl.workflow,
|
|
53715
|
-
policy: dsl.policies
|
|
53915
|
+
policy: dsl.policies,
|
|
53916
|
+
guardrail: dsl.guardrails,
|
|
53917
|
+
guardrail_policy: dsl.guardrail_policies
|
|
53716
53918
|
};
|
|
53717
53919
|
return sectionMap[context] ?? {};
|
|
53718
53920
|
}
|
|
@@ -53745,6 +53947,10 @@ function buildEntityContext(dsl, context, entityId) {
|
|
|
53745
53947
|
return buildWorkflowContext(dsl, entityId);
|
|
53746
53948
|
case "policy":
|
|
53747
53949
|
return buildPolicyContext(dsl, entityId);
|
|
53950
|
+
case "guardrail":
|
|
53951
|
+
return buildGuardrailContext(dsl, entityId);
|
|
53952
|
+
case "guardrail_policy":
|
|
53953
|
+
return buildGuardrailPolicyContext(dsl, entityId);
|
|
53748
53954
|
case "system":
|
|
53749
53955
|
return buildSystemContext(dsl);
|
|
53750
53956
|
}
|
|
@@ -53813,8 +54019,17 @@ async function checkDriftFromConfig(dsl, renderTargets) {
|
|
|
53813
54019
|
return { hasDrift: diffs.length > 0, diffs };
|
|
53814
54020
|
}
|
|
53815
54021
|
|
|
54022
|
+
// src/config/binding-loader.ts
|
|
54023
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
54024
|
+
import { parse as parseYaml3 } from "yaml";
|
|
54025
|
+
|
|
54026
|
+
// src/config/loader.ts
|
|
54027
|
+
import { readFile as readFile3, access } from "fs/promises";
|
|
54028
|
+
import { resolve as resolve4, dirname as dirname4 } from "path";
|
|
54029
|
+
import { parse as parseYaml2 } from "yaml";
|
|
54030
|
+
|
|
53816
54031
|
// src/config/types.ts
|
|
53817
|
-
import { z as
|
|
54032
|
+
import { z as z16 } from "zod";
|
|
53818
54033
|
var CONTEXT_TYPES = [
|
|
53819
54034
|
"agent",
|
|
53820
54035
|
"task",
|
|
@@ -53824,18 +54039,20 @@ var CONTEXT_TYPES = [
|
|
|
53824
54039
|
"handoff_type",
|
|
53825
54040
|
"workflow",
|
|
53826
54041
|
"policy",
|
|
54042
|
+
"guardrail",
|
|
54043
|
+
"guardrail_policy",
|
|
53827
54044
|
"system"
|
|
53828
54045
|
];
|
|
53829
|
-
var ContextTypeSchema =
|
|
54046
|
+
var ContextTypeSchema = z16.enum(CONTEXT_TYPES);
|
|
53830
54047
|
var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
|
|
53831
54048
|
(t3) => t3 !== "system"
|
|
53832
54049
|
);
|
|
53833
|
-
var RenderTargetSchema =
|
|
53834
|
-
template:
|
|
54050
|
+
var RenderTargetSchema = z16.object({
|
|
54051
|
+
template: z16.string(),
|
|
53835
54052
|
context: ContextTypeSchema,
|
|
53836
|
-
output:
|
|
53837
|
-
include:
|
|
53838
|
-
exclude:
|
|
54053
|
+
output: z16.string(),
|
|
54054
|
+
include: z16.array(z16.string()).optional(),
|
|
54055
|
+
exclude: z16.array(z16.string()).optional()
|
|
53839
54056
|
}).refine(
|
|
53840
54057
|
(data) => !(data.include && data.exclude),
|
|
53841
54058
|
{ message: "include and exclude are mutually exclusive" }
|
|
@@ -53848,16 +54065,16 @@ var RenderTargetSchema = z14.object({
|
|
|
53848
54065
|
},
|
|
53849
54066
|
{ message: "include/exclude cannot be used with context: system" }
|
|
53850
54067
|
);
|
|
53851
|
-
var AgentContractsConfigSchema =
|
|
53852
|
-
dsl:
|
|
53853
|
-
vars:
|
|
53854
|
-
renders:
|
|
54068
|
+
var AgentContractsConfigSchema = z16.object({
|
|
54069
|
+
dsl: z16.string(),
|
|
54070
|
+
vars: z16.record(z16.string(), z16.string()).optional(),
|
|
54071
|
+
renders: z16.array(RenderTargetSchema).min(1),
|
|
54072
|
+
bindings: z16.array(z16.string()).default([]),
|
|
54073
|
+
active_guardrail_policy: z16.string().optional(),
|
|
54074
|
+
paths: z16.record(z16.string(), z16.string()).optional()
|
|
53855
54075
|
});
|
|
53856
54076
|
|
|
53857
54077
|
// src/config/loader.ts
|
|
53858
|
-
import { readFile as readFile3, access } from "fs/promises";
|
|
53859
|
-
import { resolve as resolve4, dirname as dirname4 } from "path";
|
|
53860
|
-
import { parse as parseYaml2 } from "yaml";
|
|
53861
54078
|
var DEFAULT_CONFIG_NAME = "agent-contracts.config.yaml";
|
|
53862
54079
|
var ConfigLoadError = class extends Error {
|
|
53863
54080
|
constructor(message, filePath) {
|
|
@@ -53925,7 +54142,10 @@ ${issues}`,
|
|
|
53925
54142
|
template: resolve4(configDir, r3.template),
|
|
53926
54143
|
output: resolve4(configDir, r3.output)
|
|
53927
54144
|
})),
|
|
53928
|
-
configDir
|
|
54145
|
+
configDir,
|
|
54146
|
+
bindings: (config.bindings ?? []).map((b3) => resolve4(configDir, b3)),
|
|
54147
|
+
activeGuardrailPolicy: config.active_guardrail_policy,
|
|
54148
|
+
paths: config.paths
|
|
53929
54149
|
};
|
|
53930
54150
|
}
|
|
53931
54151
|
function resolveDslPath(dirArg, dirArgDefault, config) {
|
|
@@ -53937,13 +54157,272 @@ function resolveDslPath(dirArg, dirArgDefault, config) {
|
|
|
53937
54157
|
}
|
|
53938
54158
|
return resolve4(dirArgDefault);
|
|
53939
54159
|
}
|
|
54160
|
+
|
|
54161
|
+
// src/config/binding-loader.ts
|
|
54162
|
+
async function loadBindings(bindingPaths) {
|
|
54163
|
+
const results = [];
|
|
54164
|
+
for (const filePath of bindingPaths) {
|
|
54165
|
+
let content;
|
|
54166
|
+
try {
|
|
54167
|
+
content = await readFile4(filePath, "utf8");
|
|
54168
|
+
} catch {
|
|
54169
|
+
throw new ConfigLoadError(
|
|
54170
|
+
`Failed to read binding file: ${filePath}`,
|
|
54171
|
+
filePath
|
|
54172
|
+
);
|
|
54173
|
+
}
|
|
54174
|
+
let raw;
|
|
54175
|
+
try {
|
|
54176
|
+
raw = parseYaml3(content);
|
|
54177
|
+
} catch (err) {
|
|
54178
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
54179
|
+
throw new ConfigLoadError(
|
|
54180
|
+
`Invalid YAML syntax in binding file ${filePath}: ${msg}`,
|
|
54181
|
+
filePath
|
|
54182
|
+
);
|
|
54183
|
+
}
|
|
54184
|
+
const result = SoftwareBindingSchema.safeParse(raw);
|
|
54185
|
+
if (!result.success) {
|
|
54186
|
+
const issues = result.error.issues.map((i3) => ` ${i3.path.join(".")}: ${i3.message}`).join("\n");
|
|
54187
|
+
throw new ConfigLoadError(
|
|
54188
|
+
`Invalid binding schema in ${filePath}:
|
|
54189
|
+
${issues}`,
|
|
54190
|
+
filePath
|
|
54191
|
+
);
|
|
54192
|
+
}
|
|
54193
|
+
results.push({ filePath, binding: result.data });
|
|
54194
|
+
}
|
|
54195
|
+
return results;
|
|
54196
|
+
}
|
|
54197
|
+
|
|
54198
|
+
// src/guardrail-generator/generator.ts
|
|
54199
|
+
import { readFile as readFile5, writeFile as writeFile2, mkdir as mkdir2, chmod } from "fs/promises";
|
|
54200
|
+
import { resolve as resolve5, dirname as dirname5 } from "path";
|
|
54201
|
+
import Handlebars2 from "handlebars";
|
|
54202
|
+
|
|
54203
|
+
// src/guardrail-generator/resolve-checks.ts
|
|
54204
|
+
function resolveChecks(dsl, binding, policy) {
|
|
54205
|
+
const resolved = [];
|
|
54206
|
+
const diagnostics = [];
|
|
54207
|
+
const guardrailImpl = binding.guardrail_impl ?? {};
|
|
54208
|
+
for (const [guardrailId, impl] of Object.entries(guardrailImpl)) {
|
|
54209
|
+
const guardrail = dsl.guardrails[guardrailId];
|
|
54210
|
+
if (!guardrail) {
|
|
54211
|
+
diagnostics.push({
|
|
54212
|
+
path: `binding.${binding.software}.guardrail_impl.${guardrailId}`,
|
|
54213
|
+
message: `Binding "${binding.software}" implements guardrail "${guardrailId}" which is not defined in the DSL`,
|
|
54214
|
+
severity: "error"
|
|
54215
|
+
});
|
|
54216
|
+
continue;
|
|
54217
|
+
}
|
|
54218
|
+
const policyRule = policy.rules.find((r3) => r3.guardrail === guardrailId);
|
|
54219
|
+
if (!policyRule) {
|
|
54220
|
+
diagnostics.push({
|
|
54221
|
+
path: `binding.${binding.software}.guardrail_impl.${guardrailId}`,
|
|
54222
|
+
message: `Guardrail "${guardrailId}" has no policy rule in the active policy \u2014 skipping`,
|
|
54223
|
+
severity: "info"
|
|
54224
|
+
});
|
|
54225
|
+
continue;
|
|
54226
|
+
}
|
|
54227
|
+
for (const check of impl.checks) {
|
|
54228
|
+
resolved.push({
|
|
54229
|
+
guardrail_id: guardrailId,
|
|
54230
|
+
guardrail,
|
|
54231
|
+
policy_rule: policyRule,
|
|
54232
|
+
check
|
|
54233
|
+
});
|
|
54234
|
+
}
|
|
54235
|
+
}
|
|
54236
|
+
return { resolved, diagnostics };
|
|
54237
|
+
}
|
|
54238
|
+
|
|
54239
|
+
// src/guardrail-generator/resolve-paths.ts
|
|
54240
|
+
function resolveBindingTargetPath(target, paths, bindingSoftware) {
|
|
54241
|
+
const diagnostics = [];
|
|
54242
|
+
const resolved = target.replace(/\{(\w+)\}/g, (match, varName) => {
|
|
54243
|
+
const value = paths[varName];
|
|
54244
|
+
if (value === void 0) {
|
|
54245
|
+
diagnostics.push({
|
|
54246
|
+
path: `binding.${bindingSoftware}.outputs`,
|
|
54247
|
+
message: `Path variable "${varName}" used in target "${target}" but not defined in config.paths`,
|
|
54248
|
+
severity: "error"
|
|
54249
|
+
});
|
|
54250
|
+
return match;
|
|
54251
|
+
}
|
|
54252
|
+
return value;
|
|
54253
|
+
});
|
|
54254
|
+
return { resolved, diagnostics };
|
|
54255
|
+
}
|
|
54256
|
+
|
|
54257
|
+
// src/guardrail-generator/generator.ts
|
|
54258
|
+
Handlebars2.registerHelper("json", (value) => {
|
|
54259
|
+
return new Handlebars2.SafeString(JSON.stringify(value, null, 2));
|
|
54260
|
+
});
|
|
54261
|
+
Handlebars2.registerHelper(
|
|
54262
|
+
"expand",
|
|
54263
|
+
(pattern, options) => {
|
|
54264
|
+
if (typeof pattern !== "string") return "";
|
|
54265
|
+
const hash = options.hash;
|
|
54266
|
+
let result = pattern;
|
|
54267
|
+
for (const [key, val] of Object.entries(hash)) {
|
|
54268
|
+
result = result.replace(new RegExp(`\\{\\{${key}\\}\\}`, "g"), String(val));
|
|
54269
|
+
}
|
|
54270
|
+
return new Handlebars2.SafeString(result);
|
|
54271
|
+
}
|
|
54272
|
+
);
|
|
54273
|
+
async function generateGuardrails(options) {
|
|
54274
|
+
const { dsl, config, loadedBindings, filterBindings, dryRun } = options;
|
|
54275
|
+
const outputFiles = [];
|
|
54276
|
+
const diagnostics = [];
|
|
54277
|
+
const policyName = config.activeGuardrailPolicy;
|
|
54278
|
+
if (!policyName) {
|
|
54279
|
+
diagnostics.push({
|
|
54280
|
+
path: "config.active_guardrail_policy",
|
|
54281
|
+
message: "No active_guardrail_policy specified in config \u2014 no guardrails will be generated",
|
|
54282
|
+
severity: "warning"
|
|
54283
|
+
});
|
|
54284
|
+
return { outputFiles, diagnostics };
|
|
54285
|
+
}
|
|
54286
|
+
const policy = dsl.guardrail_policies[policyName];
|
|
54287
|
+
if (!policy) {
|
|
54288
|
+
diagnostics.push({
|
|
54289
|
+
path: "config.active_guardrail_policy",
|
|
54290
|
+
message: `Active guardrail policy "${policyName}" not found in DSL guardrail_policies`,
|
|
54291
|
+
severity: "error"
|
|
54292
|
+
});
|
|
54293
|
+
return { outputFiles, diagnostics };
|
|
54294
|
+
}
|
|
54295
|
+
const allBindings = {};
|
|
54296
|
+
for (const lb of loadedBindings) {
|
|
54297
|
+
allBindings[lb.binding.software] = lb.binding;
|
|
54298
|
+
}
|
|
54299
|
+
let reporting = null;
|
|
54300
|
+
for (const lb of loadedBindings) {
|
|
54301
|
+
if (lb.binding.reporting) {
|
|
54302
|
+
reporting = {
|
|
54303
|
+
commands: lb.binding.reporting.commands,
|
|
54304
|
+
fail_open: lb.binding.reporting.fail_open,
|
|
54305
|
+
timeout_ms: lb.binding.reporting.timeout_ms
|
|
54306
|
+
};
|
|
54307
|
+
break;
|
|
54308
|
+
}
|
|
54309
|
+
}
|
|
54310
|
+
const paths = config.paths ?? {};
|
|
54311
|
+
const vars = config.vars ?? {};
|
|
54312
|
+
for (const lb of loadedBindings) {
|
|
54313
|
+
const binding = lb.binding;
|
|
54314
|
+
if (filterBindings && !filterBindings.includes(binding.software)) {
|
|
54315
|
+
continue;
|
|
54316
|
+
}
|
|
54317
|
+
if (!binding.outputs) continue;
|
|
54318
|
+
const checkResult = resolveChecks(dsl, binding, policy);
|
|
54319
|
+
diagnostics.push(...checkResult.diagnostics);
|
|
54320
|
+
const ctx = {
|
|
54321
|
+
system: { id: dsl.system.id, name: dsl.system.name },
|
|
54322
|
+
guardrails: dsl.guardrails,
|
|
54323
|
+
policy,
|
|
54324
|
+
binding,
|
|
54325
|
+
all_bindings: allBindings,
|
|
54326
|
+
vars,
|
|
54327
|
+
paths,
|
|
54328
|
+
reporting,
|
|
54329
|
+
resolved_checks: checkResult.resolved
|
|
54330
|
+
};
|
|
54331
|
+
for (const [outputId, outputDef] of Object.entries(binding.outputs)) {
|
|
54332
|
+
const pathResult = resolveBindingTargetPath(
|
|
54333
|
+
outputDef.target,
|
|
54334
|
+
paths,
|
|
54335
|
+
binding.software
|
|
54336
|
+
);
|
|
54337
|
+
diagnostics.push(...pathResult.diagnostics);
|
|
54338
|
+
if (pathResult.diagnostics.some((d2) => d2.severity === "error")) {
|
|
54339
|
+
continue;
|
|
54340
|
+
}
|
|
54341
|
+
const targetPath = resolve5(config.configDir, pathResult.resolved);
|
|
54342
|
+
let templateContent;
|
|
54343
|
+
if (outputDef.inline_template) {
|
|
54344
|
+
templateContent = outputDef.inline_template;
|
|
54345
|
+
} else if (outputDef.template) {
|
|
54346
|
+
if (outputDef.template.startsWith("builtin:")) {
|
|
54347
|
+
diagnostics.push({
|
|
54348
|
+
path: `binding.${binding.software}.outputs.${outputId}`,
|
|
54349
|
+
message: `Builtin template "${outputDef.template}" is not yet implemented \u2014 skipping`,
|
|
54350
|
+
severity: "info"
|
|
54351
|
+
});
|
|
54352
|
+
continue;
|
|
54353
|
+
}
|
|
54354
|
+
const templatePath = resolve5(config.configDir, outputDef.template);
|
|
54355
|
+
try {
|
|
54356
|
+
templateContent = await readFile5(templatePath, "utf8");
|
|
54357
|
+
} catch {
|
|
54358
|
+
diagnostics.push({
|
|
54359
|
+
path: `binding.${binding.software}.outputs.${outputId}`,
|
|
54360
|
+
message: `Template file not found: ${templatePath}`,
|
|
54361
|
+
severity: "error"
|
|
54362
|
+
});
|
|
54363
|
+
continue;
|
|
54364
|
+
}
|
|
54365
|
+
} else {
|
|
54366
|
+
diagnostics.push({
|
|
54367
|
+
path: `binding.${binding.software}.outputs.${outputId}`,
|
|
54368
|
+
message: "Output has neither template nor inline_template",
|
|
54369
|
+
severity: "error"
|
|
54370
|
+
});
|
|
54371
|
+
continue;
|
|
54372
|
+
}
|
|
54373
|
+
if (outputDef.group_by) {
|
|
54374
|
+
const groupField = outputDef.group_by;
|
|
54375
|
+
const groups = /* @__PURE__ */ new Map();
|
|
54376
|
+
for (const rc of checkResult.resolved) {
|
|
54377
|
+
const key = String(
|
|
54378
|
+
rc.check[groupField] ?? "default"
|
|
54379
|
+
);
|
|
54380
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
54381
|
+
groups.get(key).push(rc);
|
|
54382
|
+
}
|
|
54383
|
+
for (const [groupKey, groupChecks] of groups) {
|
|
54384
|
+
const groupCtx = {
|
|
54385
|
+
...ctx,
|
|
54386
|
+
resolved_checks: groupChecks,
|
|
54387
|
+
current_group: groupKey
|
|
54388
|
+
};
|
|
54389
|
+
const compiled = Handlebars2.compile(templateContent, { noEscape: true });
|
|
54390
|
+
const output = compiled(groupCtx);
|
|
54391
|
+
const groupTarget = resolve5(targetPath, groupKey);
|
|
54392
|
+
if (!dryRun) {
|
|
54393
|
+
await mkdir2(dirname5(groupTarget), { recursive: true });
|
|
54394
|
+
await writeFile2(groupTarget, output, "utf8");
|
|
54395
|
+
if (outputDef.executable) {
|
|
54396
|
+
await chmod(groupTarget, 493);
|
|
54397
|
+
}
|
|
54398
|
+
}
|
|
54399
|
+
outputFiles.push(groupTarget);
|
|
54400
|
+
}
|
|
54401
|
+
} else {
|
|
54402
|
+
const compiled = Handlebars2.compile(templateContent, { noEscape: true });
|
|
54403
|
+
const output = compiled(ctx);
|
|
54404
|
+
if (!dryRun) {
|
|
54405
|
+
await mkdir2(dirname5(targetPath), { recursive: true });
|
|
54406
|
+
await writeFile2(targetPath, output, "utf8");
|
|
54407
|
+
if (outputDef.executable) {
|
|
54408
|
+
await chmod(targetPath, 493);
|
|
54409
|
+
}
|
|
54410
|
+
}
|
|
54411
|
+
outputFiles.push(targetPath);
|
|
54412
|
+
}
|
|
54413
|
+
}
|
|
54414
|
+
}
|
|
54415
|
+
return { outputFiles, diagnostics };
|
|
54416
|
+
}
|
|
53940
54417
|
export {
|
|
53941
54418
|
AgentContractsConfigSchema,
|
|
53942
54419
|
AgentSchema,
|
|
53943
54420
|
AppendOperatorSchema,
|
|
53944
54421
|
ArtifactSchema,
|
|
53945
54422
|
BaseResolveError,
|
|
54423
|
+
BindingOutputSchema,
|
|
53946
54424
|
CONTEXT_TYPES,
|
|
54425
|
+
CheckSchema,
|
|
53947
54426
|
CommandSchema,
|
|
53948
54427
|
ComponentsSchema,
|
|
53949
54428
|
ConfigLoadError,
|
|
@@ -53953,8 +54432,14 @@ export {
|
|
|
53953
54432
|
EscalationCriterionSchema,
|
|
53954
54433
|
ExecutionStepSchema,
|
|
53955
54434
|
ExtendsSchema,
|
|
54435
|
+
GuardrailPolicyRuleEscalationSchema,
|
|
54436
|
+
GuardrailPolicyRuleSchema,
|
|
54437
|
+
GuardrailPolicySchema,
|
|
54438
|
+
GuardrailSchema,
|
|
54439
|
+
GuardrailScopeSchema,
|
|
53956
54440
|
HandoffTypeSchema,
|
|
53957
54441
|
InsertAfterOperatorSchema,
|
|
54442
|
+
MatcherSchema,
|
|
53958
54443
|
MergeError,
|
|
53959
54444
|
PolicySchema,
|
|
53960
54445
|
PolicyWhenSchema,
|
|
@@ -53963,7 +54448,9 @@ export {
|
|
|
53963
54448
|
RemoveOperatorSchema,
|
|
53964
54449
|
RenderTargetSchema,
|
|
53965
54450
|
ReplaceOperatorSchema,
|
|
54451
|
+
ReportingSchema,
|
|
53966
54452
|
RuleSchema,
|
|
54453
|
+
SoftwareBindingSchema,
|
|
53967
54454
|
SystemSchema,
|
|
53968
54455
|
TaskSchema,
|
|
53969
54456
|
ToolSchema,
|
|
@@ -53973,6 +54460,8 @@ export {
|
|
|
53973
54460
|
WorkflowStepSchema,
|
|
53974
54461
|
buildArtifactContext,
|
|
53975
54462
|
buildGlobalContext,
|
|
54463
|
+
buildGuardrailContext,
|
|
54464
|
+
buildGuardrailPolicyContext,
|
|
53976
54465
|
buildHandoffTypeContext,
|
|
53977
54466
|
buildPerAgentContext,
|
|
53978
54467
|
buildPolicyContext,
|
|
@@ -53984,7 +54473,9 @@ export {
|
|
|
53984
54473
|
builtinRules,
|
|
53985
54474
|
checkDriftFromConfig,
|
|
53986
54475
|
checkReferences,
|
|
54476
|
+
generateGuardrails,
|
|
53987
54477
|
lint,
|
|
54478
|
+
loadBindings,
|
|
53988
54479
|
loadConfig,
|
|
53989
54480
|
loadDsl,
|
|
53990
54481
|
mergeDsl,
|
|
@@ -53992,6 +54483,8 @@ export {
|
|
|
53992
54483
|
resolve3 as resolve,
|
|
53993
54484
|
resolveAllOf,
|
|
53994
54485
|
resolveBase,
|
|
54486
|
+
resolveBindingTargetPath,
|
|
54487
|
+
resolveChecks,
|
|
53995
54488
|
resolveDslPath,
|
|
53996
54489
|
spectralLint,
|
|
53997
54490
|
validateHandoffSchemas,
|