@akasecurity/cli 0.9.10 → 0.9.12

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.
Files changed (120) hide show
  1. package/README.md +12 -12
  2. package/dist/cli.js +3706 -1895
  3. package/extension/content.js +1 -1
  4. package/extension/manifest.json +1 -1
  5. package/native-host/host.js +2270 -1336
  6. package/native-host/scan-worker.js +388 -74
  7. package/native-host/sync.js +587 -138
  8. package/package.json +6 -6
  9. package/web-ui/package.json +1 -1
  10. package/web-ui/web-ui/.next/BUILD_ID +1 -1
  11. package/web-ui/web-ui/.next/app-build-manifest.json +81 -81
  12. package/web-ui/web-ui/.next/app-path-routes-manifest.json +5 -5
  13. package/web-ui/web-ui/.next/build-manifest.json +2 -2
  14. package/web-ui/web-ui/.next/prerender-manifest.json +14 -14
  15. package/web-ui/web-ui/.next/server/app/(app)/activity/page.js +2 -2
  16. package/web-ui/web-ui/.next/server/app/(app)/activity/page.js.nft.json +1 -1
  17. package/web-ui/web-ui/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
  18. package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js +2 -2
  19. package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js.nft.json +1 -1
  20. package/web-ui/web-ui/.next/server/app/(app)/data-shares/page_client-reference-manifest.js +1 -1
  21. package/web-ui/web-ui/.next/server/app/(app)/detections/page.js +2 -2
  22. package/web-ui/web-ui/.next/server/app/(app)/detections/page.js.nft.json +1 -1
  23. package/web-ui/web-ui/.next/server/app/(app)/detections/page_client-reference-manifest.js +1 -1
  24. package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js +2 -2
  25. package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js.nft.json +1 -1
  26. package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page_client-reference-manifest.js +1 -1
  27. package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js +1 -1
  28. package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js.nft.json +1 -1
  29. package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page_client-reference-manifest.js +1 -1
  30. package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js +1 -1
  31. package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js.nft.json +1 -1
  32. package/web-ui/web-ui/.next/server/app/(app)/exceptions/page_client-reference-manifest.js +1 -1
  33. package/web-ui/web-ui/.next/server/app/(app)/findings/page.js +2 -2
  34. package/web-ui/web-ui/.next/server/app/(app)/findings/page.js.nft.json +1 -1
  35. package/web-ui/web-ui/.next/server/app/(app)/findings/page_client-reference-manifest.js +1 -1
  36. package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js +2 -2
  37. package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js.nft.json +1 -1
  38. package/web-ui/web-ui/.next/server/app/(app)/inventory/page_client-reference-manifest.js +1 -1
  39. package/web-ui/web-ui/.next/server/app/(app)/policies/page.js +2 -2
  40. package/web-ui/web-ui/.next/server/app/(app)/policies/page.js.nft.json +1 -1
  41. package/web-ui/web-ui/.next/server/app/(app)/policies/page_client-reference-manifest.js +1 -1
  42. package/web-ui/web-ui/.next/server/app/(app)/scan/page.js +3 -3
  43. package/web-ui/web-ui/.next/server/app/(app)/scan/page.js.nft.json +1 -1
  44. package/web-ui/web-ui/.next/server/app/(app)/scan/page_client-reference-manifest.js +1 -1
  45. package/web-ui/web-ui/.next/server/app/(app)/security/page.js +2 -2
  46. package/web-ui/web-ui/.next/server/app/(app)/security/page.js.nft.json +1 -1
  47. package/web-ui/web-ui/.next/server/app/(app)/security/page_client-reference-manifest.js +1 -1
  48. package/web-ui/web-ui/.next/server/app/(app)/settings/page.js +2 -2
  49. package/web-ui/web-ui/.next/server/app/(app)/settings/page.js.nft.json +1 -1
  50. package/web-ui/web-ui/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
  51. package/web-ui/web-ui/.next/server/app/(app)/updates/page.js +2 -2
  52. package/web-ui/web-ui/.next/server/app/(app)/updates/page.js.nft.json +1 -1
  53. package/web-ui/web-ui/.next/server/app/(app)/updates/page_client-reference-manifest.js +1 -1
  54. package/web-ui/web-ui/.next/server/app/(app)/vault/page.js +2 -2
  55. package/web-ui/web-ui/.next/server/app/(app)/vault/page.js.nft.json +1 -1
  56. package/web-ui/web-ui/.next/server/app/(app)/vault/page_client-reference-manifest.js +1 -1
  57. package/web-ui/web-ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  58. package/web-ui/web-ui/.next/server/app/_not-found.html +1 -1
  59. package/web-ui/web-ui/.next/server/app/_not-found.rsc +2 -2
  60. package/web-ui/web-ui/.next/server/app/index.html +1 -1
  61. package/web-ui/web-ui/.next/server/app/index.rsc +2 -2
  62. package/web-ui/web-ui/.next/server/app/page_client-reference-manifest.js +1 -1
  63. package/web-ui/web-ui/.next/server/app-paths-manifest.json +5 -5
  64. package/web-ui/web-ui/.next/server/chunks/121.js +1 -0
  65. package/web-ui/web-ui/.next/server/chunks/290.js +6 -0
  66. package/web-ui/web-ui/.next/server/chunks/475.js +1 -1
  67. package/web-ui/web-ui/.next/server/chunks/589.js +1 -1
  68. package/web-ui/web-ui/.next/server/chunks/611.js +1015 -0
  69. package/web-ui/web-ui/.next/server/chunks/7.js +1 -1
  70. package/web-ui/web-ui/.next/server/chunks/816.js +1 -0
  71. package/web-ui/web-ui/.next/server/chunks/935.js +1 -1
  72. package/web-ui/web-ui/.next/server/chunks/968.js +1006 -0
  73. package/web-ui/web-ui/.next/server/functions-config-manifest.json +6 -6
  74. package/web-ui/web-ui/.next/server/middleware-manifest.json +5 -5
  75. package/web-ui/web-ui/.next/server/pages/404.html +1 -1
  76. package/web-ui/web-ui/.next/server/pages/500.html +1 -1
  77. package/web-ui/web-ui/.next/server/server-reference-manifest.js +1 -1
  78. package/web-ui/web-ui/.next/server/server-reference-manifest.json +1 -1
  79. package/web-ui/web-ui/.next/static/chunks/{526-026c69b926a17dbb.js → 526-f0156de7831566b3.js} +1 -1
  80. package/web-ui/web-ui/.next/static/chunks/674-d8237c5d0faa4a53.js +1 -0
  81. package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-a27c8937989448e4.js +1 -0
  82. package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-2b805f9e1f995092.js +1 -0
  83. package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-a87cfee370c4e0f4.js +1 -0
  84. package/web-ui/web-ui/.next/static/chunks/app/(app)/error-190085728a856072.js +1 -0
  85. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/{page-0fcffe4b9dff201f.js → page-4e214491c7be8d43.js} +1 -1
  86. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/page-c1bb992ee1f12566.js +1 -0
  87. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-f16ba40d88e414b1.js +1 -0
  88. package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-59c76da638f22b0e.js +1 -0
  89. package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-c37447caf89a86e1.js +1 -0
  90. package/web-ui/web-ui/.next/static/chunks/app/(app)/layout-cb3c8c7b6b33414c.js +1 -0
  91. package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/{page-b90748d139a546c9.js → page-ab639e48f60ad7ee.js} +1 -1
  92. package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-494614fccc8c62cc.js +1 -0
  93. package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-a3095119b3e87341.js +1 -0
  94. package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-469613d499e41093.js +1 -0
  95. package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-5b32bd569c9569d9.js +1 -0
  96. package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-3152ceb31f024b8d.js +1 -0
  97. package/web-ui/web-ui/.next/static/css/6e72259eccdf4435.css +2 -0
  98. package/web-ui/web-ui/dist/scan-worker.js +388 -74
  99. package/web-ui/web-ui/.next/server/chunks/389.js +0 -903
  100. package/web-ui/web-ui/.next/server/chunks/667.js +0 -894
  101. package/web-ui/web-ui/.next/server/chunks/851.js +0 -1
  102. package/web-ui/web-ui/.next/server/chunks/950.js +0 -6
  103. package/web-ui/web-ui/.next/static/chunks/907-207847c57011ba44.js +0 -1
  104. package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-e4f94a75c631ce86.js +0 -1
  105. package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-d70fcc5612f380b7.js +0 -1
  106. package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-e1823ce15bb6277d.js +0 -1
  107. package/web-ui/web-ui/.next/static/chunks/app/(app)/error-14165283b00c8626.js +0 -1
  108. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/page-c95079a2acd284fd.js +0 -1
  109. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-4b9f034bd078f5d3.js +0 -1
  110. package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-b97fc083884ef341.js +0 -1
  111. package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-e96e7e947ed5f279.js +0 -1
  112. package/web-ui/web-ui/.next/static/chunks/app/(app)/layout-83072d434c6b6b0e.js +0 -1
  113. package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-7a46abe149271870.js +0 -1
  114. package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-f4a1ee202d6e60a4.js +0 -1
  115. package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-2ec6d863f1a31792.js +0 -1
  116. package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-b388003fb0d3efd1.js +0 -1
  117. package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-6bda74d234a1376a.js +0 -1
  118. package/web-ui/web-ui/.next/static/css/81a7ed955b02c959.css +0 -2
  119. /package/web-ui/web-ui/.next/static/{k7tk0MLkPITbi_x6JL01X → PMeePXfXsQ2xxrXppySG_}/_buildManifest.js +0 -0
  120. /package/web-ui/web-ui/.next/static/{k7tk0MLkPITbi_x6JL01X → PMeePXfXsQ2xxrXppySG_}/_ssgManifest.js +0 -0
