@akasecurity/ai-tc-claude-code 0.9.9 → 0.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -492,8 +492,8 @@ var require_ignore = __commonJS({
492
492
  });
493
493
 
494
494
  // ../../packages/plugin-sdk/src/config.ts
495
- import { existsSync as existsSync7 } from "fs";
496
- import { join as join12 } from "path";
495
+ import { existsSync as existsSync8 } from "fs";
496
+ import { join as join14 } from "path";
497
497
 
498
498
  // ../../packages/persistence/src/attached-derived.ts
499
499
  import { rmSync } from "fs";
@@ -20385,13 +20385,11 @@ var FindingGroup = external_exports.object({
20385
20385
  latestDetectedAt: external_exports.iso.datetime(),
20386
20386
  instances: external_exports.array(FindingInstance),
20387
20387
  // Derived from instances' statuses with open-dominates precedence (see
20388
- // buildFindingGroups). Undefined only when no instance carries a status.
20388
+ // foldGroupStatus). Undefined only when no instance carries a status.
20389
20389
  status: FindingStatus.optional(),
20390
- // The distinct people across the WHOLE group, not just the `instances`
20391
- // preview — from the store's whole-group aggregate when it supplies one,
20392
- // else folded from the rows (see buildFindingGroups). Undefined when no
20393
- // instance carries a user, or when the store supplied whole-group folds
20394
- // without one.
20390
+ // The distinct people across the WHOLE group, not just the instances
20391
+ // carried here. Undefined when no instance carries a user, or when the
20392
+ // store supplied whole-group folds without one.
20395
20393
  users: external_exports.array(FindingUser).optional()
20396
20394
  }).meta({ id: "FindingGroup" });
