@akasecurity/ai-tc-claude-code 0.9.4 → 0.9.6

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.
@@ -492,13 +492,12 @@ var require_ignore = __commonJS({
492
492
  });
493
493
 
494
494
  // ../../packages/plugin-sdk/src/config.ts
495
- import { existsSync as existsSync4 } from "fs";
496
- import { join as join7 } from "path";
495
+ import { existsSync as existsSync5 } from "fs";
496
+ import { join as join8 } from "path";
497
497
 
498
498
  // ../../packages/persistence/src/database.ts
499
- import { randomUUID as randomUUID9 } from "crypto";
500
- import { existsSync, renameSync as renameSync2, rmSync as rmSync2 } from "fs";
501
- import { join, sep } from "path";
499
+ import { randomUUID as randomUUID10 } from "crypto";
500
+ import { join as join2, sep } from "path";
502
501
  import { DatabaseSync } from "node:sqlite";
503
502
 
504
503
  // ../../packages/schema/src/exception-scope.ts
@@ -15093,7 +15092,17 @@ var Finding = external_exports.object({
15093
15092
  }).meta({ id: "Finding" });
15094
15093
  var DetectedFinding = Finding.meta({ id: "DetectedFinding" });
15095
15094
  var FindingAction = external_exports.enum(["blocked", "redacted", "warned", "allowed", "quarantined", "monitored"]).meta({ id: "FindingAction" });
