@akasecurity/cli 0.9.11 → 0.9.13

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 (124) hide show
  1. package/dist/cli.js +4334 -2752
  2. package/extension/background.js +1 -1
  3. package/extension/bridge.js +1 -0
  4. package/extension/content.js +1 -1
  5. package/extension/manifest.json +24 -1
  6. package/extension/popup.html +9 -0
  7. package/extension/popup.js +1 -1
  8. package/extension/tap.js +1 -0
  9. package/native-host/host.js +2320 -837
  10. package/native-host/scan-worker.js +441 -30
  11. package/native-host/sync.js +578 -92
  12. package/package.json +7 -7
  13. package/web-ui/web-ui/.next/BUILD_ID +1 -1
  14. package/web-ui/web-ui/.next/app-build-manifest.json +84 -84
  15. package/web-ui/web-ui/.next/app-path-routes-manifest.json +7 -7
  16. package/web-ui/web-ui/.next/build-manifest.json +2 -2
  17. package/web-ui/web-ui/.next/prerender-manifest.json +18 -18
  18. package/web-ui/web-ui/.next/server/app/(app)/activity/page.js +2 -2
  19. package/web-ui/web-ui/.next/server/app/(app)/activity/page.js.nft.json +1 -1
  20. package/web-ui/web-ui/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
  21. package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js +2 -2
  22. package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js.nft.json +1 -1
  23. package/web-ui/web-ui/.next/server/app/(app)/data-shares/page_client-reference-manifest.js +1 -1
  24. package/web-ui/web-ui/.next/server/app/(app)/detections/page.js +2 -2
  25. package/web-ui/web-ui/.next/server/app/(app)/detections/page.js.nft.json +1 -1
  26. package/web-ui/web-ui/.next/server/app/(app)/detections/page_client-reference-manifest.js +1 -1
  27. package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js +2 -2
  28. package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js.nft.json +1 -1
  29. package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page_client-reference-manifest.js +1 -1
  30. package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js +1 -1
  31. package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js.nft.json +1 -1
  32. package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page_client-reference-manifest.js +1 -1
  33. package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js +1 -1
  34. package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js.nft.json +1 -1
  35. package/web-ui/web-ui/.next/server/app/(app)/exceptions/page_client-reference-manifest.js +1 -1
  36. package/web-ui/web-ui/.next/server/app/(app)/findings/page.js +2 -2
  37. package/web-ui/web-ui/.next/server/app/(app)/findings/page.js.nft.json +1 -1
  38. package/web-ui/web-ui/.next/server/app/(app)/findings/page_client-reference-manifest.js +1 -1
  39. package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js +2 -2
  40. package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js.nft.json +1 -1
  41. package/web-ui/web-ui/.next/server/app/(app)/inventory/page_client-reference-manifest.js +1 -1
  42. package/web-ui/web-ui/.next/server/app/(app)/policies/page.js +2 -2
  43. package/web-ui/web-ui/.next/server/app/(app)/policies/page.js.nft.json +1 -1
  44. package/web-ui/web-ui/.next/server/app/(app)/policies/page_client-reference-manifest.js +1 -1
  45. package/web-ui/web-ui/.next/server/app/(app)/scan/page.js +3 -3
  46. package/web-ui/web-ui/.next/server/app/(app)/scan/page.js.nft.json +1 -1
  47. package/web-ui/web-ui/.next/server/app/(app)/scan/page_client-reference-manifest.js +1 -1
  48. package/web-ui/web-ui/.next/server/app/(app)/security/page.js +2 -2
  49. package/web-ui/web-ui/.next/server/app/(app)/security/page.js.nft.json +1 -1
  50. package/web-ui/web-ui/.next/server/app/(app)/security/page_client-reference-manifest.js +1 -1
  51. package/web-ui/web-ui/.next/server/app/(app)/settings/page.js +2 -2
  52. package/web-ui/web-ui/.next/server/app/(app)/settings/page.js.nft.json +1 -1
  53. package/web-ui/web-ui/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
  54. package/web-ui/web-ui/.next/server/app/(app)/updates/page.js +2 -2
  55. package/web-ui/web-ui/.next/server/app/(app)/updates/page.js.nft.json +1 -1
  56. package/web-ui/web-ui/.next/server/app/(app)/updates/page_client-reference-manifest.js +1 -1
  57. package/web-ui/web-ui/.next/server/app/(app)/vault/page.js +2 -2
  58. package/web-ui/web-ui/.next/server/app/(app)/vault/page.js.nft.json +1 -1
  59. package/web-ui/web-ui/.next/server/app/(app)/vault/page_client-reference-manifest.js +1 -1
  60. package/web-ui/web-ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  61. package/web-ui/web-ui/.next/server/app/_not-found.html +1 -1
  62. package/web-ui/web-ui/.next/server/app/_not-found.rsc +2 -2
  63. package/web-ui/web-ui/.next/server/app/index.html +1 -1
  64. package/web-ui/web-ui/.next/server/app/index.rsc +2 -2
  65. package/web-ui/web-ui/.next/server/app/page_client-reference-manifest.js +1 -1
  66. package/web-ui/web-ui/.next/server/app-paths-manifest.json +7 -7
  67. package/web-ui/web-ui/.next/server/chunks/121.js +1 -0
  68. package/web-ui/web-ui/.next/server/chunks/130.js +1026 -0
  69. package/web-ui/web-ui/.next/server/chunks/290.js +6 -0
  70. package/web-ui/web-ui/.next/server/chunks/3.js +1017 -0
  71. package/web-ui/web-ui/.next/server/chunks/300.js +1 -0
  72. package/web-ui/web-ui/.next/server/chunks/475.js +1 -1
  73. package/web-ui/web-ui/.next/server/chunks/589.js +1 -1
  74. package/web-ui/web-ui/.next/server/chunks/662.js +1 -0
  75. package/web-ui/web-ui/.next/server/chunks/70.js +1 -0
  76. package/web-ui/web-ui/.next/server/chunks/935.js +1 -1
  77. package/web-ui/web-ui/.next/server/functions-config-manifest.json +5 -5
  78. package/web-ui/web-ui/.next/server/middleware-manifest.json +5 -5
  79. package/web-ui/web-ui/.next/server/pages/404.html +1 -1
  80. package/web-ui/web-ui/.next/server/pages/500.html +1 -1
  81. package/web-ui/web-ui/.next/server/server-reference-manifest.js +1 -1
  82. package/web-ui/web-ui/.next/server/server-reference-manifest.json +1 -1
  83. package/web-ui/web-ui/.next/static/chunks/421-cc967c01935826d1.js +1 -0
  84. package/web-ui/web-ui/.next/static/chunks/{526-026c69b926a17dbb.js → 526-f0156de7831566b3.js} +1 -1
  85. package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-41fba0354cc950be.js +1 -0
  86. package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-d2e03c3ab61af01a.js +1 -0
  87. package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-566036afcc87e4c9.js +1 -0
  88. package/web-ui/web-ui/.next/static/chunks/app/(app)/{error-dead9507fc349f26.js → error-4baae46bcee63009.js} +1 -1
  89. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-73dbcf0078b82ec4.js +1 -0
  90. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/{page-0695d0006518b2cb.js → page-8051503193da1baf.js} +1 -1
  91. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-32c8a853bc8b5d34.js +1 -0
  92. package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-dc8fadb56d6d1e77.js +1 -0
  93. package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-9b49ef42350ea7bd.js +1 -0
  94. package/web-ui/web-ui/.next/static/chunks/app/(app)/{layout-dc7ae7664dcdc3c5.js → layout-f5f361f817f90ac9.js} +1 -1
  95. package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-01b303adf3c8ee56.js +1 -0
  96. package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-8db3b62245c333a3.js +1 -0
  97. package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-7a4ba61626e0d130.js +1 -0
  98. package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-0930b49f6ab951bc.js +1 -0
  99. package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-9b04f3441a1a3f96.js +1 -0
  100. package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/{page-f37ab8e1edc67663.js → page-911a76e75f5a1419.js} +1 -1
  101. package/web-ui/web-ui/.next/static/css/298a651f6af38209.css +2 -0
  102. package/web-ui/web-ui/dist/scan-worker.js +441 -30
  103. package/web-ui/web-ui/.next/server/chunks/471.js +0 -950
  104. package/web-ui/web-ui/.next/server/chunks/7.js +0 -1
  105. package/web-ui/web-ui/.next/server/chunks/739.js +0 -1
  106. package/web-ui/web-ui/.next/server/chunks/766.js +0 -6
  107. package/web-ui/web-ui/.next/server/chunks/851.js +0 -1
  108. package/web-ui/web-ui/.next/server/chunks/905.js +0 -959
  109. package/web-ui/web-ui/.next/static/chunks/907-2ba9428e7818b656.js +0 -1
  110. package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-c5a55618d187c906.js +0 -1
  111. package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-b1c76b8c00e1ae2a.js +0 -1
  112. package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-159167b47a005b33.js +0 -1
  113. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-5e872a82af85ef64.js +0 -1
  114. package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-adec99f2f4bbc180.js +0 -1
  115. package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-d013384d2ddb3036.js +0 -1
  116. package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-42c1b48a01fdecb0.js +0 -1
  117. package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-9b6d7cc4ce9fb33e.js +0 -1
  118. package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-f3ee9ecde06df153.js +0 -1
  119. package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-24a003c709776317.js +0 -1
  120. package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-4ea49ce2e765fffb.js +0 -1
  121. package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-6c7b94b070de8986.js +0 -1
  122. package/web-ui/web-ui/.next/static/css/c6954dd65f2115e6.css +0 -2
  123. /package/web-ui/web-ui/.next/static/{osEmGZG6yEV-XkQlklt-B → pkVZ1_T311YNkJgZOLTx5}/_buildManifest.js +0 -0
  124. /package/web-ui/web-ui/.next/static/{osEmGZG6yEV-XkQlklt-B → pkVZ1_T311YNkJgZOLTx5}/_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
