@akasecurity/ai-tc-copilot 0.9.23 → 0.9.25
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 +3 -3
- package/plugin.json +1 -1
- package/scripts/content-retention.js +115 -22
- package/scripts/fail-open-count.js +91 -9
- package/scripts/history-sync.js +307 -70
- package/scripts/post-tool-use.js +409 -101
- package/scripts/pre-tool-use.js +409 -101
- package/scripts/scan-worker.js +90 -8
- package/scripts/session-start.js +387 -116
- package/scripts/sync.js +427 -120
- package/scripts/user-prompt-submit.js +409 -101
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akasecurity/ai-tc-copilot",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
4
4
|
"description": "AI Traffic Control — inspect and govern AI prompts in GitHub Copilot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@akasecurity/eslint-config": "0.8.0",
|
|
31
31
|
"@akasecurity/persistence": "0.8.0",
|
|
32
32
|
"@akasecurity/plugin-runtime": "0.8.0",
|
|
33
|
+
"@akasecurity/plugin-sdk": "0.8.0",
|
|
33
34
|
"@akasecurity/scanner": "0.8.0",
|
|
34
|
-
"@akasecurity/schema": "0.8.0",
|
|
35
35
|
"@akasecurity/setup-wizard": "0.8.0",
|
|
36
|
-
"@akasecurity/
|
|
36
|
+
"@akasecurity/schema": "0.8.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup",
|
package/plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aka-copilot",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
4
4
|
"description": "AI Traffic Control — inspect and govern AI prompts in GitHub Copilot. Detection runs locally; events are recorded to a local SQLite store on your machine.",
|
|
5
5
|
"hooks": "./hooks.json",
|
|
6
6
|
"skills": "./skills",
|
|
@@ -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({
|
|
@@ -9403,7 +9415,13 @@ var AuditEventType = _enum([
|
|
|
9403
9415
|
// is doing — a write-through of the native host's in-memory tracker, so a
|
|
9404
9416
|
// second process (aka extension status) and a restarted host both have
|
|
9405
9417
|
// somewhere to read it back from.
|
|
9406
|
-
"capture_status"
|
|
9418
|
+
"capture_status",
|
|
9419
|
+
// One row per commit a session's checkout reached while a git command the
|
|
9420
|
+
// agent ran was running, hung off the session root. Its `attributes` follow
|
|
9421
|
+
// `GitCommitAttributes`: the commit id, the kind of HEAD move, the
|
|
9422
|
+
// attribution, and `scope_key`, the repository the command ran in; never
|
|
9423
|
+
// the branch, commit message, author or diff.
|
|
9424
|
+
"git_commit"
|
|
9407
9425
|
]).meta({ id: "AuditEventType" });
|
|
9408
9426
|
var AttributeBag = record(string2(), unknown());
|
|
9409
9427
|
var HostAttributes = object({
|
|
@@ -9511,6 +9529,13 @@ var ToolCallAttributes = object({
|
|
|
9511
9529
|
parent_uuid: string2().optional(),
|
|
9512
9530
|
run_key: string2().optional()
|
|
9513
9531
|
}).catchall(unknown());
|
|
9532
|
+
var GitCommitKind = _enum(["commit", "merge", "rebase", "cherry-pick", "am", "revert"]);
|
|
9533
|
+
var GitCommitAttributes = object({
|
|
9534
|
+
commit: string2().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),
|
|
9535
|
+
kind: GitCommitKind,
|
|
9536
|
+
attribution: literal("command_window"),
|
|
9537
|
+
scope_key: string2().optional()
|
|
9538
|
+
}).catchall(unknown());
|
|
9514
9539
|
var CaptureAttributes = object({
|
|
9515
9540
|
// The harness/tool that produced the capture (`claude-code`, `cli`, …). A
|
|
9516
9541
|
// column on the legacy `events` table; here it rides the bag because a
|
|
@@ -11399,7 +11424,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
11399
11424
|
var ListVaultInventoryQuery = object({
|
|
11400
11425
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11401
11426
|
// Opaque; names the last row of the page just served.
|
|
11402
|
-
cursor: string2().optional()
|
|
11427
|
+
cursor: string2().optional(),
|
|
11428
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11429
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11430
|
+
// from wherever it lands.
|
|
11431
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11403
11432
|
});
|
|
11404
11433
|
var ListVaultInventoryResponse = object({
|
|
11405
11434
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -11411,7 +11440,11 @@ var ListVaultInventoryResponse = object({
|
|
|
11411
11440
|
});
|
|
11412
11441
|
var ListVaultReuseQuery = object({
|
|
11413
11442
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11414
|
-
cursor: string2().optional()
|
|
11443
|
+
cursor: string2().optional(),
|
|
11444
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11445
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11446
|
+
// from wherever it lands.
|
|
11447
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11415
11448
|
});
|
|
11416
11449
|
var ListVaultReuseResponse = object({
|
|
11417
11450
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -11427,9 +11460,15 @@ var ListVaultDerefsQuery = object({
|
|
|
11427
11460
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
11428
11461
|
includeBatched: boolean2().optional(),
|
|
11429
11462
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11430
|
-
cursor: string2().optional()
|
|
11463
|
+
cursor: string2().optional(),
|
|
11464
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11465
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11466
|
+
// from wherever it lands.
|
|
11467
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11431
11468
|
});
|
|
11432
11469
|
var ListVaultDerefsResponse = object({
|
|
11470
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
11471
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
11433
11472
|
items: array(VaultDeref),
|
|
11434
11473
|
nextCursor: string2().nullable(),
|
|
11435
11474
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -12122,6 +12161,42 @@ var ConfigInventoryAck = object({
|
|
|
12122
12161
|
accepted: number2().int().nonnegative()
|
|
12123
12162
|
});
|
|
12124
12163
|
|
|
12164
|
+
// ../../packages/schema/src/zod/credential-handles.ts
|
|
12165
|
+
var CREDENTIAL_SLUG_SOURCE = "[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?";
|
|
12166
|
+
var CredentialSlug = string2().regex(
|
|
12167
|
+
new RegExp(`^${CREDENTIAL_SLUG_SOURCE}$`),
|
|
12168
|
+
"must be lower-case letters, digits and dashes"
|
|
12169
|
+
);
|
|
12170
|
+
var HANDLE_SOURCE = `\\[\\[aka:cred:(${CREDENTIAL_SLUG_SOURCE})\\]\\]`;
|
|
12171
|
+
var CREDENTIAL_RESOLVE_BATCH_MAX = 20;
|
|
12172
|
+
var CREDENTIAL_VALUE_MAX_LENGTH = 65536;
|
|
12173
|
+
var AvailableCredential = object({
|
|
12174
|
+
slug: CredentialSlug,
|
|
12175
|
+
description: string2().max(500),
|
|
12176
|
+
/**
|
|
12177
|
+
* The value's sighting tokens under each accepted sighting-key version, so a
|
|
12178
|
+
* machine can recognise the value when it is pasted. Absent when the store
|
|
12179
|
+
* could not be read.
|
|
12180
|
+
*/
|
|
12181
|
+
lookups: array(string2().max(200)).max(SIGHTING_ALIASES_MAX + 1).optional()
|
|
12182
|
+
}).strict();
|
|
12183
|
+
var AvailableCredentialsResponse = object({ credentials: array(AvailableCredential) }).strict();
|
|
12184
|
+
var ResolveCredentialsRequest = object({
|
|
12185
|
+
slugs: array(CredentialSlug).min(1).max(CREDENTIAL_RESOLVE_BATCH_MAX).refine((slugs) => new Set(slugs).size === slugs.length, "slugs must be unique"),
|
|
12186
|
+
sessionId: string2().min(1).max(128).nullable()
|
|
12187
|
+
}).strict();
|
|
12188
|
+
var CredentialRefusalReason = _enum([
|
|
12189
|
+
"no_grant",
|
|
12190
|
+
"credential_not_found",
|
|
12191
|
+
"store_unavailable"
|
|
12192
|
+
]);
|
|
12193
|
+
var ResolveCredentialsResponse = object({
|
|
12194
|
+
resolved: array(
|
|
12195
|
+
object({ slug: CredentialSlug, value: string2().max(CREDENTIAL_VALUE_MAX_LENGTH) }).strict()
|
|
12196
|
+
),
|
|
12197
|
+
refused: array(object({ slug: CredentialSlug, reason: CredentialRefusalReason }).strict())
|
|
12198
|
+
}).strict();
|
|
12199
|
+
|
|
12125
12200
|
// ../../packages/schema/src/zod/credential-status.ts
|
|
12126
12201
|
var CredentialStatus = _enum(["rotation_overdue", "exposed"]).meta({ id: "CredentialStatus" });
|
|
12127
12202
|
|
|
@@ -15345,7 +15420,7 @@ function syncFailureRejectCondition(column = "sync_failure") {
|
|
|
15345
15420
|
}
|
|
15346
15421
|
|
|
15347
15422
|
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
15348
|
-
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
15423
|
+
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call", "git_commit"];
|
|
15349
15424
|
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
15350
15425
|
var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_TYPE_LIST;
|
|
15351
15426
|
var COUNTED_EVENT_TYPES = [
|
|
@@ -19083,7 +19158,7 @@ var SqliteFindingsRepository = class {
|
|
|
19083
19158
|
};
|
|
19084
19159
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
19085
19160
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
19086
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
19161
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
19087
19162
|
const page = sorted.slice(start, start + limit);
|
|
19088
19163
|
const lastOnPage = page.at(-1);
|
|
19089
19164
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -19177,7 +19252,7 @@ var SqliteFindingsRepository = class {
|
|
|
19177
19252
|
accumulator.add(row);
|
|
19178
19253
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
19179
19254
|
total += 1;
|
|
19180
|
-
if (!isPastCursor(row)) continue;
|
|
19255
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
19181
19256
|
if (items.length < limit) {
|
|
19182
19257
|
items.push(toInstanceDetail(row));
|
|
19183
19258
|
last = row;
|
|
@@ -19266,7 +19341,7 @@ var SqliteFindingsRepository = class {
|
|
|
19266
19341
|
}
|
|
19267
19342
|
}
|
|
19268
19343
|
sorted.sort(compareLocationOrder);
|
|
19269
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
19344
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
19270
19345
|
const page = sorted.slice(start, start + limit);
|
|
19271
19346
|
const lastOnPage = page.at(-1);
|
|
19272
19347
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -21894,6 +21969,9 @@ function pageLimit(requested, fallback) {
|
|
|
21894
21969
|
if (requested === void 0) return fallback;
|
|
21895
21970
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
21896
21971
|
}
|
|
21972
|
+
function pageOffset(requested) {
|
|
21973
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
21974
|
+
}
|
|
21897
21975
|
function encodeReuseCursor(payload) {
|
|
21898
21976
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
21899
21977
|
}
|
|
@@ -22241,7 +22319,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
22241
22319
|
*/
|
|
22242
22320
|
listInventory(query = {}, now = Date.now()) {
|
|
22243
22321
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
22244
|
-
const
|
|
22322
|
+
const offset = pageOffset(query.offset);
|
|
22323
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
22245
22324
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
22246
22325
|
const rows = allRows(
|
|
22247
22326
|
this.db.prepare(
|
|
@@ -22255,11 +22334,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
22255
22334
|
FROM secret_vault v
|
|
22256
22335
|
${where}
|
|
22257
22336
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
22258
|
-
LIMIT :limit`
|
|
22337
|
+
LIMIT :limit OFFSET :offset`
|
|
22259
22338
|
),
|
|
22260
22339
|
bindParams({
|
|
22261
22340
|
now,
|
|
22262
22341
|
limit: limit + 1,
|
|
22342
|
+
offset,
|
|
22263
22343
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
22264
22344
|
})
|
|
22265
22345
|
);
|
|
@@ -22283,7 +22363,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
22283
22363
|
*/
|
|
22284
22364
|
listReuse(query = {}, now = Date.now()) {
|
|
22285
22365
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
22286
|
-
const
|
|
22366
|
+
const offset = pageOffset(query.offset);
|
|
22367
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
22287
22368
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
22288
22369
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
22289
22370
|
const rows = allRows(
|
|
@@ -22298,11 +22379,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
22298
22379
|
FROM secret_vault v
|
|
22299
22380
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
22300
22381
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
22301
|
-
LIMIT :limit`
|
|
22382
|
+
LIMIT :limit OFFSET :offset`
|
|
22302
22383
|
),
|
|
22303
22384
|
bindParams({
|
|
22304
22385
|
now,
|
|
22305
22386
|
limit: limit + 1,
|
|
22387
|
+
offset,
|
|
22306
22388
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
22307
22389
|
})
|
|
22308
22390
|
);
|
|
@@ -22327,7 +22409,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
22327
22409
|
*/
|
|
22328
22410
|
listDerefs(query = {}) {
|
|
22329
22411
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
22330
|
-
const
|
|
22412
|
+
const offset = pageOffset(query.offset);
|
|
22413
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
22331
22414
|
const conditions = [];
|
|
22332
22415
|
if (query.includeBatched !== true) {
|
|
22333
22416
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -22340,21 +22423,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
22340
22423
|
this.db.prepare(
|
|
22341
22424
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
22342
22425
|
FROM secret_vault_deref ${where}
|
|
22343
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
22426
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
22344
22427
|
),
|
|
22345
22428
|
bindParams({
|
|
22346
22429
|
limit: limit + 1,
|
|
22430
|
+
offset,
|
|
22347
22431
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
22348
22432
|
})
|
|
22349
22433
|
);
|
|
22350
22434
|
const hasMore = rows.length > limit;
|
|
22351
22435
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
22352
22436
|
const last = page[page.length - 1];
|
|
22353
|
-
const
|
|
22354
|
-
this.db
|
|
22355
|
-
|
|
22356
|
-
|
|
22437
|
+
const counts = getRow(
|
|
22438
|
+
this.db.prepare(
|
|
22439
|
+
`SELECT count(*) AS total,
|
|
22440
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
22441
|
+
FROM secret_vault_deref`
|
|
22442
|
+
)
|
|
22443
|
+
) ?? { total: 0, hidden: 0 };
|
|
22444
|
+
const includeBatched = query.includeBatched === true;
|
|
22445
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
22357
22446
|
return {
|
|
22447
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
22358
22448
|
items: page.map((r) => ({
|
|
22359
22449
|
id: r.id,
|
|
22360
22450
|
pointerId: r.pointer_id,
|
|
@@ -23783,6 +23873,9 @@ import { spawn as spawn2 } from "child_process";
|
|
|
23783
23873
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
23784
23874
|
var SYNC_THROTTLE_MS = 15 * 60 * 1e3;
|
|
23785
23875
|
|
|
23876
|
+
// ../../packages/plugin-runtime/src/attached/vault-credentials.ts
|
|
23877
|
+
import { dirname as dirname8 } from "path";
|
|
23878
|
+
|
|
23786
23879
|
// ../../packages/plugin-runtime/src/content-retention-pass.ts
|
|
23787
23880
|
var MAX_ROWS_PER_SWEEP = 50 * 1e3;
|
|
23788
23881
|
var DAY_MS5 = 864e5;
|
|
@@ -23836,7 +23929,7 @@ var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
|
|
|
23836
23929
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
23837
23930
|
|
|
23838
23931
|
// ../../packages/plugin-runtime/src/attached/forwarding-line.ts
|
|
23839
|
-
import { dirname as
|
|
23932
|
+
import { dirname as dirname9 } from "path";
|
|
23840
23933
|
|
|
23841
23934
|
// ../../packages/plugin-runtime/src/handle-session-start.ts
|
|
23842
23935
|
var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
@@ -8334,7 +8334,11 @@ var ListFindingTypesQuery = object({
|
|
|
8334
8334
|
// and so is not bounded by what any page happens to hold.
|
|
8335
8335
|
includeId: string2().optional(),
|
|
8336
8336
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8337
|
-
cursor: string2().optional()
|
|
8337
|
+
cursor: string2().optional(),
|
|
8338
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8339
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8340
|
+
// from wherever it lands.
|
|
8341
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8338
8342
|
});
|
|
8339
8343
|
var ListFindingTypesResponse = object({
|
|
8340
8344
|
totals: object({
|
|
@@ -8414,7 +8418,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8414
8418
|
sessionId: string2().optional(),
|
|
8415
8419
|
from: iso_exports.datetime().optional(),
|
|
8416
8420
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8417
|
-
cursor: string2().optional()
|
|
8421
|
+
cursor: string2().optional(),
|
|
8422
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8423
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8424
|
+
// from wherever it lands.
|
|
8425
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8418
8426
|
});
|
|
8419
8427
|
var ListFindingInstancesResponse = object({
|
|
8420
8428
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8485,7 +8493,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8485
8493
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8486
8494
|
includeId: string2().optional(),
|
|
8487
8495
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8488
|
-
cursor: string2().optional()
|
|
8496
|
+
cursor: string2().optional(),
|
|
8497
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8498
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8499
|
+
// from wherever it lands.
|
|
8500
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8489
8501
|
});
|
|
8490
8502
|
var ListFindingLocationsResponse = object({
|
|
8491
8503
|
totals: object({
|
|
@@ -8978,7 +8990,13 @@ var AuditEventType = _enum([
|
|
|
8978
8990
|
// is doing — a write-through of the native host's in-memory tracker, so a
|
|
8979
8991
|
// second process (aka extension status) and a restarted host both have
|
|
8980
8992
|
// somewhere to read it back from.
|
|
8981
|
-
"capture_status"
|
|
8993
|
+
"capture_status",
|
|
8994
|
+
// One row per commit a session's checkout reached while a git command the
|
|
8995
|
+
// agent ran was running, hung off the session root. Its `attributes` follow
|
|
8996
|
+
// `GitCommitAttributes`: the commit id, the kind of HEAD move, the
|
|
8997
|
+
// attribution, and `scope_key`, the repository the command ran in; never
|
|
8998
|
+
// the branch, commit message, author or diff.
|
|
8999
|
+
"git_commit"
|
|
8982
9000
|
]).meta({ id: "AuditEventType" });
|
|
8983
9001
|
var AttributeBag = record(string2(), unknown());
|
|
8984
9002
|
var HostAttributes = object({
|
|
@@ -9086,6 +9104,13 @@ var ToolCallAttributes = object({
|
|
|
9086
9104
|
parent_uuid: string2().optional(),
|
|
9087
9105
|
run_key: string2().optional()
|
|
9088
9106
|
}).catchall(unknown());
|
|
9107
|
+
var GitCommitKind = _enum(["commit", "merge", "rebase", "cherry-pick", "am", "revert"]);
|
|
9108
|
+
var GitCommitAttributes = object({
|
|
9109
|
+
commit: string2().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),
|
|
9110
|
+
kind: GitCommitKind,
|
|
9111
|
+
attribution: literal("command_window"),
|
|
9112
|
+
scope_key: string2().optional()
|
|
9113
|
+
}).catchall(unknown());
|
|
9089
9114
|
var CaptureAttributes = object({
|
|
9090
9115
|
// The harness/tool that produced the capture (`claude-code`, `cli`, …). A
|
|
9091
9116
|
// column on the legacy `events` table; here it rides the bag because a
|
|
@@ -10885,7 +10910,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
10885
10910
|
var ListVaultInventoryQuery = object({
|
|
10886
10911
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
10887
10912
|
// Opaque; names the last row of the page just served.
|
|
10888
|
-
cursor: string2().optional()
|
|
10913
|
+
cursor: string2().optional(),
|
|
10914
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
10915
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
10916
|
+
// from wherever it lands.
|
|
10917
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
10889
10918
|
});
|
|
10890
10919
|
var ListVaultInventoryResponse = object({
|
|
10891
10920
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -10897,7 +10926,11 @@ var ListVaultInventoryResponse = object({
|
|
|
10897
10926
|
});
|
|
10898
10927
|
var ListVaultReuseQuery = object({
|
|
10899
10928
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
10900
|
-
cursor: string2().optional()
|
|
10929
|
+
cursor: string2().optional(),
|
|
10930
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
10931
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
10932
|
+
// from wherever it lands.
|
|
10933
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
10901
10934
|
});
|
|
10902
10935
|
var ListVaultReuseResponse = object({
|
|
10903
10936
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -10913,9 +10946,15 @@ var ListVaultDerefsQuery = object({
|
|
|
10913
10946
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
10914
10947
|
includeBatched: boolean2().optional(),
|
|
10915
10948
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
10916
|
-
cursor: string2().optional()
|
|
10949
|
+
cursor: string2().optional(),
|
|
10950
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
10951
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
10952
|
+
// from wherever it lands.
|
|
10953
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
10917
10954
|
});
|
|
10918
10955
|
var ListVaultDerefsResponse = object({
|
|
10956
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
10957
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
10919
10958
|
items: array(VaultDeref),
|
|
10920
10959
|
nextCursor: string2().nullable(),
|
|
10921
10960
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -11366,6 +11405,45 @@ var ConfigInventoryAck = object({
|
|
|
11366
11405
|
accepted: number2().int().nonnegative()
|
|
11367
11406
|
});
|
|
11368
11407
|
|
|
11408
|
+
// ../../packages/schema/src/zod/credential-handles.ts
|
|
11409
|
+
var CREDENTIAL_SLUG_SOURCE = "[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?";
|
|
11410
|
+
var CredentialSlug = string2().regex(
|
|
11411
|
+
new RegExp(`^${CREDENTIAL_SLUG_SOURCE}$`),
|
|
11412
|
+
"must be lower-case letters, digits and dashes"
|
|
11413
|
+
);
|
|
11414
|
+
var HANDLE_SOURCE = `\\[\\[aka:cred:(${CREDENTIAL_SLUG_SOURCE})\\]\\]`;
|
|
11415
|
+
function credentialHandleScanner() {
|
|
11416
|
+
return new RegExp(HANDLE_SOURCE, "g");
|
|
11417
|
+
}
|
|
11418
|
+
var CREDENTIAL_RESOLVE_BATCH_MAX = 20;
|
|
11419
|
+
var CREDENTIAL_VALUE_MAX_LENGTH = 65536;
|
|
11420
|
+
var AvailableCredential = object({
|
|
11421
|
+
slug: CredentialSlug,
|
|
11422
|
+
description: string2().max(500),
|
|
11423
|
+
/**
|
|
11424
|
+
* The value's sighting tokens under each accepted sighting-key version, so a
|
|
11425
|
+
* machine can recognise the value when it is pasted. Absent when the store
|
|
11426
|
+
* could not be read.
|
|
11427
|
+
*/
|
|
11428
|
+
lookups: array(string2().max(200)).max(SIGHTING_ALIASES_MAX + 1).optional()
|
|
11429
|
+
}).strict();
|
|
11430
|
+
var AvailableCredentialsResponse = object({ credentials: array(AvailableCredential) }).strict();
|
|
11431
|
+
var ResolveCredentialsRequest = object({
|
|
11432
|
+
slugs: array(CredentialSlug).min(1).max(CREDENTIAL_RESOLVE_BATCH_MAX).refine((slugs) => new Set(slugs).size === slugs.length, "slugs must be unique"),
|
|
11433
|
+
sessionId: string2().min(1).max(128).nullable()
|
|
11434
|
+
}).strict();
|
|
11435
|
+
var CredentialRefusalReason = _enum([
|
|
11436
|
+
"no_grant",
|
|
11437
|
+
"credential_not_found",
|
|
11438
|
+
"store_unavailable"
|
|
11439
|
+
]);
|
|
11440
|
+
var ResolveCredentialsResponse = object({
|
|
11441
|
+
resolved: array(
|
|
11442
|
+
object({ slug: CredentialSlug, value: string2().max(CREDENTIAL_VALUE_MAX_LENGTH) }).strict()
|
|
11443
|
+
),
|
|
11444
|
+
refused: array(object({ slug: CredentialSlug, reason: CredentialRefusalReason }).strict())
|
|
11445
|
+
}).strict();
|
|
11446
|
+
|
|
11369
11447
|
// ../../packages/schema/src/zod/credential-status.ts
|
|
11370
11448
|
var CredentialStatus = _enum(["rotation_overdue", "exposed"]).meta({ id: "CredentialStatus" });
|
|
11371
11449
|
|
|
@@ -13025,7 +13103,11 @@ var keywordMatcher = new KeywordMatcher2();
|
|
|
13025
13103
|
var regexMatcher = new RegexMatcher2();
|
|
13026
13104
|
|
|
13027
13105
|
// ../../packages/detections/src/pointer-shield.ts
|
|
13028
|
-
var SHIELDED_SOURCE =
|
|
13106
|
+
var SHIELDED_SOURCE = [
|
|
13107
|
+
POINTER_TOKEN_PATTERN.source,
|
|
13108
|
+
SIGHTING_TOKEN_PATTERN.source,
|
|
13109
|
+
credentialHandleScanner().source
|
|
13110
|
+
].join("|");
|
|
13029
13111
|
|
|
13030
13112
|
// ../../packages/detections/src/posture/config-posture.ts
|
|
13031
13113
|
var RULE_VERSION = "2";
|
|
@@ -13432,7 +13514,7 @@ var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).j
|
|
|
13432
13514
|
var SYNC_FAILURE_REASONS = SyncFailureReason.options;
|
|
13433
13515
|
|
|
13434
13516
|
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
13435
|
-
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
13517
|
+
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call", "git_commit"];
|
|
13436
13518
|
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
13437
13519
|
var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_TYPE_LIST;
|
|
13438
13520
|
var COUNTED_EVENT_TYPES = [
|