@akasecurity/ai-tc-codex 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.
package/scripts/intro.js CHANGED
@@ -492,7 +492,7 @@ var require_ignore = __commonJS({
492
492
  });
493
493
 
494
494
  // src/intro.ts
495
- import { readFileSync as readFileSync14 } from "fs";
495
+ import { readFileSync as readFileSync16 } from "fs";
496
496
 
497
497
  // src/present.ts
498
498
  var SHADE = {
@@ -548,8 +548,8 @@ function fenced(body) {
548
548
  }
549
549
 
550
550
  // ../../packages/plugin-sdk/src/config.ts
551
- import { existsSync as existsSync7 } from "fs";
552
- import { join as join12 } from "path";
551
+ import { existsSync as existsSync8 } from "fs";
552
+ import { join as join14 } from "path";
553
553
 
554
554
  // ../../packages/persistence/src/attached-derived.ts
555
555
  import { rmSync } from "fs";
@@ -20441,13 +20441,11 @@ var FindingGroup = external_exports.object({
20441
20441
  latestDetectedAt: external_exports.iso.datetime(),
20442
20442
  instances: external_exports.array(FindingInstance),
20443
20443
  // Derived from instances' statuses with open-dominates precedence (see
20444
- // buildFindingGroups). Undefined only when no instance carries a status.
20444
+ // foldGroupStatus). Undefined only when no instance carries a status.
20445
20445
  status: FindingStatus.optional(),
20446
- // The distinct people across the WHOLE group, not just the `instances`
20447
- // preview — from the store's whole-group aggregate when it supplies one,
20448
- // else folded from the rows (see buildFindingGroups). Undefined when no
20449
- // instance carries a user, or when the store supplied whole-group folds
20450
- // without one.
20446
+ // The distinct people across the WHOLE group, not just the instances
20447
+ // carried here. Undefined when no instance carries a user, or when the
20448
+ // store supplied whole-group folds without one.
20451
20449
  users: external_exports.array(FindingUser).optional()
20452
20450
  }).meta({ id: "FindingGroup" });
20453
20451
  var FindingStats = external_exports.object({
@@ -20476,20 +20474,30 @@ var FindingFacets = external_exports.object({
20476
20474
  // counted under no value.
20477
20475
  status: external_exports.array(FindingFacetItem),
20478
20476
  // Host tool (attributes.tool_name). Present only on the instance-level
20479
- // reads, which can filter by it; the grouped read omits the dimension
20477
+ // reads, which can filter by it; the type-level read omits the dimension
20480
20478
  // because a group spans tools.
20481
20479
  tool: external_exports.array(FindingFacetItem).optional()
20482
20480
  }).meta({ id: "FindingFacets" });
20483
- var ListGroupedFindingsQuery = external_exports.object({
20481
+ var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20482
+ id: "FindingTypeSummary"
20483
+ });
20484
+ var MAX_FINDING_TYPES_LIMIT = 100;
20485
+ var ListFindingTypesQuery = external_exports.object({
20484
20486
  // NOTE: severity filters by Severity (critical/high/medium/low), not by
20485
- // FindingAction.
20487
+ // FindingAction. It narrows TYPES: a type's severity is the one its newest
20488
+ // firing version carries, and this list pages types.
20489
+ //
20490
+ // That is NOT a claim the findings of a type share it. A rule can hold several
20491
+ // definition versions at different severities, so a type kept by this filter
20492
+ // can hold findings that individually do not match — see totals.findings on
20493
+ // ListFindingTypesResponse, which counts them all.
20486
20494
  severity: external_exports.array(Severity).optional(),
20487
20495
  subtype: external_exports.array(external_exports.string()).optional(),
20488
20496
  provider: external_exports.array(FindingProvider).optional(),
20489
20497
  action: external_exports.array(FindingAction).optional(),
20490
- // Matches a group's DERIVED status (see FindingGroup.status), not its
20491
- // individual instances' — so a filtered group's Status column always reads
20492
- // one of the requested values.
20498
+ // Matches a type's DERIVED status (see FindingGroup.status), not its
20499
+ // individual findings' — so a filtered row's status always reads one of the
20500
+ // requested values.
20493
20501
  status: external_exports.array(FindingStatus).optional(),
20494
20502
  q: external_exports.string().optional(),
20495
20503
  // Scope to findings whose event carries this session id (the Activity page's
@@ -20499,23 +20507,37 @@ var ListGroupedFindingsQuery = external_exports.object({
20499
20507
  // from a time-scoped page (Activity's range) can carry that scope. Absent
20500
20508
  // means all time — this list has no default window.
20501
20509
  from: external_exports.iso.datetime().optional(),
20502
- // A group or instance id that must appear in the page even when the cursor
20503
- // has already advanced past its sort position. This is what keeps the
20504
- // Findings page's one-shot ?finding= deep link resolving once the list
20505
- // paginates: the target group is appended out of sort order rather than
20506
- // scanning forward for it. Never affects totals, facets or the cursor.
20510
+ // A RULE id that must appear in the page even when the cursor has already
20511
+ // advanced past its sort position. This is what keeps the selected type
20512
+ // visible in the list once it paginates: the target is appended out of sort
20513
+ // order rather than scanned forward for. Never affects totals, facets or the
20514
+ // cursor. Unlike the grouped read this replaces, it names a rule only — an
20515
+ // instance id is resolved by `findingInstance`, which is a primary-key seek
20516
+ // and so is not bounded by what any page happens to hold.
20507
20517
  includeId: external_exports.string().optional(),
20508
- groupBy: external_exports.literal("type").optional(),
20509
- limit: external_exports.coerce.number().int().min(1).max(100).optional(),
20518
+ limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
20510
20519
  cursor: external_exports.string().optional()
20511
20520
  });
20512
- var ListGroupedFindingsResponse = external_exports.object({
20521
+ var ListFindingTypesResponse = external_exports.object({
20513
20522
  totals: external_exports.object({
20523
+ // Findings belonging to the matching TYPES — not findings that each match
20524
+ // the filters. The filters here select types, so a type that survives
20525
+ // contributes its whole instanceCount.
20526
+ //
20527
+ // `status` is the one exception, narrowed per finding via
20528
+ // countInstancesByStatus. `severity`, `provider` and `action` are not, so
20529
+ // this can exceed what the instance read reports for the same filters: a
20530
+ // rule whose severity moved between versions is kept on its newest and
20531
+ // still counts its older findings. Narrowing the other three needs
20532
+ // per-dimension counts the aggregate does not carry today.
20514
20533
  findings: external_exports.number().int().nonnegative(),
20515
- groups: external_exports.number().int().nonnegative()
20534
+ // Counts TYPES, which is the unit this read pages. The instance read's
20535
+ // own totals count findings; the two deliberately answer different
20536
+ // questions and are never summed.
20537
+ types: external_exports.number().int().nonnegative()
20516
20538
  }),
20517
20539
  facets: FindingFacets,
20518
- items: external_exports.array(FindingGroup),
20540
+ items: external_exports.array(FindingTypeSummary),
20519
20541
  nextCursor: external_exports.string().nullable(),
20520
20542
  // Present only on session-scoped queries (`sessionId` set): per ruleId, how
20521
20543
  // many times that rule fired in the session's persisted transcript. Findings
@@ -20523,7 +20545,7 @@ var ListGroupedFindingsResponse = external_exports.object({
20523
20545
  // every firing, so the two numbers legitimately differ — this map lets a
20524
20546
  // session-scoped view show both.
20525
20547
  sessionFirings: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional()
20526
- }).meta({ id: "ListGroupedFindingsResponse" });
20548
+ }).meta({ id: "ListFindingTypesResponse" });
20527
20549
  var ApplyFindingActionRequest = external_exports.object({
20528
20550
  // 'quarantined' is system-assigned (see FindingAction) — clients may not set
20529
20551
  // it, so it is excluded from the request contract. The mapping helper
@@ -20552,12 +20574,13 @@ var FindingInstanceDetail = FindingInstance.extend({
20552
20574
  var MAX_FLAT_FINDINGS_LIMIT = 200;
20553
20575
  var ListFindingInstancesQuery = external_exports.object({
20554
20576
  severity: external_exports.array(Severity).optional(),
20555
- // Rule ids, the same vocabulary the grouped list's `subtype` carries.
20577
+ // Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
20578
+ // ONE of them is how the master/detail view scopes its right-hand panel.
20556
20579
  subtype: external_exports.array(external_exports.string()).optional(),
20557
20580
  provider: external_exports.array(FindingProvider).optional(),
20558
20581
  action: external_exports.array(FindingAction).optional(),
20559
20582
  // Matches each instance's OWN derived status (deriveFindingStatus), unlike
20560
- // the grouped query's group-level fold.
20583
+ // the types query's type-level fold.
20561
20584
  status: external_exports.array(FindingStatus).optional(),
20562
20585
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20563
20586
  // where the free-text `q` can only match the rendered "via Bash" label.
@@ -20574,37 +20597,46 @@ var ListFindingInstancesQuery = external_exports.object({
20574
20597
  });
20575
20598
  var ListFindingInstancesResponse = external_exports.object({
20576
20599
  // Instances matching the filters across the whole scope, not just this
20577
- // page — cursor-independent, like the grouped list's totals.
20600
+ // page — cursor-independent, like the types list's totals.
20578
20601
  totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
20579
- // Counts in INSTANCES here, where the grouped response counts groups. Each
20602
+ // Counts in INSTANCES here, where the types response counts types. Each
20580
20603
  // dimension still excludes its own filter.
20581
20604
  facets: FindingFacets,
20582
20605
  items: external_exports.array(FindingInstanceDetail),
20583
20606
  nextCursor: external_exports.string().nullable()
20584
20607
  }).meta({ id: "ListFindingInstancesResponse" });
20585
- var FindingLocationFile = external_exports.object({
20586
- // Empty when the instances carried no file path (a prompt or a tool call
20587
- // with no file attribution).
20588
- file: external_exports.string(),
20589
- instanceCount: external_exports.number().int().nonnegative(),
20590
- maxSeverity: Severity,
20591
- latestDetectedAt: external_exports.iso.datetime(),
20592
- // Folded from the instances' derived statuses with the same
20593
- // open-dominates precedence a group uses.
20594
- status: FindingStatus.optional(),
20595
- // Distinct rules seen at this location, capped — the row shows them as
20596
- // chips, and the count is what conveys scale.
20597
- ruleIds: external_exports.array(external_exports.string())
20598
- }).meta({ id: "FindingLocationFile" });
20599
- var FindingLocationRepo = external_exports.object({
20608
+ var FindingLocationSummary = external_exports.object({
20609
+ // Opaque, stable, minted from the pair by encodeLocationId. It exists
20610
+ // because a location's identity is two values and a URL param carries one:
20611
+ // `?loc=` names a location the way `?rule=` names a type. Only ever compared
20612
+ // for EQUALITY — the page's selection check, this read's `includeId`, the
20613
+ // client's page dedupe — never decoded, and never a sort key.
20614
+ id: external_exports.string(),
20600
20615
  /** Empty when the instances carried no repo attribute. */
20601
20616
  repo: external_exports.string(),
20617
+ // Empty when the instances carried no file path (a prompt, or a tool call
20618
+ // with no file attribution). Both halves empty is a real location — usually
20619
+ // the largest one in a store — and is selectable like any other.
20620
+ file: external_exports.string(),
20602
20621
  instanceCount: external_exports.number().int().nonnegative(),
20622
+ // The WORST severity present, not the first row's. It is this list's primary
20623
+ // sort key, so it is also what explains why a row is where it is, and it is
20624
+ // how a reader decides what to open without opening everything.
20603
20625
  maxSeverity: Severity,
20604
20626
  latestDetectedAt: external_exports.iso.datetime(),
20627
+ // Folded from the instances' derived statuses with the same open-dominates
20628
+ // precedence a group uses, so it answers "is anything left to do here" and
20629
+ // not much more: a location holding 1 open among 40 resolved reads like one
20630
+ // holding 40 open. That loss is accepted — the panel beside this list
20631
+ // carries each finding's own status, and instanceCount sits next to the
20632
+ // badge.
20605
20633
  status: FindingStatus.optional(),
20606
- files: external_exports.array(FindingLocationFile)
20607
- }).meta({ id: "FindingLocationRepo" });
20634
+ // Every distinct rule seen at this location, UNCAPPED — so the length is a
20635
+ // tally rather than a sample and a row can say how many there are. Bounded
20636
+ // by the ruleset, not by the store. The view bounds what it DISPLAYS.
20637
+ ruleIds: external_exports.array(external_exports.string())
20638
+ }).meta({ id: "FindingLocationSummary" });
20639
+ var MAX_FINDING_LOCATIONS_LIMIT = 100;
20608
20640
  var ListFindingLocationsQuery = external_exports.object({
20609
20641
  severity: external_exports.array(Severity).optional(),
20610
20642
  subtype: external_exports.array(external_exports.string()).optional(),
@@ -20617,18 +20649,42 @@ var ListFindingLocationsQuery = external_exports.object({
20617
20649
  q: external_exports.string().optional(),
20618
20650
  sessionId: external_exports.string().optional(),
20619
20651
  from: external_exports.iso.datetime().optional(),
20620
- limit: external_exports.coerce.number().int().min(1).max(500).optional()
20652
+ // A LOCATION id (see FindingLocationSummary.id) that must appear in the page
20653
+ // even when the cursor has already advanced past its sort position — the
20654
+ // counterpart of ListFindingTypesQuery.includeId, and needed far more often
20655
+ // here. Selecting a row pushes the URL, which re-renders the server and resets
20656
+ // the client's page cache to page 0; with distinct (repo, file) pairs running
20657
+ // into the thousands, a selection sitting off page 0 is the ordinary case
20658
+ // rather than a deep-link corner. Never affects totals, facets or the cursor.
20659
+ includeId: external_exports.string().optional(),
20660
+ limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
20661
+ cursor: external_exports.string().optional()
20621
20662
  });
20622
20663
  var ListFindingLocationsResponse = external_exports.object({
20623
20664
  totals: external_exports.object({
20665
+ // Findings matching the filters across the whole scope. Unlike the types
20666
+ // read's same-named field this needs no caveat: the filters here narrow
20667
+ // per finding, so this is the sum of every row's instanceCount.
20624
20668
  findings: external_exports.number().int().nonnegative(),
20625
- repos: external_exports.number().int().nonnegative(),
20626
- files: external_exports.number().int().nonnegative()
20669
+ // Counts LOCATIONS, the unit this read pages — the number the paginator
20670
+ // states. The facets beside it count FINDINGS (see below); a surface
20671
+ // showing both says which is which.
20672
+ locations: external_exports.number().int().nonnegative()
20627
20673
  }),
20628
- /** Sorted by max severity, then most recent. */
20629
- items: external_exports.array(FindingLocationRepo),
20630
- /** Whether `limit` truncated the repo list. */
20631
- hasMore: external_exports.boolean()
20674
+ // Counts in FINDINGS, where the types response counts types, each dimension
20675
+ // still excluding its own filter. Deliberately not locations: counting those
20676
+ // needs a set of location keys per dimension per value — memory tracking the
20677
+ // store times the vocabulary, in a read whose scan promises flat memory —
20678
+ // and the cheap per-location version is not an approximation but WRONG. A
20679
+ // location holding {claudecode, block} and {codex, warn} would survive
20680
+ // provider=claudecode AND action=warn, under which no single finding
20681
+ // matches, so the facet would contradict the instanceCount this whole view
20682
+ // rests on. Findings also keep the toolbar in the same unit as the page
20683
+ // tally and the panel it sits above.
20684
+ facets: FindingFacets,
20685
+ /** Sorted by max severity, then most recent, then (repo, file). */
20686
+ items: external_exports.array(FindingLocationSummary),
20687
+ nextCursor: external_exports.string().nullable()
20632
20688
  }).meta({ id: "ListFindingLocationsResponse" });
20633
20689
 
20634
20690
  // ../../packages/schema/src/zod/meta.ts
@@ -21793,6 +21849,14 @@ var ControlPlaneErrorBody = external_exports.object({
21793
21849
  message: external_exports.string().optional()
21794
21850
  }).optional()
21795
21851
  });
21852
+ var RemoteFailureKind = external_exports.enum([
21853
+ "unauthorized",
21854
+ "forbidden",
21855
+ "route-absent",
21856
+ "invalid-request",
21857
+ "rejected",
21858
+ "unreachable"
21859
+ ]);
21796
21860
  var AttachDeviceRequest = external_exports.object({
21797
21861
  // This machine's own continuity id, so re-attaching ROTATES the credential
21798
21862
  // on one machine record instead of producing a second one. Client-minted
@@ -21854,6 +21918,26 @@ var AttachTokenResponse = external_exports.union([
21854
21918
  AttachTokenExpired,
21855
21919
  external_exports.object({ status: printable(64) })
21856
21920
  ]);
21921
+ var DeviceCommandKind = external_exports.enum(["shares_rescan"]);
21922
+ var DeviceCommand = external_exports.object({
21923
+ id: printable(128).min(1),
21924
+ kind: DeviceCommandKind,
21925
+ issuedAt: printable(64).min(1),
21926
+ expiresAt: printable(64).min(1)
21927
+ }).strict();
21928
+ var DeviceCommandPollResponse = external_exports.object({ command: DeviceCommand.nullable() });
21929
+ var DeviceCommandFailureReason = external_exports.enum(["scan_failed", "no_projects", "expired"]);
21930
+ var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
21931
+ external_exports.object({
21932
+ outcome: external_exports.literal("reported"),
21933
+ projectsScanned: external_exports.number().int().nonnegative()
21934
+ }).strict(),
21935
+ external_exports.object({
21936
+ outcome: external_exports.literal("failed"),
21937
+ reason: DeviceCommandFailureReason,
21938
+ projectsScanned: external_exports.number().int().nonnegative()
21939
+ }).strict()
21940
+ ]);
21857
21941
 
21858
21942
  // ../../packages/schema/src/zod/registry.ts
21859
21943
  var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
@@ -22020,7 +22104,7 @@ var PackManifest = external_exports.object({
22020
22104
  }).meta({ id: "PackManifest" });
22021
22105
 
22022
22106
  // ../../packages/schema/src/zod/detection.ts
22023
- var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
22107
+ var OriginEnum = external_exports.enum(["library", "custom"]).meta({ id: "OriginEnum" });
22024
22108
  var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
22025
22109
  var LibraryStateEnum = external_exports.enum(["new", "imported", "update"]).meta({ id: "LibraryStateEnum" });
22026
22110
  var DetectionCounts = external_exports.object({
@@ -22215,8 +22299,9 @@ var Event = external_exports.object({
22215
22299
  metadata: EventMetadata.optional()
22216
22300
  }).meta({ id: "Event" });
22217
22301
  var IngestEvent = Event.meta({ id: "IngestEvent" });
22302
+ var INGEST_BATCH_MAX = 100;
22218
22303
  var IngestBatch = external_exports.object({
22219
- events: external_exports.array(IngestEvent).min(1).max(100),
22304
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
22220
22305
  // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
22221
22306
  // additionally rejects any event whose contentHash the store has already
22222
22307
  // recorded — for re-runnable bulk ingest (worktree scan, transcript
@@ -22342,6 +22427,225 @@ var PatchInstalledPackRequest = external_exports.object({
22342
22427
  message: "At least one field must be provided"
22343
22428
  }).meta({ id: "PatchInstalledPackRequest" });
22344
22429
 
22430
+ // ../../packages/schema/src/zod/policy.ts
22431
+ var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22432
+ var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22433
+ var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22434
+ var PolicyProvenance = external_exports.enum(["builtin", "authored"]).meta({ id: "PolicyProvenance" });
22435
+ var Policy = external_exports.object({
22436
+ id: external_exports.guid(),
22437
+ scope: PolicyScope,
22438
+ target: PolicyTarget,
22439
+ action: ActionTaken,
22440
+ enabled: external_exports.boolean().default(true),
22441
+ customKeywords: external_exports.array(external_exports.string()).optional(),
22442
+ // Display name — optional so older policy rows without name still parse.
22443
+ // Added for the findings API (policy.name column migration).
22444
+ name: external_exports.string().optional(),
22445
+ // Whether an AUTHORED policy governs this row's target — not a claim about
22446
+ // which row this is. A producer that collapses several rows onto one target
22447
+ // must carry the marker onto whichever row survives, or the collapse decides
22448
+ // the answer; a survivor may therefore be a built-in expansion still marked
22449
+ // 'authored' because an authored sibling targeted the same thing.
22450
+ // Optional so an older producer — and an older on-disk cache — still parses;
22451
+ // absent reads as 'builtin', which is the behaviour that predates the field.
22452
+ //
22453
+ // Deliberately NOT `kind`/PolicyKind: that name and that enum answer which
22454
+ // built-in archetype catalog entry a policy is, which every catalog surface
22455
+ // reads and which a caller may state. This one is a statement the PRODUCER
22456
+ // of a bundle makes about a row, and only the bundle builder ever stamps it
22457
+ // — the CRUD routes neither accept nor set it.
22458
+ //
22459
+ // A device consumes this in exactly one direction: an 'authored' policy
22460
+ // arriving from a control plane marks the rules it targets as not
22461
+ // locally re-assignable. That can only ever ADD a refusal, never relax one,
22462
+ // which is what makes it safe to honour from an unsigned cache — the same
22463
+ // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22464
+ provenance: PolicyProvenance.optional()
22465
+ }).meta({ id: "Policy" });
22466
+ var PolicyBundle = external_exports.object({
22467
+ version: external_exports.string(),
22468
+ policies: external_exports.array(Policy),
22469
+ // Rules from the installed marketplace packs (snapshotted by the
22470
+ // control plane). The plugin registers these in addition to its bundled
22471
+ // packs. Optional so older backends — and older on-disk caches — that omit
22472
+ // the field still parse; consumers read `bundle.rules ?? []`.
22473
+ rules: external_exports.array(Rule).optional(),
22474
+ // When true, `rules` IS the complete effective ruleset and the runtime must
22475
+ // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22476
+ // after reading the user's installed snapshot (installed_packs, enabled
22477
+ // packs only), which is how detection updates stay manual: new bundled
22478
+ // rules run only after the user applies the pack update. Absent/false keeps
22479
+ // the historical composition (bundled packs + rules) — older caches.
22480
+ rulesComplete: external_exports.boolean().optional(),
22481
+ // Active detection exceptions, evaluation subset only (see
22482
+ // ExceptionBundleEntry). Optional so older bundle producers — and older
22483
+ // on-disk caches — that omit the field still parse; consumers read
22484
+ // `bundle.exceptions ?? []`.
22485
+ exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22486
+ // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22487
+ // A second axis over the same `redact` action, carried beside the policies
22488
+ // rather than on them: nothing writes ruleId-targeted policies to disk, so
22489
+ // widening Policy itself would change a persisted shape to express something
22490
+ // only the in-memory bundle needs. Optional so an older producer — or an
22491
+ // older on-disk cache — still parses; consumers read `?? []` and get the
22492
+ // pre-existing one-way behaviour, which is the safe direction to default.
22493
+ reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22494
+ // Installed pack version, keyed by ruleId, for rules in `rules` that came
22495
+ // from a versioned installed pack. Optional so older backends — and older
22496
+ // on-disk caches — that omit the field still parse; consumers fall back to
22497
+ // the rule's own spec version. NOT the bundle version above — see
22498
+ // installedRuleset's ruleVersions for the source of truth.
22499
+ ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22500
+ // Model ids (the raw `model` string a harness reports, e.g.
22501
+ // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22502
+ // a session onto one (PreModelSwitch) and refuses a turn that would run on
22503
+ // one (UserPromptSubmit). Optional so an older backend — and an older
22504
+ // on-disk cache — still parses; consumers read `?? []`, which is the
22505
+ // unenforced behaviour that predates this field and the safe direction to
22506
+ // default.
22507
+ //
22508
+ // Ids, not display names: the governance decision is keyed on the exact
22509
+ // string the harness reports (`model_status_override.versionId` in the
22510
+ // control plane), so no name resolution stands between the decision and the
22511
+ // comparison.
22512
+ prohibitedModels: external_exports.array(external_exports.string()).optional(),
22513
+ customKeywords: external_exports.array(external_exports.string()),
22514
+ fetchedAt: external_exports.iso.datetime()
22515
+ }).meta({ id: "PolicyBundle" });
22516
+ var POLICY_BUNDLE_SHAPE_ID = [
22517
+ ...Object.keys(PolicyBundle.shape),
22518
+ ...Object.keys(Policy.shape).map((key) => `policies.${key}`),
22519
+ ...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
22520
+ ...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
22521
+ ].sort().join(",");
22522
+ var OBSERVE_ONLY_CATEGORIES = ["config"];
22523
+ var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22524
+ var CATEGORY_PEAK_SEVERITY = {
22525
+ secret: "critical",
22526
+ financial: "critical",
22527
+ // core-financial/credit-card
22528
+ code_flaw: "critical",
22529
+ pii: "high",
22530
+ phi: "high",
22531
+ custom: "high",
22532
+ // user-defined; conservative
22533
+ code_context: "low",
22534
+ config: "low"
22535
+ // observe-only; floors to monitor regardless
22536
+ };
22537
+ function severityFloorPolicy(category) {
22538
+ if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22539
+ const peak = CATEGORY_PEAK_SEVERITY[category];
22540
+ return peak === "critical" || peak === "high" ? "warn" : "monitor";
22541
+ }
22542
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22543
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22544
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22545
+ id: "RedactFallback"
22546
+ });
22547
+ var BUILTIN_POLICY_SPECS = {
22548
+ monitor: {
22549
+ name: "Monitor",
22550
+ action: "log",
22551
+ reversible: false,
22552
+ description: "Log every match for audit. The request is allowed through untouched."
22553
+ },
22554
+ warn: {
22555
+ name: "Warn",
22556
+ action: "warn",
22557
+ reversible: false,
22558
+ description: "Allow the request, but warn the user inline before it is sent."
22559
+ },
22560
+ redact: {
22561
+ name: "Redact",
22562
+ action: "redact",
22563
+ reversible: false,
22564
+ description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22565
+ },
22566
+ vault: {
22567
+ name: "Redact & Vault",
22568
+ action: "redact",
22569
+ reversible: true,
22570
+ 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."
22571
+ },
22572
+ block: {
22573
+ name: "Block",
22574
+ action: "block",
22575
+ reversible: false,
22576
+ description: "Refuse the request entirely whenever any rule in this detection matches."
22577
+ }
22578
+ };
22579
+ function builtinPolicyToAction(id) {
22580
+ return BUILTIN_POLICY_SPECS[id].action;
22581
+ }
22582
+ var PALETTE_WEAKEST_FIRST = [
22583
+ ...new Set(KNOWN_BUILTIN_IDS.map(builtinPolicyToAction))
22584
+ ];
22585
+ var BELOW_PALETTE = ACTION_TAKEN_KEYS.filter(
22586
+ (action) => !PALETTE_WEAKEST_FIRST.includes(action)
22587
+ );
22588
+ var ACTION_STRENGTH_ORDER = [
22589
+ ...BELOW_PALETTE,
22590
+ ...PALETTE_WEAKEST_FIRST
22591
+ ];
22592
+ var PackPolicyFloor = external_exports.object({
22593
+ /**
22594
+ * The weakest archetype the device may assign. Stated as a BuiltinPolicyId
22595
+ * rather than a raw ActionTaken because that is the vocabulary the user
22596
+ * picks from — a floor a UI cannot name is one it cannot explain.
22597
+ */
22598
+ floor: BuiltinPolicyId,
22599
+ /**
22600
+ * True when the organization AUTHORED a policy governing this pack rather
22601
+ * than stating a minimum: it gave the answer, so the pack is not
22602
+ * re-assignable locally in either direction.
22603
+ */
22604
+ locked: external_exports.boolean()
22605
+ }).describe("PackPolicyFloor");
22606
+ var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22607
+ (id) => !BUILTIN_POLICY_SPECS[id].reversible
22608
+ );
22609
+ var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22610
+ (id) => BUILTIN_POLICY_SPECS[id].reversible
22611
+ );
22612
+ var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22613
+ var DEFAULT_ACTIONS = Object.fromEntries(
22614
+ DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22615
+ );
22616
+ var BUILTIN_POLICIES = Object.fromEntries(
22617
+ KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22618
+ );
22619
+ var UsedByItem = external_exports.object({
22620
+ id: external_exports.string(),
22621
+ name: external_exports.string(),
22622
+ ruleCount: external_exports.number().int().nonnegative(),
22623
+ enabled: external_exports.boolean()
22624
+ }).meta({ id: "UsedByItem" });
22625
+ var PolicyListItem = external_exports.object({
22626
+ id: external_exports.string(),
22627
+ kind: PolicyKind,
22628
+ name: external_exports.string(),
22629
+ enabled: external_exports.boolean(),
22630
+ usedByCount: external_exports.number().int().nonnegative()
22631
+ }).meta({ id: "PolicyListItem" });
22632
+ var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22633
+ var PolicyDetail = external_exports.object({
22634
+ specVersion: external_exports.literal(1),
22635
+ id: external_exports.string(),
22636
+ kind: PolicyKind,
22637
+ name: external_exports.string(),
22638
+ enabled: external_exports.boolean(),
22639
+ description: external_exports.string(),
22640
+ usedBy: external_exports.array(UsedByItem)
22641
+ }).meta({ id: "PolicyDetail" });
22642
+ var PolicyStatsResponse = external_exports.object({
22643
+ policies: external_exports.number().int().nonnegative(),
22644
+ builtin: external_exports.number().int().nonnegative(),
22645
+ custom: external_exports.number().int().nonnegative(),
22646
+ detectionsGoverned: external_exports.number().int().nonnegative()
22647
+ }).meta({ id: "PolicyStatsResponse" });
22648
+
22345
22649
  // ../../packages/schema/src/zod/vault.ts
22346
22650
  var CATEGORY_ALTERNATION = DetectionCategory.options.join("|");
22347
22651
  var POINTER_TOKEN_PATTERN = new RegExp(
@@ -22378,6 +22682,14 @@ var VaultEntry = external_exports.object({
22378
22682
  // How many times this value has been detected on this machine — the reuse
22379
22683
  // signal the vault dashboard reads. Distinct from VaultDeref.pointerCount.
22380
22684
  occurrenceCount: external_exports.number().int().nonnegative(),
22685
+ // True when a PERSON asked for this value to be replaced — the surfaced-
22686
+ // secrets strike — rather than a pack enforcing its assignment. One value is
22687
+ // one row however many paths vault it, so this is what tells a policy sweep
22688
+ // that the row carries somebody's own instruction and not just an assignment
22689
+ // that has since been lowered. STICKY and MONOTONIC: a later automatic
22690
+ // vaulting of the same value must never clear it — what the user said about
22691
+ // the value does not expire.
22692
+ userAuthorized: external_exports.boolean(),
22381
22693
  firstSeen: external_exports.string(),
22382
22694
  lastSeen: external_exports.string()
22383
22695
  });
@@ -22493,7 +22805,7 @@ var VaultConsent = external_exports.object({
22493
22805
  });
22494
22806
 
22495
22807
  // ../../packages/schema/src/zod/local.ts
22496
- var WORKSPACE_SETTINGS_SPEC_VERSION = 6;
22808
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22497
22809
  var RunMode = external_exports.enum(["standalone", "attached"]);
22498
22810
  var ControlPlaneConnection = external_exports.object({
22499
22811
  endpoint: external_exports.string().min(1),
@@ -22534,6 +22846,19 @@ var WorkspaceSettings = external_exports.object({
22534
22846
  vaultKeyCustody: VaultKeyCustody.default("file"),
22535
22847
  // How a pointer renders in assistant prose on screen (see VaultInlineReveal).
22536
22848
  vaultInlineReveal: VaultInlineReveal.default("masked"),
22849
+ // What a `redact` policy degrades to on a FIELD the host cannot rewrite in
22850
+ // place. Not a handling policy: the policy has already resolved to redact,
22851
+ // and this only says what happens when the host offers no channel to carry it
22852
+ // out — Antigravity's PreToolUse has no updatedInput at all, and Codex and
22853
+ // Claude Code decline to mask a field that EXECUTES because masking would
22854
+ // change what runs. Per FIELD rather than per host, so a host that can
22855
+ // rewrite some inputs keeps true redaction on those.
22856
+ //
22857
+ // Spelled in the built-in policy vocabulary rather than as a fresh enum, so
22858
+ // an attached machine's merge is `strongerAction` over the one action ladder
22859
+ // and no second rank order exists to drift from it. 'deny' is a host wire
22860
+ // word and stays out of the stored value.
22861
+ redactFallback: RedactFallback.default("warn"),
22537
22862
  // Absent until /aka:setup completes; its presence is what "onboarded" means.
22538
22863
  onboardedAt: external_exports.iso.datetime().optional(),
22539
22864
  // Records that the user consented to sending findings to the model API for
@@ -22541,10 +22866,12 @@ var WorkspaceSettings = external_exports.object({
22541
22866
  // Absent until granted; a stale payloadVersion means the consent no longer
22542
22867
  // covers the current payload and must be re-granted.
22543
22868
  modelJudgeConsent: ModelJudgeConsent.optional(),
22544
- // Records that the user consented to sending the activity already recorded on
22545
- // this machine to the deployment it is attached to, along with the payload
22546
- // shape and the endpoint they agreed to. Absent until granted, and a grant for
22547
- // a different endpoint or an older payload no longer counts.
22869
+ // Records that the user consented to the DEFERRED send — the outbox — along
22870
+ // with the payload shape and the endpoint they agreed to. Since payload v3
22871
+ // that covers the pre-attach backlog AND undelivered captures alike, and both
22872
+ // carry prompt/reply/tool-output text in `content`; the key name predates
22873
+ // both widenings. Absent until granted, and a grant for a different endpoint
22874
+ // or an older payload no longer counts.
22548
22875
  historySyncConsent: HistorySyncConsent.optional()
22549
22876
  });
22550
22877
 
@@ -22557,8 +22884,12 @@ var ManagedSettingKey = external_exports.enum([
22557
22884
  "vaultKeyCustody",
22558
22885
  "vaultInlineReveal",
22559
22886
  "modelJudgeConsent",
22560
- "dataSharesInPlace"
22887
+ "dataSharesInPlace",
22888
+ "redactFallback"
22561
22889
  ]).meta({ id: "ManagedSettingKey" });
22890
+ function isManagedSettingKey(value) {
22891
+ return ManagedSettingKey.safeParse(value).success;
22892
+ }
22562
22893
  var ManagedSettingsValues = external_exports.object({
22563
22894
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
22564
22895
  controlPlane: external_exports.object({
@@ -22570,7 +22901,8 @@ var ManagedSettingsValues = external_exports.object({
22570
22901
  vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
22571
22902
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22572
22903
  modelJudgeConsent: external_exports.boolean().optional(),
22573
- dataSharesInPlace: external_exports.boolean().optional()
22904
+ dataSharesInPlace: external_exports.boolean().optional(),
22905
+ redactFallback: RedactFallback.optional()
22574
22906
  }).meta({ id: "ManagedSettingsValues" });
22575
22907
  var ManagedSettings = external_exports.object({
22576
22908
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22582,173 +22914,28 @@ var ManagedSettings = external_exports.object({
22582
22914
  // Which of those the user may not change. A key here with no matching value
22583
22915
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22584
22916
  // the user may still override. The two are separable on purpose.
22585
- lockedFields: external_exports.array(ManagedSettingKey).default([])
22586
- }).meta({ id: "ManagedSettings" });
22587
-
22588
- // ../../packages/schema/src/zod/policy.ts
22589
- var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22590
- var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22591
- var Policy = external_exports.object({
22592
- id: external_exports.guid(),
22593
- scope: PolicyScope,
22594
- target: PolicyTarget,
22595
- action: ActionTaken,
22596
- enabled: external_exports.boolean().default(true),
22597
- customKeywords: external_exports.array(external_exports.string()).optional(),
22598
- // Display name — optional so older policy rows without name still parse.
22599
- // Added for the findings API (policy.name column migration).
22600
- name: external_exports.string().optional()
22601
- }).meta({ id: "Policy" });
22602
- var PolicyBundle = external_exports.object({
22603
- version: external_exports.string(),
22604
- policies: external_exports.array(Policy),
22605
- // Rules from the installed marketplace packs (snapshotted by the
22606
- // control plane). The plugin registers these in addition to its bundled
22607
- // packs. Optional so older backends — and older on-disk caches — that omit
22608
- // the field still parse; consumers read `bundle.rules ?? []`.
22609
- rules: external_exports.array(Rule).optional(),
22610
- // When true, `rules` IS the complete effective ruleset and the runtime must
22611
- // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22612
- // after reading the user's installed snapshot (installed_packs, enabled
22613
- // packs only), which is how detection updates stay manual: new bundled
22614
- // rules run only after the user applies the pack update. Absent/false keeps
22615
- // the historical composition (bundled packs + rules) — older caches.
22616
- rulesComplete: external_exports.boolean().optional(),
22617
- // Active detection exceptions, evaluation subset only (see
22618
- // ExceptionBundleEntry). Optional so older bundle producers — and older
22619
- // on-disk caches — that omit the field still parse; consumers read
22620
- // `bundle.exceptions ?? []`.
22621
- exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22622
- // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22623
- // A second axis over the same `redact` action, carried beside the policies
22624
- // rather than on them: nothing writes ruleId-targeted policies to disk, so
22625
- // widening Policy itself would change a persisted shape to express something
22626
- // only the in-memory bundle needs. Optional so an older producer — or an
22627
- // older on-disk cache — still parses; consumers read `?? []` and get the
22628
- // pre-existing one-way behaviour, which is the safe direction to default.
22629
- reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22630
- // Installed pack version, keyed by ruleId, for rules in `rules` that came
22631
- // from a versioned installed pack. Optional so older backends — and older
22632
- // on-disk caches — that omit the field still parse; consumers fall back to
22633
- // the rule's own spec version. NOT the bundle version above — see
22634
- // installedRuleset's ruleVersions for the source of truth.
22635
- ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22636
- // Model ids (the raw `model` string a harness reports, e.g.
22637
- // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22638
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
22639
- // one (UserPromptSubmit). Optional so an older backend — and an older
22640
- // on-disk cache — still parses; consumers read `?? []`, which is the
22641
- // unenforced behaviour that predates this field and the safe direction to
22642
- // default.
22643
22917
  //
22644
- // Ids, not display names: the governance decision is keyed on the exact
22645
- // string the harness reports (`model_status_override.versionId` in the
22646
- // control plane), so no name resolution stands between the decision and the
22647
- // comparison.
22648
- prohibitedModels: external_exports.array(external_exports.string()).optional(),
22649
- customKeywords: external_exports.array(external_exports.string()),
22650
- fetchedAt: external_exports.iso.datetime()
22651
- }).meta({ id: "PolicyBundle" });
22652
- var OBSERVE_ONLY_CATEGORIES = ["config"];
22653
- var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22654
- var CATEGORY_PEAK_SEVERITY = {
22655
- secret: "critical",
22656
- financial: "critical",
22657
- // core-financial/credit-card
22658
- code_flaw: "critical",
22659
- pii: "high",
22660
- phi: "high",
22661
- custom: "high",
22662
- // user-defined; conservative
22663
- code_context: "low",
22664
- config: "low"
22665
- // observe-only; floors to monitor regardless
22666
- };
22667
- function severityFloorPolicy(category) {
22668
- if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22669
- const peak = CATEGORY_PEAK_SEVERITY[category];
22670
- return peak === "critical" || peak === "high" ? "warn" : "monitor";
22671
- }
22672
- var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22673
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22674
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22675
- var BUILTIN_POLICY_SPECS = {
22676
- monitor: {
22677
- name: "Monitor",
22678
- action: "log",
22679
- reversible: false,
22680
- description: "Log every match for audit. The request is allowed through untouched."
22681
- },
22682
- warn: {
22683
- name: "Warn",
22684
- action: "warn",
22685
- reversible: false,
22686
- description: "Allow the request, but warn the user inline before it is sent."
22687
- },
22688
- redact: {
22689
- name: "Redact",
22690
- action: "redact",
22691
- reversible: false,
22692
- description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22693
- },
22694
- vault: {
22695
- name: "Redact & Vault",
22696
- action: "redact",
22697
- reversible: true,
22698
- 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."
22699
- },
22700
- block: {
22701
- name: "Block",
22702
- action: "block",
22703
- reversible: false,
22704
- description: "Refuse the request entirely whenever any rule in this detection matches."
22918
+ // Parsed as NAMES rather than as the enum, and split below: a name this
22919
+ // build does not know is dropped from the locked set and reported, never a
22920
+ // reason to refuse the file. The same shape reaches an older build whenever
22921
+ // an administrator locks a key a newer build added, and refusing it there
22922
+ // ran that build entirely unmanaged — every pin and lock gone — on exactly
22923
+ // the fleets most likely to carry a version skew. A name outside the enum
22924
+ // is still never HONOURED: the lockable set stays explicit above.
22925
+ lockedFields: external_exports.array(external_exports.string()).default([])
22926
+ }).transform(({ lockedFields, ...rest }) => {
22927
+ const known = [];
22928
+ const unknown2 = [];
22929
+ for (const name of lockedFields) {
22930
+ if (isManagedSettingKey(name)) known.push(name);
22931
+ else unknown2.push(name);
22705
22932
  }
22706
- };
22707
- function builtinPolicyToAction(id) {
22708
- return BUILTIN_POLICY_SPECS[id].action;
22709
- }
22710
- var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22711
- (id) => !BUILTIN_POLICY_SPECS[id].reversible
22712
- );
22713
- var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22714
- (id) => BUILTIN_POLICY_SPECS[id].reversible
22715
- );
22716
- var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22717
- var DEFAULT_ACTIONS = Object.fromEntries(
22718
- DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22719
- );
22720
- var BUILTIN_POLICIES = Object.fromEntries(
22721
- KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22722
- );
22723
- var UsedByItem = external_exports.object({
22724
- id: external_exports.string(),
22725
- name: external_exports.string(),
22726
- ruleCount: external_exports.number().int().nonnegative(),
22727
- enabled: external_exports.boolean()
22728
- }).meta({ id: "UsedByItem" });
22729
- var PolicyListItem = external_exports.object({
22730
- id: external_exports.string(),
22731
- kind: PolicyKind,
22732
- name: external_exports.string(),
22733
- enabled: external_exports.boolean(),
22734
- usedByCount: external_exports.number().int().nonnegative()
22735
- }).meta({ id: "PolicyListItem" });
22736
- var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22737
- var PolicyDetail = external_exports.object({
22738
- specVersion: external_exports.literal(1),
22739
- id: external_exports.string(),
22740
- kind: PolicyKind,
22741
- name: external_exports.string(),
22742
- enabled: external_exports.boolean(),
22743
- description: external_exports.string(),
22744
- usedBy: external_exports.array(UsedByItem)
22745
- }).meta({ id: "PolicyDetail" });
22746
- var PolicyStatsResponse = external_exports.object({
22747
- policies: external_exports.number().int().nonnegative(),
22748
- builtin: external_exports.number().int().nonnegative(),
22749
- custom: external_exports.number().int().nonnegative(),
22750
- detectionsGoverned: external_exports.number().int().nonnegative()
22751
- }).meta({ id: "PolicyStatsResponse" });
22933
+ return {
22934
+ ...rest,
22935
+ lockedFields: known,
22936
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
22937
+ };
22938
+ }).meta({ id: "ManagedSettings" });
22752
22939
 
22753
22940
  // ../../packages/schema/src/zod/project-files.ts
22754
22941
  var ProjectFileInput = external_exports.object({
@@ -22865,7 +23052,11 @@ var FindingsTimeseriesPoint = external_exports.object({
22865
23052
  timestamp: external_exports.iso.date(),
22866
23053
  critical: external_exports.number().int().nonnegative(),
22867
23054
  high: external_exports.number().int().nonnegative(),
22868
- medium: external_exports.number().int().nonnegative()
23055
+ medium: external_exports.number().int().nonnegative(),
23056
+ // Optional and additive, so a producer written against the earlier
23057
+ // three-series contract keeps validating. A consumer plotting it resolves the
23058
+ // absent case itself — the chart point requires a number.
23059
+ low: external_exports.number().int().nonnegative().optional()
22869
23060
  }).meta({ id: "FindingsTimeseriesPoint" });
22870
23061
  var FindingsTimeseriesResponse = external_exports.object({
22871
23062
  range: TimeRange,
@@ -22891,6 +23082,10 @@ var ResolvedFeedItem = external_exports.object({
22891
23082
  findingKey: external_exports.string(),
22892
23083
  ruleId: external_exports.string(),
22893
23084
  severity: Severity,
23085
+ // Repository slug, and the file path RELATIVE to it. The pair is what
23086
+ // identifies the file: a bare path matches the same name in every repo.
23087
+ // Optional and additive; empty when the event carried no repo.
23088
+ repo: external_exports.string().optional(),
22894
23089
  path: external_exports.string(),
22895
23090
  // ISO-8601 datetime (matches FindingInstance.detectedAt / the rest of the
22896
23091
  // findings domain). The reader `.toISOString()`s the DB epoch-ms values.
@@ -22989,10 +23184,12 @@ var DismissRecommendedActionResponse = external_exports.object({ id: external_ex
22989
23184
  var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
22990
23185
 
22991
23186
  // ../../packages/schema/src/zod/settings-action.ts
23187
+ var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23188
+ var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
22992
23189
  var SaveSettingsInput = external_exports.object({
22993
23190
  historicalAccess: external_exports.string(),
22994
- modelJudgeConsent: external_exports.boolean(),
22995
- historySyncConsent: external_exports.boolean(),
23191
+ modelJudgeConsent: ModelJudgeConsentChoice,
23192
+ historySyncConsent: HistorySyncConsentChoice,
22996
23193
  vaultConsent: external_exports.string(),
22997
23194
  vaultInlineReveal: external_exports.string()
22998
23195
  });
@@ -23133,8 +23330,8 @@ import {
23133
23330
  import { threadId } from "worker_threads";
23134
23331
 
23135
23332
  // ../../packages/persistence/src/database.ts
23136
- import { randomUUID as randomUUID10 } from "crypto";
23137
- import { join as join4, sep } from "path";
23333
+ import { randomUUID as randomUUID11 } from "crypto";
23334
+ import { dirname as dirname2, join as join7, sep } from "path";
23138
23335
  import { DatabaseSync } from "node:sqlite";
23139
23336
 
23140
23337
  // ../../packages/persistence/src/ids.ts
@@ -23150,6 +23347,20 @@ var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23150
23347
 
23151
23348
  // ../../packages/persistence/src/repositories/activity.ts
23152
23349
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
23350
+ var DB_EVENT_TYPE_TO_KIND = {
23351
+ session: "session",
23352
+ prompt: "prompt",
23353
+ response: "response",
23354
+ tool_call: "tool",
23355
+ hook: "hook",
23356
+ detection: "detection",
23357
+ share: "share",
23358
+ permission: "permission",
23359
+ commit: "commit",
23360
+ error: "error",
23361
+ active: "active"
23362
+ };
23363
+ var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
23153
23364
  var DEFAULT_HARNESS = HARNESS.ClaudeCode;
23154
23365
 
23155
23366
  // ../../packages/persistence/src/repositories/exceptions.ts
@@ -23163,15 +23374,75 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
23163
23374
  AND conditions IS NULL
23164
23375
  AND ${ACTIVE_PREDICATE}`;
23165
23376
 
23377
+ // ../../packages/persistence/src/repositories/resolution-sql.ts
23378
+ function latestResolutionColumnSql(column, findingsAlias) {
23379
+ return `(
23380
+ SELECT fr.${column} FROM finding_resolution fr
23381
+ WHERE fr.finding_key = ${findingsAlias}.finding_key
23382
+ ORDER BY fr.created_at DESC, fr.rowid DESC
23383
+ LIMIT 1
23384
+ )`;
23385
+ }
23386
+ function latestResolutionStatusSql(findingsAlias) {
23387
+ return latestResolutionColumnSql("status", findingsAlias);
23388
+ }
23389
+
23390
+ // ../../packages/persistence/src/repositories/findings.ts
23391
+ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
23392
+ d.severity AS severity, f.masked_match AS masked_match,
23393
+ f.action_taken AS action_taken, f.confidence AS confidence,
23394
+ e.started_at AS occurred_at,
23395
+ e.source_tool AS source_tool,
23396
+ e.repo AS repo,
23397
+ e.file_path AS file,
23398
+ e.tool_name AS tool_name,
23399
+ f.audit_event_id AS event_id, e.root_session_id AS session_id,
23400
+ e.event_type AS kind, f.finding_key AS finding_key,
23401
+ ${latestResolutionStatusSql("f")} AS latest_status`;
23402
+
23166
23403
  // ../../packages/persistence/src/repositories/history-sync.ts
23167
23404
  var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23168
23405
  var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23406
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23407
+ var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23169
23408
 
23170
23409
  // ../../packages/persistence/src/repositories/installed-packs.ts
23171
- import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
23410
+ import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
23411
+
23412
+ // ../../packages/persistence/src/policy-floor.ts
23413
+ import { readFileSync as readFileSync5 } from "fs";
23414
+ import { join as join6 } from "path";
23415
+
23416
+ // ../../packages/persistence/src/local-layout.ts
23417
+ import { renameSync as renameSync3 } from "fs";
23418
+ import { mkdir } from "fs/promises";
23419
+ import { homedir } from "os";
23420
+ import { join as join4 } from "path";
23421
+
23422
+ // ../../packages/persistence/src/settings.ts
23423
+ import { readFileSync as readFileSync4 } from "fs";
23424
+ import { join as join5 } from "path";
23425
+
23426
+ // ../../packages/persistence/src/file-lock.ts
23427
+ import { randomUUID as randomUUID3 } from "crypto";
23428
+ import {
23429
+ closeSync,
23430
+ existsSync as existsSync2,
23431
+ openSync,
23432
+ readFileSync as readFileSync2,
23433
+ rmSync as rmSync5,
23434
+ statSync as statSync3,
23435
+ writeFileSync as writeFileSync2
23436
+ } from "fs";
23437
+ import { hostname as hostname3 } from "os";
23438
+ var PARK = new Int32Array(new SharedArrayBuffer(4));
23439
+
23440
+ // ../../packages/persistence/src/managed-settings.ts
23441
+ import { readFileSync as readFileSync3 } from "fs";
23442
+ import { posix, win32 } from "path";
23172
23443
 
23173
23444
  // ../../packages/persistence/src/repositories/inventory-assets.ts
23174
- import { randomUUID as randomUUID4 } from "crypto";
23445
+ import { randomUUID as randomUUID5 } from "crypto";
23175
23446
  var VALID_HARNESS_IDS = new Set(HarnessId.options);
23176
23447
  var HARNESS_LABELS = {
23177
23448
  [HARNESS.ClaudeCode]: "Claude Code",
@@ -23189,16 +23460,16 @@ var TITLE_NEEDLES = {
23189
23460
  };
23190
23461
 
23191
23462
  // ../../packages/persistence/src/repositories/policies.ts
23192
- import { randomUUID as randomUUID5 } from "crypto";
23463
+ import { randomUUID as randomUUID6 } from "crypto";
23193
23464
 
23194
23465
  // ../../packages/persistence/src/repositories/project-files.ts
23195
- import { randomUUID as randomUUID6 } from "crypto";
23466
+ import { randomUUID as randomUUID7 } from "crypto";
23196
23467
 
23197
23468
  // ../../packages/persistence/src/repositories/resolutions.ts
23198
- import { randomUUID as randomUUID7 } from "crypto";
23469
+ import { randomUUID as randomUUID8 } from "crypto";
23199
23470
 
23200
23471
  // ../../packages/persistence/src/repositories/secret-vault.ts
23201
- import { randomUUID as randomUUID8 } from "crypto";
23472
+ import { randomUUID as randomUUID9 } from "crypto";
23202
23473
 
23203
23474
  // ../../packages/persistence/src/repositories/security.ts
23204
23475
  var SCAN_COVERAGE = {
@@ -23213,53 +23484,35 @@ var SCAN_COVERAGE = {
23213
23484
  };
23214
23485
 
23215
23486
  // ../../packages/persistence/src/repositories/shares.ts
23216
- import { randomUUID as randomUUID9 } from "crypto";
23487
+ import { randomUUID as randomUUID10 } from "crypto";
23217
23488
 
23218
- // ../../packages/persistence/src/file-lock.ts
23219
- import { randomUUID as randomUUID11 } from "crypto";
23220
- import {
23221
- closeSync,
23222
- existsSync as existsSync2,
23223
- openSync,
23224
- readFileSync as readFileSync2,
23225
- rmSync as rmSync5,
23226
- statSync as statSync3,
23227
- writeFileSync as writeFileSync2
23228
- } from "fs";
23229
- import { hostname as hostname3 } from "os";
23230
- var PARK = new Int32Array(new SharedArrayBuffer(4));
23489
+ // ../../packages/persistence/src/database.ts
23490
+ var CAPTURE_GRAIN = new Set(EventKind.options);
23231
23491
 
23232
- // ../../packages/persistence/src/finding-key.ts
23492
+ // ../../packages/persistence/src/egress-wire.ts
23233
23493
  import { createHash as createHash3 } from "crypto";
23234
23494
 
23495
+ // ../../packages/persistence/src/finding-key.ts
23496
+ import { createHash as createHash4 } from "crypto";
23497
+
23235
23498
  // ../../packages/persistence/src/fingerprint.ts
23236
23499
  import { createHmac, randomBytes } from "crypto";
23237
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
23238
- import { join as join5 } from "path";
23500
+ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23501
+ import { join as join8 } from "path";
23239
23502
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23240
23503
 
23241
- // ../../packages/persistence/src/history-preview.ts
23504
+ // ../../packages/persistence/src/history-backfill.ts
23242
23505
  import { existsSync as existsSync4 } from "fs";
23243
- import { join as join6 } from "path";
23244
- import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23245
-
23246
- // ../../packages/persistence/src/local-layout.ts
23247
- import { renameSync as renameSync3 } from "fs";
23248
- import { mkdir } from "fs/promises";
23249
- import { homedir } from "os";
23250
- import { join as join7 } from "path";
23506
+ import { join as join9 } from "path";
23251
23507
 
23252
- // ../../packages/persistence/src/managed-settings.ts
23253
- import { readFileSync as readFileSync4 } from "fs";
23254
- import { posix, win32 } from "path";
23255
-
23256
- // ../../packages/persistence/src/settings.ts
23257
- import { readFileSync as readFileSync5 } from "fs";
23258
- import { join as join8 } from "path";
23508
+ // ../../packages/persistence/src/history-preview.ts
23509
+ import { existsSync as existsSync5 } from "fs";
23510
+ import { join as join10 } from "path";
23511
+ import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23259
23512
 
23260
23513
  // ../../packages/persistence/src/store-symlinks.ts
23261
- import { existsSync as existsSync5, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23262
- import { dirname as dirname2, join as join9, resolve } from "path";
23514
+ import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23515
+ import { dirname as dirname3, join as join11, resolve } from "path";
23263
23516
 
23264
23517
  // ../../packages/persistence/src/vault/crypto.ts
23265
23518
  import {
@@ -23273,15 +23526,15 @@ import {
23273
23526
  // ../../packages/persistence/src/vault/key-provider.ts
23274
23527
  import { execFileSync } from "child_process";
23275
23528
  import { randomBytes as randomBytes2 } from "crypto";
23276
- import { chmodSync as chmodSync3, readFileSync as readFileSync6, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23277
- import { join as join10 } from "path";
23529
+ import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23530
+ import { join as join12 } from "path";
23278
23531
 
23279
23532
  // ../../packages/persistence/src/vault/vault.ts
23280
23533
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23281
23534
 
23282
23535
  // ../../packages/persistence/src/warn-era-cap.ts
23283
- import { existsSync as existsSync6, writeFileSync as writeFileSync4 } from "fs";
23284
- import { join as join11 } from "path";
23536
+ import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23537
+ import { join as join13 } from "path";
23285
23538
 
23286
23539
  // ../../packages/plugin-sdk/src/provider-env.ts
23287
23540
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -23302,9 +23555,9 @@ var providerEnvShape = {
23302
23555
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
23303
23556
 
23304
23557
  // ../../packages/plugin-sdk/src/config-inventory.ts
23305
- import { readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23558
+ import { readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23306
23559
  import { homedir as homedir2 } from "os";
23307
- import { basename as basename3, join as join14 } from "path";
23560
+ import { basename as basename3, join as join16 } from "path";
23308
23561
 
23309
23562
  // ../../packages/detections/src/egress/registry.ts
23310
23563
  var EXTRACTOR_VERSION = "1";
@@ -24062,24 +24315,20 @@ var CPU_CORROBORATION_SHARE = 0.2;
24062
24315
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24063
24316
 
24064
24317
  // ../../packages/plugin-sdk/src/repo.ts
24065
- import { existsSync as existsSync8, readFileSync as readFileSync7, statSync as statSync6 } from "fs";
24066
- import { basename as basename2, dirname as dirname3, isAbsolute, join as join13, sep as sep2 } from "path";
24318
+ import { existsSync as existsSync9, readFileSync as readFileSync8, statSync as statSync6 } from "fs";
24319
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join15, sep as sep2 } from "path";
24067
24320
 
24068
24321
  // ../../packages/plugin-sdk/src/events.ts
24069
- import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
24322
+ import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
24070
24323
 
24071
24324
  // ../../packages/plugin-sdk/src/isolated-scan.ts
24072
- import { existsSync as existsSync9 } from "fs";
24325
+ import { existsSync as existsSync10 } from "fs";
24073
24326
  import { fileURLToPath } from "url";
24074
24327
  import { Worker } from "worker_threads";
24075
24328
 
24076
- // ../../packages/plugin-sdk/src/ignore-layers.ts
24077
- var import_ignore = __toESM(require_ignore(), 1);
24078
- import { readFileSync as readFileSync9 } from "fs";
24079
- import { join as join15 } from "path";
24080
-
24081
- // ../../packages/plugin-sdk/src/inventory-resolver.ts
24082
- import { arch, hostname as hostname4, platform, release } from "os";
24329
+ // ../../packages/plugin-sdk/src/host-floor.ts
24330
+ import { readFileSync as readFileSync11 } from "fs";
24331
+ import { join as join18 } from "path";
24083
24332
 
24084
24333
  // ../../packages/plugin-sdk/src/model-governance.ts
24085
24334
  import {
@@ -24091,20 +24340,46 @@ import {
24091
24340
  readSync,
24092
24341
  writeFileSync as writeFileSync5
24093
24342
  } from "fs";
24094
- import { join as join16 } from "path";
24343
+ import { join as join17 } from "path";
24095
24344
  var TAIL_BYTES = 256 * 1024;
24096
24345
 
24346
+ // ../../packages/plugin-sdk/src/host-floor.ts
24347
+ var HOST_FEATURE = {
24348
+ ModelSwitch: "model-switch",
24349
+ VaultPointerDisplay: "vault-pointer-display"
24350
+ };
24351
+ var HOST_FLOORS = {
24352
+ [HOST_FEATURE.ModelSwitch]: {
24353
+ label: "model-switch protection",
24354
+ hookEvents: ["PreModelSwitch", "PostModelSwitch"],
24355
+ since: "2.1.251"
24356
+ },
24357
+ [HOST_FEATURE.VaultPointerDisplay]: {
24358
+ label: "vault pointer display",
24359
+ hookEvents: ["MessageDisplay"],
24360
+ since: "2.1.152"
24361
+ }
24362
+ };
24363
+
24364
+ // ../../packages/plugin-sdk/src/ignore-layers.ts
24365
+ var import_ignore = __toESM(require_ignore(), 1);
24366
+ import { readFileSync as readFileSync12 } from "fs";
24367
+ import { join as join19 } from "path";
24368
+
24369
+ // ../../packages/plugin-sdk/src/inventory-resolver.ts
24370
+ import { arch, hostname as hostname4, platform, release } from "os";
24371
+
24097
24372
  // ../../packages/plugin-sdk/src/nudge.ts
24098
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync6 } from "fs";
24099
- import { join as join17 } from "path";
24373
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
24374
+ import { join as join20 } from "path";
24100
24375
 
24101
24376
  // ../../packages/plugin-sdk/src/paths.ts
24102
24377
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
24103
- import { basename as basename4, dirname as dirname4, sep as sep3 } from "path";
24378
+ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24104
24379
 
24105
24380
  // ../../packages/plugin-sdk/src/project-files.ts
24106
- import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
24107
- import { basename as basename5, join as join18 } from "path";
24381
+ import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
24382
+ import { basename as basename5, join as join21 } from "path";
24108
24383
 
24109
24384
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24110
24385
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24140,11 +24415,11 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24140
24415
 
24141
24416
  // ../../packages/plugin-sdk/src/throttle.ts
24142
24417
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24143
- import { join as join19 } from "path";
24418
+ import { join as join22 } from "path";
24144
24419
 
24145
24420
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
24146
24421
  import { writeFileSync as writeFileSync8 } from "fs";
24147
- import { join as join20 } from "path";
24422
+ import { join as join23 } from "path";
24148
24423
 
24149
24424
  // ../../packages/setup-wizard/src/triage/merge.ts
24150
24425
  var RANK = Object.fromEntries(
@@ -24152,9 +24427,9 @@ var RANK = Object.fromEntries(
24152
24427
  );
24153
24428
 
24154
24429
  // ../../packages/setup-wizard/src/triage/plan-file.ts
24155
- import { mkdtempSync, readFileSync as readFileSync12, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24430
+ import { mkdtempSync, readFileSync as readFileSync14, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24156
24431
  import { tmpdir } from "os";
24157
- import { basename as basename6, dirname as dirname5, join as join21 } from "path";
24432
+ import { basename as basename6, dirname as dirname6, join as join24 } from "path";
24158
24433
  var SuppressionEntrySchema = external_exports.object({
24159
24434
  ruleId: external_exports.string(),
24160
24435
  category: DetectionCategory,
@@ -24196,8 +24471,8 @@ var PersistedPlanSchema = external_exports.object({
24196
24471
  });
24197
24472
 
24198
24473
  // src/skills-registry.ts
24199
- import { readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
24200
- import { join as join22 } from "path";
24474
+ import { readdirSync as readdirSync5, readFileSync as readFileSync15 } from "fs";
24475
+ import { join as join25 } from "path";
24201
24476
  import { fileURLToPath as fileURLToPath2 } from "url";
24202
24477
  var SKILLS_DIR = fileURLToPath2(new URL("../skills", import.meta.url));
24203
24478
 
@@ -24237,7 +24512,7 @@ function authorName(author) {
24237
24512
  var manifestPath = process.argv[2];
24238
24513
  var manifest = {};
24239
24514
  try {
24240
- manifest = JSON.parse(readFileSync14(manifestPath ?? "", "utf8"));
24515
+ manifest = JSON.parse(readFileSync16(manifestPath ?? "", "utf8"));
24241
24516
  } catch {
24242
24517
  }
24243
24518
  process.stdout.write(