@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
|
@@ -8777,7 +8777,11 @@ var ListFindingTypesQuery = object({
|
|
|
8777
8777
|
// and so is not bounded by what any page happens to hold.
|
|
8778
8778
|
includeId: string2().optional(),
|
|
8779
8779
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8780
|
-
cursor: string2().optional()
|
|
8780
|
+
cursor: string2().optional(),
|
|
8781
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8782
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8783
|
+
// from wherever it lands.
|
|
8784
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8781
8785
|
});
|
|
8782
8786
|
var ListFindingTypesResponse = object({
|
|
8783
8787
|
totals: object({
|
|
@@ -8858,7 +8862,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8858
8862
|
sessionId: string2().optional(),
|
|
8859
8863
|
from: iso_exports.datetime().optional(),
|
|
8860
8864
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8861
|
-
cursor: string2().optional()
|
|
8865
|
+
cursor: string2().optional(),
|
|
8866
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8867
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8868
|
+
// from wherever it lands.
|
|
8869
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8862
8870
|
});
|
|
8863
8871
|
var ListFindingInstancesResponse = object({
|
|
8864
8872
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8930,7 +8938,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8930
8938
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8931
8939
|
includeId: string2().optional(),
|
|
8932
8940
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8933
|
-
cursor: string2().optional()
|
|
8941
|
+
cursor: string2().optional(),
|
|
8942
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8943
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8944
|
+
// from wherever it lands.
|
|
8945
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8934
8946
|
});
|
|
8935
8947
|
var ListFindingLocationsResponse = object({
|
|
8936
8948
|
totals: object({
|
|
@@ -11567,7 +11579,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
11567
11579
|
var ListVaultInventoryQuery = object({
|
|
11568
11580
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11569
11581
|
// Opaque; names the last row of the page just served.
|
|
11570
|
-
cursor: string2().optional()
|
|
11582
|
+
cursor: string2().optional(),
|
|
11583
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11584
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11585
|
+
// from wherever it lands.
|
|
11586
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11571
11587
|
});
|
|
11572
11588
|
var ListVaultInventoryResponse = object({
|
|
11573
11589
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -11579,7 +11595,11 @@ var ListVaultInventoryResponse = object({
|
|
|
11579
11595
|
});
|
|
11580
11596
|
var ListVaultReuseQuery = object({
|
|
11581
11597
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11582
|
-
cursor: string2().optional()
|
|
11598
|
+
cursor: string2().optional(),
|
|
11599
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11600
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11601
|
+
// from wherever it lands.
|
|
11602
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11583
11603
|
});
|
|
11584
11604
|
var ListVaultReuseResponse = object({
|
|
11585
11605
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -11595,9 +11615,15 @@ var ListVaultDerefsQuery = object({
|
|
|
11595
11615
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
11596
11616
|
includeBatched: boolean2().optional(),
|
|
11597
11617
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11598
|
-
cursor: string2().optional()
|
|
11618
|
+
cursor: string2().optional(),
|
|
11619
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11620
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11621
|
+
// from wherever it lands.
|
|
11622
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11599
11623
|
});
|
|
11600
11624
|
var ListVaultDerefsResponse = object({
|
|
11625
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
11626
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
11601
11627
|
items: array(VaultDeref),
|
|
11602
11628
|
nextCursor: string2().nullable(),
|
|
11603
11629
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -25185,7 +25211,7 @@ var SqliteFindingsRepository = class {
|
|
|
25185
25211
|
};
|
|
25186
25212
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
25187
25213
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
25188
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
25214
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
25189
25215
|
const page = sorted.slice(start, start + limit);
|
|
25190
25216
|
const lastOnPage = page.at(-1);
|
|
25191
25217
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -25279,7 +25305,7 @@ var SqliteFindingsRepository = class {
|
|
|
25279
25305
|
accumulator.add(row);
|
|
25280
25306
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
25281
25307
|
total += 1;
|
|
25282
|
-
if (!isPastCursor(row)) continue;
|
|
25308
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
25283
25309
|
if (items.length < limit) {
|
|
25284
25310
|
items.push(toInstanceDetail(row));
|
|
25285
25311
|
last = row;
|
|
@@ -25368,7 +25394,7 @@ var SqliteFindingsRepository = class {
|
|
|
25368
25394
|
}
|
|
25369
25395
|
}
|
|
25370
25396
|
sorted.sort(compareLocationOrder);
|
|
25371
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
25397
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
25372
25398
|
const page = sorted.slice(start, start + limit);
|
|
25373
25399
|
const lastOnPage = page.at(-1);
|
|
25374
25400
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -27996,6 +28022,9 @@ function pageLimit(requested, fallback) {
|
|
|
27996
28022
|
if (requested === void 0) return fallback;
|
|
27997
28023
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
27998
28024
|
}
|
|
28025
|
+
function pageOffset(requested) {
|
|
28026
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
28027
|
+
}
|
|
27999
28028
|
function encodeReuseCursor(payload) {
|
|
28000
28029
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
28001
28030
|
}
|
|
@@ -28343,7 +28372,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28343
28372
|
*/
|
|
28344
28373
|
listInventory(query = {}, now = Date.now()) {
|
|
28345
28374
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
28346
|
-
const
|
|
28375
|
+
const offset = pageOffset(query.offset);
|
|
28376
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
28347
28377
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
28348
28378
|
const rows = allRows(
|
|
28349
28379
|
this.db.prepare(
|
|
@@ -28357,11 +28387,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
28357
28387
|
FROM secret_vault v
|
|
28358
28388
|
${where}
|
|
28359
28389
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
28360
|
-
LIMIT :limit`
|
|
28390
|
+
LIMIT :limit OFFSET :offset`
|
|
28361
28391
|
),
|
|
28362
28392
|
bindParams({
|
|
28363
28393
|
now,
|
|
28364
28394
|
limit: limit + 1,
|
|
28395
|
+
offset,
|
|
28365
28396
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
28366
28397
|
})
|
|
28367
28398
|
);
|
|
@@ -28385,7 +28416,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28385
28416
|
*/
|
|
28386
28417
|
listReuse(query = {}, now = Date.now()) {
|
|
28387
28418
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
28388
|
-
const
|
|
28419
|
+
const offset = pageOffset(query.offset);
|
|
28420
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
28389
28421
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
28390
28422
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
28391
28423
|
const rows = allRows(
|
|
@@ -28400,11 +28432,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
28400
28432
|
FROM secret_vault v
|
|
28401
28433
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
28402
28434
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
28403
|
-
LIMIT :limit`
|
|
28435
|
+
LIMIT :limit OFFSET :offset`
|
|
28404
28436
|
),
|
|
28405
28437
|
bindParams({
|
|
28406
28438
|
now,
|
|
28407
28439
|
limit: limit + 1,
|
|
28440
|
+
offset,
|
|
28408
28441
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
28409
28442
|
})
|
|
28410
28443
|
);
|
|
@@ -28429,7 +28462,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28429
28462
|
*/
|
|
28430
28463
|
listDerefs(query = {}) {
|
|
28431
28464
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
28432
|
-
const
|
|
28465
|
+
const offset = pageOffset(query.offset);
|
|
28466
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
28433
28467
|
const conditions = [];
|
|
28434
28468
|
if (query.includeBatched !== true) {
|
|
28435
28469
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -28442,21 +28476,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
28442
28476
|
this.db.prepare(
|
|
28443
28477
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
28444
28478
|
FROM secret_vault_deref ${where}
|
|
28445
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
28479
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
28446
28480
|
),
|
|
28447
28481
|
bindParams({
|
|
28448
28482
|
limit: limit + 1,
|
|
28483
|
+
offset,
|
|
28449
28484
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
28450
28485
|
})
|
|
28451
28486
|
);
|
|
28452
28487
|
const hasMore = rows.length > limit;
|
|
28453
28488
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
28454
28489
|
const last = page[page.length - 1];
|
|
28455
|
-
const
|
|
28456
|
-
this.db
|
|
28457
|
-
|
|
28458
|
-
|
|
28490
|
+
const counts = getRow(
|
|
28491
|
+
this.db.prepare(
|
|
28492
|
+
`SELECT count(*) AS total,
|
|
28493
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
28494
|
+
FROM secret_vault_deref`
|
|
28495
|
+
)
|
|
28496
|
+
) ?? { total: 0, hidden: 0 };
|
|
28497
|
+
const includeBatched = query.includeBatched === true;
|
|
28498
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
28459
28499
|
return {
|
|
28500
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
28460
28501
|
items: page.map((r) => ({
|
|
28461
28502
|
id: r.id,
|
|
28462
28503
|
pointerId: r.pointer_id,
|
|
@@ -30917,8 +30958,25 @@ function bundledMaskingRules() {
|
|
|
30917
30958
|
return ensureBundledPacks() ? getLoadedRules() : null;
|
|
30918
30959
|
}
|
|
30919
30960
|
|
|
30961
|
+
// ../../packages/plugin-sdk/src/regular-file.ts
|
|
30962
|
+
import { closeSync as closeSync2, constants, fstatSync, openSync as openSync2, readFileSync as readFileSync16 } from "fs";
|
|
30963
|
+
function notRegularFile(path) {
|
|
30964
|
+
return `not a regular file: ${path}`;
|
|
30965
|
+
}
|
|
30966
|
+
function readRegularFile(path, maxBytes) {
|
|
30967
|
+
const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
30968
|
+
try {
|
|
30969
|
+
const stat2 = fstatSync(fd);
|
|
30970
|
+
if (!stat2.isFile()) throw new Error(notRegularFile(path));
|
|
30971
|
+
if (maxBytes !== void 0 && stat2.size > maxBytes) throw new Error(`file too large: ${path}`);
|
|
30972
|
+
return readFileSync16(fd, "utf8");
|
|
30973
|
+
} finally {
|
|
30974
|
+
closeSync2(fd);
|
|
30975
|
+
}
|
|
30976
|
+
}
|
|
30977
|
+
|
|
30920
30978
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
30921
|
-
import { existsSync as existsSync9,
|
|
30979
|
+
import { existsSync as existsSync9, statSync as statSync7 } from "fs";
|
|
30922
30980
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
|
|
30923
30981
|
function remoteWithoutCredentials(remote) {
|
|
30924
30982
|
const withoutInfo = withoutUserinfo(remote);
|
|
@@ -31007,9 +31065,10 @@ function resolveGitContext(root) {
|
|
|
31007
31065
|
const headRoot = basename2(commonGitDir) === ".git" ? dirname5(commonGitDir) : root;
|
|
31008
31066
|
return { configPath: join24(commonGitDir, "config"), headRoot };
|
|
31009
31067
|
}
|
|
31068
|
+
var MAX_GIT_METADATA_BYTES = 1024 * 1024;
|
|
31010
31069
|
function safeRead(path) {
|
|
31011
31070
|
try {
|
|
31012
|
-
return
|
|
31071
|
+
return readRegularFile(path, MAX_GIT_METADATA_BYTES);
|
|
31013
31072
|
} catch {
|
|
31014
31073
|
return void 0;
|
|
31015
31074
|
}
|
|
@@ -31668,10 +31727,10 @@ function isPositiveSafeInteger(value) {
|
|
|
31668
31727
|
|
|
31669
31728
|
// ../../packages/plugin-sdk/src/model-governance.ts
|
|
31670
31729
|
import {
|
|
31671
|
-
closeSync as
|
|
31672
|
-
fstatSync,
|
|
31730
|
+
closeSync as closeSync3,
|
|
31731
|
+
fstatSync as fstatSync2,
|
|
31673
31732
|
mkdirSync as mkdirSync2,
|
|
31674
|
-
openSync as
|
|
31733
|
+
openSync as openSync3,
|
|
31675
31734
|
readFileSync as readFileSync18,
|
|
31676
31735
|
readSync,
|
|
31677
31736
|
writeFileSync as writeFileSync5
|
|
@@ -31706,9 +31765,9 @@ function readSessionModel(dataDir2, sessionId) {
|
|
|
31706
31765
|
}
|
|
31707
31766
|
var TAIL_BYTES = 256 * 1024;
|
|
31708
31767
|
function readTail(path) {
|
|
31709
|
-
const fd =
|
|
31768
|
+
const fd = openSync3(path, "r");
|
|
31710
31769
|
try {
|
|
31711
|
-
const { size } =
|
|
31770
|
+
const { size } = fstatSync2(fd);
|
|
31712
31771
|
if (size <= TAIL_BYTES) return { text: readFileSync18(fd, "utf8"), truncated: false };
|
|
31713
31772
|
const buffer = Buffer.allocUnsafe(TAIL_BYTES);
|
|
31714
31773
|
let filled = 0;
|
|
@@ -31719,7 +31778,7 @@ function readTail(path) {
|
|
|
31719
31778
|
}
|
|
31720
31779
|
return { text: buffer.subarray(0, filled).toString("utf8"), truncated: true };
|
|
31721
31780
|
} finally {
|
|
31722
|
-
|
|
31781
|
+
closeSync3(fd);
|
|
31723
31782
|
}
|
|
31724
31783
|
}
|
|
31725
31784
|
function modelFromTranscriptTail(transcriptPath, fromRecord) {
|
|
@@ -35799,21 +35858,21 @@ function resolveCodexHome(env, home = homedir3()) {
|
|
|
35799
35858
|
|
|
35800
35859
|
// ../../packages/plugin-sdk/src/account/observation-log.ts
|
|
35801
35860
|
import { createHash as createHash13 } from "crypto";
|
|
35802
|
-
import { closeSync as
|
|
35861
|
+
import { closeSync as closeSync4, constants as constants2, fstatSync as fstatSync3, mkdirSync as mkdirSync4, openSync as openSync4, readSync as readSync2, writeSync } from "fs";
|
|
35803
35862
|
import { join as join37 } from "path";
|
|
35804
35863
|
var SESSION_LOG_CAP_BYTES = 16 * 1024 * 1024;
|
|
35805
35864
|
var SESSION_LOG_TAIL_BYTES = 64 * 1024;
|
|
35806
35865
|
var NEWLINE = 10;
|
|
35807
35866
|
var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
|
|
35808
35867
|
function sessionLogOpenFlags(noFollow) {
|
|
35809
|
-
return
|
|
35868
|
+
return constants2.O_WRONLY | constants2.O_APPEND | constants2.O_CREAT | (noFollow ?? 0);
|
|
35810
35869
|
}
|
|
35811
35870
|
var SESSION_LOG_OPEN_FLAGS = sessionLogOpenFlags(
|
|
35812
|
-
|
|
35871
|
+
constants2.O_NOFOLLOW
|
|
35813
35872
|
);
|
|
35814
35873
|
function closeQuietly2(fd) {
|
|
35815
35874
|
try {
|
|
35816
|
-
|
|
35875
|
+
closeSync4(fd);
|
|
35817
35876
|
} catch {
|
|
35818
35877
|
}
|
|
35819
35878
|
}
|
|
@@ -35836,8 +35895,8 @@ function appendObservation(stateDir, sessionId, observation, capBytes = SESSION_
|
|
|
35836
35895
|
let fd;
|
|
35837
35896
|
try {
|
|
35838
35897
|
mkdirSync4(stateDir, { recursive: true, mode: DATA_DIR_MODE });
|
|
35839
|
-
fd =
|
|
35840
|
-
if (
|
|
35898
|
+
fd = openSync4(sessionLogPath(stateDir, sessionId), openFlags, DATA_FILE_MODE);
|
|
35899
|
+
if (fstatSync3(fd).size + Buffer.byteLength(line) > capBytes) return false;
|
|
35841
35900
|
writeSync(fd, line);
|
|
35842
35901
|
return true;
|
|
35843
35902
|
} catch {
|
|
@@ -35867,12 +35926,12 @@ function parseLines(buffer, base) {
|
|
|
35867
35926
|
function readRange(path, from, capBytes) {
|
|
35868
35927
|
let fd;
|
|
35869
35928
|
try {
|
|
35870
|
-
fd =
|
|
35929
|
+
fd = openSync4(path, "r");
|
|
35871
35930
|
} catch {
|
|
35872
35931
|
return void 0;
|
|
35873
35932
|
}
|
|
35874
35933
|
try {
|
|
35875
|
-
const size =
|
|
35934
|
+
const size = fstatSync3(fd).size;
|
|
35876
35935
|
const length = Math.max(0, Math.min(size, capBytes) - from);
|
|
35877
35936
|
const buffer = Buffer.alloc(length);
|
|
35878
35937
|
let filled = 0;
|
|
@@ -35919,7 +35978,7 @@ function classifyObservation(observation) {
|
|
|
35919
35978
|
}
|
|
35920
35979
|
|
|
35921
35980
|
// ../../packages/plugin-sdk/src/account/codex-head.ts
|
|
35922
|
-
import { closeSync as
|
|
35981
|
+
import { closeSync as closeSync5, openSync as openSync5, readSync as readSync3 } from "fs";
|
|
35923
35982
|
var CODEX_HEAD_READ_BYTES = 64 * 1024;
|
|
35924
35983
|
var CODEX_HEAD_MAX_BYTES = 1024 * 1024;
|
|
35925
35984
|
var NEWLINE2 = 10;
|
|
@@ -35952,7 +36011,7 @@ function parseHead(line) {
|
|
|
35952
36011
|
function readCodexHead(rolloutPath) {
|
|
35953
36012
|
let fd;
|
|
35954
36013
|
try {
|
|
35955
|
-
fd =
|
|
36014
|
+
fd = openSync5(rolloutPath, "r");
|
|
35956
36015
|
} catch (error2) {
|
|
35957
36016
|
return isNotFound(error2) ? "pending" : void 0;
|
|
35958
36017
|
}
|
|
@@ -35977,14 +36036,14 @@ function readCodexHead(rolloutPath) {
|
|
|
35977
36036
|
return void 0;
|
|
35978
36037
|
} finally {
|
|
35979
36038
|
try {
|
|
35980
|
-
|
|
36039
|
+
closeSync5(fd);
|
|
35981
36040
|
} catch {
|
|
35982
36041
|
}
|
|
35983
36042
|
}
|
|
35984
36043
|
}
|
|
35985
36044
|
|
|
35986
36045
|
// ../../packages/plugin-sdk/src/account/codex-login.ts
|
|
35987
|
-
import { closeSync as
|
|
36046
|
+
import { closeSync as closeSync6, constants as constants3, fstatSync as fstatSync4, lstatSync as lstatSync6, openSync as openSync6, readSync as readSync4 } from "fs";
|
|
35988
36047
|
import { join as join38 } from "path";
|
|
35989
36048
|
var CODEX_AUTH_MAX_BYTES = 64 * 1024;
|
|
35990
36049
|
var CODEX_ID_TOKEN_MAX_CHARS = 16 * 1024;
|
|
@@ -36017,8 +36076,8 @@ var DROPPED = new Set(CODEX_DROPPED_FIELDS);
|
|
|
36017
36076
|
var PRESENCE = new Set(CODEX_PRESENCE_FIELDS);
|
|
36018
36077
|
var BASE64URL = /^[A-Za-z0-9_-]+$/;
|
|
36019
36078
|
var UUID3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
36020
|
-
var NOFOLLOW =
|
|
36021
|
-
var READ_FLAGS =
|
|
36079
|
+
var NOFOLLOW = constants3.O_NOFOLLOW ?? 0;
|
|
36080
|
+
var READ_FLAGS = constants3.O_RDONLY | NOFOLLOW;
|
|
36022
36081
|
var ABSENT = { status: "absent" };
|
|
36023
36082
|
var MODE = { status: "mode" };
|
|
36024
36083
|
var MALFORMED = { status: "malformed" };
|
|
@@ -36140,12 +36199,12 @@ function inspectCodexLogin(codexHome, attachedUserDigest, platform = process.pla
|
|
|
36140
36199
|
let fd;
|
|
36141
36200
|
try {
|
|
36142
36201
|
if (platform === "win32" && lstatSync6(path).isSymbolicLink()) return MALFORMED;
|
|
36143
|
-
fd =
|
|
36202
|
+
fd = openSync6(path, openFlags);
|
|
36144
36203
|
} catch (error2) {
|
|
36145
36204
|
return isNotFound2(error2) ? ABSENT : MALFORMED;
|
|
36146
36205
|
}
|
|
36147
36206
|
try {
|
|
36148
|
-
const stat2 =
|
|
36207
|
+
const stat2 = fstatSync4(fd);
|
|
36149
36208
|
if (!stat2.isFile() || stat2.size > CODEX_AUTH_MAX_BYTES) return MALFORMED;
|
|
36150
36209
|
if (platform !== "win32" && (stat2.uid !== process.getuid?.() || (stat2.mode & 18) !== 0)) {
|
|
36151
36210
|
return MALFORMED;
|
|
@@ -36157,7 +36216,7 @@ function inspectCodexLogin(codexHome, attachedUserDigest, platform = process.pla
|
|
|
36157
36216
|
return MALFORMED;
|
|
36158
36217
|
} finally {
|
|
36159
36218
|
try {
|
|
36160
|
-
|
|
36219
|
+
closeSync6(fd);
|
|
36161
36220
|
} catch {
|
|
36162
36221
|
}
|
|
36163
36222
|
}
|