overlane 0.1.137 → 0.1.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/overlane.mjs CHANGED
@@ -4545,7 +4545,7 @@ function isRef(value) {
4545
4545
  function cloneIssues(issues) {
4546
4546
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
4547
4547
  }
4548
- function isRecursive(inst, stack, resolve16) {
4548
+ function isRecursive(inst, stack, resolve17) {
4549
4549
  const cached2 = recursive.get(inst);
4550
4550
  if (cached2 !== void 0)
4551
4551
  return cached2 ? PROVEN : NONE;
@@ -4555,7 +4555,7 @@ function isRecursive(inst, stack, resolve16) {
4555
4555
  let result = NONE;
4556
4556
  const check2 = (child) => {
4557
4557
  if (result !== PROVEN && child?._zod) {
4558
- const answer = isRecursive(child, stack, resolve16);
4558
+ const answer = isRecursive(child, stack, resolve17);
4559
4559
  if (answer > result)
4560
4560
  result = answer;
4561
4561
  }
@@ -4566,7 +4566,7 @@ function isRecursive(inst, stack, resolve16) {
4566
4566
  const desc = Object.getOwnPropertyDescriptor(sh, key);
4567
4567
  if (spread && !desc.enumerable)
4568
4568
  continue;
4569
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve16) : NONE;
4569
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve17) : NONE;
4570
4570
  if (child > answer)
4571
4571
  answer = child;
4572
4572
  }
@@ -4630,7 +4630,7 @@ function isRecursive(inst, stack, resolve16) {
4630
4630
  break;
4631
4631
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
4632
4632
  case "lazy": {
4633
- const inner = def._cachedInner ?? (resolve16 ? inst._zod.innerType : void 0);
4633
+ const inner = def._cachedInner ?? (resolve17 ? inst._zod.innerType : void 0);
4634
4634
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
4635
4635
  break;
4636
4636
  }
@@ -4732,14 +4732,14 @@ var init_memoizer = __esm({
4732
4732
  var _a3;
4733
4733
  (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
4734
4734
  inst._zod.deferred.push(() => {
4735
- const base4 = inst._zod.parse;
4735
+ const base5 = inst._zod.parse;
4736
4736
  const wrapped = (payload, ctx) => {
4737
4737
  if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value))
4738
4738
  throw new $ZodCyclicError();
4739
- return base4(payload, ctx);
4739
+ return base5(payload, ctx);
4740
4740
  };
4741
4741
  inst._zod.parse = wrapped;
4742
- if (inst._zod.run === base4)
4742
+ if (inst._zod.run === base5)
4743
4743
  inst._zod.run = wrapped;
4744
4744
  });
4745
4745
  },
@@ -4751,15 +4751,15 @@ var init_memoizer = __esm({
4751
4751
  let lastBucket;
4752
4752
  (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
4753
4753
  inst._zod.deferred.push(() => {
4754
- const base4 = inst._zod.parse;
4754
+ const base5 = inst._zod.parse;
4755
4755
  const wrapped = (payload, ctx) => {
4756
4756
  if (isRecursiveInst === void 0) {
4757
4757
  const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
4758
4758
  if (walked === NONE) {
4759
- inst._zod.parse = base4;
4759
+ inst._zod.parse = base5;
4760
4760
  if (inst._zod.run === wrapped)
4761
- inst._zod.run = base4;
4762
- return base4(payload, ctx);
4761
+ inst._zod.run = base5;
4762
+ return base5(payload, ctx);
4763
4763
  }
4764
4764
  if (walked === PROVEN || rechecked)
4765
4765
  isRecursiveInst = true;
@@ -4768,7 +4768,7 @@ var init_memoizer = __esm({
4768
4768
  }
4769
4769
  const input2 = payload.value;
4770
4770
  if (!isRef(input2))
4771
- return base4(payload, ctx);
4771
+ return base5(payload, ctx);
4772
4772
  let state = ctx[STATE];
4773
4773
  if (!state) {
4774
4774
  state = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 };
@@ -4797,7 +4797,7 @@ var init_memoizer = __esm({
4797
4797
  }
4798
4798
  handoff = bucket;
4799
4799
  const depth = open.length;
4800
- const result = base4(payload, ctx);
4800
+ const result = base5(payload, ctx);
4801
4801
  handoff = void 0;
4802
4802
  const entry = open.length > depth ? open.pop() : void 0;
4803
4803
  if (result instanceof Promise) {
@@ -4812,7 +4812,7 @@ var init_memoizer = __esm({
4812
4812
  return result;
4813
4813
  };
4814
4814
  inst._zod.parse = wrapped;
4815
- if (inst._zod.run === base4)
4815
+ if (inst._zod.run === base5)
4816
4816
  inst._zod.run = wrapped;
4817
4817
  });
4818
4818
  }
@@ -22552,6 +22552,27 @@ function chainAuditEvent(prevHash, body2) {
22552
22552
  const previous = prevHash ?? AUDIT_GENESIS_HASH;
22553
22553
  return AuditEvent.parse({ ...body2, prevHash: previous, hash: auditHash(previous, body2) });
22554
22554
  }
22555
+ function bodyOf(event) {
22556
+ const { prevHash: _p, hash: _h, ...body2 } = event;
22557
+ return body2;
22558
+ }
22559
+ function verifyAuditChain(tenantId, events, start2 = { prevHash: AUDIT_GENESIS_HASH, seq: 0 }) {
22560
+ let prev = start2.prevHash;
22561
+ let seq = start2.seq;
22562
+ let checked2 = 0;
22563
+ for (const event of events) {
22564
+ const fail = (reason) => ({ tenantId, ok: false, checked: checked2, head: checked2 === 0 ? null : prev, brokenAt: event.seq > 0 ? event.seq : seq + 1, reason });
22565
+ if (event.tenantId !== tenantId) return fail("wrong_tenant");
22566
+ if (event.seq !== seq + 1) return fail("bad_sequence");
22567
+ if (event.prevHash !== prev) return fail("bad_link");
22568
+ if (AUDIT_ACTIONS[event.action] !== event.category) return fail("bad_category");
22569
+ if (auditHash(prev, bodyOf(event)) !== event.hash) return fail("bad_hash");
22570
+ prev = event.hash;
22571
+ seq = event.seq;
22572
+ checked2 += 1;
22573
+ }
22574
+ return { tenantId, ok: true, checked: checked2, head: checked2 === 0 && start2.seq === 0 ? null : prev };
22575
+ }
22555
22576
  var AUDIT_CATEGORIES, AuditCategory, AUDIT_ACTIONS, AUDIT_ACTION_NAMES, AuditActionName, AUDIT_RESULTS, AuditResult, AuditPrincipalType, AuditTarget, Hash, AUDIT_GENESIS_HASH, AuditEventBody, AuditEvent, AuditList, AuditVerification, K, FIXTURE_AT, fixtureBodies, AUDIT_FIXTURE;
22556
22577
  var init_audit = __esm({
22557
22578
  "../contracts/src/audit.ts"() {
@@ -22583,7 +22604,26 @@ var init_audit = __esm({
22583
22604
  "bot.revoked": "policy",
22584
22605
  "bot.key_rotated": "policy",
22585
22606
  "token.created": "token",
22586
- "token.revoked": "token"
22607
+ "token.revoked": "token",
22608
+ // MS-B6 enterprise (additive)
22609
+ "sso.portal_link_issued": "admin",
22610
+ "directory.synced": "admin",
22611
+ "group_mapping.updated": "admin",
22612
+ "audit.exported": "admin",
22613
+ "siem_target.created": "policy",
22614
+ "siem_target.deleted": "policy",
22615
+ "residency.pinned": "policy",
22616
+ "residency.migration_requested": "policy",
22617
+ "byok.key_added": "token",
22618
+ "byok.key_tested": "token",
22619
+ "byok.key_rotated": "token",
22620
+ "byok.key_revoked": "token",
22621
+ "retention.updated": "policy",
22622
+ "retention.purged": "policy",
22623
+ "data.exported": "admin",
22624
+ "data.deleted": "admin",
22625
+ "restore.drill_run": "admin",
22626
+ "mcp_allowlist.updated": "policy"
22587
22627
  };
22588
22628
  AUDIT_ACTION_NAMES = Object.keys(AUDIT_ACTIONS);
22589
22629
  AuditActionName = external_exports.enum(Object.keys(AUDIT_ACTIONS));
@@ -25646,7 +25686,39 @@ var init_route_commands = __esm({
25646
25686
  "webhooks.delete": c("webhook delete"),
25647
25687
  "webhooks.rotate": c("webhook rotate"),
25648
25688
  "webhooks.test": c("webhook test"),
25649
- "webhooks.deliveries": c("webhook deliveries")
25689
+ "webhooks.deliveries": c("webhook deliveries"),
25690
+ // Enterprise (MS-B6)
25691
+ "enterprise.entitlements": c("enterprise status"),
25692
+ "enterprise.identity.get": c("enterprise sso show"),
25693
+ "enterprise.identity.portal-link": c("enterprise sso link"),
25694
+ "enterprise.identity.test": c("enterprise sso test"),
25695
+ "enterprise.identity.sync": c("enterprise sso sync"),
25696
+ "enterprise.identity.mappings.get": c("enterprise sso show"),
25697
+ "enterprise.identity.mappings.put": c("enterprise sso groups set"),
25698
+ "enterprise.audit-exports.create": c("enterprise audit export"),
25699
+ "enterprise.streams.list": c("enterprise audit stream list"),
25700
+ "enterprise.streams.create": c("enterprise audit stream add"),
25701
+ "enterprise.streams.delete": c("enterprise audit stream remove"),
25702
+ "enterprise.streams.run": c("enterprise audit stream run"),
25703
+ "enterprise.residency.get": c("enterprise region show"),
25704
+ "enterprise.residency.put": c("enterprise region set"),
25705
+ "enterprise.residency.migrate": c("enterprise region set"),
25706
+ "enterprise.residency.stores": c("enterprise region show"),
25707
+ "enterprise.byok.list": c("enterprise keys list"),
25708
+ "enterprise.byok.create": c("enterprise keys add"),
25709
+ "enterprise.byok.revoke": c("enterprise keys revoke"),
25710
+ "enterprise.byok.test": c("enterprise keys test"),
25711
+ "enterprise.byok.rotate": c("enterprise keys rotate"),
25712
+ "enterprise.retention.get": c("enterprise retention show"),
25713
+ "enterprise.retention.put": c("enterprise retention set"),
25714
+ "enterprise.retention.purge": c("enterprise retention purge"),
25715
+ "enterprise.retention.reports": c("enterprise retention reports"),
25716
+ "enterprise.data.export": c("enterprise data export"),
25717
+ "enterprise.data.delete": c("enterprise data delete"),
25718
+ "enterprise.backups.drill": c("enterprise backups drill"),
25719
+ "enterprise.mcp-allowlist.get": c("enterprise mcp-allowlist show"),
25720
+ "enterprise.mcp-allowlist.put": c("enterprise mcp-allowlist set"),
25721
+ "enterprise.evidence-pack": c("enterprise evidence-pack")
25650
25722
  };
25651
25723
  }
25652
25724
  });
@@ -26027,49 +26099,49 @@ function describeLine(text) {
26027
26099
  return clean2.length > 80 ? `${clean2.slice(0, 77)}...` : clean2;
26028
26100
  }
26029
26101
  function inspectRegionTarget(target2, fileText, source) {
26030
- const base4 = { id: target2.id, path: target2.path };
26031
- if (fileText === null) return { ...base4, state: "missing", detail: `${target2.path} does not exist; sync creates it`, syncable: true };
26102
+ const base5 = { id: target2.id, path: target2.path };
26103
+ if (fileText === null) return { ...base5, state: "missing", detail: `${target2.path} does not exist; sync creates it`, syncable: true };
26032
26104
  const scan = scanRegion(fileText);
26033
- if (scan.kind === "damaged") return { ...base4, state: "damaged", detail: `${target2.path}: ${scan.problem}; fix the markers by hand, then run sync`, syncable: false };
26034
- if (scan.kind === "none") return { ...base4, state: "unmanaged", detail: `${target2.path} has no managed region; sync appends one and keeps every existing line`, syncable: true };
26105
+ if (scan.kind === "damaged") return { ...base5, state: "damaged", detail: `${target2.path}: ${scan.problem}; fix the markers by hand, then run sync`, syncable: false };
26106
+ if (scan.kind === "none") return { ...base5, state: "unmanaged", detail: `${target2.path} has no managed region; sync appends one and keeps every existing line`, syncable: true };
26035
26107
  const { region } = scan;
26036
26108
  if (digestOf(region.body) !== region.digest) {
26037
26109
  const expected = regionBody(source.text);
26038
26110
  const diff = firstDifference(region.body, region.revision === source.revision ? expected : region.body);
26039
26111
  const where2 = region.revision === source.revision ? `line ${diff.line} of the region` : "the region";
26040
26112
  return {
26041
- ...base4,
26113
+ ...base5,
26042
26114
  state: "edited",
26043
26115
  detail: `${target2.path}: ${where2} was edited by hand${region.revision === source.revision ? ` (found "${describeLine(diff.found)}", the source says "${describeLine(diff.expected)}")` : ""}; move the change into ${RULES_SOURCE_PATH}, or run sync --overwrite-edits to replace it`,
26044
26116
  ...region.revision === source.revision ? { firstDifference: diff } : {},
26045
26117
  syncable: false
26046
26118
  };
26047
26119
  }
26048
- if (region.revision !== source.revision) return { ...base4, state: "stale", detail: `${target2.path} was written from revision ${region.revision}; the source is ${source.revision}; sync updates it`, syncable: true };
26049
- return { ...base4, state: "in_sync", detail: `${target2.path} matches revision ${source.revision}`, syncable: true };
26120
+ if (region.revision !== source.revision) return { ...base5, state: "stale", detail: `${target2.path} was written from revision ${region.revision}; the source is ${source.revision}; sync updates it`, syncable: true };
26121
+ return { ...base5, state: "in_sync", detail: `${target2.path} matches revision ${source.revision}`, syncable: true };
26050
26122
  }
26051
26123
  function planRegionSync(target2, fileText, source, force) {
26052
26124
  const report2 = inspectRegionTarget(target2, fileText, source);
26053
26125
  const region = renderRegion(source.text);
26054
- const base4 = { id: target2.id, path: target2.path };
26126
+ const base5 = { id: target2.id, path: target2.path };
26055
26127
  switch (report2.state) {
26056
26128
  case "in_sync":
26057
- return { ...base4, action: "none", next: null, reason: report2.detail };
26129
+ return { ...base5, action: "none", next: null, reason: report2.detail };
26058
26130
  case "missing":
26059
- return { ...base4, action: "create", next: `${target2.preamble}${region}`, reason: "created" };
26131
+ return { ...base5, action: "create", next: `${target2.preamble}${region}`, reason: "created" };
26060
26132
  case "unmanaged": {
26061
26133
  const text = normaliseText(fileText);
26062
26134
  const joined = text === "" ? "" : text.endsWith("\n\n") ? text : text.endsWith("\n") ? `${text}
26063
26135
  ` : `${text}
26064
26136
 
26065
26137
  `;
26066
- return { ...base4, action: "append", next: `${joined}${region}`, reason: "appended a managed region at the end; every existing line is kept" };
26138
+ return { ...base5, action: "append", next: `${joined}${region}`, reason: "appended a managed region at the end; every existing line is kept" };
26067
26139
  }
26068
26140
  case "stale":
26069
26141
  case "edited": {
26070
- if (report2.state === "edited" && !force) return { ...base4, action: "refuse", next: null, reason: report2.detail };
26142
+ if (report2.state === "edited" && !force) return { ...base5, action: "refuse", next: null, reason: report2.detail };
26071
26143
  const scan = scanRegion(fileText);
26072
- if (scan.kind !== "one") return { ...base4, action: "refuse", next: null, reason: report2.detail };
26144
+ if (scan.kind !== "one") return { ...base5, action: "refuse", next: null, reason: report2.detail };
26073
26145
  const lines = normaliseText(fileText).split("\n");
26074
26146
  const before = lines.slice(0, scan.region.startLine).join("\n");
26075
26147
  const after = lines.slice(scan.region.endLine + 1).join("\n");
@@ -26079,7 +26151,7 @@ function planRegionSync(target2, fileText, source, force) {
26079
26151
  const written = new Set(regionBody(source.text).split("\n"));
26080
26152
  const going = replaced.filter((l) => l.trim() !== "" && !written.has(l));
26081
26153
  return {
26082
- ...base4,
26154
+ ...base5,
26083
26155
  action: report2.state === "edited" ? "force_replace" : "replace",
26084
26156
  next: next.endsWith("\n") ? next : `${next}
26085
26157
  `,
@@ -26088,7 +26160,7 @@ function planRegionSync(target2, fileText, source, force) {
26088
26160
  };
26089
26161
  }
26090
26162
  case "damaged":
26091
- return { ...base4, action: "refuse", next: null, reason: report2.detail };
26163
+ return { ...base5, action: "refuse", next: null, reason: report2.detail };
26092
26164
  }
26093
26165
  }
26094
26166
  function parseSettings(text) {
@@ -26110,23 +26182,23 @@ function contextFileNames(settings) {
26110
26182
  return { names: [], shape: fileName === void 0 ? "none" : "other" };
26111
26183
  }
26112
26184
  function inspectGeminiSettings(target2, fileText) {
26113
- const base4 = { id: target2.id, path: target2.path };
26114
- if (fileText === null) return { ...base4, state: "missing", detail: `${target2.path} does not exist; sync creates it`, syncable: true };
26185
+ const base5 = { id: target2.id, path: target2.path };
26186
+ if (fileText === null) return { ...base5, state: "missing", detail: `${target2.path} does not exist; sync creates it`, syncable: true };
26115
26187
  const parsed = parseSettings(fileText);
26116
- if (!parsed.ok) return { ...base4, state: "damaged", detail: `${target2.path} ${parsed.problem}; fix it by hand, then run sync`, syncable: false };
26188
+ if (!parsed.ok) return { ...base5, state: "damaged", detail: `${target2.path} ${parsed.problem}; fix it by hand, then run sync`, syncable: false };
26117
26189
  const { names, shape: shape2 } = contextFileNames(parsed.value);
26118
- if (shape2 === "other") return { ...base4, state: "damaged", detail: `${target2.path}: context.fileName is neither a string nor a list of strings; fix it by hand, then run sync`, syncable: false };
26190
+ if (shape2 === "other") return { ...base5, state: "damaged", detail: `${target2.path}: context.fileName is neither a string nor a list of strings; fix it by hand, then run sync`, syncable: false };
26119
26191
  const missing = GEMINI_CONTEXT_FILES.filter((name2) => !names.includes(name2));
26120
- if (missing.length === 0) return { ...base4, state: "in_sync", detail: `${target2.path} lists ${GEMINI_CONTEXT_FILES.join(" and ")}`, syncable: true };
26121
- return { ...base4, state: "unmanaged", detail: `${target2.path}: context.fileName does not list ${missing.join(" and ")}; sync adds it and keeps every other setting`, syncable: true };
26192
+ if (missing.length === 0) return { ...base5, state: "in_sync", detail: `${target2.path} lists ${GEMINI_CONTEXT_FILES.join(" and ")}`, syncable: true };
26193
+ return { ...base5, state: "unmanaged", detail: `${target2.path}: context.fileName does not list ${missing.join(" and ")}; sync adds it and keeps every other setting`, syncable: true };
26122
26194
  }
26123
26195
  function planGeminiSettingsSync(target2, fileText) {
26124
26196
  const report2 = inspectGeminiSettings(target2, fileText);
26125
- const base4 = { id: target2.id, path: target2.path };
26126
- if (report2.state === "in_sync") return { ...base4, action: "none", next: null, reason: report2.detail };
26127
- if (report2.state === "damaged") return { ...base4, action: "refuse", next: null, reason: report2.detail };
26197
+ const base5 = { id: target2.id, path: target2.path };
26198
+ if (report2.state === "in_sync") return { ...base5, action: "none", next: null, reason: report2.detail };
26199
+ if (report2.state === "damaged") return { ...base5, action: "refuse", next: null, reason: report2.detail };
26128
26200
  const parsed = parseSettings(fileText);
26129
- if (!parsed.ok) return { ...base4, action: "refuse", next: null, reason: report2.detail };
26201
+ if (!parsed.ok) return { ...base5, action: "refuse", next: null, reason: report2.detail };
26130
26202
  const settings = { ...parsed.value };
26131
26203
  const existing = contextFileNames(settings).names;
26132
26204
  const context4 = settings["context"] !== null && typeof settings["context"] === "object" && !Array.isArray(settings["context"]) ? { ...settings["context"] } : {};
@@ -26134,7 +26206,7 @@ function planGeminiSettingsSync(target2, fileText) {
26134
26206
  for (const name2 of GEMINI_CONTEXT_FILES) if (!names.includes(name2)) names.push(name2);
26135
26207
  context4["fileName"] = names;
26136
26208
  settings["context"] = context4;
26137
- return { ...base4, action: fileText === null ? "create" : "append", next: `${JSON.stringify(settings, null, 2)}
26209
+ return { ...base5, action: fileText === null ? "create" : "append", next: `${JSON.stringify(settings, null, 2)}
26138
26210
  `, reason: fileText === null ? "created" : "added the missing names to context.fileName; nothing else changed" };
26139
26211
  }
26140
26212
  function checkRules(source, input2) {
@@ -26523,6 +26595,281 @@ var init_egress = __esm({
26523
26595
  }
26524
26596
  });
26525
26597
 
26598
+ // ../contracts/src/enterprise.ts
26599
+ function parseCsv(text) {
26600
+ const rows = [];
26601
+ let row = [];
26602
+ let cell = "";
26603
+ let quoted = false;
26604
+ for (let i2 = 0; i2 < text.length; i2 += 1) {
26605
+ const ch = text[i2];
26606
+ if (quoted) {
26607
+ if (ch === '"' && text[i2 + 1] === '"') {
26608
+ cell += '"';
26609
+ i2 += 1;
26610
+ } else if (ch === '"') quoted = false;
26611
+ else cell += ch;
26612
+ } else if (ch === '"') quoted = true;
26613
+ else if (ch === ",") {
26614
+ row.push(cell);
26615
+ cell = "";
26616
+ } else if (ch === "\n" || ch === "\r") {
26617
+ if (ch === "\r" && text[i2 + 1] === "\n") i2 += 1;
26618
+ row.push(cell);
26619
+ rows.push(row);
26620
+ row = [];
26621
+ cell = "";
26622
+ } else cell += ch;
26623
+ }
26624
+ if (cell !== "" || row.length > 0) {
26625
+ row.push(cell);
26626
+ rows.push(row);
26627
+ }
26628
+ return rows;
26629
+ }
26630
+ function parseAuditCsv(csv) {
26631
+ const rows = parseCsv(csv);
26632
+ const header = rows[0] ?? [];
26633
+ if (header.join(",") !== AUDIT_CSV_COLUMNS.join(",")) throw new Error("unexpected header");
26634
+ return rows.slice(1).map((cells) => {
26635
+ if (cells.length !== AUDIT_CSV_COLUMNS.length) throw new Error("wrong column count");
26636
+ const value = (name2) => {
26637
+ const raw = cells[AUDIT_CSV_COLUMNS.indexOf(name2)] ?? "";
26638
+ return /^'[=+\-@\t\r]/.test(raw) ? raw.slice(1) : raw;
26639
+ };
26640
+ return AuditEvent.parse({
26641
+ tenantId: value("tenantId"),
26642
+ seq: Number(value("seq")),
26643
+ eventId: value("eventId"),
26644
+ at: value("at"),
26645
+ actor: value("actor"),
26646
+ principalType: value("principalType"),
26647
+ role: value("role") === "" ? null : value("role"),
26648
+ action: value("action"),
26649
+ category: value("category"),
26650
+ target: { type: value("targetType"), id: value("targetId") },
26651
+ result: value("result"),
26652
+ prevHash: value("prevHash"),
26653
+ hash: value("hash")
26654
+ });
26655
+ });
26656
+ }
26657
+ function verifyAuditExport(tenantId, csv, manifest) {
26658
+ let events;
26659
+ try {
26660
+ events = parseAuditCsv(csv);
26661
+ } catch {
26662
+ return { tenantId, ok: false, checked: 0, head: null, reason: "bad_hash", manifestOk: false };
26663
+ }
26664
+ const chain = verifyAuditChain(tenantId, events, { prevHash: manifest.firstSeq === null || manifest.firstSeq === 1 ? AUDIT_GENESIS_HASH : events[0]?.prevHash ?? AUDIT_GENESIS_HASH, seq: (manifest.firstSeq ?? 1) - 1 });
26665
+ const manifestOk = manifest.tenantId === tenantId && manifest.count === events.length && manifest.lastSeq === (events.at(-1)?.seq ?? null) && manifest.head === (events.at(-1)?.hash ?? null) && manifest.firstSeq === (events[0]?.seq ?? null);
26666
+ return { ...chain, ok: chain.ok && manifestOk, manifestOk };
26667
+ }
26668
+ var ENTERPRISE_FEATURES, EnterpriseFeature, EnterpriseEntitlements, roleName, shortId, SSO_PROTOCOLS, SsoProtocol, IDENTITY_CONNECTION_STATUSES, ConnectionStatus, SsoConnection, ScimDirectory, PORTAL_INTENTS, PortalIntent, PortalLinkRequest, PortalLink, TestConnectionResult, EnterpriseIdentityStatus, GroupRoleMapping, GROUP_ROLE_CAPS, GroupRoleCap, GroupMappingSet, PutGroupMappingsRequest, DirectorySyncReport, AUDIT_CSV_COLUMNS, AuditExportManifest, AuditExport, STREAM_STATUSES, AuditStreamTarget, CreateAuditStreamTargetRequest, AuditStreamTargetList, AuditStreamDelivery, StreamRunReport, REGIONS, Region, STORE_KINDS, StoreKind, StoreLocation, ResidencyPolicy, PinRegionRequest, RegionMigrationRequest, StoreLocationReport, BYOK_PROVIDERS, ByokProvider, BYOK_STATUSES, ByokStatus, ByokAlias, ByokKey, ByokKeyList, CreateByokKeyRequest, RotateByokKeyRequest, ByokTestResult, RETENTION_CLASSES, RetentionClass, RetentionRule, EnterpriseRetentionPolicy, PutRetentionPolicyRequest, PurgeLine, PurgeReport, PurgeReportList, ExportScope, DataRequest, DataExportReport, DataDeletionReport, RestoreDrillReport, EnterpriseMcpAllowlistEntry, McpAllowlist, PutMcpAllowlistRequest, EvidencePack, base4, enterprisePaths, FIXTURE_AT2, ENTERPRISE_FIXTURES;
26669
+ var init_enterprise = __esm({
26670
+ "../contracts/src/enterprise.ts"() {
26671
+ "use strict";
26672
+ init_zod();
26673
+ init_audit();
26674
+ init_common();
26675
+ init_plans();
26676
+ ENTERPRISE_FEATURES = ["sso", "scim", "audit_export", "siem_stream", "data_residency", "byok", "retention", "policy_as_code", "mcp_allowlist"];
26677
+ EnterpriseFeature = external_exports.enum(ENTERPRISE_FEATURES);
26678
+ EnterpriseEntitlements = external_exports.object({ tenantId: TenantId, plan: BillingPlanId, features: external_exports.record(EnterpriseFeature, external_exports.boolean()) }).strict();
26679
+ roleName = external_exports.enum(["owner", "admin", "member", "viewer"]);
26680
+ shortId = external_exports.string().min(1).max(64);
26681
+ SSO_PROTOCOLS = ["saml", "oidc"];
26682
+ SsoProtocol = external_exports.enum(SSO_PROTOCOLS);
26683
+ IDENTITY_CONNECTION_STATUSES = ["not_configured", "pending", "active", "failed", "disabled"];
26684
+ ConnectionStatus = external_exports.enum(IDENTITY_CONNECTION_STATUSES);
26685
+ SsoConnection = external_exports.object({
26686
+ tenantId: TenantId,
26687
+ connectionId: shortId.nullable(),
26688
+ protocol: SsoProtocol.nullable(),
26689
+ status: ConnectionStatus,
26690
+ domains: external_exports.array(external_exports.string().min(1).max(253)).max(20),
26691
+ lastTestedAt: Timestamp.nullable(),
26692
+ lastTestOk: external_exports.boolean().nullable()
26693
+ }).strict();
26694
+ ScimDirectory = external_exports.object({
26695
+ tenantId: TenantId,
26696
+ directoryId: shortId.nullable(),
26697
+ status: ConnectionStatus,
26698
+ userCount: external_exports.number().int().nonnegative(),
26699
+ groupCount: external_exports.number().int().nonnegative(),
26700
+ lastSyncAt: Timestamp.nullable()
26701
+ }).strict();
26702
+ PORTAL_INTENTS = ["sso", "dsync"];
26703
+ PortalIntent = external_exports.enum(PORTAL_INTENTS);
26704
+ PortalLinkRequest = external_exports.object({ intent: PortalIntent }).strict();
26705
+ PortalLink = external_exports.object({ tenantId: TenantId, intent: PortalIntent, url: external_exports.string().url(), expiresAt: Timestamp }).strict();
26706
+ TestConnectionResult = external_exports.object({ tenantId: TenantId, intent: PortalIntent, ok: external_exports.boolean(), checkedAt: Timestamp, detail: external_exports.string().max(300) }).strict();
26707
+ EnterpriseIdentityStatus = external_exports.object({ tenantId: TenantId, sso: SsoConnection, scim: ScimDirectory }).strict();
26708
+ GroupRoleMapping = external_exports.object({ tenantId: TenantId, groupName: external_exports.string().min(1).max(200), role: roleName }).strict();
26709
+ GROUP_ROLE_CAPS = ["admin", "member", "viewer"];
26710
+ GroupRoleCap = external_exports.enum(GROUP_ROLE_CAPS);
26711
+ GroupMappingSet = external_exports.object({ tenantId: TenantId, cap: GroupRoleCap, mappings: external_exports.array(GroupRoleMapping).max(200), updatedAt: Timestamp.nullable() }).strict();
26712
+ PutGroupMappingsRequest = external_exports.object({ cap: GroupRoleCap.default("admin"), mappings: external_exports.array(external_exports.object({ groupName: external_exports.string().min(1).max(200), role: roleName }).strict()).max(200) }).strict();
26713
+ DirectorySyncReport = external_exports.object({
26714
+ tenantId: TenantId,
26715
+ syncedAt: Timestamp,
26716
+ rolesChanged: external_exports.number().int().nonnegative(),
26717
+ deprovisioned: external_exports.number().int().nonnegative(),
26718
+ /** Seconds from the directory marking a user inactive to this sync applying it, per deprovisioned user. */
26719
+ deprovisionLatencySeconds: external_exports.array(external_exports.number().nonnegative()),
26720
+ withinDeadline: external_exports.boolean()
26721
+ }).strict();
26722
+ AUDIT_CSV_COLUMNS = ["tenantId", "seq", "eventId", "at", "actor", "principalType", "role", "action", "category", "targetType", "targetId", "result", "prevHash", "hash"];
26723
+ AuditExportManifest = external_exports.object({
26724
+ tenantId: TenantId,
26725
+ exportId: shortId,
26726
+ format: external_exports.literal("csv"),
26727
+ count: external_exports.number().int().nonnegative(),
26728
+ firstSeq: external_exports.number().int().positive().nullable(),
26729
+ lastSeq: external_exports.number().int().positive().nullable(),
26730
+ head: external_exports.string().regex(/^[0-9a-f]{64}$/).nullable(),
26731
+ exportedAt: Timestamp
26732
+ }).strict();
26733
+ AuditExport = external_exports.object({ manifest: AuditExportManifest, csv: external_exports.string() }).strict();
26734
+ STREAM_STATUSES = ["active", "paused", "failing"];
26735
+ AuditStreamTarget = external_exports.object({
26736
+ tenantId: TenantId,
26737
+ targetId: shortId,
26738
+ /** Where deliveries go. https only. */
26739
+ url: external_exports.string().url().refine((u) => u.startsWith("https://"), "must be https"),
26740
+ status: external_exports.enum(STREAM_STATUSES),
26741
+ /** The newest chain sequence the target has acknowledged. */
26742
+ deliveredThroughSeq: external_exports.number().int().nonnegative(),
26743
+ lastError: external_exports.string().max(200).nullable(),
26744
+ createdAt: Timestamp
26745
+ }).strict();
26746
+ CreateAuditStreamTargetRequest = external_exports.object({ url: external_exports.string().url().refine((u) => u.startsWith("https://"), "must be https"), signingSecret: external_exports.string().min(16).max(200) }).strict();
26747
+ AuditStreamTargetList = external_exports.object({ tenantId: TenantId, targets: external_exports.array(AuditStreamTarget) }).strict();
26748
+ AuditStreamDelivery = external_exports.object({
26749
+ tenantId: TenantId,
26750
+ targetId: shortId,
26751
+ idempotencyKey: external_exports.string().min(1).max(200),
26752
+ batchSeq: external_exports.number().int().positive(),
26753
+ events: external_exports.array(AuditEvent).min(1).max(500)
26754
+ }).strict();
26755
+ StreamRunReport = external_exports.object({ tenantId: TenantId, targetId: shortId, delivered: external_exports.number().int().nonnegative(), batches: external_exports.number().int().nonnegative(), failed: external_exports.boolean(), deliveredThroughSeq: external_exports.number().int().nonnegative() }).strict();
26756
+ REGIONS = ["global", "eu", "us"];
26757
+ Region = external_exports.enum(REGIONS);
26758
+ STORE_KINDS = ["d1", "r2", "kv", "durable_objects", "vectors", "logs", "backups"];
26759
+ StoreKind = external_exports.enum(STORE_KINDS);
26760
+ StoreLocation = external_exports.object({ store: StoreKind, region: Region, detail: external_exports.string().max(200) }).strict();
26761
+ ResidencyPolicy = external_exports.object({
26762
+ tenantId: TenantId,
26763
+ region: Region,
26764
+ pinnedAt: Timestamp.nullable(),
26765
+ /** Supported pin targets, so a refusal and the settings screen show the same list. */
26766
+ supportedRegions: external_exports.array(Region),
26767
+ pendingMigration: external_exports.object({ from: Region, to: Region, requestedAt: Timestamp, requestedBy: external_exports.string().min(1).max(200), status: external_exports.enum(["requested", "running", "done", "failed"]) }).strict().nullable()
26768
+ }).strict();
26769
+ PinRegionRequest = external_exports.object({ region: Region }).strict();
26770
+ RegionMigrationRequest = external_exports.object({ to: Region, reason: external_exports.string().min(1).max(300) }).strict();
26771
+ StoreLocationReport = external_exports.object({ tenantId: TenantId, region: Region, checkedAt: Timestamp, stores: external_exports.array(StoreLocation), ok: external_exports.boolean(), violations: external_exports.array(external_exports.string().max(200)) }).strict();
26772
+ BYOK_PROVIDERS = ["anthropic", "openai", "google"];
26773
+ ByokProvider = external_exports.enum(BYOK_PROVIDERS);
26774
+ BYOK_STATUSES = ["untested", "active", "failed", "revoked"];
26775
+ ByokStatus = external_exports.enum(BYOK_STATUSES);
26776
+ ByokAlias = external_exports.string().min(1).max(60).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and hyphens");
26777
+ ByokKey = external_exports.object({
26778
+ tenantId: TenantId,
26779
+ alias: ByokAlias,
26780
+ provider: ByokProvider,
26781
+ status: ByokStatus,
26782
+ /** Increments on each rotation. */
26783
+ version: external_exports.number().int().positive(),
26784
+ /** No fingerprint and no last characters are kept: the alias is the only reference. */
26785
+ lastTestedAt: Timestamp.nullable(),
26786
+ createdAt: Timestamp,
26787
+ revokedAt: Timestamp.nullable()
26788
+ }).strict();
26789
+ ByokKeyList = external_exports.object({ tenantId: TenantId, keys: external_exports.array(ByokKey) }).strict();
26790
+ CreateByokKeyRequest = external_exports.object({ alias: ByokAlias, provider: ByokProvider, value: external_exports.string().min(8).max(500) }).strict();
26791
+ RotateByokKeyRequest = external_exports.object({ value: external_exports.string().min(8).max(500) }).strict();
26792
+ ByokTestResult = external_exports.object({ tenantId: TenantId, alias: ByokAlias, ok: external_exports.boolean(), checkedAt: Timestamp, detail: external_exports.string().max(200) }).strict();
26793
+ RETENTION_CLASSES = ["memory", "derived_data", "agent_conversations", "ci_artifacts", "run_logs"];
26794
+ RetentionClass = external_exports.enum(RETENTION_CLASSES);
26795
+ RetentionRule = external_exports.object({ dataClass: RetentionClass, days: external_exports.number().int().min(1).max(3650) }).strict();
26796
+ EnterpriseRetentionPolicy = external_exports.object({ tenantId: TenantId, rules: external_exports.array(RetentionRule).max(RETENTION_CLASSES.length), updatedAt: Timestamp.nullable() }).strict();
26797
+ PutRetentionPolicyRequest = external_exports.object({ rules: external_exports.array(RetentionRule).max(RETENTION_CLASSES.length) }).strict();
26798
+ PurgeLine = external_exports.object({ dataClass: RetentionClass, store: StoreKind, cutoff: Timestamp, purged: external_exports.number().int().nonnegative() }).strict();
26799
+ PurgeReport = external_exports.object({ tenantId: TenantId, purgeId: shortId, ranAt: Timestamp, trigger: external_exports.enum(["schedule", "manual"]), lines: external_exports.array(PurgeLine), totalPurged: external_exports.number().int().nonnegative() }).strict();
26800
+ PurgeReportList = external_exports.object({ tenantId: TenantId, reports: external_exports.array(PurgeReport) }).strict();
26801
+ ExportScope = external_exports.enum(["tenant", "project", "user"]);
26802
+ DataRequest = external_exports.object({ scope: ExportScope, subjectId: external_exports.string().min(1).max(128).optional() }).strict();
26803
+ DataExportReport = external_exports.object({ tenantId: TenantId, scope: ExportScope, exportedAt: Timestamp, stores: external_exports.array(external_exports.object({ store: StoreKind, dataClass: external_exports.string().max(60), rows: external_exports.number().int().nonnegative() }).strict()), totalRows: external_exports.number().int().nonnegative(), ndjson: external_exports.string() }).strict();
26804
+ DataDeletionReport = external_exports.object({
26805
+ tenantId: TenantId,
26806
+ scope: ExportScope,
26807
+ deletedAt: Timestamp,
26808
+ stores: external_exports.array(external_exports.object({ store: StoreKind, dataClass: external_exports.string().max(60), rows: external_exports.number().int().nonnegative() }).strict()),
26809
+ totalRows: external_exports.number().int().nonnegative(),
26810
+ backupsPurgedBy: Timestamp
26811
+ }).strict();
26812
+ RestoreDrillReport = external_exports.object({
26813
+ tenantId: TenantId,
26814
+ drillId: shortId,
26815
+ ranAt: Timestamp,
26816
+ restoredFrom: Timestamp,
26817
+ tables: external_exports.array(external_exports.object({ name: external_exports.string().min(1).max(80), expected: external_exports.number().int().nonnegative(), restored: external_exports.number().int().nonnegative() }).strict()),
26818
+ ok: external_exports.boolean(),
26819
+ durationMs: external_exports.number().int().nonnegative()
26820
+ }).strict();
26821
+ EnterpriseMcpAllowlistEntry = external_exports.object({ server: external_exports.string().min(1).max(253), note: external_exports.string().max(200).optional() }).strict();
26822
+ McpAllowlist = external_exports.object({ tenantId: TenantId, mode: external_exports.enum(["off", "allowlist"]), entries: external_exports.array(EnterpriseMcpAllowlistEntry).max(200), updatedAt: Timestamp.nullable() }).strict();
26823
+ PutMcpAllowlistRequest = external_exports.object({ mode: external_exports.enum(["off", "allowlist"]), entries: external_exports.array(EnterpriseMcpAllowlistEntry).max(200) }).strict();
26824
+ EvidencePack = external_exports.object({
26825
+ tenantId: TenantId,
26826
+ generatedAt: Timestamp,
26827
+ chain: external_exports.object({ ok: external_exports.boolean(), checked: external_exports.number().int().nonnegative(), head: external_exports.string().nullable() }).strict(),
26828
+ agentActions: external_exports.object({ total: external_exports.number().int().nonnegative(), byAction: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()), denied: external_exports.number().int().nonnegative() }).strict(),
26829
+ controls: external_exports.array(external_exports.object({ id: external_exports.string().max(40), title: external_exports.string().max(120), state: external_exports.enum(["enabled", "not_configured"]), evidence: external_exports.string().max(200) }).strict())
26830
+ }).strict();
26831
+ base4 = (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/enterprise`;
26832
+ enterprisePaths = {
26833
+ entitlements: (t2) => `${base4(t2)}/entitlements`,
26834
+ identity: (t2) => `${base4(t2)}/identity`,
26835
+ portalLink: (t2) => `${base4(t2)}/identity/portal-link`,
26836
+ testConnection: (t2) => `${base4(t2)}/identity/test`,
26837
+ syncDirectory: (t2) => `${base4(t2)}/identity/sync`,
26838
+ groupMappings: (t2) => `${base4(t2)}/identity/group-mappings`,
26839
+ auditExports: (t2) => `${base4(t2)}/audit-exports`,
26840
+ streamTargets: (t2) => `${base4(t2)}/audit-streams`,
26841
+ streamTarget: (t2, id2) => `${base4(t2)}/audit-streams/${encodeURIComponent(id2)}`,
26842
+ streamRun: (t2, id2) => `${base4(t2)}/audit-streams/${encodeURIComponent(id2)}/run`,
26843
+ residency: (t2) => `${base4(t2)}/residency`,
26844
+ residencyMigrations: (t2) => `${base4(t2)}/residency/migrations`,
26845
+ storeLocations: (t2) => `${base4(t2)}/residency/stores`,
26846
+ byokKeys: (t2) => `${base4(t2)}/byok/keys`,
26847
+ byokKey: (t2, alias) => `${base4(t2)}/byok/keys/${encodeURIComponent(alias)}`,
26848
+ byokTest: (t2, alias) => `${base4(t2)}/byok/keys/${encodeURIComponent(alias)}/test`,
26849
+ byokRotate: (t2, alias) => `${base4(t2)}/byok/keys/${encodeURIComponent(alias)}/rotate`,
26850
+ retention: (t2) => `${base4(t2)}/retention`,
26851
+ purge: (t2) => `${base4(t2)}/retention/purge`,
26852
+ purgeReports: (t2) => `${base4(t2)}/retention/reports`,
26853
+ dataExport: (t2) => `${base4(t2)}/data/export`,
26854
+ dataDelete: (t2) => `${base4(t2)}/data/delete`,
26855
+ restoreDrill: (t2) => `${base4(t2)}/backups/drill`,
26856
+ mcpAllowlist: (t2) => `${base4(t2)}/mcp-allowlist`,
26857
+ evidencePack: (t2) => `${base4(t2)}/evidence-pack`
26858
+ };
26859
+ FIXTURE_AT2 = "2026-10-10T00:00:00.000Z";
26860
+ ENTERPRISE_FIXTURES = {
26861
+ sso: SsoConnection.parse({ tenantId: "tm-1", connectionId: "conn_1", protocol: "saml", status: "active", domains: ["example.com"], lastTestedAt: FIXTURE_AT2, lastTestOk: true }),
26862
+ scim: ScimDirectory.parse({ tenantId: "tm-1", directoryId: "dir_1", status: "active", userCount: 12, groupCount: 3, lastSyncAt: FIXTURE_AT2 }),
26863
+ groupMappings: GroupMappingSet.parse({ tenantId: "tm-1", cap: "admin", mappings: [{ tenantId: "tm-1", groupName: "Engineering", role: "member" }, { tenantId: "tm-1", groupName: "Platform", role: "admin" }], updatedAt: FIXTURE_AT2 }),
26864
+ residency: ResidencyPolicy.parse({ tenantId: "tm-1", region: "eu", pinnedAt: FIXTURE_AT2, supportedRegions: ["global", "eu", "us"], pendingMigration: null }),
26865
+ byok: ByokKey.parse({ tenantId: "tm-1", alias: "team-anthropic", provider: "anthropic", status: "active", version: 1, lastTestedAt: FIXTURE_AT2, createdAt: FIXTURE_AT2, revokedAt: null }),
26866
+ retention: EnterpriseRetentionPolicy.parse({ tenantId: "tm-1", rules: [{ dataClass: "run_logs", days: 90 }], updatedAt: FIXTURE_AT2 }),
26867
+ streamTarget: AuditStreamTarget.parse({ tenantId: "tm-1", targetId: "tgt_1", url: "https://siem.example.com/ingest", status: "active", deliveredThroughSeq: 3, lastError: null, createdAt: FIXTURE_AT2 }),
26868
+ mcpAllowlist: McpAllowlist.parse({ tenantId: "tm-1", mode: "allowlist", entries: [{ server: "mcp.example.com" }], updatedAt: FIXTURE_AT2 })
26869
+ };
26870
+ }
26871
+ });
26872
+
26526
26873
  // ../contracts/src/observability.ts
26527
26874
  var RUN_EVENT_TYPES, RunEventType, OBS_RUN_STATUSES, ObsRunStatus, REVIEW_OUTCOMES, ReviewOutcome, Name2, Level, RunEventFields, RunEvent, RunEventInput, IngestRunEventsRequest, RunResume, LogRecord, LogInput, Span, SpanInput, IngestTelemetryRequest, IngestTelemetryResult, LogRecordList, ObsRun, TraceBundle, METRIC_KINDS, MetricKind, METRIC_DIMENSIONS, MetricDimension, MetricDimensions, MetricInput, Metric, IngestMetricsRequest, IngestMetricsResult, MetricTotal, MetricTotals, CostRowV1, CostSummaryV1, CostReport, ReconcileLine, Reconciliation, ALERT_KINDS, AlertKind, ALERT_CHANNELS, AlertChannel, AlertTarget, AlertThreshold, AlertRule, PutAlertRuleRequest, DeleteAlertRuleRequest, AlertDelivery, Incident, AlertOverview, EvaluateAlertsResult, AlertNotice, RETENTION_COVERS, RETENTION_KEEPS, RetentionPolicy, RetentionPurgeResult, ComparisonEntry, ComparisonReport, ReplayResult, EvalRow, EvalReport, RunEvalRequest, DecisionSummary, ObserveStatus, t, p, observePaths;
26528
26875
  var init_observability = __esm({
@@ -26825,6 +27172,7 @@ var init_src = __esm({
26825
27172
  init_rules_sync();
26826
27173
  init_pr_routing();
26827
27174
  init_egress();
27175
+ init_enterprise();
26828
27176
  init_observability();
26829
27177
  }
26830
27178
  });
@@ -34160,12 +34508,12 @@ var require_dist = __commonJS({
34160
34508
  });
34161
34509
 
34162
34510
  // src/assets.ts
34163
- import { basename as basename5, join as join25, resolve as resolve13 } from "node:path";
34511
+ import { basename as basename5, join as join25, resolve as resolve14 } from "node:path";
34164
34512
  import { fileURLToPath } from "node:url";
34165
34513
  function packageRoot(env = process.env) {
34166
34514
  const override = env["MVRX_PACKAGE_ROOT"];
34167
34515
  if (override !== void 0 && override !== "") return override;
34168
- return resolve13(fileURLToPath(new URL(".", import.meta.url)), "..");
34516
+ return resolve14(fileURLToPath(new URL(".", import.meta.url)), "..");
34169
34517
  }
34170
34518
  function assetDir(env = process.env) {
34171
34519
  const override = env["MVRX_ASSET_DIR"];
@@ -34178,7 +34526,7 @@ var VERSION;
34178
34526
  var init_assets = __esm({
34179
34527
  "src/assets.ts"() {
34180
34528
  "use strict";
34181
- VERSION = true ? "0.1.137" : "0.0.0-dev";
34529
+ VERSION = true ? "0.1.138" : "0.0.0-dev";
34182
34530
  }
34183
34531
  });
34184
34532
 
@@ -34273,13 +34621,13 @@ function int64FromString(dec) {
34273
34621
  if (minus) {
34274
34622
  dec = dec.slice(1);
34275
34623
  }
34276
- const base4 = 1e6;
34624
+ const base5 = 1e6;
34277
34625
  let lowBits = 0;
34278
34626
  let highBits = 0;
34279
34627
  function add1e6digit(begin, end) {
34280
34628
  const digit1e6 = Number(dec.slice(begin, end));
34281
- highBits *= base4;
34282
- lowBits = lowBits * base4 + digit1e6;
34629
+ highBits *= base5;
34630
+ lowBits = lowBits * base5 + digit1e6;
34283
34631
  if (lowBits >= TWO_PWR_32_DBL) {
34284
34632
  highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0);
34285
34633
  lowBits = lowBits % TWO_PWR_32_DBL;
@@ -34311,14 +34659,14 @@ function uInt64ToString(lo, hi) {
34311
34659
  let digitA = low + mid * 6777216 + high * 6710656;
34312
34660
  let digitB = mid + high * 8147497;
34313
34661
  let digitC = high * 2;
34314
- const base4 = 1e7;
34315
- if (digitA >= base4) {
34316
- digitB += Math.floor(digitA / base4);
34317
- digitA %= base4;
34662
+ const base5 = 1e7;
34663
+ if (digitA >= base5) {
34664
+ digitB += Math.floor(digitA / base5);
34665
+ digitA %= base5;
34318
34666
  }
34319
- if (digitB >= base4) {
34320
- digitC += Math.floor(digitB / base4);
34321
- digitB %= base4;
34667
+ if (digitB >= base5) {
34668
+ digitC += Math.floor(digitB / base5);
34669
+ digitB %= base5;
34322
34670
  }
34323
34671
  return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) + decimalFrom1e7WithLeadingZeros(digitA);
34324
34672
  }
@@ -35596,7 +35944,7 @@ function createFileRegistry(...args2) {
35596
35944
  if (seen.has(protoFileName)) {
35597
35945
  continue;
35598
35946
  }
35599
- const dep = resolve16(protoFileName);
35947
+ const dep = resolve17(protoFileName);
35600
35948
  if (!dep) {
35601
35949
  throw new Error(`Unable to resolve ${protoFileName}, imported by ${file2.name}`);
35602
35950
  }
@@ -35610,7 +35958,7 @@ function createFileRegistry(...args2) {
35610
35958
  return deps.concat(...deps.map(recurseDeps));
35611
35959
  };
35612
35960
  const input2 = args2[0];
35613
- const resolve16 = args2[1];
35961
+ const resolve17 = args2[1];
35614
35962
  const seen = /* @__PURE__ */ new Set();
35615
35963
  for (const file2 of [input2, ...recurseDeps(input2)].reverse()) {
35616
35964
  addFile(file2, registry2);
@@ -37445,10 +37793,10 @@ var init_scip_pb = __esm({
37445
37793
 
37446
37794
  // ../index-builder/src/languages.ts
37447
37795
  function languageForPath(path) {
37448
- const base4 = path.slice(path.lastIndexOf("/") + 1);
37449
- const dot = base4.lastIndexOf(".");
37796
+ const base5 = path.slice(path.lastIndexOf("/") + 1);
37797
+ const dot = base5.lastIndexOf(".");
37450
37798
  if (dot <= 0) return null;
37451
- return BY_EXTENSION.get(base4.slice(dot).toLowerCase()) ?? null;
37799
+ return BY_EXTENSION.get(base5.slice(dot).toLowerCase()) ?? null;
37452
37800
  }
37453
37801
  var BY_EXTENSION;
37454
37802
  var init_languages = __esm({
@@ -38023,13 +38371,13 @@ async function Module2(moduleArg = {}) {
38023
38371
  }
38024
38372
  readAsync = /* @__PURE__ */ __name(async (url2) => {
38025
38373
  if (isFileURI(url2)) {
38026
- return new Promise((resolve16, reject) => {
38374
+ return new Promise((resolve17, reject) => {
38027
38375
  var xhr = new XMLHttpRequest();
38028
38376
  xhr.open("GET", url2, true);
38029
38377
  xhr.responseType = "arraybuffer";
38030
38378
  xhr.onload = () => {
38031
38379
  if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
38032
- resolve16(xhr.response);
38380
+ resolve17(xhr.response);
38033
38381
  return;
38034
38382
  }
38035
38383
  reject(xhr.status);
@@ -38225,9 +38573,9 @@ async function Module2(moduleArg = {}) {
38225
38573
  __name(receiveInstantiationResult, "receiveInstantiationResult");
38226
38574
  var info2 = getWasmImports();
38227
38575
  if (Module["instantiateWasm"]) {
38228
- return new Promise((resolve16, reject) => {
38576
+ return new Promise((resolve17, reject) => {
38229
38577
  Module["instantiateWasm"](info2, (mod, inst) => {
38230
- resolve16(receiveInstance(mod, inst));
38578
+ resolve17(receiveInstance(mod, inst));
38231
38579
  });
38232
38580
  });
38233
38581
  }
@@ -39560,8 +39908,8 @@ async function Module2(moduleArg = {}) {
39560
39908
  if (runtimeInitialized) {
39561
39909
  moduleRtn = Module;
39562
39910
  } else {
39563
- moduleRtn = new Promise((resolve16, reject) => {
39564
- readyPromiseResolve = resolve16;
39911
+ moduleRtn = new Promise((resolve17, reject) => {
39912
+ readyPromiseResolve = resolve17;
39565
39913
  readyPromiseReject = reject;
39566
39914
  });
39567
39915
  }
@@ -42218,7 +42566,7 @@ var init_snapshot = __esm({
42218
42566
  // ../index-builder/src/upload.ts
42219
42567
  async function uploadSnapshot(options) {
42220
42568
  const doFetch = options.fetch ?? fetch;
42221
- const base4 = options.serviceUrl.replace(/\/+$/, "");
42569
+ const base5 = options.serviceUrl.replace(/\/+$/, "");
42222
42570
  const manifest = SnapshotManifest.parse(options.manifest);
42223
42571
  const { tenantId, repository, projectId, commitSha } = manifest;
42224
42572
  const byProject = projectId !== void 0 && (repository === void 0 || options.byProject === true);
@@ -42228,7 +42576,7 @@ async function uploadSnapshot(options) {
42228
42576
  for (let attempt2 = 1; ; attempt2 += 1) {
42229
42577
  let failure4;
42230
42578
  try {
42231
- const response = await doFetch(`${base4}${path}`, { method: "POST", headers, body: body2 });
42579
+ const response = await doFetch(`${base5}${path}`, { method: "POST", headers, body: body2 });
42232
42580
  if (response.ok) return response;
42233
42581
  const retryable = response.status === 429 || response.status >= 500;
42234
42582
  if (!retryable || attempt2 >= ATTEMPTS) {
@@ -42240,7 +42588,7 @@ async function uploadSnapshot(options) {
42240
42588
  failure4 = error62 instanceof Error ? error62.message : String(error62);
42241
42589
  if (attempt2 >= ATTEMPTS) throw new Error(`POST ${path} failed: ${failure4}`);
42242
42590
  }
42243
- await new Promise((resolve16) => setTimeout(resolve16, (options.retryDelayMs ?? 500) * attempt2));
42591
+ await new Promise((resolve17) => setTimeout(resolve17, (options.retryDelayMs ?? 500) * attempt2));
42244
42592
  }
42245
42593
  };
42246
42594
  const manifestPath = byProject ? codePaths.projectUploadManifest(tenantId, projectId ?? "") : codePaths.uploadManifest(tenantId, repository?.owner ?? "", repository?.name ?? "");
@@ -42637,7 +42985,7 @@ async function buildRepoIndex(files) {
42637
42985
  }
42638
42986
  const heritage = /* @__PURE__ */ new Map();
42639
42987
  const heirs = /* @__PURE__ */ new Map();
42640
- const resolve16 = (from, name2) => {
42988
+ const resolve17 = (from, name2) => {
42641
42989
  const visible = imports.get(from.path) ?? /* @__PURE__ */ new Set();
42642
42990
  return (byName.get(baseName(name2)) ?? []).find((candidate) => candidate.path === from.path || reaches(visible, candidate.path));
42643
42991
  };
@@ -42646,8 +42994,8 @@ async function buildRepoIndex(files) {
42646
42994
  const stem2 = header.slice(header.indexOf(entry.name) + entry.name.length).replace(/^<[^>]*>/, "").replace(/\{.*$/, "");
42647
42995
  const ext = /\bextends\s+([A-Za-z_$][\w$.]*)/.exec(stem2)?.[1];
42648
42996
  const impl = /\bimplements\s+(.+)$/.exec(stem2)?.[1];
42649
- const extendsIds = ext === void 0 ? [] : [resolve16(entry, ext)?.id].filter((value) => value !== void 0);
42650
- const implementsIds = (impl === void 0 ? [] : impl.split(/,(?![^<]*>)/).map((part) => resolve16(entry, part.trim()))).filter((value) => value !== void 0).map((value) => value.id);
42997
+ const extendsIds = ext === void 0 ? [] : [resolve17(entry, ext)?.id].filter((value) => value !== void 0);
42998
+ const implementsIds = (impl === void 0 ? [] : impl.split(/,(?![^<]*>)/).map((part) => resolve17(entry, part.trim()))).filter((value) => value !== void 0).map((value) => value.id);
42651
42999
  if (extendsIds.length === 0 && implementsIds.length === 0) continue;
42652
43000
  heritage.set(id2, { extends: extendsIds, implements: implementsIds });
42653
43001
  for (const target2 of extendsIds) heirs.set(target2, { extendedBy: [...heirs.get(target2)?.extendedBy ?? [], id2], implementedBy: heirs.get(target2)?.implementedBy ?? [] });
@@ -42740,7 +43088,7 @@ var init_context_map_build = __esm({
42740
43088
  // ../index-builder/src/run.ts
42741
43089
  import { execFile as execFile3 } from "node:child_process";
42742
43090
  import { mkdir as mkdir4, readdir as readdir4, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
42743
- import { join as join28, resolve as resolve14 } from "node:path";
43091
+ import { join as join28, resolve as resolve15 } from "node:path";
42744
43092
  import { parseArgs as parseArgs2 } from "node:util";
42745
43093
  import { promisify as promisify3 } from "node:util";
42746
43094
  async function git6(root, args2) {
@@ -42761,7 +43109,7 @@ async function repositoryFromRemote(root) {
42761
43109
  }
42762
43110
  }
42763
43111
  async function snapshotFromArgs(values, env) {
42764
- const root = resolve14(typeof values["root"] === "string" ? values["root"] : process.cwd());
43112
+ const root = resolve15(typeof values["root"] === "string" ? values["root"] : process.cwd());
42765
43113
  const projectId = typeof values["project"] === "string" ? values["project"] : void 0;
42766
43114
  if (projectId !== void 0 && !ProjectId.safeParse(projectId).success) throw new UsageError2(`--project must be a project identifier, got "${projectId}"`);
42767
43115
  const repoText = projectId !== void 0 ? typeof values["repo"] === "string" ? values["repo"] : void 0 : (typeof values["repo"] === "string" ? values["repo"] : void 0) ?? env["GITHUB_REPOSITORY"] ?? await repositoryFromRemote(root);
@@ -42773,7 +43121,7 @@ async function snapshotFromArgs(values, env) {
42773
43121
  const scip = Array.isArray(values["scip"]) ? values["scip"] : [];
42774
43122
  return buildSnapshot({
42775
43123
  repoRoot: root,
42776
- scipFiles: scip.map((file2) => resolve14(file2)),
43124
+ scipFiles: scip.map((file2) => resolve15(file2)),
42777
43125
  tenantId: tenant,
42778
43126
  ...repoText ? { repository: parseRepository(repoText) } : {},
42779
43127
  ...projectId !== void 0 ? { projectId } : {},
@@ -42789,14 +43137,14 @@ async function runCli2(argv, env, out2 = console.log, err2 = console.error) {
42789
43137
  const outDir = values.out;
42790
43138
  if (!outDir) throw new UsageError2("build needs --out DIR");
42791
43139
  const built = await snapshotFromArgs({ ...values, tenant: values.tenant ?? env["HARNESS_TENANT"] ?? "local" }, env);
42792
- await writeSnapshot(resolve14(outDir), built);
42793
- out2(`built ${built.shards.length} shards (${built.uncovered.length} files uncovered) into ${resolve14(outDir)}`);
43140
+ await writeSnapshot(resolve15(outDir), built);
43141
+ out2(`built ${built.shards.length} shards (${built.uncovered.length} files uncovered) into ${resolve15(outDir)}`);
42794
43142
  return 0;
42795
43143
  }
42796
43144
  if (command === "map") {
42797
- const root = resolve14(values.root ?? process.cwd());
43145
+ const root = resolve15(values.root ?? process.cwd());
42798
43146
  const { digest, indexFile } = await buildArtifactsForCheckout({ root, ...values.task === void 0 ? {} : { task: values.task } });
42799
- const path = await writeDigest(root, digest, values.out === void 0 ? void 0 : resolve14(values.out));
43147
+ const path = await writeDigest(root, digest, values.out === void 0 ? void 0 : resolve15(values.out));
42800
43148
  const indexPath = values.out === void 0 ? await writeIndexFile(root, indexFile) : null;
42801
43149
  out2(`wrote the code map digest for ${digest.revision.commitSha.slice(0, 12)} (${digest.coverage.files} files, ${digest.coverage.symbols} symbols, ${digest.lines.length} lines) to ${path}${indexPath === null ? "" : `, and the ranking index to ${indexPath}`}`);
42802
43150
  return 0;
@@ -46436,14 +46784,14 @@ function inputRequiredRoundsExceededMessage(method, maxRounds) {
46436
46784
  return `Multi-round-trip request '${method}' still required input after ${maxRounds} rounds (inputRequired.maxRounds)`;
46437
46785
  }
46438
46786
  function sleep2(ms, signal) {
46439
- return new Promise((resolve16, reject) => {
46787
+ return new Promise((resolve17, reject) => {
46440
46788
  if (signal?.aborted) {
46441
46789
  reject(signal.reason instanceof SdkError ? signal.reason : new SdkError(SdkErrorCode.RequestTimeout, String(signal.reason)));
46442
46790
  return;
46443
46791
  }
46444
46792
  const timer = setTimeout(() => {
46445
46793
  signal?.removeEventListener("abort", onAbort);
46446
- resolve16();
46794
+ resolve17();
46447
46795
  }, ms);
46448
46796
  const onAbort = () => {
46449
46797
  clearTimeout(timer);
@@ -46549,8 +46897,8 @@ function setNegotiatedProtocolVersion(instance2, version2) {
46549
46897
  function isPlainObject$1(value) {
46550
46898
  return value !== null && typeof value === "object" && !Array.isArray(value);
46551
46899
  }
46552
- function mergeCapabilities(base4, additional) {
46553
- const result = { ...base4 };
46900
+ function mergeCapabilities(base5, additional) {
46901
+ const result = { ...base5 };
46554
46902
  for (const key in additional) {
46555
46903
  const k = key;
46556
46904
  const addValue = additional[k];
@@ -48239,7 +48587,7 @@ var init_src_CX2iR2pK = __esm({
48239
48587
  const flowStartedAt = Date.now();
48240
48588
  let onAbort;
48241
48589
  let cleanupMessageId;
48242
- return new Promise((resolve16, reject) => {
48590
+ return new Promise((resolve17, reject) => {
48243
48591
  const earlyReject = (error62) => {
48244
48592
  reject(error62);
48245
48593
  };
@@ -48307,7 +48655,7 @@ var init_src_CX2iR2pK = __esm({
48307
48655
  }
48308
48656
  if (decoded.kind === "invalid") return reject(decoded.error);
48309
48657
  if (decoded.kind === "input_required") {
48310
- if (options?.allowInputRequired === true) return resolve16(manualInputRequiredValue(decoded));
48658
+ if (options?.allowInputRequired === true) return resolve17(manualInputRequiredValue(decoded));
48311
48659
  const flow = {
48312
48660
  codec: codec2,
48313
48661
  request,
@@ -48319,11 +48667,11 @@ var init_src_CX2iR2pK = __esm({
48319
48667
  params
48320
48668
  }, resultSchema2, legOptions)
48321
48669
  };
48322
- return resolve16(this._resolveNonCompleteResult(decoded, flow));
48670
+ return resolve17(this._resolveNonCompleteResult(decoded, flow));
48323
48671
  }
48324
48672
  const result = decoded.result;
48325
48673
  validateStandardSchema(resultSchema2, result).then((parseResult) => {
48326
- if (parseResult.success) resolve16(parseResult.data);
48674
+ if (parseResult.success) resolve17(parseResult.data);
48327
48675
  else reject(new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${request.method}: ${parseResult.error}`));
48328
48676
  }, reject);
48329
48677
  });
@@ -51139,7 +51487,7 @@ var init_ajvProvider_CEoC_sr = __esm({
51139
51487
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
51140
51488
  const schOrFunc = root.refs[ref];
51141
51489
  if (schOrFunc) return schOrFunc;
51142
- let _sch = resolve16.call(this, root, ref);
51490
+ let _sch = resolve17.call(this, root, ref);
51143
51491
  if (_sch === void 0) {
51144
51492
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
51145
51493
  const { schemaId } = this.opts;
@@ -51165,7 +51513,7 @@ var init_ajvProvider_CEoC_sr = __esm({
51165
51513
  function sameSchemaEnv(s1, s2) {
51166
51514
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
51167
51515
  }
51168
- function resolve16(root, ref) {
51516
+ function resolve17(root, ref) {
51169
51517
  let sch;
51170
51518
  while (typeof (sch = this.refs[ref]) == "string") ref = sch;
51171
51519
  return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
@@ -51615,16 +51963,16 @@ var init_ajvProvider_CEoC_sr = __esm({
51615
51963
  else if (typeof uri === "object") uri = parse5(serialize(uri, options), options);
51616
51964
  return uri;
51617
51965
  }
51618
- function resolve16(baseURI, relativeURI, options) {
51966
+ function resolve17(baseURI, relativeURI, options) {
51619
51967
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
51620
51968
  const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
51621
51969
  schemelessOptions.skipEscape = true;
51622
51970
  return serialize(resolved, schemelessOptions);
51623
51971
  }
51624
- function resolveComponent(base4, relative4, options, skipNormalization) {
51972
+ function resolveComponent(base5, relative4, options, skipNormalization) {
51625
51973
  const target2 = {};
51626
51974
  if (!skipNormalization) {
51627
- base4 = parse5(serialize(base4, options), options);
51975
+ base5 = parse5(serialize(base5, options), options);
51628
51976
  relative4 = parse5(serialize(relative4, options), options);
51629
51977
  }
51630
51978
  options = options || {};
@@ -51644,24 +51992,24 @@ var init_ajvProvider_CEoC_sr = __esm({
51644
51992
  target2.query = relative4.query;
51645
51993
  } else {
51646
51994
  if (!relative4.path) {
51647
- target2.path = base4.path;
51995
+ target2.path = base5.path;
51648
51996
  if (relative4.query !== void 0) target2.query = relative4.query;
51649
- else target2.query = base4.query;
51997
+ else target2.query = base5.query;
51650
51998
  } else {
51651
51999
  if (relative4.path[0] === "/") target2.path = removeDotSegments(relative4.path);
51652
52000
  else {
51653
- if ((base4.userinfo !== void 0 || base4.host !== void 0 || base4.port !== void 0) && !base4.path) target2.path = "/" + relative4.path;
51654
- else if (!base4.path) target2.path = relative4.path;
51655
- else target2.path = base4.path.slice(0, base4.path.lastIndexOf("/") + 1) + relative4.path;
52001
+ if ((base5.userinfo !== void 0 || base5.host !== void 0 || base5.port !== void 0) && !base5.path) target2.path = "/" + relative4.path;
52002
+ else if (!base5.path) target2.path = relative4.path;
52003
+ else target2.path = base5.path.slice(0, base5.path.lastIndexOf("/") + 1) + relative4.path;
51656
52004
  target2.path = removeDotSegments(target2.path);
51657
52005
  }
51658
52006
  target2.query = relative4.query;
51659
52007
  }
51660
- target2.userinfo = base4.userinfo;
51661
- target2.host = base4.host;
51662
- target2.port = base4.port;
52008
+ target2.userinfo = base5.userinfo;
52009
+ target2.host = base5.host;
52010
+ target2.port = base5.port;
51663
52011
  }
51664
- target2.scheme = base4.scheme;
52012
+ target2.scheme = base5.scheme;
51665
52013
  }
51666
52014
  target2.fragment = relative4.fragment;
51667
52015
  return target2;
@@ -51789,7 +52137,7 @@ var init_ajvProvider_CEoC_sr = __esm({
51789
52137
  const fastUri = {
51790
52138
  SCHEMES,
51791
52139
  normalize,
51792
- resolve: resolve16,
52140
+ resolve: resolve17,
51793
52141
  resolveComponent,
51794
52142
  equal,
51795
52143
  serialize,
@@ -57486,7 +57834,7 @@ var init_stdio = __esm({
57486
57834
  }
57487
57835
  send(message) {
57488
57836
  if (this._closed) return Promise.reject(/* @__PURE__ */ new Error("StdioServerTransport is closed"));
57489
- return new Promise((resolve16, reject) => {
57837
+ return new Promise((resolve17, reject) => {
57490
57838
  const json2 = serializeMessage(message);
57491
57839
  let settled = false;
57492
57840
  const onError = (error62) => {
@@ -57501,14 +57849,14 @@ var init_stdio = __esm({
57501
57849
  settled = true;
57502
57850
  this._stdout.off("error", onError);
57503
57851
  this._stdout.off("drain", onDrain);
57504
- resolve16();
57852
+ resolve17();
57505
57853
  };
57506
57854
  this._stdout.once("error", onError);
57507
57855
  if (this._stdout.write(json2)) {
57508
57856
  if (settled) return;
57509
57857
  settled = true;
57510
57858
  this._stdout.off("error", onError);
57511
- resolve16();
57859
+ resolve17();
57512
57860
  } else if (!settled) this._stdout.once("drain", onDrain);
57513
57861
  });
57514
57862
  }
@@ -57562,14 +57910,14 @@ var init_stdio = __esm({
57562
57910
  */
57563
57911
  async whenRequestsAnswered(timeoutMs) {
57564
57912
  if (this._closed || this._pendingRequests.size === 0) return true;
57565
- return await new Promise((resolve16) => {
57913
+ return await new Promise((resolve17) => {
57566
57914
  const waiter = () => {
57567
57915
  clearTimeout(timer);
57568
- resolve16(true);
57916
+ resolve17(true);
57569
57917
  };
57570
57918
  const timer = setTimeout(() => {
57571
57919
  this._drainWaiters = this._drainWaiters.filter((pending) => pending !== waiter);
57572
- resolve16(false);
57920
+ resolve17(false);
57573
57921
  }, timeoutMs);
57574
57922
  this._drainWaiters.push(waiter);
57575
57923
  });
@@ -57748,18 +58096,18 @@ var init_git2 = __esm({
57748
58096
  });
57749
58097
 
57750
58098
  // ../code-shim/src/config.ts
57751
- import { readFileSync as readFileSync16 } from "node:fs";
58099
+ import { readFileSync as readFileSync17 } from "node:fs";
57752
58100
  import { homedir as homedir2 } from "node:os";
57753
58101
  import { join as join33 } from "node:path";
57754
58102
  function configDir(env) {
57755
- const base4 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join33(homedir2(), ".config");
57756
- return join33(base4, "mvrx-harness");
58103
+ const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join33(homedir2(), ".config");
58104
+ return join33(base5, "mvrx-harness");
57757
58105
  }
57758
58106
  function findToken2(env, serviceUrl, now) {
57759
58107
  const fromEnv = env["HARNESS_TOKEN"];
57760
58108
  if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
57761
58109
  try {
57762
- const file2 = JSON.parse(readFileSync16(join33(configDir(env), "credentials.json"), "utf8"));
58110
+ const file2 = JSON.parse(readFileSync17(join33(configDir(env), "credentials.json"), "utf8"));
57763
58111
  const stored = file2[serviceUrl];
57764
58112
  if (stored === void 0 || typeof stored.accessToken !== "string" || stored.accessToken.length === 0) return null;
57765
58113
  if (typeof stored.expiresAt === "number" && stored.expiresAt <= now) return null;
@@ -57771,7 +58119,7 @@ function findToken2(env, serviceUrl, now) {
57771
58119
  function resolveCloudConfig(root, env, now) {
57772
58120
  let binding;
57773
58121
  try {
57774
- const parsed = ProjectBinding.safeParse(JSON.parse(readFileSync16(join33(root, ".harness", "project.json"), "utf8")));
58122
+ const parsed = ProjectBinding.safeParse(JSON.parse(readFileSync17(join33(root, ".harness", "project.json"), "utf8")));
57775
58123
  if (!parsed.success) return null;
57776
58124
  binding = parsed.data;
57777
58125
  } catch {
@@ -57793,10 +58141,10 @@ var init_config = __esm({
57793
58141
  });
57794
58142
 
57795
58143
  // ../code-shim/src/local.ts
57796
- import { readFileSync as readFileSync17, statSync as statSync3 } from "node:fs";
57797
- import { isAbsolute as isAbsolute2, relative as relative3, resolve as resolve15, sep as sep2 } from "node:path";
58144
+ import { readFileSync as readFileSync18, statSync as statSync3 } from "node:fs";
58145
+ import { isAbsolute as isAbsolute2, relative as relative3, resolve as resolve16, sep as sep2 } from "node:path";
57798
58146
  function resolveInside(root, path) {
57799
- const absolute = resolve15(root, path);
58147
+ const absolute = resolve16(root, path);
57800
58148
  const rel = relative3(root, absolute);
57801
58149
  if (rel.length === 0 || rel.startsWith("..") || isAbsolute2(rel)) return null;
57802
58150
  return absolute;
@@ -57913,7 +58261,7 @@ var init_local = __esm({
57913
58261
  let shard;
57914
58262
  try {
57915
58263
  this.parses += 1;
57916
- shard = await this.parse(path, readFileSync17(absolute, "utf8"));
58264
+ shard = await this.parse(path, readFileSync18(absolute, "utf8"));
57917
58265
  } catch {
57918
58266
  shard = null;
57919
58267
  }
@@ -57925,7 +58273,7 @@ var init_local = __esm({
57925
58273
  const absolute = resolveInside(this.root, path);
57926
58274
  if (absolute === null) return null;
57927
58275
  try {
57928
- return readFileSync17(absolute, "utf8");
58276
+ return readFileSync18(absolute, "utf8");
57929
58277
  } catch {
57930
58278
  return null;
57931
58279
  }
@@ -57935,7 +58283,7 @@ var init_local = __esm({
57935
58283
  const absolute = resolveInside(this.root, path);
57936
58284
  if (absolute === null) return void 0;
57937
58285
  try {
57938
- const lines = readFileSync17(absolute, "utf8").split("\n");
58286
+ const lines = readFileSync18(absolute, "utf8").split("\n");
57939
58287
  const start2 = range[0];
57940
58288
  if (start2 >= lines.length) return void 0;
57941
58289
  const end = Math.min(Math.max(range[2], start2), start2 + maxLines - 1, lines.length - 1);
@@ -58056,8 +58404,8 @@ async function symbolsOverview(deps, args2) {
58056
58404
  const dirty2 = await parseDirty(deps.index, state, (p2) => isUnder(p2, scope));
58057
58405
  const cloud = await deps.cloud.query("symbols_overview", state.head, args2, SymbolAnswer);
58058
58406
  const local2 = localSymbolHits(dirty2.shards, (shard, i2) => shard.symbols[i2]?.parent === void 0);
58059
- const base4 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state).filter((hit) => isUnder(hit.path, scope)) : [];
58060
- const merged = uniqueBy([...base4, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
58407
+ const base5 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state).filter((hit) => isUnder(hit.path, scope)) : [];
58408
+ const merged = uniqueBy([...base5, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
58061
58409
  const limited = limitByTokens(merged, args2.max_tokens ?? 4e3);
58062
58410
  return {
58063
58411
  provenance: mergeProvenance(state.head, cloud.kind === "ok" ? cloud.data.provenance : null, state, { overlaid: [...dirty2.shards.keys()], unparsed: dirty2.unparsed }),
@@ -58074,8 +58422,8 @@ async function findSymbol(deps, args2) {
58074
58422
  const symbol2 = shard.symbols[i2];
58075
58423
  return symbol2 !== void 0 && matchesNamePath(shard, symbol2, wanted);
58076
58424
  });
58077
- const base4 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state) : [];
58078
- const merged = uniqueBy([...base4, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
58425
+ const base5 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state) : [];
58426
+ const merged = uniqueBy([...base5, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
58079
58427
  return {
58080
58428
  provenance: mergeProvenance(state.head, cloud.kind === "ok" ? cloud.data.provenance : null, state, { overlaid: [...dirty2.shards.keys()], unparsed: dirty2.unparsed }),
58081
58429
  symbols: withSnippets(deps.index, merged, args2.include_snippet === true)
@@ -58095,14 +58443,14 @@ async function findReferences(deps, args2) {
58095
58443
  local2.push({ path, symbol: args2.name, range, source: "local" });
58096
58444
  }
58097
58445
  }
58098
- const base4 = [];
58446
+ const base5 = [];
58099
58447
  if (cloud.kind === "ok") {
58100
58448
  for (const hit of cloud.data.references) {
58101
58449
  const path = keepCloudPath(hit.path, state);
58102
- if (path !== null) base4.push({ ...hit, path, source: "cloud" });
58450
+ if (path !== null) base5.push({ ...hit, path, source: "cloud" });
58103
58451
  }
58104
58452
  }
58105
- const merged = uniqueBy([...base4, ...local2], (h) => `${h.path}\0${h.range.join(",")}`);
58453
+ const merged = uniqueBy([...base5, ...local2], (h) => `${h.path}\0${h.range.join(",")}`);
58106
58454
  return {
58107
58455
  provenance: mergeProvenance(state.head, cloud.kind === "ok" ? cloud.data.provenance : null, state, { overlaid: [...dirty2.shards.keys()], unparsed: dirty2.unparsed }),
58108
58456
  references: withSnippets(deps.index, merged, args2.include_snippet === true)
@@ -58162,7 +58510,7 @@ var init_nav = __esm({
58162
58510
 
58163
58511
  // ../code-shim/src/edit.ts
58164
58512
  import { createHash as createHash8 } from "node:crypto";
58165
- import { readFileSync as readFileSync18, writeFileSync as writeFileSync10 } from "node:fs";
58513
+ import { readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "node:fs";
58166
58514
  function lineStarts(text) {
58167
58515
  const starts = [0];
58168
58516
  for (let i2 = 0; i2 < text.length; i2 += 1) if (text[i2] === "\n") starts.push(i2 + 1);
@@ -58203,7 +58551,7 @@ async function editSymbol(index, args2) {
58203
58551
  if (!found.ok) return found;
58204
58552
  const absolute = resolveInside(index.root, args2.path);
58205
58553
  if (absolute === null) return { ok: false, reason: `path ${args2.path} is outside the repository` };
58206
- const original = readFileSync18(absolute, "utf8");
58554
+ const original = readFileSync19(absolute, "utf8");
58207
58555
  const starts = lineStarts(original);
58208
58556
  const range = found.symbol.enclosingRange ?? found.symbol.range;
58209
58557
  const from = offsetOf(starts, original, range[0], range[1]);
@@ -58231,7 +58579,7 @@ ${args2.content.replace(/\n+$/, "")}`;
58231
58579
  const before = positionAt(next, changedStart);
58232
58580
  const after = positionAt(next, insertAt + inserted.length);
58233
58581
  const bytes = Buffer.from(next, "utf8");
58234
- writeFileSync10(absolute, bytes);
58582
+ writeFileSync11(absolute, bytes);
58235
58583
  return {
58236
58584
  ok: true,
58237
58585
  path: args2.path,
@@ -58270,7 +58618,7 @@ async function renameSymbol(deps, args2) {
58270
58618
  if (absolute === null) return { ok: false, reason: `reference path ${path} is outside the repository` };
58271
58619
  let text;
58272
58620
  try {
58273
- text = readFileSync18(absolute, "utf8");
58621
+ text = readFileSync19(absolute, "utf8");
58274
58622
  } catch {
58275
58623
  return { ok: false, reason: `cannot read ${path}` };
58276
58624
  }
@@ -58292,7 +58640,7 @@ async function renameSymbol(deps, args2) {
58292
58640
  let next = item.text;
58293
58641
  for (const offset of offsets) next = next.slice(0, offset) + args2.new_name + next.slice(offset + oldName.length);
58294
58642
  const bytes = Buffer.from(next, "utf8");
58295
- writeFileSync10(item.absolute, bytes);
58643
+ writeFileSync11(item.absolute, bytes);
58296
58644
  filesChanged.push({ path: item.path, edits: offsets.length, sha256: sha2563(bytes) });
58297
58645
  edits += offsets.length;
58298
58646
  }
@@ -58420,12 +58768,12 @@ function shimSetting(env) {
58420
58768
  }
58421
58769
  function codeMapSwitch(env, results) {
58422
58770
  const setting = shimSetting(env);
58423
- const base4 = results === void 0 ? codeMapDefault(setting) : codeMapDefault(setting, results);
58771
+ const base5 = results === void 0 ? codeMapDefault(setting) : codeMapDefault(setting, results);
58424
58772
  const forced = env["HARNESS_CODE_MAP"];
58425
58773
  if (forced === "on" || forced === "off") {
58426
- return { ...base4, on: forced === "on", basis: "project-setting", reason: `${forced}: set by HARNESS_CODE_MAP (the default for this setting is ${base4.on ? "on" : "off"}: ${base4.reason})`, source: "env" };
58774
+ return { ...base5, on: forced === "on", basis: "project-setting", reason: `${forced}: set by HARNESS_CODE_MAP (the default for this setting is ${base5.on ? "on" : "off"}: ${base5.reason})`, source: "env" };
58427
58775
  }
58428
- return { ...base4, source: "default" };
58776
+ return { ...base5, source: "default" };
58429
58777
  }
58430
58778
  function describeSwitch(state) {
58431
58779
  return `code-shim: code map ${state.on ? "on" : "off"} for ${state.setting} (${state.source}). ${state.reason}`;
@@ -58733,8 +59081,8 @@ var AuthRequiredError = class extends MvrxError {
58733
59081
  super(message, { code: "auth_required", exit: EXIT.auth }, { hint: "overlane auth status", ...options });
58734
59082
  }
58735
59083
  };
58736
- function unreachable(base4, cause) {
58737
- return new CliError(`cannot reach ${base4}: ${cause instanceof Error ? cause.message : String(cause)}`, {
59084
+ function unreachable(base5, cause) {
59085
+ return new CliError(`cannot reach ${base5}: ${cause instanceof Error ? cause.message : String(cause)}`, {
58738
59086
  code: "unreachable",
58739
59087
  exit: EXIT.unreachable,
58740
59088
  retryable: true,
@@ -59313,19 +59661,19 @@ function pkcePair() {
59313
59661
  return { verifier, challenge: base64url3(createHash("sha256").update(verifier).digest()) };
59314
59662
  }
59315
59663
  function listen(server2, port) {
59316
- return new Promise((resolve16, reject) => {
59664
+ return new Promise((resolve17, reject) => {
59317
59665
  const onError = (error62) => reject(error62);
59318
59666
  server2.once("error", onError);
59319
59667
  server2.listen(port, "127.0.0.1", () => {
59320
59668
  server2.off("error", onError);
59321
- resolve16();
59669
+ resolve17();
59322
59670
  });
59323
59671
  });
59324
59672
  }
59325
59673
  async function startLoopback(preferredPort, state) {
59326
59674
  let settle2;
59327
- const code2 = new Promise((resolve16, reject) => {
59328
- settle2 = { resolve: resolve16, reject };
59675
+ const code2 = new Promise((resolve17, reject) => {
59676
+ settle2 = { resolve: resolve17, reject };
59329
59677
  });
59330
59678
  code2.catch(() => void 0);
59331
59679
  const server2 = createServer((request, response) => {
@@ -59700,10 +60048,10 @@ async function failure2(response) {
59700
60048
  }
59701
60049
  return { code: void 0, text: `status ${response.status}` };
59702
60050
  }
59703
- async function call(deps, base4, token, schema, method, path, body2) {
60051
+ async function call(deps, base5, token, schema, method, path, body2) {
59704
60052
  let response;
59705
60053
  try {
59706
- response = await deps.fetch(`${base4}${path}`, {
60054
+ response = await deps.fetch(`${base5}${path}`, {
59707
60055
  method,
59708
60056
  headers: {
59709
60057
  accept: "application/json",
@@ -59713,7 +60061,7 @@ async function call(deps, base4, token, schema, method, path, body2) {
59713
60061
  ...body2 === void 0 ? {} : { body: JSON.stringify(body2) }
59714
60062
  });
59715
60063
  } catch (error62) {
59716
- throw unreachable(base4, error62);
60064
+ throw unreachable(base5, error62);
59717
60065
  }
59718
60066
  if (!response.ok) {
59719
60067
  const failed = await failure2(response);
@@ -59730,12 +60078,12 @@ async function call(deps, base4, token, schema, method, path, body2) {
59730
60078
  return parsed.data;
59731
60079
  }
59732
60080
  function releaseClient(deps, binding, token, serviceUrl = binding.serviceUrl) {
59733
- const base4 = serviceUrl.replace(/\/+$/, "");
60081
+ const base5 = serviceUrl.replace(/\/+$/, "");
59734
60082
  return {
59735
- list: () => call(deps, base4, token, external_exports.array(ReleaseRecord), "GET", releasePaths.list(binding.tenantId)),
59736
- get: (digest) => call(deps, base4, token, ReleaseRecord, "GET", releasePaths.one(binding.tenantId, digest)),
59737
- pin: (digest) => call(deps, base4, token, ProjectRecord, "PUT", releasePaths.pin(binding.tenantId, binding.projectId), { digest }),
59738
- rollback: () => call(deps, base4, token, ProjectRecord, "POST", releasePaths.rollback(binding.tenantId, binding.projectId), {})
60083
+ list: () => call(deps, base5, token, external_exports.array(ReleaseRecord), "GET", releasePaths.list(binding.tenantId)),
60084
+ get: (digest) => call(deps, base5, token, ReleaseRecord, "GET", releasePaths.one(binding.tenantId, digest)),
60085
+ pin: (digest) => call(deps, base5, token, ProjectRecord, "PUT", releasePaths.pin(binding.tenantId, binding.projectId), { digest }),
60086
+ rollback: () => call(deps, base5, token, ProjectRecord, "POST", releasePaths.rollback(binding.tenantId, binding.projectId), {})
59739
60087
  };
59740
60088
  }
59741
60089
  async function fetchServicePublicKey(deps, serviceUrl, token) {
@@ -60102,8 +60450,8 @@ function withTimeout(deps, ms) {
60102
60450
  }
60103
60451
  async function attempt(deps, ms, work) {
60104
60452
  let timer;
60105
- const deadline = new Promise((resolve16) => {
60106
- timer = setTimeout(() => resolve16("unreachable"), ms);
60453
+ const deadline = new Promise((resolve17) => {
60454
+ timer = setTimeout(() => resolve17("unreachable"), ms);
60107
60455
  });
60108
60456
  try {
60109
60457
  return await Promise.race([work(withTimeout(deps, ms)).catch((error62) => error62 instanceof ServiceError && error62.exit === EXIT.auth ? "unauthenticated" : "unreachable"), deadline]);
@@ -60341,13 +60689,13 @@ function render(op, existing) {
60341
60689
  case "block":
60342
60690
  return withBlock(existing, op.content);
60343
60691
  case "json": {
60344
- let base4 = op.base ?? {};
60692
+ let base5 = op.base ?? {};
60345
60693
  if (existing !== null && existing.trim() !== "") {
60346
60694
  const parsed = JSON.parse(existing);
60347
60695
  if (!isRecord(parsed)) throw new Error(`${op.path} is not a JSON object; fix it by hand, then run the command again`);
60348
- base4 = parsed;
60696
+ base5 = parsed;
60349
60697
  }
60350
- return `${JSON.stringify(setAt(base4, op.key, op.value), null, 2)}
60698
+ return `${JSON.stringify(setAt(base5, op.key, op.value), null, 2)}
60351
60699
  `;
60352
60700
  }
60353
60701
  }
@@ -60900,12 +61248,12 @@ async function failure3(response) {
60900
61248
  return { text: `status ${response.status}`, code: void 0, hint: void 0 };
60901
61249
  }
60902
61250
  function serviceCall(deps, serviceUrl, token) {
60903
- const base4 = serviceUrl.replace(/\/+$/, "");
61251
+ const base5 = serviceUrl.replace(/\/+$/, "");
60904
61252
  const approval = deps.env["OVERLANE_APPROVAL"];
60905
61253
  return async (schema, method, path, body2, extraHeaders) => {
60906
61254
  let response;
60907
61255
  try {
60908
- response = await deps.fetch(`${base4}${path}`, {
61256
+ response = await deps.fetch(`${base5}${path}`, {
60909
61257
  method,
60910
61258
  headers: {
60911
61259
  accept: "application/json",
@@ -60917,7 +61265,7 @@ function serviceCall(deps, serviceUrl, token) {
60917
61265
  ...body2 === void 0 ? {} : { body: JSON.stringify(body2) }
60918
61266
  });
60919
61267
  } catch (error62) {
60920
- throw unreachable(base4, error62);
61268
+ throw unreachable(base5, error62);
60921
61269
  }
60922
61270
  if (!response.ok) {
60923
61271
  const failed = await failure3(response);
@@ -63247,12 +63595,12 @@ init_zod();
63247
63595
  init_src();
63248
63596
  init_zod();
63249
63597
  var ErrorBody = external_exports.object({ error: external_exports.object({ code: external_exports.string(), message: external_exports.string() }).passthrough() }).passthrough();
63250
- async function post(deps, base4, path, body2) {
63598
+ async function post(deps, base5, path, body2) {
63251
63599
  let response;
63252
63600
  try {
63253
- response = await deps.fetch(`${base4}${path}`, { method: "POST", headers: { "content-type": "application/json", accept: "application/json" }, body: JSON.stringify(body2) });
63601
+ response = await deps.fetch(`${base5}${path}`, { method: "POST", headers: { "content-type": "application/json", accept: "application/json" }, body: JSON.stringify(body2) });
63254
63602
  } catch (error62) {
63255
- throw unreachable(base4, error62);
63603
+ throw unreachable(base5, error62);
63256
63604
  }
63257
63605
  let json2 = null;
63258
63606
  try {
@@ -63263,7 +63611,7 @@ async function post(deps, base4, path, body2) {
63263
63611
  return { status: response.status, json: json2 };
63264
63612
  }
63265
63613
  function sleep(ms) {
63266
- return new Promise((resolve16) => setTimeout(resolve16, ms));
63614
+ return new Promise((resolve17) => setTimeout(resolve17, ms));
63267
63615
  }
63268
63616
  async function deviceLogin(deps, service, options) {
63269
63617
  const started = await post(deps, service, "/auth/device", {});
@@ -63592,8 +63940,8 @@ var tokenListCommand = defineCommand({
63592
63940
  });
63593
63941
  var tokenRevokeCommand = defineCommand({
63594
63942
  path: ["token", "revoke"],
63595
- summary: "Revoke an agent token; it stops working within seconds",
63596
- description: "Revokes an agent token. The next call made with it fails with exit 3 (token_revoked). You can revoke your own tokens; a team-wide agent token can revoke any. This cannot be undone: mint a new token instead.",
63943
+ summary: "Revoke a token: an agent token stops working within seconds",
63944
+ description: "Revoke a token that leaked or is no longer needed: the agent token stops working. The next call made with it fails with exit 3 (token_revoked). You can revoke your own tokens; a team-wide agent token can revoke any token. To revoke a token, give its token ID from `overlane token list`. This cannot be undone: mint a new token instead.",
63597
63945
  args: [{ name: "token-id", required: false, description: "The token ID from `overlane token list` (required)" }],
63598
63946
  flags: [SERVICE_FLAG2, TEAM_FLAG2],
63599
63947
  examples: ["overlane token revoke tok_abc123 --force", "overlane token revoke tok_abc123 --dry-run"],
@@ -64382,9 +64730,9 @@ var prOpenCommand = defineCommand({
64382
64730
  const head = textFlag(inv, "head");
64383
64731
  const title = textFlag(inv, "title");
64384
64732
  if (head === void 0 || title === void 0) throw new UsageError("--head and --title are required", { hint: 'overlane repo pr open app --head feature/x --title "Add x"' });
64385
- const base4 = textFlag(inv, "base");
64733
+ const base5 = textFlag(inv, "base");
64386
64734
  const text = textFlag(inv, "body");
64387
- const body2 = { requestId: requestId4(), title, head, ...base4 === void 0 ? {} : { base: base4 }, ...text === void 0 ? {} : { body: text }, draft: boolFlag(inv, "draft") };
64735
+ const body2 = { requestId: requestId4(), title, head, ...base5 === void 0 ? {} : { base: base5 }, ...text === void 0 ? {} : { body: text }, draft: boolFlag(inv, "draft") };
64388
64736
  if (inv.dryRun) return planned2(inv, "repo", "POST", (t2, p2) => gitPaths.pulls(t2, p2, repo), body2);
64389
64737
  const { call: call2, tenantId, projectId } = await connected2(inv, "repo");
64390
64738
  return { data: await call2(PullRequest, "POST", gitPaths.pulls(tenantId, projectId, repo), body2) };
@@ -67074,19 +67422,19 @@ async function connectKit(deps, options) {
67074
67422
  if (options.dryRun) {
67075
67423
  const inner = await connect(deps, { ...options, dryRun: true });
67076
67424
  say(deps, "Dry run: no file was written and no branch, commit or service change was made.");
67077
- const base4 = inner.data !== void 0 && "dryRun" in inner.data ? inner.data : dryRunPlan({});
67425
+ const base5 = inner.data !== void 0 && "dryRun" in inner.data ? inner.data : dryRunPlan({});
67078
67426
  const writes = [
67079
67427
  ...planExists ? [] : [{ path: `${PLAN_DIR}/`, action: "write", description: planSource }],
67080
67428
  ...workflow === null ? [] : [{ path: CI_FILE, action: "write", description: "CI workflow with pinned actions" }],
67081
67429
  ...blockChanges.map((entry) => ({ path: entry.file, action: entry.before === null ? "write" : "append", description: "the run-step block" })),
67082
- ...base4.writes
67430
+ ...base5.writes
67083
67431
  ];
67084
67432
  return {
67085
67433
  data: {
67086
- ...base4,
67087
- commands: [`git switch -c ${KIT_BRANCH}`, ...base4.commands, `git commit -m "Set up the project kit"`],
67434
+ ...base5,
67435
+ commands: [`git switch -c ${KIT_BRANCH}`, ...base5.commands, `git commit -m "Set up the project kit"`],
67088
67436
  writes,
67089
- notes: [...base4.notes, `Plan: ${planSource} (${summary2.milestones} milestone(s), ${summary2.tasks} task(s)); CI: ${ciSummary}; then the run policy is set, the plan synced and one pull request opened (or its commands printed).`]
67437
+ notes: [...base5.notes, `Plan: ${planSource} (${summary2.milestones} milestone(s), ${summary2.tasks} task(s)); CI: ${ciSummary}; then the run policy is set, the plan synced and one pull request opened (or its commands printed).`]
67090
67438
  }
67091
67439
  };
67092
67440
  }
@@ -67110,11 +67458,11 @@ async function connectKit(deps, options) {
67110
67458
  const agentConfig = [join23(".claude", "settings.json"), join23(".codex", "config.toml")];
67111
67459
  const preDirty = new Set(await dirty(deps, root, agentConfig));
67112
67460
  const preExisting = new Set(agentConfig.filter((file2) => existsSync7(join23(root, file2))));
67113
- const connected10 = await connect(deps, { ...options, yes: true });
67114
- if (connected10.error !== void 0 || readBindingFile(root).kind !== "ok") {
67461
+ const connected11 = await connect(deps, { ...options, yes: true });
67462
+ if (connected11.error !== void 0 || readBindingFile(root).kind !== "ok") {
67115
67463
  throw new CliError(`connect did not finish; the kit files are on ${KIT_BRANCH}, uncommitted. Fix the cause and run \`overlane connect\`, then commit`, { code: "connect_incomplete", hint: "overlane connect --yes" });
67116
67464
  }
67117
- const connectData = connected10.data !== void 0 && !("dryRun" in connected10.data) ? connected10.data : void 0;
67465
+ const connectData = connected11.data !== void 0 && !("dryRun" in connected11.data) ? connected11.data : void 0;
67118
67466
  for (const file2 of agentConfig) {
67119
67467
  if (!existsSync7(join23(root, file2)) || preDirty.has(file2) || preExisting.has(file2) && (await dirty(deps, root, [file2])).length === 0) continue;
67120
67468
  if ((await gitOut(deps, root, "check-ignore", "-q", "--", file2)).code === 0) continue;
@@ -67200,7 +67548,7 @@ var connectCommand = defineCommand({
67200
67548
  keywords: ["setup", "install", "bind", "link", "onboard", "register plugin", "bootstrap", "autonomous", "plan", "kit", "get started", "initialise", "enable harness", "ci workflow", "pull request"],
67201
67549
  result: external_exports.union([ConnectAny, ConnectKitResult]),
67202
67550
  handler: async (inv) => {
67203
- const base4 = {
67551
+ const base5 = {
67204
67552
  service: textFlag(inv, "service"),
67205
67553
  marketplaceRoot: textFlag(inv, "marketplace-root"),
67206
67554
  agents: parseAgentList(textFlag(inv, "agents")),
@@ -67213,10 +67561,10 @@ var connectCommand = defineCommand({
67213
67561
  const goal = textFlag(inv, "goal");
67214
67562
  if (kit === void 0) {
67215
67563
  if (goal !== void 0) throw new UsageError("--goal belongs to --kit new", { hint: "overlane schema connect" });
67216
- return connect(inv.deps, base4);
67564
+ return connect(inv.deps, base5);
67217
67565
  }
67218
67566
  if (kit !== "existing" && kit !== "new") throw new UsageError("--kit must be existing or new");
67219
- return connectKit(inv.deps, { ...base4, mode: kit, goal });
67567
+ return connectKit(inv.deps, { ...base5, mode: kit, goal });
67220
67568
  }
67221
67569
  });
67222
67570
  var doctorCommand = defineCommand({
@@ -69652,11 +70000,11 @@ async function planned7(inv, method, path, body2, note) {
69652
70000
  var git4 = (deps, args2) => deps.exec("git", args2, { cwd: deps.paths.cwd });
69653
70001
  var MAX_PATCH_FILES = 40;
69654
70002
  var MAX_PATCH_CHARS = 8e3;
69655
- async function snapshotOf(inv, head, base4) {
70003
+ async function snapshotOf(inv, head, base5) {
69656
70004
  const sha = await git4(inv.deps, ["rev-parse", "--verify", "--quiet", `${head}^{commit}`]);
69657
70005
  if (sha.code !== 0) throw new UsageError(`${head} is not a commit in this checkout`, { hint: "git fetch, then retry" });
69658
- const stat = await git4(inv.deps, ["diff", "--numstat", "-z", "--no-renames", `${base4}...${head}`]);
69659
- if (stat.code !== 0) throw new UsageError(`could not compare ${base4} with ${head}: ${stat.stderr.trim().split("\n")[0] ?? "git failed"}`, { hint: "pass --base with a branch that exists, for example --base origin/main" });
70006
+ const stat = await git4(inv.deps, ["diff", "--numstat", "-z", "--no-renames", `${base5}...${head}`]);
70007
+ if (stat.code !== 0) throw new UsageError(`could not compare ${base5} with ${head}: ${stat.stderr.trim().split("\n")[0] ?? "git failed"}`, { hint: "pass --base with a branch that exists, for example --base origin/main" });
69660
70008
  const files = [];
69661
70009
  for (const entry of stat.stdout.split("\0")) {
69662
70010
  const match = /^(\d+|-)\t(\d+|-)\t(.+)$/s.exec(entry);
@@ -69664,12 +70012,12 @@ async function snapshotOf(inv, head, base4) {
69664
70012
  files.push({ path: match[3], status: "modified", additions: match[1] === "-" ? 0 : Number(match[1]), deletions: match[2] === "-" ? 0 : Number(match[2]) });
69665
70013
  }
69666
70014
  for (const file2 of files.slice(0, MAX_PATCH_FILES)) {
69667
- const patch = await git4(inv.deps, ["diff", "--unified=2", `${base4}...${head}`, "--", file2.path]);
70015
+ const patch = await git4(inv.deps, ["diff", "--unified=2", `${base5}...${head}`, "--", file2.path]);
69668
70016
  if (patch.code === 0 && patch.stdout !== "") file2.patch = patch.stdout.slice(0, MAX_PATCH_CHARS);
69669
70017
  }
69670
70018
  const project = await detectProject(inv.deps);
69671
70019
  const repository = textFlag(inv, "repo") ?? (project.repository === void 0 ? `overlane/${project.name.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "project"}` : `${project.repository.owner}/${project.repository.name}`);
69672
- return { provider: project.provider === "github" ? "github" : "overlane", repository, headSha: sha.stdout.trim(), baseRef: base4, files };
70020
+ return { provider: project.provider === "github" ? "github" : "overlane", repository, headSha: sha.stdout.trim(), baseRef: base5, files };
69673
70021
  }
69674
70022
  function numberOf(inv) {
69675
70023
  const text = textFlag(inv, "number");
@@ -69721,11 +70069,11 @@ var prRouteCommand = defineCommand({
69721
70069
  handler: async (inv) => {
69722
70070
  const number4 = numberOf(inv);
69723
70071
  const head = textFlag(inv, "head") ?? "HEAD";
69724
- let base4 = textFlag(inv, "base");
69725
- if (base4 === void 0) base4 = (await git4(inv.deps, ["rev-parse", "--verify", "--quiet", "origin/main"])).code === 0 ? "origin/main" : "main";
70072
+ let base5 = textFlag(inv, "base");
70073
+ if (base5 === void 0) base5 = (await git4(inv.deps, ["rev-parse", "--verify", "--quiet", "origin/main"])).code === 0 ? "origin/main" : "main";
69726
70074
  const critical = textFlag(inv, "critical");
69727
70075
  if (critical !== void 0 && !/^\d+$/.test(critical)) throw new UsageError("--critical is a whole number");
69728
- const snapshot = await snapshotOf(inv, head, base4);
70076
+ const snapshot = await snapshotOf(inv, head, base5);
69729
70077
  const body2 = {
69730
70078
  requestId: requestId12(),
69731
70079
  pull: { provider: snapshot.provider, repository: snapshot.repository, number: number4, headSha: snapshot.headSha, title: textFlag(inv, "title") ?? `Pull request ${number4}`, body: "", author: textFlag(inv, "author") ?? "unknown", fork: boolFlag(inv, "fork"), files: snapshot.files },
@@ -70060,17 +70408,678 @@ var egressScanCommand = defineCommand({
70060
70408
  });
70061
70409
  var egressCommands = [egressPolicyShowCommand, egressPolicySetCommand, egressCheckCommand, egressEventsCommand, egressGrantCommand, egressGrantsCommand, egressRevokeCommand, egressScanCommand];
70062
70410
 
70411
+ // ../cli/src/commands/enterprise.ts
70412
+ init_src();
70413
+ init_zod();
70414
+ import { readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "node:fs";
70415
+ import { resolve as resolve13 } from "node:path";
70416
+ var common20 = { needsAuth: true, needsNetwork: true };
70417
+ async function connected9(inv) {
70418
+ const project = await connectedProject(inv.deps, "enterprise");
70419
+ return { call: serviceCall(inv.deps, project.serviceUrl, project.token), tenantId: project.binding.tenantId };
70420
+ }
70421
+ async function planned9(inv, method, path, body2, note) {
70422
+ const project = await offlineProject(inv.deps, "enterprise");
70423
+ return planOutcome(inv.deps, dryRunPlan({ service: project.serviceUrl, requests: [{ method, path: path(project.binding.tenantId), ...body2 === void 0 ? {} : { body: body2 }, ...note === void 0 ? {} : { note } }] }));
70424
+ }
70425
+ async function secretValue2(inv, envFlag) {
70426
+ const name2 = textFlag(inv, envFlag);
70427
+ if (name2 !== void 0) {
70428
+ const value = inv.deps.env[name2];
70429
+ if (value === void 0 || value === "") throw new UsageError(`${name2} is not set`, { hint: `export ${name2}=... then run the command again` });
70430
+ return value;
70431
+ }
70432
+ if (inv.deps.stdin !== void 0 && !inv.deps.stdin.isTTY) {
70433
+ const text = (await inv.deps.stdin.read()).trim();
70434
+ if (text !== "") return text;
70435
+ }
70436
+ throw new UsageError("give the key through --value-env NAME or on standard input; it is never an argument", { hint: "overlane enterprise keys add --alias team-anthropic --provider anthropic --value-env PROVIDER_KEY" });
70437
+ }
70438
+ var enterpriseStatusCommand = defineCommand({
70439
+ path: ["enterprise", "status"],
70440
+ summary: "Show which enterprise features this team's plan includes",
70441
+ description: "Lists single sign-on, directory sync, audit export, SIEM stream, data region, bring-your-own-key, retention, policy as code and the MCP allowlist, each as included or not. All are Business and above.",
70442
+ examples: ["overlane enterprise status", "overlane enterprise status --json"],
70443
+ effect: "read",
70444
+ ...common20,
70445
+ keywords: ["enterprise", "sso", "plan features", "what does my plan include"],
70446
+ result: EnterpriseEntitlements,
70447
+ text: (d) => [`plan: ${d.plan}`, ...Object.entries(d.features).map(([name2, on]) => `${on ? "included " : "not included"} ${name2}`)],
70448
+ handler: async (inv) => {
70449
+ const { call: call2, tenantId } = await connected9(inv);
70450
+ return { data: await call2(EnterpriseEntitlements, "GET", enterprisePaths.entitlements(tenantId)) };
70451
+ }
70452
+ });
70453
+ var enterpriseSsoLinkCommand = defineCommand({
70454
+ path: ["enterprise", "sso", "link"],
70455
+ summary: "Print a short-lived link to the identity provider's hosted setup portal",
70456
+ description: "Issues a setup link for single sign-on (SAML or OpenID Connect) or for directory sync (SCIM). The link expires in minutes and is the credential: open it yourself or hand it to the person who administers the identity provider. Issuing a link is recorded in the audit log.",
70457
+ flags: [{ name: "intent", type: "string", enum: ["sso", "dsync"], default: "sso", value: "INTENT", description: "sso (default) or dsync for the directory" }],
70458
+ examples: ["overlane enterprise sso link", "overlane enterprise sso link --intent dsync"],
70459
+ effect: "write",
70460
+ ...common20,
70461
+ keywords: ["saml", "oidc", "scim", "directory sync", "admin portal", "set up sso"],
70462
+ result: withDryRun(PortalLink),
70463
+ text: (d) => "url" in d ? [`open: ${d.url}`, `expires: ${d.expiresAt}`] : [],
70464
+ handler: async (inv) => {
70465
+ const intent = textFlag(inv, "intent") ?? "sso";
70466
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.portalLink, { intent }, "returns a short-lived link");
70467
+ const { call: call2, tenantId } = await connected9(inv);
70468
+ return { data: await call2(PortalLink, "POST", enterprisePaths.portalLink(tenantId), { intent }) };
70469
+ }
70470
+ });
70471
+ var enterpriseSyncCommand = defineCommand({
70472
+ path: ["enterprise", "sso", "sync"],
70473
+ summary: "Sync the directory now: apply group roles and deprovision removed people",
70474
+ description: "Reads the directory and applies it. A person marked inactive loses access, their agent access ends and their leases are released. The same sync runs every five minutes on its own; the report says how long each removal took against the five-minute deadline.",
70475
+ examples: ["overlane enterprise sso sync"],
70476
+ effect: "write",
70477
+ ...common20,
70478
+ keywords: ["scim sync", "deprovision", "directory"],
70479
+ result: withDryRun(DirectorySyncReport),
70480
+ text: (d) => "syncedAt" in d ? [`synced ${d.syncedAt}: ${d.rolesChanged} role changes, ${d.deprovisioned} removed${d.withinDeadline ? "" : " (some later than five minutes)"}`] : [],
70481
+ handler: async (inv) => {
70482
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.syncDirectory, {});
70483
+ const { call: call2, tenantId } = await connected9(inv);
70484
+ return { data: await call2(DirectorySyncReport, "POST", enterprisePaths.syncDirectory(tenantId), {}) };
70485
+ }
70486
+ });
70487
+ var ExportResult = external_exports.object({ file: external_exports.string(), manifestFile: external_exports.string(), manifest: AuditExportManifest }).strict();
70488
+ var enterpriseAuditExportCommand = defineCommand({
70489
+ path: ["enterprise", "audit", "export"],
70490
+ summary: "Export the tamper-evident audit log as CSV, with a manifest, to files",
70491
+ description: "Writes the whole log as CSV (every row with the hashes that chain it) and a manifest with the row count and the head hash. Exporting is itself recorded in the audit log. Check the files later with `overlane enterprise audit verify`.",
70492
+ flags: [{ name: "out", type: "string", default: "audit.csv", value: "FILE", description: "Where to write the CSV (default audit.csv); the manifest goes beside it as FILE.manifest.json" }],
70493
+ examples: ["overlane enterprise audit export --out audit-2026-10.csv"],
70494
+ effect: "write",
70495
+ ...common20,
70496
+ keywords: ["audit csv", "export audit log", "compliance export", "siem file"],
70497
+ result: withDryRun(ExportResult),
70498
+ text: (d) => "manifest" in d ? [`wrote ${d.manifest.count} rows to ${d.file}`, `manifest: ${d.manifestFile}`, `head: ${d.manifest.head ?? "none"}`] : [],
70499
+ handler: async (inv) => {
70500
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.auditExports, {}, "writes the CSV and the manifest to local files");
70501
+ const { call: call2, tenantId } = await connected9(inv);
70502
+ const exported = await call2(AuditExport, "POST", enterprisePaths.auditExports(tenantId), {});
70503
+ const file2 = resolve13(inv.deps.paths.cwd, textFlag(inv, "out") ?? "audit.csv");
70504
+ const manifestFile = `${file2}.manifest.json`;
70505
+ writeFileSync9(file2, exported.csv);
70506
+ writeFileSync9(manifestFile, `${JSON.stringify(exported.manifest, null, 2)}
70507
+ `);
70508
+ return { data: { file: file2, manifestFile, manifest: exported.manifest } };
70509
+ }
70510
+ });
70511
+ var VerifyResult = external_exports.object({ ok: external_exports.boolean(), tenantId: external_exports.string(), checked: external_exports.number(), head: external_exports.string().nullable(), manifestOk: external_exports.boolean(), brokenAt: external_exports.number().optional(), reason: external_exports.string().optional() }).strict();
70512
+ var enterpriseAuditVerifyCommand = defineCommand({
70513
+ path: ["enterprise", "audit", "verify"],
70514
+ summary: "Check an exported audit CSV offline; exits 1 if any row was altered, removed or reordered",
70515
+ description: "Re-computes the hash chain of the file and compares the row count, last sequence and head hash with the manifest, so a removed newest row is found as well. Needs no network and no account.",
70516
+ args: [{ name: "file", required: true, description: "The exported CSV" }],
70517
+ flags: [{ name: "manifest", type: "string", value: "FILE", description: "The manifest (default FILE.manifest.json)" }],
70518
+ examples: ["overlane enterprise audit verify audit.csv"],
70519
+ effect: "read",
70520
+ needsAuth: false,
70521
+ needsNetwork: false,
70522
+ keywords: ["verify audit export", "tamper check", "audit chain"],
70523
+ result: VerifyResult,
70524
+ text: (d) => [d.ok ? `OK: ${d.checked} rows verified, head ${d.head ?? "none"}` : `FAILED${d.brokenAt === void 0 ? "" : ` at row ${d.brokenAt}`}${d.reason === void 0 ? "" : ` (${d.reason})`}${d.manifestOk ? "" : "; the manifest does not match the file"}`],
70525
+ handler: async (inv) => {
70526
+ const file2 = inv.positionals[0];
70527
+ if (file2 === void 0) throw new UsageError("give the exported CSV", { hint: "overlane enterprise audit verify audit.csv" });
70528
+ const path = resolve13(inv.deps.paths.cwd, file2);
70529
+ const manifestPath = resolve13(inv.deps.paths.cwd, textFlag(inv, "manifest") ?? `${file2}.manifest.json`);
70530
+ let manifest;
70531
+ let csv;
70532
+ try {
70533
+ csv = readFileSync14(path, "utf8");
70534
+ manifest = AuditExportManifest.parse(JSON.parse(readFileSync14(manifestPath, "utf8")));
70535
+ } catch {
70536
+ throw new UsageError(`could not read ${file2} and its manifest`, { hint: "overlane enterprise audit export --out audit.csv" });
70537
+ }
70538
+ const result = verifyAuditExport(manifest.tenantId, csv, manifest);
70539
+ const data = { ok: result.ok, tenantId: result.tenantId, checked: result.checked, head: result.head, manifestOk: result.manifestOk, ...result.brokenAt === void 0 ? {} : { brokenAt: result.brokenAt }, ...result.reason === void 0 ? {} : { reason: result.reason } };
70540
+ return result.ok ? { data } : { data, exit: EXIT.failure, error: new CliError("the audit export failed verification", { code: "audit_tampered", exit: EXIT.failure, quiet: true }) };
70541
+ }
70542
+ });
70543
+ var StreamAdded = external_exports.object({ target: AuditStreamTarget }).strict();
70544
+ var enterpriseStreamAddCommand = defineCommand({
70545
+ path: ["enterprise", "audit", "stream", "add"],
70546
+ summary: "Add a SIEM stream target: an https address and a signing secret you choose",
70547
+ description: "Deliveries are signed with HMAC-SHA-256 over `timestamp.body` using your secret and carry an idempotency key, so your SIEM can de-duplicate the at-least-once delivery. The secret is read from an environment variable or standard input, stored encrypted and never shown again.",
70548
+ flags: [
70549
+ { name: "url", type: "string", required: true, value: "URL", description: "The https address that receives deliveries" },
70550
+ { name: "secret-env", type: "string", value: "NAME", description: "Name of the environment variable holding the signing secret (16 characters or more)" }
70551
+ ],
70552
+ examples: ["overlane enterprise audit stream add --url https://siem.example.com/ingest --secret-env SIEM_SECRET"],
70553
+ effect: "write",
70554
+ ...common20,
70555
+ keywords: ["siem", "splunk", "stream audit", "log forwarding"],
70556
+ result: withDryRun(StreamAdded),
70557
+ text: (d) => "target" in d ? [`target ${d.target.targetId} -> ${d.target.url}`, "The signing secret is stored encrypted and will not be shown again."] : [],
70558
+ handler: async (inv) => {
70559
+ const url2 = textFlag(inv, "url");
70560
+ if (url2 === void 0) throw new UsageError("add needs --url", { hint: "overlane enterprise audit stream add --url https://siem.example.com/ingest --secret-env SIEM_SECRET" });
70561
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.streamTargets, { url: url2, signingSecret: "(read from the environment; not shown)" });
70562
+ const signingSecret = await secretValue2(inv, "secret-env");
70563
+ const { call: call2, tenantId } = await connected9(inv);
70564
+ return { data: await call2(StreamAdded, "POST", enterprisePaths.streamTargets(tenantId), { url: url2, signingSecret }) };
70565
+ }
70566
+ });
70567
+ var ResidencyShow = external_exports.object({ policy: ResidencyPolicy, stores: StoreLocationReport.nullable() }).strict();
70568
+ var enterpriseRegionShowCommand = defineCommand({
70569
+ path: ["enterprise", "region", "show"],
70570
+ summary: "Show the data region and where each store holds the team's data",
70571
+ description: "Prints the pinned region, the supported regions and the store-location check: D1, R2, KV, Durable Objects, vectors, logs and backups, each with the region it holds.",
70572
+ examples: ["overlane enterprise region show"],
70573
+ effect: "read",
70574
+ ...common20,
70575
+ keywords: ["data residency", "region", "where is my data"],
70576
+ result: ResidencyShow,
70577
+ text: (d) => [`region: ${d.policy.region} (supported: ${d.policy.supportedRegions.join(", ")})`, ...d.stores === null ? [] : [d.stores.ok ? "every store holds the data in the region" : `violations: ${d.stores.violations.join("; ")}`, ...d.stores.stores.map((s) => `${s.store.padEnd(16)} ${s.region}`)]],
70578
+ handler: async (inv) => {
70579
+ const { call: call2, tenantId } = await connected9(inv);
70580
+ const policy = await call2(ResidencyPolicy, "GET", enterprisePaths.residency(tenantId));
70581
+ const stores = policy.pinnedAt === null ? null : await call2(StoreLocationReport, "GET", enterprisePaths.storeLocations(tenantId));
70582
+ return { data: { policy, stores } };
70583
+ }
70584
+ });
70585
+ var enterpriseRegionSetCommand = defineCommand({
70586
+ path: ["enterprise", "region", "set"],
70587
+ summary: "Pin the team's data to a region, or request a migration to another one",
70588
+ description: "The first call pins the region (the choice made at team creation). Once pinned, a change needs --reason and is an audited migration; data is never placed outside the chosen region. A region the stores cannot all hold is refused with the supported list.",
70589
+ flags: [
70590
+ { name: "region", type: "string", required: true, enum: ["global", "eu", "us"], value: "REGION", description: "global (no pin), eu or us" },
70591
+ { name: "reason", type: "string", value: "TEXT", description: "Why the region changes (needed when the team is already pinned)" }
70592
+ ],
70593
+ examples: ["overlane enterprise region set --region eu", "overlane enterprise region set --region us --reason 'customer request'"],
70594
+ effect: "write",
70595
+ ...common20,
70596
+ keywords: ["pin region", "move region", "eu data", "residency migration"],
70597
+ result: withDryRun(ResidencyPolicy),
70598
+ text: (d) => "region" in d ? [`region: ${d.region}${d.pendingMigration === null ? "" : ` last migration ${d.pendingMigration.from} to ${d.pendingMigration.to}: ${d.pendingMigration.status}`}`] : [],
70599
+ handler: async (inv) => {
70600
+ const region = textFlag(inv, "region");
70601
+ if (region === void 0) throw new UsageError("set needs --region", { hint: "overlane enterprise region set --region eu" });
70602
+ const reason = textFlag(inv, "reason");
70603
+ if (inv.dryRun) return planned9(inv, reason === void 0 ? "PUT" : "POST", (t2) => reason === void 0 ? enterprisePaths.residency(t2) : enterprisePaths.residencyMigrations(t2), reason === void 0 ? { region } : { to: region, reason });
70604
+ const { call: call2, tenantId } = await connected9(inv);
70605
+ const current2 = await call2(ResidencyPolicy, "GET", enterprisePaths.residency(tenantId));
70606
+ if (current2.pinnedAt === null) return { data: await call2(ResidencyPolicy, "PUT", enterprisePaths.residency(tenantId), { region }) };
70607
+ if (reason === void 0) throw new UsageError("the team is already pinned; a change is a migration and needs --reason", { hint: `overlane enterprise region set --region ${region} --reason 'why'` });
70608
+ return { data: await call2(ResidencyPolicy, "POST", enterprisePaths.residencyMigrations(tenantId), { to: region, reason }) };
70609
+ }
70610
+ });
70611
+ var KeyList = external_exports.object({ tenantId: external_exports.string(), keys: external_exports.array(ByokKey) }).strict();
70612
+ var KeyOne = external_exports.object({ key: ByokKey }).strict();
70613
+ var KeyTested = external_exports.object({ result: ByokTestResult, key: ByokKey }).strict();
70614
+ var keyLine = (k) => `${k.alias.padEnd(24)} ${k.provider.padEnd(10)} ${k.status.padEnd(9)} v${k.version} tested ${k.lastTestedAt ?? "never"}`;
70615
+ var enterpriseKeysListCommand = defineCommand({
70616
+ path: ["enterprise", "keys", "list"],
70617
+ summary: "List bring-your-own inference keys by alias, provider and status",
70618
+ description: "Shows aliases and states only. A key value is never shown after it is added.",
70619
+ examples: ["overlane enterprise keys list"],
70620
+ effect: "read",
70621
+ ...common20,
70622
+ keywords: ["byok", "inference keys", "api keys"],
70623
+ result: KeyList,
70624
+ text: (d) => d.keys.length === 0 ? ["No keys. Inference runs on the hosted models."] : d.keys.map(keyLine),
70625
+ handler: async (inv) => {
70626
+ const { call: call2, tenantId } = await connected9(inv);
70627
+ return { data: await call2(KeyList, "GET", enterprisePaths.byokKeys(tenantId)) };
70628
+ }
70629
+ });
70630
+ var enterpriseKeysAddCommand = defineCommand({
70631
+ path: ["enterprise", "keys", "add"],
70632
+ summary: "Add an inference key under an alias; the value comes from the environment or stdin",
70633
+ description: "The value is read from the variable named by --value-env, or from standard input, sent once and stored encrypted. It is never an argument, never printed and never shown again. Test it with `overlane enterprise keys test`; inference uses the alias.",
70634
+ flags: [
70635
+ { name: "alias", type: "string", required: true, value: "ALIAS", description: "Lowercase letters, digits and hyphens" },
70636
+ { name: "provider", type: "string", required: true, enum: ["anthropic", "openai", "google"], value: "PROVIDER", description: "The key's provider" },
70637
+ { name: "value-env", type: "string", value: "NAME", description: "Name of the environment variable holding the key (default: read standard input)" }
70638
+ ],
70639
+ examples: ["overlane enterprise keys add --alias team-anthropic --provider anthropic --value-env PROVIDER_KEY", "overlane enterprise keys add --alias team-anthropic --provider anthropic < key.txt"],
70640
+ effect: "write",
70641
+ ...common20,
70642
+ keywords: ["add byok key", "bring your own key", "provider key"],
70643
+ result: withDryRun(KeyOne),
70644
+ text: (d) => "key" in d ? [keyLine(d.key), "The value is stored encrypted and will not be shown again."] : [],
70645
+ handler: async (inv) => {
70646
+ const alias = textFlag(inv, "alias");
70647
+ const provider = textFlag(inv, "provider");
70648
+ if (alias === void 0 || provider === void 0) throw new UsageError("add needs --alias and --provider", { hint: "overlane enterprise keys add --alias team-anthropic --provider anthropic --value-env PROVIDER_KEY" });
70649
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.byokKeys, { alias, provider, value: "(read from the environment; not shown)" });
70650
+ const value = await secretValue2(inv, "value-env");
70651
+ const { call: call2, tenantId } = await connected9(inv);
70652
+ return { data: await call2(KeyOne, "POST", enterprisePaths.byokKeys(tenantId), { alias, provider, value }) };
70653
+ }
70654
+ });
70655
+ var aliasArg = [{ name: "alias", required: false, description: "The key's alias (required)" }];
70656
+ var aliasOf = (inv) => {
70657
+ const alias = inv.positionals[0];
70658
+ if (alias === void 0) throw new UsageError("give the key's alias", { hint: "overlane enterprise keys test team-anthropic" });
70659
+ return alias;
70660
+ };
70661
+ var enterpriseKeysTestCommand = defineCommand({
70662
+ path: ["enterprise", "keys", "test"],
70663
+ summary: "Test a key against its provider; a key that fails is not used for inference",
70664
+ description: "Makes a minimal call to the provider with the stored key and records the result. The key is not printed.",
70665
+ args: aliasArg,
70666
+ examples: ["overlane enterprise keys test team-anthropic"],
70667
+ effect: "write",
70668
+ ...common20,
70669
+ keywords: ["check key", "validate key"],
70670
+ result: withDryRun(KeyTested),
70671
+ text: (d) => "result" in d ? [`${d.result.ok ? "passed" : "failed"}: ${d.result.detail}`, keyLine(d.key)] : [],
70672
+ handler: async (inv) => {
70673
+ const alias = aliasOf(inv);
70674
+ if (inv.dryRun) return planned9(inv, "POST", (t2) => enterprisePaths.byokTest(t2, alias), {});
70675
+ const { call: call2, tenantId } = await connected9(inv);
70676
+ const out2 = await call2(KeyTested, "POST", enterprisePaths.byokTest(tenantId, alias), {});
70677
+ return out2.result.ok ? { data: out2 } : { data: out2, exit: EXIT.failure, error: new CliError(`the provider refused ${alias}`, { code: "byok_test_failed", exit: EXIT.failure, quiet: true }) };
70678
+ }
70679
+ });
70680
+ var enterpriseKeysRotateCommand = defineCommand({
70681
+ path: ["enterprise", "keys", "rotate"],
70682
+ summary: "Replace a key's value under the same alias; the old value stays if the provider refuses the new one",
70683
+ description: "The new value is read like `keys add` reads it, checked with the provider first, then stored encrypted. The alias and everything that uses it stay the same.",
70684
+ args: aliasArg,
70685
+ flags: [{ name: "value-env", type: "string", value: "NAME", description: "Name of the environment variable holding the new key (default: read standard input)" }],
70686
+ examples: ["overlane enterprise keys rotate team-anthropic --value-env NEW_PROVIDER_KEY"],
70687
+ effect: "write",
70688
+ ...common20,
70689
+ keywords: ["rotate key", "replace key"],
70690
+ result: withDryRun(KeyOne),
70691
+ text: (d) => "key" in d ? [keyLine(d.key)] : [],
70692
+ handler: async (inv) => {
70693
+ const alias = aliasOf(inv);
70694
+ if (inv.dryRun) return planned9(inv, "POST", (t2) => enterprisePaths.byokRotate(t2, alias), { value: "(read from the environment; not shown)" });
70695
+ const value = await secretValue2(inv, "value-env");
70696
+ const { call: call2, tenantId } = await connected9(inv);
70697
+ return { data: await call2(KeyOne, "POST", enterprisePaths.byokRotate(tenantId, alias), { value }) };
70698
+ }
70699
+ });
70700
+ var enterpriseKeysRevokeCommand = defineCommand({
70701
+ path: ["enterprise", "keys", "revoke"],
70702
+ summary: "Disable a key for good: the stored value is deleted and inference by that alias is refused",
70703
+ description: "This cannot be undone; add a new key to use the provider again. Doing it twice changes nothing.",
70704
+ args: aliasArg,
70705
+ examples: ["overlane enterprise keys revoke team-anthropic"],
70706
+ effect: "destructive",
70707
+ ...common20,
70708
+ keywords: ["delete key", "disable key"],
70709
+ result: withDryRun(KeyOne),
70710
+ text: (d) => "key" in d ? [keyLine(d.key)] : [],
70711
+ handler: async (inv) => {
70712
+ const alias = aliasOf(inv);
70713
+ if (inv.dryRun) return planned9(inv, "DELETE", (t2) => enterprisePaths.byokKey(t2, alias));
70714
+ const { call: call2, tenantId } = await connected9(inv);
70715
+ return { data: await call2(KeyOne, "DELETE", enterprisePaths.byokKey(tenantId, alias)) };
70716
+ }
70717
+ });
70718
+ var enterpriseRetentionShowCommand = defineCommand({
70719
+ path: ["enterprise", "retention", "show"],
70720
+ summary: "Show the retention rules per data class",
70721
+ description: "Classes: memory, derived_data, agent_conversations, ci_artifacts and run_logs. The audit log is exported, never purged by age.",
70722
+ examples: ["overlane enterprise retention show"],
70723
+ effect: "read",
70724
+ ...common20,
70725
+ keywords: ["retention policy", "how long is data kept"],
70726
+ result: EnterpriseRetentionPolicy,
70727
+ text: (d) => d.rules.length === 0 ? ["No rules: nothing is purged by age."] : d.rules.map((r) => `${r.dataClass.padEnd(20)} ${r.days} days`),
70728
+ handler: async (inv) => {
70729
+ const { call: call2, tenantId } = await connected9(inv);
70730
+ return { data: await call2(EnterpriseRetentionPolicy, "GET", enterprisePaths.retention(tenantId)) };
70731
+ }
70732
+ });
70733
+ var enterpriseRetentionSetCommand = defineCommand({
70734
+ path: ["enterprise", "retention", "set"],
70735
+ summary: "Set retention rules, replacing the current ones",
70736
+ description: "Each --rule is CLASS=DAYS, for example memory=365. Records older than the days are purged on schedule and reported. Changing retention is a policy change.",
70737
+ flags: [{ name: "rule", type: "string", multiple: true, required: true, value: "CLASS=DAYS", description: "A rule; repeat for more" }],
70738
+ examples: ["overlane enterprise retention set --rule memory=365 --rule run_logs=90"],
70739
+ effect: "write",
70740
+ ...common20,
70741
+ keywords: ["set retention", "purge after days"],
70742
+ result: withDryRun(EnterpriseRetentionPolicy),
70743
+ text: (d) => "rules" in d ? d.rules.map((r) => `${r.dataClass.padEnd(20)} ${r.days} days`) : [],
70744
+ handler: async (inv) => {
70745
+ const raw = inv.values["rule"];
70746
+ const texts = (Array.isArray(raw) ? raw : raw === void 0 ? [] : [raw]).filter((v) => typeof v === "string");
70747
+ const rules = texts.map((text) => {
70748
+ const [dataClass, days] = text.split("=");
70749
+ if (dataClass === void 0 || days === void 0 || !/^\d{1,4}$/.test(days)) throw new UsageError(`${text}: use CLASS=DAYS, for example memory=365`);
70750
+ return { dataClass, days: Number(days) };
70751
+ });
70752
+ if (inv.dryRun) return planned9(inv, "PUT", enterprisePaths.retention, { rules });
70753
+ const { call: call2, tenantId } = await connected9(inv);
70754
+ return { data: await call2(EnterpriseRetentionPolicy, "PUT", enterprisePaths.retention(tenantId), { rules }) };
70755
+ }
70756
+ });
70757
+ var enterprisePurgeCommand = defineCommand({
70758
+ path: ["enterprise", "retention", "purge"],
70759
+ summary: "Run the retention purge now and print the report",
70760
+ description: "Removes records older than each class's days, and derived text and vectors whose item is gone. Idempotent. Purging is an irreversible deletion.",
70761
+ examples: ["overlane enterprise retention purge"],
70762
+ effect: "destructive",
70763
+ ...common20,
70764
+ keywords: ["purge now", "delete old data"],
70765
+ result: withDryRun(PurgeReport),
70766
+ text: (d) => "lines" in d ? [`purge ${d.purgeId}: ${d.totalPurged} records removed`, ...d.lines.map((l) => `${l.dataClass.padEnd(20)} ${l.store.padEnd(8)} ${l.purged}`)] : [],
70767
+ handler: async (inv) => {
70768
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.purge, {});
70769
+ const { call: call2, tenantId } = await connected9(inv);
70770
+ return { data: await call2(PurgeReport, "POST", enterprisePaths.purge(tenantId), {}) };
70771
+ }
70772
+ });
70773
+ var DataFlags = [
70774
+ { name: "scope", type: "string", enum: ["tenant", "project", "user"], default: "tenant", value: "SCOPE", description: "tenant (default), project or user" },
70775
+ { name: "subject", type: "string", value: "ID", description: "The project or user ID for a project or user scope" }
70776
+ ];
70777
+ var dataBody = (inv) => {
70778
+ const scope = textFlag(inv, "scope") ?? "tenant";
70779
+ const subject = textFlag(inv, "subject");
70780
+ if (scope !== "tenant" && subject === void 0) throw new UsageError(`a ${scope} scope needs --subject`, { hint: `overlane enterprise data export --scope ${scope} --subject ID` });
70781
+ return { scope, ...subject === void 0 ? {} : { subjectId: subject } };
70782
+ };
70783
+ var DataExported = external_exports.object({ file: external_exports.string(), totalRows: external_exports.number(), stores: DataExportReport.shape.stores }).strict();
70784
+ var enterpriseDataExportCommand = defineCommand({
70785
+ path: ["enterprise", "data", "export"],
70786
+ summary: "Export the team's own data (or one project's or user's) as NDJSON",
70787
+ description: "Writes memory, derived text, vectors (metadata only), conversations, CI records, logs and, for the tenant scope, the audit log, one JSON record per line. Open to every plan.",
70788
+ flags: [...DataFlags, { name: "out", type: "string", default: "export.ndjson", value: "FILE", description: "Where to write the file" }],
70789
+ examples: ["overlane enterprise data export --out export.ndjson", "overlane enterprise data export --scope project --subject prj-1"],
70790
+ effect: "write",
70791
+ ...common20,
70792
+ keywords: ["export my data", "data portability", "gdpr export"],
70793
+ result: withDryRun(DataExported),
70794
+ text: (d) => "file" in d ? [`wrote ${d.totalRows} records to ${d.file}`] : [],
70795
+ handler: async (inv) => {
70796
+ const body2 = dataBody(inv);
70797
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.dataExport, body2, "writes a local file");
70798
+ const { call: call2, tenantId } = await connected9(inv);
70799
+ const report2 = await call2(DataExportReport, "POST", enterprisePaths.dataExport(tenantId), body2);
70800
+ const file2 = resolve13(inv.deps.paths.cwd, textFlag(inv, "out") ?? "export.ndjson");
70801
+ writeFileSync9(file2, report2.ndjson);
70802
+ return { data: { file: file2, totalRows: report2.totalRows, stores: report2.stores } };
70803
+ }
70804
+ });
70805
+ var enterpriseDataDeleteCommand = defineCommand({
70806
+ path: ["enterprise", "data", "delete"],
70807
+ summary: "Delete the team's own data (or one project's or user's) from every store",
70808
+ description: "Removes records, derived text, vectors, logs and backup snapshots written by the service. Point-in-time database copies age out within 30 days, and the report states the date. The audit log keeps identifiers only, including this deletion. Irreversible: it needs --force without a terminal, and an agent needs an independent agent's approval.",
70809
+ flags: DataFlags,
70810
+ examples: ["overlane enterprise data delete --scope project --subject prj-1 --dry-run"],
70811
+ effect: "destructive",
70812
+ ...common20,
70813
+ keywords: ["delete my data", "erase", "right to erasure"],
70814
+ result: withDryRun(DataDeletionReport),
70815
+ text: (d) => "backupsPurgedBy" in d ? [`deleted ${d.totalRows} records`, `backups are purged by ${d.backupsPurgedBy}`] : [],
70816
+ handler: async (inv) => {
70817
+ const body2 = dataBody(inv);
70818
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.dataDelete, body2, "deletes from every store");
70819
+ const { call: call2, tenantId } = await connected9(inv);
70820
+ return { data: await call2(DataDeletionReport, "POST", enterprisePaths.dataDelete(tenantId), body2) };
70821
+ }
70822
+ });
70823
+ var SsoShow = external_exports.object({ identity: EnterpriseIdentityStatus, groups: GroupMappingSet }).strict();
70824
+ var enterpriseSsoShowCommand = defineCommand({
70825
+ path: ["enterprise", "sso", "show"],
70826
+ summary: "Show the single sign-on and directory state, and the group to role mappings",
70827
+ description: "Prints each connection's status (not set up, setup in progress, active, failed), the protocol and domains, when it was last tested, the directory's people and group counts, and the mappings with the highest role a group may grant.",
70828
+ examples: ["overlane enterprise sso show"],
70829
+ effect: "read",
70830
+ ...common20,
70831
+ keywords: ["sso status", "scim status", "group mappings", "connection state"],
70832
+ result: SsoShow,
70833
+ text: (d) => [
70834
+ `sso: ${d.identity.sso.status}${d.identity.sso.protocol === null ? "" : ` (${d.identity.sso.protocol})`} last test ${d.identity.sso.lastTestedAt ?? "never"}`,
70835
+ `directory: ${d.identity.scim.status} ${d.identity.scim.userCount} people in ${d.identity.scim.groupCount} groups last sync ${d.identity.scim.lastSyncAt ?? "never"}`,
70836
+ `groups (cap ${d.groups.cap}): ${d.groups.mappings.length === 0 ? "none mapped" : d.groups.mappings.map((m) => `${m.groupName}=${m.role}`).join(", ")}`
70837
+ ],
70838
+ handler: async (inv) => {
70839
+ const { call: call2, tenantId } = await connected9(inv);
70840
+ return { data: { identity: await call2(EnterpriseIdentityStatus, "GET", enterprisePaths.identity(tenantId)), groups: await call2(GroupMappingSet, "GET", enterprisePaths.groupMappings(tenantId)) } };
70841
+ }
70842
+ });
70843
+ var enterpriseSsoTestCommand = defineCommand({
70844
+ path: ["enterprise", "sso", "test"],
70845
+ summary: "Test the single sign-on or directory connection end to end; exits 1 when it fails",
70846
+ description: "Asks the identity provider to check the connection (a metadata fetch for sign-on, a directory read for the directory) and records the result.",
70847
+ flags: [{ name: "intent", type: "string", enum: ["sso", "dsync"], default: "sso", value: "INTENT", description: "sso (default) or dsync for the directory" }],
70848
+ examples: ["overlane enterprise sso test", "overlane enterprise sso test --intent dsync"],
70849
+ effect: "write",
70850
+ ...common20,
70851
+ keywords: ["test sso", "check connection", "verify scim"],
70852
+ result: withDryRun(TestConnectionResult),
70853
+ text: (d) => "ok" in d ? [`${d.ok ? "passed" : "failed"}: ${d.detail}`] : [],
70854
+ handler: async (inv) => {
70855
+ const intent = textFlag(inv, "intent") ?? "sso";
70856
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.testConnection, { intent });
70857
+ const { call: call2, tenantId } = await connected9(inv);
70858
+ const result = await call2(TestConnectionResult, "POST", enterprisePaths.testConnection(tenantId), { intent });
70859
+ return result.ok ? { data: result } : { data: result, exit: EXIT.failure, error: new CliError(`the ${intent} connection failed its test`, { code: "connection_test_failed", exit: EXIT.failure, quiet: true }) };
70860
+ }
70861
+ });
70862
+ var enterpriseSsoGroupsSetCommand = defineCommand({
70863
+ path: ["enterprise", "sso", "groups", "set"],
70864
+ summary: "Replace the group to role mappings and the highest role a group may grant",
70865
+ description: "Each --map is GROUP=ROLE with ROLE viewer, member or admin. A person in several mapped groups gets the highest role, up to --cap (default admin). A mapping above the cap is refused, and the owner role cannot be mapped. Changing mappings is a policy change.",
70866
+ flags: [
70867
+ { name: "map", type: "string", multiple: true, value: "GROUP=ROLE", description: "A mapping; repeat for more (none clears them)" },
70868
+ { name: "cap", type: "string", enum: GROUP_ROLE_CAPS, default: "admin", value: "ROLE", description: "The highest role any group may grant" }
70869
+ ],
70870
+ examples: ["overlane enterprise sso groups set --map Engineering=member --map Platform=admin --cap admin"],
70871
+ effect: "write",
70872
+ ...common20,
70873
+ keywords: ["group mapping", "idp groups", "roles from groups"],
70874
+ result: withDryRun(GroupMappingSet),
70875
+ text: (d) => "cap" in d ? [`cap: ${d.cap}`, ...d.mappings.map((m) => `${m.groupName} -> ${m.role}`)] : [],
70876
+ handler: async (inv) => {
70877
+ const raw = inv.values["map"];
70878
+ const texts = (Array.isArray(raw) ? raw : raw === void 0 ? [] : [raw]).filter((v) => typeof v === "string");
70879
+ const mappings = texts.map((text) => {
70880
+ const at = text.lastIndexOf("=");
70881
+ const groupName = at < 1 ? "" : text.slice(0, at);
70882
+ const role = text.slice(at + 1);
70883
+ if (groupName === "" || !["viewer", "member", "admin"].includes(role)) throw new UsageError(`${text}: use GROUP=ROLE with ROLE viewer, member or admin`, { hint: "overlane enterprise sso groups set --map Engineering=member" });
70884
+ return { groupName, role };
70885
+ });
70886
+ const body2 = { cap: textFlag(inv, "cap") ?? "admin", mappings };
70887
+ if (inv.dryRun) return planned9(inv, "PUT", enterprisePaths.groupMappings, body2);
70888
+ const { call: call2, tenantId } = await connected9(inv);
70889
+ return { data: await call2(GroupMappingSet, "PUT", enterprisePaths.groupMappings(tenantId), body2) };
70890
+ }
70891
+ });
70892
+ var enterpriseStreamListCommand = defineCommand({
70893
+ path: ["enterprise", "audit", "stream", "list"],
70894
+ summary: "List SIEM stream targets with their status and how far each has been delivered",
70895
+ description: "Shows each target's address, whether it is active, paused or failing, the newest audit row it has acknowledged and the last error. The signing secret is never shown.",
70896
+ examples: ["overlane enterprise audit stream list"],
70897
+ effect: "read",
70898
+ ...common20,
70899
+ keywords: ["siem targets", "stream status", "log forwarding status"],
70900
+ result: AuditStreamTargetList,
70901
+ text: (d) => d.targets.length === 0 ? ["No stream targets."] : d.targets.map((t2) => `${t2.targetId} ${t2.status.padEnd(8)} ${t2.url} through row ${t2.deliveredThroughSeq}${t2.lastError === null ? "" : ` error: ${t2.lastError}`}`),
70902
+ handler: async (inv) => {
70903
+ const { call: call2, tenantId } = await connected9(inv);
70904
+ return { data: await call2(AuditStreamTargetList, "GET", enterprisePaths.streamTargets(tenantId)) };
70905
+ }
70906
+ });
70907
+ var TargetArg = [{ name: "target", required: false, description: "The target ID from `overlane enterprise audit stream list` (required)" }];
70908
+ var targetOf = (inv) => {
70909
+ const id2 = inv.positionals[0];
70910
+ if (id2 === void 0) throw new UsageError("give the stream target ID", { hint: "overlane enterprise audit stream list" });
70911
+ return id2;
70912
+ };
70913
+ var enterpriseStreamRunCommand = defineCommand({
70914
+ path: ["enterprise", "audit", "stream", "run"],
70915
+ summary: "Send the audit rows a target has not acknowledged yet, now",
70916
+ description: "Delivers the rows after the target's cursor in batches, signed and with idempotency keys. A refusal or error stops the run, keeps the cursor and marks the target failing; the next run resends the same batch. Runs also happen every five minutes on their own.",
70917
+ args: TargetArg,
70918
+ examples: ["overlane enterprise audit stream run tgt_abc123"],
70919
+ effect: "write",
70920
+ ...common20,
70921
+ keywords: ["send audit now", "flush stream", "retry siem"],
70922
+ result: withDryRun(StreamRunReport),
70923
+ text: (d) => "delivered" in d ? [`${d.failed ? "failed" : "ok"}: ${d.delivered} rows in ${d.batches} batches, through row ${d.deliveredThroughSeq}`] : [],
70924
+ handler: async (inv) => {
70925
+ const id2 = targetOf(inv);
70926
+ if (inv.dryRun) return planned9(inv, "POST", (t2) => enterprisePaths.streamRun(t2, id2), {});
70927
+ const { call: call2, tenantId } = await connected9(inv);
70928
+ const report2 = await call2(StreamRunReport, "POST", enterprisePaths.streamRun(tenantId, id2), {});
70929
+ return report2.failed ? { data: report2, exit: EXIT.failure, error: new CliError("the target did not accept the delivery", { code: "stream_delivery_failed", exit: EXIT.failure, quiet: true }) } : { data: report2 };
70930
+ }
70931
+ });
70932
+ var StreamRemoved = external_exports.object({ deleted: external_exports.literal(true) }).strict();
70933
+ var enterpriseStreamRemoveCommand = defineCommand({
70934
+ path: ["enterprise", "audit", "stream", "remove"],
70935
+ summary: "Remove a SIEM stream target; its stored signing secret goes with it",
70936
+ description: "Stops deliveries to the target and deletes the sealed signing secret. Rows already delivered stay in your SIEM. Add the target again to resume from the start.",
70937
+ args: TargetArg,
70938
+ examples: ["overlane enterprise audit stream remove tgt_abc123 --dry-run"],
70939
+ effect: "destructive",
70940
+ ...common20,
70941
+ keywords: ["delete siem target", "stop streaming"],
70942
+ result: withDryRun(StreamRemoved),
70943
+ text: (d) => "deleted" in d ? ["Target removed."] : [],
70944
+ handler: async (inv) => {
70945
+ const id2 = targetOf(inv);
70946
+ if (inv.dryRun) return planned9(inv, "DELETE", (t2) => enterprisePaths.streamTarget(t2, id2));
70947
+ const { call: call2, tenantId } = await connected9(inv);
70948
+ return { data: await call2(StreamRemoved, "DELETE", enterprisePaths.streamTarget(tenantId, id2)) };
70949
+ }
70950
+ });
70951
+ var enterpriseRetentionReportsCommand = defineCommand({
70952
+ path: ["enterprise", "retention", "reports"],
70953
+ summary: "List the purge reports, newest first",
70954
+ description: "Each report names the trigger (schedule or manual), when it ran, and for each class and store the cutoff and how many records it removed.",
70955
+ examples: ["overlane enterprise retention reports"],
70956
+ effect: "read",
70957
+ ...common20,
70958
+ keywords: ["purge history", "what was deleted by retention"],
70959
+ result: PurgeReportList,
70960
+ text: (d) => d.reports.length === 0 ? ["No purge has run yet."] : d.reports.map((r) => `${r.ranAt} ${r.trigger.padEnd(8)} ${r.totalPurged} records removed (${r.purgeId})`),
70961
+ handler: async (inv) => {
70962
+ const { call: call2, tenantId } = await connected9(inv);
70963
+ return { data: await call2(PurgeReportList, "GET", enterprisePaths.purgeReports(tenantId)) };
70964
+ }
70965
+ });
70966
+ var enterpriseBackupsDrillCommand = defineCommand({
70967
+ path: ["enterprise", "backups", "drill"],
70968
+ summary: "Run the backup restore drill; exits 1 if any record count differs or the audit chain breaks",
70969
+ description: "Takes a snapshot of the team's data, reads it back from storage, restores it into a scratch target and compares every table's record count with the source. The restored audit rows must still verify as a chain. Snapshots expire after 30 days.",
70970
+ examples: ["overlane enterprise backups drill"],
70971
+ effect: "write",
70972
+ ...common20,
70973
+ keywords: ["restore drill", "backup test", "disaster recovery"],
70974
+ result: withDryRun(RestoreDrillReport),
70975
+ text: (d) => "tables" in d ? [d.ok ? "restore drill passed" : "restore drill FAILED", ...d.tables.map((t2) => `${t2.name.padEnd(16)} expected ${t2.expected} restored ${t2.restored}`)] : [],
70976
+ handler: async (inv) => {
70977
+ if (inv.dryRun) return planned9(inv, "POST", enterprisePaths.restoreDrill, {}, "writes a snapshot and restores it into a scratch target");
70978
+ const { call: call2, tenantId } = await connected9(inv);
70979
+ const report2 = await call2(RestoreDrillReport, "POST", enterprisePaths.restoreDrill(tenantId), {});
70980
+ return report2.ok ? { data: report2 } : { data: report2, exit: EXIT.failure, error: new CliError("the restore drill failed", { code: "restore_drill_failed", exit: EXIT.failure, quiet: true }) };
70981
+ }
70982
+ });
70983
+ var enterpriseAllowlistShowCommand = defineCommand({
70984
+ path: ["enterprise", "mcp-allowlist", "show"],
70985
+ summary: "Show the MCP server allowlist for the team's agents",
70986
+ description: "With the allowlist on, an agent may connect only to a listed server host or a subdomain of one; any other server is refused before a connection is made.",
70987
+ examples: ["overlane enterprise mcp-allowlist show"],
70988
+ effect: "read",
70989
+ ...common20,
70990
+ keywords: ["mcp servers allowed", "allowlist", "which mcp servers can agents use"],
70991
+ result: McpAllowlist,
70992
+ text: (d) => [`mode: ${d.mode}`, ...d.entries.map((e2) => `allow ${e2.server}${e2.note === void 0 ? "" : ` (${e2.note})`}`)],
70993
+ handler: async (inv) => {
70994
+ const { call: call2, tenantId } = await connected9(inv);
70995
+ return { data: await call2(McpAllowlist, "GET", enterprisePaths.mcpAllowlist(tenantId)) };
70996
+ }
70997
+ });
70998
+ var enterpriseAllowlistSetCommand = defineCommand({
70999
+ path: ["enterprise", "mcp-allowlist", "set"],
71000
+ summary: "Turn the MCP server allowlist on or off and set the listed hosts",
71001
+ description: "Replaces the list with the --allow hosts and sets the mode. Mode allowlist refuses any server not listed (a host or a subdomain of one); mode off allows every server. Changing the allowlist is a policy change.",
71002
+ flags: [
71003
+ { name: "mode", type: "string", enum: ["off", "allowlist"], default: "allowlist", value: "MODE", description: "allowlist (default) or off" },
71004
+ { name: "allow", type: "string", multiple: true, value: "HOST", description: "A host agents may connect to; repeat for more" }
71005
+ ],
71006
+ examples: ["overlane enterprise mcp-allowlist set --allow mcp.example.com", "overlane enterprise mcp-allowlist set --mode off"],
71007
+ effect: "write",
71008
+ ...common20,
71009
+ keywords: ["allow mcp server", "restrict mcp", "mcp gateway"],
71010
+ result: withDryRun(McpAllowlist),
71011
+ text: (d) => "mode" in d ? [`mode: ${d.mode}`, ...d.entries.map((e2) => `allow ${e2.server}`)] : [],
71012
+ handler: async (inv) => {
71013
+ const raw = inv.values["allow"];
71014
+ const hosts2 = (Array.isArray(raw) ? raw : raw === void 0 ? [] : [raw]).filter((v) => typeof v === "string");
71015
+ const body2 = { mode: textFlag(inv, "mode") ?? "allowlist", entries: hosts2.map((server2) => ({ server: server2 })) };
71016
+ if (inv.dryRun) return planned9(inv, "PUT", enterprisePaths.mcpAllowlist, body2);
71017
+ const { call: call2, tenantId } = await connected9(inv);
71018
+ return { data: await call2(McpAllowlist, "PUT", enterprisePaths.mcpAllowlist(tenantId), body2) };
71019
+ }
71020
+ });
71021
+ var enterpriseEvidencePackCommand = defineCommand({
71022
+ path: ["enterprise", "evidence-pack"],
71023
+ summary: "Print the security review evidence pack: chain state, agent action counts and controls",
71024
+ description: "Verifies the audit chain, counts the audited actions taken by agent tokens (and how many were denied), and lists the controls (single sign-on, directory sync, audit log, SIEM stream, data region, customer keys, retention, MCP allowlist) as enabled or not configured. Identifiers and counts only.",
71025
+ examples: ["overlane enterprise evidence-pack --json"],
71026
+ effect: "read",
71027
+ ...common20,
71028
+ keywords: ["soc 2 evidence", "security review", "agent action audit"],
71029
+ result: EvidencePack,
71030
+ text: (d) => [
71031
+ `audit chain: ${d.chain.ok ? "verified" : "BROKEN"} (${d.chain.checked} rows)`,
71032
+ `agent actions: ${d.agentActions.total} (${d.agentActions.denied} denied)`,
71033
+ ...d.controls.map((c2) => `${c2.state === "enabled" ? "enabled " : "not configured"} ${c2.id.padEnd(7)} ${c2.title}: ${c2.evidence}`)
71034
+ ],
71035
+ handler: async (inv) => {
71036
+ const { call: call2, tenantId } = await connected9(inv);
71037
+ return { data: await call2(EvidencePack, "GET", enterprisePaths.evidencePack(tenantId)) };
71038
+ }
71039
+ });
71040
+ var enterpriseCommands = [
71041
+ enterpriseSsoShowCommand,
71042
+ enterpriseSsoTestCommand,
71043
+ enterpriseSsoGroupsSetCommand,
71044
+ enterpriseStreamListCommand,
71045
+ enterpriseStreamRunCommand,
71046
+ enterpriseStreamRemoveCommand,
71047
+ enterpriseRetentionReportsCommand,
71048
+ enterpriseBackupsDrillCommand,
71049
+ enterpriseAllowlistShowCommand,
71050
+ enterpriseAllowlistSetCommand,
71051
+ enterpriseEvidencePackCommand,
71052
+ enterpriseStatusCommand,
71053
+ enterpriseSsoLinkCommand,
71054
+ enterpriseSyncCommand,
71055
+ enterpriseAuditExportCommand,
71056
+ enterpriseAuditVerifyCommand,
71057
+ enterpriseStreamAddCommand,
71058
+ enterpriseRegionShowCommand,
71059
+ enterpriseRegionSetCommand,
71060
+ enterpriseKeysListCommand,
71061
+ enterpriseKeysAddCommand,
71062
+ enterpriseKeysTestCommand,
71063
+ enterpriseKeysRotateCommand,
71064
+ enterpriseKeysRevokeCommand,
71065
+ enterpriseRetentionShowCommand,
71066
+ enterpriseRetentionSetCommand,
71067
+ enterprisePurgeCommand,
71068
+ enterpriseDataExportCommand,
71069
+ enterpriseDataDeleteCommand
71070
+ ];
71071
+
70063
71072
  // ../cli/src/commands/observe.ts
70064
71073
  init_src();
70065
71074
  init_zod();
70066
71075
  import { randomUUID as randomUUID15 } from "node:crypto";
70067
- var common20 = { needsAuth: true, needsNetwork: true };
71076
+ var common21 = { needsAuth: true, needsNetwork: true };
70068
71077
  var requestId14 = () => `cli-${randomUUID15()}`;
70069
- async function connected9(inv) {
71078
+ async function connected10(inv) {
70070
71079
  const project = await connectedProject(inv.deps, "observe");
70071
71080
  return { call: serviceCall(inv.deps, project.serviceUrl, project.token), tenantId: project.binding.tenantId, projectId: project.binding.projectId };
70072
71081
  }
70073
- async function planned9(inv, method, path, body2, note) {
71082
+ async function planned10(inv, method, path, body2, note) {
70074
71083
  const project = await offlineProject(inv.deps, "observe");
70075
71084
  return planOutcome(inv.deps, dryRunPlan({ service: project.serviceUrl, requests: [{ method, path: path(project.binding.tenantId), ...body2 === void 0 ? {} : { body: body2 }, ...note === void 0 ? {} : { note } }] }));
70076
71085
  }
@@ -70085,7 +71094,7 @@ var observeStatusCommand = defineCommand({
70085
71094
  description: "One read of the team's observability: runs in the last 24 hours by status, open alert incidents, cost and tokens this billing period, the decision-model records (outcomes and latency), and how long telemetry is kept on the plan.",
70086
71095
  examples: ["overlane observe status", "overlane observe status --json"],
70087
71096
  effect: "read",
70088
- ...common20,
71097
+ ...common21,
70089
71098
  keywords: ["observability", "run status", "open incidents", "how are my agents doing", "telemetry"],
70090
71099
  result: ObserveStatus,
70091
71100
  text: (d) => [
@@ -70096,7 +71105,7 @@ var observeStatusCommand = defineCommand({
70096
71105
  `retention: ${d.retention.retentionDays === null ? "set by contract" : `${d.retention.retentionDays} days`} (${d.retention.plan})`
70097
71106
  ],
70098
71107
  handler: async (inv) => {
70099
- const { call: call2, tenantId } = await connected9(inv);
71108
+ const { call: call2, tenantId } = await connected10(inv);
70100
71109
  return { data: await call2(ObserveStatus, "GET", observePaths.status(tenantId)) };
70101
71110
  }
70102
71111
  });
@@ -70110,12 +71119,12 @@ var observeLogsCommand = defineCommand({
70110
71119
  ],
70111
71120
  examples: ["overlane observe logs", "overlane observe logs --run run-12 --limit 50"],
70112
71121
  effect: "read",
70113
- ...common20,
71122
+ ...common21,
70114
71123
  keywords: ["logs", "agent logs", "what happened in the run", "tool output"],
70115
71124
  result: LogRecordList,
70116
71125
  text: (d) => d.logs.length === 0 ? ["No log lines recorded."] : d.logs.map((l) => `${l.at} ${l.level.toUpperCase().padEnd(5)} ${l.runId} ${l.source} ${l.message}${l.redacted ? ` (${l.redactions} redacted)` : ""}`),
70117
71126
  handler: async (inv) => {
70118
- const { call: call2, tenantId, projectId } = await connected9(inv);
71127
+ const { call: call2, tenantId, projectId } = await connected10(inv);
70119
71128
  const run3 = textFlag(inv, "run");
70120
71129
  const limit = textFlag(inv, "limit");
70121
71130
  if (limit !== void 0 && !/^\d+$/.test(limit)) throw new UsageError("--limit is a whole number");
@@ -70130,7 +71139,7 @@ var observeTraceCommand = defineCommand({
70130
71139
  flags: [{ name: "run", type: "string", required: true, value: "RUN", description: "The run ID" }],
70131
71140
  examples: ["overlane observe trace --run run-12", "overlane observe trace --run run-12 --json"],
70132
71141
  effect: "read",
70133
- ...common20,
71142
+ ...common21,
70134
71143
  keywords: ["trace", "run trace", "stitched logs", "spans", "run id"],
70135
71144
  result: TraceBundle,
70136
71145
  text: (d) => [
@@ -70142,7 +71151,7 @@ var observeTraceCommand = defineCommand({
70142
71151
  handler: async (inv) => {
70143
71152
  const run3 = textFlag(inv, "run");
70144
71153
  if (run3 === void 0) throw new UsageError("trace needs --run", { hint: "overlane observe trace --run <run id>" });
70145
- const { call: call2, tenantId, projectId } = await connected9(inv);
71154
+ const { call: call2, tenantId, projectId } = await connected10(inv);
70146
71155
  return { data: await call2(TraceBundle, "GET", observePaths.trace(tenantId, projectId, run3)) };
70147
71156
  }
70148
71157
  });
@@ -70152,7 +71161,7 @@ var observeCostCommand = defineCommand({
70152
71161
  description: "Cost in dollars, tokens and run counts grouped by agent, by project and for the team, from the metrics the runs reported. `overlane observe reconcile` compares the same figures with metered usage.",
70153
71162
  examples: ["overlane observe cost", "overlane observe cost --json"],
70154
71163
  effect: "read",
70155
- ...common20,
71164
+ ...common21,
70156
71165
  keywords: ["cost per agent", "token usage", "spend per project", "how much did the run cost"],
70157
71166
  result: CostReport,
70158
71167
  text: (d) => [
@@ -70161,7 +71170,7 @@ var observeCostCommand = defineCommand({
70161
71170
  ...d.byProject.map((r) => ` project ${r.key.padEnd(18)} ${usd3(r.costMicros).padStart(10)} ${String(r.tokens).padStart(10)} tokens ${r.runs} runs`)
70162
71171
  ],
70163
71172
  handler: async (inv) => {
70164
- const { call: call2, tenantId } = await connected9(inv);
71173
+ const { call: call2, tenantId } = await connected10(inv);
70165
71174
  return { data: await call2(CostReport, "GET", observePaths.cost(tenantId)) };
70166
71175
  }
70167
71176
  });
@@ -70171,7 +71180,7 @@ var observeReconcileCommand = defineCommand({
70171
71180
  description: "Compares the cost the metrics report with the usage the billing ledger meters, per agent, per project and in total. A line outside the tolerance names the key and the error in basis points.",
70172
71181
  examples: ["overlane observe reconcile", "overlane observe reconcile --json"],
70173
71182
  effect: "read",
70174
- ...common20,
71183
+ ...common21,
70175
71184
  keywords: ["reconcile cost", "metered usage", "cost matches billing", "metrics accuracy"],
70176
71185
  result: Reconciliation,
70177
71186
  text: (d) => [
@@ -70179,7 +71188,7 @@ var observeReconcileCommand = defineCommand({
70179
71188
  ...[...d.byAgent.map((l) => ({ ...l, key: `agent ${l.key}` })), ...d.byProject.map((l) => ({ ...l, key: `project ${l.key}` }))].filter((l) => !l.within).map((l) => ` ${l.key}: metered ${usd3(l.meteredMicros)}, observed ${usd3(l.observedMicros)}, error ${l.errorBps} bps`)
70180
71189
  ],
70181
71190
  handler: async (inv) => {
70182
- const { call: call2, tenantId } = await connected9(inv);
71191
+ const { call: call2, tenantId } = await connected10(inv);
70183
71192
  return { data: await call2(Reconciliation, "GET", observePaths.reconcile(tenantId)) };
70184
71193
  }
70185
71194
  });
@@ -70190,7 +71199,7 @@ var observeCompareCommand = defineCommand({
70190
71199
  flags: [{ name: "task", type: "string", required: true, value: "TASK", description: "The task ID" }],
70191
71200
  examples: ["overlane observe compare --task task-77", "overlane observe compare --task task-77 --json"],
70192
71201
  effect: "read",
70193
- ...common20,
71202
+ ...common21,
70194
71203
  keywords: ["compare agents", "which agent is better", "claude vs codex", "agent report", "same task two agents"],
70195
71204
  result: ComparisonReport,
70196
71205
  text: (d) => d.entries.length === 0 ? [`No runs recorded for task ${d.taskId}.`] : [
@@ -70200,7 +71209,7 @@ var observeCompareCommand = defineCommand({
70200
71209
  handler: async (inv) => {
70201
71210
  const task = textFlag(inv, "task");
70202
71211
  if (task === void 0) throw new UsageError("compare needs --task", { hint: "overlane observe compare --task <task id>" });
70203
- const { call: call2, tenantId } = await connected9(inv);
71212
+ const { call: call2, tenantId } = await connected10(inv);
70204
71213
  return { data: await call2(ComparisonReport, "GET", `${observePaths.compare(tenantId)}?task=${encodeURIComponent(task)}`) };
70205
71214
  }
70206
71215
  });
@@ -70210,12 +71219,12 @@ var observeEvalsCommand = defineCommand({
70210
71219
  description: "Pass rate, mean cost and mean review time per agent and configuration, scored from the stored replays of your own merged pull requests. Scoring is arithmetic over checks, never a model's opinion.",
70211
71220
  examples: ["overlane observe evals", "overlane observe evals --json"],
70212
71221
  effect: "read",
70213
- ...common20,
71222
+ ...common21,
70214
71223
  keywords: ["evals", "replay merged prs", "agent pass rate", "benchmark my repo", "which config works"],
70215
71224
  result: EvalReport,
70216
71225
  text: (d) => d.rows.length === 0 ? ["No replays recorded. Run some: overlane observe evals run --prs pr-1,pr-2 --agents codex --configs default"] : [...d.rows.map((r) => `${r.agent.padEnd(16)} ${r.config.padEnd(14)} pass ${(r.passRateBps / 100).toFixed(1)}% ${r.passed}/${r.prs} cost ${usd3(r.meanCostMicros)} review ${minutes(r.meanReviewMs)}`), `best: ${d.best === null ? "none" : `${d.best.agent} / ${d.best.config}`}`],
70217
71226
  handler: async (inv) => {
70218
- const { call: call2, tenantId } = await connected9(inv);
71227
+ const { call: call2, tenantId } = await connected10(inv);
70219
71228
  return { data: await call2(EvalReport, "GET", observePaths.evals(tenantId)) };
70220
71229
  }
70221
71230
  });
@@ -70235,14 +71244,14 @@ var observeEvalsRunCommand = defineCommand({
70235
71244
  ],
70236
71245
  examples: ["overlane observe evals run --prs pr-1,pr-2 --agents codex,claude-code --configs default,strict", "overlane observe evals run --prs pr-1 --agents codex --configs default --dry-run"],
70237
71246
  effect: "write",
70238
- ...common20,
71247
+ ...common21,
70239
71248
  keywords: ["run evals", "replay pull requests", "compare configs", "agent benchmark on my repo"],
70240
71249
  result: withDryRun(EvalReport),
70241
71250
  text: (d) => "rows" in d ? d.rows.map((r) => `${r.agent} / ${r.config}: pass ${(r.passRateBps / 100).toFixed(1)}%, cost ${usd3(r.meanCostMicros)}, review ${minutes(r.meanReviewMs)}`) : [],
70242
71251
  handler: async (inv) => {
70243
71252
  const body2 = { requestId: requestId14(), prs: list(textFlag(inv, "prs"), "prs"), agents: list(textFlag(inv, "agents"), "agents"), configs: list(textFlag(inv, "configs"), "configs") };
70244
- if (inv.dryRun) return planned9(inv, "POST", observePaths.evals, body2, "replays each pull request with each agent and configuration");
70245
- const { call: call2, tenantId } = await connected9(inv);
71253
+ if (inv.dryRun) return planned10(inv, "POST", observePaths.evals, body2, "replays each pull request with each agent and configuration");
71254
+ const { call: call2, tenantId } = await connected10(inv);
70246
71255
  return { data: await call2(EvalReport, "POST", observePaths.evals(tenantId), body2) };
70247
71256
  }
70248
71257
  });
@@ -70252,7 +71261,7 @@ var observeAlertsCommand = defineCommand({
70252
71261
  description: "Alert rules (spend cap reached, failing run, stuck lease, stale index) with where each one goes, and the incidents they opened. An incident fires once; resolving it is a separate notice.",
70253
71262
  examples: ["overlane observe alerts", "overlane observe alerts --json"],
70254
71263
  effect: "read",
70255
- ...common20,
71264
+ ...common21,
70256
71265
  keywords: ["alerts", "incidents", "notifications", "who gets paged", "failing runs"],
70257
71266
  result: AlertOverview,
70258
71267
  text: (d) => [
@@ -70260,7 +71269,7 @@ var observeAlertsCommand = defineCommand({
70260
71269
  ...d.incidents.map((i2) => `${i2.state.padEnd(8)} ${i2.openedAt} ${i2.kind} ${i2.subject} next: ${i2.nextCommand}`)
70261
71270
  ],
70262
71271
  handler: async (inv) => {
70263
- const { call: call2, tenantId } = await connected9(inv);
71272
+ const { call: call2, tenantId } = await connected10(inv);
70264
71273
  return { data: await call2(AlertOverview, "GET", observePaths.alerts(tenantId)) };
70265
71274
  }
70266
71275
  });
@@ -70290,7 +71299,7 @@ var observeAlertsSetCommand = defineCommand({
70290
71299
  ],
70291
71300
  examples: ["overlane observe alerts set --kind failing_run --email ops@example.com --slack ops", "overlane observe alerts set --kind spend_cap --percent 80 --email ops@example.com --dry-run"],
70292
71301
  effect: "write",
70293
- ...common20,
71302
+ ...common21,
70294
71303
  keywords: ["add alert", "alert on failing runs", "alert on spend", "notify slack", "notify email"],
70295
71304
  result: withDryRun(RuleSet),
70296
71305
  text: (d) => "rule" in d ? [`rule ${d.rule.ruleId}: ${d.rule.kind}, ${d.rule.enabled ? "on" : "off"}, -> ${d.rule.targets.map((t2) => `${t2.channel}:${t2.destination}`).join(", ")}`] : [],
@@ -70312,8 +71321,8 @@ var observeAlertsSetCommand = defineCommand({
70312
71321
  enabled: !boolFlag(inv, "off"),
70313
71322
  ...ruleId === void 0 ? {} : { ruleId }
70314
71323
  };
70315
- if (inv.dryRun) return planned9(inv, "PUT", observePaths.alertRules, body2);
70316
- const { call: call2, tenantId } = await connected9(inv);
71324
+ if (inv.dryRun) return planned10(inv, "PUT", observePaths.alertRules, body2);
71325
+ const { call: call2, tenantId } = await connected10(inv);
70317
71326
  return { data: await call2(RuleSet, "PUT", observePaths.alertRules(tenantId), body2) };
70318
71327
  }
70319
71328
  });
@@ -70325,15 +71334,15 @@ var observeAlertsRemoveCommand = defineCommand({
70325
71334
  flags: [{ name: "rule-id", type: "string", value: "ID", description: "The rule to remove (required)" }],
70326
71335
  examples: ["overlane observe alerts remove --rule-id rule-1 --force", "overlane observe alerts remove --rule-id rule-1 --dry-run"],
70327
71336
  effect: "destructive",
70328
- ...common20,
71337
+ ...common21,
70329
71338
  keywords: ["delete alert", "remove alert rule", "stop alerts"],
70330
71339
  result: withDryRun(RuleRemoved),
70331
71340
  text: (d) => "removed" in d ? ["rule removed"] : [],
70332
71341
  handler: async (inv) => {
70333
71342
  const ruleId = textFlag(inv, "rule-id");
70334
71343
  if (ruleId === void 0) throw new UsageError("remove needs --rule-id", { hint: "overlane observe alerts" });
70335
- if (inv.dryRun) return planned9(inv, "DELETE", observePaths.alertRules, { ruleId });
70336
- const { call: call2, tenantId } = await connected9(inv);
71344
+ if (inv.dryRun) return planned10(inv, "DELETE", observePaths.alertRules, { ruleId });
71345
+ const { call: call2, tenantId } = await connected10(inv);
70337
71346
  return { data: await call2(RuleRemoved, "DELETE", observePaths.alertRules(tenantId), { ruleId }) };
70338
71347
  }
70339
71348
  });
@@ -70343,13 +71352,13 @@ var observeAlertsEvaluateCommand = defineCommand({
70343
71352
  description: "Looks at each enabled rule's condition, opens an incident for a new one, resolves one that cleared, and sends each notice once. The service also runs this on a schedule and when a run ends in failure.",
70344
71353
  examples: ["overlane observe alerts evaluate", "overlane observe alerts evaluate --dry-run"],
70345
71354
  effect: "write",
70346
- ...common20,
71355
+ ...common21,
70347
71356
  keywords: ["check alerts now", "evaluate rules", "send alerts"],
70348
71357
  result: withDryRun(EvaluateAlertsResult),
70349
71358
  text: (d) => "opened" in d ? [`opened ${d.opened.length}, resolved ${d.resolved.length}, still open ${d.stillOpen}`, ...d.opened.map((i2) => ` ${i2.kind}: ${i2.subject}`)] : [],
70350
71359
  handler: async (inv) => {
70351
- if (inv.dryRun) return planned9(inv, "POST", observePaths.alertsEvaluate, {}, "opens incidents and sends notices");
70352
- const { call: call2, tenantId } = await connected9(inv);
71360
+ if (inv.dryRun) return planned10(inv, "POST", observePaths.alertsEvaluate, {}, "opens incidents and sends notices");
71361
+ const { call: call2, tenantId } = await connected10(inv);
70353
71362
  return { data: await call2(EvaluateAlertsResult, "POST", observePaths.alertsEvaluate(tenantId), {}) };
70354
71363
  }
70355
71364
  });
@@ -70359,12 +71368,12 @@ var observeRetentionCommand = defineCommand({
70359
71368
  description: "The retention period for logs, spans, metrics and run events on the team's plan, and the records no purge ever touches: the task ledger, evidence, the audit log, billing and decision records.",
70360
71369
  examples: ["overlane observe retention", "overlane observe retention --json"],
70361
71370
  effect: "read",
70362
- ...common20,
71371
+ ...common21,
70363
71372
  keywords: ["retention", "how long are logs kept", "data retention", "purge"],
70364
71373
  result: RetentionPolicy,
70365
71374
  text: (d) => [`plan ${d.plan}: ${d.retentionDays === null ? "no fixed period" : `${d.retentionDays} days`}`, `purged: ${d.covers.join(", ")}`, `never purged: ${d.keeps.join(", ")}`],
70366
71375
  handler: async (inv) => {
70367
- const { call: call2, tenantId } = await connected9(inv);
71376
+ const { call: call2, tenantId } = await connected10(inv);
70368
71377
  return { data: await call2(RetentionPolicy, "GET", observePaths.retention(tenantId)) };
70369
71378
  }
70370
71379
  });
@@ -70374,13 +71383,13 @@ var observeRetentionPurgeCommand = defineCommand({
70374
71383
  description: "Deletes logs, spans, metrics, run events and resolved incidents older than the plan's retention period and prints how many of each. The task ledger, evidence, audit log, billing and decision records are never touched. The service also runs this on a schedule. Destructive: it needs --force without a terminal.",
70375
71384
  examples: ["overlane observe retention purge --force", "overlane observe retention purge --dry-run"],
70376
71385
  effect: "destructive",
70377
- ...common20,
71386
+ ...common21,
70378
71387
  keywords: ["purge logs", "delete old telemetry", "enforce retention"],
70379
71388
  result: withDryRun(RetentionPurgeResult),
70380
71389
  text: (d) => "deleted" in d ? [`plan ${d.plan}, cutoff ${d.cutoff ?? "none"}`, ...Object.entries(d.deleted).map(([k, v]) => ` ${k}: ${v}`)] : [],
70381
71390
  handler: async (inv) => {
70382
- if (inv.dryRun) return planned9(inv, "POST", observePaths.retentionPurge, {}, "deletes telemetry older than the plan keeps");
70383
- const { call: call2, tenantId } = await connected9(inv);
71391
+ if (inv.dryRun) return planned10(inv, "POST", observePaths.retentionPurge, {}, "deletes telemetry older than the plan keeps");
71392
+ const { call: call2, tenantId } = await connected10(inv);
70384
71393
  return { data: await call2(RetentionPurgeResult, "POST", observePaths.retentionPurge(tenantId), {}) };
70385
71394
  }
70386
71395
  });
@@ -70439,7 +71448,8 @@ function coreCommands() {
70439
71448
  ...observeCommands,
70440
71449
  ...repoCommands,
70441
71450
  ...ciCommands,
70442
- ...deployCommands
71451
+ ...deployCommands,
71452
+ ...enterpriseCommands
70443
71453
  ];
70444
71454
  }
70445
71455
  function createRegistry(extra = []) {
@@ -70664,22 +71674,22 @@ import { join as join29 } from "node:path";
70664
71674
  function dataDir(env = process.env, home = homedir()) {
70665
71675
  const override = env["MVRX_DATA_DIR"];
70666
71676
  if (override !== void 0 && override !== "") return override;
70667
- const base4 = env["XDG_DATA_HOME"] ?? (process.platform === "win32" ? env["LOCALAPPDATA"] : void 0) ?? (process.platform === "darwin" ? join29(home, "Library", "Application Support") : join29(home, ".local", "share"));
70668
- return join29(base4, "mvrx-harness");
71677
+ const base5 = env["XDG_DATA_HOME"] ?? (process.platform === "win32" ? env["LOCALAPPDATA"] : void 0) ?? (process.platform === "darwin" ? join29(home, "Library", "Application Support") : join29(home, ".local", "share"));
71678
+ return join29(base5, "mvrx-harness");
70669
71679
  }
70670
71680
  function marketplaceRoot(env = process.env, home = homedir()) {
70671
71681
  return join29(dataDir(env, home), "marketplace");
70672
71682
  }
70673
71683
 
70674
71684
  // src/plugin.ts
70675
- import { readFileSync as readFileSync15 } from "node:fs";
71685
+ import { readFileSync as readFileSync16 } from "node:fs";
70676
71686
  import { join as join31 } from "node:path";
70677
71687
  import { parseArgs as parseArgs3 } from "node:util";
70678
71688
 
70679
71689
  // src/marketplace.ts
70680
71690
  init_src();
70681
71691
  import { createHash as createHash7 } from "node:crypto";
70682
- import { cpSync, existsSync as existsSync8, mkdirSync as mkdirSync10, readdirSync as readdirSync3, readFileSync as readFileSync14, renameSync as renameSync7, rmSync as rmSync4, statSync as statSync2, writeFileSync as writeFileSync9 } from "node:fs";
71692
+ import { cpSync, existsSync as existsSync8, mkdirSync as mkdirSync10, readdirSync as readdirSync3, readFileSync as readFileSync15, renameSync as renameSync7, rmSync as rmSync4, statSync as statSync2, writeFileSync as writeFileSync10 } from "node:fs";
70683
71693
  import { dirname as dirname11, join as join30, relative as relative2, sep } from "node:path";
70684
71694
  var CLIENT_DIRS = ["claude", "codex"];
70685
71695
  var EMBEDDED_MANIFEST = "release-manifest.json";
@@ -70690,7 +71700,7 @@ function loadEmbedded(packageRoot2) {
70690
71700
  const dir = join30(packageRoot2, "plugins");
70691
71701
  const path = join30(dir, EMBEDDED_MANIFEST);
70692
71702
  if (!existsSync8(path)) throw new MarketplaceError(`this package has no embedded plugin release (${path} is missing)`);
70693
- const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync14(path, "utf8")));
71703
+ const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync15(path, "utf8")));
70694
71704
  if (!parsed.success) throw new MarketplaceError(`the embedded release manifest is invalid: ${parsed.error.message}`);
70695
71705
  return { dir, manifest: parsed.data };
70696
71706
  }
@@ -70718,7 +71728,7 @@ async function verifyTree(treeRoot, manifest) {
70718
71728
  problems.push(`missing: ${file2.path}`);
70719
71729
  continue;
70720
71730
  }
70721
- if (sha2562(readFileSync14(path)) !== file2.digest) problems.push(`modified: ${file2.path}`);
71731
+ if (sha2562(readFileSync15(path)) !== file2.digest) problems.push(`modified: ${file2.path}`);
70722
71732
  }
70723
71733
  for (const client of CLIENT_DIRS) {
70724
71734
  for (const found of listFiles(join30(treeRoot, client))) {
@@ -70729,7 +71739,7 @@ async function verifyTree(treeRoot, manifest) {
70729
71739
  }
70730
71740
  function readInstalledManifest(target2) {
70731
71741
  try {
70732
- const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync14(join30(target2, INSTALLED_MANIFEST), "utf8")));
71742
+ const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync15(join30(target2, INSTALLED_MANIFEST), "utf8")));
70733
71743
  return parsed.success ? parsed.data : null;
70734
71744
  } catch {
70735
71745
  return null;
@@ -70760,7 +71770,7 @@ async function syncMarketplace(embedded, target2) {
70760
71770
  if (existsSync8(join30(embedded.dir, client))) cpSync(join30(embedded.dir, client), join30(staging, client), { recursive: true });
70761
71771
  }
70762
71772
  mkdirSync10(join30(staging, ".release"), { recursive: true });
70763
- writeFileSync9(join30(staging, INSTALLED_MANIFEST), `${JSON.stringify(embedded.manifest, null, 2)}
71773
+ writeFileSync10(join30(staging, INSTALLED_MANIFEST), `${JSON.stringify(embedded.manifest, null, 2)}
70764
71774
  `);
70765
71775
  const after = await verifyTree(staging, embedded.manifest);
70766
71776
  if (after.length > 0) throw new MarketplaceError(`the copied plugin files do not match the release manifest:
@@ -70793,7 +71803,7 @@ var PluginUsageError = class extends Error {
70793
71803
  };
70794
71804
  function readNames(treeRoot, client) {
70795
71805
  const file2 = client === "claude" ? join31(treeRoot, "claude", ".claude-plugin", "marketplace.json") : join31(treeRoot, "codex", ".agents", "plugins", "marketplace.json");
70796
- const parsed = JSON.parse(readFileSync15(file2, "utf8"));
71806
+ const parsed = JSON.parse(readFileSync16(file2, "utf8"));
70797
71807
  const record3 = parsed;
70798
71808
  const plugin = record3.plugins?.[0]?.name;
70799
71809
  if (typeof record3.name !== "string" || typeof plugin !== "string") throw new MarketplaceError(`${file2} names no marketplace or plugin`);
@@ -71065,8 +72075,8 @@ async function confirm(question) {
71065
72075
  }
71066
72076
  }
71067
72077
  function configDir2(env) {
71068
- const base4 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join34(homedir3(), ".config");
71069
- return join34(base4, "mvrx-harness");
72078
+ const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join34(homedir3(), ".config");
72079
+ return join34(base5, "mvrx-harness");
71070
72080
  }
71071
72081
  function createDeps2(env = process.env) {
71072
72082
  return {