15096
- var FindingProvider = external_exports.enum(["claudecode", "claudedesktop", "cursor", "copilot", "chatgpt", "api"]).meta({ id: "FindingProvider" });
15095
+ var FindingProvider = external_exports.enum([
15096
+ "claudecode",
15097
+ "claudedesktop",
15098
+ "cursor",
15099
+ "copilot",
15100
+ "chatgpt",
15101
+ "claudeai",
15102
+ "codex",
15103
+ "antigravity",
15104
+ "api"
15105
+ ]).meta({ id: "FindingProvider" });
15097
15106
  var FindingCategory = external_exports.enum([
15098
15107
  "secret",
15099
15108
  "pii",
@@ -15147,7 +15156,16 @@ var FindingInstance = external_exports.object({
15147
15156
  confidence: external_exports.number().min(0).max(1),
15148
15157
  // Lifecycle status (see FindingStatus). Optional so legacy callers/rows
15149
15158
  // that predate the resolution feature stay valid.
15150
- status: FindingStatus.optional()
15159
+ status: FindingStatus.optional(),
15160
+ // The audit event this finding was captured from. Optional so callers that
15161
+ // do not project it stay valid. An at-rest finding is content-addressed by
15162
+ // finding_key and its row is upserted on re-detection, so this names the
15163
+ // MOST RECENT detection event, not the first.
15164
+ eventId: external_exports.string().optional(),
15165
+ // The session that event belongs to, when it has one — the seam a
15166
+ // per-instance "view session" link needs. Absent for events captured
15167
+ // outside a session.
15168
+ sessionId: external_exports.string().optional()
15151
15169
  }).meta({ id: "FindingInstance" });
15152
15170
  var FindingGroup = external_exports.object({
15153
15171
  id: external_exports.string(),
@@ -15191,7 +15209,11 @@ var FindingFacets = external_exports.object({
15191
15209
  // for every instance, so every group lands in a bucket; a status-less
15192
15210
  // group (possible only for callers whose rows carry no statuses) is
15193
15211
  // counted under no value.
15194
- status: external_exports.array(FindingFacetItem)
15212
+ status: external_exports.array(FindingFacetItem),
15213
+ // Host tool (attributes.tool_name). Present only on the instance-level
15214
+ // reads, which can filter by it; the grouped read omits the dimension
15215
+ // because a group spans tools.
15216
+ tool: external_exports.array(FindingFacetItem).optional()
15195
15217
  }).meta({ id: "FindingFacets" });
15196
15218
  var ListGroupedFindingsQuery = external_exports.object({
15197
15219
  // NOTE: severity filters by Severity (critical/high/medium/low), not by
@@ -15208,6 +15230,16 @@ var ListGroupedFindingsQuery = external_exports.object({
15208
15230
  // Scope to findings whose event carries this session id (the Activity page's
15209
15231
  // session → findings drilldown). Findings without a session never match.
15210
15232
  sessionId: external_exports.string().optional(),
15233
+ // Inclusive lower bound on the parent event's timestamp, so a caller arriving
15234
+ // from a time-scoped page (Activity's range) can carry that scope. Absent
15235
+ // means all time — this list has no default window.
15236
+ from: external_exports.iso.datetime().optional(),
15237
+ // A group or instance id that must appear in the page even when the cursor
15238
+ // has already advanced past its sort position. This is what keeps the
15239
+ // Findings page's one-shot ?finding= deep link resolving once the list
15240
+ // paginates: the target group is appended out of sort order rather than
15241
+ // scanning forward for it. Never affects totals, facets or the cursor.
15242
+ includeId: external_exports.string().optional(),
15211
15243
  groupBy: external_exports.literal("type").optional(),
15212
15244
  limit: external_exports.coerce.number().int().min(1).max(100).optional(),
15213
15245
  cursor: external_exports.string().optional()
@@ -15252,9 +15284,100 @@ var FindingInstanceDetail = FindingInstance.extend({
15252
15284
  detection: FindingDetectionRef,
15253
15285
  policy: FindingPolicyRef
15254
15286
  }).meta({ id: "FindingInstanceDetail" });
15287
+ var ListFindingInstancesQuery = external_exports.object({
15288
+ severity: external_exports.array(Severity).optional(),
15289
+ // Rule ids, the same vocabulary the grouped list's `subtype` carries.
15290
+ subtype: external_exports.array(external_exports.string()).optional(),
15291
+ provider: external_exports.array(FindingProvider).optional(),
15292
+ action: external_exports.array(FindingAction).optional(),
15293
+ // Matches each instance's OWN derived status (deriveFindingStatus), unlike
15294
+ // the grouped query's group-level fold.
15295
+ status: external_exports.array(FindingStatus).optional(),
15296
+ // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
15297
+ // where the free-text `q` can only match the rendered "via Bash" label.
15298
+ tool: external_exports.array(external_exports.string()).optional(),
15299
+ // Exact repository / file-path matches, for the drill-down out of the
15300
+ // locations view. A row whose event carries no repo/file matches neither.
15301
+ repo: external_exports.string().optional(),
15302
+ file: external_exports.string().optional(),
15303
+ q: external_exports.string().optional(),
15304
+ sessionId: external_exports.string().optional(),
15305
+ from: external_exports.iso.datetime().optional(),
15306
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
15307
+ cursor: external_exports.string().optional()
15308
+ });
15309
+ var ListFindingInstancesResponse = external_exports.object({
15310
+ // Instances matching the filters across the whole scope, not just this
15311
+ // page — cursor-independent, like the grouped list's totals.
15312
+ totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
15313
+ // Counts in INSTANCES here, where the grouped response counts groups. Each
15314
+ // dimension still excludes its own filter.
15315
+ facets: FindingFacets,
15316
+ items: external_exports.array(FindingInstanceDetail),
15317
+ nextCursor: external_exports.string().nullable()
15318
+ }).meta({ id: "ListFindingInstancesResponse" });
15319
+ var FindingLocationFile = external_exports.object({
15320
+ // Empty when the instances carried no file path (a prompt or a tool call
15321
+ // with no file attribution).
15322
+ file: external_exports.string(),
15323
+ instanceCount: external_exports.number().int().nonnegative(),
15324
+ maxSeverity: Severity,
15325
+ latestDetectedAt: external_exports.iso.datetime(),
15326
+ // Folded from the instances' derived statuses with the same
15327
+ // open-dominates precedence a group uses.
15328
+ status: FindingStatus.optional(),
15329
+ // Distinct rules seen at this location, capped — the row shows them as
15330
+ // chips, and the count is what conveys scale.
15331
+ ruleIds: external_exports.array(external_exports.string())
15332
+ }).meta({ id: "FindingLocationFile" });
15333
+ var FindingLocationRepo = external_exports.object({
15334
+ /** Empty when the instances carried no repo attribute. */
15335
+ repo: external_exports.string(),
15336
+ instanceCount: external_exports.number().int().nonnegative(),
15337
+ maxSeverity: Severity,
15338
+ latestDetectedAt: external_exports.iso.datetime(),
15339
+ status: FindingStatus.optional(),
15340
+ files: external_exports.array(FindingLocationFile)
15341
+ }).meta({ id: "FindingLocationRepo" });
15342
+ var ListFindingLocationsQuery = external_exports.object({
15343
+ severity: external_exports.array(Severity).optional(),
15344
+ subtype: external_exports.array(external_exports.string()).optional(),
15345
+ provider: external_exports.array(FindingProvider).optional(),
15346
+ action: external_exports.array(FindingAction).optional(),
15347
+ // Per-instance, as in ListFindingInstancesQuery: a location keeps the
15348
+ // instances that match, and folds its status from those.
15349
+ status: external_exports.array(FindingStatus).optional(),
15350
+ tool: external_exports.array(external_exports.string()).optional(),
15351
+ q: external_exports.string().optional(),
15352
+ sessionId: external_exports.string().optional(),
15353
+ from: external_exports.iso.datetime().optional(),
15354
+ limit: external_exports.coerce.number().int().min(1).max(500).optional()
15355
+ });
15356
+ var ListFindingLocationsResponse = external_exports.object({
15357
+ totals: external_exports.object({
15358
+ findings: external_exports.number().int().nonnegative(),
15359
+ repos: external_exports.number().int().nonnegative(),
15360
+ files: external_exports.number().int().nonnegative()
15361
+ }),
15362
+ /** Sorted by max severity, then most recent. */
15363
+ items: external_exports.array(FindingLocationRepo),
15364
+ /** Whether `limit` truncated the repo list. */
15365
+ hasMore: external_exports.boolean()
15366
+ }).meta({ id: "ListFindingLocationsResponse" });
15255
15367
 
15256
15368
  // ../../packages/schema/src/zod/harness-map.ts
15257
- var Harness = external_exports.enum(["claudecode", "cursor", "copilot", "codex", "windsurf", "claudedesktop", "chatgpt", "api"]).meta({ id: "Harness" });
15369
+ var Harness = external_exports.enum([
15370
+ "claudecode",
15371
+ "cursor",
15372
+ "copilot",
15373
+ "codex",
15374
+ "antigravity",
15375
+ "windsurf",
15376
+ "claudedesktop",
15377
+ "chatgpt",
15378
+ "claudeai",
15379
+ "api"
15380
+ ]).meta({ id: "Harness" });
15258
15381
 
15259
15382
  // ../../packages/schema/src/zod/meta.ts
15260
15383
  var InventoryObjectType = external_exports.enum(["host", "harness", "user", "skill", "hook", "mcp_server", "config_file"]).meta({ id: "InventoryObjectType" });
@@ -15708,7 +15831,18 @@ var ActivityOverviewResponse = external_exports.object({
15708
15831
  // ../../packages/schema/src/zod/event.ts
15709
15832
  var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
15710
15833
  var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
15711
- var SourceTool = external_exports.enum(["claude-code", "claude-desktop", "cursor", "chatgpt", "github-copilot", "cli", "unknown"]).meta({ id: "SourceTool" });
15834
+ var SourceTool = external_exports.enum([
15835
+ "claude-code",
15836
+ "claude-desktop",
15837
+ "cursor",
15838
+ "chatgpt",
15839
+ "claude-ai",
15840
+ "github-copilot",
15841
+ "codex",
15842
+ "antigravity",
15843
+ "cli",
15844
+ "unknown"
15845
+ ]).meta({ id: "SourceTool" });
15712
15846
  var EventMetadata = external_exports.object({
15713
15847
  sessionId: external_exports.string().optional(),
15714
15848
  repo: external_exports.string().optional(),
@@ -15779,7 +15913,7 @@ var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).me
15779
15913
  var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
15780
15914
  var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
15781
15915
  var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
15782
- var HarnessId = external_exports.enum(["claudecode", "cursor", "codex"]).meta({ id: "HarnessId" });
15916
+ var HarnessId = external_exports.enum(["claudecode", "cursor", "codex", "antigravity"]).meta({ id: "HarnessId" });
15783
15917
  var AccessCounts = external_exports.object({
15784
15918
  open: external_exports.number().int().nonnegative(),
15785
15919
  approved: external_exports.number().int().nonnegative(),
@@ -16048,6 +16182,7 @@ var ExceptionBundleEntry = DetectionException.pick({
16048
16182
  useCount: true,
16049
16183
  conditions: true
16050
16184
  });
16185
+ var ExceptionDescriptor = DetectionException.omit({ valueFingerprint: true });
16051
16186
 
16052
16187
  // ../../packages/schema/src/zod/rule.ts
16053
16188
  var MatcherType = external_exports.enum(["keyword", "regex", "validator"]).meta({ id: "MatcherType" });
@@ -16779,6 +16914,35 @@ var EgressWriteSummary = external_exports.object({
16779
16914
  droppedFiles: external_exports.array(external_exports.string()).default([])
16780
16915
  }).meta({ id: "EgressWriteSummary" });
16781
16916
 
16917
+ // ../../packages/schema/src/zod/exception-action.ts
16918
+ var confirmation = external_exports.string().optional();
16919
+ var ApproveBlockedInput = external_exports.object({
16920
+ reference: external_exports.string(),
16921
+ scope: external_exports.string(),
16922
+ reason: external_exports.string(),
16923
+ confirmation
16924
+ });
16925
+ var AddExceptionInput = external_exports.object({
16926
+ ruleId: external_exports.string(),
16927
+ value: external_exports.string(),
16928
+ scope: external_exports.string(),
16929
+ reason: external_exports.string(),
16930
+ confirmation
16931
+ });
16932
+ var GrantRevealInput = external_exports.object({
16933
+ pointer: external_exports.string(),
16934
+ scope: external_exports.string(),
16935
+ justification: external_exports.string(),
16936
+ confirmation
16937
+ });
16938
+ var RevokeExceptionInput = external_exports.object({
16939
+ id: external_exports.string(),
16940
+ reason: external_exports.string()
16941
+ });
16942
+ var RotateKeyInput = external_exports.object({
16943
+ confirmation: external_exports.string()
16944
+ });
16945
+
16782
16946
  // ../../packages/schema/src/zod/installed-pack.ts
16783
16947
  var InstalledPack = external_exports.object({
16784
16948
  id: external_exports.guid(),
@@ -16910,6 +17074,48 @@ var VaultInventoryEntry = external_exports.object({
16910
17074
  revealGrantId: external_exports.string().nullable(),
16911
17075
  sightings: external_exports.array(VaultSighting)
16912
17076
  });
17077
+ var MAX_VAULT_PAGE_LIMIT = 200;
17078
+ var ListVaultInventoryQuery = external_exports.object({
17079
+ limit: external_exports.coerce.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
17080
+ // Opaque; names the last row of the page just served.
17081
+ cursor: external_exports.string().optional()
17082
+ });
17083
+ var ListVaultInventoryResponse = external_exports.object({
17084
+ // Vaulted values across the whole store, not just this page — cursor-
17085
+ // independent, so paging never changes what the count claims.
17086
+ totals: external_exports.object({ values: external_exports.number().int().nonnegative() }),
17087
+ items: external_exports.array(VaultInventoryEntry),
17088
+ // `null` once the last page is reached.
17089
+ nextCursor: external_exports.string().nullable()
17090
+ });
17091
+ var ListVaultReuseQuery = external_exports.object({
17092
+ limit: external_exports.coerce.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
17093
+ cursor: external_exports.string().optional()
17094
+ });
17095
+ var ListVaultReuseResponse = external_exports.object({
17096
+ // Reused values across the whole store — the number the section's claim
17097
+ // ("values detected in more than one place") is about.
17098
+ totals: external_exports.object({ reused: external_exports.number().int().nonnegative() }),
17099
+ items: external_exports.array(VaultInventoryEntry),
17100
+ nextCursor: external_exports.string().nullable()
17101
+ });
17102
+ var ListVaultDerefsQuery = external_exports.object({
17103
+ // Include the batched, high-volume reasons (display, view-render). Omitted
17104
+ // hides them and counts them into `hiddenBatched` instead, so the model
17105
+ // crossings stay visible. A real boolean, not `z.stringbool()`: this arrives
17106
+ // over a Server Action, which preserves the type, never as a URL param.
17107
+ includeBatched: external_exports.boolean().optional(),
17108
+ limit: external_exports.coerce.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
17109
+ cursor: external_exports.string().optional()
17110
+ });
17111
+ var ListVaultDerefsResponse = external_exports.object({
17112
+ items: external_exports.array(VaultDeref),
17113
+ nextCursor: external_exports.string().nullable(),
17114
+ // Display/view-render rows the query hid, over the WHOLE trail rather than
17115
+ // this page — it is the count the "N hidden" line and its toggle speak for.
17116
+ // Always 0 when `includeBatched` was set, since nothing was hidden.
17117
+ hiddenBatched: external_exports.number().int().nonnegative()
17118
+ });
16913
17119
  var VaultKeyCustody = external_exports.string();
16914
17120
  var VaultInlineReveal = external_exports.enum(["masked", "full", "off"]);
16915
17121
  var VaultConsent = external_exports.object({
@@ -17166,7 +17372,7 @@ var TopSourcesQuery = external_exports.object({
17166
17372
  // Omit for both kinds.
17167
17373
  kind: external_exports.enum(SOURCE_KINDS).optional()
17168
17374
  });
17169
- var Provider = external_exports.enum(["claudecode", "cursor", "codex", "chatgpt", "copilot", "api"]).meta({ id: "Provider" });
17375
+ var Provider = external_exports.enum(["claudecode", "cursor", "codex", "antigravity", "claudeai", "chatgpt", "copilot", "api"]).meta({ id: "Provider" });
17170
17376
  var ScanCoverageProvider = external_exports.object({
17171
17377
  provider: Provider,
17172
17378
  // Percent of that provider's traffic scanned in the window. 0 when unsupported.
@@ -17334,14 +17540,31 @@ var SetupHandoffOffer = external_exports.object({
17334
17540
  // ../../packages/persistence/src/ids.ts
17335
17541
  import { createHash } from "crypto";
17336
17542
 
17543
+ // ../../packages/persistence/src/internal/snapshot.ts
17544
+ import { randomUUID } from "crypto";
17545
+ import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync2, statSync } from "fs";
17546
+ import { basename, dirname, join } from "path";
17547
+
17337
17548
  // ../../packages/persistence/src/paths.ts
17338
- import { chmodSync, lstatSync, mkdirSync, renameSync, rmSync, writeFileSync } from "fs";
17549
+ import {
17550
+ chmodSync,
17551
+ linkSync,
17552
+ lstatSync,
17553
+ mkdirSync,
17554
+ renameSync,
17555
+ rmSync,
17556
+ writeFileSync
17557
+ } from "fs";
17558
+ import { threadId } from "worker_threads";
17559
+
17560
+ // ../../packages/persistence/src/internal/snapshot.ts
17561
+ var STALE_PARTIAL_MS = 5 * 6e4;
17339
17562
 
17340
17563
  // ../../packages/persistence/src/repositories/activity.ts
17341
17564
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
17342
17565
 
17343
17566
  // ../../packages/persistence/src/repositories/exceptions.ts
17344
- import { randomUUID } from "crypto";
17567
+ import { randomUUID as randomUUID2 } from "crypto";
17345
17568
  var BLOCKED_DETECTIONS_TTL_MS = 30 * 60 * 1e3;
17346
17569
  var BLOCKED_DETECTIONS_RETENTION_MS = 24 * 60 * 60 * 1e3;
17347
17570
  var ACTIVE_PREDICATE = `revoked_at IS NULL
@@ -17352,46 +17575,60 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
17352
17575
  AND ${ACTIVE_PREDICATE}`;
17353
17576
 
17354
17577
  // ../../packages/persistence/src/repositories/installed-packs.ts
17355
- import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
17578
+ import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
17356
17579
 
17357
17580
  // ../../packages/persistence/src/repositories/inventory-assets.ts
17358
- import { randomUUID as randomUUID3 } from "crypto";
17581
+ import { randomUUID as randomUUID4 } from "crypto";
17359
17582
  var VALID_HARNESS_IDS = new Set(HarnessId.options);
17360
17583
  var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
17361
17584
 
17362
17585
  // ../../packages/persistence/src/repositories/policies.ts
17363
- import { randomUUID as randomUUID4 } from "crypto";
17586
+ import { randomUUID as randomUUID5 } from "crypto";
17364
17587
 
17365
17588
  // ../../packages/persistence/src/repositories/project-files.ts
17366
- import { randomUUID as randomUUID5 } from "crypto";
17589
+ import { randomUUID as randomUUID6 } from "crypto";
17367
17590
 
17368
17591
  // ../../packages/persistence/src/repositories/resolutions.ts
17369
- import { randomUUID as randomUUID6 } from "crypto";
17592
+ import { randomUUID as randomUUID7 } from "crypto";
17370
17593
 
17371
17594
  // ../../packages/persistence/src/repositories/secret-vault.ts
17372
- import { randomUUID as randomUUID7 } from "crypto";
17595
+ import { randomUUID as randomUUID8 } from "crypto";
17373
17596
 
17374
17597
  // ../../packages/persistence/src/repositories/shares.ts
17375
- import { randomUUID as randomUUID8 } from "crypto";
17598
+ import { randomUUID as randomUUID9 } from "crypto";
17599
+
17600
+ // ../../packages/persistence/src/file-lock.ts
17601
+ import { randomUUID as randomUUID11 } from "crypto";
17602
+ import {
17603
+ closeSync,
17604
+ existsSync as existsSync2,
17605
+ openSync,
17606
+ readFileSync,
17607
+ rmSync as rmSync3,
17608
+ statSync as statSync2,
17609
+ writeFileSync as writeFileSync2
17610
+ } from "fs";
17611
+ import { hostname as hostname3 } from "os";
17612
+ var PARK = new Int32Array(new SharedArrayBuffer(4));
17376
17613
 
17377
17614
  // ../../packages/persistence/src/finding-key.ts
17378
17615
  import { createHash as createHash3 } from "crypto";
17379
17616
 
17380
17617
  // ../../packages/persistence/src/fingerprint.ts
17381
17618
  import { createHmac, randomBytes } from "crypto";
17382
- import { existsSync as existsSync2, readFileSync } from "fs";
17383
- import { join as join2 } from "path";
17619
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
17620
+ import { join as join3 } from "path";
17384
17621
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
17385
17622
 
17386
17623
  // ../../packages/persistence/src/local-layout.ts
17387
17624
  import { renameSync as renameSync3 } from "fs";
17388
17625
  import { mkdir } from "fs/promises";
17389
17626
  import { homedir } from "os";
17390
- import { join as join3 } from "path";
17627
+ import { join as join4 } from "path";
17391
17628
 
17392
17629
  // ../../packages/persistence/src/settings.ts
17393
- import { readFileSync as readFileSync2 } from "fs";
17394
- import { join as join4 } from "path";
17630
+ import { readFileSync as readFileSync3 } from "fs";
17631
+ import { join as join5 } from "path";
17395
17632
 
17396
17633
  // ../../packages/persistence/src/vault/crypto.ts
17397
17634
  import {
@@ -17408,20 +17645,20 @@ import { randomBytes as randomBytes2 } from "crypto";
17408
17645
  import {
17409
17646
  chmodSync as chmodSync2,
17410
17647
  mkdirSync as mkdirSync2,
17411
- readFileSync as readFileSync3,
17648
+ readFileSync as readFileSync4,
17412
17649
  renameSync as renameSync4,
17413
- rmSync as rmSync3,
17414
- statSync,
17415
- writeFileSync as writeFileSync2
17650
+ rmSync as rmSync4,
17651
+ statSync as statSync3,
17652
+ writeFileSync as writeFileSync3
17416
17653
  } from "fs";
17417
- import { join as join5 } from "path";
17654
+ import { join as join6 } from "path";
17418
17655
 
17419
17656
  // ../../packages/persistence/src/vault/vault.ts
17420
- import { randomBytes as randomBytes3, randomUUID as randomUUID10 } from "crypto";
17657
+ import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
17421
17658
 
17422
17659
  // ../../packages/persistence/src/warn-era-cap.ts
17423
- import { existsSync as existsSync3, writeFileSync as writeFileSync3 } from "fs";
17424
- import { join as join6 } from "path";
17660
+ import { existsSync as existsSync4, writeFileSync as writeFileSync4 } from "fs";
17661
+ import { join as join7 } from "path";
17425
17662
 
17426
17663
  // ../../packages/plugin-sdk/src/provider-env.ts
17427
17664
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -17442,9 +17679,9 @@ var providerEnvShape = {
17442
17679
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
17443
17680
 
17444
17681
  // ../../packages/plugin-sdk/src/config-inventory.ts
17445
- import { readdirSync, readFileSync as readFileSync5, realpathSync, statSync as statSync3 } from "fs";
17682
+ import { readdirSync as readdirSync2, readFileSync as readFileSync6, realpathSync, statSync as statSync5 } from "fs";
17446
17683
  import { homedir as homedir2 } from "os";
17447
- import { basename as basename2, join as join9 } from "path";
17684
+ import { basename as basename3, join as join10 } from "path";
17448
17685
 
17449
17686
  // ../../packages/detections/src/egress/registry.ts
17450
17687
  var EXTRACTOR_VERSION = "1";
@@ -18018,6 +18255,40 @@ function escapeRegExp2(value) {
18018
18255
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18019
18256
  }
18020
18257
 
18258
+ // ../../packages/detections/src/regex-cache.ts
18259
+ var singles = /* @__PURE__ */ new WeakMap();
18260
+ var keywordLists = /* @__PURE__ */ new WeakMap();
18261
+ var labelLists = /* @__PURE__ */ new WeakMap();
18262
+ function listCache(kind) {
18263
+ return kind === "keyword" ? keywordLists : labelLists;
18264
+ }
18265
+ function memoizedRegExp(owner, build) {
18266
+ const cached2 = singles.get(owner);
18267
+ if (cached2 !== void 0) {
18268
+ cached2.lastIndex = 0;
18269
+ return cached2;
18270
+ }
18271
+ const compiled = build();
18272
+ singles.set(owner, compiled);
18273
+ return compiled;
18274
+ }
18275
+ function memoizedRegExpList(kind, owner, build) {
18276
+ const cache = listCache(kind);
18277
+ const cached2 = cache.get(owner);
18278
+ if (cached2 !== void 0) {
18279
+ if (cached2.stateful) {
18280
+ for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
18281
+ }
18282
+ return cached2.entries;
18283
+ }
18284
+ const entries = build();
18285
+ cache.set(owner, {
18286
+ entries,
18287
+ stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
18288
+ });
18289
+ return entries;
18290
+ }
18291
+
18021
18292
  // ../../packages/detections/src/matchers/limits.ts
18022
18293
  var MAX_MATCHES_PER_RULE = 1e4;
18023
18294
  var MAX_REGEX_INPUT_LENGTH = 2e5;
@@ -18028,10 +18299,17 @@ var KeywordMatcher2 = class {
18028
18299
  if (rule.matcher.type !== "keyword") return [];
18029
18300
  const { keywords, caseSensitive } = rule.matcher;
18030
18301
  const spans = [];
18031
- for (const kw of keywords) {
18032
- if (kw.length === 0) continue;
18302
+ const compiled = memoizedRegExpList(
18303
+ "keyword",
18304
+ rule.matcher,
18305
+ () => keywords.map((kw) => {
18306
+ if (kw.length === 0) return void 0;
18307
+ return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
18308
+ })
18309
+ );
18310
+ for (const re of compiled) {
18311
+ if (re === void 0) continue;
18033
18312
  if (spans.length >= MAX_MATCHES_PER_RULE) break;
18034
- const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
18035
18313
  let m;
18036
18314
  while ((m = re.exec(text)) !== null) {
18037
18315
  spans.push({ start: m.index, end: m.index + m[0].length });
@@ -18047,7 +18325,10 @@ var RegexMatcher2 = class {
18047
18325
  match(text, rule) {
18048
18326
  if (rule.matcher.type !== "regex") return [];
18049
18327
  const { pattern, flags, captureGroup } = rule.matcher;
18050
- const re = new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`);
18328
+ const re = memoizedRegExp(
18329
+ rule.matcher,
18330
+ () => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
18331
+ );
18051
18332
  const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
18052
18333
  const spans = [];
18053
18334
  let m;
@@ -18155,39 +18436,70 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
18155
18436
  );
18156
18437
 
18157
18438
  // ../../packages/plugin-sdk/src/repo.ts
18158
- import { existsSync as existsSync5, readFileSync as readFileSync4, statSync as statSync2 } from "fs";
18159
- import { basename, dirname, isAbsolute, join as join8, sep as sep2 } from "path";
18439
+ import { existsSync as existsSync6, readFileSync as readFileSync5, statSync as statSync4 } from "fs";
18440
+ import { basename as basename2, dirname as dirname2, isAbsolute, join as join9, sep as sep2 } from "path";
18160
18441
 
18161
18442
  // ../../packages/plugin-sdk/src/events.ts
18162
- import { createHash as createHash4, randomUUID as randomUUID11 } from "crypto";
18443
+ import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
18444
+
18445
+ // ../../packages/plugin-sdk/src/isolated-scan.ts
18446
+ import { existsSync as existsSync7 } from "fs";
18447
+ import { fileURLToPath } from "url";
18448
+ import { Worker } from "worker_threads";
18163
18449
 
18164
18450
  // ../../packages/plugin-sdk/src/inventory-resolver.ts
18165
- import { arch, hostname as hostname3, platform, release } from "os";
18451
+ import { arch, hostname as hostname4, platform, release } from "os";
18166
18452
 
18167
18453
  // ../../packages/plugin-sdk/src/nudge.ts
18168
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
18169
- import { join as join10 } from "path";
18454
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
18455
+ import { join as join11 } from "path";
18170
18456
 
18171
18457
  // ../../packages/plugin-sdk/src/paths.ts
18172
- import { readdirSync as readdirSync2, realpathSync as realpathSync2 } from "fs";
18173
- import { basename as basename3, dirname as dirname2, sep as sep3 } from "path";
18458
+ import { readdirSync as readdirSync3, realpathSync as realpathSync2 } from "fs";
18459
+ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
18174
18460
 
18175
18461
  // ../../packages/plugin-sdk/src/project-files.ts
18176
18462
  var import_ignore = __toESM(require_ignore(), 1);
18177
- import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync7 } from "fs";
18178
- import { basename as basename4, join as join11, relative, sep as sep4 } from "path";
18463
+ import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
18464
+ import { basename as basename5, join as join12 } from "path";
18465
+
18466
+ // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
18467
+ var optionalBaseUrl2 = external_exports.preprocess((v) => {
18468
+ if (typeof v === "string" && v.trim() === "") return void 0;
18469
+ return v;
18470
+ }, external_exports.string().optional()).catch(void 0);
18471
+ var optionalFlag = external_exports.preprocess((v) => {
18472
+ if (typeof v !== "string") return false;
18473
+ const normalized = v.trim().toLowerCase();
18474
+ return normalized !== "" && normalized !== "0" && normalized !== "false";
18475
+ }, external_exports.boolean()).catch(false);
18476
+ var antigravityProviderEnvShape = {
18477
+ GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
18478
+ GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
18479
+ };
18480
+ var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
18481
+
18482
+ // ../../packages/plugin-sdk/src/provider-env-codex.ts
18483
+ var optionalBaseUrl3 = external_exports.preprocess((v) => {
18484
+ if (typeof v === "string" && v.trim() === "") return void 0;
18485
+ return v;
18486
+ }, external_exports.string().optional()).catch(void 0);
18487
+ var codexProviderEnvShape = {
18488
+ OPENAI_BASE_URL: optionalBaseUrl3
18489
+ };
18490
+ var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
18179
18491
 
18180
18492
  // ../../packages/plugin-sdk/src/runtime.ts
18181
- import { randomUUID as randomUUID12 } from "crypto";
18493
+ import { randomUUID as randomUUID14 } from "crypto";
18182
18494
 
18183
18495
  // ../../packages/plugin-sdk/src/suppressions.ts
18184
18496
  var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
18185
18497
 
18186
18498
  // ../../packages/plugin-sdk/src/throttle.ts
18187
- import { mkdirSync as mkdirSync4, statSync as statSync4, writeFileSync as writeFileSync5 } from "fs";
18188
- import { join as join12 } from "path";
18499
+ import { mkdirSync as mkdirSync4, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
18500
+ import { join as join13 } from "path";
18189
18501
 
18190
- // src/onboard-posture.ts
18502
+ // ../../packages/setup-wizard/src/onboard-posture.ts
18191
18503
  function parsePosture(json2) {
18192
18504
  const raw = JSON.parse(json2);
18193
18505
  if (typeof raw !== "object" || raw === null) throw new Error("posture must be a JSON object");
@@ -18222,6 +18534,73 @@ function parseCurrent(json2) {
18222
18534
  return out;
18223
18535
  }
18224
18536
 
18537
+ // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
18538
+ import { writeFileSync as writeFileSync7 } from "fs";
18539
+ import { join as join14 } from "path";
18540
+
18541
+ // ../../packages/setup-wizard/src/triage/gate-display.ts
18542
+ var ACTION_RANK = {
18543
+ allow: 0,
18544
+ log: 1,
18545
+ warn: 2,
18546
+ redact: 3,
18547
+ block: 4
18548
+ };
18549
+ function isDowngrade(planned, current) {
18550
+ if (current === void 0) return false;
18551
+ return ACTION_RANK[builtinPolicyToAction(planned)] < ACTION_RANK[current];
18552
+ }
18553
+ function downgradeWarning(downgrades) {
18554
+ if (downgrades.length === 0) return "";
18555
+ return `
18556
+
18557
+ Heads up \u2014 this would lower ${String(downgrades.length)} detection level${downgrades.length === 1 ? "" : "s"} (${downgrades.join(", ")}) below what you've already set. Confirm you mean to lower ${downgrades.length === 1 ? "it" : "them"} before I apply.`;
18558
+ }
18559
+
18560
+ // ../../packages/setup-wizard/src/triage/plan-file.ts
18561
+ import { mkdtempSync, readFileSync as readFileSync9, rmdirSync, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
18562
+ import { tmpdir } from "os";
18563
+ import { basename as basename6, dirname as dirname4, join as join15 } from "path";
18564
+ var SuppressionEntrySchema = external_exports.object({
18565
+ ruleId: external_exports.string(),
18566
+ category: DetectionCategory,
18567
+ valueFingerprint: external_exports.string(),
18568
+ keyVersion: external_exports.number(),
18569
+ maskedValue: external_exports.string(),
18570
+ justification: external_exports.string()
18571
+ });
18572
+ var ShowcaseCategorySchema = external_exports.object({
18573
+ category: DetectionCategory,
18574
+ action: BuiltinPolicyId,
18575
+ genuineCount: external_exports.number(),
18576
+ fpCount: external_exports.number(),
18577
+ reasoning: external_exports.string()
18578
+ });
18579
+ var JoinEntrySchema = external_exports.object({
18580
+ id: external_exports.string(),
18581
+ ruleId: external_exports.string(),
18582
+ category: DetectionCategory,
18583
+ valueFingerprint: external_exports.string().optional(),
18584
+ keyVersion: external_exports.number().optional(),
18585
+ maskedMatch: external_exports.string(),
18586
+ maskedContext: external_exports.string()
18587
+ });
18588
+ var PLAN_FILE_VERSION = 3;
18589
+ var PersistedPlanSchema = external_exports.object({
18590
+ version: external_exports.literal(PLAN_FILE_VERSION),
18591
+ // partialRecord (not record): a posture only covers the categories present in
18592
+ // the evidence, so an exhaustive-key record would reject every real plan.
18593
+ posture: external_exports.partialRecord(DetectionCategory, BuiltinPolicyId),
18594
+ entries: external_exports.array(SuppressionEntrySchema),
18595
+ showcase: external_exports.array(ShowcaseCategorySchema),
18596
+ join: external_exports.array(JoinEntrySchema),
18597
+ notes: external_exports.string(),
18598
+ // The store's per-category action at preview time. The downgrade view is
18599
+ // rendered from it at PREVIEW (renderPosturePlan); confirm reads it back ONLY to
18600
+ // compare against the live store and reject a stale plan (runConfirm's drift gate).
18601
+ current: external_exports.partialRecord(DetectionCategory, ActionTaken)
18602
+ });
18603
+
18225
18604
  // src/setup-show.ts
18226
18605
  var SHOW_BEGIN = "<<<AKA_SHOW";
18227
18606
  var SHOW_END = "AKA_SHOW>>>";
@@ -18280,8 +18659,8 @@ function table(headers, rows, opts = {}) {
18280
18659
  const widths = headers.map(
18281
18660
  (h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
18282
18661
  );
18283
- const sep5 = " ".repeat(gap);
18284
- const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep5);
18662
+ const sep4 = " ".repeat(gap);
18663
+ const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
18285
18664
  const headerLine = fmt(headers.map((h) => h.toUpperCase()));
18286
18665
  if (opts.rowSep === true) {
18287
18666
  const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
@@ -18293,7 +18672,7 @@ function table(headers, rows, opts = {}) {
18293
18672
  });
18294
18673
  return [headerLine, rule, ...body].join("\n");
18295
18674
  }
18296
- const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep5);
18675
+ const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
18297
18676
  return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
18298
18677
  }
18299
18678
  function fenced(body) {
@@ -18306,28 +18685,9 @@ function show(body) {
18306
18685
  }
18307
18686
 
18308
18687
  // src/command-registry.ts
18309
- import { readdirSync as readdirSync4 } from "fs";
18310
- import { fileURLToPath } from "url";
18311
- var COMMANDS_DIR = fileURLToPath(new URL("../commands", import.meta.url));
18312
-
18313
- // src/triage/gate-display.ts
18314
- var ACTION_RANK = {
18315
- allow: 0,
18316
- log: 1,
18317
- warn: 2,
18318
- redact: 3,
18319
- block: 4
18320
- };
18321
- function isDowngrade(planned, current) {
18322
- if (current === void 0) return false;
18323
- return ACTION_RANK[builtinPolicyToAction(planned)] < ACTION_RANK[current];
18324
- }
18325
- function downgradeWarning(downgrades) {
18326
- if (downgrades.length === 0) return "";
18327
- return `
18328
-
18329
- Heads up \u2014 this would lower ${String(downgrades.length)} detection level${downgrades.length === 1 ? "" : "s"} (${downgrades.join(", ")}) below what you've already set. Confirm you mean to lower ${downgrades.length === 1 ? "it" : "them"} before I apply.`;
18330
- }
18688
+ import { readdirSync as readdirSync5 } from "fs";
18689
+ import { fileURLToPath as fileURLToPath2 } from "url";
18690
+ var COMMANDS_DIR = fileURLToPath2(new URL("../commands", import.meta.url));
18331
18691
 
18332
18692
  // src/render.ts
18333
18693
  var SEVERITY_GLYPH = {
@@ -18419,7 +18779,7 @@ function postureArg() {
18419
18779
  if (value === void 0) throw new Error("--adjust-confirm requires --posture <json>");
18420
18780
  return value;
18421
18781
  }
18422
- function recommendedPosture() {
18782
+ function recommendedPosture2() {
18423
18783
  const raw = jsonArg("--recommended");
18424
18784
  return raw === void 0 ? severityFloorPosture() : parsePosture(raw);
18425
18785
  }
@@ -18428,7 +18788,7 @@ function currentPosture() {
18428
18788
  return raw === void 0 ? {} : parseCurrent(raw);
18429
18789
  }
18430
18790
  try {
18431
- const card = argv.includes("--adjust-confirm") ? renderAdjustConfirm(recommendedPosture(), parsePosture(postureArg()), currentPosture()) : renderStartLight(severityFloorPosture());
18791
+ const card = argv.includes("--adjust-confirm") ? renderAdjustConfirm(recommendedPosture2(), parsePosture(postureArg()), currentPosture()) : renderStartLight(severityFloorPosture());
18432
18792
  process.stdout.write(show(fenced(card)));
18433
18793
  } catch (err) {
18434
18794
  const message = err instanceof Error ? err.message : String(err);