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

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.
@@ -22116,6 +22116,26 @@ var AttachTokenResponse = external_exports.union([
22116
22116
  AttachTokenExpired,
22117
22117
  external_exports.object({ status: printable(64) })
22118
22118
  ]);
22119
+ var DeviceCommandKind = external_exports.enum(["shares_rescan"]);
22120
+ var DeviceCommand = external_exports.object({
22121
+ id: printable(128).min(1),
22122
+ kind: DeviceCommandKind,
22123
+ issuedAt: printable(64).min(1),
22124
+ expiresAt: printable(64).min(1)
22125
+ }).strict();
22126
+ var DeviceCommandPollResponse = external_exports.object({ command: DeviceCommand.nullable() });
22127
+ var DeviceCommandFailureReason = external_exports.enum(["scan_failed", "no_projects", "expired"]);
22128
+ var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
22129
+ external_exports.object({
22130
+ outcome: external_exports.literal("reported"),
22131
+ projectsScanned: external_exports.number().int().nonnegative()
22132
+ }).strict(),
22133
+ external_exports.object({
22134
+ outcome: external_exports.literal("failed"),
22135
+ reason: DeviceCommandFailureReason,
22136
+ projectsScanned: external_exports.number().int().nonnegative()
22137
+ }).strict()
22138
+ ]);
22119
22139
 
22120
22140
  // ../../packages/schema/src/zod/registry.ts
22121
22141
  var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
@@ -22282,7 +22302,7 @@ var PackManifest = external_exports.object({
22282
22302
  }).meta({ id: "PackManifest" });
22283
22303
 
22284
22304
  // ../../packages/schema/src/zod/detection.ts
22285
- var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
22305
+ var OriginEnum = external_exports.enum(["library", "custom"]).meta({ id: "OriginEnum" });
22286
22306
  var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
22287
22307
  var LibraryStateEnum = external_exports.enum(["new", "imported", "update"]).meta({ id: "LibraryStateEnum" });
