agent-contracts 0.25.0 → 0.30.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(resolve9) {
163
- resolve9(value);
162
+ return value instanceof P2 ? value : new P2(function(resolve10) {
163
+ resolve10(value);
164
164
  });
165
165
  }
166
- return new (P2 || (P2 = Promise))(function(resolve9, reject) {
166
+ return new (P2 || (P2 = Promise))(function(resolve10, 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 ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
182
+ result.done ? resolve10(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(resolve9, reject) {
374
- v2 = o3[n3](v2), settle(resolve9, reject, v2.done, v2.value);
373
+ return new Promise(function(resolve10, reject) {
374
+ v2 = o3[n3](v2), settle(resolve10, reject, v2.done, v2.value);
375
375
  });
376
376
  };
377
377
  }
378
- function settle(resolve9, reject, d2, v2) {
378
+ function settle(resolve10, reject, d2, v2) {
379
379
  Promise.resolve(v2).then(function(v3) {
380
- resolve9({ value: v3, done: d2 });
380
+ resolve10({ value: v3, done: d2 });
381
381
  }, reject);
382
382
  }
383
383
  }
@@ -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 parseYaml5 = (input) => (0, yaml_1.parseWithPointers)(input, {
12940
+ var parseYaml6 = (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 = parseYaml5;
12946
+ exports.parseYaml = parseYaml6;
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(resolve9) {
13037
- resolve9(value);
13036
+ return value instanceof P2 ? value : new P2(function(resolve10) {
13037
+ resolve10(value);
13038
13038
  });
13039
13039
  }
13040
- return new (P2 || (P2 = Promise))(function(resolve9, reject) {
13040
+ return new (P2 || (P2 = Promise))(function(resolve10, 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 ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
13056
+ result.done ? resolve10(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(resolve9, reject) {
13235
- v2 = o3[n3](v2), settle(resolve9, reject, v2.done, v2.value);
13234
+ return new Promise(function(resolve10, reject) {
13235
+ v2 = o3[n3](v2), settle(resolve10, reject, v2.done, v2.value);
13236
13236
  });
13237
13237
  };
13238
13238
  }
13239
- function settle(resolve9, reject, d2, v2) {
13239
+ function settle(resolve10, reject, d2, v2) {
13240
13240
  Promise.resolve(v2).then(function(v3) {
13241
- resolve9({ value: v3, done: d2 });
13241
+ resolve10({ value: v3, done: d2 });
13242
13242
  }, reject);
13243
13243
  }
13244
13244
  }
@@ -18836,7 +18836,7 @@ function consumeBody() {
18836
18836
  let accum = [];
18837
18837
  let accumBytes = 0;
18838
18838
  let abort = false;
18839
- return new Body.Promise(function(resolve9, reject) {
18839
+ return new Body.Promise(function(resolve10, reject) {
18840
18840
  let resTimeout;
18841
18841
  if (_this4.timeout) {
18842
18842
  resTimeout = setTimeout(function() {
@@ -18870,7 +18870,7 @@ function consumeBody() {
18870
18870
  }
18871
18871
  clearTimeout(resTimeout);
18872
18872
  try {
18873
- resolve9(Buffer.concat(accum, accumBytes));
18873
+ resolve10(Buffer.concat(accum, accumBytes));
18874
18874
  } catch (err) {
18875
18875
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
18876
18876
  }
@@ -19133,7 +19133,7 @@ function fetch(url, opts) {
19133
19133
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
19134
19134
  }
19135
19135
  Body.Promise = fetch.Promise;
19136
- return new fetch.Promise(function(resolve9, reject) {
19136
+ return new fetch.Promise(function(resolve10, reject) {
19137
19137
  const request = new Request(url, opts);
19138
19138
  const options = getNodeRequestOptions(request);
19139
19139
  const send = (options.protocol === "https:" ? https : http).request;
@@ -19266,7 +19266,7 @@ function fetch(url, opts) {
19266
19266
  requestOpts.body = void 0;
19267
19267
  requestOpts.headers.delete("content-length");
19268
19268
  }
19269
- resolve9(fetch(new Request(locationURL, requestOpts)));
19269
+ resolve10(fetch(new Request(locationURL, requestOpts)));
19270
19270
  finalize();
19271
19271
  return;
19272
19272
  }
@@ -19287,7 +19287,7 @@ function fetch(url, opts) {
19287
19287
  const codings = headers.get("Content-Encoding");
19288
19288
  if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
19289
19289
  response = new Response(body, response_options);
19290
- resolve9(response);
19290
+ resolve10(response);
19291
19291
  return;
19292
19292
  }
19293
19293
  const zlibOptions = {
@@ -19297,7 +19297,7 @@ function fetch(url, opts) {
19297
19297
  if (codings == "gzip" || codings == "x-gzip") {
19298
19298
  body = body.pipe(zlib.createGunzip(zlibOptions));
19299
19299
  response = new Response(body, response_options);
19300
- resolve9(response);
19300
+ resolve10(response);
19301
19301
  return;
19302
19302
  }
19303
19303
  if (codings == "deflate" || codings == "x-deflate") {
@@ -19309,12 +19309,12 @@ function fetch(url, opts) {
19309
19309
  body = body.pipe(zlib.createInflateRaw());
19310
19310
  }
19311
19311
  response = new Response(body, response_options);
19312
- resolve9(response);
19312
+ resolve10(response);
19313
19313
  });
19314
19314
  raw.on("end", function() {
19315
19315
  if (!response) {
19316
19316
  response = new Response(body, response_options);
19317
- resolve9(response);
19317
+ resolve10(response);
19318
19318
  }
19319
19319
  });
19320
19320
  return;
@@ -19322,11 +19322,11 @@ function fetch(url, opts) {
19322
19322
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
19323
19323
  body = body.pipe(zlib.createBrotliDecompress());
19324
19324
  response = new Response(body, response_options);
19325
- resolve9(response);
19325
+ resolve10(response);
19326
19326
  return;
19327
19327
  }
19328
19328
  response = new Response(body, response_options);
19329
- resolve9(response);
19329
+ resolve10(response);
19330
19330
  });
19331
19331
  writeToStream(req, request);
19332
19332
  });
@@ -20039,13 +20039,13 @@ var require_file = __commonJS({
20039
20039
  Object.defineProperty(exports, "__esModule", { value: true });
20040
20040
  var fs_1 = __require("fs");
20041
20041
  function resolveFile(ref) {
20042
- return new Promise((resolve9, reject) => {
20042
+ return new Promise((resolve10, reject) => {
20043
20043
  const path = ref.href();
20044
20044
  fs_1.readFile(path, "utf8", (err, data) => {
20045
20045
  if (err) {
20046
20046
  reject(err);
20047
20047
  } else {
20048
- resolve9(data);
20048
+ resolve10(data);
20049
20049
  }
20050
20050
  });
20051
20051
  });
@@ -27648,12 +27648,12 @@ var require_reader = __commonJS({
27648
27648
  }
27649
27649
  } else {
27650
27650
  try {
27651
- return await new Promise((resolve9, reject) => {
27651
+ return await new Promise((resolve10, reject) => {
27652
27652
  fs.readFile(name, opts.encoding, (err, data) => {
27653
27653
  if (err !== null) {
27654
27654
  reject(err);
27655
27655
  } else {
27656
- resolve9(data);
27656
+ resolve10(data);
27657
27657
  }
27658
27658
  });
27659
27659
  });
@@ -44538,14 +44538,14 @@ var require_AsyncFromSyncIteratorContinuation = __commonJS({
44538
44538
  if (!$Promise) {
44539
44539
  throw new $SyntaxError("This environment does not support Promises.");
44540
44540
  }
44541
- return new $Promise(function(resolve9) {
44541
+ return new $Promise(function(resolve10) {
44542
44542
  var done = IteratorComplete(result);
44543
44543
  var value = IteratorValue(result);
44544
44544
  var valueWrapper = PromiseResolve($Promise, value);
44545
44545
  var onFulfilled = function(value2) {
44546
44546
  return CreateIteratorResultObject(value2, done);
44547
44547
  };
44548
- resolve9($then(valueWrapper, onFulfilled));
44548
+ resolve10($then(valueWrapper, onFulfilled));
44549
44549
  });
44550
44550
  };
44551
44551
  }
@@ -45093,7 +45093,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
45093
45093
  var O2 = this;
45094
45094
  SLOT.assert(O2, "[[SyncIteratorRecord]]");
45095
45095
  var argsLength = arguments.length;
45096
- return new $Promise(function(resolve9) {
45096
+ return new $Promise(function(resolve10) {
45097
45097
  var syncIteratorRecord = SLOT.get(O2, "[[SyncIteratorRecord]]");
45098
45098
  var result;
45099
45099
  if (argsLength > 0) {
@@ -45101,7 +45101,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
45101
45101
  } else {
45102
45102
  result = IteratorNext(syncIteratorRecord);
45103
45103
  }
45104
- resolve9(AsyncFromSyncIteratorContinuation(result));
45104
+ resolve10(AsyncFromSyncIteratorContinuation(result));
45105
45105
  });
45106
45106
  },
45107
45107
  "return": function() {
@@ -45112,12 +45112,12 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
45112
45112
  SLOT.assert(O2, "[[SyncIteratorRecord]]");
45113
45113
  var valueIsPresent = arguments.length > 0;
45114
45114
  var value = valueIsPresent ? arguments[0] : void 0;
45115
- return new $Promise(function(resolve9, reject) {
45115
+ return new $Promise(function(resolve10, reject) {
45116
45116
  var syncIterator = SLOT.get(O2, "[[SyncIteratorRecord]]")["[[Iterator]]"];
45117
45117
  var iteratorReturn = GetMethod(syncIterator, "return");
45118
45118
  if (typeof iteratorReturn === "undefined") {
45119
45119
  var iterResult = CreateIteratorResultObject(value, true);
45120
- Call(resolve9, void 0, [iterResult]);
45120
+ Call(resolve10, void 0, [iterResult]);
45121
45121
  return;
45122
45122
  }
45123
45123
  var result;
@@ -45130,7 +45130,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
45130
45130
  Call(reject, void 0, [new $TypeError("Iterator `return` method returned a non-object value.")]);
45131
45131
  return;
45132
45132
  }
45133
- resolve9(AsyncFromSyncIteratorContinuation(result));
45133
+ resolve10(AsyncFromSyncIteratorContinuation(result));
45134
45134
  });
45135
45135
  },
45136
45136
  "throw": function() {
@@ -45141,7 +45141,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
45141
45141
  SLOT.assert(O2, "[[SyncIteratorRecord]]");
45142
45142
  var valueIsPresent = arguments.length > 0;
45143
45143
  var value = valueIsPresent ? arguments[0] : void 0;
45144
- return new $Promise(function(resolve9, reject) {
45144
+ return new $Promise(function(resolve10, reject) {
45145
45145
  var syncIterator = SLOT.get(O2, "[[SyncIteratorRecord]]")["[[Iterator]]"];
45146
45146
  var throwMethod = GetMethod(syncIterator, "throw");
45147
45147
  if (typeof throwMethod === "undefined") {
@@ -45158,7 +45158,7 @@ var require_CreateAsyncFromSyncIterator = __commonJS({
45158
45158
  Call(reject, void 0, [new $TypeError("Iterator `throw` method returned a non-object value.")]);
45159
45159
  return;
45160
45160
  }
45161
- resolve9(AsyncFromSyncIteratorContinuation(
45161
+ resolve10(AsyncFromSyncIteratorContinuation(
45162
45162
  result
45163
45163
  /* , promiseCapability */
45164
45164
  ));
@@ -48889,9 +48889,9 @@ var require_dist14 = __commonJS({
48889
48889
  });
48890
48890
 
48891
48891
  // src/cli/cli.ts
48892
- import { readFileSync as readFileSync2 } from "fs";
48892
+ import { readFileSync as readFileSync3 } from "fs";
48893
48893
  import { fileURLToPath } from "url";
48894
- import { resolve as resolve8, dirname as dirname8 } from "path";
48894
+ import { resolve as resolve9, dirname as dirname8 } from "path";
48895
48895
 
48896
48896
  // src/generated/cli-contract/program.ts
48897
48897
  import { Command } from "commander";
@@ -48930,9 +48930,9 @@ function derivePolicy(input) {
48930
48930
  const riskLevels = [];
48931
48931
  let executionMode;
48932
48932
  let explicitConfirmation;
48933
- if (input.commandEffects) {
48934
- const ce2 = input.commandEffects;
48935
- riskLevels.push(ce2.riskLevel ?? "low");
48933
+ if (input.command_effects) {
48934
+ const ce2 = input.command_effects;
48935
+ riskLevels.push(ce2.risk_level ?? "low");
48936
48936
  if (ce2.writes) {
48937
48937
  sideEffects.add("file_write");
48938
48938
  for (const w2 of ce2.writes) {
@@ -48943,9 +48943,9 @@ function derivePolicy(input) {
48943
48943
  overwrite: w2.overwrite,
48944
48944
  destructive: w2.destructive,
48945
48945
  ...w2.idempotent !== void 0 ? { idempotent: w2.idempotent } : {},
48946
- ...w2.idempotencyKey ? { idempotencyKey: w2.idempotencyKey } : {},
48947
- ...w2.idempotentNote ? { idempotentNote: w2.idempotentNote } : {},
48948
- source: `command:${input.commandId}`
48946
+ ...w2.idempotency_key ? { idempotency_key: w2.idempotency_key } : {},
48947
+ ...w2.idempotent_note ? { idempotent_note: w2.idempotent_note } : {},
48948
+ source: `command:${input.command_id}`
48949
48949
  });
48950
48950
  }
48951
48951
  }
@@ -48955,7 +48955,7 @@ function derivePolicy(input) {
48955
48955
  kind: "semantic",
48956
48956
  target: r3.target,
48957
48957
  description: r3.description,
48958
- source: `command:${input.commandId}`
48958
+ source: `command:${input.command_id}`
48959
48959
  });
48960
48960
  }
48961
48961
  }
@@ -48966,17 +48966,17 @@ function derivePolicy(input) {
48966
48966
  ...ce2.network.description ? { description: ce2.network.description } : {},
48967
48967
  ...ce2.network.domains ? { domains: ce2.network.domains } : {},
48968
48968
  ...ce2.network.idempotent !== void 0 ? { idempotent: ce2.network.idempotent } : {},
48969
- ...ce2.network.idempotencyKey ? { idempotencyKey: ce2.network.idempotencyKey } : {},
48970
- ...ce2.network.idempotentNote ? { idempotentNote: ce2.network.idempotentNote } : {},
48971
- source: `command:${input.commandId}`
48969
+ ...ce2.network.idempotency_key ? { idempotency_key: ce2.network.idempotency_key } : {},
48970
+ ...ce2.network.idempotent_note ? { idempotent_note: ce2.network.idempotent_note } : {},
48971
+ source: `command:${input.command_id}`
48972
48972
  });
48973
48973
  }
48974
48974
  }
48975
- if (ce2.executionMode) {
48976
- executionMode = ce2.executionMode;
48975
+ if (ce2.execution_mode) {
48976
+ executionMode = ce2.execution_mode;
48977
48977
  }
48978
- if (ce2.requiresConfirmation !== void 0) {
48979
- explicitConfirmation = ce2.requiresConfirmation;
48978
+ if (ce2.requires_confirmation !== void 0) {
48979
+ explicitConfirmation = ce2.requires_confirmation;
48980
48980
  }
48981
48981
  }
48982
48982
  for (const [optName, optInput] of Object.entries(input.options)) {
@@ -49007,7 +49007,7 @@ function derivePolicy(input) {
49007
49007
  }
49008
49008
  if (definition.effects) {
49009
49009
  const eff = definition.effects;
49010
- riskLevels.push(eff.riskLevel ?? "low");
49010
+ riskLevels.push(eff.risk_level ?? "low");
49011
49011
  if (eff.writes) {
49012
49012
  sideEffects.add("file_write");
49013
49013
  for (const w2 of eff.writes) {
@@ -49018,8 +49018,8 @@ function derivePolicy(input) {
49018
49018
  overwrite: w2.overwrite,
49019
49019
  destructive: w2.destructive,
49020
49020
  ...w2.idempotent !== void 0 ? { idempotent: w2.idempotent } : {},
49021
- ...w2.idempotencyKey ? { idempotencyKey: w2.idempotencyKey } : {},
49022
- ...w2.idempotentNote ? { idempotentNote: w2.idempotentNote } : {},
49021
+ ...w2.idempotency_key ? { idempotency_key: w2.idempotency_key } : {},
49022
+ ...w2.idempotent_note ? { idempotent_note: w2.idempotent_note } : {},
49023
49023
  source: `option:${optName}`
49024
49024
  });
49025
49025
  }
@@ -49041,17 +49041,17 @@ function derivePolicy(input) {
49041
49041
  ...eff.network.description ? { description: eff.network.description } : {},
49042
49042
  ...eff.network.domains ? { domains: eff.network.domains } : {},
49043
49043
  ...eff.network.idempotent !== void 0 ? { idempotent: eff.network.idempotent } : {},
49044
- ...eff.network.idempotencyKey ? { idempotencyKey: eff.network.idempotencyKey } : {},
49045
- ...eff.network.idempotentNote ? { idempotentNote: eff.network.idempotentNote } : {},
49044
+ ...eff.network.idempotency_key ? { idempotency_key: eff.network.idempotency_key } : {},
49045
+ ...eff.network.idempotent_note ? { idempotent_note: eff.network.idempotent_note } : {},
49046
49046
  source: `option:${optName}`
49047
49047
  });
49048
49048
  }
49049
49049
  }
49050
- if (eff.executionMode && !executionMode) {
49051
- executionMode = eff.executionMode;
49050
+ if (eff.execution_mode && !executionMode) {
49051
+ executionMode = eff.execution_mode;
49052
49052
  }
49053
- if (eff.requiresConfirmation !== void 0 && explicitConfirmation === void 0) {
49054
- explicitConfirmation = eff.requiresConfirmation;
49053
+ if (eff.requires_confirmation !== void 0 && explicitConfirmation === void 0) {
49054
+ explicitConfirmation = eff.requires_confirmation;
49055
49055
  }
49056
49056
  }
49057
49057
  }
@@ -49072,15 +49072,15 @@ function derivePolicy(input) {
49072
49072
  const semanticWrites = writes.filter((w2) => w2.kind === "semantic");
49073
49073
  const idempotent = semanticWrites.every((w2) => w2.idempotent === true) && networkEffects.every((n3) => n3.idempotent === true);
49074
49074
  return {
49075
- riskLevel: finalRiskLevel,
49076
- requiresConfirmation,
49075
+ risk_level: finalRiskLevel,
49076
+ requires_confirmation: requiresConfirmation,
49077
49077
  idempotent,
49078
- sideEffects: [...sideEffects],
49078
+ side_effects: [...sideEffects],
49079
49079
  reads,
49080
49080
  writes,
49081
49081
  ...networkEffects.length > 0 ? { network: networkEffects } : {},
49082
- ...executionMode ? { executionMode } : {},
49083
- ...requiresSecrets ? { requiresSecrets } : {}
49082
+ ...executionMode ? { execution_mode: executionMode } : {},
49083
+ ...requiresSecrets ? { requires_secrets: requiresSecrets } : {}
49084
49084
  };
49085
49085
  }
49086
49086
 
@@ -49096,7 +49096,7 @@ var commandDefinitions = {
49096
49096
  "file": {
49097
49097
  "mode": "read",
49098
49098
  "exists": false,
49099
- "mediaType": "application/yaml",
49099
+ "media_type": "application/yaml",
49100
49100
  "encoding": "utf-8"
49101
49101
  }
49102
49102
  },
@@ -49136,7 +49136,7 @@ var commandDefinitions = {
49136
49136
  "file": {
49137
49137
  "mode": "read",
49138
49138
  "exists": false,
49139
- "mediaType": "application/yaml",
49139
+ "media_type": "application/yaml",
49140
49140
  "encoding": "utf-8"
49141
49141
  }
49142
49142
  },
@@ -49183,7 +49183,7 @@ var commandDefinitions = {
49183
49183
  "file": {
49184
49184
  "mode": "read",
49185
49185
  "exists": false,
49186
- "mediaType": "application/yaml",
49186
+ "media_type": "application/yaml",
49187
49187
  "encoding": "utf-8"
49188
49188
  }
49189
49189
  },
@@ -49222,14 +49222,14 @@ var commandDefinitions = {
49222
49222
  },
49223
49223
  "render": {
49224
49224
  "effects": {
49225
- "riskLevel": "medium",
49225
+ "risk_level": "medium",
49226
49226
  "writes": [
49227
49227
  {
49228
49228
  "target": "configured render output paths",
49229
49229
  "description": "rendered template files from DSL input",
49230
49230
  "overwrite": true,
49231
49231
  "idempotent": true,
49232
- "idempotentNote": "Output is deterministic from DSL input and templates. Repeated runs produce identical files."
49232
+ "idempotent_note": "Output is deterministic from DSL input and templates. Repeated runs produce identical files."
49233
49233
  }
49234
49234
  ]
49235
49235
  },
@@ -49242,7 +49242,7 @@ var commandDefinitions = {
49242
49242
  "file": {
49243
49243
  "mode": "read",
49244
49244
  "exists": false,
49245
- "mediaType": "application/yaml",
49245
+ "media_type": "application/yaml",
49246
49246
  "encoding": "utf-8"
49247
49247
  }
49248
49248
  },
@@ -49278,7 +49278,7 @@ var commandDefinitions = {
49278
49278
  "file": {
49279
49279
  "mode": "read",
49280
49280
  "exists": false,
49281
- "mediaType": "application/yaml",
49281
+ "media_type": "application/yaml",
49282
49282
  "encoding": "utf-8"
49283
49283
  }
49284
49284
  },
@@ -49325,7 +49325,7 @@ var commandDefinitions = {
49325
49325
  "file": {
49326
49326
  "mode": "read",
49327
49327
  "exists": false,
49328
- "mediaType": "application/yaml",
49328
+ "media_type": "application/yaml",
49329
49329
  "encoding": "utf-8"
49330
49330
  }
49331
49331
  },
@@ -49356,11 +49356,11 @@ var commandDefinitions = {
49356
49356
  },
49357
49357
  "audit": {
49358
49358
  "effects": {
49359
- "riskLevel": "medium",
49359
+ "risk_level": "medium",
49360
49360
  "network": {
49361
49361
  "description": "LLM API calls to configured adapter (e.g. OpenAI, Gemini, Cursor). Incurs token cost and sends DSL content to the LLM provider.",
49362
49362
  "idempotent": false,
49363
- "idempotentNote": "LLM inference is non-deterministic \u2014 identical inputs may produce different findings across runs."
49363
+ "idempotent_note": "LLM inference is non-deterministic \u2014 identical inputs may produce different findings across runs."
49364
49364
  }
49365
49365
  },
49366
49366
  "options": [
@@ -49372,7 +49372,7 @@ var commandDefinitions = {
49372
49372
  "file": {
49373
49373
  "mode": "read",
49374
49374
  "exists": false,
49375
- "mediaType": "application/yaml",
49375
+ "media_type": "application/yaml",
49376
49376
  "encoding": "utf-8"
49377
49377
  }
49378
49378
  },
@@ -49458,14 +49458,14 @@ var commandDefinitions = {
49458
49458
  },
49459
49459
  "generate": {
49460
49460
  "effects": {
49461
- "riskLevel": "low",
49461
+ "risk_level": "low",
49462
49462
  "writes": [
49463
49463
  {
49464
49464
  "target": "configured render, guardrail, and interface output paths",
49465
49465
  "description": "template files, guardrail binding files, and/or team interface files generated from DSL input",
49466
49466
  "overwrite": true,
49467
49467
  "idempotent": true,
49468
- "idempotentNote": "Output is deterministic from DSL input, templates, policies, and bindings. Repeated runs produce identical files."
49468
+ "idempotent_note": "Output is deterministic from DSL input, templates, policies, and bindings. Repeated runs produce identical files."
49469
49469
  }
49470
49470
  ]
49471
49471
  },
@@ -49478,7 +49478,7 @@ var commandDefinitions = {
49478
49478
  "file": {
49479
49479
  "mode": "read",
49480
49480
  "exists": false,
49481
- "mediaType": "application/yaml",
49481
+ "media_type": "application/yaml",
49482
49482
  "encoding": "utf-8"
49483
49483
  }
49484
49484
  },
@@ -49509,7 +49509,7 @@ var commandDefinitions = {
49509
49509
  },
49510
49510
  "file": {
49511
49511
  "mode": "write",
49512
- "mediaType": "application/yaml",
49512
+ "media_type": "application/yaml",
49513
49513
  "encoding": "utf-8"
49514
49514
  }
49515
49515
  },
@@ -49539,29 +49539,75 @@ var commandDefinitions = {
49539
49539
  }
49540
49540
  }
49541
49541
  ]
49542
+ },
49543
+ "navigation-index": {
49544
+ "options": [
49545
+ {
49546
+ "name": "config",
49547
+ "schema": {
49548
+ "type": "string"
49549
+ },
49550
+ "file": {
49551
+ "mode": "read",
49552
+ "exists": false,
49553
+ "media_type": "application/yaml",
49554
+ "encoding": "utf-8"
49555
+ }
49556
+ },
49557
+ {
49558
+ "name": "team",
49559
+ "schema": {
49560
+ "type": "string"
49561
+ }
49562
+ },
49563
+ {
49564
+ "name": "format",
49565
+ "schema": {
49566
+ "type": "string",
49567
+ "enum": [
49568
+ "json",
49569
+ "yaml"
49570
+ ],
49571
+ "default": "json"
49572
+ }
49573
+ },
49574
+ {
49575
+ "name": "artifact",
49576
+ "schema": {
49577
+ "type": "string"
49578
+ }
49579
+ },
49580
+ {
49581
+ "name": "quiet",
49582
+ "schema": {
49583
+ "type": "boolean",
49584
+ "default": false
49585
+ }
49586
+ }
49587
+ ]
49542
49588
  }
49543
49589
  };
49544
- function deriveCommandPolicy(commandId, optionValues) {
49545
- const def = commandDefinitions[commandId];
49546
- if (!def) throw new Error(`Unknown command: ${commandId}`);
49590
+ function deriveCommandPolicy(command_id, optionValues) {
49591
+ const def = commandDefinitions[command_id];
49592
+ if (!def) throw new Error(`Unknown command: ${command_id}`);
49547
49593
  const cmdDef = def;
49548
49594
  const options = {};
49549
- const activeOptions = [];
49595
+ const active_options = [];
49550
49596
  for (const optDef of cmdDef.options ?? []) {
49551
49597
  const value = optionValues[optDef.name];
49552
49598
  const specified = optDef.name in optionValues && value !== void 0;
49553
49599
  options[optDef.name] = { value, specified, definition: optDef };
49554
49600
  if (isOptionActive(optDef, value, specified)) {
49555
- activeOptions.push(optDef.name);
49601
+ active_options.push(optDef.name);
49556
49602
  }
49557
49603
  }
49558
49604
  const policy = derivePolicy({
49559
- commandId,
49560
- commandEffects: cmdDef.effects,
49605
+ command_id,
49606
+ command_effects: cmdDef.effects,
49561
49607
  options,
49562
49608
  env: cmdDef.env
49563
49609
  });
49564
- return { command: commandId, activeOptions, policy };
49610
+ return { command: command_id, active_options, policy };
49565
49611
  }
49566
49612
 
49567
49613
  // src/generated/cli-contract/program.ts
@@ -49641,16 +49687,25 @@ function createProgram(handlers2, version) {
49641
49687
  }
49642
49688
  await handlers2.generate(type, opts, globalOpts);
49643
49689
  });
49690
+ program2.command("navigation-index").description("Build artifact-centric navigation index from resolved DSL.").argument("[dir]", "Path to agent-contracts.yaml.").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.", "json").option("--artifact <id>", "Filter output to a single artifact by ID.").option("--quiet", "Suppress informational output.", false).action(async (dir, opts, cmd) => {
49691
+ const globalOpts = cmd.optsWithGlobals();
49692
+ if (globalOpts.introspect) {
49693
+ const policy = deriveCommandPolicy("navigation-index", opts);
49694
+ console.log(JSON.stringify(policy, null, 2));
49695
+ return;
49696
+ }
49697
+ await handlers2.navigationIndex(dir, opts, globalOpts);
49698
+ });
49644
49699
  return program2;
49645
49700
  }
49646
49701
 
49647
49702
  // src/cli/handlers.ts
49648
49703
  import { writeFileSync as writeFileSync2 } from "fs";
49649
- import { existsSync, readFileSync } from "fs";
49704
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
49650
49705
  import { join as join3, dirname as dirname7 } from "path";
49651
49706
  import { resolve as pathResolve } from "path";
49652
49707
  import { access as access2 } from "fs/promises";
49653
- import { stringify as stringify3, parse as parseYaml4 } from "yaml";
49708
+ import { stringify as stringify3, parse as parseYaml5 } from "yaml";
49654
49709
 
49655
49710
  // src/config/binding-loader.ts
49656
49711
  import { readFile as readFile3 } from "fs/promises";
@@ -49746,11 +49801,12 @@ var CONTEXT_TYPES = [
49746
49801
  "policy",
49747
49802
  "guardrail",
49748
49803
  "guardrail_policy",
49749
- "system"
49804
+ "system",
49805
+ "navigation_index"
49750
49806
  ];
49751
49807
  var ContextTypeSchema = z3.enum(CONTEXT_TYPES);
49752
49808
  var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
49753
- (t3) => t3 !== "system"
49809
+ (t3) => t3 !== "system" && t3 !== "navigation_index"
49754
49810
  );
49755
49811
 
49756
49812
  // src/schema/binding.ts
@@ -49988,7 +50044,9 @@ var CommandSchema = z12.object({
49988
50044
  purpose: z12.string().optional()
49989
50045
  });
49990
50046
  var ToolSchema = z12.object({
49991
- kind: z12.string(),
50047
+ kind: z12.string().optional(),
50048
+ extends: z12.string().optional(),
50049
+ command: z12.string().optional(),
49992
50050
  description: z12.string().optional(),
49993
50051
  input_artifacts: z12.array(z12.string()).default([]),
49994
50052
  output_artifacts: z12.array(z12.string()).default([]),
@@ -51139,6 +51197,123 @@ function mergeDsl(base, project) {
51139
51197
 
51140
51198
  // src/resolver/resolve.ts
51141
51199
  import { dirname as dirname3, resolve as resolvePath } from "path";
51200
+
51201
+ // src/resolver/tool-extends.ts
51202
+ var ToolExtendsError = class extends Error {
51203
+ constructor(message) {
51204
+ super(message);
51205
+ this.name = "ToolExtendsError";
51206
+ }
51207
+ };
51208
+ function asStringArray(value) {
51209
+ return Array.isArray(value) ? value : [];
51210
+ }
51211
+ function asRecord(value) {
51212
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
51213
+ return value;
51214
+ }
51215
+ return {};
51216
+ }
51217
+ function asCommands(value) {
51218
+ return Array.isArray(value) ? value : [];
51219
+ }
51220
+ function isUnset(value) {
51221
+ return value === void 0 || value === null;
51222
+ }
51223
+ function mergeToolFields(base, child) {
51224
+ const merged = { ...child };
51225
+ merged.artifact_bindings = {
51226
+ ...asRecord(base.artifact_bindings),
51227
+ ...asRecord(child.artifact_bindings)
51228
+ };
51229
+ if (isUnset(child.kind) && !isUnset(base.kind)) {
51230
+ merged.kind = base.kind;
51231
+ }
51232
+ if (isUnset(child.cli_contract) && !isUnset(base.cli_contract)) {
51233
+ merged.cli_contract = base.cli_contract;
51234
+ }
51235
+ if (isUnset(child.description) && !isUnset(base.description)) {
51236
+ merged.description = base.description;
51237
+ }
51238
+ const childInvokableBy = asStringArray(child.invokable_by);
51239
+ const baseInvokableBy = asStringArray(base.invokable_by);
51240
+ if (childInvokableBy.length === 0 && baseInvokableBy.length > 0) {
51241
+ merged.invokable_by = [...baseInvokableBy];
51242
+ }
51243
+ const childInputArtifacts = asStringArray(child.input_artifacts);
51244
+ const baseInputArtifacts = asStringArray(base.input_artifacts);
51245
+ if (childInputArtifacts.length === 0 && baseInputArtifacts.length > 0) {
51246
+ merged.input_artifacts = [...baseInputArtifacts];
51247
+ }
51248
+ const childOutputArtifacts = asStringArray(child.output_artifacts);
51249
+ const baseOutputArtifacts = asStringArray(base.output_artifacts);
51250
+ if (childOutputArtifacts.length === 0 && baseOutputArtifacts.length > 0) {
51251
+ merged.output_artifacts = [...baseOutputArtifacts];
51252
+ }
51253
+ const childSideEffects = asStringArray(child.side_effects);
51254
+ const baseSideEffects = asStringArray(base.side_effects);
51255
+ if (childSideEffects.length === 0 && baseSideEffects.length > 0) {
51256
+ merged.side_effects = [...baseSideEffects];
51257
+ }
51258
+ const childCommands = asCommands(child.commands);
51259
+ const baseCommands = asCommands(base.commands);
51260
+ if (childCommands.length === 0 && baseCommands.length > 0) {
51261
+ merged.commands = [...baseCommands];
51262
+ }
51263
+ if (isUnset(child.guardrails) && !isUnset(base.guardrails)) {
51264
+ merged.guardrails = base.guardrails;
51265
+ }
51266
+ return merged;
51267
+ }
51268
+ function resolveToolChain(id, tools, resolving, resolved) {
51269
+ const cached = resolved.get(id);
51270
+ if (cached !== void 0) {
51271
+ return cached;
51272
+ }
51273
+ const tool = tools[id];
51274
+ if (tool === void 0) {
51275
+ throw new ToolExtendsError(`Tool "${id}" not found`);
51276
+ }
51277
+ const extendsId = tool.extends;
51278
+ if (extendsId === void 0) {
51279
+ resolved.set(id, tool);
51280
+ return tool;
51281
+ }
51282
+ if (resolving.has(id)) {
51283
+ throw new ToolExtendsError(
51284
+ `Circular tool extends detected involving "${id}"`
51285
+ );
51286
+ }
51287
+ const baseTool = tools[extendsId];
51288
+ if (baseTool === void 0) {
51289
+ resolved.set(id, tool);
51290
+ return tool;
51291
+ }
51292
+ resolving.add(id);
51293
+ try {
51294
+ const resolvedBase = resolveToolChain(
51295
+ extendsId,
51296
+ tools,
51297
+ resolving,
51298
+ resolved
51299
+ );
51300
+ const merged = mergeToolFields(resolvedBase, tool);
51301
+ resolved.set(id, merged);
51302
+ return merged;
51303
+ } finally {
51304
+ resolving.delete(id);
51305
+ }
51306
+ }
51307
+ function resolveToolExtends(tools) {
51308
+ const resolved = /* @__PURE__ */ new Map();
51309
+ const result = {};
51310
+ for (const id of Object.keys(tools)) {
51311
+ result[id] = resolveToolChain(id, tools, /* @__PURE__ */ new Set(), resolved);
51312
+ }
51313
+ return result;
51314
+ }
51315
+
51316
+ // src/resolver/resolve.ts
51142
51317
  async function resolveExtendsChain(data, filePath, seen) {
51143
51318
  const extendsValue = data["extends"];
51144
51319
  if (typeof extendsValue !== "string") {
@@ -51168,6 +51343,10 @@ async function resolve4(projectDirOrFile) {
51168
51343
  projectResult.filePath,
51169
51344
  /* @__PURE__ */ new Set()
51170
51345
  );
51346
+ const tools = data["tools"];
51347
+ if (tools !== void 0 && tools !== null && typeof tools === "object" && !Array.isArray(tools)) {
51348
+ data["tools"] = resolveToolExtends(tools);
51349
+ }
51171
51350
  return {
51172
51351
  data,
51173
51352
  projectPath: projectResult.filePath,
@@ -52156,7 +52335,7 @@ function checkReferences(dsl) {
52156
52335
  for (const [id, art] of Object.entries(dsl.artifacts)) {
52157
52336
  if (art.owner) {
52158
52337
  const ownerAgent = dsl.agents[art.owner];
52159
- if (ownerAgent && !ownerAgent.can_read_artifacts.includes(id)) {
52338
+ if (ownerAgent && ownerAgent.can_read_artifacts.length > 0 && !ownerAgent.can_read_artifacts.includes(id)) {
52160
52339
  diagnostics.push({
52161
52340
  path: `artifacts.${id}.owner`,
52162
52341
  message: `Agent "${art.owner}" owns artifact "${id}" but cannot read it (missing from can_read_artifacts)`,
@@ -52179,6 +52358,15 @@ function checkReferences(dsl) {
52179
52358
  }
52180
52359
  }
52181
52360
  for (const [id, tool] of Object.entries(dsl.tools)) {
52361
+ if (tool.extends) {
52362
+ checkExists(
52363
+ tool.extends,
52364
+ toolIds,
52365
+ "tools",
52366
+ `tools.${id}.extends`,
52367
+ "tool-extends-not-found"
52368
+ );
52369
+ }
52182
52370
  if (tool.invokable_by.length > 0) {
52183
52371
  for (const ref of tool.invokable_by) {
52184
52372
  checkExists(ref, agentIds, "agents", `tools.${id}.invokable_by`);
@@ -52261,14 +52449,16 @@ function checkReferences(dsl) {
52261
52449
  code: "result-handoff-not-returnable"
52262
52450
  });
52263
52451
  }
52264
- for (let j2 = 0; j2 < task.input_artifacts.length; j2++) {
52265
- const inputId = task.input_artifacts[j2];
52266
- if (!targetAgent.can_read_artifacts.includes(inputId)) {
52267
- diagnostics.push({
52268
- path: `tasks.${id}.input_artifacts[${j2}]`,
52269
- message: `Input artifact "${inputId}" is not in target agent "${task.target_agent}" can_read_artifacts`,
52270
- code: "input-artifact-not-readable"
52271
- });
52452
+ if (targetAgent.can_read_artifacts.length > 0) {
52453
+ for (let j2 = 0; j2 < task.input_artifacts.length; j2++) {
52454
+ const inputId = task.input_artifacts[j2];
52455
+ if (!targetAgent.can_read_artifacts.includes(inputId)) {
52456
+ diagnostics.push({
52457
+ path: `tasks.${id}.input_artifacts[${j2}]`,
52458
+ message: `Input artifact "${inputId}" is not in target agent "${task.target_agent}" can_read_artifacts`,
52459
+ code: "input-artifact-not-readable"
52460
+ });
52461
+ }
52272
52462
  }
52273
52463
  }
52274
52464
  }
@@ -52284,7 +52474,7 @@ function checkReferences(dsl) {
52284
52474
  if (agent.prerequisites) {
52285
52475
  for (let j2 = 0; j2 < agent.prerequisites.length; j2++) {
52286
52476
  const pre = agent.prerequisites[j2];
52287
- if (!agent.can_read_artifacts.includes(pre.target)) {
52477
+ if (agent.can_read_artifacts.length > 0 && !agent.can_read_artifacts.includes(pre.target)) {
52288
52478
  diagnostics.push({
52289
52479
  path: `agents.${id}.prerequisites[${j2}].target`,
52290
52480
  message: `Prerequisite target "${pre.target}" is not in agent "${id}" can_read_artifacts`,
@@ -52675,14 +52865,16 @@ var taskAgentBindingRule = {
52675
52865
  for (const [taskId, task] of Object.entries(dsl.tasks)) {
52676
52866
  const targetAgent = dsl.agents[task.target_agent];
52677
52867
  if (!targetAgent) continue;
52678
- for (const ref of task.input_artifacts) {
52679
- if (!targetAgent.can_read_artifacts.includes(ref)) {
52680
- diagnostics.push({
52681
- ruleId: "task-agent-binding",
52682
- severity: "error",
52683
- path: `tasks.${taskId}.input_artifacts`,
52684
- message: `Task "${taskId}" input_artifact "${ref}" not in target agent "${task.target_agent}" can_read_artifacts`
52685
- });
52868
+ if (targetAgent.can_read_artifacts.length > 0) {
52869
+ for (const ref of task.input_artifacts) {
52870
+ if (!targetAgent.can_read_artifacts.includes(ref)) {
52871
+ diagnostics.push({
52872
+ ruleId: "task-agent-binding",
52873
+ severity: "error",
52874
+ path: `tasks.${taskId}.input_artifacts`,
52875
+ message: `Task "${taskId}" input_artifact "${ref}" not in target agent "${task.target_agent}" can_read_artifacts`
52876
+ });
52877
+ }
52686
52878
  }
52687
52879
  }
52688
52880
  if (!targetAgent.can_return_handoffs.includes(task.result_handoff)) {
@@ -52718,7 +52910,7 @@ var taskAgentBindingRule = {
52718
52910
  });
52719
52911
  }
52720
52912
  }
52721
- if (step.produces_artifact) {
52913
+ if (step.produces_artifact && targetAgent.can_write_artifacts.length > 0) {
52722
52914
  if (!targetAgent.can_write_artifacts.includes(step.produces_artifact)) {
52723
52915
  diagnostics.push({
52724
52916
  ruleId: "task-agent-binding",
@@ -52728,7 +52920,7 @@ var taskAgentBindingRule = {
52728
52920
  });
52729
52921
  }
52730
52922
  }
52731
- if (step.reads_artifact) {
52923
+ if (step.reads_artifact && targetAgent.can_read_artifacts.length > 0) {
52732
52924
  if (!targetAgent.can_read_artifacts.includes(step.reads_artifact)) {
52733
52925
  diagnostics.push({
52734
52926
  ruleId: "task-agent-binding",
@@ -52793,7 +52985,8 @@ var artifactOwnershipRule = {
52793
52985
  }
52794
52986
  if (step.reads_artifact) {
52795
52987
  const artifact = dsl.artifacts[step.reads_artifact];
52796
- if (artifact && (artifact.consumers.length > 0 || artifact.producers.length > 0 || artifact.editors.length > 0)) {
52988
+ const hasDeprecatedOwnership = !!artifact?.owner || (artifact?.producers.length ?? 0) > 0 || (artifact?.editors.length ?? 0) > 0 || (artifact?.consumers.length ?? 0) > 0;
52989
+ if (artifact && hasDeprecatedOwnership) {
52797
52990
  const canRead = artifact.consumers.includes(agentId) || artifact.producers.includes(agentId) || artifact.editors.includes(agentId);
52798
52991
  if (!canRead) {
52799
52992
  diagnostics.push({
@@ -53231,6 +53424,7 @@ var artifactOwnershipConsistencyRule = {
53231
53424
  run(dsl) {
53232
53425
  const diagnostics = [];
53233
53426
  for (const [agentId, agent] of Object.entries(dsl.agents)) {
53427
+ if (agent.own_artifacts.length === 0) continue;
53234
53428
  for (const artId of agent.own_artifacts) {
53235
53429
  if (!agent.can_read_artifacts.includes(artId)) {
53236
53430
  diagnostics.push({
@@ -53258,6 +53452,68 @@ var artifactOwnershipConsistencyRule = {
53258
53452
  }
53259
53453
  };
53260
53454
 
53455
+ // src/linter/rules/deprecated-ownership-fields.ts
53456
+ var ARTIFACT_FIELDS = ["owner", "producers", "editors", "consumers"];
53457
+ var AGENT_FIELDS = [
53458
+ "own_artifacts",
53459
+ "can_read_artifacts",
53460
+ "can_write_artifacts"
53461
+ ];
53462
+ function isArtifactFieldUsed(artifact, field) {
53463
+ switch (field) {
53464
+ case "owner":
53465
+ return !!artifact.owner;
53466
+ case "producers":
53467
+ return artifact.producers.length > 0;
53468
+ case "editors":
53469
+ return artifact.editors.length > 0;
53470
+ case "consumers":
53471
+ return artifact.consumers.length > 0;
53472
+ }
53473
+ }
53474
+ function isAgentFieldUsed(agent, field) {
53475
+ switch (field) {
53476
+ case "own_artifacts":
53477
+ return agent.own_artifacts.length > 0;
53478
+ case "can_read_artifacts":
53479
+ return agent.can_read_artifacts.length > 0;
53480
+ case "can_write_artifacts":
53481
+ return agent.can_write_artifacts.length > 0;
53482
+ }
53483
+ }
53484
+ var deprecatedOwnershipFieldsRule = {
53485
+ id: "deprecated-ownership-fields",
53486
+ description: "Warn when deprecated ownership/permission fields are used instead of artifact_bindings + artifact_slots",
53487
+ run(dsl) {
53488
+ const diagnostics = [];
53489
+ for (const [artId, artifact] of Object.entries(dsl.artifacts)) {
53490
+ for (const field of ARTIFACT_FIELDS) {
53491
+ if (isArtifactFieldUsed(artifact, field)) {
53492
+ diagnostics.push({
53493
+ ruleId: "deprecated-ownership-fields",
53494
+ severity: "warning",
53495
+ path: `artifacts.${artId}.${field}`,
53496
+ message: `Artifact "${artId}" uses deprecated field "${field}". Ownership is derived from artifact_bindings + artifact_slots in the binding model.`
53497
+ });
53498
+ }
53499
+ }
53500
+ }
53501
+ for (const [agentId, agent] of Object.entries(dsl.agents)) {
53502
+ for (const field of AGENT_FIELDS) {
53503
+ if (isAgentFieldUsed(agent, field)) {
53504
+ diagnostics.push({
53505
+ ruleId: "deprecated-ownership-fields",
53506
+ severity: "warning",
53507
+ path: `agents.${agentId}.${field}`,
53508
+ message: `Agent "${agentId}" uses deprecated field "${field}". Artifact permissions are derived from artifact_bindings + artifact_slots in the binding model.`
53509
+ });
53510
+ }
53511
+ }
53512
+ }
53513
+ return diagnostics;
53514
+ }
53515
+ };
53516
+
53261
53517
  // src/linter/rules/extension-consumption.ts
53262
53518
  function isRecord4(v2) {
53263
53519
  return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
@@ -53428,6 +53684,194 @@ var extensionUndeclaredUsageRule = {
53428
53684
  }
53429
53685
  };
53430
53686
 
53687
+ // src/navigation-index/cli-contract-loader.ts
53688
+ import { existsSync, readFileSync } from "fs";
53689
+ import { isAbsolute, resolve as resolve6 } from "path";
53690
+ import { parse as parseYaml4 } from "yaml";
53691
+ function extractStringArray(value) {
53692
+ if (!Array.isArray(value)) return [];
53693
+ return value.filter((item) => typeof item === "string");
53694
+ }
53695
+ function extractArtifactSlots(doc) {
53696
+ const slots = doc.artifact_slots;
53697
+ if (!slots || typeof slots !== "object") return null;
53698
+ const result = {};
53699
+ for (const [name, slotDef] of Object.entries(slots)) {
53700
+ if (!slotDef || typeof slotDef !== "object") continue;
53701
+ const direction = slotDef.direction;
53702
+ if (direction === "read" || direction === "write" || direction === "readwrite") {
53703
+ result[name] = { direction };
53704
+ }
53705
+ }
53706
+ return Object.keys(result).length > 0 ? result : null;
53707
+ }
53708
+ function extractCommandEffects(doc) {
53709
+ const result = {};
53710
+ const commandSets = doc.command_sets;
53711
+ if (!commandSets || typeof commandSets !== "object") return result;
53712
+ for (const setDef of Object.values(commandSets)) {
53713
+ if (!setDef || typeof setDef !== "object") continue;
53714
+ const commands = setDef.commands;
53715
+ if (!commands || typeof commands !== "object") continue;
53716
+ for (const [cmdName, cmdDef] of Object.entries(commands)) {
53717
+ if (!cmdDef || typeof cmdDef !== "object") continue;
53718
+ const effects = cmdDef.effects;
53719
+ if (!effects || typeof effects !== "object") continue;
53720
+ result[cmdName] = {
53721
+ reads: extractStringArray(effects.reads),
53722
+ writes: extractStringArray(effects.writes)
53723
+ };
53724
+ }
53725
+ }
53726
+ return result;
53727
+ }
53728
+ function resolveCliContractPath(cliContractPath) {
53729
+ return isAbsolute(cliContractPath) ? cliContractPath : resolve6(process.cwd(), cliContractPath);
53730
+ }
53731
+ function loadCliContractSlots(cliContractPath) {
53732
+ const filePath = resolveCliContractPath(cliContractPath);
53733
+ if (!existsSync(filePath)) return null;
53734
+ let doc;
53735
+ try {
53736
+ doc = parseYaml4(readFileSync(filePath, "utf8"));
53737
+ } catch {
53738
+ return null;
53739
+ }
53740
+ if (!doc || typeof doc !== "object") return null;
53741
+ const artifactSlots = extractArtifactSlots(doc);
53742
+ if (!artifactSlots) return null;
53743
+ return {
53744
+ artifactSlots,
53745
+ commandEffects: extractCommandEffects(doc)
53746
+ };
53747
+ }
53748
+ function resolveSlotDirection(slot, command, slotInfo) {
53749
+ const cmdEffects = slotInfo.commandEffects[command];
53750
+ if (cmdEffects) {
53751
+ if (cmdEffects.writes.includes(slot)) return "write";
53752
+ if (cmdEffects.reads.includes(slot)) return "read";
53753
+ }
53754
+ const slotDecl = slotInfo.artifactSlots[slot];
53755
+ if (slotDecl) {
53756
+ if (slotDecl.direction === "write" || slotDecl.direction === "readwrite") {
53757
+ return "write";
53758
+ }
53759
+ return "read";
53760
+ }
53761
+ return "read";
53762
+ }
53763
+
53764
+ // src/linter/rules/binding-completeness.ts
53765
+ var bindingCompletenessRule = {
53766
+ id: "binding-completeness",
53767
+ description: "Check that artifact_bindings cover all slots referenced in the cli-contract command effects",
53768
+ run(dsl) {
53769
+ const diagnostics = [];
53770
+ for (const [toolId, tool] of Object.entries(dsl.tools)) {
53771
+ if (!tool.cli_contract || !tool.artifact_bindings) continue;
53772
+ const slotInfo = loadCliContractSlots(tool.cli_contract);
53773
+ if (!slotInfo?.artifactSlots) continue;
53774
+ const command = tool.command ?? "";
53775
+ const effects = slotInfo.commandEffects[command];
53776
+ if (!effects) continue;
53777
+ const referencedSlots = [...effects.reads, ...effects.writes];
53778
+ const boundSlots = new Set(Object.keys(tool.artifact_bindings));
53779
+ for (const slot of referencedSlots) {
53780
+ if (boundSlots.has(slot)) continue;
53781
+ diagnostics.push({
53782
+ ruleId: "binding-completeness",
53783
+ severity: "warning",
53784
+ path: `tools.${toolId}.artifact_bindings`,
53785
+ message: `Command "${command}" references slot "${slot}" but tool has no artifact_bindings entry for it`
53786
+ });
53787
+ }
53788
+ }
53789
+ return diagnostics;
53790
+ }
53791
+ };
53792
+
53793
+ // src/linter/rules/binding-direction-match.ts
53794
+ function agentCanWriteArtifact(agentId, artifactId, dsl) {
53795
+ const agent = dsl.agents[agentId];
53796
+ if (!agent) return false;
53797
+ return agent.can_write_artifacts.includes(artifactId) || agent.own_artifacts.includes(artifactId);
53798
+ }
53799
+ var bindingDirectionMatchRule = {
53800
+ id: "binding-direction-match",
53801
+ description: "Check that agents invoking a tool can write artifacts bound via write slots",
53802
+ run(dsl) {
53803
+ const diagnostics = [];
53804
+ for (const [toolId, tool] of Object.entries(dsl.tools)) {
53805
+ if (!tool.cli_contract || !tool.artifact_bindings) continue;
53806
+ const slotInfo = loadCliContractSlots(tool.cli_contract);
53807
+ if (!slotInfo) continue;
53808
+ const command = tool.command ?? "";
53809
+ for (const [slot, artifactId] of Object.entries(tool.artifact_bindings)) {
53810
+ const direction = resolveSlotDirection(slot, command, slotInfo);
53811
+ if (direction !== "write") continue;
53812
+ for (const agentId of tool.invokable_by) {
53813
+ if (agentCanWriteArtifact(agentId, artifactId, dsl)) continue;
53814
+ diagnostics.push({
53815
+ ruleId: "binding-direction-match",
53816
+ severity: "warning",
53817
+ path: `tools.${toolId}.artifact_bindings.${slot}`,
53818
+ message: `Agent "${agentId}" invokes tool "${toolId}" which writes to artifact "${artifactId}" via slot "${slot}", but agent lacks can_write_artifacts or own_artifacts for it`
53819
+ });
53820
+ }
53821
+ }
53822
+ }
53823
+ return diagnostics;
53824
+ }
53825
+ };
53826
+
53827
+ // src/linter/rules/slot-declaration-exists.ts
53828
+ var slotDeclarationExistsRule = {
53829
+ id: "slot-declaration-exists",
53830
+ description: "Check that artifact_bindings keys reference slot names declared in the cli-contract",
53831
+ run(dsl) {
53832
+ const diagnostics = [];
53833
+ for (const [toolId, tool] of Object.entries(dsl.tools)) {
53834
+ if (!tool.cli_contract || !tool.artifact_bindings) continue;
53835
+ const slotInfo = loadCliContractSlots(tool.cli_contract);
53836
+ if (!slotInfo?.artifactSlots) continue;
53837
+ for (const slot of Object.keys(tool.artifact_bindings)) {
53838
+ if (slot in slotInfo.artifactSlots) continue;
53839
+ diagnostics.push({
53840
+ ruleId: "slot-declaration-exists",
53841
+ severity: "warning",
53842
+ path: `tools.${toolId}.artifact_bindings.${slot}`,
53843
+ message: `artifact_bindings key "${slot}" is not declared in cli-contract artifactSlots`
53844
+ });
53845
+ }
53846
+ }
53847
+ return diagnostics;
53848
+ }
53849
+ };
53850
+
53851
+ // src/linter/rules/config-path-consistency.ts
53852
+ var configPathConsistencyRule = {
53853
+ id: "config-path-consistency",
53854
+ description: "Check that control-authority artifacts bound by tools have path_patterns defined",
53855
+ run(dsl) {
53856
+ const diagnostics = [];
53857
+ for (const [toolId, tool] of Object.entries(dsl.tools)) {
53858
+ if (!tool.artifact_bindings) continue;
53859
+ for (const [slot, artifactId] of Object.entries(tool.artifact_bindings)) {
53860
+ const artifact = dsl.artifacts[artifactId];
53861
+ if (!artifact || artifact.authority !== "control") continue;
53862
+ if (artifact.path_patterns && artifact.path_patterns.length > 0) continue;
53863
+ diagnostics.push({
53864
+ ruleId: "config-path-consistency",
53865
+ severity: "info",
53866
+ path: `tools.${toolId}.artifact_bindings.${slot}`,
53867
+ message: `Config artifact "${artifactId}" has no path_patterns; consider adding them for path-based lookup`
53868
+ });
53869
+ }
53870
+ }
53871
+ return diagnostics;
53872
+ }
53873
+ };
53874
+
53431
53875
  // src/linter/linter.ts
53432
53876
  var builtinRules = [
53433
53877
  validationCoverageRule,
@@ -53446,9 +53890,14 @@ var builtinRules = [
53446
53890
  guardrailOrphanedRule,
53447
53891
  validationExecutorNoContextRule,
53448
53892
  artifactOwnershipConsistencyRule,
53893
+ deprecatedOwnershipFieldsRule,
53449
53894
  extensionDeclaredButUnusedRule,
53450
53895
  extensionScopeMismatchRule,
53451
- extensionUndeclaredUsageRule
53896
+ extensionUndeclaredUsageRule,
53897
+ bindingCompletenessRule,
53898
+ bindingDirectionMatchRule,
53899
+ slotDeclarationExistsRule,
53900
+ configPathConsistencyRule
53452
53901
  ];
53453
53902
  function lint(dsl, rules = builtinRules) {
53454
53903
  const diagnostics = [];
@@ -53502,9 +53951,18 @@ var ref_exists_default = (0, import_spectral_core.createRulesetFunction)(
53502
53951
 
53503
53952
  // src/linter/spectral/functions/editors-not-empty.ts
53504
53953
  var import_spectral_core2 = __toESM(require_dist9(), 1);
53954
+ function allDeprecatedOwnershipFieldsEmpty(art) {
53955
+ return !art.owner && (art.producers?.length ?? 0) === 0 && (art.editors?.length ?? 0) === 0 && (art.consumers?.length ?? 0) === 0;
53956
+ }
53505
53957
  var editors_not_empty_default = (0, import_spectral_core2.createRulesetFunction)(
53506
53958
  { input: { type: "array" }, options: null },
53507
- (targetVal, _options, _context) => {
53959
+ (targetVal, _options, context) => {
53960
+ const root = context.document.data;
53961
+ const artId = context.path.length >= 2 ? String(context.path[1]) : void 0;
53962
+ const artifact = artId && root.artifacts ? root.artifacts[artId] : void 0;
53963
+ if (artifact && allDeprecatedOwnershipFieldsEmpty(artifact)) {
53964
+ return [];
53965
+ }
53508
53966
  if (targetVal.length === 0) {
53509
53967
  return [{ message: "editors must not be empty" }];
53510
53968
  }
@@ -53536,6 +53994,7 @@ var prerequisite_readable_default = (0, import_spectral_core4.createRulesetFunct
53536
53994
  (targetVal, _options, context) => {
53537
53995
  const readable = new Set(targetVal.can_read_artifacts ?? []);
53538
53996
  const prereqs = targetVal.prerequisites ?? [];
53997
+ if (readable.size === 0) return [];
53539
53998
  const results = [];
53540
53999
  for (let i3 = 0; i3 < prereqs.length; i3++) {
53541
54000
  const p2 = prereqs[i3];
@@ -53937,7 +54396,7 @@ var ruleset = {
53937
54396
  },
53938
54397
  "artifact-owner-exists": {
53939
54398
  description: "(deprecated) Every artifact must have an owner",
53940
- severity: "warn",
54399
+ severity: "off",
53941
54400
  given: "$.artifacts.*",
53942
54401
  then: {
53943
54402
  field: "owner",
@@ -54796,7 +55255,7 @@ function emitExecutionStep(es, agentAlias2, participants, lines, indent) {
54796
55255
  }
54797
55256
  function emitValidationStep(step, participants, dsl, lastFromAgent, lines, indent) {
54798
55257
  const val = dsl.validations[step.validation];
54799
- if (!val) return;
55258
+ if (!val || !val.executor) return;
54800
55259
  const executorAlias = participantAlias(participants, val.executor);
54801
55260
  const artifactAlias = participantAlias(participants, val.target_artifact);
54802
55261
  const fromAlias = lastFromAgent ? participantAlias(participants, lastFromAgent) : null;
@@ -55099,6 +55558,299 @@ function generateOverviewFlowchart(dsl) {
55099
55558
  return sections.join("\n\n");
55100
55559
  }
55101
55560
 
55561
+ // src/navigation-index/builder.ts
55562
+ var VALIDATOR_KINDS = /* @__PURE__ */ new Set(["linter", "checker", "validator", "test"]);
55563
+ var VALIDATION_TERMS = ["lint", "check", "validate", "test", "verify", "audit"];
55564
+ function sortUnique(values) {
55565
+ return [...new Set(values)].sort();
55566
+ }
55567
+ function matchesValidationTerm(value) {
55568
+ const lower = value.toLowerCase();
55569
+ return VALIDATION_TERMS.some((term) => lower.includes(term));
55570
+ }
55571
+ function isValidatorTool(tool) {
55572
+ if (tool.kind && VALIDATOR_KINDS.has(tool.kind)) {
55573
+ return true;
55574
+ }
55575
+ if (tool.command && matchesValidationTerm(tool.command)) {
55576
+ return true;
55577
+ }
55578
+ for (const cmd of tool.commands ?? []) {
55579
+ if (matchesValidationTerm(cmd.category) || matchesValidationTerm(cmd.command)) {
55580
+ return true;
55581
+ }
55582
+ }
55583
+ return false;
55584
+ }
55585
+ function extractToolArtifactLinks(toolId, tool) {
55586
+ const links = [];
55587
+ if (tool.cli_contract) {
55588
+ const command = tool.command ?? "";
55589
+ const slotInfo = loadCliContractSlots(tool.cli_contract);
55590
+ for (const [slot, artifactId] of Object.entries(tool.artifact_bindings ?? {})) {
55591
+ const direction = slotInfo ? resolveSlotDirection(slot, command, slotInfo) : "read";
55592
+ links.push({
55593
+ toolId,
55594
+ artifactId,
55595
+ direction,
55596
+ slot,
55597
+ command
55598
+ });
55599
+ }
55600
+ return links;
55601
+ }
55602
+ for (const cmd of tool.commands ?? []) {
55603
+ for (const artifactId of cmd.reads ?? []) {
55604
+ links.push({
55605
+ toolId,
55606
+ artifactId,
55607
+ direction: "read",
55608
+ slot: "",
55609
+ command: cmd.command
55610
+ });
55611
+ }
55612
+ for (const artifactId of cmd.writes ?? []) {
55613
+ links.push({
55614
+ toolId,
55615
+ artifactId,
55616
+ direction: "write",
55617
+ slot: "",
55618
+ command: cmd.command
55619
+ });
55620
+ }
55621
+ }
55622
+ return links;
55623
+ }
55624
+ function buildOperation(toolId, tool, link) {
55625
+ return {
55626
+ tool: toolId,
55627
+ cli_contract: tool.cli_contract ?? "",
55628
+ command: link.command || tool.command || "",
55629
+ slot: link.slot,
55630
+ invokable_by: [...tool.invokable_by ?? []]
55631
+ };
55632
+ }
55633
+ function operationKey(op) {
55634
+ return `${op.tool}:${op.command}:${op.slot}`;
55635
+ }
55636
+ function dedupeOperations(operations) {
55637
+ const seen = /* @__PURE__ */ new Set();
55638
+ const result = [];
55639
+ for (const op of operations) {
55640
+ const key = operationKey(op);
55641
+ if (seen.has(key)) continue;
55642
+ seen.add(key);
55643
+ result.push(op);
55644
+ }
55645
+ return result.sort((a3, b3) => a3.tool.localeCompare(b3.tool) || a3.slot.localeCompare(b3.slot));
55646
+ }
55647
+ function buildAgentMapping(dsl, artifactId) {
55648
+ const owners = [];
55649
+ const editors = [];
55650
+ const readers = [];
55651
+ for (const [agentId, agent] of Object.entries(dsl.agents)) {
55652
+ if (agent.own_artifacts?.includes(artifactId)) owners.push(agentId);
55653
+ if (agent.can_write_artifacts?.includes(artifactId)) editors.push(agentId);
55654
+ if (agent.can_read_artifacts?.includes(artifactId)) readers.push(agentId);
55655
+ }
55656
+ return {
55657
+ owners: sortUnique(owners),
55658
+ editors: sortUnique(editors),
55659
+ readers: sortUnique(readers)
55660
+ };
55661
+ }
55662
+ function buildRelations(artifactId, authority, linksByArtifact, allLinks) {
55663
+ const sourceArtifacts = /* @__PURE__ */ new Set();
55664
+ const derivedArtifacts = /* @__PURE__ */ new Set();
55665
+ const writesToThis = allLinks.filter(
55666
+ (link) => link.artifactId === artifactId && link.direction === "write"
55667
+ );
55668
+ if (authority === "generated" || authority === "derived") {
55669
+ for (const writeLink of writesToThis) {
55670
+ for (const readLink of allLinks) {
55671
+ if (readLink.toolId === writeLink.toolId && readLink.direction === "read") {
55672
+ sourceArtifacts.add(readLink.artifactId);
55673
+ }
55674
+ }
55675
+ }
55676
+ }
55677
+ const readsThis = allLinks.filter(
55678
+ (link) => link.artifactId === artifactId && link.direction === "read"
55679
+ );
55680
+ for (const readLink of readsThis) {
55681
+ for (const writeLink of allLinks) {
55682
+ if (writeLink.toolId === readLink.toolId && writeLink.direction === "write") {
55683
+ derivedArtifacts.add(writeLink.artifactId);
55684
+ }
55685
+ }
55686
+ }
55687
+ const knownArtifacts = new Set(linksByArtifact.keys());
55688
+ return {
55689
+ source_artifacts: sortUnique(
55690
+ [...sourceArtifacts].filter((id) => id !== artifactId && knownArtifacts.has(id))
55691
+ ),
55692
+ derived_artifacts: sortUnique(
55693
+ [...derivedArtifacts].filter((id) => id !== artifactId && knownArtifacts.has(id))
55694
+ )
55695
+ };
55696
+ }
55697
+ function buildValidateRoutes(validators) {
55698
+ return validators.map((validator) => ({
55699
+ purpose: "validate",
55700
+ steps: [
55701
+ {
55702
+ type: "run_operation",
55703
+ operation: validator.tool,
55704
+ candidate_agents: [...validator.invokable_by]
55705
+ }
55706
+ ]
55707
+ }));
55708
+ }
55709
+ function buildRegenerateRoutes(sourceArtifacts, producers, agentsByArtifact) {
55710
+ if (producers.length === 0) return [];
55711
+ const editSteps = sourceArtifacts.map((artifactId) => ({
55712
+ type: "edit_artifact",
55713
+ artifact: artifactId,
55714
+ candidate_agents: agentsByArtifact.get(artifactId)?.editors ?? []
55715
+ }));
55716
+ const runSteps = producers.map((producer) => ({
55717
+ type: "run_operation",
55718
+ operation: producer.tool,
55719
+ candidate_agents: [...producer.invokable_by]
55720
+ }));
55721
+ return [
55722
+ {
55723
+ purpose: "regenerate",
55724
+ steps: [...editSteps, ...runSteps]
55725
+ }
55726
+ ];
55727
+ }
55728
+ function buildUpdateRoutes(artifactId, validators, editors) {
55729
+ const steps = [
55730
+ {
55731
+ type: "edit_artifact",
55732
+ artifact: artifactId,
55733
+ candidate_agents: [...editors]
55734
+ }
55735
+ ];
55736
+ for (const validator of validators) {
55737
+ steps.push({
55738
+ type: "run_operation",
55739
+ operation: validator.tool,
55740
+ candidate_agents: [...validator.invokable_by]
55741
+ });
55742
+ }
55743
+ return [
55744
+ {
55745
+ purpose: "update",
55746
+ steps
55747
+ }
55748
+ ];
55749
+ }
55750
+ function defaultProperties(artifact) {
55751
+ return {
55752
+ type: artifact.type,
55753
+ authority: artifact.authority ?? "canonical",
55754
+ manual_edit: artifact.manual_edit ?? "allowed",
55755
+ change_control: artifact.change_control ?? "none"
55756
+ };
55757
+ }
55758
+ function buildNavigationIndex(dsl) {
55759
+ const resolvedTools = resolveToolExtends(dsl.tools);
55760
+ const allLinks = [];
55761
+ for (const [toolId, tool] of Object.entries(resolvedTools)) {
55762
+ allLinks.push(...extractToolArtifactLinks(toolId, tool));
55763
+ }
55764
+ const linksByArtifact = /* @__PURE__ */ new Map();
55765
+ for (const link of allLinks) {
55766
+ const existing = linksByArtifact.get(link.artifactId) ?? [];
55767
+ existing.push(link);
55768
+ linksByArtifact.set(link.artifactId, existing);
55769
+ }
55770
+ const toolWrites = /* @__PURE__ */ new Map();
55771
+ for (const link of allLinks) {
55772
+ if (link.direction !== "write") continue;
55773
+ const writes = toolWrites.get(link.toolId) ?? /* @__PURE__ */ new Set();
55774
+ writes.add(link.artifactId);
55775
+ toolWrites.set(link.toolId, writes);
55776
+ }
55777
+ const artifacts = {};
55778
+ const agentsByArtifact = /* @__PURE__ */ new Map();
55779
+ for (const [artifactId, artifactDef] of Object.entries(dsl.artifacts)) {
55780
+ const properties = defaultProperties(artifactDef);
55781
+ const agents = buildAgentMapping(dsl, artifactId);
55782
+ agentsByArtifact.set(artifactId, agents);
55783
+ const artifactLinks = linksByArtifact.get(artifactId) ?? [];
55784
+ const producers = [];
55785
+ const validators = [];
55786
+ const consumers = [];
55787
+ const processedPairs = /* @__PURE__ */ new Set();
55788
+ for (const link of artifactLinks) {
55789
+ const tool = resolvedTools[link.toolId];
55790
+ if (!tool) continue;
55791
+ const pairKey = `${link.toolId}:${link.direction}:${link.slot}:${link.command}`;
55792
+ if (processedPairs.has(pairKey)) continue;
55793
+ processedPairs.add(pairKey);
55794
+ const operation = buildOperation(link.toolId, tool, link);
55795
+ const toolWritesArtifacts = toolWrites.get(link.toolId) ?? /* @__PURE__ */ new Set();
55796
+ if (link.direction === "write" || toolWritesArtifacts.has(artifactId)) {
55797
+ producers.push(operation);
55798
+ } else if (isValidatorTool(tool)) {
55799
+ validators.push(operation);
55800
+ } else if (link.direction === "read") {
55801
+ consumers.push(operation);
55802
+ }
55803
+ }
55804
+ const relations = buildRelations(
55805
+ artifactId,
55806
+ properties.authority,
55807
+ linksByArtifact,
55808
+ allLinks
55809
+ );
55810
+ const routes = {};
55811
+ const dedupedValidators = dedupeOperations(validators);
55812
+ const dedupedProducers = dedupeOperations(producers);
55813
+ if (dedupedValidators.length > 0) {
55814
+ routes.validate = buildValidateRoutes(dedupedValidators);
55815
+ }
55816
+ if (properties.authority === "generated" && dedupedProducers.length > 0 && relations.source_artifacts.length > 0) {
55817
+ routes.regenerate = buildRegenerateRoutes(
55818
+ relations.source_artifacts,
55819
+ dedupedProducers,
55820
+ agentsByArtifact
55821
+ );
55822
+ }
55823
+ if (properties.authority === "canonical") {
55824
+ routes.update = buildUpdateRoutes(artifactId, dedupedValidators, agents.editors);
55825
+ }
55826
+ artifacts[artifactId] = {
55827
+ id: artifactId,
55828
+ files: {
55829
+ path_patterns: artifactDef.path_patterns ?? [],
55830
+ exclude_patterns: artifactDef.exclude_patterns ?? []
55831
+ },
55832
+ properties,
55833
+ relations,
55834
+ operations: {
55835
+ producers: dedupeOperations(producers),
55836
+ validators: dedupedValidators,
55837
+ consumers: dedupeOperations(consumers)
55838
+ },
55839
+ agents,
55840
+ routes
55841
+ };
55842
+ }
55843
+ return {
55844
+ version: "1.0.0",
55845
+ generated_at: (/* @__PURE__ */ new Date()).toISOString(),
55846
+ system: {
55847
+ id: dsl.system.id,
55848
+ name: dsl.system.name
55849
+ },
55850
+ artifacts
55851
+ };
55852
+ }
55853
+
55102
55854
  // src/renderer/renderer.ts
55103
55855
  Handlebars.registerHelper("eq", (a3, b3) => a3 === b3);
55104
55856
  Handlebars.registerHelper("notEmpty", (obj) => {
@@ -55408,6 +56160,8 @@ function buildEntityContext(dsl, context, entityId) {
55408
56160
  return buildGuardrailPolicyContext(dsl, entityId);
55409
56161
  case "system":
55410
56162
  return buildSystemContext(dsl);
56163
+ case "navigation_index":
56164
+ return buildNavigationIndex(dsl);
55411
56165
  }
55412
56166
  }
55413
56167
  async function loadTemplate(templatePath) {
@@ -55427,8 +56181,8 @@ async function renderFromConfig(dsl, renderTargets, options) {
55427
56181
  for (const target of renderTargets) {
55428
56182
  const templateContent = await loadTemplate(target.template);
55429
56183
  const compiled = Handlebars.compile(templateContent, { noEscape: false });
55430
- if (target.context === "system") {
55431
- const ctx = buildSystemContext(dsl, options);
56184
+ if (target.context === "system" || target.context === "navigation_index") {
56185
+ const ctx = target.context === "system" ? buildSystemContext(dsl, options) : buildNavigationIndex(dsl);
55432
56186
  const output = compiled(ctx);
55433
56187
  if (target.skip_empty && isEffectivelyEmpty(output)) {
55434
56188
  await removeIfExists(target.output);
@@ -55484,8 +56238,8 @@ async function checkDriftFromConfig(dsl, renderTargets, options) {
55484
56238
  for (const target of renderTargets) {
55485
56239
  const templateContent = await loadTemplate(target.template);
55486
56240
  const compiled = Handlebars.compile(templateContent, { noEscape: false });
55487
- if (target.context === "system") {
55488
- const ctx = buildSystemContext(dsl, options);
56241
+ if (target.context === "system" || target.context === "navigation_index") {
56242
+ const ctx = target.context === "system" ? buildSystemContext(dsl, options) : buildNavigationIndex(dsl);
55489
56243
  const expected = compiled(ctx);
55490
56244
  await checkExpectedVsExisting(expected, target.output, target.skip_empty, diffs);
55491
56245
  } else {
@@ -55764,7 +56518,7 @@ function score(dsl) {
55764
56518
 
55765
56519
  // src/guardrail-generator/generator.ts
55766
56520
  import { readFile as readFile5, writeFile as writeFile2, mkdir as mkdir2, chmod, unlink as unlink2, copyFile } from "fs/promises";
55767
- import { resolve as resolve6, dirname as dirname6 } from "path";
56521
+ import { resolve as resolve7, dirname as dirname6 } from "path";
55768
56522
  import Handlebars2 from "handlebars";
55769
56523
  import YAML from "yaml";
55770
56524
 
@@ -55986,9 +56740,9 @@ async function generateGuardrails(options) {
55986
56740
  if (pathResult.diagnostics.some((d2) => d2.severity === "error")) {
55987
56741
  continue;
55988
56742
  }
55989
- const targetPath = resolve6(config.configDir, pathResult.resolved);
56743
+ const targetPath = resolve7(config.configDir, pathResult.resolved);
55990
56744
  if (outputDef.source) {
55991
- const sourcePath = resolve6(config.configDir, outputDef.source);
56745
+ const sourcePath = resolve7(config.configDir, outputDef.source);
55992
56746
  if (!dryRun) {
55993
56747
  try {
55994
56748
  await mkdir2(dirname6(targetPath), { recursive: true });
@@ -56024,7 +56778,7 @@ async function generateGuardrails(options) {
56024
56778
  });
56025
56779
  continue;
56026
56780
  }
56027
- const templatePath = resolve6(config.configDir, outputDef.template);
56781
+ const templatePath = resolve7(config.configDir, outputDef.template);
56028
56782
  try {
56029
56783
  templateContent = await readFile5(templatePath, "utf8");
56030
56784
  } catch {
@@ -56063,7 +56817,7 @@ async function generateGuardrails(options) {
56063
56817
  };
56064
56818
  const compiled = Handlebars2.compile(templateContent, { noEscape: true });
56065
56819
  const rendered = compiled(groupCtx);
56066
- const groupTarget = resolve6(targetPath, groupKey);
56820
+ const groupTarget = resolve7(targetPath, groupKey);
56067
56821
  if (shouldSkipEmpty && rendered.trim().length === 0) {
56068
56822
  if (!dryRun) {
56069
56823
  try {
@@ -56111,7 +56865,7 @@ async function generateGuardrails(options) {
56111
56865
  if (renderTarget.inline_template) {
56112
56866
  templateContent = renderTarget.inline_template;
56113
56867
  } else if (renderTarget.template) {
56114
- const templatePath = resolve6(config.configDir, renderTarget.template);
56868
+ const templatePath = resolve7(config.configDir, renderTarget.template);
56115
56869
  try {
56116
56870
  templateContent = await readFile5(templatePath, "utf8");
56117
56871
  } catch {
@@ -56133,12 +56887,12 @@ async function generateGuardrails(options) {
56133
56887
  const compiled = Handlebars2.compile(templateContent, { noEscape: true });
56134
56888
  const shouldSkipEmpty = renderTarget.skip_empty === true;
56135
56889
  const context = renderTarget.context;
56136
- if (context === "system") {
56137
- const sysCtx = buildSystemContext(dsl);
56138
- const mergedCtx = { ...sysCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
56890
+ if (context === "system" || context === "navigation_index") {
56891
+ const baseCtx = context === "system" ? buildSystemContext(dsl) : buildNavigationIndex(dsl);
56892
+ const mergedCtx = { ...baseCtx, vars, paths, binding, resolved_checks: checkResult.resolved };
56139
56893
  const rendered = compiled(mergedCtx);
56140
56894
  const resolvedOutput = resolveBindingRenderOutputPath(renderTarget.output, paths);
56141
- const outputPath = resolve6(config.configDir, resolvedOutput);
56895
+ const outputPath = resolve7(config.configDir, resolvedOutput);
56142
56896
  if (shouldSkipEmpty && rendered.trim().length === 0) {
56143
56897
  if (!dryRun) {
56144
56898
  try {
@@ -56168,7 +56922,7 @@ async function generateGuardrails(options) {
56168
56922
  const expandedOutput = expandOutputPath(renderTarget.output, context, entityId, entity);
56169
56923
  if (hasUnresolvedPathVars(expandedOutput)) continue;
56170
56924
  const resolvedOutput = resolveBindingRenderOutputPath(expandedOutput, paths);
56171
- const outputPath = resolve6(config.configDir, resolvedOutput);
56925
+ const outputPath = resolve7(config.configDir, resolvedOutput);
56172
56926
  if (shouldSkipEmpty && rendered.trim().length === 0) {
56173
56927
  if (!dryRun) {
56174
56928
  try {
@@ -56384,10 +57138,10 @@ function collectAllXUsages(dsl) {
56384
57138
  function extractTemplateXReferences(config) {
56385
57139
  const refs = [];
56386
57140
  try {
56387
- const { readFileSync: readFileSync3 } = __require("fs");
57141
+ const { readFileSync: readFileSync4 } = __require("fs");
56388
57142
  for (const target of config.renders) {
56389
57143
  try {
56390
- const content = readFileSync3(target.template, "utf8");
57144
+ const content = readFileSync4(target.template, "utf8");
56391
57145
  const matches = content.matchAll(/\{\{[^}]*?(x-[\w-]+)[^}]*?\}\}/g);
56392
57146
  for (const m2 of matches) refs.push(m2[1]);
56393
57147
  } catch {
@@ -56912,7 +57666,7 @@ var DslTaskResultSchema = z20.object({
56912
57666
  });
56913
57667
  var AuditResultSchema = z20.object({
56914
57668
  summary: z20.string(),
56915
- riskLevel: z20.enum(["low", "medium", "high", "critical"]),
57669
+ risk_level: z20.enum(["low", "medium", "high", "critical"]),
56916
57670
  findings: z20.array(z20.object({
56917
57671
  id: z20.string().optional(),
56918
57672
  severity: z20.enum(["info", "warning", "error", "critical"]),
@@ -56930,7 +57684,7 @@ var AuditResultSchema = z20.object({
56930
57684
  })).optional(),
56931
57685
  details: z20.record(z20.string(), z20.unknown()).optional()
56932
57686
  })),
56933
- recommendedActions: z20.array(z20.object({
57687
+ recommended_actions: z20.array(z20.object({
56934
57688
  kind: z20.enum(["run_command", "edit_file", "review", "confirm", "block", "ignore"]),
56935
57689
  title: z20.string(),
56936
57690
  command: z20.string().optional(),
@@ -56941,7 +57695,7 @@ var AuditResultSchema = z20.object({
56941
57695
  tool: z20.string().optional(),
56942
57696
  command: z20.string().optional(),
56943
57697
  version: z20.string().optional(),
56944
- generatedAt: z20.string().optional(),
57698
+ generated_at: z20.string().optional(),
56945
57699
  adapter: z20.string().optional(),
56946
57700
  model: z20.string().optional()
56947
57701
  }).optional()
@@ -57252,13 +58006,13 @@ function getTeamEntries(config, teamFilter) {
57252
58006
 
57253
58007
  // src/cli/commands/generate-interface.ts
57254
58008
  import { writeFileSync } from "fs";
57255
- import { resolve as resolve7 } from "path";
58009
+ import { resolve as resolve8 } from "path";
57256
58010
  function runGenerateInterfaceCli(opts) {
57257
58011
  if (!opts.dsl.team_interface) {
57258
58012
  process.stderr.write("Error: DSL has no team_interface section.\n");
57259
58013
  process.exit(1);
57260
58014
  }
57261
- const outputPath = resolve7(process.cwd(), opts.output ?? "team-interface.yaml");
58015
+ const outputPath = resolve8(process.cwd(), opts.output ?? "team-interface.yaml");
57262
58016
  const result = generateInterface({
57263
58017
  dsl: opts.dsl,
57264
58018
  output: outputPath,
@@ -57654,12 +58408,12 @@ var handleCheck = async (opts) => {
57654
58408
  }
57655
58409
  if (schemaResult.data.team_interface) {
57656
58410
  const interfacePath = join3(config.configDir, "team-interface.yaml");
57657
- if (existsSync(interfacePath)) {
58411
+ if (existsSync2(interfacePath)) {
57658
58412
  const result = generateInterface({ dsl: schemaResult.data, dryRun: true, format: "yaml" });
57659
- const existing = readFileSync(interfacePath, "utf8");
58413
+ const existing = readFileSync2(interfacePath, "utf8");
57660
58414
  const normalize = (raw) => {
57661
58415
  try {
57662
- const parsed = parseYaml4(raw);
58416
+ const parsed = parseYaml5(raw);
57663
58417
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
57664
58418
  const { generated_at: _t, ...rest } = parsed;
57665
58419
  return `${stringify3(rest, { sortMapEntries: true })}
@@ -58071,6 +58825,105 @@ var handleGenerate = async (type, opts) => {
58071
58825
  process.exit(1);
58072
58826
  }
58073
58827
  };
58828
+ function filterIndexByArtifact(index3, artifactId) {
58829
+ const node = index3.artifacts[artifactId];
58830
+ if (!node) {
58831
+ throw new Error(`Artifact not found: ${artifactId}`);
58832
+ }
58833
+ return {
58834
+ ...index3,
58835
+ artifacts: { [artifactId]: node }
58836
+ };
58837
+ }
58838
+ function writeNavigationIndex(index3, format2) {
58839
+ if (format2 === "json") {
58840
+ process.stdout.write(JSON.stringify(index3, null, 2) + "\n");
58841
+ } else {
58842
+ process.stdout.write(stringify3(index3));
58843
+ }
58844
+ }
58845
+ async function buildNavigationIndexForDsl(dslPath, vars, artifactFilter) {
58846
+ const resolved = await resolve4(dslPath);
58847
+ const data = vars ? substituteVars(resolved.data, vars) : resolved.data;
58848
+ const schemaResult = validateSchema(data);
58849
+ if (!schemaResult.success) {
58850
+ const issues = schemaResult.diagnostics.map((d2) => ` ${d2.path}: ${d2.message}`).join("\n");
58851
+ process.stderr.write(`Schema validation failed:
58852
+ ${issues}
58853
+ `);
58854
+ throw new Error("schema validation failed");
58855
+ }
58856
+ let index3 = buildNavigationIndex(schemaResult.data);
58857
+ if (artifactFilter) {
58858
+ index3 = filterIndexByArtifact(index3, artifactFilter);
58859
+ }
58860
+ return index3;
58861
+ }
58862
+ var handleNavigationIndex = async (dir, opts) => {
58863
+ const fmt = opts.format ?? "json";
58864
+ if (fmt !== "json" && fmt !== "yaml") {
58865
+ process.stderr.write(`Invalid --format: expected json or yaml, got ${fmt}
58866
+ `);
58867
+ process.exit(1);
58868
+ }
58869
+ try {
58870
+ const config = await loadConfig(opts.config);
58871
+ if (config !== null && isMultiTeamConfig(config)) {
58872
+ const teamEntries = getTeamEntries(config, opts.team);
58873
+ let hasErrors = false;
58874
+ if (fmt === "json") {
58875
+ const out = {};
58876
+ for (const [teamId, teamConfig] of teamEntries) {
58877
+ try {
58878
+ out[teamId] = await buildNavigationIndexForDsl(
58879
+ teamConfig.dsl,
58880
+ teamConfig.vars,
58881
+ opts.artifact
58882
+ );
58883
+ } catch (err) {
58884
+ if (err instanceof Error && err.message === "schema validation failed") {
58885
+ hasErrors = true;
58886
+ continue;
58887
+ }
58888
+ throw err;
58889
+ }
58890
+ }
58891
+ if (hasErrors) process.exit(1);
58892
+ process.stdout.write(JSON.stringify(out, null, 2) + "\n");
58893
+ } else {
58894
+ for (const [teamId, teamConfig] of teamEntries) {
58895
+ if (!opts.quiet) process.stdout.write(`
58896
+ --- Team: ${teamId} ---
58897
+ `);
58898
+ try {
58899
+ const index4 = await buildNavigationIndexForDsl(
58900
+ teamConfig.dsl,
58901
+ teamConfig.vars,
58902
+ opts.artifact
58903
+ );
58904
+ process.stdout.write(stringify3(index4));
58905
+ } catch (err) {
58906
+ if (err instanceof Error && err.message === "schema validation failed") {
58907
+ hasErrors = true;
58908
+ continue;
58909
+ }
58910
+ throw err;
58911
+ }
58912
+ }
58913
+ if (hasErrors) process.exit(1);
58914
+ }
58915
+ return;
58916
+ }
58917
+ const dslPath = resolveDslPath(dir ?? DIR_DEFAULT, DIR_DEFAULT, config);
58918
+ const index3 = await buildNavigationIndexForDsl(dslPath, config?.vars, opts.artifact);
58919
+ writeNavigationIndex(index3, fmt);
58920
+ } catch (err) {
58921
+ const msg = err instanceof Error ? err.message : String(err);
58922
+ process.stderr.write(`Error: ${msg}
58923
+ `);
58924
+ process.exit(1);
58925
+ }
58926
+ };
58074
58927
  var handlers = {
58075
58928
  resolve: handleResolve,
58076
58929
  validate: handleValidate,
@@ -58079,12 +58932,13 @@ var handlers = {
58079
58932
  check: handleCheck,
58080
58933
  score: handleScore,
58081
58934
  audit: handleAudit,
58082
- generate: handleGenerate
58935
+ generate: handleGenerate,
58936
+ navigationIndex: handleNavigationIndex
58083
58937
  };
58084
58938
 
58085
58939
  // src/cli/cli.ts
58086
58940
  var __dirname = dirname8(fileURLToPath(import.meta.url));
58087
- var pkg = JSON.parse(readFileSync2(resolve8(__dirname, "../package.json"), "utf8"));
58941
+ var pkg = JSON.parse(readFileSync3(resolve9(__dirname, "../package.json"), "utf8"));
58088
58942
  var program = createProgram(handlers, pkg.version);
58089
58943
  program.parse();
58090
58944
  /*! Bundled license information: