@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.
- package/.codex-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/apply-suppressions.js +60 -19
- package/scripts/backfill.js +83 -24
- package/scripts/content-retention.js +60 -19
- package/scripts/filescan.js +94 -36
- package/scripts/firstrun.js +74 -32
- package/scripts/history-sync.js +60 -19
- package/scripts/intro.js +32 -6
- package/scripts/onboard.js +60 -19
- package/scripts/post-tool-use.js +97 -38
- package/scripts/pre-tool-use.js +97 -38
- package/scripts/query.js +73 -31
- package/scripts/reconcile.js +95 -36
- package/scripts/remediate.js +80 -21
- package/scripts/scan-worker.js +32 -6
- package/scripts/session-start.js +134 -72
- package/scripts/start-light.js +32 -6
- package/scripts/stop.js +78 -36
- package/scripts/sync.js +96 -38
- package/scripts/user-prompt-submit.js +103 -44
|
@@ -8757,7 +8757,11 @@ var ListFindingTypesQuery = object({
|
|
|
8757
8757
|
// and so is not bounded by what any page happens to hold.
|
|
8758
8758
|
includeId: string2().optional(),
|
|
8759
8759
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8760
|
-
cursor: string2().optional()
|
|
8760
|
+
cursor: string2().optional(),
|
|
8761
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8762
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8763
|
+
// from wherever it lands.
|
|
8764
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8761
8765
|
});
|
|
8762
8766
|
var ListFindingTypesResponse = object({
|
|
8763
8767
|
totals: object({
|
|
@@ -8838,7 +8842,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8838
8842
|
sessionId: string2().optional(),
|
|
8839
8843
|
from: iso_exports.datetime().optional(),
|
|
8840
8844
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8841
|
-
cursor: string2().optional()
|
|
8845
|
+
cursor: string2().optional(),
|
|
8846
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8847
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8848
|
+
// from wherever it lands.
|
|
8849
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8842
8850
|
});
|
|
8843
8851
|
var ListFindingInstancesResponse = object({
|
|
8844
8852
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8910,7 +8918,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8910
8918
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8911
8919
|
includeId: string2().optional(),
|
|
8912
8920
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8913
|
-
cursor: string2().optional()
|
|
8921
|
+
cursor: string2().optional(),
|
|
8922
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8923
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8924
|
+
// from wherever it lands.
|
|
8925
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8914
8926
|
});
|
|
8915
8927
|
var ListFindingLocationsResponse = object({
|
|
8916
8928
|
totals: object({
|
|
@@ -11399,7 +11411,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
11399
11411
|
var ListVaultInventoryQuery = object({
|
|
11400
11412
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11401
11413
|
// Opaque; names the last row of the page just served.
|
|
11402
|
-
cursor: string2().optional()
|
|
11414
|
+
cursor: string2().optional(),
|
|
11415
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11416
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11417
|
+
// from wherever it lands.
|
|
11418
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11403
11419
|
});
|
|
11404
11420
|
var ListVaultInventoryResponse = object({
|
|
11405
11421
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -11411,7 +11427,11 @@ var ListVaultInventoryResponse = object({
|
|
|
11411
11427
|
});
|
|
11412
11428
|
var ListVaultReuseQuery = object({
|
|
11413
11429
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11414
|
-
cursor: string2().optional()
|
|
11430
|
+
cursor: string2().optional(),
|
|
11431
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11432
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11433
|
+
// from wherever it lands.
|
|
11434
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11415
11435
|
});
|
|
11416
11436
|
var ListVaultReuseResponse = object({
|
|
11417
11437
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -11427,9 +11447,15 @@ var ListVaultDerefsQuery = object({
|
|
|
11427
11447
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
11428
11448
|
includeBatched: boolean2().optional(),
|
|
11429
11449
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11430
|
-
cursor: string2().optional()
|
|
11450
|
+
cursor: string2().optional(),
|
|
11451
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11452
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11453
|
+
// from wherever it lands.
|
|
11454
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11431
11455
|
});
|
|
11432
11456
|
var ListVaultDerefsResponse = object({
|
|
11457
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
11458
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
11433
11459
|
items: array(VaultDeref),
|
|
11434
11460
|
nextCursor: string2().nullable(),
|
|
11435
11461
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -19083,7 +19109,7 @@ var SqliteFindingsRepository = class {
|
|
|
19083
19109
|
};
|
|
19084
19110
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
19085
19111
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
19086
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
19112
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
19087
19113
|
const page = sorted.slice(start, start + limit);
|
|
19088
19114
|
const lastOnPage = page.at(-1);
|
|
19089
19115
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -19177,7 +19203,7 @@ var SqliteFindingsRepository = class {
|
|
|
19177
19203
|
accumulator.add(row);
|
|
19178
19204
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
19179
19205
|
total += 1;
|
|
19180
|
-
if (!isPastCursor(row)) continue;
|
|
19206
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
19181
19207
|
if (items.length < limit) {
|
|
19182
19208
|
items.push(toInstanceDetail(row));
|
|
19183
19209
|
last = row;
|
|
@@ -19266,7 +19292,7 @@ var SqliteFindingsRepository = class {
|
|
|
19266
19292
|
}
|
|
19267
19293
|
}
|
|
19268
19294
|
sorted.sort(compareLocationOrder);
|
|
19269
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
19295
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
19270
19296
|
const page = sorted.slice(start, start + limit);
|
|
19271
19297
|
const lastOnPage = page.at(-1);
|
|
19272
19298
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -21894,6 +21920,9 @@ function pageLimit(requested, fallback) {
|
|
|
21894
21920
|
if (requested === void 0) return fallback;
|
|
21895
21921
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
21896
21922
|
}
|
|
21923
|
+
function pageOffset(requested) {
|
|
21924
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
21925
|
+
}
|
|
21897
21926
|
function encodeReuseCursor(payload) {
|
|
21898
21927
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
21899
21928
|
}
|
|
@@ -22241,7 +22270,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
22241
22270
|
*/
|
|
22242
22271
|
listInventory(query = {}, now = Date.now()) {
|
|
22243
22272
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
22244
|
-
const
|
|
22273
|
+
const offset = pageOffset(query.offset);
|
|
22274
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
22245
22275
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
22246
22276
|
const rows = allRows(
|
|
22247
22277
|
this.db.prepare(
|
|
@@ -22255,11 +22285,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
22255
22285
|
FROM secret_vault v
|
|
22256
22286
|
${where}
|
|
22257
22287
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
22258
|
-
LIMIT :limit`
|
|
22288
|
+
LIMIT :limit OFFSET :offset`
|
|
22259
22289
|
),
|
|
22260
22290
|
bindParams({
|
|
22261
22291
|
now,
|
|
22262
22292
|
limit: limit + 1,
|
|
22293
|
+
offset,
|
|
22263
22294
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
22264
22295
|
})
|
|
22265
22296
|
);
|
|
@@ -22283,7 +22314,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
22283
22314
|
*/
|
|
22284
22315
|
listReuse(query = {}, now = Date.now()) {
|
|
22285
22316
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
22286
|
-
const
|
|
22317
|
+
const offset = pageOffset(query.offset);
|
|
22318
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
22287
22319
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
22288
22320
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
22289
22321
|
const rows = allRows(
|
|
@@ -22298,11 +22330,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
22298
22330
|
FROM secret_vault v
|
|
22299
22331
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
22300
22332
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
22301
|
-
LIMIT :limit`
|
|
22333
|
+
LIMIT :limit OFFSET :offset`
|
|
22302
22334
|
),
|
|
22303
22335
|
bindParams({
|
|
22304
22336
|
now,
|
|
22305
22337
|
limit: limit + 1,
|
|
22338
|
+
offset,
|
|
22306
22339
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
22307
22340
|
})
|
|
22308
22341
|
);
|
|
@@ -22327,7 +22360,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
22327
22360
|
*/
|
|
22328
22361
|
listDerefs(query = {}) {
|
|
22329
22362
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
22330
|
-
const
|
|
22363
|
+
const offset = pageOffset(query.offset);
|
|
22364
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
22331
22365
|
const conditions = [];
|
|
22332
22366
|
if (query.includeBatched !== true) {
|
|
22333
22367
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -22340,21 +22374,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
22340
22374
|
this.db.prepare(
|
|
22341
22375
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
22342
22376
|
FROM secret_vault_deref ${where}
|
|
22343
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
22377
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
22344
22378
|
),
|
|
22345
22379
|
bindParams({
|
|
22346
22380
|
limit: limit + 1,
|
|
22381
|
+
offset,
|
|
22347
22382
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
22348
22383
|
})
|
|
22349
22384
|
);
|
|
22350
22385
|
const hasMore = rows.length > limit;
|
|
22351
22386
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
22352
22387
|
const last = page[page.length - 1];
|
|
22353
|
-
const
|
|
22354
|
-
this.db
|
|
22355
|
-
|
|
22356
|
-
|
|
22388
|
+
const counts = getRow(
|
|
22389
|
+
this.db.prepare(
|
|
22390
|
+
`SELECT count(*) AS total,
|
|
22391
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
22392
|
+
FROM secret_vault_deref`
|
|
22393
|
+
)
|
|
22394
|
+
) ?? { total: 0, hidden: 0 };
|
|
22395
|
+
const includeBatched = query.includeBatched === true;
|
|
22396
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
22357
22397
|
return {
|
|
22398
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
22358
22399
|
items: page.map((r) => ({
|
|
22359
22400
|
id: r.id,
|
|
22360
22401
|
pointerId: r.pointer_id,
|
package/scripts/filescan.js
CHANGED
|
@@ -9656,7 +9656,11 @@ var ListFindingTypesQuery = object({
|
|
|
9656
9656
|
// and so is not bounded by what any page happens to hold.
|
|
9657
9657
|
includeId: string2().optional(),
|
|
9658
9658
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
9659
|
-
cursor: string2().optional()
|
|
9659
|
+
cursor: string2().optional(),
|
|
9660
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
9661
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
9662
|
+
// from wherever it lands.
|
|
9663
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
9660
9664
|
});
|
|
9661
9665
|
var ListFindingTypesResponse = object({
|
|
9662
9666
|
totals: object({
|
|
@@ -9737,7 +9741,11 @@ var ListFindingInstancesQuery = object({
|
|
|
9737
9741
|
sessionId: string2().optional(),
|
|
9738
9742
|
from: iso_exports.datetime().optional(),
|
|
9739
9743
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
9740
|
-
cursor: string2().optional()
|
|
9744
|
+
cursor: string2().optional(),
|
|
9745
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
9746
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
9747
|
+
// from wherever it lands.
|
|
9748
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
9741
9749
|
});
|
|
9742
9750
|
var ListFindingInstancesResponse = object({
|
|
9743
9751
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -9809,7 +9817,11 @@ var ListFindingLocationsQuery = object({
|
|
|
9809
9817
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
9810
9818
|
includeId: string2().optional(),
|
|
9811
9819
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
9812
|
-
cursor: string2().optional()
|
|
9820
|
+
cursor: string2().optional(),
|
|
9821
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
9822
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
9823
|
+
// from wherever it lands.
|
|
9824
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
9813
9825
|
});
|
|
9814
9826
|
var ListFindingLocationsResponse = object({
|
|
9815
9827
|
totals: object({
|
|
@@ -12531,7 +12543,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
12531
12543
|
var ListVaultInventoryQuery = object({
|
|
12532
12544
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
12533
12545
|
// Opaque; names the last row of the page just served.
|
|
12534
|
-
cursor: string2().optional()
|
|
12546
|
+
cursor: string2().optional(),
|
|
12547
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
12548
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
12549
|
+
// from wherever it lands.
|
|
12550
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
12535
12551
|
});
|
|
12536
12552
|
var ListVaultInventoryResponse = object({
|
|
12537
12553
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -12543,7 +12559,11 @@ var ListVaultInventoryResponse = object({
|
|
|
12543
12559
|
});
|
|
12544
12560
|
var ListVaultReuseQuery = object({
|
|
12545
12561
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
12546
|
-
cursor: string2().optional()
|
|
12562
|
+
cursor: string2().optional(),
|
|
12563
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
12564
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
12565
|
+
// from wherever it lands.
|
|
12566
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
12547
12567
|
});
|
|
12548
12568
|
var ListVaultReuseResponse = object({
|
|
12549
12569
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -12559,9 +12579,15 @@ var ListVaultDerefsQuery = object({
|
|
|
12559
12579
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
12560
12580
|
includeBatched: boolean2().optional(),
|
|
12561
12581
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
12562
|
-
cursor: string2().optional()
|
|
12582
|
+
cursor: string2().optional(),
|
|
12583
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
12584
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
12585
|
+
// from wherever it lands.
|
|
12586
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
12563
12587
|
});
|
|
12564
12588
|
var ListVaultDerefsResponse = object({
|
|
12589
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
12590
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
12565
12591
|
items: array(VaultDeref),
|
|
12566
12592
|
nextCursor: string2().nullable(),
|
|
12567
12593
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -21582,7 +21608,7 @@ var SqliteFindingsRepository = class {
|
|
|
21582
21608
|
};
|
|
21583
21609
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
21584
21610
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
21585
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
21611
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
21586
21612
|
const page = sorted.slice(start, start + limit);
|
|
21587
21613
|
const lastOnPage = page.at(-1);
|
|
21588
21614
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -21676,7 +21702,7 @@ var SqliteFindingsRepository = class {
|
|
|
21676
21702
|
accumulator.add(row);
|
|
21677
21703
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
21678
21704
|
total += 1;
|
|
21679
|
-
if (!isPastCursor(row)) continue;
|
|
21705
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
21680
21706
|
if (items.length < limit) {
|
|
21681
21707
|
items.push(toInstanceDetail(row));
|
|
21682
21708
|
last = row;
|
|
@@ -21765,7 +21791,7 @@ var SqliteFindingsRepository = class {
|
|
|
21765
21791
|
}
|
|
21766
21792
|
}
|
|
21767
21793
|
sorted.sort(compareLocationOrder);
|
|
21768
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
21794
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
21769
21795
|
const page = sorted.slice(start, start + limit);
|
|
21770
21796
|
const lastOnPage = page.at(-1);
|
|
21771
21797
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -24393,6 +24419,9 @@ function pageLimit(requested, fallback) {
|
|
|
24393
24419
|
if (requested === void 0) return fallback;
|
|
24394
24420
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
24395
24421
|
}
|
|
24422
|
+
function pageOffset(requested) {
|
|
24423
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
24424
|
+
}
|
|
24396
24425
|
function encodeReuseCursor(payload) {
|
|
24397
24426
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
24398
24427
|
}
|
|
@@ -24740,7 +24769,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
24740
24769
|
*/
|
|
24741
24770
|
listInventory(query = {}, now = Date.now()) {
|
|
24742
24771
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
24743
|
-
const
|
|
24772
|
+
const offset = pageOffset(query.offset);
|
|
24773
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
24744
24774
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
24745
24775
|
const rows = allRows(
|
|
24746
24776
|
this.db.prepare(
|
|
@@ -24754,11 +24784,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
24754
24784
|
FROM secret_vault v
|
|
24755
24785
|
${where}
|
|
24756
24786
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
24757
|
-
LIMIT :limit`
|
|
24787
|
+
LIMIT :limit OFFSET :offset`
|
|
24758
24788
|
),
|
|
24759
24789
|
bindParams({
|
|
24760
24790
|
now,
|
|
24761
24791
|
limit: limit + 1,
|
|
24792
|
+
offset,
|
|
24762
24793
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
24763
24794
|
})
|
|
24764
24795
|
);
|
|
@@ -24782,7 +24813,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
24782
24813
|
*/
|
|
24783
24814
|
listReuse(query = {}, now = Date.now()) {
|
|
24784
24815
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
24785
|
-
const
|
|
24816
|
+
const offset = pageOffset(query.offset);
|
|
24817
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
24786
24818
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
24787
24819
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
24788
24820
|
const rows = allRows(
|
|
@@ -24797,11 +24829,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
24797
24829
|
FROM secret_vault v
|
|
24798
24830
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
24799
24831
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
24800
|
-
LIMIT :limit`
|
|
24832
|
+
LIMIT :limit OFFSET :offset`
|
|
24801
24833
|
),
|
|
24802
24834
|
bindParams({
|
|
24803
24835
|
now,
|
|
24804
24836
|
limit: limit + 1,
|
|
24837
|
+
offset,
|
|
24805
24838
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
24806
24839
|
})
|
|
24807
24840
|
);
|
|
@@ -24826,7 +24859,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
24826
24859
|
*/
|
|
24827
24860
|
listDerefs(query = {}) {
|
|
24828
24861
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
24829
|
-
const
|
|
24862
|
+
const offset = pageOffset(query.offset);
|
|
24863
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
24830
24864
|
const conditions = [];
|
|
24831
24865
|
if (query.includeBatched !== true) {
|
|
24832
24866
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -24839,21 +24873,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
24839
24873
|
this.db.prepare(
|
|
24840
24874
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
24841
24875
|
FROM secret_vault_deref ${where}
|
|
24842
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
24876
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
24843
24877
|
),
|
|
24844
24878
|
bindParams({
|
|
24845
24879
|
limit: limit + 1,
|
|
24880
|
+
offset,
|
|
24846
24881
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
24847
24882
|
})
|
|
24848
24883
|
);
|
|
24849
24884
|
const hasMore = rows.length > limit;
|
|
24850
24885
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
24851
24886
|
const last = page[page.length - 1];
|
|
24852
|
-
const
|
|
24853
|
-
this.db
|
|
24854
|
-
|
|
24855
|
-
|
|
24887
|
+
const counts = getRow(
|
|
24888
|
+
this.db.prepare(
|
|
24889
|
+
`SELECT count(*) AS total,
|
|
24890
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
24891
|
+
FROM secret_vault_deref`
|
|
24892
|
+
)
|
|
24893
|
+
) ?? { total: 0, hidden: 0 };
|
|
24894
|
+
const includeBatched = query.includeBatched === true;
|
|
24895
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
24856
24896
|
return {
|
|
24897
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
24857
24898
|
items: page.map((r) => ({
|
|
24858
24899
|
id: r.id,
|
|
24859
24900
|
pointerId: r.pointer_id,
|
|
@@ -33246,8 +33287,25 @@ function bundledMaskingRules() {
|
|
|
33246
33287
|
return ensureBundledPacks() ? getLoadedRules() : null;
|
|
33247
33288
|
}
|
|
33248
33289
|
|
|
33290
|
+
// ../../packages/plugin-sdk/src/regular-file.ts
|
|
33291
|
+
import { closeSync as closeSync2, constants, fstatSync, openSync as openSync2, readFileSync as readFileSync16 } from "fs";
|
|
33292
|
+
function notRegularFile(path) {
|
|
33293
|
+
return `not a regular file: ${path}`;
|
|
33294
|
+
}
|
|
33295
|
+
function readRegularFile(path, maxBytes) {
|
|
33296
|
+
const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
33297
|
+
try {
|
|
33298
|
+
const stat2 = fstatSync(fd);
|
|
33299
|
+
if (!stat2.isFile()) throw new Error(notRegularFile(path));
|
|
33300
|
+
if (maxBytes !== void 0 && stat2.size > maxBytes) throw new Error(`file too large: ${path}`);
|
|
33301
|
+
return readFileSync16(fd, "utf8");
|
|
33302
|
+
} finally {
|
|
33303
|
+
closeSync2(fd);
|
|
33304
|
+
}
|
|
33305
|
+
}
|
|
33306
|
+
|
|
33249
33307
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
33250
|
-
import { existsSync as existsSync9,
|
|
33308
|
+
import { existsSync as existsSync9, statSync as statSync7 } from "fs";
|
|
33251
33309
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
|
|
33252
33310
|
function remoteWithoutCredentials(remote) {
|
|
33253
33311
|
const withoutInfo = withoutUserinfo(remote);
|
|
@@ -33358,9 +33416,10 @@ function resolveGitContext(root) {
|
|
|
33358
33416
|
const headRoot = basename2(commonGitDir) === ".git" ? dirname5(commonGitDir) : root;
|
|
33359
33417
|
return { configPath: join24(commonGitDir, "config"), headRoot };
|
|
33360
33418
|
}
|
|
33419
|
+
var MAX_GIT_METADATA_BYTES = 1024 * 1024;
|
|
33361
33420
|
function safeRead(path) {
|
|
33362
33421
|
try {
|
|
33363
|
-
return
|
|
33422
|
+
return readRegularFile(path, MAX_GIT_METADATA_BYTES);
|
|
33364
33423
|
} catch {
|
|
33365
33424
|
return void 0;
|
|
33366
33425
|
}
|
|
@@ -33981,11 +34040,10 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
33981
34040
|
|
|
33982
34041
|
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
33983
34042
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
33984
|
-
import { readFileSync as readFileSync17 } from "fs";
|
|
33985
34043
|
import { join as join25 } from "path";
|
|
33986
34044
|
function readIgnoreLayer(dir, filename, anchorLen) {
|
|
33987
34045
|
try {
|
|
33988
|
-
return { matcher: (0, import_ignore.default)().add(
|
|
34046
|
+
return { matcher: (0, import_ignore.default)().add(readRegularFile(join25(dir, filename))), anchorLen };
|
|
33989
34047
|
} catch {
|
|
33990
34048
|
return void 0;
|
|
33991
34049
|
}
|
|
@@ -35374,7 +35432,7 @@ function renderMultiRepoSummary(summary, opts = {}) {
|
|
|
35374
35432
|
}
|
|
35375
35433
|
|
|
35376
35434
|
// ../../packages/scanner/src/scan.ts
|
|
35377
|
-
import { existsSync as existsSync13, readFileSync as
|
|
35435
|
+
import { existsSync as existsSync13, readFileSync as readFileSync25 } from "fs";
|
|
35378
35436
|
import { dirname as dirname13, extname as extname2, isAbsolute as isAbsolute4, relative as relative5 } from "path";
|
|
35379
35437
|
|
|
35380
35438
|
// ../../packages/plugin-runtime/src/account-scope.ts
|
|
@@ -36444,7 +36502,7 @@ function sessionToolIsKeyed(tool) {
|
|
|
36444
36502
|
|
|
36445
36503
|
// ../../packages/plugin-runtime/src/attached/config-inventory-sync.ts
|
|
36446
36504
|
import { createHash as createHash12 } from "crypto";
|
|
36447
|
-
import { readFileSync as
|
|
36505
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
36448
36506
|
import { join as join30 } from "path";
|
|
36449
36507
|
|
|
36450
36508
|
// ../../packages/plugin-runtime/src/attached/config-inventory-wire.ts
|
|
@@ -36544,7 +36602,7 @@ async function publishByRename(tmp, file, move = rename2) {
|
|
|
36544
36602
|
|
|
36545
36603
|
// ../../packages/plugin-runtime/src/attached/capture-settings.ts
|
|
36546
36604
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
36547
|
-
import { readFileSync as
|
|
36605
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
36548
36606
|
import { rm, writeFile as writeFile2 } from "fs/promises";
|
|
36549
36607
|
import { join as join28 } from "path";
|
|
36550
36608
|
var HookCaptureSettingsSchema = CaptureSettings.pick({
|
|
@@ -36932,7 +36990,7 @@ function reportKey(request) {
|
|
|
36932
36990
|
function readStagedEntries(dataDir2) {
|
|
36933
36991
|
let parsed2;
|
|
36934
36992
|
try {
|
|
36935
|
-
parsed2 = JSON.parse(
|
|
36993
|
+
parsed2 = JSON.parse(readFileSync18(stagedConfigInventoryPath(dataDir2), "utf8"));
|
|
36936
36994
|
} catch {
|
|
36937
36995
|
return [];
|
|
36938
36996
|
}
|
|
@@ -36956,7 +37014,7 @@ function isTimestamp(value) {
|
|
|
36956
37014
|
}
|
|
36957
37015
|
|
|
36958
37016
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
36959
|
-
import { readFileSync as
|
|
37017
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
36960
37018
|
import { join as join31 } from "path";
|
|
36961
37019
|
var FORWARD_DROPS_FILENAME = ATTACHED_FORWARD_DROPS_FILENAME;
|
|
36962
37020
|
function forwardDropsPath(dataDir2) {
|
|
@@ -36978,7 +37036,7 @@ function recordForwardDrops(dataDir2, count, nowMs) {
|
|
|
36978
37036
|
}
|
|
36979
37037
|
function readForwardDrops(dataDir2) {
|
|
36980
37038
|
try {
|
|
36981
|
-
const parsed2 = JSON.parse(
|
|
37039
|
+
const parsed2 = JSON.parse(readFileSync19(forwardDropsPath(dataDir2), "utf8"));
|
|
36982
37040
|
if (typeof parsed2 !== "object" || parsed2 === null) return null;
|
|
36983
37041
|
const record2 = parsed2;
|
|
36984
37042
|
if (typeof record2.droppedForwards !== "number" || !Number.isFinite(record2.droppedForwards)) {
|
|
@@ -38082,7 +38140,7 @@ function toWireInspection(insp, nameKey) {
|
|
|
38082
38140
|
}
|
|
38083
38141
|
|
|
38084
38142
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
38085
|
-
import { readFileSync as
|
|
38143
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
38086
38144
|
|
|
38087
38145
|
// ../../packages/plugin-runtime/src/attached/install-record.ts
|
|
38088
38146
|
import { readFile as readFile3, stat } from "fs/promises";
|
|
@@ -38155,7 +38213,7 @@ async function readInstalledVersionBounded(installRoot) {
|
|
|
38155
38213
|
}
|
|
38156
38214
|
|
|
38157
38215
|
// ../../packages/plugin-runtime/src/attached/posture-report-state.ts
|
|
38158
|
-
import { readFileSync as
|
|
38216
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
38159
38217
|
import { join as join33 } from "path";
|
|
38160
38218
|
var POSTURE_REPORT_STATE_FILENAME = ATTACHED_POSTURE_REPORT_FILENAME;
|
|
38161
38219
|
var OUTCOME_KEYS = {
|
|
@@ -38431,11 +38489,11 @@ function createPostureStore(dir = settingsDir(), legacyDir) {
|
|
|
38431
38489
|
}
|
|
38432
38490
|
|
|
38433
38491
|
// ../../packages/plugin-runtime/src/attached/label-drops.ts
|
|
38434
|
-
import { readFileSync as
|
|
38492
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
38435
38493
|
import { join as join35 } from "path";
|
|
38436
38494
|
|
|
38437
38495
|
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
38438
|
-
import { readFileSync as
|
|
38496
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
38439
38497
|
import { join as join36 } from "path";
|
|
38440
38498
|
|
|
38441
38499
|
// ../../packages/plugin-runtime/src/attached/status.ts
|
|
@@ -38643,7 +38701,7 @@ function sendScanSightings(base, input, deps = {}) {
|
|
|
38643
38701
|
import { statSync as statSync11 } from "fs";
|
|
38644
38702
|
|
|
38645
38703
|
// ../../packages/scanner/src/walk.ts
|
|
38646
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
38704
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync24, statSync as statSync10 } from "fs";
|
|
38647
38705
|
import { homedir as homedir3 } from "os";
|
|
38648
38706
|
import { join as join38, relative as relative4, sep as sep7 } from "path";
|
|
38649
38707
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
@@ -38771,7 +38829,7 @@ function* walkSourceFiles(opts = {}) {
|
|
|
38771
38829
|
if (opts.shouldRead && !opts.shouldRead(meta3)) continue;
|
|
38772
38830
|
let content;
|
|
38773
38831
|
try {
|
|
38774
|
-
content =
|
|
38832
|
+
content = readFileSync24(file.path, "utf8");
|
|
38775
38833
|
} catch {
|
|
38776
38834
|
continue;
|
|
38777
38835
|
}
|
|
@@ -39219,7 +39277,7 @@ function scanManifests(egress, ledger, updates, rootDir, scopeKeyOf2, onReposito
|
|
|
39219
39277
|
}
|
|
39220
39278
|
let content;
|
|
39221
39279
|
try {
|
|
39222
|
-
content =
|
|
39280
|
+
content = readFileSync25(manifest.path, "utf8");
|
|
39223
39281
|
} catch {
|
|
39224
39282
|
continue;
|
|
39225
39283
|
}
|