@@ -50,7 +50,7 @@ var require_ignore = __commonJS({
50
50
  var REGEX_SPLITALL_CRLF = /\r?\n/g;
51
51
  var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
52
52
  var REGEX_TEST_TRAILING_SLASH = /\/$/;
53
- var SLASH2 = "/";
53
+ var SLASH3 = "/";
54
54
  var TMP_KEY_IGNORE = "node-ignore";
55
55
  if (typeof Symbol !== "undefined") {
56
56
  TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
@@ -422,11 +422,11 @@ var require_ignore = __commonJS({
422
422
  if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
423
423
  return this.test(path);
424
424
  }
425
- const slices = path.split(SLASH2).filter(Boolean);
425
+ const slices = path.split(SLASH3).filter(Boolean);
426
426
  slices.pop();
427
427
  if (slices.length) {
428
428
  const parent = this._t(
429
- slices.join(SLASH2) + SLASH2,
429
+ slices.join(SLASH3) + SLASH3,
430
430
  this._testCache,
431
431
  true,
432
432
  slices
@@ -442,14 +442,14 @@ var require_ignore = __commonJS({
442
442
  return cache[path];
443
443
  }
444
444
  if (!slices) {
445
- slices = path.split(SLASH2).filter(Boolean);
445
+ slices = path.split(SLASH3).filter(Boolean);
446
446
  }
447
447
  slices.pop();
448
448
  if (!slices.length) {
449
449
  return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
450
450
  }
451
451
  const parent = this._t(
452
- slices.join(SLASH2) + SLASH2,
452
+ slices.join(SLASH3) + SLASH3,
453
453
  cache,
454
454
  checkUnignored,
455
455
  slices
@@ -491,9 +491,6 @@ var require_ignore = __commonJS({
491
491
  }
492
492
  });
493
493
 
494
- // ../../packages/plugin-runtime/src/attached/egress-wire.ts
495
- import { createHash as createHash4 } from "crypto";
496
-
497
494
  // ../../packages/persistence/src/attached-derived.ts
498
495
  import { rmSync } from "fs";
499
496
  import { join } from "path";
@@ -503,6 +500,14 @@ var ATTACHED_SYNC_STATE_FILENAME = "attached-sync-state.json";
503
500
  import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
504
501
  import { join as join2 } from "path";
505
502
 
503
+ // ../../packages/schema/src/drizzle/deferred-migrations.ts
504
+ var DEFERRED_MIGRATION_TAGS = [
505
+ "0031_audit_capture_by_time_index",
506
+ "0032_audit_capture_by_id_index",
507
+ "0033_audit_capture_location_index",
508
+ "0034_findings_read_indexes"
509
+ ];
510
+
506
511
  // ../../packages/schema/src/exception-scope.ts
507
512
  var MINUTE_MS = 6e4;
508
513
  var HOUR_MS = 60 * MINUTE_MS;
@@ -20312,6 +20317,15 @@ var FindingCategory = external_exports.enum([
20312
20317
  ]).meta({ id: "FindingCategory" });
20313
20318
  var FindingOrigin = external_exports.enum(["in-flight", "at-rest"]).meta({ id: "FindingOrigin" });
20314
20319
  var FindingStatus = external_exports.enum(["open", "handled", "resolved", "dismissed"]).meta({ id: "FindingStatus" });
20320
+ var SyncFailureReason = external_exports.enum(["deployment_refused", "payload_invalid", "detached_undelivered"]).meta({ id: "SyncFailureReason" });
20321
+ var FindingDeliveryState = external_exports.enum(["sent", "queued", "not_sent", "never_offered", "local_scan"]).meta({ id: "FindingDeliveryState" });
20322
+ var FindingDelivery = external_exports.object({
20323
+ state: FindingDeliveryState,
20324
+ // The delivery time for `sent`; the failure time for `not_sent` when recorded.
20325
+ at: external_exports.iso.datetime().optional(),
20326
+ // Only on `not_sent`, and only when a known reason was recorded.
20327
+ reason: SyncFailureReason.optional()
20328
+ }).meta({ id: "FindingDelivery" });
20315
20329
  var ResolutionMethod = external_exports.enum([
20316
20330
  "enforced-in-flight",
20317
20331
  "fixed-at-source",
@@ -20368,7 +20382,10 @@ var FindingInstance = external_exports.object({
20368
20382
  // The session that event belongs to, when it has one — the seam a
20369
20383
  // per-instance "view session" link needs. Absent for events captured
20370
20384
  // outside a session.
20371
- sessionId: external_exports.string().optional()
20385
+ sessionId: external_exports.string().optional(),
20386
+ // The delivery state of the event above (see FindingDelivery). Optional so
20387
+ // readers that do not project it stay valid.
20388
+ delivery: FindingDelivery.optional()
20372
20389
  }).meta({ id: "FindingInstance" });
20373
20390
  var FindingGroup = external_exports.object({
20374
20391
  id: external_exports.string(),
@@ -20385,13 +20402,11 @@ var FindingGroup = external_exports.object({
20385
20402
  latestDetectedAt: external_exports.iso.datetime(),
20386
20403
  instances: external_exports.array(FindingInstance),
20387
20404
  // Derived from instances' statuses with open-dominates precedence (see
20388
- // buildFindingGroups). Undefined only when no instance carries a status.
20405
+ // foldGroupStatus). Undefined only when no instance carries a status.
20389
20406
  status: FindingStatus.optional(),
20390
- // The distinct people across the WHOLE group, not just the `instances`
20391
- // preview — from the store's whole-group aggregate when it supplies one,
20392
- // else folded from the rows (see buildFindingGroups). Undefined when no
20393
- // instance carries a user, or when the store supplied whole-group folds
20394
- // without one.
20407
+ // The distinct people across the WHOLE group, not just the instances
20408
+ // carried here. Undefined when no instance carries a user, or when the
20409
+ // store supplied whole-group folds without one.
20395
20410
  users: external_exports.array(FindingUser).optional()
20396
20411
  }).meta({ id: "FindingGroup" });
20397
20412
  var FindingStats = external_exports.object({
@@ -20420,20 +20435,33 @@ var FindingFacets = external_exports.object({
20420
20435
  // counted under no value.
20421
20436
  status: external_exports.array(FindingFacetItem),
20422
20437
  // Host tool (attributes.tool_name). Present only on the instance-level
20423
- // reads, which can filter by it; the grouped read omits the dimension
20438
+ // reads, which can filter by it; the type-level read omits the dimension
20424
20439
  // because a group spans tools.
20425
- tool: external_exports.array(FindingFacetItem).optional()
20440
+ tool: external_exports.array(FindingFacetItem).optional(),
20441
+ // Delivery states (FindingDeliveryState). Present only on the
20442
+ // instance-level reads, like `tool`.
20443
+ deployment: external_exports.array(FindingFacetItem).optional()
20426
20444
  }).meta({ id: "FindingFacets" });
20427
- var ListGroupedFindingsQuery = external_exports.object({
20445
+ var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20446
+ id: "FindingTypeSummary"
20447
+ });
20448
+ var MAX_FINDING_TYPES_LIMIT = 100;
20449
+ var ListFindingTypesQuery = external_exports.object({
20428
20450
  // NOTE: severity filters by Severity (critical/high/medium/low), not by
20429
- // FindingAction.
20451
+ // FindingAction. It narrows TYPES: a type's severity is the one its newest
20452
+ // firing version carries, and this list pages types.
20453
+ //
20454
+ // That is NOT a claim the findings of a type share it. A rule can hold several
20455
+ // definition versions at different severities, so a type kept by this filter
20456
+ // can hold findings that individually do not match — see totals.findings on
20457
+ // ListFindingTypesResponse, which counts them all.
20430
20458
  severity: external_exports.array(Severity).optional(),
20431
20459
  subtype: external_exports.array(external_exports.string()).optional(),
20432
20460
  provider: external_exports.array(FindingProvider).optional(),
20433
20461
  action: external_exports.array(FindingAction).optional(),
20434
- // Matches a group's DERIVED status (see FindingGroup.status), not its
20435
- // individual instances' — so a filtered group's Status column always reads
20436
- // one of the requested values.
20462
+ // Matches a type's DERIVED status (see FindingGroup.status), not its
20463
+ // individual findings' — so a filtered row's status always reads one of the
20464
+ // requested values.
20437
20465
  status: external_exports.array(FindingStatus).optional(),
20438
20466
  q: external_exports.string().optional(),
20439
20467
  // Scope to findings whose event carries this session id (the Activity page's
@@ -20443,23 +20471,37 @@ var ListGroupedFindingsQuery = external_exports.object({
20443
20471
  // from a time-scoped page (Activity's range) can carry that scope. Absent
20444
20472
  // means all time — this list has no default window.
20445
20473
  from: external_exports.iso.datetime().optional(),
20446
- // A group or instance id that must appear in the page even when the cursor
20447
- // has already advanced past its sort position. This is what keeps the
20448
- // Findings page's one-shot ?finding= deep link resolving once the list
20449
- // paginates: the target group is appended out of sort order rather than
20450
- // scanning forward for it. Never affects totals, facets or the cursor.
20474
+ // A RULE id that must appear in the page even when the cursor has already
20475
+ // advanced past its sort position. This is what keeps the selected type
20476
+ // visible in the list once it paginates: the target is appended out of sort
20477
+ // order rather than scanned forward for. Never affects totals, facets or the
20478
+ // cursor. Unlike the grouped read this replaces, it names a rule only — an
20479
+ // instance id is resolved by `findingInstance`, which is a primary-key seek
20480
+ // and so is not bounded by what any page happens to hold.
20451
20481
  includeId: external_exports.string().optional(),
20452
- groupBy: external_exports.literal("type").optional(),
20453
- limit: external_exports.coerce.number().int().min(1).max(100).optional(),
20482
+ limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
20454
20483
  cursor: external_exports.string().optional()
20455
20484
  });
20456
- var ListGroupedFindingsResponse = external_exports.object({
20485
+ var ListFindingTypesResponse = external_exports.object({
20457
20486
  totals: external_exports.object({
20487
+ // Findings belonging to the matching TYPES — not findings that each match
20488
+ // the filters. The filters here select types, so a type that survives
20489
+ // contributes its whole instanceCount.
20490
+ //
20491
+ // `status` is the one exception, narrowed per finding via
20492
+ // countInstancesByStatus. `severity`, `provider` and `action` are not, so
20493
+ // this can exceed what the instance read reports for the same filters: a
20494
+ // rule whose severity moved between versions is kept on its newest and
20495
+ // still counts its older findings. Narrowing the other three needs
20496
+ // per-dimension counts the aggregate does not carry today.
20458
20497
  findings: external_exports.number().int().nonnegative(),
20459
- groups: external_exports.number().int().nonnegative()
20498
+ // Counts TYPES, which is the unit this read pages. The instance read's
20499
+ // own totals count findings; the two deliberately answer different
20500
+ // questions and are never summed.
20501
+ types: external_exports.number().int().nonnegative()
20460
20502
  }),
20461
20503
  facets: FindingFacets,
20462
- items: external_exports.array(FindingGroup),
20504
+ items: external_exports.array(FindingTypeSummary),
20463
20505
  nextCursor: external_exports.string().nullable(),
20464
20506
  // Present only on session-scoped queries (`sessionId` set): per ruleId, how
20465
20507
  // many times that rule fired in the session's persisted transcript. Findings
@@ -20467,7 +20509,7 @@ var ListGroupedFindingsResponse = external_exports.object({
20467
20509
  // every firing, so the two numbers legitimately differ — this map lets a
20468
20510
  // session-scoped view show both.
20469
20511
  sessionFirings: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional()
20470
- }).meta({ id: "ListGroupedFindingsResponse" });
20512
+ }).meta({ id: "ListFindingTypesResponse" });
20471
20513
  var ApplyFindingActionRequest = external_exports.object({
20472
20514
  // 'quarantined' is system-assigned (see FindingAction) — clients may not set
20473
20515
  // it, so it is excluded from the request contract. The mapping helper
@@ -20496,16 +20538,19 @@ var FindingInstanceDetail = FindingInstance.extend({
20496
20538
  var MAX_FLAT_FINDINGS_LIMIT = 200;
20497
20539
  var ListFindingInstancesQuery = external_exports.object({
20498
20540
  severity: external_exports.array(Severity).optional(),
20499
- // Rule ids, the same vocabulary the grouped list's `subtype` carries.
20541
+ // Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
20542
+ // ONE of them is how the master/detail view scopes its right-hand panel.
20500
20543
  subtype: external_exports.array(external_exports.string()).optional(),
20501
20544
  provider: external_exports.array(FindingProvider).optional(),
20502
20545
  action: external_exports.array(FindingAction).optional(),
20503
20546
  // Matches each instance's OWN derived status (deriveFindingStatus), unlike
20504
- // the grouped query's group-level fold.
20547
+ // the types query's type-level fold.
20505
20548
  status: external_exports.array(FindingStatus).optional(),
20506
20549
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20507
20550
  // where the free-text `q` can only match the rendered "via Bash" label.
20508
20551
  tool: external_exports.array(external_exports.string()).optional(),
20552
+ // The delivery state of each finding's event (see FindingDelivery).
20553
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20509
20554
  // Exact repository / file-path matches, for the drill-down out of the
20510
20555
  // locations view. A row whose event carries no repo/file matches neither.
20511
20556
  repo: external_exports.string().optional(),
@@ -20518,37 +20563,50 @@ var ListFindingInstancesQuery = external_exports.object({
20518
20563
  });
20519
20564
  var ListFindingInstancesResponse = external_exports.object({
20520
20565
  // Instances matching the filters across the whole scope, not just this
20521
- // page — cursor-independent, like the grouped list's totals.
20566
+ // page — cursor-independent, like the types list's totals.
20522
20567
  totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
20523
- // Counts in INSTANCES here, where the grouped response counts groups. Each
20568
+ // Counts in INSTANCES here, where the types response counts types. Each
20524
20569
  // dimension still excludes its own filter.
20525
20570
  facets: FindingFacets,
20526
20571
  items: external_exports.array(FindingInstanceDetail),
20527
20572
  nextCursor: external_exports.string().nullable()
20528
20573
  }).meta({ id: "ListFindingInstancesResponse" });
20529
- var FindingLocationFile = external_exports.object({
20530
- // Empty when the instances carried no file path (a prompt or a tool call
20531
- // with no file attribution).
20532
- file: external_exports.string(),
20533
- instanceCount: external_exports.number().int().nonnegative(),
20534
- maxSeverity: Severity,
20535
- latestDetectedAt: external_exports.iso.datetime(),
20536
- // Folded from the instances' derived statuses with the same
20537
- // open-dominates precedence a group uses.
20538
- status: FindingStatus.optional(),
20539
- // Distinct rules seen at this location, capped — the row shows them as
20540
- // chips, and the count is what conveys scale.
20541
- ruleIds: external_exports.array(external_exports.string())
20542
- }).meta({ id: "FindingLocationFile" });
20543
- var FindingLocationRepo = external_exports.object({
20574
+ var ListFindingInstancesPage = external_exports.object({
20575
+ items: external_exports.array(FindingInstanceDetail),
20576
+ nextCursor: external_exports.string().nullable()
20577
+ }).meta({ id: "ListFindingInstancesPage" });
20578
+ var FindingLocationSummary = external_exports.object({
20579
+ // Opaque, stable, minted from the pair by encodeLocationId. It exists
20580
+ // because a location's identity is two values and a URL param carries one:
20581
+ // `?loc=` names a location the way `?rule=` names a type. Only ever compared
20582
+ // for EQUALITY — the page's selection check, this read's `includeId`, the
20583
+ // client's page dedupe — never decoded, and never a sort key.
20584
+ id: external_exports.string(),
20544
20585
  /** Empty when the instances carried no repo attribute. */
20545
20586
  repo: external_exports.string(),
20587
+ // Empty when the instances carried no file path (a prompt, or a tool call
20588
+ // with no file attribution). Both halves empty is a real location — usually
20589
+ // the largest one in a store — and is selectable like any other.
20590
+ file: external_exports.string(),
20546
20591
  instanceCount: external_exports.number().int().nonnegative(),
20592
+ // The WORST severity present, not the first row's. It is this list's primary
20593
+ // sort key, so it is also what explains why a row is where it is, and it is
20594
+ // how a reader decides what to open without opening everything.
20547
20595
  maxSeverity: Severity,
20548
20596
  latestDetectedAt: external_exports.iso.datetime(),
20597
+ // Folded from the instances' derived statuses with the same open-dominates
20598
+ // precedence a group uses, so it answers "is anything left to do here" and
20599
+ // not much more: a location holding 1 open among 40 resolved reads like one
20600
+ // holding 40 open. That loss is accepted — the panel beside this list
20601
+ // carries each finding's own status, and instanceCount sits next to the
20602
+ // badge.
20549
20603
  status: FindingStatus.optional(),
20550
- files: external_exports.array(FindingLocationFile)
20551
- }).meta({ id: "FindingLocationRepo" });
20604
+ // Every distinct rule seen at this location, UNCAPPED — so the length is a
20605
+ // tally rather than a sample and a row can say how many there are. Bounded
20606
+ // by the ruleset, not by the store. The view bounds what it DISPLAYS.
20607
+ ruleIds: external_exports.array(external_exports.string())
20608
+ }).meta({ id: "FindingLocationSummary" });
20609
+ var MAX_FINDING_LOCATIONS_LIMIT = 100;
20552
20610
  var ListFindingLocationsQuery = external_exports.object({
20553
20611
  severity: external_exports.array(Severity).optional(),
20554
20612
  subtype: external_exports.array(external_exports.string()).optional(),
@@ -20558,21 +20616,47 @@ var ListFindingLocationsQuery = external_exports.object({
20558
20616
  // instances that match, and folds its status from those.
20559
20617
  status: external_exports.array(FindingStatus).optional(),
20560
20618
  tool: external_exports.array(external_exports.string()).optional(),
20619
+ // The delivery state of each finding's event (see FindingDelivery).
20620
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20561
20621
  q: external_exports.string().optional(),
20562
20622
  sessionId: external_exports.string().optional(),
20563
20623
  from: external_exports.iso.datetime().optional(),
20564
- limit: external_exports.coerce.number().int().min(1).max(500).optional()
20624
+ // A LOCATION id (see FindingLocationSummary.id) that must appear in the page
20625
+ // even when the cursor has already advanced past its sort position — the
20626
+ // counterpart of ListFindingTypesQuery.includeId, and needed far more often
20627
+ // here. Selecting a row pushes the URL, which re-renders the server and resets
20628
+ // the client's page cache to page 0; with distinct (repo, file) pairs running
20629
+ // into the thousands, a selection sitting off page 0 is the ordinary case
20630
+ // rather than a deep-link corner. Never affects totals, facets or the cursor.
20631
+ includeId: external_exports.string().optional(),
20632
+ limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
20633
+ cursor: external_exports.string().optional()
20565
20634
  });
20566
20635
  var ListFindingLocationsResponse = external_exports.object({
20567
20636
  totals: external_exports.object({
20637
+ // Findings matching the filters across the whole scope. Unlike the types
20638
+ // read's same-named field this needs no caveat: the filters here narrow
20639
+ // per finding, so this is the sum of every row's instanceCount.
20568
20640
  findings: external_exports.number().int().nonnegative(),
20569
- repos: external_exports.number().int().nonnegative(),
20570
- files: external_exports.number().int().nonnegative()
20641
+ // Counts LOCATIONS, the unit this read pages — the number the paginator
20642
+ // states. The facets beside it count FINDINGS (see below); a surface
20643
+ // showing both says which is which.
20644
+ locations: external_exports.number().int().nonnegative()
20571
20645
  }),
20572
- /** Sorted by max severity, then most recent. */
20573
- items: external_exports.array(FindingLocationRepo),
20574
- /** Whether `limit` truncated the repo list. */
20575
- hasMore: external_exports.boolean()
20646
+ // Counts in FINDINGS, where the types response counts types, each dimension
20647
+ // still excluding its own filter. Deliberately not locations: counting those
20648
+ // needs a set of location keys per dimension per value — memory tracking the
20649
+ // store times the vocabulary, in a read whose scan promises flat memory —
20650
+ // and the cheap per-location version is not an approximation but WRONG. A
20651
+ // location holding {claudecode, block} and {codex, warn} would survive
20652
+ // provider=claudecode AND action=warn, under which no single finding
20653
+ // matches, so the facet would contradict the instanceCount this whole view
20654
+ // rests on. Findings also keep the toolbar in the same unit as the page
20655
+ // tally and the panel it sits above.
20656
+ facets: FindingFacets,
20657
+ /** Sorted by max severity, then most recent, then (repo, file). */
20658
+ items: external_exports.array(FindingLocationSummary),
20659
+ nextCursor: external_exports.string().nullable()
20576
20660
  }).meta({ id: "ListFindingLocationsResponse" });
20577
20661
 
20578
20662
  // ../../packages/schema/src/zod/meta.ts
@@ -20736,6 +20820,10 @@ var CaptureAttributes = external_exports.object({
20736
20820
  // to 'allow' — the enforcement audit trail's link back to the grant that
20737
20821
  // authorized the bypass.
20738
20822
  exception_ids: external_exports.array(external_exports.guid()).optional(),
20823
+ // The persisted spellings of EventMetadata's messageId/conversationId — the
20824
+ // join back to the `llm_call` leaf for the same assistant turn.
20825
+ message_id: external_exports.string().optional(),
20826
+ conversation_id: external_exports.string().optional(),
20739
20827
  // Whole milliseconds this capture's inspection blocked its caller — the
20740
20828
  // plugin's own added latency (see EventMetadata.inspectionMs, whose value
20741
20829
  // this is). Promoted to the `inspection_ms` generated column so the facet is
@@ -20744,7 +20832,19 @@ var CaptureAttributes = external_exports.object({
20744
20832
  // inline json_extract and is not itself an optimization.
20745
20833
  // ABSENT on replayed captures (backfill / worktree scan) and on rows written
20746
20834
  // before the measurement shipped — never present as a placeholder 0.
20747
- inspection_ms: external_exports.number().int().nonnegative().optional()
20835
+ inspection_ms: external_exports.number().int().nonnegative().optional(),
20836
+ // What a `redact` this capture could not carry out became instead (see
20837
+ // EventMetadata.redactDegradedTo, whose value this is). Present only when a
20838
+ // degrade actually happened, so absence is the ordinary case rather than a
20839
+ // reader having to distinguish it from a zero.
20840
+ //
20841
+ // PER CAPTURE, while `inspection_findings.action_taken` is per finding —
20842
+ // so on a multi-finding row this does not say which finding degraded, and
20843
+ // its presence does not mean the fallback decided the capture's action. A
20844
+ // capture denied by another finding's own Block policy carries `block`
20845
+ // here too. The full statement is on EventMetadata.redactDegradedTo; it is
20846
+ // repeated rather than referenced because a store reader opens this file.
20847
+ redact_degraded_to: ActionTaken.optional()
20748
20848
  }).catchall(external_exports.unknown());
20749
20849
  var ToolCallInspection = external_exports.object({
20750
20850
  ruleId: external_exports.string().min(1),
@@ -20940,7 +21040,17 @@ var AuditEvent = external_exports.object({
20940
21040
  /** `share` to a first-party/internal destination. */
20941
21041
  internal: external_exports.boolean(),
20942
21042
  /** Event needs review (e.g. unverified egress). */
20943
- flagged: external_exports.boolean()
21043
+ flagged: external_exports.boolean(),
21044
+ /**
21045
+ * The body this event's `title` is drawn from was cleared by local body
21046
+ * expiry, so an EMPTY title here means "gone", not "never had one".
21047
+ *
21048
+ * A separate flag rather than a sentinel written into `title`: the title is
21049
+ * rendered text, and a store-layer module that invented display copy for it
21050
+ * would be choosing words the view is supposed to choose. Additive and
21051
+ * defaulted, so an older producer still validates.
21052
+ */
21053
+ bodyExpired: external_exports.boolean().default(false)
20944
21054
  }).meta({ id: "ActivityAuditEvent" });
20945
21055
  var ActivitySessionSummary = external_exports.object({
20946
21056
  id: external_exports.string(),
@@ -21738,6 +21848,14 @@ var ControlPlaneErrorBody = external_exports.object({
21738
21848
  message: external_exports.string().optional()
21739
21849
  }).optional()
21740
21850
  });
21851
+ var RemoteFailureKind = external_exports.enum([
21852
+ "unauthorized",
21853
+ "forbidden",
21854
+ "route-absent",
21855
+ "invalid-request",
21856
+ "rejected",
21857
+ "unreachable"
21858
+ ]);
21741
21859
  var AttachDeviceRequest = external_exports.object({
21742
21860
  // This machine's own continuity id, so re-attaching ROTATES the credential
21743
21861
  // on one machine record instead of producing a second one. Client-minted
@@ -22156,6 +22274,12 @@ var EventMetadata = external_exports.object({
22156
22274
  // to 'allow' — the enforcement audit trail's link back to the grant that
22157
22275
  // authorized the bypass. Absent on captures where no exception applied.
22158
22276
  exceptionIds: external_exports.array(external_exports.guid()).optional(),
22277
+ // The assistant message this capture belongs to, and the conversation it sits
22278
+ // in — set by the browser extension's network capture so a stored `response`
22279
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
22280
+ // on every other capture path, which has no such id.
22281
+ messageId: external_exports.string().optional(),
22282
+ conversationId: external_exports.string().optional(),
22159
22283
  // How long THIS capture's inspection blocked its caller, in whole
22160
22284
  // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
22161
22285
  // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
@@ -22168,7 +22292,37 @@ var EventMetadata = external_exports.object({
22168
22292
  // Absent is also what every pre-measurement client writes, and what a
22169
22293
  // clock failure degrades to — a reader must treat absence as "not measured"
22170
22294
  // and never as a zero, which would read as "inspection is free".
22171
- inspectionMs: external_exports.number().int().nonnegative().optional()
22295
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
22296
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
22297
+ // workspace's `redactFallback`, applied because the field could not be
22298
+ // masked in place (a shell command, a URL, or any argument on a host whose
22299
+ // hook contract offers no rewrite channel).
22300
+ //
22301
+ // It exists because the action alone cannot say why. A finding recorded as
22302
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
22303
+ // assigned Redact on a field that could not take one — and those are
22304
+ // different facts about the same row: the first is a policy the user chose,
22305
+ // the second is a masking the host could not perform. Absent means no
22306
+ // degrade happened, which is every ordinary capture.
22307
+ //
22308
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
22309
+ // is the CAPTURE while `actionTaken` is per FINDING:
22310
+ //
22311
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
22312
+ // `redact` alongside a finding ASSIGNED the same action stores both
22313
+ // identically and one reason for the pair; attributing it to both
22314
+ // describes the assigned one wrongly, and to neither loses the degrade.
22315
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
22316
+ // became, not the reason the capture ended as it did — a capture denied
22317
+ // by some other finding's own Block policy still carries `block` here,
22318
+ // and clearing the workspace's fallback would not have let it through.
22319
+ // Gate on the value against what a fallback can produce; never read the
22320
+ // field's presence as "this was the fallback's doing".
22321
+ //
22322
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
22323
+ // Closing either means moving the reason onto the finding row, which
22324
+ // already carries its own action.
22325
+ redactDegradedTo: ActionTaken.optional()
22172
22326
  }).meta({ id: "EventMetadata" });
22173
22327
  var Event = external_exports.object({
22174
22328
  id: external_exports.guid(),
@@ -22278,6 +22432,15 @@ var RotateKeyInput = external_exports.object({
22278
22432
  confirmation: external_exports.string()
22279
22433
  });
22280
22434
 
22435
+ // ../../packages/schema/src/zod/finding-delivery.ts
22436
+ var KNOWN_REASONS = SyncFailureReason.options;
22437
+
22438
+ // ../../packages/schema/src/zod/findings-group-build.ts
22439
+ function rankByOrder(members2) {
22440
+ return Object.fromEntries(members2.map((member, index) => [member, index]));
22441
+ }
22442
+ var SEVERITY_RANK = rankByOrder(Severity.options);
22443
+
22281
22444
  // ../../packages/schema/src/zod/installed-pack.ts
22282
22445
  var InstalledPack = external_exports.object({
22283
22446
  id: external_exports.guid(),
@@ -22344,6 +22507,11 @@ var Policy = external_exports.object({
22344
22507
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22345
22508
  provenance: PolicyProvenance.optional()
22346
22509
  }).meta({ id: "Policy" });
22510
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22511
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22512
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22513
+ id: "RedactFallback"
22514
+ });
22347
22515
  var PolicyBundle = external_exports.object({
22348
22516
  version: external_exports.string(),
22349
22517
  policies: external_exports.array(Policy),
@@ -22391,6 +22559,16 @@ var PolicyBundle = external_exports.object({
22391
22559
  // control plane), so no name resolution stands between the decision and the
22392
22560
  // comparison.
22393
22561
  prohibitedModels: external_exports.array(external_exports.string()).optional(),
22562
+ // What a resolved `redact` becomes on a field the host cannot rewrite, as
22563
+ // the ORGANIZATION would have it. Merged raise-only against the device's own
22564
+ // `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
22565
+ // a control plane can tighten a machine and never loosen one — the same
22566
+ // direction `mergeRaiseOnly` enforces for policies.
22567
+ //
22568
+ // Optional so an older backend, and an older on-disk cache, still parses;
22569
+ // absent leaves the device's own setting in force, which is the behaviour
22570
+ // that predates the field and the safe direction to default.
22571
+ redactFallback: RedactFallback.optional(),
22394
22572
  customKeywords: external_exports.array(external_exports.string()),
22395
22573
  fetchedAt: external_exports.iso.datetime()
22396
22574
  }).meta({ id: "PolicyBundle" });
@@ -22420,11 +22598,6 @@ function severityFloorPolicy(category) {
22420
22598
  const peak = CATEGORY_PEAK_SEVERITY[category];
22421
22599
  return peak === "critical" || peak === "high" ? "warn" : "monitor";
22422
22600
  }
22423
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22424
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22425
- var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22426
- id: "RedactFallback"
22427
- });
22428
22601
  var BUILTIN_POLICY_SPECS = {
22429
22602
  monitor: {
22430
22603
  name: "Monitor",
@@ -22687,7 +22860,7 @@ var VaultConsent = external_exports.object({
22687
22860
  });
22688
22861
 
22689
22862
  // ../../packages/schema/src/zod/local.ts
22690
- var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22863
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
22691
22864
  var MODEL_JUDGE_PAYLOAD_VERSION = 1;
22692
22865
  var RunMode = external_exports.enum(["standalone", "attached"]);
22693
22866
  var ControlPlaneConnection = external_exports.object({
@@ -22707,6 +22880,15 @@ var HistorySyncConsent = external_exports.object({
22707
22880
  payloadVersion: external_exports.number().int().positive(),
22708
22881
  endpoint: external_exports.string()
22709
22882
  });
22883
+ var BODY_RETENTION_DEFAULT_DAYS = 30;
22884
+ var BodyRetention = external_exports.object({
22885
+ enabled: external_exports.boolean().default(false),
22886
+ // Never 0, and the ceiling is a fat-finger guard rather than a policy
22887
+ // limit — `enabled` is the real gate. A low value cannot reach a row the
22888
+ // sync ledger still owes: the sweep's age filter only ever NARROWS a
22889
+ // candidate set that is already bounded by "delivered, or never owed".
22890
+ retainDays: external_exports.number().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
22891
+ }).meta({ id: "BodyRetention" });
22710
22892
  var WorkspaceSettings = external_exports.object({
22711
22893
  specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
22712
22894
  runMode: RunMode.default("standalone"),
@@ -22750,12 +22932,18 @@ var WorkspaceSettings = external_exports.object({
22750
22932
  // covers the current payload and must be re-granted.
22751
22933
  modelJudgeConsent: ModelJudgeConsent.optional(),
22752
22934
  // Records that the user consented to the DEFERRED send — the outbox — along
22753
- // with the payload shape and the endpoint they agreed to. Since payload v2
22754
- // that covers both the pre-attach backlog and undelivered captures (which
22755
- // carry prompt/reply text in `content`); the key name predates the widening.
22756
- // Absent until granted, and a grant for a different endpoint or an older
22757
- // payload no longer counts.
22758
- historySyncConsent: HistorySyncConsent.optional()
22935
+ // with the payload shape and the endpoint they agreed to. Since payload v3
22936
+ // that covers the pre-attach backlog AND undelivered captures alike, and both
22937
+ // carry prompt/reply/tool-output text in `content`; the key name predates
22938
+ // both widenings. Absent until granted, and a grant for a different endpoint
22939
+ // or an older payload no longer counts.
22940
+ historySyncConsent: HistorySyncConsent.optional(),
22941
+ // Local body expiry (see BodyRetention). Off until switched on; expiring a
22942
+ // body never removes the row or its findings.
22943
+ bodyRetention: BodyRetention.default({
22944
+ enabled: false,
22945
+ retainDays: BODY_RETENTION_DEFAULT_DAYS
22946
+ })
22759
22947
  });
22760
22948
  function defaultWorkspaceSettings() {
22761
22949
  return WorkspaceSettings.parse({});
@@ -22775,10 +22963,22 @@ var ManagedSettingKey = external_exports.enum([
22775
22963
  "vaultInlineReveal",
22776
22964
  "modelJudgeConsent",
22777
22965
  "dataSharesInPlace",
22778
- "redactFallback"
22966
+ "redactFallback",
22967
+ // Pins the toggle and the day count together — see BodyRetention on why the
22968
+ // two are one unit. An administrator mandating a window wants the count
22969
+ // enforced with it, not one a user can widen while the toggle stays on.
22970
+ "bodyRetention"
22779
22971
  ]).meta({ id: "ManagedSettingKey" });
22972
+ function isManagedSettingKey(value) {
22973
+ return ManagedSettingKey.safeParse(value).success;
22974
+ }
22780
22975
  var ManagedSettingsValues = external_exports.object({
22781
22976
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
22977
+ // `controlPlane` and `bodyRetention` are the two nested values, and both are
22978
+ // plain, non-strict objects: a key under either that this build does not know
22979
+ // is stripped and nothing reports it. The unknown-value split in
22980
+ // ManagedSettings below classifies top-level names only, so it stops at
22981
+ // these boundaries.
22782
22982
  controlPlane: external_exports.object({
22783
22983
  endpoint: external_exports.string().min(1),
22784
22984
  label: external_exports.string().min(1).optional()
@@ -22789,7 +22989,8 @@ var ManagedSettingsValues = external_exports.object({
22789
22989
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22790
22990
  modelJudgeConsent: external_exports.boolean().optional(),
22791
22991
  dataSharesInPlace: external_exports.boolean().optional(),
22792
- redactFallback: RedactFallback.optional()
22992
+ redactFallback: RedactFallback.optional(),
22993
+ bodyRetention: BodyRetention.optional()
22793
22994
  }).meta({ id: "ManagedSettingsValues" });
22794
22995
  var ManagedSettings = external_exports.object({
22795
22996
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22797,11 +22998,59 @@ var ManagedSettings = external_exports.object({
22797
22998
  // decision from a bug. Absent renders as a generic "your organization".
22798
22999
  organization: external_exports.string().min(1).optional(),
22799
23000
  // What the administrator pinned.
22800
- values: ManagedSettingsValues.default({}),
23001
+ //
23002
+ // Parsed as a RECORD rather than as the nested schema, and split below for
23003
+ // the same reason `lockedFields` is parsed as names: a plain `z.object`
23004
+ // drops an unrecognised key and succeeds, so a pin this build does not know
23005
+ // vanished and nothing anywhere said so. A pin with no lock is a supported
23006
+ // shape — it is a DEFAULT the user may still change — so that silence hit
23007
+ // exactly the file an administrator is most likely to write while a fleet
23008
+ // is mid-upgrade.
23009
+ //
23010
+ // Splitting here rather than calling `.strict()`: strict would REFUSE the
23011
+ // file, which is the outcome the lock half already rejected — an older
23012
+ // build then runs entirely unmanaged, every pin and lock gone. A bad KNOWN
23013
+ // value still fails, because the nested schema is re-run over the known
23014
+ // subset and its issues are re-raised on this parse.
23015
+ values: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
22801
23016
  // Which of those the user may not change. A key here with no matching value
22802
23017
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22803
23018
  // the user may still override. The two are separable on purpose.
22804
- lockedFields: external_exports.array(ManagedSettingKey).default([])
23019
+ //
23020
+ // Parsed as NAMES rather than as the enum, and split below: a name this
23021
+ // build does not know is dropped from the locked set and reported, never a
23022
+ // reason to refuse the file. The same shape reaches an older build whenever
23023
+ // an administrator locks a key a newer build added, and refusing it there
23024
+ // ran that build entirely unmanaged — every pin and lock gone — on exactly
23025
+ // the fleets most likely to carry a version skew. A name outside the enum
23026
+ // is still never HONOURED: the lockable set stays explicit above.
23027
+ lockedFields: external_exports.array(external_exports.string()).default([])
23028
+ }).transform(({ lockedFields, values, ...rest }, ctx) => {
23029
+ const known = [];
23030
+ const unknown2 = [];
23031
+ for (const name of lockedFields) {
23032
+ if (isManagedSettingKey(name)) known.push(name);
23033
+ else unknown2.push(name);
23034
+ }
23035
+ const knownValues = /* @__PURE__ */ Object.create(null);
23036
+ const unknownValues = [];
23037
+ for (const [name, value] of Object.entries(values)) {
23038
+ if (Object.hasOwn(ManagedSettingsValues.shape, name)) knownValues[name] = value;
23039
+ else unknownValues.push(name);
23040
+ }
23041
+ const pinned = ManagedSettingsValues.safeParse(knownValues);
23042
+ if (!pinned.success) {
23043
+ for (const issue2 of pinned.error.issues)
23044
+ ctx.addIssue({ ...issue2, path: ["values", ...issue2.path] });
23045
+ return external_exports.NEVER;
23046
+ }
23047
+ return {
23048
+ ...rest,
23049
+ values: pinned.data,
23050
+ lockedFields: known,
23051
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {},
23052
+ ...unknownValues.length > 0 ? { unknownValueFields: unknownValues } : {}
23053
+ };
22805
23054
  }).meta({ id: "ManagedSettings" });
22806
23055
 
22807
23056
  // ../../packages/schema/src/zod/project-files.ts
@@ -22919,7 +23168,11 @@ var FindingsTimeseriesPoint = external_exports.object({
22919
23168
  timestamp: external_exports.iso.date(),
22920
23169
  critical: external_exports.number().int().nonnegative(),
22921
23170
  high: external_exports.number().int().nonnegative(),
22922
- medium: external_exports.number().int().nonnegative()
23171
+ medium: external_exports.number().int().nonnegative(),
23172
+ // Optional and additive, so a producer written against the earlier
23173
+ // three-series contract keeps validating. A consumer plotting it resolves the
23174
+ // absent case itself — the chart point requires a number.
23175
+ low: external_exports.number().int().nonnegative().optional()
22923
23176
  }).meta({ id: "FindingsTimeseriesPoint" });
22924
23177
  var FindingsTimeseriesResponse = external_exports.object({
22925
23178
  range: TimeRange,
@@ -22945,6 +23198,10 @@ var ResolvedFeedItem = external_exports.object({
22945
23198
  findingKey: external_exports.string(),
22946
23199
  ruleId: external_exports.string(),
22947
23200
  severity: Severity,
23201
+ // Repository slug, and the file path RELATIVE to it. The pair is what
23202
+ // identifies the file: a bare path matches the same name in every repo.
23203
+ // Optional and additive; empty when the event carried no repo.
23204
+ repo: external_exports.string().optional(),
22948
23205
  path: external_exports.string(),
22949
23206
  // ISO-8601 datetime (matches FindingInstance.detectedAt / the rest of the
22950
23207
  // findings domain). The reader `.toISOString()`s the DB epoch-ms values.
@@ -23050,7 +23307,23 @@ var SaveSettingsInput = external_exports.object({
23050
23307
  modelJudgeConsent: ModelJudgeConsentChoice,
23051
23308
  historySyncConsent: HistorySyncConsentChoice,
23052
23309
  vaultConsent: external_exports.string(),
23053
- vaultInlineReveal: external_exports.string()
23310
+ vaultInlineReveal: external_exports.string(),
23311
+ // Widened to `string` like its neighbours rather than typed as
23312
+ // `RedactFallback`, on this module's own layering rule: shape here, VALUE at
23313
+ // the call site, so the domain check receives the type it was written for.
23314
+ //
23315
+ // NOT because a narrower schema would reject differently. `parseActionInput`
23316
+ // is a `safeParse` wrapper and throws for no field schema, so either spelling
23317
+ // reaches a recoverable `{ ok: false }` and there is no rejected promise to
23318
+ // trade against. The real cost runs the other way and is the part worth
23319
+ // knowing: a value this schema admits and the domain enum then rejects lands
23320
+ // on the action's shared refusal, which names NO field, where a shape
23321
+ // rejection reaches `malformedInput` and names the schema key.
23322
+ redactFallback: external_exports.string(),
23323
+ // Shape only, the way the enum fields above are strings only: the RANGE is
23324
+ // `BodyRetention`'s and the action checks it there, so there is one place
23325
+ // that decides what a legal horizon is rather than two that can drift.
23326
+ bodyRetention: external_exports.object({ enabled: external_exports.boolean(), retainDays: external_exports.number() })
23054
23327
  });
23055
23328
  var AttachInput = external_exports.object({
23056
23329
  endpoint: external_exports.string(),
@@ -23176,6 +23449,52 @@ var SetupHandoffOffer = external_exports.object({
23176
23449
  path: ["liveKeys"]
23177
23450
  });
23178
23451
 
23452
+ // ../../packages/schema/src/zod/web-capture.ts
23453
+ var WebUsageSource = external_exports.enum(["site", "estimated", "none"]);
23454
+ var WebUsage = external_exports.object({
23455
+ inputTokens: external_exports.number().int().nonnegative().optional(),
23456
+ outputTokens: external_exports.number().int().nonnegative().optional(),
23457
+ cacheReadInputTokens: external_exports.number().int().nonnegative().optional(),
23458
+ cacheCreationInputTokens: external_exports.number().int().nonnegative().optional()
23459
+ });
23460
+ var WebToolCall = external_exports.object({
23461
+ toolUseId: external_exports.string().min(1),
23462
+ toolName: external_exports.string().min(1),
23463
+ target: external_exports.string().optional(),
23464
+ isError: external_exports.boolean().optional(),
23465
+ inputSize: external_exports.number().int().nonnegative().optional(),
23466
+ outputSize: external_exports.number().int().nonnegative().optional()
23467
+ });
23468
+ var WebExchange = external_exports.object({
23469
+ messageId: external_exports.string().min(1),
23470
+ startedAt: external_exports.iso.datetime(),
23471
+ model: external_exports.string().optional(),
23472
+ usage: WebUsage.optional(),
23473
+ usageSource: WebUsageSource,
23474
+ stopReason: external_exports.string().optional(),
23475
+ conversationId: external_exports.string().optional(),
23476
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23477
+ toolCalls: external_exports.array(WebToolCall).default([]),
23478
+ // Absent when the adapter recovered no text. Capped by the caller at
23479
+ // RESPONSE_TEXT_MAX_BYTES; `truncated` records that the cap was reached, so a
23480
+ // short capture is never mistaken for a short reply.
23481
+ responseText: external_exports.string().optional(),
23482
+ truncated: external_exports.boolean().default(false)
23483
+ });
23484
+ var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
23485
+ var WebCaptureStatus = external_exports.object({
23486
+ patched: external_exports.boolean(),
23487
+ live: external_exports.boolean(),
23488
+ blind: external_exports.boolean(),
23489
+ sendsSeenDom: external_exports.number().int().nonnegative(),
23490
+ exchangesSeenNet: external_exports.number().int().nonnegative(),
23491
+ parseFailures: external_exports.number().int().nonnegative(),
23492
+ unparsedBodies: external_exports.number().int().nonnegative(),
23493
+ // The adapter-declared JSON key paths that were absent from a real payload —
23494
+ // the earliest signal that a site's contract moved.
23495
+ shapeMisses: external_exports.array(external_exports.string()).default([])
23496
+ });
23497
+
23179
23498
  // ../../packages/persistence/src/paths.ts
23180
23499
  import {
23181
23500
  chmodSync,
@@ -23319,6 +23638,32 @@ var STALE_PARTIAL_MS = 5 * 6e4;
23319
23638
  var SNAPSHOT_STAGING_SUFFIX = ".partial";
23320
23639
  var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23321
23640
 
23641
+ // ../../packages/persistence/src/internal/sql-functions.ts
23642
+ var utf8 = new TextDecoder();
23643
+
23644
+ // ../../packages/persistence/src/internal/outbox-lane.ts
23645
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23646
+ var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23647
+
23648
+ // ../../packages/persistence/src/sync-failure.ts
23649
+ var SYNC_FAILURE_REASONS = SyncFailureReason.options;
23650
+
23651
+ // ../../packages/persistence/src/repositories/history-sync.ts
23652
+ var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23653
+ var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23654
+ var COUNTED_EVENT_TYPES = [
23655
+ ...STRUCTURAL_EVENT_TYPES,
23656
+ ...OUTBOX_CAPTURE_EVENT_TYPES
23657
+ ];
23658
+ var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23659
+ var COUNTED_SCOPE = `
23660
+ WHERE event_type IN (${COUNTED_TYPE_LIST})
23661
+ AND (
23662
+ event_type IN (${TYPE_LIST})
23663
+ OR synced_at IS NOT NULL
23664
+ OR outbox_owed = 1
23665
+ )`;
23666
+
23322
23667
  // ../../packages/persistence/src/internal/json.ts
23323
23668
  function parseJsonObject(s) {
23324
23669
  if (s == null) return void 0;
@@ -23359,11 +23704,34 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
23359
23704
  AND conditions IS NULL
23360
23705
  AND ${ACTIVE_PREDICATE}`;
23361
23706
 
23362
- // ../../packages/persistence/src/repositories/history-sync.ts
23363
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23364
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23365
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23366
- var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23707
+ // ../../packages/persistence/src/repositories/resolution-sql.ts
23708
+ function latestResolutionColumnSql(column, findingsAlias) {
23709
+ return `(
23710
+ SELECT fr.${column} FROM finding_resolution fr
23711
+ WHERE fr.finding_key = ${findingsAlias}.finding_key
23712
+ ORDER BY fr.created_at DESC, fr.rowid DESC
23713
+ LIMIT 1
23714
+ )`;
23715
+ }
23716
+ function latestResolutionStatusSql(findingsAlias) {
23717
+ return latestResolutionColumnSql("status", findingsAlias);
23718
+ }
23719
+
23720
+ // ../../packages/persistence/src/repositories/findings.ts
23721
+ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
23722
+ d.severity AS severity, f.masked_match AS masked_match,
23723
+ f.action_taken AS action_taken, f.confidence AS confidence,
23724
+ e.started_at AS occurred_at,
23725
+ e.source_tool AS source_tool,
23726
+ e.repo AS repo,
23727
+ e.file_path AS file,
23728
+ e.tool_name AS tool_name,
23729
+ f.audit_event_id AS event_id, e.root_session_id AS session_id,
23730
+ e.event_type AS kind, f.finding_key AS finding_key,
23731
+ ${latestResolutionStatusSql("f")} AS latest_status,
23732
+ e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
23733
+ e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
23734
+ e.outbox_owed AS outbox_owed`;
23367
23735
 
23368
23736
  // ../../packages/persistence/src/repositories/installed-packs.ts
23369
23737
  import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
@@ -23424,7 +23792,8 @@ function managedSettingsPaths(platform2 = process.platform) {
23424
23792
  }
23425
23793
  return [posix.join("/etc", "aka", MANAGED_SETTINGS_FILENAME)];
23426
23794
  }
23427
- function readManagedSettings(paths = managedSettingsPaths()) {
23795
+ var testOnlyManagedPaths = null;
23796
+ function readManagedSettings(paths = testOnlyManagedPaths ?? managedSettingsPaths()) {
23428
23797
  for (const path of paths) {
23429
23798
  let text;
23430
23799
  try {
@@ -23459,6 +23828,7 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
23459
23828
  if (values.vaultInlineReveal !== void 0) merged.vaultInlineReveal = values.vaultInlineReveal;
23460
23829
  if (values.dataSharesInPlace !== void 0) merged.dataSharesInPlace = values.dataSharesInPlace;
23461
23830
  if (values.redactFallback !== void 0) merged.redactFallback = values.redactFallback;
23831
+ if (values.bodyRetention !== void 0) merged.bodyRetention = values.bodyRetention;
23462
23832
  if (values.vaultConsent !== void 0) {
23463
23833
  merged.vaultConsent = values.vaultConsent ? (
23464
23834
  // Keep an existing valid grant so its acknowledgedAt survives; mint one
@@ -23546,9 +23916,14 @@ import { randomUUID as randomUUID10 } from "crypto";
23546
23916
 
23547
23917
  // ../../packages/persistence/src/database.ts
23548
23918
  var CAPTURE_GRAIN = new Set(EventKind.options);
23919
+ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
23549
23920
 
23550
- // ../../packages/persistence/src/finding-key.ts
23921
+ // ../../packages/persistence/src/egress-wire.ts
23551
23922
  import { createHash as createHash3 } from "crypto";
23923
+ var SLASH = "/".charCodeAt(0);
23924
+
23925
+ // ../../packages/persistence/src/finding-key.ts
23926
+ import { createHash as createHash4 } from "crypto";
23552
23927
 
23553
23928
  // ../../packages/persistence/src/fingerprint.ts
23554
23929
  import { createHmac, randomBytes } from "crypto";
@@ -23556,14 +23931,26 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23556
23931
  import { join as join8 } from "path";
23557
23932
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23558
23933
 
23559
- // ../../packages/persistence/src/history-preview.ts
23560
- import { existsSync as existsSync4 } from "fs";
23934
+ // ../../packages/persistence/src/forward-health.ts
23935
+ import { readFileSync as readFileSync7 } from "fs";
23561
23936
  import { join as join9 } from "path";
23937
+
23938
+ // ../../packages/persistence/src/history-backfill.ts
23939
+ import { existsSync as existsSync4 } from "fs";
23940
+ import { join as join10 } from "path";
23941
+
23942
+ // ../../packages/persistence/src/history-preview.ts
23943
+ import { existsSync as existsSync5 } from "fs";
23944
+ import { join as join11 } from "path";
23562
23945
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23563
23946
 
23947
+ // ../../packages/persistence/src/history-sync-state.ts
23948
+ import { readFileSync as readFileSync8 } from "fs";
23949
+ import { join as join12 } from "path";
23950
+
23564
23951
  // ../../packages/persistence/src/store-symlinks.ts
23565
- import { existsSync as existsSync5, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23566
- import { dirname as dirname3, join as join10, resolve } from "path";
23952
+ import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23953
+ import { dirname as dirname3, join as join13, resolve } from "path";
23567
23954
 
23568
23955
  // ../../packages/persistence/src/vault/crypto.ts
23569
23956
  import {
@@ -23577,15 +23964,15 @@ import {
23577
23964
  // ../../packages/persistence/src/vault/key-provider.ts
23578
23965
  import { execFileSync } from "child_process";
23579
23966
  import { randomBytes as randomBytes2 } from "crypto";
23580
- import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23581
- import { join as join11 } from "path";
23967
+ import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23968
+ import { join as join14 } from "path";
23582
23969
 
23583
23970
  // ../../packages/persistence/src/vault/vault.ts
23584
23971
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23585
23972
 
23586
23973
  // ../../packages/persistence/src/warn-era-cap.ts
23587
- import { existsSync as existsSync6, writeFileSync as writeFileSync4 } from "fs";
23588
- import { join as join12 } from "path";
23974
+ import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23975
+ import { join as join15 } from "path";
23589
23976
 
23590
23977
  // ../../packages/remote/src/http.ts
23591
23978
  import { request as httpRequest } from "http";
@@ -23770,10 +24157,10 @@ function parsed(schema, body, route) {
23770
24157
  }
23771
24158
  function withoutTrailingSlashes(endpoint) {
23772
24159
  let end = endpoint.length;
23773
- while (end > 0 && endpoint.charCodeAt(end - 1) === SLASH) end -= 1;
24160
+ while (end > 0 && endpoint.charCodeAt(end - 1) === SLASH2) end -= 1;
23774
24161
  return endpoint.slice(0, end);
23775
24162
  }
23776
- var SLASH = "/".charCodeAt(0);
24163
+ var SLASH2 = "/".charCodeAt(0);
23777
24164
  function createRemoteClient(options) {
23778
24165
  const base = withoutTrailingSlashes(options.endpoint);
23779
24166
  const url2 = (route) => `${base}${route}`;
@@ -23866,6 +24253,7 @@ function createRemoteClient(options) {
23866
24253
  url: url2(ROUTES.shares),
23867
24254
  body: JSON.stringify(validated.data)
23868
24255
  });
24256
+ if (response.status === 404) throw new RemoteRouteAbsent(ROUTES.shares);
23869
24257
  okBody(response);
23870
24258
  },
23871
24259
  async pollCommand() {
@@ -23888,19 +24276,51 @@ function createRemoteClient(options) {
23888
24276
  };
23889
24277
  }
23890
24278
 
23891
- // ../../packages/plugin-runtime/src/attached/failure.ts
24279
+ // ../../packages/remote/src/failure-kind.ts
23892
24280
  function statusOf(err) {
23893
24281
  if (typeof err !== "object" || err === null || !("status" in err)) return null;
23894
24282
  const { status } = err;
23895
24283
  if (typeof status !== "number" || !Number.isInteger(status)) return null;
23896
24284
  return status >= 100 && status <= 599 ? status : null;
23897
24285
  }
23898
- function classifyFailure(err) {
23899
- switch (statusOf(err)) {
24286
+ function nameOf(err) {
24287
+ if (typeof err !== "object" || err === null || !("name" in err)) return null;
24288
+ return typeof err.name === "string" ? err.name : null;
24289
+ }
24290
+ function classifyRemoteFailure(err) {
24291
+ switch (nameOf(err)) {
24292
+ case "RemoteRouteAbsent":
24293
+ return "route-absent";
24294
+ case "RemoteRequestInvalid":
24295
+ return "invalid-request";
24296
+ case "RemoteResponseInvalid":
24297
+ return "rejected";
24298
+ default:
24299
+ break;
24300
+ }
24301
+ const status = statusOf(err);
24302
+ if (status === null) return "unreachable";
24303
+ switch (status) {
23900
24304
  case 401:
23901
24305
  return "unauthorized";
23902
24306
  case 403:
23903
24307
  return "forbidden";
24308
+ case 429:
24309
+ return "unreachable";
24310
+ case 404:
24311
+ return "unreachable";
24312
+ default:
24313
+ return status >= 400 && status <= 499 ? "rejected" : "unreachable";
24314
+ }
24315
+ }
24316
+
24317
+ // ../../packages/plugin-runtime/src/attached/failure.ts
24318
+ function classifyFailure(err) {
24319
+ switch (classifyRemoteFailure(err)) {
24320
+ case "unauthorized":
24321
+ return "unauthorized";
24322
+ case "forbidden":
24323
+ return "forbidden";
23904
24324
  default:
23905
24325
  return "unreachable";
23906
24326
  }
@@ -23980,18 +24400,17 @@ async function runCommandSync(deps) {
23980
24400
  }
23981
24401
 
23982
24402
  // ../../packages/plugin-runtime/src/attached/forward-drops.ts
23983
- import { readFileSync as readFileSync8 } from "fs";
23984
- import { join as join13 } from "path";
24403
+ import { readFileSync as readFileSync10 } from "fs";
24404
+ import { join as join16 } from "path";
23985
24405
 
23986
24406
  // ../../packages/plugin-runtime/src/attached/forward-policy.ts
23987
24407
  import { randomUUID as randomUUID15 } from "crypto";
23988
- import { readFileSync as readFileSync14 } from "fs";
23989
24408
  import { readFile, rename, writeFile } from "fs/promises";
23990
- import { join as join22 } from "path";
24409
+ import { join as join26 } from "path";
23991
24410
 
23992
24411
  // ../../packages/plugin-sdk/src/config.ts
23993
- import { existsSync as existsSync7 } from "fs";
23994
- import { join as join14 } from "path";
24412
+ import { existsSync as existsSync8 } from "fs";
24413
+ import { join as join17 } from "path";
23995
24414
 
23996
24415
  // ../../packages/plugin-sdk/src/provider-env.ts
23997
24416
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -24012,9 +24431,9 @@ var providerEnvShape = {
24012
24431
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
24013
24432
 
24014
24433
  // ../../packages/plugin-sdk/src/config-inventory.ts
24015
- import { readdirSync as readdirSync2, readFileSync as readFileSync10, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
24434
+ import { readdirSync as readdirSync2, readFileSync as readFileSync12, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
24016
24435
  import { homedir as homedir2 } from "os";
24017
- import { basename as basename3, join as join16 } from "path";
24436
+ import { basename as basename3, join as join19 } from "path";
24018
24437
 
24019
24438
  // ../../packages/detections/src/egress/registry.ts
24020
24439
  var EXTRACTOR_VERSION = "1";
@@ -24772,24 +25191,20 @@ var CPU_CORROBORATION_SHARE = 0.2;
24772
25191
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24773
25192
 
24774
25193
  // ../../packages/plugin-sdk/src/repo.ts
24775
- import { existsSync as existsSync8, readFileSync as readFileSync9, statSync as statSync6 } from "fs";
24776
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join15, sep as sep2 } from "path";
25194
+ import { existsSync as existsSync9, readFileSync as readFileSync11, statSync as statSync6 } from "fs";
25195
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join18, sep as sep2 } from "path";
24777
25196
 
24778
25197
  // ../../packages/plugin-sdk/src/events.ts
24779
25198
  import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
24780
25199
 
24781
25200
  // ../../packages/plugin-sdk/src/isolated-scan.ts
24782
- import { existsSync as existsSync9 } from "fs";
25201
+ import { existsSync as existsSync10 } from "fs";
24783
25202
  import { fileURLToPath } from "url";
24784
25203
  import { Worker } from "worker_threads";
24785
25204
 
24786
- // ../../packages/plugin-sdk/src/ignore-layers.ts
24787
- var import_ignore = __toESM(require_ignore(), 1);
24788
- import { readFileSync as readFileSync11 } from "fs";
24789
- import { join as join17 } from "path";
24790
-
24791
- // ../../packages/plugin-sdk/src/inventory-resolver.ts
24792
- import { arch, hostname as hostname4, platform, release } from "os";
25205
+ // ../../packages/plugin-sdk/src/host-floor.ts
25206
+ import { readFileSync as readFileSync14 } from "fs";
25207
+ import { join as join21 } from "path";
24793
25208
 
24794
25209
  // ../../packages/plugin-sdk/src/model-governance.ts
24795
25210
  import {
@@ -24797,24 +25212,50 @@ import {
24797
25212
  fstatSync,
24798
25213
  mkdirSync as mkdirSync2,
24799
25214
  openSync as openSync2,
24800
- readFileSync as readFileSync12,
25215
+ readFileSync as readFileSync13,
24801
25216
  readSync,
24802
25217
  writeFileSync as writeFileSync5
24803
25218
  } from "fs";
24804
- import { join as join18 } from "path";
25219
+ import { join as join20 } from "path";
24805
25220
  var TAIL_BYTES = 256 * 1024;
24806
25221
 
25222
+ // ../../packages/plugin-sdk/src/host-floor.ts
25223
+ var HOST_FEATURE = {
25224
+ ModelSwitch: "model-switch",
25225
+ VaultPointerDisplay: "vault-pointer-display"
25226
+ };
25227
+ var HOST_FLOORS = {
25228
+ [HOST_FEATURE.ModelSwitch]: {
25229
+ label: "model-switch protection",
25230
+ hookEvents: ["PreModelSwitch", "PostModelSwitch"],
25231
+ since: "2.1.251"
25232
+ },
25233
+ [HOST_FEATURE.VaultPointerDisplay]: {
25234
+ label: "vault pointer display",
25235
+ hookEvents: ["MessageDisplay"],
25236
+ since: "2.1.152"
25237
+ }
25238
+ };
25239
+
25240
+ // ../../packages/plugin-sdk/src/ignore-layers.ts
25241
+ var import_ignore = __toESM(require_ignore(), 1);
25242
+ import { readFileSync as readFileSync15 } from "fs";
25243
+ import { join as join22 } from "path";
25244
+
25245
+ // ../../packages/plugin-sdk/src/inventory-resolver.ts
25246
+ import { arch, hostname as hostname4, platform, release } from "os";
25247
+
24807
25248
  // ../../packages/plugin-sdk/src/nudge.ts
24808
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
24809
- import { join as join19 } from "path";
25249
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
25250
+ import { join as join23 } from "path";
24810
25251
 
24811
25252
  // ../../packages/plugin-sdk/src/paths.ts
24812
25253
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
24813
25254
  import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24814
25255
 
24815
25256
  // ../../packages/plugin-sdk/src/project-files.ts
24816
- import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
24817
- import { basename as basename5, join as join20 } from "path";
25257
+ import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
25258
+ import { basename as basename5, join as join24 } from "path";
24818
25259
 
24819
25260
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24820
25261
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24850,11 +25291,7 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24850
25291
 
24851
25292
  // ../../packages/plugin-sdk/src/throttle.ts
24852
25293
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24853
- import { join as join21 } from "path";
24854
-
24855
- // ../../packages/plugin-runtime/src/attached/history-state.ts
24856
- import { readFileSync as readFileSync15 } from "fs";
24857
- import { join as join23 } from "path";
25294
+ import { join as join25 } from "path";
24858
25295
 
24859
25296
  // ../../packages/plugin-runtime/src/attached/history-sync.ts
24860
25297
  import { createHash as createHash6 } from "crypto";
@@ -24864,6 +25301,10 @@ import { hostname as hostname5 } from "os";
24864
25301
  var CORRELATION_ID = EventMetadata.shape.correlationId;
24865
25302
  var TRACE_ID = EventMetadata.shape.traceId;
24866
25303
  var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
25304
+ var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
25305
+
25306
+ // ../../packages/plugin-runtime/src/attached/history-sync.ts
25307
+ var CAPTURE_BATCH_BYTES = 1024 * 1024;
24867
25308
 
24868
25309
  // ../../packages/plugin-runtime/src/attached/history-sync-trigger.ts
24869
25310
  import { spawn } from "child_process";
@@ -24871,12 +25312,12 @@ import { fileURLToPath as fileURLToPath2 } from "url";
24871
25312
  var HISTORY_SYNC_THROTTLE_MS = 5 * 60 * 1e3;
24872
25313
 
24873
25314
  // ../../packages/plugin-runtime/src/attached/plugin-block.ts
24874
- import { readFileSync as readFileSync16 } from "fs";
25315
+ import { readFileSync as readFileSync17 } from "fs";
24875
25316
 
24876
25317
  // ../../packages/plugin-runtime/src/attached/policy-store.ts
24877
25318
  import { randomUUID as randomUUID16 } from "crypto";
24878
25319
  import { readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
24879
- import { join as join24 } from "path";
25320
+ import { join as join27 } from "path";
24880
25321
 
24881
25322
  // ../../packages/plugin-runtime/src/attached/atomic-publish.ts
24882
25323
  import { rename as rename2 } from "fs/promises";
@@ -24900,7 +25341,7 @@ async function publishByRename(tmp, file2, move = rename2) {
24900
25341
 
24901
25342
  // ../../packages/plugin-runtime/src/attached/policy-store.ts
24902
25343
  function createPolicyStore(dir = dataDir()) {
24903
- const file2 = join24(dir, "policy-cache.json");
25344
+ const file2 = join27(dir, "policy-cache.json");
24904
25345
  async function read() {
24905
25346
  try {
24906
25347
  const raw = await readFile2(file2, "utf8");
@@ -25028,14 +25469,14 @@ import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
25028
25469
  // ../../packages/plugin-runtime/src/attached/posture-store.ts
25029
25470
  import { randomUUID as randomUUID17 } from "crypto";
25030
25471
  import { readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "fs/promises";
25031
- import { join as join25 } from "path";
25472
+ import { join as join28 } from "path";
25032
25473
 
25033
25474
  // ../../packages/plugin-runtime/src/attached/sync-state.ts
25034
- import { readFileSync as readFileSync17 } from "fs";
25035
- import { join as join26 } from "path";
25475
+ import { readFileSync as readFileSync18 } from "fs";
25476
+ import { join as join29 } from "path";
25036
25477
  var SYNC_STATE_FILENAME = ATTACHED_SYNC_STATE_FILENAME;
25037
25478
  function syncStatePath(dataDir2) {
25038
- return join26(dataDir2, SYNC_STATE_FILENAME);
25479
+ return join29(dataDir2, SYNC_STATE_FILENAME);
25039
25480
  }
25040
25481
  function writeSyncState(dataDir2, result) {
25041
25482
  try {
@@ -25088,6 +25529,14 @@ import { spawn as spawn2 } from "child_process";
25088
25529
  import { fileURLToPath as fileURLToPath3 } from "url";
25089
25530
  var SYNC_THROTTLE_MS = 15 * 60 * 1e3;
25090
25531
 
25532
+ // ../../packages/plugin-runtime/src/content-retention-pass.ts
25533
+ var MAX_ROWS_PER_SWEEP = 50 * 1e3;
25534
+
25535
+ // ../../packages/plugin-runtime/src/content-retention-trigger.ts
25536
+ import { spawn as spawn3 } from "child_process";
25537
+ import { fileURLToPath as fileURLToPath4 } from "url";
25538
+ var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
25539
+
25091
25540
  // ../../packages/plugin-runtime/src/attached/factory.ts
25092
25541
  import { hostname as hostname6 } from "os";
25093
25542