@@ -500,6 +500,14 @@ var ATTACHED_SYNC_STATE_FILENAME = "attached-sync-state.json";
500
500
  import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
501
501
  import { join as join2 } from "path";
502
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
+
503
511
  // ../../packages/schema/src/exception-scope.ts
504
512
  var MINUTE_MS = 6e4;
505
513
  var HOUR_MS = 60 * MINUTE_MS;
@@ -20212,7 +20220,17 @@ var UNPRICEABLE_PROVIDERS = Object.freeze([
20212
20220
  "gateway",
20213
20221
  "unknown",
20214
20222
  "cli",
20215
- "api"
20223
+ "api",
20224
+ // The browser extension's native host records these as `llm_call.provider`
20225
+ // for a web-chat turn — the web tool id, deliberately never the vendor id
20226
+ // (`openai`/`anthropic`) the session root carries. Subscription traffic
20227
+ // burns rate-limit budget, not dollar credits, and listing them here is
20228
+ // what keeps that true structurally: a later maintainer who wants to price
20229
+ // web-chat traffic at API rates has to delete this entry first, and meet
20230
+ // the reason on the way, rather than quietly adding one to
20231
+ // PROVIDER_PLATFORM.
20232
+ "chatgpt",
20233
+ "claude-ai"
20216
20234
  ]);
20217
20235
 
20218
20236
  // ../../packages/schema/src/token/format.ts
@@ -20232,7 +20250,12 @@ var HARNESS = {
20232
20250
  ClaudeDesktop: "claudedesktop",
20233
20251
  ChatGpt: "chatgpt",
20234
20252
  ClaudeAi: "claudeai",
20235
- Api: "api"
20253
+ Api: "api",
20254
+ // Not a coding assistant a person drives — an in-process SDK embedded in an
20255
+ // application, so it has no IDE/CLI/desktop/web surface of its own. Carries
20256
+ // the same id as its SOURCE_TOOL counterpart, unlike every capture-side tool
20257
+ // whose wire spelling differs from its display spelling.
20258
+ AiTcSdk: "ai-tc-sdk"
20236
20259
  };
20237
20260
  var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
