@akasecurity/ai-tc-codex 0.9.23 → 0.9.24

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.
@@ -884,7 +884,7 @@ var require_ignore = __commonJS({
884
884
  });
885
885
 
886
886
  // src/hooks/session-start.ts
887
- import { readFileSync as readFileSync32 } from "fs";
887
+ import { readFileSync as readFileSync30 } from "fs";
888
888
 
889
889
  // ../../packages/schema/src/drizzle/deferred-migrations.ts
890
890
  var DEFERRED_MIGRATION_TAGS = [
@@ -9662,7 +9662,11 @@ var ListFindingTypesQuery = object({
9662
9662
  // and so is not bounded by what any page happens to hold.
9663
9663
  includeId: string2().optional(),
9664
9664
  limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
9665
- cursor: string2().optional()
9665
+ cursor: string2().optional(),
9666
+ // A row position to read from, for jumping to a page instead of stepping to
9667
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
9668
+ // from wherever it lands.
9669
+ offset: coerce_exports.number().int().min(0).optional()
9666
9670
  });
9667
9671
  var ListFindingTypesResponse = object({
9668
9672
  totals: object({
@@ -9743,7 +9747,11 @@ var ListFindingInstancesQuery = object({
9743
9747
  sessionId: string2().optional(),
9744
9748
  from: iso_exports.datetime().optional(),
9745
9749
  limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
9746
- cursor: string2().optional()
9750
+ cursor: string2().optional(),
9751
+ // A row position to read from, for jumping to a page instead of stepping to
9752
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
9753
+ // from wherever it lands.
9754
+ offset: coerce_exports.number().int().min(0).optional()
9747
9755
  });
9748
9756
  var ListFindingInstancesResponse = object({
9749
9757
  // Instances matching the filters across the whole scope, not just this
@@ -9815,7 +9823,11 @@ var ListFindingLocationsQuery = object({
9815
9823
  // rather than a deep-link corner. Never affects totals, facets or the cursor.
9816
9824
  includeId: string2().optional(),
9817
9825
  limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
9818
- cursor: string2().optional()
9826
+ cursor: string2().optional(),
9827
+ // A row position to read from, for jumping to a page instead of stepping to
9828
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
9829
+ // from wherever it lands.
9830
+ offset: coerce_exports.number().int().min(0).optional()
9819
9831
  });
9820
9832
  var ListFindingLocationsResponse = object({
9821
9833
  totals: object({
@@ -12447,7 +12459,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
12447
12459
  var ListVaultInventoryQuery = object({
12448
12460
  limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
12449
12461
  // Opaque; names the last row of the page just served.
12450
- cursor: string2().optional()
12462
+ cursor: string2().optional(),
12463
+ // A row position to read from, for jumping to a page instead of stepping to
12464
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
12465
+ // from wherever it lands.
12466
+ offset: coerce_exports.number().int().min(0).optional()
12451
12467
  });
12452
12468
  var ListVaultInventoryResponse = object({
12453
12469
  // Vaulted values across the whole store, not just this page — cursor-
@@ -12459,7 +12475,11 @@ var ListVaultInventoryResponse = object({
12459
12475
  });
12460
12476
  var ListVaultReuseQuery = object({
12461
12477
  limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
12462
- cursor: string2().optional()
12478
+ cursor: string2().optional(),
12479
+ // A row position to read from, for jumping to a page instead of stepping to
12480
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
12481
+ // from wherever it lands.
12482
+ offset: coerce_exports.number().int().min(0).optional()
12463
12483
  });
12464
12484
  var ListVaultReuseResponse = object({
12465
12485
  // Reused values across the whole store — the number the section's claim
@@ -12475,9 +12495,15 @@ var ListVaultDerefsQuery = object({
12475
12495
  // over a Server Action, which preserves the type, never as a URL param.
12476
12496
  includeBatched: boolean2().optional(),
12477
12497
  limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
12478
- cursor: string2().optional()
12498
+ cursor: string2().optional(),
12499
+ // A row position to read from, for jumping to a page instead of stepping to
12500
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
12501
+ // from wherever it lands.
12502
+ offset: coerce_exports.number().int().min(0).optional()
12479
12503
  });
12480
12504
  var ListVaultDerefsResponse = object({
12505
+ // Rows this filter selects across the whole trail, not just this page.
12506
+ totals: object({ derefs: number2().int().nonnegative() }),
12481
12507
  items: array(VaultDeref),
12482
12508
  nextCursor: string2().nullable(),
12483
12509
  // Display/view-render rows the query hid, over the WHOLE trail rather than
@@ -21543,7 +21569,7 @@ var SqliteFindingsRepository = class {
21543
21569
  };
21544
21570
  const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
21545
21571
  const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
21546
- const start = cursor === null ? 0 : firstAfter(sorted, cursor);
21572
+ const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
21547
21573
  const page = sorted.slice(start, start + limit);
21548
21574
  const lastOnPage = page.at(-1);
21549
21575
  const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
@@ -21637,7 +21663,7 @@ var SqliteFindingsRepository = class {
21637
21663
  accumulator.add(row);
21638
21664
  if (!matchesInstanceFilters(row, opts)) continue;
21639
21665
  total += 1;
21640
- if (!isPastCursor(row)) continue;
21666
+ if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
21641
21667
  if (items.length < limit) {
21642
21668
  items.push(toInstanceDetail(row));
21643
21669
  last = row;
@@ -21726,7 +21752,7 @@ var SqliteFindingsRepository = class {
21726
21752
  }
21727
21753
  }
21728
21754
  sorted.sort(compareLocationOrder);
21729
- const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
21755
+ const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
21730
21756
  const page = sorted.slice(start, start + limit);
21731
21757
  const lastOnPage = page.at(-1);
21732
21758
  const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
@@ -24354,6 +24380,9 @@ function pageLimit(requested, fallback) {
24354
24380
  if (requested === void 0) return fallback;
24355
24381
  return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
24356
24382
  }
24383
+ function pageOffset(requested) {
24384
+ return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
24385
+ }
24357
24386
  function encodeReuseCursor(payload) {
24358
24387
  return Buffer.from(JSON.stringify(payload)).toString("base64url");
24359
24388
  }
@@ -24701,7 +24730,8 @@ var SqliteSecretVaultRepository = class {
24701
24730
  */
24702
24731
  listInventory(query = {}, now = Date.now()) {
24703
24732
  const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
24704
- const cursor = query.cursor === void 0 ? null : decodeKeysetCursor(query.cursor);
24733
+ const offset = pageOffset(query.offset);
24734
+ const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
24705
24735
  const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
24706
24736
  const rows = allRows(
24707
24737
  this.db.prepare(
@@ -24715,11 +24745,12 @@ var SqliteSecretVaultRepository = class {
24715
24745
  FROM secret_vault v
24716
24746
  ${where}
24717
24747
  ORDER BY v.last_seen DESC, v.pointer_id DESC
24718
- LIMIT :limit`
24748
+ LIMIT :limit OFFSET :offset`
24719
24749
  ),
24720
24750
  bindParams({
24721
24751
  now,
24722
24752
  limit: limit + 1,
24753
+ offset,
24723
24754
  ...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
24724
24755
  })
24725
24756
  );
@@ -24743,7 +24774,8 @@ var SqliteSecretVaultRepository = class {
24743
24774
  */
24744
24775
  listReuse(query = {}, now = Date.now()) {
24745
24776
  const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
24746
- const cursor = query.cursor === void 0 ? null : decodeReuseCursor(query.cursor);
24777
+ const offset = pageOffset(query.offset);
24778
+ const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
24747
24779
  const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
24748
24780
  OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
24749
24781
  const rows = allRows(
@@ -24758,11 +24790,12 @@ var SqliteSecretVaultRepository = class {
24758
24790
  FROM secret_vault v
24759
24791
  WHERE ${REUSED_PREDICATE} ${after}
24760
24792
  ORDER BY v.occurrence_count DESC, v.pointer_id DESC
24761
- LIMIT :limit`
24793
+ LIMIT :limit OFFSET :offset`
24762
24794
  ),
24763
24795
  bindParams({
24764
24796
  now,
24765
24797
  limit: limit + 1,
24798
+ offset,
24766
24799
  ...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
24767
24800
  })
24768
24801
  );
@@ -24787,7 +24820,8 @@ var SqliteSecretVaultRepository = class {
24787
24820
  */
24788
24821
  listDerefs(query = {}) {
24789
24822
  const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
24790
- const cursor = query.cursor === void 0 ? null : decodeKeysetCursor(query.cursor);
24823
+ const offset = pageOffset(query.offset);
24824
+ const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
24791
24825
  const conditions = [];
24792
24826
  if (query.includeBatched !== true) {
24793
24827
  conditions.push(`reason NOT IN ('display', 'view-render')`);
@@ -24800,21 +24834,28 @@ var SqliteSecretVaultRepository = class {
24800
24834
  this.db.prepare(
24801
24835
  `SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
24802
24836
  FROM secret_vault_deref ${where}
24803
- ORDER BY at DESC, id DESC LIMIT :limit`
24837
+ ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
24804
24838
  ),
24805
24839
  bindParams({
24806
24840
  limit: limit + 1,
24841
+ offset,
24807
24842
  ...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
24808
24843
  })
24809
24844
  );
24810
24845
  const hasMore = rows.length > limit;
24811
24846
  const page = hasMore ? rows.slice(0, limit) : rows;
24812
24847
  const last = page[page.length - 1];
24813
- const hiddenBatched = query.includeBatched === true ? 0 : countScalar(
24814
- this.db,
24815
- `SELECT count(*) AS n FROM secret_vault_deref WHERE reason IN ('display', 'view-render')`
24816
- );
24848
+ const counts = getRow(
24849
+ this.db.prepare(
24850
+ `SELECT count(*) AS total,
24851
+ count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
24852
+ FROM secret_vault_deref`
24853
+ )
24854
+ ) ?? { total: 0, hidden: 0 };
24855
+ const includeBatched = query.includeBatched === true;
24856
+ const hiddenBatched = includeBatched ? 0 : counts.hidden;
24817
24857
  return {
24858
+ totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
24818
24859
  items: page.map((r) => ({
24819
24860
  id: r.id,
24820
24861
  pointerId: r.pointer_id,
@@ -31794,7 +31835,7 @@ function resolveProviderSafe(resolveProviderFn) {
31794
31835
  }
31795
31836
 
31796
31837
  // ../../packages/plugin-sdk/src/config-inventory.ts
31797
- import { readdirSync as readdirSync3, readFileSync as readFileSync17, realpathSync as realpathSync2, statSync as statSync8 } from "fs";
31838
+ import { readdirSync as readdirSync3, realpathSync as realpathSync2, statSync as statSync8 } from "fs";
31798
31839
  import { homedir as homedir3 } from "os";
31799
31840
  import { basename as basename4, join as join25, resolve as resolve3 } from "path";
31800
31841
 
@@ -32167,8 +32208,25 @@ function maskText(text2) {
32167
32208
  return scanText2(text2).masked;
32168
32209
  }
32169
32210
 
32211
+ // ../../packages/plugin-sdk/src/regular-file.ts
32212
+ import { closeSync as closeSync2, constants, fstatSync, openSync as openSync2, readFileSync as readFileSync16 } from "fs";
32213
+ function notRegularFile(path) {
32214
+ return `not a regular file: ${path}`;
32215
+ }
32216
+ function readRegularFile(path, maxBytes) {
32217
+ const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK);
32218
+ try {
32219
+ const stat2 = fstatSync(fd);
32220
+ if (!stat2.isFile()) throw new Error(notRegularFile(path));
32221
+ if (maxBytes !== void 0 && stat2.size > maxBytes) throw new Error(`file too large: ${path}`);
32222
+ return readFileSync16(fd, "utf8");
32223
+ } finally {
32224
+ closeSync2(fd);
32225
+ }
32226
+ }
32227
+
32170
32228
  // ../../packages/plugin-sdk/src/repo.ts
32171
- import { existsSync as existsSync9, readFileSync as readFileSync16, statSync as statSync7 } from "fs";
32229
+ import { existsSync as existsSync9, statSync as statSync7 } from "fs";
32172
32230
  import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
32173
32231
  function remoteWithoutCredentials(remote) {
32174
32232
  const withoutInfo = withoutUserinfo(remote);
@@ -32339,9 +32397,10 @@ function resolveGitContext(root) {
32339
32397
  const headRoot = basename3(commonGitDir) === ".git" ? dirname5(commonGitDir) : root;
32340
32398
  return { configPath: join24(commonGitDir, "config"), headRoot };
32341
32399
  }
32400
+ var MAX_GIT_METADATA_BYTES = 1024 * 1024;
32342
32401
  function safeRead(path) {
32343
32402
  try {
32344
- return readFileSync16(path, "utf8");
32403
+ return readRegularFile(path, MAX_GIT_METADATA_BYTES);
32345
32404
  } catch {
32346
32405
  return void 0;
32347
32406
  }
@@ -32632,9 +32691,13 @@ function collectConfigFiles(scan2, claudeDir, cwd) {
32632
32691
  dirConfigFile(scan2, join25(cwd, ".claude", "commands"), "Slash commands", "command");
32633
32692
  dirConfigFile(scan2, join25(cwd, ".claude", "agents"), "Subagents", "subagent");
32634
32693
  }
32635
- function configFileEntry(scan2, path, scope, kind) {
32694
+ function configFileEntry(scan2, path, scope, kind, nonFile) {
32636
32695
  try {
32637
32696
  const stat2 = statSync8(path);
32697
+ if (nonFile !== "keep" && !stat2.isFile()) {
32698
+ if (nonFile === "report") scan2.errors.push({ source: path, reason: notRegularFile(path) });
32699
+ return void 0;
32700
+ }
32638
32701
  return { name: basename4(path), path, scope, kind, updatedAt: stat2.mtime.toISOString() };
32639
32702
  } catch (err) {
32640
32703
  if (!isAbsent(err)) scan2.errors.push({ source: path, reason: message(err) });
@@ -32642,7 +32705,7 @@ function configFileEntry(scan2, path, scope, kind) {
32642
32705
  }
32643
32706
  }
32644
32707
  function settingsConfigFile(scan2, path, scope, kind) {
32645
- const entry = configFileEntry(scan2, path, scope, kind);
32708
+ const entry = configFileEntry(scan2, path, scope, kind, "skip");
32646
32709
  if (!entry) return;
32647
32710
  const raw = readOptional(scan2, path, false);
32648
32711
  if (raw !== void 0) {
@@ -32660,7 +32723,7 @@ function settingsConfigFile(scan2, path, scope, kind) {
32660
32723
  scan2.configFiles.push(entry);
32661
32724
  }
32662
32725
  function memoryConfigFile(scan2, path, scope, kind) {
32663
- const entry = configFileEntry(scan2, path, scope, kind);
32726
+ const entry = configFileEntry(scan2, path, scope, kind, "report");
32664
32727
  if (!entry) return;
32665
32728
  const raw = readOptional(scan2, path);
32666
32729
  if (raw !== void 0) {
@@ -32671,7 +32734,7 @@ function memoryConfigFile(scan2, path, scope, kind) {
32671
32734
  scan2.configFiles.push(entry);
32672
32735
  }
32673
32736
  function mcpJsonConfigFile(scan2, path) {
32674
- const entry = configFileEntry(scan2, path, "project", "MCP servers");
32737
+ const entry = configFileEntry(scan2, path, "project", "MCP servers", "skip");
32675
32738
  if (!entry) return;
32676
32739
  const raw = readOptional(scan2, path, false);
32677
32740
  if (raw !== void 0) {
@@ -32691,7 +32754,7 @@ function mcpJsonConfigFile(scan2, path) {
32691
32754
  scan2.configFiles.push(entry);
32692
32755
  }
32693
32756
  function dirConfigFile(scan2, path, kind, noun) {
32694
- const entry = configFileEntry(scan2, path, "project", kind);
32757
+ const entry = configFileEntry(scan2, path, "project", kind, "keep");
32695
32758
  if (!entry) return;
32696
32759
  try {
32697
32760
  const count = countMarkdownFiles(path, 0);
@@ -32887,7 +32950,7 @@ function dedupeMcpServers(servers) {
32887
32950
  }
32888
32951
  function readOptional(scan2, path, record2 = true) {
32889
32952
  try {
32890
- return readFileSync17(path, "utf8");
32953
+ return readRegularFile(path);
32891
32954
  } catch (err) {
32892
32955
  if (record2 && !isAbsent(err)) scan2.errors.push({ source: path, reason: message(err) });
32893
32956
  return void 0;
@@ -33466,7 +33529,7 @@ function createGuardedScanner(partition, gateway, opts) {
33466
33529
  }
33467
33530
 
33468
33531
  // ../../packages/plugin-sdk/src/hook-fail-opens.ts
33469
- import { readFileSync as readFileSync18 } from "fs";
33532
+ import { readFileSync as readFileSync17 } from "fs";
33470
33533
  import { join as join26 } from "path";
33471
33534
  var HOOK_FAIL_OPENS_FILENAME = "hook-fail-opens.json";
33472
33535
  function hookFailOpensPath(dataDir2) {
@@ -33489,7 +33552,7 @@ function recordHookFailOpen(dataDir2, nowMs) {
33489
33552
  }
33490
33553
  function readHookFailOpens(dataDir2) {
33491
33554
  try {
33492
- const parsed2 = JSON.parse(readFileSync18(hookFailOpensPath(dataDir2), "utf8"));
33555
+ const parsed2 = JSON.parse(readFileSync17(hookFailOpensPath(dataDir2), "utf8"));
33493
33556
  if (typeof parsed2 !== "object" || parsed2 === null) return null;
33494
33557
  const record2 = parsed2;
33495
33558
  if (!isPositiveSafeInteger(record2.failOpens)) return null;
@@ -33505,11 +33568,10 @@ function isPositiveSafeInteger(value) {
33505
33568
 
33506
33569
  // ../../packages/plugin-sdk/src/ignore-layers.ts
33507
33570
  var import_ignore = __toESM(require_ignore(), 1);
33508
- import { readFileSync as readFileSync19 } from "fs";
33509
33571
  import { join as join27 } from "path";
33510
33572
  function readIgnoreLayer(dir, filename, anchorLen) {
33511
33573
  try {
33512
- return { matcher: (0, import_ignore.default)().add(readFileSync19(join27(dir, filename), "utf8")), anchorLen };
33574
+ return { matcher: (0, import_ignore.default)().add(readRegularFile(join27(dir, filename))), anchorLen };
33513
33575
  } catch {
33514
33576
  return void 0;
33515
33577
  }
@@ -33566,7 +33628,7 @@ function resolveInventoryContext(input) {
33566
33628
  }
33567
33629
 
33568
33630
  // ../../packages/plugin-sdk/src/nudge.ts
33569
- import { mkdirSync as mkdirSync2, readFileSync as readFileSync20, writeFileSync as writeFileSync5 } from "fs";
33631
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync18, writeFileSync as writeFileSync5 } from "fs";
33570
33632
  import { join as join28 } from "path";
33571
33633
  var SESSION_START_MARKER = "session-start-last";
33572
33634
  function claimSessionStart(dataDir2, sessionId) {
@@ -33578,7 +33640,7 @@ function claimOncePerSession(dataDir2, marker, sessionId) {
33578
33640
  const path = join28(dataDir2, marker);
33579
33641
  let recent = [];
33580
33642
  try {
33581
- recent = readFileSync20(path, "utf8").split("\n").filter(Boolean);
33643
+ recent = readFileSync18(path, "utf8").split("\n").filter(Boolean);
33582
33644
  if (recent.includes(sessionId)) return false;
33583
33645
  } catch {
33584
33646
  }
@@ -34982,7 +35044,7 @@ function sessionToolIsKeyed(tool) {
34982
35044
 
34983
35045
  // ../../packages/plugin-runtime/src/attached/config-inventory-sync.ts
34984
35046
  import { createHash as createHash11 } from "crypto";
34985
- import { readFileSync as readFileSync22 } from "fs";
35047
+ import { readFileSync as readFileSync20 } from "fs";
34986
35048
  import { join as join35 } from "path";
34987
35049
 
34988
35050
  // ../../packages/plugin-runtime/src/attached/config-inventory-wire.ts
@@ -35082,7 +35144,7 @@ async function publishByRename(tmp, file, move = rename2) {
35082
35144
 
35083
35145
  // ../../packages/plugin-runtime/src/attached/capture-settings.ts
35084
35146
  import { randomUUID as randomUUID17 } from "crypto";
35085
- import { readFileSync as readFileSync21 } from "fs";
35147
+ import { readFileSync as readFileSync19 } from "fs";
35086
35148
  import { rm, writeFile as writeFile2 } from "fs/promises";
35087
35149
  import { join as join33 } from "path";
35088
35150
  var HookCaptureSettingsSchema = CaptureSettings.pick({
@@ -35470,7 +35532,7 @@ function reportKey(request) {
35470
35532
  function readStagedEntries(dataDir2) {
35471
35533
  let parsed2;
35472
35534
  try {
35473
- parsed2 = JSON.parse(readFileSync22(stagedConfigInventoryPath(dataDir2), "utf8"));
35535
+ parsed2 = JSON.parse(readFileSync20(stagedConfigInventoryPath(dataDir2), "utf8"));
35474
35536
  } catch {
35475
35537
  return [];
35476
35538
  }
@@ -35494,7 +35556,7 @@ function isTimestamp(value) {
35494
35556
  }
35495
35557
 
35496
35558
  // ../../packages/plugin-runtime/src/attached/forward-drops.ts
35497
- import { readFileSync as readFileSync23 } from "fs";
35559
+ import { readFileSync as readFileSync21 } from "fs";
35498
35560
  import { join as join36 } from "path";
35499
35561
  var FORWARD_DROPS_FILENAME = ATTACHED_FORWARD_DROPS_FILENAME;
35500
35562
  function forwardDropsPath(dataDir2) {
@@ -35516,7 +35578,7 @@ function recordForwardDrops(dataDir2, count, nowMs) {
35516
35578
  }
35517
35579
  function readForwardDrops(dataDir2) {
35518
35580
  try {
35519
- const parsed2 = JSON.parse(readFileSync23(forwardDropsPath(dataDir2), "utf8"));
35581
+ const parsed2 = JSON.parse(readFileSync21(forwardDropsPath(dataDir2), "utf8"));
35520
35582
  if (typeof parsed2 !== "object" || parsed2 === null) return null;
35521
35583
  const record2 = parsed2;
35522
35584
  if (typeof record2.droppedForwards !== "number" || !Number.isFinite(record2.droppedForwards)) {
@@ -36620,7 +36682,7 @@ function toWireInspection(insp, nameKey) {
36620
36682
  }
36621
36683
 
36622
36684
  // ../../packages/plugin-runtime/src/attached/plugin-block.ts
36623
- import { readFileSync as readFileSync24 } from "fs";
36685
+ import { readFileSync as readFileSync22 } from "fs";
36624
36686
 
36625
36687
  // ../../packages/plugin-runtime/src/attached/install-record.ts
36626
36688
  import { readFile as readFile3, stat } from "fs/promises";
@@ -36673,7 +36735,7 @@ function readManifestBuild(manifestUrl, packageName) {
36673
36735
  if (!manifestBuildCache.has(key)) {
36674
36736
  let build;
36675
36737
  try {
36676
- const manifest = JSON.parse(readFileSync24(manifestUrl, "utf8"));
36738
+ const manifest = JSON.parse(readFileSync22(manifestUrl, "utf8"));
36677
36739
  build = typeof manifest.version === "string" && manifest.version.length > 0 ? { package: packageName, version: manifest.version } : void 0;
36678
36740
  } catch {
36679
36741
  build = void 0;
@@ -36708,7 +36770,7 @@ async function readInstalledVersionBounded(installRoot) {
36708
36770
  }
36709
36771
 
36710
36772
  // ../../packages/plugin-runtime/src/attached/posture-report-state.ts
36711
- import { readFileSync as readFileSync25 } from "fs";
36773
+ import { readFileSync as readFileSync23 } from "fs";
36712
36774
  import { join as join38 } from "path";
36713
36775
  var POSTURE_REPORT_STATE_FILENAME = ATTACHED_POSTURE_REPORT_FILENAME;
36714
36776
  var OUTCOME_KEYS = {
@@ -37104,21 +37166,21 @@ function codexHomeDir(home) {
37104
37166
 
37105
37167
  // ../../packages/plugin-sdk/src/account/observation-log.ts
37106
37168
  import { createHash as createHash12 } from "crypto";
37107
- import { closeSync as closeSync2, constants, fstatSync, mkdirSync as mkdirSync4, openSync as openSync2, readSync, writeSync } from "fs";
37169
+ import { closeSync as closeSync3, constants as constants2, fstatSync as fstatSync2, mkdirSync as mkdirSync4, openSync as openSync3, readSync, writeSync } from "fs";
37108
37170
  import { join as join41 } from "path";
37109
37171
  var SESSION_LOG_CAP_BYTES = 16 * 1024 * 1024;
37110
37172
  var SESSION_LOG_TAIL_BYTES = 64 * 1024;
37111
37173
  var NEWLINE = 10;
37112
37174
  var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
37113
37175
  function sessionLogOpenFlags(noFollow) {
37114
- return constants.O_WRONLY | constants.O_APPEND | constants.O_CREAT | (noFollow ?? 0);
37176
+ return constants2.O_WRONLY | constants2.O_APPEND | constants2.O_CREAT | (noFollow ?? 0);
37115
37177
  }
37116
37178
  var SESSION_LOG_OPEN_FLAGS = sessionLogOpenFlags(
37117
- constants.O_NOFOLLOW
37179
+ constants2.O_NOFOLLOW
37118
37180
  );
37119
37181
  function closeQuietly2(fd) {
37120
37182
  try {
37121
- closeSync2(fd);
37183
+ closeSync3(fd);
37122
37184
  } catch {
37123
37185
  }
37124
37186
  }
@@ -37141,8 +37203,8 @@ function appendObservation(stateDir, sessionId, observation, capBytes = SESSION_
37141
37203
  let fd;
37142
37204
  try {
37143
37205
  mkdirSync4(stateDir, { recursive: true, mode: DATA_DIR_MODE });
37144
- fd = openSync2(sessionLogPath(stateDir, sessionId), openFlags, DATA_FILE_MODE);
37145
- if (fstatSync(fd).size + Buffer.byteLength(line) > capBytes) return false;
37206
+ fd = openSync3(sessionLogPath(stateDir, sessionId), openFlags, DATA_FILE_MODE);
37207
+ if (fstatSync2(fd).size + Buffer.byteLength(line) > capBytes) return false;
37146
37208
  writeSync(fd, line);
37147
37209
  return true;
37148
37210
  } catch {
@@ -37172,12 +37234,12 @@ function parseLines(buffer, base) {
37172
37234
  function readRange(path, from, capBytes) {
37173
37235
  let fd;
37174
37236
  try {
37175
- fd = openSync2(path, "r");
37237
+ fd = openSync3(path, "r");
37176
37238
  } catch {
37177
37239
  return void 0;
37178
37240
  }
37179
37241
  try {
37180
- const size = fstatSync(fd).size;
37242
+ const size = fstatSync2(fd).size;
37181
37243
  const length = Math.max(0, Math.min(size, capBytes) - from);
37182
37244
  const buffer = Buffer.alloc(length);
37183
37245
  let filled = 0;
@@ -37224,7 +37286,7 @@ function classifyObservation(observation) {
37224
37286
  }
37225
37287
 
37226
37288
  // ../../packages/plugin-sdk/src/account/codex-head.ts
37227
- import { closeSync as closeSync3, openSync as openSync3, readSync as readSync2 } from "fs";
37289
+ import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "fs";
37228
37290
  var CODEX_HEAD_READ_BYTES = 64 * 1024;
37229
37291
  var CODEX_HEAD_MAX_BYTES = 1024 * 1024;
37230
37292
  var NEWLINE2 = 10;
@@ -37257,7 +37319,7 @@ function parseHead(line) {
37257
37319
  function readCodexHead(rolloutPath) {
37258
37320
  let fd;
37259
37321
  try {
37260
- fd = openSync3(rolloutPath, "r");
37322
+ fd = openSync4(rolloutPath, "r");
37261
37323
  } catch (error2) {
37262
37324
  return isNotFound(error2) ? "pending" : void 0;
37263
37325
  }
@@ -37282,14 +37344,14 @@ function readCodexHead(rolloutPath) {
37282
37344
  return void 0;
37283
37345
  } finally {
37284
37346
  try {
37285
- closeSync3(fd);
37347
+ closeSync4(fd);
37286
37348
  } catch {
37287
37349
  }
37288
37350
  }
37289
37351
  }
37290
37352
 
37291
37353
  // ../../packages/plugin-sdk/src/account/codex-login.ts
37292
- import { closeSync as closeSync4, constants as constants2, fstatSync as fstatSync2, lstatSync as lstatSync6, openSync as openSync4, readSync as readSync3 } from "fs";
37354
+ import { closeSync as closeSync5, constants as constants3, fstatSync as fstatSync3, lstatSync as lstatSync6, openSync as openSync5, readSync as readSync3 } from "fs";
37293
37355
  import { join as join42 } from "path";
37294
37356
  var CODEX_AUTH_MAX_BYTES = 64 * 1024;
37295
37357
  var CODEX_ID_TOKEN_MAX_CHARS = 16 * 1024;
@@ -37322,8 +37384,8 @@ var DROPPED = new Set(CODEX_DROPPED_FIELDS);
37322
37384
  var PRESENCE = new Set(CODEX_PRESENCE_FIELDS);
37323
37385
  var BASE64URL = /^[A-Za-z0-9_-]+$/;
37324
37386
  var UUID3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
37325
- var NOFOLLOW = constants2.O_NOFOLLOW ?? 0;
37326
- var READ_FLAGS = constants2.O_RDONLY | NOFOLLOW;
37387
+ var NOFOLLOW = constants3.O_NOFOLLOW ?? 0;
37388
+ var READ_FLAGS = constants3.O_RDONLY | NOFOLLOW;
37327
37389
  var ABSENT = { status: "absent" };
37328
37390
  var MODE = { status: "mode" };
37329
37391
  var MALFORMED = { status: "malformed" };
@@ -37445,12 +37507,12 @@ function inspectCodexLogin(codexHome, attachedUserDigest, platform2 = process.pl
37445
37507
  let fd;
37446
37508
  try {
37447
37509
  if (platform2 === "win32" && lstatSync6(path).isSymbolicLink()) return MALFORMED;
37448
- fd = openSync4(path, openFlags);
37510
+ fd = openSync5(path, openFlags);
37449
37511
  } catch (error2) {
37450
37512
  return isNotFound2(error2) ? ABSENT : MALFORMED;
37451
37513
  }
37452
37514
  try {
37453
- const stat2 = fstatSync2(fd);
37515
+ const stat2 = fstatSync3(fd);
37454
37516
  if (!stat2.isFile() || stat2.size > CODEX_AUTH_MAX_BYTES) return MALFORMED;
37455
37517
  if (platform2 !== "win32" && (stat2.uid !== process.getuid?.() || (stat2.mode & 18) !== 0)) {
37456
37518
  return MALFORMED;
@@ -37462,7 +37524,7 @@ function inspectCodexLogin(codexHome, attachedUserDigest, platform2 = process.pl
37462
37524
  return MALFORMED;
37463
37525
  } finally {
37464
37526
  try {
37465
- closeSync4(fd);
37527
+ closeSync5(fd);
37466
37528
  } catch {
37467
37529
  }
37468
37530
  }
@@ -37659,11 +37721,11 @@ function codexHookAccount(input) {
37659
37721
  }
37660
37722
 
37661
37723
  // ../../packages/plugin-runtime/src/attached/label-drops.ts
37662
- import { readFileSync as readFileSync26 } from "fs";
37724
+ import { readFileSync as readFileSync24 } from "fs";
37663
37725
  import { join as join43 } from "path";
37664
37726
 
37665
37727
  // ../../packages/plugin-runtime/src/attached/sync-state.ts
37666
- import { readFileSync as readFileSync27 } from "fs";
37728
+ import { readFileSync as readFileSync25 } from "fs";
37667
37729
  import { join as join44 } from "path";
37668
37730
 
37669
37731
  // ../../packages/plugin-runtime/src/attached/status.ts
@@ -38334,11 +38396,11 @@ import { fileURLToPath as fileURLToPath5 } from "url";
38334
38396
  // src/history/tail.ts
38335
38397
  import { createHash as createHash13 } from "crypto";
38336
38398
  import {
38337
- closeSync as closeSync5,
38338
- fstatSync as fstatSync3,
38399
+ closeSync as closeSync6,
38400
+ fstatSync as fstatSync4,
38339
38401
  mkdirSync as mkdirSync5,
38340
- openSync as openSync5,
38341
- readFileSync as readFileSync28,
38402
+ openSync as openSync6,
38403
+ readFileSync as readFileSync26,
38342
38404
  readSync as readSync4,
38343
38405
  writeFileSync as writeFileSync7
38344
38406
  } from "fs";
@@ -38374,7 +38436,7 @@ function spawnWorker(args) {
38374
38436
  }
38375
38437
 
38376
38438
  // src/history/transcripts.ts
38377
- import { readdirSync as readdirSync6, readFileSync as readFileSync29, statSync as statSync13 } from "fs";
38439
+ import { readdirSync as readdirSync6, readFileSync as readFileSync27, statSync as statSync13 } from "fs";
38378
38440
  import { homedir as homedir5 } from "os";
38379
38441
  import { join as join48 } from "path";
38380
38442
  function peekSessionOriginator(transcriptPath) {
@@ -38385,7 +38447,7 @@ var DAY_MS5 = 24 * 60 * 60 * 1e3;
38385
38447
 
38386
38448
  // src/protocol/marker.ts
38387
38449
  import { randomBytes as randomBytes6 } from "crypto";
38388
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync30, renameSync as renameSync5, writeFileSync as writeFileSync8 } from "fs";
38450
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync28, renameSync as renameSync5, writeFileSync as writeFileSync8 } from "fs";
38389
38451
  import { join as join49 } from "path";
38390
38452
  var MARKER_FILE = "protocol-marker";
38391
38453
  function mintMarker() {
@@ -38395,7 +38457,7 @@ function sessionProtocolMarker(dataDir2, sessionId) {
38395
38457
  if (!sessionId) return mintMarker();
38396
38458
  const path = join49(dataDir2, MARKER_FILE);
38397
38459
  try {
38398
- const stored = JSON.parse(readFileSync30(path, "utf8"));
38460
+ const stored = JSON.parse(readFileSync28(path, "utf8"));
38399
38461
  if (stored.sessionId === sessionId && typeof stored.marker === "string" && /^[0-9a-f]{16}$/.test(stored.marker)) {
38400
38462
  return stored.marker;
38401
38463
  }
@@ -38569,7 +38631,7 @@ async function codexSessionStartAccount(config2, input) {
38569
38631
  }
38570
38632
 
38571
38633
  // src/hooks/store-health.ts
38572
- import { mkdirSync as mkdirSync7, readFileSync as readFileSync31, writeFileSync as writeFileSync9 } from "fs";
38634
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync29, writeFileSync as writeFileSync9 } from "fs";
38573
38635
  import { dirname as dirname12, join as join50 } from "path";
38574
38636
  var STORE_REDIRECT_MARKER = "store-redirect-last-session";
38575
38637
  var RECENT_SESSIONS2 = 32;
@@ -38589,7 +38651,7 @@ function alreadyClaimed(dirs, marker, sessionId) {
38589
38651
  }
38590
38652
  function readRecent(dir, marker) {
38591
38653
  try {
38592
- return readFileSync31(join50(dir, marker), "utf8").split("\n").filter(Boolean);
38654
+ return readFileSync29(join50(dir, marker), "utf8").split("\n").filter(Boolean);
38593
38655
  } catch {
38594
38656
  return [];
38595
38657
  }
@@ -38644,7 +38706,7 @@ function harnessVersion() {
38644
38706
  const manifestPath = process.argv[2];
38645
38707
  if (!manifestPath) return void 0;
38646
38708
  try {
38647
- const manifest = JSON.parse(readFileSync32(manifestPath, "utf8"));
38709
+ const manifest = JSON.parse(readFileSync30(manifestPath, "utf8"));
38648
38710
  return typeof manifest.version === "string" ? manifest.version : void 0;
38649
38711
  } catch {
38650
38712
  return void 0;