@akasecurity/ai-tc-copilot 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/package.json +4 -4
- package/plugin.json +1 -1
- package/scripts/content-retention.js +60 -19
- package/scripts/fail-open-count.js +32 -6
- package/scripts/history-sync.js +60 -19
- package/scripts/post-tool-use.js +80 -21
- package/scripts/pre-tool-use.js +80 -21
- package/scripts/scan-worker.js +32 -6
- package/scripts/session-start.js +108 -46
- package/scripts/sync.js +96 -38
- package/scripts/user-prompt-submit.js +80 -21
package/scripts/session-start.js
CHANGED
|
@@ -9659,7 +9659,11 @@ var ListFindingTypesQuery = object({
|
|
|
9659
9659
|
// and so is not bounded by what any page happens to hold.
|
|
9660
9660
|
includeId: string2().optional(),
|
|
9661
9661
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
9662
|
-
cursor: string2().optional()
|
|
9662
|
+
cursor: string2().optional(),
|
|
9663
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
9664
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
9665
|
+
// from wherever it lands.
|
|
9666
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
9663
9667
|
});
|
|
9664
9668
|
var ListFindingTypesResponse = object({
|
|
9665
9669
|
totals: object({
|
|
@@ -9740,7 +9744,11 @@ var ListFindingInstancesQuery = object({
|
|
|
9740
9744
|
sessionId: string2().optional(),
|
|
9741
9745
|
from: iso_exports.datetime().optional(),
|
|
9742
9746
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
9743
|
-
cursor: string2().optional()
|
|
9747
|
+
cursor: string2().optional(),
|
|
9748
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
9749
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
9750
|
+
// from wherever it lands.
|
|
9751
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
9744
9752
|
});
|
|
9745
9753
|
var ListFindingInstancesResponse = object({
|
|
9746
9754
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -9812,7 +9820,11 @@ var ListFindingLocationsQuery = object({
|
|
|
9812
9820
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
9813
9821
|
includeId: string2().optional(),
|
|
9814
9822
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
9815
|
-
cursor: string2().optional()
|
|
9823
|
+
cursor: string2().optional(),
|
|
9824
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
9825
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
9826
|
+
// from wherever it lands.
|
|
9827
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
9816
9828
|
});
|
|
9817
9829
|
var ListFindingLocationsResponse = object({
|
|
9818
9830
|
totals: object({
|
|
@@ -12444,7 +12456,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
12444
12456
|
var ListVaultInventoryQuery = object({
|
|
12445
12457
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
12446
12458
|
// Opaque; names the last row of the page just served.
|
|
12447
|
-
cursor: string2().optional()
|
|
12459
|
+
cursor: string2().optional(),
|
|
12460
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
12461
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
12462
|
+
// from wherever it lands.
|
|
12463
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
12448
12464
|
});
|
|
12449
12465
|
var ListVaultInventoryResponse = object({
|
|
12450
12466
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -12456,7 +12472,11 @@ var ListVaultInventoryResponse = object({
|
|
|
12456
12472
|
});
|
|
12457
12473
|
var ListVaultReuseQuery = object({
|
|
12458
12474
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
12459
|
-
cursor: string2().optional()
|
|
12475
|
+
cursor: string2().optional(),
|
|
12476
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
12477
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
12478
|
+
// from wherever it lands.
|
|
12479
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
12460
12480
|
});
|
|
12461
12481
|
var ListVaultReuseResponse = object({
|
|
12462
12482
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -12472,9 +12492,15 @@ var ListVaultDerefsQuery = object({
|
|
|
12472
12492
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
12473
12493
|
includeBatched: boolean2().optional(),
|
|
12474
12494
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
12475
|
-
cursor: string2().optional()
|
|
12495
|
+
cursor: string2().optional(),
|
|
12496
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
12497
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
12498
|
+
// from wherever it lands.
|
|
12499
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
12476
12500
|
});
|
|
12477
12501
|
var ListVaultDerefsResponse = object({
|
|
12502
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
12503
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
12478
12504
|
items: array(VaultDeref),
|
|
12479
12505
|
nextCursor: string2().nullable(),
|
|
12480
12506
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -21486,7 +21512,7 @@ var SqliteFindingsRepository = class {
|
|
|
21486
21512
|
};
|
|
21487
21513
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
21488
21514
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
21489
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
21515
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
21490
21516
|
const page = sorted.slice(start, start + limit);
|
|
21491
21517
|
const lastOnPage = page.at(-1);
|
|
21492
21518
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -21580,7 +21606,7 @@ var SqliteFindingsRepository = class {
|
|
|
21580
21606
|
accumulator.add(row);
|
|
21581
21607
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
21582
21608
|
total += 1;
|
|
21583
|
-
if (!isPastCursor(row)) continue;
|
|
21609
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
21584
21610
|
if (items.length < limit) {
|
|
21585
21611
|
items.push(toInstanceDetail(row));
|
|
21586
21612
|
last = row;
|
|
@@ -21669,7 +21695,7 @@ var SqliteFindingsRepository = class {
|
|
|
21669
21695
|
}
|
|
21670
21696
|
}
|
|
21671
21697
|
sorted.sort(compareLocationOrder);
|
|
21672
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
21698
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
21673
21699
|
const page = sorted.slice(start, start + limit);
|
|
21674
21700
|
const lastOnPage = page.at(-1);
|
|
21675
21701
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -24297,6 +24323,9 @@ function pageLimit(requested, fallback) {
|
|
|
24297
24323
|
if (requested === void 0) return fallback;
|
|
24298
24324
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
24299
24325
|
}
|
|
24326
|
+
function pageOffset(requested) {
|
|
24327
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
24328
|
+
}
|
|
24300
24329
|
function encodeReuseCursor(payload) {
|
|
24301
24330
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
24302
24331
|
}
|
|
@@ -24644,7 +24673,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
24644
24673
|
*/
|
|
24645
24674
|
listInventory(query = {}, now = Date.now()) {
|
|
24646
24675
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
24647
|
-
const
|
|
24676
|
+
const offset = pageOffset(query.offset);
|
|
24677
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
24648
24678
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
24649
24679
|
const rows = allRows(
|
|
24650
24680
|
this.db.prepare(
|
|
@@ -24658,11 +24688,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
24658
24688
|
FROM secret_vault v
|
|
24659
24689
|
${where}
|
|
24660
24690
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
24661
|
-
LIMIT :limit`
|
|
24691
|
+
LIMIT :limit OFFSET :offset`
|
|
24662
24692
|
),
|
|
24663
24693
|
bindParams({
|
|
24664
24694
|
now,
|
|
24665
24695
|
limit: limit + 1,
|
|
24696
|
+
offset,
|
|
24666
24697
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
24667
24698
|
})
|
|
24668
24699
|
);
|
|
@@ -24686,7 +24717,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
24686
24717
|
*/
|
|
24687
24718
|
listReuse(query = {}, now = Date.now()) {
|
|
24688
24719
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
24689
|
-
const
|
|
24720
|
+
const offset = pageOffset(query.offset);
|
|
24721
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
24690
24722
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
24691
24723
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
24692
24724
|
const rows = allRows(
|
|
@@ -24701,11 +24733,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
24701
24733
|
FROM secret_vault v
|
|
24702
24734
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
24703
24735
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
24704
|
-
LIMIT :limit`
|
|
24736
|
+
LIMIT :limit OFFSET :offset`
|
|
24705
24737
|
),
|
|
24706
24738
|
bindParams({
|
|
24707
24739
|
now,
|
|
24708
24740
|
limit: limit + 1,
|
|
24741
|
+
offset,
|
|
24709
24742
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
24710
24743
|
})
|
|
24711
24744
|
);
|
|
@@ -24730,7 +24763,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
24730
24763
|
*/
|
|
24731
24764
|
listDerefs(query = {}) {
|
|
24732
24765
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
24733
|
-
const
|
|
24766
|
+
const offset = pageOffset(query.offset);
|
|
24767
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
24734
24768
|
const conditions = [];
|
|
24735
24769
|
if (query.includeBatched !== true) {
|
|
24736
24770
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -24743,21 +24777,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
24743
24777
|
this.db.prepare(
|
|
24744
24778
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
24745
24779
|
FROM secret_vault_deref ${where}
|
|
24746
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
24780
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
24747
24781
|
),
|
|
24748
24782
|
bindParams({
|
|
24749
24783
|
limit: limit + 1,
|
|
24784
|
+
offset,
|
|
24750
24785
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
24751
24786
|
})
|
|
24752
24787
|
);
|
|
24753
24788
|
const hasMore = rows.length > limit;
|
|
24754
24789
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
24755
24790
|
const last = page[page.length - 1];
|
|
24756
|
-
const
|
|
24757
|
-
this.db
|
|
24758
|
-
|
|
24759
|
-
|
|
24791
|
+
const counts = getRow(
|
|
24792
|
+
this.db.prepare(
|
|
24793
|
+
`SELECT count(*) AS total,
|
|
24794
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
24795
|
+
FROM secret_vault_deref`
|
|
24796
|
+
)
|
|
24797
|
+
) ?? { total: 0, hidden: 0 };
|
|
24798
|
+
const includeBatched = query.includeBatched === true;
|
|
24799
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
24760
24800
|
return {
|
|
24801
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
24761
24802
|
items: page.map((r) => ({
|
|
24762
24803
|
id: r.id,
|
|
24763
24804
|
pointerId: r.pointer_id,
|
|
@@ -31737,7 +31778,7 @@ function resolveProviderSafe(resolveProviderFn) {
|
|
|
31737
31778
|
}
|
|
31738
31779
|
|
|
31739
31780
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
31740
|
-
import { readdirSync as readdirSync3,
|
|
31781
|
+
import { readdirSync as readdirSync3, realpathSync as realpathSync2, statSync as statSync8 } from "fs";
|
|
31741
31782
|
import { homedir as homedir3 } from "os";
|
|
31742
31783
|
import { basename as basename4, join as join25, resolve as resolve3 } from "path";
|
|
31743
31784
|
|
|
@@ -32110,8 +32151,25 @@ function maskText(text) {
|
|
|
32110
32151
|
return scanText2(text).masked;
|
|
32111
32152
|
}
|
|
32112
32153
|
|
|
32154
|
+
// ../../packages/plugin-sdk/src/regular-file.ts
|
|
32155
|
+
import { closeSync as closeSync2, constants, fstatSync, openSync as openSync2, readFileSync as readFileSync16 } from "fs";
|
|
32156
|
+
function notRegularFile(path) {
|
|
32157
|
+
return `not a regular file: ${path}`;
|
|
32158
|
+
}
|
|
32159
|
+
function readRegularFile(path, maxBytes) {
|
|
32160
|
+
const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
32161
|
+
try {
|
|
32162
|
+
const stat2 = fstatSync(fd);
|
|
32163
|
+
if (!stat2.isFile()) throw new Error(notRegularFile(path));
|
|
32164
|
+
if (maxBytes !== void 0 && stat2.size > maxBytes) throw new Error(`file too large: ${path}`);
|
|
32165
|
+
return readFileSync16(fd, "utf8");
|
|
32166
|
+
} finally {
|
|
32167
|
+
closeSync2(fd);
|
|
32168
|
+
}
|
|
32169
|
+
}
|
|
32170
|
+
|
|
32113
32171
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
32114
|
-
import { existsSync as existsSync9,
|
|
32172
|
+
import { existsSync as existsSync9, statSync as statSync7 } from "fs";
|
|
32115
32173
|
import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
|
|
32116
32174
|
function remoteWithoutCredentials(remote) {
|
|
32117
32175
|
const withoutInfo = withoutUserinfo(remote);
|
|
@@ -32282,9 +32340,10 @@ function resolveGitContext(root) {
|
|
|
32282
32340
|
const headRoot = basename3(commonGitDir) === ".git" ? dirname5(commonGitDir) : root;
|
|
32283
32341
|
return { configPath: join24(commonGitDir, "config"), headRoot };
|
|
32284
32342
|
}
|
|
32343
|
+
var MAX_GIT_METADATA_BYTES = 1024 * 1024;
|
|
32285
32344
|
function safeRead(path) {
|
|
32286
32345
|
try {
|
|
32287
|
-
return
|
|
32346
|
+
return readRegularFile(path, MAX_GIT_METADATA_BYTES);
|
|
32288
32347
|
} catch {
|
|
32289
32348
|
return void 0;
|
|
32290
32349
|
}
|
|
@@ -32575,9 +32634,13 @@ function collectConfigFiles(scan2, claudeDir, cwd) {
|
|
|
32575
32634
|
dirConfigFile(scan2, join25(cwd, ".claude", "commands"), "Slash commands", "command");
|
|
32576
32635
|
dirConfigFile(scan2, join25(cwd, ".claude", "agents"), "Subagents", "subagent");
|
|
32577
32636
|
}
|
|
32578
|
-
function configFileEntry(scan2, path, scope, kind) {
|
|
32637
|
+
function configFileEntry(scan2, path, scope, kind, nonFile) {
|
|
32579
32638
|
try {
|
|
32580
32639
|
const stat2 = statSync8(path);
|
|
32640
|
+
if (nonFile !== "keep" && !stat2.isFile()) {
|
|
32641
|
+
if (nonFile === "report") scan2.errors.push({ source: path, reason: notRegularFile(path) });
|
|
32642
|
+
return void 0;
|
|
32643
|
+
}
|
|
32581
32644
|
return { name: basename4(path), path, scope, kind, updatedAt: stat2.mtime.toISOString() };
|
|
32582
32645
|
} catch (err) {
|
|
32583
32646
|
if (!isAbsent(err)) scan2.errors.push({ source: path, reason: message(err) });
|
|
@@ -32585,7 +32648,7 @@ function configFileEntry(scan2, path, scope, kind) {
|
|
|
32585
32648
|
}
|
|
32586
32649
|
}
|
|
32587
32650
|
function settingsConfigFile(scan2, path, scope, kind) {
|
|
32588
|
-
const entry = configFileEntry(scan2, path, scope, kind);
|
|
32651
|
+
const entry = configFileEntry(scan2, path, scope, kind, "skip");
|
|
32589
32652
|
if (!entry) return;
|
|
32590
32653
|
const raw = readOptional(scan2, path, false);
|
|
32591
32654
|
if (raw !== void 0) {
|
|
@@ -32603,7 +32666,7 @@ function settingsConfigFile(scan2, path, scope, kind) {
|
|
|
32603
32666
|
scan2.configFiles.push(entry);
|
|
32604
32667
|
}
|
|
32605
32668
|
function memoryConfigFile(scan2, path, scope, kind) {
|
|
32606
|
-
const entry = configFileEntry(scan2, path, scope, kind);
|
|
32669
|
+
const entry = configFileEntry(scan2, path, scope, kind, "report");
|
|
32607
32670
|
if (!entry) return;
|
|
32608
32671
|
const raw = readOptional(scan2, path);
|
|
32609
32672
|
if (raw !== void 0) {
|
|
@@ -32614,7 +32677,7 @@ function memoryConfigFile(scan2, path, scope, kind) {
|
|
|
32614
32677
|
scan2.configFiles.push(entry);
|
|
32615
32678
|
}
|
|
32616
32679
|
function mcpJsonConfigFile(scan2, path) {
|
|
32617
|
-
const entry = configFileEntry(scan2, path, "project", "MCP servers");
|
|
32680
|
+
const entry = configFileEntry(scan2, path, "project", "MCP servers", "skip");
|
|
32618
32681
|
if (!entry) return;
|
|
32619
32682
|
const raw = readOptional(scan2, path, false);
|
|
32620
32683
|
if (raw !== void 0) {
|
|
@@ -32634,7 +32697,7 @@ function mcpJsonConfigFile(scan2, path) {
|
|
|
32634
32697
|
scan2.configFiles.push(entry);
|
|
32635
32698
|
}
|
|
32636
32699
|
function dirConfigFile(scan2, path, kind, noun) {
|
|
32637
|
-
const entry = configFileEntry(scan2, path, "project", kind);
|
|
32700
|
+
const entry = configFileEntry(scan2, path, "project", kind, "keep");
|
|
32638
32701
|
if (!entry) return;
|
|
32639
32702
|
try {
|
|
32640
32703
|
const count = countMarkdownFiles(path, 0);
|
|
@@ -32830,7 +32893,7 @@ function dedupeMcpServers(servers) {
|
|
|
32830
32893
|
}
|
|
32831
32894
|
function readOptional(scan2, path, record2 = true) {
|
|
32832
32895
|
try {
|
|
32833
|
-
return
|
|
32896
|
+
return readRegularFile(path);
|
|
32834
32897
|
} catch (err) {
|
|
32835
32898
|
if (record2 && !isAbsent(err)) scan2.errors.push({ source: path, reason: message(err) });
|
|
32836
32899
|
return void 0;
|
|
@@ -33410,11 +33473,10 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
33410
33473
|
|
|
33411
33474
|
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
33412
33475
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
33413
|
-
import { readFileSync as readFileSync18 } from "fs";
|
|
33414
33476
|
import { join as join26 } from "path";
|
|
33415
33477
|
function readIgnoreLayer(dir, filename, anchorLen) {
|
|
33416
33478
|
try {
|
|
33417
|
-
return { matcher: (0, import_ignore.default)().add(
|
|
33479
|
+
return { matcher: (0, import_ignore.default)().add(readRegularFile(join26(dir, filename))), anchorLen };
|
|
33418
33480
|
} catch {
|
|
33419
33481
|
return void 0;
|
|
33420
33482
|
}
|
|
@@ -33471,7 +33533,7 @@ function resolveInventoryContext(input) {
|
|
|
33471
33533
|
}
|
|
33472
33534
|
|
|
33473
33535
|
// ../../packages/plugin-sdk/src/nudge.ts
|
|
33474
|
-
import { mkdirSync as mkdirSync2, readFileSync as
|
|
33536
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync17, writeFileSync as writeFileSync5 } from "fs";
|
|
33475
33537
|
import { join as join27 } from "path";
|
|
33476
33538
|
var SESSION_START_MARKER = "session-start-last";
|
|
33477
33539
|
function claimSessionStart(dataDir2, sessionId) {
|
|
@@ -33483,7 +33545,7 @@ function claimOncePerSession(dataDir2, marker, sessionId) {
|
|
|
33483
33545
|
const path = join27(dataDir2, marker);
|
|
33484
33546
|
let recent = [];
|
|
33485
33547
|
try {
|
|
33486
|
-
recent =
|
|
33548
|
+
recent = readFileSync17(path, "utf8").split("\n").filter(Boolean);
|
|
33487
33549
|
if (recent.includes(sessionId)) return false;
|
|
33488
33550
|
} catch {
|
|
33489
33551
|
}
|
|
@@ -34807,7 +34869,7 @@ function sessionToolIsKeyed(tool) {
|
|
|
34807
34869
|
|
|
34808
34870
|
// ../../packages/plugin-runtime/src/attached/config-inventory-sync.ts
|
|
34809
34871
|
import { createHash as createHash11 } from "crypto";
|
|
34810
|
-
import { readFileSync as
|
|
34872
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
34811
34873
|
import { join as join34 } from "path";
|
|
34812
34874
|
|
|
34813
34875
|
// ../../packages/plugin-runtime/src/attached/config-inventory-wire.ts
|
|
@@ -34907,7 +34969,7 @@ async function publishByRename(tmp, file, move = rename2) {
|
|
|
34907
34969
|
|
|
34908
34970
|
// ../../packages/plugin-runtime/src/attached/capture-settings.ts
|
|
34909
34971
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
34910
|
-
import { readFileSync as
|
|
34972
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
34911
34973
|
import { rm, writeFile as writeFile2 } from "fs/promises";
|
|
34912
34974
|
import { join as join32 } from "path";
|
|
34913
34975
|
var HookCaptureSettingsSchema = CaptureSettings.pick({
|
|
@@ -35295,7 +35357,7 @@ function reportKey(request) {
|
|
|
35295
35357
|
function readStagedEntries(dataDir2) {
|
|
35296
35358
|
let parsed2;
|
|
35297
35359
|
try {
|
|
35298
|
-
parsed2 = JSON.parse(
|
|
35360
|
+
parsed2 = JSON.parse(readFileSync19(stagedConfigInventoryPath(dataDir2), "utf8"));
|
|
35299
35361
|
} catch {
|
|
35300
35362
|
return [];
|
|
35301
35363
|
}
|
|
@@ -35319,7 +35381,7 @@ function isTimestamp(value) {
|
|
|
35319
35381
|
}
|
|
35320
35382
|
|
|
35321
35383
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
35322
|
-
import { readFileSync as
|
|
35384
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
35323
35385
|
import { join as join35 } from "path";
|
|
35324
35386
|
var FORWARD_DROPS_FILENAME = ATTACHED_FORWARD_DROPS_FILENAME;
|
|
35325
35387
|
function forwardDropsPath(dataDir2) {
|
|
@@ -35341,7 +35403,7 @@ function recordForwardDrops(dataDir2, count, nowMs) {
|
|
|
35341
35403
|
}
|
|
35342
35404
|
function readForwardDrops(dataDir2) {
|
|
35343
35405
|
try {
|
|
35344
|
-
const parsed2 = JSON.parse(
|
|
35406
|
+
const parsed2 = JSON.parse(readFileSync20(forwardDropsPath(dataDir2), "utf8"));
|
|
35345
35407
|
if (typeof parsed2 !== "object" || parsed2 === null) return null;
|
|
35346
35408
|
const record2 = parsed2;
|
|
35347
35409
|
if (typeof record2.droppedForwards !== "number" || !Number.isFinite(record2.droppedForwards)) {
|
|
@@ -36445,7 +36507,7 @@ function toWireInspection(insp, nameKey) {
|
|
|
36445
36507
|
}
|
|
36446
36508
|
|
|
36447
36509
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
36448
|
-
import { readFileSync as
|
|
36510
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
36449
36511
|
|
|
36450
36512
|
// ../../packages/plugin-runtime/src/attached/install-record.ts
|
|
36451
36513
|
import { readFile as readFile3, stat } from "fs/promises";
|
|
@@ -36498,7 +36560,7 @@ function readManifestBuild(manifestUrl, packageName) {
|
|
|
36498
36560
|
if (!manifestBuildCache.has(key)) {
|
|
36499
36561
|
let build;
|
|
36500
36562
|
try {
|
|
36501
|
-
const manifest = JSON.parse(
|
|
36563
|
+
const manifest = JSON.parse(readFileSync21(manifestUrl, "utf8"));
|
|
36502
36564
|
build = typeof manifest.version === "string" && manifest.version.length > 0 ? { package: packageName, version: manifest.version } : void 0;
|
|
36503
36565
|
} catch {
|
|
36504
36566
|
build = void 0;
|
|
@@ -36533,7 +36595,7 @@ async function readInstalledVersionBounded(installRoot) {
|
|
|
36533
36595
|
}
|
|
36534
36596
|
|
|
36535
36597
|
// ../../packages/plugin-runtime/src/attached/posture-report-state.ts
|
|
36536
|
-
import { readFileSync as
|
|
36598
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
36537
36599
|
import { join as join37 } from "path";
|
|
36538
36600
|
var POSTURE_REPORT_STATE_FILENAME = ATTACHED_POSTURE_REPORT_FILENAME;
|
|
36539
36601
|
var OUTCOME_KEYS = {
|
|
@@ -36809,11 +36871,11 @@ function createPostureStore(dir = settingsDir(), legacyDir) {
|
|
|
36809
36871
|
}
|
|
36810
36872
|
|
|
36811
36873
|
// ../../packages/plugin-runtime/src/attached/label-drops.ts
|
|
36812
|
-
import { readFileSync as
|
|
36874
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
36813
36875
|
import { join as join39 } from "path";
|
|
36814
36876
|
|
|
36815
36877
|
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
36816
|
-
import { readFileSync as
|
|
36878
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
36817
36879
|
import { join as join40 } from "path";
|
|
36818
36880
|
|
|
36819
36881
|
// ../../packages/plugin-runtime/src/attached/status.ts
|
|
@@ -37457,7 +37519,7 @@ function buildSessionRoot(sessionId, input, ctx, resolved, provider, branch, sco
|
|
|
37457
37519
|
}
|
|
37458
37520
|
|
|
37459
37521
|
// src/build-info.ts
|
|
37460
|
-
import { readFileSync as
|
|
37522
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
37461
37523
|
var PLUGIN_PACKAGE = "@akasecurity/ai-tc-copilot";
|
|
37462
37524
|
var MANIFEST_URL = new URL("../plugin.json", import.meta.url);
|
|
37463
37525
|
var MANIFEST_ARGV_INDEX = 3;
|
|
@@ -37468,7 +37530,7 @@ function harnessVersionFromArgv(argv = process.argv) {
|
|
|
37468
37530
|
const manifestPath = argv[MANIFEST_ARGV_INDEX];
|
|
37469
37531
|
if (!manifestPath) return void 0;
|
|
37470
37532
|
try {
|
|
37471
|
-
const manifest = JSON.parse(
|
|
37533
|
+
const manifest = JSON.parse(readFileSync25(manifestPath, "utf8"));
|
|
37472
37534
|
return typeof manifest.version === "string" ? manifest.version : void 0;
|
|
37473
37535
|
} catch {
|
|
37474
37536
|
return void 0;
|
|
@@ -37688,7 +37750,7 @@ async function runHookEntry(handler, failOpen) {
|
|
|
37688
37750
|
}
|
|
37689
37751
|
|
|
37690
37752
|
// src/hooks/store-health.ts
|
|
37691
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
37753
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync26, writeFileSync as writeFileSync7 } from "fs";
|
|
37692
37754
|
import { dirname as dirname11, join as join42 } from "path";
|
|
37693
37755
|
var STORE_REDIRECT_MARKER = "store-redirect-last-session";
|
|
37694
37756
|
var RECENT_SESSIONS2 = 32;
|
|
@@ -37708,7 +37770,7 @@ function alreadyClaimed(dirs, marker, sessionId) {
|
|
|
37708
37770
|
}
|
|
37709
37771
|
function readRecent(dir, marker) {
|
|
37710
37772
|
try {
|
|
37711
|
-
return
|
|
37773
|
+
return readFileSync26(join42(dir, marker), "utf8").split("\n").filter(Boolean);
|
|
37712
37774
|
} catch {
|
|
37713
37775
|
return [];
|
|
37714
37776
|
}
|