@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.
package/scripts/intro.js CHANGED
@@ -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
@@ -492,7 +492,15 @@ var require_ignore = __commonJS({
492
492
  });
493
493
 
494
494
  // src/intro.ts
495
- import { readFileSync as readFileSync15 } from "fs";
495
+ import { readFileSync as readFileSync17 } from "fs";
496
+
497
+ // ../../packages/schema/src/drizzle/deferred-migrations.ts
498
+ var DEFERRED_MIGRATION_TAGS = [
499
+ "0031_audit_capture_by_time_index",
500
+ "0032_audit_capture_by_id_index",
501
+ "0033_audit_capture_location_index",
502
+ "0034_findings_read_indexes"
503
+ ];
496
504
 
497
505
  // ../../packages/schema/src/exception-scope.ts
498
506
  var MINUTE_MS = 6e4;
@@ -20209,7 +20217,17 @@ var UNPRICEABLE_PROVIDERS = Object.freeze([
20209
20217
  "gateway",
20210
20218
  "unknown",
20211
20219
  "cli",
20212
- "api"
20220
+ "api",
20221
+ // The browser extension's native host records these as `llm_call.provider`
20222
+ // for a web-chat turn — the web tool id, deliberately never the vendor id
20223
+ // (`openai`/`anthropic`) the session root carries. Subscription traffic
20224
+ // burns rate-limit budget, not dollar credits, and listing them here is
20225
+ // what keeps that true structurally: a later maintainer who wants to price
20226
+ // web-chat traffic at API rates has to delete this entry first, and meet
20227
+ // the reason on the way, rather than quietly adding one to
20228
+ // PROVIDER_PLATFORM.
20229
+ "chatgpt",
20230
+ "claude-ai"
20213
20231
  ]);
20214
20232
 
20215
20233
  // ../../packages/schema/src/token/format.ts
@@ -20229,7 +20247,12 @@ var HARNESS = {
20229
20247
  ClaudeDesktop: "claudedesktop",
20230
20248
  ChatGpt: "chatgpt",
20231
20249
  ClaudeAi: "claudeai",
20232
- Api: "api"
20250
+ Api: "api",
20251
+ // Not a coding assistant a person drives — an in-process SDK embedded in an
20252
+ // application, so it has no IDE/CLI/desktop/web surface of its own. Carries
20253
+ // the same id as its SOURCE_TOOL counterpart, unlike every capture-side tool
20254
+ // whose wire spelling differs from its display spelling.
20255
+ AiTcSdk: "ai-tc-sdk"
20233
20256
  };
20234
20257
  var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
