@akasecurity/ai-tc-claude-code 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.
@@ -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 SLASH = "/";
53
+ var SLASH2 = "/";
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(SLASH).filter(Boolean);
425
+ const slices = path.split(SLASH2).filter(Boolean);
426
426
  slices.pop();
427
427
  if (slices.length) {
428
428
  const parent = this._t(
429
- slices.join(SLASH) + SLASH,
429
+ slices.join(SLASH2) + SLASH2,
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(SLASH).filter(Boolean);
445
+ slices = path.split(SLASH2).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(SLASH) + SLASH,
452
+ slices.join(SLASH2) + SLASH2,
453
453
  cache,
454
454
  checkUnignored,
455
455
  slices
@@ -493,7 +493,7 @@ var require_ignore = __commonJS({
493
493
 
494
494
  // ../../packages/plugin-sdk/src/config.ts
495
495
  import { existsSync as existsSync8 } from "fs";
496
- import { join as join14 } from "path";
496
+ import { join as join16 } from "path";
497
497
 
498
498
  // ../../packages/persistence/src/attached-derived.ts
499
499
  import { rmSync } from "fs";
@@ -503,6 +503,14 @@ import { join } from "path";
503
503
  import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
504
504
  import { join as join2 } from "path";
505
505
 
506
+ // ../../packages/schema/src/drizzle/deferred-migrations.ts
507
+ var DEFERRED_MIGRATION_TAGS = [
508
+ "0031_audit_capture_by_time_index",
509
+ "0032_audit_capture_by_id_index",
510
+ "0033_audit_capture_location_index",
511
+ "0034_findings_read_indexes"
512
+ ];
513
+
506
514
  // ../../packages/schema/src/exception-scope.ts
507
515
  var MINUTE_MS = 6e4;
508
516
  var HOUR_MS = 60 * MINUTE_MS;
@@ -20215,7 +20223,17 @@ var UNPRICEABLE_PROVIDERS = Object.freeze([
20215
20223
  "gateway",
20216
20224
  "unknown",
20217
20225
  "cli",
20218
- "api"
20226
+ "api",
20227
+ // The browser extension's native host records these as `llm_call.provider`
20228
+ // for a web-chat turn — the web tool id, deliberately never the vendor id
20229
+ // (`openai`/`anthropic`) the session root carries. Subscription traffic
20230
+ // burns rate-limit budget, not dollar credits, and listing them here is
20231
+ // what keeps that true structurally: a later maintainer who wants to price
20232
+ // web-chat traffic at API rates has to delete this entry first, and meet
20233
+ // the reason on the way, rather than quietly adding one to
20234
+ // PROVIDER_PLATFORM.
20235
+ "chatgpt",
20236
+ "claude-ai"
20219
20237
  ]);
20220
20238
 
20221
20239
  // ../../packages/schema/src/token/format.ts
@@ -20235,7 +20253,12 @@ var HARNESS = {
20235
20253
  ClaudeDesktop: "claudedesktop",
20236
20254
  ChatGpt: "chatgpt",
20237
20255
  ClaudeAi: "claudeai",
20238
- Api: "api"
20256
+ Api: "api",
20257
+ // Not a coding assistant a person drives — an in-process SDK embedded in an
20258
+ // application, so it has no IDE/CLI/desktop/web surface of its own. Carries
20259
+ // the same id as its SOURCE_TOOL counterpart, unlike every capture-side tool
20260
+ // whose wire spelling differs from its display spelling.
20261
+ AiTcSdk: "ai-tc-sdk"
20239
20262
  };
20240
20263
  var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
20241
20264
  var SOURCE_TOOL = {
@@ -20251,9 +20274,15 @@ var SOURCE_TOOL = {
20251
20274
  // whose tool could not be identified both render through the read side's
20252
20275
  // miss path rather than as a harness of their own.
20253
20276
  Cli: "cli",
20254
- Unknown: "unknown"
20277
+ Unknown: "unknown",
20278
+ // The wire id an in-process, request-path SDK stamps on its own structural
20279
+ // rows (`request_decision`) — never a capture of prompt/response/tool text,
20280
+ // since the SDK sits in front of a model call rather than inside a coding
20281
+ // assistant's own hook contract.
20282
+ AiTcSdk: "ai-tc-sdk"
20255
20283
  };
20256
20284
  var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
20285
+ var WebSourceTool = SourceTool.extract(["ChatGpt", "ClaudeAi"]);
20257
20286
  var TOOL_TO_HARNESS = {
20258
20287
  [SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
20259
20288
  [SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
@@ -20262,7 +20291,12 @@ var TOOL_TO_HARNESS = {
20262
20291
  [SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
20263
20292
  [SOURCE_TOOL.Codex]: HARNESS.Codex,
20264
20293
  [SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
20265
- [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
20294
+ [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi,
20295
+ // Wire and display id are the same string here, but the row still belongs:
20296
+ // both vocabularies carry the `AiTcSdk` member, and the join is exactly
20297
+ // their intersection — leaving a shared member out would read as an
20298
+ // uninstrumented tool on both surfaces, which this one is not.
20299
+ [SOURCE_TOOL.AiTcSdk]: HARNESS.AiTcSdk
20266
20300
  };
20267
20301
 
20268
20302
  // ../../packages/schema/src/zod/finding.ts
@@ -20296,7 +20330,8 @@ var FindingProvider = Harness.extract([
20296
20330
  "ClaudeAi",
20297
20331
  "Codex",
20298
20332
  "Antigravity",
20299
- "Api"
20333
+ "Api",
20334
+ "AiTcSdk"
20300
20335
  ]).meta({ id: "FindingProvider" });
20301
20336
  var FindingCategory = external_exports.enum([
20302
20337
  "secret",
@@ -20312,6 +20347,15 @@ var FindingCategory = external_exports.enum([
20312
20347
  ]).meta({ id: "FindingCategory" });
20313
20348
  var FindingOrigin = external_exports.enum(["in-flight", "at-rest"]).meta({ id: "FindingOrigin" });
20314
20349
  var FindingStatus = external_exports.enum(["open", "handled", "resolved", "dismissed"]).meta({ id: "FindingStatus" });
20350
+ var SyncFailureReason = external_exports.enum(["deployment_refused", "payload_invalid", "detached_undelivered"]).meta({ id: "SyncFailureReason" });
20351
+ var FindingDeliveryState = external_exports.enum(["sent", "queued", "not_sent", "never_offered", "local_scan"]).meta({ id: "FindingDeliveryState" });
20352
+ var FindingDelivery = external_exports.object({
20353
+ state: FindingDeliveryState,
20354
+ // The delivery time for `sent`; the failure time for `not_sent` when recorded.
20355
+ at: external_exports.iso.datetime().optional(),
20356
+ // Only on `not_sent`, and only when a known reason was recorded.
20357
+ reason: SyncFailureReason.optional()
20358
+ }).meta({ id: "FindingDelivery" });
20315
20359
  var ResolutionMethod = external_exports.enum([
20316
20360
  "enforced-in-flight",
20317
20361
  "fixed-at-source",
@@ -20368,7 +20412,10 @@ var FindingInstance = external_exports.object({
20368
20412
  // The session that event belongs to, when it has one — the seam a
20369
20413
  // per-instance "view session" link needs. Absent for events captured
20370
20414
  // outside a session.
20371
- sessionId: external_exports.string().optional()
20415
+ sessionId: external_exports.string().optional(),
20416
+ // The delivery state of the event above (see FindingDelivery). Optional so
20417
+ // readers that do not project it stay valid.
20418
+ delivery: FindingDelivery.optional()
20372
20419
  }).meta({ id: "FindingInstance" });
20373
20420
  var FindingGroup = external_exports.object({
20374
20421
  id: external_exports.string(),
@@ -20420,7 +20467,10 @@ var FindingFacets = external_exports.object({
20420
20467
  // Host tool (attributes.tool_name). Present only on the instance-level
20421
20468
  // reads, which can filter by it; the type-level read omits the dimension
20422
20469
  // because a group spans tools.
20423
- tool: external_exports.array(FindingFacetItem).optional()
20470
+ tool: external_exports.array(FindingFacetItem).optional(),
20471
+ // Delivery states (FindingDeliveryState). Present only on the
20472
+ // instance-level reads, like `tool`.
20473
+ deployment: external_exports.array(FindingFacetItem).optional()
20424
20474
  }).meta({ id: "FindingFacets" });
20425
20475
  var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20426
20476
  id: "FindingTypeSummary"
@@ -20529,6 +20579,8 @@ var ListFindingInstancesQuery = external_exports.object({
20529
20579
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20530
20580
  // where the free-text `q` can only match the rendered "via Bash" label.
20531
20581
  tool: external_exports.array(external_exports.string()).optional(),
20582
+ // The delivery state of each finding's event (see FindingDelivery).
20583
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20532
20584
  // Exact repository / file-path matches, for the drill-down out of the
20533
20585
  // locations view. A row whose event carries no repo/file matches neither.
20534
20586
  repo: external_exports.string().optional(),
@@ -20549,6 +20601,10 @@ var ListFindingInstancesResponse = external_exports.object({
20549
20601
  items: external_exports.array(FindingInstanceDetail),
20550
20602
  nextCursor: external_exports.string().nullable()
20551
20603
  }).meta({ id: "ListFindingInstancesResponse" });
20604
+ var ListFindingInstancesPage = external_exports.object({
20605
+ items: external_exports.array(FindingInstanceDetail),
20606
+ nextCursor: external_exports.string().nullable()
20607
+ }).meta({ id: "ListFindingInstancesPage" });
20552
20608
  var FindingLocationSummary = external_exports.object({
20553
20609
  // Opaque, stable, minted from the pair by encodeLocationId. It exists
20554
20610
  // because a location's identity is two values and a URL param carries one:
@@ -20590,6 +20646,8 @@ var ListFindingLocationsQuery = external_exports.object({
20590
20646
  // instances that match, and folds its status from those.
20591
20647
  status: external_exports.array(FindingStatus).optional(),
20592
20648
  tool: external_exports.array(external_exports.string()).optional(),
20649
+ // The delivery state of each finding's event (see FindingDelivery).
20650
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20593
20651
  q: external_exports.string().optional(),
20594
20652
  sessionId: external_exports.string().optional(),
20595
20653
  from: external_exports.iso.datetime().optional(),
@@ -20647,18 +20705,41 @@ var AuditEventType = external_exports.enum([
20647
20705
  // 'tool_call' is the reconciler's structural row for every call, while
20648
20706
  // 'tool_use' exists only where a hook enforced against the arguments.
20649
20707
  "tool_use",
20650
- // One row per model REFUSAL: a switch onto a prohibited model that was
20651
- // denied, or a turn refused because the session was already running on one.
20652
- // A structural row like the ones above rather than a capture — it carries
20653
- // the model that was refused and nothing the user typed, because what is
20654
- // worth recording about a governance decision is the decision, and prompt
20655
- // text is the thing this product exists to keep from travelling.
20708
+ // One row per model REFUSAL, across all four seams a prohibited model can be
20709
+ // stopped at: a switch onto it, a turn already running on it, a subagent
20710
+ // spawn asking for it, or a request-path refusal an embedded request-path
20711
+ // SDK makes in-process before the call leaves the application. Which seam
20712
+ // rides `attributes.refusal_seam`, never this member name. A structural row
20713
+ // like the ones above rather than a capture — it carries the model that was
20714
+ // refused and nothing the user typed, because what is worth recording about
20715
+ // a governance decision is the decision, and prompt text is the thing this
20716
+ // product exists to keep from travelling.
20656
20717
  "model_refusal",
20718
+ // One row per request-path DECISION: a policy check an embedded request-path
20719
+ // SDK performs in-process before a model call leaves the application, or
20720
+ // against that call's non-streamed response. A structural row like
20721
+ // 'model_refusal' rather than a capture — content-free in the same way:
20722
+ // which side, which seam, what action and which field are decided rides
20723
+ // `attributes`, never this member name, and the matched text itself never
20724
+ // travels.
20725
+ //
20726
+ // A prohibited-model refusal on the request path is deliberately NOT this
20727
+ // member: it stays 'model_refusal' with `refusal_seam: 'request'`, so it
20728
+ // shares one bucket with the plugin's switch/turn/spawn refusals rather
20729
+ // than splitting one governance concept across two event types. This
20730
+ // member carries every OTHER request-path decision.
20731
+ "request_decision",
20657
20732
  // One row per config-inventory scan, hung off the session root. It is the
20658
20733
  // fact the posture inspection findings reference (findings require an
20659
20734
  // audit_event_id), and its started_at is the "scanned Nm ago" the read
20660
20735
  // surface renders.
20661
- "config_scan"
20736
+ "config_scan",
20737
+ // One row per reported browser-extension capture status, hung off the web
20738
+ // session root. The durable home of what one tab's network interception
20739
+ // is doing — a write-through of the native host's in-memory tracker, so a
20740
+ // second process (aka extension status) and a restarted host both have
20741
+ // somewhere to read it back from.
20742
+ "capture_status"
20662
20743
  ]).meta({ id: "AuditEventType" });
20663
20744
  var AttributeBag = external_exports.record(external_exports.string(), external_exports.unknown());
20664
20745
  var HostAttributes = external_exports.object({
@@ -20792,6 +20873,10 @@ var CaptureAttributes = external_exports.object({
20792
20873
  // to 'allow' — the enforcement audit trail's link back to the grant that
20793
20874
  // authorized the bypass.
20794
20875
  exception_ids: external_exports.array(external_exports.guid()).optional(),
20876
+ // The persisted spellings of EventMetadata's messageId/conversationId — the
20877
+ // join back to the `llm_call` leaf for the same assistant turn.
20878
+ message_id: external_exports.string().optional(),
20879
+ conversation_id: external_exports.string().optional(),
20795
20880
  // Whole milliseconds this capture's inspection blocked its caller — the
20796
20881
  // plugin's own added latency (see EventMetadata.inspectionMs, whose value
20797
20882
  // this is). Promoted to the `inspection_ms` generated column so the facet is
@@ -20800,7 +20885,33 @@ var CaptureAttributes = external_exports.object({
20800
20885
  // inline json_extract and is not itself an optimization.
20801
20886
  // ABSENT on replayed captures (backfill / worktree scan) and on rows written
20802
20887
  // before the measurement shipped — never present as a placeholder 0.
20803
- inspection_ms: external_exports.number().int().nonnegative().optional()
20888
+ inspection_ms: external_exports.number().int().nonnegative().optional(),
20889
+ // What a `redact` this capture could not carry out became instead (see
20890
+ // EventMetadata.redactDegradedTo, whose value this is). Present only when a
20891
+ // degrade actually happened, so absence is the ordinary case rather than a
20892
+ // reader having to distinguish it from a zero.
20893
+ //
20894
+ // PER CAPTURE, while `inspection_findings.action_taken` is per finding —
20895
+ // so on a multi-finding row this does not say which finding degraded, and
20896
+ // its presence does not mean the fallback decided the capture's action. A
20897
+ // capture denied by another finding's own Block policy carries `block`
20898
+ // here too. The full statement is on EventMetadata.redactDegradedTo; it is
20899
+ // repeated rather than referenced because a store reader opens this file.
20900
+ redact_degraded_to: ActionTaken.optional()
20901
+ }).catchall(external_exports.unknown());
20902
+ var CaptureStatusAttributes = external_exports.object({
20903
+ source_tool: external_exports.string().optional(),
20904
+ patched: external_exports.boolean().optional(),
20905
+ live: external_exports.boolean().optional(),
20906
+ blind: external_exports.boolean().optional(),
20907
+ sends_seen_dom: external_exports.number().int().nonnegative().optional(),
20908
+ exchanges_seen_net: external_exports.number().int().nonnegative().optional(),
20909
+ parse_failures: external_exports.number().int().nonnegative().optional(),
20910
+ unparsed_bodies: external_exports.number().int().nonnegative().optional(),
20911
+ shape_misses: external_exports.array(external_exports.string()).optional(),
20912
+ conversation_endpoints: external_exports.number().int().nonnegative().optional(),
20913
+ closed: external_exports.boolean().optional(),
20914
+ enforcement: external_exports.string().optional()
20804
20915
  }).catchall(external_exports.unknown());
20805
20916
  var ToolCallInspection = external_exports.object({
20806
20917
  ruleId: external_exports.string().min(1),
@@ -20996,7 +21107,17 @@ var AuditEvent = external_exports.object({
20996
21107
  /** `share` to a first-party/internal destination. */
20997
21108
  internal: external_exports.boolean(),
20998
21109
  /** Event needs review (e.g. unverified egress). */
20999
- flagged: external_exports.boolean()
21110
+ flagged: external_exports.boolean(),
21111
+ /**
21112
+ * The body this event's `title` is drawn from was cleared by local body
21113
+ * expiry, so an EMPTY title here means "gone", not "never had one".
21114
+ *
21115
+ * A separate flag rather than a sentinel written into `title`: the title is
21116
+ * rendered text, and a store-layer module that invented display copy for it
21117
+ * would be choosing words the view is supposed to choose. Additive and
21118
+ * defaulted, so an older producer still validates.
21119
+ */
21120
+ bodyExpired: external_exports.boolean().default(false)
21000
21121
  }).meta({ id: "ActivityAuditEvent" });
21001
21122
  var ActivitySessionSummary = external_exports.object({
21002
21123
  id: external_exports.string(),
@@ -21801,6 +21922,11 @@ var RemoteFailureKind = external_exports.enum([
21801
21922
  "rejected",
21802
21923
  "unreachable"
21803
21924
  ]);
21925
+ var ControlPlaneFailure = RemoteFailureKind.extract([
21926
+ "unauthorized",
21927
+ "forbidden",
21928
+ "unreachable"
21929
+ ]);
21804
21930
  var AttachDeviceRequest = external_exports.object({
21805
21931
  // This machine's own continuity id, so re-attaching ROTATES the credential
21806
21932
  // on one machine record instead of producing a second one. Client-minted
@@ -22219,6 +22345,17 @@ var EventMetadata = external_exports.object({
22219
22345
  // to 'allow' — the enforcement audit trail's link back to the grant that
22220
22346
  // authorized the bypass. Absent on captures where no exception applied.
22221
22347
  exceptionIds: external_exports.array(external_exports.guid()).optional(),
22348
+ // The assistant message this capture belongs to, and the conversation it sits
22349
+ // in — set by the browser extension's network capture so a stored `response`
22350
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
22351
+ // on every other capture path, which has no such id.
22352
+ //
22353
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
22354
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
22355
+ // places an event is PARSED; the local write path types the event and parses
22356
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
22357
+ messageId: external_exports.string().min(1).optional(),
22358
+ conversationId: external_exports.string().optional(),
22222
22359
  // How long THIS capture's inspection blocked its caller, in whole
22223
22360
  // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
22224
22361
  // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
@@ -22231,7 +22368,37 @@ var EventMetadata = external_exports.object({
22231
22368
  // Absent is also what every pre-measurement client writes, and what a
22232
22369
  // clock failure degrades to — a reader must treat absence as "not measured"
22233
22370
  // and never as a zero, which would read as "inspection is free".
22234
- inspectionMs: external_exports.number().int().nonnegative().optional()
22371
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
22372
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
22373
+ // workspace's `redactFallback`, applied because the field could not be
22374
+ // masked in place (a shell command, a URL, or any argument on a host whose
22375
+ // hook contract offers no rewrite channel).
22376
+ //
22377
+ // It exists because the action alone cannot say why. A finding recorded as
22378
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
22379
+ // assigned Redact on a field that could not take one — and those are
22380
+ // different facts about the same row: the first is a policy the user chose,
22381
+ // the second is a masking the host could not perform. Absent means no
22382
+ // degrade happened, which is every ordinary capture.
22383
+ //
22384
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
22385
+ // is the CAPTURE while `actionTaken` is per FINDING:
22386
+ //
22387
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
22388
+ // `redact` alongside a finding ASSIGNED the same action stores both
22389
+ // identically and one reason for the pair; attributing it to both
22390
+ // describes the assigned one wrongly, and to neither loses the degrade.
22391
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
22392
+ // became, not the reason the capture ended as it did — a capture denied
22393
+ // by some other finding's own Block policy still carries `block` here,
22394
+ // and clearing the workspace's fallback would not have let it through.
22395
+ // Gate on the value against what a fallback can produce; never read the
22396
+ // field's presence as "this was the fallback's doing".
22397
+ //
22398
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
22399
+ // Closing either means moving the reason onto the finding row, which
22400
+ // already carries its own action.
22401
+ redactDegradedTo: ActionTaken.optional()
22235
22402
  }).meta({ id: "EventMetadata" });
22236
22403
  var Event = external_exports.object({
22237
22404
  id: external_exports.guid(),
@@ -22341,6 +22508,15 @@ var RotateKeyInput = external_exports.object({
22341
22508
  confirmation: external_exports.string()
22342
22509
  });
22343
22510
 
22511
+ // ../../packages/schema/src/zod/finding-delivery.ts
22512
+ var KNOWN_REASONS = SyncFailureReason.options;
22513
+
22514
+ // ../../packages/schema/src/zod/findings-group-build.ts
22515
+ function rankByOrder(members2) {
22516
+ return Object.fromEntries(members2.map((member, index) => [member, index]));
22517
+ }
22518
+ var SEVERITY_RANK = rankByOrder(Severity.options);
22519
+
22344
22520
  // ../../packages/schema/src/zod/installed-pack.ts
22345
22521
  var InstalledPack = external_exports.object({
22346
22522
  id: external_exports.guid(),
@@ -22407,6 +22583,11 @@ var Policy = external_exports.object({
22407
22583
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22408
22584
  provenance: PolicyProvenance.optional()
22409
22585
  }).meta({ id: "Policy" });
22586
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22587
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22588
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22589
+ id: "RedactFallback"
22590
+ });
22410
22591
  var PolicyBundle = external_exports.object({
22411
22592
  version: external_exports.string(),
22412
22593
  policies: external_exports.array(Policy),
@@ -22454,6 +22635,16 @@ var PolicyBundle = external_exports.object({
22454
22635
  // control plane), so no name resolution stands between the decision and the
22455
22636
  // comparison.
22456
22637
  prohibitedModels: external_exports.array(external_exports.string()).optional(),
22638
+ // What a resolved `redact` becomes on a field the host cannot rewrite, as
22639
+ // the ORGANIZATION would have it. Merged raise-only against the device's own
22640
+ // `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
22641
+ // a control plane can tighten a machine and never loosen one — the same
22642
+ // direction `mergeRaiseOnly` enforces for policies.
22643
+ //
22644
+ // Optional so an older backend, and an older on-disk cache, still parses;
22645
+ // absent leaves the device's own setting in force, which is the behaviour
22646
+ // that predates the field and the safe direction to default.
22647
+ redactFallback: RedactFallback.optional(),
22457
22648
  customKeywords: external_exports.array(external_exports.string()),
22458
22649
  fetchedAt: external_exports.iso.datetime()
22459
22650
  }).meta({ id: "PolicyBundle" });
@@ -22488,11 +22679,6 @@ function severityFloorPosture() {
22488
22679
  for (const c of DetectionCategory.options) out[c] = severityFloorPolicy(c);
22489
22680
  return out;
22490
22681
  }
22491
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22492
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22493
- var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22494
- id: "RedactFallback"
22495
- });
22496
22682
  var BUILTIN_POLICY_SPECS = {
22497
22683
  monitor: {
22498
22684
  name: "Monitor",
@@ -22754,7 +22940,7 @@ var VaultConsent = external_exports.object({
22754
22940
  });
22755
22941
 
22756
22942
  // ../../packages/schema/src/zod/local.ts
22757
- var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22943
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
22758
22944
  var RunMode = external_exports.enum(["standalone", "attached"]);
22759
22945
  var ControlPlaneConnection = external_exports.object({
22760
22946
  endpoint: external_exports.string().min(1),
@@ -22773,6 +22959,27 @@ var HistorySyncConsent = external_exports.object({
22773
22959
  payloadVersion: external_exports.number().int().positive(),
22774
22960
  endpoint: external_exports.string()
22775
22961
  });
22962
+ var WebChatCaptureConsent = external_exports.object({
22963
+ acknowledgedAt: external_exports.iso.datetime(),
22964
+ version: external_exports.number().int().positive()
22965
+ });
22966
+ var WebChatResponseCapture = external_exports.enum(["with-findings", "always", "never"]);
22967
+ var WebChatCapture = external_exports.object({
22968
+ responses: WebChatResponseCapture.default("with-findings"),
22969
+ account: external_exports.boolean().default(false),
22970
+ // Absent until granted. Presence alone does not authorize anything — see
22971
+ // isWebChatCaptureConsentValid.
22972
+ consent: WebChatCaptureConsent.optional()
22973
+ });
22974
+ var BODY_RETENTION_DEFAULT_DAYS = 30;
22975
+ var BodyRetention = external_exports.object({
22976
+ enabled: external_exports.boolean().default(false),
22977
+ // Never 0, and the ceiling is a fat-finger guard rather than a policy
22978
+ // limit — `enabled` is the real gate. A low value cannot reach a row the
22979
+ // sync ledger still owes: the sweep's age filter only ever NARROWS a
22980
+ // candidate set that is already bounded by "delivered, or never owed".
22981
+ retainDays: external_exports.number().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
22982
+ }).meta({ id: "BodyRetention" });
22776
22983
  var WorkspaceSettings = external_exports.object({
22777
22984
  specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
22778
22985
  runMode: RunMode.default("standalone"),
@@ -22821,7 +23028,23 @@ var WorkspaceSettings = external_exports.object({
22821
23028
  // carry prompt/reply/tool-output text in `content`; the key name predates
22822
23029
  // both widenings. Absent until granted, and a grant for a different endpoint
22823
23030
  // or an older payload no longer counts.
22824
- historySyncConsent: HistorySyncConsent.optional()
23031
+ historySyncConsent: HistorySyncConsent.optional(),
23032
+ // What the browser extension may record from a web chat, and the grant that
23033
+ // authorizes it. Absent until the user answers: recording something that was
23034
+ // never recorded before is never an assumed grant on upgrade, so the whole
23035
+ // block is optional rather than defaulted in. What an absent block means is
23036
+ // webChatCaptureOf's answer, in one place.
23037
+ //
23038
+ // Enforcement is NOT gated on this. A machine that has never answered still
23039
+ // blocks, redacts and warns on what a user sends; the grant covers what is
23040
+ // written down.
23041
+ webChatCapture: WebChatCapture.optional(),
23042
+ // Local body expiry (see BodyRetention). Off until switched on; expiring a
23043
+ // body never removes the row or its findings.
23044
+ bodyRetention: BodyRetention.default({
23045
+ enabled: false,
23046
+ retainDays: BODY_RETENTION_DEFAULT_DAYS
23047
+ })
22825
23048
  });
22826
23049
 
22827
23050
  // ../../packages/schema/src/zod/managed.ts
@@ -22834,13 +23057,22 @@ var ManagedSettingKey = external_exports.enum([
22834
23057
  "vaultInlineReveal",
22835
23058
  "modelJudgeConsent",
22836
23059
  "dataSharesInPlace",
22837
- "redactFallback"
23060
+ "redactFallback",
23061
+ // Pins the toggle and the day count together — see BodyRetention on why the
23062
+ // two are one unit. An administrator mandating a window wants the count
23063
+ // enforced with it, not one a user can widen while the toggle stays on.
23064
+ "bodyRetention"
22838
23065
  ]).meta({ id: "ManagedSettingKey" });
22839
23066
  function isManagedSettingKey(value) {
22840
23067
  return ManagedSettingKey.safeParse(value).success;
22841
23068
  }
22842
23069
  var ManagedSettingsValues = external_exports.object({
22843
23070
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
23071
+ // `controlPlane` and `bodyRetention` are the two nested values, and both are
23072
+ // plain, non-strict objects: a key under either that this build does not know
23073
+ // is stripped and nothing reports it. The unknown-value split in
23074
+ // ManagedSettings below classifies top-level names only, so it stops at
23075
+ // these boundaries.
22844
23076
  controlPlane: external_exports.object({
22845
23077
  endpoint: external_exports.string().min(1),
22846
23078
  label: external_exports.string().min(1).optional()
@@ -22851,7 +23083,8 @@ var ManagedSettingsValues = external_exports.object({
22851
23083
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22852
23084
  modelJudgeConsent: external_exports.boolean().optional(),
22853
23085
  dataSharesInPlace: external_exports.boolean().optional(),
22854
- redactFallback: RedactFallback.optional()
23086
+ redactFallback: RedactFallback.optional(),
23087
+ bodyRetention: BodyRetention.optional()
22855
23088
  }).meta({ id: "ManagedSettingsValues" });
22856
23089
  var ManagedSettings = external_exports.object({
22857
23090
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22859,7 +23092,21 @@ var ManagedSettings = external_exports.object({
22859
23092
  // decision from a bug. Absent renders as a generic "your organization".
22860
23093
  organization: external_exports.string().min(1).optional(),
22861
23094
  // What the administrator pinned.
22862
- values: ManagedSettingsValues.default({}),
23095
+ //
23096
+ // Parsed as a RECORD rather than as the nested schema, and split below for
23097
+ // the same reason `lockedFields` is parsed as names: a plain `z.object`
23098
+ // drops an unrecognised key and succeeds, so a pin this build does not know
23099
+ // vanished and nothing anywhere said so. A pin with no lock is a supported
23100
+ // shape — it is a DEFAULT the user may still change — so that silence hit
23101
+ // exactly the file an administrator is most likely to write while a fleet
23102
+ // is mid-upgrade.
23103
+ //
23104
+ // Splitting here rather than calling `.strict()`: strict would REFUSE the
23105
+ // file, which is the outcome the lock half already rejected — an older
23106
+ // build then runs entirely unmanaged, every pin and lock gone. A bad KNOWN
23107
+ // value still fails, because the nested schema is re-run over the known
23108
+ // subset and its issues are re-raised on this parse.
23109
+ values: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
22863
23110
  // Which of those the user may not change. A key here with no matching value
22864
23111
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22865
23112
  // the user may still override. The two are separable on purpose.
@@ -22872,17 +23119,31 @@ var ManagedSettings = external_exports.object({
22872
23119
  // the fleets most likely to carry a version skew. A name outside the enum
22873
23120
  // is still never HONOURED: the lockable set stays explicit above.
22874
23121
  lockedFields: external_exports.array(external_exports.string()).default([])
22875
- }).transform(({ lockedFields, ...rest }) => {
23122
+ }).transform(({ lockedFields, values, ...rest }, ctx) => {
22876
23123
  const known = [];
22877
23124
  const unknown2 = [];
22878
23125
  for (const name of lockedFields) {
22879
23126
  if (isManagedSettingKey(name)) known.push(name);
22880
23127
  else unknown2.push(name);
22881
23128
  }
23129
+ const knownValues = /* @__PURE__ */ Object.create(null);
23130
+ const unknownValues = [];
23131
+ for (const [name, value] of Object.entries(values)) {
23132
+ if (Object.hasOwn(ManagedSettingsValues.shape, name)) knownValues[name] = value;
23133
+ else unknownValues.push(name);
23134
+ }
23135
+ const pinned = ManagedSettingsValues.safeParse(knownValues);
23136
+ if (!pinned.success) {
23137
+ for (const issue2 of pinned.error.issues)
23138
+ ctx.addIssue({ ...issue2, path: ["values", ...issue2.path] });
23139
+ return external_exports.NEVER;
23140
+ }
22882
23141
  return {
22883
23142
  ...rest,
23143
+ values: pinned.data,
22884
23144
  lockedFields: known,
22885
- ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
23145
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {},
23146
+ ...unknownValues.length > 0 ? { unknownValueFields: unknownValues } : {}
22886
23147
  };
22887
23148
  }).meta({ id: "ManagedSettings" });
22888
23149
 
@@ -23135,12 +23396,30 @@ var RecommendedActionIdParam = external_exports.object({ id: external_exports.st
23135
23396
  // ../../packages/schema/src/zod/settings-action.ts
23136
23397
  var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23137
23398
  var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
23399
+ var WebChatCaptureConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "WebChatCaptureConsentChoice" });
23138
23400
  var SaveSettingsInput = external_exports.object({
23139
23401
  historicalAccess: external_exports.string(),
23140
23402
  modelJudgeConsent: ModelJudgeConsentChoice,
23141
23403
  historySyncConsent: HistorySyncConsentChoice,
23142
23404
  vaultConsent: external_exports.string(),
23143
- vaultInlineReveal: external_exports.string()
23405
+ vaultInlineReveal: external_exports.string(),
23406
+ webChatCaptureConsent: WebChatCaptureConsentChoice,
23407
+ // Widened to `string` like its neighbours rather than typed as
23408
+ // `RedactFallback`, on this module's own layering rule: shape here, VALUE at
23409
+ // the call site, so the domain check receives the type it was written for.
23410
+ //
23411
+ // NOT because a narrower schema would reject differently. `parseActionInput`
23412
+ // is a `safeParse` wrapper and throws for no field schema, so either spelling
23413
+ // reaches a recoverable `{ ok: false }` and there is no rejected promise to
23414
+ // trade against. The real cost runs the other way and is the part worth
23415
+ // knowing: a value this schema admits and the domain enum then rejects lands
23416
+ // on the action's shared refusal, which names NO field, where a shape
23417
+ // rejection reaches `malformedInput` and names the schema key.
23418
+ redactFallback: external_exports.string(),
23419
+ // Shape only, the way the enum fields above are strings only: the RANGE is
23420
+ // `BodyRetention`'s and the action checks it there, so there is one place
23421
+ // that decides what a legal horizon is rather than two that can drift.
23422
+ bodyRetention: external_exports.object({ enabled: external_exports.boolean(), retainDays: external_exports.number() })
23144
23423
  });
23145
23424
  var AttachInput = external_exports.object({
23146
23425
  endpoint: external_exports.string(),
@@ -23266,6 +23545,96 @@ var SetupHandoffOffer = external_exports.object({
23266
23545
  path: ["liveKeys"]
23267
23546
  });
23268
23547
 
23548
+ // ../../packages/schema/src/zod/web-capture.ts
23549
+ var WebUsageSource = external_exports.enum(["site", "estimated", "none"]);
23550
+ var WebUsage = external_exports.object({
23551
+ inputTokens: external_exports.number().int().nonnegative().optional(),
23552
+ outputTokens: external_exports.number().int().nonnegative().optional(),
23553
+ cacheReadInputTokens: external_exports.number().int().nonnegative().optional(),
23554
+ cacheCreationInputTokens: external_exports.number().int().nonnegative().optional()
23555
+ });
23556
+ var WebToolCall = external_exports.object({
23557
+ toolUseId: external_exports.string().min(1),
23558
+ toolName: external_exports.string().min(1),
23559
+ target: external_exports.string().optional(),
23560
+ isError: external_exports.boolean().optional(),
23561
+ inputSize: external_exports.number().int().nonnegative().optional(),
23562
+ outputSize: external_exports.number().int().nonnegative().optional()
23563
+ });
23564
+ var WebExchange = external_exports.object({
23565
+ messageId: external_exports.string().min(1),
23566
+ startedAt: external_exports.iso.datetime(),
23567
+ model: external_exports.string().optional(),
23568
+ usage: WebUsage.optional(),
23569
+ usageSource: WebUsageSource,
23570
+ stopReason: external_exports.string().optional(),
23571
+ conversationId: external_exports.string().optional(),
23572
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23573
+ toolCalls: external_exports.array(WebToolCall).default([]),
23574
+ // Absent when the adapter recovered no text. Capped by the caller at
23575
+ // RESPONSE_TEXT_MAX_BYTES, so a short capture is never mistaken for a short
23576
+ // reply.
23577
+ responseText: external_exports.string().optional(),
23578
+ // The stored text is short of the reply. It does NOT say which of the two
23579
+ // ceilings on this path cut it: the caller applies its own cap on the raw
23580
+ // bytes it reads off the wire, which can be reached by a stream whose
23581
+ // recovered text stays well under RESPONSE_TEXT_MAX_BYTES, and applies that
23582
+ // one to the text. A reader cannot tell them apart, and nothing downstream
23583
+ // should branch as though it could.
23584
+ truncated: external_exports.boolean().default(false)
23585
+ });
23586
+ var WebEnforcementState = external_exports.enum([
23587
+ "watching",
23588
+ "composer-only",
23589
+ "button-only",
23590
+ "unattached",
23591
+ "unknown"
23592
+ ]);
23593
+ var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
23594
+ var WebCaptureStatus = external_exports.object({
23595
+ patched: external_exports.boolean(),
23596
+ live: external_exports.boolean(),
23597
+ blind: external_exports.boolean(),
23598
+ sendsSeenDom: external_exports.number().int().nonnegative(),
23599
+ exchangesSeenNet: external_exports.number().int().nonnegative(),
23600
+ parseFailures: external_exports.number().int().nonnegative(),
23601
+ unparsedBodies: external_exports.number().int().nonnegative(),
23602
+ // The adapter-declared JSON key paths that were absent from a real payload —
23603
+ // the earliest signal that a site's contract moved.
23604
+ shapeMisses: external_exports.array(external_exports.string()).default([]),
23605
+ // How many `kind: 'conversation'` endpoints the reporting tab's adapter
23606
+ // compiled. Zero means this build declares none for the site, so observing
23607
+ // nothing is the design rather than a fault — the one fact that separates a
23608
+ // site nobody has surveyed yet from one whose contract moved. Defaulted so a
23609
+ // build predating the field is read as declaring nothing rather than refused.
23610
+ conversationEndpoints: external_exports.number().int().nonnegative().default(0),
23611
+ // The document that sent this report is going away. The bridge sets it on
23612
+ // its `pagehide` report and nowhere else.
23613
+ //
23614
+ // A property of the REPORT rather than of capture health, which is why
23615
+ // nothing in `deriveWebCaptureState` reads it and why it stays out of the
23616
+ // bridge's own report signature — a closing tab's last word must not be
23617
+ // suppressed for carrying the same health as the report before it. What
23618
+ // reads it is the per-site fold: a document that said it was unloading stops
23619
+ // voting on the site's state, so the reload the `blind` remediation asks for
23620
+ // can actually clear the verdict it was shown. A document that dies without
23621
+ // sending one is covered by CAPTURE_STATUS_DOCUMENT_QUIET_MS instead.
23622
+ //
23623
+ // Defaulted so a build predating the field reads as a document that never
23624
+ // said it was closing — which keeps it voting, the same as every report that
23625
+ // is not a final one.
23626
+ closed: external_exports.boolean().default(false),
23627
+ // What the DOM enforcement path is doing, which none of the counters above
23628
+ // can say: `sendsSeenDom` rises only once a send has COMPLETED, so a tab
23629
+ // whose watcher never bound reports zero exactly like a tab nobody typed in.
23630
+ // Defaulted to 'unknown' rather than 'watching' so a status from a build
23631
+ // predating the field is not read as reporting a healthy one.
23632
+ enforcement: WebEnforcementState.default("unknown")
23633
+ });
23634
+ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
23635
+ var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
23636
+ var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
23637
+
23269
23638
  // ../../packages/persistence/src/paths.ts
23270
23639
  import {
23271
23640
  chmodSync,
@@ -23294,6 +23663,32 @@ var STALE_PARTIAL_MS = 5 * 6e4;
23294
23663
  var SNAPSHOT_STAGING_SUFFIX = ".partial";
23295
23664
  var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23296
23665
 
23666
+ // ../../packages/persistence/src/internal/sql-functions.ts
23667
+ var utf8 = new TextDecoder();
23668
+
23669
+ // ../../packages/persistence/src/internal/outbox-lane.ts
23670
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23671
+ var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23672
+
23673
+ // ../../packages/persistence/src/sync-failure.ts
23674
+ var SYNC_FAILURE_REASONS = SyncFailureReason.options;
23675
+
23676
+ // ../../packages/persistence/src/repositories/history-sync.ts
23677
+ var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23678
+ var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23679
+ var COUNTED_EVENT_TYPES = [
23680
+ ...STRUCTURAL_EVENT_TYPES,
23681
+ ...OUTBOX_CAPTURE_EVENT_TYPES
23682
+ ];
23683
+ var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23684
+ var COUNTED_SCOPE = `
23685
+ WHERE event_type IN (${COUNTED_TYPE_LIST})
23686
+ AND (
23687
+ event_type IN (${TYPE_LIST})
23688
+ OR synced_at IS NOT NULL
23689
+ OR outbox_owed = 1
23690
+ )`;
23691
+
23297
23692
  // ../../packages/persistence/src/repositories/activity.ts
23298
23693
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
23299
23694
  var DB_EVENT_TYPE_TO_KIND = {
@@ -23347,13 +23742,10 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
23347
23742
  e.tool_name AS tool_name,
23348
23743
  f.audit_event_id AS event_id, e.root_session_id AS session_id,
23349
23744
  e.event_type AS kind, f.finding_key AS finding_key,
23350
- ${latestResolutionStatusSql("f")} AS latest_status`;
23351
-
23352
- // ../../packages/persistence/src/repositories/history-sync.ts
23353
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23354
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23355
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23356
- var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23745
+ ${latestResolutionStatusSql("f")} AS latest_status,
23746
+ e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
23747
+ e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
23748
+ e.outbox_owed AS outbox_owed`;
23357
23749
 
23358
23750
  // ../../packages/persistence/src/repositories/installed-packs.ts
23359
23751
  import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
@@ -23437,9 +23829,11 @@ import { randomUUID as randomUUID10 } from "crypto";
23437
23829
 
23438
23830
  // ../../packages/persistence/src/database.ts
23439
23831
  var CAPTURE_GRAIN = new Set(EventKind.options);
23832
+ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
23440
23833
 
23441
23834
  // ../../packages/persistence/src/egress-wire.ts
23442
23835
  import { createHash as createHash3 } from "crypto";
23836
+ var SLASH = "/".charCodeAt(0);
23443
23837
 
23444
23838
  // ../../packages/persistence/src/finding-key.ts
23445
23839
  import { createHash as createHash4 } from "crypto";
@@ -23450,18 +23844,26 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23450
23844
  import { join as join8 } from "path";
23451
23845
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23452
23846
 
23847
+ // ../../packages/persistence/src/forward-health.ts
23848
+ import { readFileSync as readFileSync7 } from "fs";
23849
+ import { join as join9 } from "path";
23850
+
23453
23851
  // ../../packages/persistence/src/history-backfill.ts
23454
23852
  import { existsSync as existsSync4 } from "fs";
23455
- import { join as join9 } from "path";
23853
+ import { join as join10 } from "path";
23456
23854
 
23457
23855
  // ../../packages/persistence/src/history-preview.ts
23458
23856
  import { existsSync as existsSync5 } from "fs";
23459
- import { join as join10 } from "path";
23857
+ import { join as join11 } from "path";
23460
23858
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23461
23859
 
23860
+ // ../../packages/persistence/src/history-sync-state.ts
23861
+ import { readFileSync as readFileSync8 } from "fs";
23862
+ import { join as join12 } from "path";
23863
+
23462
23864
  // ../../packages/persistence/src/store-symlinks.ts
23463
23865
  import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23464
- import { dirname as dirname3, join as join11, resolve } from "path";
23866
+ import { dirname as dirname3, join as join13, resolve } from "path";
23465
23867
 
23466
23868
  // ../../packages/persistence/src/vault/crypto.ts
23467
23869
  import {
@@ -23475,15 +23877,15 @@ import {
23475
23877
  // ../../packages/persistence/src/vault/key-provider.ts
23476
23878
  import { execFileSync } from "child_process";
23477
23879
  import { randomBytes as randomBytes2 } from "crypto";
23478
- import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23479
- import { join as join12 } from "path";
23880
+ import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23881
+ import { join as join14 } from "path";
23480
23882
 
23481
23883
  // ../../packages/persistence/src/vault/vault.ts
23482
23884
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23483
23885
 
23484
23886
  // ../../packages/persistence/src/warn-era-cap.ts
23485
23887
  import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23486
- import { join as join13 } from "path";
23888
+ import { join as join15 } from "path";
23487
23889
 
23488
23890
  // ../../packages/plugin-sdk/src/provider-env.ts
23489
23891
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -23504,9 +23906,9 @@ var providerEnvShape = {
23504
23906
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
23505
23907
 
23506
23908
  // ../../packages/plugin-sdk/src/config-inventory.ts
23507
- import { readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23909
+ import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23508
23910
  import { homedir as homedir2 } from "os";
23509
- import { basename as basename3, join as join16 } from "path";
23911
+ import { basename as basename3, join as join18 } from "path";
23510
23912
 
23511
23913
  // ../../packages/detections/src/egress/registry.ts
23512
23914
  var EXTRACTOR_VERSION = "1";
@@ -24235,6 +24637,56 @@ var CONFIG_POSTURE_RULES = [
24235
24637
  }
24236
24638
  ];
24237
24639
 
24640
+ // ../../packages/detections/src/posture/web-capture-posture.ts
24641
+ var RULE_VERSION2 = "1";
24642
+ var DRIFT_MIN_PARSE_FAILURES = 2;
24643
+ var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
24644
+ "blind",
24645
+ "degraded"
24646
+ ]);
24647
+ var WEB_CAPTURE_DRIFT_RULE = {
24648
+ ruleId: "web-capture-drift",
24649
+ version: RULE_VERSION2,
24650
+ name: "Web chat capture is not reading the site",
24651
+ category: "config",
24652
+ severity: "medium",
24653
+ definition: JSON.stringify({
24654
+ kind: "web-capture-drift",
24655
+ states: [...WEB_CAPTURE_DRIFT_STATES],
24656
+ minParseFailures: DRIFT_MIN_PARSE_FAILURES
24657
+ })
24658
+ };
24659
+ var STATIC_COPY = {
24660
+ active: { headline: "turns are being observed on this site" },
24661
+ unreported: {
24662
+ // Says "recently" rather than "yet": the store read is bounded to
24663
+ // CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
24664
+ // reported for AND one whose last report has aged out. The two are the
24665
+ // same fact to a reader — nobody has confirmed anything lately — and the
24666
+ // copy may not claim the stronger of them.
24667
+ headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
24668
+ },
24669
+ standby: {
24670
+ headline: "this build declares no endpoints for the site, so nothing is observed yet"
24671
+ },
24672
+ unpatched: {
24673
+ // Says what the flags say and no more. `patched` is false both for a tap
24674
+ // that installed and hooked neither transport and for one that never ran
24675
+ // at all — a page reports the same status either way, so the copy may not
24676
+ // assert one of them.
24677
+ headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
24678
+ },
24679
+ idle: { headline: "watching; no turn has been observed yet" },
24680
+ blind: {
24681
+ headline: "messages were sent in the page that the network capture never saw",
24682
+ 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."
24683
+ },
24684
+ degraded: {
24685
+ headline: "the site's payloads no longer carry the fields the extension reads",
24686
+ 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."
24687
+ }
24688
+ };
24689
+
24238
24690
  // ../../packages/detections/src/security/redos-probe.ts
24239
24691
  var BUDGET_MS = 100;
24240
24692
  var EXPONENTIAL_UNITS = [
@@ -24264,8 +24716,8 @@ var CPU_CORROBORATION_SHARE = 0.2;
24264
24716
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24265
24717
 
24266
24718
  // ../../packages/plugin-sdk/src/repo.ts
24267
- import { existsSync as existsSync9, readFileSync as readFileSync8, statSync as statSync6 } from "fs";
24268
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join15, sep as sep2 } from "path";
24719
+ import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
24720
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
24269
24721
 
24270
24722
  // ../../packages/plugin-sdk/src/events.ts
24271
24723
  import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
@@ -24276,8 +24728,8 @@ import { fileURLToPath } from "url";
24276
24728
  import { Worker } from "worker_threads";
24277
24729
 
24278
24730
  // ../../packages/plugin-sdk/src/host-floor.ts
24279
- import { readFileSync as readFileSync11 } from "fs";
24280
- import { join as join18 } from "path";
24731
+ import { readFileSync as readFileSync13 } from "fs";
24732
+ import { join as join20 } from "path";
24281
24733
 
24282
24734
  // ../../packages/plugin-sdk/src/model-governance.ts
24283
24735
  import {
@@ -24285,11 +24737,11 @@ import {
24285
24737
  fstatSync,
24286
24738
  mkdirSync as mkdirSync2,
24287
24739
  openSync as openSync2,
24288
- readFileSync as readFileSync10,
24740
+ readFileSync as readFileSync12,
24289
24741
  readSync,
24290
24742
  writeFileSync as writeFileSync5
24291
24743
  } from "fs";
24292
- import { join as join17 } from "path";
24744
+ import { join as join19 } from "path";
24293
24745
  var TAIL_BYTES = 256 * 1024;
24294
24746
 
24295
24747
  // ../../packages/plugin-sdk/src/host-floor.ts
@@ -24312,15 +24764,15 @@ var HOST_FLOORS = {
24312
24764
 
24313
24765
  // ../../packages/plugin-sdk/src/ignore-layers.ts
24314
24766
  var import_ignore = __toESM(require_ignore(), 1);
24315
- import { readFileSync as readFileSync12 } from "fs";
24316
- import { join as join19 } from "path";
24767
+ import { readFileSync as readFileSync14 } from "fs";
24768
+ import { join as join21 } from "path";
24317
24769
 
24318
24770
  // ../../packages/plugin-sdk/src/inventory-resolver.ts
24319
24771
  import { arch, hostname as hostname4, platform, release } from "os";
24320
24772
 
24321
24773
  // ../../packages/plugin-sdk/src/nudge.ts
24322
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
24323
- import { join as join20 } from "path";
24774
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "fs";
24775
+ import { join as join22 } from "path";
24324
24776
 
24325
24777
  // ../../packages/plugin-sdk/src/paths.ts
24326
24778
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
@@ -24328,7 +24780,7 @@ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24328
24780
 
24329
24781
  // ../../packages/plugin-sdk/src/project-files.ts
24330
24782
  import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
24331
- import { basename as basename5, join as join21 } from "path";
24783
+ import { basename as basename5, join as join23 } from "path";
24332
24784
 
24333
24785
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24334
24786
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24364,7 +24816,7 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24364
24816
 
24365
24817
  // ../../packages/plugin-sdk/src/throttle.ts
24366
24818
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24367
- import { join as join22 } from "path";
24819
+ import { join as join24 } from "path";
24368
24820
 
24369
24821
  // ../../packages/setup-wizard/src/onboard-posture.ts
24370
24822
  function parsePosture(json2) {
@@ -24403,7 +24855,7 @@ function parseCurrent(json2) {
24403
24855
 
24404
24856
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
24405
24857
  import { writeFileSync as writeFileSync8 } from "fs";
24406
- import { join as join23 } from "path";
24858
+ import { join as join25 } from "path";
24407
24859
 
24408
24860
  // ../../packages/setup-wizard/src/triage/gate-display.ts
24409
24861
  var ACTION_RANK = {
@@ -24430,9 +24882,9 @@ var RANK = Object.fromEntries(
24430
24882
  );
24431
24883
 
24432
24884
  // ../../packages/setup-wizard/src/triage/plan-file.ts
24433
- import { mkdtempSync, readFileSync as readFileSync14, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24885
+ import { mkdtempSync, readFileSync as readFileSync16, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24434
24886
  import { tmpdir } from "os";
24435
- import { basename as basename6, dirname as dirname6, join as join24 } from "path";
24887
+ import { basename as basename6, dirname as dirname6, join as join26 } from "path";
24436
24888
  var SuppressionEntrySchema = external_exports.object({
24437
24889
  ruleId: external_exports.string(),
24438
24890
  category: DetectionCategory,