agent-contracts 0.14.1 → 0.16.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/dist/cli.js CHANGED
@@ -159,11 +159,11 @@ function __metadata(metadataKey, metadataValue) {
159
159
  }
160
160
  function __awaiter(thisArg, _arguments, P2, generator) {
161
161
  function adopt(value) {
162
- return value instanceof P2 ? value : new P2(function(resolve8) {
163
- resolve8(value);
162
+ return value instanceof P2 ? value : new P2(function(resolve9) {
163
+ resolve9(value);
164
164
  });
165
165
  }
166
- return new (P2 || (P2 = Promise))(function(resolve8, reject) {
166
+ return new (P2 || (P2 = Promise))(function(resolve9, reject) {
167
167
  function fulfilled(value) {
168
168
  try {
169
169
  step(generator.next(value));
@@ -179,7 +179,7 @@ function __awaiter(thisArg, _arguments, P2, generator) {
179
179
  }
180
180
  }
181
181
  function step(result) {
182
- result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
182
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
183
183
  }
184
184
  step((generator = generator.apply(thisArg, _arguments || [])).next());
185
185
  });
@@ -370,14 +370,14 @@ function __asyncValues(o3) {
370
370
  }, i3);
371
371
  function verb(n3) {
372
372
  i3[n3] = o3[n3] && function(v2) {
373
- return new Promise(function(resolve8, reject) {
374
- v2 = o3[n3](v2), settle(resolve8, reject, v2.done, v2.value);
373
+ return new Promise(function(resolve9, reject) {
374
+ v2 = o3[n3](v2), settle(resolve9, reject, v2.done, v2.value);
375
375
  });
376
376
  };
377
377
  }
378
- function settle(resolve8, reject, d2, v2) {
378
+ function settle(resolve9, reject, d2, v2) {
379
379
  Promise.resolve(v2).then(function(v3) {
380
- resolve8({ value: v3, done: d2 });
380
+ resolve9({ value: v3, done: d2 });
381
381
  }, reject);
382
382
  }
383
383
  }
@@ -3952,7 +3952,7 @@ var require_lodash = __commonJS({
3952
3952
  }
3953
3953
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
3954
3954
  });
3955
- function join3(array, separator) {
3955
+ function join4(array, separator) {
3956
3956
  return array == null ? "" : nativeJoin.call(array, separator);
3957
3957
  }
3958
3958
  function last(array) {
@@ -5876,7 +5876,7 @@ var require_lodash = __commonJS({
5876
5876
  lodash.isUndefined = isUndefined;
5877
5877
  lodash.isWeakMap = isWeakMap;
5878
5878
  lodash.isWeakSet = isWeakSet;
5879
- lodash.join = join3;
5879
+ lodash.join = join4;
5880
5880
  lodash.kebabCase = kebabCase;
5881
5881
  lodash.last = last;
5882
5882
  lodash.lastIndexOf = lastIndexOf;
@@ -6293,7 +6293,7 @@ var init_index_es = __esm({
6293
6293
  return { drive: t4.toLowerCase() + ":" };
6294
6294
  }, k2 = function() {
6295
6295
  return { drive: null };
6296
- }, z18 = function() {
6296
+ }, z20 = function() {
6297
6297
  return { drive: null };
6298
6298
  }, B2 = function(t4) {
6299
6299
  return { protocol: null, origin: null, absolute: false, drive: null, ...t4 };
@@ -6334,7 +6334,7 @@ var init_index_es = __esm({
6334
6334
  var t4, n4, r4, e4, o4;
6335
6335
  return t4 = K2, (n4 = rt()) !== c2 && (r4 = et()) !== c2 && (e4 = ut()) !== c2 && (o4 = it()) !== c2 ? (n4 = s2(n4, r4, e4, o4), t4 = n4) : (K2 = t4, t4 = c2), t4 === c2 && (t4 = K2, (n4 = rt()) !== c2 && (r4 = et()) !== c2 && (e4 = (function() {
6336
6336
  var t5;
6337
- return (t5 = x3) !== c2 && (t5 = z18()), t5;
6337
+ return (t5 = x3) !== c2 && (t5 = z20()), t5;
6338
6338
  })()) !== c2 ? (n4 = f2(n4, r4, e4), t4 = n4) : (K2 = t4, t4 = c2)), t4;
6339
6339
  })()) === c2 && (n3 = (function() {
6340
6340
  var n4, r4, e4, o4;
@@ -7367,7 +7367,7 @@ var init_dist = __esm({
7367
7367
  var require_stable = __commonJS({
7368
7368
  "node_modules/safe-stable-stringify/stable.js"(exports, module) {
7369
7369
  "use strict";
7370
- module.exports = stringify2;
7370
+ module.exports = stringify4;
7371
7371
  var indentation = "";
7372
7372
  var strEscapeSequencesRegExp = /[\x00-\x1f\x22\x5c]/;
7373
7373
  var strEscapeSequencesReplacer = /[\x00-\x1f\x22\x5c]/g;
@@ -7497,7 +7497,7 @@ var require_stable = __commonJS({
7497
7497
  return result;
7498
7498
  }
7499
7499
  function stringifyFullFn(key, parent, stack, replacer, indent) {
7500
- var i3, res, join3;
7500
+ var i3, res, join4;
7501
7501
  const originalIndentation = indentation;
7502
7502
  var value = parent[key];
7503
7503
  if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
@@ -7523,12 +7523,12 @@ var require_stable = __commonJS({
7523
7523
  indentation += indent;
7524
7524
  res += `
7525
7525
  ${indentation}`;
7526
- join3 = `,
7526
+ join4 = `,
7527
7527
  ${indentation}`;
7528
7528
  for (i3 = 0; i3 < value.length - 1; i3++) {
7529
7529
  const tmp2 = stringifyFullFn(i3, value, stack, replacer, indent);
7530
7530
  res += tmp2 !== void 0 ? tmp2 : "null";
7531
- res += join3;
7531
+ res += join4;
7532
7532
  }
7533
7533
  const tmp = stringifyFullFn(i3, value, stack, replacer, indent);
7534
7534
  res += tmp !== void 0 ? tmp : "null";
@@ -7550,7 +7550,7 @@ ${originalIndentation}`;
7550
7550
  indentation += indent;
7551
7551
  res += `
7552
7552
  ${indentation}`;
7553
- join3 = `,
7553
+ join4 = `,
7554
7554
  ${indentation}`;
7555
7555
  var separator = "";
7556
7556
  for (i3 = 0; i3 < keys.length; i3++) {
@@ -7558,7 +7558,7 @@ ${indentation}`;
7558
7558
  const tmp = stringifyFullFn(key, value, stack, replacer, indent);
7559
7559
  if (tmp !== void 0) {
7560
7560
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7561
- separator = join3;
7561
+ separator = join4;
7562
7562
  }
7563
7563
  }
7564
7564
  if (separator !== "") {
@@ -7580,7 +7580,7 @@ ${originalIndentation}`;
7580
7580
  }
7581
7581
  }
7582
7582
  function stringifyFullArr(key, value, stack, replacer, indent) {
7583
- var i3, res, join3;
7583
+ var i3, res, join4;
7584
7584
  const originalIndentation = indentation;
7585
7585
  if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
7586
7586
  value = value.toJSON(key);
@@ -7604,12 +7604,12 @@ ${originalIndentation}`;
7604
7604
  indentation += indent;
7605
7605
  res += `
7606
7606
  ${indentation}`;
7607
- join3 = `,
7607
+ join4 = `,
7608
7608
  ${indentation}`;
7609
7609
  for (i3 = 0; i3 < value.length - 1; i3++) {
7610
7610
  const tmp2 = stringifyFullArr(i3, value[i3], stack, replacer, indent);
7611
7611
  res += tmp2 !== void 0 ? tmp2 : "null";
7612
- res += join3;
7612
+ res += join4;
7613
7613
  }
7614
7614
  const tmp = stringifyFullArr(i3, value[i3], stack, replacer, indent);
7615
7615
  res += tmp !== void 0 ? tmp : "null";
@@ -7630,7 +7630,7 @@ ${originalIndentation}`;
7630
7630
  indentation += indent;
7631
7631
  res += `
7632
7632
  ${indentation}`;
7633
- join3 = `,
7633
+ join4 = `,
7634
7634
  ${indentation}`;
7635
7635
  var separator = "";
7636
7636
  for (i3 = 0; i3 < replacer.length; i3++) {
@@ -7639,7 +7639,7 @@ ${indentation}`;
7639
7639
  const tmp = stringifyFullArr(key, value[key], stack, replacer, indent);
7640
7640
  if (tmp !== void 0) {
7641
7641
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7642
- separator = join3;
7642
+ separator = join4;
7643
7643
  }
7644
7644
  }
7645
7645
  }
@@ -7662,7 +7662,7 @@ ${originalIndentation}`;
7662
7662
  }
7663
7663
  }
7664
7664
  function stringifyIndent(key, value, stack, indent) {
7665
- var i3, res, join3;
7665
+ var i3, res, join4;
7666
7666
  const originalIndentation = indentation;
7667
7667
  switch (typeof value) {
7668
7668
  case "object":
@@ -7692,12 +7692,12 @@ ${originalIndentation}`;
7692
7692
  indentation += indent;
7693
7693
  res += `
7694
7694
  ${indentation}`;
7695
- join3 = `,
7695
+ join4 = `,
7696
7696
  ${indentation}`;
7697
7697
  for (i3 = 0; i3 < value.length - 1; i3++) {
7698
7698
  const tmp2 = stringifyIndent(i3, value[i3], stack, indent);
7699
7699
  res += tmp2 !== void 0 ? tmp2 : "null";
7700
- res += join3;
7700
+ res += join4;
7701
7701
  }
7702
7702
  const tmp = stringifyIndent(i3, value[i3], stack, indent);
7703
7703
  res += tmp !== void 0 ? tmp : "null";
@@ -7719,7 +7719,7 @@ ${originalIndentation}`;
7719
7719
  indentation += indent;
7720
7720
  res += `
7721
7721
  ${indentation}`;
7722
- join3 = `,
7722
+ join4 = `,
7723
7723
  ${indentation}`;
7724
7724
  var separator = "";
7725
7725
  for (i3 = 0; i3 < keys.length; i3++) {
@@ -7727,7 +7727,7 @@ ${indentation}`;
7727
7727
  const tmp = stringifyIndent(key, value[key], stack, indent);
7728
7728
  if (tmp !== void 0) {
7729
7729
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7730
- separator = join3;
7730
+ separator = join4;
7731
7731
  }
7732
7732
  }
7733
7733
  if (separator !== "") {
@@ -7943,7 +7943,7 @@ ${originalIndentation}`;
7943
7943
  }
7944
7944
  return arr;
7945
7945
  }
7946
- function stringify2(value, replacer, spacer) {
7946
+ function stringify4(value, replacer, spacer) {
7947
7947
  var i3;
7948
7948
  var indent = "";
7949
7949
  indentation = "";
@@ -7982,9 +7982,9 @@ ${originalIndentation}`;
7982
7982
  var require_safe_stable_stringify = __commonJS({
7983
7983
  "node_modules/safe-stable-stringify/index.js"(exports, module) {
7984
7984
  "use strict";
7985
- var stringify2 = require_stable();
7986
- module.exports = stringify2;
7987
- stringify2.default = stringify2;
7985
+ var stringify4 = require_stable();
7986
+ module.exports = stringify4;
7987
+ stringify4.default = stringify4;
7988
7988
  }
7989
7989
  });
7990
7990
 
@@ -8023,7 +8023,7 @@ __export(index_es_exports2, {
8023
8023
  resolveExternalRef: () => ye,
8024
8024
  resolveExternalRefWithLocation: () => ge,
8025
8025
  resolveInlineRef: () => B,
8026
- resolveInlineRefWithLocation: () => z17,
8026
+ resolveInlineRefWithLocation: () => z19,
8027
8027
  safeParse: () => de,
8028
8028
  safeStringify: () => ve,
8029
8029
  startsWith: () => be,
@@ -8067,9 +8067,9 @@ function* L(e3, t3, r3) {
8067
8067
  for (const [n3, o3] of t3.entries()) O(e3.value, o3, r3), e3.value = e3.value[o3], A(e3.value) && (j(e3.value), yield [n3, e3.value]);
8068
8068
  }
8069
8069
  function B(e3, t3) {
8070
- return z17(e3, t3).value;
8070
+ return z19(e3, t3).value;
8071
8071
  }
8072
- function z17(e3, t3) {
8072
+ function z19(e3, t3) {
8073
8073
  return (function e4(t4, r3, n3, o3) {
8074
8074
  if (null !== V(r3)) throw new ReferenceError("Cannot resolve external references");
8075
8075
  const i3 = K(r3);
@@ -12937,13 +12937,13 @@ var require_yaml2 = __commonJS({
12937
12937
  function getLocationForJsonPath(result, path) {
12938
12938
  return (0, yaml_1.getLocationForJsonPath)(result, path);
12939
12939
  }
12940
- var parseYaml4 = (input) => (0, yaml_1.parseWithPointers)(input, {
12940
+ var parseYaml5 = (input) => (0, yaml_1.parseWithPointers)(input, {
12941
12941
  ignoreDuplicateKeys: false,
12942
12942
  mergeKeys: true,
12943
12943
  preserveKeyOrder: true,
12944
12944
  attachComments: false
12945
12945
  });
12946
- exports.parseYaml = parseYaml4;
12946
+ exports.parseYaml = parseYaml5;
12947
12947
  exports.Yaml = {
12948
12948
  parse: exports.parseYaml,
12949
12949
  getLocationForJsonPath,
@@ -13033,11 +13033,11 @@ function __metadata2(metadataKey, metadataValue) {
13033
13033
  }
13034
13034
  function __awaiter2(thisArg, _arguments, P2, generator) {
13035
13035
  function adopt(value) {
13036
- return value instanceof P2 ? value : new P2(function(resolve8) {
13037
- resolve8(value);
13036
+ return value instanceof P2 ? value : new P2(function(resolve9) {
13037
+ resolve9(value);
13038
13038
  });
13039
13039
  }
13040
- return new (P2 || (P2 = Promise))(function(resolve8, reject) {
13040
+ return new (P2 || (P2 = Promise))(function(resolve9, reject) {
13041
13041
  function fulfilled(value) {
13042
13042
  try {
13043
13043
  step(generator.next(value));
@@ -13053,7 +13053,7 @@ function __awaiter2(thisArg, _arguments, P2, generator) {
13053
13053
  }
13054
13054
  }
13055
13055
  function step(result) {
13056
- result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
13056
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
13057
13057
  }
13058
13058
  step((generator = generator.apply(thisArg, _arguments || [])).next());
13059
13059
  });
@@ -13231,14 +13231,14 @@ function __asyncValues2(o3) {
13231
13231
  }, i3);
13232
13232
  function verb(n3) {
13233
13233
  i3[n3] = o3[n3] && function(v2) {
13234
- return new Promise(function(resolve8, reject) {
13235
- v2 = o3[n3](v2), settle(resolve8, reject, v2.done, v2.value);
13234
+ return new Promise(function(resolve9, reject) {
13235
+ v2 = o3[n3](v2), settle(resolve9, reject, v2.done, v2.value);
13236
13236
  });
13237
13237
  };
13238
13238
  }
13239
- function settle(resolve8, reject, d2, v2) {
13239
+ function settle(resolve9, reject, d2, v2) {
13240
13240
  Promise.resolve(v2).then(function(v3) {
13241
- resolve8({ value: v3, done: d2 });
13241
+ resolve9({ value: v3, done: d2 });
13242
13242
  }, reject);
13243
13243
  }
13244
13244
  }
@@ -15152,7 +15152,7 @@ function consumeBody() {
15152
15152
  let accum = [];
15153
15153
  let accumBytes = 0;
15154
15154
  let abort = false;
15155
- return new Body.Promise(function(resolve8, reject) {
15155
+ return new Body.Promise(function(resolve9, reject) {
15156
15156
  let resTimeout;
15157
15157
  if (_this4.timeout) {
15158
15158
  resTimeout = setTimeout(function() {
@@ -15186,7 +15186,7 @@ function consumeBody() {
15186
15186
  }
15187
15187
  clearTimeout(resTimeout);
15188
15188
  try {
15189
- resolve8(Buffer.concat(accum, accumBytes));
15189
+ resolve9(Buffer.concat(accum, accumBytes));
15190
15190
  } catch (err) {
15191
15191
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
15192
15192
  }
@@ -15449,7 +15449,7 @@ function fetch(url, opts) {
15449
15449
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
15450
15450
  }
15451
15451
  Body.Promise = fetch.Promise;
15452
- return new fetch.Promise(function(resolve8, reject) {
15452
+ return new fetch.Promise(function(resolve9, reject) {
15453
15453
  const request = new Request(url, opts);
15454
15454
  const options = getNodeRequestOptions(request);
15455
15455
  const send = (options.protocol === "https:" ? https : http).request;
@@ -15582,7 +15582,7 @@ function fetch(url, opts) {
15582
15582
  requestOpts.body = void 0;
15583
15583
  requestOpts.headers.delete("content-length");
15584
15584
  }
15585
- resolve8(fetch(new Request(locationURL, requestOpts)));
15585
+ resolve9(fetch(new Request(locationURL, requestOpts)));
15586
15586
  finalize();
15587
15587
  return;
15588
15588
  }
@@ -15603,7 +15603,7 @@ function fetch(url, opts) {
15603
15603
  const codings = headers.get("Content-Encoding");
15604
15604
  if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
15605
15605
  response = new Response(body, response_options);
15606
- resolve8(response);
15606
+ resolve9(response);
15607
15607
  return;
15608
15608
  }
15609
15609
  const zlibOptions = {
@@ -15613,7 +15613,7 @@ function fetch(url, opts) {
15613
15613
  if (codings == "gzip" || codings == "x-gzip") {
15614
15614
  body = body.pipe(zlib.createGunzip(zlibOptions));
15615
15615
  response = new Response(body, response_options);
15616
- resolve8(response);
15616
+ resolve9(response);
15617
15617
  return;
15618
15618
  }
15619
15619
  if (codings == "deflate" || codings == "x-deflate") {
@@ -15625,12 +15625,12 @@ function fetch(url, opts) {
15625
15625
  body = body.pipe(zlib.createInflateRaw());
15626
15626
  }
15627
15627
  response = new Response(body, response_options);
15628
- resolve8(response);
15628
+ resolve9(response);
15629
15629
  });
15630
15630
  raw.on("end", function() {
15631
15631
  if (!response) {
15632
15632
  response = new Response(body, response_options);
15633
- resolve8(response);
15633
+ resolve9(response);
15634
15634
  }
15635
15635
  });
15636
15636
  return;
@@ -15638,11 +15638,11 @@ function fetch(url, opts) {
15638
15638
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
15639
15639
  body = body.pipe(zlib.createBrotliDecompress());
15640
15640
  response = new Response(body, response_options);
15641
- resolve8(response);
15641
+ resolve9(response);
15642
15642
  return;
15643
15643
  }
15644
15644
  response = new Response(body, response_options);
15645
- resolve8(response);
15645
+ resolve9(response);
15646
15646
  });
15647
15647
  writeToStream(req, request);
15648
15648
  });
@@ -16355,13 +16355,13 @@ var require_file = __commonJS({
16355
16355
  Object.defineProperty(exports, "__esModule", { value: true });
16356
16356
  var fs_1 = __require("fs");
16357
16357
  function resolveFile(ref) {
16358
- return new Promise((resolve8, reject) => {
16358
+ return new Promise((resolve9, reject) => {
16359
16359
  const path = ref.href();
16360
16360
  fs_1.readFile(path, "utf8", (err, data) => {
16361
16361
  if (err) {
16362
16362
  reject(err);
16363
16363
  } else {
16364
- resolve8(data);
16364
+ resolve9(data);
16365
16365
  }
16366
16366
  });
16367
16367
  });
@@ -16899,7 +16899,7 @@ var require_immer_cjs_production_min = __commonJS({
16899
16899
  var t4 = n4[H2];
16900
16900
  return (t4 ? s2(t4) : n4)[r4];
16901
16901
  }
16902
- function z18(n4, r4) {
16902
+ function z20(n4, r4) {
16903
16903
  if (r4 in n4) for (var t4 = Object.getPrototypeOf(n4); t4; ) {
16904
16904
  var e4 = Object.getOwnPropertyDescriptor(t4, r4);
16905
16905
  if (e4) return e4;
@@ -17292,7 +17292,7 @@ var require_immer_cjs_production_min = __commonJS({
17292
17292
  if (r4 === H2) return n4;
17293
17293
  var e4 = s2(n4);
17294
17294
  if (!u2(e4, r4)) return (function(n5, r5, t4) {
17295
- var e5, i5 = z18(r5, t4);
17295
+ var e5, i5 = z20(r5, t4);
17296
17296
  return i5 ? "value" in i5 ? i5.value : null === (e5 = i5.get) || void 0 === e5 ? void 0 : e5.call(n5.k) : void 0;
17297
17297
  })(n4, e4, r4);
17298
17298
  var i4 = e4[r4];
@@ -17302,7 +17302,7 @@ var require_immer_cjs_production_min = __commonJS({
17302
17302
  }, ownKeys: function(n4) {
17303
17303
  return Reflect.ownKeys(s2(n4));
17304
17304
  }, set: function(n4, r4, t4) {
17305
- var e4 = z18(s2(n4), r4);
17305
+ var e4 = z20(s2(n4), r4);
17306
17306
  if (null == e4 ? void 0 : e4.set) return e4.set.call(n4.k, t4), true;
17307
17307
  if (!n4.g) {
17308
17308
  var i4 = A2(s2(n4), r4), o4 = null == i4 ? void 0 : i4[H2];
@@ -23964,12 +23964,12 @@ var require_reader = __commonJS({
23964
23964
  }
23965
23965
  } else {
23966
23966
  try {
23967
- return await new Promise((resolve8, reject) => {
23967
+ return await new Promise((resolve9, reject) => {
23968
23968
  fs.readFile(name, opts.encoding, (err, data) => {
23969
23969
  if (err !== null) {
23970
23970
  reject(err);
23971
23971
  } else {
23972
- resolve8(data);
23972
+ resolve9(data);
23973
23973
  }
23974
23974
  });
23975
23975
  });
@@ -30464,7 +30464,7 @@ var require_astring = __commonJS({
30464
30464
  if (staticProps) _defineProperties(Constructor, staticProps);
30465
30465
  return Constructor;
30466
30466
  }
30467
- var stringify2 = JSON.stringify;
30467
+ var stringify4 = JSON.stringify;
30468
30468
  if (!String.prototype.repeat) {
30469
30469
  throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");
30470
30470
  }
@@ -31386,7 +31386,7 @@ var require_astring = __commonJS({
31386
31386
  } else if (node.bigint != null) {
31387
31387
  state.write(node.bigint + "n", node);
31388
31388
  } else {
31389
- state.write(stringify2(node.value), node);
31389
+ state.write(stringify4(node.value), node);
31390
31390
  }
31391
31391
  },
31392
31392
  RegExpLiteral: function RegExpLiteral(node, state) {
@@ -35641,11 +35641,11 @@ var require_brace_expansion = __commonJS({
35641
35641
  if (pad) {
35642
35642
  var need = width - c2.length;
35643
35643
  if (need > 0) {
35644
- var z18 = new Array(need + 1).join("0");
35644
+ var z20 = new Array(need + 1).join("0");
35645
35645
  if (i3 < 0)
35646
- c2 = "-" + z18 + c2.slice(1);
35646
+ c2 = "-" + z20 + c2.slice(1);
35647
35647
  else
35648
- c2 = z18 + c2;
35648
+ c2 = z20 + c2;
35649
35649
  }
35650
35650
  }
35651
35651
  }
@@ -40854,14 +40854,14 @@ var require_AsyncFromSyncIteratorContinuation = __commonJS({
40854
40854
  if (!$Promise) {
40855
40855
  throw new $SyntaxError("This environment does not support Promises.");
40856
40856
  }
40857
- return new $Promise(function(resolve8) {
40857
+ return new $Promise(function(resolve9) {
40858
40858
  var done = IteratorComplete(result);
40859
40859
  var value = IteratorValue(result);
40860
40860
  var valueWrapper = PromiseResolve($Promise, value);
40861
40861
  var onFulfilled = function(value2) {
40862
40862
  return CreateIteratorResultObject(value2, done);
40863
40863
  };
40864
- resolve8($then(valueWrapper, onFulfilled));
40864
+ resolve9($then(valueWrapper, onFulfilled));
40865
40865
  });
40866
40866
  };
40867
40867
  }
@@ -41409,7 +41409,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
41409
41409
  var O2 = this;
41410
41410
  SLOT.assert(O2, "[[SyncIteratorRecord]]");
41411
41411
  var argsLength = arguments.length;
41412
- return new $Promise(function(resolve8) {
41412
+ return new $Promise(function(resolve9) {
41413
41413
  var syncIteratorRecord = SLOT.get(O2, "[[SyncIteratorRecord]]");
41414
41414
  var result;
41415
41415
  if (argsLength > 0) {
@@ -41417,7 +41417,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
41417
41417
  } else {
41418
41418
  result = IteratorNext(syncIteratorRecord);
41419
41419
  }
41420
- resolve8(AsyncFromSyncIteratorContinuation(result));
41420
+ resolve9(AsyncFromSyncIteratorContinuation(result));
41421
41421
  });
41422
41422
  },
41423
41423
  "return": function() {
@@ -41428,12 +41428,12 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
41428
41428
  SLOT.assert(O2, "[[SyncIteratorRecord]]");
41429
41429
  var valueIsPresent = arguments.length > 0;
41430
41430
  var value = valueIsPresent ? arguments[0] : void 0;
41431
- return new $Promise(function(resolve8, reject) {
41431
+ return new $Promise(function(resolve9, reject) {
41432
41432
  var syncIterator = SLOT.get(O2, "[[SyncIteratorRecord]]")["[[Iterator]]"];
41433
41433
  var iteratorReturn = GetMethod(syncIterator, "return");
41434
41434
  if (typeof iteratorReturn === "undefined") {
41435
41435
  var iterResult = CreateIteratorResultObject(value, true);
41436
- Call(resolve8, void 0, [iterResult]);
41436
+ Call(resolve9, void 0, [iterResult]);
41437
41437
  return;
41438
41438
  }
41439
41439
  var result;
@@ -41446,7 +41446,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
41446
41446
  Call(reject, void 0, [new $TypeError("Iterator `return` method returned a non-object value.")]);
41447
41447
  return;
41448
41448
  }
41449
- resolve8(AsyncFromSyncIteratorContinuation(result));
41449
+ resolve9(AsyncFromSyncIteratorContinuation(result));
41450
41450
  });
41451
41451
  },
41452
41452
  "throw": function() {
@@ -41457,7 +41457,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
41457
41457
  SLOT.assert(O2, "[[SyncIteratorRecord]]");
41458
41458
  var valueIsPresent = arguments.length > 0;
41459
41459
  var value = valueIsPresent ? arguments[0] : void 0;
41460
- return new $Promise(function(resolve8, reject) {
41460
+ return new $Promise(function(resolve9, reject) {
41461
41461
  var syncIterator = SLOT.get(O2, "[[SyncIteratorRecord]]")["[[Iterator]]"];
41462
41462
  var throwMethod = GetMethod(syncIterator, "throw");
41463
41463
  if (typeof throwMethod === "undefined") {
@@ -41474,7 +41474,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
41474
41474
  Call(reject, void 0, [new $TypeError("Iterator `throw` method returned a non-object value.")]);
41475
41475
  return;
41476
41476
  }
41477
- resolve8(AsyncFromSyncIteratorContinuation(
41477
+ resolve9(AsyncFromSyncIteratorContinuation(
41478
41478
  result
41479
41479
  /* , promiseCapability */
41480
41480
  ));
@@ -46246,7 +46246,7 @@ var require_lodash3 = __commonJS({
46246
46246
  }
46247
46247
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
46248
46248
  });
46249
- function join3(array, separator) {
46249
+ function join4(array, separator) {
46250
46250
  return array == null ? "" : nativeJoin.call(array, separator);
46251
46251
  }
46252
46252
  function last(array) {
@@ -48165,7 +48165,7 @@ var require_lodash3 = __commonJS({
48165
48165
  lodash.isUndefined = isUndefined;
48166
48166
  lodash.isWeakMap = isWeakMap;
48167
48167
  lodash.isWeakSet = isWeakSet;
48168
- lodash.join = join3;
48168
+ lodash.join = join4;
48169
48169
  lodash.kebabCase = kebabCase;
48170
48170
  lodash.last = last;
48171
48171
  lodash.lastIndexOf = lastIndexOf;
@@ -49169,7 +49169,7 @@ var require_dist10 = __commonJS({
49169
49169
  var getSiblings = (parent) => (node) => getChildren(parent).filter(not(eq(node)));
49170
49170
  var concatAll = (
49171
49171
  /*::<T>*/
49172
- (xs) => (ys) => ys.reduce((zs, z18) => zs.concat(z18), xs)
49172
+ (xs) => (ys) => ys.reduce((zs, z20) => zs.concat(z20), xs)
49173
49173
  );
49174
49174
  function getLastSegment(instancePath) {
49175
49175
  const index4 = instancePath.lastIndexOf("/");
@@ -50425,9 +50425,9 @@ var require_dist13 = __commonJS({
50425
50425
  });
50426
50426
 
50427
50427
  // src/cli/cli.ts
50428
- import { readFileSync } from "fs";
50428
+ import { readFileSync as readFileSync2 } from "fs";
50429
50429
  import { fileURLToPath } from "url";
50430
- import { resolve as resolve7, dirname as dirname7 } from "path";
50430
+ import { resolve as resolve8, dirname as dirname8 } from "path";
50431
50431
  import { Command as Command8 } from "commander";
50432
50432
 
50433
50433
  // src/cli/commands/resolve.ts
@@ -50618,7 +50618,7 @@ var SoftwareBindingSchema = z4.object({
50618
50618
  }).passthrough();
50619
50619
 
50620
50620
  // src/schema/dsl.ts
50621
- import { z as z13 } from "zod";
50621
+ import { z as z15 } from "zod";
50622
50622
 
50623
50623
  // src/schema/handoff-type.ts
50624
50624
  import { z as z5 } from "zod";
@@ -50719,106 +50719,143 @@ var TaskSchema = z9.object({
50719
50719
  guardrails: z9.array(z9.string()).optional()
50720
50720
  }).passthrough();
50721
50721
 
50722
- // src/schema/tool.ts
50722
+ // src/schema/team-import.ts
50723
50723
  import { z as z10 } from "zod";
50724
- var CommandSchema = z10.object({
50725
- command: z10.string(),
50726
- category: z10.string(),
50727
- reads: z10.array(z10.string()).default([]),
50728
- writes: z10.array(z10.string()).default([]),
50729
- purpose: z10.string().optional()
50730
- });
50731
- var ToolSchema = z10.object({
50732
- kind: z10.string(),
50733
- description: z10.string().optional(),
50734
- input_artifacts: z10.array(z10.string()).default([]),
50735
- output_artifacts: z10.array(z10.string()).default([]),
50736
- invokable_by: z10.array(z10.string()),
50737
- side_effects: z10.array(z10.string()).default([]),
50738
- commands: z10.array(CommandSchema).default([]),
50739
- guardrails: z10.array(z10.string()).optional()
50724
+ var TeamImportSchema = z10.object({
50725
+ interface: z10.string(),
50726
+ version: z10.string().optional()
50740
50727
  }).passthrough();
50741
50728
 
50742
- // src/schema/validation.ts
50729
+ // src/schema/team-interface.ts
50743
50730
  import { z as z11 } from "zod";
50744
- var ValidationSchema = z11.object({
50745
- target_artifact: z11.string(),
50746
- kind: z11.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
50747
- executor_type: z11.enum(["tool", "agent"]),
50748
- executor: z11.string(),
50749
- blocking: z11.boolean(),
50750
- produces_evidence: z11.string().optional()
50731
+ var TeamInterfaceAcceptWorkflowSchema = z11.object({
50732
+ internal_workflow: z11.string().optional(),
50733
+ input_handoff: z11.string(),
50734
+ output_handoff: z11.string(),
50735
+ description: z11.string().optional()
50736
+ }).passthrough();
50737
+ var TeamInterfaceSchema = z11.object({
50738
+ version: z11.number(),
50739
+ description: z11.string().optional(),
50740
+ accepts: z11.object({
50741
+ workflows: z11.record(z11.string(), TeamInterfaceAcceptWorkflowSchema)
50742
+ }).passthrough().optional(),
50743
+ exposes: z11.object({
50744
+ artifacts: z11.array(z11.string())
50745
+ }).passthrough().optional(),
50746
+ constraints: z11.array(z11.string()).optional()
50751
50747
  }).passthrough();
50752
50748
 
50753
- // src/schema/workflow.ts
50749
+ // src/schema/tool.ts
50754
50750
  import { z as z12 } from "zod";
50755
- var RetrySchema = z12.object({
50756
- condition: z12.string(),
50757
- fix_task: z12.string(),
50758
- revalidate_task: z12.string().optional()
50759
- });
50760
- var ExternalParticipantSchema = z12.object({
50761
- id: z12.string(),
50762
- kind: z12.enum(["actor", "participant"]),
50763
- label: z12.string(),
50764
- description: z12.string().optional()
50765
- });
50766
- var WorkflowDelegateStepSchema = z12.object({
50767
- type: z12.literal("delegate"),
50751
+ var CommandSchema = z12.object({
50752
+ command: z12.string(),
50753
+ category: z12.string(),
50754
+ reads: z12.array(z12.string()).default([]),
50755
+ writes: z12.array(z12.string()).default([]),
50756
+ purpose: z12.string().optional()
50757
+ });
50758
+ var ToolSchema = z12.object({
50759
+ kind: z12.string(),
50768
50760
  description: z12.string().optional(),
50769
- task: z12.string(),
50770
- from_agent: z12.string(),
50771
- group: z12.string().optional(),
50761
+ input_artifacts: z12.array(z12.string()).default([]),
50762
+ output_artifacts: z12.array(z12.string()).default([]),
50763
+ invokable_by: z12.array(z12.string()),
50764
+ side_effects: z12.array(z12.string()).default([]),
50765
+ commands: z12.array(CommandSchema).default([]),
50766
+ guardrails: z12.array(z12.string()).optional()
50767
+ }).passthrough();
50768
+
50769
+ // src/schema/validation.ts
50770
+ import { z as z13 } from "zod";
50771
+ var ValidationSchema = z13.object({
50772
+ target_artifact: z13.string(),
50773
+ kind: z13.enum(["schema", "mechanical", "semantic", "approval", "provenance", "traceability", "fidelity"]),
50774
+ executor_type: z13.enum(["tool", "agent"]),
50775
+ executor: z13.string(),
50776
+ blocking: z13.boolean(),
50777
+ produces_evidence: z13.string().optional()
50778
+ }).passthrough();
50779
+
50780
+ // src/schema/workflow.ts
50781
+ import { z as z14 } from "zod";
50782
+ var RetrySchema = z14.object({
50783
+ condition: z14.string(),
50784
+ fix_task: z14.string(),
50785
+ revalidate_task: z14.string().optional()
50786
+ });
50787
+ var ExternalParticipantSchema = z14.object({
50788
+ id: z14.string(),
50789
+ kind: z14.enum(["actor", "participant"]),
50790
+ label: z14.string(),
50791
+ description: z14.string().optional()
50792
+ });
50793
+ var WorkflowDelegateStepSchema = z14.object({
50794
+ type: z14.literal("delegate"),
50795
+ description: z14.string().optional(),
50796
+ task: z14.string(),
50797
+ from_agent: z14.string(),
50798
+ group: z14.string().optional(),
50772
50799
  retry: RetrySchema.optional()
50773
50800
  }).passthrough();
50774
- var WorkflowGateStepSchema = z12.object({
50775
- type: z12.literal("gate"),
50776
- description: z12.string().optional(),
50777
- gate_kind: z12.string(),
50778
- group: z12.string().optional()
50801
+ var WorkflowGateStepSchema = z14.object({
50802
+ type: z14.literal("gate"),
50803
+ description: z14.string().optional(),
50804
+ gate_kind: z14.string(),
50805
+ group: z14.string().optional()
50779
50806
  }).passthrough();
50780
- var WorkflowHandoffStepSchema = z12.object({
50781
- type: z12.literal("handoff"),
50782
- description: z12.string().optional(),
50783
- handoff_kind: z12.string(),
50784
- task: z12.string().optional(),
50785
- from_agent: z12.string().optional(),
50786
- group: z12.string().optional(),
50807
+ var WorkflowHandoffStepSchema = z14.object({
50808
+ type: z14.literal("handoff"),
50809
+ description: z14.string().optional(),
50810
+ handoff_kind: z14.string(),
50811
+ task: z14.string().optional(),
50812
+ from_agent: z14.string().optional(),
50813
+ group: z14.string().optional(),
50787
50814
  retry: RetrySchema.optional()
50788
50815
  }).passthrough();
50789
- var WorkflowValidationStepSchema = z12.object({
50790
- type: z12.literal("validation"),
50791
- description: z12.string().optional(),
50792
- validation: z12.string(),
50793
- group: z12.string().optional()
50816
+ var WorkflowValidationStepSchema = z14.object({
50817
+ type: z14.literal("validation"),
50818
+ description: z14.string().optional(),
50819
+ validation: z14.string(),
50820
+ group: z14.string().optional()
50794
50821
  }).passthrough();
50795
- var WorkflowDecisionStepSchema = z12.object({
50796
- type: z12.literal("decision"),
50797
- description: z12.string().optional(),
50822
+ var WorkflowDecisionStepSchema = z14.object({
50823
+ type: z14.literal("decision"),
50824
+ description: z14.string().optional(),
50798
50825
  /** @deprecated Use `routing_key` instead. `on` is kept for backward compatibility. */
50799
- on: z12.string().optional(),
50800
- routing_key: z12.string().optional(),
50801
- branches: z12.record(z12.string(), z12.array(z12.string())),
50802
- group: z12.string().optional()
50826
+ on: z14.string().optional(),
50827
+ routing_key: z14.string().optional(),
50828
+ branches: z14.record(z14.string(), z14.array(z14.string())),
50829
+ group: z14.string().optional()
50830
+ }).passthrough();
50831
+ var WorkflowTeamTaskStepSchema = z14.object({
50832
+ type: z14.literal("team_task"),
50833
+ description: z14.string().optional(),
50834
+ to_team: z14.string(),
50835
+ workflow: z14.string(),
50836
+ handoff: z14.string(),
50837
+ expects: z14.string(),
50838
+ group: z14.string().optional()
50803
50839
  }).passthrough();
50804
- var WorkflowStepSchema = z12.discriminatedUnion("type", [
50840
+ var WorkflowStepSchema = z14.discriminatedUnion("type", [
50805
50841
  WorkflowDelegateStepSchema,
50806
50842
  WorkflowGateStepSchema,
50807
50843
  WorkflowHandoffStepSchema,
50808
50844
  WorkflowValidationStepSchema,
50809
- WorkflowDecisionStepSchema
50845
+ WorkflowDecisionStepSchema,
50846
+ WorkflowTeamTaskStepSchema
50810
50847
  ]);
50811
- var WorkflowSchema = z12.object({
50812
- description: z12.string().optional(),
50813
- entry_conditions: z12.array(z12.string()).default([]),
50814
- trigger: z12.string().optional(),
50815
- steps: z12.array(WorkflowStepSchema),
50816
- external_participants: z12.array(ExternalParticipantSchema).default([])
50848
+ var WorkflowSchema = z14.object({
50849
+ description: z14.string().optional(),
50850
+ entry_conditions: z14.array(z14.string()).default([]),
50851
+ trigger: z14.string().optional(),
50852
+ steps: z14.array(WorkflowStepSchema),
50853
+ external_participants: z14.array(ExternalParticipantSchema).default([])
50817
50854
  }).passthrough();
50818
50855
 
50819
50856
  // src/schema/dsl.ts
50820
- var ComponentsSchema = z13.object({
50821
- schemas: z13.record(z13.string(), z13.record(z13.string(), z13.any())).default({})
50857
+ var ComponentsSchema = z15.object({
50858
+ schemas: z15.record(z15.string(), z15.record(z15.string(), z15.any())).default({})
50822
50859
  }).passthrough();
50823
50860
  var SCOPE_NODE_TYPES = [
50824
50861
  "root",
@@ -50840,32 +50877,34 @@ var SCOPE_NODE_TYPES = [
50840
50877
  "escalation_criterion",
50841
50878
  "prerequisite"
50842
50879
  ];
50843
- var ScopeNodeTypeSchema = z13.enum(SCOPE_NODE_TYPES);
50844
- var XExtensionDeclSchema = z13.object({
50845
- type: z13.string(),
50846
- items: z13.string().optional(),
50847
- description: z13.string().optional(),
50848
- scope: z13.array(ScopeNodeTypeSchema).optional(),
50849
- schema: z13.record(z13.string(), z13.any()).optional(),
50850
- required: z13.boolean().default(false)
50851
- });
50852
- var DslSchema = z13.object({
50853
- version: z13.literal(1),
50854
- extends: z13.string().optional(),
50880
+ var ScopeNodeTypeSchema = z15.enum(SCOPE_NODE_TYPES);
50881
+ var XExtensionDeclSchema = z15.object({
50882
+ type: z15.string(),
50883
+ items: z15.string().optional(),
50884
+ description: z15.string().optional(),
50885
+ scope: z15.array(ScopeNodeTypeSchema).optional(),
50886
+ schema: z15.record(z15.string(), z15.any()).optional(),
50887
+ required: z15.boolean().default(false)
50888
+ });
50889
+ var DslSchema = z15.object({
50890
+ version: z15.literal(1),
50891
+ extends: z15.string().optional(),
50855
50892
  system: SystemSchema,
50856
- agents: z13.record(z13.string(), AgentSchema).default({}),
50857
- tasks: z13.record(z13.string(), TaskSchema).default({}),
50858
- artifacts: z13.record(z13.string(), ArtifactSchema).default({}),
50859
- tools: z13.record(z13.string(), ToolSchema).default({}),
50860
- validations: z13.record(z13.string(), ValidationSchema).default({}),
50861
- handoff_types: z13.record(z13.string(), HandoffTypeSchema).default({}),
50862
- workflow: z13.record(z13.string(), WorkflowSchema).default({}),
50863
- policies: z13.record(z13.string(), PolicySchema).default({}),
50864
- guardrails: z13.record(z13.string(), GuardrailSchema).default({}),
50865
- guardrail_policies: z13.record(z13.string(), GuardrailPolicySchema).default({}),
50893
+ agents: z15.record(z15.string(), AgentSchema).default({}),
50894
+ tasks: z15.record(z15.string(), TaskSchema).default({}),
50895
+ artifacts: z15.record(z15.string(), ArtifactSchema).default({}),
50896
+ tools: z15.record(z15.string(), ToolSchema).default({}),
50897
+ validations: z15.record(z15.string(), ValidationSchema).default({}),
50898
+ handoff_types: z15.record(z15.string(), HandoffTypeSchema).default({}),
50899
+ team_interface: TeamInterfaceSchema.optional(),
50900
+ imports: z15.record(z15.string(), TeamImportSchema).optional(),
50901
+ workflow: z15.record(z15.string(), WorkflowSchema).default({}),
50902
+ policies: z15.record(z15.string(), PolicySchema).default({}),
50903
+ guardrails: z15.record(z15.string(), GuardrailSchema).default({}),
50904
+ guardrail_policies: z15.record(z15.string(), GuardrailPolicySchema).default({}),
50866
50905
  components: ComponentsSchema.default({ schemas: {} }),
50867
- extensions: z13.record(z13.string(), XExtensionDeclSchema).default({}),
50868
- extensions_strict: z13.boolean().default(false)
50906
+ extensions: z15.record(z15.string(), XExtensionDeclSchema).default({}),
50907
+ extensions_strict: z15.boolean().default(false)
50869
50908
  }).passthrough();
50870
50909
 
50871
50910
  // src/schema/json-schema-utils.ts
@@ -50917,22 +50956,22 @@ function resolveAllOf(schema) {
50917
50956
  }
50918
50957
 
50919
50958
  // src/schema/merge-operators.ts
50920
- import { z as z14 } from "zod";
50921
- var AppendOperatorSchema = z14.object({
50922
- $append: z14.record(z14.string(), z14.any())
50959
+ import { z as z16 } from "zod";
50960
+ var AppendOperatorSchema = z16.object({
50961
+ $append: z16.record(z16.string(), z16.any())
50923
50962
  });
50924
- var PrependOperatorSchema = z14.object({
50925
- $prepend: z14.record(z14.string(), z14.any())
50963
+ var PrependOperatorSchema = z16.object({
50964
+ $prepend: z16.record(z16.string(), z16.any())
50926
50965
  });
50927
- var InsertAfterOperatorSchema = z14.object({
50928
- $insert_after: z14.object({
50929
- after: z14.string(),
50930
- entries: z14.record(z14.string(), z14.any())
50966
+ var InsertAfterOperatorSchema = z16.object({
50967
+ $insert_after: z16.object({
50968
+ after: z16.string(),
50969
+ entries: z16.record(z16.string(), z16.any())
50931
50970
  })
50932
50971
  });
50933
- var ReplaceOperatorSchema = z14.object({ $replace: z14.any() });
50934
- var RemoveOperatorSchema = z14.object({
50935
- $remove: z14.array(z14.string())
50972
+ var ReplaceOperatorSchema = z16.object({ $replace: z16.any() });
50973
+ var RemoveOperatorSchema = z16.object({
50974
+ $remove: z16.array(z16.string())
50936
50975
  });
50937
50976
 
50938
50977
  // src/config/loader.ts
@@ -50941,14 +50980,14 @@ import { resolve, dirname } from "path";
50941
50980
  import { parse as parseYaml } from "yaml";
50942
50981
 
50943
50982
  // src/config/types.ts
50944
- import { z as z15 } from "zod";
50945
- var RenderTargetSchema = z15.object({
50946
- template: z15.string(),
50983
+ import { z as z17 } from "zod";
50984
+ var RenderTargetSchema = z17.object({
50985
+ template: z17.string(),
50947
50986
  context: ContextTypeSchema,
50948
- output: z15.string(),
50949
- include: z15.array(z15.string()).optional(),
50950
- exclude: z15.array(z15.string()).optional(),
50951
- skip_empty: z15.boolean().optional()
50987
+ output: z17.string(),
50988
+ include: z17.array(z17.string()).optional(),
50989
+ exclude: z17.array(z17.string()).optional(),
50990
+ skip_empty: z17.boolean().optional()
50952
50991
  }).refine(
50953
50992
  (data) => !(data.include && data.exclude),
50954
50993
  { message: "include and exclude are mutually exclusive" }
@@ -50961,13 +51000,51 @@ var RenderTargetSchema = z15.object({
50961
51000
  },
50962
51001
  { message: "include/exclude cannot be used with context: system" }
50963
51002
  );
50964
- var AgentContractsConfigSchema = z15.object({
50965
- dsl: z15.string(),
50966
- vars: z15.record(z15.string(), z15.string()).optional(),
50967
- renders: z15.array(RenderTargetSchema).default([]),
50968
- bindings: z15.array(z15.string()).default([]),
50969
- active_guardrail_policy: z15.string().optional(),
50970
- paths: z15.record(z15.string(), z15.string()).optional()
51003
+ var TeamConfigSchema = z17.object({
51004
+ dsl: z17.string().optional(),
51005
+ bindings: z17.array(z17.string()).default([]),
51006
+ vars: z17.record(z17.string(), z17.string()).optional(),
51007
+ paths: z17.record(z17.string(), z17.string()).optional(),
51008
+ active_guardrail_policy: z17.string().optional(),
51009
+ interface_output: z17.string().optional()
51010
+ });
51011
+ var AgentContractsConfigSchema = z17.object({
51012
+ dsl: z17.string().optional(),
51013
+ vars: z17.record(z17.string(), z17.string()).optional(),
51014
+ renders: z17.array(RenderTargetSchema).default([]),
51015
+ bindings: z17.array(z17.string()).default([]),
51016
+ active_guardrail_policy: z17.string().optional(),
51017
+ paths: z17.record(z17.string(), z17.string()).optional(),
51018
+ teams: z17.record(z17.string(), TeamConfigSchema).optional()
51019
+ }).superRefine((data, ctx) => {
51020
+ if (data.dsl !== void 0 && data.teams !== void 0) {
51021
+ ctx.addIssue({
51022
+ code: z17.ZodIssueCode.custom,
51023
+ message: "dsl and teams are mutually exclusive",
51024
+ path: ["teams"]
51025
+ });
51026
+ return;
51027
+ }
51028
+ if (data.dsl === void 0 && data.teams === void 0) {
51029
+ ctx.addIssue({
51030
+ code: z17.ZodIssueCode.custom,
51031
+ message: "Either dsl or teams must be specified",
51032
+ path: []
51033
+ });
51034
+ return;
51035
+ }
51036
+ if (data.teams) {
51037
+ for (const [key, team] of Object.entries(data.teams)) {
51038
+ if (key === "_defaults") continue;
51039
+ if (team.dsl === void 0) {
51040
+ ctx.addIssue({
51041
+ code: z17.ZodIssueCode.custom,
51042
+ message: `Team "${key}" must specify dsl`,
51043
+ path: ["teams", key, "dsl"]
51044
+ });
51045
+ }
51046
+ }
51047
+ }
50971
51048
  });
50972
51049
 
50973
51050
  // src/config/loader.ts
@@ -50988,6 +51065,27 @@ async function fileExists(filePath) {
50988
51065
  return false;
50989
51066
  }
50990
51067
  }
51068
+ function resolveTeamConfigs(teams, configDir) {
51069
+ const defaults = teams._defaults;
51070
+ const result = {};
51071
+ for (const [key, team] of Object.entries(teams)) {
51072
+ if (key === "_defaults") continue;
51073
+ const mergedBindings = [...defaults?.bindings ?? [], ...team.bindings].map(
51074
+ (b3) => resolve(configDir, b3)
51075
+ );
51076
+ const mergedVars = defaults?.vars || team.vars ? { ...defaults?.vars ?? {}, ...team.vars ?? {} } : void 0;
51077
+ const mergedPaths = defaults?.paths || team.paths ? { ...defaults?.paths ?? {}, ...team.paths ?? {} } : void 0;
51078
+ result[key] = {
51079
+ dsl: resolve(configDir, team.dsl),
51080
+ bindings: mergedBindings,
51081
+ vars: mergedVars,
51082
+ activeGuardrailPolicy: team.active_guardrail_policy ?? defaults?.active_guardrail_policy,
51083
+ paths: mergedPaths,
51084
+ interfaceOutput: team.interface_output ? resolve(configDir, team.interface_output) : void 0
51085
+ };
51086
+ }
51087
+ return result;
51088
+ }
50991
51089
  async function loadConfig(configPath) {
50992
51090
  const isExplicit = configPath !== void 0;
50993
51091
  const targetPath = resolve(configPath ?? DEFAULT_CONFIG_NAME);
@@ -51030,14 +51128,27 @@ ${issues}`,
51030
51128
  }
51031
51129
  const configDir = dirname(targetPath);
51032
51130
  const config = result.data;
51131
+ const renders = config.renders.map((r3) => ({
51132
+ ...r3,
51133
+ template: resolve(configDir, r3.template),
51134
+ output: resolve(configDir, r3.output)
51135
+ }));
51136
+ if (config.teams) {
51137
+ return {
51138
+ dsl: "",
51139
+ vars: void 0,
51140
+ renders,
51141
+ configDir,
51142
+ bindings: [],
51143
+ activeGuardrailPolicy: void 0,
51144
+ paths: void 0,
51145
+ teams: resolveTeamConfigs(config.teams, configDir)
51146
+ };
51147
+ }
51033
51148
  return {
51034
51149
  dsl: resolve(configDir, config.dsl),
51035
51150
  vars: config.vars,
51036
- renders: config.renders.map((r3) => ({
51037
- ...r3,
51038
- template: resolve(configDir, r3.template),
51039
- output: resolve(configDir, r3.output)
51040
- })),
51151
+ renders,
51041
51152
  configDir,
51042
51153
  bindings: (config.bindings ?? []).map((b3) => resolve(configDir, b3)),
51043
51154
  activeGuardrailPolicy: config.active_guardrail_policy,
@@ -51601,6 +51712,7 @@ var MERGE_SECTIONS = [
51601
51712
  "tools",
51602
51713
  "validations",
51603
51714
  "handoff_types",
51715
+ "imports",
51604
51716
  "workflow",
51605
51717
  "policies",
51606
51718
  "guardrails",
@@ -51859,44 +51971,95 @@ ${issues}`,
51859
51971
 
51860
51972
  // src/cli/commands/resolve.ts
51861
51973
  import { stringify } from "yaml";
51862
- var DIR_DEFAULT = "agent-contracts.yaml";
51863
- var resolveCommand = new Command("resolve").description("Resolve DSL (load + merge extends) and output YAML").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--format <format>", "Output format (text|json)", "text").option("--expand-defaults", "Expand all Zod default values in output", false).action(async (dir, opts) => {
51864
- try {
51865
- const config = await loadConfig(opts.config);
51866
- const dslPath = resolveDslPath(dir, DIR_DEFAULT, config);
51867
- const result = await resolve4(dslPath);
51868
- let data = config?.vars ? substituteVars(result.data, config.vars) : result.data;
51869
- if (opts.expandDefaults) {
51870
- data = expandDefaults(data);
51871
- }
51872
- if (opts.format === "json") {
51873
- process.stdout.write(JSON.stringify(data, null, 2) + "\n");
51874
- } else {
51875
- process.stdout.write(stringify(data));
51974
+
51975
+ // src/cli/multi-team.ts
51976
+ function isMultiTeamConfig(config) {
51977
+ return config.teams !== void 0 && Object.keys(config.teams).length > 0;
51978
+ }
51979
+ function getTeamEntries(config, teamFilter) {
51980
+ if (!config.teams) return [];
51981
+ const entries = Object.entries(config.teams);
51982
+ if (teamFilter) {
51983
+ const found = entries.filter(([k2]) => k2 === teamFilter);
51984
+ if (found.length === 0) {
51985
+ throw new Error(
51986
+ `Team "${teamFilter}" not found. Available teams: ${entries.map(([k2]) => k2).join(", ")}`
51987
+ );
51876
51988
  }
51877
- } catch (err) {
51878
- const msg = err instanceof Error ? err.message : String(err);
51879
- process.stderr.write(`Error: ${msg}
51989
+ return found;
51990
+ }
51991
+ return entries;
51992
+ }
51993
+
51994
+ // src/cli/commands/resolve.ts
51995
+ var DIR_DEFAULT = "agent-contracts.yaml";
51996
+ var resolveCommand = new Command("resolve").description("Resolve DSL (load + merge extends) and output YAML").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--format <format>", "Output format (text|json)", "text").option("--expand-defaults", "Expand all Zod default values in output", false).action(
51997
+ async (dir, opts) => {
51998
+ try {
51999
+ const config = await loadConfig(opts.config);
52000
+ if (config !== null && isMultiTeamConfig(config)) {
52001
+ const teamEntries = getTeamEntries(config, opts.team);
52002
+ if (opts.format === "json") {
52003
+ const out = {};
52004
+ for (const [teamId, teamConfig] of teamEntries) {
52005
+ const result2 = await resolve4(teamConfig.dsl);
52006
+ let data2 = teamConfig.vars ? substituteVars(result2.data, teamConfig.vars) : result2.data;
52007
+ if (opts.expandDefaults) {
52008
+ data2 = expandDefaults(data2);
52009
+ }
52010
+ out[teamId] = data2;
52011
+ }
52012
+ process.stdout.write(JSON.stringify(out, null, 2) + "\n");
52013
+ } else {
52014
+ for (const [teamId, teamConfig] of teamEntries) {
52015
+ process.stdout.write(`
52016
+ --- Team: ${teamId} ---
51880
52017
  `);
51881
- process.exit(1);
52018
+ const result2 = await resolve4(teamConfig.dsl);
52019
+ let data2 = teamConfig.vars ? substituteVars(result2.data, teamConfig.vars) : result2.data;
52020
+ if (opts.expandDefaults) {
52021
+ data2 = expandDefaults(data2);
52022
+ }
52023
+ process.stdout.write(stringify(data2));
52024
+ }
52025
+ }
52026
+ return;
52027
+ }
52028
+ const dslPath = resolveDslPath(dir, DIR_DEFAULT, config);
52029
+ const result = await resolve4(dslPath);
52030
+ let data = config?.vars ? substituteVars(result.data, config.vars) : result.data;
52031
+ if (opts.expandDefaults) {
52032
+ data = expandDefaults(data);
52033
+ }
52034
+ if (opts.format === "json") {
52035
+ process.stdout.write(JSON.stringify(data, null, 2) + "\n");
52036
+ } else {
52037
+ process.stdout.write(stringify(data));
52038
+ }
52039
+ } catch (err) {
52040
+ const msg = err instanceof Error ? err.message : String(err);
52041
+ process.stderr.write(`Error: ${msg}
52042
+ `);
52043
+ process.exit(1);
52044
+ }
51882
52045
  }
51883
- });
52046
+ );
51884
52047
 
51885
52048
  // src/cli/commands/validate.ts
51886
52049
  import { Command as Command2 } from "commander";
51887
52050
 
51888
52051
  // src/validator/schema-validator.ts
51889
52052
  import Ajv from "ajv";
51890
- import { z as z16 } from "zod";
52053
+ import { z as z18 } from "zod";
51891
52054
  function unwrap(schema) {
51892
- if (schema instanceof z16.ZodOptional) return unwrap(schema.unwrap());
51893
- if (schema instanceof z16.ZodDefault) return unwrap(schema.removeDefault());
51894
- if (schema instanceof z16.ZodNullable) return unwrap(schema.unwrap());
52055
+ if (schema instanceof z18.ZodOptional) return unwrap(schema.unwrap());
52056
+ if (schema instanceof z18.ZodDefault) return unwrap(schema.removeDefault());
52057
+ if (schema instanceof z18.ZodNullable) return unwrap(schema.unwrap());
51895
52058
  return schema;
51896
52059
  }
51897
52060
  function checkCustomPropsRecursive(data, schema, path) {
51898
52061
  const inner = unwrap(schema);
51899
- if (inner instanceof z16.ZodObject) {
52062
+ if (inner instanceof z18.ZodObject) {
51900
52063
  if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
51901
52064
  const obj = data;
51902
52065
  const shape = inner.shape;
@@ -51917,7 +52080,7 @@ function checkCustomPropsRecursive(data, schema, path) {
51917
52080
  }
51918
52081
  return diagnostics;
51919
52082
  }
51920
- if (inner instanceof z16.ZodRecord) {
52083
+ if (inner instanceof z18.ZodRecord) {
51921
52084
  if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
51922
52085
  const valueSchema = inner._def.valueType;
51923
52086
  const diagnostics = [];
@@ -51926,7 +52089,7 @@ function checkCustomPropsRecursive(data, schema, path) {
51926
52089
  }
51927
52090
  return diagnostics;
51928
52091
  }
51929
- if (inner instanceof z16.ZodArray) {
52092
+ if (inner instanceof z18.ZodArray) {
51930
52093
  if (!Array.isArray(data)) return [];
51931
52094
  const diagnostics = [];
51932
52095
  for (let i3 = 0; i3 < data.length; i3++) {
@@ -51934,14 +52097,14 @@ function checkCustomPropsRecursive(data, schema, path) {
51934
52097
  }
51935
52098
  return diagnostics;
51936
52099
  }
51937
- if (inner instanceof z16.ZodDiscriminatedUnion) {
52100
+ if (inner instanceof z18.ZodDiscriminatedUnion) {
51938
52101
  if (typeof data !== "object" || data === null) return [];
51939
52102
  const obj = data;
51940
52103
  const disc = inner._def.discriminator;
51941
52104
  const discValue = obj[disc];
51942
52105
  const match = inner.options.find((opt) => {
51943
52106
  const shape = opt.shape;
51944
- return shape[disc] instanceof z16.ZodLiteral && shape[disc].value === discValue;
52107
+ return shape[disc] instanceof z18.ZodLiteral && shape[disc].value === discValue;
51945
52108
  });
51946
52109
  if (match) return checkCustomPropsRecursive(data, match, path);
51947
52110
  return [];
@@ -52743,6 +52906,25 @@ function checkReferences(dsl) {
52743
52906
  }
52744
52907
  } else if (step.type === "validation") {
52745
52908
  checkExists(step.validation, validationIds, "validations", `workflow.${wfId}.steps[${j2}].validation`);
52909
+ } else if (step.type === "team_task") {
52910
+ const importKeys = dsl.imports !== void 0 ? new Set(Object.keys(dsl.imports)) : null;
52911
+ if (importKeys) {
52912
+ checkExists(
52913
+ step.to_team,
52914
+ importKeys,
52915
+ "imports",
52916
+ `workflow.${wfId}.steps[${j2}].to_team`,
52917
+ "team-import-not-found"
52918
+ );
52919
+ } else {
52920
+ diagnostics.push({
52921
+ path: `workflow.${wfId}.steps[${j2}].to_team`,
52922
+ message: `team_task step references team "${step.to_team}" but dsl.imports is not defined`,
52923
+ code: "team-task-missing-imports"
52924
+ });
52925
+ }
52926
+ checkExists(step.handoff, handoffKinds, "handoff_types", `workflow.${wfId}.steps[${j2}].handoff`);
52927
+ checkExists(step.expects, handoffKinds, "handoff_types", `workflow.${wfId}.steps[${j2}].expects`);
52746
52928
  }
52747
52929
  }
52748
52930
  }
@@ -52920,6 +53102,48 @@ function checkReferences(dsl) {
52920
53102
  );
52921
53103
  }
52922
53104
  }
53105
+ const workflowDefinitionIds = new Set(Object.keys(dsl.workflow));
53106
+ if (dsl.team_interface) {
53107
+ const ti = dsl.team_interface;
53108
+ if (ti.accepts?.workflows) {
53109
+ for (const [wfKey, spec] of Object.entries(ti.accepts.workflows)) {
53110
+ const internalWf = spec.internal_workflow ?? wfKey;
53111
+ checkExists(
53112
+ internalWf,
53113
+ workflowDefinitionIds,
53114
+ "workflow",
53115
+ `team_interface.accepts.workflows.${wfKey}.internal_workflow`,
53116
+ "team-interface-workflow-not-found"
53117
+ );
53118
+ checkExists(
53119
+ spec.input_handoff,
53120
+ handoffKinds,
53121
+ "handoff_types",
53122
+ `team_interface.accepts.workflows.${wfKey}.input_handoff`,
53123
+ "team-interface-handoff-not-found"
53124
+ );
53125
+ checkExists(
53126
+ spec.output_handoff,
53127
+ handoffKinds,
53128
+ "handoff_types",
53129
+ `team_interface.accepts.workflows.${wfKey}.output_handoff`,
53130
+ "team-interface-handoff-not-found"
53131
+ );
53132
+ }
53133
+ }
53134
+ if (ti.exposes?.artifacts) {
53135
+ for (let i3 = 0; i3 < ti.exposes.artifacts.length; i3++) {
53136
+ const artKey = ti.exposes.artifacts[i3];
53137
+ checkExists(
53138
+ artKey,
53139
+ artifactIds,
53140
+ "artifacts",
53141
+ `team_interface.exposes.artifacts[${i3}]`,
53142
+ "team-interface-artifact-not-found"
53143
+ );
53144
+ }
53145
+ }
53146
+ }
52923
53147
  return diagnostics;
52924
53148
  }
52925
53149
 
@@ -52960,44 +53184,88 @@ function formatDiagnostics(diagnostics, options) {
52960
53184
 
52961
53185
  // src/cli/commands/validate.ts
52962
53186
  var DIR_DEFAULT2 = "agent-contracts.yaml";
52963
- var validateCommand = new Command2("validate").description("Validate DSL against schema and check references").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT2).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--format <format>", "Output format (text|json)", "text").option("--quiet", "Suppress output on success", false).option("--strict", "Treat warnings as errors", false).action(async (dir, opts) => {
52964
- try {
52965
- const config = await loadConfig(opts.config);
52966
- const dslPath = resolveDslPath(dir, DIR_DEFAULT2, config);
52967
- const resolved = await resolve4(dslPath);
52968
- const data = config?.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
52969
- const schemaResult = validateSchema(data);
52970
- const schemaWarnings = schemaResult.diagnostics.filter(
52971
- (d2) => d2.severity === "warning"
52972
- );
52973
- if (!schemaResult.success) {
52974
- const output = formatDiagnostics(schemaResult.diagnostics, opts);
52975
- if (output) process.stderr.write(output + "\n");
52976
- process.exit(1);
52977
- }
52978
- const refDiags = checkReferences(schemaResult.data);
52979
- const handoffDiags = validateHandoffSchemas(schemaResult.data);
52980
- const allDiags = [...refDiags, ...handoffDiags, ...schemaWarnings];
52981
- const hasWarnings = allDiags.some(
52982
- (d2) => "severity" in d2 && d2.severity === "warning"
52983
- );
52984
- if (allDiags.length > 0) {
52985
- const output = formatDiagnostics(allDiags, opts);
52986
- if (output) process.stderr.write(output + "\n");
52987
- if (refDiags.length > 0 || handoffDiags.length > 0 || opts.strict && hasWarnings) {
53187
+ var validateCommand = new Command2("validate").description("Validate DSL against schema and check references").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT2).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--format <format>", "Output format (text|json)", "text").option("--quiet", "Suppress output on success", false).option("--strict", "Treat warnings as errors", false).action(
53188
+ async (dir, opts) => {
53189
+ try {
53190
+ const config = await loadConfig(opts.config);
53191
+ if (config !== null && isMultiTeamConfig(config)) {
53192
+ const teamEntries = getTeamEntries(config, opts.team);
53193
+ let hasErrors = false;
53194
+ let allTeamsFullyClean = true;
53195
+ for (const [teamId, teamConfig] of teamEntries) {
53196
+ if (!opts.quiet) process.stdout.write(`
53197
+ --- Team: ${teamId} ---
53198
+ `);
53199
+ const resolved2 = await resolve4(teamConfig.dsl);
53200
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
53201
+ const schemaResult2 = validateSchema(data2);
53202
+ const schemaWarnings2 = schemaResult2.diagnostics.filter(
53203
+ (d2) => d2.severity === "warning"
53204
+ );
53205
+ if (!schemaResult2.success) {
53206
+ const output = formatDiagnostics(schemaResult2.diagnostics, opts);
53207
+ if (output) process.stderr.write(output + "\n");
53208
+ hasErrors = true;
53209
+ allTeamsFullyClean = false;
53210
+ continue;
53211
+ }
53212
+ const refDiags2 = checkReferences(schemaResult2.data);
53213
+ const handoffDiags2 = validateHandoffSchemas(schemaResult2.data);
53214
+ const allDiags2 = [...refDiags2, ...handoffDiags2, ...schemaWarnings2];
53215
+ const hasWarnings2 = allDiags2.some(
53216
+ (d2) => "severity" in d2 && d2.severity === "warning"
53217
+ );
53218
+ if (allDiags2.length > 0) {
53219
+ allTeamsFullyClean = false;
53220
+ const output = formatDiagnostics(allDiags2, opts);
53221
+ if (output) process.stderr.write(output + "\n");
53222
+ if (refDiags2.length > 0 || handoffDiags2.length > 0 || opts.strict && hasWarnings2) {
53223
+ hasErrors = true;
53224
+ }
53225
+ }
53226
+ }
53227
+ if (hasErrors) process.exit(1);
53228
+ if (!opts.quiet && allTeamsFullyClean) {
53229
+ process.stdout.write("Validation passed.\n");
53230
+ }
53231
+ return;
53232
+ }
53233
+ const dslPath = resolveDslPath(dir, DIR_DEFAULT2, config);
53234
+ const resolved = await resolve4(dslPath);
53235
+ const data = config?.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
53236
+ const schemaResult = validateSchema(data);
53237
+ const schemaWarnings = schemaResult.diagnostics.filter(
53238
+ (d2) => d2.severity === "warning"
53239
+ );
53240
+ if (!schemaResult.success) {
53241
+ const output = formatDiagnostics(schemaResult.diagnostics, opts);
53242
+ if (output) process.stderr.write(output + "\n");
52988
53243
  process.exit(1);
52989
53244
  }
52990
- }
52991
- if (!opts.quiet && allDiags.length === 0) {
52992
- process.stdout.write("Validation passed.\n");
52993
- }
52994
- } catch (err) {
52995
- const msg = err instanceof Error ? err.message : String(err);
52996
- process.stderr.write(`Error: ${msg}
53245
+ const refDiags = checkReferences(schemaResult.data);
53246
+ const handoffDiags = validateHandoffSchemas(schemaResult.data);
53247
+ const allDiags = [...refDiags, ...handoffDiags, ...schemaWarnings];
53248
+ const hasWarnings = allDiags.some(
53249
+ (d2) => "severity" in d2 && d2.severity === "warning"
53250
+ );
53251
+ if (allDiags.length > 0) {
53252
+ const output = formatDiagnostics(allDiags, opts);
53253
+ if (output) process.stderr.write(output + "\n");
53254
+ if (refDiags.length > 0 || handoffDiags.length > 0 || opts.strict && hasWarnings) {
53255
+ process.exit(1);
53256
+ }
53257
+ }
53258
+ if (!opts.quiet && allDiags.length === 0) {
53259
+ process.stdout.write("Validation passed.\n");
53260
+ }
53261
+ } catch (err) {
53262
+ const msg = err instanceof Error ? err.message : String(err);
53263
+ process.stderr.write(`Error: ${msg}
52997
53264
  `);
52998
- process.exit(1);
53265
+ process.exit(1);
53266
+ }
52999
53267
  }
53000
- });
53268
+ );
53001
53269
 
53002
53270
  // src/cli/commands/lint.ts
53003
53271
  import { Command as Command3 } from "commander";
@@ -54395,10 +54663,63 @@ async function spectralLint(dslObject) {
54395
54663
 
54396
54664
  // src/cli/commands/lint.ts
54397
54665
  var DIR_DEFAULT3 = "agent-contracts.yaml";
54398
- var lintCommand = new Command3("lint").description("Run semantic lint rules on resolved DSL").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT3).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--format <format>", "Output format (text|json)", "text").option("--quiet", "Suppress output on success", false).option("--strict", "Treat warnings as errors", false).action(
54666
+ var lintCommand = new Command3("lint").description("Run semantic lint rules on resolved DSL").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT3).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--format <format>", "Output format (text|json)", "text").option("--quiet", "Suppress output on success", false).option("--strict", "Treat warnings as errors", false).action(
54399
54667
  async (dir, opts) => {
54400
54668
  try {
54401
54669
  const config = await loadConfig(opts.config);
54670
+ if (config !== null && isMultiTeamConfig(config)) {
54671
+ const teamEntries = getTeamEntries(config, opts.team);
54672
+ let hasErrors = false;
54673
+ let allClean = true;
54674
+ for (const [teamId, teamConfig] of teamEntries) {
54675
+ if (!opts.quiet) process.stdout.write(`
54676
+ --- Team: ${teamId} ---
54677
+ `);
54678
+ const resolved2 = await resolve4(teamConfig.dsl);
54679
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
54680
+ const schemaResult2 = validateSchema(data2);
54681
+ const schemaWarnings2 = schemaResult2.diagnostics.filter(
54682
+ (d2) => d2.severity === "warning"
54683
+ );
54684
+ if (!schemaResult2.success) {
54685
+ const output = formatDiagnostics(schemaResult2.diagnostics, {
54686
+ format: opts.format,
54687
+ quiet: opts.quiet
54688
+ });
54689
+ if (output) process.stderr.write(output + "\n");
54690
+ hasErrors = true;
54691
+ allClean = false;
54692
+ continue;
54693
+ }
54694
+ const tsDiagnostics2 = lint(schemaResult2.data);
54695
+ const spectralDiagnostics2 = await spectralLint(
54696
+ schemaResult2.data
54697
+ );
54698
+ const diagnostics2 = [
54699
+ ...tsDiagnostics2,
54700
+ ...spectralDiagnostics2,
54701
+ ...schemaWarnings2
54702
+ ];
54703
+ if (diagnostics2.length > 0) {
54704
+ allClean = false;
54705
+ const output = formatDiagnostics(diagnostics2, {
54706
+ format: opts.format,
54707
+ quiet: opts.quiet
54708
+ });
54709
+ if (output) process.stderr.write(output + "\n");
54710
+ const teamHasErrors = diagnostics2.some((d2) => d2.severity === "error");
54711
+ const teamHasWarnings = diagnostics2.some((d2) => d2.severity === "warning");
54712
+ if (teamHasErrors || opts.strict && teamHasWarnings) {
54713
+ hasErrors = true;
54714
+ }
54715
+ }
54716
+ }
54717
+ if (hasErrors) process.exit(1);
54718
+ if (!opts.quiet && allClean) {
54719
+ process.stdout.write("Lint passed.\n");
54720
+ }
54721
+ return;
54722
+ }
54402
54723
  const dslPath = resolveDslPath(dir, DIR_DEFAULT3, config);
54403
54724
  const resolved = await resolve4(dslPath);
54404
54725
  const data = config?.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
@@ -55832,7 +56153,7 @@ async function checkDriftFromConfig(dsl, renderTargets, options) {
55832
56153
  }
55833
56154
 
55834
56155
  // src/cli/commands/render.ts
55835
- var renderCommand = new Command4("render").description("Render resolved DSL with Handlebars templates (requires config)").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--check", "Check for drift without writing files", false).option("--quiet", "Suppress output on success", false).action(
56156
+ var renderCommand = new Command4("render").description("Render resolved DSL with Handlebars templates (requires config)").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--check", "Check for drift without writing files", false).option("--quiet", "Suppress output on success", false).action(
55836
56157
  async (opts) => {
55837
56158
  try {
55838
56159
  const config = await loadConfig(opts.config);
@@ -55842,6 +56163,68 @@ var renderCommand = new Command4("render").description("Render resolved DSL with
55842
56163
  );
55843
56164
  process.exit(1);
55844
56165
  }
56166
+ if (isMultiTeamConfig(config)) {
56167
+ const teamEntries = getTeamEntries(config, opts.team);
56168
+ for (const [teamId, teamConfig] of teamEntries) {
56169
+ if (!opts.quiet) process.stdout.write(`
56170
+ --- Team: ${teamId} ---
56171
+ `);
56172
+ const resolved2 = await resolve4(teamConfig.dsl);
56173
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
56174
+ const schemaResult2 = validateSchema(data2);
56175
+ if (!schemaResult2.success) {
56176
+ process.stderr.write(
56177
+ `Schema validation failed for team ${teamId}. Run 'agent-contracts validate' for details.
56178
+ `
56179
+ );
56180
+ process.exit(1);
56181
+ }
56182
+ let renderOptions2;
56183
+ if (teamConfig.bindings.length > 0) {
56184
+ const loadedBindings = await loadBindings(teamConfig.bindings);
56185
+ renderOptions2 = {
56186
+ loadedBindings,
56187
+ activeGuardrailPolicy: teamConfig.activeGuardrailPolicy
56188
+ };
56189
+ }
56190
+ if (opts.check) {
56191
+ const drift = await checkDriftFromConfig(
56192
+ schemaResult2.data,
56193
+ config.renders,
56194
+ renderOptions2
56195
+ );
56196
+ if (drift.hasDrift) {
56197
+ process.stderr.write(
56198
+ `Drift detected for team ${teamId} in the following files:
56199
+ `
56200
+ );
56201
+ for (const f2 of drift.diffs) {
56202
+ process.stderr.write(` ${f2}
56203
+ `);
56204
+ }
56205
+ process.exit(1);
56206
+ }
56207
+ if (!opts.quiet) {
56208
+ process.stdout.write("No drift detected.\n");
56209
+ }
56210
+ } else {
56211
+ const files = await renderFromConfig(
56212
+ schemaResult2.data,
56213
+ config.renders,
56214
+ renderOptions2
56215
+ );
56216
+ if (!opts.quiet) {
56217
+ process.stdout.write(`Rendered ${files.length} file(s):
56218
+ `);
56219
+ for (const f2 of files) {
56220
+ process.stdout.write(` ${f2}
56221
+ `);
56222
+ }
56223
+ }
56224
+ }
56225
+ }
56226
+ return;
56227
+ }
55845
56228
  const resolved = await resolve4(config.dsl);
55846
56229
  const data = config.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
55847
56230
  const schemaResult = validateSchema(data);
@@ -55906,8 +56289,91 @@ var renderCommand = new Command4("render").description("Render resolved DSL with
55906
56289
  );
55907
56290
 
55908
56291
  // src/cli/commands/check.ts
56292
+ import { existsSync, readFileSync } from "fs";
56293
+ import { join as join3 } from "path";
55909
56294
  import { Command as Command5 } from "commander";
55910
- var checkCommand = new Command5("check").description("Run full pipeline: resolve \u2192 validate \u2192 lint \u2192 render --check").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--format <format>", "Output format (text|json)", "text").option("--quiet", "Suppress output on success", false).option("--strict", "Treat warnings as errors", false).action(
56295
+ import { parse as parseYaml4, stringify as stringify3 } from "yaml";
56296
+ import { access as access2 } from "fs/promises";
56297
+ import { resolve as pathResolve, dirname as dirname6 } from "path";
56298
+
56299
+ // src/interface-generator/generator.ts
56300
+ import { stringify as stringify2 } from "yaml";
56301
+ function buildInterfaceDocument(dsl, generatedAt) {
56302
+ const ti = dsl.team_interface;
56303
+ const doc = {
56304
+ team_id: dsl.system.id,
56305
+ team_name: dsl.system.name,
56306
+ version: ti.version,
56307
+ generated_at: generatedAt
56308
+ };
56309
+ if (ti.description !== void 0) {
56310
+ doc.description = ti.description;
56311
+ }
56312
+ if (ti.accepts?.workflows && Object.keys(ti.accepts.workflows).length > 0) {
56313
+ doc.accepts = { workflows: { ...ti.accepts.workflows } };
56314
+ }
56315
+ const handoffKeys = /* @__PURE__ */ new Set();
56316
+ if (ti.accepts?.workflows) {
56317
+ for (const spec of Object.values(ti.accepts.workflows)) {
56318
+ handoffKeys.add(spec.input_handoff);
56319
+ handoffKeys.add(spec.output_handoff);
56320
+ }
56321
+ }
56322
+ const handoff_types = {};
56323
+ for (const k2 of [...handoffKeys].sort()) {
56324
+ const ht = dsl.handoff_types[k2];
56325
+ if (ht) {
56326
+ const entry = {
56327
+ version: ht.version,
56328
+ schema: ht.schema
56329
+ };
56330
+ if (ht.description !== void 0) {
56331
+ entry.description = ht.description;
56332
+ }
56333
+ handoff_types[k2] = entry;
56334
+ }
56335
+ }
56336
+ if (Object.keys(handoff_types).length > 0) {
56337
+ doc.handoff_types = handoff_types;
56338
+ }
56339
+ const artifactsOut = {};
56340
+ if (ti.exposes?.artifacts) {
56341
+ for (const key of [...ti.exposes.artifacts].sort()) {
56342
+ const art = dsl.artifacts[key];
56343
+ if (art) {
56344
+ const entry = {
56345
+ type: art.type,
56346
+ states: art.states
56347
+ };
56348
+ if (art.description !== void 0) {
56349
+ entry.description = art.description;
56350
+ }
56351
+ artifactsOut[key] = entry;
56352
+ }
56353
+ }
56354
+ }
56355
+ if (Object.keys(artifactsOut).length > 0) {
56356
+ doc.exposes = { artifacts: artifactsOut };
56357
+ }
56358
+ if (ti.constraints !== void 0 && ti.constraints.length > 0) {
56359
+ doc.constraints = ti.constraints;
56360
+ }
56361
+ return doc;
56362
+ }
56363
+ function generateInterface(options) {
56364
+ if (!options.dsl.team_interface) {
56365
+ throw new Error("DSL has no team_interface section");
56366
+ }
56367
+ const doc = buildInterfaceDocument(options.dsl, (/* @__PURE__ */ new Date()).toISOString());
56368
+ const content = options.format === "json" ? `${JSON.stringify(doc, null, 2)}
56369
+ ` : `${stringify2(doc, { sortMapEntries: true })}
56370
+ `;
56371
+ const outputPath = options.output ?? "team-interface.yaml";
56372
+ return { outputPath, content };
56373
+ }
56374
+
56375
+ // src/cli/commands/check.ts
56376
+ var checkCommand = new Command5("check").description("Run full pipeline: resolve \u2192 validate \u2192 lint \u2192 render --check").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--format <format>", "Output format (text|json)", "text").option("--quiet", "Suppress output on success", false).option("--strict", "Treat warnings as errors", false).action(
55911
56377
  async (opts) => {
55912
56378
  let hasErrors = false;
55913
56379
  try {
@@ -55918,6 +56384,111 @@ var checkCommand = new Command5("check").description("Run full pipeline: resolve
55918
56384
  );
55919
56385
  process.exit(1);
55920
56386
  }
56387
+ if (isMultiTeamConfig(config)) {
56388
+ const teamEntries = getTeamEntries(config, opts.team);
56389
+ for (const [teamId, teamConfig] of teamEntries) {
56390
+ if (!opts.quiet) process.stderr.write(`
56391
+ --- Team: ${teamId} ---
56392
+ `);
56393
+ const resolved2 = await resolve4(teamConfig.dsl);
56394
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
56395
+ const schemaResult2 = validateSchema(data2);
56396
+ const schemaWarnings2 = schemaResult2.diagnostics.filter(
56397
+ (d2) => d2.severity === "warning"
56398
+ );
56399
+ if (!schemaResult2.success) {
56400
+ const output = formatDiagnostics(schemaResult2.diagnostics, {
56401
+ format: opts.format,
56402
+ quiet: opts.quiet
56403
+ });
56404
+ if (output) process.stderr.write(output + "\n");
56405
+ hasErrors = true;
56406
+ continue;
56407
+ }
56408
+ const refDiags2 = checkReferences(schemaResult2.data);
56409
+ const handoffDiags2 = validateHandoffSchemas(schemaResult2.data);
56410
+ const allRefDiags2 = [...refDiags2, ...handoffDiags2, ...schemaWarnings2];
56411
+ if (allRefDiags2.length > 0) {
56412
+ const output = formatDiagnostics(allRefDiags2, {
56413
+ format: opts.format,
56414
+ quiet: opts.quiet
56415
+ });
56416
+ if (output) process.stderr.write(output + "\n");
56417
+ hasErrors = true;
56418
+ }
56419
+ const tsLintDiags2 = lint(schemaResult2.data);
56420
+ const spectralDiags2 = await spectralLint(
56421
+ schemaResult2.data
56422
+ );
56423
+ const lintDiags2 = [...tsLintDiags2, ...spectralDiags2];
56424
+ if (lintDiags2.length > 0) {
56425
+ const output = formatDiagnostics(lintDiags2, {
56426
+ format: opts.format,
56427
+ quiet: opts.quiet
56428
+ });
56429
+ if (output) process.stderr.write(output + "\n");
56430
+ if (lintDiags2.some((d2) => d2.severity === "error")) {
56431
+ hasErrors = true;
56432
+ }
56433
+ if (opts.strict && lintDiags2.some((d2) => d2.severity === "warning")) {
56434
+ hasErrors = true;
56435
+ }
56436
+ }
56437
+ let renderOptions2;
56438
+ if (teamConfig.bindings.length > 0) {
56439
+ const loadedBindings = await loadBindings(teamConfig.bindings);
56440
+ renderOptions2 = {
56441
+ loadedBindings,
56442
+ activeGuardrailPolicy: teamConfig.activeGuardrailPolicy
56443
+ };
56444
+ }
56445
+ const drift2 = await checkDriftFromConfig(
56446
+ schemaResult2.data,
56447
+ config.renders,
56448
+ renderOptions2
56449
+ );
56450
+ if (drift2.hasDrift) {
56451
+ process.stderr.write(`Drift detected for team ${teamId} in:
56452
+ `);
56453
+ for (const f2 of drift2.diffs) {
56454
+ process.stderr.write(` ${f2}
56455
+ `);
56456
+ }
56457
+ hasErrors = true;
56458
+ }
56459
+ }
56460
+ if (!hasErrors) {
56461
+ for (const [teamId, teamConfig] of teamEntries) {
56462
+ const resolved2 = await resolve4(teamConfig.dsl);
56463
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
56464
+ const schemaResult2 = validateSchema(data2);
56465
+ if (!schemaResult2.success || !schemaResult2.data) continue;
56466
+ const dsl = schemaResult2.data;
56467
+ const imports = dsl.imports;
56468
+ if (!imports) continue;
56469
+ for (const [importName, importDef] of Object.entries(imports)) {
56470
+ const interfacePathRel = importDef?.interface;
56471
+ if (typeof interfacePathRel !== "string") continue;
56472
+ const interfacePath = pathResolve(
56473
+ dirname6(teamConfig.dsl),
56474
+ interfacePathRel
56475
+ );
56476
+ try {
56477
+ await access2(interfacePath);
56478
+ } catch {
56479
+ process.stderr.write(
56480
+ `Cross-team error: Team "${teamId}" imports "${importName}" but interface file not found: ${interfacePath}
56481
+ `
56482
+ );
56483
+ hasErrors = true;
56484
+ }
56485
+ }
56486
+ }
56487
+ }
56488
+ if (hasErrors) process.exit(1);
56489
+ if (!opts.quiet) process.stdout.write("All checks passed.\n");
56490
+ return;
56491
+ }
55921
56492
  const resolved = await resolve4(config.dsl);
55922
56493
  const data = config.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
55923
56494
  const schemaResult = validateSchema(data);
@@ -55980,6 +56551,33 @@ var checkCommand = new Command5("check").description("Run full pipeline: resolve
55980
56551
  }
55981
56552
  hasErrors = true;
55982
56553
  }
56554
+ if (schemaResult.data.team_interface) {
56555
+ const interfacePath = join3(config.configDir, "team-interface.yaml");
56556
+ if (existsSync(interfacePath)) {
56557
+ const result = generateInterface({
56558
+ dsl: schemaResult.data,
56559
+ dryRun: true,
56560
+ format: "yaml"
56561
+ });
56562
+ const existing = readFileSync(interfacePath, "utf8");
56563
+ const normalize = (raw) => {
56564
+ try {
56565
+ const parsed = parseYaml4(raw);
56566
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
56567
+ const { generated_at: _t, ...rest } = parsed;
56568
+ return `${stringify3(rest, { sortMapEntries: true })}
56569
+ `;
56570
+ }
56571
+ } catch {
56572
+ }
56573
+ return raw.trim();
56574
+ };
56575
+ if (normalize(existing) !== normalize(result.content)) {
56576
+ process.stderr.write("Drift detected in team-interface.yaml\n");
56577
+ hasErrors = true;
56578
+ }
56579
+ }
56580
+ }
55983
56581
  if (hasErrors) {
55984
56582
  process.exit(1);
55985
56583
  }
@@ -56005,7 +56603,7 @@ import { Command as Command6 } from "commander";
56005
56603
 
56006
56604
  // src/guardrail-generator/generator.ts
56007
56605
  import { readFile as readFile5, writeFile as writeFile2, mkdir as mkdir2, chmod, unlink as unlink2, copyFile } from "fs/promises";
56008
- import { resolve as resolve6, dirname as dirname6 } from "path";
56606
+ import { resolve as resolve6, dirname as dirname7 } from "path";
56009
56607
  import Handlebars2 from "handlebars";
56010
56608
  import YAML from "yaml";
56011
56609
 
@@ -56232,7 +56830,7 @@ async function generateGuardrails(options) {
56232
56830
  const sourcePath = resolve6(config.configDir, outputDef.source);
56233
56831
  if (!dryRun) {
56234
56832
  try {
56235
- await mkdir2(dirname6(targetPath), { recursive: true });
56833
+ await mkdir2(dirname7(targetPath), { recursive: true });
56236
56834
  await copyFile(sourcePath, targetPath);
56237
56835
  if (outputDef.executable) {
56238
56836
  await chmod(targetPath, 493);
@@ -56316,7 +56914,7 @@ async function generateGuardrails(options) {
56316
56914
  }
56317
56915
  const output = isPatch && !dryRun ? await applyPatch(groupTarget, rendered, outputDef) : rendered;
56318
56916
  if (!dryRun) {
56319
- await mkdir2(dirname6(groupTarget), { recursive: true });
56917
+ await mkdir2(dirname7(groupTarget), { recursive: true });
56320
56918
  await writeFile2(groupTarget, output, "utf8");
56321
56919
  if (outputDef.executable) {
56322
56920
  await chmod(groupTarget, 493);
@@ -56337,7 +56935,7 @@ async function generateGuardrails(options) {
56337
56935
  } else {
56338
56936
  const output = isPatch && !dryRun ? await applyPatch(targetPath, rendered, outputDef) : rendered;
56339
56937
  if (!dryRun) {
56340
- await mkdir2(dirname6(targetPath), { recursive: true });
56938
+ await mkdir2(dirname7(targetPath), { recursive: true });
56341
56939
  await writeFile2(targetPath, output, "utf8");
56342
56940
  if (outputDef.executable) {
56343
56941
  await chmod(targetPath, 493);
@@ -56390,7 +56988,7 @@ async function generateGuardrails(options) {
56390
56988
  continue;
56391
56989
  }
56392
56990
  if (!dryRun) {
56393
- await mkdir2(dirname6(outputPath), { recursive: true });
56991
+ await mkdir2(dirname7(outputPath), { recursive: true });
56394
56992
  await writeFile2(outputPath, rendered, "utf8");
56395
56993
  if (renderTarget.executable) {
56396
56994
  await chmod(outputPath, 493);
@@ -56420,7 +57018,7 @@ async function generateGuardrails(options) {
56420
57018
  continue;
56421
57019
  }
56422
57020
  if (!dryRun) {
56423
- await mkdir2(dirname6(outputPath), { recursive: true });
57021
+ await mkdir2(dirname7(outputPath), { recursive: true });
56424
57022
  await writeFile2(outputPath, rendered, "utf8");
56425
57023
  if (renderTarget.executable) {
56426
57024
  await chmod(outputPath, 493);
@@ -56440,11 +57038,60 @@ function resolveBindingRenderOutputPath(output, paths) {
56440
57038
  });
56441
57039
  }
56442
57040
 
57041
+ // src/cli/commands/generate-interface.ts
57042
+ import { writeFileSync } from "fs";
57043
+ import { resolve as resolve7 } from "path";
57044
+ function runGenerateInterfaceCli(opts) {
57045
+ if (!opts.dsl.team_interface) {
57046
+ process.stderr.write("Error: DSL has no team_interface section.\n");
57047
+ process.exit(1);
57048
+ }
57049
+ const outputPath = resolve7(process.cwd(), opts.output ?? "team-interface.yaml");
57050
+ const result = generateInterface({
57051
+ dsl: opts.dsl,
57052
+ output: outputPath,
57053
+ dryRun: opts.dryRun,
57054
+ format: opts.format
57055
+ });
57056
+ if (opts.dryRun) {
57057
+ process.stdout.write(result.content);
57058
+ return;
57059
+ }
57060
+ writeFileSync(result.outputPath, result.content, "utf8");
57061
+ if (!opts.quiet) {
57062
+ process.stdout.write(`Wrote ${result.outputPath}
57063
+ `);
57064
+ }
57065
+ }
57066
+
56443
57067
  // src/cli/commands/generate-guardrails.ts
56444
- var generateGuardrailsCommand = new Command6("generate").description("Generate guardrail runtime artifacts from DSL, policies, and bindings").argument("[type]", "Type of artifacts to generate", "guardrails").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--binding <name...>", "Filter to specific software binding(s)").option("--dry-run", "Print what would be generated without writing files", false).option("--quiet", "Suppress output on success", false).action(
57068
+ function resolvedConfigForTeam(workspace, teamConfig) {
57069
+ return {
57070
+ dsl: "",
57071
+ vars: teamConfig.vars,
57072
+ renders: workspace.renders,
57073
+ configDir: workspace.configDir,
57074
+ bindings: teamConfig.bindings,
57075
+ activeGuardrailPolicy: teamConfig.activeGuardrailPolicy,
57076
+ paths: teamConfig.paths
57077
+ };
57078
+ }
57079
+ var generateGuardrailsCommand = new Command6("generate").description("Generate guardrail runtime artifacts from DSL, policies, and bindings").argument("[type]", "Type of artifacts to generate (guardrails|interface)", "guardrails").option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--binding <name...>", "Filter to specific software binding(s)").option(
57080
+ "-o, --output <path>",
57081
+ "Output path for generated team interface (interface type only)"
57082
+ ).option(
57083
+ "--format <format>",
57084
+ "Output format for team interface: yaml or json",
57085
+ "yaml"
57086
+ ).option("--dry-run", "Print what would be generated without writing files", false).option("--quiet", "Suppress output on success", false).action(
56445
57087
  async (type, opts) => {
56446
- if (type !== "guardrails") {
57088
+ if (type !== "guardrails" && type !== "interface") {
56447
57089
  process.stderr.write(`Unknown generate type: ${type}
57090
+ `);
57091
+ process.exit(1);
57092
+ }
57093
+ if (type === "interface" && opts.format !== "yaml" && opts.format !== "json") {
57094
+ process.stderr.write(`Invalid --format: expected yaml or json, got ${opts.format}
56448
57095
  `);
56449
57096
  process.exit(1);
56450
57097
  }
@@ -56456,6 +57103,83 @@ var generateGuardrailsCommand = new Command6("generate").description("Generate g
56456
57103
  );
56457
57104
  process.exit(1);
56458
57105
  }
57106
+ if (isMultiTeamConfig(config)) {
57107
+ const teamEntries = getTeamEntries(config, opts.team);
57108
+ let exitWithError = false;
57109
+ for (const [teamId, teamConfig] of teamEntries) {
57110
+ if (!opts.quiet) process.stdout.write(`
57111
+ --- Team: ${teamId} ---
57112
+ `);
57113
+ const resolved2 = await resolve4(teamConfig.dsl);
57114
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
57115
+ const schemaResult2 = validateSchema(data2);
57116
+ if (!schemaResult2.success) {
57117
+ process.stderr.write(
57118
+ `Schema validation failed for team ${teamId}. Run 'agent-contracts validate' for details.
57119
+ `
57120
+ );
57121
+ exitWithError = true;
57122
+ continue;
57123
+ }
57124
+ if (type === "interface") {
57125
+ runGenerateInterfaceCli({
57126
+ dsl: schemaResult2.data,
57127
+ output: teamConfig.interfaceOutput ?? opts.output,
57128
+ dryRun: opts.dryRun,
57129
+ format: opts.format,
57130
+ quiet: opts.quiet
57131
+ });
57132
+ continue;
57133
+ }
57134
+ const loadedBindings2 = await loadBindings(teamConfig.bindings);
57135
+ const result2 = await generateGuardrails({
57136
+ dsl: schemaResult2.data,
57137
+ config: resolvedConfigForTeam(config, teamConfig),
57138
+ loadedBindings: loadedBindings2,
57139
+ filterBindings: opts.binding,
57140
+ dryRun: opts.dryRun
57141
+ });
57142
+ const errors2 = result2.diagnostics.filter((d2) => d2.severity === "error");
57143
+ const warnings2 = result2.diagnostics.filter((d2) => d2.severity === "warning");
57144
+ const infos2 = result2.diagnostics.filter((d2) => d2.severity === "info");
57145
+ if (errors2.length > 0) {
57146
+ process.stderr.write(`Errors (team ${teamId}):
57147
+ `);
57148
+ for (const d2 of errors2) {
57149
+ process.stderr.write(` error [${d2.path}] ${d2.message}
57150
+ `);
57151
+ }
57152
+ exitWithError = true;
57153
+ }
57154
+ if (warnings2.length > 0 && !opts.quiet) {
57155
+ process.stderr.write(`Warnings (team ${teamId}):
57156
+ `);
57157
+ for (const d2 of warnings2) {
57158
+ process.stderr.write(` warning [${d2.path}] ${d2.message}
57159
+ `);
57160
+ }
57161
+ }
57162
+ if (infos2.length > 0 && !opts.quiet) {
57163
+ for (const d2 of infos2) {
57164
+ process.stderr.write(` info [${d2.path}] ${d2.message}
57165
+ `);
57166
+ }
57167
+ }
57168
+ if (!opts.quiet) {
57169
+ const action = opts.dryRun ? "Would generate" : "Generated";
57170
+ process.stdout.write(
57171
+ `${action} ${result2.outputFiles.length} file(s):
57172
+ `
57173
+ );
57174
+ for (const f2 of result2.outputFiles) {
57175
+ process.stdout.write(` ${f2}
57176
+ `);
57177
+ }
57178
+ }
57179
+ }
57180
+ if (exitWithError) process.exit(1);
57181
+ return;
57182
+ }
56459
57183
  const resolved = await resolve4(config.dsl);
56460
57184
  const data = config.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
56461
57185
  const schemaResult = validateSchema(data);
@@ -56465,6 +57189,16 @@ var generateGuardrailsCommand = new Command6("generate").description("Generate g
56465
57189
  );
56466
57190
  process.exit(1);
56467
57191
  }
57192
+ if (type === "interface") {
57193
+ runGenerateInterfaceCli({
57194
+ dsl: schemaResult.data,
57195
+ output: opts.output,
57196
+ dryRun: opts.dryRun,
57197
+ format: opts.format,
57198
+ quiet: opts.quiet
57199
+ });
57200
+ return;
57201
+ }
56468
57202
  const loadedBindings = await loadBindings(config.bindings);
56469
57203
  const result = await generateGuardrails({
56470
57204
  dsl: schemaResult.data,
@@ -56861,10 +57595,56 @@ function formatText(result) {
56861
57595
  }
56862
57596
  return lines.join("\n");
56863
57597
  }
56864
- var scoreCommand = new Command7("score").description("Calculate DSL completeness score").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT4).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--format <format>", "Output format (text|json)", "text").option("--threshold <number>", "Minimum score (exit 1 if below)", void 0).action(
57598
+ var scoreCommand = new Command7("score").description("Calculate DSL completeness score").argument("[dir]", "Path to agent-contracts.yaml", DIR_DEFAULT4).option("-c, --config <path>", "Path to agent-contracts.config.yaml").option("--team <id>", "Limit to one team (multi-team config only)").option("--format <format>", "Output format (text|json)", "text").option("--threshold <number>", "Minimum score (exit 1 if below)", void 0).action(
56865
57599
  async (dir, opts) => {
56866
57600
  try {
56867
57601
  const config = await loadConfig(opts.config);
57602
+ if (config !== null && isMultiTeamConfig(config)) {
57603
+ const teamEntries = getTeamEntries(config, opts.team);
57604
+ let thresholdNum;
57605
+ if (opts.threshold !== void 0) {
57606
+ thresholdNum = parseInt(opts.threshold, 10);
57607
+ if (isNaN(thresholdNum)) {
57608
+ process.stderr.write(
57609
+ `Error: --threshold must be a number, got "${opts.threshold}"
57610
+ `
57611
+ );
57612
+ process.exit(1);
57613
+ }
57614
+ }
57615
+ let hasErrors = false;
57616
+ for (const [teamId, teamConfig] of teamEntries) {
57617
+ process.stdout.write(`
57618
+ --- Team: ${teamId} ---
57619
+ `);
57620
+ const resolved2 = await resolve4(teamConfig.dsl);
57621
+ const data2 = teamConfig.vars ? substituteVars(resolved2.data, teamConfig.vars) : resolved2.data;
57622
+ const schemaResult2 = validateSchema(data2);
57623
+ if (!schemaResult2.success) {
57624
+ const issues = schemaResult2.diagnostics.map((d2) => ` ${d2.path}: ${d2.message}`).join("\n");
57625
+ process.stderr.write(`Schema validation failed:
57626
+ ${issues}
57627
+ `);
57628
+ hasErrors = true;
57629
+ continue;
57630
+ }
57631
+ const result2 = score(schemaResult2.data);
57632
+ if (opts.format === "json") {
57633
+ process.stdout.write(JSON.stringify(result2, null, 2) + "\n");
57634
+ } else {
57635
+ process.stdout.write(formatText(result2) + "\n");
57636
+ }
57637
+ if (thresholdNum !== void 0 && result2.overall < thresholdNum) {
57638
+ process.stderr.write(
57639
+ `Score ${result2.overall} is below threshold ${thresholdNum}
57640
+ `
57641
+ );
57642
+ hasErrors = true;
57643
+ }
57644
+ }
57645
+ if (hasErrors) process.exit(1);
57646
+ return;
57647
+ }
56868
57648
  const dslPath = resolveDslPath(dir, DIR_DEFAULT4, config);
56869
57649
  const resolved = await resolve4(dslPath);
56870
57650
  const data = config?.vars ? substituteVars(resolved.data, config.vars) : resolved.data;
@@ -56909,8 +57689,8 @@ ${issues}
56909
57689
  );
56910
57690
 
56911
57691
  // src/cli/cli.ts
56912
- var __dirname = dirname7(fileURLToPath(import.meta.url));
56913
- var pkg = JSON.parse(readFileSync(resolve7(__dirname, "../package.json"), "utf8"));
57692
+ var __dirname = dirname8(fileURLToPath(import.meta.url));
57693
+ var pkg = JSON.parse(readFileSync2(resolve8(__dirname, "../package.json"), "utf8"));
56914
57694
  var program = new Command8();
56915
57695
  program.name("agent-contracts").description("Agent contracts tooling \u2014 validate, lint, render DSL files").version(pkg.version);
56916
57696
  program.addCommand(resolveCommand);