@smartergpt/lexrunner 2.0.2 → 2.1.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.
Files changed (38) hide show
  1. package/BRAND.md +14 -0
  2. package/CHANGELOG.md +21 -0
  3. package/GOVERNANCE.md +18 -0
  4. package/LICENSE.md +201 -110
  5. package/NOTICE.md +12 -1
  6. package/README.md +12 -6
  7. package/dist/{api-QBPBKYOC.js → api-UIWVFU7M.js} +1 -1
  8. package/dist/{audit-SKMMC2U4.js → audit-HVB2HJPU.js} +2 -2
  9. package/dist/{autopilot-3OHEUTHD.js → autopilot-JWIOXBCZ.js} +2 -2
  10. package/dist/{chunk-6PZDSWCG.js → chunk-37UC53OG.js} +2 -2
  11. package/dist/{chunk-V3BU2VDU.js → chunk-PDDULIDL.js} +13 -1
  12. package/dist/{chunk-ARDKZW7F.js → chunk-SHSL643G.js} +2 -2
  13. package/dist/cli.cjs +979 -328
  14. package/dist/cli.d.ts +161 -7
  15. package/dist/cli.js +803 -171
  16. package/dist/{commandValidator-LVEMJTZP.js → commandValidator-XFVNCZXX.js} +1 -1
  17. package/dist/{constraints-2ZK5FJFA.js → constraints-LE2MW5NS.js} +1 -1
  18. package/dist/errors/index.js +1 -1
  19. package/dist/frames/index.js +1 -1
  20. package/dist/{gateMapping-R3RJYKMS.js → gateMapping-V4DTL5WD.js} +1 -1
  21. package/dist/hooks/events.js +1 -1
  22. package/dist/{jsonEnvelope-K2U5CWKU.js → jsonEnvelope-MXJM5ZQH.js} +1 -1
  23. package/dist/{mergeTreeSimulator-QCFSOU25.js → mergeTreeSimulator-GWZ77NF2.js} +1 -1
  24. package/dist/package-schemas/behavior-rule.js +1 -1
  25. package/dist/package-schemas/execution-plan-v1.js +1 -1
  26. package/dist/package-schemas/gates.js +1 -1
  27. package/dist/package-schemas/runner-scope.js +1 -1
  28. package/dist/package-schemas/runner-stack.js +1 -1
  29. package/dist/{planDiff-IHLFNZUT.js → planDiff-4D3AERAW.js} +1 -1
  30. package/dist/{planHistory-GLRI356L.js → planHistory-VPV4WDPW.js} +1 -1
  31. package/dist/{planReview-UUMCGZJ6.js → planReview-FV6INFLQ.js} +1 -1
  32. package/dist/{planViewer-TRSQVMH4.js → planViewer-WOV6A2HZ.js} +1 -1
  33. package/dist/{sarif-2C6RKOUX.js → sarif-QXVE3LYD.js} +1 -1
  34. package/dist/sdk/index.js +1 -1
  35. package/dist/{security-OE4VLUFK.js → security-W7TOUXSB.js} +1 -1
  36. package/dist/{signing-KLZYZZMP.js → signing-WGVPHJGG.js} +1 -1
  37. package/dist/{verify-3UVMA62I.js → verify-Y34CJAKB.js} +1 -1
  38. package/package.json +6 -4
package/dist/cli.cjs CHANGED
@@ -7,6 +7,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __typeError = (msg) => {
11
+ throw TypeError(msg);
12
+ };
10
13
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
14
  var __esm = (fn, res, err) => function __init() {
12
15
  if (err) throw err[0];
@@ -45,6 +48,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
45
48
  ));
46
49
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
47
50
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
51
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
52
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
53
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
54
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
55
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
48
56
 
49
57
  // src/tiers/schema.ts
