@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.
package/scripts/stop.js CHANGED
@@ -493,7 +493,7 @@ var require_ignore = __commonJS({
493
493
 
494
494
  // ../../packages/plugin-sdk/src/config.ts
495
495
  import { existsSync as existsSync7 } from "fs";
496
- import { join as join12 } from "path";
496
+ import { join as join13 } from "path";
497
497
 
498
498
  // ../../packages/persistence/src/attached-derived.ts
499
499
  import { rmSync } from "fs";
@@ -21798,6 +21798,26 @@ var AttachTokenResponse = external_exports.union([
21798
21798
  AttachTokenExpired,
21799
21799
  external_exports.object({ status: printable(64) })
21800
21800
  ]);
21801
+ var DeviceCommandKind = external_exports.enum(["shares_rescan"]);
21802
+ var DeviceCommand = external_exports.object({
21803
+ id: printable(128).min(1),
21804
+ kind: DeviceCommandKind,
21805
+ issuedAt: printable(64).min(1),
21806
+ expiresAt: printable(64).min(1)
21807
+ }).strict();
21808
+ var DeviceCommandPollResponse = external_exports.object({ command: DeviceCommand.nullable() });
21809
+ var DeviceCommandFailureReason = external_exports.enum(["scan_failed", "no_projects", "expired"]);
21810
+ var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
21811
+ external_exports.object({
21812
+ outcome: external_exports.literal("reported"),
21813
+ projectsScanned: external_exports.number().int().nonnegative()
21814
+ }).strict(),
21815
+ external_exports.object({
21816
+ outcome: external_exports.literal("failed"),
21817
+ reason: DeviceCommandFailureReason,
21818
+ projectsScanned: external_exports.number().int().nonnegative()
21819
+ }).strict()
21820
+ ]);
21801
21821
 
21802
21822
  // ../../packages/schema/src/zod/registry.ts
21803
21823
  var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
@@ -21964,7 +21984,7 @@ var PackManifest = external_exports.object({
21964
21984
  }).meta({ id: "PackManifest" });
21965
21985
 
21966
21986
  // ../../packages/schema/src/zod/detection.ts
21967
- var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
21987
+ var OriginEnum = external_exports.enum(["library", "custom"]).meta({ id: "OriginEnum" });
21968
21988
  var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
21969
21989
  var LibraryStateEnum = external_exports.enum(["new", "imported", "update"]).meta({ id: "LibraryStateEnum" });