20238
20261
  var SOURCE_TOOL = {
@@ -20248,9 +20271,15 @@ var SOURCE_TOOL = {
20248
20271
  // whose tool could not be identified both render through the read side's
20249
20272
  // miss path rather than as a harness of their own.
20250
20273
  Cli: "cli",
20251
- Unknown: "unknown"
20274
+ Unknown: "unknown",
20275
+ // The wire id an in-process, request-path SDK stamps on its own structural
20276
+ // rows (`request_decision`) — never a capture of prompt/response/tool text,
20277
+ // since the SDK sits in front of a model call rather than inside a coding
20278
+ // assistant's own hook contract.
20279
+ AiTcSdk: "ai-tc-sdk"
20252
20280
  };
20253
20281
  var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
20282
+ var WebSourceTool = SourceTool.extract(["ChatGpt", "ClaudeAi"]);
20254
20283
  var TOOL_TO_HARNESS = {
20255
20284
  [SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
20256
20285
  [SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
@@ -20259,7 +20288,12 @@ var TOOL_TO_HARNESS = {
20259
20288
  [SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
20260
20289
  [SOURCE_TOOL.Codex]: HARNESS.Codex,
20261
20290
  [SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
20262
- [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
20291
+ [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi,
20292
+ // Wire and display id are the same string here, but the row still belongs:
20293
+ // both vocabularies carry the `AiTcSdk` member, and the join is exactly
20294
+ // their intersection — leaving a shared member out would read as an
20295
+ // uninstrumented tool on both surfaces, which this one is not.
20296
+ [SOURCE_TOOL.AiTcSdk]: HARNESS.AiTcSdk
20263
20297
  };
20264
20298
 
20265
20299
  // ../../packages/schema/src/zod/finding.ts
@@ -20293,7 +20327,8 @@ var FindingProvider = Harness.extract([
20293
20327
  "ClaudeAi",
20294
20328
  "Codex",
20295
20329
  "Antigravity",
20296
- "Api"
20330
+ "Api",
20331
+ "AiTcSdk"
20297
20332
  ]).meta({ id: "FindingProvider" });
20298
20333
  var FindingCategory = external_exports.enum([
20299
20334
  "secret",
@@ -20309,6 +20344,15 @@ var FindingCategory = external_exports.enum([
20309
20344
  ]).meta({ id: "FindingCategory" });
20310
20345
  var FindingOrigin = external_exports.enum(["in-flight", "at-rest"]).meta({ id: "FindingOrigin" });
20311
20346
  var FindingStatus = external_exports.enum(["open", "handled", "resolved", "dismissed"]).meta({ id: "FindingStatus" });
20347
+ var SyncFailureReason = external_exports.enum(["deployment_refused", "payload_invalid", "detached_undelivered"]).meta({ id: "SyncFailureReason" });
20348
+ var FindingDeliveryState = external_exports.enum(["sent", "queued", "not_sent", "never_offered", "local_scan"]).meta({ id: "FindingDeliveryState" });
20349
+ var FindingDelivery = external_exports.object({
20350
+ state: FindingDeliveryState,
20351
+ // The delivery time for `sent`; the failure time for `not_sent` when recorded.
20352
+ at: external_exports.iso.datetime().optional(),
20353
+ // Only on `not_sent`, and only when a known reason was recorded.
20354
+ reason: SyncFailureReason.optional()
20355
+ }).meta({ id: "FindingDelivery" });
20312
20356
  var ResolutionMethod = external_exports.enum([
20313
20357
  "enforced-in-flight",
20314
20358
  "fixed-at-source",
@@ -20365,7 +20409,10 @@ var FindingInstance = external_exports.object({
20365
20409
  // The session that event belongs to, when it has one — the seam a
20366
20410
  // per-instance "view session" link needs. Absent for events captured
20367
20411
  // outside a session.
20368
- sessionId: external_exports.string().optional()
20412
+ sessionId: external_exports.string().optional(),
20413
+ // The delivery state of the event above (see FindingDelivery). Optional so
20414
+ // readers that do not project it stay valid.
20415
+ delivery: FindingDelivery.optional()
20369
20416
  }).meta({ id: "FindingInstance" });
20370
20417
  var FindingGroup = external_exports.object({
20371
20418
  id: external_exports.string(),
@@ -20417,7 +20464,10 @@ var FindingFacets = external_exports.object({
20417
20464
  // Host tool (attributes.tool_name). Present only on the instance-level
20418
20465
  // reads, which can filter by it; the type-level read omits the dimension
20419
20466
  // because a group spans tools.
20420
- tool: external_exports.array(FindingFacetItem).optional()
20467
+ tool: external_exports.array(FindingFacetItem).optional(),
20468
+ // Delivery states (FindingDeliveryState). Present only on the
20469
+ // instance-level reads, like `tool`.
20470
+ deployment: external_exports.array(FindingFacetItem).optional()
20421
20471
  }).meta({ id: "FindingFacets" });
20422
20472
  var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20423
20473
  id: "FindingTypeSummary"
@@ -20526,6 +20576,8 @@ var ListFindingInstancesQuery = external_exports.object({
20526
20576
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20527
20577
  // where the free-text `q` can only match the rendered "via Bash" label.
20528
20578
  tool: external_exports.array(external_exports.string()).optional(),
20579
+ // The delivery state of each finding's event (see FindingDelivery).
20580
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20529
20581
  // Exact repository / file-path matches, for the drill-down out of the
20530
20582
  // locations view. A row whose event carries no repo/file matches neither.
20531
20583
  repo: external_exports.string().optional(),
@@ -20546,6 +20598,10 @@ var ListFindingInstancesResponse = external_exports.object({
20546
20598
  items: external_exports.array(FindingInstanceDetail),
20547
20599
  nextCursor: external_exports.string().nullable()
20548
20600
  }).meta({ id: "ListFindingInstancesResponse" });
20601
+ var ListFindingInstancesPage = external_exports.object({
20602
+ items: external_exports.array(FindingInstanceDetail),
20603
+ nextCursor: external_exports.string().nullable()
20604
+ }).meta({ id: "ListFindingInstancesPage" });
20549
20605
  var FindingLocationSummary = external_exports.object({
20550
20606
  // Opaque, stable, minted from the pair by encodeLocationId. It exists
20551
20607
  // because a location's identity is two values and a URL param carries one:
@@ -20587,6 +20643,8 @@ var ListFindingLocationsQuery = external_exports.object({
20587
20643
  // instances that match, and folds its status from those.
20588
20644
  status: external_exports.array(FindingStatus).optional(),
20589
20645
  tool: external_exports.array(external_exports.string()).optional(),
20646
+ // The delivery state of each finding's event (see FindingDelivery).
20647
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20590
20648
  q: external_exports.string().optional(),
20591
20649
  sessionId: external_exports.string().optional(),
20592
20650
  from: external_exports.iso.datetime().optional(),
@@ -20644,18 +20702,41 @@ var AuditEventType = external_exports.enum([
20644
20702
  // 'tool_call' is the reconciler's structural row for every call, while
20645
20703
  // 'tool_use' exists only where a hook enforced against the arguments.
20646
20704
  "tool_use",
20647
- // One row per model REFUSAL: a switch onto a prohibited model that was
20648
- // denied, or a turn refused because the session was already running on one.
20649
- // A structural row like the ones above rather than a capture — it carries
20650
- // the model that was refused and nothing the user typed, because what is
20651
- // worth recording about a governance decision is the decision, and prompt
20652
- // text is the thing this product exists to keep from travelling.
20705
+ // One row per model REFUSAL, across all four seams a prohibited model can be
20706
+ // stopped at: a switch onto it, a turn already running on it, a subagent
20707
+ // spawn asking for it, or a request-path refusal an embedded request-path
20708
+ // SDK makes in-process before the call leaves the application. Which seam
20709
+ // rides `attributes.refusal_seam`, never this member name. A structural row
20710
+ // like the ones above rather than a capture — it carries the model that was
20711
+ // refused and nothing the user typed, because what is worth recording about
20712
+ // a governance decision is the decision, and prompt text is the thing this
20713
+ // product exists to keep from travelling.
20653
20714
  "model_refusal",
20715
+ // One row per request-path DECISION: a policy check an embedded request-path
20716
+ // SDK performs in-process before a model call leaves the application, or
20717
+ // against that call's non-streamed response. A structural row like
20718
+ // 'model_refusal' rather than a capture — content-free in the same way:
20719
+ // which side, which seam, what action and which field are decided rides
20720
+ // `attributes`, never this member name, and the matched text itself never
20721
+ // travels.
20722
+ //
20723
+ // A prohibited-model refusal on the request path is deliberately NOT this
20724
+ // member: it stays 'model_refusal' with `refusal_seam: 'request'`, so it
20725
+ // shares one bucket with the plugin's switch/turn/spawn refusals rather
20726
+ // than splitting one governance concept across two event types. This
20727
+ // member carries every OTHER request-path decision.
20728
+ "request_decision",
20654
20729
  // One row per config-inventory scan, hung off the session root. It is the
20655
20730
  // fact the posture inspection findings reference (findings require an
20656
20731
  // audit_event_id), and its started_at is the "scanned Nm ago" the read
20657
20732
  // surface renders.
20658
- "config_scan"
20733
+ "config_scan",
20734
+ // One row per reported browser-extension capture status, hung off the web
20735
+ // session root. The durable home of what one tab's network interception
20736
+ // is doing — a write-through of the native host's in-memory tracker, so a
20737
+ // second process (aka extension status) and a restarted host both have
20738
+ // somewhere to read it back from.
20739
+ "capture_status"
20659
20740
  ]).meta({ id: "AuditEventType" });
20660
20741
  var AttributeBag = external_exports.record(external_exports.string(), external_exports.unknown());
20661
20742
  var HostAttributes = external_exports.object({
@@ -20789,6 +20870,10 @@ var CaptureAttributes = external_exports.object({
20789
20870
  // to 'allow' — the enforcement audit trail's link back to the grant that
20790
20871
  // authorized the bypass.
20791
20872
  exception_ids: external_exports.array(external_exports.guid()).optional(),
20873
+ // The persisted spellings of EventMetadata's messageId/conversationId — the
20874
+ // join back to the `llm_call` leaf for the same assistant turn.
20875
+ message_id: external_exports.string().optional(),
20876
+ conversation_id: external_exports.string().optional(),
20792
20877
  // Whole milliseconds this capture's inspection blocked its caller — the
20793
20878
  // plugin's own added latency (see EventMetadata.inspectionMs, whose value
20794
20879
  // this is). Promoted to the `inspection_ms` generated column so the facet is
@@ -20797,7 +20882,33 @@ var CaptureAttributes = external_exports.object({
20797
20882
  // inline json_extract and is not itself an optimization.
20798
20883
  // ABSENT on replayed captures (backfill / worktree scan) and on rows written
20799
20884
  // before the measurement shipped — never present as a placeholder 0.
20800
- inspection_ms: external_exports.number().int().nonnegative().optional()
20885
+ inspection_ms: external_exports.number().int().nonnegative().optional(),
20886
+ // What a `redact` this capture could not carry out became instead (see
20887
+ // EventMetadata.redactDegradedTo, whose value this is). Present only when a
20888
+ // degrade actually happened, so absence is the ordinary case rather than a
20889
+ // reader having to distinguish it from a zero.
20890
+ //
20891
+ // PER CAPTURE, while `inspection_findings.action_taken` is per finding —
20892
+ // so on a multi-finding row this does not say which finding degraded, and
20893
+ // its presence does not mean the fallback decided the capture's action. A
20894
+ // capture denied by another finding's own Block policy carries `block`
20895
+ // here too. The full statement is on EventMetadata.redactDegradedTo; it is
20896
+ // repeated rather than referenced because a store reader opens this file.
20897
+ redact_degraded_to: ActionTaken.optional()
20898
+ }).catchall(external_exports.unknown());
20899
+ var CaptureStatusAttributes = external_exports.object({
20900
+ source_tool: external_exports.string().optional(),
20901
+ patched: external_exports.boolean().optional(),
20902
+ live: external_exports.boolean().optional(),
20903
+ blind: external_exports.boolean().optional(),
20904
+ sends_seen_dom: external_exports.number().int().nonnegative().optional(),
20905
+ exchanges_seen_net: external_exports.number().int().nonnegative().optional(),
20906
+ parse_failures: external_exports.number().int().nonnegative().optional(),
20907
+ unparsed_bodies: external_exports.number().int().nonnegative().optional(),
20908
+ shape_misses: external_exports.array(external_exports.string()).optional(),
20909
+ conversation_endpoints: external_exports.number().int().nonnegative().optional(),
20910
+ closed: external_exports.boolean().optional(),
20911
+ enforcement: external_exports.string().optional()
20801
20912
  }).catchall(external_exports.unknown());
20802
20913
  var ToolCallInspection = external_exports.object({
20803
20914
  ruleId: external_exports.string().min(1),
@@ -20993,7 +21104,17 @@ var AuditEvent = external_exports.object({
20993
21104
  /** `share` to a first-party/internal destination. */
20994
21105
  internal: external_exports.boolean(),
20995
21106
  /** Event needs review (e.g. unverified egress). */
20996
- flagged: external_exports.boolean()
21107
+ flagged: external_exports.boolean(),
21108
+ /**
21109
+ * The body this event's `title` is drawn from was cleared by local body
21110
+ * expiry, so an EMPTY title here means "gone", not "never had one".
21111
+ *
21112
+ * A separate flag rather than a sentinel written into `title`: the title is
21113
+ * rendered text, and a store-layer module that invented display copy for it
21114
+ * would be choosing words the view is supposed to choose. Additive and
21115
+ * defaulted, so an older producer still validates.
21116
+ */
21117
+ bodyExpired: external_exports.boolean().default(false)
20997
21118
  }).meta({ id: "ActivityAuditEvent" });
20998
21119
  var ActivitySessionSummary = external_exports.object({
20999
21120
  id: external_exports.string(),
@@ -21645,6 +21766,30 @@ var AttachedCredential = external_exports.object({
21645
21766
  keyPrefix: external_exports.string().min(1).max(16).optional(),
21646
21767
  mintedAt: external_exports.iso.datetime().optional()
21647
21768
  });
21769
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
21770
+ function unsafeEndpointReason(endpoint) {
21771
+ let parsed2;
21772
+ try {
21773
+ parsed2 = new URL(endpoint);
21774
+ } catch {
21775
+ return "unparseable";
21776
+ }
21777
+ if (parsed2.username !== "" || parsed2.password !== "") return "userinfo";
21778
+ if (parsed2.search !== "" || parsed2.hash !== "") return "query-or-fragment";
21779
+ if (parsed2.protocol === "https:") return null;
21780
+ return parsed2.protocol === "http:" && LOOPBACK_HOSTS.has(parsed2.hostname) ? null : "insecure";
21781
+ }
21782
+ function isSafeEndpoint(endpoint) {
21783
+ return unsafeEndpointReason(endpoint) === null;
21784
+ }
21785
+ function originOnly(endpoint) {
21786
+ try {
21787
+ const parsed2 = new URL(endpoint);
21788
+ return `${parsed2.protocol}//${parsed2.host}`;
21789
+ } catch {
21790
+ return "(unparseable endpoint)";
21791
+ }
21792
+ }
21648
21793
  var MAX_DATE_MS = 253402300799999;
21649
21794
  var MAX_INT4 = 2147483647;
21650
21795
  var StorePosturePack = external_exports.object({
@@ -21799,6 +21944,11 @@ var RemoteFailureKind = external_exports.enum([
21799
21944
  "rejected",
21800
21945
  "unreachable"
21801
21946
  ]);
21947
+ var ControlPlaneFailure = RemoteFailureKind.extract([
21948
+ "unauthorized",
21949
+ "forbidden",
21950
+ "unreachable"
21951
+ ]);
21802
21952
  var AttachDeviceRequest = external_exports.object({
21803
21953
  // This machine's own continuity id, so re-attaching ROTATES the credential
21804
21954
  // on one machine record instead of producing a second one. Client-minted
@@ -22217,6 +22367,17 @@ var EventMetadata = external_exports.object({
22217
22367
  // to 'allow' — the enforcement audit trail's link back to the grant that
22218
22368
  // authorized the bypass. Absent on captures where no exception applied.
22219
22369
  exceptionIds: external_exports.array(external_exports.guid()).optional(),
22370
+ // The assistant message this capture belongs to, and the conversation it sits
22371
+ // in — set by the browser extension's network capture so a stored `response`
22372
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
22373
+ // on every other capture path, which has no such id.
22374
+ //
22375
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
22376
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
22377
+ // places an event is PARSED; the local write path types the event and parses
22378
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
22379
+ messageId: external_exports.string().min(1).optional(),
22380
+ conversationId: external_exports.string().optional(),
22220
22381
  // How long THIS capture's inspection blocked its caller, in whole
22221
22382
  // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
22222
22383
  // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
@@ -22229,7 +22390,37 @@ var EventMetadata = external_exports.object({
22229
22390
  // Absent is also what every pre-measurement client writes, and what a
22230
22391
  // clock failure degrades to — a reader must treat absence as "not measured"
22231
22392
  // and never as a zero, which would read as "inspection is free".
22232
- inspectionMs: external_exports.number().int().nonnegative().optional()
22393
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
22394
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
22395
+ // workspace's `redactFallback`, applied because the field could not be
22396
+ // masked in place (a shell command, a URL, or any argument on a host whose
22397
+ // hook contract offers no rewrite channel).
22398
+ //
22399
+ // It exists because the action alone cannot say why. A finding recorded as
22400
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
22401
+ // assigned Redact on a field that could not take one — and those are
22402
+ // different facts about the same row: the first is a policy the user chose,
22403
+ // the second is a masking the host could not perform. Absent means no
22404
+ // degrade happened, which is every ordinary capture.
22405
+ //
22406
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
22407
+ // is the CAPTURE while `actionTaken` is per FINDING:
22408
+ //
22409
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
22410
+ // `redact` alongside a finding ASSIGNED the same action stores both
22411
+ // identically and one reason for the pair; attributing it to both
22412
+ // describes the assigned one wrongly, and to neither loses the degrade.
22413
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
22414
+ // became, not the reason the capture ended as it did — a capture denied
22415
+ // by some other finding's own Block policy still carries `block` here,
22416
+ // and clearing the workspace's fallback would not have let it through.
22417
+ // Gate on the value against what a fallback can produce; never read the
22418
+ // field's presence as "this was the fallback's doing".
22419
+ //
22420
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
22421
+ // Closing either means moving the reason onto the finding row, which
22422
+ // already carries its own action.
22423
+ redactDegradedTo: ActionTaken.optional()
22233
22424
  }).meta({ id: "EventMetadata" });
22234
22425
  var Event = external_exports.object({
22235
22426
  id: external_exports.guid(),
@@ -22339,6 +22530,15 @@ var RotateKeyInput = external_exports.object({
22339
22530
  confirmation: external_exports.string()
22340
22531
  });
22341
22532
 
22533
+ // ../../packages/schema/src/zod/finding-delivery.ts
22534
+ var KNOWN_REASONS = SyncFailureReason.options;
22535
+
22536
+ // ../../packages/schema/src/zod/findings-group-build.ts
22537
+ function rankByOrder(members2) {
22538
+ return Object.fromEntries(members2.map((member, index) => [member, index]));
22539
+ }
22540
+ var SEVERITY_RANK = rankByOrder(Severity.options);
22541
+
22342
22542
  // ../../packages/schema/src/zod/installed-pack.ts
22343
22543
  var InstalledPack = external_exports.object({
22344
22544
  id: external_exports.guid(),
@@ -22405,6 +22605,11 @@ var Policy = external_exports.object({
22405
22605
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22406
22606
  provenance: PolicyProvenance.optional()
22407
22607
  }).meta({ id: "Policy" });
22608
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22609
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22610
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22611
+ id: "RedactFallback"
22612
+ });
22408
22613
  var PolicyBundle = external_exports.object({
22409
22614
  version: external_exports.string(),
22410
22615
  policies: external_exports.array(Policy),
@@ -22452,6 +22657,16 @@ var PolicyBundle = external_exports.object({
22452
22657
  // control plane), so no name resolution stands between the decision and the
22453
22658
  // comparison.
22454
22659
  prohibitedModels: external_exports.array(external_exports.string()).optional(),
22660
+ // What a resolved `redact` becomes on a field the host cannot rewrite, as
22661
+ // the ORGANIZATION would have it. Merged raise-only against the device's own
22662
+ // `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
22663
+ // a control plane can tighten a machine and never loosen one — the same
22664
+ // direction `mergeRaiseOnly` enforces for policies.
22665
+ //
22666
+ // Optional so an older backend, and an older on-disk cache, still parses;
22667
+ // absent leaves the device's own setting in force, which is the behaviour
22668
+ // that predates the field and the safe direction to default.
22669
+ redactFallback: RedactFallback.optional(),
22455
22670
  customKeywords: external_exports.array(external_exports.string()),
22456
22671
  fetchedAt: external_exports.iso.datetime()
22457
22672
  }).meta({ id: "PolicyBundle" });
@@ -22481,11 +22696,6 @@ function severityFloorPolicy(category) {
22481
22696
  const peak = CATEGORY_PEAK_SEVERITY[category];
22482
22697
  return peak === "critical" || peak === "high" ? "warn" : "monitor";
22483
22698
  }
22484
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22485
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22486
- var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22487
- id: "RedactFallback"
22488
- });
22489
22699
  var BUILTIN_POLICY_SPECS = {
22490
22700
  monitor: {
22491
22701
  name: "Monitor",
@@ -22748,7 +22958,7 @@ var VaultConsent = external_exports.object({
22748
22958
  });
22749
22959
 
22750
22960
  // ../../packages/schema/src/zod/local.ts
22751
- var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22961
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
22752
22962
  var MODEL_JUDGE_PAYLOAD_VERSION = 1;
22753
22963
  var RunMode = external_exports.enum(["standalone", "attached"]);
22754
22964
  var ControlPlaneConnection = external_exports.object({
@@ -22768,6 +22978,27 @@ var HistorySyncConsent = external_exports.object({
22768
22978
  payloadVersion: external_exports.number().int().positive(),
22769
22979
  endpoint: external_exports.string()
22770
22980
  });
22981
+ var WebChatCaptureConsent = external_exports.object({
22982
+ acknowledgedAt: external_exports.iso.datetime(),
22983
+ version: external_exports.number().int().positive()
22984
+ });
22985
+ var WebChatResponseCapture = external_exports.enum(["with-findings", "always", "never"]);
22986
+ var WebChatCapture = external_exports.object({
22987
+ responses: WebChatResponseCapture.default("with-findings"),
22988
+ account: external_exports.boolean().default(false),
22989
+ // Absent until granted. Presence alone does not authorize anything — see
22990
+ // isWebChatCaptureConsentValid.
22991
+ consent: WebChatCaptureConsent.optional()
22992
+ });
22993
+ var BODY_RETENTION_DEFAULT_DAYS = 30;
22994
+ var BodyRetention = external_exports.object({
22995
+ enabled: external_exports.boolean().default(false),
22996
+ // Never 0, and the ceiling is a fat-finger guard rather than a policy
22997
+ // limit — `enabled` is the real gate. A low value cannot reach a row the
22998
+ // sync ledger still owes: the sweep's age filter only ever NARROWS a
22999
+ // candidate set that is already bounded by "delivered, or never owed".
23000
+ retainDays: external_exports.number().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
23001
+ }).meta({ id: "BodyRetention" });
22771
23002
  var WorkspaceSettings = external_exports.object({
22772
23003
  specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
22773
23004
  runMode: RunMode.default("standalone"),
@@ -22816,7 +23047,23 @@ var WorkspaceSettings = external_exports.object({
22816
23047
  // carry prompt/reply/tool-output text in `content`; the key name predates
22817
23048
  // both widenings. Absent until granted, and a grant for a different endpoint
22818
23049
  // or an older payload no longer counts.
22819
- historySyncConsent: HistorySyncConsent.optional()
23050
+ historySyncConsent: HistorySyncConsent.optional(),
23051
+ // What the browser extension may record from a web chat, and the grant that
23052
+ // authorizes it. Absent until the user answers: recording something that was
23053
+ // never recorded before is never an assumed grant on upgrade, so the whole
23054
+ // block is optional rather than defaulted in. What an absent block means is
23055
+ // webChatCaptureOf's answer, in one place.
23056
+ //
23057
+ // Enforcement is NOT gated on this. A machine that has never answered still
23058
+ // blocks, redacts and warns on what a user sends; the grant covers what is
23059
+ // written down.
23060
+ webChatCapture: WebChatCapture.optional(),
23061
+ // Local body expiry (see BodyRetention). Off until switched on; expiring a
23062
+ // body never removes the row or its findings.
23063
+ bodyRetention: BodyRetention.default({
23064
+ enabled: false,
23065
+ retainDays: BODY_RETENTION_DEFAULT_DAYS
23066
+ })
22820
23067
  });
22821
23068
  function defaultWorkspaceSettings() {
22822
23069
  return WorkspaceSettings.parse({});
@@ -22836,13 +23083,22 @@ var ManagedSettingKey = external_exports.enum([
22836
23083
  "vaultInlineReveal",
22837
23084
  "modelJudgeConsent",
22838
23085
  "dataSharesInPlace",
22839
- "redactFallback"
23086
+ "redactFallback",
23087
+ // Pins the toggle and the day count together — see BodyRetention on why the
23088
+ // two are one unit. An administrator mandating a window wants the count
23089
+ // enforced with it, not one a user can widen while the toggle stays on.
23090
+ "bodyRetention"
22840
23091
  ]).meta({ id: "ManagedSettingKey" });
22841
23092
  function isManagedSettingKey(value) {
22842
23093
  return ManagedSettingKey.safeParse(value).success;
22843
23094
  }
22844
23095
  var ManagedSettingsValues = external_exports.object({
22845
23096
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
23097
+ // `controlPlane` and `bodyRetention` are the two nested values, and both are
23098
+ // plain, non-strict objects: a key under either that this build does not know
23099
+ // is stripped and nothing reports it. The unknown-value split in
23100
+ // ManagedSettings below classifies top-level names only, so it stops at
23101
+ // these boundaries.
22846
23102
  controlPlane: external_exports.object({
22847
23103
  endpoint: external_exports.string().min(1),
22848
23104
  label: external_exports.string().min(1).optional()
@@ -22853,7 +23109,8 @@ var ManagedSettingsValues = external_exports.object({
22853
23109
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22854
23110
  modelJudgeConsent: external_exports.boolean().optional(),
22855
23111
  dataSharesInPlace: external_exports.boolean().optional(),
22856
- redactFallback: RedactFallback.optional()
23112
+ redactFallback: RedactFallback.optional(),
23113
+ bodyRetention: BodyRetention.optional()
22857
23114
  }).meta({ id: "ManagedSettingsValues" });
22858
23115
  var ManagedSettings = external_exports.object({
22859
23116
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22861,7 +23118,21 @@ var ManagedSettings = external_exports.object({
22861
23118
  // decision from a bug. Absent renders as a generic "your organization".
22862
23119
  organization: external_exports.string().min(1).optional(),
22863
23120
  // What the administrator pinned.
22864
- values: ManagedSettingsValues.default({}),
23121
+ //
23122
+ // Parsed as a RECORD rather than as the nested schema, and split below for
23123
+ // the same reason `lockedFields` is parsed as names: a plain `z.object`
23124
+ // drops an unrecognised key and succeeds, so a pin this build does not know
23125
+ // vanished and nothing anywhere said so. A pin with no lock is a supported
23126
+ // shape — it is a DEFAULT the user may still change — so that silence hit
23127
+ // exactly the file an administrator is most likely to write while a fleet
23128
+ // is mid-upgrade.
23129
+ //
23130
+ // Splitting here rather than calling `.strict()`: strict would REFUSE the
23131
+ // file, which is the outcome the lock half already rejected — an older
23132
+ // build then runs entirely unmanaged, every pin and lock gone. A bad KNOWN
23133
+ // value still fails, because the nested schema is re-run over the known
23134
+ // subset and its issues are re-raised on this parse.
23135
+ values: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
22865
23136
  // Which of those the user may not change. A key here with no matching value
22866
23137
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22867
23138
  // the user may still override. The two are separable on purpose.
@@ -22874,17 +23145,31 @@ var ManagedSettings = external_exports.object({
22874
23145
  // the fleets most likely to carry a version skew. A name outside the enum
22875
23146
  // is still never HONOURED: the lockable set stays explicit above.
22876
23147
  lockedFields: external_exports.array(external_exports.string()).default([])
22877
- }).transform(({ lockedFields, ...rest }) => {
23148
+ }).transform(({ lockedFields, values, ...rest }, ctx) => {
22878
23149
  const known = [];
22879
23150
  const unknown2 = [];
22880
23151
  for (const name of lockedFields) {
22881
23152
  if (isManagedSettingKey(name)) known.push(name);
22882
23153
  else unknown2.push(name);
22883
23154
  }
23155
+ const knownValues = /* @__PURE__ */ Object.create(null);
23156
+ const unknownValues = [];
23157
+ for (const [name, value] of Object.entries(values)) {
23158
+ if (Object.hasOwn(ManagedSettingsValues.shape, name)) knownValues[name] = value;
23159
+ else unknownValues.push(name);
23160
+ }
23161
+ const pinned = ManagedSettingsValues.safeParse(knownValues);
23162
+ if (!pinned.success) {
23163
+ for (const issue2 of pinned.error.issues)
23164
+ ctx.addIssue({ ...issue2, path: ["values", ...issue2.path] });
23165
+ return external_exports.NEVER;
23166
+ }
22884
23167
  return {
22885
23168
  ...rest,
23169
+ values: pinned.data,
22886
23170
  lockedFields: known,
22887
- ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
23171
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {},
23172
+ ...unknownValues.length > 0 ? { unknownValueFields: unknownValues } : {}
22888
23173
  };
22889
23174
  }).meta({ id: "ManagedSettings" });
22890
23175
 
@@ -23137,12 +23422,30 @@ var RecommendedActionIdParam = external_exports.object({ id: external_exports.st
23137
23422
  // ../../packages/schema/src/zod/settings-action.ts
23138
23423
  var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23139
23424
  var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
23425
+ var WebChatCaptureConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "WebChatCaptureConsentChoice" });
23140
23426
  var SaveSettingsInput = external_exports.object({
23141
23427
  historicalAccess: external_exports.string(),
23142
23428
  modelJudgeConsent: ModelJudgeConsentChoice,
23143
23429
  historySyncConsent: HistorySyncConsentChoice,
23144
23430
  vaultConsent: external_exports.string(),
23145
- vaultInlineReveal: external_exports.string()
23431
+ vaultInlineReveal: external_exports.string(),
23432
+ webChatCaptureConsent: WebChatCaptureConsentChoice,
23433
+ // Widened to `string` like its neighbours rather than typed as
23434
+ // `RedactFallback`, on this module's own layering rule: shape here, VALUE at
23435
+ // the call site, so the domain check receives the type it was written for.
23436
+ //
23437
+ // NOT because a narrower schema would reject differently. `parseActionInput`
23438
+ // is a `safeParse` wrapper and throws for no field schema, so either spelling
23439
+ // reaches a recoverable `{ ok: false }` and there is no rejected promise to
23440
+ // trade against. The real cost runs the other way and is the part worth
23441
+ // knowing: a value this schema admits and the domain enum then rejects lands
23442
+ // on the action's shared refusal, which names NO field, where a shape
23443
+ // rejection reaches `malformedInput` and names the schema key.
23444
+ redactFallback: external_exports.string(),
23445
+ // Shape only, the way the enum fields above are strings only: the RANGE is
23446
+ // `BodyRetention`'s and the action checks it there, so there is one place
23447
+ // that decides what a legal horizon is rather than two that can drift.
23448
+ bodyRetention: external_exports.object({ enabled: external_exports.boolean(), retainDays: external_exports.number() })
23146
23449
  });
23147
23450
  var AttachInput = external_exports.object({
23148
23451
  endpoint: external_exports.string(),
@@ -23268,6 +23571,96 @@ var SetupHandoffOffer = external_exports.object({
23268
23571
  path: ["liveKeys"]
23269
23572
  });
23270
23573
 
23574
+ // ../../packages/schema/src/zod/web-capture.ts
23575
+ var WebUsageSource = external_exports.enum(["site", "estimated", "none"]);
23576
+ var WebUsage = external_exports.object({
23577
+ inputTokens: external_exports.number().int().nonnegative().optional(),
23578
+ outputTokens: external_exports.number().int().nonnegative().optional(),
23579
+ cacheReadInputTokens: external_exports.number().int().nonnegative().optional(),
23580
+ cacheCreationInputTokens: external_exports.number().int().nonnegative().optional()
23581
+ });
23582
+ var WebToolCall = external_exports.object({
23583
+ toolUseId: external_exports.string().min(1),
23584
+ toolName: external_exports.string().min(1),
23585
+ target: external_exports.string().optional(),
23586
+ isError: external_exports.boolean().optional(),
23587
+ inputSize: external_exports.number().int().nonnegative().optional(),
23588
+ outputSize: external_exports.number().int().nonnegative().optional()
23589
+ });
23590
+ var WebExchange = external_exports.object({
23591
+ messageId: external_exports.string().min(1),
23592
+ startedAt: external_exports.iso.datetime(),
23593
+ model: external_exports.string().optional(),
23594
+ usage: WebUsage.optional(),
23595
+ usageSource: WebUsageSource,
23596
+ stopReason: external_exports.string().optional(),
23597
+ conversationId: external_exports.string().optional(),
23598
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23599
+ toolCalls: external_exports.array(WebToolCall).default([]),
23600
+ // Absent when the adapter recovered no text. Capped by the caller at
23601
+ // RESPONSE_TEXT_MAX_BYTES, so a short capture is never mistaken for a short
23602
+ // reply.
23603
+ responseText: external_exports.string().optional(),
23604
+ // The stored text is short of the reply. It does NOT say which of the two
23605
+ // ceilings on this path cut it: the caller applies its own cap on the raw
23606
+ // bytes it reads off the wire, which can be reached by a stream whose
23607
+ // recovered text stays well under RESPONSE_TEXT_MAX_BYTES, and applies that
23608
+ // one to the text. A reader cannot tell them apart, and nothing downstream
23609
+ // should branch as though it could.
23610
+ truncated: external_exports.boolean().default(false)
23611
+ });
23612
+ var WebEnforcementState = external_exports.enum([
23613
+ "watching",
23614
+ "composer-only",
23615
+ "button-only",
23616
+ "unattached",
23617
+ "unknown"
23618
+ ]);
23619
+ var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
23620
+ var WebCaptureStatus = external_exports.object({
23621
+ patched: external_exports.boolean(),
23622
+ live: external_exports.boolean(),
23623
+ blind: external_exports.boolean(),
23624
+ sendsSeenDom: external_exports.number().int().nonnegative(),
23625
+ exchangesSeenNet: external_exports.number().int().nonnegative(),
23626
+ parseFailures: external_exports.number().int().nonnegative(),
23627
+ unparsedBodies: external_exports.number().int().nonnegative(),
23628
+ // The adapter-declared JSON key paths that were absent from a real payload —
23629
+ // the earliest signal that a site's contract moved.
23630
+ shapeMisses: external_exports.array(external_exports.string()).default([]),
23631
+ // How many `kind: 'conversation'` endpoints the reporting tab's adapter
23632
+ // compiled. Zero means this build declares none for the site, so observing
23633
+ // nothing is the design rather than a fault — the one fact that separates a
23634
+ // site nobody has surveyed yet from one whose contract moved. Defaulted so a
23635
+ // build predating the field is read as declaring nothing rather than refused.
23636
+ conversationEndpoints: external_exports.number().int().nonnegative().default(0),
23637
+ // The document that sent this report is going away. The bridge sets it on
23638
+ // its `pagehide` report and nowhere else.
23639
+ //
23640
+ // A property of the REPORT rather than of capture health, which is why
23641
+ // nothing in `deriveWebCaptureState` reads it and why it stays out of the
23642
+ // bridge's own report signature — a closing tab's last word must not be
23643
+ // suppressed for carrying the same health as the report before it. What
23644
+ // reads it is the per-site fold: a document that said it was unloading stops
23645
+ // voting on the site's state, so the reload the `blind` remediation asks for
23646
+ // can actually clear the verdict it was shown. A document that dies without
23647
+ // sending one is covered by CAPTURE_STATUS_DOCUMENT_QUIET_MS instead.
23648
+ //
23649
+ // Defaulted so a build predating the field reads as a document that never
23650
+ // said it was closing — which keeps it voting, the same as every report that
23651
+ // is not a final one.
23652
+ closed: external_exports.boolean().default(false),
23653
+ // What the DOM enforcement path is doing, which none of the counters above
23654
+ // can say: `sendsSeenDom` rises only once a send has COMPLETED, so a tab
23655
+ // whose watcher never bound reports zero exactly like a tab nobody typed in.
23656
+ // Defaulted to 'unknown' rather than 'watching' so a status from a build
23657
+ // predating the field is not read as reporting a healthy one.
23658
+ enforcement: WebEnforcementState.default("unknown")
23659
+ });
23660
+ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
23661
+ var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
23662
+ var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
23663
+
23271
23664
  // ../../packages/persistence/src/paths.ts
23272
23665
  import {
23273
23666
  chmodSync,
@@ -23333,17 +23726,6 @@ function writeOwnerOnlyFileSync(file2, data) {
23333
23726
  function controlPlaneCredentialPath(settingsDir2) {
23334
23727
  return join2(settingsDir2, ATTACHED_CREDENTIAL_FILENAME);
23335
23728
  }
23336
- var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
23337
- function isSafeEndpoint(endpoint) {
23338
- let parsed2;
23339
- try {
23340
- parsed2 = new URL(endpoint);
23341
- } catch {
23342
- return false;
23343
- }
23344
- if (parsed2.protocol === "https:") return true;
23345
- return parsed2.protocol === "http:" && LOOPBACK_HOSTS.has(parsed2.hostname);
23346
- }
23347
23729
  function repairOrRefuseMode(file2) {
23348
23730
  const link = lstatSync2(file2, { throwIfNoEntry: false });
23349
23731
  if (link === void 0) return "absent";
@@ -23411,6 +23793,32 @@ var STALE_PARTIAL_MS = 5 * 6e4;
23411
23793
  var SNAPSHOT_STAGING_SUFFIX = ".partial";
23412
23794
  var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23413
23795
 
23796
+ // ../../packages/persistence/src/internal/sql-functions.ts
23797
+ var utf8 = new TextDecoder();
23798
+
23799
+ // ../../packages/persistence/src/internal/outbox-lane.ts
23800
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23801
+ var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23802
+
23803
+ // ../../packages/persistence/src/sync-failure.ts
23804
+ var SYNC_FAILURE_REASONS = SyncFailureReason.options;
23805
+
23806
+ // ../../packages/persistence/src/repositories/history-sync.ts
23807
+ var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23808
+ var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23809
+ var COUNTED_EVENT_TYPES = [
23810
+ ...STRUCTURAL_EVENT_TYPES,
23811
+ ...OUTBOX_CAPTURE_EVENT_TYPES
23812
+ ];
23813
+ var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23814
+ var COUNTED_SCOPE = `
23815
+ WHERE event_type IN (${COUNTED_TYPE_LIST})
23816
+ AND (
23817
+ event_type IN (${TYPE_LIST})
23818
+ OR synced_at IS NOT NULL
23819
+ OR outbox_owed = 1
23820
+ )`;
23821
+
23414
23822
  // ../../packages/persistence/src/internal/json.ts
23415
23823
  function parseJsonObject(s) {
23416
23824
  if (s == null) return void 0;
@@ -23475,13 +23883,10 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
23475
23883
  e.tool_name AS tool_name,
23476
23884
  f.audit_event_id AS event_id, e.root_session_id AS session_id,
23477
23885
  e.event_type AS kind, f.finding_key AS finding_key,
23478
- ${latestResolutionStatusSql("f")} AS latest_status`;
23479
-
23480
- // ../../packages/persistence/src/repositories/history-sync.ts
23481
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23482
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23483
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23484
- var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23886
+ ${latestResolutionStatusSql("f")} AS latest_status,
23887
+ e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
23888
+ e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
23889
+ e.outbox_owed AS outbox_owed`;
23485
23890
 
23486
23891
  // ../../packages/persistence/src/repositories/installed-packs.ts
23487
23892
  import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
@@ -23578,6 +23983,7 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
23578
23983
  if (values.vaultInlineReveal !== void 0) merged.vaultInlineReveal = values.vaultInlineReveal;
23579
23984
  if (values.dataSharesInPlace !== void 0) merged.dataSharesInPlace = values.dataSharesInPlace;
23580
23985
  if (values.redactFallback !== void 0) merged.redactFallback = values.redactFallback;
23986
+ if (values.bodyRetention !== void 0) merged.bodyRetention = values.bodyRetention;
23581
23987
  if (values.vaultConsent !== void 0) {
23582
23988
  merged.vaultConsent = values.vaultConsent ? (
23583
23989
  // Keep an existing valid grant so its acknowledgedAt survives; mint one
@@ -23665,9 +24071,11 @@ import { randomUUID as randomUUID10 } from "crypto";
23665
24071
 
23666
24072
  // ../../packages/persistence/src/database.ts
23667
24073
  var CAPTURE_GRAIN = new Set(EventKind.options);
24074
+ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
23668
24075
 
23669
24076
  // ../../packages/persistence/src/egress-wire.ts
23670
24077
  import { createHash as createHash3 } from "crypto";
24078
+ var SLASH = "/".charCodeAt(0);
23671
24079
 
23672
24080
  // ../../packages/persistence/src/finding-key.ts
23673
24081
  import { createHash as createHash4 } from "crypto";
@@ -23678,18 +24086,26 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23678
24086
  import { join as join8 } from "path";
23679
24087
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23680
24088
 
24089
+ // ../../packages/persistence/src/forward-health.ts
24090
+ import { readFileSync as readFileSync7 } from "fs";
24091
+ import { join as join9 } from "path";
24092
+
23681
24093
  // ../../packages/persistence/src/history-backfill.ts
23682
24094
  import { existsSync as existsSync4 } from "fs";
23683
- import { join as join9 } from "path";
24095
+ import { join as join10 } from "path";
23684
24096
 
23685
24097
  // ../../packages/persistence/src/history-preview.ts
23686
24098
  import { existsSync as existsSync5 } from "fs";
23687
- import { join as join10 } from "path";
24099
+ import { join as join11 } from "path";
23688
24100
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23689
24101
 
24102
+ // ../../packages/persistence/src/history-sync-state.ts
24103
+ import { readFileSync as readFileSync8 } from "fs";
24104
+ import { join as join12 } from "path";
24105
+
23690
24106
  // ../../packages/persistence/src/store-symlinks.ts
23691
24107
  import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23692
- import { dirname as dirname3, join as join11, resolve } from "path";
24108
+ import { dirname as dirname3, join as join13, resolve } from "path";
23693
24109
 
23694
24110
  // ../../packages/persistence/src/vault/crypto.ts
23695
24111
  import {
@@ -23703,15 +24119,15 @@ import {
23703
24119
  // ../../packages/persistence/src/vault/key-provider.ts
23704
24120
  import { execFileSync } from "child_process";
23705
24121
  import { randomBytes as randomBytes2 } from "crypto";
23706
- import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23707
- import { join as join12 } from "path";
24122
+ import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
24123
+ import { join as join14 } from "path";
23708
24124
 
23709
24125
  // ../../packages/persistence/src/vault/vault.ts
23710
24126
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23711
24127
 
23712
24128
  // ../../packages/persistence/src/warn-era-cap.ts
23713
24129
  import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23714
- import { join as join13 } from "path";
24130
+ import { join as join15 } from "path";
23715
24131
 
23716
24132
  // ../../packages/remote/src/http.ts
23717
24133
  import { request as httpRequest } from "http";
@@ -23742,6 +24158,12 @@ var RemoteRequestInvalid = class extends Error {
23742
24158
  }
23743
24159
  cause;
23744
24160
  };
24161
+ var RemoteEndpointRefused = class extends Error {
24162
+ constructor(endpoint) {
24163
+ super(`refusing to talk to an unsafe control-plane endpoint: ${originOnly(endpoint)}`);
24164
+ this.name = "RemoteEndpointRefused";
24165
+ }
24166
+ };
23745
24167
  var RemoteResponseInvalid = class extends Error {
23746
24168
  constructor(route, detail) {
23747
24169
  super(`control plane answered ${route} with ${detail}`);
@@ -23894,14 +24316,15 @@ function parsed(schema, body, route) {
23894
24316
  }
23895
24317
  return result.data;
23896
24318
  }
23897
- function withoutTrailingSlashes(endpoint) {
24319
+ function resolveBaseUrl(endpoint) {
24320
+ if (!isSafeEndpoint(endpoint)) throw new RemoteEndpointRefused(endpoint);
23898
24321
  let end = endpoint.length;
23899
- while (end > 0 && endpoint.charCodeAt(end - 1) === SLASH) end -= 1;
24322
+ while (end > 0 && endpoint.charCodeAt(end - 1) === SLASH2) end -= 1;
23900
24323
  return endpoint.slice(0, end);
23901
24324
  }
23902
- var SLASH = "/".charCodeAt(0);
24325
+ var SLASH2 = "/".charCodeAt(0);
23903
24326
  function createRemoteClient(options) {
23904
- const base = withoutTrailingSlashes(options.endpoint);
24327
+ const base = resolveBaseUrl(options.endpoint);
23905
24328
  const url2 = (route) => `${base}${route}`;
23906
24329
  const common = { apiKey: options.apiKey, timeoutMs: options.timeoutMs };
23907
24330
  const sendOne = async (event) => {
@@ -24031,6 +24454,7 @@ function classifyRemoteFailure(err) {
24031
24454
  case "RemoteRouteAbsent":
24032
24455
  return "route-absent";
24033
24456
  case "RemoteRequestInvalid":
24457
+ case "RemoteEndpointRefused":
24034
24458
  return "invalid-request";
24035
24459
  case "RemoteResponseInvalid":
24036
24460
  return "rejected";
@@ -24139,18 +24563,17 @@ async function runCommandSync(deps) {
24139
24563
  }
24140
24564
 
24141
24565
  // ../../packages/plugin-runtime/src/attached/forward-drops.ts
24142
- import { readFileSync as readFileSync8 } from "fs";
24143
- import { join as join14 } from "path";
24566
+ import { readFileSync as readFileSync10 } from "fs";
24567
+ import { join as join16 } from "path";
24144
24568
 
24145
24569
  // ../../packages/plugin-runtime/src/attached/forward-policy.ts
24146
24570
  import { randomUUID as randomUUID15 } from "crypto";
24147
- import { readFileSync as readFileSync15 } from "fs";
24148
24571
  import { readFile, rename, writeFile } from "fs/promises";
24149
- import { join as join24 } from "path";
24572
+ import { join as join26 } from "path";
24150
24573
 
24151
24574
  // ../../packages/plugin-sdk/src/config.ts
24152
24575
  import { existsSync as existsSync8 } from "fs";
24153
- import { join as join15 } from "path";
24576
+ import { join as join17 } from "path";
24154
24577
 
24155
24578
  // ../../packages/plugin-sdk/src/provider-env.ts
24156
24579
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -24171,9 +24594,9 @@ var providerEnvShape = {
24171
24594
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
24172
24595
 
24173
24596
  // ../../packages/plugin-sdk/src/config-inventory.ts
24174
- import { readdirSync as readdirSync2, readFileSync as readFileSync10, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
24597
+ import { readdirSync as readdirSync2, readFileSync as readFileSync12, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
24175
24598
  import { homedir as homedir2 } from "os";
24176
- import { basename as basename3, join as join17 } from "path";
24599
+ import { basename as basename3, join as join19 } from "path";
24177
24600
 
24178
24601
  // ../../packages/detections/src/egress/registry.ts
24179
24602
  var EXTRACTOR_VERSION = "1";
@@ -24902,6 +25325,56 @@ var CONFIG_POSTURE_RULES = [
24902
25325
  }
24903
25326
  ];
24904
25327
 
25328
+ // ../../packages/detections/src/posture/web-capture-posture.ts
25329
+ var RULE_VERSION2 = "1";
25330
+ var DRIFT_MIN_PARSE_FAILURES = 2;
25331
+ var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
25332
+ "blind",
25333
+ "degraded"
25334
+ ]);
25335
+ var WEB_CAPTURE_DRIFT_RULE = {
25336
+ ruleId: "web-capture-drift",
25337
+ version: RULE_VERSION2,
25338
+ name: "Web chat capture is not reading the site",
25339
+ category: "config",
25340
+ severity: "medium",
25341
+ definition: JSON.stringify({
25342
+ kind: "web-capture-drift",
25343
+ states: [...WEB_CAPTURE_DRIFT_STATES],
25344
+ minParseFailures: DRIFT_MIN_PARSE_FAILURES
25345
+ })
25346
+ };
25347
+ var STATIC_COPY = {
25348
+ active: { headline: "turns are being observed on this site" },
25349
+ unreported: {
25350
+ // Says "recently" rather than "yet": the store read is bounded to
25351
+ // CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
25352
+ // reported for AND one whose last report has aged out. The two are the
25353
+ // same fact to a reader — nobody has confirmed anything lately — and the
25354
+ // copy may not claim the stronger of them.
25355
+ headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
25356
+ },
25357
+ standby: {
25358
+ headline: "this build declares no endpoints for the site, so nothing is observed yet"
25359
+ },
25360
+ unpatched: {
25361
+ // Says what the flags say and no more. `patched` is false both for a tap
25362
+ // that installed and hooked neither transport and for one that never ran
25363
+ // at all — a page reports the same status either way, so the copy may not
25364
+ // assert one of them.
25365
+ headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
25366
+ },
25367
+ idle: { headline: "watching; no turn has been observed yet" },
25368
+ blind: {
25369
+ headline: "messages were sent in the page that the network capture never saw",
25370
+ remediation: "reload the tab. If it persists after `aka update` and reloading the extension at chrome://extensions, the site's send path has changed and needs a new extension build."
25371
+ },
25372
+ degraded: {
25373
+ headline: "the site's payloads no longer carry the fields the extension reads",
25374
+ remediation: "run `aka update`, then reload the extension at chrome://extensions. If it stays degraded after an update, the site's contract has changed and needs a new extension build."
25375
+ }
25376
+ };
25377
+
24905
25378
  // ../../packages/detections/src/security/redos-probe.ts
24906
25379
  var BUDGET_MS = 100;
24907
25380
  var EXPONENTIAL_UNITS = [
@@ -24931,8 +25404,8 @@ var CPU_CORROBORATION_SHARE = 0.2;
24931
25404
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24932
25405
 
24933
25406
  // ../../packages/plugin-sdk/src/repo.ts
24934
- import { existsSync as existsSync9, readFileSync as readFileSync9, statSync as statSync6 } from "fs";
24935
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join16, sep as sep2 } from "path";
25407
+ import { existsSync as existsSync9, readFileSync as readFileSync11, statSync as statSync6 } from "fs";
25408
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join18, sep as sep2 } from "path";
24936
25409
 
24937
25410
  // ../../packages/plugin-sdk/src/events.ts
24938
25411
  import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
@@ -24943,8 +25416,8 @@ import { fileURLToPath } from "url";
24943
25416
  import { Worker } from "worker_threads";
24944
25417
 
24945
25418
  // ../../packages/plugin-sdk/src/host-floor.ts
24946
- import { readFileSync as readFileSync12 } from "fs";
24947
- import { join as join19 } from "path";
25419
+ import { readFileSync as readFileSync14 } from "fs";
25420
+ import { join as join21 } from "path";
24948
25421
 
24949
25422
  // ../../packages/plugin-sdk/src/model-governance.ts
24950
25423
  import {
@@ -24952,11 +25425,11 @@ import {
24952
25425
  fstatSync,
24953
25426
  mkdirSync as mkdirSync2,
24954
25427
  openSync as openSync2,
24955
- readFileSync as readFileSync11,
25428
+ readFileSync as readFileSync13,
24956
25429
  readSync,
24957
25430
  writeFileSync as writeFileSync5
24958
25431
  } from "fs";
24959
- import { join as join18 } from "path";
25432
+ import { join as join20 } from "path";
24960
25433
  var TAIL_BYTES = 256 * 1024;
24961
25434
 
24962
25435
  // ../../packages/plugin-sdk/src/host-floor.ts
@@ -24979,15 +25452,15 @@ var HOST_FLOORS = {
24979
25452
 
24980
25453
  // ../../packages/plugin-sdk/src/ignore-layers.ts
24981
25454
  var import_ignore = __toESM(require_ignore(), 1);
24982
- import { readFileSync as readFileSync13 } from "fs";
24983
- import { join as join20 } from "path";
25455
+ import { readFileSync as readFileSync15 } from "fs";
25456
+ import { join as join22 } from "path";
24984
25457
 
24985
25458
  // ../../packages/plugin-sdk/src/inventory-resolver.ts
24986
25459
  import { arch, hostname as hostname4, platform, release } from "os";
24987
25460
 
24988
25461
  // ../../packages/plugin-sdk/src/nudge.ts
24989
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
24990
- import { join as join21 } from "path";
25462
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
25463
+ import { join as join23 } from "path";
24991
25464
 
24992
25465
  // ../../packages/plugin-sdk/src/paths.ts
24993
25466
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
@@ -24995,7 +25468,7 @@ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24995
25468
 
24996
25469
  // ../../packages/plugin-sdk/src/project-files.ts
24997
25470
  import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
24998
- import { basename as basename5, join as join22 } from "path";
25471
+ import { basename as basename5, join as join24 } from "path";
24999
25472
 
25000
25473
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
25001
25474
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -25031,10 +25504,6 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
25031
25504
 
25032
25505
  // ../../packages/plugin-sdk/src/throttle.ts
25033
25506
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
25034
- import { join as join23 } from "path";
25035
-
25036
- // ../../packages/plugin-runtime/src/attached/history-state.ts
25037
- import { readFileSync as readFileSync16 } from "fs";
25038
25507
  import { join as join25 } from "path";
25039
25508
 
25040
25509
  // ../../packages/plugin-runtime/src/attached/history-sync.ts
@@ -25045,6 +25514,10 @@ import { hostname as hostname5 } from "os";
25045
25514
  var CORRELATION_ID = EventMetadata.shape.correlationId;
25046
25515
  var TRACE_ID = EventMetadata.shape.traceId;
25047
25516
  var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
25517
+ var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
25518
+
25519
+ // ../../packages/plugin-runtime/src/attached/history-sync.ts
25520
+ var CAPTURE_BATCH_BYTES = 1024 * 1024;
25048
25521
 
25049
25522
  // ../../packages/plugin-runtime/src/attached/history-sync-trigger.ts
25050
25523
  import { spawn } from "child_process";
@@ -25057,15 +25530,20 @@ import { readFileSync as readFileSync17 } from "fs";
25057
25530
  // ../../packages/plugin-runtime/src/attached/policy-store.ts
25058
25531
  import { randomUUID as randomUUID16 } from "crypto";
25059
25532
  import { readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
25060
- import { join as join26 } from "path";
25533
+ import { join as join27 } from "path";
25061
25534
 
25062
25535
  // ../../packages/plugin-runtime/src/attached/atomic-publish.ts
25063
25536
  import { rename as rename2 } from "fs/promises";
25064
25537
  var RETRYABLE = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
25065
- var ATTEMPTS = 5;
25538
+ var IMMEDIATE_RETRIES = 8;
25539
+ var TIMED_RETRIES = 4;
25540
+ var ATTEMPTS = 1 + IMMEDIATE_RETRIES + TIMED_RETRIES;
25066
25541
  var delay = (ms) => new Promise((resolve2) => {
25067
25542
  setTimeout(resolve2, ms);
25068
25543
  });
25544
+ var yieldToLoop = () => new Promise((resolve2) => {
25545
+ setImmediate(resolve2);
25546
+ });
25069
25547
  async function publishByRename(tmp, file2, move = rename2) {
25070
25548
  for (let attempt = 1; ; attempt += 1) {
25071
25549
  try {
@@ -25074,14 +25552,14 @@ async function publishByRename(tmp, file2, move = rename2) {
25074
25552
  } catch (err) {
25075
25553
  const code = err.code;
25076
25554
  if (attempt >= ATTEMPTS || code === void 0 || !RETRYABLE.has(code)) throw err;
25077
- await delay(attempt * 10);
25555
+ await (attempt <= IMMEDIATE_RETRIES ? yieldToLoop() : delay((attempt - IMMEDIATE_RETRIES) * 10));
25078
25556
  }
25079
25557
  }
25080
25558
  }
25081
25559
 
25082
25560
  // ../../packages/plugin-runtime/src/attached/policy-store.ts
25083
25561
  function createPolicyStore(dir = dataDir()) {
25084
- const file2 = join26(dir, "policy-cache.json");
25562
+ const file2 = join27(dir, "policy-cache.json");
25085
25563
  async function read() {
25086
25564
  try {
25087
25565
  const raw = await readFile2(file2, "utf8");
@@ -25209,14 +25687,14 @@ import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
25209
25687
  // ../../packages/plugin-runtime/src/attached/posture-store.ts
25210
25688
  import { randomUUID as randomUUID17 } from "crypto";
25211
25689
  import { readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "fs/promises";
25212
- import { join as join27 } from "path";
25690
+ import { join as join28 } from "path";
25213
25691
 
25214
25692
  // ../../packages/plugin-runtime/src/attached/sync-state.ts
25215
25693
  import { readFileSync as readFileSync18 } from "fs";
25216
- import { join as join28 } from "path";
25694
+ import { join as join29 } from "path";
25217
25695
  var SYNC_STATE_FILENAME = ATTACHED_SYNC_STATE_FILENAME;
25218
25696
  function syncStatePath(dataDir2) {
25219
- return join28(dataDir2, SYNC_STATE_FILENAME);
25697
+ return join29(dataDir2, SYNC_STATE_FILENAME);
25220
25698
  }
25221
25699
  function writeSyncState(dataDir2, result) {
25222
25700
  try {
@@ -25269,6 +25747,14 @@ import { spawn as spawn2 } from "child_process";
25269
25747
  import { fileURLToPath as fileURLToPath3 } from "url";
25270
25748
  var SYNC_THROTTLE_MS = 15 * 60 * 1e3;
25271
25749
 
25750
+ // ../../packages/plugin-runtime/src/content-retention-pass.ts
25751
+ var MAX_ROWS_PER_SWEEP = 50 * 1e3;
25752
+
25753
+ // ../../packages/plugin-runtime/src/content-retention-trigger.ts
25754
+ import { spawn as spawn3 } from "child_process";
25755
+ import { fileURLToPath as fileURLToPath4 } from "url";
25756
+ var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
25757
+
25272
25758
  // ../../packages/plugin-runtime/src/attached/factory.ts
25273
25759
  import { hostname as hostname6 } from "os";
25274
25760