22288
22308
  var DetectionCounts = external_exports.object({
@@ -22477,8 +22497,9 @@ var Event = external_exports.object({
22477
22497
  metadata: EventMetadata.optional()
22478
22498
  }).meta({ id: "Event" });
22479
22499
  var IngestEvent = Event.meta({ id: "IngestEvent" });
22500
+ var INGEST_BATCH_MAX = 100;
22480
22501
  var IngestBatch = external_exports.object({
22481
- events: external_exports.array(IngestEvent).min(1).max(100),
22502
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
22482
22503
  // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
22483
22504
  // additionally rejects any event whose contentHash the store has already
22484
22505
  // recorded — for re-runnable bulk ingest (worktree scan, transcript
@@ -22604,6 +22625,225 @@ var PatchInstalledPackRequest = external_exports.object({
22604
22625
  message: "At least one field must be provided"
22605
22626
  }).meta({ id: "PatchInstalledPackRequest" });
22606
22627
 
22628
+ // ../../packages/schema/src/zod/policy.ts
22629
+ var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22630
+ var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22631
+ var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22632
+ var PolicyProvenance = external_exports.enum(["builtin", "authored"]).meta({ id: "PolicyProvenance" });
22633
+ var Policy = external_exports.object({
22634
+ id: external_exports.guid(),
22635
+ scope: PolicyScope,
22636
+ target: PolicyTarget,
22637
+ action: ActionTaken,
22638
+ enabled: external_exports.boolean().default(true),
22639
+ customKeywords: external_exports.array(external_exports.string()).optional(),
22640
+ // Display name — optional so older policy rows without name still parse.
22641
+ // Added for the findings API (policy.name column migration).
22642
+ name: external_exports.string().optional(),
22643
+ // Whether an AUTHORED policy governs this row's target — not a claim about
22644
+ // which row this is. A producer that collapses several rows onto one target
22645
+ // must carry the marker onto whichever row survives, or the collapse decides
22646
+ // the answer; a survivor may therefore be a built-in expansion still marked
22647
+ // 'authored' because an authored sibling targeted the same thing.
22648
+ // Optional so an older producer — and an older on-disk cache — still parses;
22649
+ // absent reads as 'builtin', which is the behaviour that predates the field.
22650
+ //
22651
+ // Deliberately NOT `kind`/PolicyKind: that name and that enum answer which
22652
+ // built-in archetype catalog entry a policy is, which every catalog surface
22653
+ // reads and which a caller may state. This one is a statement the PRODUCER
22654
+ // of a bundle makes about a row, and only the bundle builder ever stamps it
22655
+ // — the CRUD routes neither accept nor set it.
22656
+ //
22657
+ // A device consumes this in exactly one direction: an 'authored' policy
22658
+ // arriving from a control plane marks the rules it targets as not
22659
+ // locally re-assignable. That can only ever ADD a refusal, never relax one,
22660
+ // which is what makes it safe to honour from an unsigned cache — the same
22661
+ // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22662
+ provenance: PolicyProvenance.optional()
22663
+ }).meta({ id: "Policy" });
22664
+ var PolicyBundle = external_exports.object({
22665
+ version: external_exports.string(),
22666
+ policies: external_exports.array(Policy),
22667
+ // Rules from the installed marketplace packs (snapshotted by the
22668
+ // control plane). The plugin registers these in addition to its bundled
22669
+ // packs. Optional so older backends — and older on-disk caches — that omit
22670
+ // the field still parse; consumers read `bundle.rules ?? []`.
22671
+ rules: external_exports.array(Rule).optional(),
22672
+ // When true, `rules` IS the complete effective ruleset and the runtime must
22673
+ // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22674
+ // after reading the user's installed snapshot (installed_packs, enabled
22675
+ // packs only), which is how detection updates stay manual: new bundled
22676
+ // rules run only after the user applies the pack update. Absent/false keeps
22677
+ // the historical composition (bundled packs + rules) — older caches.
22678
+ rulesComplete: external_exports.boolean().optional(),
22679
+ // Active detection exceptions, evaluation subset only (see
22680
+ // ExceptionBundleEntry). Optional so older bundle producers — and older
22681
+ // on-disk caches — that omit the field still parse; consumers read
22682
+ // `bundle.exceptions ?? []`.
22683
+ exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22684
+ // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22685
+ // A second axis over the same `redact` action, carried beside the policies
22686
+ // rather than on them: nothing writes ruleId-targeted policies to disk, so
22687
+ // widening Policy itself would change a persisted shape to express something
22688
+ // only the in-memory bundle needs. Optional so an older producer — or an
22689
+ // older on-disk cache — still parses; consumers read `?? []` and get the
22690
+ // pre-existing one-way behaviour, which is the safe direction to default.
22691
+ reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22692
+ // Installed pack version, keyed by ruleId, for rules in `rules` that came
22693
+ // from a versioned installed pack. Optional so older backends — and older
22694
+ // on-disk caches — that omit the field still parse; consumers fall back to
22695
+ // the rule's own spec version. NOT the bundle version above — see
22696
+ // installedRuleset's ruleVersions for the source of truth.
22697
+ ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22698
+ // Model ids (the raw `model` string a harness reports, e.g.
22699
+ // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22700
+ // a session onto one (PreModelSwitch) and refuses a turn that would run on
22701
+ // one (UserPromptSubmit). Optional so an older backend — and an older
22702
+ // on-disk cache — still parses; consumers read `?? []`, which is the
22703
+ // unenforced behaviour that predates this field and the safe direction to
22704
+ // default.
22705
+ //
22706
+ // Ids, not display names: the governance decision is keyed on the exact
22707
+ // string the harness reports (`model_status_override.versionId` in the
22708
+ // control plane), so no name resolution stands between the decision and the
22709
+ // comparison.
22710
+ prohibitedModels: external_exports.array(external_exports.string()).optional(),
22711
+ customKeywords: external_exports.array(external_exports.string()),
22712
+ fetchedAt: external_exports.iso.datetime()
22713
+ }).meta({ id: "PolicyBundle" });
22714
+ var POLICY_BUNDLE_SHAPE_ID = [
22715
+ ...Object.keys(PolicyBundle.shape),
22716
+ ...Object.keys(Policy.shape).map((key) => `policies.${key}`),
22717
+ ...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
22718
+ ...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
22719
+ ].sort().join(",");
22720
+ var OBSERVE_ONLY_CATEGORIES = ["config"];
22721
+ var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22722
+ var CATEGORY_PEAK_SEVERITY = {
22723
+ secret: "critical",
22724
+ financial: "critical",
22725
+ // core-financial/credit-card
22726
+ code_flaw: "critical",
22727
+ pii: "high",
22728
+ phi: "high",
22729
+ custom: "high",
22730
+ // user-defined; conservative
22731
+ code_context: "low",
22732
+ config: "low"
22733
+ // observe-only; floors to monitor regardless
22734
+ };
22735
+ function severityFloorPolicy(category) {
22736
+ if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22737
+ const peak = CATEGORY_PEAK_SEVERITY[category];
22738
+ return peak === "critical" || peak === "high" ? "warn" : "monitor";
22739
+ }
22740
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22741
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22742
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22743
+ id: "RedactFallback"
22744
+ });
22745
+ var BUILTIN_POLICY_SPECS = {
22746
+ monitor: {
22747
+ name: "Monitor",
22748
+ action: "log",
22749
+ reversible: false,
22750
+ description: "Log every match for audit. The request is allowed through untouched."
22751
+ },
22752
+ warn: {
22753
+ name: "Warn",
22754
+ action: "warn",
22755
+ reversible: false,
22756
+ description: "Allow the request, but warn the user inline before it is sent."
22757
+ },
22758
+ redact: {
22759
+ name: "Redact",
22760
+ action: "redact",
22761
+ reversible: false,
22762
+ description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22763
+ },
22764
+ vault: {
22765
+ name: "Redact & Vault",
22766
+ action: "redact",
22767
+ reversible: true,
22768
+ 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."
22769
+ },
22770
+ block: {
22771
+ name: "Block",
22772
+ action: "block",
22773
+ reversible: false,
22774
+ description: "Refuse the request entirely whenever any rule in this detection matches."
22775
+ }
22776
+ };
22777
+ function builtinPolicyToAction(id) {
22778
+ return BUILTIN_POLICY_SPECS[id].action;
22779
+ }
22780
+ var PALETTE_WEAKEST_FIRST = [
22781
+ ...new Set(KNOWN_BUILTIN_IDS.map(builtinPolicyToAction))
22782
+ ];
22783
+ var BELOW_PALETTE = ACTION_TAKEN_KEYS.filter(
22784
+ (action) => !PALETTE_WEAKEST_FIRST.includes(action)
22785
+ );
22786
+ var ACTION_STRENGTH_ORDER = [
22787
+ ...BELOW_PALETTE,
22788
+ ...PALETTE_WEAKEST_FIRST
22789
+ ];
22790
+ var PackPolicyFloor = external_exports.object({
22791
+ /**
22792
+ * The weakest archetype the device may assign. Stated as a BuiltinPolicyId
22793
+ * rather than a raw ActionTaken because that is the vocabulary the user
22794
+ * picks from — a floor a UI cannot name is one it cannot explain.
22795
+ */
22796
+ floor: BuiltinPolicyId,
22797
+ /**
22798
+ * True when the organization AUTHORED a policy governing this pack rather
22799
+ * than stating a minimum: it gave the answer, so the pack is not
22800
+ * re-assignable locally in either direction.
22801
+ */
22802
+ locked: external_exports.boolean()
22803
+ }).describe("PackPolicyFloor");
22804
+ var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22805
+ (id) => !BUILTIN_POLICY_SPECS[id].reversible
22806
+ );
22807
+ var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22808
+ (id) => BUILTIN_POLICY_SPECS[id].reversible
22809
+ );
22810
+ var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22811
+ var DEFAULT_ACTIONS = Object.fromEntries(
22812
+ DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22813
+ );
22814
+ var BUILTIN_POLICIES = Object.fromEntries(
22815
+ KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22816
+ );
22817
+ var UsedByItem = external_exports.object({
22818
+ id: external_exports.string(),
22819
+ name: external_exports.string(),
22820
+ ruleCount: external_exports.number().int().nonnegative(),
22821
+ enabled: external_exports.boolean()
22822
+ }).meta({ id: "UsedByItem" });
22823
+ var PolicyListItem = external_exports.object({
22824
+ id: external_exports.string(),
22825
+ kind: PolicyKind,
22826
+ name: external_exports.string(),
22827
+ enabled: external_exports.boolean(),
22828
+ usedByCount: external_exports.number().int().nonnegative()
22829
+ }).meta({ id: "PolicyListItem" });
22830
+ var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22831
+ var PolicyDetail = external_exports.object({
22832
+ specVersion: external_exports.literal(1),
22833
+ id: external_exports.string(),
22834
+ kind: PolicyKind,
22835
+ name: external_exports.string(),
22836
+ enabled: external_exports.boolean(),
22837
+ description: external_exports.string(),
22838
+ usedBy: external_exports.array(UsedByItem)
22839
+ }).meta({ id: "PolicyDetail" });
22840
+ var PolicyStatsResponse = external_exports.object({
22841
+ policies: external_exports.number().int().nonnegative(),
22842
+ builtin: external_exports.number().int().nonnegative(),
22843
+ custom: external_exports.number().int().nonnegative(),
22844
+ detectionsGoverned: external_exports.number().int().nonnegative()
22845
+ }).meta({ id: "PolicyStatsResponse" });
22846
+
22607
22847
  // ../../packages/schema/src/zod/vault.ts