21970
21990
  var DetectionCounts = external_exports.object({
@@ -22159,8 +22179,9 @@ var Event = external_exports.object({
22159
22179
  metadata: EventMetadata.optional()
22160
22180
  }).meta({ id: "Event" });
22161
22181
  var IngestEvent = Event.meta({ id: "IngestEvent" });
22182
+ var INGEST_BATCH_MAX = 100;
22162
22183
  var IngestBatch = external_exports.object({
22163
- events: external_exports.array(IngestEvent).min(1).max(100),
22184
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
22164
22185
  // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
22165
22186
  // additionally rejects any event whose contentHash the store has already
22166
22187
  // recorded — for re-runnable bulk ingest (worktree scan, transcript
@@ -22286,6 +22307,225 @@ var PatchInstalledPackRequest = external_exports.object({
22286
22307
  message: "At least one field must be provided"
22287
22308
  }).meta({ id: "PatchInstalledPackRequest" });
22288
22309
 
22310
+ // ../../packages/schema/src/zod/policy.ts
22311
+ var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22312
+ var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22313
+ var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22314
+ var PolicyProvenance = external_exports.enum(["builtin", "authored"]).meta({ id: "PolicyProvenance" });
22315
+ var Policy = external_exports.object({
22316
+ id: external_exports.guid(),
22317
+ scope: PolicyScope,
22318
+ target: PolicyTarget,
22319
+ action: ActionTaken,
22320
+ enabled: external_exports.boolean().default(true),
22321
+ customKeywords: external_exports.array(external_exports.string()).optional(),
22322
+ // Display name — optional so older policy rows without name still parse.
22323
+ // Added for the findings API (policy.name column migration).
22324
+ name: external_exports.string().optional(),
22325
+ // Whether an AUTHORED policy governs this row's target — not a claim about
22326
+ // which row this is. A producer that collapses several rows onto one target
22327
+ // must carry the marker onto whichever row survives, or the collapse decides
22328
+ // the answer; a survivor may therefore be a built-in expansion still marked
22329
+ // 'authored' because an authored sibling targeted the same thing.
22330
+ // Optional so an older producer — and an older on-disk cache — still parses;
22331
+ // absent reads as 'builtin', which is the behaviour that predates the field.
22332
+ //
22333
+ // Deliberately NOT `kind`/PolicyKind: that name and that enum answer which
22334
+ // built-in archetype catalog entry a policy is, which every catalog surface
22335
+ // reads and which a caller may state. This one is a statement the PRODUCER
22336
+ // of a bundle makes about a row, and only the bundle builder ever stamps it
22337
+ // — the CRUD routes neither accept nor set it.
22338
+ //
22339
+ // A device consumes this in exactly one direction: an 'authored' policy
22340
+ // arriving from a control plane marks the rules it targets as not
22341
+ // locally re-assignable. That can only ever ADD a refusal, never relax one,
22342
+ // which is what makes it safe to honour from an unsigned cache — the same
22343
+ // test `prohibitedModels` passes and `reversibleRuleIds` fails.
22344
+ provenance: PolicyProvenance.optional()
22345
+ }).meta({ id: "Policy" });
22346
+ var PolicyBundle = external_exports.object({
22347
+ version: external_exports.string(),
22348
+ policies: external_exports.array(Policy),
22349
+ // Rules from the installed marketplace packs (snapshotted by the
22350
+ // control plane). The plugin registers these in addition to its bundled
22351
+ // packs. Optional so older backends — and older on-disk caches — that omit
22352
+ // the field still parse; consumers read `bundle.rules ?? []`.
22353
+ rules: external_exports.array(Rule).optional(),
22354
+ // When true, `rules` IS the complete effective ruleset and the runtime must
22355
+ // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22356
+ // after reading the user's installed snapshot (installed_packs, enabled
22357
+ // packs only), which is how detection updates stay manual: new bundled
22358
+ // rules run only after the user applies the pack update. Absent/false keeps
22359
+ // the historical composition (bundled packs + rules) — older caches.
22360
+ rulesComplete: external_exports.boolean().optional(),
22361
+ // Active detection exceptions, evaluation subset only (see
22362
+ // ExceptionBundleEntry). Optional so older bundle producers — and older
22363
+ // on-disk caches — that omit the field still parse; consumers read
22364
+ // `bundle.exceptions ?? []`.
22365
+ exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22366
+ // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22367
+ // A second axis over the same `redact` action, carried beside the policies
22368
+ // rather than on them: nothing writes ruleId-targeted policies to disk, so
22369
+ // widening Policy itself would change a persisted shape to express something
22370
+ // only the in-memory bundle needs. Optional so an older producer — or an
22371
+ // older on-disk cache — still parses; consumers read `?? []` and get the
22372
+ // pre-existing one-way behaviour, which is the safe direction to default.
22373
+ reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22374
+ // Installed pack version, keyed by ruleId, for rules in `rules` that came
22375
+ // from a versioned installed pack. Optional so older backends — and older
22376
+ // on-disk caches — that omit the field still parse; consumers fall back to
22377
+ // the rule's own spec version. NOT the bundle version above — see
22378
+ // installedRuleset's ruleVersions for the source of truth.
22379
+ ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22380
+ // Model ids (the raw `model` string a harness reports, e.g.
22381
+ // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22382
+ // a session onto one (PreModelSwitch) and refuses a turn that would run on
22383
+ // one (UserPromptSubmit). Optional so an older backend — and an older
22384
+ // on-disk cache — still parses; consumers read `?? []`, which is the
22385
+ // unenforced behaviour that predates this field and the safe direction to
22386
+ // default.
22387
+ //
22388
+ // Ids, not display names: the governance decision is keyed on the exact
22389
+ // string the harness reports (`model_status_override.versionId` in the
22390
+ // control plane), so no name resolution stands between the decision and the
22391
+ // comparison.
22392
+ prohibitedModels: external_exports.array(external_exports.string()).optional(),
22393
+ customKeywords: external_exports.array(external_exports.string()),
22394
+ fetchedAt: external_exports.iso.datetime()
22395
+ }).meta({ id: "PolicyBundle" });
22396
+ var POLICY_BUNDLE_SHAPE_ID = [
22397
+ ...Object.keys(PolicyBundle.shape),
22398
+ ...Object.keys(Policy.shape).map((key) => `policies.${key}`),
22399
+ ...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
22400
+ ...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
22401
+ ].sort().join(",");
22402
+ var OBSERVE_ONLY_CATEGORIES = ["config"];
22403
+ var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22404
+ var CATEGORY_PEAK_SEVERITY = {
22405
+ secret: "critical",
22406
+ financial: "critical",
22407
+ // core-financial/credit-card
22408
+ code_flaw: "critical",
22409
+ pii: "high",
22410
+ phi: "high",
22411
+ custom: "high",
22412
+ // user-defined; conservative
22413
+ code_context: "low",
22414
+ config: "low"
22415
+ // observe-only; floors to monitor regardless
22416
+ };
22417
+ function severityFloorPolicy(category) {
22418
+ if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22419
+ const peak = CATEGORY_PEAK_SEVERITY[category];
22420
+ return peak === "critical" || peak === "high" ? "warn" : "monitor";
22421
+ }
22422
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22423
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22424
+ var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
22425
+ id: "RedactFallback"
22426
+ });
22427
+ var BUILTIN_POLICY_SPECS = {
22428
+ monitor: {
22429
+ name: "Monitor",
22430
+ action: "log",
22431
+ reversible: false,
22432
+ description: "Log every match for audit. The request is allowed through untouched."
22433
+ },
22434
+ warn: {
22435
+ name: "Warn",
22436
+ action: "warn",
22437
+ reversible: false,
22438
+ description: "Allow the request, but warn the user inline before it is sent."
22439
+ },
22440
+ redact: {
22441
+ name: "Redact",
22442
+ action: "redact",
22443
+ reversible: false,
22444
+ description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22445
+ },
22446
+ vault: {
22447
+ name: "Redact & Vault",
22448
+ action: "redact",
22449
+ reversible: true,
22450
+ 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."
22451
+ },
22452
+ block: {
22453
+ name: "Block",
22454
+ action: "block",
22455
+ reversible: false,
22456
+ description: "Refuse the request entirely whenever any rule in this detection matches."
22457
+ }
22458
+ };
22459
+ function builtinPolicyToAction(id) {
22460
+ return BUILTIN_POLICY_SPECS[id].action;
22461
+ }
22462
+ var PALETTE_WEAKEST_FIRST = [
22463
+ ...new Set(KNOWN_BUILTIN_IDS.map(builtinPolicyToAction))
22464
+ ];
22465
+ var BELOW_PALETTE = ACTION_TAKEN_KEYS.filter(
22466
+ (action) => !PALETTE_WEAKEST_FIRST.includes(action)
22467
+ );
22468
+ var ACTION_STRENGTH_ORDER = [
22469
+ ...BELOW_PALETTE,
22470
+ ...PALETTE_WEAKEST_FIRST
22471
+ ];
22472
+ var PackPolicyFloor = external_exports.object({
22473
+ /**
22474
+ * The weakest archetype the device may assign. Stated as a BuiltinPolicyId
22475
+ * rather than a raw ActionTaken because that is the vocabulary the user
22476
+ * picks from — a floor a UI cannot name is one it cannot explain.
22477
+ */
22478
+ floor: BuiltinPolicyId,
22479
+ /**
22480
+ * True when the organization AUTHORED a policy governing this pack rather
22481
+ * than stating a minimum: it gave the answer, so the pack is not
22482
+ * re-assignable locally in either direction.
22483
+ */
22484
+ locked: external_exports.boolean()
22485
+ }).describe("PackPolicyFloor");
22486
+ var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22487
+ (id) => !BUILTIN_POLICY_SPECS[id].reversible
22488
+ );
22489
+ var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22490
+ (id) => BUILTIN_POLICY_SPECS[id].reversible
22491
+ );
22492
+ var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22493
+ var DEFAULT_ACTIONS = Object.fromEntries(
22494
+ DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22495
+ );
22496
+ var BUILTIN_POLICIES = Object.fromEntries(
22497
+ KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22498
+ );
22499
+ var UsedByItem = external_exports.object({
22500
+ id: external_exports.string(),
22501
+ name: external_exports.string(),
22502
+ ruleCount: external_exports.number().int().nonnegative(),
22503
+ enabled: external_exports.boolean()
22504
+ }).meta({ id: "UsedByItem" });
22505
+ var PolicyListItem = external_exports.object({
22506
+ id: external_exports.string(),
22507
+ kind: PolicyKind,
22508
+ name: external_exports.string(),
22509
+ enabled: external_exports.boolean(),
22510
+ usedByCount: external_exports.number().int().nonnegative()
22511
+ }).meta({ id: "PolicyListItem" });
22512
+ var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22513
+ var PolicyDetail = external_exports.object({
22514
+ specVersion: external_exports.literal(1),
22515
+ id: external_exports.string(),
22516
+ kind: PolicyKind,
22517
+ name: external_exports.string(),
22518
+ enabled: external_exports.boolean(),
22519
+ description: external_exports.string(),
22520
+ usedBy: external_exports.array(UsedByItem)
22521
+ }).meta({ id: "PolicyDetail" });
22522
+ var PolicyStatsResponse = external_exports.object({
22523
+ policies: external_exports.number().int().nonnegative(),
22524
+ builtin: external_exports.number().int().nonnegative(),
22525
+ custom: external_exports.number().int().nonnegative(),
22526
+ detectionsGoverned: external_exports.number().int().nonnegative()
22527
+ }).meta({ id: "PolicyStatsResponse" });
22528
+
22289
22529
  // ../../packages/schema/src/zod/vault.ts
22290
22530
  var CATEGORY_ALTERNATION = DetectionCategory.options.join("|");
