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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/scripts/intro.js CHANGED
@@ -50,7 +50,7 @@ var require_ignore = __commonJS({
50
50
  var REGEX_SPLITALL_CRLF = /\r?\n/g;
51
51
  var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
52
52
  var REGEX_TEST_TRAILING_SLASH = /\/$/;
53
- var SLASH = "/";
53
+ var SLASH2 = "/";
54
54
  var TMP_KEY_IGNORE = "node-ignore";
55
55
  if (typeof Symbol !== "undefined") {
56
56
  TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
@@ -422,11 +422,11 @@ var require_ignore = __commonJS({
422
422
  if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
423
423
  return this.test(path);
424
424
  }
425
- const slices = path.split(SLASH).filter(Boolean);
425
+ const slices = path.split(SLASH2).filter(Boolean);
426
426
  slices.pop();
427
427
  if (slices.length) {
428
428
  const parent = this._t(
429
- slices.join(SLASH) + SLASH,
429
+ slices.join(SLASH2) + SLASH2,
430
430
  this._testCache,
431
431
  true,
432
432
  slices
@@ -442,14 +442,14 @@ var require_ignore = __commonJS({
442
442
  return cache[path];
443
443
  }
444
444
  if (!slices) {
445
- slices = path.split(SLASH).filter(Boolean);
445
+ slices = path.split(SLASH2).filter(Boolean);
446
446
  }
447
447
  slices.pop();
448
448
  if (!slices.length) {
449
449
  return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
450
450
  }
451
451
  const parent = this._t(
452
- slices.join(SLASH) + SLASH,
452
+ slices.join(SLASH2) + SLASH2,
453
453
  cache,
454
454
  checkUnignored,
455
455
  slices
@@ -492,7 +492,15 @@ var require_ignore = __commonJS({
492
492
  });
493
493
 
494
494
  // src/intro.ts
495
- import { readFileSync as readFileSync15 } from "fs";
495
+ import { readFileSync as readFileSync17 } from "fs";
496
+
497
+ // ../../packages/schema/src/drizzle/deferred-migrations.ts
498
+ var DEFERRED_MIGRATION_TAGS = [
499
+ "0031_audit_capture_by_time_index",
500
+ "0032_audit_capture_by_id_index",
501
+ "0033_audit_capture_location_index",
502
+ "0034_findings_read_indexes"
503
+ ];
496
504
 
497
505
  // ../../packages/schema/src/exception-scope.ts
498
506
  var MINUTE_MS = 6e4;
@@ -20306,6 +20314,15 @@ var FindingCategory = external_exports.enum([
20306
20314
  ]).meta({ id: "FindingCategory" });
20307
20315
  var FindingOrigin = external_exports.enum(["in-flight", "at-rest"]).meta({ id: "FindingOrigin" });
20308
20316
  var FindingStatus = external_exports.enum(["open", "handled", "resolved", "dismissed"]).meta({ id: "FindingStatus" });
20317
+ var SyncFailureReason = external_exports.enum(["deployment_refused", "payload_invalid", "detached_undelivered"]).meta({ id: "SyncFailureReason" });
20318
+ var FindingDeliveryState = external_exports.enum(["sent", "queued", "not_sent", "never_offered", "local_scan"]).meta({ id: "FindingDeliveryState" });
20319
+ var FindingDelivery = external_exports.object({
20320
+ state: FindingDeliveryState,
20321
+ // The delivery time for `sent`; the failure time for `not_sent` when recorded.
20322
+ at: external_exports.iso.datetime().optional(),
20323
+ // Only on `not_sent`, and only when a known reason was recorded.
20324
+ reason: SyncFailureReason.optional()
20325
+ }).meta({ id: "FindingDelivery" });
20309
20326
  var ResolutionMethod = external_exports.enum([
20310
20327
  "enforced-in-flight",
20311
20328
  "fixed-at-source",
@@ -20362,7 +20379,10 @@ var FindingInstance = external_exports.object({
20362
20379
  // The session that event belongs to, when it has one — the seam a
20363
20380
  // per-instance "view session" link needs. Absent for events captured
20364
20381
  // outside a session.
20365
- sessionId: external_exports.string().optional()
20382
+ sessionId: external_exports.string().optional(),
20383
+ // The delivery state of the event above (see FindingDelivery). Optional so
20384
+ // readers that do not project it stay valid.
20385
+ delivery: FindingDelivery.optional()
20366
20386
  }).meta({ id: "FindingInstance" });
20367
20387
  var FindingGroup = external_exports.object({
20368
20388
  id: external_exports.string(),
@@ -20414,7 +20434,10 @@ var FindingFacets = external_exports.object({
20414
20434
  // Host tool (attributes.tool_name). Present only on the instance-level
20415
20435
  // reads, which can filter by it; the type-level read omits the dimension
20416
20436
  // because a group spans tools.
20417
- tool: external_exports.array(FindingFacetItem).optional()
20437
+ tool: external_exports.array(FindingFacetItem).optional(),
20438
+ // Delivery states (FindingDeliveryState). Present only on the
20439
+ // instance-level reads, like `tool`.
20440
+ deployment: external_exports.array(FindingFacetItem).optional()
20418
20441
  }).meta({ id: "FindingFacets" });
20419
20442
  var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
20420
20443
  id: "FindingTypeSummary"
@@ -20523,6 +20546,8 @@ var ListFindingInstancesQuery = external_exports.object({
20523
20546
  // Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
20524
20547
  // where the free-text `q` can only match the rendered "via Bash" label.
20525
20548
  tool: external_exports.array(external_exports.string()).optional(),
20549
+ // The delivery state of each finding's event (see FindingDelivery).
20550
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20526
20551
  // Exact repository / file-path matches, for the drill-down out of the
20527
20552
  // locations view. A row whose event carries no repo/file matches neither.
20528
20553
  repo: external_exports.string().optional(),
@@ -20543,6 +20568,10 @@ var ListFindingInstancesResponse = external_exports.object({
20543
20568
  items: external_exports.array(FindingInstanceDetail),
20544
20569
  nextCursor: external_exports.string().nullable()
20545
20570
  }).meta({ id: "ListFindingInstancesResponse" });
20571
+ var ListFindingInstancesPage = external_exports.object({
20572
+ items: external_exports.array(FindingInstanceDetail),
20573
+ nextCursor: external_exports.string().nullable()
20574
+ }).meta({ id: "ListFindingInstancesPage" });
20546
20575
  var FindingLocationSummary = external_exports.object({
20547
20576
  // Opaque, stable, minted from the pair by encodeLocationId. It exists
20548
20577
  // because a location's identity is two values and a URL param carries one:
@@ -20584,6 +20613,8 @@ var ListFindingLocationsQuery = external_exports.object({
20584
20613
  // instances that match, and folds its status from those.
20585
20614
  status: external_exports.array(FindingStatus).optional(),
20586
20615
  tool: external_exports.array(external_exports.string()).optional(),
20616
+ // The delivery state of each finding's event (see FindingDelivery).
20617
+ deployment: external_exports.array(FindingDeliveryState).optional(),
20587
20618
  q: external_exports.string().optional(),
20588
20619
  sessionId: external_exports.string().optional(),
20589
20620
  from: external_exports.iso.datetime().optional(),
@@ -20786,6 +20817,10 @@ var CaptureAttributes = external_exports.object({
20786
20817
  // to 'allow' — the enforcement audit trail's link back to the grant that
20787
20818
  // authorized the bypass.
20788
20819
  exception_ids: external_exports.array(external_exports.guid()).optional(),
20820
+ // The persisted spellings of EventMetadata's messageId/conversationId — the
20821
+ // join back to the `llm_call` leaf for the same assistant turn.
20822
+ message_id: external_exports.string().optional(),
20823
+ conversation_id: external_exports.string().optional(),
20789
20824
  // Whole milliseconds this capture's inspection blocked its caller — the
20790
20825
  // plugin's own added latency (see EventMetadata.inspectionMs, whose value
20791
20826
  // this is). Promoted to the `inspection_ms` generated column so the facet is
@@ -20794,7 +20829,19 @@ var CaptureAttributes = external_exports.object({
20794
20829
  // inline json_extract and is not itself an optimization.
20795
20830
  // ABSENT on replayed captures (backfill / worktree scan) and on rows written
20796
20831
  // before the measurement shipped — never present as a placeholder 0.
20797
- inspection_ms: external_exports.number().int().nonnegative().optional()
20832
+ inspection_ms: external_exports.number().int().nonnegative().optional(),
20833
+ // What a `redact` this capture could not carry out became instead (see
20834
+ // EventMetadata.redactDegradedTo, whose value this is). Present only when a
20835
+ // degrade actually happened, so absence is the ordinary case rather than a
20836
+ // reader having to distinguish it from a zero.
20837
+ //
20838
+ // PER CAPTURE, while `inspection_findings.action_taken` is per finding —
20839
+ // so on a multi-finding row this does not say which finding degraded, and
20840
+ // its presence does not mean the fallback decided the capture's action. A
20841
+ // capture denied by another finding's own Block policy carries `block`
20842
+ // here too. The full statement is on EventMetadata.redactDegradedTo; it is
20843
+ // repeated rather than referenced because a store reader opens this file.
20844
+ redact_degraded_to: ActionTaken.optional()
20798
20845
  }).catchall(external_exports.unknown());
20799
20846
  var ToolCallInspection = external_exports.object({
20800
20847
  ruleId: external_exports.string().min(1),
@@ -20990,7 +21037,17 @@ var AuditEvent = external_exports.object({
20990
21037
  /** `share` to a first-party/internal destination. */
20991
21038
  internal: external_exports.boolean(),
20992
21039
  /** Event needs review (e.g. unverified egress). */
20993
- flagged: external_exports.boolean()
21040
+ flagged: external_exports.boolean(),
21041
+ /**
21042
+ * The body this event's `title` is drawn from was cleared by local body
21043
+ * expiry, so an EMPTY title here means "gone", not "never had one".
21044
+ *
21045
+ * A separate flag rather than a sentinel written into `title`: the title is
21046
+ * rendered text, and a store-layer module that invented display copy for it
21047
+ * would be choosing words the view is supposed to choose. Additive and
21048
+ * defaulted, so an older producer still validates.
21049
+ */
21050
+ bodyExpired: external_exports.boolean().default(false)
20994
21051
  }).meta({ id: "ActivityAuditEvent" });
20995
21052
  var ActivitySessionSummary = external_exports.object({
20996
21053
  id: external_exports.string(),
@@ -22213,6 +22270,12 @@ var EventMetadata = external_exports.object({
22213
22270
  // to 'allow' — the enforcement audit trail's link back to the grant that
22214
22271
  // authorized the bypass. Absent on captures where no exception applied.
22215
22272
  exceptionIds: external_exports.array(external_exports.guid()).optional(),
22273
+ // The assistant message this capture belongs to, and the conversation it sits
22274
+ // in — set by the browser extension's network capture so a stored `response`
22275
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
22276
+ // on every other capture path, which has no such id.
22277
+ messageId: external_exports.string().optional(),
22278
+ conversationId: external_exports.string().optional(),
22216
22279
  // How long THIS capture's inspection blocked its caller, in whole
22217
22280
  // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
22218
22281
  // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
@@ -22225,7 +22288,37 @@ var EventMetadata = external_exports.object({
22225
22288
  // Absent is also what every pre-measurement client writes, and what a
22226
22289
  // clock failure degrades to — a reader must treat absence as "not measured"
22227
22290
  // and never as a zero, which would read as "inspection is free".
22228
- inspectionMs: external_exports.number().int().nonnegative().optional()
22291
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
22292
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
22293
+ // workspace's `redactFallback`, applied because the field could not be
22294
+ // masked in place (a shell command, a URL, or any argument on a host whose
22295
+ // hook contract offers no rewrite channel).
22296
+ //
22297
+ // It exists because the action alone cannot say why. A finding recorded as
22298
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
22299
+ // assigned Redact on a field that could not take one — and those are
22300
+ // different facts about the same row: the first is a policy the user chose,
22301
+ // the second is a masking the host could not perform. Absent means no
22302
+ // degrade happened, which is every ordinary capture.
22303
+ //
22304
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
22305
+ // is the CAPTURE while `actionTaken` is per FINDING:
22306
+ //
22307
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
22308
+ // `redact` alongside a finding ASSIGNED the same action stores both
22309
+ // identically and one reason for the pair; attributing it to both
22310
+ // describes the assigned one wrongly, and to neither loses the degrade.
22311
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
22312
+ // became, not the reason the capture ended as it did — a capture denied
22313
+ // by some other finding's own Block policy still carries `block` here,
22314
+ // and clearing the workspace's fallback would not have let it through.
22315
+ // Gate on the value against what a fallback can produce; never read the
22316
+ // field's presence as "this was the fallback's doing".
22317
+ //
22318
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
22319
+ // Closing either means moving the reason onto the finding row, which
22320
+ // already carries its own action.
22321
+ redactDegradedTo: ActionTaken.optional()
22229
22322
  }).meta({ id: "EventMetadata" });
22230
22323
  var Event = external_exports.object({
22231
22324
  id: external_exports.guid(),
@@ -22335,6 +22428,15 @@ var RotateKeyInput = external_exports.object({
22335
22428
  confirmation: external_exports.string()
22336
22429
  });
22337
22430
 
22431
+ // ../../packages/schema/src/zod/finding-delivery.ts
22432
+ var KNOWN_REASONS = SyncFailureReason.options;
22433
+
22434
+ // ../../packages/schema/src/zod/findings-group-build.ts
22435
+ function rankByOrder(members2) {
22436
+ return Object.fromEntries(members2.map((member, index) => [member, index]));
22437
+ }
22438
+ var SEVERITY_RANK = rankByOrder(Severity.options);
22439
+
22338
22440
  // ../../packages/schema/src/zod/installed-pack.ts
22339
22441
  var InstalledPack = external_exports.object({
22340
22442
  id: external_exports.guid(),
@@ -22401,6 +22503,11 @@ var Policy = external_exports.object({
22401
22503
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22402
22504
  provenance: PolicyProvenance.optional()
22403
22505
  }).meta({ id: "Policy" });
22506
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22507
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22508
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22509
+ id: "RedactFallback"
22510
+ });
22404
22511
  var PolicyBundle = external_exports.object({
22405
22512
  version: external_exports.string(),
22406
22513
  policies: external_exports.array(Policy),
@@ -22448,6 +22555,16 @@ var PolicyBundle = external_exports.object({
22448
22555
  // control plane), so no name resolution stands between the decision and the
22449
22556
  // comparison.
22450
22557
  prohibitedModels: external_exports.array(external_exports.string()).optional(),
22558
+ // What a resolved `redact` becomes on a field the host cannot rewrite, as
22559
+ // the ORGANIZATION would have it. Merged raise-only against the device's own
22560
+ // `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
22561
+ // a control plane can tighten a machine and never loosen one — the same
22562
+ // direction `mergeRaiseOnly` enforces for policies.
22563
+ //
22564
+ // Optional so an older backend, and an older on-disk cache, still parses;
22565
+ // absent leaves the device's own setting in force, which is the behaviour
22566
+ // that predates the field and the safe direction to default.
22567
+ redactFallback: RedactFallback.optional(),
22451
22568
  customKeywords: external_exports.array(external_exports.string()),
22452
22569
  fetchedAt: external_exports.iso.datetime()
22453
22570
  }).meta({ id: "PolicyBundle" });
@@ -22477,11 +22594,6 @@ function severityFloorPolicy(category) {
22477
22594
  const peak = CATEGORY_PEAK_SEVERITY[category];
22478
22595
  return peak === "critical" || peak === "high" ? "warn" : "monitor";
22479
22596
  }
22480
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22481
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22482
- var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22483
- id: "RedactFallback"
22484
- });
22485
22597
  var BUILTIN_POLICY_SPECS = {
22486
22598
  monitor: {
22487
22599
  name: "Monitor",
@@ -22743,7 +22855,7 @@ var VaultConsent = external_exports.object({
22743
22855
  });
22744
22856
 
22745
22857
  // ../../packages/schema/src/zod/local.ts
22746
- var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22858
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
22747
22859
  var RunMode = external_exports.enum(["standalone", "attached"]);
22748
22860
  var ControlPlaneConnection = external_exports.object({
22749
22861
  endpoint: external_exports.string().min(1),
@@ -22762,6 +22874,15 @@ var HistorySyncConsent = external_exports.object({
22762
22874
  payloadVersion: external_exports.number().int().positive(),
22763
22875
  endpoint: external_exports.string()
22764
22876
  });
22877
+ var BODY_RETENTION_DEFAULT_DAYS = 30;
22878
+ var BodyRetention = external_exports.object({
22879
+ enabled: external_exports.boolean().default(false),
22880
+ // Never 0, and the ceiling is a fat-finger guard rather than a policy
22881
+ // limit — `enabled` is the real gate. A low value cannot reach a row the
22882
+ // sync ledger still owes: the sweep's age filter only ever NARROWS a
22883
+ // candidate set that is already bounded by "delivered, or never owed".
22884
+ retainDays: external_exports.number().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
22885
+ }).meta({ id: "BodyRetention" });
22765
22886
  var WorkspaceSettings = external_exports.object({
22766
22887
  specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
22767
22888
  runMode: RunMode.default("standalone"),
@@ -22810,7 +22931,13 @@ var WorkspaceSettings = external_exports.object({
22810
22931
  // carry prompt/reply/tool-output text in `content`; the key name predates
22811
22932
  // both widenings. Absent until granted, and a grant for a different endpoint
22812
22933
  // or an older payload no longer counts.
22813
- historySyncConsent: HistorySyncConsent.optional()
22934
+ historySyncConsent: HistorySyncConsent.optional(),
22935
+ // Local body expiry (see BodyRetention). Off until switched on; expiring a
22936
+ // body never removes the row or its findings.
22937
+ bodyRetention: BodyRetention.default({
22938
+ enabled: false,
22939
+ retainDays: BODY_RETENTION_DEFAULT_DAYS
22940
+ })
22814
22941
  });
22815
22942
 
22816
22943
  // ../../packages/schema/src/zod/managed.ts
@@ -22823,13 +22950,22 @@ var ManagedSettingKey = external_exports.enum([
22823
22950
  "vaultInlineReveal",
22824
22951
  "modelJudgeConsent",
22825
22952
  "dataSharesInPlace",
22826
- "redactFallback"
22953
+ "redactFallback",
22954
+ // Pins the toggle and the day count together — see BodyRetention on why the
22955
+ // two are one unit. An administrator mandating a window wants the count
22956
+ // enforced with it, not one a user can widen while the toggle stays on.
22957
+ "bodyRetention"
22827
22958
  ]).meta({ id: "ManagedSettingKey" });
22828
22959
  function isManagedSettingKey(value) {
22829
22960
  return ManagedSettingKey.safeParse(value).success;
22830
22961
  }
22831
22962
  var ManagedSettingsValues = external_exports.object({
22832
22963
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
22964
+ // `controlPlane` and `bodyRetention` are the two nested values, and both are
22965
+ // plain, non-strict objects: a key under either that this build does not know
22966
+ // is stripped and nothing reports it. The unknown-value split in
22967
+ // ManagedSettings below classifies top-level names only, so it stops at
22968
+ // these boundaries.
22833
22969
  controlPlane: external_exports.object({
22834
22970
  endpoint: external_exports.string().min(1),
22835
22971
  label: external_exports.string().min(1).optional()
@@ -22840,7 +22976,8 @@ var ManagedSettingsValues = external_exports.object({
22840
22976
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22841
22977
  modelJudgeConsent: external_exports.boolean().optional(),
22842
22978
  dataSharesInPlace: external_exports.boolean().optional(),
22843
- redactFallback: RedactFallback.optional()
22979
+ redactFallback: RedactFallback.optional(),
22980
+ bodyRetention: BodyRetention.optional()
22844
22981
  }).meta({ id: "ManagedSettingsValues" });
22845
22982
  var ManagedSettings = external_exports.object({
22846
22983
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22848,7 +22985,21 @@ var ManagedSettings = external_exports.object({
22848
22985
  // decision from a bug. Absent renders as a generic "your organization".
22849
22986
  organization: external_exports.string().min(1).optional(),
22850
22987
  // What the administrator pinned.
22851
- values: ManagedSettingsValues.default({}),
22988
+ //
22989
+ // Parsed as a RECORD rather than as the nested schema, and split below for
22990
+ // the same reason `lockedFields` is parsed as names: a plain `z.object`
22991
+ // drops an unrecognised key and succeeds, so a pin this build does not know
22992
+ // vanished and nothing anywhere said so. A pin with no lock is a supported
22993
+ // shape — it is a DEFAULT the user may still change — so that silence hit
22994
+ // exactly the file an administrator is most likely to write while a fleet
22995
+ // is mid-upgrade.
22996
+ //
22997
+ // Splitting here rather than calling `.strict()`: strict would REFUSE the
22998
+ // file, which is the outcome the lock half already rejected — an older
22999
+ // build then runs entirely unmanaged, every pin and lock gone. A bad KNOWN
23000
+ // value still fails, because the nested schema is re-run over the known
23001
+ // subset and its issues are re-raised on this parse.
23002
+ values: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
22852
23003
  // Which of those the user may not change. A key here with no matching value
22853
23004
  // freezes whatever the user last chose; a value with no lock is a DEFAULT
22854
23005
  // the user may still override. The two are separable on purpose.
@@ -22861,17 +23012,31 @@ var ManagedSettings = external_exports.object({
22861
23012
  // the fleets most likely to carry a version skew. A name outside the enum
22862
23013
  // is still never HONOURED: the lockable set stays explicit above.
22863
23014
  lockedFields: external_exports.array(external_exports.string()).default([])
22864
- }).transform(({ lockedFields, ...rest }) => {
23015
+ }).transform(({ lockedFields, values, ...rest }, ctx) => {
22865
23016
  const known = [];
22866
23017
  const unknown2 = [];
22867
23018
  for (const name of lockedFields) {
22868
23019
  if (isManagedSettingKey(name)) known.push(name);
22869
23020
  else unknown2.push(name);
22870
23021
  }
23022
+ const knownValues = /* @__PURE__ */ Object.create(null);
23023
+ const unknownValues = [];
23024
+ for (const [name, value] of Object.entries(values)) {
23025
+ if (Object.hasOwn(ManagedSettingsValues.shape, name)) knownValues[name] = value;
23026
+ else unknownValues.push(name);
23027
+ }
23028
+ const pinned = ManagedSettingsValues.safeParse(knownValues);
23029
+ if (!pinned.success) {
23030
+ for (const issue2 of pinned.error.issues)
23031
+ ctx.addIssue({ ...issue2, path: ["values", ...issue2.path] });
23032
+ return external_exports.NEVER;
23033
+ }
22871
23034
  return {
22872
23035
  ...rest,
23036
+ values: pinned.data,
22873
23037
  lockedFields: known,
22874
- ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
23038
+ ...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {},
23039
+ ...unknownValues.length > 0 ? { unknownValueFields: unknownValues } : {}
22875
23040
  };
22876
23041
  }).meta({ id: "ManagedSettings" });
22877
23042
 
@@ -23129,7 +23294,23 @@ var SaveSettingsInput = external_exports.object({
23129
23294
  modelJudgeConsent: ModelJudgeConsentChoice,
23130
23295
  historySyncConsent: HistorySyncConsentChoice,
23131
23296
  vaultConsent: external_exports.string(),
23132
- vaultInlineReveal: external_exports.string()
23297
+ vaultInlineReveal: external_exports.string(),
23298
+ // Widened to `string` like its neighbours rather than typed as
23299
+ // `RedactFallback`, on this module's own layering rule: shape here, VALUE at
23300
+ // the call site, so the domain check receives the type it was written for.
23301
+ //
23302
+ // NOT because a narrower schema would reject differently. `parseActionInput`
23303
+ // is a `safeParse` wrapper and throws for no field schema, so either spelling
23304
+ // reaches a recoverable `{ ok: false }` and there is no rejected promise to
23305
+ // trade against. The real cost runs the other way and is the part worth
23306
+ // knowing: a value this schema admits and the domain enum then rejects lands
23307
+ // on the action's shared refusal, which names NO field, where a shape
23308
+ // rejection reaches `malformedInput` and names the schema key.
23309
+ redactFallback: external_exports.string(),
23310
+ // Shape only, the way the enum fields above are strings only: the RANGE is
23311
+ // `BodyRetention`'s and the action checks it there, so there is one place
23312
+ // that decides what a legal horizon is rather than two that can drift.
23313
+ bodyRetention: external_exports.object({ enabled: external_exports.boolean(), retainDays: external_exports.number() })
23133
23314
  });
23134
23315
  var AttachInput = external_exports.object({
23135
23316
  endpoint: external_exports.string(),
@@ -23255,13 +23436,59 @@ var SetupHandoffOffer = external_exports.object({
23255
23436
  path: ["liveKeys"]
23256
23437
  });
23257
23438
 
23439
+ // ../../packages/schema/src/zod/web-capture.ts
23440
+ var WebUsageSource = external_exports.enum(["site", "estimated", "none"]);
23441
+ var WebUsage = external_exports.object({
23442
+ inputTokens: external_exports.number().int().nonnegative().optional(),
23443
+ outputTokens: external_exports.number().int().nonnegative().optional(),
23444
+ cacheReadInputTokens: external_exports.number().int().nonnegative().optional(),
23445
+ cacheCreationInputTokens: external_exports.number().int().nonnegative().optional()
23446
+ });
23447
+ var WebToolCall = external_exports.object({
23448
+ toolUseId: external_exports.string().min(1),
23449
+ toolName: external_exports.string().min(1),
23450
+ target: external_exports.string().optional(),
23451
+ isError: external_exports.boolean().optional(),
23452
+ inputSize: external_exports.number().int().nonnegative().optional(),
23453
+ outputSize: external_exports.number().int().nonnegative().optional()
23454
+ });
23455
+ var WebExchange = external_exports.object({
23456
+ messageId: external_exports.string().min(1),
23457
+ startedAt: external_exports.iso.datetime(),
23458
+ model: external_exports.string().optional(),
23459
+ usage: WebUsage.optional(),
23460
+ usageSource: WebUsageSource,
23461
+ stopReason: external_exports.string().optional(),
23462
+ conversationId: external_exports.string().optional(),
23463
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23464
+ toolCalls: external_exports.array(WebToolCall).default([]),
23465
+ // Absent when the adapter recovered no text. Capped by the caller at
23466
+ // RESPONSE_TEXT_MAX_BYTES; `truncated` records that the cap was reached, so a
23467
+ // short capture is never mistaken for a short reply.
23468
+ responseText: external_exports.string().optional(),
23469
+ truncated: external_exports.boolean().default(false)
23470
+ });
23471
+ var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
23472
+ var WebCaptureStatus = external_exports.object({
23473
+ patched: external_exports.boolean(),
23474
+ live: external_exports.boolean(),
23475
+ blind: external_exports.boolean(),
23476
+ sendsSeenDom: external_exports.number().int().nonnegative(),
23477
+ exchangesSeenNet: external_exports.number().int().nonnegative(),
23478
+ parseFailures: external_exports.number().int().nonnegative(),
23479
+ unparsedBodies: external_exports.number().int().nonnegative(),
23480
+ // The adapter-declared JSON key paths that were absent from a real payload —
23481
+ // the earliest signal that a site's contract moved.
23482
+ shapeMisses: external_exports.array(external_exports.string()).default([])
23483
+ });
23484
+
23258
23485
  // src/provenance.ts
23259
23486
  import { execFileSync } from "child_process";
23260
23487
  var USE_SHELL = process.platform === "win32";
23261
23488
 
23262
23489
  // ../../packages/plugin-sdk/src/config.ts
23263
23490
  import { existsSync as existsSync8 } from "fs";
23264
- import { join as join14 } from "path";
23491
+ import { join as join16 } from "path";
23265
23492
 
23266
23493
  // ../../packages/persistence/src/attached-derived.ts
23267
23494
  import { rmSync } from "fs";
@@ -23299,6 +23526,32 @@ var STALE_PARTIAL_MS = 5 * 6e4;
23299
23526
  var SNAPSHOT_STAGING_SUFFIX = ".partial";
23300
23527
  var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
23301
23528
 
23529
+ // ../../packages/persistence/src/internal/sql-functions.ts
23530
+ var utf8 = new TextDecoder();
23531
+
23532
+ // ../../packages/persistence/src/internal/outbox-lane.ts
23533
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23534
+ var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23535
+
23536
+ // ../../packages/persistence/src/sync-failure.ts
23537
+ var SYNC_FAILURE_REASONS = SyncFailureReason.options;
23538
+
23539
+ // ../../packages/persistence/src/repositories/history-sync.ts
23540
+ var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23541
+ var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23542
+ var COUNTED_EVENT_TYPES = [
23543
+ ...STRUCTURAL_EVENT_TYPES,
23544
+ ...OUTBOX_CAPTURE_EVENT_TYPES
23545
+ ];
23546
+ var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23547
+ var COUNTED_SCOPE = `
23548
+ WHERE event_type IN (${COUNTED_TYPE_LIST})
23549
+ AND (
23550
+ event_type IN (${TYPE_LIST})
23551
+ OR synced_at IS NOT NULL
23552
+ OR outbox_owed = 1
23553
+ )`;
23554
+
23302
23555
  // ../../packages/persistence/src/repositories/activity.ts
23303
23556
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
23304
23557
  var DB_EVENT_TYPE_TO_KIND = {
@@ -23352,13 +23605,10 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
23352
23605
  e.tool_name AS tool_name,
23353
23606
  f.audit_event_id AS event_id, e.root_session_id AS session_id,
23354
23607
  e.event_type AS kind, f.finding_key AS finding_key,
23355
- ${latestResolutionStatusSql("f")} AS latest_status`;
23356
-
23357
- // ../../packages/persistence/src/repositories/history-sync.ts
23358
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23359
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23360
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23361
- var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23608
+ ${latestResolutionStatusSql("f")} AS latest_status,
23609
+ e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
23610
+ e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
23611
+ e.outbox_owed AS outbox_owed`;
23362
23612
 
23363
23613
  // ../../packages/persistence/src/repositories/installed-packs.ts
23364
23614
  import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
@@ -23442,9 +23692,11 @@ import { randomUUID as randomUUID10 } from "crypto";
23442
23692
 
23443
23693
  // ../../packages/persistence/src/database.ts
23444
23694
  var CAPTURE_GRAIN = new Set(EventKind.options);
23695
+ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
23445
23696
 
23446
23697
  // ../../packages/persistence/src/egress-wire.ts
23447
23698
  import { createHash as createHash3 } from "crypto";
23699
+ var SLASH = "/".charCodeAt(0);
23448
23700
 
23449
23701
  // ../../packages/persistence/src/finding-key.ts
23450
23702
  import { createHash as createHash4 } from "crypto";
@@ -23455,18 +23707,26 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23455
23707
  import { join as join8 } from "path";
23456
23708
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23457
23709
 
23710
+ // ../../packages/persistence/src/forward-health.ts
23711
+ import { readFileSync as readFileSync7 } from "fs";
23712
+ import { join as join9 } from "path";
23713
+
23458
23714
  // ../../packages/persistence/src/history-backfill.ts
23459
23715
  import { existsSync as existsSync4 } from "fs";
23460
- import { join as join9 } from "path";
23716
+ import { join as join10 } from "path";
23461
23717
 
23462
23718
  // ../../packages/persistence/src/history-preview.ts
23463
23719
  import { existsSync as existsSync5 } from "fs";
23464
- import { join as join10 } from "path";
23720
+ import { join as join11 } from "path";
23465
23721
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23466
23722
 
23723
+ // ../../packages/persistence/src/history-sync-state.ts
23724
+ import { readFileSync as readFileSync8 } from "fs";
23725
+ import { join as join12 } from "path";
23726
+
23467
23727
  // ../../packages/persistence/src/store-symlinks.ts
23468
23728
  import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23469
- import { dirname as dirname3, join as join11, resolve } from "path";
23729
+ import { dirname as dirname3, join as join13, resolve } from "path";
23470
23730
 
23471
23731
  // ../../packages/persistence/src/vault/crypto.ts
23472
23732
  import {
@@ -23480,15 +23740,15 @@ import {
23480
23740
  // ../../packages/persistence/src/vault/key-provider.ts
23481
23741
  import { execFileSync as execFileSync2 } from "child_process";
23482
23742
  import { randomBytes as randomBytes2 } from "crypto";
23483
- import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23484
- import { join as join12 } from "path";
23743
+ import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23744
+ import { join as join14 } from "path";
23485
23745
 
23486
23746
  // ../../packages/persistence/src/vault/vault.ts
23487
23747
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23488
23748
 
23489
23749
  // ../../packages/persistence/src/warn-era-cap.ts
23490
23750
  import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
23491
- import { join as join13 } from "path";
23751
+ import { join as join15 } from "path";
23492
23752
 
23493
23753
  // ../../packages/plugin-sdk/src/provider-env.ts
23494
23754
  var booleanish = external_exports.string().optional().transform((v) => {
@@ -23509,9 +23769,9 @@ var providerEnvShape = {
23509
23769
  var ProviderEnvSchema = external_exports.object(providerEnvShape);
23510
23770
 
23511
23771
  // ../../packages/plugin-sdk/src/config-inventory.ts
23512
- import { readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23772
+ import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23513
23773
  import { homedir as homedir2 } from "os";
23514
- import { basename as basename3, join as join16 } from "path";
23774
+ import { basename as basename3, join as join18 } from "path";
23515
23775
 
23516
23776
  // ../../packages/detections/src/egress/registry.ts
23517
23777
  var EXTRACTOR_VERSION = "1";
@@ -24269,8 +24529,8 @@ var CPU_CORROBORATION_SHARE = 0.2;
24269
24529
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24270
24530
 
24271
24531
  // ../../packages/plugin-sdk/src/repo.ts
24272
- import { existsSync as existsSync9, readFileSync as readFileSync8, statSync as statSync6 } from "fs";
24273
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join15, sep as sep2 } from "path";
24532
+ import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
24533
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
24274
24534
 
24275
24535
  // ../../packages/plugin-sdk/src/events.ts
24276
24536
  import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
@@ -24281,8 +24541,8 @@ import { fileURLToPath } from "url";
24281
24541
  import { Worker } from "worker_threads";
24282
24542
 
24283
24543
  // ../../packages/plugin-sdk/src/host-floor.ts
24284
- import { readFileSync as readFileSync11 } from "fs";
24285
- import { join as join18 } from "path";
24544
+ import { readFileSync as readFileSync13 } from "fs";
24545
+ import { join as join20 } from "path";
24286
24546
 
24287
24547
  // ../../packages/plugin-sdk/src/model-governance.ts
24288
24548
  import {
@@ -24290,11 +24550,11 @@ import {
24290
24550
  fstatSync,
24291
24551
  mkdirSync as mkdirSync2,
24292
24552
  openSync as openSync2,
24293
- readFileSync as readFileSync10,
24553
+ readFileSync as readFileSync12,
24294
24554
  readSync,
24295
24555
  writeFileSync as writeFileSync5
24296
24556
  } from "fs";
24297
- import { join as join17 } from "path";
24557
+ import { join as join19 } from "path";
24298
24558
  var TAIL_BYTES = 256 * 1024;
24299
24559
 
24300
24560
  // ../../packages/plugin-sdk/src/host-floor.ts
@@ -24317,15 +24577,15 @@ var HOST_FLOORS = {
24317
24577
 
24318
24578
  // ../../packages/plugin-sdk/src/ignore-layers.ts
24319
24579
  var import_ignore = __toESM(require_ignore(), 1);
24320
- import { readFileSync as readFileSync12 } from "fs";
24321
- import { join as join19 } from "path";
24580
+ import { readFileSync as readFileSync14 } from "fs";
24581
+ import { join as join21 } from "path";
24322
24582
 
24323
24583
  // ../../packages/plugin-sdk/src/inventory-resolver.ts
24324
24584
  import { arch, hostname as hostname4, platform, release } from "os";
24325
24585
 
24326
24586
  // ../../packages/plugin-sdk/src/nudge.ts
24327
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
24328
- import { join as join20 } from "path";
24587
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "fs";
24588
+ import { join as join22 } from "path";
24329
24589
 
24330
24590
  // ../../packages/plugin-sdk/src/paths.ts
24331
24591
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
@@ -24333,7 +24593,7 @@ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24333
24593
 
24334
24594
  // ../../packages/plugin-sdk/src/project-files.ts
24335
24595
  import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
24336
- import { basename as basename5, join as join21 } from "path";
24596
+ import { basename as basename5, join as join23 } from "path";
24337
24597
 
24338
24598
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24339
24599
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24369,11 +24629,11 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24369
24629
 
24370
24630
  // ../../packages/plugin-sdk/src/throttle.ts
24371
24631
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24372
- import { join as join22 } from "path";
24632
+ import { join as join24 } from "path";
24373
24633
 
24374
24634
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
24375
24635
  import { writeFileSync as writeFileSync8 } from "fs";
24376
- import { join as join23 } from "path";
24636
+ import { join as join25 } from "path";
24377
24637
 
24378
24638
  // ../../packages/setup-wizard/src/triage/merge.ts
24379
24639
  var RANK = Object.fromEntries(
@@ -24381,9 +24641,9 @@ var RANK = Object.fromEntries(
24381
24641
  );
24382
24642
 
24383
24643
  // ../../packages/setup-wizard/src/triage/plan-file.ts
24384
- import { mkdtempSync, readFileSync as readFileSync14, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24644
+ import { mkdtempSync, readFileSync as readFileSync16, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24385
24645
  import { tmpdir } from "os";
24386
- import { basename as basename6, dirname as dirname6, join as join24 } from "path";
24646
+ import { basename as basename6, dirname as dirname6, join as join26 } from "path";
24387
24647
  var SuppressionEntrySchema = external_exports.object({
24388
24648
  ruleId: external_exports.string(),
24389
24649
  category: DetectionCategory,
@@ -24526,7 +24786,7 @@ function buildIntroCard(manifest2, verified) {
24526
24786
  var manifestPath = process.argv[2];
24527
24787
  var manifest = {};
24528
24788
  try {
24529
- manifest = JSON.parse(readFileSync15(manifestPath ?? "", "utf8"));
24789
+ manifest = JSON.parse(readFileSync17(manifestPath ?? "", "utf8"));
24530
24790
  } catch {
24531
24791
  }
24532
24792
  process.stdout.write(show(fenced(buildIntroCard(manifest))));