20235
20258
  var SOURCE_TOOL = {
@@ -20245,9 +20268,15 @@ var SOURCE_TOOL = {
20245
20268
  // whose tool could not be identified both render through the read side's
20246
20269
  // miss path rather than as a harness of their own.
20247
20270
  Cli: "cli",
20248
- Unknown: "unknown"
20271
+ Unknown: "unknown",
20272
+ // The wire id an in-process, request-path SDK stamps on its own structural
20273
+ // rows (`request_decision`) — never a capture of prompt/response/tool text,
20274
+ // since the SDK sits in front of a model call rather than inside a coding
20275
+ // assistant's own hook contract.
20276
+ AiTcSdk: "ai-tc-sdk"
20249
20277
  };
20250
20278
  var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
20279
+ var WebSourceTool = SourceTool.extract(["ChatGpt", "ClaudeAi"]);
20251
20280
  var TOOL_TO_HARNESS = {
20252
20281
  [SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
20253
20282
  [SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
@@ -20256,7 +20285,12 @@ var TOOL_TO_HARNESS = {
20256
20285
  [SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
20257
20286
  [SOURCE_TOOL.Codex]: HARNESS.Codex,
20258
20287
  [SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
20259
- [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
20288
+ [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi,
20289
+ // Wire and display id are the same string here, but the row still belongs:
20290
+ // both vocabularies carry the `AiTcSdk` member, and the join is exactly
20291
+ // their intersection — leaving a shared member out would read as an
20292
+ // uninstrumented tool on both surfaces, which this one is not.
20293
+ [SOURCE_TOOL.AiTcSdk]: HARNESS.AiTcSdk
20260
20294
  };
20261
20295
 
20262
20296
  // ../../packages/schema/src/zod/finding.ts
@@ -20290,7 +20324,8 @@ var FindingProvider = Harness.extract([
20290
20324
  "ClaudeAi",
20291
20325
  "Codex",
20292
20326
  "Antigravity",
20293
- "Api"
20327
+ "Api",
20328
+ "AiTcSdk"
20294
20329
  ]).meta({ id: "FindingProvider" });
20295
20330
  var FindingCategory = external_exports.enum([
20296
20331
  "secret",
@@ -20306,6 +20341,15 @@ var FindingCategory = external_exports.enum([
20306
20341
  ]).meta({ id: "FindingCategory" });
20307
20342
  var FindingOrigin = external_exports.enum(["in-flight", "at-rest"]).meta({ id: "FindingOrigin" });
20308
20343
  var FindingStatus = external_exports.enum(["open", "handled", "resolved", "dismissed"]).meta({ id: "FindingStatus" });
20344
+ var SyncFailureReason = external_exports.enum(["deployment_refused", "payload_invalid", "detached_undelivered"]).meta({ id: "SyncFailureReason" });
20345
+ var FindingDeliveryState = external_exports.enum(["sent", "queued", "not_sent", "never_offered", "local_scan"]).meta({ id: "FindingDeliveryState" });
20346
+ var FindingDelivery = external_exports.object({
20347
+ state: FindingDeliveryState,
20348
+ // The delivery time for `sent`; the failure time for `not_sent` when recorded.
20349
+ at: external_exports.iso.datetime().optional(),
20350
+ // Only on `not_sent`, and only when a known reason was recorded.
20351
+ reason: SyncFailureReason.optional()
20352
+ }).meta({ id: "FindingDelivery" });
20309
20353
  var ResolutionMethod = external_exports.enum([
20310
20354
  "enforced-in-flight",
20311
20355
  "fixed-at-source",
@@ -20362,7 +20406,10 @@ var FindingInstance = external_exports.object({
20362
20406
  // The session that event belongs to, when it has one — the seam a
20363
20407
  // per-instance "view session" link needs. Absent for events captured
20364
20408
  // outside a session.
20365
- sessionId: external_exports.string().optional()
20409
+ sessionId: external_exports.string().optional(),
20410
+ // The delivery state of the event above (see FindingDelivery). Optional so
20411
+ // readers that do not project it stay valid.
20412
+ delivery: FindingDelivery.optional()
20366
20413
  }).meta({ id: "FindingInstance" });
20367
20414
  var FindingGroup = external_exports.object({
20368
20415
  id: external_exports.string(),
@@ -20414,7 +20461,10 @@ var FindingFacets = external_exports.object({
20414
20461
  // Host tool (attributes.tool_name). Present only on the instance-level
20415
20462
  // reads, which can filter by it; the type-level read omits the dimension
20416
20463
  // because a group spans tools.
20417
- tool: external_exports.array(FindingFacetItem).optional()
20464
+ tool: external_exports.array(FindingFacetItem).optional(),
20465
+ // Delivery states (FindingDeliveryState). Present only on the
20466
+ // instance-level reads, like `tool`.
20467
+ deployment: external_exports.array(FindingFacetItem).optional()
20418
20468
  }).meta({ id: "FindingFacets" });
20419
20469
  var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20420
20470
  id: "FindingTypeSummary"
@@ -20523,6 +20573,8 @@ var ListFindingInstancesQuery = external_exports.object({
20523
20573
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20524
20574
  // where the free-text `q` can only match the rendered "via Bash" label.
20525
20575
  tool: external_exports.array(external_exports.string()).optional(),
20576
+ // The delivery state of each finding's event (see FindingDelivery).
20577
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20526
20578
  // Exact repository / file-path matches, for the drill-down out of the
20527
20579
  // locations view. A row whose event carries no repo/file matches neither.
20528
20580
  repo: external_exports.string().optional(),
@@ -20543,6 +20595,10 @@ var ListFindingInstancesResponse = external_exports.object({
20543
20595
  items: external_exports.array(FindingInstanceDetail),
20544
20596
  nextCursor: external_exports.string().nullable()
20545
20597
  }).meta({ id: "ListFindingInstancesResponse" });
20598
+ var ListFindingInstancesPage = external_exports.object({
20599
+ items: external_exports.array(FindingInstanceDetail),
20600
+ nextCursor: external_exports.string().nullable()
20601
+ }).meta({ id: "ListFindingInstancesPage" });
20546
20602
  var FindingLocationSummary = external_exports.object({
20547
20603
  // Opaque, stable, minted from the pair by encodeLocationId. It exists
20548
20604
  // because a location's identity is two values and a URL param carries one:
@@ -20584,6 +20640,8 @@ var ListFindingLocationsQuery = external_exports.object({
20584
20640
  // instances that match, and folds its status from those.
20585
20641
  status: external_exports.array(FindingStatus).optional(),
20586
20642
  tool: external_exports.array(external_exports.string()).optional(),
20643
+ // The delivery state of each finding's event (see FindingDelivery).
20644
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20587
20645
  q: external_exports.string().optional(),
20588
20646
  sessionId: external_exports.string().optional(),
20589
20647
  from: external_exports.iso.datetime().optional(),
@@ -20641,18 +20699,41 @@ var AuditEventType = external_exports.enum([
20641
20699
  // 'tool_call' is the reconciler's structural row for every call, while
20642
20700
  // 'tool_use' exists only where a hook enforced against the arguments.
20643
20701
  "tool_use",
20644
- // One row per model REFUSAL: a switch onto a prohibited model that was
20645
- // denied, or a turn refused because the session was already running on one.
20646
- // A structural row like the ones above rather than a capture — it carries
20647
- // the model that was refused and nothing the user typed, because what is
20648
- // worth recording about a governance decision is the decision, and prompt
20649
- // text is the thing this product exists to keep from travelling.
20702
+ // One row per model REFUSAL, across all four seams a prohibited model can be
20703
+ // stopped at: a switch onto it, a turn already running on it, a subagent
20704
+ // spawn asking for it, or a request-path refusal an embedded request-path
20705
+ // SDK makes in-process before the call leaves the application. Which seam
20706
+ // rides `attributes.refusal_seam`, never this member name. A structural row
20707
+ // like the ones above rather than a capture — it carries the model that was
20708
+ // refused and nothing the user typed, because what is worth recording about
20709
+ // a governance decision is the decision, and prompt text is the thing this
20710
+ // product exists to keep from travelling.
20650
20711
  "model_refusal",
20712
+ // One row per request-path DECISION: a policy check an embedded request-path
20713
+ // SDK performs in-process before a model call leaves the application, or
20714
+ // against that call's non-streamed response. A structural row like
20715
+ // 'model_refusal' rather than a capture — content-free in the same way:
20716
+ // which side, which seam, what action and which field are decided rides
20717
+ // `attributes`, never this member name, and the matched text itself never
20718
+ // travels.
20719
+ //
20720
+ // A prohibited-model refusal on the request path is deliberately NOT this
20721
+ // member: it stays 'model_refusal' with `refusal_seam: 'request'`, so it
20722
+ // shares one bucket with the plugin's switch/turn/spawn refusals rather
20723
+ // than splitting one governance concept across two event types. This
20724
+ // member carries every OTHER request-path decision.
20725
+ "request_decision",
20651
20726
  // One row per config-inventory scan, hung off the session root. It is the
20652
20727
  // fact the posture inspection findings reference (findings require an
20653
20728
  // audit_event_id), and its started_at is the "scanned Nm ago" the read
20654
20729
  // surface renders.
20655
- "config_scan"
20730
+ "config_scan",
20731
+ // One row per reported browser-extension capture status, hung off the web
20732
+ // session root. The durable home of what one tab's network interception
20733
+ // is doing — a write-through of the native host's in-memory tracker, so a
20734
+ // second process (aka extension status) and a restarted host both have
20735
+ // somewhere to read it back from.
20736
+ "capture_status"
20656
20737
  ]).meta({ id: "AuditEventType" });
20657
20738
  var AttributeBag = external_exports.record(external_exports.string(), external_exports.unknown());
20658
20739
  var HostAttributes = external_exports.object({
@@ -20786,6 +20867,10 @@ var CaptureAttributes = external_exports.object({
20786
20867
  // to 'allow' — the enforcement audit trail's link back to the grant that
20787
20868
  // authorized the bypass.
20788
20869
  exception_ids: external_exports.array(external_exports.guid()).optional(),
20870
+ // The persisted spellings of EventMetadata's messageId/conversationId — the
20871
+ // join back to the `llm_call` leaf for the same assistant turn.
20872
+ message_id: external_exports.string().optional(),
20873
+ conversation_id: external_exports.string().optional(),
20789
20874
  // Whole milliseconds this capture's inspection blocked its caller — the
20790
20875
  // plugin's own added latency (see EventMetadata.inspectionMs, whose value
20791
20876
  // this is). Promoted to the `inspection_ms` generated column so the facet is
@@ -20794,7 +20879,33 @@ var CaptureAttributes = external_exports.object({
20794
20879
  // inline json_extract and is not itself an optimization.
20795
20880
  // ABSENT on replayed captures (backfill / worktree scan) and on rows written
20796
20881
  // before the measurement shipped — never present as a placeholder 0.
20797
- inspection_ms: external_exports.number().int().nonnegative().optional()
20882
+ inspection_ms: external_exports.number().int().nonnegative().optional(),
20883
+ // What a `redact` this capture could not carry out became instead (see
20884
+ // EventMetadata.redactDegradedTo, whose value this is). Present only when a
20885
+ // degrade actually happened, so absence is the ordinary case rather than a
20886
+ // reader having to distinguish it from a zero.
20887
+ //
20888
+ // PER CAPTURE, while `inspection_findings.action_taken` is per finding —
20889
+ // so on a multi-finding row this does not say which finding degraded, and
20890
+ // its presence does not mean the fallback decided the capture's action. A
20891
+ // capture denied by another finding's own Block policy carries `block`
20892
+ // here too. The full statement is on EventMetadata.redactDegradedTo; it is
20893
+ // repeated rather than referenced because a store reader opens this file.
20894
+ redact_degraded_to: ActionTaken.optional()
20895
+ }).catchall(external_exports.unknown());
20896
+ var CaptureStatusAttributes = external_exports.object({
20897
+ source_tool: external_exports.string().optional(),
20898
+ patched: external_exports.boolean().optional(),
20899
+ live: external_exports.boolean().optional(),
20900
+ blind: external_exports.boolean().optional(),
20901
+ sends_seen_dom: external_exports.number().int().nonnegative().optional(),
20902
+ exchanges_seen_net: external_exports.number().int().nonnegative().optional(),
20903
+ parse_failures: external_exports.number().int().nonnegative().optional(),
20904
+ unparsed_bodies: external_exports.number().int().nonnegative().optional(),
20905
+ shape_misses: external_exports.array(external_exports.string()).optional(),
20906
+ conversation_endpoints: external_exports.number().int().nonnegative().optional(),
20907
+ closed: external_exports.boolean().optional(),
20908
+ enforcement: external_exports.string().optional()
20798
20909
  }).catchall(external_exports.unknown());
20799
20910
  var ToolCallInspection = external_exports.object({
20800
20911
  ruleId: external_exports.string().min(1),
@@ -20990,7 +21101,17 @@ var AuditEvent = external_exports.object({
20990
21101
  /** `share` to a first-party/internal destination. */
20991
21102
  internal: external_exports.boolean(),
20992
21103
  /** Event needs review (e.g. unverified egress). */
20993
- flagged: external_exports.boolean()
21104
+ flagged: external_exports.boolean(),
21105
+ /**
21106
+ * The body this event's `title` is drawn from was cleared by local body
21107
+ * expiry, so an EMPTY title here means "gone", not "never had one".
21108
+ *
21109
+ * A separate flag rather than a sentinel written into `title`: the title is
21110
+ * rendered text, and a store-layer module that invented display copy for it
21111
+ * would be choosing words the view is supposed to choose. Additive and
21112
+ * defaulted, so an older producer still validates.
21113
+ */
21114
+ bodyExpired: external_exports.boolean().default(false)
20994
21115
  }).meta({ id: "ActivityAuditEvent" });
20995
21116
  var ActivitySessionSummary = external_exports.object({
20996
21117
  id: external_exports.string(),
@@ -21795,6 +21916,11 @@ var RemoteFailureKind = external_exports.enum([
21795
21916
  "rejected",
21796
21917
  "unreachable"
21797
21918
  ]);
21919
+ var ControlPlaneFailure = RemoteFailureKind.extract([
21920
+ "unauthorized",
21921
+ "forbidden",
21922
+ "unreachable"
21923
+ ]);
21798
21924
  var AttachDeviceRequest = external_exports.object({
21799
21925
  // This machine's own continuity id, so re-attaching ROTATES the credential
21800
21926
  // on one machine record instead of producing a second one. Client-minted
@@ -22213,6 +22339,17 @@ var EventMetadata = external_exports.object({
22213
22339
  // to 'allow' — the enforcement audit trail's link back to the grant that
22214
22340
  // authorized the bypass. Absent on captures where no exception applied.
22215
22341
  exceptionIds: external_exports.array(external_exports.guid()).optional(),
22342
+ // The assistant message this capture belongs to, and the conversation it sits
22343
+ // in — set by the browser extension's network capture so a stored `response`
22344
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
22345
+ // on every other capture path, which has no such id.
22346
+ //
22347
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
22348
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
22349
+ // places an event is PARSED; the local write path types the event and parses
22350
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
22351
+ messageId: external_exports.string().min(1).optional(),
22352
+ conversationId: external_exports.string().optional(),
22216
22353
  // How long THIS capture's inspection blocked its caller, in whole
22217
22354
  // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
22218
22355
  // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
@@ -22225,7 +22362,37 @@ var EventMetadata = external_exports.object({
22225
22362
  // Absent is also what every pre-measurement client writes, and what a
22226
22363
  // clock failure degrades to — a reader must treat absence as "not measured"
22227
22364
  // and never as a zero, which would read as "inspection is free".
22228
- inspectionMs: external_exports.number().int().nonnegative().optional()
22365
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
22366
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
22367
+ // workspace's `redactFallback`, applied because the field could not be
22368
+ // masked in place (a shell command, a URL, or any argument on a host whose
22369
+ // hook contract offers no rewrite channel).
22370
+ //
22371
+ // It exists because the action alone cannot say why. A finding recorded as
22372
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
22373
+ // assigned Redact on a field that could not take one — and those are
22374
+ // different facts about the same row: the first is a policy the user chose,
22375
+ // the second is a masking the host could not perform. Absent means no
22376
+ // degrade happened, which is every ordinary capture.
22377
+ //
22378
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
22379
+ // is the CAPTURE while `actionTaken` is per FINDING:
22380
+ //
22381
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
22382
+ // `redact` alongside a finding ASSIGNED the same action stores both
22383
+ // identically and one reason for the pair; attributing it to both
22384
+ // describes the assigned one wrongly, and to neither loses the degrade.
22385
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
22386
+ // became, not the reason the capture ended as it did — a capture denied
22387
+ // by some other finding's own Block policy still carries `block` here,
22388
+ // and clearing the workspace's fallback would not have let it through.
22389
+ // Gate on the value against what a fallback can produce; never read the
22390
+ // field's presence as "this was the fallback's doing".
22391
+ //
22392
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
22393
+ // Closing either means moving the reason onto the finding row, which
22394
+ // already carries its own action.
22395
+ redactDegradedTo: ActionTaken.optional()
22229
22396
  }).meta({ id: "EventMetadata" });
22230
22397
  var Event = external_exports.object({
22231
22398
  id: external_exports.guid(),
@@ -22335,6 +22502,15 @@ var RotateKeyInput = external_exports.object({
22335
22502
  confirmation: external_exports.string()
22336
22503
  });
22337
22504
 
22505
+ // ../../packages/schema/src/zod/finding-delivery.ts
22506
+ var KNOWN_REASONS = SyncFailureReason.options;
22507
+
22508
+ // ../../packages/schema/src/zod/findings-group-build.ts
22509
+ function rankByOrder(members2) {
22510
+ return Object.fromEntries(members2.map((member, index) => [member, index]));
22511
+ }
22512
+ var SEVERITY_RANK = rankByOrder(Severity.options);
22513
+
22338
22514
  // ../../packages/schema/src/zod/installed-pack.ts
22339
22515
  var InstalledPack = external_exports.object({
22340
22516
  id: external_exports.guid(),
@@ -22401,6 +22577,11 @@ var Policy = external_exports.object({
22401
22577
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22402
22578
  provenance: PolicyProvenance.optional()
22403
22579
  }).meta({ id: "Policy" });
22580
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22581
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22582
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22583
+ id: "RedactFallback"
22584
+ });
22404
22585
  var PolicyBundle = external_exports.object({
22405
22586
  version: external_exports.string(),
22406
22587
  policies: external_exports.array(Policy),
@@ -22448,6 +22629,16 @@ var PolicyBundle = external_exports.object({
22448
22629
  // control plane), so no name resolution stands between the decision and the
22449
22630
  // comparison.
22450
22631
  prohibitedModels: external_exports.array(external_exports.string()).optional(),
22632
+ // What a resolved `redact` becomes on a field the host cannot rewrite, as
22633
+ // the ORGANIZATION would have it. Merged raise-only against the device's own
22634
+ // `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
22635
+ // a control plane can tighten a machine and never loosen one — the same
22636
+ // direction `mergeRaiseOnly` enforces for policies.
22637
+ //
22638
+ // Optional so an older backend, and an older on-disk cache, still parses;
22639
+ // absent leaves the device's own setting in force, which is the behaviour
22640
+ // that predates the field and the safe direction to default.
22641
+ redactFallback: RedactFallback.optional(),
22451
22642
  customKeywords: external_exports.array(external_exports.string()),
22452
22643
  fetchedAt: external_exports.iso.datetime()
22453
22644
  }).meta({ id: "PolicyBundle" });
@@ -22477,11 +22668,6 @@ function severityFloorPolicy(category) {
22477
22668
  const peak = CATEGORY_PEAK_SEVERITY[category];
22478
22669
  return peak === "critical" || peak === "high" ? "warn" : "monitor";
22479
22670
  }
22480
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22481
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22482
- var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22483
- id: "RedactFallback"
22484
- });
22485
22671
  var BUILTIN_POLICY_SPECS = {
22486
22672
  monitor: {
22487
22673
  name: "Monitor",
@@ -22743,7 +22929,7 @@ var VaultConsent = external_exports.object({
22743
22929
  });
22744
22930
 
22745
22931
  // ../../packages/schema/src/zod/local.ts
22746
- var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22932
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
22747
22933
  var RunMode = external_exports.enum(["standalone", "attached"]);
22748
22934
  var ControlPlaneConnection = external_exports.object({
22749
22935
  endpoint: external_exports.string().min(1),
@@ -22762,6 +22948,27 @@ var HistorySyncConsent = external_exports.object({
22762
22948
  payloadVersion: external_exports.number().int().positive(),
22763
22949
  endpoint: external_exports.string()
22764
22950
  });
22951
+ var WebChatCaptureConsent = external_exports.object({
22952
+ acknowledgedAt: external_exports.iso.datetime(),
22953
+ version: external_exports.number().int().positive()
22954
+ });
22955
+ var WebChatResponseCapture = external_exports.enum(["with-findings", "always", "never"]);
22956
+ var WebChatCapture = external_exports.object({
22957
+ responses: WebChatResponseCapture.default("with-findings"),
22958
+ account: external_exports.boolean().default(false),
22959
+ // Absent until granted. Presence alone does not authorize anything — see
22960
+ // isWebChatCaptureConsentValid.
22961
+ consent: WebChatCaptureConsent.optional()
22962
+ });
22963
+ var BODY_RETENTION_DEFAULT_DAYS = 30;
22964
+ var BodyRetention = external_exports.object({
22965
+ enabled: external_exports.boolean().default(false),
22966
+ // Never 0, and the ceiling is a fat-finger guard rather than a policy
22967
+ // limit — `enabled` is the real gate. A low value cannot reach a row the
22968
+ // sync ledger still owes: the sweep's age filter only ever NARROWS a
22969
+ // candidate set that is already bounded by "delivered, or never owed".
22970
+ retainDays: external_exports.number().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
22971
+ }).meta({ id: "BodyRetention" });
22765
22972
  var WorkspaceSettings = external_exports.object({
22766
22973
  specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
22767
22974
  runMode: RunMode.default("standalone"),
@@ -22810,7 +23017,23 @@ var WorkspaceSettings = external_exports.object({
22810
23017
  // carry prompt/reply/tool-output text in `content`; the key name predates
22811
23018
  // both widenings. Absent until granted, and a grant for a different endpoint
22812
23019
  // or an older payload no longer counts.
22813
- historySyncConsent: HistorySyncConsent.optional()
23020
+ historySyncConsent: HistorySyncConsent.optional(),
23021
+ // What the browser extension may record from a web chat, and the grant that
23022
+ // authorizes it. Absent until the user answers: recording something that was
23023
+ // never recorded before is never an assumed grant on upgrade, so the whole
23024
+ // block is optional rather than defaulted in. What an absent block means is
23025
+ // webChatCaptureOf's answer, in one place.
23026
+ //
23027
+ // Enforcement is NOT gated on this. A machine that has never answered still
23028
+ // blocks, redacts and warns on what a user sends; the grant covers what is
23029
+ // written down.
23030
+ webChatCapture: WebChatCapture.optional(),
23031
+ // Local body expiry (see BodyRetention). Off until switched on; expiring a
23032
+ // body never removes the row or its findings.
23033
+ bodyRetention: BodyRetention.default({
23034
+ enabled: false,
23035
+ retainDays: BODY_RETENTION_DEFAULT_DAYS
23036
+ })
22814
23037
  });
22815
23038
 
22816
23039
  // ../../packages/schema/src/zod/managed.ts
@@ -22823,13 +23046,22 @@ var ManagedSettingKey = external_exports.enum([
22823
23046
  "vaultInlineReveal",
22824
23047
  "modelJudgeConsent",
22825
23048
  "dataSharesInPlace",
22826
- "redactFallback"
23049
+ "redactFallback",
23050
+ // Pins the toggle and the day count together — see BodyRetention on why the
23051
+ // two are one unit. An administrator mandating a window wants the count
23052
+ // enforced with it, not one a user can widen while the toggle stays on.
23053
+ "bodyRetention"
22827
23054
  ]).meta({ id: "ManagedSettingKey" });
22828
23055
  function isManagedSettingKey(value) {
22829
23056
  return ManagedSettingKey.safeParse(value).success;
22830
23057
  }
22831
23058
  var ManagedSettingsValues = external_exports.object({
22832
23059
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
23060
+ // `controlPlane` and `bodyRetention` are the two nested values, and both are
23061
+ // plain, non-strict objects: a key under either that this build does not know
23062
+ // is stripped and nothing reports it. The unknown-value split in
23063
+ // ManagedSettings below classifies top-level names only, so it stops at
23064
+ // these boundaries.
22833
23065
  controlPlane: external_exports.object({
22834
23066
  endpoint: external_exports.string().min(1),
22835
23067
  label: external_exports.string().min(1).optional()
@@ -22840,7 +23072,8 @@ var ManagedSettingsValues = external_exports.object({
22840
23072
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22841
23073
  modelJudgeConsent: external_exports.boolean().optional(),
22842
23074
  dataSharesInPlace: external_exports.boolean().optional(),
22843
- redactFallback: RedactFallback.optional()
23075
+ redactFallback: RedactFallback.optional(),
23076
+ bodyRetention: BodyRetention.optional()
22844
23077
  }).meta({ id: "ManagedSettingsValues" });
22845
23078
  var ManagedSettings = external_exports.object({
22846
23079
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22848,7 +23081,21 @@ var ManagedSettings = external_exports.object({
22848
23081
  // decision from a bug. Absent renders as a generic "your organization".
22849
23082
  organization: external_exports.string().min(1).optional(),
22850
23083
  // What the administrator pinned.
22851
- values: ManagedSettingsValues.default({}),
23084
+ //
23085
+ // Parsed as a RECORD rather than as the nested schema, and split below for
23086
+ // the same reason `lockedFields` is parsed as names: a plain `z.object`
23087
+ // drops an unrecognised key and succeeds, so a pin this build does not know
23088
+ // vanished and nothing anywhere said so. A pin with no lock is a supported
23089
+ // shape — it is a DEFAULT the user may still change — so that silence hit
23090
+ // exactly the file an administrator is most likely to write while a fleet
23091
+ // is mid-upgrade.
23092
+ //
23093
+ // Splitting here rather than calling `.strict()`: strict would REFUSE the
23094
+ // file, which is the outcome the lock half already rejected — an older
23095
+ // build then runs entirely unmanaged, every pin and lock gone. A bad KNOWN
23096
+ // value still fails, because the nested schema is re-run over the known
23097
+ // subset and its issues are re-raised on this parse.
23098
+ values: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
22852
23099
  // Which of those the user may not change. A key here with no matching value
22853
23100
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22854
23101
  // the user may still override. The two are separable on purpose.
@@ -22861,17 +23108,31 @@ var ManagedSettings = external_exports.object({
22861
23108
  // the fleets most likely to carry a version skew. A name outside the enum
22862
23109
  // is still never HONOURED: the lockable set stays explicit above.
22863
23110
  lockedFields: external_exports.array(external_exports.string()).default([])
22864
- }).transform(({ lockedFields, ...rest }) => {
23111
+ }).transform(({ lockedFields, values, ...rest }, ctx) => {
22865
23112
  const known = [];
22866
23113
  const unknown2 = [];
22867
23114
  for (const name of lockedFields) {
22868
23115
  if (isManagedSettingKey(name)) known.push(name);
22869
23116
  else unknown2.push(name);
22870
23117
  }
23118
+ const knownValues = /* @__PURE__ */ Object.create(null);
23119
+ const unknownValues = [];
23120
+ for (const [name, value] of Object.entries(values)) {
23121
+ if (Object.hasOwn(ManagedSettingsValues.shape, name)) knownValues[name] = value;
23122
+ else unknownValues.push(name);
23123
+ }
23124
+ const pinned = ManagedSettingsValues.safeParse(knownValues);
23125
+ if (!pinned.success) {
23126
+ for (const issue2 of pinned.error.issues)
23127
+ ctx.addIssue({ ...issue2, path: ["values", ...issue2.path] });
23128
+ return external_exports.NEVER;
23129
+ }
22871
23130
  return {
22872
23131
  ...rest,
23132
+ values: pinned.data,
22873
23133
  lockedFields: known,
22874
- ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
23134
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {},
23135
+ ...unknownValues.length > 0 ? { unknownValueFields: unknownValues } : {}
22875
23136
  };
22876
23137
  }).meta({ id: "ManagedSettings" });
22877
23138
 
@@ -23124,12 +23385,30 @@ var RecommendedActionIdParam = external_exports.object({ id: external_exports.st
23124
23385
  // ../../packages/schema/src/zod/settings-action.ts
23125
23386
  var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23126
23387
  var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
23388
+ var WebChatCaptureConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "WebChatCaptureConsentChoice" });
23127
23389
  var SaveSettingsInput = external_exports.object({
23128
23390
  historicalAccess: external_exports.string(),
23129
23391
  modelJudgeConsent: ModelJudgeConsentChoice,
23130
23392
  historySyncConsent: HistorySyncConsentChoice,
23131
23393
  vaultConsent: external_exports.string(),
23132
- vaultInlineReveal: external_exports.string()
23394
+ vaultInlineReveal: external_exports.string(),
23395
+ webChatCaptureConsent: WebChatCaptureConsentChoice,
23396
+ // Widened to `string` like its neighbours rather than typed as
23397
+ // `RedactFallback`, on this module's own layering rule: shape here, VALUE at
23398
+ // the call site, so the domain check receives the type it was written for.
23399
+ //
23400
+ // NOT because a narrower schema would reject differently. `parseActionInput`
23401
+ // is a `safeParse` wrapper and throws for no field schema, so either spelling
23402
+ // reaches a recoverable `{ ok: false }` and there is no rejected promise to
23403
+ // trade against. The real cost runs the other way and is the part worth
23404
+ // knowing: a value this schema admits and the domain enum then rejects lands
23405
+ // on the action's shared refusal, which names NO field, where a shape
23406
+ // rejection reaches `malformedInput` and names the schema key.
23407
+ redactFallback: external_exports.string(),
23408
+ // Shape only, the way the enum fields above are strings only: the RANGE is
23409
+ // `BodyRetention`'s and the action checks it there, so there is one place
23410
+ // that decides what a legal horizon is rather than two that can drift.
23411
+ bodyRetention: external_exports.object({ enabled: external_exports.boolean(), retainDays: external_exports.number() })
23133
23412
  });
23134
23413
  var AttachInput = external_exports.object({
23135
23414
  endpoint: external_exports.string(),
@@ -23255,13 +23534,103 @@ var SetupHandoffOffer = external_exports.object({
23255
23534
  path: ["liveKeys"]
23256
23535
  });
23257
23536
 
23537
+ // ../../packages/schema/src/zod/web-capture.ts
23538
+ var WebUsageSource = external_exports.enum(["site", "estimated", "none"]);
23539
+ var WebUsage = external_exports.object({
23540
+ inputTokens: external_exports.number().int().nonnegative().optional(),
23541
+ outputTokens: external_exports.number().int().nonnegative().optional(),
23542
+ cacheReadInputTokens: external_exports.number().int().nonnegative().optional(),
23543
+ cacheCreationInputTokens: external_exports.number().int().nonnegative().optional()
23544
+ });
23545
+ var WebToolCall = external_exports.object({
23546
+ toolUseId: external_exports.string().min(1),
23547
+ toolName: external_exports.string().min(1),
23548
+ target: external_exports.string().optional(),
23549
+ isError: external_exports.boolean().optional(),
23550
+ inputSize: external_exports.number().int().nonnegative().optional(),
23551
+ outputSize: external_exports.number().int().nonnegative().optional()
23552
+ });
23553
+ var WebExchange = external_exports.object({
23554
+ messageId: external_exports.string().min(1),
23555
+ startedAt: external_exports.iso.datetime(),
23556
+ model: external_exports.string().optional(),
23557
+ usage: WebUsage.optional(),
23558
+ usageSource: WebUsageSource,
23559
+ stopReason: external_exports.string().optional(),
23560
+ conversationId: external_exports.string().optional(),
23561
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23562
+ toolCalls: external_exports.array(WebToolCall).default([]),
23563
+ // Absent when the adapter recovered no text. Capped by the caller at
23564
+ // RESPONSE_TEXT_MAX_BYTES, so a short capture is never mistaken for a short
23565
+ // reply.
23566
+ responseText: external_exports.string().optional(),
23567
+ // The stored text is short of the reply. It does NOT say which of the two
23568
+ // ceilings on this path cut it: the caller applies its own cap on the raw
23569
+ // bytes it reads off the wire, which can be reached by a stream whose
23570
+ // recovered text stays well under RESPONSE_TEXT_MAX_BYTES, and applies that
23571
+ // one to the text. A reader cannot tell them apart, and nothing downstream
23572
+ // should branch as though it could.
23573
+ truncated: external_exports.boolean().default(false)
23574
+ });
23575
+ var WebEnforcementState = external_exports.enum([
23576
+ "watching",
23577
+ "composer-only",
23578
+ "button-only",
23579
+ "unattached",
23580
+ "unknown"
23581
+ ]);
23582
+ var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
23583
+ var WebCaptureStatus = external_exports.object({
23584
+ patched: external_exports.boolean(),
23585
+ live: external_exports.boolean(),
23586
+ blind: external_exports.boolean(),
23587
+ sendsSeenDom: external_exports.number().int().nonnegative(),
23588
+ exchangesSeenNet: external_exports.number().int().nonnegative(),
23589
+ parseFailures: external_exports.number().int().nonnegative(),
23590
+ unparsedBodies: external_exports.number().int().nonnegative(),
23591
+ // The adapter-declared JSON key paths that were absent from a real payload —
23592
+ // the earliest signal that a site's contract moved.
23593
+ shapeMisses: external_exports.array(external_exports.string()).default([]),
23594
+ // How many `kind: 'conversation'` endpoints the reporting tab's adapter
23595
+ // compiled. Zero means this build declares none for the site, so observing
23596
+ // nothing is the design rather than a fault — the one fact that separates a
23597
+ // site nobody has surveyed yet from one whose contract moved. Defaulted so a
23598
+ // build predating the field is read as declaring nothing rather than refused.
23599
+ conversationEndpoints: external_exports.number().int().nonnegative().default(0),
23600
+ // The document that sent this report is going away. The bridge sets it on
23601
+ // its `pagehide` report and nowhere else.
23602
+ //
23603
+ // A property of the REPORT rather than of capture health, which is why
23604
+ // nothing in `deriveWebCaptureState` reads it and why it stays out of the
23605
+ // bridge's own report signature — a closing tab's last word must not be
23606
+ // suppressed for carrying the same health as the report before it. What
23607
+ // reads it is the per-site fold: a document that said it was unloading stops
23608
+ // voting on the site's state, so the reload the `blind` remediation asks for
23609
+ // can actually clear the verdict it was shown. A document that dies without
23610
+ // sending one is covered by CAPTURE_STATUS_DOCUMENT_QUIET_MS instead.
23611
+ //
23612
+ // Defaulted so a build predating the field reads as a document that never
23613
+ // said it was closing — which keeps it voting, the same as every report that
23614
+ // is not a final one.
23615
+ closed: external_exports.boolean().default(false),
23616
+ // What the DOM enforcement path is doing, which none of the counters above
23617
+ // can say: `sendsSeenDom` rises only once a send has COMPLETED, so a tab
23618
+ // whose watcher never bound reports zero exactly like a tab nobody typed in.
23619
+ // Defaulted to 'unknown' rather than 'watching' so a status from a build
23620
+ // predating the field is not read as reporting a healthy one.
23621
+ enforcement: WebEnforcementState.default("unknown")
23622
+ });
23623
+ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
23624
+ var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
23625
+ var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
23626
+
23258
23627
  // src/provenance.ts
23259
23628
  import { execFileSync } from "child_process";
23260
23629
  var USE_SHELL = process.platform === "win32";
23261
23630
 
23262
23631
  // ../../packages/plugin-sdk/src/config.ts
23263
23632
  import { existsSync as existsSync8 } from "fs";
23264
- import { join as join14 } from "path";
23633
+ import { join as join16 } from "path";
23265
23634
 
23266
23635
  // ../../packages/persistence/src/attached-derived.ts
23267
23636
  import { rmSync } from "fs";
@@ -23299,6 +23668,32 @@ var STALE_PARTIAL_MS = 5 * 6e4;
23299
23668
  var SNAPSHOT_STAGING_SUFFIX = ".partial";
23300
23669
  var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23301
23670
 
23671
+ // ../../packages/persistence/src/internal/sql-functions.ts
23672
+ var utf8 = new TextDecoder();
23673
+
23674
+ // ../../packages/persistence/src/internal/outbox-lane.ts
23675
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23676
+ var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23677
+
23678
+ // ../../packages/persistence/src/sync-failure.ts
23679
+ var SYNC_FAILURE_REASONS = SyncFailureReason.options;
23680
+
23681
+ // ../../packages/persistence/src/repositories/history-sync.ts
23682
+ var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23683
+ var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23684
+ var COUNTED_EVENT_TYPES = [
23685
+ ...STRUCTURAL_EVENT_TYPES,
23686
+ ...OUTBOX_CAPTURE_EVENT_TYPES
23687
+ ];
23688
+ var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23689
+ var COUNTED_SCOPE = `
23690
+ WHERE event_type IN (${COUNTED_TYPE_LIST})
23691
+ AND (
23692
+ event_type IN (${TYPE_LIST})
23693
+ OR synced_at IS NOT NULL
23694
+ OR outbox_owed = 1
23695
+ )`;
23696
+
23302
23697
  // ../../packages/persistence/src/repositories/activity.ts
23303
23698
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
23304
23699
  var DB_EVENT_TYPE_TO_KIND = {
@@ -23352,13 +23747,10 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
23352
23747
  e.tool_name AS tool_name,
23353
23748
  f.audit_event_id AS event_id, e.root_session_id AS session_id,
23354
23749
  e.event_type AS kind, f.finding_key AS finding_key,
23355
- ${latestResolutionStatusSql("f")} AS latest_status`;
23356
-
23357
- // ../../packages/persistence/src/repositories/history-sync.ts
23358
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23359
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23360
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23361
- var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23750
+ ${latestResolutionStatusSql("f")} AS latest_status,
23751
+ e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
23752
+ e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
23753
+ e.outbox_owed AS outbox_owed`;
23362
23754
 
23363
23755
  // ../../packages/persistence/src/repositories/installed-packs.ts
23364
23756
  import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
@@ -23442,9 +23834,11 @@ import { randomUUID as randomUUID10 } from "crypto";
23442
23834
 
23443
23835
  // ../../packages/persistence/src/database.ts
23444
23836
  var CAPTURE_GRAIN = new Set(EventKind.options);
23837
+ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
23445
23838
 
23446
23839
  // ../../packages/persistence/src/egress-wire.ts
23447
23840
  import { createHash as createHash3 } from "crypto";
23841
+ var SLASH = "/".charCodeAt(0);
23448
23842
 
23449
23843
  // ../../packages/persistence/src/finding-key.ts
23450
23844
  import { createHash as createHash4 } from "crypto";
@@ -23455,18 +23849,26 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23455
23849
  import { join as join8 } from "path";
23456
23850
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23457
23851
 
23852
+ // ../../packages/persistence/src/forward-health.ts
23853
+ import { readFileSync as readFileSync7 } from "fs";
23854
+ import { join as join9 } from "path";
23855
+
23458
23856
  // ../../packages/persistence/src/history-backfill.ts
23459
23857
  import { existsSync as existsSync4 } from "fs";
23460
- import { join as join9 } from "path";
23858
+ import { join as join10 } from "path";
23461
23859
 
23462
23860
  // ../../packages/persistence/src/history-preview.ts
23463
23861
  import { existsSync as existsSync5 } from "fs";
23464
- import { join as join10 } from "path";
23862
+ import { join as join11 } from "path";
23465
23863
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23466
23864
 
23865
+ // ../../packages/persistence/src/history-sync-state.ts
23866
+ import { readFileSync as readFileSync8 } from "fs";
23867
+ import { join as join12 } from "path";
23868
+
23467
23869
  // ../../packages/persistence/src/store-symlinks.ts
23468
23870
  import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23469
- import { dirname as dirname3, join as join11, resolve } from "path";
23871
+ import { dirname as dirname3, join as join13, resolve } from "path";
23470
23872
 
23471
23873
  // ../../packages/persistence/src/vault/crypto.ts
23472
23874
  import {
@@ -23480,15 +23882,15 @@ import {
23480
23882
  // ../../packages/persistence/src/vault/key-provider.ts
23481
23883
  import { execFileSync as execFileSync2 } from "child_process";
23482
23884
  import { randomBytes as randomBytes2 } from "crypto";
23483
- import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23484
- import { join as join12 } from "path";
23885
+ import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23886
+ import { join as join14 } from "path";
23485
23887
 
23486
23888
  // ../../packages/persistence/src/vault/vault.ts
23487
23889
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23488
23890
 
23489
23891
  // ../../packages/persistence/src/warn-era-cap.ts
23490
23892
  import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23491
- import { join as join13 } from "path";
23893
+ import { join as join15 } from "path";
23492
23894
 
23493
23895
  // ../../packages/plugin-sdk/src/provider-env.ts
23494
23896
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -23509,9 +23911,9 @@ var providerEnvShape = {
23509
23911
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
23510
23912
 
23511
23913
  // ../../packages/plugin-sdk/src/config-inventory.ts
23512
- import { readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23914
+ import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23513
23915
  import { homedir as homedir2 } from "os";
23514
- import { basename as basename3, join as join16 } from "path";
23916
+ import { basename as basename3, join as join18 } from "path";
23515
23917
 
23516
23918
  // ../../packages/detections/src/egress/registry.ts
23517
23919
  var EXTRACTOR_VERSION = "1";
@@ -24240,6 +24642,56 @@ var CONFIG_POSTURE_RULES = [
24240
24642
  }
24241
24643
  ];
24242
24644
 
24645
+ // ../../packages/detections/src/posture/web-capture-posture.ts
24646
+ var RULE_VERSION2 = "1";
24647
+ var DRIFT_MIN_PARSE_FAILURES = 2;
24648
+ var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
24649
+ "blind",
24650
+ "degraded"
24651
+ ]);
24652
+ var WEB_CAPTURE_DRIFT_RULE = {
24653
+ ruleId: "web-capture-drift",
24654
+ version: RULE_VERSION2,
24655
+ name: "Web chat capture is not reading the site",
24656
+ category: "config",
24657
+ severity: "medium",
24658
+ definition: JSON.stringify({
24659
+ kind: "web-capture-drift",
24660
+ states: [...WEB_CAPTURE_DRIFT_STATES],
24661
+ minParseFailures: DRIFT_MIN_PARSE_FAILURES
24662
+ })
24663
+ };
24664
+ var STATIC_COPY = {
24665
+ active: { headline: "turns are being observed on this site" },
24666
+ unreported: {
24667
+ // Says "recently" rather than "yet": the store read is bounded to
24668
+ // CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
24669
+ // reported for AND one whose last report has aged out. The two are the
24670
+ // same fact to a reader — nobody has confirmed anything lately — and the
24671
+ // copy may not claim the stronger of them.
24672
+ headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
24673
+ },
24674
+ standby: {
24675
+ headline: "this build declares no endpoints for the site, so nothing is observed yet"
24676
+ },
24677
+ unpatched: {
24678
+ // Says what the flags say and no more. `patched` is false both for a tap
24679
+ // that installed and hooked neither transport and for one that never ran
24680
+ // at all — a page reports the same status either way, so the copy may not
24681
+ // assert one of them.
24682
+ headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
24683
+ },
24684
+ idle: { headline: "watching; no turn has been observed yet" },
24685
+ blind: {
24686
+ headline: "messages were sent in the page that the network capture never saw",
24687
+ 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."
24688
+ },
24689
+ degraded: {
24690
+ headline: "the site's payloads no longer carry the fields the extension reads",
24691
+ 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."
24692
+ }
24693
+ };
24694
+
24243
24695
  // ../../packages/detections/src/security/redos-probe.ts
24244
24696
  var BUDGET_MS = 100;
24245
24697
  var EXPONENTIAL_UNITS = [
@@ -24269,8 +24721,8 @@ var CPU_CORROBORATION_SHARE = 0.2;
24269
24721
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24270
24722
 
24271
24723
  // ../../packages/plugin-sdk/src/repo.ts
24272
- import { existsSync as existsSync9, readFileSync as readFileSync8, statSync as statSync6 } from "fs";
24273
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join15, sep as sep2 } from "path";
24724
+ import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
24725
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
24274
24726
 
24275
24727
  // ../../packages/plugin-sdk/src/events.ts
24276
24728
  import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
@@ -24281,8 +24733,8 @@ import { fileURLToPath } from "url";
24281
24733
  import { Worker } from "worker_threads";
24282
24734
 
24283
24735
  // ../../packages/plugin-sdk/src/host-floor.ts
24284
- import { readFileSync as readFileSync11 } from "fs";
24285
- import { join as join18 } from "path";
24736
+ import { readFileSync as readFileSync13 } from "fs";
24737
+ import { join as join20 } from "path";
24286
24738
 
24287
24739
  // ../../packages/plugin-sdk/src/model-governance.ts
24288
24740
  import {
@@ -24290,11 +24742,11 @@ import {
24290
24742
  fstatSync,
24291
24743
  mkdirSync as mkdirSync2,
24292
24744
  openSync as openSync2,
24293
- readFileSync as readFileSync10,
24745
+ readFileSync as readFileSync12,
24294
24746
  readSync,
24295
24747
  writeFileSync as writeFileSync5
24296
24748
  } from "fs";
24297
- import { join as join17 } from "path";
24749
+ import { join as join19 } from "path";
24298
24750
  var TAIL_BYTES = 256 * 1024;
24299
24751
 
24300
24752
  // ../../packages/plugin-sdk/src/host-floor.ts
@@ -24317,15 +24769,15 @@ var HOST_FLOORS = {
24317
24769
 
24318
24770
  // ../../packages/plugin-sdk/src/ignore-layers.ts
24319
24771
  var import_ignore = __toESM(require_ignore(), 1);
24320
- import { readFileSync as readFileSync12 } from "fs";
24321
- import { join as join19 } from "path";
24772
+ import { readFileSync as readFileSync14 } from "fs";
24773
+ import { join as join21 } from "path";
24322
24774
 
24323
24775
  // ../../packages/plugin-sdk/src/inventory-resolver.ts
24324
24776
  import { arch, hostname as hostname4, platform, release } from "os";
24325
24777
 
24326
24778
  // ../../packages/plugin-sdk/src/nudge.ts
24327
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
24328
- import { join as join20 } from "path";
24779
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "fs";
24780
+ import { join as join22 } from "path";
24329
24781
 
24330
24782
  // ../../packages/plugin-sdk/src/paths.ts
24331
24783
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
@@ -24333,7 +24785,7 @@ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24333
24785
 
24334
24786
  // ../../packages/plugin-sdk/src/project-files.ts
24335
24787
  import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
24336
- import { basename as basename5, join as join21 } from "path";
24788
+ import { basename as basename5, join as join23 } from "path";
24337
24789
 
24338
24790
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24339
24791
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24369,11 +24821,11 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24369
24821
 
24370
24822
  // ../../packages/plugin-sdk/src/throttle.ts
24371
24823
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24372
- import { join as join22 } from "path";
24824
+ import { join as join24 } from "path";
24373
24825
 
24374
24826
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
24375
24827
  import { writeFileSync as writeFileSync8 } from "fs";
24376
- import { join as join23 } from "path";
24828
+ import { join as join25 } from "path";
24377
24829
 
24378
24830
  // ../../packages/setup-wizard/src/triage/merge.ts
24379
24831
  var RANK = Object.fromEntries(
@@ -24381,9 +24833,9 @@ var RANK = Object.fromEntries(
24381
24833
  );
24382
24834
 
24383
24835
  // ../../packages/setup-wizard/src/triage/plan-file.ts
24384
- import { mkdtempSync, readFileSync as readFileSync14, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24836
+ import { mkdtempSync, readFileSync as readFileSync16, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24385
24837
  import { tmpdir } from "os";
24386
- import { basename as basename6, dirname as dirname6, join as join24 } from "path";
24838
+ import { basename as basename6, dirname as dirname6, join as join26 } from "path";
24387
24839
  var SuppressionEntrySchema = external_exports.object({
24388
24840
  ruleId: external_exports.string(),
24389
24841
  category: DetectionCategory,
@@ -24526,7 +24978,7 @@ function buildIntroCard(manifest2, verified) {
24526
24978
  var manifestPath = process.argv[2];
24527
24979
  var manifest = {};
24528
24980
  try {
24529
- manifest = JSON.parse(readFileSync15(manifestPath ?? "", "utf8"));
24981
+ manifest = JSON.parse(readFileSync17(manifestPath ?? "", "utf8"));
24530
24982
  } catch {
24531
24983
  }
24532
24984
  process.stdout.write(show(fenced(buildIntroCard(manifest))));