20397
20395
  var FindingStats = external_exports.object({
@@ -20420,20 +20418,30 @@ var FindingFacets = external_exports.object({
20420
20418
  // counted under no value.
20421
20419
  status: external_exports.array(FindingFacetItem),
20422
20420
  // Host tool (attributes.tool_name). Present only on the instance-level
20423
- // reads, which can filter by it; the grouped read omits the dimension
20421
+ // reads, which can filter by it; the type-level read omits the dimension
20424
20422
  // because a group spans tools.
20425
20423
  tool: external_exports.array(FindingFacetItem).optional()
20426
20424
  }).meta({ id: "FindingFacets" });
20427
- var ListGroupedFindingsQuery = external_exports.object({
20425
+ var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20426
+ id: "FindingTypeSummary"
20427
+ });
20428
+ var MAX_FINDING_TYPES_LIMIT = 100;
20429
+ var ListFindingTypesQuery = external_exports.object({
20428
20430
  // NOTE: severity filters by Severity (critical/high/medium/low), not by
20429
- // FindingAction.
20431
+ // FindingAction. It narrows TYPES: a type's severity is the one its newest
20432
+ // firing version carries, and this list pages types.
20433
+ //
20434
+ // That is NOT a claim the findings of a type share it. A rule can hold several
20435
+ // definition versions at different severities, so a type kept by this filter
20436
+ // can hold findings that individually do not match — see totals.findings on
20437
+ // ListFindingTypesResponse, which counts them all.
20430
20438
  severity: external_exports.array(Severity).optional(),
20431
20439
  subtype: external_exports.array(external_exports.string()).optional(),
20432
20440
  provider: external_exports.array(FindingProvider).optional(),
20433
20441
  action: external_exports.array(FindingAction).optional(),
20434
- // Matches a group's DERIVED status (see FindingGroup.status), not its
20435
- // individual instances' — so a filtered group's Status column always reads
20436
- // one of the requested values.
20442
+ // Matches a type's DERIVED status (see FindingGroup.status), not its
20443
+ // individual findings' — so a filtered row's status always reads one of the
20444
+ // requested values.
20437
20445
  status: external_exports.array(FindingStatus).optional(),
20438
20446
  q: external_exports.string().optional(),
20439
20447
  // Scope to findings whose event carries this session id (the Activity page's
@@ -20443,23 +20451,37 @@ var ListGroupedFindingsQuery = external_exports.object({
20443
20451
  // from a time-scoped page (Activity's range) can carry that scope. Absent
20444
20452
  // means all time — this list has no default window.
20445
20453
  from: external_exports.iso.datetime().optional(),
20446
- // A group or instance id that must appear in the page even when the cursor
20447
- // has already advanced past its sort position. This is what keeps the
20448
- // Findings page's one-shot ?finding= deep link resolving once the list
20449
- // paginates: the target group is appended out of sort order rather than
20450
- // scanning forward for it. Never affects totals, facets or the cursor.
20454
+ // A RULE id that must appear in the page even when the cursor has already
20455
+ // advanced past its sort position. This is what keeps the selected type
20456
+ // visible in the list once it paginates: the target is appended out of sort
20457
+ // order rather than scanned forward for. Never affects totals, facets or the
20458
+ // cursor. Unlike the grouped read this replaces, it names a rule only — an
20459
+ // instance id is resolved by `findingInstance`, which is a primary-key seek
20460
+ // and so is not bounded by what any page happens to hold.
20451
20461
  includeId: external_exports.string().optional(),
20452
- groupBy: external_exports.literal("type").optional(),
20453
- limit: external_exports.coerce.number().int().min(1).max(100).optional(),
20462
+ limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
20454
20463
  cursor: external_exports.string().optional()
20455
20464
  });
20456
- var ListGroupedFindingsResponse = external_exports.object({
20465
+ var ListFindingTypesResponse = external_exports.object({
20457
20466
  totals: external_exports.object({
20467
+ // Findings belonging to the matching TYPES — not findings that each match
20468
+ // the filters. The filters here select types, so a type that survives
20469
+ // contributes its whole instanceCount.
20470
+ //
20471
+ // `status` is the one exception, narrowed per finding via
20472
+ // countInstancesByStatus. `severity`, `provider` and `action` are not, so
20473
+ // this can exceed what the instance read reports for the same filters: a
20474
+ // rule whose severity moved between versions is kept on its newest and
20475
+ // still counts its older findings. Narrowing the other three needs
20476
+ // per-dimension counts the aggregate does not carry today.
20458
20477
  findings: external_exports.number().int().nonnegative(),
20459
- groups: external_exports.number().int().nonnegative()
20478
+ // Counts TYPES, which is the unit this read pages. The instance read's
20479
+ // own totals count findings; the two deliberately answer different
20480
+ // questions and are never summed.
20481
+ types: external_exports.number().int().nonnegative()
20460
20482
  }),
20461
20483
  facets: FindingFacets,
20462
- items: external_exports.array(FindingGroup),
20484
+ items: external_exports.array(FindingTypeSummary),
20463
20485
  nextCursor: external_exports.string().nullable(),
20464
20486
  // Present only on session-scoped queries (`sessionId` set): per ruleId, how
20465
20487
  // many times that rule fired in the session's persisted transcript. Findings
@@ -20467,7 +20489,7 @@ var ListGroupedFindingsResponse = external_exports.object({
20467
20489
  // every firing, so the two numbers legitimately differ — this map lets a
20468
20490
  // session-scoped view show both.
20469
20491
  sessionFirings: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional()
20470
- }).meta({ id: "ListGroupedFindingsResponse" });
20492
+ }).meta({ id: "ListFindingTypesResponse" });
20471
20493
  var ApplyFindingActionRequest = external_exports.object({
20472
20494
  // 'quarantined' is system-assigned (see FindingAction) — clients may not set
20473
20495
  // it, so it is excluded from the request contract. The mapping helper
@@ -20496,12 +20518,13 @@ var FindingInstanceDetail = FindingInstance.extend({
20496
20518
  var MAX_FLAT_FINDINGS_LIMIT = 200;
20497
20519
  var ListFindingInstancesQuery = external_exports.object({
20498
20520
  severity: external_exports.array(Severity).optional(),
20499
- // Rule ids, the same vocabulary the grouped list's `subtype` carries.
20521
+ // Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
20522
+ // ONE of them is how the master/detail view scopes its right-hand panel.
20500
20523
  subtype: external_exports.array(external_exports.string()).optional(),
20501
20524
  provider: external_exports.array(FindingProvider).optional(),
20502
20525
  action: external_exports.array(FindingAction).optional(),
20503
20526
  // Matches each instance's OWN derived status (deriveFindingStatus), unlike
20504
- // the grouped query's group-level fold.
20527
+ // the types query's type-level fold.
20505
20528
  status: external_exports.array(FindingStatus).optional(),
20506
20529
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20507
20530
  // where the free-text `q` can only match the rendered "via Bash" label.
@@ -20518,37 +20541,46 @@ var ListFindingInstancesQuery = external_exports.object({
20518
20541
  });
20519
20542
  var ListFindingInstancesResponse = external_exports.object({
20520
20543
  // Instances matching the filters across the whole scope, not just this
20521
- // page — cursor-independent, like the grouped list's totals.
20544
+ // page — cursor-independent, like the types list's totals.
20522
20545
  totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
20523
- // Counts in INSTANCES here, where the grouped response counts groups. Each
20546
+ // Counts in INSTANCES here, where the types response counts types. Each
20524
20547
  // dimension still excludes its own filter.
20525
20548
  facets: FindingFacets,
20526
20549
  items: external_exports.array(FindingInstanceDetail),
20527
20550
  nextCursor: external_exports.string().nullable()
20528
20551
  }).meta({ id: "ListFindingInstancesResponse" });
20529
- var FindingLocationFile = external_exports.object({
20530
- // Empty when the instances carried no file path (a prompt or a tool call
20531
- // with no file attribution).
20532
- file: external_exports.string(),
20533
- instanceCount: external_exports.number().int().nonnegative(),
20534
- maxSeverity: Severity,
20535
- latestDetectedAt: external_exports.iso.datetime(),
20536
- // Folded from the instances' derived statuses with the same
20537
- // open-dominates precedence a group uses.
20538
- status: FindingStatus.optional(),
20539
- // Distinct rules seen at this location, capped — the row shows them as
20540
- // chips, and the count is what conveys scale.
20541
- ruleIds: external_exports.array(external_exports.string())
20542
- }).meta({ id: "FindingLocationFile" });
20543
- var FindingLocationRepo = external_exports.object({
20552
+ var FindingLocationSummary = external_exports.object({
20553
+ // Opaque, stable, minted from the pair by encodeLocationId. It exists
20554
+ // because a location's identity is two values and a URL param carries one:
20555
+ // `?loc=` names a location the way `?rule=` names a type. Only ever compared
20556
+ // for EQUALITY — the page's selection check, this read's `includeId`, the
20557
+ // client's page dedupe — never decoded, and never a sort key.
20558
+ id: external_exports.string(),
20544
20559
  /** Empty when the instances carried no repo attribute. */
20545
20560
  repo: external_exports.string(),
20561
+ // Empty when the instances carried no file path (a prompt, or a tool call
20562
+ // with no file attribution). Both halves empty is a real location — usually
20563
+ // the largest one in a store — and is selectable like any other.
20564
+ file: external_exports.string(),
20546
20565
  instanceCount: external_exports.number().int().nonnegative(),
20566
+ // The WORST severity present, not the first row's. It is this list's primary
20567
+ // sort key, so it is also what explains why a row is where it is, and it is
20568
+ // how a reader decides what to open without opening everything.
20547
20569
  maxSeverity: Severity,
20548
20570
  latestDetectedAt: external_exports.iso.datetime(),
20571
+ // Folded from the instances' derived statuses with the same open-dominates
20572
+ // precedence a group uses, so it answers "is anything left to do here" and
20573
+ // not much more: a location holding 1 open among 40 resolved reads like one
20574
+ // holding 40 open. That loss is accepted — the panel beside this list
20575
+ // carries each finding's own status, and instanceCount sits next to the
20576
+ // badge.
20549
20577
  status: FindingStatus.optional(),
20550
- files: external_exports.array(FindingLocationFile)
20551
- }).meta({ id: "FindingLocationRepo" });
20578
+ // Every distinct rule seen at this location, UNCAPPED — so the length is a
20579
+ // tally rather than a sample and a row can say how many there are. Bounded
20580
+ // by the ruleset, not by the store. The view bounds what it DISPLAYS.
20581
+ ruleIds: external_exports.array(external_exports.string())
20582
+ }).meta({ id: "FindingLocationSummary" });
20583
+ var MAX_FINDING_LOCATIONS_LIMIT = 100;
20552
20584
  var ListFindingLocationsQuery = external_exports.object({
20553
20585
  severity: external_exports.array(Severity).optional(),
20554
20586
  subtype: external_exports.array(external_exports.string()).optional(),
@@ -20561,18 +20593,42 @@ var ListFindingLocationsQuery = external_exports.object({
20561
20593
  q: external_exports.string().optional(),
20562
20594
  sessionId: external_exports.string().optional(),
20563
20595
  from: external_exports.iso.datetime().optional(),
20564
- limit: external_exports.coerce.number().int().min(1).max(500).optional()
20596
+ // A LOCATION id (see FindingLocationSummary.id) that must appear in the page
20597
+ // even when the cursor has already advanced past its sort position — the
20598
+ // counterpart of ListFindingTypesQuery.includeId, and needed far more often
20599
+ // here. Selecting a row pushes the URL, which re-renders the server and resets
20600
+ // the client's page cache to page 0; with distinct (repo, file) pairs running
20601
+ // into the thousands, a selection sitting off page 0 is the ordinary case
20602
+ // rather than a deep-link corner. Never affects totals, facets or the cursor.
20603
+ includeId: external_exports.string().optional(),
20604
+ limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
20605
+ cursor: external_exports.string().optional()
20565
20606
  });
20566
20607
  var ListFindingLocationsResponse = external_exports.object({
20567
20608
  totals: external_exports.object({
20609
+ // Findings matching the filters across the whole scope. Unlike the types
20610
+ // read's same-named field this needs no caveat: the filters here narrow
20611
+ // per finding, so this is the sum of every row's instanceCount.
20568
20612
  findings: external_exports.number().int().nonnegative(),
20569
- repos: external_exports.number().int().nonnegative(),
20570
- files: external_exports.number().int().nonnegative()
20613
+ // Counts LOCATIONS, the unit this read pages — the number the paginator
20614
+ // states. The facets beside it count FINDINGS (see below); a surface
20615
+ // showing both says which is which.
20616
+ locations: external_exports.number().int().nonnegative()
20571
20617
  }),
20572
- /** Sorted by max severity, then most recent. */
20573
- items: external_exports.array(FindingLocationRepo),
20574
- /** Whether `limit` truncated the repo list. */
20575
- hasMore: external_exports.boolean()
20618
+ // Counts in FINDINGS, where the types response counts types, each dimension
20619
+ // still excluding its own filter. Deliberately not locations: counting those
20620
+ // needs a set of location keys per dimension per value — memory tracking the
20621
+ // store times the vocabulary, in a read whose scan promises flat memory —
20622
+ // and the cheap per-location version is not an approximation but WRONG. A
20623
+ // location holding {claudecode, block} and {codex, warn} would survive
20624
+ // provider=claudecode AND action=warn, under which no single finding
20625
+ // matches, so the facet would contradict the instanceCount this whole view
20626
+ // rests on. Findings also keep the toolbar in the same unit as the page
20627
+ // tally and the panel it sits above.
20628
+ facets: FindingFacets,
20629
+ /** Sorted by max severity, then most recent, then (repo, file). */
20630
+ items: external_exports.array(FindingLocationSummary),
20631
+ nextCursor: external_exports.string().nullable()
20576
20632
  }).meta({ id: "ListFindingLocationsResponse" });
20577
20633
 
20578
20634
  // ../../packages/schema/src/zod/meta.ts
@@ -21737,6 +21793,14 @@ var ControlPlaneErrorBody = external_exports.object({
21737
21793
  message: external_exports.string().optional()
21738
21794
  }).optional()
21739
21795
  });
21796
+ var RemoteFailureKind = external_exports.enum([
21797
+ "unauthorized",
21798
+ "forbidden",
21799
+ "route-absent",
21800
+ "invalid-request",
21801
+ "rejected",
21802
+ "unreachable"
21803
+ ]);
21740
21804
  var AttachDeviceRequest = external_exports.object({
21741
21805
  // This machine's own continuity id, so re-attaching ROTATES the credential
21742
21806
  // on one machine record instead of producing a second one. Client-minted
@@ -21798,6 +21862,26 @@ var AttachTokenResponse = external_exports.union([
21798
21862
  AttachTokenExpired,
21799
21863
  external_exports.object({ status: printable(64) })
21800
21864
  ]);
21865
+ var DeviceCommandKind = external_exports.enum(["shares_rescan"]);
21866
+ var DeviceCommand = external_exports.object({
21867
+ id: printable(128).min(1),
21868
+ kind: DeviceCommandKind,
21869
+ issuedAt: printable(64).min(1),
21870
+ expiresAt: printable(64).min(1)
21871
+ }).strict();
21872
+ var DeviceCommandPollResponse = external_exports.object({ command: DeviceCommand.nullable() });
21873
+ var DeviceCommandFailureReason = external_exports.enum(["scan_failed", "no_projects", "expired"]);
21874
+ var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
21875
+ external_exports.object({
21876
+ outcome: external_exports.literal("reported"),
21877
+ projectsScanned: external_exports.number().int().nonnegative()
21878
+ }).strict(),
21879
+ external_exports.object({
21880
+ outcome: external_exports.literal("failed"),
21881
+ reason: DeviceCommandFailureReason,
21882
+ projectsScanned: external_exports.number().int().nonnegative()
21883
+ }).strict()
21884
+ ]);
21801
21885
 
21802
21886
  // ../../packages/schema/src/zod/registry.ts
21803
21887
  var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
@@ -21964,7 +22048,7 @@ var PackManifest = external_exports.object({
21964
22048
  }).meta({ id: "PackManifest" });
21965
22049
 
21966
22050
  // ../../packages/schema/src/zod/detection.ts
21967
- var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
22051
+ var OriginEnum = external_exports.enum(["library", "custom"]).meta({ id: "OriginEnum" });
21968
22052
  var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
21969
22053
  var LibraryStateEnum = external_exports.enum(["new", "imported", "update"]).meta({ id: "LibraryStateEnum" });
21970
22054
  var DetectionCounts = external_exports.object({
@@ -22159,8 +22243,9 @@ var Event = external_exports.object({
22159
22243
  metadata: EventMetadata.optional()
22160
22244
  }).meta({ id: "Event" });
22161
22245
  var IngestEvent = Event.meta({ id: "IngestEvent" });
22246
+ var INGEST_BATCH_MAX = 100;
22162
22247
  var IngestBatch = external_exports.object({
22163
- events: external_exports.array(IngestEvent).min(1).max(100),
22248
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
22164
22249
  // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
22165
22250
  // additionally rejects any event whose contentHash the store has already
22166
22251
  // recorded — for re-runnable bulk ingest (worktree scan, transcript
@@ -22286,6 +22371,230 @@ var PatchInstalledPackRequest = external_exports.object({
22286
22371
  message: "At least one field must be provided"
22287
22372
  }).meta({ id: "PatchInstalledPackRequest" });
22288
22373
 
22374
+ // ../../packages/schema/src/zod/policy.ts
22375
+ var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22376
+ var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22377
+ var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22378
+ var PolicyProvenance = external_exports.enum(["builtin", "authored"]).meta({ id: "PolicyProvenance" });
22379
+ var Policy = external_exports.object({
22380
+ id: external_exports.guid(),
22381
+ scope: PolicyScope,
22382
+ target: PolicyTarget,
22383
+ action: ActionTaken,
22384
+ enabled: external_exports.boolean().default(true),
22385
+ customKeywords: external_exports.array(external_exports.string()).optional(),
22386
+ // Display name — optional so older policy rows without name still parse.
22387
+ // Added for the findings API (policy.name column migration).
22388
+ name: external_exports.string().optional(),
22389
+ // Whether an AUTHORED policy governs this row's target — not a claim about
22390
+ // which row this is. A producer that collapses several rows onto one target
22391
+ // must carry the marker onto whichever row survives, or the collapse decides
22392
+ // the answer; a survivor may therefore be a built-in expansion still marked
22393
+ // 'authored' because an authored sibling targeted the same thing.
22394
+ // Optional so an older producer — and an older on-disk cache — still parses;
22395
+ // absent reads as 'builtin', which is the behaviour that predates the field.
22396
+ //
22397
+ // Deliberately NOT `kind`/PolicyKind: that name and that enum answer which
22398
+ // built-in archetype catalog entry a policy is, which every catalog surface
22399
+ // reads and which a caller may state. This one is a statement the PRODUCER
22400
+ // of a bundle makes about a row, and only the bundle builder ever stamps it
22401
+ // — the CRUD routes neither accept nor set it.
22402
+ //
22403
+ // A device consumes this in exactly one direction: an 'authored' policy
22404
+ // arriving from a control plane marks the rules it targets as not
22405
+ // locally re-assignable. That can only ever ADD a refusal, never relax one,
22406
+ // which is what makes it safe to honour from an unsigned cache — the same
22407
+ // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22408
+ provenance: PolicyProvenance.optional()
22409
+ }).meta({ id: "Policy" });
22410
+ var PolicyBundle = external_exports.object({
22411
+ version: external_exports.string(),
22412
+ policies: external_exports.array(Policy),
22413
+ // Rules from the installed marketplace packs (snapshotted by the
22414
+ // control plane). The plugin registers these in addition to its bundled
22415
+ // packs. Optional so older backends — and older on-disk caches — that omit
22416
+ // the field still parse; consumers read `bundle.rules ?? []`.
22417
+ rules: external_exports.array(Rule).optional(),
22418
+ // When true, `rules` IS the complete effective ruleset and the runtime must
22419
+ // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22420
+ // after reading the user's installed snapshot (installed_packs, enabled
22421
+ // packs only), which is how detection updates stay manual: new bundled
22422
+ // rules run only after the user applies the pack update. Absent/false keeps
22423
+ // the historical composition (bundled packs + rules) — older caches.
22424
+ rulesComplete: external_exports.boolean().optional(),
22425
+ // Active detection exceptions, evaluation subset only (see
22426
+ // ExceptionBundleEntry). Optional so older bundle producers — and older
22427
+ // on-disk caches — that omit the field still parse; consumers read
22428
+ // `bundle.exceptions ?? []`.
22429
+ exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22430
+ // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22431
+ // A second axis over the same `redact` action, carried beside the policies
22432
+ // rather than on them: nothing writes ruleId-targeted policies to disk, so
22433
+ // widening Policy itself would change a persisted shape to express something
22434
+ // only the in-memory bundle needs. Optional so an older producer — or an
22435
+ // older on-disk cache — still parses; consumers read `?? []` and get the
22436
+ // pre-existing one-way behaviour, which is the safe direction to default.
22437
+ reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22438
+ // Installed pack version, keyed by ruleId, for rules in `rules` that came
22439
+ // from a versioned installed pack. Optional so older backends — and older
22440
+ // on-disk caches — that omit the field still parse; consumers fall back to
22441
+ // the rule's own spec version. NOT the bundle version above — see
22442
+ // installedRuleset's ruleVersions for the source of truth.
22443
+ ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22444
+ // Model ids (the raw `model` string a harness reports, e.g.
22445
+ // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22446
+ // a session onto one (PreModelSwitch) and refuses a turn that would run on
22447
+ // one (UserPromptSubmit). Optional so an older backend — and an older
22448
+ // on-disk cache — still parses; consumers read `?? []`, which is the
22449
+ // unenforced behaviour that predates this field and the safe direction to
22450
+ // default.
22451
+ //
22452
+ // Ids, not display names: the governance decision is keyed on the exact
22453
+ // string the harness reports (`model_status_override.versionId` in the
22454
+ // control plane), so no name resolution stands between the decision and the
22455
+ // comparison.
22456
+ prohibitedModels: external_exports.array(external_exports.string()).optional(),
22457
+ customKeywords: external_exports.array(external_exports.string()),
22458
+ fetchedAt: external_exports.iso.datetime()
22459
+ }).meta({ id: "PolicyBundle" });
22460
+ var POLICY_BUNDLE_SHAPE_ID = [
22461
+ ...Object.keys(PolicyBundle.shape),
22462
+ ...Object.keys(Policy.shape).map((key) => `policies.${key}`),
22463
+ ...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
22464
+ ...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
22465
+ ].sort().join(",");
22466
+ var OBSERVE_ONLY_CATEGORIES = ["config"];
22467
+ var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22468
+ var CATEGORY_PEAK_SEVERITY = {
22469
+ secret: "critical",
22470
+ financial: "critical",
22471
+ // core-financial/credit-card
22472
+ code_flaw: "critical",
22473
+ pii: "high",
22474
+ phi: "high",
22475
+ custom: "high",
22476
+ // user-defined; conservative
22477
+ code_context: "low",
22478
+ config: "low"
22479
+ // observe-only; floors to monitor regardless
22480
+ };
22481
+ function severityFloorPolicy(category) {
22482
+ if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22483
+ const peak = CATEGORY_PEAK_SEVERITY[category];
22484
+ return peak === "critical" || peak === "high" ? "warn" : "monitor";
22485
+ }
22486
+ function severityFloorPosture() {
22487
+ const out = {};
22488
+ for (const c of DetectionCategory.options) out[c] = severityFloorPolicy(c);
22489
+ return out;
22490
+ }
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
+ var BUILTIN_POLICY_SPECS = {
22497
+ monitor: {
22498
+ name: "Monitor",
22499
+ action: "log",
22500
+ reversible: false,
22501
+ description: "Log every match for audit. The request is allowed through untouched."
22502
+ },
22503
+ warn: {
22504
+ name: "Warn",
22505
+ action: "warn",
22506
+ reversible: false,
22507
+ description: "Allow the request, but warn the user inline before it is sent."
22508
+ },
22509
+ redact: {
22510
+ name: "Redact",
22511
+ action: "redact",
22512
+ reversible: false,
22513
+ description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22514
+ },
22515
+ vault: {
22516
+ name: "Redact & Vault",
22517
+ action: "redact",
22518
+ reversible: true,
22519
+ description: "Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."
22520
+ },
22521
+ block: {
22522
+ name: "Block",
22523
+ action: "block",
22524
+ reversible: false,
22525
+ description: "Refuse the request entirely whenever any rule in this detection matches."
22526
+ }
22527
+ };
22528
+ function builtinPolicyToAction(id) {
22529
+ return BUILTIN_POLICY_SPECS[id].action;
22530
+ }
22531
+ var PALETTE_WEAKEST_FIRST = [
22532
+ ...new Set(KNOWN_BUILTIN_IDS.map(builtinPolicyToAction))
22533
+ ];
22534
+ var BELOW_PALETTE = ACTION_TAKEN_KEYS.filter(
22535
+ (action) => !PALETTE_WEAKEST_FIRST.includes(action)
22536
+ );
22537
+ var ACTION_STRENGTH_ORDER = [
22538
+ ...BELOW_PALETTE,
22539
+ ...PALETTE_WEAKEST_FIRST
22540
+ ];
22541
+ var PackPolicyFloor = external_exports.object({
22542
+ /**
22543
+ * The weakest archetype the device may assign. Stated as a BuiltinPolicyId
22544
+ * rather than a raw ActionTaken because that is the vocabulary the user
22545
+ * picks from — a floor a UI cannot name is one it cannot explain.
22546
+ */
22547
+ floor: BuiltinPolicyId,
22548
+ /**
22549
+ * True when the organization AUTHORED a policy governing this pack rather
22550
+ * than stating a minimum: it gave the answer, so the pack is not
22551
+ * re-assignable locally in either direction.
22552
+ */
22553
+ locked: external_exports.boolean()
22554
+ }).describe("PackPolicyFloor");
22555
+ var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22556
+ (id) => !BUILTIN_POLICY_SPECS[id].reversible
22557
+ );
22558
+ var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22559
+ (id) => BUILTIN_POLICY_SPECS[id].reversible
22560
+ );
22561
+ var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22562
+ var DEFAULT_ACTIONS = Object.fromEntries(
22563
+ DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22564
+ );
22565
+ var BUILTIN_POLICIES = Object.fromEntries(
22566
+ KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22567
+ );
22568
+ var UsedByItem = external_exports.object({
22569
+ id: external_exports.string(),
22570
+ name: external_exports.string(),
22571
+ ruleCount: external_exports.number().int().nonnegative(),
22572
+ enabled: external_exports.boolean()
22573
+ }).meta({ id: "UsedByItem" });
22574
+ var PolicyListItem = external_exports.object({
22575
+ id: external_exports.string(),
22576
+ kind: PolicyKind,
22577
+ name: external_exports.string(),
22578
+ enabled: external_exports.boolean(),
22579
+ usedByCount: external_exports.number().int().nonnegative()
22580
+ }).meta({ id: "PolicyListItem" });
22581
+ var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22582
+ var PolicyDetail = external_exports.object({
22583
+ specVersion: external_exports.literal(1),
22584
+ id: external_exports.string(),
22585
+ kind: PolicyKind,
22586
+ name: external_exports.string(),
22587
+ enabled: external_exports.boolean(),
22588
+ description: external_exports.string(),
22589
+ usedBy: external_exports.array(UsedByItem)
22590
+ }).meta({ id: "PolicyDetail" });
22591
+ var PolicyStatsResponse = external_exports.object({
22592
+ policies: external_exports.number().int().nonnegative(),
22593
+ builtin: external_exports.number().int().nonnegative(),
22594
+ custom: external_exports.number().int().nonnegative(),
22595
+ detectionsGoverned: external_exports.number().int().nonnegative()
22596
+ }).meta({ id: "PolicyStatsResponse" });
22597
+
22289
22598
  // ../../packages/schema/src/zod/vault.ts
22290
22599
  var CATEGORY_ALTERNATION = DetectionCategory.options.join("|");
22291
22600
  var POINTER_TOKEN_PATTERN = new RegExp(
@@ -22322,6 +22631,14 @@ var VaultEntry = external_exports.object({
22322
22631
  // How many times this value has been detected on this machine — the reuse
22323
22632
  // signal the vault dashboard reads. Distinct from VaultDeref.pointerCount.
22324
22633
  occurrenceCount: external_exports.number().int().nonnegative(),
22634
+ // True when a PERSON asked for this value to be replaced — the surfaced-
22635
+ // secrets strike — rather than a pack enforcing its assignment. One value is
22636
+ // one row however many paths vault it, so this is what tells a policy sweep
22637
+ // that the row carries somebody's own instruction and not just an assignment
22638
+ // that has since been lowered. STICKY and MONOTONIC: a later automatic
22639
+ // vaulting of the same value must never clear it — what the user said about
22640
+ // the value does not expire.
22641
+ userAuthorized: external_exports.boolean(),
22325
22642
  firstSeen: external_exports.string(),
22326
22643
  lastSeen: external_exports.string()
22327
22644
  });
@@ -22437,7 +22754,7 @@ var VaultConsent = external_exports.object({
22437
22754
  });
22438
22755
 
22439
22756
  // ../../packages/schema/src/zod/local.ts
22440
- var WORKSPACE_SETTINGS_SPEC_VERSION = 6;
22757
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22441
22758
  var RunMode = external_exports.enum(["standalone", "attached"]);
22442
22759
  var ControlPlaneConnection = external_exports.object({
22443
22760
  endpoint: external_exports.string().min(1),
@@ -22478,6 +22795,19 @@ var WorkspaceSettings = external_exports.object({
22478
22795
  vaultKeyCustody: VaultKeyCustody.default("file"),
22479
22796
  // How a pointer renders in assistant prose on screen (see VaultInlineReveal).
22480
22797
  vaultInlineReveal: VaultInlineReveal.default("masked"),
22798
+ // What a `redact` policy degrades to on a FIELD the host cannot rewrite in
22799
+ // place. Not a handling policy: the policy has already resolved to redact,
22800
+ // and this only says what happens when the host offers no channel to carry it
22801
+ // out — Antigravity's PreToolUse has no updatedInput at all, and Codex and
22802
+ // Claude Code decline to mask a field that EXECUTES because masking would
22803
+ // change what runs. Per FIELD rather than per host, so a host that can
22804
+ // rewrite some inputs keeps true redaction on those.
22805
+ //
22806
+ // Spelled in the built-in policy vocabulary rather than as a fresh enum, so
22807
+ // an attached machine's merge is `strongerAction` over the one action ladder
22808
+ // and no second rank order exists to drift from it. 'deny' is a host wire
22809
+ // word and stays out of the stored value.
22810
+ redactFallback: RedactFallback.default("warn"),
22481
22811
  // Absent until /aka:setup completes; its presence is what "onboarded" means.
22482
22812
  onboardedAt: external_exports.iso.datetime().optional(),
22483
22813
  // Records that the user consented to sending findings to the model API for
@@ -22485,10 +22815,12 @@ var WorkspaceSettings = external_exports.object({
22485
22815
  // Absent until granted; a stale payloadVersion means the consent no longer
22486
22816
  // covers the current payload and must be re-granted.
22487
22817
  modelJudgeConsent: ModelJudgeConsent.optional(),
22488
- // Records that the user consented to sending the activity already recorded on
22489
- // this machine to the deployment it is attached to, along with the payload
22490
- // shape and the endpoint they agreed to. Absent until granted, and a grant for
22491
- // a different endpoint or an older payload no longer counts.
22818
+ // Records that the user consented to the DEFERRED send — the outbox — along
22819
+ // with the payload shape and the endpoint they agreed to. Since payload v3
22820
+ // that covers the pre-attach backlog AND undelivered captures alike, and both
22821
+ // carry prompt/reply/tool-output text in `content`; the key name predates
22822
+ // both widenings. Absent until granted, and a grant for a different endpoint
22823
+ // or an older payload no longer counts.
22492
22824
  historySyncConsent: HistorySyncConsent.optional()
22493
22825
  });
22494
22826
 
@@ -22501,8 +22833,12 @@ var ManagedSettingKey = external_exports.enum([
22501
22833
  "vaultKeyCustody",
22502
22834
  "vaultInlineReveal",
22503
22835
  "modelJudgeConsent",
22504
- "dataSharesInPlace"
22836
+ "dataSharesInPlace",
22837
+ "redactFallback"
22505
22838
  ]).meta({ id: "ManagedSettingKey" });
22839
+ function isManagedSettingKey(value) {
22840
+ return ManagedSettingKey.safeParse(value).success;
22841
+ }
22506
22842
  var ManagedSettingsValues = external_exports.object({
22507
22843
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
22508
22844
  controlPlane: external_exports.object({
@@ -22514,7 +22850,8 @@ var ManagedSettingsValues = external_exports.object({
22514
22850
  vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
22515
22851
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22516
22852
  modelJudgeConsent: external_exports.boolean().optional(),
22517
- dataSharesInPlace: external_exports.boolean().optional()
22853
+ dataSharesInPlace: external_exports.boolean().optional(),
22854
+ redactFallback: RedactFallback.optional()
22518
22855
  }).meta({ id: "ManagedSettingsValues" });
22519
22856
  var ManagedSettings = external_exports.object({
22520
22857
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22526,178 +22863,28 @@ var ManagedSettings = external_exports.object({
22526
22863
  // Which of those the user may not change. A key here with no matching value
22527
22864
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22528
22865
  // the user may still override. The two are separable on purpose.
22529
- lockedFields: external_exports.array(ManagedSettingKey).default([])
22530
- }).meta({ id: "ManagedSettings" });
22531
-
22532
- // ../../packages/schema/src/zod/policy.ts
22533
- var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22534
- var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22535
- var Policy = external_exports.object({
22536
- id: external_exports.guid(),
22537
- scope: PolicyScope,
22538
- target: PolicyTarget,
22539
- action: ActionTaken,
22540
- enabled: external_exports.boolean().default(true),
22541
- customKeywords: external_exports.array(external_exports.string()).optional(),
22542
- // Display name — optional so older policy rows without name still parse.
22543
- // Added for the findings API (policy.name column migration).
22544
- name: external_exports.string().optional()
22545
- }).meta({ id: "Policy" });
22546
- var PolicyBundle = external_exports.object({
22547
- version: external_exports.string(),
22548
- policies: external_exports.array(Policy),
22549
- // Rules from the installed marketplace packs (snapshotted by the
22550
- // control plane). The plugin registers these in addition to its bundled
22551
- // packs. Optional so older backends — and older on-disk caches — that omit
22552
- // the field still parse; consumers read `bundle.rules ?? []`.
22553
- rules: external_exports.array(Rule).optional(),
22554
- // When true, `rules` IS the complete effective ruleset and the runtime must
22555
- // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22556
- // after reading the user's installed snapshot (installed_packs, enabled
22557
- // packs only), which is how detection updates stay manual: new bundled
22558
- // rules run only after the user applies the pack update. Absent/false keeps
22559
- // the historical composition (bundled packs + rules) — older caches.
22560
- rulesComplete: external_exports.boolean().optional(),
22561
- // Active detection exceptions, evaluation subset only (see
22562
- // ExceptionBundleEntry). Optional so older bundle producers — and older
22563
- // on-disk caches — that omit the field still parse; consumers read
22564
- // `bundle.exceptions ?? []`.
22565
- exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22566
- // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22567
- // A second axis over the same `redact` action, carried beside the policies
22568
- // rather than on them: nothing writes ruleId-targeted policies to disk, so
22569
- // widening Policy itself would change a persisted shape to express something
22570
- // only the in-memory bundle needs. Optional so an older producer — or an
22571
- // older on-disk cache — still parses; consumers read `?? []` and get the
22572
- // pre-existing one-way behaviour, which is the safe direction to default.
22573
- reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22574
- // Installed pack version, keyed by ruleId, for rules in `rules` that came
22575
- // from a versioned installed pack. Optional so older backends — and older
22576
- // on-disk caches — that omit the field still parse; consumers fall back to
22577
- // the rule's own spec version. NOT the bundle version above — see
22578
- // installedRuleset's ruleVersions for the source of truth.
22579
- ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22580
- // Model ids (the raw `model` string a harness reports, e.g.
22581
- // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22582
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
22583
- // one (UserPromptSubmit). Optional so an older backend — and an older
22584
- // on-disk cache — still parses; consumers read `?? []`, which is the
22585
- // unenforced behaviour that predates this field and the safe direction to
22586
- // default.
22587
22866
  //
22588
- // Ids, not display names: the governance decision is keyed on the exact
22589
- // string the harness reports (`model_status_override.versionId` in the
22590
- // control plane), so no name resolution stands between the decision and the
22591
- // comparison.
22592
- prohibitedModels: external_exports.array(external_exports.string()).optional(),
22593
- customKeywords: external_exports.array(external_exports.string()),
22594
- fetchedAt: external_exports.iso.datetime()
22595
- }).meta({ id: "PolicyBundle" });
22596
- var OBSERVE_ONLY_CATEGORIES = ["config"];
22597
- var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22598
- var CATEGORY_PEAK_SEVERITY = {
22599
- secret: "critical",
22600
- financial: "critical",
22601
- // core-financial/credit-card
22602
- code_flaw: "critical",
22603
- pii: "high",
22604
- phi: "high",
22605
- custom: "high",
22606
- // user-defined; conservative
22607
- code_context: "low",
22608
- config: "low"
22609
- // observe-only; floors to monitor regardless
22610
- };
22611
- function severityFloorPolicy(category) {
22612
- if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22613
- const peak = CATEGORY_PEAK_SEVERITY[category];
22614
- return peak === "critical" || peak === "high" ? "warn" : "monitor";
22615
- }
22616
- function severityFloorPosture() {
22617
- const out = {};
22618
- for (const c of DetectionCategory.options) out[c] = severityFloorPolicy(c);
22619
- return out;
22620
- }
22621
- var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22622
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22623
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22624
- var BUILTIN_POLICY_SPECS = {
22625
- monitor: {
22626
- name: "Monitor",
22627
- action: "log",
22628
- reversible: false,
22629
- description: "Log every match for audit. The request is allowed through untouched."
22630
- },
22631
- warn: {
22632
- name: "Warn",
22633
- action: "warn",
22634
- reversible: false,
22635
- description: "Allow the request, but warn the user inline before it is sent."
22636
- },
22637
- redact: {
22638
- name: "Redact",
22639
- action: "redact",
22640
- reversible: false,
22641
- description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22642
- },
22643
- vault: {
22644
- name: "Redact & Vault",
22645
- action: "redact",
22646
- reversible: true,
22647
- description: "Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."
22648
- },
22649
- block: {
22650
- name: "Block",
22651
- action: "block",
22652
- reversible: false,
22653
- description: "Refuse the request entirely whenever any rule in this detection matches."
22867
+ // Parsed as NAMES rather than as the enum, and split below: a name this
22868
+ // build does not know is dropped from the locked set and reported, never a
22869
+ // reason to refuse the file. The same shape reaches an older build whenever
22870
+ // an administrator locks a key a newer build added, and refusing it there
22871
+ // ran that build entirely unmanaged — every pin and lock gone — on exactly
22872
+ // the fleets most likely to carry a version skew. A name outside the enum
22873
+ // is still never HONOURED: the lockable set stays explicit above.
22874
+ lockedFields: external_exports.array(external_exports.string()).default([])
22875
+ }).transform(({ lockedFields, ...rest }) => {
22876
+ const known = [];
22877
+ const unknown2 = [];
22878
+ for (const name of lockedFields) {
22879
+ if (isManagedSettingKey(name)) known.push(name);
22880
+ else unknown2.push(name);
22654
22881
  }
22655
- };
22656
- function builtinPolicyToAction(id) {
22657
- return BUILTIN_POLICY_SPECS[id].action;
22658
- }
22659
- var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22660
- (id) => !BUILTIN_POLICY_SPECS[id].reversible
22661
- );
22662
- var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22663
- (id) => BUILTIN_POLICY_SPECS[id].reversible
22664
- );
22665
- var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22666
- var DEFAULT_ACTIONS = Object.fromEntries(
22667
- DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22668
- );
22669
- var BUILTIN_POLICIES = Object.fromEntries(
22670
- KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22671
- );
22672
- var UsedByItem = external_exports.object({
22673
- id: external_exports.string(),
22674
- name: external_exports.string(),
22675
- ruleCount: external_exports.number().int().nonnegative(),
22676
- enabled: external_exports.boolean()
22677
- }).meta({ id: "UsedByItem" });
22678
- var PolicyListItem = external_exports.object({
22679
- id: external_exports.string(),
22680
- kind: PolicyKind,
22681
- name: external_exports.string(),
22682
- enabled: external_exports.boolean(),
22683
- usedByCount: external_exports.number().int().nonnegative()
22684
- }).meta({ id: "PolicyListItem" });
22685
- var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22686
- var PolicyDetail = external_exports.object({
22687
- specVersion: external_exports.literal(1),
22688
- id: external_exports.string(),
22689
- kind: PolicyKind,
22690
- name: external_exports.string(),
22691
- enabled: external_exports.boolean(),
22692
- description: external_exports.string(),
22693
- usedBy: external_exports.array(UsedByItem)
22694
- }).meta({ id: "PolicyDetail" });
22695
- var PolicyStatsResponse = external_exports.object({
22696
- policies: external_exports.number().int().nonnegative(),
22697
- builtin: external_exports.number().int().nonnegative(),
22698
- custom: external_exports.number().int().nonnegative(),
22699
- detectionsGoverned: external_exports.number().int().nonnegative()
22700
- }).meta({ id: "PolicyStatsResponse" });
22882
+ return {
22883
+ ...rest,
22884
+ lockedFields: known,
22885
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
22886
+ };
22887
+ }).meta({ id: "ManagedSettings" });
22701
22888
 
22702
22889
  // ../../packages/schema/src/zod/project-files.ts
22703
22890
  var ProjectFileInput = external_exports.object({
@@ -22814,7 +23001,11 @@ var FindingsTimeseriesPoint = external_exports.object({
22814
23001
  timestamp: external_exports.iso.date(),
22815
23002
  critical: external_exports.number().int().nonnegative(),
22816
23003
  high: external_exports.number().int().nonnegative(),
22817
- medium: external_exports.number().int().nonnegative()
23004
+ medium: external_exports.number().int().nonnegative(),
23005
+ // Optional and additive, so a producer written against the earlier
23006
+ // three-series contract keeps validating. A consumer plotting it resolves the
23007
+ // absent case itself — the chart point requires a number.
23008
+ low: external_exports.number().int().nonnegative().optional()
22818
23009
  }).meta({ id: "FindingsTimeseriesPoint" });
22819
23010
  var FindingsTimeseriesResponse = external_exports.object({
22820
23011
  range: TimeRange,
@@ -22840,6 +23031,10 @@ var ResolvedFeedItem = external_exports.object({
22840
23031
  findingKey: external_exports.string(),
22841
23032
  ruleId: external_exports.string(),
22842
23033
  severity: Severity,
23034
+ // Repository slug, and the file path RELATIVE to it. The pair is what
23035
+ // identifies the file: a bare path matches the same name in every repo.
23036
+ // Optional and additive; empty when the event carried no repo.
23037
+ repo: external_exports.string().optional(),
22843
23038
  path: external_exports.string(),
22844
23039
  // ISO-8601 datetime (matches FindingInstance.detectedAt / the rest of the
22845
23040
  // findings domain). The reader `.toISOString()`s the DB epoch-ms values.
@@ -22938,10 +23133,12 @@ var DismissRecommendedActionResponse = external_exports.object({ id: external_ex
22938
23133
  var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
22939
23134
 
22940
23135
  // ../../packages/schema/src/zod/settings-action.ts
23136
+ var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23137
+ var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
22941
23138
  var SaveSettingsInput = external_exports.object({
22942
23139
  historicalAccess: external_exports.string(),
22943
- modelJudgeConsent: external_exports.boolean(),
22944
- historySyncConsent: external_exports.boolean(),
23140
+ modelJudgeConsent: ModelJudgeConsentChoice,
23141
+ historySyncConsent: HistorySyncConsentChoice,
22945
23142
  vaultConsent: external_exports.string(),
22946
23143
  vaultInlineReveal: external_exports.string()
22947
23144
  });
@@ -23082,8 +23279,8 @@ import {
23082
23279
  import { threadId } from "worker_threads";
23083
23280
 
23084
23281
  // ../../packages/persistence/src/database.ts
23085
- import { randomUUID as randomUUID10 } from "crypto";
23086
- import { join as join4, sep } from "path";
23282
+ import { randomUUID as randomUUID11 } from "crypto";
23283
+ import { dirname as dirname2, join as join7, sep } from "path";
23087
23284
  import { DatabaseSync } from "node:sqlite";
23088
23285
 
23089
23286
  // ../../packages/persistence/src/ids.ts
@@ -23099,6 +23296,20 @@ var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23099
23296
 
23100
23297
  // ../../packages/persistence/src/repositories/activity.ts
23101
23298
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
23299
+ var DB_EVENT_TYPE_TO_KIND = {
23300
+ session: "session",
23301
+ prompt: "prompt",
23302
+ response: "response",
23303
+ tool_call: "tool",
23304
+ hook: "hook",
23305
+ detection: "detection",
23306
+ share: "share",
23307
+ permission: "permission",
23308
+ commit: "commit",
23309
+ error: "error",
23310
+ active: "active"
23311
+ };
23312
+ var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
23102
23313
  var DEFAULT_HARNESS = HARNESS.ClaudeCode;
23103
23314
 
23104
23315
  // ../../packages/persistence/src/repositories/exceptions.ts
@@ -23112,15 +23323,75 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
23112
23323
  AND conditions IS NULL
23113
23324
  AND ${ACTIVE_PREDICATE}`;
23114
23325
 
23326
+ // ../../packages/persistence/src/repositories/resolution-sql.ts
23327
+ function latestResolutionColumnSql(column, findingsAlias) {
23328
+ return `(
23329
+ SELECT fr.${column} FROM finding_resolution fr
23330
+ WHERE fr.finding_key = ${findingsAlias}.finding_key
23331
+ ORDER BY fr.created_at DESC, fr.rowid DESC
23332
+ LIMIT 1
23333
+ )`;
23334
+ }
23335
+ function latestResolutionStatusSql(findingsAlias) {
23336
+ return latestResolutionColumnSql("status", findingsAlias);
23337
+ }
23338
+
23339
+ // ../../packages/persistence/src/repositories/findings.ts
23340
+ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
23341
+ d.severity AS severity, f.masked_match AS masked_match,
23342
+ f.action_taken AS action_taken, f.confidence AS confidence,
23343
+ e.started_at AS occurred_at,
23344
+ e.source_tool AS source_tool,
23345
+ e.repo AS repo,
23346
+ e.file_path AS file,
23347
+ e.tool_name AS tool_name,
23348
+ f.audit_event_id AS event_id, e.root_session_id AS session_id,
23349
+ e.event_type AS kind, f.finding_key AS finding_key,
23350
+ ${latestResolutionStatusSql("f")} AS latest_status`;
23351
+
23115
23352
  // ../../packages/persistence/src/repositories/history-sync.ts
23116
23353
  var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23117
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(", ");
23118
23357
 
23119
23358
  // ../../packages/persistence/src/repositories/installed-packs.ts
23120
- import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
23359
+ import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
23360
+
23361
+ // ../../packages/persistence/src/policy-floor.ts
23362
+ import { readFileSync as readFileSync5 } from "fs";
23363
+ import { join as join6 } from "path";
23364
+
23365
+ // ../../packages/persistence/src/local-layout.ts
23366
+ import { renameSync as renameSync3 } from "fs";
23367
+ import { mkdir } from "fs/promises";
23368
+ import { homedir } from "os";
23369
+ import { join as join4 } from "path";
23370
+
23371
+ // ../../packages/persistence/src/settings.ts
23372
+ import { readFileSync as readFileSync4 } from "fs";
23373
+ import { join as join5 } from "path";
23374
+
23375
+ // ../../packages/persistence/src/file-lock.ts
23376
+ import { randomUUID as randomUUID3 } from "crypto";
23377
+ import {
23378
+ closeSync,
23379
+ existsSync as existsSync2,
23380
+ openSync,
23381
+ readFileSync as readFileSync2,
23382
+ rmSync as rmSync5,
23383
+ statSync as statSync3,
23384
+ writeFileSync as writeFileSync2
23385
+ } from "fs";
23386
+ import { hostname as hostname3 } from "os";
23387
+ var PARK = new Int32Array(new SharedArrayBuffer(4));
23388
+
23389
+ // ../../packages/persistence/src/managed-settings.ts
23390
+ import { readFileSync as readFileSync3 } from "fs";
23391
+ import { posix, win32 } from "path";
23121
23392
 
23122
23393
  // ../../packages/persistence/src/repositories/inventory-assets.ts
23123
- import { randomUUID as randomUUID4 } from "crypto";
23394
+ import { randomUUID as randomUUID5 } from "crypto";
23124
23395
  var VALID_HARNESS_IDS = new Set(HarnessId.options);
23125
23396
  var HARNESS_LABELS = {
23126
23397
  [HARNESS.ClaudeCode]: "Claude Code",
@@ -23138,16 +23409,16 @@ var TITLE_NEEDLES = {
23138
23409
  };
23139
23410
 
23140
23411
  // ../../packages/persistence/src/repositories/policies.ts
23141
- import { randomUUID as randomUUID5 } from "crypto";
23412
+ import { randomUUID as randomUUID6 } from "crypto";
23142
23413
 
23143
23414
  // ../../packages/persistence/src/repositories/project-files.ts
23144
- import { randomUUID as randomUUID6 } from "crypto";
23415
+ import { randomUUID as randomUUID7 } from "crypto";
23145
23416
 
23146
23417
  // ../../packages/persistence/src/repositories/resolutions.ts
23147
- import { randomUUID as randomUUID7 } from "crypto";
23418
+ import { randomUUID as randomUUID8 } from "crypto";
23148
23419
 
23149
23420
  // ../../packages/persistence/src/repositories/secret-vault.ts
23150
- import { randomUUID as randomUUID8 } from "crypto";
23421
+ import { randomUUID as randomUUID9 } from "crypto";
23151
23422
 
23152
23423
  // ../../packages/persistence/src/repositories/security.ts
23153
23424
  var SCAN_COVERAGE = {
@@ -23162,53 +23433,35 @@ var SCAN_COVERAGE = {
23162
23433
  };
23163
23434
 
23164
23435
  // ../../packages/persistence/src/repositories/shares.ts
23165
- import { randomUUID as randomUUID9 } from "crypto";
23436
+ import { randomUUID as randomUUID10 } from "crypto";
23166
23437
 
23167
- // ../../packages/persistence/src/file-lock.ts
23168
- import { randomUUID as randomUUID11 } from "crypto";
23169
- import {
23170
- closeSync,
23171
- existsSync as existsSync2,
23172
- openSync,
23173
- readFileSync as readFileSync2,
23174
- rmSync as rmSync5,
23175
- statSync as statSync3,
23176
- writeFileSync as writeFileSync2
23177
- } from "fs";
23178
- import { hostname as hostname3 } from "os";
23179
- var PARK = new Int32Array(new SharedArrayBuffer(4));
23438
+ // ../../packages/persistence/src/database.ts
23439
+ var CAPTURE_GRAIN = new Set(EventKind.options);
23180
23440
 
23181
- // ../../packages/persistence/src/finding-key.ts
23441
+ // ../../packages/persistence/src/egress-wire.ts
23182
23442
  import { createHash as createHash3 } from "crypto";
23183
23443
 
23444
+ // ../../packages/persistence/src/finding-key.ts
23445
+ import { createHash as createHash4 } from "crypto";
23446
+
23184
23447
  // ../../packages/persistence/src/fingerprint.ts
23185
23448
  import { createHmac, randomBytes } from "crypto";
23186
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
23187
- import { join as join5 } from "path";
23449
+ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23450
+ import { join as join8 } from "path";
23188
23451
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23189
23452
 
23190
- // ../../packages/persistence/src/history-preview.ts
23453
+ // ../../packages/persistence/src/history-backfill.ts
23191
23454
  import { existsSync as existsSync4 } from "fs";
23192
- import { join as join6 } from "path";
23193
- import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23194
-
23195
- // ../../packages/persistence/src/local-layout.ts
23196
- import { renameSync as renameSync3 } from "fs";
23197
- import { mkdir } from "fs/promises";
23198
- import { homedir } from "os";
23199
- import { join as join7 } from "path";
23200
-
23201
- // ../../packages/persistence/src/managed-settings.ts
23202
- import { readFileSync as readFileSync4 } from "fs";
23203
- import { posix, win32 } from "path";
23455
+ import { join as join9 } from "path";
23204
23456
 
23205
- // ../../packages/persistence/src/settings.ts
23206
- import { readFileSync as readFileSync5 } from "fs";
23207
- import { join as join8 } from "path";
23457
+ // ../../packages/persistence/src/history-preview.ts
23458
+ import { existsSync as existsSync5 } from "fs";
23459
+ import { join as join10 } from "path";
23460
+ import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23208
23461
 
23209
23462
  // ../../packages/persistence/src/store-symlinks.ts
23210
- import { existsSync as existsSync5, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23211
- import { dirname as dirname2, join as join9, resolve } from "path";
23463
+ 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";
23212
23465
 
23213
23466
  // ../../packages/persistence/src/vault/crypto.ts
23214
23467
  import {
@@ -23222,15 +23475,15 @@ import {
23222
23475
  // ../../packages/persistence/src/vault/key-provider.ts
23223
23476
  import { execFileSync } from "child_process";
23224
23477
  import { randomBytes as randomBytes2 } from "crypto";
23225
- import { chmodSync as chmodSync3, readFileSync as readFileSync6, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23226
- import { join as join10 } from "path";
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";
23227
23480
 
23228
23481
  // ../../packages/persistence/src/vault/vault.ts
23229
23482
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23230
23483
 
23231
23484
  // ../../packages/persistence/src/warn-era-cap.ts
23232
- import { existsSync as existsSync6, writeFileSync as writeFileSync4 } from "fs";
23233
- import { join as join11 } from "path";
23485
+ import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23486
+ import { join as join13 } from "path";
23234
23487
 
23235
23488
  // ../../packages/plugin-sdk/src/provider-env.ts
23236
23489
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -23251,9 +23504,9 @@ var providerEnvShape = {
23251
23504
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
23252
23505
 
23253
23506
  // ../../packages/plugin-sdk/src/config-inventory.ts
23254
- import { readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23507
+ import { readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23255
23508
  import { homedir as homedir2 } from "os";
23256
- import { basename as basename3, join as join14 } from "path";
23509
+ import { basename as basename3, join as join16 } from "path";
23257
23510
 
23258
23511
  // ../../packages/detections/src/egress/registry.ts
23259
23512
  var EXTRACTOR_VERSION = "1";
@@ -24011,24 +24264,20 @@ var CPU_CORROBORATION_SHARE = 0.2;
24011
24264
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24012
24265
 
24013
24266
  // ../../packages/plugin-sdk/src/repo.ts
24014
- import { existsSync as existsSync8, readFileSync as readFileSync7, statSync as statSync6 } from "fs";
24015
- import { basename as basename2, dirname as dirname3, isAbsolute, join as join13, sep as sep2 } from "path";
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";
24016
24269
 
24017
24270
  // ../../packages/plugin-sdk/src/events.ts
24018
- import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
24271
+ import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
24019
24272
 
24020
24273
  // ../../packages/plugin-sdk/src/isolated-scan.ts
24021
- import { existsSync as existsSync9 } from "fs";
24274
+ import { existsSync as existsSync10 } from "fs";
24022
24275
  import { fileURLToPath } from "url";
24023
24276
  import { Worker } from "worker_threads";
24024
24277
 
24025
- // ../../packages/plugin-sdk/src/ignore-layers.ts
24026
- var import_ignore = __toESM(require_ignore(), 1);
24027
- import { readFileSync as readFileSync9 } from "fs";
24028
- import { join as join15 } from "path";
24029
-
24030
- // ../../packages/plugin-sdk/src/inventory-resolver.ts
24031
- import { arch, hostname as hostname4, platform, release } from "os";
24278
+ // ../../packages/plugin-sdk/src/host-floor.ts
24279
+ import { readFileSync as readFileSync11 } from "fs";
24280
+ import { join as join18 } from "path";
24032
24281
 
24033
24282
  // ../../packages/plugin-sdk/src/model-governance.ts
24034
24283
  import {
@@ -24040,20 +24289,46 @@ import {
24040
24289
  readSync,
24041
24290
  writeFileSync as writeFileSync5
24042
24291
  } from "fs";
24043
- import { join as join16 } from "path";
24292
+ import { join as join17 } from "path";
24044
24293
  var TAIL_BYTES = 256 * 1024;
24045
24294
 
24295
+ // ../../packages/plugin-sdk/src/host-floor.ts
24296
+ var HOST_FEATURE = {
24297
+ ModelSwitch: "model-switch",
24298
+ VaultPointerDisplay: "vault-pointer-display"
24299
+ };
24300
+ var HOST_FLOORS = {
24301
+ [HOST_FEATURE.ModelSwitch]: {
24302
+ label: "model-switch protection",
24303
+ hookEvents: ["PreModelSwitch", "PostModelSwitch"],
24304
+ since: "2.1.251"
24305
+ },
24306
+ [HOST_FEATURE.VaultPointerDisplay]: {
24307
+ label: "vault pointer display",
24308
+ hookEvents: ["MessageDisplay"],
24309
+ since: "2.1.152"
24310
+ }
24311
+ };
24312
+
24313
+ // ../../packages/plugin-sdk/src/ignore-layers.ts
24314
+ var import_ignore = __toESM(require_ignore(), 1);
24315
+ import { readFileSync as readFileSync12 } from "fs";
24316
+ import { join as join19 } from "path";
24317
+
24318
+ // ../../packages/plugin-sdk/src/inventory-resolver.ts
24319
+ import { arch, hostname as hostname4, platform, release } from "os";
24320
+
24046
24321
  // ../../packages/plugin-sdk/src/nudge.ts
24047
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync6 } from "fs";
24048
- import { join as join17 } from "path";
24322
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
24323
+ import { join as join20 } from "path";
24049
24324
 
24050
24325
  // ../../packages/plugin-sdk/src/paths.ts
24051
24326
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
24052
- import { basename as basename4, dirname as dirname4, sep as sep3 } from "path";
24327
+ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24053
24328
 
24054
24329
  // ../../packages/plugin-sdk/src/project-files.ts
24055
- import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
24056
- import { basename as basename5, join as join18 } from "path";
24330
+ import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
24331
+ import { basename as basename5, join as join21 } from "path";
24057
24332
 
24058
24333
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24059
24334
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24089,7 +24364,7 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24089
24364
 
24090
24365
  // ../../packages/plugin-sdk/src/throttle.ts
24091
24366
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24092
- import { join as join19 } from "path";
24367
+ import { join as join22 } from "path";
24093
24368
 
24094
24369
  // ../../packages/setup-wizard/src/onboard-posture.ts
24095
24370
  function parsePosture(json2) {
@@ -24128,7 +24403,7 @@ function parseCurrent(json2) {
24128
24403
 
24129
24404
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
24130
24405
  import { writeFileSync as writeFileSync8 } from "fs";
24131
- import { join as join20 } from "path";
24406
+ import { join as join23 } from "path";
24132
24407
 
24133
24408
  // ../../packages/setup-wizard/src/triage/gate-display.ts
24134
24409
  var ACTION_RANK = {
@@ -24155,9 +24430,9 @@ var RANK = Object.fromEntries(
24155
24430
  );
24156
24431
 
24157
24432
  // ../../packages/setup-wizard/src/triage/plan-file.ts
24158
- import { mkdtempSync, readFileSync as readFileSync12, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24433
+ import { mkdtempSync, readFileSync as readFileSync14, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24159
24434
  import { tmpdir } from "os";
24160
- import { basename as basename6, dirname as dirname5, join as join21 } from "path";
24435
+ import { basename as basename6, dirname as dirname6, join as join24 } from "path";
24161
24436
  var SuppressionEntrySchema = external_exports.object({
24162
24437
  ruleId: external_exports.string(),
24163
24438
  category: DetectionCategory,