overlane 0.1.119 → 0.1.120

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
@@ -3502,15 +3502,15 @@ var init_schemas = __esm({
3502
3502
  const syms = normalized.symbolKeys;
3503
3503
  const doc = new Doc(["payload", "ctx"], { shape: shape2, inst, memo: memo3, syms });
3504
3504
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
3505
- const prefixStr = (id, k) => `
3506
- let ${id}_ab = false;
3507
- for (let i = 0; i < ${id}.issues.length; i++) {
3508
- const iss = ${id}.issues[i];
3505
+ const prefixStr = (id2, k) => `
3506
+ let ${id2}_ab = false;
3507
+ for (let i = 0; i < ${id2}.issues.length; i++) {
3508
+ const iss = ${id2}.issues[i];
3509
3509
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
3510
3510
  payload.issues.push(iss);
3511
- if (iss.continue !== true) ${id}_ab = true;
3511
+ if (iss.continue !== true) ${id2}_ab = true;
3512
3512
  }
3513
- if (${id}_ab && ctx && ctx.abortEarly) {
3513
+ if (${id2}_ab && ctx && ctx.abortEarly) {
3514
3514
  payload.value = newResult;
3515
3515
  return payload;
3516
3516
  }`;
@@ -3524,34 +3524,34 @@ var init_schemas = __esm({
3524
3524
  for (const key of normalized.allKeys) {
3525
3525
  if (key === "__proto__")
3526
3526
  continue;
3527
- const id = ids[key];
3527
+ const id2 = ids[key];
3528
3528
  const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
3529
3529
  const isPresent = `${k} in input`;
3530
3530
  const schema = shape2[key];
3531
3531
  const optin = schema?._zod?.optin;
3532
3532
  const isOptionalIn = optin !== void 0;
3533
3533
  const isOptionalOut = schema?._zod?.optout === "optional";
3534
- doc.write(`const ${id} = ${parseStr(k)};`);
3534
+ doc.write(`const ${id2} = ${parseStr(k)};`);
3535
3535
  if (isOptionalIn && isOptionalOut) {
3536
- const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
3536
+ const assign = optin === "optional" ? `${id2}_present` : `${id2}.value !== undefined || ${id2}_present`;
3537
3537
  doc.write(`
3538
- const ${id}_present = ${isPresent};
3539
- if (!${id}.issues.length || ${id}_present) {
3540
- if (${id}.issues.length) {${prefixStr(id, k)}
3538
+ const ${id2}_present = ${isPresent};
3539
+ if (!${id2}.issues.length || ${id2}_present) {
3540
+ if (${id2}.issues.length) {${prefixStr(id2, k)}
3541
3541
  }
3542
3542
 
3543
3543
  if (${assign}) {
3544
- newResult[${k}] = ${id}.value;
3544
+ newResult[${k}] = ${id2}.value;
3545
3545
  }
3546
3546
  }
3547
3547
 
3548
3548
  `);
3549
3549
  } else if (!isOptionalIn) {
3550
3550
  doc.write(`
3551
- const ${id}_present = ${isPresent};
3552
- if (${id}.issues.length) {${prefixStr(id, k)}
3551
+ const ${id2}_present = ${isPresent};
3552
+ if (${id2}.issues.length) {${prefixStr(id2, k)}
3553
3553
  }
3554
- if (!${id}_present && !${id}.issues.length) {
3554
+ if (!${id2}_present && !${id2}.issues.length) {
3555
3555
  payload.issues.push({
3556
3556
  code: "invalid_type",
3557
3557
  expected: "nonoptional",
@@ -3564,22 +3564,22 @@ var init_schemas = __esm({
3564
3564
  }
3565
3565
  }
3566
3566
 
3567
- if (${id}_present) {
3568
- newResult[${k}] = ${id}.value;
3567
+ if (${id2}_present) {
3568
+ newResult[${k}] = ${id2}.value;
3569
3569
  }
3570
3570
 
3571
3571
  `);
3572
3572
  } else {
3573
3573
  doc.write(`
3574
- if (${id}.issues.length) {${prefixStr(id, k)}
3574
+ if (${id2}.issues.length) {${prefixStr(id2, k)}
3575
3575
  }
3576
3576
  `);
3577
3577
  if (optin === "defaulted") {
3578
- doc.write(`newResult[${k}] = ${id}.value;`);
3578
+ doc.write(`newResult[${k}] = ${id2}.value;`);
3579
3579
  } else {
3580
3580
  doc.write(`
3581
- if (${id}.value !== undefined || ${isPresent}) {
3582
- newResult[${k}] = ${id}.value;
3581
+ if (${id2}.value !== undefined || ${isPresent}) {
3582
+ newResult[${k}] = ${id2}.value;
3583
3583
  }
3584
3584
  `);
3585
3585
  }
@@ -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, resolve11) {
4548
+ function isRecursive(inst, stack, resolve12) {
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, resolve11) {
4555
4555
  let result = NONE;
4556
4556
  const check2 = (child) => {
4557
4557
  if (result !== PROVEN && child?._zod) {
4558
- const answer = isRecursive(child, stack, resolve11);
4558
+ const answer = isRecursive(child, stack, resolve12);
4559
4559
  if (answer > result)
4560
4560
  result = answer;
4561
4561
  }
@@ -4566,7 +4566,7 @@ function isRecursive(inst, stack, resolve11) {
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, resolve11) : NONE;
4569
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve12) : NONE;
4570
4570
  if (child > answer)
4571
4571
  answer = child;
4572
4572
  }
@@ -4630,7 +4630,7 @@ function isRecursive(inst, stack, resolve11) {
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 ?? (resolve11 ? inst._zod.innerType : void 0);
4633
+ const inner = def._cachedInner ?? (resolve12 ? 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 base3 = inst._zod.parse;
4735
+ const base4 = 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 base3(payload, ctx);
4739
+ return base4(payload, ctx);
4740
4740
  };
4741
4741
  inst._zod.parse = wrapped;
4742
- if (inst._zod.run === base3)
4742
+ if (inst._zod.run === base4)
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 base3 = inst._zod.parse;
4754
+ const base4 = 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 = base3;
4759
+ inst._zod.parse = base4;
4760
4760
  if (inst._zod.run === wrapped)
4761
- inst._zod.run = base3;
4762
- return base3(payload, ctx);
4761
+ inst._zod.run = base4;
4762
+ return base4(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 base3(payload, ctx);
4771
+ return base4(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 = base3(payload, ctx);
4800
+ const result = base4(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 === base3)
4815
+ if (inst._zod.run === base4)
4816
4816
  inst._zod.run = wrapped;
4817
4817
  });
4818
4818
  }
@@ -15677,26 +15677,26 @@ function extractDefs(ctx, schema) {
15677
15677
  return;
15678
15678
  const idToSchema = /* @__PURE__ */ new Map();
15679
15679
  for (const entry of ctx.seen.entries()) {
15680
- const id = ctx.metadataRegistry.get(entry[0])?.id;
15681
- if (id) {
15682
- const existing = idToSchema.get(id);
15680
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
15681
+ if (id2) {
15682
+ const existing = idToSchema.get(id2);
15683
15683
  if (existing && existing !== entry[0]) {
15684
- throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
15684
+ throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
15685
15685
  }
15686
- idToSchema.set(id, entry[0]);
15686
+ idToSchema.set(id2, entry[0]);
15687
15687
  }
15688
15688
  }
15689
15689
  const makeURI = (entry) => {
15690
15690
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
15691
15691
  if (ctx.external) {
15692
15692
  const externalId = ctx.external.registry.get(entry[0])?.id;
15693
- const uriGenerator = ctx.external.uri ?? ((id2) => id2);
15693
+ const uriGenerator = ctx.external.uri ?? ((id3) => id3);
15694
15694
  if (externalId) {
15695
15695
  return { ref: uriGenerator(externalId) };
15696
15696
  }
15697
- const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
15698
- entry[1].defId = id;
15699
- return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` };
15697
+ const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
15698
+ entry[1].defId = id2;
15699
+ return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id2)}` };
15700
15700
  }
15701
15701
  const uriPrefix = `#`;
15702
15702
  const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
@@ -15744,8 +15744,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15744
15744
  continue;
15745
15745
  }
15746
15746
  }
15747
- const id = ctx.metadataRegistry.get(entry[0])?.id;
15748
- if (id) {
15747
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
15748
+ if (id2) {
15749
15749
  extractToDef(entry);
15750
15750
  continue;
15751
15751
  }
@@ -15976,10 +15976,10 @@ function finalize(ctx, schema) {
15976
15976
  } else {
15977
15977
  }
15978
15978
  if (ctx.external?.uri) {
15979
- const id = ctx.external.registry.get(schema)?.id;
15980
- if (!id)
15979
+ const id2 = ctx.external.registry.get(schema)?.id;
15980
+ if (!id2)
15981
15981
  throw new Error("Schema is missing an `id` property");
15982
- result.$id = ctx.external.uri(id);
15982
+ result.$id = ctx.external.uri(id2);
15983
15983
  }
15984
15984
  assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
15985
15985
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -16165,7 +16165,7 @@ function stringifyKeyNames(bySchema, json2, visited) {
16165
16165
  const values = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0);
16166
16166
  if (!numericType && !values?.some((v) => typeof v === "number"))
16167
16167
  return json2;
16168
- const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json2;
16168
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id2, ...rest } = json2;
16169
16169
  if (rest.enum)
16170
16170
  rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
16171
16171
  else if (typeof rest.const === "number")
@@ -21918,10 +21918,10 @@ var init_memory = __esm({
21918
21918
  /** Retrieval API (spec 7.2). The tenant comes from the caller's credential. */
21919
21919
  search: "/v1/memory/search",
21920
21920
  collection: memoryBase2,
21921
- one: (tenantId, id) => `${memoryBase2(tenantId)}/${encodeURIComponent(id)}`,
21922
- confirm: (tenantId, id) => `${memoryBase2(tenantId)}/${encodeURIComponent(id)}/confirm`,
21923
- promote: (tenantId, id) => `${memoryBase2(tenantId)}/${encodeURIComponent(id)}/promote`,
21924
- unlearn: (tenantId, id) => `${memoryBase2(tenantId)}/${encodeURIComponent(id)}/unlearn`,
21921
+ one: (tenantId, id2) => `${memoryBase2(tenantId)}/${encodeURIComponent(id2)}`,
21922
+ confirm: (tenantId, id2) => `${memoryBase2(tenantId)}/${encodeURIComponent(id2)}/confirm`,
21923
+ promote: (tenantId, id2) => `${memoryBase2(tenantId)}/${encodeURIComponent(id2)}/promote`,
21924
+ unlearn: (tenantId, id2) => `${memoryBase2(tenantId)}/${encodeURIComponent(id2)}/unlearn`,
21925
21925
  export: (tenantId) => `${memoryBase2(tenantId)}/export`,
21926
21926
  purge: (tenantId) => `${memoryBase2(tenantId)}/purge`,
21927
21927
  settings: (tenantId) => `${memoryBase2(tenantId)}/settings`,
@@ -22170,19 +22170,19 @@ var init_issues = __esm({
22170
22170
  base2 = (tenantId, projectId) => `/v1/tenants/${encodeURIComponent(tenantId)}/projects/${encodeURIComponent(projectId)}`;
22171
22171
  issuePaths = {
22172
22172
  issues: (t, p) => `${base2(t, p)}/issues`,
22173
- issue: (t, p, id) => `${base2(t, p)}/issues/${encodeURIComponent(id)}`,
22174
- assign: (t, p, id) => `${base2(t, p)}/issues/${encodeURIComponent(id)}/assign`,
22175
- events: (t, p, id) => `${base2(t, p)}/issues/${encodeURIComponent(id)}/events`,
22173
+ issue: (t, p, id2) => `${base2(t, p)}/issues/${encodeURIComponent(id2)}`,
22174
+ assign: (t, p, id2) => `${base2(t, p)}/issues/${encodeURIComponent(id2)}/assign`,
22175
+ events: (t, p, id2) => `${base2(t, p)}/issues/${encodeURIComponent(id2)}/events`,
22176
22176
  import: (t, p) => `${base2(t, p)}/issues-import`,
22177
22177
  workProjects: (t, p) => `${base2(t, p)}/work-projects`,
22178
- workProject: (t, p, id) => `${base2(t, p)}/work-projects/${encodeURIComponent(id)}`,
22178
+ workProject: (t, p, id2) => `${base2(t, p)}/work-projects/${encodeURIComponent(id2)}`,
22179
22179
  cycles: (t, p) => `${base2(t, p)}/cycles`,
22180
22180
  labels: (t, p) => `${base2(t, p)}/labels`,
22181
22181
  views: (t, p) => `${base2(t, p)}/views`,
22182
- viewRun: (t, p, id) => `${base2(t, p)}/views/${encodeURIComponent(id)}/run`,
22182
+ viewRun: (t, p, id2) => `${base2(t, p)}/views/${encodeURIComponent(id2)}/run`,
22183
22183
  loops: (t, p) => `${base2(t, p)}/loops`,
22184
- loop: (t, p, id) => `${base2(t, p)}/loops/${encodeURIComponent(id)}`,
22185
- loopFire: (t, p, id) => `${base2(t, p)}/loops/${encodeURIComponent(id)}/fire`,
22184
+ loop: (t, p, id2) => `${base2(t, p)}/loops/${encodeURIComponent(id2)}`,
22185
+ loopFire: (t, p, id2) => `${base2(t, p)}/loops/${encodeURIComponent(id2)}/fire`,
22186
22186
  sync: (t, p) => `${base2(t, p)}/issue-sync`,
22187
22187
  syncDeliveries: (t, p) => `${base2(t, p)}/issue-sync/deliveries`
22188
22188
  };
@@ -22284,6 +22284,554 @@ var init_onboarding = __esm({
22284
22284
  }
22285
22285
  });
22286
22286
 
22287
+ // ../contracts/src/review.ts
22288
+ function base3(tenantId, projectId) {
22289
+ return `/v1/tenants/${encodeURIComponent(tenantId)}/projects/${encodeURIComponent(projectId)}/review`;
22290
+ }
22291
+ var SEVERITIES, Severity, FINDING_STATUSES, FindingStatus, counts, Finding, REVIEW_SKIP_REASONS, SkipEntry, SkipList, TokenCapNotice, REVIEW_MODES, ReviewMode, REVIEW_TRIGGERS, REVIEW_STATUSES, ReviewSummary, ReviewRun, REVIEW_PRIVACY_TEXT, ReviewSettings, UpdateReviewSettingsRequest, PullFile, PullRequestSnapshot, ReviewRunRequest, ReviewRunResponse, ReviewStatusResponse, ReviewFindingsResponse, FEEDBACK_KINDS, FeedbackRequest, LearnedRule, FeedbackResponse, AutofixRequest, AutofixResponse, RawFinding, reviewPaths;
22292
+ var init_review = __esm({
22293
+ "../contracts/src/review.ts"() {
22294
+ "use strict";
22295
+ init_zod();
22296
+ init_common();
22297
+ SEVERITIES = ["low", "medium", "high", "critical"];
22298
+ Severity = external_exports.enum(SEVERITIES);
22299
+ FINDING_STATUSES = ["open", "fixed", "dismissed"];
22300
+ FindingStatus = external_exports.enum(FINDING_STATUSES);
22301
+ counts = external_exports.object({ open: external_exports.number().int().nonnegative(), fixed: external_exports.number().int().nonnegative(), dismissed: external_exports.number().int().nonnegative() }).strict();
22302
+ Finding = external_exports.object({
22303
+ tenantId: TenantId,
22304
+ id: external_exports.string().min(1),
22305
+ projectId: ProjectId,
22306
+ repository: external_exports.string().min(1),
22307
+ pullNumber: external_exports.number().int().positive(),
22308
+ path: external_exports.string().min(1),
22309
+ line: external_exports.number().int().positive(),
22310
+ endLine: external_exports.number().int().positive().optional(),
22311
+ severity: Severity,
22312
+ rule: external_exports.string().min(1).optional(),
22313
+ reason: external_exports.string().min(1).max(1e3).optional(),
22314
+ message: external_exports.string().min(1).max(2e3),
22315
+ status: FindingStatus,
22316
+ /** Stable across pushes: path, rule and the normalised text of the flagged line. Never contains source text. */
22317
+ fingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
22318
+ commentId: external_exports.string().optional(),
22319
+ firstSeenSha: CommitSha,
22320
+ lastSeenSha: CommitSha,
22321
+ autofixTaskId: TaskId.optional(),
22322
+ autofixAssignee: external_exports.string().min(1).optional(),
22323
+ createdAt: Timestamp,
22324
+ updatedAt: Timestamp
22325
+ }).strict().refine((finding) => finding.rule !== void 0 || finding.reason !== void 0, { message: "a finding needs a rule or a reason" });
22326
+ REVIEW_SKIP_REASONS = ["generated", "vendored", "lockfile", "minified", "binary", "rule"];
22327
+ SkipEntry = external_exports.object({ path: external_exports.string().min(1), reason: external_exports.enum(REVIEW_SKIP_REASONS) }).strict();
22328
+ SkipList = external_exports.array(SkipEntry);
22329
+ TokenCapNotice = external_exports.object({
22330
+ tenantId: TenantId,
22331
+ cap: external_exports.number().int().positive(),
22332
+ used: external_exports.number().int().nonnegative(),
22333
+ partial: external_exports.literal(true),
22334
+ covered: external_exports.number().int().nonnegative(),
22335
+ uncovered: external_exports.array(external_exports.string().min(1))
22336
+ }).strict();
22337
+ REVIEW_MODES = ["log_only", "comments"];
22338
+ ReviewMode = external_exports.enum(REVIEW_MODES);
22339
+ REVIEW_TRIGGERS = ["opened", "push", "manual"];
22340
+ REVIEW_STATUSES = ["completed", "partial", "failed"];
22341
+ ReviewSummary = external_exports.object({
22342
+ tenantId: TenantId,
22343
+ runId: external_exports.string().min(1),
22344
+ headSha: CommitSha,
22345
+ changes: external_exports.object({ files: external_exports.number().int().nonnegative(), additions: external_exports.number().int().nonnegative(), deletions: external_exports.number().int().nonnegative() }).strict(),
22346
+ risks: external_exports.array(external_exports.string()),
22347
+ checks: external_exports.array(external_exports.object({ name: external_exports.string().min(1), state: external_exports.enum(["pass", "fail", "pending"]) }).strict()),
22348
+ counts,
22349
+ skipped: SkipList,
22350
+ notice: TokenCapNotice.optional(),
22351
+ contextSymbols: external_exports.number().int().nonnegative(),
22352
+ /** The rendered comment body: one per PR, updated in place (REQ-REV-03). */
22353
+ body: external_exports.string().min(1)
22354
+ }).strict();
22355
+ ReviewRun = external_exports.object({
22356
+ tenantId: TenantId,
22357
+ id: external_exports.string().min(1),
22358
+ projectId: ProjectId,
22359
+ repository: external_exports.string().min(1),
22360
+ pullNumber: external_exports.number().int().positive(),
22361
+ headSha: CommitSha,
22362
+ trigger: external_exports.enum(REVIEW_TRIGGERS),
22363
+ fork: external_exports.boolean(),
22364
+ mode: ReviewMode,
22365
+ status: external_exports.enum(REVIEW_STATUSES),
22366
+ tokensUsed: external_exports.number().int().nonnegative(),
22367
+ tokenCap: external_exports.number().int().positive(),
22368
+ model: external_exports.string().min(1),
22369
+ posted: external_exports.boolean(),
22370
+ findings: counts,
22371
+ startedAt: Timestamp,
22372
+ completedAt: Timestamp
22373
+ }).strict();
22374
+ REVIEW_PRIVACY_TEXT = "Review sends the diff of a pull request, the code-map context around it and your review rules to a model provider only under terms that exclude training on that data. A fork pull request never receives your secrets.";
22375
+ ReviewSettings = external_exports.object({
22376
+ tenantId: TenantId,
22377
+ projectId: ProjectId,
22378
+ /** Log-only until the owner enables comments (REQ-REV-12). */
22379
+ mode: ReviewMode,
22380
+ tokenCap: external_exports.number().int().min(1e3).max(2e6),
22381
+ skipPatterns: external_exports.array(external_exports.string().min(1).max(256)).max(100),
22382
+ privacy: external_exports.literal(REVIEW_PRIVACY_TEXT),
22383
+ updatedAt: Timestamp.nullable()
22384
+ }).strict();
22385
+ UpdateReviewSettingsRequest = external_exports.object({
22386
+ mode: ReviewMode.optional(),
22387
+ tokenCap: external_exports.number().int().min(1e3).max(2e6).optional(),
22388
+ skipPatterns: external_exports.array(external_exports.string().min(1).max(256)).max(100).optional()
22389
+ }).strict();
22390
+ PullFile = external_exports.object({
22391
+ path: external_exports.string().min(1),
22392
+ status: external_exports.enum(["added", "modified", "removed", "renamed"]).default("modified"),
22393
+ additions: external_exports.number().int().nonnegative().default(0),
22394
+ deletions: external_exports.number().int().nonnegative().default(0),
22395
+ /** Unified diff hunks for the file; absent for binary files. */
22396
+ patch: external_exports.string().max(4e5).optional()
22397
+ }).strict();
22398
+ PullRequestSnapshot = external_exports.object({
22399
+ repository: external_exports.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),
22400
+ number: external_exports.number().int().positive(),
22401
+ headSha: CommitSha,
22402
+ title: external_exports.string().max(500),
22403
+ body: external_exports.string().max(6e4).default(""),
22404
+ author: external_exports.string().min(1),
22405
+ /** The head comes from a fork: no secrets are ever handed to the run (REQ-REV-09). */
22406
+ fork: external_exports.boolean().default(false),
22407
+ files: external_exports.array(PullFile).max(3e3)
22408
+ }).strict();
22409
+ ReviewRunRequest = external_exports.object({
22410
+ requestId: external_exports.string().min(1).max(128),
22411
+ trigger: external_exports.enum(REVIEW_TRIGGERS).default("manual"),
22412
+ source: external_exports.discriminatedUnion("kind", [
22413
+ external_exports.object({ kind: external_exports.literal("github"), repository: external_exports.string().min(1), number: external_exports.number().int().positive() }).strict(),
22414
+ external_exports.object({ kind: external_exports.literal("inline"), pull: PullRequestSnapshot }).strict()
22415
+ ])
22416
+ }).strict();
22417
+ ReviewRunResponse = external_exports.object({
22418
+ run: ReviewRun,
22419
+ summary: ReviewSummary,
22420
+ findings: external_exports.array(Finding),
22421
+ replay: external_exports.boolean()
22422
+ }).strict();
22423
+ ReviewStatusResponse = external_exports.object({ tenantId: TenantId, projectId: ProjectId, settings: ReviewSettings, runs: external_exports.array(ReviewRun), openFindings: external_exports.number().int().nonnegative() }).strict();
22424
+ ReviewFindingsResponse = external_exports.object({ tenantId: TenantId, findings: external_exports.array(Finding) }).strict();
22425
+ FEEDBACK_KINDS = ["accept", "dismiss", "reply"];
22426
+ FeedbackRequest = external_exports.object({ kind: external_exports.enum(FEEDBACK_KINDS), note: external_exports.string().max(1e3).optional(), requestId: external_exports.string().min(1).max(128) }).strict();
22427
+ LearnedRule = external_exports.object({
22428
+ tenantId: TenantId,
22429
+ rule: external_exports.string().min(1),
22430
+ direction: external_exports.enum(["suppress", "boost"]),
22431
+ evidence: external_exports.number().int().positive(),
22432
+ memoryId: external_exports.string().optional()
22433
+ }).strict();
22434
+ FeedbackResponse = external_exports.object({ finding: Finding, learned: LearnedRule.nullable() }).strict();
22435
+ AutofixRequest = external_exports.object({ requestId: external_exports.string().min(1).max(128), assignee: external_exports.string().min(1).max(128).optional() }).strict();
22436
+ AutofixResponse = external_exports.object({ finding: Finding, taskId: TaskId, assignee: external_exports.string().nullable(), replay: external_exports.boolean() }).strict();
22437
+ RawFinding = external_exports.object({
22438
+ path: external_exports.string().min(1),
22439
+ line: external_exports.number().int().positive(),
22440
+ endLine: external_exports.number().int().positive().optional(),
22441
+ severity: Severity,
22442
+ rule: external_exports.string().min(1).max(100).optional(),
22443
+ reason: external_exports.string().min(1).max(1e3).optional(),
22444
+ message: external_exports.string().min(1).max(2e3)
22445
+ }).strict();
22446
+ reviewPaths = {
22447
+ runs: (tenantId, projectId) => `${base3(tenantId, projectId)}/runs`,
22448
+ status: (tenantId, projectId) => `${base3(tenantId, projectId)}/status`,
22449
+ settings: (tenantId, projectId) => `${base3(tenantId, projectId)}/settings`,
22450
+ findings: (tenantId, projectId) => `${base3(tenantId, projectId)}/findings`,
22451
+ feedback: (tenantId, projectId, id2) => `${base3(tenantId, projectId)}/findings/${encodeURIComponent(id2)}/feedback`,
22452
+ autofix: (tenantId, projectId, id2) => `${base3(tenantId, projectId)}/findings/${encodeURIComponent(id2)}/autofix`
22453
+ };
22454
+ }
22455
+ });
22456
+
22457
+ // ../contracts/src/guardrails.ts
22458
+ function globToRegExp(pattern) {
22459
+ let source = "";
22460
+ for (let i2 = 0; i2 < pattern.length; i2 += 1) {
22461
+ const char = pattern[i2];
22462
+ if (char === "*") {
22463
+ if (pattern[i2 + 1] === "*") {
22464
+ source += ".*";
22465
+ i2 += 1;
22466
+ if (pattern[i2 + 1] === "/") i2 += 1;
22467
+ } else source += "[^/]*";
22468
+ } else if (char === "?") source += "[^/]";
22469
+ else source += char.replace(/[.+^${}()|[\]\\]/g, "\\$&");
22470
+ }
22471
+ return new RegExp(`^${source}$`);
22472
+ }
22473
+ function globMatches(pattern, value) {
22474
+ return globToRegExp(pattern).test(value);
22475
+ }
22476
+ function anyGlob(patterns, values) {
22477
+ if (patterns === void 0) return true;
22478
+ return values.some((value) => patterns.some((pattern) => globMatches(pattern, value)));
22479
+ }
22480
+ function inWindow(window3, at) {
22481
+ if (window3 === void 0) return true;
22482
+ const date5 = new Date(at);
22483
+ if (window3.days !== void 0 && !window3.days.includes(date5.getUTCDay())) return false;
22484
+ const hour = date5.getUTCHours();
22485
+ const from = window3.fromHour ?? 0;
22486
+ const to = window3.toHour ?? 24;
22487
+ return from <= to ? hour >= from && hour < to : hour >= from || hour < to;
22488
+ }
22489
+ function ruleMatches(rule, request) {
22490
+ const m = rule.match;
22491
+ if (m.principals !== void 0 && !anyGlob(m.principals, [`${request.principal.kind}:${request.principal.id}`, request.principal.id])) return false;
22492
+ if (m.roles !== void 0 && !m.roles.includes(request.principal.role)) return false;
22493
+ if (m.tools !== void 0 && !anyGlob(m.tools, [request.tool])) return false;
22494
+ if (m.paths !== void 0 && !anyGlob(m.paths, request.paths)) return false;
22495
+ if (m.branches !== void 0 && (request.branch === void 0 || !anyGlob(m.branches, [request.branch]))) return false;
22496
+ if (m.repositories !== void 0 && (request.repository === void 0 || !anyGlob(m.repositories, [request.repository]))) return false;
22497
+ if (m.environments !== void 0 && (request.environment === void 0 || !anyGlob(m.environments, [request.environment]))) return false;
22498
+ if (m.hosts !== void 0 && (request.host === void 0 || !anyGlob(m.hosts, [request.host]))) return false;
22499
+ if (!inWindow(m.time, request.at)) return false;
22500
+ if (m.usage !== void 0 && (request.usage[m.usage.metric] ?? 0) < m.usage.atLeast) return false;
22501
+ if (m.taskHeld !== void 0 && request.taskHeld !== m.taskHeld) return false;
22502
+ return true;
22503
+ }
22504
+ function describeFor(effect, ruleId, message) {
22505
+ if (message !== void 0) return message;
22506
+ return effect === "deny" ? `blocked by rule ${ruleId}` : `rule ${ruleId} requires approval before this runs`;
22507
+ }
22508
+ function composeDecision(tenantId, layers, request) {
22509
+ const matched = [];
22510
+ let winner = null;
22511
+ let dryWinner = null;
22512
+ const ordered = [...layers].sort((a, b) => GUARD_LAYERS.indexOf(a.layer) - GUARD_LAYERS.indexOf(b.layer));
22513
+ for (const { layer: layer2, rules } of ordered) {
22514
+ const live = rules.find((rule2) => !rule2.dryRun && ruleMatches(rule2, request));
22515
+ for (const rule2 of rules) {
22516
+ if (rule2.dryRun && ruleMatches(rule2, request)) {
22517
+ matched.push({ ruleId: rule2.id, layer: layer2, effect: rule2.effect, dryRun: true });
22518
+ if (rule2.effect !== "allow" && (dryWinner === null || EFFECT_STRENGTH[rule2.effect] > EFFECT_STRENGTH[dryWinner.rule.effect])) dryWinner = { layer: layer2, rule: rule2 };
22519
+ }
22520
+ }
22521
+ if (live === void 0) continue;
22522
+ matched.push({ ruleId: live.id, layer: layer2, effect: live.effect, dryRun: false });
22523
+ if (winner === null || EFFECT_STRENGTH[live.effect] > EFFECT_STRENGTH[winner.rule.effect]) winner = { layer: layer2, rule: live };
22524
+ }
22525
+ if (winner === null || winner.rule.effect === "allow") {
22526
+ const wouldBlock = dryWinner !== null;
22527
+ return {
22528
+ tenantId,
22529
+ effect: "allow",
22530
+ allowed: true,
22531
+ code: null,
22532
+ ruleId: winner?.rule.id ?? null,
22533
+ layer: winner?.layer ?? null,
22534
+ message: wouldBlock && dryWinner !== null ? `allowed; dry-run rule ${dryWinner.rule.id} would have blocked this` : "allowed",
22535
+ nextCommand: null,
22536
+ exitCode: 0,
22537
+ dryRun: wouldBlock,
22538
+ wouldBlock,
22539
+ matched
22540
+ };
22541
+ }
22542
+ const { rule, layer } = winner;
22543
+ return {
22544
+ tenantId,
22545
+ effect: rule.effect,
22546
+ allowed: false,
22547
+ code: rule.code ?? (rule.effect === "deny" ? "policy_denied" : "approval_required"),
22548
+ ruleId: rule.id,
22549
+ layer,
22550
+ message: describeFor(rule.effect, rule.id, rule.message),
22551
+ nextCommand: rule.nextCommand ?? DEFAULT_NEXT[rule.effect],
22552
+ exitCode: GUARD_EXIT_CODE,
22553
+ dryRun: false,
22554
+ wouldBlock: true,
22555
+ matched
22556
+ };
22557
+ }
22558
+ var GUARD_LAYERS, GuardLayer, GUARD_EFFECTS, GuardEffect, GUARD_CODES, GuardCode, GUARD_EXIT_CODE, glob, globs, GuardTimeWindow, GuardUsageMatch, GuardMatch, GuardRuleSource, GuardRuleFileSource, GuardRule, GuardRuleFileRecord, PutGuardRuleFileRequest, GuardRequest, GuardMatchedRule, GuardDecision, GUARD_APPROVAL_STATUSES, GUARD_AUTONOMY_MODES, GuardAutonomy, GuardApproval, AnswerGuardApprovalRequest, GuardEvaluateRequest, SECRET_SOURCES, SecretFinding, SecretScanResult, GuardEvaluateResponse, GuardRulesResponse, EFFECT_STRENGTH, DEFAULT_NEXT, guardPaths, APPROVAL_HEADER;
22559
+ var init_guardrails = __esm({
22560
+ "../contracts/src/guardrails.ts"() {
22561
+ "use strict";
22562
+ init_zod();
22563
+ init_common();
22564
+ init_identity();
22565
+ GUARD_LAYERS = ["platform", "team", "project"];
22566
+ GuardLayer = external_exports.enum(GUARD_LAYERS);
22567
+ GUARD_EFFECTS = ["allow", "deny", "require_approval"];
22568
+ GuardEffect = external_exports.enum(GUARD_EFFECTS);
22569
+ GUARD_CODES = [
22570
+ "policy_denied",
22571
+ "approval_required",
22572
+ "protected_branch",
22573
+ "path_protected",
22574
+ "spend_cap_reached",
22575
+ "plan_limit_reached",
22576
+ "egress_blocked",
22577
+ "deploy_blocked",
22578
+ "secret_detected",
22579
+ "task_required"
22580
+ ];
22581
+ GuardCode = external_exports.enum(GUARD_CODES);
22582
+ GUARD_EXIT_CODE = 6;
22583
+ glob = external_exports.string().min(1).max(256);
22584
+ globs = external_exports.array(glob).min(1).max(64);
22585
+ GuardTimeWindow = external_exports.object({
22586
+ days: external_exports.array(external_exports.number().int().min(0).max(6)).min(1).max(7).optional(),
22587
+ fromHour: external_exports.number().int().min(0).max(23).optional(),
22588
+ toHour: external_exports.number().int().min(1).max(24).optional()
22589
+ }).strict();
22590
+ GuardUsageMatch = external_exports.object({ metric: external_exports.string().min(1).max(64), atLeast: external_exports.number().nonnegative() }).strict();
22591
+ GuardMatch = external_exports.object({
22592
+ principals: globs.optional(),
22593
+ roles: external_exports.array(Role).min(1).optional(),
22594
+ tools: globs.optional(),
22595
+ paths: globs.optional(),
22596
+ branches: globs.optional(),
22597
+ repositories: globs.optional(),
22598
+ environments: globs.optional(),
22599
+ hosts: globs.optional(),
22600
+ time: GuardTimeWindow.optional(),
22601
+ usage: GuardUsageMatch.optional(),
22602
+ /** The caller holds an active task (ADR 0038). */
22603
+ taskHeld: external_exports.boolean().optional()
22604
+ }).strict();
22605
+ GuardRuleSource = external_exports.object({
22606
+ id: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{1,63}$/, "use lowercase letters, digits, . _ -"),
22607
+ description: external_exports.string().min(1).max(400),
22608
+ effect: GuardEffect,
22609
+ match: GuardMatch,
22610
+ /** Report what the rule would block without blocking (REQ-GRD-08). */
22611
+ dryRun: external_exports.boolean().default(false),
22612
+ code: GuardCode.optional(),
22613
+ /** Plain-language reason shown to the person or agent that was refused. */
22614
+ message: external_exports.string().min(1).max(400).optional(),
22615
+ /** The exact next command or approval path (REQ-GRD-12). */
22616
+ nextCommand: external_exports.string().min(1).max(200).optional()
22617
+ }).strict();
22618
+ GuardRuleFileSource = external_exports.object({
22619
+ version: external_exports.literal("1"),
22620
+ rules: external_exports.array(GuardRuleSource).max(200)
22621
+ }).strict().superRefine((file2, ctx) => {
22622
+ const seen = /* @__PURE__ */ new Set();
22623
+ file2.rules.forEach((rule, index) => {
22624
+ if (seen.has(rule.id)) ctx.addIssue({ code: "custom", path: ["rules", index, "id"], message: `duplicate rule id ${rule.id}` });
22625
+ seen.add(rule.id);
22626
+ });
22627
+ });
22628
+ GuardRule = GuardRuleSource.extend({
22629
+ tenantId: TenantId,
22630
+ layer: GuardLayer,
22631
+ projectId: ProjectId.optional(),
22632
+ fileVersion: external_exports.number().int().positive()
22633
+ }).strict();
22634
+ GuardRuleFileRecord = external_exports.object({
22635
+ tenantId: TenantId,
22636
+ layer: GuardLayer,
22637
+ projectId: ProjectId.optional(),
22638
+ version: external_exports.number().int().positive(),
22639
+ digest: Sha256Digest,
22640
+ ruleCount: external_exports.number().int().nonnegative(),
22641
+ author: external_exports.string().min(1),
22642
+ reason: external_exports.string().min(1).max(400).optional(),
22643
+ createdAt: Timestamp
22644
+ }).strict();
22645
+ PutGuardRuleFileRequest = external_exports.object({
22646
+ requestId: external_exports.string().min(1).max(128),
22647
+ layer: GuardLayer.exclude(["platform"]).default("team"),
22648
+ projectId: ProjectId.optional(),
22649
+ /** The rule file text (JSON). Kept as text so the digest and the reviewed file are the same bytes. */
22650
+ content: external_exports.string().min(2).max(256e3),
22651
+ reason: external_exports.string().min(1).max(400).optional()
22652
+ }).strict();
22653
+ GuardRequest = external_exports.object({
22654
+ tenantId: TenantId,
22655
+ projectId: ProjectId.optional(),
22656
+ principal: external_exports.object({ kind: external_exports.enum(["user", "agent", "bot", "system"]), id: external_exports.string().min(1), role: Role }).strict(),
22657
+ /** `api.write`, `git.push`, `git.merge`, `ci.run`, `deploy.run`, `egress.fetch`, `task.create`, `review.run`, ... */
22658
+ tool: external_exports.string().min(1).max(128),
22659
+ paths: external_exports.array(external_exports.string().min(1)).max(2e3).default([]),
22660
+ branch: external_exports.string().min(1).optional(),
22661
+ repository: external_exports.string().min(1).optional(),
22662
+ environment: external_exports.string().min(1).optional(),
22663
+ host: external_exports.string().min(1).optional(),
22664
+ at: Timestamp,
22665
+ usage: external_exports.record(external_exports.string(), external_exports.number().nonnegative()).default({}),
22666
+ taskHeld: external_exports.boolean().optional(),
22667
+ /** For approve-before-write: what the action does in plain language and the change it would make (REQ-GRD-09). */
22668
+ summary: external_exports.string().min(1).max(2e3).optional(),
22669
+ diff: external_exports.string().max(1e5).optional()
22670
+ }).strict();
22671
+ GuardMatchedRule = external_exports.object({ ruleId: external_exports.string().min(1), layer: GuardLayer, effect: GuardEffect, dryRun: external_exports.boolean() }).strict();
22672
+ GuardDecision = external_exports.object({
22673
+ tenantId: TenantId,
22674
+ effect: GuardEffect,
22675
+ allowed: external_exports.boolean(),
22676
+ code: GuardCode.nullable(),
22677
+ ruleId: external_exports.string().nullable(),
22678
+ layer: GuardLayer.nullable(),
22679
+ message: external_exports.string().min(1),
22680
+ nextCommand: external_exports.string().nullable(),
22681
+ exitCode: external_exports.union([external_exports.literal(0), external_exports.literal(GUARD_EXIT_CODE)]),
22682
+ /** True when a dry-run rule matched and would have blocked. */
22683
+ dryRun: external_exports.boolean(),
22684
+ wouldBlock: external_exports.boolean(),
22685
+ approvalId: external_exports.string().optional(),
22686
+ matched: external_exports.array(GuardMatchedRule)
22687
+ }).strict().superRefine((decision, ctx) => {
22688
+ if (decision.effect !== "allow" && decision.allowed) ctx.addIssue({ code: "custom", path: ["allowed"], message: "a deny or approval decision is not allowed" });
22689
+ if (!decision.allowed && (decision.code === null || decision.ruleId === null || decision.nextCommand === null)) {
22690
+ ctx.addIssue({ code: "custom", message: "a refusal carries a code, a rule ID and the next command" });
22691
+ }
22692
+ if (!decision.allowed && decision.exitCode !== GUARD_EXIT_CODE) ctx.addIssue({ code: "custom", path: ["exitCode"], message: "a refusal exits with 6" });
22693
+ });
22694
+ GUARD_APPROVAL_STATUSES = ["pending", "approved", "denied"];
22695
+ GUARD_AUTONOMY_MODES = ["autonomous", "supervised", "manual"];
22696
+ GuardAutonomy = external_exports.enum(GUARD_AUTONOMY_MODES);
22697
+ GuardApproval = external_exports.object({
22698
+ tenantId: TenantId,
22699
+ id: external_exports.string().min(1),
22700
+ projectId: ProjectId.optional(),
22701
+ ruleId: external_exports.string().min(1),
22702
+ tool: external_exports.string().min(1),
22703
+ requestedBy: external_exports.string().min(1),
22704
+ summary: external_exports.string().min(1),
22705
+ diff: external_exports.string().nullable(),
22706
+ status: external_exports.enum(GUARD_APPROVAL_STATUSES),
22707
+ /** Hash of the action the approval covers; a changed action needs a new approval. */
22708
+ actionDigest: Sha256Digest,
22709
+ decidedBy: external_exports.string().nullable(),
22710
+ /** Who approved: an independent second agent satisfies an approval; a person always can. */
22711
+ approverKind: external_exports.enum(["user", "agent"]).nullable(),
22712
+ evidence: external_exports.array(external_exports.string()),
22713
+ reason: external_exports.string().nullable(),
22714
+ decidedAt: Timestamp.nullable(),
22715
+ createdAt: Timestamp
22716
+ }).strict();
22717
+ AnswerGuardApprovalRequest = external_exports.object({ decision: external_exports.enum(["approve", "deny"]), reason: external_exports.string().min(1).max(400).optional(), evidence: external_exports.array(external_exports.string().min(1).max(400)).max(20).optional() }).strict();
22718
+ GuardEvaluateRequest = external_exports.object({
22719
+ tool: external_exports.string().min(1).max(128),
22720
+ paths: external_exports.array(external_exports.string().min(1)).max(2e3).optional(),
22721
+ branch: external_exports.string().optional(),
22722
+ repository: external_exports.string().optional(),
22723
+ environment: external_exports.string().optional(),
22724
+ host: external_exports.string().optional(),
22725
+ taskHeld: external_exports.boolean().optional(),
22726
+ summary: external_exports.string().min(1).max(2e3).optional(),
22727
+ diff: external_exports.string().max(1e5).optional(),
22728
+ /** Text the action would write (push content, log lines); scanned for secrets (REQ-GRD-05). */
22729
+ content: external_exports.string().max(1e6).optional(),
22730
+ /** Evaluate without recording an approval request or blocking. */
22731
+ dryRun: external_exports.boolean().optional(),
22732
+ /** Optional test overrides, honoured only for an explicit rule test. */
22733
+ principalOverride: external_exports.object({ kind: external_exports.enum(["user", "agent", "bot", "system"]), id: external_exports.string().min(1), role: Role }).strict().optional(),
22734
+ usage: external_exports.record(external_exports.string(), external_exports.number().nonnegative()).optional(),
22735
+ at: Timestamp.optional()
22736
+ }).strict();
22737
+ SECRET_SOURCES = ["push", "task", "evidence", "log", "memory", "api"];
22738
+ SecretFinding = external_exports.object({
22739
+ tenantId: TenantId,
22740
+ source: external_exports.enum(SECRET_SOURCES),
22741
+ rule: external_exports.string().min(1),
22742
+ /** Provider-prefixed keys block; generic high-entropy strings are reported only. */
22743
+ disposition: external_exports.enum(["blocked", "reported"]),
22744
+ path: external_exports.string().optional(),
22745
+ line: external_exports.number().int().positive().optional()
22746
+ }).strict();
22747
+ SecretScanResult = external_exports.object({ tenantId: TenantId, blocked: external_exports.boolean(), findings: external_exports.array(SecretFinding) }).strict();
22748
+ GuardEvaluateResponse = external_exports.object({ decision: GuardDecision, secrets: SecretScanResult.nullable() }).strict();
22749
+ GuardRulesResponse = external_exports.object({ tenantId: TenantId, files: external_exports.array(GuardRuleFileRecord), rules: external_exports.array(GuardRule) }).strict();
22750
+ EFFECT_STRENGTH = { allow: 0, require_approval: 1, deny: 2 };
22751
+ DEFAULT_NEXT = {
22752
+ allow: null,
22753
+ deny: "overlane guard rules list",
22754
+ require_approval: "overlane guard approvals list"
22755
+ };
22756
+ guardPaths = {
22757
+ base: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard`,
22758
+ rules: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard/rules`,
22759
+ evaluate: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard/evaluate`,
22760
+ approvals: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard/approvals`,
22761
+ approval: (tenantId, id2) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard/approvals/${encodeURIComponent(id2)}`,
22762
+ answer: (tenantId, id2) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard/approvals/${encodeURIComponent(id2)}/answer`,
22763
+ scan: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/guard/scan`
22764
+ };
22765
+ APPROVAL_HEADER = "x-overlane-approval";
22766
+ }
22767
+ });
22768
+
22769
+ // ../contracts/src/code-map.ts
22770
+ function codeMapDefault(setting, results = GATE_07_LATEST) {
22771
+ const result = results[setting];
22772
+ if (result.verdict === "failed") return { setting, on: false, basis: "gate-07-failed", reason: `off: ${result.summary} (${result.evidence})`, gate07: "failed" };
22773
+ if (result.verdict === "passed") return { setting, on: true, basis: "gate-07-passed", reason: `on: ${result.summary} (${result.evidence})`, gate07: "passed" };
22774
+ const on = SPEC_DEFAULT[setting];
22775
+ if (result.verdict === "pending") {
22776
+ return { setting, on, basis: "spec-default-provisional", reason: `${on ? "on" : "off"} by the spec default, provisional: ${result.summary} (${result.evidence})`, gate07: "pending" };
22777
+ }
22778
+ return { setting, on, basis: "spec-default", reason: `${on ? "on" : "off"} by the spec default: ${result.summary}`, gate07: "not-applicable" };
22779
+ }
22780
+ var CODE_MAP_SETTINGS, CodeMapSetting, GATE_07_VERDICTS, Gate07Verdict, GATE_07_LATEST, SPEC_DEFAULT, CODE_MAP_BASES, CodeMapDefault, CodeMapClientStatus, CodeMapStatus, codeMapPaths;
22781
+ var init_code_map = __esm({
22782
+ "../contracts/src/code-map.ts"() {
22783
+ "use strict";
22784
+ init_zod();
22785
+ init_clients();
22786
+ init_common();
22787
+ CODE_MAP_SETTINGS = ["local-agent-with-grep", "cloud-session", "bot", "review-service", "cross-repo", "wiki"];
22788
+ CodeMapSetting = external_exports.enum(CODE_MAP_SETTINGS);
22789
+ GATE_07_VERDICTS = ["passed", "failed", "pending", "not-applicable"];
22790
+ Gate07Verdict = external_exports.enum(GATE_07_VERDICTS);
22791
+ GATE_07_LATEST = {
22792
+ "local-agent-with-grep": {
22793
+ verdict: "failed",
22794
+ summary: "GATE-07 failed with a local checkout and grep: cueline 115% and afltables 109% of the native-search token cost",
22795
+ evidence: "ADR 0018, docs/findings/gate-07-preliminary.md, docs/findings/gate-07-realism-afltables.md"
22796
+ },
22797
+ "cloud-session": {
22798
+ verdict: "pending",
22799
+ summary: "re-run for agents without a checkout: the mechanical leg is recorded, the agent leg waits on a model",
22800
+ evidence: "docs/findings/MS-A5-results.md (MS-A5.6)"
22801
+ },
22802
+ bot: {
22803
+ verdict: "pending",
22804
+ summary: "re-run for agents without a checkout: the mechanical leg is recorded, the agent leg waits on a model",
22805
+ evidence: "docs/findings/MS-A5-results.md (MS-A5.6)"
22806
+ },
22807
+ "review-service": { verdict: "not-applicable", summary: "the review service has no grep to compare with; it uses the map as context", evidence: "ADR 0032 decision 3" },
22808
+ "cross-repo": { verdict: "not-applicable", summary: "cross-repository questions have no single checkout to search", evidence: "ADR 0032 decision 2" },
22809
+ wiki: { verdict: "not-applicable", summary: "the generated wiki is built from the map", evidence: "ADR 0032 decision 3" }
22810
+ };
22811
+ SPEC_DEFAULT = {
22812
+ "local-agent-with-grep": false,
22813
+ "cloud-session": true,
22814
+ bot: true,
22815
+ "review-service": true,
22816
+ "cross-repo": true,
22817
+ wiki: true
22818
+ };
22819
+ CODE_MAP_BASES = ["gate-07-failed", "gate-07-passed", "spec-default-provisional", "spec-default", "project-setting"];
22820
+ CodeMapDefault = external_exports.object({ setting: CodeMapSetting, on: external_exports.boolean(), basis: external_exports.enum(CODE_MAP_BASES), reason: external_exports.string().min(1), gate07: Gate07Verdict }).strict();
22821
+ CodeMapClientStatus = external_exports.object({ subject: external_exports.string().min(1), client: external_exports.string().min(1), setting: CodeMapSetting, on: external_exports.boolean(), basis: external_exports.enum(CODE_MAP_BASES), reason: external_exports.string().min(1), gate07: Gate07Verdict }).strict();
22822
+ CodeMapStatus = external_exports.object({
22823
+ tenantId: TenantId,
22824
+ projectId: ProjectId,
22825
+ /** ADR 0018: the Worker serves code routes and the MCP code tool only when the project turns the code layer on. */
22826
+ projectCodeLayer: external_exports.boolean(),
22827
+ clients: external_exports.array(CodeMapClientStatus)
22828
+ }).strict();
22829
+ codeMapPaths = {
22830
+ status: (tenantId, projectId) => `/v1/tenants/${encodeURIComponent(tenantId)}/projects/${encodeURIComponent(projectId)}/code-map/status`
22831
+ };
22832
+ }
22833
+ });
22834
+
22287
22835
  // ../contracts/src/index.ts
22288
22836
  var init_src = __esm({
22289
22837
  "../contracts/src/index.ts"() {
@@ -22310,6 +22858,9 @@ var init_src = __esm({
22310
22858
  init_memory();
22311
22859
  init_issues();
22312
22860
  init_onboarding();
22861
+ init_review();
22862
+ init_guardrails();
22863
+ init_code_map();
22313
22864
  }
22314
22865
  });
22315
22866
 
@@ -29644,12 +30195,12 @@ var require_dist = __commonJS({
29644
30195
  });
29645
30196
 
29646
30197
  // src/assets.ts
29647
- import { basename as basename3, join as join24, resolve as resolve8 } from "node:path";
30198
+ import { basename as basename3, join as join24, resolve as resolve9 } from "node:path";
29648
30199
  import { fileURLToPath } from "node:url";
29649
30200
  function packageRoot(env = process.env) {
29650
30201
  const override = env["MVRX_PACKAGE_ROOT"];
29651
30202
  if (override !== void 0 && override !== "") return override;
29652
- return resolve8(fileURLToPath(new URL(".", import.meta.url)), "..");
30203
+ return resolve9(fileURLToPath(new URL(".", import.meta.url)), "..");
29653
30204
  }
29654
30205
  function assetDir(env = process.env) {
29655
30206
  const override = env["MVRX_ASSET_DIR"];
@@ -29662,7 +30213,7 @@ var VERSION;
29662
30213
  var init_assets = __esm({
29663
30214
  "src/assets.ts"() {
29664
30215
  "use strict";
29665
- VERSION = true ? "0.1.119" : "0.0.0-dev";
30216
+ VERSION = true ? "0.1.120" : "0.0.0-dev";
29666
30217
  }
29667
30218
  });
29668
30219
 
@@ -29757,13 +30308,13 @@ function int64FromString(dec) {
29757
30308
  if (minus) {
29758
30309
  dec = dec.slice(1);
29759
30310
  }
29760
- const base3 = 1e6;
30311
+ const base4 = 1e6;
29761
30312
  let lowBits = 0;
29762
30313
  let highBits = 0;
29763
30314
  function add1e6digit(begin, end) {
29764
30315
  const digit1e6 = Number(dec.slice(begin, end));
29765
- highBits *= base3;
29766
- lowBits = lowBits * base3 + digit1e6;
30316
+ highBits *= base4;
30317
+ lowBits = lowBits * base4 + digit1e6;
29767
30318
  if (lowBits >= TWO_PWR_32_DBL) {
29768
30319
  highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0);
29769
30320
  lowBits = lowBits % TWO_PWR_32_DBL;
@@ -29795,14 +30346,14 @@ function uInt64ToString(lo, hi) {
29795
30346
  let digitA = low + mid * 6777216 + high * 6710656;
29796
30347
  let digitB = mid + high * 8147497;
29797
30348
  let digitC = high * 2;
29798
- const base3 = 1e7;
29799
- if (digitA >= base3) {
29800
- digitB += Math.floor(digitA / base3);
29801
- digitA %= base3;
30349
+ const base4 = 1e7;
30350
+ if (digitA >= base4) {
30351
+ digitB += Math.floor(digitA / base4);
30352
+ digitA %= base4;
29802
30353
  }
29803
- if (digitB >= base3) {
29804
- digitC += Math.floor(digitB / base3);
29805
- digitB %= base3;
30354
+ if (digitB >= base4) {
30355
+ digitC += Math.floor(digitB / base4);
30356
+ digitB %= base4;
29806
30357
  }
29807
30358
  return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) + decimalFrom1e7WithLeadingZeros(digitA);
29808
30359
  }
@@ -31080,7 +31631,7 @@ function createFileRegistry(...args2) {
31080
31631
  if (seen.has(protoFileName)) {
31081
31632
  continue;
31082
31633
  }
31083
- const dep = resolve11(protoFileName);
31634
+ const dep = resolve12(protoFileName);
31084
31635
  if (!dep) {
31085
31636
  throw new Error(`Unable to resolve ${protoFileName}, imported by ${file2.name}`);
31086
31637
  }
@@ -31094,7 +31645,7 @@ function createFileRegistry(...args2) {
31094
31645
  return deps.concat(...deps.map(recurseDeps));
31095
31646
  };
31096
31647
  const input2 = args2[0];
31097
- const resolve11 = args2[1];
31648
+ const resolve12 = args2[1];
31098
31649
  const seen = /* @__PURE__ */ new Set();
31099
31650
  for (const file2 of [input2, ...recurseDeps(input2)].reverse()) {
31100
31651
  addFile(file2, registry2);
@@ -32627,7 +33178,7 @@ var init_codegenv2 = __esm({
32627
33178
  });
32628
33179
 
32629
33180
  // ../../node_modules/.pnpm/@scip-code+scip@0.10.0/node_modules/@scip-code/scip/dist/scip_pb.js
32630
- var file_scip, IndexSchema, Descriptor_Suffix, SymbolInformation_Kind, ProtocolVersion, TextEncoding, PositionEncoding, SymbolRole, SyntaxKind, Severity, DiagnosticTag, Language;
33181
+ var file_scip, IndexSchema, Descriptor_Suffix, SymbolInformation_Kind, ProtocolVersion, TextEncoding, PositionEncoding, SymbolRole, SyntaxKind, Severity2, DiagnosticTag, Language;
32631
33182
  var init_scip_pb = __esm({
32632
33183
  "../../node_modules/.pnpm/@scip-code+scip@0.10.0/node_modules/@scip-code/scip/dist/scip_pb.js"() {
32633
33184
  init_codegenv2();
@@ -32799,13 +33350,13 @@ var init_scip_pb = __esm({
32799
33350
  SyntaxKind2[SyntaxKind2["TagAttribute"] = 35] = "TagAttribute";
32800
33351
  SyntaxKind2[SyntaxKind2["TagDelimiter"] = 36] = "TagDelimiter";
32801
33352
  })(SyntaxKind || (SyntaxKind = {}));
32802
- (function(Severity2) {
32803
- Severity2[Severity2["UnspecifiedSeverity"] = 0] = "UnspecifiedSeverity";
32804
- Severity2[Severity2["Error"] = 1] = "Error";
32805
- Severity2[Severity2["Warning"] = 2] = "Warning";
32806
- Severity2[Severity2["Information"] = 3] = "Information";
32807
- Severity2[Severity2["Hint"] = 4] = "Hint";
32808
- })(Severity || (Severity = {}));
33353
+ (function(Severity3) {
33354
+ Severity3[Severity3["UnspecifiedSeverity"] = 0] = "UnspecifiedSeverity";
33355
+ Severity3[Severity3["Error"] = 1] = "Error";
33356
+ Severity3[Severity3["Warning"] = 2] = "Warning";
33357
+ Severity3[Severity3["Information"] = 3] = "Information";
33358
+ Severity3[Severity3["Hint"] = 4] = "Hint";
33359
+ })(Severity2 || (Severity2 = {}));
32809
33360
  (function(DiagnosticTag2) {
32810
33361
  DiagnosticTag2[DiagnosticTag2["UnspecifiedDiagnosticTag"] = 0] = "UnspecifiedDiagnosticTag";
32811
33362
  DiagnosticTag2[DiagnosticTag2["Unnecessary"] = 1] = "Unnecessary";
@@ -32929,10 +33480,10 @@ var init_scip_pb = __esm({
32929
33480
 
32930
33481
  // ../index-builder/src/languages.ts
32931
33482
  function languageForPath(path) {
32932
- const base3 = path.slice(path.lastIndexOf("/") + 1);
32933
- const dot = base3.lastIndexOf(".");
33483
+ const base4 = path.slice(path.lastIndexOf("/") + 1);
33484
+ const dot = base4.lastIndexOf(".");
32934
33485
  if (dot <= 0) return null;
32935
- return BY_EXTENSION.get(base3.slice(dot).toLowerCase()) ?? null;
33486
+ return BY_EXTENSION.get(base4.slice(dot).toLowerCase()) ?? null;
32936
33487
  }
32937
33488
  var BY_EXTENSION;
32938
33489
  var init_languages = __esm({
@@ -33352,9 +33903,9 @@ function marshalNode(node2, index = 0) {
33352
33903
  C.setValue(address, node2[0], "i32");
33353
33904
  }
33354
33905
  function unmarshalNode(tree, address = TRANSFER_BUFFER) {
33355
- const id = C.getValue(address, "i32");
33906
+ const id2 = C.getValue(address, "i32");
33356
33907
  address += SIZE_OF_INT;
33357
- if (id === 0) return null;
33908
+ if (id2 === 0) return null;
33358
33909
  const index = C.getValue(address, "i32");
33359
33910
  address += SIZE_OF_INT;
33360
33911
  const row = C.getValue(address, "i32");
@@ -33363,7 +33914,7 @@ function unmarshalNode(tree, address = TRANSFER_BUFFER) {
33363
33914
  address += SIZE_OF_INT;
33364
33915
  const other = C.getValue(address, "i32");
33365
33916
  const result = new Node(INTERNAL, {
33366
- id,
33917
+ id: id2,
33367
33918
  tree,
33368
33919
  startIndex: index,
33369
33920
  startPosition: { row, column },
@@ -33507,13 +34058,13 @@ async function Module2(moduleArg = {}) {
33507
34058
  }
33508
34059
  readAsync = /* @__PURE__ */ __name(async (url2) => {
33509
34060
  if (isFileURI(url2)) {
33510
- return new Promise((resolve11, reject) => {
34061
+ return new Promise((resolve12, reject) => {
33511
34062
  var xhr = new XMLHttpRequest();
33512
34063
  xhr.open("GET", url2, true);
33513
34064
  xhr.responseType = "arraybuffer";
33514
34065
  xhr.onload = () => {
33515
34066
  if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
33516
- resolve11(xhr.response);
34067
+ resolve12(xhr.response);
33517
34068
  return;
33518
34069
  }
33519
34070
  reject(xhr.status);
@@ -33709,9 +34260,9 @@ async function Module2(moduleArg = {}) {
33709
34260
  __name(receiveInstantiationResult, "receiveInstantiationResult");
33710
34261
  var info2 = getWasmImports();
33711
34262
  if (Module["instantiateWasm"]) {
33712
- return new Promise((resolve11, reject) => {
34263
+ return new Promise((resolve12, reject) => {
33713
34264
  Module["instantiateWasm"](info2, (mod, inst) => {
33714
- resolve11(receiveInstance(mod, inst));
34265
+ resolve12(receiveInstance(mod, inst));
33715
34266
  });
33716
34267
  });
33717
34268
  }
@@ -34452,7 +35003,7 @@ async function Module2(moduleArg = {}) {
34452
35003
  }, "reportUndefinedSymbols");
34453
35004
  var runDependencies = 0;
34454
35005
  var dependenciesFulfilled = null;
34455
- var removeRunDependency = /* @__PURE__ */ __name((id) => {
35006
+ var removeRunDependency = /* @__PURE__ */ __name((id2) => {
34456
35007
  runDependencies--;
34457
35008
  Module["monitorRunDependencies"]?.(runDependencies);
34458
35009
  if (runDependencies == 0) {
@@ -34463,7 +35014,7 @@ async function Module2(moduleArg = {}) {
34463
35014
  }
34464
35015
  }
34465
35016
  }, "removeRunDependency");
34466
- var addRunDependency = /* @__PURE__ */ __name((id) => {
35017
+ var addRunDependency = /* @__PURE__ */ __name((id2) => {
34467
35018
  runDependencies++;
34468
35019
  Module["monitorRunDependencies"]?.(runDependencies);
34469
35020
  }, "addRunDependency");
@@ -35044,8 +35595,8 @@ async function Module2(moduleArg = {}) {
35044
35595
  if (runtimeInitialized) {
35045
35596
  moduleRtn = Module;
35046
35597
  } else {
35047
- moduleRtn = new Promise((resolve11, reject) => {
35048
- readyPromiseResolve = resolve11;
35598
+ moduleRtn = new Promise((resolve12, reject) => {
35599
+ readyPromiseResolve = resolve12;
35049
35600
  readyPromiseReject = reject;
35050
35601
  });
35051
35602
  }
@@ -35383,9 +35934,9 @@ var init_web_tree_sitter = __esm({
35383
35934
  * Returns `null` if the iterator is not positioned on a symbol.
35384
35935
  */
35385
35936
  get currentType() {
35386
- const id = this.currentTypeId;
35387
- if (id === null) return null;
35388
- return this.language.types[id] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id));
35937
+ const id2 = this.currentTypeId;
35938
+ if (id2 === null) return null;
35939
+ return this.language.types[id2] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id2));
35389
35940
  }
35390
35941
  /** Delete the lookahead iterator, freeing its resources. */
35391
35942
  delete() {
@@ -35849,7 +36400,7 @@ var init_web_tree_sitter = __esm({
35849
36400
  _namedChildren;
35850
36401
  /** @internal */
35851
36402
  constructor(internal, {
35852
- id,
36403
+ id: id2,
35853
36404
  tree,
35854
36405
  startIndex,
35855
36406
  startPosition,
@@ -35857,7 +36408,7 @@ var init_web_tree_sitter = __esm({
35857
36408
  }) {
35858
36409
  assertInternal(internal);
35859
36410
  this[0] = other;
35860
- this.id = id;
36411
+ this.id = id2;
35861
36412
  this.tree = tree;
35862
36413
  this.startIndex = startIndex;
35863
36414
  this.startPosition = startPosition;
@@ -37379,19 +37930,19 @@ function collect(extract, nodes, scope, parentId, prefix, path, symbols2, occurr
37379
37930
  for (const node2 of nodes) {
37380
37931
  for (const decl of extract(node2, scope)) {
37381
37932
  const qualified = prefix === "" ? decl.name : `${prefix}.${decl.name}`;
37382
- const id = `decl ${path}#${qualified}`;
37383
- if (symbols2.has(id)) continue;
37933
+ const id2 = `decl ${path}#${qualified}`;
37934
+ if (symbols2.has(id2)) continue;
37384
37935
  const range = rangeOf(decl.nameNode);
37385
- symbols2.set(id, {
37386
- symbol: id,
37936
+ symbols2.set(id2, {
37937
+ symbol: id2,
37387
37938
  name: decl.name,
37388
37939
  kind: decl.kind,
37389
37940
  range,
37390
37941
  enclosingRange: rangeOf(decl.outer),
37391
37942
  ...parentId ? { parent: parentId } : {}
37392
37943
  });
37393
- occurrences.push({ symbol: id, range, definition: true, ...parentId ? { enclosingSymbol: parentId } : {} });
37394
- if (decl.members.length > 0) collect(extract, decl.members, decl.memberScope, id, qualified, path, symbols2, occurrences);
37944
+ occurrences.push({ symbol: id2, range, definition: true, ...parentId ? { enclosingSymbol: parentId } : {} });
37945
+ if (decl.members.length > 0) collect(extract, decl.members, decl.memberScope, id2, qualified, path, symbols2, occurrences);
37395
37946
  }
37396
37947
  }
37397
37948
  }
@@ -37701,7 +38252,7 @@ var init_snapshot = __esm({
37701
38252
  // ../index-builder/src/upload.ts
37702
38253
  async function uploadSnapshot(options) {
37703
38254
  const doFetch = options.fetch ?? fetch;
37704
- const base3 = options.serviceUrl.replace(/\/+$/, "");
38255
+ const base4 = options.serviceUrl.replace(/\/+$/, "");
37705
38256
  const manifest = SnapshotManifest.parse(options.manifest);
37706
38257
  const { tenantId, repository, commitSha } = manifest;
37707
38258
  const headers = { authorization: `Bearer ${options.token}`, "content-type": "application/json" };
@@ -37709,7 +38260,7 @@ async function uploadSnapshot(options) {
37709
38260
  for (let attempt2 = 1; ; attempt2 += 1) {
37710
38261
  let failure4;
37711
38262
  try {
37712
- const response = await doFetch(`${base3}${path}`, { method: "POST", headers, body: body2 });
38263
+ const response = await doFetch(`${base4}${path}`, { method: "POST", headers, body: body2 });
37713
38264
  if (response.ok) return response;
37714
38265
  const retryable = response.status === 429 || response.status >= 500;
37715
38266
  if (!retryable || attempt2 >= ATTEMPTS) {
@@ -37721,7 +38272,7 @@ async function uploadSnapshot(options) {
37721
38272
  failure4 = error62 instanceof Error ? error62.message : String(error62);
37722
38273
  if (attempt2 >= ATTEMPTS) throw new Error(`POST ${path} failed: ${failure4}`);
37723
38274
  }
37724
- await new Promise((resolve11) => setTimeout(resolve11, (options.retryDelayMs ?? 500) * attempt2));
38275
+ await new Promise((resolve12) => setTimeout(resolve12, (options.retryDelayMs ?? 500) * attempt2));
37725
38276
  }
37726
38277
  };
37727
38278
  const manifestResponse = await send2(codePaths.uploadManifest(tenantId, repository.owner, repository.name), JSON.stringify(manifest));
@@ -37799,7 +38350,7 @@ var init_oidc = __esm({
37799
38350
  // ../index-builder/src/run.ts
37800
38351
  import { execFile as execFile2 } from "node:child_process";
37801
38352
  import { mkdir as mkdir3, readdir as readdir4, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
37802
- import { join as join26, resolve as resolve9 } from "node:path";
38353
+ import { join as join26, resolve as resolve10 } from "node:path";
37803
38354
  import { parseArgs as parseArgs2 } from "node:util";
37804
38355
  import { promisify as promisify2 } from "node:util";
37805
38356
  async function git3(root, args2) {
@@ -37820,7 +38371,7 @@ async function repositoryFromRemote(root) {
37820
38371
  }
37821
38372
  }
37822
38373
  async function snapshotFromArgs(values, env) {
37823
- const root = resolve9(typeof values["root"] === "string" ? values["root"] : process.cwd());
38374
+ const root = resolve10(typeof values["root"] === "string" ? values["root"] : process.cwd());
37824
38375
  const repoText = (typeof values["repo"] === "string" ? values["repo"] : void 0) ?? env["GITHUB_REPOSITORY"] ?? await repositoryFromRemote(root);
37825
38376
  if (!repoText) throw new UsageError2("cannot determine the repository; pass --repo owner/name");
37826
38377
  const commit = (typeof values["commit"] === "string" ? values["commit"] : void 0) ?? env["GITHUB_SHA"] ?? await git3(root, ["rev-parse", "HEAD"]);
@@ -37830,7 +38381,7 @@ async function snapshotFromArgs(values, env) {
37830
38381
  const scip = Array.isArray(values["scip"]) ? values["scip"] : [];
37831
38382
  return buildSnapshot({
37832
38383
  repoRoot: root,
37833
- scipFiles: scip.map((file2) => resolve9(file2)),
38384
+ scipFiles: scip.map((file2) => resolve10(file2)),
37834
38385
  tenantId: tenant,
37835
38386
  repository: parseRepository(repoText),
37836
38387
  commitSha: commit,
@@ -37845,8 +38396,8 @@ async function runCli2(argv, env, out2 = console.log, err2 = console.error) {
37845
38396
  const outDir = values.out;
37846
38397
  if (!outDir) throw new UsageError2("build needs --out DIR");
37847
38398
  const built = await snapshotFromArgs({ ...values, tenant: values.tenant ?? env["HARNESS_TENANT"] ?? "local" }, env);
37848
- await writeSnapshot(resolve9(outDir), built);
37849
- out2(`built ${built.shards.length} shards (${built.uncovered.length} files uncovered) into ${resolve9(outDir)}`);
38399
+ await writeSnapshot(resolve10(outDir), built);
38400
+ out2(`built ${built.shards.length} shards (${built.uncovered.length} files uncovered) into ${resolve10(outDir)}`);
37850
38401
  return 0;
37851
38402
  }
37852
38403
  if (command === "upload") {
@@ -39931,8 +40482,8 @@ function buildSchemas2025() {
39931
40482
  function isNonObjectJsonSchemaRoot(json2) {
39932
40483
  return json2["type"] !== "object";
39933
40484
  }
39934
- function establishesNewBase(id) {
39935
- return id !== void 0 && !(typeof id === "string" && id.startsWith("#"));
40485
+ function establishesNewBase(id2) {
40486
+ return id2 !== void 0 && !(typeof id2 === "string" && id2.startsWith("#"));
39936
40487
  }
39937
40488
  function wrapOutputSchemaForLegacy(natural) {
39938
40489
  const $schema = typeof natural["$schema"] === "string" ? natural["$schema"] : void 0;
@@ -41474,14 +42025,14 @@ function inputRequiredRoundsExceededMessage(method, maxRounds) {
41474
42025
  return `Multi-round-trip request '${method}' still required input after ${maxRounds} rounds (inputRequired.maxRounds)`;
41475
42026
  }
41476
42027
  function sleep2(ms, signal) {
41477
- return new Promise((resolve11, reject) => {
42028
+ return new Promise((resolve12, reject) => {
41478
42029
  if (signal?.aborted) {
41479
42030
  reject(signal.reason instanceof SdkError ? signal.reason : new SdkError(SdkErrorCode.RequestTimeout, String(signal.reason)));
41480
42031
  return;
41481
42032
  }
41482
42033
  const timer = setTimeout(() => {
41483
42034
  signal?.removeEventListener("abort", onAbort);
41484
- resolve11();
42035
+ resolve12();
41485
42036
  }, ms);
41486
42037
  const onAbort = () => {
41487
42038
  clearTimeout(timer);
@@ -41587,8 +42138,8 @@ function setNegotiatedProtocolVersion(instance2, version2) {
41587
42138
  function isPlainObject$1(value) {
41588
42139
  return value !== null && typeof value === "object" && !Array.isArray(value);
41589
42140
  }
41590
- function mergeCapabilities(base3, additional) {
41591
- const result = { ...base3 };
42141
+ function mergeCapabilities(base4, additional) {
42142
+ const result = { ...base4 };
41592
42143
  for (const key in additional) {
41593
42144
  const k = key;
41594
42145
  const addValue = additional[k];
@@ -43277,7 +43828,7 @@ var init_src_CX2iR2pK = __esm({
43277
43828
  const flowStartedAt = Date.now();
43278
43829
  let onAbort;
43279
43830
  let cleanupMessageId;
43280
- return new Promise((resolve11, reject) => {
43831
+ return new Promise((resolve12, reject) => {
43281
43832
  const earlyReject = (error62) => {
43282
43833
  reject(error62);
43283
43834
  };
@@ -43345,7 +43896,7 @@ var init_src_CX2iR2pK = __esm({
43345
43896
  }
43346
43897
  if (decoded.kind === "invalid") return reject(decoded.error);
43347
43898
  if (decoded.kind === "input_required") {
43348
- if (options?.allowInputRequired === true) return resolve11(manualInputRequiredValue(decoded));
43899
+ if (options?.allowInputRequired === true) return resolve12(manualInputRequiredValue(decoded));
43349
43900
  const flow = {
43350
43901
  codec: codec2,
43351
43902
  request,
@@ -43357,11 +43908,11 @@ var init_src_CX2iR2pK = __esm({
43357
43908
  params
43358
43909
  }, resultSchema2, legOptions)
43359
43910
  };
43360
- return resolve11(this._resolveNonCompleteResult(decoded, flow));
43911
+ return resolve12(this._resolveNonCompleteResult(decoded, flow));
43361
43912
  }
43362
43913
  const result = decoded.result;
43363
43914
  validateStandardSchema(resultSchema2, result).then((parseResult) => {
43364
- if (parseResult.success) resolve11(parseResult.data);
43915
+ if (parseResult.success) resolve12(parseResult.data);
43365
43916
  else reject(new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${request.method}: ${parseResult.error}`));
43366
43917
  }, reject);
43367
43918
  });
@@ -45552,9 +46103,9 @@ var init_ajvProvider_CEoC_sr = __esm({
45552
46103
  }
45553
46104
  return count;
45554
46105
  }
45555
- function getFullPath(resolver, id = "", normalize) {
45556
- if (normalize !== false) id = normalizeId(id);
45557
- return _getFullPath(resolver, resolver.parse(id));
46106
+ function getFullPath(resolver, id2 = "", normalize) {
46107
+ if (normalize !== false) id2 = normalizeId(id2);
46108
+ return _getFullPath(resolver, resolver.parse(id2));
45558
46109
  }
45559
46110
  exports.getFullPath = getFullPath;
45560
46111
  function _getFullPath(resolver, p) {
@@ -45562,13 +46113,13 @@ var init_ajvProvider_CEoC_sr = __esm({
45562
46113
  }
45563
46114
  exports._getFullPath = _getFullPath;
45564
46115
  const TRAILING_SLASH_HASH = /#\/?$/;
45565
- function normalizeId(id) {
45566
- return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
46116
+ function normalizeId(id2) {
46117
+ return id2 ? id2.replace(TRAILING_SLASH_HASH, "") : "";
45567
46118
  }
45568
46119
  exports.normalizeId = normalizeId;
45569
- function resolveUrl(resolver, baseId, id) {
45570
- id = normalizeId(id);
45571
- return resolver.resolve(baseId, id);
46120
+ function resolveUrl(resolver, baseId, id2) {
46121
+ id2 = normalizeId(id2);
46122
+ return resolver.resolve(baseId, id2);
45572
46123
  }
45573
46124
  exports.resolveUrl = resolveUrl;
45574
46125
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
@@ -46177,7 +46728,7 @@ var init_ajvProvider_CEoC_sr = __esm({
46177
46728
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
46178
46729
  const schOrFunc = root.refs[ref];
46179
46730
  if (schOrFunc) return schOrFunc;
46180
- let _sch = resolve11.call(this, root, ref);
46731
+ let _sch = resolve12.call(this, root, ref);
46181
46732
  if (_sch === void 0) {
46182
46733
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
46183
46734
  const { schemaId } = this.opts;
@@ -46203,7 +46754,7 @@ var init_ajvProvider_CEoC_sr = __esm({
46203
46754
  function sameSchemaEnv(s1, s2) {
46204
46755
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
46205
46756
  }
46206
- function resolve11(root, ref) {
46757
+ function resolve12(root, ref) {
46207
46758
  let sch;
46208
46759
  while (typeof (sch = this.refs[ref]) == "string") ref = sch;
46209
46760
  return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
@@ -46213,8 +46764,8 @@ var init_ajvProvider_CEoC_sr = __esm({
46213
46764
  const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
46214
46765
  let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0);
46215
46766
  if (Object.keys(root.schema).length > 0 && refPath === baseId) return getJsonPointer.call(this, p, root);
46216
- const id = (0, resolve_1.normalizeId)(refPath);
46217
- const schOrRef = this.refs[id] || this.schemas[id];
46767
+ const id2 = (0, resolve_1.normalizeId)(refPath);
46768
+ const schOrRef = this.refs[id2] || this.schemas[id2];
46218
46769
  if (typeof schOrRef == "string") {
46219
46770
  const sch = resolveSchema.call(this, root, schOrRef);
46220
46771
  if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") return;
@@ -46222,7 +46773,7 @@ var init_ajvProvider_CEoC_sr = __esm({
46222
46773
  }
46223
46774
  if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") return;
46224
46775
  if (!schOrRef.validate) compileSchema.call(this, schOrRef);
46225
- if (id === (0, resolve_1.normalizeId)(ref)) {
46776
+ if (id2 === (0, resolve_1.normalizeId)(ref)) {
46226
46777
  const { schema } = schOrRef;
46227
46778
  const { schemaId } = this.opts;
46228
46779
  const schId = schema[schemaId];
@@ -46653,16 +47204,16 @@ var init_ajvProvider_CEoC_sr = __esm({
46653
47204
  else if (typeof uri === "object") uri = parse5(serialize(uri, options), options);
46654
47205
  return uri;
46655
47206
  }
46656
- function resolve11(baseURI, relativeURI, options) {
47207
+ function resolve12(baseURI, relativeURI, options) {
46657
47208
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
46658
47209
  const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
46659
47210
  schemelessOptions.skipEscape = true;
46660
47211
  return serialize(resolved, schemelessOptions);
46661
47212
  }
46662
- function resolveComponent(base3, relative4, options, skipNormalization) {
47213
+ function resolveComponent(base4, relative4, options, skipNormalization) {
46663
47214
  const target = {};
46664
47215
  if (!skipNormalization) {
46665
- base3 = parse5(serialize(base3, options), options);
47216
+ base4 = parse5(serialize(base4, options), options);
46666
47217
  relative4 = parse5(serialize(relative4, options), options);
46667
47218
  }
46668
47219
  options = options || {};
@@ -46682,24 +47233,24 @@ var init_ajvProvider_CEoC_sr = __esm({
46682
47233
  target.query = relative4.query;
46683
47234
  } else {
46684
47235
  if (!relative4.path) {
46685
- target.path = base3.path;
47236
+ target.path = base4.path;
46686
47237
  if (relative4.query !== void 0) target.query = relative4.query;
46687
- else target.query = base3.query;
47238
+ else target.query = base4.query;
46688
47239
  } else {
46689
47240
  if (relative4.path[0] === "/") target.path = removeDotSegments(relative4.path);
46690
47241
  else {
46691
- if ((base3.userinfo !== void 0 || base3.host !== void 0 || base3.port !== void 0) && !base3.path) target.path = "/" + relative4.path;
46692
- else if (!base3.path) target.path = relative4.path;
46693
- else target.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) + relative4.path;
47242
+ if ((base4.userinfo !== void 0 || base4.host !== void 0 || base4.port !== void 0) && !base4.path) target.path = "/" + relative4.path;
47243
+ else if (!base4.path) target.path = relative4.path;
47244
+ else target.path = base4.path.slice(0, base4.path.lastIndexOf("/") + 1) + relative4.path;
46694
47245
  target.path = removeDotSegments(target.path);
46695
47246
  }
46696
47247
  target.query = relative4.query;
46697
47248
  }
46698
- target.userinfo = base3.userinfo;
46699
- target.host = base3.host;
46700
- target.port = base3.port;
47249
+ target.userinfo = base4.userinfo;
47250
+ target.host = base4.host;
47251
+ target.port = base4.port;
46701
47252
  }
46702
- target.scheme = base3.scheme;
47253
+ target.scheme = base4.scheme;
46703
47254
  }
46704
47255
  target.fragment = relative4.fragment;
46705
47256
  return target;
@@ -46827,7 +47378,7 @@ var init_ajvProvider_CEoC_sr = __esm({
46827
47378
  const fastUri = {
46828
47379
  SCHEMES,
46829
47380
  normalize,
46830
- resolve: resolve11,
47381
+ resolve: resolve12,
46831
47382
  resolveComponent,
46832
47383
  equal,
46833
47384
  serialize,
@@ -47090,13 +47641,13 @@ var init_ajvProvider_CEoC_sr = __esm({
47090
47641
  for (const sch of schema) this.addSchema(sch, void 0, _meta, _validateSchema);
47091
47642
  return this;
47092
47643
  }
47093
- let id;
47644
+ let id2;
47094
47645
  if (typeof schema === "object") {
47095
47646
  const { schemaId } = this.opts;
47096
- id = schema[schemaId];
47097
- if (id !== void 0 && typeof id != "string") throw new Error(`schema ${schemaId} must be string`);
47647
+ id2 = schema[schemaId];
47648
+ if (id2 !== void 0 && typeof id2 != "string") throw new Error(`schema ${schemaId} must be string`);
47098
47649
  }
47099
- key = (0, resolve_1.normalizeId)(key || id);
47650
+ key = (0, resolve_1.normalizeId)(key || id2);
47100
47651
  this._checkUnique(key);
47101
47652
  this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
47102
47653
  return this;
@@ -47161,11 +47712,11 @@ var init_ajvProvider_CEoC_sr = __esm({
47161
47712
  case "object": {
47162
47713
  const cacheKey = schemaKeyRef;
47163
47714
  this._cache.delete(cacheKey);
47164
- let id = schemaKeyRef[this.opts.schemaId];
47165
- if (id) {
47166
- id = (0, resolve_1.normalizeId)(id);
47167
- delete this.schemas[id];
47168
- delete this.refs[id];
47715
+ let id2 = schemaKeyRef[this.opts.schemaId];
47716
+ if (id2) {
47717
+ id2 = (0, resolve_1.normalizeId)(id2);
47718
+ delete this.schemas[id2];
47719
+ delete this.refs[id2];
47169
47720
  }
47170
47721
  return this;
47171
47722
  }
@@ -47257,14 +47808,14 @@ var init_ajvProvider_CEoC_sr = __esm({
47257
47808
  }
47258
47809
  }
47259
47810
  _addSchema(schema, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
47260
- let id;
47811
+ let id2;
47261
47812
  const { schemaId } = this.opts;
47262
- if (typeof schema == "object") id = schema[schemaId];
47813
+ if (typeof schema == "object") id2 = schema[schemaId];
47263
47814
  else if (this.opts.jtd) throw new Error("schema must be object");
47264
47815
  else if (typeof schema != "boolean") throw new Error("schema must be object or boolean");
47265
47816
  let sch = this._cache.get(schema);
47266
47817
  if (sch !== void 0) return sch;
47267
- baseId = (0, resolve_1.normalizeId)(id || baseId);
47818
+ baseId = (0, resolve_1.normalizeId)(id2 || baseId);
47268
47819
  const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
47269
47820
  sch = new compile_1.SchemaEnv({
47270
47821
  schema,
@@ -47281,8 +47832,8 @@ var init_ajvProvider_CEoC_sr = __esm({
47281
47832
  if (validateSchema) this.validateSchema(schema, true);
47282
47833
  return sch;
47283
47834
  }
47284
- _checkUnique(id) {
47285
- if (this.schemas[id] || this.refs[id]) throw new Error(`schema with key or id "${id}" already exists`);
47835
+ _checkUnique(id2) {
47836
+ if (this.schemas[id2] || this.refs[id2]) throw new Error(`schema with key or id "${id2}" already exists`);
47286
47837
  }
47287
47838
  _compileSchemaEnv(sch) {
47288
47839
  if (sch.meta) this._compileMetaSchema(sch);
@@ -50816,8 +51367,8 @@ var init_mcp_DXXb3Vv3 = __esm({
50816
51367
  if (serverInfo !== void 0) this._serverInfo = serverInfo;
50817
51368
  }
50818
51369
  /** Whether `id` is an active listen subscription on this connection. */
50819
- has(id) {
50820
- return this._subs.has(id);
51370
+ has(id2) {
51371
+ return this._subs.has(id2);
50821
51372
  }
50822
51373
  /**
50823
51374
  * Serve one inbound `subscriptions/listen` request: registers the
@@ -50861,8 +51412,8 @@ var init_mcp_DXXb3Vv3 = __esm({
50861
51412
  * `true` when a subscription was removed. After this call NOTHING further
50862
51413
  * is delivered for that subscription id (the post-cancel hardening).
50863
51414
  */
50864
- cancel(id) {
50865
- return this._subs.delete(id);
51415
+ cancel(id2) {
51416
+ return this._subs.delete(id2);
50866
51417
  }
50867
51418
  /**
50868
51419
  * Route an outbound notification through the active subscriptions.
@@ -50894,13 +51445,13 @@ var init_mcp_DXXb3Vv3 = __esm({
50894
51445
  */
50895
51446
  teardownAll() {
50896
51447
  const out2 = [];
50897
- for (const id of this._subs.keys()) out2.push({
51448
+ for (const id2 of this._subs.keys()) out2.push({
50898
51449
  jsonrpc: "2.0",
50899
- id,
51450
+ id: id2,
50900
51451
  result: {
50901
51452
  resultType: "complete",
50902
51453
  _meta: {
50903
- [SUBSCRIPTION_ID_META_KEY]: id,
51454
+ [SUBSCRIPTION_ID_META_KEY]: id2,
50904
51455
  ...this._serverInfo !== void 0 && { [SERVER_INFO_META_KEY]: this._serverInfo }
50905
51456
  }
50906
51457
  }
@@ -51468,7 +52019,7 @@ var init_mcp_DXXb3Vv3 = __esm({
51468
52019
  if (hasPreviousToolUse) {
51469
52020
  const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
51470
52021
  const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
51471
- if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) throw new ProtocolError(ProtocolErrorCode.InvalidParams, "ids of tool_result blocks and tool_use blocks from previous message do not match");
52022
+ if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id2) => toolResultIds.has(id2))) throw new ProtocolError(ProtocolErrorCode.InvalidParams, "ids of tool_result blocks and tool_use blocks from previous message do not match");
51472
52023
  }
51473
52024
  }
51474
52025
  const hasTools = Boolean(params.tools || params.toolChoice);
@@ -52192,9 +52743,9 @@ function serveStdio(factory, options = {}) {
52192
52743
  } catch {
52193
52744
  }
52194
52745
  };
52195
- const writeErrorResponse = (id, code2, message, data) => wire.send({
52746
+ const writeErrorResponse = (id2, code2, message, data) => wire.send({
52196
52747
  jsonrpc: "2.0",
52197
- id,
52748
+ id: id2,
52198
52749
  error: {
52199
52750
  code: code2,
52200
52751
  message,
@@ -52524,7 +53075,7 @@ var init_stdio = __esm({
52524
53075
  }
52525
53076
  send(message) {
52526
53077
  if (this._closed) return Promise.reject(/* @__PURE__ */ new Error("StdioServerTransport is closed"));
52527
- return new Promise((resolve11, reject) => {
53078
+ return new Promise((resolve12, reject) => {
52528
53079
  const json2 = serializeMessage(message);
52529
53080
  let settled = false;
52530
53081
  const onError = (error62) => {
@@ -52539,14 +53090,14 @@ var init_stdio = __esm({
52539
53090
  settled = true;
52540
53091
  this._stdout.off("error", onError);
52541
53092
  this._stdout.off("drain", onDrain);
52542
- resolve11();
53093
+ resolve12();
52543
53094
  };
52544
53095
  this._stdout.once("error", onError);
52545
53096
  if (this._stdout.write(json2)) {
52546
53097
  if (settled) return;
52547
53098
  settled = true;
52548
53099
  this._stdout.off("error", onError);
52549
- resolve11();
53100
+ resolve12();
52550
53101
  } else if (!settled) this._stdout.once("drain", onDrain);
52551
53102
  });
52552
53103
  }
@@ -52569,8 +53120,8 @@ var init_stdio = __esm({
52569
53120
  }
52570
53121
  async send(message, options) {
52571
53122
  if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
52572
- const { id } = message;
52573
- if (id !== void 0) this._settle(id);
53123
+ const { id: id2 } = message;
53124
+ if (id2 !== void 0) this._settle(id2);
52574
53125
  }
52575
53126
  if (this._closed) return;
52576
53127
  if (this._outboundIntercept?.(message) === "handled") return;
@@ -52600,14 +53151,14 @@ var init_stdio = __esm({
52600
53151
  */
52601
53152
  async whenRequestsAnswered(timeoutMs) {
52602
53153
  if (this._closed || this._pendingRequests.size === 0) return true;
52603
- return await new Promise((resolve11) => {
53154
+ return await new Promise((resolve12) => {
52604
53155
  const waiter = () => {
52605
53156
  clearTimeout(timer);
52606
- resolve11(true);
53157
+ resolve12(true);
52607
53158
  };
52608
53159
  const timer = setTimeout(() => {
52609
53160
  this._drainWaiters = this._drainWaiters.filter((pending) => pending !== waiter);
52610
- resolve11(false);
53161
+ resolve12(false);
52611
53162
  }, timeoutMs);
52612
53163
  this._drainWaiters.push(waiter);
52613
53164
  });
@@ -52623,8 +53174,8 @@ var init_stdio = __esm({
52623
53174
  this.onclose?.();
52624
53175
  }
52625
53176
  }
52626
- _settle(id) {
52627
- this._pendingRequests.delete(id);
53177
+ _settle(id2) {
53178
+ this._pendingRequests.delete(id2);
52628
53179
  if (this._pendingRequests.size === 0) this._releaseDrainWaiters();
52629
53180
  }
52630
53181
  _releaseDrainWaiters() {
@@ -52786,18 +53337,18 @@ var init_git = __esm({
52786
53337
  });
52787
53338
 
52788
53339
  // ../code-shim/src/config.ts
52789
- import { readFileSync as readFileSync10 } from "node:fs";
53340
+ import { readFileSync as readFileSync11 } from "node:fs";
52790
53341
  import { homedir as homedir2 } from "node:os";
52791
53342
  import { join as join31 } from "node:path";
52792
53343
  function configDir(env) {
52793
- const base3 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join31(homedir2(), ".config");
52794
- return join31(base3, "mvrx-harness");
53344
+ const base4 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join31(homedir2(), ".config");
53345
+ return join31(base4, "mvrx-harness");
52795
53346
  }
52796
53347
  function findToken2(env, serviceUrl, now) {
52797
53348
  const fromEnv = env["HARNESS_TOKEN"];
52798
53349
  if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
52799
53350
  try {
52800
- const file2 = JSON.parse(readFileSync10(join31(configDir(env), "credentials.json"), "utf8"));
53351
+ const file2 = JSON.parse(readFileSync11(join31(configDir(env), "credentials.json"), "utf8"));
52801
53352
  const stored = file2[serviceUrl];
52802
53353
  if (stored === void 0 || typeof stored.accessToken !== "string" || stored.accessToken.length === 0) return null;
52803
53354
  if (typeof stored.expiresAt === "number" && stored.expiresAt <= now) return null;
@@ -52809,7 +53360,7 @@ function findToken2(env, serviceUrl, now) {
52809
53360
  function resolveCloudConfig(root, env, now) {
52810
53361
  let binding;
52811
53362
  try {
52812
- const parsed = ProjectBinding.safeParse(JSON.parse(readFileSync10(join31(root, ".harness", "project.json"), "utf8")));
53363
+ const parsed = ProjectBinding.safeParse(JSON.parse(readFileSync11(join31(root, ".harness", "project.json"), "utf8")));
52813
53364
  if (!parsed.success) return null;
52814
53365
  binding = parsed.data;
52815
53366
  } catch {
@@ -52831,10 +53382,10 @@ var init_config = __esm({
52831
53382
  });
52832
53383
 
52833
53384
  // ../code-shim/src/local.ts
52834
- import { readFileSync as readFileSync11, statSync as statSync2 } from "node:fs";
52835
- import { isAbsolute as isAbsolute2, relative as relative3, resolve as resolve10, sep as sep2 } from "node:path";
53385
+ import { readFileSync as readFileSync12, statSync as statSync2 } from "node:fs";
53386
+ import { isAbsolute as isAbsolute2, relative as relative3, resolve as resolve11, sep as sep2 } from "node:path";
52836
53387
  function resolveInside(root, path) {
52837
- const absolute = resolve10(root, path);
53388
+ const absolute = resolve11(root, path);
52838
53389
  const rel = relative3(root, absolute);
52839
53390
  if (rel.length === 0 || rel.startsWith("..") || isAbsolute2(rel)) return null;
52840
53391
  return absolute;
@@ -52951,7 +53502,7 @@ var init_local = __esm({
52951
53502
  let shard;
52952
53503
  try {
52953
53504
  this.parses += 1;
52954
- shard = await this.parse(path, readFileSync11(absolute, "utf8"));
53505
+ shard = await this.parse(path, readFileSync12(absolute, "utf8"));
52955
53506
  } catch {
52956
53507
  shard = null;
52957
53508
  }
@@ -52963,7 +53514,7 @@ var init_local = __esm({
52963
53514
  const absolute = resolveInside(this.root, path);
52964
53515
  if (absolute === null) return null;
52965
53516
  try {
52966
- return readFileSync11(absolute, "utf8");
53517
+ return readFileSync12(absolute, "utf8");
52967
53518
  } catch {
52968
53519
  return null;
52969
53520
  }
@@ -52973,7 +53524,7 @@ var init_local = __esm({
52973
53524
  const absolute = resolveInside(this.root, path);
52974
53525
  if (absolute === null) return void 0;
52975
53526
  try {
52976
- const lines = readFileSync11(absolute, "utf8").split("\n");
53527
+ const lines = readFileSync12(absolute, "utf8").split("\n");
52977
53528
  const start2 = range[0];
52978
53529
  if (start2 >= lines.length) return void 0;
52979
53530
  const end = Math.min(Math.max(range[2], start2), start2 + maxLines - 1, lines.length - 1);
@@ -53094,8 +53645,8 @@ async function symbolsOverview(deps, args2) {
53094
53645
  const dirty2 = await parseDirty(deps.index, state, (p) => isUnder(p, scope));
53095
53646
  const cloud = await deps.cloud.query("symbols_overview", state.head, args2, SymbolAnswer);
53096
53647
  const local2 = localSymbolHits(dirty2.shards, (shard, i2) => shard.symbols[i2]?.parent === void 0);
53097
- const base3 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state).filter((hit) => isUnder(hit.path, scope)) : [];
53098
- const merged = uniqueBy([...base3, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
53648
+ const base4 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state).filter((hit) => isUnder(hit.path, scope)) : [];
53649
+ const merged = uniqueBy([...base4, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
53099
53650
  const limited = limitByTokens(merged, args2.max_tokens ?? 4e3);
53100
53651
  return {
53101
53652
  provenance: mergeProvenance(state.head, cloud.kind === "ok" ? cloud.data.provenance : null, state, { overlaid: [...dirty2.shards.keys()], unparsed: dirty2.unparsed }),
@@ -53112,8 +53663,8 @@ async function findSymbol(deps, args2) {
53112
53663
  const symbol2 = shard.symbols[i2];
53113
53664
  return symbol2 !== void 0 && matchesNamePath(shard, symbol2, wanted);
53114
53665
  });
53115
- const base3 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state) : [];
53116
- const merged = uniqueBy([...base3, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
53666
+ const base4 = cloud.kind === "ok" ? cloudSymbols(cloud.data.symbols, state) : [];
53667
+ const merged = uniqueBy([...base4, ...local2], (h) => `${h.path}\0${h.symbol}\0${h.range.join(",")}`);
53117
53668
  return {
53118
53669
  provenance: mergeProvenance(state.head, cloud.kind === "ok" ? cloud.data.provenance : null, state, { overlaid: [...dirty2.shards.keys()], unparsed: dirty2.unparsed }),
53119
53670
  symbols: withSnippets(deps.index, merged, args2.include_snippet === true)
@@ -53133,14 +53684,14 @@ async function findReferences(deps, args2) {
53133
53684
  local2.push({ path, symbol: args2.name, range, source: "local" });
53134
53685
  }
53135
53686
  }
53136
- const base3 = [];
53687
+ const base4 = [];
53137
53688
  if (cloud.kind === "ok") {
53138
53689
  for (const hit of cloud.data.references) {
53139
53690
  const path = keepCloudPath(hit.path, state);
53140
- if (path !== null) base3.push({ ...hit, path, source: "cloud" });
53691
+ if (path !== null) base4.push({ ...hit, path, source: "cloud" });
53141
53692
  }
53142
53693
  }
53143
- const merged = uniqueBy([...base3, ...local2], (h) => `${h.path}\0${h.range.join(",")}`);
53694
+ const merged = uniqueBy([...base4, ...local2], (h) => `${h.path}\0${h.range.join(",")}`);
53144
53695
  return {
53145
53696
  provenance: mergeProvenance(state.head, cloud.kind === "ok" ? cloud.data.provenance : null, state, { overlaid: [...dirty2.shards.keys()], unparsed: dirty2.unparsed }),
53146
53697
  references: withSnippets(deps.index, merged, args2.include_snippet === true)
@@ -53200,7 +53751,7 @@ var init_nav = __esm({
53200
53751
 
53201
53752
  // ../code-shim/src/edit.ts
53202
53753
  import { createHash as createHash8 } from "node:crypto";
53203
- import { readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "node:fs";
53754
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "node:fs";
53204
53755
  function lineStarts(text) {
53205
53756
  const starts = [0];
53206
53757
  for (let i2 = 0; i2 < text.length; i2 += 1) if (text[i2] === "\n") starts.push(i2 + 1);
@@ -53241,7 +53792,7 @@ async function editSymbol(index, args2) {
53241
53792
  if (!found.ok) return found;
53242
53793
  const absolute = resolveInside(index.root, args2.path);
53243
53794
  if (absolute === null) return { ok: false, reason: `path ${args2.path} is outside the repository` };
53244
- const original = readFileSync12(absolute, "utf8");
53795
+ const original = readFileSync13(absolute, "utf8");
53245
53796
  const starts = lineStarts(original);
53246
53797
  const range = found.symbol.enclosingRange ?? found.symbol.range;
53247
53798
  const from = offsetOf(starts, original, range[0], range[1]);
@@ -53308,7 +53859,7 @@ async function renameSymbol(deps, args2) {
53308
53859
  if (absolute === null) return { ok: false, reason: `reference path ${path} is outside the repository` };
53309
53860
  let text;
53310
53861
  try {
53311
- text = readFileSync12(absolute, "utf8");
53862
+ text = readFileSync13(absolute, "utf8");
53312
53863
  } catch {
53313
53864
  return { ok: false, reason: `cannot read ${path}` };
53314
53865
  }
@@ -53451,6 +54002,30 @@ var init_server = __esm({
53451
54002
  }
53452
54003
  });
53453
54004
 
54005
+ // ../code-shim/src/defaults.ts
54006
+ function shimSetting(env) {
54007
+ const remote = env["CLAUDE_CODE_REMOTE"] === "true" || env["CODEX_CLOUD"] === "1" || env["HARNESS_SETTING"] === "cloud-session";
54008
+ return remote ? "cloud-session" : "local-agent-with-grep";
54009
+ }
54010
+ function codeMapSwitch(env, results) {
54011
+ const setting = shimSetting(env);
54012
+ const base4 = results === void 0 ? codeMapDefault(setting) : codeMapDefault(setting, results);
54013
+ const forced = env["HARNESS_CODE_MAP"];
54014
+ if (forced === "on" || forced === "off") {
54015
+ 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" };
54016
+ }
54017
+ return { ...base4, source: "default" };
54018
+ }
54019
+ function describeSwitch(state) {
54020
+ return `code-shim: code map ${state.on ? "on" : "off"} for ${state.setting} (${state.source}). ${state.reason}`;
54021
+ }
54022
+ var init_defaults = __esm({
54023
+ "../code-shim/src/defaults.ts"() {
54024
+ "use strict";
54025
+ init_src();
54026
+ }
54027
+ });
54028
+
53454
54029
  // ../code-shim/src/index.ts
53455
54030
  var src_exports = {};
53456
54031
  __export(src_exports, {
@@ -53459,8 +54034,10 @@ __export(src_exports, {
53459
54034
  callHierarchy: () => callHierarchy,
53460
54035
  changeImpact: () => changeImpact,
53461
54036
  cloudArgs: () => cloudArgs,
54037
+ codeMapSwitch: () => codeMapSwitch,
53462
54038
  createDeps: () => createDeps,
53463
54039
  createServer: () => createServer2,
54040
+ describeSwitch: () => describeSwitch,
53464
54041
  editSymbol: () => editSymbol,
53465
54042
  findReferences: () => findReferences,
53466
54043
  findSymbol: () => findSymbol,
@@ -53471,6 +54048,7 @@ __export(src_exports, {
53471
54048
  readWorkingCopyState: () => readWorkingCopyState,
53472
54049
  renameSymbol: () => renameSymbol,
53473
54050
  resolveCloudConfig: () => resolveCloudConfig,
54051
+ shimSetting: () => shimSetting,
53474
54052
  symbolsOverview: () => symbolsOverview
53475
54053
  });
53476
54054
  var init_src3 = __esm({
@@ -53484,6 +54062,7 @@ var init_src3 = __esm({
53484
54062
  init_merge2();
53485
54063
  init_nav();
53486
54064
  init_server();
54065
+ init_defaults();
53487
54066
  }
53488
54067
  });
53489
54068
 
@@ -53741,8 +54320,8 @@ var AuthRequiredError = class extends MvrxError {
53741
54320
  super(message, { code: "auth_required", exit: EXIT.auth }, { hint: "overlane auth status", ...options });
53742
54321
  }
53743
54322
  };
53744
- function unreachable(base3, cause) {
53745
- return new CliError(`cannot reach ${base3}: ${cause instanceof Error ? cause.message : String(cause)}`, {
54323
+ function unreachable(base4, cause) {
54324
+ return new CliError(`cannot reach ${base4}: ${cause instanceof Error ? cause.message : String(cause)}`, {
53746
54325
  code: "unreachable",
53747
54326
  exit: EXIT.unreachable,
53748
54327
  retryable: true,
@@ -53773,6 +54352,19 @@ var SERVICE_CODES = {
53773
54352
  promotion_blocked: { exit: EXIT.blocked, hint: "overlane release list" },
53774
54353
  no_previous_release: { exit: EXIT.conflict, hint: "overlane release status" },
53775
54354
  managed_file_edited: { exit: EXIT.conflict, hint: "overlane release status" },
54355
+ // guardrails and review (MS-A5): a refusal by policy exits 6 with the rule and the next command (REQ-GRD-12)
54356
+ policy_denied: { exit: EXIT.blocked, hint: "overlane guard rules list" },
54357
+ protected_branch: { exit: EXIT.blocked, hint: "overlane guard approvals list" },
54358
+ path_protected: { exit: EXIT.blocked, hint: "overlane guard approvals list" },
54359
+ spend_cap_reached: { exit: EXIT.blocked, hint: "overlane guard rules list" },
54360
+ plan_limit_reached: { exit: EXIT.blocked, hint: "overlane guard rules list" },
54361
+ egress_blocked: { exit: EXIT.blocked, hint: "overlane guard rules list" },
54362
+ deploy_blocked: { exit: EXIT.blocked, hint: "overlane guard rules list" },
54363
+ secret_detected: { exit: EXIT.blocked, hint: "overlane guard scan --path <file>" },
54364
+ task_required: { exit: EXIT.blocked, hint: 'overlane task new "<title>"' },
54365
+ invalid_rules: { exit: EXIT.usage, hint: "overlane guard rules test --file <rules.json> --tool <tool>" },
54366
+ finding_not_open: { exit: EXIT.conflict, hint: "overlane review findings --status open" },
54367
+ live_leg_pending: { exit: EXIT.failure, hint: "overlane review status" },
53776
54368
  // generic
53777
54369
  unauthorized: { exit: EXIT.auth, hint: "overlane auth login" },
53778
54370
  // identity (MS-A1): a revoked or expired token needs a new sign-in; a role that may not do this is blocked by policy
@@ -54261,19 +54853,19 @@ function pkcePair() {
54261
54853
  return { verifier, challenge: base64url3(createHash("sha256").update(verifier).digest()) };
54262
54854
  }
54263
54855
  function listen(server, port) {
54264
- return new Promise((resolve11, reject) => {
54856
+ return new Promise((resolve12, reject) => {
54265
54857
  const onError = (error62) => reject(error62);
54266
54858
  server.once("error", onError);
54267
54859
  server.listen(port, "127.0.0.1", () => {
54268
54860
  server.off("error", onError);
54269
- resolve11();
54861
+ resolve12();
54270
54862
  });
54271
54863
  });
54272
54864
  }
54273
54865
  async function startLoopback(preferredPort, state) {
54274
54866
  let settle2;
54275
- const code2 = new Promise((resolve11, reject) => {
54276
- settle2 = { resolve: resolve11, reject };
54867
+ const code2 = new Promise((resolve12, reject) => {
54868
+ settle2 = { resolve: resolve12, reject };
54277
54869
  });
54278
54870
  code2.catch(() => void 0);
54279
54871
  const server = createServer((request, response) => {
@@ -54620,10 +55212,10 @@ async function failure2(response) {
54620
55212
  }
54621
55213
  return { code: void 0, text: `status ${response.status}` };
54622
55214
  }
54623
- async function call(deps, base3, token, schema, method, path, body2) {
55215
+ async function call(deps, base4, token, schema, method, path, body2) {
54624
55216
  let response;
54625
55217
  try {
54626
- response = await deps.fetch(`${base3}${path}`, {
55218
+ response = await deps.fetch(`${base4}${path}`, {
54627
55219
  method,
54628
55220
  headers: {
54629
55221
  accept: "application/json",
@@ -54633,7 +55225,7 @@ async function call(deps, base3, token, schema, method, path, body2) {
54633
55225
  ...body2 === void 0 ? {} : { body: JSON.stringify(body2) }
54634
55226
  });
54635
55227
  } catch (error62) {
54636
- throw unreachable(base3, error62);
55228
+ throw unreachable(base4, error62);
54637
55229
  }
54638
55230
  if (!response.ok) {
54639
55231
  const failed = await failure2(response);
@@ -54650,12 +55242,12 @@ async function call(deps, base3, token, schema, method, path, body2) {
54650
55242
  return parsed.data;
54651
55243
  }
54652
55244
  function releaseClient(deps, binding, token, serviceUrl = binding.serviceUrl) {
54653
- const base3 = serviceUrl.replace(/\/+$/, "");
55245
+ const base4 = serviceUrl.replace(/\/+$/, "");
54654
55246
  return {
54655
- list: () => call(deps, base3, token, external_exports.array(ReleaseRecord), "GET", releasePaths.list(binding.tenantId)),
54656
- get: (digest) => call(deps, base3, token, ReleaseRecord, "GET", releasePaths.one(binding.tenantId, digest)),
54657
- pin: (digest) => call(deps, base3, token, ProjectRecord, "PUT", releasePaths.pin(binding.tenantId, binding.projectId), { digest }),
54658
- rollback: () => call(deps, base3, token, ProjectRecord, "POST", releasePaths.rollback(binding.tenantId, binding.projectId), {})
55247
+ list: () => call(deps, base4, token, external_exports.array(ReleaseRecord), "GET", releasePaths.list(binding.tenantId)),
55248
+ get: (digest) => call(deps, base4, token, ReleaseRecord, "GET", releasePaths.one(binding.tenantId, digest)),
55249
+ pin: (digest) => call(deps, base4, token, ProjectRecord, "PUT", releasePaths.pin(binding.tenantId, binding.projectId), { digest }),
55250
+ rollback: () => call(deps, base4, token, ProjectRecord, "POST", releasePaths.rollback(binding.tenantId, binding.projectId), {})
54659
55251
  };
54660
55252
  }
54661
55253
  async function fetchServicePublicKey(deps, serviceUrl, token) {
@@ -55020,8 +55612,8 @@ function withTimeout(deps, ms) {
55020
55612
  }
55021
55613
  async function attempt(deps, ms, work) {
55022
55614
  let timer;
55023
- const deadline = new Promise((resolve11) => {
55024
- timer = setTimeout(() => resolve11("unreachable"), ms);
55615
+ const deadline = new Promise((resolve12) => {
55616
+ timer = setTimeout(() => resolve12("unreachable"), ms);
55025
55617
  });
55026
55618
  try {
55027
55619
  return await Promise.race([work(withTimeout(deps, ms)).catch((error62) => error62 instanceof ServiceError && error62.exit === EXIT.auth ? "unauthenticated" : "unreachable"), deadline]);
@@ -55259,13 +55851,13 @@ function render(op, existing) {
55259
55851
  case "block":
55260
55852
  return withBlock(existing, op.content);
55261
55853
  case "json": {
55262
- let base3 = op.base ?? {};
55854
+ let base4 = op.base ?? {};
55263
55855
  if (existing !== null && existing.trim() !== "") {
55264
55856
  const parsed = JSON.parse(existing);
55265
55857
  if (!isRecord(parsed)) throw new Error(`${op.path} is not a JSON object; fix it by hand, then run the command again`);
55266
- base3 = parsed;
55858
+ base4 = parsed;
55267
55859
  }
55268
- return `${JSON.stringify(setAt(base3, op.key, op.value), null, 2)}
55860
+ return `${JSON.stringify(setAt(base4, op.key, op.value), null, 2)}
55269
55861
  `;
55270
55862
  }
55271
55863
  }
@@ -55665,9 +56257,9 @@ function updateSteps(agent) {
55665
56257
  ];
55666
56258
  }
55667
56259
  function kindOfEachFile(diff) {
55668
- const counts = /* @__PURE__ */ new Map();
55669
- for (const file2 of [...diff.added, ...diff.changed, ...diff.removed]) counts.set(file2.kind, (counts.get(file2.kind) ?? 0) + 1);
55670
- return counts.size === 0 ? "no file changes" : [...counts].map(([kind, count]) => `${count} ${kind}`).join(", ");
56260
+ const counts2 = /* @__PURE__ */ new Map();
56261
+ for (const file2 of [...diff.added, ...diff.changed, ...diff.removed]) counts2.set(file2.kind, (counts2.get(file2.kind) ?? 0) + 1);
56262
+ return counts2.size === 0 ? "no file changes" : [...counts2].map(([kind, count]) => `${count} ${kind}`).join(", ");
55671
56263
  }
55672
56264
  function showDiff(deps, diff) {
55673
56265
  say(deps, ` files: ${diff.added.length} added, ${diff.changed.length} changed, ${diff.removed.length} removed (${kindOfEachFile(diff)})`);
@@ -55804,17 +56396,20 @@ async function failure3(response) {
55804
56396
  const text = await response.text();
55805
56397
  try {
55806
56398
  const parsed = ApiError.safeParse(JSON.parse(text));
55807
- if (parsed.success) return { text: `${parsed.data.error.code}: ${parsed.data.error.message}`, code: parsed.data.error.code };
56399
+ if (parsed.success) {
56400
+ const { code: code2, message, ruleId, hint } = parsed.data.error;
56401
+ return { text: `${code2}: ${message}${ruleId === void 0 ? "" : ` [rule ${ruleId}]`}`, code: code2, hint };
56402
+ }
55808
56403
  } catch {
55809
56404
  }
55810
- return { text: `status ${response.status}`, code: void 0 };
56405
+ return { text: `status ${response.status}`, code: void 0, hint: void 0 };
55811
56406
  }
55812
56407
  function serviceCall(deps, serviceUrl, token) {
55813
- const base3 = serviceUrl.replace(/\/+$/, "");
56408
+ const base4 = serviceUrl.replace(/\/+$/, "");
55814
56409
  return async (schema, method, path, body2, extraHeaders) => {
55815
56410
  let response;
55816
56411
  try {
55817
- response = await deps.fetch(`${base3}${path}`, {
56412
+ response = await deps.fetch(`${base4}${path}`, {
55818
56413
  method,
55819
56414
  headers: {
55820
56415
  accept: "application/json",
@@ -55825,11 +56420,11 @@ function serviceCall(deps, serviceUrl, token) {
55825
56420
  ...body2 === void 0 ? {} : { body: JSON.stringify(body2) }
55826
56421
  });
55827
56422
  } catch (error62) {
55828
- throw unreachable(base3, error62);
56423
+ throw unreachable(base4, error62);
55829
56424
  }
55830
56425
  if (!response.ok) {
55831
56426
  const failed = await failure3(response);
55832
- throw new ServiceError(`${method} ${path} failed (${failed.text})`, failed.code, response.status);
56427
+ throw new ServiceError(`${method} ${path} failed (${failed.text})`, failed.code, response.status, failed.hint);
55833
56428
  }
55834
56429
  let json2;
55835
56430
  try {
@@ -56010,7 +56605,7 @@ function slugify2(value) {
56010
56605
  var PLAN_DIR = ".harness/plan";
56011
56606
  var planPaths = (repoDir) => {
56012
56607
  const root = join15(repoDir, PLAN_DIR);
56013
- return { root, project: join15(root, "project.md"), milestones: join15(root, "milestones.md"), tasks: join15(root, "tasks"), task: (id) => join15(root, "tasks", `${id}.md`) };
56608
+ return { root, project: join15(root, "project.md"), milestones: join15(root, "milestones.md"), tasks: join15(root, "tasks"), task: (id2) => join15(root, "tasks", `${id2}.md`) };
56014
56609
  };
56015
56610
  function parsePlan(input2, where) {
56016
56611
  const result = Plan.safeParse(input2);
@@ -56111,7 +56706,7 @@ function parseMilestones(text, where) {
56111
56706
  }
56112
56707
  if (line2.trim() === "") continue;
56113
56708
  const depends = /^Depends on: (.+)$/.exec(line2);
56114
- if (depends && !inAcceptance) current2.dependsOn = (depends[1] ?? "").split(",").map((id) => id.trim());
56709
+ if (depends && !inAcceptance) current2.dependsOn = (depends[1] ?? "").split(",").map((id2) => id2.trim());
56115
56710
  else if (inAcceptance && line2.startsWith("- ")) current2.acceptance.push(line2.slice(2));
56116
56711
  else throw new KitError(`${where}: unexpected line under ${current2.id}: "${line2}"`);
56117
56712
  }
@@ -56313,9 +56908,9 @@ async function draftPlanForExisting(repoDir, opts = {}) {
56313
56908
  const allowedPaths = opts.allowedPaths ?? ["."];
56314
56909
  const tasks = [];
56315
56910
  const starter = (title, outcome, verification, dependsOn) => {
56316
- const id = `T${String(tasks.length + 1).padStart(3, "0")}`;
56317
- tasks.push({ id, title, milestone, outcome, allowedPaths, acceptance: verification.map((command) => `\`${command}\` exits 0`), verification, evidenceLevel: "L2", dependsOn, requiresConnections: [] });
56318
- return id;
56911
+ const id2 = `T${String(tasks.length + 1).padStart(3, "0")}`;
56912
+ tasks.push({ id: id2, title, milestone, outcome, allowedPaths, acceptance: verification.map((command) => `\`${command}\` exits 0`), verification, evidenceLevel: "L2", dependsOn, requiresConnections: [] });
56913
+ return id2;
56319
56914
  };
56320
56915
  const installId = detected.install ? starter("Install dependencies", "Dependencies install cleanly from the lockfile.", [detected.install], []) : void 0;
56321
56916
  const after = installId ? [installId] : [];
@@ -56509,9 +57104,9 @@ async function importSpecKit(repoDir) {
56509
57104
  const name2 = (parsedConstitution?.name ?? basename2(root)).slice(0, 100);
56510
57105
  const goal = (parsedConstitution?.goal ?? firstInput ?? `Deliver ${name2}.`).slice(0, 2e3);
56511
57106
  const multi = features.length > 1;
56512
- const counts = /* @__PURE__ */ new Map();
56513
- for (const feature of features) for (const phase of feature.phases) for (const task of phase.tasks) counts.set(task.id, (counts.get(task.id) ?? 0) + 1);
56514
- const prefixTasks = [...counts.values()].some((count) => count > 1);
57107
+ const counts2 = /* @__PURE__ */ new Map();
57108
+ for (const feature of features) for (const phase of feature.phases) for (const task of phase.tasks) counts2.set(task.id, (counts2.get(task.id) ?? 0) + 1);
57109
+ const prefixTasks = [...counts2.values()].some((count) => count > 1);
56515
57110
  const detected = await detectCommands(root);
56516
57111
  const milestones = [];
56517
57112
  const tasks = [];
@@ -56529,17 +57124,17 @@ async function importSpecKit(repoDir) {
56529
57124
  let storyRun = [];
56530
57125
  feature.phases.forEach((phase, index) => {
56531
57126
  const defaultId = `${multi ? `F${feature.key}-` : ""}P${phase.number ?? index + 1}`;
56532
- const id = phase.id ?? defaultId;
57127
+ const id2 = phase.id ?? defaultId;
56533
57128
  const story = isStoryTitle(phase.title);
56534
57129
  const derivedDeps = story !== void 0 ? lastNonStory ? [lastNonStory] : [] : storyRun.length > 0 ? [...storyRun] : lastNonStory ? [lastNonStory] : [];
56535
- if (story !== void 0) storyRun.push(id);
57130
+ if (story !== void 0) storyRun.push(id2);
56536
57131
  else {
56537
- lastNonStory = id;
57132
+ lastNonStory = id2;
56538
57133
  storyRun = [];
56539
57134
  }
56540
- const stored = feature.block.milestones[id];
57135
+ const stored = feature.block.milestones[id2];
56541
57136
  const derivedAcceptance = story !== void 0 ? feature.stories.get(story) ?? [] : phase.checkpoint ? [phase.checkpoint] : [];
56542
- milestones.push({ id, title: phase.title || `Phase ${phase.number ?? index + 1}`, acceptance: stored?.acceptance ?? derivedAcceptance, dependsOn: stored?.dependsOn ?? derivedDeps });
57137
+ milestones.push({ id: id2, title: phase.title || `Phase ${phase.number ?? index + 1}`, acceptance: stored?.acceptance ?? derivedAcceptance, dependsOn: stored?.dependsOn ?? derivedDeps });
56543
57138
  let previousGroup = [];
56544
57139
  let group = [];
56545
57140
  let groupParallel = false;
@@ -56560,7 +57155,7 @@ async function importSpecKit(repoDir) {
56560
57155
  tasks.push({
56561
57156
  id: taskId,
56562
57157
  title: parsed.title,
56563
- milestone: id,
57158
+ milestone: id2,
56564
57159
  outcome: storedTask?.outcome ?? parsed.title,
56565
57160
  allowedPaths: storedTask?.allowedPaths ?? (paths.length > 0 ? paths : ["."]),
56566
57161
  acceptance: storedTask?.acceptance ?? (storyAcceptance && storyAcceptance.length > 0 ? storyAcceptance : [`Completed: ${parsed.title}`]),
@@ -57883,12 +58478,12 @@ init_zod();
57883
58478
  init_src();
57884
58479
  init_zod();
57885
58480
  var ErrorBody = external_exports.object({ error: external_exports.object({ code: external_exports.string(), message: external_exports.string() }).passthrough() }).passthrough();
57886
- async function post(deps, base3, path, body2) {
58481
+ async function post(deps, base4, path, body2) {
57887
58482
  let response;
57888
58483
  try {
57889
- response = await deps.fetch(`${base3}${path}`, { method: "POST", headers: { "content-type": "application/json", accept: "application/json" }, body: JSON.stringify(body2) });
58484
+ response = await deps.fetch(`${base4}${path}`, { method: "POST", headers: { "content-type": "application/json", accept: "application/json" }, body: JSON.stringify(body2) });
57890
58485
  } catch (error62) {
57891
- throw unreachable(base3, error62);
58486
+ throw unreachable(base4, error62);
57892
58487
  }
57893
58488
  let json2 = null;
57894
58489
  try {
@@ -57899,7 +58494,7 @@ async function post(deps, base3, path, body2) {
57899
58494
  return { status: response.status, json: json2 };
57900
58495
  }
57901
58496
  function sleep(ms) {
57902
- return new Promise((resolve11) => setTimeout(resolve11, ms));
58497
+ return new Promise((resolve12) => setTimeout(resolve12, ms));
57903
58498
  }
57904
58499
  async function deviceLogin(deps, service, options) {
57905
58500
  const started = await post(deps, service, "/auth/device", {});
@@ -58239,28 +58834,302 @@ var tokenRevokeCommand = defineCommand({
58239
58834
  keywords: ["revoke", "delete token", "disable token", "kill credentials", "remove access", "leaked token"],
58240
58835
  result: TokenRevokeResult,
58241
58836
  handler: async (inv) => {
58242
- const id = inv.positionals[0];
58243
- if (id === void 0) throw new UsageError("a token ID is required", { hint: "overlane token list" });
58837
+ const id2 = inv.positionals[0];
58838
+ if (id2 === void 0) throw new UsageError("a token ID is required", { hint: "overlane token list" });
58244
58839
  if (inv.dryRun) {
58245
58840
  const target = await resolveTarget(inv.deps, textFlag(inv, "service"));
58246
- return planOutcome(inv.deps, dryRunPlan({ service: target.service, requests: [{ method: "DELETE", path: `/v1/tenants/${textFlag(inv, "team") ?? ":your-team"}/tokens/${id}` }] }));
58841
+ return planOutcome(inv.deps, dryRunPlan({ service: target.service, requests: [{ method: "DELETE", path: `/v1/tenants/${textFlag(inv, "team") ?? ":your-team"}/tokens/${id2}` }] }));
58247
58842
  }
58248
58843
  const { call: call2 } = await authed(inv);
58249
58844
  const tenantId = await tenantOf(call2, inv);
58250
- await call2(external_exports.object({ ok: external_exports.literal(true) }).passthrough(), "DELETE", `/v1/tenants/${encodeURIComponent(tenantId)}/tokens/${encodeURIComponent(id)}`);
58251
- say(inv.deps, `Revoked ${id}.`);
58252
- return { data: { tenantId, tokenId: id, revoked: true } };
58845
+ await call2(external_exports.object({ ok: external_exports.literal(true) }).passthrough(), "DELETE", `/v1/tenants/${encodeURIComponent(tenantId)}/tokens/${encodeURIComponent(id2)}`);
58846
+ say(inv.deps, `Revoked ${id2}.`);
58847
+ return { data: { tenantId, tokenId: id2, revoked: true } };
58253
58848
  }
58254
58849
  });
58255
58850
  var identityCommands = [authLoginCommand, authLogoutCommand, authTokenCommand, teamListCommand, teamInviteCommand, tokenCreateCommand, tokenListCommand, tokenRevokeCommand];
58256
58851
 
58257
- // ../cli/src/commands/memory.ts
58852
+ // ../cli/src/commands/guard.ts
58258
58853
  init_src();
58259
58854
  init_zod();
58260
58855
  import { randomUUID as randomUUID3 } from "node:crypto";
58856
+ import { readFileSync as readFileSync7 } from "node:fs";
58857
+ import { resolve as resolve7 } from "node:path";
58858
+ var common = { needsAuth: true, needsNetwork: true };
58859
+ var requestId3 = () => `cli-${randomUUID3()}`;
58860
+ async function connected(inv) {
58861
+ const project = await connectedProject(inv.deps, "guard");
58862
+ return { project, call: serviceCall(inv.deps, project.serviceUrl, project.token), tenantId: project.binding.tenantId, projectId: project.binding.projectId };
58863
+ }
58864
+ async function planned(inv, method, path, body2, note) {
58865
+ const project = await offlineProject(inv.deps, "guard");
58866
+ return planOutcome(inv.deps, dryRunPlan({ service: project.serviceUrl, requests: [{ method, path: path(project.binding.tenantId), ...body2 === void 0 ? {} : { body: body2 }, ...note === void 0 ? {} : { note } }] }));
58867
+ }
58868
+ function readText3(inv, path) {
58869
+ try {
58870
+ return readFileSync7(resolve7(inv.deps.paths.cwd, path), "utf8");
58871
+ } catch {
58872
+ throw new UsageError(`could not read ${path}`, { hint: "overlane guard rules test --file rules.json --tool git.push" });
58873
+ }
58874
+ }
58875
+ var ACTION_FLAGS = [
58876
+ { name: "tool", type: "string", required: true, value: "TOOL", description: "The action, for example git.push, deploy.run, egress.fetch or api.write" },
58877
+ { name: "path", type: "string", multiple: true, value: "PATH", description: "A path the action touches; repeat for more" },
58878
+ { name: "branch", type: "string", value: "BRANCH", description: "The branch the action targets" },
58879
+ { name: "repo", type: "string", value: "OWNER/NAME", description: "The repository the action targets" },
58880
+ { name: "environment", type: "string", value: "NAME", description: "The environment, for example production" },
58881
+ { name: "host", type: "string", value: "HOST", description: "The host, for an egress action" }
58882
+ ];
58883
+ function actionOf(inv) {
58884
+ const tool = textFlag(inv, "tool");
58885
+ if (tool === void 0) throw new UsageError("this command needs --tool", { hint: "overlane guard dry-run --tool git.push --branch main" });
58886
+ const branch = textFlag(inv, "branch");
58887
+ const repo = textFlag(inv, "repo");
58888
+ const environment = textFlag(inv, "environment");
58889
+ const host = textFlag(inv, "host");
58890
+ const paths = listFlag(inv, "path");
58891
+ return { tool, ...paths.length === 0 ? {} : { paths }, ...branch === void 0 ? {} : { branch }, ...repo === void 0 ? {} : { repository: repo }, ...environment === void 0 ? {} : { environment }, ...host === void 0 ? {} : { host } };
58892
+ }
58893
+ function describeDecision(decision) {
58894
+ const lines = [`${decision.allowed ? decision.wouldBlock ? "ALLOWED (dry-run: would block)" : "ALLOWED" : decision.effect === "require_approval" ? "APPROVAL REQUIRED" : "DENIED"} ${decision.message}`];
58895
+ if (decision.ruleId !== null) lines.push(`rule: ${decision.ruleId}${decision.layer === null ? "" : ` (${decision.layer})`}${decision.code === null ? "" : `, code: ${decision.code}`}`);
58896
+ if (decision.nextCommand !== null) lines.push(`next: ${decision.nextCommand}`);
58897
+ return lines;
58898
+ }
58899
+ function refusalOutcome(data, decision) {
58900
+ const error62 = new CliError(`${decision.message}${decision.ruleId === null ? "" : ` [rule ${decision.ruleId}]`}`, {
58901
+ code: decision.code ?? "policy_denied",
58902
+ exit: EXIT.blocked,
58903
+ ...decision.nextCommand === null ? {} : { hint: decision.nextCommand }
58904
+ });
58905
+ return { data, exit: EXIT.blocked, error: error62 };
58906
+ }
58907
+ var guardRulesListCommand = defineCommand({
58908
+ path: ["guard", "rules", "list"],
58909
+ summary: "List the guardrail rules in force and the versions of the rule files",
58910
+ description: "Lists the platform rules (always in force), then the team and project rule files and their rules. A rule change is an audit event; every file version is listed with its digest and author.",
58911
+ examples: ["overlane guard rules list", "overlane guard rules list --json"],
58912
+ effect: "read",
58913
+ ...common,
58914
+ keywords: ["guardrails", "policy as code", "rules in force", "protected branches", "what is blocked", "rule files"],
58915
+ result: GuardRulesResponse,
58916
+ text: (d) => [...d.rules.map((rule) => `${rule.layer.padEnd(8)} ${rule.effect.padEnd(16)} ${rule.id}${rule.dryRun ? " [dry-run]" : ""} ${rule.description}`), ...d.files.map((file2) => `file ${file2.layer} v${file2.version} ${file2.digest.slice(0, 19)} by ${file2.author}`)],
58917
+ handler: async (inv) => {
58918
+ const { call: call2, tenantId, projectId } = await connected(inv);
58919
+ return { data: await call2(GuardRulesResponse, "GET", `${guardPaths.rules(tenantId)}?projectId=${encodeURIComponent(projectId)}`) };
58920
+ }
58921
+ });
58922
+ var RuleTestResult = external_exports.object({ decision: GuardDecision, rules: external_exports.number().int().nonnegative(), note: external_exports.string() }).strict();
58923
+ var guardRulesTestCommand = defineCommand({
58924
+ path: ["guard", "rules", "test"],
58925
+ summary: "Test a rule file against an action, locally, before it is merged",
58926
+ description: "Loads a rule file (JSON, version 1) and evaluates one action against it as the team layer, with no network. The server also applies the platform rules, which a team file cannot weaken; use `overlane guard dry-run` to see the combined decision. Exits 6 when the file would refuse the action.",
58927
+ flags: [
58928
+ { name: "file", type: "string", required: true, value: "PATH", description: "The rule file to test" },
58929
+ ...ACTION_FLAGS,
58930
+ { name: "role", type: "string", enum: ["owner", "admin", "member", "viewer", "agent"], default: "agent", description: "The role of the principal" },
58931
+ { name: "usage", type: "string", multiple: true, value: "METRIC=N", description: "Measured usage, for example usd=12.5 or reviews=50" }
58932
+ ],
58933
+ examples: ["overlane guard rules test --file rules.json --tool git.push --branch main --role agent", "overlane guard rules test --file rules.json --tool review.run --usage reviews=50"],
58934
+ effect: "read",
58935
+ needsAuth: false,
58936
+ needsNetwork: false,
58937
+ keywords: ["test rules", "check rule file", "validate policy", "rule test", "try a rule"],
58938
+ result: RuleTestResult,
58939
+ text: (d) => [...describeDecision(d.decision), d.note],
58940
+ handler: async (inv) => {
58941
+ const file2 = textFlag(inv, "file");
58942
+ if (file2 === void 0) throw new UsageError("rules test needs --file", { hint: "overlane guard rules test --file rules.json --tool git.push" });
58943
+ let json2;
58944
+ try {
58945
+ json2 = JSON.parse(readText3(inv, file2));
58946
+ } catch (error62) {
58947
+ if (error62 instanceof UsageError) throw error62;
58948
+ throw new UsageError(`${file2} is not valid JSON`);
58949
+ }
58950
+ const parsed = GuardRuleFileSource.safeParse(json2);
58951
+ if (!parsed.success) throw new UsageError(`${file2} is not a valid rule file: ${parsed.error.issues.map((issue2) => `${issue2.path.join(".") || "file"}: ${issue2.message}`).join("; ")}`);
58952
+ const usage = {};
58953
+ for (const entry of listFlag(inv, "usage")) {
58954
+ const [metric, value] = entry.split("=");
58955
+ if (metric === void 0 || value === void 0 || Number.isNaN(Number(value))) throw new UsageError("--usage must be METRIC=NUMBER", { hint: "overlane guard rules test --file rules.json --tool ci.run --usage usd=12.5" });
58956
+ usage[metric] = Number(value);
58957
+ }
58958
+ const role = textFlag(inv, "role") ?? "agent";
58959
+ const action = actionOf(inv);
58960
+ const request = GuardRequest.parse({
58961
+ tenantId: "local",
58962
+ principal: { kind: role === "agent" ? "agent" : "user", id: "local-test", role },
58963
+ tool: action.tool,
58964
+ paths: action.paths ?? [],
58965
+ ...action.branch === void 0 ? {} : { branch: action.branch },
58966
+ ...action.repository === void 0 ? {} : { repository: action.repository },
58967
+ ...action.environment === void 0 ? {} : { environment: action.environment },
58968
+ ...action.host === void 0 ? {} : { host: action.host },
58969
+ at: new Date(inv.deps.now()).toISOString(),
58970
+ usage
58971
+ });
58972
+ const decision = composeDecision("local", [{ layer: "team", rules: parsed.data.rules }], request);
58973
+ const result = { decision, rules: parsed.data.rules.length, note: "Tested as the team layer only. The platform rules also apply on the server." };
58974
+ return decision.allowed ? { data: result } : refusalOutcome(result, decision);
58975
+ }
58976
+ });
58977
+ var guardRulesPutCommand = defineCommand({
58978
+ path: ["guard", "rules", "put"],
58979
+ summary: "Publish a new version of the team or project rule file",
58980
+ description: "Uploads a rule file as the next version. The file is validated whole, scanned for credentials and recorded as an audit event with its digest and author. Keep the file in version control and review it by pull request; this command publishes what was reviewed.",
58981
+ flags: [
58982
+ { name: "file", type: "string", required: true, value: "PATH", description: "The rule file (JSON, version 1)" },
58983
+ { name: "layer", type: "string", enum: ["team", "project"], default: "team", description: "team applies to every project; project applies to this one" },
58984
+ { name: "reason", type: "string", value: "TEXT", description: "Why the rules changed; kept in the audit event" }
58985
+ ],
58986
+ examples: ['overlane guard rules put --file rules.json --reason "freeze deploys on Fridays"', "overlane guard rules put --file rules.json --layer project --dry-run"],
58987
+ effect: "write",
58988
+ ...common,
58989
+ keywords: ["publish rules", "update guardrails", "change policy", "upload rule file", "freeze deploys"],
58990
+ result: withDryRun(GuardRuleFileRecord),
58991
+ text: (d) => "version" in d ? [`Published ${d.layer} rule file v${d.version} (${d.ruleCount} rules, ${d.digest.slice(0, 19)}).`] : [],
58992
+ handler: async (inv) => {
58993
+ const file2 = textFlag(inv, "file");
58994
+ if (file2 === void 0) throw new UsageError("rules put needs --file", { hint: "overlane guard rules put --file rules.json" });
58995
+ const layer = textFlag(inv, "layer") ?? "team";
58996
+ const reason = textFlag(inv, "reason");
58997
+ if (inv.dryRun) {
58998
+ const offline = await offlineProject(inv.deps, "guard");
58999
+ return planOutcome(inv.deps, dryRunPlan({ service: offline.serviceUrl, requests: [{ method: "PUT", path: guardPaths.rules(offline.binding.tenantId), body: { requestId: "<generated>", layer, ...layer === "project" ? { projectId: offline.binding.projectId } : {}, content: `<contents of ${file2}>`, ...reason === void 0 ? {} : { reason } }, note: "the file is validated and scanned for credentials on the server" }] }));
59000
+ }
59001
+ const content = readText3(inv, file2);
59002
+ const { call: call2, tenantId, projectId } = await connected(inv);
59003
+ return { data: await call2(GuardRuleFileRecord, "PUT", guardPaths.rules(tenantId), { requestId: requestId3(), layer, ...layer === "project" ? { projectId } : {}, content, ...reason === void 0 ? {} : { reason } }) };
59004
+ }
59005
+ });
59006
+ async function evaluate(inv, dryRun) {
59007
+ const { call: call2, tenantId, projectId } = await connected(inv);
59008
+ const contentFile = textFlag(inv, "content-file");
59009
+ const body2 = {
59010
+ ...actionOf(inv),
59011
+ ...textFlag(inv, "task") === void 0 ? {} : { taskHeld: textFlag(inv, "task") === "held" },
59012
+ ...textFlag(inv, "summary") === void 0 ? {} : { summary: textFlag(inv, "summary") },
59013
+ ...contentFile === void 0 ? {} : { content: readText3(inv, contentFile) },
59014
+ ...dryRun ? { dryRun: true } : {}
59015
+ };
59016
+ const approval = textFlag(inv, "approval");
59017
+ const reply = await call2(GuardEvaluateResponse, "POST", `${guardPaths.evaluate(tenantId)}?projectId=${encodeURIComponent(projectId)}`, body2, approval === void 0 ? void 0 : { [APPROVAL_HEADER]: approval });
59018
+ return reply;
59019
+ }
59020
+ var DECISION_FLAGS = [
59021
+ ...ACTION_FLAGS,
59022
+ { name: "task", type: "string", enum: ["held", "none"], value: "held|none", description: "Whether the caller holds an active task (the task rule needs it)" },
59023
+ { name: "summary", type: "string", value: "TEXT", description: "A plain-language summary shown to the approver if the action needs approval" },
59024
+ { name: "content-file", type: "string", value: "PATH", description: "A file whose text the action would write; scanned for credentials" }
59025
+ ];
59026
+ var guardCheckCommand = defineCommand({
59027
+ path: ["guard", "check"],
59028
+ summary: "Ask the server to decide an action now; exits 6 when it is refused",
59029
+ description: "The hook point for the git layer and CI: sends the action to the guardrail engine and exits 0 when allowed, or 6 with the code, the rule ID and the exact next command. An action that needs approval opens one with your summary and prints its ID; run it again with --approval <id> after a person approves.",
59030
+ flags: [...DECISION_FLAGS, { name: "approval", type: "string", value: "ID", description: "An approval that covers exactly this action" }],
59031
+ examples: ["overlane guard check --tool git.push --branch main --task held", 'overlane guard check --tool deploy.run --environment production --summary "Deploy build 42" --dry-run'],
59032
+ effect: "write",
59033
+ ...common,
59034
+ keywords: ["check action", "pre push check", "ci gate", "is this allowed", "approval required", "blocked by policy"],
59035
+ result: withDryRun(GuardEvaluateResponse),
59036
+ text: (d) => "decision" in d ? describeDecision(d.decision) : [],
59037
+ handler: async (inv) => {
59038
+ if (inv.dryRun) return planned(inv, "POST", guardPaths.evaluate, { ...actionOf(inv) }, "the decision is recorded; a rule that needs approval opens one");
59039
+ const reply = await evaluate(inv, false);
59040
+ return reply.decision.allowed ? { data: reply } : refusalOutcome(reply, reply.decision);
59041
+ }
59042
+ });
59043
+ var guardDryRunCommand = defineCommand({
59044
+ path: ["guard", "dry-run"],
59045
+ summary: "Report what the guardrails would decide for an action, without blocking or recording",
59046
+ description: "Asks the server for the combined decision (platform, team and project rules) and prints it without recording an audit entry or opening an approval. A rule in dry-run mode shows as would-block. An agent or a person sees exactly what a rule change would do before it is enforced.",
59047
+ flags: DECISION_FLAGS,
59048
+ examples: ["overlane guard dry-run --tool git.push --branch main --task held", "overlane guard dry-run --tool egress.fetch --host registry.example.com --json"],
59049
+ effect: "read",
59050
+ ...common,
59051
+ keywords: ["dry run rules", "what would block", "test policy", "simulate", "would be refused"],
59052
+ result: GuardEvaluateResponse,
59053
+ text: (d) => describeDecision(d.decision),
59054
+ handler: async (inv) => ({ data: await evaluate(inv, true) })
59055
+ });
59056
+ var guardScanCommand = defineCommand({
59057
+ path: ["guard", "scan"],
59058
+ summary: "Scan a file for credentials the way a push would be scanned",
59059
+ description: "Sends the text of a file to the secret scanner and reports the rule and line of each finding, never the matched text. Provider-prefixed keys block; generic high-entropy strings are reported only. Exits 6 when something would block.",
59060
+ flags: [
59061
+ { name: "path", type: "string", required: true, value: "PATH", description: "The file to scan" },
59062
+ { name: "source", type: "string", enum: SECRET_SOURCES, default: "push", description: "What the text would be: a push, task record, evidence, log or memory" }
59063
+ ],
59064
+ examples: ["overlane guard scan --path src/config.ts", "overlane guard scan --path ci.log --source log --json"],
59065
+ effect: "read",
59066
+ ...common,
59067
+ keywords: ["secret scan", "find credentials", "leaked key", "push protection", "scan file"],
59068
+ result: SecretScanResult,
59069
+ text: (d) => d.findings.length === 0 ? ["No credentials found."] : d.findings.map((finding) => `${finding.disposition.padEnd(8)} ${finding.rule}${finding.path === void 0 ? "" : ` ${finding.path}`}${finding.line === void 0 ? "" : `:${finding.line}`}`),
59070
+ handler: async (inv) => {
59071
+ const path = textFlag(inv, "path");
59072
+ if (path === void 0) throw new UsageError("scan needs --path", { hint: "overlane guard scan --path src/config.ts" });
59073
+ const { call: call2, tenantId } = await connected(inv);
59074
+ const result = await call2(SecretScanResult, "POST", guardPaths.scan(tenantId), { source: textFlag(inv, "source") ?? "push", content: readText3(inv, path), path });
59075
+ return result.blocked ? { data: result, exit: EXIT.blocked, error: new CliError("a credential was found; nothing should be pushed until it is removed and rotated", { code: "secret_detected", exit: EXIT.blocked, hint: "overlane guard scan --path <file>" }) } : { data: result };
59076
+ }
59077
+ });
59078
+ var ApprovalList2 = external_exports.object({ tenantId: external_exports.string(), approvals: external_exports.array(GuardApproval) }).strict();
59079
+ var guardApprovalsListCommand = defineCommand({
59080
+ path: ["guard", "approvals", "list"],
59081
+ summary: "List approvals waiting for an answer, with the summary and diff of each",
59082
+ description: "Lists approvals the guardrails opened for actions that need a person. Each shows who asked, the rule, a plain-language summary and the change it would make. Nothing runs until an approval is approved.",
59083
+ flags: [{ name: "status", type: "string", enum: ["pending", "approved", "denied"], description: "Only approvals with this status" }],
59084
+ examples: ["overlane guard approvals list", "overlane guard approvals list --status pending --json"],
59085
+ effect: "read",
59086
+ ...common,
59087
+ keywords: ["pending approvals", "approve before write", "who needs to approve", "approval queue"],
59088
+ result: ApprovalList2,
59089
+ text: (d) => d.approvals.length === 0 ? ["No approvals."] : d.approvals.flatMap((a) => [`${a.status.padEnd(9)} ${a.id} ${a.tool} by ${a.requestedBy} (rule ${a.ruleId})`, ` ${a.summary}`]),
59090
+ handler: async (inv) => {
59091
+ const { call: call2, tenantId } = await connected(inv);
59092
+ const status = textFlag(inv, "status");
59093
+ return { data: await call2(ApprovalList2, "GET", `${guardPaths.approvals(tenantId)}${status === void 0 ? "" : `?status=${status}`}`) };
59094
+ }
59095
+ });
59096
+ var guardApprovalsAnswerCommand = defineCommand({
59097
+ path: ["guard", "approvals", "answer"],
59098
+ summary: "Approve or deny an action waiting for approval, as an independent agent or a person",
59099
+ description: "Answers one approval. An independent second agent satisfies an approval (a different principal from the one that asked, listing the evidence it checked); a person always can. Under manual autonomy only a person can. An approval covers exactly the action it describes; a changed action needs a new approval. An answered approval does not change.",
59100
+ args: [{ name: "approval-id", required: true, description: "The approval to answer" }],
59101
+ flags: [
59102
+ { name: "decision", type: "string", required: true, enum: ["approve", "deny"], description: "approve lets the action run; deny keeps it refused" },
59103
+ { name: "reason", type: "string", value: "TEXT", description: "Why; kept in the approval record" },
59104
+ { name: "evidence", type: "string", multiple: true, value: "TEXT", description: "What you checked; repeat for more (required for an agent approver)" }
59105
+ ],
59106
+ examples: ["overlane guard approvals answer apr_1 --decision approve", 'overlane guard approvals answer apr_1 --decision approve --evidence "diff reviewed" --reason "matches the task" --dry-run'],
59107
+ effect: "write",
59108
+ ...common,
59109
+ keywords: ["approve action", "deny action", "answer approval", "allow push", "sign off"],
59110
+ result: withDryRun(GuardApproval),
59111
+ text: (d) => "status" in d ? [`${d.id} is ${d.status}.`] : [],
59112
+ handler: async (inv) => {
59113
+ const approvalId = inv.positionals[0];
59114
+ if (approvalId === void 0) throw new UsageError("answer needs an approval ID", { hint: "overlane guard approvals list --status pending" });
59115
+ const reason = textFlag(inv, "reason");
59116
+ const evidence = listFlag(inv, "evidence");
59117
+ const parsed = AnswerGuardApprovalRequest.safeParse({ decision: textFlag(inv, "decision"), ...reason === void 0 ? {} : { reason }, ...evidence.length === 0 ? {} : { evidence } });
59118
+ if (!parsed.success) throw new UsageError("--decision must be approve or deny", { hint: `overlane guard approvals answer ${approvalId} --decision approve` });
59119
+ if (inv.dryRun) return planned(inv, "POST", (tenantId2) => guardPaths.answer(tenantId2, approvalId), parsed.data);
59120
+ const { call: call2, tenantId } = await connected(inv);
59121
+ return { data: await call2(GuardApproval, "POST", guardPaths.answer(tenantId, approvalId), parsed.data) };
59122
+ }
59123
+ });
59124
+ var guardCommands = [guardRulesListCommand, guardRulesTestCommand, guardRulesPutCommand, guardCheckCommand, guardDryRunCommand, guardScanCommand, guardApprovalsListCommand, guardApprovalsAnswerCommand];
59125
+
59126
+ // ../cli/src/commands/memory.ts
59127
+ init_src();
59128
+ init_zod();
59129
+ import { randomUUID as randomUUID4 } from "node:crypto";
58261
59130
  var SERVICE_FLAG2 = { name: "service", type: "string", value: "URL", description: "The service address (default: HARNESS_SERVICE_URL, then the project's binding, then the hosted service)" };
58262
59131
  var TEAM_FLAG2 = { name: "team", type: "string", value: "TENANT_ID", description: "The team (tenant) to act on (default: the one your token belongs to)" };
58263
- var common = { needsAuth: true, needsNetwork: true };
59132
+ var common2 = { needsAuth: true, needsNetwork: true };
58264
59133
  async function authed2(inv) {
58265
59134
  const target = await resolveTarget(inv.deps, textFlag(inv, "service"));
58266
59135
  const token = await requireToken(inv.deps, target.storeKey);
@@ -58270,16 +59139,16 @@ async function tenantOf2(call2, inv) {
58270
59139
  return textFlag(inv, "team") ?? (await call2(WhoAmI, "GET", apiPaths.whoami)).tenantId;
58271
59140
  }
58272
59141
  function idArg(inv, what) {
58273
- const id = inv.positionals[0];
58274
- if (id === void 0) throw new UsageError(`${what} needs a memory ID`, { hint: "overlane memory search <query>" });
58275
- return id;
59142
+ const id2 = inv.positionals[0];
59143
+ if (id2 === void 0) throw new UsageError(`${what} needs a memory ID`, { hint: "overlane memory search <query>" });
59144
+ return id2;
58276
59145
  }
58277
59146
  async function plan(inv, method, path, body2, note) {
58278
59147
  const target = await resolveTarget(inv.deps, textFlag(inv, "service"));
58279
59148
  const tenant = textFlag(inv, "team") ?? ":your-team";
58280
59149
  return planOutcome(inv.deps, dryRunPlan({ service: target.service, requests: [{ method, path: path(tenant), ...body2 === void 0 ? {} : { body: body2 }, ...note === void 0 ? {} : { note } }] }));
58281
59150
  }
58282
- var requestId3 = () => `cli-${randomUUID3()}`;
59151
+ var requestId4 = () => `cli-${randomUUID4()}`;
58283
59152
  var memorySearchCommand = defineCommand({
58284
59153
  path: ["memory", "search"],
58285
59154
  summary: "Search memory across project, team, user and global scopes",
@@ -58294,7 +59163,7 @@ var memorySearchCommand = defineCommand({
58294
59163
  ],
58295
59164
  examples: ['overlane memory search "how do we deploy"', 'overlane memory search "indentation" --scope team --json'],
58296
59165
  effect: "read",
58297
- ...common,
59166
+ ...common2,
58298
59167
  keywords: ["recall", "remember", "what do we know", "find memory", "lookup", "notes", "conventions", "decisions"],
58299
59168
  result: MemorySearchResponse,
58300
59169
  text: (d) => d.items.length === 0 ? ["No memories match."] : d.items.map((i2) => `${i2.scope.padEnd(7)} ${i2.status.padEnd(9)} ${i2.id} ${i2.title}${i2.stale ? " [stale]" : ""}${i2.overriddenBy === null ? "" : ` [overridden by ${i2.overriddenBy}]`}`),
@@ -58328,7 +59197,7 @@ var memoryAddCommand = defineCommand({
58328
59197
  ],
58329
59198
  examples: ['overlane memory add --title "Deploy day" "Deploys go out on Tuesdays" --project prj_1', 'overlane memory add --title "Editor" --scope user "I prefer a dark theme" --dry-run'],
58330
59199
  effect: "write",
58331
- ...common,
59200
+ ...common2,
58332
59201
  keywords: ["remember this", "save a note", "record a decision", "store convention", "candidate"],
58333
59202
  result: AddResult,
58334
59203
  handler: async (inv) => {
@@ -58336,7 +59205,7 @@ var memoryAddCommand = defineCommand({
58336
59205
  if (title === void 0) throw new UsageError("add needs --title", { hint: 'overlane memory add --title "..." "<text>"' });
58337
59206
  const project = textFlag(inv, "project");
58338
59207
  const parsed = MemoryCandidate.safeParse({
58339
- requestId: requestId3(),
59208
+ requestId: requestId4(),
58340
59209
  scope: textFlag(inv, "scope") ?? "project",
58341
59210
  ...project === void 0 ? {} : { projectId: project },
58342
59211
  category: textFlag(inv, "category") ?? "fact",
@@ -58367,18 +59236,18 @@ var memoryConfirmCommand = defineCommand({
58367
59236
  ],
58368
59237
  examples: ["overlane memory confirm mem_ab12", "overlane memory confirm mem_ab12 --basis ci_evidence --evidence 0123abc:unit_tests --dry-run"],
58369
59238
  effect: "write",
58370
- ...common,
59239
+ ...common2,
58371
59240
  keywords: ["approve memory", "verify", "promote candidate", "second observer", "ci evidence"],
58372
59241
  result: ConfirmResult,
58373
59242
  handler: async (inv) => {
58374
- const id = idArg(inv, "confirm");
59243
+ const id2 = idArg(inv, "confirm");
58375
59244
  const evidence = textFlag(inv, "evidence");
58376
59245
  const parsed = MemoryConfirmRequest.safeParse({ basis: textFlag(inv, "basis") ?? "human", ...evidence === void 0 ? {} : { evidenceRef: evidence } });
58377
59246
  if (!parsed.success) throw new UsageError(parsed.error.issues.map((issue2) => issue2.message).join("; "));
58378
- if (inv.dryRun) return plan(inv, "POST", (tenant) => memoryPaths.confirm(tenant, id), parsed.data);
59247
+ if (inv.dryRun) return plan(inv, "POST", (tenant) => memoryPaths.confirm(tenant, id2), parsed.data);
58379
59248
  const { call: call2 } = await authed2(inv);
58380
59249
  const tenantId = await tenantOf2(call2, inv);
58381
- const item = await call2(MemoryItem, "POST", memoryPaths.confirm(tenantId, id), parsed.data);
59250
+ const item = await call2(MemoryItem, "POST", memoryPaths.confirm(tenantId, id2), parsed.data);
58382
59251
  say(inv.deps, `${item.id} is ${item.status}.`);
58383
59252
  return { data: item };
58384
59253
  }
@@ -58391,17 +59260,17 @@ var memoryPromoteCommand = defineCommand({
58391
59260
  flags: [SERVICE_FLAG2, TEAM_FLAG2, { name: "to", type: "string", enum: ["team", "global"], default: "team", description: "Where to promote it" }],
58392
59261
  examples: ["overlane memory promote mem_ab12 --to team", "overlane memory promote mem_cd34 --to global --dry-run"],
58393
59262
  effect: "write",
58394
- ...common,
59263
+ ...common2,
58395
59264
  keywords: ["share with team", "contribute", "global memory", "make team wide"],
58396
59265
  result: withDryRun(MemoryPromoteResponse),
58397
59266
  handler: async (inv) => {
58398
- const id = idArg(inv, "promote");
59267
+ const id2 = idArg(inv, "promote");
58399
59268
  const parsed = MemoryPromoteRequest.safeParse({ to: textFlag(inv, "to") ?? "team" });
58400
59269
  if (!parsed.success) throw new UsageError("--to must be team or global");
58401
- if (inv.dryRun) return plan(inv, "POST", (tenant) => memoryPaths.promote(tenant, id), parsed.data);
59270
+ if (inv.dryRun) return plan(inv, "POST", (tenant) => memoryPaths.promote(tenant, id2), parsed.data);
58402
59271
  const { call: call2 } = await authed2(inv);
58403
59272
  const tenantId = await tenantOf2(call2, inv);
58404
- const out2 = await call2(MemoryPromoteResponse, "POST", memoryPaths.promote(tenantId, id), parsed.data);
59273
+ const out2 = await call2(MemoryPromoteResponse, "POST", memoryPaths.promote(tenantId, id2), parsed.data);
58405
59274
  say(inv.deps, out2.contribution === null ? `Promoted to team as ${out2.item?.id ?? "?"}.` : `Contribution ${out2.contribution.id} is ${out2.contribution.status} (${out2.contribution.tenantsSeen} of ${out2.contribution.k} teams).`);
58406
59275
  return { data: out2 };
58407
59276
  }
@@ -58419,7 +59288,7 @@ var memoryExportCommand = defineCommand({
58419
59288
  ],
58420
59289
  examples: ["overlane memory export --json", "overlane memory export --scope user --user usr_1 --json"],
58421
59290
  effect: "read",
58422
- ...common,
59291
+ ...common2,
58423
59292
  keywords: ["download memory", "backup", "data portability", "gdpr", "subject access"],
58424
59293
  result: MemoryExportRecord,
58425
59294
  text: (d) => [`${d.items.length} memories exported at ${d.exportedAt}. Use --json for the full content.`],
@@ -58443,15 +59312,15 @@ var memoryDeleteCommand = defineCommand({
58443
59312
  flags: [SERVICE_FLAG2, TEAM_FLAG2],
58444
59313
  examples: ["overlane memory delete mem_ab12 --force", "overlane memory delete mem_ab12 --dry-run"],
58445
59314
  effect: "destructive",
58446
- ...common,
59315
+ ...common2,
58447
59316
  keywords: ["remove memory", "forget", "erase", "wrong memory", "gdpr deletion"],
58448
59317
  result: withDryRun(MemoryDeleteResponse),
58449
59318
  handler: async (inv) => {
58450
- const id = idArg(inv, "delete");
58451
- if (inv.dryRun) return plan(inv, "DELETE", (tenant) => memoryPaths.one(tenant, id));
59319
+ const id2 = idArg(inv, "delete");
59320
+ if (inv.dryRun) return plan(inv, "DELETE", (tenant) => memoryPaths.one(tenant, id2));
58452
59321
  const { call: call2 } = await authed2(inv);
58453
59322
  const tenantId = await tenantOf2(call2, inv);
58454
- const out2 = await call2(MemoryDeleteResponse, "DELETE", memoryPaths.one(tenantId, id));
59323
+ const out2 = await call2(MemoryDeleteResponse, "DELETE", memoryPaths.one(tenantId, id2));
58455
59324
  say(inv.deps, `Deleted ${out2.removedIds.length} memory (${out2.vectorsRemoved} vectors, ${out2.derivedRemoved} derived records).`);
58456
59325
  return { data: out2 };
58457
59326
  }
@@ -58464,15 +59333,15 @@ var memoryUnlearnCommand = defineCommand({
58464
59333
  flags: [SERVICE_FLAG2, TEAM_FLAG2],
58465
59334
  examples: ["overlane memory unlearn mem_ab12 --force", "overlane memory unlearn mem_ab12 --dry-run"],
58466
59335
  effect: "destructive",
58467
- ...common,
59336
+ ...common2,
58468
59337
  keywords: ["unlearn", "forget everything derived", "retract", "poisoned memory", "bad memory"],
58469
59338
  result: withDryRun(MemoryUnlearnRecord),
58470
59339
  handler: async (inv) => {
58471
- const id = idArg(inv, "unlearn");
58472
- if (inv.dryRun) return plan(inv, "POST", (tenant) => memoryPaths.unlearn(tenant, id), {});
59340
+ const id2 = idArg(inv, "unlearn");
59341
+ if (inv.dryRun) return plan(inv, "POST", (tenant) => memoryPaths.unlearn(tenant, id2), {});
58473
59342
  const { call: call2 } = await authed2(inv);
58474
59343
  const tenantId = await tenantOf2(call2, inv);
58475
- const out2 = await call2(MemoryUnlearnRecord, "POST", memoryPaths.unlearn(tenantId, id), {});
59344
+ const out2 = await call2(MemoryUnlearnRecord, "POST", memoryPaths.unlearn(tenantId, id2), {});
58476
59345
  say(inv.deps, `Unlearned ${out2.removedIds.length} memories (record ${out2.id}).`);
58477
59346
  return { data: out2 };
58478
59347
  }
@@ -58484,7 +59353,7 @@ var memoryStatusCommand = defineCommand({
58484
59353
  flags: [SERVICE_FLAG2, TEAM_FLAG2],
58485
59354
  examples: ["overlane memory status", "overlane memory status --json"],
58486
59355
  effect: "read",
58487
- ...common,
59356
+ ...common2,
58488
59357
  keywords: ["memory health", "stale memory", "how many memories", "contribution", "opt in"],
58489
59358
  result: MemoryStatusResponse,
58490
59359
  text: (d) => [...Object.entries(d.counts).map(([key, n]) => `${key}: ${n}`), `stale: ${d.stale}`, `global contribution: ${d.settings.globalContribution ? "on" : "off"}`, `pending jobs: ${d.pendingJobs}`],
@@ -58502,7 +59371,7 @@ var memoryContributionCommand = defineCommand({
58502
59371
  flags: [SERVICE_FLAG2, TEAM_FLAG2],
58503
59372
  examples: ["overlane memory contribution on", "overlane memory contribution off --dry-run"],
58504
59373
  effect: "write",
58505
- ...common,
59374
+ ...common2,
58506
59375
  keywords: ["opt in", "opt out", "share patterns", "global pool", "contribute"],
58507
59376
  result: withDryRun(MemorySettings),
58508
59377
  handler: async (inv) => {
@@ -58522,10 +59391,10 @@ var memoryCommands = [memorySearchCommand, memoryAddCommand, memoryConfirmComman
58522
59391
  // ../cli/src/commands/issue.ts
58523
59392
  init_src();
58524
59393
  init_zod();
58525
- import { randomUUID as randomUUID4 } from "node:crypto";
58526
- import { readFileSync as readFileSync7 } from "node:fs";
58527
- var common2 = { needsAuth: true, needsNetwork: true };
58528
- var requestId4 = () => `cli-${randomUUID4()}`;
59394
+ import { randomUUID as randomUUID5 } from "node:crypto";
59395
+ import { readFileSync as readFileSync8 } from "node:fs";
59396
+ var common3 = { needsAuth: true, needsNetwork: true };
59397
+ var requestId5 = () => `cli-${randomUUID5()}`;
58529
59398
  var PRIORITIES = ["P0", "P1", "P2", "P3"];
58530
59399
  var STATUSES = ["backlog", "todo", "in_progress", "in_review", "cancelled"];
58531
59400
  async function send(deps, label, schema, method, path, body2, dryRun) {
@@ -58562,7 +59431,7 @@ var issueListCommand = defineCommand({
58562
59431
  flags: [{ name: "status", type: "string", enum: ["backlog", "todo", "in_progress", "in_review", "done", "cancelled"], description: "Only issues in this status" }],
58563
59432
  examples: ["overlane issue list", "overlane issue list --status todo --json"],
58564
59433
  effect: "read",
58565
- ...common2,
59434
+ ...common3,
58566
59435
  keywords: ["issues", "backlog", "tickets", "work items", "what is open", "list issues"],
58567
59436
  result: external_exports.object({ issues: external_exports.array(IssueShown) }),
58568
59437
  handler: async (inv) => {
@@ -58583,14 +59452,14 @@ var issueShowCommand = defineCommand({
58583
59452
  args: [{ name: "issue-id", required: true, description: "The issue ID, for example iss_ab12cd34ef56gh78" }],
58584
59453
  examples: ["overlane issue show iss_ab12cd34ef56gh78"],
58585
59454
  effect: "read",
58586
- ...common2,
59455
+ ...common3,
58587
59456
  keywords: ["issue details", "ticket", "view issue", "who is working on"],
58588
59457
  result: IssueShown,
58589
59458
  handler: async (inv) => {
58590
- const id = inv.positionals[0];
58591
- if (id === void 0) throw new UsageError("show needs an ISSUE_ID");
59459
+ const id2 = inv.positionals[0];
59460
+ if (id2 === void 0) throw new UsageError("show needs an ISSUE_ID");
58592
59461
  const project = await connectedProject(inv.deps, "issue");
58593
- const issue2 = shown(inv.deps, await serviceCall(inv.deps, project.serviceUrl, project.token)(Issue, "GET", issuePaths.issue(project.binding.tenantId, project.binding.projectId, id)));
59462
+ const issue2 = shown(inv.deps, await serviceCall(inv.deps, project.serviceUrl, project.token)(Issue, "GET", issuePaths.issue(project.binding.tenantId, project.binding.projectId, id2)));
58594
59463
  if (isAgent(inv.deps)) say(inv.deps, UNTRUSTED_NOTICE);
58595
59464
  say(inv.deps, line(issue2));
58596
59465
  const active = issue2.links.tasks.find((link) => link.state === "active");
@@ -58606,14 +59475,14 @@ var issueEventsCommand = defineCommand({
58606
59475
  args: [{ name: "issue-id", required: true, description: "The issue ID" }],
58607
59476
  examples: ["overlane issue events iss_ab12cd34ef56gh78"],
58608
59477
  effect: "read",
58609
- ...common2,
59478
+ ...common3,
58610
59479
  keywords: ["audit", "history", "who changed", "field changes", "issue log"],
58611
59480
  result: IssueEventList,
58612
59481
  handler: async (inv) => {
58613
- const id = inv.positionals[0];
58614
- if (id === void 0) throw new UsageError("events needs an ISSUE_ID");
59482
+ const id2 = inv.positionals[0];
59483
+ if (id2 === void 0) throw new UsageError("events needs an ISSUE_ID");
58615
59484
  const project = await connectedProject(inv.deps, "issue");
58616
- const events = await serviceCall(inv.deps, project.serviceUrl, project.token)(IssueEventList, "GET", issuePaths.events(project.binding.tenantId, project.binding.projectId, id));
59485
+ const events = await serviceCall(inv.deps, project.serviceUrl, project.token)(IssueEventList, "GET", issuePaths.events(project.binding.tenantId, project.binding.projectId, id2));
58617
59486
  for (const event of events.events) say(inv.deps, `${event.sequence} ${event.at} ${event.field} by ${event.actor.type}:${event.actor.id}`);
58618
59487
  return { data: events };
58619
59488
  }
@@ -58631,12 +59500,12 @@ var issueNewCommand = defineCommand({
58631
59500
  ],
58632
59501
  examples: ['overlane issue new "Back-time drifts by a second"', 'overlane issue new "Fix export" --priority P0 --description "Fails on empty notes"'],
58633
59502
  effect: "write",
58634
- ...common2,
59503
+ ...common3,
58635
59504
  keywords: ["create issue", "new issue", "file a ticket", "add work item", "report bug"],
58636
59505
  result: withDryRun(Issue),
58637
59506
  handler: async (inv) => {
58638
59507
  const estimate = textFlag(inv, "estimate");
58639
- const body2 = { requestId: requestId4(), title: inv.positionals.join(" "), description: textFlag(inv, "description") ?? "", priority: priorityFlag(inv) ?? "P1", status: textFlag(inv, "status") ?? "backlog", ...estimate === void 0 ? {} : { estimate: Number(estimate) } };
59508
+ const body2 = { requestId: requestId5(), title: inv.positionals.join(" "), description: textFlag(inv, "description") ?? "", priority: priorityFlag(inv) ?? "P1", status: textFlag(inv, "status") ?? "backlog", ...estimate === void 0 ? {} : { estimate: Number(estimate) } };
58640
59509
  const result = await send(inv.deps, "issue", Issue, "POST", issuePaths.issues, body2, inv.dryRun);
58641
59510
  if (result.value !== void 0) say(inv.deps, `Created #${result.value.number} ${result.value.issueId}`);
58642
59511
  return result;
@@ -58656,15 +59525,15 @@ var issueUpdateCommand = defineCommand({
58656
59525
  ],
58657
59526
  examples: ["overlane issue update iss_ab12cd34ef56gh78 --priority P0", 'overlane issue update iss_ab12cd34ef56gh78 --status in_progress --title "New title"'],
58658
59527
  effect: "write",
58659
- ...common2,
59528
+ ...common3,
58660
59529
  keywords: ["edit issue", "change status", "change priority", "rename issue", "update ticket"],
58661
59530
  result: withDryRun(Issue),
58662
59531
  handler: async (inv) => {
58663
- const id = inv.positionals[0];
58664
- if (id === void 0) throw new UsageError("update needs an ISSUE_ID");
59532
+ const id2 = inv.positionals[0];
59533
+ if (id2 === void 0) throw new UsageError("update needs an ISSUE_ID");
58665
59534
  const estimate = textFlag(inv, "estimate");
58666
59535
  const body2 = {
58667
- requestId: requestId4(),
59536
+ requestId: requestId5(),
58668
59537
  ...textFlag(inv, "title") === void 0 ? {} : { title: textFlag(inv, "title") },
58669
59538
  ...textFlag(inv, "description") === void 0 ? {} : { description: textFlag(inv, "description") },
58670
59539
  ...textFlag(inv, "status") === void 0 ? {} : { status: textFlag(inv, "status") },
@@ -58672,7 +59541,7 @@ var issueUpdateCommand = defineCommand({
58672
59541
  ...estimate === void 0 ? {} : { estimate: Number(estimate) }
58673
59542
  };
58674
59543
  if (Object.keys(body2).length === 1) throw new UsageError("update needs at least one of --title, --description, --status, --priority, --estimate");
58675
- return send(inv.deps, "issue", Issue, "PATCH", (t, p) => issuePaths.issue(t, p, id), body2, inv.dryRun);
59544
+ return send(inv.deps, "issue", Issue, "PATCH", (t, p) => issuePaths.issue(t, p, id2), body2, inv.dryRun);
58676
59545
  }
58677
59546
  });
58678
59547
  var issueAssignCommand = defineCommand({
@@ -58685,14 +59554,14 @@ var issueAssignCommand = defineCommand({
58685
59554
  ],
58686
59555
  examples: ["overlane issue assign iss_ab12cd34ef56gh78 agent:claude-code", "overlane issue assign iss_ab12cd34ef56gh78 none"],
58687
59556
  effect: "write",
58688
- ...common2,
59557
+ ...common3,
58689
59558
  keywords: ["assign", "give to agent", "hand to bot", "delegate", "who works on this", "unassign"],
58690
59559
  result: withDryRun(AssignResult),
58691
59560
  handler: async (inv) => {
58692
- const id = inv.positionals[0];
58693
- if (id === void 0) throw new UsageError("assign needs an ISSUE_ID and an assignee");
59561
+ const id2 = inv.positionals[0];
59562
+ if (id2 === void 0) throw new UsageError("assign needs an ISSUE_ID and an assignee");
58694
59563
  const assignee = parseAssignee(inv.positionals[1]);
58695
- const result = await send(inv.deps, "issue", AssignResult, "POST", (t, p) => issuePaths.assign(t, p, id), { requestId: requestId4(), assignee }, inv.dryRun);
59564
+ const result = await send(inv.deps, "issue", AssignResult, "POST", (t, p) => issuePaths.assign(t, p, id2), { requestId: requestId5(), assignee }, inv.dryRun);
58696
59565
  if (result.value !== void 0) say(inv.deps, result.value.taskId === null ? "Assigned." : `Assigned. Task: ${result.value.taskId}${result.value.createdTask ? " (new)" : ""}`);
58697
59566
  return result;
58698
59567
  }
@@ -58708,7 +59577,7 @@ var issueImportCommand = defineCommand({
58708
59577
  flags: [{ name: "preview", type: "boolean", description: "Report what the import would create or update, and write nothing" }],
58709
59578
  examples: ["overlane issue import linear ./linear-export.json --preview", "overlane issue import jira ./jira-search.json"],
58710
59579
  effect: "write",
58711
- ...common2,
59580
+ ...common3,
58712
59581
  keywords: ["import", "migrate from linear", "migrate from jira", "github projects import", "bring issues in"],
58713
59582
  result: withDryRun(ImportReport),
58714
59583
  handler: async (inv) => {
@@ -58717,11 +59586,11 @@ var issueImportCommand = defineCommand({
58717
59586
  if (file2 === void 0) throw new UsageError("import needs the path of the export file");
58718
59587
  let data;
58719
59588
  try {
58720
- data = JSON.parse(readFileSync7(file2, "utf8"));
59589
+ data = JSON.parse(readFileSync8(file2, "utf8"));
58721
59590
  } catch {
58722
59591
  throw new UsageError(`${file2} is not a readable JSON file`);
58723
59592
  }
58724
- const result = await send(inv.deps, "issue", ImportReport, "POST", issuePaths.import, { requestId: requestId4(), source, dryRun: boolFlag(inv, "preview"), data }, inv.dryRun);
59593
+ const result = await send(inv.deps, "issue", ImportReport, "POST", issuePaths.import, { requestId: requestId5(), source, dryRun: boolFlag(inv, "preview"), data }, inv.dryRun);
58725
59594
  if (result.value !== void 0) {
58726
59595
  const r = result.value;
58727
59596
  say(inv.deps, `${r.dryRun ? "Would import" : "Imported"} from ${r.source}: ${r.created} new, ${r.updated} updated, ${r.unchanged} unchanged, ${r.skipped.length} skipped.`);
@@ -58735,7 +59604,7 @@ var issueSyncCommand = defineCommand({
58735
59604
  description: "Shows the repository and mode: off (default), read_only (GitHub changes flow in, nothing is written to GitHub) or write_back (an owner or admin opted in).",
58736
59605
  examples: ["overlane issue sync"],
58737
59606
  effect: "read",
58738
- ...common2,
59607
+ ...common3,
58739
59608
  keywords: ["github sync", "sync status", "two-way sync", "write back"],
58740
59609
  result: SyncConfig,
58741
59610
  handler: async (inv) => {
@@ -58755,13 +59624,13 @@ var issueSyncSetCommand = defineCommand({
58755
59624
  ],
58756
59625
  examples: ["overlane issue sync set acme/app read_only", "overlane issue sync set acme/app off"],
58757
59626
  effect: "write",
58758
- ...common2,
59627
+ ...common3,
58759
59628
  keywords: ["enable github sync", "write back", "turn off sync", "read only sync"],
58760
59629
  result: withDryRun(SyncConfig),
58761
59630
  handler: async (inv) => {
58762
59631
  const [repository, mode] = inv.positionals;
58763
59632
  if (repository === void 0 || mode === void 0) throw new UsageError("sync set needs REPOSITORY and MODE");
58764
- return send(inv.deps, "issue", SyncConfig, "PUT", issuePaths.sync, { requestId: requestId4(), repository, mode }, inv.dryRun);
59633
+ return send(inv.deps, "issue", SyncConfig, "PUT", issuePaths.sync, { requestId: requestId5(), repository, mode }, inv.dryRun);
58765
59634
  }
58766
59635
  });
58767
59636
  var issueCommands = [issueListCommand, issueShowCommand, issueEventsCommand, issueNewCommand, issueUpdateCommand, issueAssignCommand, issueImportCommand, issueSyncCommand, issueSyncSetCommand];
@@ -58769,7 +59638,7 @@ var issueCommands = [issueListCommand, issueShowCommand, issueEventsCommand, iss
58769
59638
  // ../cli/src/commands/issue-views.ts
58770
59639
  init_src();
58771
59640
  init_zod();
58772
- var common3 = { needsAuth: true, needsNetwork: true };
59641
+ var common4 = { needsAuth: true, needsNetwork: true };
58773
59642
  var Deleted = external_exports.object({ deleted: external_exports.literal(true) });
58774
59643
  var FIELDS = ["status", "priority", "assigneeType", "assignee", "labelId", "workProjectId", "cycleId", "estimate", "source", "title", "number", "createdAt", "updatedAt"];
58775
59644
  function parseCondition(text) {
@@ -58785,7 +59654,7 @@ var viewListCommand = defineCommand({
58785
59654
  description: "Lists saved views: a filter plus a group-by and sort over any issue field.",
58786
59655
  examples: ["overlane view list"],
58787
59656
  effect: "read",
58788
- ...common3,
59657
+ ...common4,
58789
59658
  keywords: ["saved views", "filters", "board", "group by"],
58790
59659
  result: ViewList,
58791
59660
  handler: async (inv) => {
@@ -58803,14 +59672,14 @@ var viewRunCommand = defineCommand({
58803
59672
  args: [{ name: "view-id", required: true, description: "The saved view ID" }],
58804
59673
  examples: ["overlane view run viw_ab12cd34ef56gh78"],
58805
59674
  effect: "read",
58806
- ...common3,
59675
+ ...common4,
58807
59676
  keywords: ["run view", "show board", "group issues"],
58808
59677
  result: ViewResult,
58809
59678
  handler: async (inv) => {
58810
- const id = inv.positionals[0];
58811
- if (id === void 0) throw new UsageError("run needs a VIEW_ID");
59679
+ const id2 = inv.positionals[0];
59680
+ if (id2 === void 0) throw new UsageError("run needs a VIEW_ID");
58812
59681
  const project = await connectedProject(inv.deps, "view");
58813
- const result = await serviceCall(inv.deps, project.serviceUrl, project.token)(ViewResult, "GET", issuePaths.viewRun(project.binding.tenantId, project.binding.projectId, id));
59682
+ const result = await serviceCall(inv.deps, project.serviceUrl, project.token)(ViewResult, "GET", issuePaths.viewRun(project.binding.tenantId, project.binding.projectId, id2));
58814
59683
  for (const group of result.groups) {
58815
59684
  say(inv.deps, `${group.key} (${group.issues.length})`);
58816
59685
  for (const issue2 of group.issues) say(inv.deps, ` #${issue2.number} ${issue2.status} ${issue2.priority}`);
@@ -58831,12 +59700,12 @@ var viewNewCommand = defineCommand({
58831
59700
  ],
58832
59701
  examples: ["overlane view new Urgent --filter priority=P0 --group-by status", 'overlane view new "Agent work" --filter assigneeType=agent --group-by status'],
58833
59702
  effect: "write",
58834
- ...common3,
59703
+ ...common4,
58835
59704
  keywords: ["create view", "save filter", "board", "group by status"],
58836
59705
  result: withDryRun(SavedView),
58837
59706
  handler: async (inv) => {
58838
59707
  const definition = { filter: listFlag(inv, "filter").map(parseCondition), groupBy: textFlag(inv, "group-by") ?? null, sortBy: textFlag(inv, "sort-by") ?? "number", sortDirection: boolFlag(inv, "desc") ? "desc" : "asc" };
58839
- return send(inv.deps, "view", SavedView, "POST", issuePaths.views, { requestId: requestId4(), name: inv.positionals.join(" "), definition }, inv.dryRun);
59708
+ return send(inv.deps, "view", SavedView, "POST", issuePaths.views, { requestId: requestId5(), name: inv.positionals.join(" "), definition }, inv.dryRun);
58840
59709
  }
58841
59710
  });
58842
59711
  var viewDeleteCommand = defineCommand({
@@ -58846,13 +59715,13 @@ var viewDeleteCommand = defineCommand({
58846
59715
  args: [{ name: "view-id", required: false, description: "The saved view ID (required; checked after the --force confirmation)" }],
58847
59716
  examples: ["overlane view delete viw_ab12cd34ef56gh78 --force"],
58848
59717
  effect: "destructive",
58849
- ...common3,
59718
+ ...common4,
58850
59719
  keywords: ["remove view", "delete filter"],
58851
59720
  result: withDryRun(Deleted),
58852
59721
  handler: async (inv) => {
58853
- const id = inv.positionals[0];
58854
- if (id === void 0) throw new UsageError("delete needs a VIEW_ID");
58855
- return send(inv.deps, "view", Deleted, "DELETE", (t, p) => `${issuePaths.views(t, p)}/${encodeURIComponent(id)}`, void 0, inv.dryRun);
59722
+ const id2 = inv.positionals[0];
59723
+ if (id2 === void 0) throw new UsageError("delete needs a VIEW_ID");
59724
+ return send(inv.deps, "view", Deleted, "DELETE", (t, p) => `${issuePaths.views(t, p)}/${encodeURIComponent(id2)}`, void 0, inv.dryRun);
58856
59725
  }
58857
59726
  });
58858
59727
  var loopListCommand = defineCommand({
@@ -58861,7 +59730,7 @@ var loopListCommand = defineCommand({
58861
59730
  description: "Lists loops: a trigger (schedule or event), a filter over issues and the executor they dispatch.",
58862
59731
  examples: ["overlane loop list"],
58863
59732
  effect: "read",
58864
- ...common3,
59733
+ ...common4,
58865
59734
  keywords: ["loops", "scheduled work", "recurring", "automation"],
58866
59735
  result: LoopList,
58867
59736
  handler: async (inv) => {
@@ -58885,7 +59754,7 @@ var loopNewCommand = defineCommand({
58885
59754
  ],
58886
59755
  examples: ["overlane loop new Nightly --every 1440 --filter priority=P0", "overlane loop new OnAssign --on issue.assigned"],
58887
59756
  effect: "write",
58888
- ...common3,
59757
+ ...common4,
58889
59758
  keywords: ["schedule agent", "recurring work", "event trigger", "automation", "nightly"],
58890
59759
  result: withDryRun(LoopDefinition),
58891
59760
  handler: async (inv) => {
@@ -58893,7 +59762,7 @@ var loopNewCommand = defineCommand({
58893
59762
  const on = textFlag(inv, "on");
58894
59763
  if (every === void 0 === (on === void 0)) throw new UsageError("pass exactly one of --every MINUTES or --on EVENT");
58895
59764
  const trigger = every !== void 0 ? { kind: "schedule", everyMinutes: Number(every) } : { kind: "event", on };
58896
- return send(inv.deps, "loop", LoopDefinition, "POST", issuePaths.loops, { requestId: requestId4(), name: inv.positionals.join(" "), trigger, filter: listFlag(inv, "filter").map(parseCondition), executor: textFlag(inv, "executor") ?? "claude-code" }, inv.dryRun);
59765
+ return send(inv.deps, "loop", LoopDefinition, "POST", issuePaths.loops, { requestId: requestId5(), name: inv.positionals.join(" "), trigger, filter: listFlag(inv, "filter").map(parseCondition), executor: textFlag(inv, "executor") ?? "claude-code" }, inv.dryRun);
58897
59766
  }
58898
59767
  });
58899
59768
  var loopSetCommand = defineCommand({
@@ -58906,13 +59775,13 @@ var loopSetCommand = defineCommand({
58906
59775
  ],
58907
59776
  examples: ["overlane loop set lop_ab12cd34ef56gh78 off"],
58908
59777
  effect: "write",
58909
- ...common3,
59778
+ ...common4,
58910
59779
  keywords: ["disable loop", "enable loop", "stop schedule"],
58911
59780
  result: withDryRun(LoopDefinition),
58912
59781
  handler: async (inv) => {
58913
- const [id, state] = inv.positionals;
58914
- if (id === void 0 || state !== "on" && state !== "off") throw new UsageError("set needs a LOOP_ID and on or off");
58915
- return send(inv.deps, "loop", LoopDefinition, "PATCH", (t, p) => issuePaths.loop(t, p, id), { requestId: requestId4(), enabled: state === "on" }, inv.dryRun);
59782
+ const [id2, state] = inv.positionals;
59783
+ if (id2 === void 0 || state !== "on" && state !== "off") throw new UsageError("set needs a LOOP_ID and on or off");
59784
+ return send(inv.deps, "loop", LoopDefinition, "PATCH", (t, p) => issuePaths.loop(t, p, id2), { requestId: requestId5(), enabled: state === "on" }, inv.dryRun);
58916
59785
  }
58917
59786
  });
58918
59787
  var loopFireCommand = defineCommand({
@@ -58922,13 +59791,13 @@ var loopFireCommand = defineCommand({
58922
59791
  args: [{ name: "loop-id", required: true, description: "The loop ID" }],
58923
59792
  examples: ["overlane loop fire lop_ab12cd34ef56gh78"],
58924
59793
  effect: "write",
58925
- ...common3,
59794
+ ...common4,
58926
59795
  keywords: ["run loop", "trigger loop", "dispatch agent"],
58927
59796
  result: withDryRun(LoopRun),
58928
59797
  handler: async (inv) => {
58929
- const id = inv.positionals[0];
58930
- if (id === void 0) throw new UsageError("fire needs a LOOP_ID");
58931
- const result = await send(inv.deps, "loop", LoopRun, "POST", (t, p) => issuePaths.loopFire(t, p, id), { requestId: requestId4(), trigger: "schedule" }, inv.dryRun);
59798
+ const id2 = inv.positionals[0];
59799
+ if (id2 === void 0) throw new UsageError("fire needs a LOOP_ID");
59800
+ const result = await send(inv.deps, "loop", LoopRun, "POST", (t, p) => issuePaths.loopFire(t, p, id2), { requestId: requestId5(), trigger: "schedule" }, inv.dryRun);
58932
59801
  if (result.value !== void 0) say(inv.deps, `Loop run ${result.value.runId ?? "(none)"}: ${result.value.claimed.length} claimed, stopped: ${result.value.stopReason}.`);
58933
59802
  return result;
58934
59803
  }
@@ -58940,18 +59809,220 @@ var loopDeleteCommand = defineCommand({
58940
59809
  args: [{ name: "loop-id", required: false, description: "The loop ID (required; checked after the --force confirmation)" }],
58941
59810
  examples: ["overlane loop delete lop_ab12cd34ef56gh78 --force"],
58942
59811
  effect: "destructive",
58943
- ...common3,
59812
+ ...common4,
58944
59813
  keywords: ["remove loop", "delete schedule"],
58945
59814
  result: withDryRun(Deleted),
58946
59815
  handler: async (inv) => {
58947
- const id = inv.positionals[0];
58948
- if (id === void 0) throw new UsageError("delete needs a LOOP_ID");
58949
- return send(inv.deps, "loop", Deleted, "DELETE", (t, p) => issuePaths.loop(t, p, id), void 0, inv.dryRun);
59816
+ const id2 = inv.positionals[0];
59817
+ if (id2 === void 0) throw new UsageError("delete needs a LOOP_ID");
59818
+ return send(inv.deps, "loop", Deleted, "DELETE", (t, p) => issuePaths.loop(t, p, id2), void 0, inv.dryRun);
58950
59819
  }
58951
59820
  });
58952
59821
  var viewCommands = [viewListCommand, viewRunCommand, viewNewCommand, viewDeleteCommand];
58953
59822
  var loopCommands = [loopListCommand, loopNewCommand, loopSetCommand, loopFireCommand, loopDeleteCommand];
58954
59823
 
59824
+ // ../cli/src/commands/review.ts
59825
+ init_src();
59826
+ import { randomUUID as randomUUID6 } from "node:crypto";
59827
+ var common5 = { needsAuth: true, needsNetwork: true };
59828
+ var requestId6 = () => `cli-${randomUUID6()}`;
59829
+ async function connected2(inv) {
59830
+ const project = await connectedProject(inv.deps, "review");
59831
+ return { project, call: serviceCall(inv.deps, project.serviceUrl, project.token), tenantId: project.binding.tenantId, projectId: project.binding.projectId };
59832
+ }
59833
+ async function planned2(inv, method, path, body2, note) {
59834
+ const project = await offlineProject(inv.deps, "review");
59835
+ return planOutcome(inv.deps, dryRunPlan({ service: project.serviceUrl, requests: [{ method, path: path(project.binding.tenantId, project.binding.projectId), ...body2 === void 0 ? {} : { body: body2 }, ...note === void 0 ? {} : { note } }] }));
59836
+ }
59837
+ async function repositoryOf(inv) {
59838
+ const flag = textFlag(inv, "repo");
59839
+ if (flag !== void 0) {
59840
+ if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(flag)) throw new UsageError("--repo must be OWNER/NAME", { hint: "overlane review run 7 --repo acme/app" });
59841
+ return flag;
59842
+ }
59843
+ const remote = await inv.deps.exec("git", ["remote", "get-url", "origin"], { cwd: inv.deps.paths.cwd });
59844
+ const match = /github\.com[:/]([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+?)(?:\.git)?\s*$/.exec(remote.stdout.trim());
59845
+ if (remote.code !== 0 || match === null) throw new UsageError("could not read the repository from the origin remote", { hint: "overlane review run 7 --repo OWNER/NAME" });
59846
+ return `${match[1]}/${match[2]}`;
59847
+ }
59848
+ function id(inv, what) {
59849
+ const value = inv.positionals[0];
59850
+ if (value === void 0) throw new UsageError(`${what} needs a finding ID`, { hint: "overlane review findings" });
59851
+ return value;
59852
+ }
59853
+ var FINDING_LINE = (finding) => `${finding.status.padEnd(9)} ${finding.severity.padEnd(8)} ${finding.path}:${finding.line} ${finding.rule ?? "see reason"} ${finding.id}`;
59854
+ var reviewRunCommand = defineCommand({
59855
+ path: ["review", "run"],
59856
+ summary: "Review a GitHub pull request now and report the findings",
59857
+ description: "Runs the review service on a pull request: triage, review passes under the per-PR token cap, inline findings and one updated summary. Until the project owner enables comments (`overlane review settings set --mode comments`) the run is log-only and posts nothing. Pull request text and code are data, never instructions. Needs the GitHub App's pull-request access; without it the command says the live leg is pending.",
59858
+ args: [{ name: "pull", required: true, description: "The pull request number" }],
59859
+ flags: [{ name: "repo", type: "string", value: "OWNER/NAME", description: "The repository (default: the origin remote of this working copy)" }],
59860
+ examples: ["overlane review run 7", "overlane review run 7 --repo acme/app --dry-run"],
59861
+ effect: "write",
59862
+ ...common5,
59863
+ keywords: ["code review", "review pull request", "review pr", "ai review", "check my pr", "findings"],
59864
+ result: withDryRun(ReviewRunResponse),
59865
+ text: (d) => "run" in d ? [`${d.run.status} review of ${d.run.repository}#${d.run.pullNumber} (${d.run.mode}${d.run.posted ? ", posted" : ", nothing posted"}): ${d.run.findings.open} open, ${d.run.findings.fixed} fixed, ${d.run.findings.dismissed} dismissed.`, ...d.findings.filter((finding) => finding.status === "open").map(FINDING_LINE)] : [],
59866
+ handler: async (inv) => {
59867
+ const number4 = Number(inv.positionals[0]);
59868
+ if (!Number.isInteger(number4) || number4 < 1) throw new UsageError("run needs a pull request number", { hint: "overlane review run 7" });
59869
+ const repository = await repositoryOf(inv);
59870
+ const body2 = { requestId: requestId6(), trigger: "manual", source: { kind: "github", repository, number: number4 } };
59871
+ if (inv.dryRun) return planned2(inv, "POST", reviewPaths.runs, body2, "reads the pull request through the GitHub App and runs the review");
59872
+ const { call: call2, tenantId, projectId } = await connected2(inv);
59873
+ const result = await call2(ReviewRunResponse, "POST", reviewPaths.runs(tenantId, projectId), body2);
59874
+ if (result.run.status === "partial") say(inv.deps, "Partial review: the token cap was reached. The summary lists what was not covered.");
59875
+ return { data: result };
59876
+ }
59877
+ });
59878
+ var reviewStatusCommand = defineCommand({
59879
+ path: ["review", "status"],
59880
+ summary: "Show the review mode, recent runs and open findings",
59881
+ description: "Shows whether review posts comments or is log-only, the token cap, the latest runs and the number of open findings. States the data-use terms: diffs go to model providers only under terms that exclude training.",
59882
+ examples: ["overlane review status", "overlane review status --json"],
59883
+ effect: "read",
59884
+ ...common5,
59885
+ keywords: ["review mode", "log only", "review settings", "recent reviews", "how is review doing"],
59886
+ result: ReviewStatusResponse,
59887
+ text: (d) => [`Review mode: ${d.settings.mode}. Token cap per pull request: ${d.settings.tokenCap}. Open findings: ${d.openFindings}.`, d.settings.privacy, ...d.runs.slice(0, 5).map((run3) => `${run3.startedAt} ${run3.repository}#${run3.pullNumber} ${run3.status} ${run3.tokensUsed} tokens ${run3.model}`)],
59888
+ handler: async (inv) => {
59889
+ const { call: call2, tenantId, projectId } = await connected2(inv);
59890
+ return { data: await call2(ReviewStatusResponse, "GET", reviewPaths.status(tenantId, projectId)) };
59891
+ }
59892
+ });
59893
+ var reviewFindingsCommand = defineCommand({
59894
+ path: ["review", "findings"],
59895
+ summary: "List review findings, optionally for one pull request or status",
59896
+ description: "Lists findings tracked across pushes with their status (open, fixed, dismissed), severity, file and line, and the rule or reason.",
59897
+ flags: [
59898
+ { name: "pull", type: "string", value: "N", description: "Only this pull request number" },
59899
+ { name: "repo", type: "string", value: "OWNER/NAME", description: "Only this repository" },
59900
+ { name: "status", type: "string", enum: ["open", "fixed", "dismissed"], description: "Only findings with this status" }
59901
+ ],
59902
+ examples: ["overlane review findings --status open", "overlane review findings --pull 7 --json"],
59903
+ effect: "read",
59904
+ ...common5,
59905
+ keywords: ["list findings", "open comments", "review comments", "what did review find", "defects"],
59906
+ result: ReviewFindingsResponse,
59907
+ text: (d) => d.findings.length === 0 ? ["No findings."] : d.findings.map(FINDING_LINE),
59908
+ handler: async (inv) => {
59909
+ const { call: call2, tenantId, projectId } = await connected2(inv);
59910
+ const params = new URLSearchParams();
59911
+ for (const name2 of ["pull", "repo", "status"]) {
59912
+ const value = textFlag(inv, name2);
59913
+ if (value !== void 0) params.set(name2 === "repo" ? "repository" : name2, value);
59914
+ }
59915
+ const query = params.size === 0 ? "" : `?${params.toString()}`;
59916
+ return { data: await call2(ReviewFindingsResponse, "GET", `${reviewPaths.findings(tenantId, projectId)}${query}`) };
59917
+ }
59918
+ });
59919
+ var reviewDismissCommand = defineCommand({
59920
+ path: ["review", "dismiss"],
59921
+ summary: "Dismiss a finding, which teaches the reviewer",
59922
+ description: "Marks a finding dismissed so it is not raised again on this pull request. Repeated dismissals of the same rule become a learned rule held as team memory, and the reviewer stops reporting that rule until feedback changes. Use --accept to tell the reviewer a finding was right instead.",
59923
+ args: [{ name: "finding-id", required: true, description: "The finding to dismiss" }],
59924
+ flags: [
59925
+ { name: "accept", type: "boolean", description: "Record that the finding was right instead of dismissing it" },
59926
+ { name: "note", type: "string", value: "TEXT", description: "Why; kept with the feedback" }
59927
+ ],
59928
+ examples: ['overlane review dismiss fnd_1 --note "intended"', "overlane review dismiss fnd_2 --accept"],
59929
+ effect: "write",
59930
+ ...common5,
59931
+ keywords: ["dismiss finding", "ignore comment", "false positive", "accept finding", "teach reviewer", "feedback"],
59932
+ result: withDryRun(FeedbackResponse),
59933
+ text: (d) => "finding" in d ? [`${d.finding.id} is ${d.finding.status}.${d.learned === null ? "" : ` Learned: ${d.learned.direction} ${d.learned.rule} (${d.learned.evidence} reviews).`}`] : [],
59934
+ handler: async (inv) => {
59935
+ const findingId = id(inv, "dismiss");
59936
+ const note = textFlag(inv, "note");
59937
+ const body2 = { kind: inv.values["accept"] === true ? "accept" : "dismiss", ...note === void 0 ? {} : { note }, requestId: requestId6() };
59938
+ if (inv.dryRun) return planned2(inv, "POST", (tenantId2, projectId2) => reviewPaths.feedback(tenantId2, projectId2, findingId), body2);
59939
+ const { call: call2, tenantId, projectId } = await connected2(inv);
59940
+ return { data: await call2(FeedbackResponse, "POST", reviewPaths.feedback(tenantId, projectId, findingId), body2) };
59941
+ }
59942
+ });
59943
+ var reviewAutofixCommand = defineCommand({
59944
+ path: ["review", "autofix"],
59945
+ summary: "Create a fix task from a finding and optionally assign it",
59946
+ description: "Turns an open finding into a task whose scope is the finding's file and whose criteria say the finding no longer applies. The task text treats the finding as data. Repeating the command returns the same task.",
59947
+ args: [{ name: "finding-id", required: true, description: "The open finding to fix" }],
59948
+ flags: [{ name: "assign", type: "string", value: "AGENT", description: "The agent or bot to assign, for example agent:fixer" }],
59949
+ examples: ["overlane review autofix fnd_1", "overlane review autofix fnd_1 --assign agent:fixer --dry-run"],
59950
+ effect: "write",
59951
+ ...common5,
59952
+ keywords: ["auto fix", "autofix", "fix finding", "create task from finding", "assign to agent"],
59953
+ result: withDryRun(AutofixResponse),
59954
+ text: (d) => "taskId" in d ? [`Task ${d.taskId} created${d.assignee === null ? "" : ` for ${d.assignee}`}. Start it with: overlane task start ${d.taskId}`] : [],
59955
+ handler: async (inv) => {
59956
+ const findingId = id(inv, "autofix");
59957
+ const assignee = textFlag(inv, "assign");
59958
+ const body2 = { requestId: requestId6(), ...assignee === void 0 ? {} : { assignee } };
59959
+ if (inv.dryRun) return planned2(inv, "POST", (tenantId2, projectId2) => reviewPaths.autofix(tenantId2, projectId2, findingId), body2);
59960
+ const { call: call2, tenantId, projectId } = await connected2(inv);
59961
+ return { data: await call2(AutofixResponse, "POST", reviewPaths.autofix(tenantId, projectId, findingId), body2) };
59962
+ }
59963
+ });
59964
+ var reviewSettingsCommand = defineCommand({
59965
+ path: ["review", "settings"],
59966
+ summary: "Show the review settings, including the data-use terms",
59967
+ description: "Shows the mode (log-only until comments are enabled), the per-PR token cap, extra skip patterns and the statement that diffs go to model providers only under terms that exclude training.",
59968
+ examples: ["overlane review settings"],
59969
+ effect: "read",
59970
+ ...common5,
59971
+ keywords: ["review configuration", "token cap", "skip patterns", "privacy", "no training", "data use"],
59972
+ result: ReviewSettings,
59973
+ text: (d) => [`Mode: ${d.mode}. Token cap: ${d.tokenCap}. Extra skip patterns: ${d.skipPatterns.length === 0 ? "none" : d.skipPatterns.join(", ")}.`, d.privacy],
59974
+ handler: async (inv) => {
59975
+ const { call: call2, tenantId, projectId } = await connected2(inv);
59976
+ return { data: await call2(ReviewSettings, "GET", reviewPaths.settings(tenantId, projectId)) };
59977
+ }
59978
+ });
59979
+ var reviewSettingsSetCommand = defineCommand({
59980
+ path: ["review", "settings", "set"],
59981
+ summary: "Change the review mode, token cap or skip patterns",
59982
+ description: "Sets how review behaves for the project. Enabling comments (`--mode comments`) lets review post inline comments and the summary on GitHub; it is log-only until then. An agent or a person can change them; a read-only viewer cannot.",
59983
+ flags: [
59984
+ { name: "mode", type: "string", enum: ["log_only", "comments"], description: "log_only records findings only; comments posts them" },
59985
+ { name: "token-cap", type: "string", value: "N", description: "Most tokens one pull request may use (1,000 to 2,000,000)" },
59986
+ { name: "skip", type: "string", multiple: true, value: "GLOB", description: "A path pattern to skip in addition to generated and vendored paths; repeat for more" }
59987
+ ],
59988
+ examples: ["overlane review settings set --mode comments", "overlane review settings set --token-cap 40000 --skip 'docs/**' --dry-run"],
59989
+ effect: "write",
59990
+ ...common5,
59991
+ keywords: ["enable review comments", "turn on review", "log only", "set token cap", "skip files"],
59992
+ result: withDryRun(ReviewSettings),
59993
+ text: (d) => "mode" in d ? [`Review is ${d.mode}. Token cap ${d.tokenCap}.`] : [],
59994
+ handler: async (inv) => {
59995
+ const cap = textFlag(inv, "token-cap");
59996
+ const skip = inv.values["skip"];
59997
+ const parsed = UpdateReviewSettingsRequest.safeParse({
59998
+ ...textFlag(inv, "mode") === void 0 ? {} : { mode: textFlag(inv, "mode") },
59999
+ ...cap === void 0 ? {} : { tokenCap: Number(cap) },
60000
+ ...Array.isArray(skip) ? { skipPatterns: skip } : typeof skip === "string" ? { skipPatterns: [skip] } : {}
60001
+ });
60002
+ if (!parsed.success) throw new UsageError(parsed.error.issues.map((issue2) => issue2.message).join("; "), { hint: "overlane review settings set --mode comments" });
60003
+ if (Object.keys(parsed.data).length === 0) throw new UsageError("nothing to change", { hint: "overlane review settings set --mode comments" });
60004
+ if (inv.dryRun) return planned2(inv, "PUT", reviewPaths.settings, parsed.data);
60005
+ const { call: call2, tenantId, projectId } = await connected2(inv);
60006
+ return { data: await call2(ReviewSettings, "PUT", reviewPaths.settings(tenantId, projectId), parsed.data) };
60007
+ }
60008
+ });
60009
+ var codeMapStatusCommand = defineCommand({
60010
+ path: ["code-map", "status"],
60011
+ summary: "Show, per client, whether the code map is on and why",
60012
+ description: "Lists every supported client in its local and cloud setting, and the bots, review service, cross-repository questions and wiki, with whether the code map is on and the reason. The default for a setting follows the latest GATE-07 result for that setting: off for a local agent with grep (the local run failed, ADR 0018), on where there is no checkout until a re-run says otherwise.",
60013
+ examples: ["overlane code-map status", "overlane code-map status --json"],
60014
+ effect: "read",
60015
+ ...common5,
60016
+ keywords: ["code map", "code tools", "is the code map on", "gate-07", "code layer", "per client"],
60017
+ result: CodeMapStatus,
60018
+ text: (d) => d.clients.map((row) => `${row.on ? "on " : "off"} ${row.subject}: ${row.reason}`),
60019
+ handler: async (inv) => {
60020
+ const { call: call2, tenantId, projectId } = await connected2(inv);
60021
+ return { data: await call2(CodeMapStatus, "GET", codeMapPaths.status(tenantId, projectId)) };
60022
+ }
60023
+ });
60024
+ var reviewCommands = [reviewRunCommand, reviewStatusCommand, reviewFindingsCommand, reviewDismissCommand, reviewAutofixCommand, reviewSettingsCommand, reviewSettingsSetCommand, codeMapStatusCommand];
60025
+
58955
60026
  // ../cli/src/commands/discovery.ts
58956
60027
  init_zod();
58957
60028
 
@@ -59450,7 +60521,7 @@ async function disconnect(deps, options) {
59450
60521
  }
59451
60522
 
59452
60523
  // ../cli/src/doctor.ts
59453
- import { resolve as resolve7 } from "node:path";
60524
+ import { resolve as resolve8 } from "node:path";
59454
60525
  init_zod();
59455
60526
  var DoctorResult = external_exports.object({
59456
60527
  project: external_exports.object({ owner: external_exports.string(), name: external_exports.string(), root: external_exports.string() }),
@@ -59470,7 +60541,7 @@ async function doctor(deps, options) {
59470
60541
  const root = project.root;
59471
60542
  const binding = readBindingFile(root);
59472
60543
  const owned = readOwned(root);
59473
- const marketplaceRoot2 = resolve7(options.marketplaceRoot ?? owned?.marketplaceRoot ?? deps.paths.defaultMarketplaceRoot);
60544
+ const marketplaceRoot2 = resolve8(options.marketplaceRoot ?? owned?.marketplaceRoot ?? deps.paths.defaultMarketplaceRoot);
59474
60545
  const infos = await detectAgents(deps, options.agents, root);
59475
60546
  let service = "reachable";
59476
60547
  let hasToken = false;
@@ -59530,7 +60601,7 @@ async function doctor(deps, options) {
59530
60601
 
59531
60602
  // ../cli/src/kit/setup.ts
59532
60603
  init_src();
59533
- import { randomUUID as randomUUID5 } from "node:crypto";
60604
+ import { randomUUID as randomUUID7 } from "node:crypto";
59534
60605
  import { existsSync as existsSync5, readdirSync as readdirSync2 } from "node:fs";
59535
60606
  import { join as join22 } from "node:path";
59536
60607
 
@@ -59710,19 +60781,19 @@ async function connectKit(deps, options) {
59710
60781
  if (options.dryRun) {
59711
60782
  const inner = await connect(deps, { ...options, dryRun: true });
59712
60783
  say(deps, "Dry run: no file was written and no branch, commit or service change was made.");
59713
- const base3 = inner.data !== void 0 && "dryRun" in inner.data ? inner.data : dryRunPlan({});
60784
+ const base4 = inner.data !== void 0 && "dryRun" in inner.data ? inner.data : dryRunPlan({});
59714
60785
  const writes = [
59715
60786
  ...planExists ? [] : [{ path: `${PLAN_DIR}/`, action: "write", description: planSource }],
59716
60787
  ...workflow === null ? [] : [{ path: CI_FILE, action: "write", description: "CI workflow with pinned actions" }],
59717
60788
  ...blockChanges.map((entry) => ({ path: entry.file, action: entry.before === null ? "write" : "append", description: "the run-step block" })),
59718
- ...base3.writes
60789
+ ...base4.writes
59719
60790
  ];
59720
60791
  return {
59721
60792
  data: {
59722
- ...base3,
59723
- commands: [`git switch -c ${KIT_BRANCH}`, ...base3.commands, `git commit -m "Set up the project kit"`],
60793
+ ...base4,
60794
+ commands: [`git switch -c ${KIT_BRANCH}`, ...base4.commands, `git commit -m "Set up the project kit"`],
59724
60795
  writes,
59725
- notes: [...base3.notes, `Plan: ${planSource} (${summary.milestones} milestone(s), ${summary.tasks} task(s)); CI: ${ciSummary}; then the run policy is set, the plan synced and one pull request opened (or its commands printed).`]
60796
+ notes: [...base4.notes, `Plan: ${planSource} (${summary.milestones} milestone(s), ${summary.tasks} task(s)); CI: ${ciSummary}; then the run policy is set, the plan synced and one pull request opened (or its commands printed).`]
59726
60797
  }
59727
60798
  };
59728
60799
  }
@@ -59746,11 +60817,11 @@ async function connectKit(deps, options) {
59746
60817
  const agentConfig = [join22(".claude", "settings.json"), join22(".codex", "config.toml")];
59747
60818
  const preDirty = new Set(await dirty(deps, root, agentConfig));
59748
60819
  const preExisting = new Set(agentConfig.filter((file2) => existsSync5(join22(root, file2))));
59749
- const connected = await connect(deps, { ...options, yes: true });
59750
- if (connected.error !== void 0 || readBindingFile(root).kind !== "ok") {
60820
+ const connected3 = await connect(deps, { ...options, yes: true });
60821
+ if (connected3.error !== void 0 || readBindingFile(root).kind !== "ok") {
59751
60822
  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" });
59752
60823
  }
59753
- const connectData = connected.data !== void 0 && !("dryRun" in connected.data) ? connected.data : void 0;
60824
+ const connectData = connected3.data !== void 0 && !("dryRun" in connected3.data) ? connected3.data : void 0;
59754
60825
  for (const file2 of agentConfig) {
59755
60826
  if (!existsSync5(join22(root, file2)) || preDirty.has(file2) || preExisting.has(file2) && (await dirty(deps, root, [file2])).length === 0) continue;
59756
60827
  if ((await gitOut(deps, root, "check-ignore", "-q", "--", file2)).code === 0) continue;
@@ -59769,7 +60840,7 @@ async function connectKit(deps, options) {
59769
60840
  const kit = kitClient(deps, serviceUrl, binding.binding, token.token);
59770
60841
  await kit.putPolicy({ ...DEFAULT_RUN_POLICY, buildAheadLimit: firstMilestone });
59771
60842
  say(deps, `Run policy set (build-ahead limit ${firstMilestone}).`);
59772
- const synced = await kit.syncPlan(PlanSyncRequest.parse({ requestId: `cli-${randomUUID5()}`, sourceCommit: sha, plan: await readPlan(root) }));
60843
+ const synced = await kit.syncPlan(PlanSyncRequest.parse({ requestId: `cli-${randomUUID7()}`, sourceCommit: sha, plan: await readPlan(root) }));
59773
60844
  say(deps, `Plan synced: ${synced.created.length} created, ${synced.updated.length} updated, ${synced.unchanged.length} unchanged, ${synced.deferred.length} deferred.`);
59774
60845
  const pr = await openPullRequest(deps, root, repository.name);
59775
60846
  say(deps);
@@ -59834,7 +60905,7 @@ var connectCommand = defineCommand({
59834
60905
  keywords: ["setup", "install", "bind", "link", "onboard", "register plugin", "bootstrap", "autonomous", "plan", "kit", "get started", "initialise", "enable harness", "ci workflow", "pull request"],
59835
60906
  result: external_exports.union([ConnectAny, ConnectKitResult]),
59836
60907
  handler: async (inv) => {
59837
- const base3 = {
60908
+ const base4 = {
59838
60909
  service: textFlag(inv, "service"),
59839
60910
  marketplaceRoot: textFlag(inv, "marketplace-root"),
59840
60911
  agents: parseAgentList(textFlag(inv, "agents")),
@@ -59845,10 +60916,10 @@ var connectCommand = defineCommand({
59845
60916
  const goal = textFlag(inv, "goal");
59846
60917
  if (kit === void 0) {
59847
60918
  if (goal !== void 0) throw new UsageError("--goal belongs to --kit new", { hint: "overlane schema connect" });
59848
- return connect(inv.deps, base3);
60919
+ return connect(inv.deps, base4);
59849
60920
  }
59850
60921
  if (kit !== "existing" && kit !== "new") throw new UsageError("--kit must be existing or new");
59851
- return connectKit(inv.deps, { ...base3, mode: kit, goal });
60922
+ return connectKit(inv.deps, { ...base4, mode: kit, goal });
59852
60923
  }
59853
60924
  });
59854
60925
  var doctorCommand = defineCommand({
@@ -59917,7 +60988,7 @@ async function listReleases(deps) {
59917
60988
  record3.manifest.changeKinds.length === 0 ? "-" : record3.manifest.changeKinds.join(","),
59918
60989
  record3.manifest.restart,
59919
60990
  compatSummary(record3),
59920
- record3.pinnedBy.length === 0 ? "-" : record3.pinnedBy.map((id) => id === ctx.binding.projectId ? `${id} (this)` : id).join(",")
60991
+ record3.pinnedBy.length === 0 ? "-" : record3.pinnedBy.map((id2) => id2 === ctx.binding.projectId ? `${id2} (this)` : id2).join(",")
59921
60992
  ]);
59922
60993
  for (const line2 of table([header, ...rows])) say(deps, line2);
59923
60994
  return { data };
@@ -60053,7 +61124,7 @@ var ReleaseRollbackResult = external_exports.union([
60053
61124
  ]);
60054
61125
 
60055
61126
  // ../cli/src/commands/release.ts
60056
- var common4 = { needsAuth: true, needsNetwork: true };
61127
+ var common6 = { needsAuth: true, needsNetwork: true };
60057
61128
  var APPROVE = { name: "approve", type: "string", value: "DIGEST", description: "Approve this exact release digest when it changes executable files or policy" };
60058
61129
  var releaseListCommand = defineCommand({
60059
61130
  path: ["release", "list"],
@@ -60061,7 +61132,7 @@ var releaseListCommand = defineCommand({
60061
61132
  description: "Lists releases with version, short digest, channel, change kinds, restart rule, compatibility and which projects pin them.",
60062
61133
  examples: ["overlane release list"],
60063
61134
  effect: "read",
60064
- ...common4,
61135
+ ...common6,
60065
61136
  keywords: ["releases", "versions", "available", "published", "what versions", "all releases"],
60066
61137
  result: ReleaseListResult,
60067
61138
  handler: async (inv) => listReleases(inv.deps)
@@ -60072,7 +61143,7 @@ var releaseStatusCommand = defineCommand({
60072
61143
  description: `Compares the installed release (.harness/release.json) with the project binding and the service's pin, and lists approvals recorded on this machine. Works when the service is down (the pin then reads "unreachable").`,
60073
61144
  examples: ["overlane release status"],
60074
61145
  effect: "read",
60075
- ...common4,
61146
+ ...common6,
60076
61147
  keywords: ["installed", "version", "in sync", "update available", "which release", "pinned", "am i up to date", "current release"],
60077
61148
  result: ReleaseStatusResult,
60078
61149
  handler: async (inv) => releaseStatus(inv.deps)
@@ -60084,7 +61155,7 @@ var releaseUpdateCommand = defineCommand({
60084
61155
  flags: [{ name: "to", type: "string", value: "DIGEST", description: "Install this release instead of the project's pin" }, APPROVE],
60085
61156
  examples: ["overlane release update --dry-run", "overlane release update", "overlane release update --approve sha256:..."],
60086
61157
  effect: "write",
60087
- ...common4,
61158
+ ...common6,
60088
61159
  keywords: ["upgrade", "install release", "new version", "pull latest", "plugin update", "approve", "update plugin", "get newest"],
60089
61160
  result: ReleaseUpdateResult,
60090
61161
  handler: async (inv) => updateRelease(inv.deps, { to: textFlag(inv, "to"), approve: textFlag(inv, "approve"), dryRun: inv.dryRun })
@@ -60096,7 +61167,7 @@ var releaseRollbackCommand = defineCommand({
60096
61167
  flags: [APPROVE],
60097
61168
  examples: ["overlane release rollback --dry-run", "overlane release rollback --force"],
60098
61169
  effect: "destructive",
60099
- ...common4,
61170
+ ...common6,
60100
61171
  keywords: ["roll back", "revert", "undo update", "previous version", "downgrade", "go back", "restore", "undo release", "bad release"],
60101
61172
  result: ReleaseRollbackResult,
60102
61173
  handler: async (inv) => rollbackRelease(inv.deps, { approve: textFlag(inv, "approve"), dryRun: inv.dryRun })
@@ -60163,7 +61234,7 @@ var RunStatusResult = external_exports.object({
60163
61234
  var RunPolicyChangeResult = withDryRun(external_exports.object({ changed: external_exports.boolean(), policy: PolicyShape }));
60164
61235
 
60165
61236
  // ../cli/src/commands/run.ts
60166
- var common5 = { needsAuth: true, needsNetwork: true };
61237
+ var common7 = { needsAuth: true, needsNetwork: true };
60167
61238
  var EXECUTOR = { name: "executor", type: "string", enum: ["claude-code", "codex"], description: "Which agent this is (default: detected from the environment)" };
60168
61239
  var STOP_NOTE = "A stop (policy paused, a budget spent, nothing runnable) exits 6 with the reason in the error code and the exact `overlane run end --reason ...` as the hint.";
60169
61240
  var runStartCommand = defineCommand({
@@ -60173,7 +61244,7 @@ var runStartCommand = defineCommand({
60173
61244
  flags: [{ name: "trigger", type: "string", enum: ["schedule", "interactive", "event"], default: "interactive", description: "What started the run" }, EXECUTOR],
60174
61245
  examples: ["overlane run start --trigger schedule", "overlane run start --dry-run"],
60175
61246
  effect: "write",
60176
- ...common5,
61247
+ ...common7,
60177
61248
  keywords: ["begin run", "bounded step", "autonomous", "start working", "new run", "schedule", "kick off"],
60178
61249
  result: RunStartResult,
60179
61250
  handler: async (inv) => startRun(inv.deps, { trigger: textFlag(inv, "trigger"), executor: textFlag(inv, "executor"), dryRun: inv.dryRun })
@@ -60185,7 +61256,7 @@ var runNextCommand = defineCommand({
60185
61256
  flags: [EXECUTOR],
60186
61257
  examples: ["overlane run next"],
60187
61258
  effect: "read",
60188
- ...common5,
61259
+ ...common7,
60189
61260
  keywords: ["what should I work on next", "next task", "runnable", "what to do", "pick a task", "which task", "what's next", "work on", "what is next", "todo"],
60190
61261
  result: RunNextResult,
60191
61262
  handler: async (inv) => nextTask(inv.deps, { executor: textFlag(inv, "executor") })
@@ -60197,7 +61268,7 @@ var runClaimCommand = defineCommand({
60197
61268
  args: [{ name: "task-id", required: false, description: "The task to claim (default: the next runnable one)" }],
60198
61269
  examples: ["overlane run claim", "overlane run claim T003"],
60199
61270
  effect: "write",
60200
- ...common5,
61271
+ ...common7,
60201
61272
  keywords: ["take task", "lease task", "grab", "assign", "pick up task", "get a task"],
60202
61273
  result: RunClaimResult,
60203
61274
  handler: async (inv) => claimTask(inv.deps, { positionals: inv.positionals, dryRun: inv.dryRun })
@@ -60214,7 +61285,7 @@ var runDecideCommand = defineCommand({
60214
61285
  ],
60215
61286
  examples: ['overlane run decide --question "Which date library?" --decision "Use the built-in Intl" --evidence "package.json has no date library"'],
60216
61287
  effect: "write",
60217
- ...common5,
61288
+ ...common7,
60218
61289
  keywords: ["record decision", "question", "unblocked", "owner override", "judgement call", "log choice", "do not ask", "decide"],
60219
61290
  result: RunDecideResult,
60220
61291
  handler: async (inv) => decide(inv.deps, { question: textFlag(inv, "question"), decision: textFlag(inv, "decision"), evidence: listFlag(inv, "evidence"), task: textFlag(inv, "task"), dryRun: inv.dryRun })
@@ -60226,7 +61297,7 @@ var runEndCommand = defineCommand({
60226
61297
  flags: [{ name: "reason", type: "string", required: true, enum: RUN_STOP_REASONS, description: "Why the run ended" }],
60227
61298
  examples: ["overlane run end --reason nothing_runnable", "overlane run end --reason error"],
60228
61299
  effect: "write",
60229
- ...common5,
61300
+ ...common7,
60230
61301
  keywords: ["finish run", "stop", "wrap up", "close run", "release leases", "done with run", "end the run"],
60231
61302
  result: RunEndResult,
60232
61303
  handler: async (inv) => endRun(inv.deps, { reason: textFlag(inv, "reason"), dryRun: inv.dryRun })
@@ -60238,7 +61309,7 @@ var runStatusCommand = defineCommand({
60238
61309
  flags: [EXECUTOR],
60239
61310
  examples: ["overlane run status"],
60240
61311
  effect: "read",
60241
- ...common5,
61312
+ ...common7,
60242
61313
  keywords: ["policy", "budget", "limits", "how much left", "remaining", "state of run", "is it paused", "run policy"],
60243
61314
  result: RunStatusResult,
60244
61315
  handler: async (inv) => runStatus(inv.deps, { executor: textFlag(inv, "executor") })
@@ -60249,7 +61320,7 @@ var runPauseCommand = defineCommand({
60249
61320
  description: "Sets the project's run policy to paused. Every run then stops at its next check (`STOP paused`). Undo with `overlane run resume`. Safe to repeat.",
60250
61321
  examples: ["overlane run pause", "overlane run pause --dry-run"],
60251
61322
  effect: "write",
60252
- ...common5,
61323
+ ...common7,
60253
61324
  keywords: ["pause", "halt", "freeze", "stop all", "emergency brake", "disable autonomous runs", "policy", "no new runs", "stop agents", "turn off", "suspend"],
60254
61325
  result: RunPolicyChangeResult,
60255
61326
  handler: async (inv) => setPolicyStatus(inv.deps, "paused", inv.dryRun)
@@ -60260,7 +61331,7 @@ var runResumeCommand = defineCommand({
60260
61331
  description: "Sets the project's run policy back to active so runs can start and tasks can be claimed again. Safe to repeat.",
60261
61332
  examples: ["overlane run resume", "overlane run resume --dry-run"],
60262
61333
  effect: "write",
60263
- ...common5,
61334
+ ...common7,
60264
61335
  keywords: ["unpause", "re-enable", "continue autonomous", "reactivate", "policy active", "turn on", "restart runs", "lift the pause"],
60265
61336
  result: RunPolicyChangeResult,
60266
61337
  handler: async (inv) => setPolicyStatus(inv.deps, "active", inv.dryRun)
@@ -60270,7 +61341,7 @@ var runCommands = [runStartCommand, runNextCommand, runClaimCommand, runDecideCo
60270
61341
  // ../cli/src/task/queue.ts
60271
61342
  init_src();
60272
61343
  init_zod();
60273
- import { randomUUID as randomUUID6 } from "node:crypto";
61344
+ import { randomUUID as randomUUID8 } from "node:crypto";
60274
61345
  import { mkdirSync as mkdirSync8, renameSync as renameSync5, writeFileSync as writeFileSync7 } from "node:fs";
60275
61346
  import { dirname as dirname8, join as join23 } from "node:path";
60276
61347
  var TASK_POLICY_PATH = join23(".harness", "task-policy.json");
@@ -60290,7 +61361,7 @@ var TaskQueueResult = TaskQueue;
60290
61361
  var TaskPrioritiseResult = withDryRun(external_exports.object({ ...PrioritiseResult.shape, next: external_exports.string() }));
60291
61362
  var TaskPolicyResult = external_exports.object({ enforcement: TaskEnforcement, reason: external_exports.string().optional(), changedBy: external_exports.string().optional(), updatedAt: external_exports.string().optional(), localFile: external_exports.string() });
60292
61363
  var TaskPolicySetResult = withDryRun(TaskPolicyResult);
60293
- var requestId5 = () => `cli-${randomUUID6()}`;
61364
+ var requestId7 = () => `cli-${randomUUID8()}`;
60294
61365
  function priorityOf(value, fallback) {
60295
61366
  const parsed = TaskPriority.safeParse(value ?? fallback);
60296
61367
  if (!parsed.success) throw new UsageError(`--priority must be one of ${TASK_PRIORITIES.join(", ")}`);
@@ -60329,7 +61400,7 @@ async function prioritiseTask(deps, input2) {
60329
61400
  const name2 = detectExecutorName(deps.env);
60330
61401
  let request;
60331
61402
  try {
60332
- request = PrioritiseRequest.parse({ requestId: requestId5(), priority, top: input2.top, origin: name2 === "terminal" ? "user" : "agent", ...input2.reason === void 0 ? {} : { reason: input2.reason }, executor: executorFor(name2) });
61403
+ request = PrioritiseRequest.parse({ requestId: requestId7(), priority, top: input2.top, origin: name2 === "terminal" ? "user" : "agent", ...input2.reason === void 0 ? {} : { reason: input2.reason }, executor: executorFor(name2) });
60333
61404
  } catch (error62) {
60334
61405
  throw new UsageError(String(error62));
60335
61406
  }
@@ -60358,7 +61429,7 @@ async function newTask(deps, input2) {
60358
61429
  const begun = data;
60359
61430
  const project = await connectedProject(deps, "task");
60360
61431
  const name2 = detectExecutorName(deps.env);
60361
- const request = PrioritiseRequest.parse({ requestId: requestId5(), priority, top: input2.top, origin: name2 === "terminal" ? "user" : "agent", executor: executorFor(name2) });
61432
+ const request = PrioritiseRequest.parse({ requestId: requestId7(), priority, top: input2.top, origin: name2 === "terminal" ? "user" : "agent", executor: executorFor(name2) });
60362
61433
  try {
60363
61434
  const ranked = await serviceCall(deps, project.serviceUrl, project.token)(PrioritiseResult, "POST", taskQueuePaths.prioritise(project.binding.tenantId, project.binding.projectId, begun.taskId), request);
60364
61435
  say(deps, `Ranked ${begun.taskId} ${ranked.priority}${input2.top ? " (first)" : ""}.`);
@@ -60379,7 +61450,7 @@ async function setPolicy(deps, input2) {
60379
61450
  const enforcement = TaskEnforcement.safeParse(input2.enforcement);
60380
61451
  if (!enforcement.success) throw new UsageError(`set needs ${TASK_ENFORCEMENT.join(" or ")}`);
60381
61452
  const name2 = detectExecutorName(deps.env);
60382
- const parsed = SetTaskPolicyRequest.safeParse({ requestId: requestId5(), enforcement: enforcement.data, ...input2.reason === void 0 ? {} : { reason: input2.reason }, executor: executorFor(name2) });
61453
+ const parsed = SetTaskPolicyRequest.safeParse({ requestId: requestId7(), enforcement: enforcement.data, ...input2.reason === void 0 ? {} : { reason: input2.reason }, executor: executorFor(name2) });
60383
61454
  if (!parsed.success) throw new UsageError(parsed.error.issues.map((issue2) => issue2.message).join("; "));
60384
61455
  if (input2.dryRun) {
60385
61456
  const project2 = await offlineProject(deps, "task");
@@ -60406,7 +61477,7 @@ async function startExisting(deps, taskId, dryRun) {
60406
61477
  }
60407
61478
 
60408
61479
  // ../cli/src/commands/queue.ts
60409
- var common6 = { needsAuth: true, needsNetwork: true };
61480
+ var common8 = { needsAuth: true, needsNetwork: true };
60410
61481
  var PRIORITIES2 = ["P0", "P1", "P2", "P3"];
60411
61482
  var taskNewCommand = defineCommand({
60412
61483
  path: ["task", "new"],
@@ -60422,7 +61493,7 @@ var taskNewCommand = defineCommand({
60422
61493
  ],
60423
61494
  examples: ['overlane task new "Fix login redirect"', 'overlane task new "Hotfix the build" --priority P0 --top'],
60424
61495
  effect: "write",
60425
- ...common6,
61496
+ ...common8,
60426
61497
  keywords: ["new task", "create task", "no active task", "blocked no task", "start work", "need a task", "begin", "quick task"],
60427
61498
  result: TaskNewResult,
60428
61499
  handler: async (inv) => newTask(inv.deps, {
@@ -60441,7 +61512,7 @@ var taskNextCommand = defineCommand({
60441
61512
  description: "Picks the best ready or paused task: P0 before P3, then rank, then milestone and dependency order. When this working copy holds a task and the next one outranks it, says so (preempt) and prints the commands to checkpoint and switch; the preempted task comes back through this command afterwards.",
60442
61513
  examples: ["overlane task next"],
60443
61514
  effect: "read",
60444
- ...common6,
61515
+ ...common8,
60445
61516
  keywords: ["what next", "next task", "priority", "what should i work on", "pick work", "resume after", "queue"],
60446
61517
  result: TaskNextResult,
60447
61518
  handler: async (inv) => taskNext(inv.deps)
@@ -60452,7 +61523,7 @@ var taskQueueCommand = defineCommand({
60452
61523
  description: "Lists ready, running, paused and blocked tasks by priority, then rank, then plan order, with each task's priority.",
60453
61524
  examples: ["overlane task queue"],
60454
61525
  effect: "read",
60455
- ...common6,
61526
+ ...common8,
60456
61527
  keywords: ["priority list", "ranking", "order", "backlog", "what is queued", "p0"],
60457
61528
  result: TaskQueueResult,
60458
61529
  handler: async (inv) => taskQueue(inv.deps)
@@ -60469,7 +61540,7 @@ var taskPrioritiseCommand = defineCommand({
60469
61540
  ],
60470
61541
  examples: ["overlane task prioritise task-7 --priority P0 --top", 'overlane task prioritise task-9 --priority P2 --reason "user said later"'],
60471
61542
  effect: "write",
60472
- ...common6,
61543
+ ...common8,
60473
61544
  keywords: ["reprioritize", "reprioritise", "bump", "urgent", "move to top", "rank", "lower priority", "p0", "p1", "p2", "p3"],
60474
61545
  result: TaskPrioritiseResult,
60475
61546
  handler: async (inv) => prioritiseTask(inv.deps, { taskId: inv.positionals[0], priority: textFlag(inv, "priority"), top: boolFlag(inv, "top"), reason: textFlag(inv, "reason"), dryRun: inv.dryRun })
@@ -60480,7 +61551,7 @@ var taskPolicyCommand = defineCommand({
60480
61551
  description: "Reads the project's task requirement (default `required`: edits and mutating shell commands are refused without an active task) and writes it to .harness/task-policy.json for the hooks.",
60481
61552
  examples: ["overlane task policy"],
60482
61553
  effect: "read",
60483
- ...common6,
61554
+ ...common8,
60484
61555
  keywords: ["enforcement", "require task", "task gate", "relax", "blocked", "policy"],
60485
61556
  result: TaskPolicyResult,
60486
61557
  handler: async (inv) => showPolicy2(inv.deps)
@@ -60493,7 +61564,7 @@ var taskPolicySetCommand = defineCommand({
60493
61564
  flags: [{ name: "reason", type: "string", value: "TEXT", description: "Why the rule is relaxed (required for relaxed)" }],
60494
61565
  examples: ["overlane task policy set required", 'overlane task policy set relaxed --reason "docs-only repository"'],
60495
61566
  effect: "write",
60496
- ...common6,
61567
+ ...common8,
60497
61568
  keywords: ["relax", "turn off task requirement", "require tasks", "allow edits without task", "enforcement"],
60498
61569
  result: TaskPolicySetResult,
60499
61570
  handler: async (inv) => setPolicy(inv.deps, { enforcement: inv.positionals[0], reason: textFlag(inv, "reason"), dryRun: inv.dryRun })
@@ -60538,14 +61609,14 @@ var TaskHandoffResult = withDryRun(
60538
61609
  );
60539
61610
 
60540
61611
  // ../cli/src/commands/task.ts
60541
- var common7 = { needsAuth: true, needsNetwork: true };
61612
+ var common9 = { needsAuth: true, needsNetwork: true };
60542
61613
  var taskListCommand = defineCommand({
60543
61614
  path: ["task", "list"],
60544
61615
  summary: "List the project's tasks and their states",
60545
61616
  description: "Lists every task of the connected project with its state, pause reason, version, lease holder, checks and latest checkpoint.",
60546
61617
  examples: ["overlane task list"],
60547
61618
  effect: "read",
60548
- ...common7,
61619
+ ...common9,
60549
61620
  keywords: ["tasks", "show all tasks", "see tasks", "backlog", "what tasks exist", "work items"],
60550
61621
  result: TaskListResult,
60551
61622
  handler: async (inv) => listTasks(inv.deps)
@@ -60563,7 +61634,7 @@ var taskStartCommand = defineCommand({
60563
61634
  ],
60564
61635
  examples: ["overlane task start task-7", 'overlane task start --outcome "Add CSV export" --criterion "export works" --check unit_tests:L2 --path "src/**"', 'overlane task start --outcome "Fix login" --criterion "login passes" --path "src/auth/**" --dry-run'],
60565
61636
  effect: "write",
60566
- ...common7,
61637
+ ...common9,
60567
61638
  keywords: ["begin", "create task", "new task", "open", "claim new", "work item", "contract", "acceptance criteria", "start working"],
60568
61639
  result: TaskStartResult,
60569
61640
  handler: async (inv) => inv.positionals[0] !== void 0 ? startExisting(inv.deps, inv.positionals[0], inv.dryRun) : startTask(inv.deps, { outcome: textFlag(inv, "outcome"), criteria: listFlag(inv, "criterion"), paths: listFlag(inv, "path"), checks: listFlag(inv, "check"), dryRun: inv.dryRun })
@@ -60574,7 +61645,7 @@ var taskStatusCommand = defineCommand({
60574
61645
  description: "Shows the held task from the service: state, lease, acceptance criteria, checks, evidence count and the latest checkpoint. Says so when nothing is held or the lease was lost.",
60575
61646
  examples: ["overlane task status"],
60576
61647
  effect: "read",
60577
- ...common7,
61648
+ ...common9,
60578
61649
  keywords: ["current task", "what am i working on", "lease", "active task", "progress", "held task"],
60579
61650
  result: TaskStatusResult,
60580
61651
  handler: async (inv) => taskStatus(inv.deps)
@@ -60590,7 +61661,7 @@ var taskCheckpointCommand = defineCommand({
60590
61661
  ],
60591
61662
  examples: ['overlane task checkpoint --summary "Parser done" --next "Write the tests"', 'overlane task checkpoint --summary "Out of budget" --next "Resume" --pause quota'],
60592
61663
  effect: "write",
60593
- ...common7,
61664
+ ...common9,
60594
61665
  keywords: ["save", "progress", "pause", "stop work", "park", "quota", "limit reached", "remember place", "snapshot", "save state", "out of budget"],
60595
61666
  result: TaskCheckpointResult,
60596
61667
  handler: async (inv) => checkpointTask(inv.deps, { summary: textFlag(inv, "summary"), next: textFlag(inv, "next"), pause: textFlag(inv, "pause"), dryRun: inv.dryRun })
@@ -60602,7 +61673,7 @@ var taskResumeCommand = defineCommand({
60602
61673
  args: [{ name: "task-id", required: true, description: "The task to resume" }],
60603
61674
  examples: ["overlane task resume task-1"],
60604
61675
  effect: "write",
60605
- ...common7,
61676
+ ...common9,
60606
61677
  keywords: ["continue", "pick up", "restart", "reclaim", "after pause", "take over", "carry on"],
60607
61678
  result: TaskResumeResult,
60608
61679
  handler: async (inv) => resumeTask(inv.deps, { taskId: inv.positionals[0], dryRun: inv.dryRun })
@@ -60613,7 +61684,7 @@ var taskSubmitCommand = defineCommand({
60613
61684
  description: "Asks for verification at HEAD. The task is verified only when evidence at or above each required check's level exists for that commit: L2 comes from CI on the pushed commit, L1 from `overlane task evidence`.",
60614
61685
  examples: ["overlane task submit", "overlane task submit --dry-run"],
60615
61686
  effect: "write",
60616
- ...common7,
61687
+ ...common9,
60617
61688
  keywords: ["finish", "done", "complete", "verify", "ready for review", "request verification", "hand in", "turn in"],
60618
61689
  result: TaskSubmitResult,
60619
61690
  handler: async (inv) => submitTask(inv.deps, { dryRun: inv.dryRun })
@@ -60629,7 +61700,7 @@ var taskEvidenceCommand = defineCommand({
60629
61700
  ],
60630
61701
  examples: ["overlane task evidence --level L1 -- pnpm test"],
60631
61702
  effect: "write",
60632
- ...common7,
61703
+ ...common9,
60633
61704
  keywords: ["tests", "prove", "record test result", "verification", "run checks", "L1", "attest", "run the tests and record"],
60634
61705
  result: TaskEvidenceResult,
60635
61706
  handler: async (inv) => recordEvidence(inv.deps, { level: textFlag(inv, "level"), task: textFlag(inv, "task"), words: inv.positionals, dryRun: inv.dryRun })
@@ -60645,7 +61716,7 @@ var taskHandoffCommand = defineCommand({
60645
61716
  ],
60646
61717
  examples: ["overlane task handoff --to codex", 'overlane task handoff --to claude --summary "API done" --next "Add tests"'],
60647
61718
  effect: "write",
60648
- ...common7,
61719
+ ...common9,
60649
61720
  keywords: ["hand off", "transfer", "give to", "switch agent", "other agent", "codex", "claude", "pass the task", "delegate", "move work", "swap agents"],
60650
61721
  result: TaskHandoffResult,
60651
61722
  handler: async (inv) => handoffTask(inv.deps, { summary: textFlag(inv, "summary"), next: textFlag(inv, "next"), to: textFlag(inv, "to"), dryRun: inv.dryRun })
@@ -60673,7 +61744,9 @@ function coreCommands() {
60673
61744
  ...viewCommands,
60674
61745
  ...loopCommands,
60675
61746
  clientInstallCommand,
60676
- ...memoryCommands
61747
+ ...memoryCommands,
61748
+ ...reviewCommands,
61749
+ ...guardCommands
60677
61750
  ];
60678
61751
  }
60679
61752
  function createRegistry(extra = []) {
@@ -60896,22 +61969,22 @@ import { join as join27 } from "node:path";
60896
61969
  function dataDir(env = process.env, home = homedir()) {
60897
61970
  const override = env["MVRX_DATA_DIR"];
60898
61971
  if (override !== void 0 && override !== "") return override;
60899
- const base3 = env["XDG_DATA_HOME"] ?? (process.platform === "win32" ? env["LOCALAPPDATA"] : void 0) ?? (process.platform === "darwin" ? join27(home, "Library", "Application Support") : join27(home, ".local", "share"));
60900
- return join27(base3, "mvrx-harness");
61972
+ const base4 = env["XDG_DATA_HOME"] ?? (process.platform === "win32" ? env["LOCALAPPDATA"] : void 0) ?? (process.platform === "darwin" ? join27(home, "Library", "Application Support") : join27(home, ".local", "share"));
61973
+ return join27(base4, "mvrx-harness");
60901
61974
  }
60902
61975
  function marketplaceRoot(env = process.env, home = homedir()) {
60903
61976
  return join27(dataDir(env, home), "marketplace");
60904
61977
  }
60905
61978
 
60906
61979
  // src/plugin.ts
60907
- import { readFileSync as readFileSync9 } from "node:fs";
61980
+ import { readFileSync as readFileSync10 } from "node:fs";
60908
61981
  import { join as join29 } from "node:path";
60909
61982
  import { parseArgs as parseArgs3 } from "node:util";
60910
61983
 
60911
61984
  // src/marketplace.ts
60912
61985
  init_src();
60913
61986
  import { createHash as createHash7 } from "node:crypto";
60914
- import { cpSync, existsSync as existsSync6, mkdirSync as mkdirSync9, readdirSync as readdirSync3, readFileSync as readFileSync8, renameSync as renameSync6, rmSync as rmSync4, statSync, writeFileSync as writeFileSync8 } from "node:fs";
61987
+ import { cpSync, existsSync as existsSync6, mkdirSync as mkdirSync9, readdirSync as readdirSync3, readFileSync as readFileSync9, renameSync as renameSync6, rmSync as rmSync4, statSync, writeFileSync as writeFileSync8 } from "node:fs";
60915
61988
  import { dirname as dirname9, join as join28, relative as relative2, sep } from "node:path";
60916
61989
  var CLIENT_DIRS = ["claude", "codex"];
60917
61990
  var EMBEDDED_MANIFEST = "release-manifest.json";
@@ -60922,7 +61995,7 @@ function loadEmbedded(packageRoot2) {
60922
61995
  const dir = join28(packageRoot2, "plugins");
60923
61996
  const path = join28(dir, EMBEDDED_MANIFEST);
60924
61997
  if (!existsSync6(path)) throw new MarketplaceError(`this package has no embedded plugin release (${path} is missing)`);
60925
- const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync8(path, "utf8")));
61998
+ const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync9(path, "utf8")));
60926
61999
  if (!parsed.success) throw new MarketplaceError(`the embedded release manifest is invalid: ${parsed.error.message}`);
60927
62000
  return { dir, manifest: parsed.data };
60928
62001
  }
@@ -60950,7 +62023,7 @@ async function verifyTree(treeRoot, manifest) {
60950
62023
  problems.push(`missing: ${file2.path}`);
60951
62024
  continue;
60952
62025
  }
60953
- if (sha2562(readFileSync8(path)) !== file2.digest) problems.push(`modified: ${file2.path}`);
62026
+ if (sha2562(readFileSync9(path)) !== file2.digest) problems.push(`modified: ${file2.path}`);
60954
62027
  }
60955
62028
  for (const client of CLIENT_DIRS) {
60956
62029
  for (const found of listFiles(join28(treeRoot, client))) {
@@ -60961,7 +62034,7 @@ async function verifyTree(treeRoot, manifest) {
60961
62034
  }
60962
62035
  function readInstalledManifest(target) {
60963
62036
  try {
60964
- const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync8(join28(target, INSTALLED_MANIFEST), "utf8")));
62037
+ const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync9(join28(target, INSTALLED_MANIFEST), "utf8")));
60965
62038
  return parsed.success ? parsed.data : null;
60966
62039
  } catch {
60967
62040
  return null;
@@ -61025,7 +62098,7 @@ var PluginUsageError = class extends Error {
61025
62098
  };
61026
62099
  function readNames(treeRoot, client) {
61027
62100
  const file2 = client === "claude" ? join29(treeRoot, "claude", ".claude-plugin", "marketplace.json") : join29(treeRoot, "codex", ".agents", "plugins", "marketplace.json");
61028
- const parsed = JSON.parse(readFileSync9(file2, "utf8"));
62101
+ const parsed = JSON.parse(readFileSync10(file2, "utf8"));
61029
62102
  const record3 = parsed;
61030
62103
  const plugin = record3.plugins?.[0]?.name;
61031
62104
  if (typeof record3.name !== "string" || typeof plugin !== "string") throw new MarketplaceError(`${file2} names no marketplace or plugin`);
@@ -61297,8 +62370,8 @@ async function confirm(question) {
61297
62370
  }
61298
62371
  }
61299
62372
  function configDir2(env) {
61300
- const base3 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join32(homedir3(), ".config");
61301
- return join32(base3, "mvrx-harness");
62373
+ const base4 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join32(homedir3(), ".config");
62374
+ return join32(base4, "mvrx-harness");
61302
62375
  }
61303
62376
  function createDeps2(env = process.env) {
61304
62377
  return {