@akasecurity/ai-tc-codex 0.9.22 → 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.
@@ -8783,7 +8783,11 @@ var ListFindingTypesQuery = object({
8783
8783
  // and so is not bounded by what any page happens to hold.
8784
8784
  includeId: string2().optional(),
8785
8785
  limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
8786
- cursor: string2().optional()
8786
+ cursor: string2().optional(),
8787
+ // A row position to read from, for jumping to a page instead of stepping to
8788
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
8789
+ // from wherever it lands.
8790
+ offset: coerce_exports.number().int().min(0).optional()
8787
8791
  });
8788
8792
  var ListFindingTypesResponse = object({
8789
8793
  totals: object({
@@ -8864,7 +8868,11 @@ var ListFindingInstancesQuery = object({
8864
8868
  sessionId: string2().optional(),
8865
8869
  from: iso_exports.datetime().optional(),
8866
8870
  limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
8867
- cursor: string2().optional()
8871
+ cursor: string2().optional(),
8872
+ // A row position to read from, for jumping to a page instead of stepping to
8873
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
8874
+ // from wherever it lands.
8875
+ offset: coerce_exports.number().int().min(0).optional()
8868
8876
  });
8869
8877
  var ListFindingInstancesResponse = object({
8870
8878
  // Instances matching the filters across the whole scope, not just this
@@ -8936,7 +8944,11 @@ var ListFindingLocationsQuery = object({
8936
8944
  // rather than a deep-link corner. Never affects totals, facets or the cursor.
8937
8945
  includeId: string2().optional(),
8938
8946
  limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
8939
- cursor: string2().optional()
8947
+ cursor: string2().optional(),
8948
+ // A row position to read from, for jumping to a page instead of stepping to
8949
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
8950
+ // from wherever it lands.
8951
+ offset: coerce_exports.number().int().min(0).optional()
8940
8952
  });
8941
8953
  var ListFindingLocationsResponse = object({
8942
8954
  totals: object({
@@ -11568,7 +11580,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
11568
11580
  var ListVaultInventoryQuery = object({
11569
11581
  limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
11570
11582
  // Opaque; names the last row of the page just served.
11571
- cursor: string2().optional()
11583
+ cursor: string2().optional(),
11584
+ // A row position to read from, for jumping to a page instead of stepping to
11585
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
11586
+ // from wherever it lands.
11587
+ offset: coerce_exports.number().int().min(0).optional()
11572
11588
  });
11573
11589
  var ListVaultInventoryResponse = object({
11574
11590
  // Vaulted values across the whole store, not just this page — cursor-
@@ -11580,7 +11596,11 @@ var ListVaultInventoryResponse = object({
11580
11596
  });
11581
11597
  var ListVaultReuseQuery = object({
11582
11598
  limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
11583
- cursor: string2().optional()
11599
+ cursor: string2().optional(),
11600
+ // A row position to read from, for jumping to a page instead of stepping to
11601
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
11602
+ // from wherever it lands.
11603
+ offset: coerce_exports.number().int().min(0).optional()
11584
11604
  });
11585
11605
  var ListVaultReuseResponse = object({
11586
11606
  // Reused values across the whole store — the number the section's claim
@@ -11596,9 +11616,15 @@ var ListVaultDerefsQuery = object({
11596
11616
  // over a Server Action, which preserves the type, never as a URL param.
11597
11617
  includeBatched: boolean2().optional(),
11598
11618
  limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
11599
- cursor: string2().optional()
11619
+ cursor: string2().optional(),
11620
+ // A row position to read from, for jumping to a page instead of stepping to
11621
+ // it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
11622
+ // from wherever it lands.
11623
+ offset: coerce_exports.number().int().min(0).optional()
11600
11624
  });
11601
11625
  var ListVaultDerefsResponse = object({
11626
+ // Rows this filter selects across the whole trail, not just this page.
11627
+ totals: object({ derefs: number2().int().nonnegative() }),
11602
11628
  items: array(VaultDeref),
11603
11629
  nextCursor: string2().nullable(),
11604
11630
  // Display/view-render rows the query hid, over the WHOLE trail rather than
@@ -15115,6 +15141,21 @@ function registerPack(pack) {
15115
15141
  function getLoadedRules() {
15116
15142
  return [...packs.values()].flatMap((p) => p.rules);
15117
15143
  }
15144
+ function outsideWrittenRegions(candidates, context) {
15145
+ const regions = context?.writtenRegions;
15146
+ if (!regions || regions.length === 0 || context.eventKind !== "tool_use") return candidates;
15147
+ return candidates.filter((c) => {
15148
+ if (c.rule.category !== "code_flaw") return true;
15149
+ const { start, end } = c.match.span;
15150
+ return !regions.some(
15151
+ (r) => r.start <= start && end <= r.end && ruleApplies(
15152
+ c.rule,
15153
+ r.filePath === void 0 ? void 0 : extensionOf(r.filePath),
15154
+ "code_change"
15155
+ )
15156
+ );
15157
+ });
15158
+ }
15118
15159
  function spansOverlap(a, b) {
15119
15160
  return a.start < b.end && a.end > b.start;
15120
15161
  }
@@ -15302,17 +15343,20 @@ function scanEncoded(text2, ruleset, context) {
15302
15343
  function scanText(text2, ruleset, context) {
15303
15344
  const extension = context?.filePath ? extensionOf(context.filePath) : void 0;
15304
15345
  const normalization = normalizeFormatChars(text2);
15305
- const originalCandidates = buildCandidates(text2, ruleset, extension, context?.eventKind);
15346
+ const originalCandidates = outsideWrittenRegions(
15347
+ buildCandidates(text2, ruleset, extension, context?.eventKind),
15348
+ context
15349
+ );
15306
15350
  if (!normalization) return gate(originalCandidates, text2, void 0);
15307
15351
  const pooledOriginal = originalCandidates.map(
15308
15352
  (candidate) => withNormalizedSpan(candidate, normalization)
15309
15353
  );
15310
- const normalizedCandidates = buildCandidates(
15311
- normalization.normalized,
15312
- ruleset,
15313
- extension,
15314
- context?.eventKind
15315
- ).map((candidate) => mapCandidateToOriginal(candidate, normalization, text2));
15354
+ const normalizedCandidates = outsideWrittenRegions(
15355
+ buildCandidates(normalization.normalized, ruleset, extension, context?.eventKind).map(
15356
+ (candidate) => mapCandidateToOriginal(candidate, normalization, text2)
15357
+ ),
15358
+ context
15359
+ );
15316
15360
  const findings = gate([...pooledOriginal, ...normalizedCandidates], text2, normalization);
15317
15361
  return mergeOverlappingSameRule(findings, text2);
15318
15362
  }
@@ -15373,6 +15417,7 @@ var BUNDLED_CODE_EVIDENCE = /* @__PURE__ */ new Set([
15373
15417
  "code-flaws/sql-inject-concat-dot",
15374
15418
  "code-flaws/sql-inject-format",
15375
15419
  "code-flaws/sql-inject-interp",
15420
+ "code-flaws/sql-inject-interp-multiline",
15376
15421
  "code-flaws/ssrf-user-url",
15377
15422
  "code-flaws/xss-dangerously-set",
15378
15423
  "code-flaws/xss-inner-html",
@@ -16462,7 +16507,7 @@ var sql_inject_concat_dot_default = {
16462
16507
  severity: "high",
16463
16508
  matcher: {
16464
16509
  type: "regex",
16465
- pattern: `["'](?=([^"'\\n]*?(?:select|insert|update|delete|drop|where)))\\1(?:(?!["'][^"'\\n]*?(?:select|insert|update|delete|drop|where))[^\\n])*?["']\\s*\\.`,
16510
+ pattern: "([\"'])(?=((?:(?!\\1)[^\\n])*?\\b(?:select\\b(?:(?!\\1|\\bselect\\b)[^\\n])*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\s+[\\w.`\\[\\]${}]+(?:\\s*(?:!=|[=<>])|\\s+(?:in\\s*\\(|like\\s*(?!\\1)['\"%]|between\\b)))))\\2(?:(?!\\1(?:(?!\\1)[^\\n])*?\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\b))[^\\n])*?[\"']\\s*\\.",
16466
16511
  flags: "gi"
16467
16512
  },
16468
16513
  appliesTo: {
@@ -16480,7 +16525,7 @@ var sql_inject_concat_default = {
16480
16525
  severity: "high",
16481
16526
  matcher: {
16482
16527
  type: "regex",
16483
- pattern: `(["'])\\s*(?=(select\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?=))\\2(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?["']\\s*\\+`,
16528
+ pattern: "([\"'])\\s*(?=(select\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\b))[^\\n])*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\s+[\\w.`\\[\\]${}]+(?:\\s*(?:!=|[=<>])|\\s+(?:in\\s*\\(|like\\s*(?!\\1)['\"%]|between\\b))))\\2(?:(?!\\1\\s*(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+(?:only\\s+)?\\S+(?:(?:\\s+as\\s+[\\w`\\[\\]]+)?\\s+set\\b|(?:\\s*,\\s*[\\w.`\\[\\]$]+)+\\s+set\\s+[\\w.`\\[\\]$]+\\s*=)|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b|where\\b))[^\\n])*?[\"']\\s*\\+",
16484
16529
  flags: "gi"
16485
16530
  },
16486
16531
  examples: ['"SELECT * FROM users WHERE id = " + userId']
@@ -16495,7 +16540,7 @@ var sql_inject_format_default = {
16495
16540
  severity: "high",
16496
16541
  matcher: {
16497
16542
  type: "regex",
16498
- pattern: `(["'\`])\\s*(?=((?:select\\b(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b)|\\1)[^\\n])*?\\bfrom\\b)|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))\\2(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b)|\\1)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|(["'\`])\\s*(?=((?:(?!\\3)[^\\n])*?\\bwhere\\b(?:(?!\\bwhere\\b|\\3)[^\\n])*?=))\\4(?:(?!\\bwhere\\b|\\3)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|(?<=^|\\n)[ \\t]*(?=(select\\b(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))[^\\n])*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))\\5(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))[^\\n])*?(?:=\\s*['"]?\\s*(?:%[sd]|\\{[^{}\\n]+\\})|[#$]\\{[^{}\\n]+\\})`,
16543
+ pattern: "([\"'`])\\s*(?=((?:select\\b(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b)|\\1)[^\\n])*?\\bfrom\\b)|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))\\2(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b)|\\1)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|([\"'`])\\s*(?=((?:(?!\\3)[^\\n])*?\\bwhere\\s+[\\w.`\\[\\]${}]+(?:\\s*(?:!=|[=<>])|\\s+(?:in\\s*\\(|like\\s*(?=(?!\\3)['\"%])|between\\b))))\\4(?:(?!\\bwhere\\b|\\3)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|(?<=^|\\n)[ \\t]*(?=(select\\b(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))[^\\n])*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))\\5(?:(?!\\b(?:select\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+(?:replace|ignore|rollback|abort|fail))\\s+){0,2}into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database|index|view)\\b))[^\\n])*?(?:=\\s*['\"]?\\s*(?:%[sd]|\\{[^{}\\n]+\\})|[#$]\\{[^{}\\n]+\\})",
16499
16544
  flags: "gi"
16500
16545
  },
16501
16546
  examples: [
@@ -16504,6 +16549,24 @@ var sql_inject_format_default = {
16504
16549
  ]
16505
16550
  };
16506
16551
 
16552
+ // ../../rules/code-flaws/sql-inject-interp-multiline.json
16553
+ var sql_inject_interp_multiline_default = {
16554
+ specVersion: 1,
16555
+ id: "code-flaws/sql-inject-interp-multiline",
16556
+ name: "SQL injection via Ruby string interpolation or PHP variable (statement on its own line, e.g. a heredoc)",
16557
+ category: "code_flaw",
16558
+ severity: "high",
16559
+ matcher: {
16560
+ type: "regex",
16561
+ pattern: '(?<=^|\\n)[ \\t]*(?=(?:select\\b(?:[^\\n]*\\n){0,3}?[^\\n]*?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+\\w+)\\s+){0,2}into\\b|update\\s+(?:(?:low_priority|ignore|or\\s+\\w+)\\s+){0,2}(?:only\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?(?:\\s*,\\s*(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?){0,7}\\s+set(?:\\s+|(?=`))(?:(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+\\s*=|#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;),]|\\n|$|(?:where|order|limit)\\b)))|delete\\s+(?:(?:low_priority|quick|ignore)\\s+){0,3}(?:from\\b|[\\w.`]+(?:\\s*,\\s*[\\w.`]+)*\\s+from\\s+[\\w.`]+(?:\\s+(?:as\\s+)?\\w+)?\\s+(?:(?:inner|cross|(?:left|right)(?:\\s+outer)?)\\s+)?(?:join|using|where)\\b)|where\\s+(?:(?:not\\s+)?(?:\\(\\s*)*(?:#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;)]|\\n|$|(?:and|or|order|group|limit)\\b)))|(?:not\\s+)?exists\\s*\\(|(?:not\\s+)?(?:\\(\\s*)*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?(?:\\s*,\\s*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?){0,4}\\s*(?:\\)\\s*)?(?:[=<>!~@|&:%^*/+-]+|\\b(?:is|in|not|i?like|regexp|rlike|similar\\s+to|glob|between|against|match|exists|and|or)\\b))))(?:select|insert|update|delete|where)\\s[^\\n]*?(?:#\\{|\\$[a-z_])',
16562
+ flags: "gi"
16563
+ },
16564
+ examples: ["sql = <<~SQL\n SELECT * FROM users WHERE id = #{params[:id]}\nSQL"],
16565
+ appliesTo: {
16566
+ extensions: [".rb", ".php"]
16567
+ }
16568
+ };
16569
+
16507
16570
  // ../../rules/code-flaws/sql-inject-interp.json
16508
16571
  var sql_inject_interp_default = {
16509
16572
  specVersion: 1,
@@ -16513,7 +16576,7 @@ var sql_inject_interp_default = {
16513
16576
  severity: "high",
16514
16577
  matcher: {
16515
16578
  type: "regex",
16516
- pattern: "([\"'`])\\s*\\b(?:select|insert|update|delete|where)\\b(?:(?!\\1)[^\\n])*?(?:#\\{|\\$[a-z_])|(?<=^|\\n)[ \\t]*(?:select|insert|update|delete|where)\\s[^\\n]*?(?:#\\{|\\$[a-z_])",
16579
+ pattern: '(?<![\\w\'"`})\\]])(["\'`])[ \\t]*(?=(?:select\\b(?:#\\{(?:[^{}\\n]|\\{(?:[^{}\\n]|\\{[^{}\\n]{0,100}\\}){0,100}\\}){0,200}\\}|\\{\\$[^}\\n]{0,200}\\}|\\\\(?!\\1[ \\t]*(?:select|insert|update|delete|where)\\b).|(?!\\1)(?!#\\{|\\{\\$|\\\\)[\\s\\S]){0,1000}?\\bfrom\\b|insert\\s+(?:(?:ignore|low_priority|delayed|high_priority|or\\s+\\w+)\\s+){0,2}(?:into\\b|[\\w.`]+\\s*\\()|update\\s+(?:(?:low_priority|ignore|or\\s+\\w+)\\s+){0,2}(?:only\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?(?:\\s*,\\s*(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+(?:\\s+(?:as\\s+)?(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+)?){0,7}(?:(?:\\s+\\w+){0,2}\\s+join\\b(?:(?!\\bset\\b)(?!\\1)[^\\n]){1,300})?\\s+set(?:\\s+|(?=`))(?:(?:[\\w.`\\"$]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\$\\{[^}\\n]{1,200}\\}|->|\\[[^\\]\\n]{1,200}\\])+\\s*=|#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;),]|\\n|$|(?:where|order|limit)\\b)))|delete\\s+(?:(?:low_priority|quick|ignore)\\s+){0,3}(?:from\\b|[\\w.`]+(?:\\s*,\\s*[\\w.`]+)*\\s+from\\s+[\\w.`]+(?:\\s+(?:as\\s+)?\\w+)?\\s+(?:(?:inner|cross|(?:left|right)(?:\\s+outer)?)\\s+)?(?:join|using|where)\\b)|where\\s+(?:(?:not\\s+)?(?:\\(\\s*)*(?:#\\{|\\{\\$|\\$[a-z_]\\w*(?:\\[[^\\]\\n]{1,200}\\])*(?=\\s*(?:["\'`;)]|\\n|$|(?:and|or|order|group|limit)\\b)))|(?:not\\s+)?exists\\s*\\(|(?:not\\s+)?(?:\\(\\s*)*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?(?:\\s*,\\s*(?:[\\w.`$"]|#\\{[^}\\n]{1,200}\\}|\\{\\$[^}\\n]{1,200}\\}|\\[[^\\]\\n]{1,200}\\]|\'[^\'\\n]{0,200}\')+(?:\\s*\\((?:[^()\\n]|\\((?:[^()\\n]|\\([^()\\n]{0,200}\\))*\\))*\\))?){0,4}\\s*(?:\\)\\s*)?(?:[=<>!~@|&:%^*/+-]+|\\b(?:is|in|not|i?like|regexp|rlike|similar\\s+to|glob|between|against|match|exists|and|or)\\b))))\\b(?:select|insert|update|delete|where)\\b(?:(?!\\1)[^\\n])*?(?:#\\{|\\$[a-z_])',
16517
16580
  flags: "gi"
16518
16581
  },
16519
16582
  examples: [
@@ -18241,12 +18304,13 @@ var BUNDLED_PACKS = [
18241
18304
  {
18242
18305
  packId: "code-flaws",
18243
18306
  name: "Code Security Flaws",
18244
- version: "0.1.3",
18307
+ version: "0.1.6",
18245
18308
  rawRules: [
18246
18309
  sql_inject_concat_default,
18247
18310
  sql_inject_concat_dot_default,
18248
18311
  sql_inject_format_default,
18249
18312
  sql_inject_interp_default,
18313
+ sql_inject_interp_multiline_default,
18250
18314
  cmd_inject_shell_default,
18251
18315
  cmd_inject_exec_default,
18252
18316
  cmd_inject_node_exec_default,
@@ -18278,6 +18342,7 @@ var BUNDLED_PACKS = [
18278
18342
  "code-flaws/sql-inject-concat-dot": "SQL injection (PHP)",
18279
18343
  "code-flaws/sql-inject-format": "SQL injection (format string)",
18280
18344
  "code-flaws/sql-inject-interp": "SQL injection (interpolation)",
18345
+ "code-flaws/sql-inject-interp-multiline": "SQL injection (interpolation)",
18281
18346
  "code-flaws/cmd-inject-shell": "Command injection (shell)",
18282
18347
  "code-flaws/cmd-inject-exec": "Command injection (Java exec)",
18283
18348
  "code-flaws/cmd-inject-node-exec": "Command injection (Node exec)",
@@ -25068,7 +25133,7 @@ var SqliteFindingsRepository = class {
25068
25133
  };
25069
25134
  const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
25070
25135
  const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
25071
- const start = cursor === null ? 0 : firstAfter(sorted, cursor);
25136
+ const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
25072
25137
  const page = sorted.slice(start, start + limit);
25073
25138
  const lastOnPage = page.at(-1);
25074
25139
  const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
@@ -25162,7 +25227,7 @@ var SqliteFindingsRepository = class {
25162
25227
  accumulator.add(row);
25163
25228
  if (!matchesInstanceFilters(row, opts)) continue;
25164
25229
  total += 1;
25165
- if (!isPastCursor(row)) continue;
25230
+ if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
25166
25231
  if (items.length < limit) {
25167
25232
  items.push(toInstanceDetail(row));
25168
25233
  last = row;
@@ -25251,7 +25316,7 @@ var SqliteFindingsRepository = class {
25251
25316
  }
25252
25317
  }
25253
25318
  sorted.sort(compareLocationOrder);
25254
- const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
25319
+ const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
25255
25320
  const page = sorted.slice(start, start + limit);
25256
25321
  const lastOnPage = page.at(-1);
25257
25322
  const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
@@ -27879,6 +27944,9 @@ function pageLimit(requested, fallback) {
27879
27944
  if (requested === void 0) return fallback;
27880
27945
  return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
27881
27946
  }
27947
+ function pageOffset(requested) {
27948
+ return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
27949
+ }
27882
27950
  function encodeReuseCursor(payload) {
27883
27951
  return Buffer.from(JSON.stringify(payload)).toString("base64url");
27884
27952
  }
@@ -28226,7 +28294,8 @@ var SqliteSecretVaultRepository = class {
28226
28294
  */
28227
28295
  listInventory(query = {}, now = Date.now()) {
28228
28296
  const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
28229
- const cursor = query.cursor === void 0 ? null : decodeKeysetCursor(query.cursor);
28297
+ const offset = pageOffset(query.offset);
28298
+ const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
28230
28299
  const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
28231
28300
  const rows = allRows(
28232
28301
  this.db.prepare(
@@ -28240,11 +28309,12 @@ var SqliteSecretVaultRepository = class {
28240
28309
  FROM secret_vault v
28241
28310
  ${where}
28242
28311
  ORDER BY v.last_seen DESC, v.pointer_id DESC
28243
- LIMIT :limit`
28312
+ LIMIT :limit OFFSET :offset`
28244
28313
  ),
28245
28314
  bindParams({
28246
28315
  now,
28247
28316
  limit: limit + 1,
28317
+ offset,
28248
28318
  ...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
28249
28319
  })
28250
28320
  );
@@ -28268,7 +28338,8 @@ var SqliteSecretVaultRepository = class {
28268
28338
  */
28269
28339
  listReuse(query = {}, now = Date.now()) {
28270
28340
  const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
28271
- const cursor = query.cursor === void 0 ? null : decodeReuseCursor(query.cursor);
28341
+ const offset = pageOffset(query.offset);
28342
+ const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
28272
28343
  const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
28273
28344
  OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
28274
28345
  const rows = allRows(
@@ -28283,11 +28354,12 @@ var SqliteSecretVaultRepository = class {
28283
28354
  FROM secret_vault v
28284
28355
  WHERE ${REUSED_PREDICATE} ${after}
28285
28356
  ORDER BY v.occurrence_count DESC, v.pointer_id DESC
28286
- LIMIT :limit`
28357
+ LIMIT :limit OFFSET :offset`
28287
28358
  ),
28288
28359
  bindParams({
28289
28360
  now,
28290
28361
  limit: limit + 1,
28362
+ offset,
28291
28363
  ...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
28292
28364
  })
28293
28365
  );
@@ -28312,7 +28384,8 @@ var SqliteSecretVaultRepository = class {
28312
28384
  */
28313
28385
  listDerefs(query = {}) {
28314
28386
  const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
28315
- const cursor = query.cursor === void 0 ? null : decodeKeysetCursor(query.cursor);
28387
+ const offset = pageOffset(query.offset);
28388
+ const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
28316
28389
  const conditions = [];
28317
28390
  if (query.includeBatched !== true) {
28318
28391
  conditions.push(`reason NOT IN ('display', 'view-render')`);
@@ -28325,21 +28398,28 @@ var SqliteSecretVaultRepository = class {
28325
28398
  this.db.prepare(
28326
28399
  `SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
28327
28400
  FROM secret_vault_deref ${where}
28328
- ORDER BY at DESC, id DESC LIMIT :limit`
28401
+ ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
28329
28402
  ),
28330
28403
  bindParams({
28331
28404
  limit: limit + 1,
28405
+ offset,
28332
28406
  ...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
28333
28407
  })
28334
28408
  );
28335
28409
  const hasMore = rows.length > limit;
28336
28410
  const page = hasMore ? rows.slice(0, limit) : rows;
28337
28411
  const last = page[page.length - 1];
28338
- const hiddenBatched = query.includeBatched === true ? 0 : countScalar(
28339
- this.db,
28340
- `SELECT count(*) AS n FROM secret_vault_deref WHERE reason IN ('display', 'view-render')`
28341
- );
28412
+ const counts = getRow(
28413
+ this.db.prepare(
28414
+ `SELECT count(*) AS total,
28415
+ count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
28416
+ FROM secret_vault_deref`
28417
+ )
28418
+ ) ?? { total: 0, hidden: 0 };
28419
+ const includeBatched = query.includeBatched === true;
28420
+ const hiddenBatched = includeBatched ? 0 : counts.hidden;
28342
28421
  return {
28422
+ totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
28343
28423
  items: page.map((r) => ({
28344
28424
  id: r.id,
28345
28425
  pointerId: r.pointer_id,
@@ -28364,6 +28444,43 @@ var SqliteSecretVaultRepository = class {
28364
28444
  `SELECT COUNT(*) AS n FROM secret_vault v WHERE ${REUSED_PREDICATE}`
28365
28445
  );
28366
28446
  }
28447
+ /**
28448
+ * Every entry held, and how many of them are NOT under `currentVersion` — the
28449
+ * standing record of a fingerprint-key rotation whose re-key did not reach
28450
+ * every row.
28451
+ *
28452
+ * This is the durable form of what `SecretVault.refreshFingerprints` reports
28453
+ * once. That count is an event, gone the moment it is printed; this is the
28454
+ * condition, and it stays true until some later rotation re-keys the rows. It
28455
+ * is therefore the one that can answer "is a shortfall still outstanding?" —
28456
+ * including for a rotation run from the CLI, which no dashboard render saw.
28457
+ *
28458
+ * `<>` rather than `<`: a row ahead of the current version is equally
28459
+ * unmatchable, and that is reachable — a key file restored from a backup, or
28460
+ * replaced after being lost, leaves rows stamped higher than the key is.
28461
+ *
28462
+ * Both numbers come from ONE statement, which is why this returns a pair
28463
+ * instead of offering two counts to call. Read separately, a purge landing
28464
+ * between them hands back a `stale` counted over rows the later `total` no
28465
+ * longer includes, and a disclosure built from that pair states a fraction
28466
+ * true of no state of the table — "1 of 0 stored values", or a negative
28467
+ * remainder. Same reasoning as `purgeVault`'s count, which comes from the
28468
+ * delete rather than from a `countEntries` standing beside it.
28469
+ */
28470
+ countFingerprintEpochs(currentVersion) {
28471
+ const row = getRow(
28472
+ this.db.prepare(
28473
+ `SELECT COUNT(*) AS total,
28474
+ COALESCE(
28475
+ SUM(CASE WHEN fingerprint_key_version <> :currentVersion THEN 1 ELSE 0 END),
28476
+ 0
28477
+ ) AS stale
28478
+ FROM secret_vault`
28479
+ ),
28480
+ { currentVersion }
28481
+ ) ?? { stale: 0, total: 0 };
28482
+ return { stale: row.stale, total: row.total };
28483
+ }
28367
28484
  };
28368
28485
 
28369
28486
  // ../../packages/persistence/src/repositories/security.ts
@@ -30086,13 +30203,22 @@ var SecretVault = class {
30086
30203
  * fingerprint collides with a row already refreshed, is skipped rather than
30087
30204
  * aborting the pass — one damaged entry must not strand the re-key of every
30088
30205
  * other. A skipped row keeps resolving under its old fingerprint epoch.
30206
+ *
30207
+ * Every skip is COUNTED, because best-effort and silent are different things:
30208
+ * the loss above is invisible at the moment it happens and only shows up later
30209
+ * as a duplicate pointer, so the pass owes its caller a denominator rather
30210
+ * than a bare success count.
30089
30211
  */
30090
30212
  async refreshFingerprints(next) {
30091
30213
  let refreshed = 0;
30214
+ let skipped = 0;
30092
30215
  for (const row of this.#repo.listAll()) {
30093
30216
  try {
30094
30217
  const raw = await this.#openRow(row);
30095
- if (raw === null) continue;
30218
+ if (raw === null) {
30219
+ skipped += 1;
30220
+ continue;
30221
+ }
30096
30222
  this.#repo.refreshFingerprint(row.pointerId, {
30097
30223
  valueFingerprint: exactFingerprintValue(next, raw),
30098
30224
  valueIdentityFingerprint: fingerprintValue(next, raw),
@@ -30100,10 +30226,10 @@ var SecretVault = class {
30100
30226
  });
30101
30227
  refreshed += 1;
30102
30228
  } catch {
30103
- continue;
30229
+ skipped += 1;
30104
30230
  }
30105
30231
  }
30106
- return refreshed;
30232
+ return { refreshed, skipped };
30107
30233
  }
30108
30234
  /**
30109
30235
  * Destroy every entry, making all outstanding pointers permanently
@@ -30656,8 +30782,25 @@ function scanText2(text2, ruleVersions, options = {}) {
30656
30782
  }
30657
30783
  }
30658
30784
 
30785
+ // ../../packages/plugin-sdk/src/regular-file.ts
30786
+ import { closeSync as closeSync2, constants, fstatSync, openSync as openSync2, readFileSync as readFileSync16 } from "fs";
30787
+ function notRegularFile(path) {
30788
+ return `not a regular file: ${path}`;
30789
+ }
30790
+ function readRegularFile(path, maxBytes) {
30791
+ const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK);
30792
+ try {
30793
+ const stat2 = fstatSync(fd);
30794
+ if (!stat2.isFile()) throw new Error(notRegularFile(path));
30795
+ if (maxBytes !== void 0 && stat2.size > maxBytes) throw new Error(`file too large: ${path}`);
30796
+ return readFileSync16(fd, "utf8");
30797
+ } finally {
30798
+ closeSync2(fd);
30799
+ }
30800
+ }
30801
+
30659
30802
  // ../../packages/plugin-sdk/src/repo.ts
30660
- import { existsSync as existsSync9, readFileSync as readFileSync16, statSync as statSync7 } from "fs";
30803
+ import { existsSync as existsSync9, statSync as statSync7 } from "fs";
30661
30804
  import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
30662
30805
  function remoteWithoutCredentials(remote) {
30663
30806
  const withoutInfo = withoutUserinfo(remote);
@@ -30761,9 +30904,10 @@ function resolveGitContext(root) {
30761
30904
  const headRoot = basename2(commonGitDir) === ".git" ? dirname5(commonGitDir) : root;
30762
30905
  return { configPath: join24(commonGitDir, "config"), headRoot };
30763
30906
  }
30907
+ var MAX_GIT_METADATA_BYTES = 1024 * 1024;
30764
30908
  function safeRead(path) {
30765
30909
  try {
30766
- return readFileSync16(path, "utf8");
30910
+ return readRegularFile(path, MAX_GIT_METADATA_BYTES);
30767
30911
  } catch {
30768
30912
  return void 0;
30769
30913
  }
@@ -31062,6 +31206,7 @@ function createIsolatedScanner(data, opts = {}) {
31062
31206
  text: text2,
31063
31207
  filePath: context?.filePath,
31064
31208
  eventKind: context?.eventKind,
31209
+ writtenRegions: context?.writtenRegions,
31065
31210
  attribute: scanOpts?.attribute === true
31066
31211
  }),
31067
31212
  reply: (message) => {
@@ -34551,21 +34696,21 @@ function chatgptKey(accountId) {
34551
34696
 
34552
34697
  // ../../packages/plugin-sdk/src/account/observation-log.ts
34553
34698
  import { createHash as createHash12 } from "crypto";
34554
- import { closeSync as closeSync2, constants, fstatSync, mkdirSync as mkdirSync2, openSync as openSync2, readSync, writeSync } from "fs";
34699
+ import { closeSync as closeSync3, constants as constants2, fstatSync as fstatSync2, mkdirSync as mkdirSync2, openSync as openSync3, readSync, writeSync } from "fs";
34555
34700
  import { join as join34 } from "path";
34556
34701
  var SESSION_LOG_CAP_BYTES = 16 * 1024 * 1024;
34557
34702
  var SESSION_LOG_TAIL_BYTES = 64 * 1024;
34558
34703
  var NEWLINE = 10;
34559
34704
  var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
34560
34705
  function sessionLogOpenFlags(noFollow) {
34561
- return constants.O_WRONLY | constants.O_APPEND | constants.O_CREAT | (noFollow ?? 0);
34706
+ return constants2.O_WRONLY | constants2.O_APPEND | constants2.O_CREAT | (noFollow ?? 0);
34562
34707
  }
34563
34708
  var SESSION_LOG_OPEN_FLAGS = sessionLogOpenFlags(
34564
- constants.O_NOFOLLOW
34709
+ constants2.O_NOFOLLOW
34565
34710
  );
34566
34711
  function closeQuietly2(fd) {
34567
34712
  try {
34568
- closeSync2(fd);
34713
+ closeSync3(fd);
34569
34714
  } catch {
34570
34715
  }
34571
34716
  }
@@ -34601,12 +34746,12 @@ function parseLines(buffer, base) {
34601
34746
  function readRange(path, from, capBytes) {
34602
34747
  let fd;
34603
34748
  try {
34604
- fd = openSync2(path, "r");
34749
+ fd = openSync3(path, "r");
34605
34750
  } catch {
34606
34751
  return void 0;
34607
34752
  }
34608
34753
  try {
34609
- const size = fstatSync(fd).size;
34754
+ const size = fstatSync2(fd).size;
34610
34755
  const length = Math.max(0, Math.min(size, capBytes) - from);
34611
34756
  const buffer = Buffer.alloc(length);
34612
34757
  let filled = 0;
@@ -34653,7 +34798,7 @@ function classifyObservation(observation) {
34653
34798
  }
34654
34799
 
34655
34800
  // ../../packages/plugin-sdk/src/account/codex-head.ts
34656
- import { closeSync as closeSync3, openSync as openSync3, readSync as readSync2 } from "fs";
34801
+ import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "fs";
34657
34802
  var CODEX_HEAD_READ_BYTES = 64 * 1024;
34658
34803
  var CODEX_HEAD_MAX_BYTES = 1024 * 1024;
34659
34804
  var NEWLINE2 = 10;
@@ -34686,7 +34831,7 @@ function parseHead(line) {
34686
34831
  function readCodexHead(rolloutPath) {
34687
34832
  let fd;
34688
34833
  try {
34689
- fd = openSync3(rolloutPath, "r");
34834
+ fd = openSync4(rolloutPath, "r");
34690
34835
  } catch (error2) {
34691
34836
  return isNotFound(error2) ? "pending" : void 0;
34692
34837
  }
@@ -34711,7 +34856,7 @@ function readCodexHead(rolloutPath) {
34711
34856
  return void 0;
34712
34857
  } finally {
34713
34858
  try {
34714
- closeSync3(fd);
34859
+ closeSync4(fd);
34715
34860
  } catch {
34716
34861
  }
34717
34862
  }
@@ -34984,10 +35129,10 @@ function codexLeafStamper(gateway, dataDir2, sessionId, transcriptPath) {
34984
35129
  // src/history/tail.ts
34985
35130
  import { createHash as createHash13 } from "crypto";
34986
35131
  import {
34987
- closeSync as closeSync4,
34988
- fstatSync as fstatSync2,
35132
+ closeSync as closeSync5,
35133
+ fstatSync as fstatSync3,
34989
35134
  mkdirSync as mkdirSync3,
34990
- openSync as openSync4,
35135
+ openSync as openSync5,
34991
35136
  readFileSync as readFileSync24,
34992
35137
  readSync as readSync3,
34993
35138
  writeFileSync as writeFileSync5
@@ -35033,12 +35178,12 @@ function writeOffset(dataDir2, sessionId, value) {
35033
35178
  function readTail(transcriptPath, startOffset) {
35034
35179
  let fd;
35035
35180
  try {
35036
- fd = openSync4(transcriptPath, "r");
35181
+ fd = openSync5(transcriptPath, "r");
35037
35182
  } catch {
35038
35183
  return { chunk: "", nextOffset: startOffset };
35039
35184
  }
35040
35185
  try {
35041
- const size = fstatSync2(fd).size;
35186
+ const size = fstatSync3(fd).size;
35042
35187
  const from = size < startOffset ? 0 : startOffset;
35043
35188
  if (from >= size) return { chunk: "", nextOffset: from };
35044
35189
  const length = size - from;
@@ -35059,7 +35204,7 @@ function readTail(transcriptPath, startOffset) {
35059
35204
  return { chunk: "", nextOffset: startOffset };
35060
35205
  } finally {
35061
35206
  try {
35062
- closeSync4(fd);
35207
+ closeSync5(fd);
35063
35208
  } catch {
35064
35209
  }
35065
35210
  }