22608
22848
  var CATEGORY_ALTERNATION = DetectionCategory.options.join("|");
22609
22849
  var POINTER_TOKEN_PATTERN = new RegExp(
@@ -22640,6 +22880,14 @@ var VaultEntry = external_exports.object({
22640
22880
  // How many times this value has been detected on this machine — the reuse
22641
22881
  // signal the vault dashboard reads. Distinct from VaultDeref.pointerCount.
22642
22882
  occurrenceCount: external_exports.number().int().nonnegative(),
22883
+ // True when a PERSON asked for this value to be replaced — the surfaced-
22884
+ // secrets strike — rather than a pack enforcing its assignment. One value is
22885
+ // one row however many paths vault it, so this is what tells a policy sweep
22886
+ // that the row carries somebody's own instruction and not just an assignment
22887
+ // that has since been lowered. STICKY and MONOTONIC: a later automatic
22888
+ // vaulting of the same value must never clear it — what the user said about
22889
+ // the value does not expire.
22890
+ userAuthorized: external_exports.boolean(),
22643
22891
  firstSeen: external_exports.string(),
22644
22892
  lastSeen: external_exports.string()
22645
22893
  });
@@ -22755,7 +23003,7 @@ var VaultConsent = external_exports.object({
22755
23003
  });
22756
23004
 
22757
23005
  // ../../packages/schema/src/zod/local.ts
22758
- var WORKSPACE_SETTINGS_SPEC_VERSION = 6;
23006
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22759
23007
  var RunMode = external_exports.enum(["standalone", "attached"]);
22760
23008
  var ControlPlaneConnection = external_exports.object({
22761
23009
  endpoint: external_exports.string().min(1),
@@ -22796,6 +23044,19 @@ var WorkspaceSettings = external_exports.object({
22796
23044
  vaultKeyCustody: VaultKeyCustody.default("file"),
22797
23045
  // How a pointer renders in assistant prose on screen (see VaultInlineReveal).
22798
23046
  vaultInlineReveal: VaultInlineReveal.default("masked"),
23047
+ // What a `redact` policy degrades to on a FIELD the host cannot rewrite in
23048
+ // place. Not a handling policy: the policy has already resolved to redact,
23049
+ // and this only says what happens when the host offers no channel to carry it
23050
+ // out — Antigravity's PreToolUse has no updatedInput at all, and Codex and
23051
+ // Claude Code decline to mask a field that EXECUTES because masking would
23052
+ // change what runs. Per FIELD rather than per host, so a host that can
23053
+ // rewrite some inputs keeps true redaction on those.
23054
+ //
23055
+ // Spelled in the built-in policy vocabulary rather than as a fresh enum, so
23056
+ // an attached machine's merge is `strongerAction` over the one action ladder
23057
+ // and no second rank order exists to drift from it. 'deny' is a host wire
23058
+ // word and stays out of the stored value.
23059
+ redactFallback: RedactFallback.default("warn"),
22799
23060
  // Absent until /aka:setup completes; its presence is what "onboarded" means.
22800
23061
  onboardedAt: external_exports.iso.datetime().optional(),
22801
23062
  // Records that the user consented to sending findings to the model API for
@@ -22803,10 +23064,12 @@ var WorkspaceSettings = external_exports.object({
22803
23064
  // Absent until granted; a stale payloadVersion means the consent no longer
22804
23065
  // covers the current payload and must be re-granted.
22805
23066
  modelJudgeConsent: ModelJudgeConsent.optional(),
22806
- // Records that the user consented to sending the activity already recorded on
22807
- // this machine to the deployment it is attached to, along with the payload
22808
- // shape and the endpoint they agreed to. Absent until granted, and a grant for
22809
- // a different endpoint or an older payload no longer counts.
23067
+ // Records that the user consented to the DEFERRED send — the outbox along
23068
+ // with the payload shape and the endpoint they agreed to. Since payload v2
23069
+ // that covers both the pre-attach backlog and undelivered captures (which
23070
+ // carry prompt/reply text in `content`); the key name predates the widening.
23071
+ // Absent until granted, and a grant for a different endpoint or an older
23072
+ // payload no longer counts.
22810
23073
  historySyncConsent: HistorySyncConsent.optional()
22811
23074
  });
22812
23075
 
@@ -22819,7 +23082,8 @@ var ManagedSettingKey = external_exports.enum([
22819
23082
  "vaultKeyCustody",
22820
23083
  "vaultInlineReveal",
22821
23084
  "modelJudgeConsent",
22822
- "dataSharesInPlace"
23085
+ "dataSharesInPlace",
23086
+ "redactFallback"
22823
23087
  ]).meta({ id: "ManagedSettingKey" });
22824
23088
  var ManagedSettingsValues = external_exports.object({
22825
23089
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
@@ -22832,7 +23096,8 @@ var ManagedSettingsValues = external_exports.object({
22832
23096
  vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
22833
23097
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22834
23098
  modelJudgeConsent: external_exports.boolean().optional(),
22835
- dataSharesInPlace: external_exports.boolean().optional()
23099
+ dataSharesInPlace: external_exports.boolean().optional(),
23100
+ redactFallback: RedactFallback.optional()
22836
23101
  }).meta({ id: "ManagedSettingsValues" });
22837
23102
  var ManagedSettings = external_exports.object({
22838
23103
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22847,171 +23112,6 @@ var ManagedSettings = external_exports.object({
22847
23112
  lockedFields: external_exports.array(ManagedSettingKey).default([])
22848
23113
  }).meta({ id: "ManagedSettings" });
22849
23114
 
22850
- // ../../packages/schema/src/zod/policy.ts
22851
- var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22852
- var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22853
- var Policy = external_exports.object({
22854
- id: external_exports.guid(),
22855
- scope: PolicyScope,
22856
- target: PolicyTarget,
22857
- action: ActionTaken,
22858
- enabled: external_exports.boolean().default(true),
22859
- customKeywords: external_exports.array(external_exports.string()).optional(),
22860
- // Display name — optional so older policy rows without name still parse.
22861
- // Added for the findings API (policy.name column migration).
22862
- name: external_exports.string().optional()
22863
- }).meta({ id: "Policy" });
22864
- var PolicyBundle = external_exports.object({
22865
- version: external_exports.string(),
22866
- policies: external_exports.array(Policy),
22867
- // Rules from the installed marketplace packs (snapshotted by the
22868
- // control plane). The plugin registers these in addition to its bundled
22869
- // packs. Optional so older backends — and older on-disk caches — that omit
22870
- // the field still parse; consumers read `bundle.rules ?? []`.
22871
- rules: external_exports.array(Rule).optional(),
22872
- // When true, `rules` IS the complete effective ruleset and the runtime must
22873
- // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22874
- // after reading the user's installed snapshot (installed_packs, enabled
22875
- // packs only), which is how detection updates stay manual: new bundled
22876
- // rules run only after the user applies the pack update. Absent/false keeps
22877
- // the historical composition (bundled packs + rules) — older caches.
22878
- rulesComplete: external_exports.boolean().optional(),
22879
- // Active detection exceptions, evaluation subset only (see
22880
- // ExceptionBundleEntry). Optional so older bundle producers — and older
22881
- // on-disk caches — that omit the field still parse; consumers read
22882
- // `bundle.exceptions ?? []`.
22883
- exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22884
- // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22885
- // A second axis over the same `redact` action, carried beside the policies
22886
- // rather than on them: nothing writes ruleId-targeted policies to disk, so
22887
- // widening Policy itself would change a persisted shape to express something
22888
- // only the in-memory bundle needs. Optional so an older producer — or an
22889
- // older on-disk cache — still parses; consumers read `?? []` and get the
22890
- // pre-existing one-way behaviour, which is the safe direction to default.
22891
- reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22892
- // Installed pack version, keyed by ruleId, for rules in `rules` that came
22893
- // from a versioned installed pack. Optional so older backends — and older
22894
- // on-disk caches — that omit the field still parse; consumers fall back to
22895
- // the rule's own spec version. NOT the bundle version above — see
22896
- // installedRuleset's ruleVersions for the source of truth.
22897
- ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22898
- // Model ids (the raw `model` string a harness reports, e.g.
22899
- // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22900
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
22901
- // one (UserPromptSubmit). Optional so an older backend — and an older
22902
- // on-disk cache — still parses; consumers read `?? []`, which is the
22903
- // unenforced behaviour that predates this field and the safe direction to
22904
- // default.
22905
- //
22906
- // Ids, not display names: the governance decision is keyed on the exact
22907
- // string the harness reports (`model_status_override.versionId` in the
22908
- // control plane), so no name resolution stands between the decision and the
22909
- // comparison.
22910
- prohibitedModels: external_exports.array(external_exports.string()).optional(),
22911
- customKeywords: external_exports.array(external_exports.string()),
22912
- fetchedAt: external_exports.iso.datetime()
22913
- }).meta({ id: "PolicyBundle" });
22914
- var OBSERVE_ONLY_CATEGORIES = ["config"];
22915
- var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22916
- var CATEGORY_PEAK_SEVERITY = {
22917
- secret: "critical",
22918
- financial: "critical",
22919
- // core-financial/credit-card
22920
- code_flaw: "critical",
22921
- pii: "high",
22922
- phi: "high",
22923
- custom: "high",
22924
- // user-defined; conservative
22925
- code_context: "low",
22926
- config: "low"
22927
- // observe-only; floors to monitor regardless
22928
- };
22929
- function severityFloorPolicy(category) {
22930
- if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22931
- const peak = CATEGORY_PEAK_SEVERITY[category];
22932
- return peak === "critical" || peak === "high" ? "warn" : "monitor";
22933
- }
22934
- var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22935
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22936
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22937
- var BUILTIN_POLICY_SPECS = {
22938
- monitor: {
22939
- name: "Monitor",
22940
- action: "log",
22941
- reversible: false,
22942
- description: "Log every match for audit. The request is allowed through untouched."
22943
- },
22944
- warn: {
22945
- name: "Warn",
22946
- action: "warn",
22947
- reversible: false,
22948
- description: "Allow the request, but warn the user inline before it is sent."
22949
- },
22950
- redact: {
22951
- name: "Redact",
22952
- action: "redact",
22953
- reversible: false,
22954
- description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22955
- },
22956
- vault: {
22957
- name: "Redact & Vault",
22958
- action: "redact",
22959
- reversible: true,
22960
- 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."
22961
- },
22962
- block: {
22963
- name: "Block",
22964
- action: "block",
22965
- reversible: false,
22966
- description: "Refuse the request entirely whenever any rule in this detection matches."
22967
- }
22968
- };
22969
- function builtinPolicyToAction(id) {
22970
- return BUILTIN_POLICY_SPECS[id].action;
22971
- }
22972
- var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22973
- (id) => !BUILTIN_POLICY_SPECS[id].reversible
22974
- );
22975
- var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22976
- (id) => BUILTIN_POLICY_SPECS[id].reversible
22977
- );
22978
- var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22979
- var DEFAULT_ACTIONS = Object.fromEntries(
22980
- DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22981
- );
22982
- var BUILTIN_POLICIES = Object.fromEntries(
22983
- KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22984
- );
22985
- var UsedByItem = external_exports.object({
22986
- id: external_exports.string(),
22987
- name: external_exports.string(),
22988
- ruleCount: external_exports.number().int().nonnegative(),
22989
- enabled: external_exports.boolean()
22990
- }).meta({ id: "UsedByItem" });
22991
- var PolicyListItem = external_exports.object({
22992
- id: external_exports.string(),
22993
- kind: PolicyKind,
22994
- name: external_exports.string(),
22995
- enabled: external_exports.boolean(),
22996
- usedByCount: external_exports.number().int().nonnegative()
22997
- }).meta({ id: "PolicyListItem" });
22998
- var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22999
- var PolicyDetail = external_exports.object({
23000
- specVersion: external_exports.literal(1),
23001
- id: external_exports.string(),
23002
- kind: PolicyKind,
23003
- name: external_exports.string(),
23004
- enabled: external_exports.boolean(),
23005
- description: external_exports.string(),
23006
- usedBy: external_exports.array(UsedByItem)
23007
- }).meta({ id: "PolicyDetail" });
23008
- var PolicyStatsResponse = external_exports.object({
23009
- policies: external_exports.number().int().nonnegative(),
23010
- builtin: external_exports.number().int().nonnegative(),
23011
- custom: external_exports.number().int().nonnegative(),
23012
- detectionsGoverned: external_exports.number().int().nonnegative()
23013
- }).meta({ id: "PolicyStatsResponse" });
23014
-
23015
23115
  // ../../packages/schema/src/zod/project-files.ts
23016
23116
  var ProjectFileInput = external_exports.object({
23017
23117
  path: external_exports.string().min(1),
@@ -23251,10 +23351,12 @@ var DismissRecommendedActionResponse = external_exports.object({ id: external_ex
23251
23351
  var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
23252
23352
 
23253
23353
  // ../../packages/schema/src/zod/settings-action.ts
23354
+ var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23355
+ var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
23254
23356
  var SaveSettingsInput = external_exports.object({
23255
23357
  historicalAccess: external_exports.string(),
23256
- modelJudgeConsent: external_exports.boolean(),
23257
- historySyncConsent: external_exports.boolean(),
23358
+ modelJudgeConsent: ModelJudgeConsentChoice,
23359
+ historySyncConsent: HistorySyncConsentChoice,
23258
23360
  vaultConsent: external_exports.string(),
23259
23361
  vaultInlineReveal: external_exports.string()
23260
23362
  });