@akasecurity/ai-tc-codex 0.9.15 → 0.9.17-beta.1

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.
@@ -881,10 +881,10 @@ function isCorroborated(candidate, candidates, text, normalization) {
881
881
  }
882
882
  return false;
883
883
  }
884
- function buildCandidates(matchText, ruleset2, extension) {
884
+ function buildCandidates(matchText, ruleset2, extension, eventKind) {
885
885
  const candidates = [];
886
886
  for (const rule of ruleset2) {
887
- if (!ruleApplies(rule, extension)) continue;
887
+ if (!ruleApplies(rule, extension, eventKind)) continue;
888
888
  const spans = MATCHERS[rule.matcher.type](matchText, rule);
889
889
  for (const span of spans) {
890
890
  const rawMatch = matchText.slice(span.start, span.end);
@@ -994,22 +994,30 @@ function extensionOf(filePath) {
994
994
  const dot = base.lastIndexOf(".");
995
995
  return dot > 0 ? base.slice(dot).toLowerCase() : void 0;
996
996
  }
997
- function ruleApplies(rule, extension) {
998
- if (!rule.appliesTo || extension === void 0) return true;
999
- return rule.appliesTo.extensions.some((e) => e.toLowerCase() === extension);
997
+ function ruleApplies(rule, extension, eventKind) {
998
+ const scope = rule.appliesTo;
999
+ if (!scope) return true;
1000
+ if (scope.eventKinds && (eventKind === void 0 || !scope.eventKinds.some((k) => k === eventKind))) {
1001
+ return false;
1002
+ }
1003
+ if (!scope.extensions || extension === void 0) return true;
1004
+ return scope.extensions.some((e) => e.toLowerCase() === extension);
1000
1005
  }
1001
1006
  function scan(text, rules, context) {
1002
1007
  const ruleset2 = rules ?? getLoadedRules();
1003
1008
  const extension = context?.filePath ? extensionOf(context.filePath) : void 0;
1004
1009
  const normalization = normalizeFormatChars(text);
1005
- const originalCandidates = buildCandidates(text, ruleset2, extension);
1010
+ const originalCandidates = buildCandidates(text, ruleset2, extension, context?.eventKind);
1006
1011
  if (!normalization) return gate(originalCandidates, text, void 0);
1007
1012
  const pooledOriginal = originalCandidates.map(
1008
1013
  (candidate) => withNormalizedSpan(candidate, normalization)
1009
1014
  );
1010
- const normalizedCandidates = buildCandidates(normalization.normalized, ruleset2, extension).map(
1011
- (candidate) => mapCandidateToOriginal(candidate, normalization, text)
1012
- );
1015
+ const normalizedCandidates = buildCandidates(
1016
+ normalization.normalized,
1017
+ ruleset2,
1018
+ extension,
1019
+ context?.eventKind
1020
+ ).map((candidate) => mapCandidateToOriginal(candidate, normalization, text));
1013
1021
  const findings = gate([...pooledOriginal, ...normalizedCandidates], text, normalization);
1014
1022
  return mergeOverlappingSameRule(findings, text);
1015
1023
  }
@@ -21038,7 +21046,7 @@ anthropic.model("claude-haiku-4-5", {
21038
21046
  name: "Claude Haiku 4.5",
21039
21047
  ctx: 2e5,
21040
21048
  maxOut: 64e3,
21041
- // Reviewed: fast/cheap tier, no flagged reasoning or code specialisation.
21049
+ // Reviewed: fast/cheap general-purpose tier, not a reasoning or code model.
21042
21050
  capability: null,
21043
21051
  price: anthropicPrice(1, 5, 0.1),
21044
21052
  // The vendor documents `claude-haiku-4-5-20251001` as the versioned id and
@@ -21169,6 +21177,11 @@ openai.model("gpt-4o", {
21169
21177
  price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
21170
21178
  on: [...OPENAI_RESELLERS]
21171
21179
  });
21180
+ openai.model("gpt-4o-2024-05-13", {
21181
+ name: "GPT-4o (2024-05-13)",
21182
+ price: tokenPrice(5, 15),
21183
+ on: [...OPENAI_RESELLERS]
21184
+ });
21172
21185
  openai.model("gpt-4o-mini", {
21173
21186
  name: "GPT-4o mini",
21174
21187
  price: tokenPrice(0.15, 0.6, { cacheRead: 0.075 }),
@@ -21188,6 +21201,24 @@ openai.model("o3", {
21188
21201
  price: tokenPrice(2, 8, { cacheRead: 0.5 }),
21189
21202
  on: [...OPENAI_RESELLERS]
21190
21203
  });
21204
+ openai.model("text-embedding-3-small", {
21205
+ name: "text-embedding-3-small",
21206
+ capability: "embedding",
21207
+ price: tokenPrice(0.02, 0),
21208
+ on: [...OPENAI_RESELLERS]
21209
+ });
21210
+ openai.model("text-embedding-3-large", {
21211
+ name: "text-embedding-3-large",
21212
+ capability: "embedding",
21213
+ price: tokenPrice(0.13, 0),
21214
+ on: [...OPENAI_RESELLERS]
21215
+ });
21216
+ openai.model("text-embedding-ada-002", {
21217
+ name: "text-embedding-ada-002",
21218
+ capability: "embedding",
21219
+ price: tokenPrice(0.1, 0),
21220
+ on: [...OPENAI_RESELLERS]
21221
+ });
21191
21222
  openai.model("gpt-oss-120b", {
21192
21223
  name: "GPT-OSS 120B",
21193
21224
  openWeights: true,
@@ -21474,10 +21505,21 @@ var MODEL_ENTRIES = Object.freeze([
21474
21505
  ...alibaba.models(),
21475
21506
  ...amazon.models()
21476
21507
  ]);
21508
+ var LONG_CONTEXT_THRESHOLDS = Object.freeze(
21509
+ [
21510
+ ...new Set(
21511
+ MODEL_ENTRIES.flatMap(
21512
+ (entry) => [...entry.platforms.values()].flatMap(
21513
+ (offering) => offering.price?.longContext ? [offering.price.longContext.thresholdInputTokens] : []
21514
+ )
21515
+ )
21516
+ )
21517
+ ].sort((a, b) => a - b)
21518
+ );
21477
21519
  var MODEL_INDEX = buildModelIndex(MODEL_ENTRIES);
21478
21520
 
21479
21521
  // ../../packages/schema/src/model/governance.ts
21480
- var ModelCapability = external_exports.enum(["reasoning", "code"]);
21522
+ var ModelCapability = external_exports.enum(["reasoning", "code", "embedding"]);
21481
21523
  var DataRetention = external_exports.enum([
21482
21524
  "zero_retention",
21483
21525
  "no_storage",
@@ -21669,11 +21711,33 @@ var ResolutionMethod = external_exports.enum([
21669
21711
  "false-positive",
21670
21712
  "redetected"
21671
21713
  ]).meta({ id: "ResolutionMethod" });
21714
+ var FindingContextBasis = external_exports.enum(["file", "excerpt"]).meta({ id: "FindingContextBasis" });
21715
+ var FindingContext = external_exports.object({
21716
+ basis: FindingContextBasis,
21717
+ // 1-based line number of `lines[0]`.
21718
+ firstLine: external_exports.number().int().positive(),
21719
+ lines: external_exports.array(external_exports.string()).min(1).max(5),
21720
+ match: external_exports.object({
21721
+ // 1-based line number, within [firstLine, firstLine + lines.length).
21722
+ line: external_exports.number().int().positive(),
21723
+ // Offsets into that entry of `lines`, end exclusive.
21724
+ start: external_exports.number().int().nonnegative(),
21725
+ end: external_exports.number().int().nonnegative()
21726
+ }).nullable()
21727
+ }).meta({ id: "FindingContext" });
21728
+ var FindingLocation = external_exports.object({
21729
+ line: external_exports.number().int().positive(),
21730
+ col: external_exports.number().int().positive(),
21731
+ context: FindingContext.nullable()
21732
+ });
21672
21733
  var FindingMatch = external_exports.object({
21673
21734
  // Masked preview of the matched value. Never raw content.
21674
21735
  maskedValue: external_exports.string(),
21675
- // Redacted source-line prefix. Currently empty (pending privacy review).
21676
- contextPrefix: external_exports.string()
21736
+ // Deprecated: always empty. Superseded by `context`.
21737
+ contextPrefix: external_exports.string(),
21738
+ // The masked lines around the match. Absent when the finding predates
21739
+ // context capture or none could be built safely.
21740
+ context: FindingContext.optional()
21677
21741
  }).meta({ id: "FindingMatch" });
21678
21742
  var FindingDetectionRef = external_exports.object({
21679
21743
  id: external_exports.string(),
@@ -21693,6 +21757,11 @@ var FindingInstance = external_exports.object({
21693
21757
  provider: FindingProvider,
21694
21758
  repo: external_exports.string(),
21695
21759
  file: external_exports.string(),
21760
+ // 1-based line and column of the match start in the scanned text (the
21761
+ // column in UTF-16 code units). Absent for findings that predate location
21762
+ // capture or have no source text.
21763
+ line: external_exports.number().int().positive().optional(),
21764
+ col: external_exports.number().int().positive().optional(),
21696
21765
  // Who the capturing event is attributed to. Optional: a single-user store
21697
21766
  // has no one to attribute a finding to and never sets it.
21698
21767
  user: FindingUser.optional(),
@@ -21754,6 +21823,13 @@ var FindingStats = external_exports.object({
21754
21823
  low: external_exports.number().int().nonnegative()
21755
21824
  })
21756
21825
  }).meta({ id: "FindingStats" });
21826
+ var FindingsOverview = external_exports.object({
21827
+ findings: external_exports.number().int().nonnegative(),
21828
+ open: external_exports.number().int().nonnegative(),
21829
+ handled: external_exports.number().int().nonnegative(),
21830
+ resolved: external_exports.number().int().nonnegative(),
21831
+ dismissed: external_exports.number().int().nonnegative()
21832
+ }).meta({ id: "FindingsOverview" });
21757
21833
  var FindingFacetItem = external_exports.object({
21758
21834
  value: external_exports.string(),
21759
21835
  count: external_exports.number().int().nonnegative()
@@ -21871,6 +21947,7 @@ var FindingInstanceDetail = FindingInstance.extend({
21871
21947
  policy: FindingPolicyRef
21872
21948
  }).meta({ id: "FindingInstanceDetail" });
21873
21949
  var MAX_FLAT_FINDINGS_LIMIT = 200;
21950
+ var FindingContextQuery = external_exports.object({ id: external_exports.string().min(1).max(256) });
21874
21951
  var ListFindingInstancesQuery = external_exports.object({
21875
21952
  severity: external_exports.array(Severity).optional(),
21876
21953
  // Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
@@ -22202,7 +22279,23 @@ var CaptureAttributes = external_exports.object({
22202
22279
  // capture denied by another finding's own Block policy carries `block`
22203
22280
  // here too. The full statement is on EventMetadata.redactDegradedTo; it is
22204
22281
  // repeated rather than referenced because a store reader opens this file.
22205
- redact_degraded_to: ActionTaken.optional()
22282
+ redact_degraded_to: ActionTaken.optional(),
22283
+ // The scope key this capture was stamped with: the canonical repository
22284
+ // (`host/owner/repo`) of the path the capture names (a relative path is read
22285
+ // against its working directory), else of its own working directory, or a
22286
+ // chat account's identity. The store's local `scope_key` column reads it, so
22287
+ // a scoped attachment has a per-row key to work from. Absent when no key
22288
+ // could be derived.
22289
+ //
22290
+ // LOCAL ONLY. That is the contract for every path that sends a row. Producers
22291
+ // stamp it in every attachment mode, and the two structural choke points strip
22292
+ // it: the attached gateway's `reKeyForForward` on the live path, and the
22293
+ // history drain's `rebuildAuditEvent`, which drops it through `withoutScopeKey`.
22294
+ // A capture row's bag reaches the wire through `rebuildCapture`, which builds
22295
+ // the metadata from named keys and never names this one; `toCaptureAttributes`,
22296
+ // which builds the bag from a wire event, never emits it. What a scoped
22297
+ // attachment does with the key is not part of this shape's contract.
22298
+ scope_key: external_exports.string().optional()
22206
22299
  }).catchall(external_exports.unknown());
22207
22300
  var CaptureStatusAttributes = external_exports.object({
22208
22301
  source_tool: external_exports.string().optional(),
@@ -22232,6 +22325,12 @@ var ToolCallInspection = external_exports.object({
22232
22325
  actionTaken: ActionTaken,
22233
22326
  confidence: external_exports.number().min(0).max(1)
22234
22327
  });
22328
+ var findingLocationFields = {
22329
+ line: external_exports.number().int().positive().optional(),
22330
+ col: external_exports.number().int().positive().optional(),
22331
+ context: FindingContext.nullable().optional()
22332
+ };
22333
+ var ToolCallInspectionInput = ToolCallInspection.extend(findingLocationFields);
22235
22334
  var ToolCallInput = external_exports.object({
22236
22335
  sessionId: external_exports.string().min(1),
22237
22336
  toolUseId: external_exports.string().min(1),
@@ -22241,7 +22340,7 @@ var ToolCallInput = external_exports.object({
22241
22340
  attributes: ToolCallAttributes,
22242
22341
  // Secrets detected in the tool's (masked) target — written as linked
22243
22342
  // `inspection_findings`. Empty for a clean tool call.
22244
- inspections: external_exports.array(ToolCallInspection).default([])
22343
+ inspections: external_exports.array(ToolCallInspectionInput).default([])
22245
22344
  });
22246
22345
  var InventoryInput = external_exports.object({
22247
22346
  objectType: InventoryObjectType,
@@ -22315,7 +22414,8 @@ var InspectionFindingInput = external_exports.object({
22315
22414
  // same findingKey — mirrors the legacy `findings.first_detected_at`.
22316
22415
  // Optional: when omitted, the writer derives it from the referenced audit
22317
22416
  // event's startedAt on first insert (see SqliteInspectionFindingsRepository).
22318
- firstDetectedAt: external_exports.iso.datetime().optional()
22417
+ firstDetectedAt: external_exports.iso.datetime().optional(),
22418
+ ...findingLocationFields
22319
22419
  });
22320
22420
  var InventoryContext = external_exports.object({
22321
22421
  host: InventoryInput.optional(),
@@ -22357,8 +22457,9 @@ var SessionTokenReport = external_exports.object({
22357
22457
  totalTokens: external_exports.number().int().nonnegative(),
22358
22458
  // Σ of the PRICED rollups only; null when no rollup had a known price.
22359
22459
  estimatedCostUsd: external_exports.number().nullable(),
22360
- // True whenever any rollup has a null cost (unknown provider/model), so the
22361
- // total understates real spend — the UI renders `≥ $X` instead of a falsely
22460
+ // True whenever any call priced to null (an unknown provider/model, or a call
22461
+ // over a long-context threshold whose rate is unpublished), so the total
22462
+ // understates real spend — the UI renders `≥ $X` instead of a falsely
22362
22463
  // precise figure rather than silently dropping the unpriced calls.
22363
22464
  costIsPartial: external_exports.boolean()
22364
22465
  });
@@ -23090,6 +23191,17 @@ var AttachedCredential = external_exports.object({
23090
23191
  keyPrefix: external_exports.string().min(1).max(16).optional(),
23091
23192
  mintedAt: external_exports.iso.datetime().optional()
23092
23193
  });
23194
+ var AttachmentMode = external_exports.enum(["machine", "scoped"]);
23195
+ var ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION = 2;
23196
+ var AttachedCredentialV1 = AttachedCredential;
23197
+ var AttachedCredentialV2 = AttachedCredential.extend({
23198
+ specVersion: external_exports.literal(ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION),
23199
+ mode: external_exports.literal("scoped")
23200
+ });
23201
+ var AttachedCredentialAny = external_exports.discriminatedUnion("specVersion", [
23202
+ AttachedCredentialV1,
23203
+ AttachedCredentialV2
23204
+ ]);
23093
23205
  var MAX_DATE_MS = 253402300799999;
23094
23206
  var MAX_INT4 = 2147483647;
23095
23207
  var StorePosturePack = external_exports.object({
@@ -23193,7 +23305,15 @@ var StorePostureSnapshot = external_exports.object({
23193
23305
  policyCounts: StorePosturePolicyCounts,
23194
23306
  // OPTIONAL, not nullable: a reporter that predates this member keeps
23195
23307
  // getting its 200 without a payload change.
23196
- plugin: StorePosturePlugin.optional()
23308
+ plugin: StorePosturePlugin.optional(),
23309
+ // OPTIONAL, and sent only by a scoped attachment, always as `scoped`. A
23310
+ // machine attachment omits it, so its body is byte for byte the one it
23311
+ // sent before this member existed. Absent therefore means machine-wide OR
23312
+ // a reporter older than this member, never "scoped". Both values parse, so
23313
+ // a sender that one day spells `machine` breaks no receiver; any other
23314
+ // value fails the whole snapshot, which is why the reporter sends a
23315
+ // constant and never the raw mode.
23316
+ attachmentMode: AttachmentMode.optional()
23197
23317
  }).meta({ id: "StorePostureSnapshot" });
23198
23318
  var CAPTURE_VERSION_PREFIX = "capture/";
23199
23319
  var RecordAuditEventRequest = AuditEventInput.extend({
@@ -23371,6 +23491,130 @@ var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
23371
23491
  var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
23372
23492
  var PublisherKind = external_exports.enum(["labs", "user", "org"]);
23373
23493
 
23494
+ // ../../packages/schema/src/zod/builtin-policy-id.ts
23495
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
23496
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
23497
+
23498
+ // ../../packages/schema/src/zod/event.ts
23499
+ var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
23500
+ var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
23501
+ var EventMetadata = external_exports.object({
23502
+ sessionId: external_exports.string().optional(),
23503
+ repo: external_exports.string().optional(),
23504
+ filePath: external_exports.string().optional(),
23505
+ // The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
23506
+ // set by the tool-scanning hooks. The tool NAME only — never the tool's
23507
+ // arguments or output, which can carry the very value a finding masked
23508
+ // (metadata is stored unredacted). Gives findings on non-file captures a
23509
+ // display location ("via Bash") when no filePath exists.
23510
+ toolName: external_exports.string().optional(),
23511
+ // Set (true) by the worktree scanner when the file is excluded by the
23512
+ // repo's .gitignore. Gitignored files ARE still scanned — local scratch and
23513
+ // generated code can leak real secrets — but the provenance is recorded so
23514
+ // policy/dashboards can treat those findings as informational rather than
23515
+ // blocking. Omitted (not false) for tracked files and non-scan events.
23516
+ gitignored: external_exports.boolean().optional(),
23517
+ // Set (true) ONLY when the event's `content` is the COMPLETE file at
23518
+ // capture time (a worktree scan reading from disk). Hook-captured edits
23519
+ // (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
23520
+ // this. The resolver-on-ingest keys its fixed-at-source dropout
23521
+ // diff on this marker: only a whole-file snapshot can prove a previously
23522
+ // open finding is gone; a fragment's absence proves nothing (the secret
23523
+ // may live outside the hunk). Omitted (not false) for fragments and
23524
+ // non-scan events, so pre-marker clients safely default to the
23525
+ // non-authoritative path.
23526
+ wholeFile: external_exports.boolean().optional(),
23527
+ model: external_exports.string().optional(),
23528
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23529
+ // Distributed-tracing correlation. `correlationId` ties a recorded event back
23530
+ // to the request that captured/ingested it (a UUID, generated independently of
23531
+ // the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
23532
+ // originating span when telemetry is enabled. Both optional + backward
23533
+ // compatible — populated by the plugin (see @akasecurity/plugin-sdk).
23534
+ correlationId: external_exports.uuid().optional(),
23535
+ traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
23536
+ // Ids of the detection exceptions that downgraded findings in this capture
23537
+ // to 'allow' — the enforcement audit trail's link back to the grant that
23538
+ // authorized the bypass. Absent on captures where no exception applied.
23539
+ exceptionIds: external_exports.array(external_exports.guid()).optional(),
23540
+ // The assistant message this capture belongs to, and the conversation it sits
23541
+ // in — set by the browser extension's network capture so a stored `response`
23542
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
23543
+ // on every other capture path, which has no such id.
23544
+ //
23545
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
23546
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
23547
+ // places an event is PARSED; the local write path types the event and parses
23548
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
23549
+ messageId: external_exports.string().min(1).optional(),
23550
+ conversationId: external_exports.string().optional(),
23551
+ // How long THIS capture's inspection blocked its caller, in whole
23552
+ // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
23553
+ // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
23554
+ // detection + redaction, the work the host session actually waits on.
23555
+ //
23556
+ // Stamped ONLY on live in-flight captures. A capture that carries its own
23557
+ // `occurredAt` is replaying past work (the transcript backfill, the worktree
23558
+ // scan), and its scan duration is not latency any host session experienced,
23559
+ // so those rows leave this ABSENT rather than reporting a misleading number.
23560
+ // Absent is also what every pre-measurement client writes, and what a
23561
+ // clock failure degrades to — a reader must treat absence as "not measured"
23562
+ // and never as a zero, which would read as "inspection is free".
23563
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
23564
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
23565
+ // workspace's `redactFallback`, applied because the field could not be
23566
+ // masked in place (a shell command, a URL, or any argument on a host whose
23567
+ // hook contract offers no rewrite channel).
23568
+ //
23569
+ // It exists because the action alone cannot say why. A finding recorded as
23570
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
23571
+ // assigned Redact on a field that could not take one — and those are
23572
+ // different facts about the same row: the first is a policy the user chose,
23573
+ // the second is a masking the host could not perform. Absent means no
23574
+ // degrade happened, which is every ordinary capture.
23575
+ //
23576
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
23577
+ // is the CAPTURE while `actionTaken` is per FINDING:
23578
+ //
23579
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
23580
+ // `redact` alongside a finding ASSIGNED the same action stores both
23581
+ // identically and one reason for the pair; attributing it to both
23582
+ // describes the assigned one wrongly, and to neither loses the degrade.
23583
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
23584
+ // became, not the reason the capture ended as it did — a capture denied
23585
+ // by some other finding's own Block policy still carries `block` here,
23586
+ // and clearing the workspace's fallback would not have let it through.
23587
+ // Gate on the value against what a fallback can produce; never read the
23588
+ // field's presence as "this was the fallback's doing".
23589
+ //
23590
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
23591
+ // Closing either means moving the reason onto the finding row, which
23592
+ // already carries its own action.
23593
+ redactDegradedTo: ActionTaken.optional()
23594
+ }).meta({ id: "EventMetadata" });
23595
+ var Event = external_exports.object({
23596
+ id: external_exports.guid(),
23597
+ sourceTool: SourceTool,
23598
+ kind: EventKind,
23599
+ occurredAt: external_exports.iso.datetime(),
23600
+ contentHash: external_exports.string(),
23601
+ content: external_exports.string(),
23602
+ metadata: EventMetadata.optional()
23603
+ }).meta({ id: "Event" });
23604
+ var IngestEvent = Event.meta({ id: "IngestEvent" });
23605
+ var INGEST_BATCH_MAX = 100;
23606
+ var IngestBatch = external_exports.object({
23607
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
23608
+ // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
23609
+ // additionally rejects any event whose contentHash the store has already
23610
+ // recorded — for re-runnable bulk ingest (worktree scan, transcript
23611
+ // backfill), where a re-run mints fresh event ids for identical content and
23612
+ // would otherwise accumulate duplicates. Live hook traffic must NOT set it:
23613
+ // two genuinely separate prompts can be byte-identical and both belong on
23614
+ // the timeline.
23615
+ dedupe: external_exports.literal("content-hash").optional()
23616
+ }).meta({ id: "IngestBatch" });
23617
+
23374
23618
  // ../../packages/schema/src/zod/rule.ts
23375
23619
  var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
23376
23620
  var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
@@ -23439,7 +23683,10 @@ var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher2, Rege
23439
23683
  var MATCHER_TYPES = MatcherType.options;
23440
23684
  var AppliesTo = external_exports.strictObject({
23441
23685
  // Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
23442
- extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
23686
+ extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1).optional(),
23687
+ eventKinds: external_exports.array(EventKind).min(1).optional()
23688
+ }).refine((v) => v.extensions !== void 0 || v.eventKinds !== void 0, {
23689
+ message: "appliesTo needs extensions, eventKinds, or both"
23443
23690
  }).meta({ id: "AppliesTo" });
23444
23691
  var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
23445
23692
  var PostValidatorRef = external_exports.union(
@@ -23462,6 +23709,7 @@ var PostValidatorRef = external_exports.union(
23462
23709
  )}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
23463
23710
  }
23464
23711
  ).meta({ id: "PostValidatorRef" });
23712
+ var RuleEvidence = external_exports.enum(["code", "value"]).meta({ id: "RuleEvidence" });
23465
23713
  var RequiresNearby = external_exports.strictObject({
23466
23714
  // Each array, when present, must be non-empty and contain non-empty strings —
23467
23715
  // an empty/blank criterion would either never fire or (for labels) match
@@ -23484,6 +23732,8 @@ var RuleFixture = external_exports.strictObject({
23484
23732
  // Simulated file context for the scan, so fixtures can assert `appliesTo`
23485
23733
  // gating (e.g. a Python-only pattern must NOT fire in a .ts file).
23486
23734
  filePath: external_exports.string().optional(),
23735
+ // Simulated capture kind, so fixtures can assert `appliesTo.eventKinds`.
23736
+ eventKind: EventKind.optional(),
23487
23737
  expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
23488
23738
  }).meta({ id: "RuleFixture" });
23489
23739
  var Rule = external_exports.strictObject({
@@ -23509,7 +23759,9 @@ var Rule = external_exports.strictObject({
23509
23759
  appliesTo: AppliesTo.optional(),
23510
23760
  postValidators: external_exports.array(PostValidatorRef).optional(),
23511
23761
  requiresNearby: RequiresNearby.optional(),
23512
- examples: external_exports.array(external_exports.string()).optional()
23762
+ examples: external_exports.array(external_exports.string()).optional(),
23763
+ // Whether the matched text is itself sensitive (see RuleEvidence).
23764
+ evidence: RuleEvidence.optional()
23513
23765
  }).meta({ id: "Rule" });
23514
23766
  var Author = external_exports.object({
23515
23767
  name: external_exports.string(),
@@ -23526,7 +23778,11 @@ var PackManifest = external_exports.object({
23526
23778
  description: external_exports.string().optional(),
23527
23779
  author: Author.optional(),
23528
23780
  license: external_exports.string().optional(),
23529
- sourceUrl: external_exports.url().optional()
23781
+ sourceUrl: external_exports.url().optional(),
23782
+ // The built-in policy a FIRST install of this pack assigns
23783
+ // (installed_packs.policy_id). Absent leaves the pack unassigned, so its
23784
+ // rules follow the category policies. An existing install never takes it.
23785
+ defaultPolicy: BuiltinPolicyId.optional()
23530
23786
  }).meta({ id: "PackManifest" });
23531
23787
 
23532
23788
  // ../../packages/schema/src/zod/detection.ts
@@ -23554,10 +23810,12 @@ var DetectionListItem = external_exports.object({
23554
23810
  // Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
23555
23811
  // (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
23556
23812
  // detection is a PACK, and its policy is the archetype applied to all its
23557
- // rules. Absent == unassigned, which resolves to Monitor everywhere
23558
- // (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
23559
- // per-rule policies (see policyIdToAction). Typed z.string() (not
23560
- // the enum) to keep the OpenAPI response tolerant of a future custom id.
23813
+ // rules. Absent == unassigned, which resolves to Monitor by default
23814
+ // (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
23815
+ // (see the dashboard's `unassignedPolicy`). Every enforcement surface
23816
+ // expands it into per-rule policies (see policyIdToAction). Typed
23817
+ // z.string() (not the enum) to keep the OpenAPI response tolerant of a
23818
+ // future custom id.
23561
23819
  policyId: external_exports.string().optional(),
23562
23820
  // Set ONLY when a newer snapshot is available for this pack (OSS: the
23563
23821
  // bundled inventory recorded in available_packs differs from the installed
@@ -23594,7 +23852,13 @@ var DetectionRule = external_exports.object({
23594
23852
  // Representative matching strings the rule author shipped with the rule. The
23595
23853
  // cheapest honest answer to "show me what this rule catches" — every bundled
23596
23854
  // rule has them, and they are already in the stored snapshot.
23597
- examples: external_exports.array(external_exports.string()).optional()
23855
+ examples: external_exports.array(external_exports.string()).optional(),
23856
+ // The rule's DECLARED evidence, as stored. Absent defers to the engine's
23857
+ // classification (ruleEvidence in @akasecurity/detections): a bundled
23858
+ // code-flaw rule reads as 'code' and anything else as 'value', and a rule
23859
+ // in a value category (secret/pii/financial/phi) is always 'value',
23860
+ // whatever it declares.
23861
+ evidence: RuleEvidence.optional()
23598
23862
  }).meta({ id: "DetectionRule" });
23599
23863
  var DetectionUpdate = external_exports.object({
23600
23864
  available: external_exports.boolean(),
@@ -23626,10 +23890,12 @@ var DetectionDetail = external_exports.object({
23626
23890
  // Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
23627
23891
  // (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
23628
23892
  // detection is a PACK, and its policy is the archetype applied to all its
23629
- // rules. Absent == unassigned, which resolves to Monitor everywhere
23630
- // (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
23631
- // per-rule policies (see policyIdToAction). Typed z.string() (not
23632
- // the enum) to keep the OpenAPI response tolerant of a future custom id.
23893
+ // rules. Absent == unassigned, which resolves to Monitor by default
23894
+ // (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
23895
+ // (see the dashboard's `unassignedPolicy`). Every enforcement surface
23896
+ // expands it into per-rule policies (see policyIdToAction). Typed
23897
+ // z.string() (not the enum) to keep the OpenAPI response tolerant of a
23898
+ // future custom id.
23633
23899
  policyId: external_exports.string().optional()
23634
23900
  }).meta({ id: "DetectionDetail" });
23635
23901
  var LibraryItem = external_exports.object({
@@ -23659,126 +23925,6 @@ var ImportDetectionRequest = external_exports.object({
23659
23925
  })
23660
23926
  }).meta({ id: "ImportDetectionRequest" });
23661
23927
 
23662
- // ../../packages/schema/src/zod/event.ts
23663
- var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
23664
- var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
23665
- var EventMetadata = external_exports.object({
23666
- sessionId: external_exports.string().optional(),
23667
- repo: external_exports.string().optional(),
23668
- filePath: external_exports.string().optional(),
23669
- // The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
23670
- // set by the tool-scanning hooks. The tool NAME only — never the tool's
23671
- // arguments or output, which can carry the very value a finding masked
23672
- // (metadata is stored unredacted). Gives findings on non-file captures a
23673
- // display location ("via Bash") when no filePath exists.
23674
- toolName: external_exports.string().optional(),
23675
- // Set (true) by the worktree scanner when the file is excluded by the
23676
- // repo's .gitignore. Gitignored files ARE still scanned — local scratch and
23677
- // generated code can leak real secrets — but the provenance is recorded so
23678
- // policy/dashboards can treat those findings as informational rather than
23679
- // blocking. Omitted (not false) for tracked files and non-scan events.
23680
- gitignored: external_exports.boolean().optional(),
23681
- // Set (true) ONLY when the event's `content` is the COMPLETE file at
23682
- // capture time (a worktree scan reading from disk). Hook-captured edits
23683
- // (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
23684
- // this. The resolver-on-ingest keys its fixed-at-source dropout
23685
- // diff on this marker: only a whole-file snapshot can prove a previously
23686
- // open finding is gone; a fragment's absence proves nothing (the secret
23687
- // may live outside the hunk). Omitted (not false) for fragments and
23688
- // non-scan events, so pre-marker clients safely default to the
23689
- // non-authoritative path.
23690
- wholeFile: external_exports.boolean().optional(),
23691
- model: external_exports.string().optional(),
23692
- turnIndex: external_exports.number().int().nonnegative().optional(),
23693
- // Distributed-tracing correlation. `correlationId` ties a recorded event back
23694
- // to the request that captured/ingested it (a UUID, generated independently of
23695
- // the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
23696
- // originating span when telemetry is enabled. Both optional + backward
23697
- // compatible — populated by the plugin (see @akasecurity/plugin-sdk).
23698
- correlationId: external_exports.uuid().optional(),
23699
- traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
23700
- // Ids of the detection exceptions that downgraded findings in this capture
23701
- // to 'allow' — the enforcement audit trail's link back to the grant that
23702
- // authorized the bypass. Absent on captures where no exception applied.
23703
- exceptionIds: external_exports.array(external_exports.guid()).optional(),
23704
- // The assistant message this capture belongs to, and the conversation it sits
23705
- // in — set by the browser extension's network capture so a stored `response`
23706
- // row can be joined to the `llm_call` leaf describing the same turn. Absent
23707
- // on every other capture path, which has no such id.
23708
- //
23709
- // Non-empty for the reason WebExchange.messageId is: it is the join key, and
23710
- // a blank one matches no `llm_call` leaf. That refusal reaches only the
23711
- // places an event is PARSED; the local write path types the event and parses
23712
- // nothing, which is why `toCaptureAttributes` omits a blank one separately.
23713
- messageId: external_exports.string().min(1).optional(),
23714
- conversationId: external_exports.string().optional(),
23715
- // How long THIS capture's inspection blocked its caller, in whole
23716
- // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
23717
- // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
23718
- // detection + redaction, the work the host session actually waits on.
23719
- //
23720
- // Stamped ONLY on live in-flight captures. A capture that carries its own
23721
- // `occurredAt` is replaying past work (the transcript backfill, the worktree
23722
- // scan), and its scan duration is not latency any host session experienced,
23723
- // so those rows leave this ABSENT rather than reporting a misleading number.
23724
- // Absent is also what every pre-measurement client writes, and what a
23725
- // clock failure degrades to — a reader must treat absence as "not measured"
23726
- // and never as a zero, which would read as "inspection is free".
23727
- inspectionMs: external_exports.number().int().nonnegative().optional(),
23728
- // What a `redact` this capture COULD NOT CARRY OUT became instead — the
23729
- // workspace's `redactFallback`, applied because the field could not be
23730
- // masked in place (a shell command, a URL, or any argument on a host whose
23731
- // hook contract offers no rewrite channel).
23732
- //
23733
- // It exists because the action alone cannot say why. A finding recorded as
23734
- // `warn` reads identically whether its detection was ASSIGNED Warn or was
23735
- // assigned Redact on a field that could not take one — and those are
23736
- // different facts about the same row: the first is a policy the user chose,
23737
- // the second is a masking the host could not perform. Absent means no
23738
- // degrade happened, which is every ordinary capture.
23739
- //
23740
- // TWO LIMITS a reader of a stored row has to know, because the grain here
23741
- // is the CAPTURE while `actionTaken` is per FINDING:
23742
- //
23743
- // - It does not say WHICH finding degraded. A capture carrying a degraded
23744
- // `redact` alongside a finding ASSIGNED the same action stores both
23745
- // identically and one reason for the pair; attributing it to both
23746
- // describes the assigned one wrongly, and to neither loses the degrade.
23747
- // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
23748
- // became, not the reason the capture ended as it did — a capture denied
23749
- // by some other finding's own Block policy still carries `block` here,
23750
- // and clearing the workspace's fallback would not have let it through.
23751
- // Gate on the value against what a fallback can produce; never read the
23752
- // field's presence as "this was the fallback's doing".
23753
- //
23754
- // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
23755
- // Closing either means moving the reason onto the finding row, which
23756
- // already carries its own action.
23757
- redactDegradedTo: ActionTaken.optional()
23758
- }).meta({ id: "EventMetadata" });
23759
- var Event = external_exports.object({
23760
- id: external_exports.guid(),
23761
- sourceTool: SourceTool,
23762
- kind: EventKind,
23763
- occurredAt: external_exports.iso.datetime(),
23764
- contentHash: external_exports.string(),
23765
- content: external_exports.string(),
23766
- metadata: EventMetadata.optional()
23767
- }).meta({ id: "Event" });
23768
- var IngestEvent = Event.meta({ id: "IngestEvent" });
23769
- var INGEST_BATCH_MAX = 100;
23770
- var IngestBatch = external_exports.object({
23771
- events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
23772
- // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
23773
- // additionally rejects any event whose contentHash the store has already
23774
- // recorded — for re-runnable bulk ingest (worktree scan, transcript
23775
- // backfill), where a re-run mints fresh event ids for identical content and
23776
- // would otherwise accumulate duplicates. Live hook traffic must NOT set it:
23777
- // two genuinely separate prompts can be byte-identical and both belong on
23778
- // the timeline.
23779
- dedupe: external_exports.literal("content-hash").optional()
23780
- }).meta({ id: "IngestBatch" });
23781
-
23782
23928
  // ../../packages/schema/src/zod/exception.ts
23783
23929
  var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
23784
23930
  var ExceptionConditions = external_exports.object({
@@ -23939,8 +24085,6 @@ var Policy = external_exports.object({
23939
24085
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
23940
24086
  provenance: PolicyProvenance.optional()
23941
24087
  }).meta({ id: "Policy" });
23942
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
23943
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
23944
24088
  var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
23945
24089
  id: "RedactFallback"
23946
24090
  });
@@ -23980,11 +24124,14 @@ var PolicyBundle = external_exports.object({
23980
24124
  ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
23981
24125
  // Model ids (the raw `model` string a harness reports, e.g.
23982
24126
  // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
23983
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
23984
- // one (UserPromptSubmit). Optional so an older backend — and an older
23985
- // on-disk cache — still parses; consumers read `?? []`, which is the
23986
- // unenforced behaviour that predates this field and the safe direction to
23987
- // default.
24127
+ // a session onto one (PreModelSwitch), refuses a turn that would run on one
24128
+ // (UserPromptSubmit) and refuses a subagent spawn onto one (PreToolUse),
24129
+ // wherever the organization governs the event: everywhere on a
24130
+ // machine-wide attachment, and only in enrolled repositories on a scoped
24131
+ // one (the plugin runtime's `governanceApplies`).
24132
+ // Optional so an older backend — and an older on-disk cache — still
24133
+ // parses; consumers read `?? []`, which is the unenforced behaviour that
24134
+ // predates this field and the safe direction to default.
23988
24135
  //
23989
24136
  // Ids, not display names: the governance decision is keyed on the exact
23990
24137
  // string the harness reports (`model_status_override.versionId` in the
@@ -24296,7 +24443,7 @@ var VaultConsent = external_exports.object({
24296
24443
  });
24297
24444
 
24298
24445
  // ../../packages/schema/src/zod/local.ts
24299
- var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
24446
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 9;
24300
24447
  var RunMode = external_exports.enum(["standalone", "attached"]);
24301
24448
  var ControlPlaneConnection = external_exports.object({
24302
24449
  endpoint: external_exports.string().min(1),
@@ -24315,6 +24462,20 @@ var HistorySyncConsent = external_exports.object({
24315
24462
  payloadVersion: external_exports.number().int().positive(),
24316
24463
  endpoint: external_exports.string()
24317
24464
  });
24465
+ var ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH = 512;
24466
+ var AttachmentScopeEntry = external_exports.object({
24467
+ kind: external_exports.enum(["repo", "account"]),
24468
+ identity: printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH).min(1),
24469
+ label: printable(80).optional(),
24470
+ enrolledAt: external_exports.iso.datetime()
24471
+ });
24472
+ var AttachmentScope = external_exports.object({
24473
+ endpoint: external_exports.string().min(1),
24474
+ tenantName: PluginWhoami.shape.tenantName.optional(),
24475
+ userEmail: PluginWhoami.shape.userEmail.optional(),
24476
+ entries: external_exports.array(AttachmentScopeEntry)
24477
+ });
24478
+ var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
24318
24479
  var WebChatCaptureConsent = external_exports.object({
24319
24480
  acknowledgedAt: external_exports.iso.datetime(),
24320
24481
  version: external_exports.number().int().positive()
@@ -24385,6 +24546,23 @@ var WorkspaceSettings = external_exports.object({
24385
24546
  // both widenings. Absent until granted, and a grant for a different endpoint
24386
24547
  // or an older payload no longer counts.
24387
24548
  historySyncConsent: HistorySyncConsent.optional(),
24549
+ // The identities a SCOPED attachment forwards and the deployment they were
24550
+ // enrolled for (see AttachmentScope). Absent until something is enrolled.
24551
+ //
24552
+ // `z.unknown()`, NOT `AttachmentScope`, and the difference is this field's
24553
+ // whole failure mode. A settings.json that fails this schema reads as the
24554
+ // unonboarded defaults (readUserSettings in @akasecurity/persistence), and the
24555
+ // next save writes those defaults back over it. Typed, one entry with an
24556
+ // unknown `kind`, a control character or a bad timestamp would cost the
24557
+ // attachment, every consent and onboardedAt, permanently. Untyped, the value
24558
+ // is kept exactly as found and validated where it is used: parseAttachmentScope
24559
+ // drops a bad entry by itself, and on a scoped attachment resolveScope reads a
24560
+ // bad envelope as no entries, which keeps every event local.
24561
+ //
24562
+ // No default: absent must stay absent, so defaultWorkspaceSettings() and a
24563
+ // fresh settings.json do not change. No `.meta({ id })`, like every field
24564
+ // here. Not a ManagedSettingKey.
24565
+ attachmentScope: external_exports.unknown().optional(),
24388
24566
  // What the browser extension may record from a web chat, and the grant that
24389
24567
  // authorizes it. Absent until the user answers: recording something that was
24390
24568
  // never recorded before is never an assumed grant on upgrade, so the whole
@@ -24503,6 +24681,27 @@ var ManagedSettings = external_exports.object({
24503
24681
  };
24504
24682
  }).meta({ id: "ManagedSettings" });
24505
24683
 
24684
+ // ../../packages/schema/src/zod/mod-policy-snapshot.ts
24685
+ var MOD_POLICY_SNAPSHOT_VERSION = 1;
24686
+ var MOD_POLICY_SNAPSHOT_MAX_BYTES = 4 * 1024 * 1024;
24687
+ var ModPolicySnapshot = external_exports.object({
24688
+ version: external_exports.literal(MOD_POLICY_SNAPSHOT_VERSION),
24689
+ generatedAt: external_exports.iso.datetime(),
24690
+ // The complete effective ruleset, as the hook's runtime scans with it: the
24691
+ // user's enabled installed packs (user-modified and custom packs included).
24692
+ // Absent means the store holds no authoritative snapshot, and the reader
24693
+ // scans with the packs it ships — the hook's own fallback.
24694
+ rules: external_exports.array(Rule).optional(),
24695
+ // Rule-targeted actions (first enabled policy per rule wins).
24696
+ ruleActions: external_exports.record(external_exports.string(), ActionTaken),
24697
+ // The resolved action per detection category.
24698
+ categoryActions: external_exports.record(external_exports.string(), ActionTaken),
24699
+ // Rules with an active exception grant. Honouring a grant means matching a
24700
+ // keyed fingerprint of the value and consuming a use, which only the hook can
24701
+ // do, so the mod leaves a finding of one of these rules for the hook to decide.
24702
+ exceptionRuleIds: external_exports.array(external_exports.string())
24703
+ }).meta({ id: "ModPolicySnapshot" });
24704
+
24506
24705
  // ../../packages/schema/src/zod/project-files.ts
24507
24706
  var ProjectFileInput = external_exports.object({
24508
24707
  path: external_exports.string().min(1),
@@ -24817,7 +25016,16 @@ var AttachInput = external_exports.object({
24817
25016
  // 200 matches the tenantName bound beside it in control-plane.ts; nothing
24818
25017
  // renders a longer one usefully.
24819
25018
  label: printable(200).optional(),
24820
- accessKey: external_exports.string()
25019
+ accessKey: external_exports.string(),
25020
+ // How much of this machine the attachment is for: everything, or only the
25021
+ // repositories its user enrolls. Optional, so an input without it still
25022
+ // parses; what an absent mode means is for whatever reads it to decide, not
25023
+ // this shape. This member validates the VALUE rather than leaving that to the
25024
+ // call site, a deliberate exception to this module's shape-only rule: a shape
25025
+ // rejection names the field, so a value that is not a mode is refused as a bad
25026
+ // `mode` rather than stripped or passed on. The dashboard's attach action reads
25027
+ // it as the mode to attach in.
25028
+ mode: AttachmentMode.optional()
24821
25029
  });
24822
25030
 
24823
25031
  // ../../packages/schema/src/zod/triage.ts
@@ -25273,7 +25481,15 @@ port.on("message", (job) => {
25273
25481
  post({ kind: "probed", id: job.id, verdict, worstMs, corroboratedMs });
25274
25482
  return;
25275
25483
  }
25276
- const context = job.filePath === void 0 ? void 0 : { filePath: job.filePath };
25484
+ if (job.eventKind !== void 0 && !EventKind.safeParse(job.eventKind).success) {
25485
+ post({
25486
+ kind: "failed",
25487
+ id: job.id,
25488
+ message: `unknown event kind ${JSON.stringify(job.eventKind)}`
25489
+ });
25490
+ return;
25491
+ }
25492
+ const context = job.filePath === void 0 && job.eventKind === void 0 ? void 0 : { filePath: job.filePath, eventKind: job.eventKind };
25277
25493
  if (job.attribute) {
25278
25494
  for (const [index, rule] of unverified.entries()) {
25279
25495
  post({ kind: "progress", index });