22291
22531
  var POINTER_TOKEN_PATTERN = new RegExp(
@@ -22322,6 +22562,14 @@ var VaultEntry = external_exports.object({
22322
22562
  // How many times this value has been detected on this machine — the reuse
22323
22563
  // signal the vault dashboard reads. Distinct from VaultDeref.pointerCount.
22324
22564
  occurrenceCount: external_exports.number().int().nonnegative(),
22565
+ // True when a PERSON asked for this value to be replaced — the surfaced-
22566
+ // secrets strike — rather than a pack enforcing its assignment. One value is
22567
+ // one row however many paths vault it, so this is what tells a policy sweep
22568
+ // that the row carries somebody's own instruction and not just an assignment
22569
+ // that has since been lowered. STICKY and MONOTONIC: a later automatic
22570
+ // vaulting of the same value must never clear it — what the user said about
22571
+ // the value does not expire.
22572
+ userAuthorized: external_exports.boolean(),
22325
22573
  firstSeen: external_exports.string(),
22326
22574
  lastSeen: external_exports.string()
22327
22575
  });
@@ -22438,7 +22686,7 @@ var VaultConsent = external_exports.object({
22438
22686
  });
22439
22687
 
22440
22688
  // ../../packages/schema/src/zod/local.ts
22441
- var WORKSPACE_SETTINGS_SPEC_VERSION = 6;
22689
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
22442
22690
  var MODEL_JUDGE_PAYLOAD_VERSION = 1;
22443
22691
  var RunMode = external_exports.enum(["standalone", "attached"]);
22444
22692
  var ControlPlaneConnection = external_exports.object({
@@ -22480,6 +22728,19 @@ var WorkspaceSettings = external_exports.object({
22480
22728
  vaultKeyCustody: VaultKeyCustody.default("file"),
22481
22729
  // How a pointer renders in assistant prose on screen (see VaultInlineReveal).
22482
22730
  vaultInlineReveal: VaultInlineReveal.default("masked"),
22731
+ // What a `redact` policy degrades to on a FIELD the host cannot rewrite in
22732
+ // place. Not a handling policy: the policy has already resolved to redact,
22733
+ // and this only says what happens when the host offers no channel to carry it
22734
+ // out — Antigravity's PreToolUse has no updatedInput at all, and Codex and
22735
+ // Claude Code decline to mask a field that EXECUTES because masking would
22736
+ // change what runs. Per FIELD rather than per host, so a host that can
22737
+ // rewrite some inputs keeps true redaction on those.
22738
+ //
22739
+ // Spelled in the built-in policy vocabulary rather than as a fresh enum, so
22740
+ // an attached machine's merge is `strongerAction` over the one action ladder
22741
+ // and no second rank order exists to drift from it. 'deny' is a host wire
22742
+ // word and stays out of the stored value.
22743
+ redactFallback: RedactFallback.default("warn"),
22483
22744
  // Absent until /aka:setup completes; its presence is what "onboarded" means.
22484
22745
  onboardedAt: external_exports.iso.datetime().optional(),
22485
22746
  // Records that the user consented to sending findings to the model API for
@@ -22487,10 +22748,12 @@ var WorkspaceSettings = external_exports.object({
22487
22748
  // Absent until granted; a stale payloadVersion means the consent no longer
22488
22749
  // covers the current payload and must be re-granted.
22489
22750
  modelJudgeConsent: ModelJudgeConsent.optional(),
22490
- // Records that the user consented to sending the activity already recorded on
22491
- // this machine to the deployment it is attached to, along with the payload
22492
- // shape and the endpoint they agreed to. Absent until granted, and a grant for
22493
- // a different endpoint or an older payload no longer counts.
22751
+ // Records that the user consented to the DEFERRED send — the outbox along
22752
+ // with the payload shape and the endpoint they agreed to. Since payload v2
22753
+ // that covers both the pre-attach backlog and undelivered captures (which
22754
+ // carry prompt/reply text in `content`); the key name predates the widening.
22755
+ // Absent until granted, and a grant for a different endpoint or an older
22756
+ // payload no longer counts.
22494
22757
  historySyncConsent: HistorySyncConsent.optional()
22495
22758
  });
22496
22759
  function defaultWorkspaceSettings() {
@@ -22507,7 +22770,8 @@ var ManagedSettingKey = external_exports.enum([
22507
22770
  "vaultKeyCustody",
22508
22771
  "vaultInlineReveal",
22509
22772
  "modelJudgeConsent",
22510
- "dataSharesInPlace"
22773
+ "dataSharesInPlace",
22774
+ "redactFallback"
22511
22775
  ]).meta({ id: "ManagedSettingKey" });
22512
22776
  var ManagedSettingsValues = external_exports.object({
22513
22777
  runMode: external_exports.enum(["standalone", "attached"]).optional(),
@@ -22520,7 +22784,8 @@ var ManagedSettingsValues = external_exports.object({
22520
22784
  vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
22521
22785
  vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
22522
22786
  modelJudgeConsent: external_exports.boolean().optional(),
22523
- dataSharesInPlace: external_exports.boolean().optional()
22787
+ dataSharesInPlace: external_exports.boolean().optional(),
22788
+ redactFallback: RedactFallback.optional()
22524
22789
  }).meta({ id: "ManagedSettingsValues" });
22525
22790
  var ManagedSettings = external_exports.object({
22526
22791
  specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
@@ -22535,171 +22800,6 @@ var ManagedSettings = external_exports.object({
22535
22800
  lockedFields: external_exports.array(ManagedSettingKey).default([])
22536
22801
  }).meta({ id: "ManagedSettings" });
22537
22802
 
22538
- // ../../packages/schema/src/zod/policy.ts
22539
- var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
22540
- var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
22541
- var Policy = external_exports.object({
22542
- id: external_exports.guid(),
22543
- scope: PolicyScope,
22544
- target: PolicyTarget,
22545
- action: ActionTaken,
22546
- enabled: external_exports.boolean().default(true),
22547
- customKeywords: external_exports.array(external_exports.string()).optional(),
22548
- // Display name — optional so older policy rows without name still parse.
22549
- // Added for the findings API (policy.name column migration).
22550
- name: external_exports.string().optional()
22551
- }).meta({ id: "Policy" });
22552
- var PolicyBundle = external_exports.object({
22553
- version: external_exports.string(),
22554
- policies: external_exports.array(Policy),
22555
- // Rules from the installed marketplace packs (snapshotted by the
22556
- // control plane). The plugin registers these in addition to its bundled
22557
- // packs. Optional so older backends — and older on-disk caches — that omit
22558
- // the field still parse; consumers read `bundle.rules ?? []`.
22559
- rules: external_exports.array(Rule).optional(),
22560
- // When true, `rules` IS the complete effective ruleset and the runtime must
22561
- // NOT merge its compiled-in bundled packs — the standalone gateway sets this
22562
- // after reading the user's installed snapshot (installed_packs, enabled
22563
- // packs only), which is how detection updates stay manual: new bundled
22564
- // rules run only after the user applies the pack update. Absent/false keeps
22565
- // the historical composition (bundled packs + rules) — older caches.
22566
- rulesComplete: external_exports.boolean().optional(),
22567
- // Active detection exceptions, evaluation subset only (see
22568
- // ExceptionBundleEntry). Optional so older bundle producers — and older
22569
- // on-disk caches — that omit the field still parse; consumers read
22570
- // `bundle.exceptions ?? []`.
22571
- exceptions: external_exports.array(ExceptionBundleEntry).optional(),
22572
- // Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
22573
- // A second axis over the same `redact` action, carried beside the policies
22574
- // rather than on them: nothing writes ruleId-targeted policies to disk, so
22575
- // widening Policy itself would change a persisted shape to express something
22576
- // only the in-memory bundle needs. Optional so an older producer — or an
22577
- // older on-disk cache — still parses; consumers read `?? []` and get the
22578
- // pre-existing one-way behaviour, which is the safe direction to default.
22579
- reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
22580
- // Installed pack version, keyed by ruleId, for rules in `rules` that came
22581
- // from a versioned installed pack. Optional so older backends — and older
22582
- // on-disk caches — that omit the field still parse; consumers fall back to
22583
- // the rule's own spec version. NOT the bundle version above — see
22584
- // installedRuleset's ruleVersions for the source of truth.
22585
- ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
22586
- // Model ids (the raw `model` string a harness reports, e.g.
22587
- // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
22588
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
22589
- // one (UserPromptSubmit). Optional so an older backend — and an older
22590
- // on-disk cache — still parses; consumers read `?? []`, which is the
22591
- // unenforced behaviour that predates this field and the safe direction to
22592
- // default.
22593
- //
22594
- // Ids, not display names: the governance decision is keyed on the exact
22595
- // string the harness reports (`model_status_override.versionId` in the
22596
- // control plane), so no name resolution stands between the decision and the
22597
- // comparison.
22598
- prohibitedModels: external_exports.array(external_exports.string()).optional(),
22599
- customKeywords: external_exports.array(external_exports.string()),
22600
- fetchedAt: external_exports.iso.datetime()
22601
- }).meta({ id: "PolicyBundle" });
22602
- var OBSERVE_ONLY_CATEGORIES = ["config"];
22603
- var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
22604
- var CATEGORY_PEAK_SEVERITY = {
22605
- secret: "critical",
22606
- financial: "critical",
22607
- // core-financial/credit-card
22608
- code_flaw: "critical",
22609
- pii: "high",
22610
- phi: "high",
22611
- custom: "high",
22612
- // user-defined; conservative
22613
- code_context: "low",
22614
- config: "low"
22615
- // observe-only; floors to monitor regardless
22616
- };
22617
- function severityFloorPolicy(category) {
22618
- if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
22619
- const peak = CATEGORY_PEAK_SEVERITY[category];
22620
- return peak === "critical" || peak === "high" ? "warn" : "monitor";
22621
- }
22622
- var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
22623
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22624
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22625
- var BUILTIN_POLICY_SPECS = {
22626
- monitor: {
22627
- name: "Monitor",
22628
- action: "log",
22629
- reversible: false,
22630
- description: "Log every match for audit. The request is allowed through untouched."
22631
- },
22632
- warn: {
22633
- name: "Warn",
22634
- action: "warn",
22635
- reversible: false,
22636
- description: "Allow the request, but warn the user inline before it is sent."
22637
- },
22638
- redact: {
22639
- name: "Redact",
22640
- action: "redact",
22641
- reversible: false,
22642
- description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
22643
- },
22644
- vault: {
22645
- name: "Redact & Vault",
22646
- action: "redact",
22647
- reversible: true,
22648
- 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."
22649
- },
22650
- block: {
22651
- name: "Block",
22652
- action: "block",
22653
- reversible: false,
22654
- description: "Refuse the request entirely whenever any rule in this detection matches."
22655
- }
22656
- };
22657
- function builtinPolicyToAction(id) {
22658
- return BUILTIN_POLICY_SPECS[id].action;
22659
- }
22660
- var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22661
- (id) => !BUILTIN_POLICY_SPECS[id].reversible
22662
- );
22663
- var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
22664
- (id) => BUILTIN_POLICY_SPECS[id].reversible
22665
- );
22666
- var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
22667
- var DEFAULT_ACTIONS = Object.fromEntries(
22668
- DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
22669
- );
22670
- var BUILTIN_POLICIES = Object.fromEntries(
22671
- KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
22672
- );
22673
- var UsedByItem = external_exports.object({
22674
- id: external_exports.string(),
22675
- name: external_exports.string(),
22676
- ruleCount: external_exports.number().int().nonnegative(),
22677
- enabled: external_exports.boolean()
22678
- }).meta({ id: "UsedByItem" });
22679
- var PolicyListItem = external_exports.object({
22680
- id: external_exports.string(),
22681
- kind: PolicyKind,
22682
- name: external_exports.string(),
22683
- enabled: external_exports.boolean(),
22684
- usedByCount: external_exports.number().int().nonnegative()
22685
- }).meta({ id: "PolicyListItem" });
22686
- var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
22687
- var PolicyDetail = external_exports.object({
22688
- specVersion: external_exports.literal(1),
22689
- id: external_exports.string(),
22690
- kind: PolicyKind,
22691
- name: external_exports.string(),
22692
- enabled: external_exports.boolean(),
22693
- description: external_exports.string(),
22694
- usedBy: external_exports.array(UsedByItem)
22695
- }).meta({ id: "PolicyDetail" });
22696
- var PolicyStatsResponse = external_exports.object({
22697
- policies: external_exports.number().int().nonnegative(),
22698
- builtin: external_exports.number().int().nonnegative(),
22699
- custom: external_exports.number().int().nonnegative(),
22700
- detectionsGoverned: external_exports.number().int().nonnegative()
22701
- }).meta({ id: "PolicyStatsResponse" });
22702
-
22703
22803
  // ../../packages/schema/src/zod/project-files.ts
22704
22804
  var ProjectFileInput = external_exports.object({
22705
22805
  path: external_exports.string().min(1),
@@ -22939,10 +23039,12 @@ var DismissRecommendedActionResponse = external_exports.object({ id: external_ex
22939
23039
  var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
22940
23040
 
22941
23041
  // ../../packages/schema/src/zod/settings-action.ts
23042
+ var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23043
+ var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
22942
23044
  var SaveSettingsInput = external_exports.object({
22943
23045
  historicalAccess: external_exports.string(),
22944
- modelJudgeConsent: external_exports.boolean(),
22945
- historySyncConsent: external_exports.boolean(),
23046
+ modelJudgeConsent: ModelJudgeConsentChoice,
23047
+ historySyncConsent: HistorySyncConsentChoice,
22946
23048
  vaultConsent: external_exports.string(),
22947
23049
  vaultInlineReveal: external_exports.string()
22948
23050
  });
@@ -23112,8 +23214,8 @@ function tightenFile(file2) {
23112
23214
  }
23113
23215
 
23114
23216
  // ../../packages/persistence/src/database.ts
23115
- import { randomUUID as randomUUID10 } from "crypto";
23116
- import { join as join4, sep } from "path";
23217
+ import { randomUUID as randomUUID11 } from "crypto";
23218
+ import { dirname as dirname2, join as join7, sep } from "path";
23117
23219
  import { DatabaseSync } from "node:sqlite";
23118
23220
 
23119
23221
  // ../../packages/persistence/src/ids.ts
@@ -23140,6 +23242,20 @@ function parseJsonObject(s) {
23140
23242
 
23141
23243
  // ../../packages/persistence/src/repositories/activity.ts
23142
23244
  var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
23245
+ var DB_EVENT_TYPE_TO_KIND = {
23246
+ session: "session",
23247
+ prompt: "prompt",
23248
+ response: "response",
23249
+ tool_call: "tool",
23250
+ hook: "hook",
23251
+ detection: "detection",
23252
+ share: "share",
23253
+ permission: "permission",
23254
+ commit: "commit",
23255
+ error: "error",
23256
+ active: "active"
23257
+ };
23258
+ var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
23143
23259
  var DEFAULT_HARNESS = HARNESS.ClaudeCode;
23144
23260
 
23145
23261
  // ../../packages/persistence/src/repositories/exceptions.ts
@@ -23156,102 +23272,35 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
23156
23272
  // ../../packages/persistence/src/repositories/history-sync.ts
23157
23273
  var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
23158
23274
  var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23275
+ var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
23276
+ var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
23159
23277
 
23160
23278
  // ../../packages/persistence/src/repositories/installed-packs.ts
23161
- import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
23162
-
23163
- // ../../packages/persistence/src/repositories/inventory-assets.ts
23164
- import { randomUUID as randomUUID4 } from "crypto";
23165
- var VALID_HARNESS_IDS = new Set(HarnessId.options);
23166
- var HARNESS_LABELS = {
23167
- [HARNESS.ClaudeCode]: "Claude Code",
23168
- [HARNESS.Cursor]: "Cursor",
23169
- [HARNESS.Codex]: "Codex",
23170
- [HARNESS.Antigravity]: "Antigravity"
23171
- };
23172
- var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
23173
- var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
23174
- var TITLE_NEEDLES = {
23175
- ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
23176
- Cursor: stripSeparators(SOURCE_TOOL.Cursor),
23177
- Codex: stripSeparators(SOURCE_TOOL.Codex),
23178
- Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
23179
- };
23180
-
23181
- // ../../packages/persistence/src/repositories/policies.ts
23182
- import { randomUUID as randomUUID5 } from "crypto";
23183
-
23184
- // ../../packages/persistence/src/repositories/project-files.ts
23185
- import { randomUUID as randomUUID6 } from "crypto";
23186
-
23187
- // ../../packages/persistence/src/repositories/resolutions.ts
23188
- import { randomUUID as randomUUID7 } from "crypto";
23189
-
23190
- // ../../packages/persistence/src/repositories/secret-vault.ts
23191
- import { randomUUID as randomUUID8 } from "crypto";
23192
-
23193
- // ../../packages/persistence/src/repositories/security.ts
23194
- var SCAN_COVERAGE = {
23195
- [HARNESS.Antigravity]: { coverage: 60, supported: true },
23196
- [HARNESS.Api]: { coverage: 0, supported: false },
23197
- [HARNESS.ChatGpt]: { coverage: 40, supported: true },
23198
- [HARNESS.ClaudeAi]: { coverage: 40, supported: true },
23199
- [HARNESS.ClaudeCode]: { coverage: 100, supported: true },
23200
- [HARNESS.Codex]: { coverage: 80, supported: true },
23201
- [HARNESS.Copilot]: { coverage: 0, supported: false },
23202
- [HARNESS.Cursor]: { coverage: 0, supported: false }
23203
- };
23204
-
23205
- // ../../packages/persistence/src/repositories/shares.ts
23206
- import { randomUUID as randomUUID9 } from "crypto";
23207
-
23208
- // ../../packages/persistence/src/file-lock.ts
23209
- import { randomUUID as randomUUID11 } from "crypto";
23210
- import {
23211
- closeSync,
23212
- existsSync as existsSync2,
23213
- openSync,
23214
- readFileSync as readFileSync2,
23215
- rmSync as rmSync5,
23216
- statSync as statSync3,
23217
- writeFileSync as writeFileSync2
23218
- } from "fs";
23219
- import { hostname as hostname3 } from "os";
23220
- var PARK = new Int32Array(new SharedArrayBuffer(4));
23279
+ import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
23221
23280
 
23222
- // ../../packages/persistence/src/finding-key.ts
23223
- import { createHash as createHash3 } from "crypto";
23224
-
23225
- // ../../packages/persistence/src/fingerprint.ts
23226
- import { createHmac, randomBytes } from "crypto";
23227
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
23228
- import { join as join5 } from "path";
23229
- import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23230
-
23231
- // ../../packages/persistence/src/history-preview.ts
23232
- import { existsSync as existsSync4 } from "fs";
23281
+ // ../../packages/persistence/src/policy-floor.ts
23282
+ import { readFileSync as readFileSync5 } from "fs";
23233
23283
  import { join as join6 } from "path";
23234
- import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23235
23284
 
23236
23285
  // ../../packages/persistence/src/local-layout.ts
23237
23286
  import { renameSync as renameSync3 } from "fs";
23238
23287
  import { mkdir } from "fs/promises";
23239
23288
  import { homedir } from "os";
23240
- import { join as join7 } from "path";
23289
+ import { join as join4 } from "path";
23241
23290
  function defaultDataDir() {
23242
- return join7(homedir(), ".aka");
23291
+ return join4(homedir(), ".aka");
23243
23292
  }
23244
23293
  function settingsDir(base = defaultDataDir()) {
23245
- return join7(base, "settings");
23294
+ return join4(base, "settings");
23246
23295
  }
23247
23296
  function dataDir(base = defaultDataDir()) {
23248
- return join7(base, "data");
23297
+ return join4(base, "data");
23249
23298
  }
23250
23299
  function dbPath(base = defaultDataDir()) {
23251
- return join7(dataDir(base), "aka.db");
23300
+ return join4(dataDir(base), "aka.db");
23252
23301
  }
23253
23302
  function keysDir(base = defaultDataDir()) {
23254
- return join7(base, "keys");
23303
+ return join4(base, "keys");
23255
23304
  }
23256
23305
  function ensureLayoutDirSync(dir = defaultDataDir()) {
23257
23306
  ensureDataDirSync(dir);
@@ -23264,16 +23313,34 @@ function migrateLegacyLayout(base = defaultDataDir()) {
23264
23313
  for (const { name, dest } of moves) {
23265
23314
  try {
23266
23315
  ensureDataDirSync(dest);
23267
- const moved = join7(dest, name);
23268
- renameSync3(join7(base, name), moved);
23316
+ const moved = join4(dest, name);
23317
+ renameSync3(join4(base, name), moved);
23269
23318
  tightenFile(moved);
23270
23319
  } catch {
23271
23320
  }
23272
23321
  }
23273
23322
  }
23274
23323
 
23275
- // ../../packages/persistence/src/managed-settings.ts
23324
+ // ../../packages/persistence/src/settings.ts
23276
23325
  import { readFileSync as readFileSync4 } from "fs";
23326
+ import { join as join5 } from "path";
23327
+
23328
+ // ../../packages/persistence/src/file-lock.ts
23329
+ import { randomUUID as randomUUID3 } from "crypto";
23330
+ import {
23331
+ closeSync,
23332
+ existsSync as existsSync2,
23333
+ openSync,
23334
+ readFileSync as readFileSync2,
23335
+ rmSync as rmSync5,
23336
+ statSync as statSync3,
23337
+ writeFileSync as writeFileSync2
23338
+ } from "fs";
23339
+ import { hostname as hostname3 } from "os";
23340
+ var PARK = new Int32Array(new SharedArrayBuffer(4));
23341
+
23342
+ // ../../packages/persistence/src/managed-settings.ts
23343
+ import { readFileSync as readFileSync3 } from "fs";
23277
23344
  import { posix, win32 } from "path";
23278
23345
  function managedSettingsPaths(platform2 = process.platform) {
23279
23346
  if (platform2 === "darwin") {
@@ -23291,7 +23358,7 @@ function readManagedSettings(paths = managedSettingsPaths()) {
23291
23358
  for (const path of paths) {
23292
23359
  let text;
23293
23360
  try {
23294
- text = readFileSync4(path, "utf8");
23361
+ text = readFileSync3(path, "utf8");
23295
23362
  } catch {
23296
23363
  continue;
23297
23364
  }
@@ -23321,6 +23388,7 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
23321
23388
  if (values.vaultKeyCustody !== void 0) merged.vaultKeyCustody = values.vaultKeyCustody;
23322
23389
  if (values.vaultInlineReveal !== void 0) merged.vaultInlineReveal = values.vaultInlineReveal;
23323
23390
  if (values.dataSharesInPlace !== void 0) merged.dataSharesInPlace = values.dataSharesInPlace;
23391
+ if (values.redactFallback !== void 0) merged.redactFallback = values.redactFallback;
23324
23392
  if (values.vaultConsent !== void 0) {
23325
23393
  merged.vaultConsent = values.vaultConsent ? (
23326
23394
  // Keep an existing valid grant so its acknowledgedAt survives; mint one
@@ -23338,14 +23406,12 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
23338
23406
  }
23339
23407
 
23340
23408
  // ../../packages/persistence/src/settings.ts
23341
- import { readFileSync as readFileSync5 } from "fs";
23342
- import { join as join8 } from "path";
23343
23409
  var SETTINGS_FILENAME = "settings.json";
23344
23410
  function readWorkspaceSettings(base = defaultDataDir()) {
23345
23411
  return overlayManagedSettings(readUserSettings(base), readManagedSettings());
23346
23412
  }
23347
23413
  function readUserSettings(base) {
23348
- const record2 = readJson(join8(settingsDir(base), SETTINGS_FILENAME));
23414
+ const record2 = readJson(join5(settingsDir(base), SETTINGS_FILENAME));
23349
23415
  if (!record2) return defaultWorkspaceSettings();
23350
23416
  try {
23351
23417
  return WorkspaceSettings.parse(record2);
@@ -23356,16 +23422,78 @@ function readUserSettings(base) {
23356
23422
  function readJson(file2) {
23357
23423
  let text;
23358
23424
  try {
23359
- text = readFileSync5(file2, "utf8");
23425
+ text = readFileSync4(file2, "utf8");
23360
23426
  } catch {
23361
23427
  return null;
23362
23428
  }
23363
23429
  return parseJsonObject(text) ?? null;
23364
23430
  }
23365
23431
 
23432
+ // ../../packages/persistence/src/repositories/inventory-assets.ts
23433
+ import { randomUUID as randomUUID5 } from "crypto";
23434
+ var VALID_HARNESS_IDS = new Set(HarnessId.options);
23435
+ var HARNESS_LABELS = {
23436
+ [HARNESS.ClaudeCode]: "Claude Code",
23437
+ [HARNESS.Cursor]: "Cursor",
23438
+ [HARNESS.Codex]: "Codex",
23439
+ [HARNESS.Antigravity]: "Antigravity"
23440
+ };
23441
+ var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
23442
+ var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
23443
+ var TITLE_NEEDLES = {
23444
+ ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
23445
+ Cursor: stripSeparators(SOURCE_TOOL.Cursor),
23446
+ Codex: stripSeparators(SOURCE_TOOL.Codex),
23447
+ Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
23448
+ };
23449
+
23450
+ // ../../packages/persistence/src/repositories/policies.ts
23451
+ import { randomUUID as randomUUID6 } from "crypto";
23452
+
23453
+ // ../../packages/persistence/src/repositories/project-files.ts
23454
+ import { randomUUID as randomUUID7 } from "crypto";
23455
+
23456
+ // ../../packages/persistence/src/repositories/resolutions.ts
23457
+ import { randomUUID as randomUUID8 } from "crypto";
23458
+
23459
+ // ../../packages/persistence/src/repositories/secret-vault.ts
23460
+ import { randomUUID as randomUUID9 } from "crypto";
23461
+
23462
+ // ../../packages/persistence/src/repositories/security.ts
23463
+ var SCAN_COVERAGE = {
23464
+ [HARNESS.Antigravity]: { coverage: 60, supported: true },
23465
+ [HARNESS.Api]: { coverage: 0, supported: false },
23466
+ [HARNESS.ChatGpt]: { coverage: 40, supported: true },
23467
+ [HARNESS.ClaudeAi]: { coverage: 40, supported: true },
23468
+ [HARNESS.ClaudeCode]: { coverage: 100, supported: true },
23469
+ [HARNESS.Codex]: { coverage: 80, supported: true },
23470
+ [HARNESS.Copilot]: { coverage: 0, supported: false },
23471
+ [HARNESS.Cursor]: { coverage: 0, supported: false }
23472
+ };
23473
+
23474
+ // ../../packages/persistence/src/repositories/shares.ts
23475
+ import { randomUUID as randomUUID10 } from "crypto";
23476
+
23477
+ // ../../packages/persistence/src/database.ts
23478
+ var CAPTURE_GRAIN = new Set(EventKind.options);
23479
+
23480
+ // ../../packages/persistence/src/finding-key.ts
23481
+ import { createHash as createHash3 } from "crypto";
23482
+
23483
+ // ../../packages/persistence/src/fingerprint.ts
23484
+ import { createHmac, randomBytes } from "crypto";
23485
+ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
23486
+ import { join as join8 } from "path";
23487
+ import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
23488
+
23489
+ // ../../packages/persistence/src/history-preview.ts
23490
+ import { existsSync as existsSync4 } from "fs";
23491
+ import { join as join9 } from "path";
23492
+ import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
23493
+
23366
23494
  // ../../packages/persistence/src/store-symlinks.ts
23367
23495
  import { existsSync as existsSync5, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
23368
- import { dirname as dirname2, join as join9, resolve } from "path";
23496
+ import { dirname as dirname3, join as join10, resolve } from "path";
23369
23497
  var STORE_DB = "the store database (including the prompt corpus)";
23370
23498
  var STORE_SETTINGS = "your settings file";
23371
23499
  function storeContents(home) {
@@ -23374,7 +23502,7 @@ function storeContents(home) {
23374
23502
  [settingsDir(home), STORE_SETTINGS],
23375
23503
  [dataDir(home), STORE_DB],
23376
23504
  [keysDir(home), "the vault key"],
23377
- [join9(settingsDir(home), "settings.json"), STORE_SETTINGS],
23505
+ [join10(settingsDir(home), "settings.json"), STORE_SETTINGS],
23378
23506
  [dbPath(home), STORE_DB]
23379
23507
  ]);
23380
23508
  }
@@ -23402,7 +23530,7 @@ function linkTarget(path) {
23402
23530
  try {
23403
23531
  return realpathSync(path);
23404
23532
  } catch {
23405
- return resolve(dirname2(path), readlinkSync(path));
23533
+ return resolve(dirname3(path), readlinkSync(path));
23406
23534
  }
23407
23535
  }
23408
23536
  function targetMode(path, platform2) {
@@ -23426,15 +23554,15 @@ import {
23426
23554
  // ../../packages/persistence/src/vault/key-provider.ts
23427
23555
  import { execFileSync } from "child_process";
23428
23556
  import { randomBytes as randomBytes2 } from "crypto";
23429
- import { chmodSync as chmodSync3, readFileSync as readFileSync6, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23430
- import { join as join10 } from "path";
23557
+ import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
23558
+ import { join as join11 } from "path";
23431
23559
 
23432
23560
  // ../../packages/persistence/src/vault/vault.ts
23433
23561
  import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
23434
23562
 
23435
23563
  // ../../packages/persistence/src/warn-era-cap.ts
23436
23564
  import { existsSync as existsSync6, writeFileSync as writeFileSync4 } from "fs";
23437
- import { join as join11 } from "path";
23565
+ import { join as join12 } from "path";
23438
23566
 
23439
23567
  // ../../packages/plugin-sdk/src/provider-env.ts
23440
23568
  var DEFAULT_ANTHROPIC_HOST = "api.anthropic.com";
@@ -23488,7 +23616,7 @@ function resolveProvider() {
23488
23616
  function loadConfig(base = defaultDataDir(), resolveProviderFn = resolveProvider) {
23489
23617
  try {
23490
23618
  ensureLayoutDirSync(base);
23491
- const settingsFile = join12(settingsDir(base), "settings.json");
23619
+ const settingsFile = join13(settingsDir(base), "settings.json");
23492
23620
  if (existsSync7(settingsFile)) tightenFile(settingsFile);
23493
23621
  } catch {
23494
23622
  }
@@ -23512,9 +23640,9 @@ function resolveProviderSafe(resolveProviderFn) {
23512
23640
  }
23513
23641
 
23514
23642
  // ../../packages/plugin-sdk/src/config-inventory.ts
23515
- import { readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23643
+ import { readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
23516
23644
  import { homedir as homedir2 } from "os";
23517
- import { basename as basename3, join as join14 } from "path";
23645
+ import { basename as basename3, join as join15 } from "path";
23518
23646
 
23519
23647
  // ../../packages/detections/src/egress/registry.ts
23520
23648
  var EXTRACTOR_VERSION = "1";
@@ -24272,8 +24400,8 @@ var CPU_CORROBORATION_SHARE = 0.2;
24272
24400
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
24273
24401
 
24274
24402
  // ../../packages/plugin-sdk/src/repo.ts
24275
- import { existsSync as existsSync8, readFileSync as readFileSync7, statSync as statSync6 } from "fs";
24276
- import { basename as basename2, dirname as dirname3, isAbsolute, join as join13, sep as sep2 } from "path";
24403
+ import { existsSync as existsSync8, readFileSync as readFileSync8, statSync as statSync6 } from "fs";
24404
+ import { basename as basename2, dirname as dirname4, isAbsolute, join as join14, sep as sep2 } from "path";
24277
24405
 
24278
24406
  // ../../packages/plugin-sdk/src/events.ts
24279
24407
  import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
@@ -24285,8 +24413,8 @@ import { Worker } from "worker_threads";
24285
24413
 
24286
24414
  // ../../packages/plugin-sdk/src/ignore-layers.ts
24287
24415
  var import_ignore = __toESM(require_ignore(), 1);
24288
- import { readFileSync as readFileSync9 } from "fs";
24289
- import { join as join15 } from "path";
24416
+ import { readFileSync as readFileSync10 } from "fs";
24417
+ import { join as join16 } from "path";
24290
24418
 
24291
24419
  // ../../packages/plugin-sdk/src/inventory-resolver.ts
24292
24420
  import { arch, hostname as hostname4, platform, release } from "os";
@@ -24297,24 +24425,24 @@ import {
24297
24425
  fstatSync,
24298
24426
  mkdirSync as mkdirSync2,
24299
24427
  openSync as openSync2,
24300
- readFileSync as readFileSync10,
24428
+ readFileSync as readFileSync11,
24301
24429
  readSync,
24302
24430
  writeFileSync as writeFileSync5
24303
24431
  } from "fs";
24304
- import { join as join16 } from "path";
24432
+ import { join as join17 } from "path";
24305
24433
  var TAIL_BYTES = 256 * 1024;
24306
24434
 
24307
24435
  // ../../packages/plugin-sdk/src/nudge.ts
24308
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync6 } from "fs";
24309
- import { join as join17 } from "path";
24436
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
24437
+ import { join as join18 } from "path";
24310
24438
 
24311
24439
  // ../../packages/plugin-sdk/src/paths.ts
24312
24440
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
24313
- import { basename as basename4, dirname as dirname4, sep as sep3 } from "path";
24441
+ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
24314
24442
 
24315
24443
  // ../../packages/plugin-sdk/src/project-files.ts
24316
24444
  import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
24317
- import { basename as basename5, join as join18 } from "path";
24445
+ import { basename as basename5, join as join19 } from "path";
24318
24446
 
24319
24447
  // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
24320
24448
  var optionalBaseUrl2 = external_exports.preprocess((v) => {
@@ -24350,9 +24478,9 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
24350
24478
 
24351
24479
  // ../../packages/plugin-sdk/src/throttle.ts
24352
24480
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
24353
- import { join as join19 } from "path";
24481
+ import { join as join20 } from "path";
24354
24482
  function throttled(dataDir2, markerName, windowMs) {
24355
- const marker = join19(dataDir2, markerName);
24483
+ const marker = join20(dataDir2, markerName);
24356
24484
  try {
24357
24485
  if (Date.now() - statSync8(marker).mtimeMs < windowMs) return true;
24358
24486
  } catch {
@@ -24367,7 +24495,7 @@ function throttled(dataDir2, markerName, windowMs) {
24367
24495
 
24368
24496
  // src/history/reconcile-trigger.ts
24369
24497
  import { spawn } from "child_process";
24370
- import { dirname as dirname5, join as join21 } from "path";
24498
+ import { dirname as dirname6, join as join22 } from "path";
24371
24499
  import { fileURLToPath as fileURLToPath2 } from "url";
24372
24500
 
24373
24501
  // src/history/tail.ts
@@ -24377,11 +24505,11 @@ import {
24377
24505
  fstatSync as fstatSync2,
24378
24506
  mkdirSync as mkdirSync5,
24379
24507
  openSync as openSync3,
24380
- readFileSync as readFileSync12,
24508
+ readFileSync as readFileSync13,
24381
24509
  readSync as readSync2,
24382
24510
  writeFileSync as writeFileSync8
24383
24511
  } from "fs";
24384
- import { join as join20 } from "path";
24512
+ import { join as join21 } from "path";
24385
24513
  var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
24386
24514
  function safeSessionId(sessionId) {
24387
24515
  if (SAFE_SESSION_ID.test(sessionId) && sessionId !== "." && sessionId !== "..") {
@@ -24397,8 +24525,8 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
24397
24525
  try {
24398
24526
  const marker = `${RECONCILE_MARKER_PREFIX}-${safeSessionId(sessionId)}`;
24399
24527
  if (throttled(dataDir2, marker, RECONCILE_THROTTLE_MS)) return;
24400
- const here = dirname5(fileURLToPath2(import.meta.url));
24401
- const child = spawn(process.execPath, [join21(here, "reconcile.js"), sessionId, transcriptPath], {
24528
+ const here = dirname6(fileURLToPath2(import.meta.url));
24529
+ const child = spawn(process.execPath, [join22(here, "reconcile.js"), sessionId, transcriptPath], {
24402
24530
  detached: true,
24403
24531
  stdio: "ignore"
24404
24532
  });
@@ -24453,37 +24581,42 @@ function parseStopPayload(input2) {
24453
24581
  }
24454
24582
 
24455
24583
  // src/hooks/store-health.ts
24456
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync18, writeFileSync as writeFileSync9 } from "fs";
24457
- import { dirname as dirname6, join as join28 } from "path";
24584
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync19, writeFileSync as writeFileSync9 } from "fs";
24585
+ import { dirname as dirname7, join as join29 } from "path";
24458
24586
 
24459
24587
  // ../../packages/plugin-runtime/src/attached/egress-wire.ts
24460
24588
  import { createHash as createHash6 } from "crypto";
24461
24589
 
24590
+ // ../../packages/remote/src/http.ts
24591
+ import { request as httpRequest } from "http";
24592
+ import { request as httpsRequest } from "https";
24593
+ var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
24594
+
24595
+ // ../../packages/remote/src/client.ts
24596
+ var SLASH = "/".charCodeAt(0);
24597
+
24462
24598
  // ../../packages/plugin-runtime/src/attached/forward-drops.ts
24463
- import { readFileSync as readFileSync13 } from "fs";
24464
- import { join as join22 } from "path";
24599
+ import { readFileSync as readFileSync14 } from "fs";
24600
+ import { join as join23 } from "path";
24465
24601
 
24466
24602
  // ../../packages/plugin-runtime/src/attached/forward-policy.ts
24467
24603
  import { randomUUID as randomUUID15 } from "crypto";
24468
- import { readFileSync as readFileSync14 } from "fs";
24604
+ import { readFileSync as readFileSync15 } from "fs";
24469
24605
  import { readFile, rename, writeFile } from "fs/promises";
24470
- import { join as join23 } from "path";
24606
+ import { join as join24 } from "path";
24471
24607
 
24472
24608
  // ../../packages/plugin-runtime/src/attached/history-state.ts
24473
- import { readFileSync as readFileSync15 } from "fs";
24474
- import { join as join24 } from "path";
24609
+ import { readFileSync as readFileSync16 } from "fs";
24610
+ import { join as join25 } from "path";
24475
24611
 
24476
24612
  // ../../packages/plugin-runtime/src/attached/history-sync.ts
24477
24613
  import { createHash as createHash7 } from "crypto";
24478
24614
  import { hostname as hostname5 } from "os";
24479
24615
 
24480
- // ../../packages/remote/src/http.ts
24481
- import { request as httpRequest } from "http";
24482
- import { request as httpsRequest } from "https";
24483
- var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
24484
-
24485
- // ../../packages/remote/src/client.ts
24486
- var SLASH = "/".charCodeAt(0);
24616
+ // ../../packages/plugin-runtime/src/attached/capture-rebuild.ts
24617
+ var CORRELATION_ID = EventMetadata.shape.correlationId;
24618
+ var TRACE_ID = EventMetadata.shape.traceId;
24619
+ var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
24487
24620
 
24488
24621
  // ../../packages/plugin-runtime/src/attached/history-sync-trigger.ts
24489
24622
  import { spawn as spawn2 } from "child_process";
@@ -24491,12 +24624,12 @@ import { fileURLToPath as fileURLToPath3 } from "url";
24491
24624
  var HISTORY_SYNC_THROTTLE_MS = 5 * 60 * 1e3;
24492
24625
 
24493
24626
  // ../../packages/plugin-runtime/src/attached/plugin-block.ts
24494
- import { readFileSync as readFileSync16 } from "fs";
24627
+ import { readFileSync as readFileSync17 } from "fs";
24495
24628
 
24496
24629
  // ../../packages/plugin-runtime/src/attached/policy-store.ts
24497
24630
  import { randomUUID as randomUUID16 } from "crypto";
24498
24631
  import { readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
24499
- import { join as join25 } from "path";
24632
+ import { join as join26 } from "path";
24500
24633
 
24501
24634
  // ../../packages/plugin-runtime/src/attached/atomic-publish.ts
24502
24635
  import { rename as rename2 } from "fs/promises";
@@ -24511,11 +24644,11 @@ import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
24511
24644
  // ../../packages/plugin-runtime/src/attached/posture-store.ts
24512
24645
  import { randomUUID as randomUUID17 } from "crypto";
24513
24646
  import { readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "fs/promises";
24514
- import { join as join26 } from "path";
24647
+ import { join as join27 } from "path";
24515
24648
 
24516
24649
  // ../../packages/plugin-runtime/src/attached/sync-state.ts
24517
- import { readFileSync as readFileSync17 } from "fs";
24518
- import { join as join27 } from "path";
24650
+ import { readFileSync as readFileSync18 } from "fs";
24651
+ import { join as join28 } from "path";
24519
24652
 
24520
24653
  // ../../packages/plugin-runtime/src/attached/status.ts
24521
24654
  var REFUSAL_LINES = {
@@ -24549,12 +24682,12 @@ var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
24549
24682
  // src/hooks/store-health.ts
24550
24683
  var STORE_REDIRECT_MARKER = "store-redirect-last-session";
24551
24684
  function markerDirs(dataDir2) {
24552
- return [dataDir2, dirname6(dataDir2)];
24685
+ return [dataDir2, dirname7(dataDir2)];
24553
24686
  }
24554
24687
  function alreadyClaimed(dirs, marker, sessionId) {
24555
24688
  return dirs.some((dir) => {
24556
24689
  try {
24557
- return readFileSync18(join28(dir, marker), "utf8") === sessionId;
24690
+ return readFileSync19(join29(dir, marker), "utf8") === sessionId;
24558
24691
  } catch {
24559
24692
  return false;
24560
24693
  }
@@ -24564,7 +24697,7 @@ function recordClaim(dirs, marker, sessionId) {
24564
24697
  for (const dir of dirs) {
24565
24698
  try {
24566
24699
  mkdirSync6(dir, { recursive: true, mode: DATA_DIR_MODE });
24567
- writeFileSync9(join28(dir, marker), sessionId, { mode: DATA_FILE_MODE });
24700
+ writeFileSync9(join29(dir, marker), sessionId, { mode: DATA_FILE_MODE });
24568
24701
  return;
24569
24702
  } catch {
24570
24703
  }
@@ -24589,7 +24722,7 @@ function formatMode(mode) {
24589
24722
  }
24590
24723
  function warnIfStoreRedirected(config2, sessionId, write = (message) => void process.stderr.write(message)) {
24591
24724
  try {
24592
- const paths = symlinkedStorePaths(dirname6(config2.dataDir));
24725
+ const paths = symlinkedStorePaths(dirname7(config2.dataDir));
24593
24726
  if (paths.length === 0) return;
24594
24727
  if (!sessionId) {
24595
24728
  write(storeRedirectedMessage(paths));