50
58
  function parseTierOverride(overrideStr) {
@@ -717,10 +725,10 @@ function formatPlanValidationFailureText(failure5) {
717
725
  return lines.join("\n");
718
726
  }
719
727
  function normalizeValidationIssue(issue) {
720
- const path81 = normalizeValidationPath(issue.path);
728
+ const path82 = normalizeValidationPath(issue.path);
721
729
  const stableCustomIssue = safeCustomValidationIssue(issue);
722
730
  return {
723
- path: boundDiagnostic(path81, MAX_SCHEMA_VALIDATION_PATH_BYTES),
731
+ path: boundDiagnostic(path82, MAX_SCHEMA_VALIDATION_PATH_BYTES),
724
732
  message: boundDiagnostic(
725
733
  stableCustomIssue?.message ?? safeValidationMessage(issue.code),
726
734
  MAX_SCHEMA_VALIDATION_MESSAGE_BYTES
@@ -1252,7 +1260,7 @@ var init_performance = __esm({
1252
1260
  if (global.gc) {
1253
1261
  global.gc();
1254
1262
  }
1255
- await new Promise((resolve28) => setTimeout(resolve28, 100));
1263
+ await new Promise((resolve29) => setTimeout(resolve29, 100));
1256
1264
  }
1257
1265
  }
1258
1266
  /**
@@ -1421,26 +1429,26 @@ function detectCycles(graph) {
1421
1429
  const visited = /* @__PURE__ */ new Set();
1422
1430
  const recursionStack = /* @__PURE__ */ new Set();
1423
1431
  const cycles = [];
1424
- const path81 = [];
1432
+ const path82 = [];
1425
1433
  function dfs(node) {
1426
1434
  visited.add(node);
1427
1435
  recursionStack.add(node);
1428
- path81.push(node);
1436
+ path82.push(node);
1429
1437
  const neighbors = graph.get(node) || [];
1430
1438
  for (const neighbor of neighbors) {
1431
1439
  if (!visited.has(neighbor)) {
1432
1440
  dfs(neighbor);
1433
1441
  } else if (recursionStack.has(neighbor)) {
1434
- const cycleStart = path81.indexOf(neighbor);
1442
+ const cycleStart = path82.indexOf(neighbor);
1435
1443
  if (cycleStart !== -1) {
1436
- const cycle = path81.slice(cycleStart);
1444
+ const cycle = path82.slice(cycleStart);
1437
1445
  cycle.push(neighbor);
1438
1446
  cycles.push(cycle);
1439
1447
  }
1440
1448
  }
1441
1449
  }
1442
1450
  recursionStack.delete(node);
1443
- path81.pop();
1451
+ path82.pop();
1444
1452
  }
1445
1453
  for (const node of graph.keys()) {
1446
1454
  if (!visited.has(node)) {
@@ -1870,7 +1878,7 @@ async function withTimeout(promise, timeoutMs) {
1870
1878
  ]);
1871
1879
  }
1872
1880
  function delay(ms) {
1873
- return new Promise((resolve28) => setTimeout(resolve28, ms));
1881
+ return new Promise((resolve29) => setTimeout(resolve29, ms));
1874
1882
  }
1875
1883
  function formatErrorForUser(classified) {
1876
1884
  const lines = [];
@@ -4027,8 +4035,8 @@ var require_req = __commonJS({
4027
4035
  if (req.originalUrl) {
4028
4036
  _req.url = req.originalUrl;
4029
4037
  } else {
4030
- const path81 = req.path;
4031
- _req.url = typeof path81 === "string" ? path81 : req.url ? req.url.path || req.url : void 0;
4038
+ const path82 = req.path;
4039
+ _req.url = typeof path82 === "string" ? path82 : req.url ? req.url.path || req.url : void 0;
4032
4040
  }
4033
4041
  if (req.query) {
4034
4042
  _req.query = req.query;
@@ -4193,14 +4201,14 @@ var require_redact = __commonJS({
4193
4201
  }
4194
4202
  return obj;
4195
4203
  }
4196
- function parsePath(path81) {
4204
+ function parsePath(path82) {
4197
4205
  const parts = [];
4198
4206
  let current = "";
4199
4207
  let inBrackets = false;
4200
4208
  let inQuotes = false;
4201
4209
  let quoteChar = "";
4202
- for (let i = 0; i < path81.length; i++) {
4203
- const char = path81[i];
4210
+ for (let i = 0; i < path82.length; i++) {
4211
+ const char = path82[i];
4204
4212
  if (!inBrackets && char === ".") {
4205
4213
  if (current) {
4206
4214
  parts.push(current);
@@ -4331,10 +4339,10 @@ var require_redact = __commonJS({
4331
4339
  return current;
4332
4340
  }
4333
4341
  function redactPaths(obj, paths, censor, remove = false) {
4334
- for (const path81 of paths) {
4335
- const parts = parsePath(path81);
4342
+ for (const path82 of paths) {
4343
+ const parts = parsePath(path82);
4336
4344
  if (parts.includes("*")) {
4337
- redactWildcardPath(obj, parts, censor, path81, remove);
4345
+ redactWildcardPath(obj, parts, censor, path82, remove);
4338
4346
  } else {
4339
4347
  if (remove) {
4340
4348
  removeKey(obj, parts);
@@ -4419,8 +4427,8 @@ var require_redact = __commonJS({
4419
4427
  }
4420
4428
  } else {
4421
4429
  if (afterWildcard.includes("*")) {
4422
- const wrappedCensor = typeof censor === "function" ? (value, path81) => {
4423
- const fullPath = [...pathArray.slice(0, pathLength), ...path81];
4430
+ const wrappedCensor = typeof censor === "function" ? (value, path82) => {
4431
+ const fullPath = [...pathArray.slice(0, pathLength), ...path82];
4424
4432
  return censor(value, fullPath);
4425
4433
  } : censor;
4426
4434
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -4455,8 +4463,8 @@ var require_redact = __commonJS({
4455
4463
  return null;
4456
4464
  }
4457
4465
  const pathStructure = /* @__PURE__ */ new Map();
4458
- for (const path81 of pathsToClone) {
4459
- const parts = parsePath(path81);
4466
+ for (const path82 of pathsToClone) {
4467
+ const parts = parsePath(path82);
4460
4468
  let current = pathStructure;
4461
4469
  for (let i = 0; i < parts.length; i++) {
4462
4470
  const part = parts[i];
@@ -4508,24 +4516,24 @@ var require_redact = __commonJS({
4508
4516
  }
4509
4517
  return cloneSelectively(obj, pathStructure);
4510
4518
  }
4511
- function validatePath(path81) {
4512
- if (typeof path81 !== "string") {
4519
+ function validatePath(path82) {
4520
+ if (typeof path82 !== "string") {
4513
4521
  throw new Error("Paths must be (non-empty) strings");
4514
4522
  }
4515
- if (path81 === "") {
4523
+ if (path82 === "") {
4516
4524
  throw new Error("Invalid redaction path ()");
4517
4525
  }
4518
- if (path81.includes("..")) {
4519
- throw new Error(`Invalid redaction path (${path81})`);
4526
+ if (path82.includes("..")) {
4527
+ throw new Error(`Invalid redaction path (${path82})`);
4520
4528
  }
4521
- if (path81.includes(",")) {
4522
- throw new Error(`Invalid redaction path (${path81})`);
4529
+ if (path82.includes(",")) {
4530
+ throw new Error(`Invalid redaction path (${path82})`);
4523
4531
  }
4524
4532
  let bracketCount = 0;
4525
4533
  let inQuotes = false;
4526
4534
  let quoteChar = "";
4527
- for (let i = 0; i < path81.length; i++) {
4528
- const char = path81[i];
4535
+ for (let i = 0; i < path82.length; i++) {
4536
+ const char = path82[i];
4529
4537
  if ((char === '"' || char === "'") && bracketCount > 0) {
4530
4538
  if (!inQuotes) {
4531
4539
  inQuotes = true;
@@ -4539,20 +4547,20 @@ var require_redact = __commonJS({
4539
4547
  } else if (char === "]" && !inQuotes) {
4540
4548
  bracketCount--;
4541
4549
  if (bracketCount < 0) {
4542
- throw new Error(`Invalid redaction path (${path81})`);
4550
+ throw new Error(`Invalid redaction path (${path82})`);
4543
4551
  }
4544
4552
  }
4545
4553
  }
4546
4554
  if (bracketCount !== 0) {
4547
- throw new Error(`Invalid redaction path (${path81})`);
4555
+ throw new Error(`Invalid redaction path (${path82})`);
4548
4556
  }
4549
4557
  }
4550
4558
  function validatePaths(paths) {
4551
4559
  if (!Array.isArray(paths)) {
4552
4560
  throw new TypeError("paths must be an array");
4553
4561
  }
4554
- for (const path81 of paths) {
4555
- validatePath(path81);
4562
+ for (const path82 of paths) {
4563
+ validatePath(path82);
4556
4564
  }
4557
4565
  }
4558
4566
  function slowRedact(options = {}) {
@@ -4720,8 +4728,8 @@ var require_redaction = __commonJS({
4720
4728
  if (shape[k] === null) {
4721
4729
  o[k] = (value) => topCensor(value, [k]);
4722
4730
  } else {
4723
- const wrappedCensor = typeof censor === "function" ? (value, path81) => {
4724
- return censor(value, [k, ...path81]);
4731
+ const wrappedCensor = typeof censor === "function" ? (value, path82) => {
4732
+ return censor(value, [k, ...path82]);
4725
4733
  } : censor;
4726
4734
  o[k] = Redact({
4727
4735
  paths: shape[k],
@@ -4939,10 +4947,10 @@ var require_atomic_sleep = __commonJS({
4939
4947
  var require_sonic_boom = __commonJS({
4940
4948
  "node_modules/sonic-boom/index.js"(exports2, module2) {
4941
4949
  "use strict";
4942
- var fs73 = require("fs");
4950
+ var fs74 = require("fs");
4943
4951
  var EventEmitter = require("events");
4944
4952
  var inherits = require("util").inherits;
4945
- var path81 = require("path");
4953
+ var path82 = require("path");
4946
4954
  var sleep2 = require_atomic_sleep();
4947
4955
  var assert = require("assert");
4948
4956
  var BUSY_WRITE_TIMEOUT = 100;
@@ -4996,20 +5004,20 @@ var require_sonic_boom = __commonJS({
4996
5004
  const mode = sonic.mode;
4997
5005
  if (sonic.sync) {
4998
5006
  try {
4999
- if (sonic.mkdir) fs73.mkdirSync(path81.dirname(file), { recursive: true });
5000
- const fd = fs73.openSync(file, flags, mode);
5007
+ if (sonic.mkdir) fs74.mkdirSync(path82.dirname(file), { recursive: true });
5008
+ const fd = fs74.openSync(file, flags, mode);
5001
5009
  fileOpened(null, fd);
5002
5010
  } catch (err) {
5003
5011
  fileOpened(err);
5004
5012
  throw err;
5005
5013
  }
5006
5014
  } else if (sonic.mkdir) {
5007
- fs73.mkdir(path81.dirname(file), { recursive: true }, (err) => {
5015
+ fs74.mkdir(path82.dirname(file), { recursive: true }, (err) => {
5008
5016
  if (err) return fileOpened(err);
5009
- fs73.open(file, flags, mode, fileOpened);
5017
+ fs74.open(file, flags, mode, fileOpened);
5010
5018
  });
5011
5019
  } else {
5012
- fs73.open(file, flags, mode, fileOpened);
5020
+ fs74.open(file, flags, mode, fileOpened);
5013
5021
  }
5014
5022
  }
5015
5023
  function SonicBoom(opts) {
@@ -5050,8 +5058,8 @@ var require_sonic_boom = __commonJS({
5050
5058
  this.flush = flushBuffer;
5051
5059
  this.flushSync = flushBufferSync;
5052
5060
  this._actualWrite = actualWriteBuffer;
5053
- fsWriteSync = () => fs73.writeSync(this.fd, this._writingBuf);
5054
- fsWrite = () => fs73.write(this.fd, this._writingBuf, this.release);
5061
+ fsWriteSync = () => fs74.writeSync(this.fd, this._writingBuf);
5062
+ fsWrite = () => fs74.write(this.fd, this._writingBuf, this.release);
5055
5063
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
5056
5064
  this._writingBuf = "";
5057
5065
  this.write = write;
@@ -5060,15 +5068,15 @@ var require_sonic_boom = __commonJS({
5060
5068
  this._actualWrite = actualWrite;
5061
5069
  fsWriteSync = () => {
5062
5070
  if (Buffer.isBuffer(this._writingBuf)) {
5063
- return fs73.writeSync(this.fd, this._writingBuf);
5071
+ return fs74.writeSync(this.fd, this._writingBuf);
5064
5072
  }
5065
- return fs73.writeSync(this.fd, this._writingBuf, "utf8");
5073
+ return fs74.writeSync(this.fd, this._writingBuf, "utf8");
5066
5074
  };
5067
5075
  fsWrite = () => {
5068
5076
  if (Buffer.isBuffer(this._writingBuf)) {
5069
- return fs73.write(this.fd, this._writingBuf, this.release);
5077
+ return fs74.write(this.fd, this._writingBuf, this.release);
5070
5078
  }
5071
- return fs73.write(this.fd, this._writingBuf, "utf8", this.release);
5079
+ return fs74.write(this.fd, this._writingBuf, "utf8", this.release);
5072
5080
  };
5073
5081
  } else {
5074
5082
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
@@ -5125,7 +5133,7 @@ var require_sonic_boom = __commonJS({
5125
5133
  }
5126
5134
  }
5127
5135
  if (this._fsync) {
5128
- fs73.fsyncSync(this.fd);
5136
+ fs74.fsyncSync(this.fd);
5129
5137
  }
5130
5138
  const len = this._len;
5131
5139
  if (this._reopening) {
@@ -5239,7 +5247,7 @@ var require_sonic_boom = __commonJS({
5239
5247
  const onDrain = () => {
5240
5248
  if (!this._fsync) {
5241
5249
  try {
5242
- fs73.fsync(this.fd, (err) => {
5250
+ fs74.fsync(this.fd, (err) => {
5243
5251
  this._flushPending = false;
5244
5252
  cb(err);
5245
5253
  });
@@ -5341,7 +5349,7 @@ var require_sonic_boom = __commonJS({
5341
5349
  const fd = this.fd;
5342
5350
  this.once("ready", () => {
5343
5351
  if (fd !== this.fd) {
5344
- fs73.close(fd, (err) => {
5352
+ fs74.close(fd, (err) => {
5345
5353
  if (err) {
5346
5354
  return this.emit("error", err);
5347
5355
  }
@@ -5390,7 +5398,7 @@ var require_sonic_boom = __commonJS({
5390
5398
  buf = this._bufs[0];
5391
5399
  }
5392
5400
  try {
5393
- const n = Buffer.isBuffer(buf) ? fs73.writeSync(this.fd, buf) : fs73.writeSync(this.fd, buf, "utf8");
5401
+ const n = Buffer.isBuffer(buf) ? fs74.writeSync(this.fd, buf) : fs74.writeSync(this.fd, buf, "utf8");
5394
5402
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
5395
5403
  buf = releasedBufObj.writingBuf;
5396
5404
  this._len = releasedBufObj.len;
@@ -5406,7 +5414,7 @@ var require_sonic_boom = __commonJS({
5406
5414
  }
5407
5415
  }
5408
5416
  try {
5409
- fs73.fsyncSync(this.fd);
5417
+ fs74.fsyncSync(this.fd);
5410
5418
  } catch {
5411
5419
  }
5412
5420
  }
@@ -5427,7 +5435,7 @@ var require_sonic_boom = __commonJS({
5427
5435
  buf = mergeBuf(this._bufs[0], this._lens[0]);
5428
5436
  }
5429
5437
  try {
5430
- const n = fs73.writeSync(this.fd, buf);
5438
+ const n = fs74.writeSync(this.fd, buf);
5431
5439
  buf = buf.subarray(n);
5432
5440
  this._len = Math.max(this._len - n, 0);
5433
5441
  if (buf.length <= 0) {
@@ -5455,13 +5463,13 @@ var require_sonic_boom = __commonJS({
5455
5463
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
5456
5464
  if (this.sync) {
5457
5465
  try {
5458
- const written = Buffer.isBuffer(this._writingBuf) ? fs73.writeSync(this.fd, this._writingBuf) : fs73.writeSync(this.fd, this._writingBuf, "utf8");
5466
+ const written = Buffer.isBuffer(this._writingBuf) ? fs74.writeSync(this.fd, this._writingBuf) : fs74.writeSync(this.fd, this._writingBuf, "utf8");
5459
5467
  release3(null, written);
5460
5468
  } catch (err) {
5461
5469
  release3(err);
5462
5470
  }
5463
5471
  } else {
5464
- fs73.write(this.fd, this._writingBuf, release3);
5472
+ fs74.write(this.fd, this._writingBuf, release3);
5465
5473
  }
5466
5474
  }
5467
5475
  function actualWriteBuffer() {
@@ -5470,7 +5478,7 @@ var require_sonic_boom = __commonJS({
5470
5478
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
5471
5479
  if (this.sync) {
5472
5480
  try {
5473
- const written = fs73.writeSync(this.fd, this._writingBuf);
5481
+ const written = fs74.writeSync(this.fd, this._writingBuf);
5474
5482
  release3(null, written);
5475
5483
  } catch (err) {
5476
5484
  release3(err);
@@ -5479,7 +5487,7 @@ var require_sonic_boom = __commonJS({
5479
5487
  if (kCopyBuffer) {
5480
5488
  this._writingBuf = Buffer.from(this._writingBuf);
5481
5489
  }
5482
- fs73.write(this.fd, this._writingBuf, release3);
5490
+ fs74.write(this.fd, this._writingBuf, release3);
5483
5491
  }
5484
5492
  }
5485
5493
  function actualClose(sonic) {
@@ -5495,12 +5503,12 @@ var require_sonic_boom = __commonJS({
5495
5503
  sonic._lens = [];
5496
5504
  assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
5497
5505
  try {
5498
- fs73.fsync(sonic.fd, closeWrapped);
5506
+ fs74.fsync(sonic.fd, closeWrapped);
5499
5507
  } catch {
5500
5508
  }
5501
5509
  function closeWrapped() {
5502
5510
  if (sonic.fd !== 1 && sonic.fd !== 2) {
5503
- fs73.close(sonic.fd, done);
5511
+ fs74.close(sonic.fd, done);
5504
5512
  } else {
5505
5513
  done();
5506
5514
  }
@@ -5753,7 +5761,7 @@ var require_thread_stream = __commonJS({
5753
5761
  var { version } = require_package();
5754
5762
  var { EventEmitter } = require("events");
5755
5763
  var { Worker } = require("worker_threads");
5756
- var { join: join61 } = require("path");
5764
+ var { join: join62 } = require("path");
5757
5765
  var { pathToFileURL } = require("url");
5758
5766
  var { wait } = require_wait();
5759
5767
  var {
@@ -5804,7 +5812,7 @@ var require_thread_stream = __commonJS({
5804
5812
  function createWorker(stream, opts) {
5805
5813
  const { filename, workerData } = opts;
5806
5814
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
5807
- const toExecute = bundlerOverrides["thread-stream-worker"] || join61(__dirname, "lib", "worker.js");
5815
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join62(__dirname, "lib", "worker.js");
5808
5816
  const worker = new Worker(toExecute, {
5809
5817
  ...opts.workerOpts,
5810
5818
  name: opts.workerOpts?.name || "thread-stream",
@@ -5968,7 +5976,7 @@ var require_thread_stream = __commonJS({
5968
5976
  }
5969
5977
  if (this[kImpl].flushing && this[kImpl].bufLen + dataBuf.length >= MAX_STRING) {
5970
5978
  try {
5971
- writeSync(this);
5979
+ writeSync2(this);
5972
5980
  this[kImpl].flushing = true;
5973
5981
  } catch (err) {
5974
5982
  destroy(this, err);
@@ -5979,7 +5987,7 @@ var require_thread_stream = __commonJS({
5979
5987
  this[kImpl].bufLen += dataBuf.length;
5980
5988
  if (this[kImpl].sync) {
5981
5989
  try {
5982
- writeSync(this);
5990
+ writeSync2(this);
5983
5991
  return true;
5984
5992
  } catch (err) {
5985
5993
  destroy(this, err);
@@ -6014,7 +6022,7 @@ var require_thread_stream = __commonJS({
6014
6022
  if (this[kImpl].destroyed) {
6015
6023
  return;
6016
6024
  }
6017
- writeSync(this);
6025
+ writeSync2(this);
6018
6026
  flushSync(this);
6019
6027
  }
6020
6028
  unref() {
@@ -6218,7 +6226,7 @@ var require_thread_stream = __commonJS({
6218
6226
  destroy(stream, err);
6219
6227
  }
6220
6228
  }
6221
- function writeSync(stream) {
6229
+ function writeSync2(stream) {
6222
6230
  const cb = () => {
6223
6231
  if (stream[kImpl].ending) {
6224
6232
  end(stream);
@@ -6272,7 +6280,7 @@ var require_transport = __commonJS({
6272
6280
  var { createRequire: createRequire2 } = require("module");
6273
6281
  var { existsSync: existsSync55 } = require("fs");
6274
6282
  var getCallers = require_caller();
6275
- var { join: join61, isAbsolute: isAbsolute12, sep: sep5 } = require("path");
6283
+ var { join: join62, isAbsolute: isAbsolute12, sep: sep7 } = require("path");
6276
6284
  var { fileURLToPath: fileURLToPath9 } = require("url");
6277
6285
  var sleep2 = require_atomic_sleep();
6278
6286
  var onExit = require_on_exit_leak_free();
@@ -6336,15 +6344,15 @@ var require_transport = __commonJS({
6336
6344
  if (!unquoted) {
6337
6345
  return false;
6338
6346
  }
6339
- let path81 = unquoted;
6340
- if (path81.startsWith("file://")) {
6347
+ let path82 = unquoted;
6348
+ if (path82.startsWith("file://")) {
6341
6349
  try {
6342
- path81 = fileURLToPath9(path81);
6350
+ path82 = fileURLToPath9(path82);
6343
6351
  } catch {
6344
6352
  return false;
6345
6353
  }
6346
6354
  }
6347
- return isAbsolute12(path81) && !existsSync55(path81);
6355
+ return isAbsolute12(path82) && !existsSync55(path82);
6348
6356
  }
6349
6357
  function stripQuotes(value) {
6350
6358
  const first = value[0];
@@ -6425,7 +6433,7 @@ var require_transport = __commonJS({
6425
6433
  throw new Error("only one of target or targets can be specified");
6426
6434
  }
6427
6435
  if (targets) {
6428
- target = bundlerOverrides["pino-worker"] || join61(__dirname, "worker.js");
6436
+ target = bundlerOverrides["pino-worker"] || join62(__dirname, "worker.js");
6429
6437
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
6430
6438
  return {
6431
6439
  ...dest,
@@ -6443,7 +6451,7 @@ var require_transport = __commonJS({
6443
6451
  });
6444
6452
  });
6445
6453
  } else if (pipeline) {
6446
- target = bundlerOverrides["pino-worker"] || join61(__dirname, "worker.js");
6454
+ target = bundlerOverrides["pino-worker"] || join62(__dirname, "worker.js");
6447
6455
  options.pipelines = [pipeline.map((dest) => {
6448
6456
  return {
6449
6457
  ...dest,
@@ -6466,12 +6474,12 @@ var require_transport = __commonJS({
6466
6474
  return origin;
6467
6475
  }
6468
6476
  if (origin === "pino/file") {
6469
- return join61(__dirname, "..", "file.js");
6477
+ return join62(__dirname, "..", "file.js");
6470
6478
  }
6471
6479
  let fixTarget2;
6472
6480
  for (const filePath of callers) {
6473
6481
  try {
6474
- const context = filePath === "node:repl" ? process.cwd() + sep5 : filePath;
6482
+ const context = filePath === "node:repl" ? process.cwd() + sep7 : filePath;
6475
6483
  fixTarget2 = createRequire2(context).resolve(origin);
6476
6484
  break;
6477
6485
  } catch (err) {
@@ -7447,7 +7455,7 @@ var require_safe_stable_stringify = __commonJS({
7447
7455
  return circularValue;
7448
7456
  }
7449
7457
  let res = "";
7450
- let join61 = ",";
7458
+ let join62 = ",";
7451
7459
  const originalIndentation = indentation;
7452
7460
  if (Array.isArray(value)) {
7453
7461
  if (value.length === 0) {
@@ -7461,7 +7469,7 @@ var require_safe_stable_stringify = __commonJS({
7461
7469
  indentation += spacer;
7462
7470
  res += `
7463
7471
  ${indentation}`;
7464
- join61 = `,
7472
+ join62 = `,
7465
7473
  ${indentation}`;
7466
7474
  }
7467
7475
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -7469,13 +7477,13 @@ ${indentation}`;
7469
7477
  for (; i < maximumValuesToStringify - 1; i++) {
7470
7478
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
7471
7479
  res += tmp2 !== void 0 ? tmp2 : "null";
7472
- res += join61;
7480
+ res += join62;
7473
7481
  }
7474
7482
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
7475
7483
  res += tmp !== void 0 ? tmp : "null";
7476
7484
  if (value.length - 1 > maximumBreadth) {
7477
7485
  const removedKeys = value.length - maximumBreadth - 1;
7478
- res += `${join61}"... ${getItemCount(removedKeys)} not stringified"`;
7486
+ res += `${join62}"... ${getItemCount(removedKeys)} not stringified"`;
7479
7487
  }
7480
7488
  if (spacer !== "") {
7481
7489
  res += `
@@ -7496,7 +7504,7 @@ ${originalIndentation}`;
7496
7504
  let separator = "";
7497
7505
  if (spacer !== "") {
7498
7506
  indentation += spacer;
7499
- join61 = `,
7507
+ join62 = `,
7500
7508
  ${indentation}`;
7501
7509
  whitespace = " ";
7502
7510
  }
@@ -7510,13 +7518,13 @@ ${indentation}`;
7510
7518
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
7511
7519
  if (tmp !== void 0) {
7512
7520
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
7513
- separator = join61;
7521
+ separator = join62;
7514
7522
  }
7515
7523
  }
7516
7524
  if (keyLength > maximumBreadth) {
7517
7525
  const removedKeys = keyLength - maximumBreadth;
7518
7526
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
7519
- separator = join61;
7527
+ separator = join62;
7520
7528
  }
7521
7529
  if (spacer !== "" && separator.length > 1) {
7522
7530
  res = `
@@ -7557,7 +7565,7 @@ ${originalIndentation}`;
7557
7565
  }
7558
7566
  const originalIndentation = indentation;
7559
7567
  let res = "";
7560
- let join61 = ",";
7568
+ let join62 = ",";
7561
7569
  if (Array.isArray(value)) {
7562
7570
  if (value.length === 0) {
7563
7571
  return "[]";
@@ -7570,7 +7578,7 @@ ${originalIndentation}`;
7570
7578
  indentation += spacer;
7571
7579
  res += `
7572
7580
  ${indentation}`;
7573
- join61 = `,
7581
+ join62 = `,
7574
7582
  ${indentation}`;
7575
7583
  }
7576
7584
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -7578,13 +7586,13 @@ ${indentation}`;
7578
7586
  for (; i < maximumValuesToStringify - 1; i++) {
7579
7587
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
7580
7588
  res += tmp2 !== void 0 ? tmp2 : "null";
7581
- res += join61;
7589
+ res += join62;
7582
7590
  }
7583
7591
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
7584
7592
  res += tmp !== void 0 ? tmp : "null";
7585
7593
  if (value.length - 1 > maximumBreadth) {
7586
7594
  const removedKeys = value.length - maximumBreadth - 1;
7587
- res += `${join61}"... ${getItemCount(removedKeys)} not stringified"`;
7595
+ res += `${join62}"... ${getItemCount(removedKeys)} not stringified"`;
7588
7596
  }
7589
7597
  if (spacer !== "") {
7590
7598
  res += `
@@ -7597,7 +7605,7 @@ ${originalIndentation}`;
7597
7605
  let whitespace = "";
7598
7606
  if (spacer !== "") {
7599
7607
  indentation += spacer;
7600
- join61 = `,
7608
+ join62 = `,
7601
7609
  ${indentation}`;
7602
7610
  whitespace = " ";
7603
7611
  }
@@ -7606,7 +7614,7 @@ ${indentation}`;
7606
7614
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
7607
7615
  if (tmp !== void 0) {
7608
7616
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
7609
- separator = join61;
7617
+ separator = join62;
7610
7618
  }
7611
7619
  }
7612
7620
  if (spacer !== "" && separator.length > 1) {
@@ -7664,20 +7672,20 @@ ${originalIndentation}`;
7664
7672
  indentation += spacer;
7665
7673
  let res2 = `
7666
7674
  ${indentation}`;
7667
- const join62 = `,
7675
+ const join63 = `,
7668
7676
  ${indentation}`;
7669
7677
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
7670
7678
  let i = 0;
7671
7679
  for (; i < maximumValuesToStringify - 1; i++) {
7672
7680
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
7673
7681
  res2 += tmp2 !== void 0 ? tmp2 : "null";
7674
- res2 += join62;
7682
+ res2 += join63;
7675
7683
  }
7676
7684
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
7677
7685
  res2 += tmp !== void 0 ? tmp : "null";
7678
7686
  if (value.length - 1 > maximumBreadth) {
7679
7687
  const removedKeys = value.length - maximumBreadth - 1;
7680
- res2 += `${join62}"... ${getItemCount(removedKeys)} not stringified"`;
7688
+ res2 += `${join63}"... ${getItemCount(removedKeys)} not stringified"`;
7681
7689
  }
7682
7690
  res2 += `
7683
7691
  ${originalIndentation}`;
@@ -7693,16 +7701,16 @@ ${originalIndentation}`;
7693
7701
  return '"[Object]"';
7694
7702
  }
7695
7703
  indentation += spacer;
7696
- const join61 = `,
7704
+ const join62 = `,
7697
7705
  ${indentation}`;
7698
7706
  let res = "";
7699
7707
  let separator = "";
7700
7708
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
7701
7709
  if (isTypedArrayWithEntries(value)) {
7702
- res += stringifyTypedArray(value, join61, maximumBreadth);
7710
+ res += stringifyTypedArray(value, join62, maximumBreadth);
7703
7711
  keys = keys.slice(value.length);
7704
7712
  maximumPropertiesToStringify -= value.length;
7705
- separator = join61;
7713
+ separator = join62;
7706
7714
  }
7707
7715
  if (deterministic) {
7708
7716
  keys = sort(keys, comparator);
@@ -7713,13 +7721,13 @@ ${indentation}`;
7713
7721
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
7714
7722
  if (tmp !== void 0) {
7715
7723
  res += `${separator}${strEscape(key2)}: ${tmp}`;
7716
- separator = join61;
7724
+ separator = join62;
7717
7725
  }
7718
7726
  }
7719
7727
  if (keyLength > maximumBreadth) {
7720
7728
  const removedKeys = keyLength - maximumBreadth;
7721
7729
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
7722
- separator = join61;
7730
+ separator = join62;
7723
7731
  }
7724
7732
  if (separator !== "") {
7725
7733
  res = `
@@ -9247,7 +9255,7 @@ var require_postgres_interval = __commonJS({
9247
9255
  if (!(this instanceof PostgresInterval)) {
9248
9256
  return new PostgresInterval(raw);
9249
9257
  }
9250
- extend(this, parse6(raw));
9258
+ extend(this, parse8(raw));
9251
9259
  }
9252
9260
  var properties = ["seconds", "minutes", "hours", "days", "months", "years"];
9253
9261
  PostgresInterval.prototype.toPostgres = function() {
@@ -9308,7 +9316,7 @@ var require_postgres_interval = __commonJS({
9308
9316
  var microseconds = fraction + "000000".slice(fraction.length);
9309
9317
  return parseInt(microseconds, 10) / 1e3;
9310
9318
  }
9311
- function parse6(interval) {
9319
+ function parse8(interval) {
9312
9320
  if (!interval) return {};
9313
9321
  var matches = INTERVAL.exec(interval);
9314
9322
  var isNegative = matches[8] === "-";
@@ -9797,13 +9805,13 @@ var require_binaryParsers = __commonJS({
9797
9805
  console.log("ERROR: ElementType not implemented: " + elementType2);
9798
9806
  }
9799
9807
  };
9800
- var parse6 = function(dimension, elementType2) {
9808
+ var parse8 = function(dimension, elementType2) {
9801
9809
  var array = [];
9802
9810
  var i2;
9803
9811
  if (dimension.length > 1) {
9804
9812
  var count = dimension.shift();
9805
9813
  for (i2 = 0; i2 < count; i2++) {
9806
- array[i2] = parse6(dimension, elementType2);
9814
+ array[i2] = parse8(dimension, elementType2);
9807
9815
  }
9808
9816
  dimension.unshift(count);
9809
9817
  } else {
@@ -9813,7 +9821,7 @@ var require_binaryParsers = __commonJS({
9813
9821
  }
9814
9822
  return array;
9815
9823
  };
9816
- return parse6(dims, elementType);
9824
+ return parse8(dims, elementType);
9817
9825
  };
9818
9826
  var parseText = function(value) {
9819
9827
  return value.toString("utf8");
@@ -10564,7 +10572,7 @@ var require_type_overrides = __commonJS({
10564
10572
  var require_pg_connection_string = __commonJS({
10565
10573
  "node_modules/pg-connection-string/index.js"(exports2, module2) {
10566
10574
  "use strict";
10567
- function parse6(str, options = {}) {
10575
+ function parse8(str, options = {}) {
10568
10576
  if (str.charAt(0) === "/") {
10569
10577
  const config2 = str.split(" ");
10570
10578
  return { host: config2[0], database: config2[1] };
@@ -10620,15 +10628,15 @@ var require_pg_connection_string = __commonJS({
10620
10628
  if (config.sslnegotiation === "direct" && config.ssl === void 0) {
10621
10629
  config.ssl = true;
10622
10630
  }
10623
- const fs73 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
10631
+ const fs74 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
10624
10632
  if (config.sslcert) {
10625
- config.ssl.cert = fs73.readFileSync(config.sslcert).toString();
10633
+ config.ssl.cert = fs74.readFileSync(config.sslcert).toString();
10626
10634
  }
10627
10635
  if (config.sslkey) {
10628
- config.ssl.key = fs73.readFileSync(config.sslkey).toString();
10636
+ config.ssl.key = fs74.readFileSync(config.sslkey).toString();
10629
10637
  }
10630
10638
  if (config.sslrootcert) {
10631
- config.ssl.ca = fs73.readFileSync(config.sslrootcert).toString();
10639
+ config.ssl.ca = fs74.readFileSync(config.sslrootcert).toString();
10632
10640
  }
10633
10641
  if (options.useLibpqCompat && config.uselibpqcompat) {
10634
10642
  throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
@@ -10726,7 +10734,7 @@ var require_pg_connection_string = __commonJS({
10726
10734
  return poolConfig;
10727
10735
  }
10728
10736
  function parseIntoClientConfig(str) {
10729
- return toClientConfig(parse6(str));
10737
+ return toClientConfig(parse8(str));
10730
10738
  }
10731
10739
  function deprecatedSslModeWarning(sslmode) {
10732
10740
  if (!deprecatedSslModeWarning.warned && typeof process !== "undefined" && process.emitWarning) {
@@ -10741,10 +10749,10 @@ To prepare for this change:
10741
10749
  See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`);
10742
10750
  }
10743
10751
  }
10744
- module2.exports = parse6;
10745
- parse6.parse = parse6;
10746
- parse6.toClientConfig = toClientConfig;
10747
- parse6.parseIntoClientConfig = parseIntoClientConfig;
10752
+ module2.exports = parse8;
10753
+ parse8.parse = parse8;
10754
+ parse8.toClientConfig = toClientConfig;
10755
+ parse8.parseIntoClientConfig = parseIntoClientConfig;
10748
10756
  }
10749
10757
  });
10750
10758
 
@@ -10754,7 +10762,7 @@ var require_connection_parameters = __commonJS({
10754
10762
  "use strict";
10755
10763
  var dns = require("dns");
10756
10764
  var defaults2 = require_defaults();
10757
- var parse6 = require_pg_connection_string().parse;
10765
+ var parse8 = require_pg_connection_string().parse;
10758
10766
  var val = function(key, config, envVar) {
10759
10767
  if (config[key]) {
10760
10768
  return config[key];
@@ -10792,9 +10800,9 @@ var require_connection_parameters = __commonJS({
10792
10800
  };
10793
10801
  var ConnectionParameters = class {
10794
10802
  constructor(config) {
10795
- config = typeof config === "string" ? parse6(config) : config || {};
10803
+ config = typeof config === "string" ? parse8(config) : config || {};
10796
10804
  if (config.connectionString) {
10797
- config = Object.assign({}, config, parse6(config.connectionString));
10805
+ config = Object.assign({}, config, parse8(config.connectionString));
10798
10806
  }
10799
10807
  this.user = val("user", config);
10800
10808
  this.database = val("database", config);
@@ -11508,7 +11516,7 @@ var require_serializer = __commonJS({
11508
11516
  );
11509
11517
  };
11510
11518
  var emptyArray = [];
11511
- var parse6 = (query2) => {
11519
+ var parse8 = (query2) => {
11512
11520
  const name = query2.name || "";
11513
11521
  if (name.length > 63) {
11514
11522
  console.error("Warning! Postgres only supports 63 characters for query names.");
@@ -11663,7 +11671,7 @@ var require_serializer = __commonJS({
11663
11671
  sendSASLInitialResponseMessage,
11664
11672
  sendSCRAMClientFinalMessage,
11665
11673
  query,
11666
- parse: parse6,
11674
+ parse: parse8,
11667
11675
  bind,
11668
11676
  execute,
11669
11677
  describe,
@@ -12052,7 +12060,7 @@ var require_dist = __commonJS({
12052
12060
  "use strict";
12053
12061
  Object.defineProperty(exports2, "__esModule", { value: true });
12054
12062
  exports2.DatabaseError = exports2.serialize = void 0;
12055
- exports2.parse = parse6;
12063
+ exports2.parse = parse8;
12056
12064
  var messages_1 = require_messages();
12057
12065
  Object.defineProperty(exports2, "DatabaseError", { enumerable: true, get: function() {
12058
12066
  return messages_1.DatabaseError;
@@ -12062,10 +12070,10 @@ var require_dist = __commonJS({
12062
12070
  return serializer_1.serialize;
12063
12071
  } });
12064
12072
  var parser_1 = require_parser();
12065
- function parse6(stream, callback) {
12073
+ function parse8(stream, callback) {
12066
12074
  const parser2 = new parser_1.Parser();
12067
12075
  stream.on("data", (buffer) => parser2.parse(buffer, callback));
12068
- return new Promise((resolve28) => stream.on("end", () => resolve28()));
12076
+ return new Promise((resolve29) => stream.on("end", () => resolve29()));
12069
12077
  }
12070
12078
  }
12071
12079
  });
@@ -12151,7 +12159,7 @@ var require_connection = __commonJS({
12151
12159
  "node_modules/pg/lib/connection.js"(exports2, module2) {
12152
12160
  "use strict";
12153
12161
  var EventEmitter = require("events").EventEmitter;
12154
- var { parse: parse6, serialize } = require_dist();
12162
+ var { parse: parse8, serialize } = require_dist();
12155
12163
  var stream = require_stream();
12156
12164
  var { getStream } = stream;
12157
12165
  var flushBuffer = serialize.flush();
@@ -12251,7 +12259,7 @@ var require_connection = __commonJS({
12251
12259
  self.emit("sslconnect");
12252
12260
  }
12253
12261
  attachListeners(stream2) {
12254
- parse6(stream2, (msg) => {
12262
+ parse8(stream2, (msg) => {
12255
12263
  const eventName = msg.name === "error" ? "errorMessage" : msg.name;
12256
12264
  if (this._emitMessage) {
12257
12265
  this.emit("message", msg);
@@ -12448,7 +12456,7 @@ var require_split2 = __commonJS({
12448
12456
  var require_helper = __commonJS({
12449
12457
  "node_modules/pgpass/lib/helper.js"(exports2, module2) {
12450
12458
  "use strict";
12451
- var path81 = require("path");
12459
+ var path82 = require("path");
12452
12460
  var Stream = require("stream").Stream;
12453
12461
  var split = require_split2();
12454
12462
  var util = require("util");
@@ -12487,7 +12495,7 @@ var require_helper = __commonJS({
12487
12495
  };
12488
12496
  module2.exports.getFileName = function(rawEnv) {
12489
12497
  var env = rawEnv || process.env;
12490
- var file = env.PGPASSFILE || (isWin ? path81.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path81.join(env.HOME || "./", ".pgpass"));
12498
+ var file = env.PGPASSFILE || (isWin ? path82.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path82.join(env.HOME || "./", ".pgpass"));
12491
12499
  return file;
12492
12500
  };
12493
12501
  module2.exports.usePgPass = function(stats, fname) {
@@ -12619,16 +12627,16 @@ var require_helper = __commonJS({
12619
12627
  var require_lib = __commonJS({
12620
12628
  "node_modules/pgpass/lib/index.js"(exports2, module2) {
12621
12629
  "use strict";
12622
- var path81 = require("path");
12623
- var fs73 = require("fs");
12630
+ var path82 = require("path");
12631
+ var fs74 = require("fs");
12624
12632
  var helper = require_helper();
12625
12633
  module2.exports = function(connInfo, cb) {
12626
12634
  var file = helper.getFileName();
12627
- fs73.stat(file, function(err, stat12) {
12635
+ fs74.stat(file, function(err, stat12) {
12628
12636
  if (err || !helper.usePgPass(stat12, file)) {
12629
12637
  return cb(void 0);
12630
12638
  }
12631
- var st = fs73.createReadStream(file);
12639
+ var st = fs74.createReadStream(file);
12632
12640
  helper.getPassword(connInfo, st, cb);
12633
12641
  });
12634
12642
  };
@@ -12827,12 +12835,12 @@ var require_client = __commonJS({
12827
12835
  this._connect(callback);
12828
12836
  return;
12829
12837
  }
12830
- return new this._Promise((resolve28, reject) => {
12838
+ return new this._Promise((resolve29, reject) => {
12831
12839
  this._connect((error) => {
12832
12840
  if (error) {
12833
12841
  reject(error);
12834
12842
  } else {
12835
- resolve28(this);
12843
+ resolve29(this);
12836
12844
  }
12837
12845
  });
12838
12846
  });
@@ -13179,8 +13187,8 @@ var require_client = __commonJS({
13179
13187
  } else {
13180
13188
  query = new Query2(config, values, callback);
13181
13189
  if (!query.callback) {
13182
- result = new this._Promise((resolve28, reject) => {
13183
- query.callback = (err, res) => err ? reject(err) : resolve28(res);
13190
+ result = new this._Promise((resolve29, reject) => {
13191
+ query.callback = (err, res) => err ? reject(err) : resolve29(res);
13184
13192
  }).catch((err) => {
13185
13193
  Error.captureStackTrace(err);
13186
13194
  throw err;
@@ -13264,8 +13272,8 @@ var require_client = __commonJS({
13264
13272
  if (cb) {
13265
13273
  this.connection.once("end", cb);
13266
13274
  } else {
13267
- return new this._Promise((resolve28) => {
13268
- this.connection.once("end", resolve28);
13275
+ return new this._Promise((resolve29) => {
13276
+ this.connection.once("end", resolve29);
13269
13277
  });
13270
13278
  }
13271
13279
  }
@@ -13314,8 +13322,8 @@ var require_pg_pool = __commonJS({
13314
13322
  const cb = function(err, client) {
13315
13323
  err ? rej(err) : res(client);
13316
13324
  };
13317
- const result = new Promise2(function(resolve28, reject) {
13318
- res = resolve28;
13325
+ const result = new Promise2(function(resolve29, reject) {
13326
+ res = resolve29;
13319
13327
  rej = reject;
13320
13328
  }).catch((err) => {
13321
13329
  Error.captureStackTrace(err);
@@ -13376,7 +13384,7 @@ var require_pg_pool = __commonJS({
13376
13384
  if (typeof Promise2.try === "function") {
13377
13385
  return Promise2.try(f);
13378
13386
  }
13379
- return new Promise2((resolve28) => resolve28(f()));
13387
+ return new Promise2((resolve29) => resolve29(f()));
13380
13388
  }
13381
13389
  _isFull() {
13382
13390
  return this._clients.length >= this.options.max;
@@ -13769,8 +13777,8 @@ var require_query2 = __commonJS({
13769
13777
  NativeQuery.prototype._getPromise = function() {
13770
13778
  if (this._promise) return this._promise;
13771
13779
  this._promise = new Promise(
13772
- function(resolve28, reject) {
13773
- this._once("end", resolve28);
13780
+ function(resolve29, reject) {
13781
+ this._once("end", resolve29);
13774
13782
  this._once("error", reject);
13775
13783
  }.bind(this)
13776
13784
  );
@@ -13948,12 +13956,12 @@ var require_client2 = __commonJS({
13948
13956
  this._connect(callback);
13949
13957
  return;
13950
13958
  }
13951
- return new this._Promise((resolve28, reject) => {
13959
+ return new this._Promise((resolve29, reject) => {
13952
13960
  this._connect((error) => {
13953
13961
  if (error) {
13954
13962
  reject(error);
13955
13963
  } else {
13956
- resolve28(this);
13964
+ resolve29(this);
13957
13965
  }
13958
13966
  });
13959
13967
  });
@@ -13977,8 +13985,8 @@ var require_client2 = __commonJS({
13977
13985
  query = new NativeQuery(config, values, callback);
13978
13986
  if (!query.callback) {
13979
13987
  let resolveOut, rejectOut;
13980
- result = new this._Promise((resolve28, reject) => {
13981
- resolveOut = resolve28;
13988
+ result = new this._Promise((resolve29, reject) => {
13989
+ resolveOut = resolve29;
13982
13990
  rejectOut = reject;
13983
13991
  }).catch((err) => {
13984
13992
  Error.captureStackTrace(err);
@@ -14041,8 +14049,8 @@ var require_client2 = __commonJS({
14041
14049
  }
14042
14050
  let result;
14043
14051
  if (!cb) {
14044
- result = new this._Promise(function(resolve28, reject) {
14045
- cb = (err) => err ? reject(err) : resolve28();
14052
+ result = new this._Promise(function(resolve29, reject) {
14053
+ cb = (err) => err ? reject(err) : resolve29();
14046
14054
  });
14047
14055
  }
14048
14056
  this.native.end(function() {
@@ -14522,7 +14530,7 @@ function loadPolicySnapshot(policyContent, policyPath) {
14522
14530
  }
14523
14531
  return policy;
14524
14532
  }
14525
- function resolvePolicyPath(path81, options = {}) {
14533
+ function resolvePolicyPath(path82, options = {}) {
14526
14534
  const envPath = options.includeEnvironmentOverride === false ? void 0 : process.env[POLICY_PATH_ENV];
14527
14535
  if (envPath) {
14528
14536
  return {
@@ -14532,11 +14540,11 @@ function resolvePolicyPath(path81, options = {}) {
14532
14540
  workspaceRoot: null
14533
14541
  };
14534
14542
  }
14535
- if (path81) {
14543
+ if (path82) {
14536
14544
  return {
14537
- path: (0, import_path4.resolve)(path81),
14545
+ path: (0, import_path4.resolve)(path82),
14538
14546
  source: "argument",
14539
- searchedPaths: [(0, import_path4.resolve)(path81)],
14547
+ searchedPaths: [(0, import_path4.resolve)(path82)],
14540
14548
  workspaceRoot: null
14541
14549
  };
14542
14550
  }
@@ -14579,11 +14587,11 @@ function resolvePolicyPath(path81, options = {}) {
14579
14587
  workspaceRoot
14580
14588
  };
14581
14589
  }
14582
- function loadPolicy(path81, options = {}) {
14583
- if (cachedPolicy && !path81 && options.includeEnvironmentOverride !== false) {
14590
+ function loadPolicy(path82, options = {}) {
14591
+ if (cachedPolicy && !path82 && options.includeEnvironmentOverride !== false) {
14584
14592
  return cachedPolicy;
14585
14593
  }
14586
- const resolution = resolvePolicyPath(path81, options);
14594
+ const resolution = resolvePolicyPath(path82, options);
14587
14595
  try {
14588
14596
  if (!resolution.path) {
14589
14597
  throw new AXErrorException(POLICY_ERROR_CODES.POLICY_NOT_FOUND, `Policy file not found`, [
@@ -14623,7 +14631,7 @@ function loadPolicy(path81, options = {}) {
14623
14631
  throw error;
14624
14632
  }
14625
14633
  const err = error;
14626
- const policyPath = resolution.path || path81 || DEFAULT_POLICY_PATH;
14634
+ const policyPath = resolution.path || path82 || DEFAULT_POLICY_PATH;
14627
14635
  if (err.code === "ENOENT") {
14628
14636
  logger6.error("Policy file not found", {
14629
14637
  operation: "loadPolicy",
@@ -14819,7 +14827,7 @@ async function resolveModulePath(input, options = {}) {
14819
14827
  }
14820
14828
  }
14821
14829
  async function resolveModulePaths(paths, options = {}) {
14822
- const resolutions = await Promise.all(paths.map((path81) => resolveModulePath(path81, options)));
14830
+ const resolutions = await Promise.all(paths.map((path82) => resolveModulePath(path82, options)));
14823
14831
  return resolutions;
14824
14832
  }
14825
14833
  function extractCanonicalIds(resolutions) {
@@ -15767,10 +15775,10 @@ function prompt(question) {
15767
15775
  input: process.stdin,
15768
15776
  output: process.stdout
15769
15777
  });
15770
- return new Promise((resolve28) => {
15778
+ return new Promise((resolve29) => {
15771
15779
  rl.question(question, (answer) => {
15772
15780
  rl.close();
15773
- resolve28(answer.trim());
15781
+ resolve29(answer.trim());
15774
15782
  });
15775
15783
  });
15776
15784
  }
@@ -15984,7 +15992,7 @@ async function terminateProcessTree(child, options = {}) {
15984
15992
  return { method: "taskkill", forceKilled: true, descendantsReaped: reaped };
15985
15993
  }
15986
15994
  const killGroup = options.killGroup ?? process.kill.bind(process);
15987
- const wait = options.wait ?? ((durationMs) => new Promise((resolve28) => setTimeout(resolve28, durationMs)));
15995
+ const wait = options.wait ?? ((durationMs) => new Promise((resolve29) => setTimeout(resolve29, durationMs)));
15988
15996
  const graceMs = options.graceMs ?? 500;
15989
15997
  let method = "process-group";
15990
15998
  try {
@@ -16017,13 +16025,13 @@ function groupExists(pid, killGroup) {
16017
16025
  }
16018
16026
  }
16019
16027
  function runTaskkill(pid) {
16020
- return new Promise((resolve28) => {
16028
+ return new Promise((resolve29) => {
16021
16029
  const killer = (0, import_node_child_process3.spawn)("taskkill", ["/PID", String(pid), "/T", "/F"], {
16022
16030
  stdio: "ignore",
16023
16031
  windowsHide: true
16024
16032
  });
16025
- killer.once("error", () => resolve28(false));
16026
- killer.once("close", (code) => resolve28(code === 0 || code === 128));
16033
+ killer.once("error", () => resolve29(false));
16034
+ killer.once("close", (code) => resolve29(code === 0 || code === 128));
16027
16035
  });
16028
16036
  }
16029
16037
  var import_node_child_process3;
@@ -16724,7 +16732,7 @@ async function executeGate(gate, policy, artifactDir, timeoutMs = 3e4, itemName,
16724
16732
  `\u23F3 Retrying gate '${gate.name}' (attempt ${attempt}/${retryConfig.maxAttempts}) after ${retryConfig.backoffSeconds}s delay...`
16725
16733
  );
16726
16734
  }
16727
- await new Promise((resolve28) => setTimeout(resolve28, delayMs));
16735
+ await new Promise((resolve29) => setTimeout(resolve29, delayMs));
16728
16736
  }
16729
16737
  const result = await executeGateAttempt(
16730
16738
  gate,
@@ -16968,7 +16976,7 @@ async function executeLocalGate(gate, artifactDir, attempt, startedAt, startTime
16968
16976
  candidateDigest
16969
16977
  });
16970
16978
  }
16971
- return new Promise((resolve28) => {
16979
+ return new Promise((resolve29) => {
16972
16980
  let timedOut = false;
16973
16981
  let settled = false;
16974
16982
  const childProcess = (0, import_child_process.spawn)(shellExecutable, shell.arguments, {
@@ -17002,7 +17010,7 @@ async function executeLocalGate(gate, artifactDir, attempt, startedAt, startTime
17002
17010
  const stdoutText = stdout.toString("utf8");
17003
17011
  const stderrText = stderr.toString("utf8");
17004
17012
  const projectedStderr = timedOut ? `GATE_TIMEOUT: exceeded ${timeoutMs}ms; descendantsReaped=${cleanup?.descendantsReaped ?? false}` : stderrText.trim();
17005
- resolve28(
17013
+ resolve29(
17006
17014
  finalizeLocalGateAttempt({
17007
17015
  gate,
17008
17016
  artifactBaselines,
@@ -17045,7 +17053,7 @@ async function executeLocalGate(gate, artifactDir, attempt, startedAt, startTime
17045
17053
  const classified = classifyError(error, `Gate '${gate.name}' process error`);
17046
17054
  console.error(formatErrorForUser(classified));
17047
17055
  const projectedStderr = `${classified.context}: ${error.message}`;
17048
- resolve28(
17056
+ resolve29(
17049
17057
  finalizeLocalGateAttempt({
17050
17058
  gate,
17051
17059
  artifactBaselines,
@@ -17502,13 +17510,13 @@ async function executeGatesWithPolicy(plan, executionState, artifactDir, timeout
17502
17510
  if (promises.length > 0) {
17503
17511
  await Promise.race(promises);
17504
17512
  } else if (executing.size > 0) {
17505
- await new Promise((resolve28) => setTimeout(resolve28, 50));
17513
+ await new Promise((resolve29) => setTimeout(resolve29, 50));
17506
17514
  } else {
17507
17515
  break;
17508
17516
  }
17509
17517
  }
17510
17518
  while (executing.size > 0) {
17511
- await new Promise((resolve28) => setTimeout(resolve28, 50));
17519
+ await new Promise((resolve29) => setTimeout(resolve29, 50));
17512
17520
  }
17513
17521
  }
17514
17522
  function buildExecutionOrder(plan) {
@@ -17610,24 +17618,24 @@ var init_gates = __esm({
17610
17618
  // src/schema/gateReport.ts
17611
17619
  function formatValidationErrors(error) {
17612
17620
  return error.issues.map((issue) => {
17613
- const path81 = issue.path.join(".");
17621
+ const path82 = issue.path.join(".");
17614
17622
  let suggestion;
17615
17623
  if (issue.code === "invalid_type") {
17616
- if (path81 === "started_at") {
17624
+ if (path82 === "started_at") {
17617
17625
  suggestion = 'Use ISO 8601 format: "2024-01-15T10:30:00Z"';
17618
- } else if (path81 === "status") {
17626
+ } else if (path82 === "status") {
17619
17627
  suggestion = 'Valid values: "pass" or "fail"';
17620
- } else if (path81 === "duration_ms") {
17628
+ } else if (path82 === "duration_ms") {
17621
17629
  suggestion = "Must be a non-negative number (milliseconds)";
17622
- } else if (path81 === "item" || path81 === "gate") {
17630
+ } else if (path82 === "item" || path82 === "gate") {
17623
17631
  suggestion = "Must be a non-empty string identifier";
17624
17632
  }
17625
17633
  } else if (issue.code === "invalid_value") {
17626
- if (path81 === "status") {
17634
+ if (path82 === "status") {
17627
17635
  suggestion = 'Valid values: "pass" or "fail"';
17628
17636
  }
17629
17637
  } else if (issue.code === "too_small") {
17630
- if (path81 === "duration_ms") {
17638
+ if (path82 === "duration_ms") {
17631
17639
  suggestion = "Duration must be >= 0 milliseconds";
17632
17640
  }
17633
17641
  } else if (issue.code === "unrecognized_keys") {
@@ -17635,7 +17643,7 @@ function formatValidationErrors(error) {
17635
17643
  suggestion = `Remove unexpected fields: ${keys}`;
17636
17644
  }
17637
17645
  return {
17638
- path: path81 || "root",
17646
+ path: path82 || "root",
17639
17647
  message: issue.message,
17640
17648
  code: issue.code,
17641
17649
  suggestion
@@ -24986,10 +24994,10 @@ var init_emitter2 = __esm({
24986
24994
  await this.ingestSidecar();
24987
24995
  if (this.ndjsonStream) {
24988
24996
  const stream = this.ndjsonStream;
24989
- await new Promise((resolve28, reject) => {
24997
+ await new Promise((resolve29, reject) => {
24990
24998
  stream.end((err) => {
24991
24999
  if (err) reject(err);
24992
- else resolve28();
25000
+ else resolve29();
24993
25001
  });
24994
25002
  });
24995
25003
  this.ndjsonStream = null;
@@ -25770,10 +25778,10 @@ function prompt2(question) {
25770
25778
  input: process.stdin,
25771
25779
  output: process.stdout
25772
25780
  });
25773
- return new Promise((resolve28) => {
25781
+ return new Promise((resolve29) => {
25774
25782
  rl.question(question, (answer) => {
25775
25783
  rl.close();
25776
- resolve28(answer.trim());
25784
+ resolve29(answer.trim());
25777
25785
  });
25778
25786
  });
25779
25787
  }
@@ -26481,10 +26489,10 @@ var init_planViewer = __esm({
26481
26489
  console.log(import_chalk13.default.gray("Navigation: \u2191/\u2193 | Filter: /search | Toggle: d(eps) g(ates) | Quit: q"));
26482
26490
  }
26483
26491
  async start() {
26484
- return new Promise((resolve28) => {
26492
+ return new Promise((resolve29) => {
26485
26493
  if (this.filteredItems.length === 0) {
26486
26494
  console.log(import_chalk13.default.yellow("No items to display"));
26487
- resolve28();
26495
+ resolve29();
26488
26496
  return;
26489
26497
  }
26490
26498
  this.render();
@@ -26495,7 +26503,7 @@ var init_planViewer = __esm({
26495
26503
  const onKeyPress = (str, key) => {
26496
26504
  if (key.name === "q" || key.ctrl && key.name === "c") {
26497
26505
  cleanup();
26498
- resolve28();
26506
+ resolve29();
26499
26507
  return;
26500
26508
  }
26501
26509
  if (key.name === "up") {
@@ -26534,11 +26542,11 @@ var init_planViewer = __esm({
26534
26542
  input: process.stdin,
26535
26543
  output: process.stdout
26536
26544
  });
26537
- return new Promise((resolve28) => {
26545
+ return new Promise((resolve29) => {
26538
26546
  rl.question(import_chalk13.default.yellow("Filter text (Enter to clear): "), (answer) => {
26539
26547
  this.filterText = answer.trim();
26540
26548
  rl.close();
26541
- resolve28();
26549
+ resolve29();
26542
26550
  });
26543
26551
  });
26544
26552
  }
@@ -26602,11 +26610,17 @@ __export(cli_exports, {
26602
26610
  ConfigurationQueryService: () => ConfigurationQueryService,
26603
26611
  ControllerLease_v1: () => ControllerLease_v1,
26604
26612
  DiscoveryQueryService: () => DiscoveryQueryService,
26613
+ EXECUTION_PLAN_ARTIFACT_CONTRACT: () => EXECUTION_PLAN_ARTIFACT_CONTRACT,
26614
+ EXECUTION_PLAN_CANONICALIZATION_PROFILE: () => EXECUTION_PLAN_CANONICALIZATION_PROFILE,
26615
+ EXECUTION_PLAN_HASH_DOMAIN: () => EXECUTION_PLAN_HASH_DOMAIN,
26616
+ EXECUTION_PLAN_HASH_PROFILE: () => EXECUTION_PLAN_HASH_PROFILE,
26605
26617
  EngineVerificationCheckSource_v2: () => EngineVerificationCheckSource_v2,
26606
26618
  EngineVerificationDeterminism_v2: () => EngineVerificationDeterminism_v2,
26607
26619
  EngineVerificationTrustGapReason_v2: () => EngineVerificationTrustGapReason_v2,
26608
26620
  ExecutionEnvelope_v1: () => ExecutionEnvelope_v1,
26609
26621
  ExecutionEnvironmentOS: () => ExecutionEnvironmentOS,
26622
+ ExecutionPlanArtifactIdentity_v1Schema: () => ExecutionPlanArtifactIdentity_v1Schema,
26623
+ ExecutionPlanArtifact_v1Schema: () => ExecutionPlanArtifact_v1Schema,
26610
26624
  ExecutionState: () => ExecutionState,
26611
26625
  ExternalAwaitOutcome_v1: () => ExternalAwaitOutcome_v1,
26612
26626
  ExternalAwaitableDescriptor_v1: () => ExternalAwaitableDescriptor_v1,
@@ -26662,6 +26676,11 @@ __export(cli_exports, {
26662
26676
  NativeWslProjectionSelection_v1: () => NativeWslProjectionSelection_v1,
26663
26677
  NativeWslProjectionStatusRequestJsonSchema: () => NativeWslProjectionStatusRequestJsonSchema,
26664
26678
  NativeWslSourceObservation_v1: () => NativeWslSourceObservation_v1,
26679
+ PLAN_ARTIFACT_REFERENCE_CONTRACT: () => PLAN_ARTIFACT_REFERENCE_CONTRACT,
26680
+ PlanArtifactReference_v1Schema: () => PlanArtifactReference_v1Schema,
26681
+ PlanArtifactRegistrationError: () => PlanArtifactRegistrationError,
26682
+ PlanArtifactRegistrationService: () => PlanArtifactRegistrationService,
26683
+ PlanArtifactScope_v1Schema: () => PlanArtifactScope_v1Schema,
26665
26684
  PlanArtifactService: () => PlanArtifactService,
26666
26685
  PlanArtifactServiceError: () => PlanArtifactServiceError,
26667
26686
  PlanCreationService: () => PlanCreationService,
@@ -26691,6 +26710,7 @@ __export(cli_exports, {
26691
26710
  completionForAttemptAwaitable: () => completionForAttemptAwaitable,
26692
26711
  computeAgentEngineVerificationV2Hash: () => computeAgentEngineVerificationV2Hash,
26693
26712
  computeAgentTaskPacketHash: () => computeAgentTaskPacketHash,
26713
+ computeExecutionPlanArtifactDigest: () => computeExecutionPlanArtifactDigest,
26694
26714
  computeFanInEvidenceSetHash: () => computeFanInEvidenceSetHash,
26695
26715
  computeMergeOrder: () => computeMergeOrder,
26696
26716
  containsAttemptAwaitableCredentialValue: () => containsAttemptAwaitableCredentialValue,
@@ -26773,7 +26793,7 @@ var import_config3 = require("dotenv/config");
26773
26793
  // package.json
26774
26794
  var package_default = {
26775
26795
  name: "@smartergpt/lexrunner",
26776
- version: "2.0.2",
26796
+ version: "2.1.0",
26777
26797
  type: "module",
26778
26798
  engines: {
26779
26799
  node: ">=24"
@@ -26786,10 +26806,10 @@ var package_default = {
26786
26806
  url: "git+https://github.com/Guffawaffle/lexrunner.git"
26787
26807
  },
26788
26808
  publishConfig: {
26789
- access: "restricted",
26809
+ access: "public",
26790
26810
  registry: "https://registry.npmjs.org/"
26791
26811
  },
26792
- license: "SEE LICENSE IN LICENSE.md",
26812
+ license: "Apache-2.0",
26793
26813
  files: [
26794
26814
  "dist/",
26795
26815
  "schemas/",
@@ -26798,7 +26818,9 @@ var package_default = {
26798
26818
  "README.mcp.md",
26799
26819
  "CHANGELOG.md",
26800
26820
  "NOTICE.md",
26801
- "LICENSE.md"
26821
+ "LICENSE.md",
26822
+ "GOVERNANCE.md",
26823
+ "BRAND.md"
26802
26824
  ],
26803
26825
  bin: {
26804
26826
  lexrunner: "dist/cli.js",
@@ -27421,8 +27443,8 @@ function generateSnapshot(plan, inputs) {
27421
27443
  }
27422
27444
  function getPackageVersion() {
27423
27445
  try {
27424
- const fs73 = require("fs");
27425
- const packageJson = JSON.parse(fs73.readFileSync("package.json", "utf8"));
27446
+ const fs74 = require("fs");
27447
+ const packageJson = JSON.parse(fs74.readFileSync("package.json", "utf8"));
27426
27448
  return packageJson.version || "unknown";
27427
27449
  } catch {
27428
27450
  return "unknown";
@@ -28766,10 +28788,10 @@ async function promptGitHubToken() {
28766
28788
  input: process.stdin,
28767
28789
  output: process.stdout
28768
28790
  });
28769
- return new Promise((resolve28) => {
28791
+ return new Promise((resolve29) => {
28770
28792
  rl.question("GitHub token (optional, press Enter to skip): ", (answer) => {
28771
28793
  rl.close();
28772
- resolve28(answer.trim());
28794
+ resolve29(answer.trim());
28773
28795
  });
28774
28796
  });
28775
28797
  }
@@ -29764,8 +29786,8 @@ function containedRegularFile(root, candidate) {
29764
29786
  }
29765
29787
  }
29766
29788
  function isContained(root, candidate) {
29767
- const relative6 = path23.relative(path23.resolve(root), path23.resolve(candidate));
29768
- return relative6 !== ".." && !relative6.startsWith(`..${path23.sep}`) && !path23.isAbsolute(relative6);
29789
+ const relative8 = path23.relative(path23.resolve(root), path23.resolve(candidate));
29790
+ return relative8 !== ".." && !relative8.startsWith(`..${path23.sep}`) && !path23.isAbsolute(relative8);
29769
29791
  }
29770
29792
  function evidenceError(code, message) {
29771
29793
  return new GateEvidenceServiceError(code, message);
@@ -31221,11 +31243,11 @@ function isTestFile(file) {
31221
31243
  }
31222
31244
  function directOwnerCandidates(file) {
31223
31245
  if (!file.startsWith("src/") || !/\.[cm]?tsx?$/.test(file)) return [];
31224
- const relative6 = file.replace(/^src\//, "").replace(/\.[cm]?tsx?$/, "");
31225
- const basename8 = path28.posix.basename(relative6);
31246
+ const relative8 = file.replace(/^src\//, "").replace(/\.[cm]?tsx?$/, "");
31247
+ const basename8 = path28.posix.basename(relative8);
31226
31248
  return [
31227
- `tests/${relative6}.spec.ts`,
31228
- `tests/${relative6}.test.ts`,
31249
+ `tests/${relative8}.spec.ts`,
31250
+ `tests/${relative8}.test.ts`,
31229
31251
  `tests/${basename8}.spec.ts`,
31230
31252
  `tests/${basename8}.test.ts`
31231
31253
  ];
@@ -32452,10 +32474,10 @@ async function readInput(inputPath) {
32452
32474
  }
32453
32475
  return fs34.readFileSync(inputPath, "utf-8");
32454
32476
  } else {
32455
- return new Promise((resolve28, reject) => {
32477
+ return new Promise((resolve29, reject) => {
32456
32478
  const chunks = [];
32457
32479
  process.stdin.on("data", (chunk) => chunks.push(chunk));
32458
- process.stdin.on("end", () => resolve28(Buffer.concat(chunks).toString("utf-8")));
32480
+ process.stdin.on("end", () => resolve29(Buffer.concat(chunks).toString("utf-8")));
32459
32481
  process.stdin.on("error", reject);
32460
32482
  });
32461
32483
  }
@@ -34779,8 +34801,8 @@ Details:`);
34779
34801
  if (opts.json || deps.jsonModeActive()) {
34780
34802
  const output = JSON.stringify(plan, null, 2);
34781
34803
  if (opts.output) {
34782
- const fs73 = await import("fs/promises");
34783
- await fs73.writeFile(opts.output, output, "utf-8");
34804
+ const fs74 = await import("fs/promises");
34805
+ await fs74.writeFile(opts.output, output, "utf-8");
34784
34806
  console.log(`Plan written to: ${opts.output}`);
34785
34807
  } else {
34786
34808
  console.log(output);
@@ -34803,8 +34825,8 @@ Details:`);
34803
34825
  console.log(` ${phase}: ${count}`);
34804
34826
  }
34805
34827
  if (opts.output) {
34806
- const fs73 = await import("fs/promises");
34807
- await fs73.writeFile(opts.output, JSON.stringify(plan, null, 2), "utf-8");
34828
+ const fs74 = await import("fs/promises");
34829
+ await fs74.writeFile(opts.output, JSON.stringify(plan, null, 2), "utf-8");
34808
34830
  console.log(`
34809
34831
  Plan written to: ${opts.output}`);
34810
34832
  }
@@ -35057,8 +35079,8 @@ function registerHarvestCommand(fanoutCommand) {
35057
35079
  });
35058
35080
  const output = JSON.stringify(harvestBundle, null, 2);
35059
35081
  if (opts.output) {
35060
- const fs73 = await import("fs/promises");
35061
- await fs73.writeFile(opts.output, output, "utf-8");
35082
+ const fs74 = await import("fs/promises");
35083
+ await fs74.writeFile(opts.output, output, "utf-8");
35062
35084
  console.error(`\u2713 Harvest bundle written to ${opts.output}`);
35063
35085
  console.error(` ${harvestBundle.bundle.pullRequests.length} PRs`);
35064
35086
  console.error(` ${harvestBundle.bundle.issues.length} issues`);
@@ -35447,10 +35469,10 @@ function analyzeBundle(harvest) {
35447
35469
  function registerAnalyzeCommand(fanoutCommand) {
35448
35470
  fanoutCommand.command("analyze").description("D1: Analyze harvest bundle into facts pool (deterministic)").option("--input <file>", "Path to harvest bundle JSON file (default: stdin)").option("--json", "Output JSON format (default)").option("--output <file>", "Write output to file").action(async (opts) => {
35449
35471
  try {
35450
- const fs73 = await import("fs/promises");
35472
+ const fs74 = await import("fs/promises");
35451
35473
  let content;
35452
35474
  if (opts.input) {
35453
- content = await fs73.readFile(opts.input, "utf-8");
35475
+ content = await fs74.readFile(opts.input, "utf-8");
35454
35476
  } else {
35455
35477
  const chunks = [];
35456
35478
  for await (const chunk of process.stdin) {
@@ -35492,7 +35514,7 @@ function registerAnalyzeCommand(fanoutCommand) {
35492
35514
  const analysisPool = analyzeBundle(harvest);
35493
35515
  const output = JSON.stringify(analysisPool, null, 2);
35494
35516
  if (opts.output) {
35495
- await fs73.writeFile(opts.output, output, "utf-8");
35517
+ await fs74.writeFile(opts.output, output, "utf-8");
35496
35518
  console.error(`\u2713 Analysis pool written to ${opts.output}`);
35497
35519
  console.error(` ${analysisPool.pool.entities.length} entities`);
35498
35520
  console.error(` ${analysisPool.pool.relations.length} relations`);
@@ -35589,9 +35611,9 @@ var DEFAULT_FANOUT_TEMPLATES_PATHS = [
35589
35611
  "fanout-templates.yml"
35590
35612
  ];
35591
35613
  var FanoutTemplatesLoadError = class extends Error {
35592
- constructor(message, path81, cause) {
35614
+ constructor(message, path82, cause) {
35593
35615
  super(message);
35594
- this.path = path81;
35616
+ this.path = path82;
35595
35617
  this.cause = cause;
35596
35618
  this.name = "FanoutTemplatesLoadError";
35597
35619
  }
@@ -35922,7 +35944,7 @@ function registerFanoutCommands(weaveCommand) {
35922
35944
  }
35923
35945
  });
35924
35946
  fanout.command("validate").description("Validate fanout templates file").option("-f, --file <path>", "Path to templates file").action(async (options) => {
35925
- const fs73 = await import("fs/promises");
35947
+ const fs74 = await import("fs/promises");
35926
35948
  try {
35927
35949
  let filePath;
35928
35950
  if (options.file) {
@@ -35935,7 +35957,7 @@ function registerFanoutCommands(weaveCommand) {
35935
35957
  }
35936
35958
  filePath = result2.path;
35937
35959
  }
35938
- const content = await fs73.readFile(filePath, "utf-8");
35960
+ const content = await fs74.readFile(filePath, "utf-8");
35939
35961
  const result = validateFanoutTemplatesContent(content);
35940
35962
  if (result.valid) {
35941
35963
  console.log(`\u2713 Valid: ${filePath}`);
@@ -36935,8 +36957,8 @@ function lastCompletedMergeSha(operations) {
36935
36957
  (operation) => operation.phase === "merge" && operation.status === "completed" && operation.result?.externalId
36936
36958
  )?.result?.externalId;
36937
36959
  }
36938
- function isRunnerStatePath(path81) {
36939
- return path81 === ".lexrunner" || path81.startsWith(".lexrunner/") || path81 === "weave-lock.json" || path81.endsWith("/weave-lock.json");
36960
+ function isRunnerStatePath(path82) {
36961
+ return path82 === ".lexrunner" || path82.startsWith(".lexrunner/") || path82 === "weave-lock.json" || path82.endsWith("/weave-lock.json");
36940
36962
  }
36941
36963
 
36942
36964
  // src/commands/weave.ts
@@ -38056,12 +38078,12 @@ ${prefix} Plan validation failed: ${error.message}`);
38056
38078
  }
38057
38079
  fs43.mkdirSync(outDir, { recursive: true });
38058
38080
  const planPath = path33.join(outDir, "plan.json");
38059
- const snapshotPath = path33.join(outDir, "snapshot.md");
38081
+ const snapshotPath2 = path33.join(outDir, "snapshot.md");
38060
38082
  fs43.writeFileSync(planPath, planJSON);
38061
- fs43.writeFileSync(snapshotPath, snapshot);
38083
+ fs43.writeFileSync(snapshotPath2, snapshot);
38062
38084
  console.log(`\u2713 Generated plan artifacts:`);
38063
38085
  console.log(` \u{1F4C1} ${planPath}`);
38064
- console.log(` \u{1F4C1} ${snapshotPath}`);
38086
+ console.log(` \u{1F4C1} ${snapshotPath2}`);
38065
38087
  console.log("");
38066
38088
  console.log(generatePlanSummary(validatedPlan));
38067
38089
  return;
@@ -40608,7 +40630,7 @@ function generateRecommendations(misBatches, mergeTreeSimulation) {
40608
40630
  // src/orchestration/agentAssigner.ts
40609
40631
  init_errorRecovery();
40610
40632
  function sleep(ms) {
40611
- return new Promise((resolve28) => setTimeout(resolve28, ms));
40633
+ return new Promise((resolve29) => setTimeout(resolve29, ms));
40612
40634
  }
40613
40635
  async function assignAgentWithRetry(issueNumber, repo, assignFn, maxRetries = 4) {
40614
40636
  let retries = 0;
@@ -41229,8 +41251,8 @@ function registerGenerateDeliverablesCommand(program2) {
41229
41251
  console.log(`\u2705 Created: ${path45.join(outputDir, "GATE5_cleanup.md")}`);
41230
41252
  console.log(`\u2705 Created: ${path45.join(outputDir, "SUMMARY.md")}`);
41231
41253
  console.log("");
41232
- const fs73 = await import("fs");
41233
- const planHashContent = fs73.readFileSync(path45.join(outputDir, "plan-hash.txt"), "utf-8");
41254
+ const fs74 = await import("fs");
41255
+ const planHashContent = fs74.readFileSync(path45.join(outputDir, "plan-hash.txt"), "utf-8");
41234
41256
  const planHashMatch = planHashContent.match(/SHA256: ([a-f0-9]+)/);
41235
41257
  if (planHashMatch) {
41236
41258
  console.log(`Plan hash: ${planHashMatch[1]}`);
@@ -43252,9 +43274,9 @@ async function promptInteractive(defaults2) {
43252
43274
  output: process.stdout
43253
43275
  });
43254
43276
  const question = (prompt3) => {
43255
- return new Promise((resolve28) => {
43277
+ return new Promise((resolve29) => {
43256
43278
  rl.question(prompt3, (answer) => {
43257
- resolve28(answer.trim());
43279
+ resolve29(answer.trim());
43258
43280
  });
43259
43281
  });
43260
43282
  };
@@ -45116,8 +45138,8 @@ Total: ${entries.length} counter-examples (${entries.filter((e) => e.shouldLearn
45116
45138
  counterExamples.command("export").description("Export counter-examples for analysis").option("--format <format>", "Export format (json|csv)", "json").option("--base-dir <dir>", "Base directory for lexrunner", process.cwd()).option("--output <file>", "Output file (prints to stdout if not specified)").action(async (options) => {
45117
45139
  const output = exportCounterExamples(options.format, options.baseDir);
45118
45140
  if (options.output) {
45119
- const fs73 = await import("fs");
45120
- fs73.writeFileSync(options.output, output, "utf-8");
45141
+ const fs74 = await import("fs");
45142
+ fs74.writeFileSync(options.output, output, "utf-8");
45121
45143
  console.log(import_chalk11.default.green(`\u2713 Exported counter-examples to ${options.output}`));
45122
45144
  } else {
45123
45145
  console.log(output);
@@ -45688,7 +45710,7 @@ function nativePathsOverlap(runtimePlatform, left, right, comparison) {
45688
45710
  if (api.parse(normalizedLeft).root !== api.parse(normalizedRight).root) return false;
45689
45711
  const relativeLeft = api.relative(normalizedLeft, normalizedRight);
45690
45712
  const relativeRight = api.relative(normalizedRight, normalizedLeft);
45691
- const isDescendant = (relative6) => relative6.length > 0 && relative6 !== ".." && !relative6.startsWith(`..${api.sep}`);
45713
+ const isDescendant = (relative8) => relative8.length > 0 && relative8 !== ".." && !relative8.startsWith(`..${api.sep}`);
45692
45714
  return isDescendant(relativeLeft) || isDescendant(relativeRight);
45693
45715
  }
45694
45716
  function digestBinding(runtime) {
@@ -47028,8 +47050,8 @@ function parseGitStatusPorcelainV1Z(input) {
47028
47050
  }
47029
47051
  const indexStatus = field[0];
47030
47052
  const worktreeStatus = field[1];
47031
- const path81 = field.slice(3);
47032
- if (path81.length === 0) {
47053
+ const path82 = field.slice(3);
47054
+ if (path82.length === 0) {
47033
47055
  throw new Error("Malformed git status porcelain: path is empty");
47034
47056
  }
47035
47057
  const renameOrCopy = [indexStatus, worktreeStatus].find(
@@ -47047,7 +47069,7 @@ function parseGitStatusPorcelainV1Z(input) {
47047
47069
  records.push({
47048
47070
  indexStatus,
47049
47071
  worktreeStatus,
47050
- path: path81,
47072
+ path: path82,
47051
47073
  ...originalPath === void 0 ? {} : { originalPath },
47052
47074
  kind
47053
47075
  });
@@ -47500,8 +47522,8 @@ function copyIssues(result, context) {
47500
47522
  context.addIssue({ code: "custom", path: issue.path, message: issue.message });
47501
47523
  }
47502
47524
  }
47503
- function addIssue(context, path81, message) {
47504
- context.addIssue({ code: "custom", path: path81, message });
47525
+ function addIssue(context, path82, message) {
47526
+ context.addIssue({ code: "custom", path: path82, message });
47505
47527
  }
47506
47528
 
47507
47529
  // src/workspaces/linux-workspace-boundary.ts
@@ -48542,8 +48564,8 @@ var NodeGitWorktreeBroker = class {
48542
48564
  "The worktree root was replaced after broker initialization"
48543
48565
  );
48544
48566
  }
48545
- const relative6 = import_node_path19.default.relative(this.worktreeRoot, import_node_path19.default.resolve(target.worktreePath));
48546
- const components = relative6.split(import_node_path19.default.sep);
48567
+ const relative8 = import_node_path19.default.relative(this.worktreeRoot, import_node_path19.default.resolve(target.worktreePath));
48568
+ const components = relative8.split(import_node_path19.default.sep);
48547
48569
  const targetName = components.pop();
48548
48570
  if (!targetName) {
48549
48571
  throw new DirectoryBoundaryError("invalid_path", "The worktree target has no basename");
@@ -48747,8 +48769,8 @@ var NodeGitWorktreeBroker = class {
48747
48769
  );
48748
48770
  }
48749
48771
  const normalized = import_node_path19.default.resolve(gitDirectoryPath);
48750
- const relative6 = import_node_path19.default.relative(this.repositoryGitIdentity.path, normalized);
48751
- if (!relative6 || relative6 === ".." || relative6.startsWith(`..${import_node_path19.default.sep}`)) {
48772
+ const relative8 = import_node_path19.default.relative(this.repositoryGitIdentity.path, normalized);
48773
+ if (!relative8 || relative8 === ".." || relative8.startsWith(`..${import_node_path19.default.sep}`)) {
48752
48774
  return this.failure(
48753
48775
  operation,
48754
48776
  "containment_violation",
@@ -48757,7 +48779,7 @@ var NodeGitWorktreeBroker = class {
48757
48779
  }
48758
48780
  let current = null;
48759
48781
  try {
48760
- for (const component of relative6.split(import_node_path19.default.sep)) {
48782
+ for (const component of relative8.split(import_node_path19.default.sep)) {
48761
48783
  const child = await boundary.lease.openChild(
48762
48784
  current ?? boundary.repositoryGit,
48763
48785
  component,
@@ -48811,8 +48833,8 @@ var NodeGitWorktreeBroker = class {
48811
48833
  const normalizedRoot = import_node_path19.default.resolve(root);
48812
48834
  const comparedCandidate = this.pathComparison === "case-insensitive" ? normalizedCandidate.toLocaleLowerCase("en-US") : normalizedCandidate;
48813
48835
  const comparedRoot = this.pathComparison === "case-insensitive" ? normalizedRoot.toLocaleLowerCase("en-US") : normalizedRoot;
48814
- const relative6 = import_node_path19.default.relative(comparedRoot, comparedCandidate);
48815
- return relative6.length > 0 && relative6 !== ".." && !relative6.startsWith(`..${import_node_path19.default.sep}`);
48836
+ const relative8 = import_node_path19.default.relative(comparedRoot, comparedCandidate);
48837
+ return relative8.length > 0 && relative8 !== ".." && !relative8.startsWith(`..${import_node_path19.default.sep}`);
48816
48838
  }
48817
48839
  async git(boundary, operation, args, cwd, options, allowedNonzeroExitCodes = [], evidence) {
48818
48840
  const result = await boundary.lease.runProcess({
@@ -48917,7 +48939,7 @@ function nativePathsOverlap2(left, right, comparison) {
48917
48939
  if (normalizedLeft === normalizedRight) return true;
48918
48940
  const relativeLeft = import_node_path19.default.relative(normalizedLeft, normalizedRight);
48919
48941
  const relativeRight = import_node_path19.default.relative(normalizedRight, normalizedLeft);
48920
- const isDescendant = (relative6) => relative6.length > 0 && relative6 !== ".." && !relative6.startsWith(`..${import_node_path19.default.sep}`);
48942
+ const isDescendant = (relative8) => relative8.length > 0 && relative8 !== ".." && !relative8.startsWith(`..${import_node_path19.default.sep}`);
48921
48943
  return isDescendant(relativeLeft) || isDescendant(relativeRight);
48922
48944
  }
48923
48945
  function branchName(ref) {
@@ -51458,24 +51480,24 @@ var AcceptanceCriterion = import_zod39.z.object({
51458
51480
  function isMachineLocalAbsolutePath(value) {
51459
51481
  return /(?:^|\s)\/(?!\/)[^\s]*/.test(value) || /(?:^|\s)~\/[^\s]*/.test(value) || /(?:^|\s)\\\\[^\s]*/.test(value) || /(?:^|\s)[a-z]:[\\/][^\s]*/i.test(value) || /(?:^|\s)file:/i.test(value);
51460
51482
  }
51461
- function rejectMachineLocalPaths(value, ctx, path81 = []) {
51483
+ function rejectMachineLocalPaths(value, ctx, path82 = []) {
51462
51484
  if (typeof value === "string") {
51463
51485
  if (isMachineLocalAbsolutePath(value)) {
51464
51486
  ctx.addIssue({
51465
51487
  code: "custom",
51466
- path: path81,
51488
+ path: path82,
51467
51489
  message: "AgentTaskPacket_v1 must not contain machine-local absolute paths"
51468
51490
  });
51469
51491
  }
51470
51492
  return;
51471
51493
  }
51472
51494
  if (Array.isArray(value)) {
51473
- value.forEach((item, index) => rejectMachineLocalPaths(item, ctx, [...path81, index]));
51495
+ value.forEach((item, index) => rejectMachineLocalPaths(item, ctx, [...path82, index]));
51474
51496
  return;
51475
51497
  }
51476
51498
  if (value !== null && typeof value === "object") {
51477
51499
  for (const [key, item] of Object.entries(value)) {
51478
- rejectMachineLocalPaths(item, ctx, [...path81, key]);
51500
+ rejectMachineLocalPaths(item, ctx, [...path82, key]);
51479
51501
  }
51480
51502
  }
51481
51503
  }
@@ -53655,10 +53677,10 @@ function captureBoundIdentities(input) {
53655
53677
  worktree: captureDirectoryIdentity(input.worktreePath, "execution mapping worktree")
53656
53678
  };
53657
53679
  }
53658
- function verifiedRoot(runtimeId, path81, identity) {
53680
+ function verifiedRoot(runtimeId, path82, identity) {
53659
53681
  return {
53660
53682
  runtime_id: runtimeId,
53661
- path: path81,
53683
+ path: path82,
53662
53684
  verification: "directory_identity",
53663
53685
  directory_identity: identityClaim2(identity)
53664
53686
  };
@@ -53777,8 +53799,8 @@ async function requireDirectoryWithin(directory, root, field) {
53777
53799
  (0, import_promises8.realpath)(directory),
53778
53800
  (0, import_promises8.realpath)(root)
53779
53801
  ]);
53780
- const relative6 = import_node_path21.default.relative(resolvedRoot, resolvedDirectory);
53781
- if (relative6 === ".." || relative6.startsWith(`..${import_node_path21.default.sep}`) || import_node_path21.default.isAbsolute(relative6)) {
53802
+ const relative8 = import_node_path21.default.relative(resolvedRoot, resolvedDirectory);
53803
+ if (relative8 === ".." || relative8.startsWith(`..${import_node_path21.default.sep}`) || import_node_path21.default.isAbsolute(relative8)) {
53782
53804
  throw new Error(`${field} must resolve within its authorized root`);
53783
53805
  }
53784
53806
  }
@@ -58977,8 +58999,8 @@ async function requireDirectoryWithin2(directory, root, field) {
58977
58999
  (0, import_promises9.realpath)(directory),
58978
59000
  (0, import_promises9.realpath)(root)
58979
59001
  ]);
58980
- const relative6 = import_node_path22.default.relative(resolvedRoot, resolvedDirectory);
58981
- if (relative6 === ".." || relative6.startsWith(`..${import_node_path22.default.sep}`) || import_node_path22.default.isAbsolute(relative6)) {
59002
+ const relative8 = import_node_path22.default.relative(resolvedRoot, resolvedDirectory);
59003
+ if (relative8 === ".." || relative8.startsWith(`..${import_node_path22.default.sep}`) || import_node_path22.default.isAbsolute(relative8)) {
58982
59004
  throw new Error(`${field} must resolve within the authorized worktree`);
58983
59005
  }
58984
59006
  }
@@ -61762,10 +61784,10 @@ var WorkerSessionDelegationBinding_v1 = import_zod49.z.object({
61762
61784
  function decisionReceiptMatchesOffer(receipt, offer, offerHash) {
61763
61785
  return receipt.delegation_id === offer.delegation_id && receipt.attempt_id === offer.attempt_id && receipt.offer_hash === offerHash && receipt.worker_thread_id === offer.worker.thread_id && receipt.transcript_start_hash === offer.transcript_start_hash && Date.parse(receipt.decided_at) >= Date.parse(offer.offered_at);
61764
61786
  }
61765
- function requireTimeOrder(earlier, later, path81, context, equalAllowed = true) {
61787
+ function requireTimeOrder(earlier, later, path82, context, equalAllowed = true) {
61766
61788
  const ordered = equalAllowed ? Date.parse(earlier) <= Date.parse(later) : Date.parse(earlier) < Date.parse(later);
61767
61789
  if (!ordered) {
61768
- context.addIssue({ code: "custom", path: [path81], message: `${path81} is out of order` });
61790
+ context.addIssue({ code: "custom", path: [path82], message: `${path82} is out of order` });
61769
61791
  }
61770
61792
  }
61771
61793
 
@@ -62882,12 +62904,12 @@ function grantWithinRequirements(grant, requirements) {
62882
62904
  );
62883
62905
  return grant.authorized_model_provider === requirements.authorized_model_provider && grant.source_disclosure_allowed === requirements.source_disclosure_allowed && grant.max_duration_ms <= requirements.max_duration_ms && grant.max_output_bytes <= requirements.max_output_bytes && grant.controls.every((control) => required2.get(control.control) === control.minimum_strength) && grant.tools.length <= 1;
62884
62906
  }
62885
- function requireExactControls(controls, context, path81) {
62907
+ function requireExactControls(controls, context, path82) {
62886
62908
  const actual = new Set(controls.map((control) => control.control));
62887
62909
  if (actual.size !== GovernedControlId.options.length || GovernedControlId.options.some((control) => !actual.has(control))) {
62888
62910
  context.addIssue({
62889
62911
  code: "custom",
62890
- path: path81,
62912
+ path: path82,
62891
62913
  message: "every governed denial control must appear exactly once"
62892
62914
  });
62893
62915
  }
@@ -63846,10 +63868,10 @@ function requireAbsent(value, fields, context) {
63846
63868
  function addStateIssue(message, context) {
63847
63869
  context.addIssue({ code: "custom", path: ["status"], message });
63848
63870
  }
63849
- function requireOrdered(earlier, later, path81, context, equalAllowed = true) {
63871
+ function requireOrdered(earlier, later, path82, context, equalAllowed = true) {
63850
63872
  const ordered = equalAllowed ? Date.parse(earlier) <= Date.parse(later) : Date.parse(earlier) < Date.parse(later);
63851
63873
  if (!ordered) {
63852
- context.addIssue({ code: "custom", path: [path81], message: `${path81} is out of order` });
63874
+ context.addIssue({ code: "custom", path: [path82], message: `${path82} is out of order` });
63853
63875
  }
63854
63876
  }
63855
63877
 
@@ -65573,8 +65595,8 @@ function normalizeInstant4(value) {
65573
65595
  return new Date(timestamp).toISOString();
65574
65596
  }
65575
65597
  function assertDescendant(parent, candidate) {
65576
- const relative6 = import_node_path31.default.relative(import_node_path31.default.resolve(parent), import_node_path31.default.resolve(candidate));
65577
- if (relative6.startsWith("..") || import_node_path31.default.isAbsolute(relative6)) {
65598
+ const relative8 = import_node_path31.default.relative(import_node_path31.default.resolve(parent), import_node_path31.default.resolve(candidate));
65599
+ if (relative8.startsWith("..") || import_node_path31.default.isAbsolute(relative8)) {
65578
65600
  throw new LocalProtectedEvidenceVerificationError("container_invalid");
65579
65601
  }
65580
65602
  }
@@ -65729,14 +65751,14 @@ var WindowsProtectedEvidenceAuthority = class {
65729
65751
  this.child = null;
65730
65752
  child?.stdin.end();
65731
65753
  if (child && child.exitCode === null) {
65732
- await new Promise((resolve28) => {
65754
+ await new Promise((resolve29) => {
65733
65755
  const timeout = setTimeout(() => {
65734
65756
  child.kill();
65735
- resolve28();
65757
+ resolve29();
65736
65758
  }, 5e3);
65737
65759
  child.once("close", () => {
65738
65760
  clearTimeout(timeout);
65739
- resolve28();
65761
+ resolve29();
65740
65762
  });
65741
65763
  });
65742
65764
  }
@@ -65747,8 +65769,8 @@ var WindowsProtectedEvidenceAuthority = class {
65747
65769
  const child = this.ensureChild();
65748
65770
  const id = this.nextId;
65749
65771
  this.nextId += 1;
65750
- return new Promise((resolve28, reject) => {
65751
- this.pending.set(id, { resolve: resolve28, reject });
65772
+ return new Promise((resolve29, reject) => {
65773
+ this.pending.set(id, { resolve: resolve29, reject });
65752
65774
  child.stdin.write(`${JSON.stringify({ id, op: operation, path: target })}
65753
65775
  `, (error) => {
65754
65776
  if (!error) return;
@@ -66404,7 +66426,7 @@ var repositoryCorpusHeaderBody = import_zod61.z.object({
66404
66426
  var GovernedRepositoryCorpusHeader_v1 = repositoryCorpusHeaderBody.superRefine(
66405
66427
  (value, context) => {
66406
66428
  const paths = value.entries.map((entry) => entry.path);
66407
- if (new Set(paths).size !== paths.length || paths.some((path81, index) => index > 0 && path81 <= paths[index - 1])) {
66429
+ if (new Set(paths).size !== paths.length || paths.some((path82, index) => index > 0 && path82 <= paths[index - 1])) {
66408
66430
  context.addIssue({
66409
66431
  code: "custom",
66410
66432
  path: ["entries"],
@@ -66831,7 +66853,7 @@ function sanitizedWslEnvironment() {
66831
66853
  return environment;
66832
66854
  }
66833
66855
  function waitForExit(child, timeoutMs) {
66834
- return new Promise((resolve28, reject) => {
66856
+ return new Promise((resolve29, reject) => {
66835
66857
  const timeout = setTimeout(() => {
66836
66858
  child.kill();
66837
66859
  reject(new Error("WSL2 provider control request timed out"));
@@ -66842,7 +66864,7 @@ function waitForExit(child, timeoutMs) {
66842
66864
  });
66843
66865
  child.once("close", (code) => {
66844
66866
  clearTimeout(timeout);
66845
- resolve28(code);
66867
+ resolve29(code);
66846
66868
  });
66847
66869
  });
66848
66870
  }
@@ -67951,8 +67973,8 @@ var LocalProtectedEvidenceStore = class {
67951
67973
  exclusive(operation) {
67952
67974
  const previous = this.queue;
67953
67975
  let release3;
67954
- this.queue = new Promise((resolve28) => {
67955
- release3 = resolve28;
67976
+ this.queue = new Promise((resolve29) => {
67977
+ release3 = resolve29;
67956
67978
  });
67957
67979
  return previous.then(operation).finally(release3);
67958
67980
  }
@@ -68115,8 +68137,8 @@ function sameToken(expected, candidate) {
68115
68137
  return left.length === right.length && (0, import_node_crypto36.timingSafeEqual)(left, right);
68116
68138
  }
68117
68139
  function assertDescendant2(root, candidate) {
68118
- const relative6 = import_node_path35.default.relative(root, candidate);
68119
- if (!relative6 || relative6.startsWith("..") || import_node_path35.default.isAbsolute(relative6)) {
68140
+ const relative8 = import_node_path35.default.relative(root, candidate);
68141
+ if (!relative8 || relative8.startsWith("..") || import_node_path35.default.isAbsolute(relative8)) {
68120
68142
  throw new Error("protected evidence deletion target escaped its root");
68121
68143
  }
68122
68144
  }
@@ -68965,11 +68987,11 @@ async function launchDetachedSupervisor(input) {
68965
68987
  env: sanitizedSupervisorEnvironment()
68966
68988
  }
68967
68989
  );
68968
- return await new Promise((resolve28) => {
68969
- child.once("error", () => resolve28(false));
68990
+ return await new Promise((resolve29) => {
68991
+ child.once("error", () => resolve29(false));
68970
68992
  child.once("spawn", () => {
68971
68993
  child.unref();
68972
- resolve28(true);
68994
+ resolve29(true);
68973
68995
  });
68974
68996
  });
68975
68997
  } catch {
@@ -69719,10 +69741,10 @@ function commandPath(command) {
69719
69741
  }
69720
69742
  return components.join(" ");
69721
69743
  }
69722
- function aliasWarning(path81) {
69723
- const policy = POLICY_BY_PATH.get(path81);
69744
+ function aliasWarning(path82) {
69745
+ const policy = POLICY_BY_PATH.get(path82);
69724
69746
  if (!policy) return null;
69725
- return policy.disposition === "deprecated" ? `[lexrunner] deprecated alias "${path81}"; use "${policy.replacement}"; removal: ${policy.removeIn}.` : `[lexrunner] compatibility alias "${path81}"; use "${policy.replacement}"; supported through 2.x and reviewed at 3.0.0.`;
69747
+ return policy.disposition === "deprecated" ? `[lexrunner] deprecated alias "${path82}"; use "${policy.replacement}"; removal: ${policy.removeIn}.` : `[lexrunner] compatibility alias "${path82}"; use "${policy.replacement}"; supported through 2.x and reviewed at 3.0.0.`;
69726
69748
  }
69727
69749
  function emitAliasWarning(command, write = (message) => process.stderr.write(message)) {
69728
69750
  const warning = aliasWarning(commandPath(command));
@@ -69831,8 +69853,8 @@ async function searchAttributions(query, runId) {
69831
69853
  // src/cli.ts
69832
69854
  init_controller();
69833
69855
  init_audit();
69834
- var fs72 = __toESM(require("fs"), 1);
69835
- var path80 = __toESM(require("path"), 1);
69856
+ var fs73 = __toESM(require("fs"), 1);
69857
+ var path81 = __toESM(require("path"), 1);
69836
69858
 
69837
69859
  // src/runs/enforcement.ts
69838
69860
  var import_zod65 = require("zod");
@@ -71267,8 +71289,8 @@ async function executeAgentWorkPreparation(input) {
71267
71289
  function passed(results, id) {
71268
71290
  return results.some((result) => result.id === id && result.outcome === "passed");
71269
71291
  }
71270
- async function containedExistingDirectory(root, relative6) {
71271
- const candidate = relative6 ? import_node_path38.default.resolve(root, relative6) : root;
71292
+ async function containedExistingDirectory(root, relative8) {
71293
+ const candidate = relative8 ? import_node_path38.default.resolve(root, relative8) : root;
71272
71294
  const resolved = await (0, import_promises21.realpath)(candidate);
71273
71295
  const relation = import_node_path38.default.relative(root, resolved);
71274
71296
  if (relation === ".." || relation.startsWith(`..${import_node_path38.default.sep}`) || import_node_path38.default.isAbsolute(relation)) {
@@ -71352,7 +71374,7 @@ var workspaceFilesystemEntry = import_zod69.z.discriminatedUnion("kind", [
71352
71374
  }).strict()
71353
71375
  ]);
71354
71376
  function requireStrictlyOrderedPaths(values, context, field) {
71355
- if (values.some(({ path: path81 }, index) => index > 0 && path81 <= values[index - 1].path)) {
71377
+ if (values.some(({ path: path82 }, index) => index > 0 && path82 <= values[index - 1].path)) {
71356
71378
  context.addIssue({
71357
71379
  code: "custom",
71358
71380
  path: [field],
@@ -71372,7 +71394,7 @@ var completeGitIdentity = import_zod69.z.object({
71372
71394
  kind: import_zod69.z.enum(["absent", "present"]),
71373
71395
  paths: import_zod69.z.array(boundedRelativePath).max(4096)
71374
71396
  }).strict().superRefine((identity, context) => {
71375
- if (identity.paths.some((path81, index) => index > 0 && path81 <= identity.paths[index - 1]) || identity.kind === "absent" && identity.paths.length !== 0 || identity.kind === "present" && identity.paths.length === 0) {
71397
+ if (identity.paths.some((path82, index) => index > 0 && path82 <= identity.paths[index - 1]) || identity.kind === "absent" && identity.paths.length !== 0 || identity.kind === "present" && identity.paths.length === 0) {
71376
71398
  context.addIssue({
71377
71399
  code: "custom",
71378
71400
  path: ["paths"],
@@ -71682,7 +71704,7 @@ var GovernedWorkspaceMutationRecoveryReceipt_v1 = import_zod69.z.object({
71682
71704
  });
71683
71705
  }
71684
71706
  if (receipt.changed_paths.some(
71685
- (path81, index) => index > 0 && path81 <= receipt.changed_paths[index - 1]
71707
+ (path82, index) => index > 0 && path82 <= receipt.changed_paths[index - 1]
71686
71708
  )) {
71687
71709
  context.addIssue({
71688
71710
  code: "custom",
@@ -72519,15 +72541,15 @@ var AttemptAwaitableSupervisor = class {
72519
72541
  0,
72520
72542
  Date.parse(record.observer_lease.expires_at) - Date.parse(this.now()) + 1
72521
72543
  );
72522
- let resolve28;
72544
+ let resolve29;
72523
72545
  const completion = new Promise((resolvePromise) => {
72524
- resolve28 = resolvePromise;
72546
+ resolve29 = resolvePromise;
72525
72547
  });
72526
72548
  const timer = setTimeout(() => {
72527
72549
  this.leaseExpiryWakeups.delete(record.awaitable_id);
72528
- void this.attach(record.awaitable_id).finally(resolve28);
72550
+ void this.attach(record.awaitable_id).finally(resolve29);
72529
72551
  }, delayMs);
72530
- this.leaseExpiryWakeups.set(record.awaitable_id, { timer, completion, resolve: resolve28 });
72552
+ this.leaseExpiryWakeups.set(record.awaitable_id, { timer, completion, resolve: resolve29 });
72531
72553
  }
72532
72554
  clearLeaseExpiryWakeup(awaitableId) {
72533
72555
  const wakeup = this.leaseExpiryWakeups.get(awaitableId);
@@ -72632,14 +72654,14 @@ function normalizeRetryDelay(value, name) {
72632
72654
  }
72633
72655
  function waitForRetry(delayMs, signal) {
72634
72656
  if (signal.aborted) return Promise.resolve(false);
72635
- return new Promise((resolve28) => {
72657
+ return new Promise((resolve29) => {
72636
72658
  const timer = setTimeout(() => {
72637
72659
  signal.removeEventListener("abort", onAbort);
72638
- resolve28(true);
72660
+ resolve29(true);
72639
72661
  }, delayMs);
72640
72662
  const onAbort = () => {
72641
72663
  clearTimeout(timer);
72642
- resolve28(false);
72664
+ resolve29(false);
72643
72665
  };
72644
72666
  signal.addEventListener("abort", onAbort, { once: true });
72645
72667
  });
@@ -76179,11 +76201,141 @@ init_fileAnalysis();
76179
76201
  // src/application/plan-artifact-service.ts
76180
76202
  var fs71 = __toESM(require("fs"), 1);
76181
76203
  var path79 = __toESM(require("path"), 1);
76204
+ var import_node_util2 = require("util");
76182
76205
  init_profileResolver();
76183
76206
  init_schema2();
76184
76207
  init_task_contract();
76185
- var MAX_PLAN_REFERENCE_BYTES = 4096;
76186
- var MAX_PLAN_BYTES = 4 * 1024 * 1024;
76208
+ init_canonicalJson();
76209
+
76210
+ // src/application/execution-plan-artifact.ts
76211
+ var import_node_crypto40 = require("crypto");
76212
+ var import_zod74 = require("zod");
76213
+ init_schema2();
76214
+ init_canonicalJson();
76215
+ var EXECUTION_PLAN_ARTIFACT_CONTRACT = "lexrunner.execution-plan-artifact.v1";
76216
+ var PLAN_ARTIFACT_REFERENCE_CONTRACT = "lexrunner.plan-artifact-reference.v1";
76217
+ var EXECUTION_PLAN_CANONICALIZATION_PROFILE = "lexrunner.execution-plan.canonical-json.v1";
76218
+ var EXECUTION_PLAN_HASH_PROFILE = "lexrunner.execution-plan-artifact.sha256.v1";
76219
+ var EXECUTION_PLAN_HASH_DOMAIN = "lexrunner:execution-plan-artifact:v1\0";
76220
+ var MAX_PLAN_ARTIFACT_BYTES = 4 * 1024 * 1024;
76221
+ var MAX_PLAN_RETRIEVAL_REFERENCE_BYTES = 4096;
76222
+ var MAX_SCOPE_LABEL_BYTES = 512;
76223
+ var Sha256Digest = import_zod74.z.string().regex(/^sha256:[a-f0-9]{64}$/);
76224
+ var BoundedScopeLabel = import_zod74.z.string().min(1).refine((value) => Buffer.byteLength(value, "utf8") <= MAX_SCOPE_LABEL_BYTES, {
76225
+ message: "Scope label exceeds the transport limit"
76226
+ });
76227
+ var BoundedIdentityLabel = import_zod74.z.string().min(1).refine((value) => Buffer.byteLength(value, "utf8") <= MAX_SCOPE_LABEL_BYTES, {
76228
+ message: "Identity label exceeds the transport limit"
76229
+ });
76230
+ var PlanArtifactScope_v1Schema = import_zod74.z.object({
76231
+ tenant: BoundedScopeLabel,
76232
+ workspace: BoundedScopeLabel,
76233
+ repository: BoundedScopeLabel,
76234
+ refNamespace: BoundedScopeLabel,
76235
+ policy: BoundedScopeLabel
76236
+ }).strict();
76237
+ var ExecutionPlanArtifactIdentity_v1Schema = import_zod74.z.object({
76238
+ contract: import_zod74.z.literal(EXECUTION_PLAN_ARTIFACT_CONTRACT),
76239
+ kind: import_zod74.z.literal("execution-plan"),
76240
+ planSchema: import_zod74.z.literal("lexrunner.execution-plan"),
76241
+ planSchemaVersion: BoundedIdentityLabel,
76242
+ canonicalizationProfile: import_zod74.z.literal(EXECUTION_PLAN_CANONICALIZATION_PROFILE),
76243
+ hashProfile: import_zod74.z.literal(EXECUTION_PLAN_HASH_PROFILE),
76244
+ digestAlgorithm: import_zod74.z.literal("sha256"),
76245
+ digest: Sha256Digest,
76246
+ canonicalByteLength: import_zod74.z.number().int().nonnegative().max(MAX_PLAN_ARTIFACT_BYTES),
76247
+ target: BoundedIdentityLabel,
76248
+ summary: import_zod74.z.object({
76249
+ itemCount: import_zod74.z.number().int().nonnegative().max(256),
76250
+ gateCount: import_zod74.z.number().int().nonnegative().max(256 * 64)
76251
+ }).strict()
76252
+ }).strict();
76253
+ var ExecutionPlanArtifact_v1Schema = import_zod74.z.object({
76254
+ identity: ExecutionPlanArtifactIdentity_v1Schema,
76255
+ canonicalBytes: import_zod74.z.string()
76256
+ }).strict().superRefine((artifact, context) => {
76257
+ const byteLength = Buffer.byteLength(artifact.canonicalBytes, "utf8");
76258
+ if (byteLength > MAX_PLAN_ARTIFACT_BYTES) {
76259
+ context.addIssue({
76260
+ code: "custom",
76261
+ path: ["canonicalBytes"],
76262
+ message: "Canonical plan bytes exceed the artifact limit"
76263
+ });
76264
+ }
76265
+ if (byteLength !== artifact.identity.canonicalByteLength) {
76266
+ context.addIssue({
76267
+ code: "custom",
76268
+ path: ["identity", "canonicalByteLength"],
76269
+ message: "Canonical plan byte length does not match the artifact identity"
76270
+ });
76271
+ }
76272
+ if (computeExecutionPlanArtifactDigest(artifact.canonicalBytes) !== artifact.identity.digest) {
76273
+ context.addIssue({
76274
+ code: "custom",
76275
+ path: ["identity", "digest"],
76276
+ message: "Canonical plan digest does not match the artifact identity"
76277
+ });
76278
+ }
76279
+ try {
76280
+ const plan = loadPlan(artifact.canonicalBytes);
76281
+ if (canonicalJSONStringify(plan) !== artifact.canonicalBytes) {
76282
+ context.addIssue({
76283
+ code: "custom",
76284
+ path: ["canonicalBytes"],
76285
+ message: "Plan bytes are not in the declared canonical form"
76286
+ });
76287
+ }
76288
+ const gateCount = plan.items.reduce((count, item) => count + item.gates.length, 0);
76289
+ if (artifact.identity.planSchemaVersion !== plan.schemaVersion || artifact.identity.target !== plan.target || artifact.identity.summary.itemCount !== plan.items.length || artifact.identity.summary.gateCount !== gateCount) {
76290
+ context.addIssue({
76291
+ code: "custom",
76292
+ path: ["identity"],
76293
+ message: "Plan semantics do not match the artifact identity"
76294
+ });
76295
+ }
76296
+ } catch {
76297
+ context.addIssue({
76298
+ code: "custom",
76299
+ path: ["canonicalBytes"],
76300
+ message: "Canonical bytes do not contain a valid execution plan"
76301
+ });
76302
+ }
76303
+ });
76304
+ var PlanArtifactReference_v1Schema = import_zod74.z.object({
76305
+ contract: import_zod74.z.literal(PLAN_ARTIFACT_REFERENCE_CONTRACT),
76306
+ artifact: ExecutionPlanArtifactIdentity_v1Schema,
76307
+ expectedDigest: Sha256Digest,
76308
+ expectedCanonicalByteLength: import_zod74.z.number().int().nonnegative().max(MAX_PLAN_ARTIFACT_BYTES),
76309
+ retrieval: import_zod74.z.object({
76310
+ kind: import_zod74.z.enum(["file", "registered"]),
76311
+ reference: import_zod74.z.string().min(1).refine(
76312
+ (value) => !value.includes("\0") && Buffer.byteLength(value, "utf8") <= MAX_PLAN_RETRIEVAL_REFERENCE_BYTES,
76313
+ { message: "Retrieval reference is invalid or exceeds the transport limit" }
76314
+ )
76315
+ }).strict(),
76316
+ scope: PlanArtifactScope_v1Schema.optional()
76317
+ }).strict().superRefine((reference, context) => {
76318
+ if (reference.expectedDigest !== reference.artifact.digest) {
76319
+ context.addIssue({
76320
+ code: "custom",
76321
+ path: ["expectedDigest"],
76322
+ message: "Expected digest does not match the embedded artifact identity"
76323
+ });
76324
+ }
76325
+ if (reference.expectedCanonicalByteLength !== reference.artifact.canonicalByteLength) {
76326
+ context.addIssue({
76327
+ code: "custom",
76328
+ path: ["expectedCanonicalByteLength"],
76329
+ message: "Expected byte length does not match the embedded artifact identity"
76330
+ });
76331
+ }
76332
+ });
76333
+ function computeExecutionPlanArtifactDigest(canonicalBytes2) {
76334
+ const digest = (0, import_node_crypto40.createHash)("sha256").update(EXECUTION_PLAN_HASH_DOMAIN, "utf8").update(canonicalBytes2, "utf8").digest("hex");
76335
+ return `sha256:${digest}`;
76336
+ }
76337
+
76338
+ // src/application/plan-artifact-service.ts
76187
76339
  var MAX_PLAN_ITEMS = 256;
76188
76340
  var MAX_GATES_PER_ITEM2 = 64;
76189
76341
  var MAX_IDENTITY_LABEL_BYTES = 512;
@@ -76195,16 +76347,41 @@ var PlanArtifactServiceError = class extends Error {
76195
76347
  this.name = "PlanArtifactServiceError";
76196
76348
  }
76197
76349
  };
76350
+ var _hooks;
76198
76351
  var PlanArtifactService = class {
76352
+ constructor(options = {}) {
76353
+ __privateAdd(this, _hooks);
76354
+ __privateSet(this, _hooks, options.importHooks ?? {});
76355
+ }
76199
76356
  resolve(input = {}) {
76200
76357
  const workingDir = path79.resolve(input.workingDir ?? process.cwd());
76358
+ const scope = parseScope(input.scope);
76359
+ if (input.planReference !== void 0 && input.planFile !== void 0) {
76360
+ throw new PlanArtifactServiceError(
76361
+ "PLAN_REFERENCE_INVALID",
76362
+ "Provide either an immutable plan reference or an explicit plan path, not both",
76363
+ "explicit"
76364
+ );
76365
+ }
76366
+ if (input.planReference !== void 0 && input.scope !== void 0) {
76367
+ throw new PlanArtifactServiceError(
76368
+ "PLAN_REFERENCE_INVALID",
76369
+ "A separately supplied scope cannot override an immutable plan reference",
76370
+ "explicit"
76371
+ );
76372
+ }
76373
+ if (input.planReference !== void 0) {
76374
+ const reference = parseReference(input.planReference);
76375
+ const explicitPath = resolveExplicitReference(reference.retrieval.reference, workingDir);
76376
+ return readArtifact(explicitPath, "explicit", __privateGet(this, _hooks), reference);
76377
+ }
76201
76378
  if (input.planFile !== void 0) {
76202
76379
  const explicitPath = resolveExplicitReference(input.planFile, workingDir);
76203
- return readArtifact(explicitPath, "explicit");
76380
+ return readArtifact(explicitPath, "explicit", __privateGet(this, _hooks), void 0, scope);
76204
76381
  }
76205
76382
  const repositoryPlan = path79.join(workingDir, "plan.json");
76206
- if (isRegularFile(repositoryPlan)) {
76207
- return readArtifact(repositoryPlan, "repository-root");
76383
+ if (pathEntryExists(repositoryPlan)) {
76384
+ return readArtifact(repositoryPlan, "repository-root", __privateGet(this, _hooks), void 0, scope);
76208
76385
  }
76209
76386
  let profilePlan;
76210
76387
  try {
@@ -76212,8 +76389,8 @@ var PlanArtifactService = class {
76212
76389
  profilePlan = path79.join(profile.path, "runner", "plan.json");
76213
76390
  } catch {
76214
76391
  }
76215
- if (profilePlan && isRegularFile(profilePlan)) {
76216
- return readArtifact(profilePlan, "profile-runner");
76392
+ if (profilePlan && pathEntryExists(profilePlan)) {
76393
+ return readArtifact(profilePlan, "profile-runner", __privateGet(this, _hooks), void 0, scope);
76217
76394
  }
76218
76395
  throw new PlanArtifactServiceError(
76219
76396
  "PLAN_NOT_FOUND",
@@ -76221,46 +76398,85 @@ var PlanArtifactService = class {
76221
76398
  );
76222
76399
  }
76223
76400
  };
76224
- function resolveExplicitReference(reference, workingDir) {
76225
- if (reference.length === 0 || reference.includes("\0") || Buffer.byteLength(reference, "utf8") > MAX_PLAN_REFERENCE_BYTES) {
76401
+ _hooks = new WeakMap();
76402
+ function parseReference(reference) {
76403
+ const parsed = PlanArtifactReference_v1Schema.safeParse(reference);
76404
+ if (!parsed.success) {
76226
76405
  throw new PlanArtifactServiceError(
76227
76406
  "PLAN_REFERENCE_INVALID",
76228
- "The explicit plan reference is empty, overlong, or contains an invalid character",
76407
+ "The immutable plan reference does not satisfy the bounded transport contract",
76229
76408
  "explicit"
76230
76409
  );
76231
76410
  }
76232
- return path79.isAbsolute(reference) ? path79.normalize(reference) : path79.resolve(workingDir, reference);
76411
+ return parsed.data;
76233
76412
  }
76234
- function readArtifact(filePath, source) {
76235
- let stat12;
76236
- try {
76237
- stat12 = fs71.statSync(filePath);
76238
- } catch {
76413
+ function parseScope(scope) {
76414
+ if (scope === void 0) return void 0;
76415
+ const parsed = PlanArtifactScope_v1Schema.safeParse(scope);
76416
+ if (!parsed.success) {
76239
76417
  throw new PlanArtifactServiceError(
76240
- "PLAN_NOT_FOUND",
76241
- "The referenced integration plan does not exist",
76242
- source
76418
+ "PLAN_REFERENCE_INVALID",
76419
+ "The plan scope does not satisfy the bounded transport contract",
76420
+ "explicit"
76243
76421
  );
76244
76422
  }
76245
- if (!stat12.isFile() || stat12.size > MAX_PLAN_BYTES) {
76423
+ return parsed.data;
76424
+ }
76425
+ function resolveExplicitReference(reference, workingDir) {
76426
+ if (reference.length === 0 || reference.includes("\0") || Buffer.byteLength(reference, "utf8") > MAX_PLAN_RETRIEVAL_REFERENCE_BYTES) {
76246
76427
  throw new PlanArtifactServiceError(
76247
- "PLAN_UNREADABLE",
76248
- "The referenced integration plan is not a readable bounded file",
76428
+ "PLAN_REFERENCE_INVALID",
76429
+ "The explicit plan reference is empty, overlong, or contains an invalid character",
76430
+ "explicit"
76431
+ );
76432
+ }
76433
+ return path79.isAbsolute(reference) ? path79.normalize(reference) : path79.resolve(workingDir, reference);
76434
+ }
76435
+ function readArtifact(filePath, source, hooks, expected, scope) {
76436
+ const content = readPortableRaceDetectedFile(filePath, source, hooks);
76437
+ const plan = loadPlan(content);
76438
+ assertBoundedArtifact(plan, source);
76439
+ const canonicalBytes2 = canonicalJSONStringify(plan);
76440
+ const canonicalByteLength = Buffer.byteLength(canonicalBytes2, "utf8");
76441
+ if (canonicalByteLength > MAX_PLAN_ARTIFACT_BYTES) {
76442
+ throw new PlanArtifactServiceError(
76443
+ "PLAN_ARTIFACT_LIMIT_EXCEEDED",
76444
+ "The canonical integration plan exceeds the artifact byte limit",
76249
76445
  source
76250
76446
  );
76251
76447
  }
76252
- let content;
76253
- try {
76254
- content = fs71.readFileSync(filePath, "utf8");
76255
- } catch {
76448
+ const artifactIdentity = {
76449
+ contract: EXECUTION_PLAN_ARTIFACT_CONTRACT,
76450
+ kind: "execution-plan",
76451
+ planSchema: "lexrunner.execution-plan",
76452
+ planSchemaVersion: plan.schemaVersion,
76453
+ canonicalizationProfile: EXECUTION_PLAN_CANONICALIZATION_PROFILE,
76454
+ hashProfile: EXECUTION_PLAN_HASH_PROFILE,
76455
+ digestAlgorithm: "sha256",
76456
+ digest: computeExecutionPlanArtifactDigest(canonicalBytes2),
76457
+ canonicalByteLength,
76458
+ target: plan.target,
76459
+ summary: {
76460
+ itemCount: plan.items.length,
76461
+ gateCount: plan.items.reduce((count, item) => count + item.gates.length, 0)
76462
+ }
76463
+ };
76464
+ const artifact = { identity: artifactIdentity, canonicalBytes: canonicalBytes2 };
76465
+ if (expected && !(0, import_node_util2.isDeepStrictEqual)(expected.artifact, artifactIdentity)) {
76256
76466
  throw new PlanArtifactServiceError(
76257
- "PLAN_UNREADABLE",
76258
- "The referenced integration plan could not be read",
76467
+ "PLAN_REFERENCE_MISMATCH",
76468
+ "The retrieved integration plan does not match the immutable reference",
76259
76469
  source
76260
76470
  );
76261
76471
  }
76262
- const plan = loadPlan(content);
76263
- assertBoundedArtifact(plan, source);
76472
+ const reference = expected ?? parseReference({
76473
+ contract: PLAN_ARTIFACT_REFERENCE_CONTRACT,
76474
+ artifact: artifactIdentity,
76475
+ expectedDigest: artifactIdentity.digest,
76476
+ expectedCanonicalByteLength: artifactIdentity.canonicalByteLength,
76477
+ retrieval: { kind: "file", reference: filePath },
76478
+ ...scope ? { scope } : {}
76479
+ });
76264
76480
  return {
76265
76481
  plan,
76266
76482
  identity: {
@@ -76272,10 +76488,167 @@ function readArtifact(filePath, source) {
76272
76488
  target: plan.target,
76273
76489
  itemCount: plan.items.length
76274
76490
  },
76491
+ artifact,
76492
+ reference,
76493
+ acquisition: {
76494
+ contract: "lexrunner.plan-artifact-acquisition.v1",
76495
+ assurance: "portable-race-detection",
76496
+ authority: "unverified"
76497
+ },
76275
76498
  source,
76276
76499
  filePath
76277
76500
  };
76278
76501
  }
76502
+ function readPortableRaceDetectedFile(filePath, source, hooks) {
76503
+ const initialPath = snapshotPath(filePath, source);
76504
+ hooks.afterInitialPathSnapshot?.();
76505
+ const noFollow = typeof fs71.constants.O_NOFOLLOW === "number" ? fs71.constants.O_NOFOLLOW : 0;
76506
+ let descriptor;
76507
+ try {
76508
+ descriptor = fs71.openSync(filePath, fs71.constants.O_RDONLY | noFollow);
76509
+ } catch (error) {
76510
+ throw importError(error, source);
76511
+ }
76512
+ let bytes;
76513
+ try {
76514
+ const before = fs71.fstatSync(descriptor, { bigint: true });
76515
+ assertOpenedIdentity(initialPath[initialPath.length - 1].stats, before, source);
76516
+ hooks.afterOpen?.();
76517
+ if (before.size > BigInt(MAX_PLAN_ARTIFACT_BYTES)) {
76518
+ throw new PlanArtifactServiceError(
76519
+ "PLAN_ARTIFACT_LIMIT_EXCEEDED",
76520
+ "The referenced integration plan exceeds the artifact byte limit",
76521
+ source
76522
+ );
76523
+ }
76524
+ bytes = readAtMost(descriptor, MAX_PLAN_ARTIFACT_BYTES + 1);
76525
+ hooks.afterRead?.();
76526
+ const after = fs71.fstatSync(descriptor, { bigint: true });
76527
+ assertStableOpenedFile(before, after, bytes.length, source);
76528
+ } finally {
76529
+ fs71.closeSync(descriptor);
76530
+ }
76531
+ hooks.beforeFinalPathSnapshot?.();
76532
+ const finalPath = snapshotPath(filePath, source);
76533
+ assertStablePath(initialPath, finalPath, source);
76534
+ try {
76535
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
76536
+ } catch {
76537
+ throw new PlanArtifactServiceError(
76538
+ "PLAN_UNREADABLE",
76539
+ "The referenced integration plan is not valid UTF-8",
76540
+ source
76541
+ );
76542
+ }
76543
+ }
76544
+ function snapshotPath(filePath, source) {
76545
+ const absolute = path79.resolve(filePath);
76546
+ const root = path79.parse(absolute).root;
76547
+ const relative8 = path79.relative(root, absolute);
76548
+ const segments = relative8.length === 0 ? [] : relative8.split(path79.sep);
76549
+ const candidates = [root];
76550
+ let current = root;
76551
+ for (const segment of segments) {
76552
+ current = path79.join(current, segment);
76553
+ candidates.push(current);
76554
+ }
76555
+ return candidates.map((candidate, index) => {
76556
+ let stats;
76557
+ try {
76558
+ stats = fs71.lstatSync(candidate, { bigint: true });
76559
+ } catch (error) {
76560
+ throw importError(error, source);
76561
+ }
76562
+ const leaf = index === candidates.length - 1;
76563
+ if (stats.isSymbolicLink()) {
76564
+ throw new PlanArtifactServiceError(
76565
+ "PLAN_FILESYSTEM_UNSAFE",
76566
+ "The integration plan path contains an unsafe filesystem object",
76567
+ source
76568
+ );
76569
+ }
76570
+ if (leaf ? !stats.isFile() : !stats.isDirectory()) {
76571
+ throw new PlanArtifactServiceError(
76572
+ "PLAN_UNREADABLE",
76573
+ "The referenced integration plan is not a readable bounded file",
76574
+ source
76575
+ );
76576
+ }
76577
+ if (leaf && stats.nlink !== 1n) {
76578
+ throw new PlanArtifactServiceError(
76579
+ "PLAN_FILESYSTEM_UNSAFE",
76580
+ "The integration plan file has an ambiguous filesystem identity",
76581
+ source
76582
+ );
76583
+ }
76584
+ return { stats, leaf };
76585
+ });
76586
+ }
76587
+ function assertOpenedIdentity(pathStats, openedStats, source) {
76588
+ if (!openedStats.isFile() || openedStats.nlink !== 1n || !sameObject(pathStats, openedStats) || pathStats.size !== openedStats.size || pathStats.mtimeNs !== openedStats.mtimeNs || pathStats.ctimeNs !== openedStats.ctimeNs) {
76589
+ throw new PlanArtifactServiceError(
76590
+ "PLAN_FILESYSTEM_UNSAFE",
76591
+ "The integration plan filesystem identity changed during acquisition",
76592
+ source
76593
+ );
76594
+ }
76595
+ }
76596
+ function assertStableOpenedFile(before, after, bytesRead, source) {
76597
+ if (bytesRead > MAX_PLAN_ARTIFACT_BYTES) {
76598
+ throw new PlanArtifactServiceError(
76599
+ "PLAN_ARTIFACT_LIMIT_EXCEEDED",
76600
+ "The referenced integration plan exceeds the artifact byte limit",
76601
+ source
76602
+ );
76603
+ }
76604
+ if (!after.isFile() || after.nlink !== 1n || !sameObject(before, after) || before.size !== after.size || before.mtimeNs !== after.mtimeNs || before.ctimeNs !== after.ctimeNs || BigInt(bytesRead) !== before.size) {
76605
+ throw new PlanArtifactServiceError(
76606
+ "PLAN_FILESYSTEM_UNSAFE",
76607
+ "The integration plan changed while its bytes were being acquired",
76608
+ source
76609
+ );
76610
+ }
76611
+ }
76612
+ function assertStablePath(before, after, source) {
76613
+ if (before.length !== after.length || before.some((entry, index) => {
76614
+ const current = after[index];
76615
+ return !current || entry.leaf !== current.leaf || !sameObject(entry.stats, current.stats) || entry.leaf && (entry.stats.size !== current.stats.size || entry.stats.mtimeNs !== current.stats.mtimeNs || entry.stats.ctimeNs !== current.stats.ctimeNs || current.stats.nlink !== 1n);
76616
+ })) {
76617
+ throw new PlanArtifactServiceError(
76618
+ "PLAN_FILESYSTEM_UNSAFE",
76619
+ "The integration plan path changed while its bytes were being acquired",
76620
+ source
76621
+ );
76622
+ }
76623
+ }
76624
+ function sameObject(left, right) {
76625
+ return left.dev === right.dev && left.ino === right.ino && left.mode === right.mode;
76626
+ }
76627
+ function readAtMost(descriptor, maximumBytes) {
76628
+ const buffer = Buffer.allocUnsafe(maximumBytes);
76629
+ let offset = 0;
76630
+ while (offset < maximumBytes) {
76631
+ const count = fs71.readSync(descriptor, buffer, offset, maximumBytes - offset, null);
76632
+ if (count === 0) break;
76633
+ offset += count;
76634
+ }
76635
+ return buffer.subarray(0, offset);
76636
+ }
76637
+ function importError(error, source) {
76638
+ const code = error?.code;
76639
+ if (code === "ENOENT" || code === "ENOTDIR") {
76640
+ return new PlanArtifactServiceError(
76641
+ "PLAN_NOT_FOUND",
76642
+ "The referenced integration plan does not exist",
76643
+ source
76644
+ );
76645
+ }
76646
+ return new PlanArtifactServiceError(
76647
+ "PLAN_UNREADABLE",
76648
+ "The referenced integration plan could not be safely read",
76649
+ source
76650
+ );
76651
+ }
76279
76652
  function assertBoundedArtifact(plan, source) {
76280
76653
  const labels = [
76281
76654
  plan.schemaVersion,
@@ -76290,11 +76663,277 @@ function assertBoundedArtifact(plan, source) {
76290
76663
  );
76291
76664
  }
76292
76665
  }
76293
- function isRegularFile(filePath) {
76666
+ function pathEntryExists(filePath) {
76294
76667
  try {
76295
- return fs71.statSync(filePath).isFile();
76296
- } catch {
76297
- return false;
76668
+ fs71.lstatSync(filePath);
76669
+ return true;
76670
+ } catch (error) {
76671
+ const code = error?.code;
76672
+ if (code === "ENOENT" || code === "ENOTDIR") return false;
76673
+ return true;
76674
+ }
76675
+ }
76676
+
76677
+ // src/application/plan-artifact-registration-service.ts
76678
+ var fs72 = __toESM(require("fs"), 1);
76679
+ var path80 = __toESM(require("path"), 1);
76680
+ var import_node_crypto41 = require("crypto");
76681
+ var PlanArtifactRegistrationError = class extends Error {
76682
+ constructor(code, message) {
76683
+ super(message);
76684
+ this.code = code;
76685
+ this.name = "PlanArtifactRegistrationError";
76686
+ }
76687
+ };
76688
+ var _PlanArtifactRegistrationService_instances, verifyExisting_fn;
76689
+ var PlanArtifactRegistrationService = class {
76690
+ constructor() {
76691
+ __privateAdd(this, _PlanArtifactRegistrationService_instances);
76692
+ }
76693
+ register(input) {
76694
+ const parsed = ExecutionPlanArtifact_v1Schema.safeParse(input.artifact);
76695
+ if (!parsed.success) {
76696
+ throw new PlanArtifactRegistrationError(
76697
+ "PLAN_REGISTRATION_INVALID",
76698
+ "The plan artifact does not satisfy the immutable artifact contract"
76699
+ );
76700
+ }
76701
+ const artifact = parsed.data;
76702
+ const scope = parseScope2(input.scope);
76703
+ const storeDirectory = validateStoreReference(input.storeDirectory);
76704
+ prepareControlledStore(storeDirectory);
76705
+ const digestName = `${artifact.identity.digest.slice("sha256:".length)}.json`;
76706
+ const artifactPath = path80.join(storeDirectory, digestName);
76707
+ const reference = createRegisteredReference(artifact, artifactPath, scope);
76708
+ if (pathEntryExists2(artifactPath)) {
76709
+ return __privateMethod(this, _PlanArtifactRegistrationService_instances, verifyExisting_fn).call(this, artifact, reference, false);
76710
+ }
76711
+ const temporaryPath = path80.join(storeDirectory, `.plan-${(0, import_node_crypto41.randomUUID)()}.tmp`);
76712
+ let temporaryCreated = false;
76713
+ try {
76714
+ const descriptor = fs72.openSync(
76715
+ temporaryPath,
76716
+ fs72.constants.O_WRONLY | fs72.constants.O_CREAT | fs72.constants.O_EXCL,
76717
+ 384
76718
+ );
76719
+ temporaryCreated = true;
76720
+ try {
76721
+ writeAll(descriptor, Buffer.from(artifact.canonicalBytes, "utf8"));
76722
+ fs72.fsyncSync(descriptor);
76723
+ } finally {
76724
+ fs72.closeSync(descriptor);
76725
+ }
76726
+ try {
76727
+ fs72.linkSync(temporaryPath, artifactPath);
76728
+ } catch (error) {
76729
+ if (!pathEntryExists2(artifactPath)) throw error;
76730
+ return __privateMethod(this, _PlanArtifactRegistrationService_instances, verifyExisting_fn).call(this, artifact, reference, false);
76731
+ }
76732
+ try {
76733
+ fs72.unlinkSync(temporaryPath);
76734
+ } catch (error) {
76735
+ if (error.code !== "ENOENT") throw error;
76736
+ }
76737
+ temporaryCreated = false;
76738
+ flushDirectoryWhenSupported(storeDirectory);
76739
+ assertStoreDirectory(storeDirectory);
76740
+ return __privateMethod(this, _PlanArtifactRegistrationService_instances, verifyExisting_fn).call(this, artifact, reference, true);
76741
+ } catch (error) {
76742
+ if (error instanceof PlanArtifactRegistrationError) throw error;
76743
+ throw new PlanArtifactRegistrationError(
76744
+ "PLAN_REGISTRATION_UNSAFE",
76745
+ "The plan artifact could not be published without replacing existing bytes"
76746
+ );
76747
+ } finally {
76748
+ if (temporaryCreated) {
76749
+ try {
76750
+ fs72.unlinkSync(temporaryPath);
76751
+ } catch {
76752
+ }
76753
+ }
76754
+ }
76755
+ }
76756
+ };
76757
+ _PlanArtifactRegistrationService_instances = new WeakSet();
76758
+ verifyExisting_fn = function(artifact, reference, created) {
76759
+ try {
76760
+ waitForConcurrentPublisher(reference.retrieval.reference);
76761
+ const resolved = new PlanArtifactService().resolve({ planReference: reference });
76762
+ if (resolved.artifact.canonicalBytes !== artifact.canonicalBytes) {
76763
+ throw new PlanArtifactRegistrationError(
76764
+ "PLAN_REGISTRATION_CONFLICT",
76765
+ "The content-addressed plan object conflicts with the requested artifact"
76766
+ );
76767
+ }
76768
+ return {
76769
+ artifact: resolved.artifact,
76770
+ reference,
76771
+ created,
76772
+ storage: { assurance: "service-no-replace-verified", authority: "unverified" }
76773
+ };
76774
+ } catch (error) {
76775
+ if (error instanceof PlanArtifactRegistrationError) throw error;
76776
+ if (error instanceof PlanArtifactServiceError && error.code === "PLAN_REFERENCE_MISMATCH") {
76777
+ throw new PlanArtifactRegistrationError(
76778
+ "PLAN_REGISTRATION_CONFLICT",
76779
+ "The content-addressed plan object conflicts with the requested artifact"
76780
+ );
76781
+ }
76782
+ throw new PlanArtifactRegistrationError(
76783
+ "PLAN_REGISTRATION_VERIFY_FAILED",
76784
+ "The persisted plan artifact could not be reread and verified"
76785
+ );
76786
+ }
76787
+ };
76788
+ function createRegisteredReference(artifact, artifactPath, scope) {
76789
+ if (Buffer.byteLength(artifactPath, "utf8") > 4096) {
76790
+ throw new PlanArtifactRegistrationError(
76791
+ "PLAN_REGISTRATION_INVALID",
76792
+ "The artifact store cannot produce a bounded retrieval reference"
76793
+ );
76794
+ }
76795
+ const reference = {
76796
+ contract: PLAN_ARTIFACT_REFERENCE_CONTRACT,
76797
+ artifact: artifact.identity,
76798
+ expectedDigest: artifact.identity.digest,
76799
+ expectedCanonicalByteLength: artifact.identity.canonicalByteLength,
76800
+ retrieval: { kind: "registered", reference: artifactPath },
76801
+ ...scope ? { scope } : {}
76802
+ };
76803
+ const parsed = PlanArtifactReference_v1Schema.safeParse(reference);
76804
+ if (!parsed.success) {
76805
+ throw new PlanArtifactRegistrationError(
76806
+ "PLAN_REGISTRATION_INVALID",
76807
+ "The registered artifact reference does not satisfy the bounded transport contract"
76808
+ );
76809
+ }
76810
+ return parsed.data;
76811
+ }
76812
+ function parseScope2(scope) {
76813
+ if (scope === void 0) return void 0;
76814
+ const parsed = PlanArtifactScope_v1Schema.safeParse(scope);
76815
+ if (!parsed.success) {
76816
+ throw new PlanArtifactRegistrationError(
76817
+ "PLAN_REGISTRATION_INVALID",
76818
+ "The plan scope does not satisfy the bounded transport contract"
76819
+ );
76820
+ }
76821
+ return parsed.data;
76822
+ }
76823
+ function validateStoreReference(reference) {
76824
+ if (reference.length === 0 || reference.includes("\0") || Buffer.byteLength(reference, "utf8") > 4096) {
76825
+ throw new PlanArtifactRegistrationError(
76826
+ "PLAN_REGISTRATION_INVALID",
76827
+ "The artifact store reference is invalid or exceeds its bound"
76828
+ );
76829
+ }
76830
+ return path80.resolve(reference);
76831
+ }
76832
+ function prepareControlledStore(storeDirectory) {
76833
+ const root = path80.parse(storeDirectory).root;
76834
+ const segments = path80.relative(root, storeDirectory).split(path80.sep).filter(Boolean);
76835
+ let current = root;
76836
+ for (const segment of segments) {
76837
+ current = path80.join(current, segment);
76838
+ try {
76839
+ const stats = fs72.lstatSync(current);
76840
+ if (stats.isSymbolicLink() || !stats.isDirectory()) {
76841
+ throw new PlanArtifactRegistrationError(
76842
+ "PLAN_REGISTRATION_UNSAFE",
76843
+ "The artifact store contains an unsafe filesystem object"
76844
+ );
76845
+ }
76846
+ } catch (error) {
76847
+ if (error instanceof PlanArtifactRegistrationError) throw error;
76848
+ if (error.code !== "ENOENT") {
76849
+ throw new PlanArtifactRegistrationError(
76850
+ "PLAN_REGISTRATION_UNSAFE",
76851
+ "The artifact store identity is unavailable"
76852
+ );
76853
+ }
76854
+ try {
76855
+ fs72.mkdirSync(current, { mode: 448 });
76856
+ } catch (mkdirError) {
76857
+ if (mkdirError.code !== "EEXIST") {
76858
+ throw new PlanArtifactRegistrationError(
76859
+ "PLAN_REGISTRATION_UNSAFE",
76860
+ "The artifact store could not be prepared"
76861
+ );
76862
+ }
76863
+ }
76864
+ const created = fs72.lstatSync(current);
76865
+ if (created.isSymbolicLink() || !created.isDirectory()) {
76866
+ throw new PlanArtifactRegistrationError(
76867
+ "PLAN_REGISTRATION_UNSAFE",
76868
+ "The artifact store contains an unsafe filesystem object"
76869
+ );
76870
+ }
76871
+ }
76872
+ }
76873
+ assertStoreDirectory(storeDirectory);
76874
+ }
76875
+ function assertStoreDirectory(storeDirectory) {
76876
+ const root = path80.parse(storeDirectory).root;
76877
+ const segments = path80.relative(root, storeDirectory).split(path80.sep).filter(Boolean);
76878
+ let current = root;
76879
+ for (const segment of segments) {
76880
+ current = path80.join(current, segment);
76881
+ let stats;
76882
+ try {
76883
+ stats = fs72.lstatSync(current);
76884
+ } catch {
76885
+ throw new PlanArtifactRegistrationError(
76886
+ "PLAN_REGISTRATION_UNSAFE",
76887
+ "The artifact store identity is unavailable"
76888
+ );
76889
+ }
76890
+ if (stats.isSymbolicLink() || !stats.isDirectory()) {
76891
+ throw new PlanArtifactRegistrationError(
76892
+ "PLAN_REGISTRATION_UNSAFE",
76893
+ "The artifact store contains an unsafe filesystem object"
76894
+ );
76895
+ }
76896
+ }
76897
+ }
76898
+ function writeAll(descriptor, bytes) {
76899
+ let offset = 0;
76900
+ while (offset < bytes.length) {
76901
+ offset += fs72.writeSync(descriptor, bytes, offset, bytes.length - offset, null);
76902
+ }
76903
+ }
76904
+ function flushDirectoryWhenSupported(directory) {
76905
+ let descriptor;
76906
+ try {
76907
+ descriptor = fs72.openSync(directory, fs72.constants.O_RDONLY);
76908
+ fs72.fsyncSync(descriptor);
76909
+ } catch (error) {
76910
+ const code = error?.code;
76911
+ if (process.platform !== "win32" || code !== "EISDIR" && code !== "EPERM") throw error;
76912
+ } finally {
76913
+ if (descriptor !== void 0) fs72.closeSync(descriptor);
76914
+ }
76915
+ }
76916
+ function pathEntryExists2(filePath) {
76917
+ try {
76918
+ fs72.lstatSync(filePath);
76919
+ return true;
76920
+ } catch (error) {
76921
+ const code = error?.code;
76922
+ return code !== "ENOENT" && code !== "ENOTDIR";
76923
+ }
76924
+ }
76925
+ function waitForConcurrentPublisher(artifactPath) {
76926
+ const deadline = Date.now() + 500;
76927
+ const signal = new Int32Array(new SharedArrayBuffer(4));
76928
+ while (Date.now() < deadline) {
76929
+ let stats;
76930
+ try {
76931
+ stats = fs72.lstatSync(artifactPath);
76932
+ } catch {
76933
+ return;
76934
+ }
76935
+ if (!stats.isFile() || stats.isSymbolicLink() || stats.nlink <= 1) return;
76936
+ Atomics.wait(signal, 0, 0, 10);
76298
76937
  }
76299
76938
  }
76300
76939
 
@@ -77227,7 +77866,7 @@ program.command("view").description("Interactive plan viewer with navigation and
77227
77866
  }
77228
77867
  try {
77229
77868
  const { InteractivePlanViewer: InteractivePlanViewer2 } = await Promise.resolve().then(() => (init_planViewer(), planViewer_exports));
77230
- const planContent = fs72.readFileSync(planFile, "utf-8");
77869
+ const planContent = fs73.readFileSync(planFile, "utf-8");
77231
77870
  const plan = loadPlan(planContent);
77232
77871
  const viewer = new InteractivePlanViewer2(plan, {
77233
77872
  filter: opts.filter,
@@ -77269,7 +77908,7 @@ program.command("deliverables:list").description("List all autopilot deliverable
77269
77908
  });
77270
77909
  const latest = manager.getLatestPath();
77271
77910
  if (latest) {
77272
- console.log(`\u{1F4CD} Latest: ${path80.basename(latest)}`);
77911
+ console.log(`\u{1F4CD} Latest: ${path81.basename(latest)}`);
77273
77912
  }
77274
77913
  }
77275
77914
  } catch (error) {
@@ -77343,8 +77982,8 @@ program.command("deliverables:cleanup").description("Clean up old deliverables b
77343
77982
  console.log(`Freed space: ${(result.freedSpace / 1024).toFixed(2)} KB`);
77344
77983
  if (result.removed.length > 0) {
77345
77984
  console.log("\nRemoved:");
77346
- result.removed.forEach((path81) => {
77347
- console.log(` - ${path81}`);
77985
+ result.removed.forEach((path82) => {
77986
+ console.log(` - ${path82}`);
77348
77987
  });
77349
77988
  }
77350
77989
  }
@@ -77415,8 +78054,8 @@ var isDirectExec = (() => {
77415
78054
  try {
77416
78055
  if (typeof import_meta === "undefined") return false;
77417
78056
  if (!process.argv[1] || !__lexrunnerImportMetaUrl) return false;
77418
- const invokedPath = fs72.realpathSync((0, import_node_path40.resolve)(process.argv[1]));
77419
- const modulePath = fs72.realpathSync((0, import_node_url7.fileURLToPath)(__lexrunnerImportMetaUrl));
78057
+ const invokedPath = fs73.realpathSync((0, import_node_path40.resolve)(process.argv[1]));
78058
+ const modulePath = fs73.realpathSync((0, import_node_url7.fileURLToPath)(__lexrunnerImportMetaUrl));
77420
78059
  return invokedPath === modulePath;
77421
78060
  } catch {
77422
78061
  return false;
@@ -77487,11 +78126,17 @@ if (isDirectExec) {
77487
78126
  ConfigurationQueryService,
77488
78127
  ControllerLease_v1,
77489
78128
  DiscoveryQueryService,
78129
+ EXECUTION_PLAN_ARTIFACT_CONTRACT,
78130
+ EXECUTION_PLAN_CANONICALIZATION_PROFILE,
78131
+ EXECUTION_PLAN_HASH_DOMAIN,
78132
+ EXECUTION_PLAN_HASH_PROFILE,
77490
78133
  EngineVerificationCheckSource_v2,
77491
78134
  EngineVerificationDeterminism_v2,
77492
78135
  EngineVerificationTrustGapReason_v2,
77493
78136
  ExecutionEnvelope_v1,
77494
78137
  ExecutionEnvironmentOS,
78138
+ ExecutionPlanArtifactIdentity_v1Schema,
78139
+ ExecutionPlanArtifact_v1Schema,
77495
78140
  ExecutionState,
77496
78141
  ExternalAwaitOutcome_v1,
77497
78142
  ExternalAwaitableDescriptor_v1,
@@ -77547,6 +78192,11 @@ if (isDirectExec) {
77547
78192
  NativeWslProjectionSelection_v1,
77548
78193
  NativeWslProjectionStatusRequestJsonSchema,
77549
78194
  NativeWslSourceObservation_v1,
78195
+ PLAN_ARTIFACT_REFERENCE_CONTRACT,
78196
+ PlanArtifactReference_v1Schema,
78197
+ PlanArtifactRegistrationError,
78198
+ PlanArtifactRegistrationService,
78199
+ PlanArtifactScope_v1Schema,
77550
78200
  PlanArtifactService,
77551
78201
  PlanArtifactServiceError,
77552
78202
  PlanCreationService,
@@ -77576,6 +78226,7 @@ if (isDirectExec) {
77576
78226
  completionForAttemptAwaitable,
77577
78227
  computeAgentEngineVerificationV2Hash,
77578
78228
  computeAgentTaskPacketHash,
78229
+ computeExecutionPlanArtifactDigest,
77579
78230
  computeFanInEvidenceSetHash,
77580
78231
  computeMergeOrder,
77581
78232
  containsAttemptAwaitableCredentialValue,