@akasecurity/ai-tc-codex 0.9.15 → 0.9.16

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
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  mod
33
33
  ));
34
34
 
35
- // ../../node_modules/.pnpm/ignore@7.0.10/node_modules/ignore/index.js
35
+ // ../../node_modules/.pnpm/ignore@7.0.11/node_modules/ignore/index.js
36
36
  var require_ignore = __commonJS({
37
- "../../node_modules/.pnpm/ignore@7.0.10/node_modules/ignore/index.js"(exports, module) {
37
+ "../../node_modules/.pnpm/ignore@7.0.11/node_modules/ignore/index.js"(exports, module) {
38
38
  "use strict";
39
39
  function makeArray(subject) {
40
40
  return Array.isArray(subject) ? subject : [subject];
@@ -169,6 +169,7 @@ var require_ignore = __commonJS({
169
169
  "g"
170
170
  );
171
171
  var TRAILING_WILDCARD = "\uE000";
172
+ var TRAILING_DOUBLESTAR = "\uE001";
172
173
  var extractBrackets = (pattern) => {
173
174
  const sources = [];
174
175
  const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
@@ -329,7 +330,7 @@ var require_ignore = __commonJS({
329
330
  // Zero, one or several directories
330
331
  // should not use '*', or it will be replaced by the next replacer
331
332
  // Check if it is not the last `'/**'`
332
- (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : "\\/.+",
333
+ (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
333
334
  "*"
334
335
  ],
335
336
  // normal intermediate wildcards
@@ -407,7 +408,7 @@ var require_ignore = __commonJS({
407
408
  // 'js' will match 'a.js' and 'a.js/'
408
409
  (source) => {
409
410
  const last = source[source.length - 1];
410
- if (!last || last === TRAILING_WILDCARD) {
411
+ if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
411
412
  return source;
412
413
  }
413
414
  return last === SLASH3 ? `${source}$` : `${source}(?=$|\\/$)`;
@@ -418,16 +419,12 @@ var require_ignore = __commonJS({
418
419
  var MODE_IGNORE = "regex";
419
420
  var MODE_CHECK_IGNORE = "checkRegex";
420
421
  var UNDERSCORE = "_";
421
- var TRAILING_WILD_CARD_REPLACERS = {
422
- [MODE_IGNORE](_, p1) {
423
- const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
424
- return `${prefix}(?=$|\\/$)`;
425
- },
426
- [MODE_CHECK_IGNORE](_, p1) {
427
- const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
428
- return `${prefix}(?=$|\\/$)`;
429
- }
422
+ var replaceTrailingWildcard = (_, p1) => {
423
+ const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
424
+ return `${prefix}(?=$|\\/$)`;
430
425
  };
426
+ var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
427
+ var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
431
428
  var WILDCARD = "[^\\/]*";
432
429
  var separatorAfter = (run, at) => {
433
430
  let separator = EMPTY;
@@ -543,6 +540,14 @@ var require_ignore = __commonJS({
543
540
  (match, index) => sources[index]
544
541
  ) : replaced;
545
542
  };
543
+ var checkSourceOf = (body, prefix) => {
544
+ if (body[body.length - 1] === SLASH3) {
545
+ prefix = makeRegexPrefix(body.slice(0, -1));
546
+ }
547
+ const head = prefix.slice(0, -1);
548
+ const last = prefix[prefix.length - 1];
549
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
550
+ };
546
551
  var matchesBasename = (body) => {
547
552
  const index = body.indexOf(SLASH3);
548
553
  return index < 0 || index === body.length - 1;
@@ -603,11 +608,9 @@ var require_ignore = __commonJS({
603
608
  return this._make(MODE_CHECK_IGNORE, key);
604
609
  }
605
610
  _make(mode, key) {
606
- const str = pinWildcards(this.regexPrefix.replace(
607
- REGEX_REPLACE_TRAILING_WILDCARD,
608
- // It does not need to bind pattern
609
- TRAILING_WILD_CARD_REPLACERS[mode]
610
- ));
611
+ const str = pinWildcards(
612
+ mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix)
613
+ );
611
614
  const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
612
615
  return define(this, key, regex);
613
616
  }
@@ -666,8 +669,39 @@ var require_ignore = __commonJS({
666
669
  makeArray(
667
670
  isString(pattern) ? splitPattern(pattern) : pattern
668
671
  ).forEach(this._add, this);
672
+ if (this._added) {
673
+ this._literalRules = UNDEFINED;
674
+ }
669
675
  return this._added;
670
676
  }
677
+ // Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
678
+ // ending in a wildcard can match it (see `checkSourceOf`), so the rest
679
+ // are left out once, rather than tested or compiled for every path.
680
+ testLiteral(path) {
681
+ const rules = this._literalRules || (this._literalRules = this._rules.filter(
682
+ ({ body }) => body[body.length - (body[body.length - 1] === SLASH3 ? 2 : 1)] === "*"
683
+ ));
684
+ let ignored = false;
685
+ let unignored = false;
686
+ let matchedRule;
687
+ for (let index = rules.length - 1; index >= 0; index--) {
688
+ const rule = rules[index];
689
+ if (rule.checkRegex.test(path)) {
690
+ ignored = !rule.negative;
691
+ unignored = rule.negative;
692
+ matchedRule = rule.negative ? UNDEFINED : rule;
693
+ break;
694
+ }
695
+ }
696
+ const ret = {
697
+ ignored,
698
+ unignored
699
+ };
700
+ if (matchedRule) {
701
+ ret.rule = matchedRule;
702
+ }
703
+ return ret;
704
+ }
671
705
  // Test one single path without recursively checking parent directories
672
706
  //
673
707
  // - checkUnignored `boolean` whether should check if the path is unignored,
@@ -788,14 +822,12 @@ var require_ignore = __commonJS({
788
822
  if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
789
823
  return this.test(path);
790
824
  }
791
- const parentPath = parentOf(path);
792
- if (parentPath) {
793
- const parent = this._t(parentPath, this._testCache, true);
794
- if (parent.ignored) {
795
- return parent;
796
- }
825
+ const dir = this._t(path, this._testCache, true);
826
+ if (dir.ignored) {
827
+ return dir;
797
828
  }
798
- return this._rules.test(path, false, MODE_CHECK_IGNORE);
829
+ const literal2 = this._rules.testLiteral(path);
830
+ return literal2.ignored || literal2.unignored ? literal2 : dir;
799
831
  }
800
832
  _t(path, cache, checkUnignored) {
801
833
  if (path in cache) {
@@ -21515,11 +21547,33 @@ var ResolutionMethod = external_exports.enum([
21515
21547
  "false-positive",
21516
21548
  "redetected"
21517
21549
  ]).meta({ id: "ResolutionMethod" });
21550
+ var FindingContextBasis = external_exports.enum(["file", "excerpt"]).meta({ id: "FindingContextBasis" });
21551
+ var FindingContext = external_exports.object({
21552
+ basis: FindingContextBasis,
21553
+ // 1-based line number of `lines[0]`.
21554
+ firstLine: external_exports.number().int().positive(),
21555
+ lines: external_exports.array(external_exports.string()).min(1).max(5),
21556
+ match: external_exports.object({
21557
+ // 1-based line number, within [firstLine, firstLine + lines.length).
21558
+ line: external_exports.number().int().positive(),
21559
+ // Offsets into that entry of `lines`, end exclusive.
21560
+ start: external_exports.number().int().nonnegative(),
21561
+ end: external_exports.number().int().nonnegative()
21562
+ }).nullable()
21563
+ }).meta({ id: "FindingContext" });
21564
+ var FindingLocation = external_exports.object({
21565
+ line: external_exports.number().int().positive(),
21566
+ col: external_exports.number().int().positive(),
21567
+ context: FindingContext.nullable()
21568
+ });
21518
21569
  var FindingMatch = external_exports.object({
21519
21570
  // Masked preview of the matched value. Never raw content.
21520
21571
  maskedValue: external_exports.string(),
21521
- // Redacted source-line prefix. Currently empty (pending privacy review).
21522
- contextPrefix: external_exports.string()
21572
+ // Deprecated: always empty. Superseded by `context`.
21573
+ contextPrefix: external_exports.string(),
21574
+ // The masked lines around the match. Absent when the finding predates
21575
+ // context capture or none could be built safely.
21576
+ context: FindingContext.optional()
21523
21577
  }).meta({ id: "FindingMatch" });
21524
21578
  var FindingDetectionRef = external_exports.object({
21525
21579
  id: external_exports.string(),
@@ -21539,6 +21593,11 @@ var FindingInstance = external_exports.object({
21539
21593
  provider: FindingProvider,
21540
21594
  repo: external_exports.string(),
21541
21595
  file: external_exports.string(),
21596
+ // 1-based line and column of the match start in the scanned text (the
21597
+ // column in UTF-16 code units). Absent for findings that predate location
21598
+ // capture or have no source text.
21599
+ line: external_exports.number().int().positive().optional(),
21600
+ col: external_exports.number().int().positive().optional(),
21542
21601
  // Who the capturing event is attributed to. Optional: a single-user store
21543
21602
  // has no one to attribute a finding to and never sets it.
21544
21603
  user: FindingUser.optional(),
@@ -21600,6 +21659,13 @@ var FindingStats = external_exports.object({
21600
21659
  low: external_exports.number().int().nonnegative()
21601
21660
  })
21602
21661
  }).meta({ id: "FindingStats" });
21662
+ var FindingsOverview = external_exports.object({
21663
+ findings: external_exports.number().int().nonnegative(),
21664
+ open: external_exports.number().int().nonnegative(),
21665
+ handled: external_exports.number().int().nonnegative(),
21666
+ resolved: external_exports.number().int().nonnegative(),
21667
+ dismissed: external_exports.number().int().nonnegative()
21668
+ }).meta({ id: "FindingsOverview" });
21603
21669
  var FindingFacetItem = external_exports.object({
21604
21670
  value: external_exports.string(),
21605
21671
  count: external_exports.number().int().nonnegative()
@@ -21717,6 +21783,7 @@ var FindingInstanceDetail = FindingInstance.extend({
21717
21783
  policy: FindingPolicyRef
21718
21784
  }).meta({ id: "FindingInstanceDetail" });
21719
21785
  var MAX_FLAT_FINDINGS_LIMIT = 200;
21786
+ var FindingContextQuery = external_exports.object({ id: external_exports.string().min(1).max(256) });
21720
21787
  var ListFindingInstancesQuery = external_exports.object({
21721
21788
  severity: external_exports.array(Severity).optional(),
21722
21789
  // Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
@@ -22048,7 +22115,23 @@ var CaptureAttributes = external_exports.object({
22048
22115
  // capture denied by another finding's own Block policy carries `block`
22049
22116
  // here too. The full statement is on EventMetadata.redactDegradedTo; it is
22050
22117
  // repeated rather than referenced because a store reader opens this file.
22051
- redact_degraded_to: ActionTaken.optional()
22118
+ redact_degraded_to: ActionTaken.optional(),
22119
+ // The scope key this capture was stamped with: the canonical repository
22120
+ // (`host/owner/repo`) of the path the capture names (a relative path is read
22121
+ // against its working directory), else of its own working directory, or a
22122
+ // chat account's identity. The store's local `scope_key` column reads it, so
22123
+ // a scoped attachment has a per-row key to work from. Absent when no key
22124
+ // could be derived.
22125
+ //
22126
+ // LOCAL ONLY. That is the contract for every path that sends a row. Producers
22127
+ // stamp it in every attachment mode, and the two structural choke points strip
22128
+ // it: the attached gateway's `reKeyForForward` on the live path, and the
22129
+ // history drain's `rebuildAuditEvent`, which drops it through `withoutScopeKey`.
22130
+ // A capture row's bag reaches the wire through `rebuildCapture`, which builds
22131
+ // the metadata from named keys and never names this one; `toCaptureAttributes`,
22132
+ // which builds the bag from a wire event, never emits it. What a scoped
22133
+ // attachment does with the key is not part of this shape's contract.
22134
+ scope_key: external_exports.string().optional()
22052
22135
  }).catchall(external_exports.unknown());
22053
22136
  var CaptureStatusAttributes = external_exports.object({
22054
22137
  source_tool: external_exports.string().optional(),
@@ -22078,6 +22161,12 @@ var ToolCallInspection = external_exports.object({
22078
22161
  actionTaken: ActionTaken,
22079
22162
  confidence: external_exports.number().min(0).max(1)
22080
22163
  });
22164
+ var findingLocationFields = {
22165
+ line: external_exports.number().int().positive().optional(),
22166
+ col: external_exports.number().int().positive().optional(),
22167
+ context: FindingContext.nullable().optional()
22168
+ };
22169
+ var ToolCallInspectionInput = ToolCallInspection.extend(findingLocationFields);
22081
22170
  var ToolCallInput = external_exports.object({
22082
22171
  sessionId: external_exports.string().min(1),
22083
22172
  toolUseId: external_exports.string().min(1),
@@ -22087,7 +22176,7 @@ var ToolCallInput = external_exports.object({
22087
22176
  attributes: ToolCallAttributes,
22088
22177
  // Secrets detected in the tool's (masked) target — written as linked
22089
22178
  // `inspection_findings`. Empty for a clean tool call.
22090
- inspections: external_exports.array(ToolCallInspection).default([])
22179
+ inspections: external_exports.array(ToolCallInspectionInput).default([])
22091
22180
  });
22092
22181
  var InventoryInput = external_exports.object({
22093
22182
  objectType: InventoryObjectType,
@@ -22161,7 +22250,8 @@ var InspectionFindingInput = external_exports.object({
22161
22250
  // same findingKey — mirrors the legacy `findings.first_detected_at`.
22162
22251
  // Optional: when omitted, the writer derives it from the referenced audit
22163
22252
  // event's startedAt on first insert (see SqliteInspectionFindingsRepository).
22164
- firstDetectedAt: external_exports.iso.datetime().optional()
22253
+ firstDetectedAt: external_exports.iso.datetime().optional(),
22254
+ ...findingLocationFields
22165
22255
  });
22166
22256
  var InventoryContext = external_exports.object({
22167
22257
  host: InventoryInput.optional(),
@@ -22936,6 +23026,17 @@ var AttachedCredential = external_exports.object({
22936
23026
  keyPrefix: external_exports.string().min(1).max(16).optional(),
22937
23027
  mintedAt: external_exports.iso.datetime().optional()
22938
23028
  });
23029
+ var AttachmentMode = external_exports.enum(["machine", "scoped"]);
23030
+ var ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION = 2;
23031
+ var AttachedCredentialV1 = AttachedCredential;
23032
+ var AttachedCredentialV2 = AttachedCredential.extend({
23033
+ specVersion: external_exports.literal(ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION),
23034
+ mode: external_exports.literal("scoped")
23035
+ });
23036
+ var AttachedCredentialAny = external_exports.discriminatedUnion("specVersion", [
23037
+ AttachedCredentialV1,
23038
+ AttachedCredentialV2
23039
+ ]);
22939
23040
  var MAX_DATE_MS = 253402300799999;
22940
23041
  var MAX_INT4 = 2147483647;
22941
23042
  var StorePosturePack = external_exports.object({
@@ -23217,6 +23318,130 @@ var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
23217
23318
  var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
23218
23319
  var PublisherKind = external_exports.enum(["labs", "user", "org"]);
23219
23320
 
23321
+ // ../../packages/schema/src/zod/builtin-policy-id.ts
23322
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
23323
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
23324
+
23325
+ // ../../packages/schema/src/zod/event.ts
23326
+ var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
23327
+ var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
23328
+ var EventMetadata = external_exports.object({
23329
+ sessionId: external_exports.string().optional(),
23330
+ repo: external_exports.string().optional(),
23331
+ filePath: external_exports.string().optional(),
23332
+ // The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
23333
+ // set by the tool-scanning hooks. The tool NAME only — never the tool's
23334
+ // arguments or output, which can carry the very value a finding masked
23335
+ // (metadata is stored unredacted). Gives findings on non-file captures a
23336
+ // display location ("via Bash") when no filePath exists.
23337
+ toolName: external_exports.string().optional(),
23338
+ // Set (true) by the worktree scanner when the file is excluded by the
23339
+ // repo's .gitignore. Gitignored files ARE still scanned — local scratch and
23340
+ // generated code can leak real secrets — but the provenance is recorded so
23341
+ // policy/dashboards can treat those findings as informational rather than
23342
+ // blocking. Omitted (not false) for tracked files and non-scan events.
23343
+ gitignored: external_exports.boolean().optional(),
23344
+ // Set (true) ONLY when the event's `content` is the COMPLETE file at
23345
+ // capture time (a worktree scan reading from disk). Hook-captured edits
23346
+ // (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
23347
+ // this. The resolver-on-ingest keys its fixed-at-source dropout
23348
+ // diff on this marker: only a whole-file snapshot can prove a previously
23349
+ // open finding is gone; a fragment's absence proves nothing (the secret
23350
+ // may live outside the hunk). Omitted (not false) for fragments and
23351
+ // non-scan events, so pre-marker clients safely default to the
23352
+ // non-authoritative path.
23353
+ wholeFile: external_exports.boolean().optional(),
23354
+ model: external_exports.string().optional(),
23355
+ turnIndex: external_exports.number().int().nonnegative().optional(),
23356
+ // Distributed-tracing correlation. `correlationId` ties a recorded event back
23357
+ // to the request that captured/ingested it (a UUID, generated independently of
23358
+ // the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
23359
+ // originating span when telemetry is enabled. Both optional + backward
23360
+ // compatible — populated by the plugin (see @akasecurity/plugin-sdk).
23361
+ correlationId: external_exports.uuid().optional(),
23362
+ traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
23363
+ // Ids of the detection exceptions that downgraded findings in this capture
23364
+ // to 'allow' — the enforcement audit trail's link back to the grant that
23365
+ // authorized the bypass. Absent on captures where no exception applied.
23366
+ exceptionIds: external_exports.array(external_exports.guid()).optional(),
23367
+ // The assistant message this capture belongs to, and the conversation it sits
23368
+ // in — set by the browser extension's network capture so a stored `response`
23369
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
23370
+ // on every other capture path, which has no such id.
23371
+ //
23372
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
23373
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
23374
+ // places an event is PARSED; the local write path types the event and parses
23375
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
23376
+ messageId: external_exports.string().min(1).optional(),
23377
+ conversationId: external_exports.string().optional(),
23378
+ // How long THIS capture's inspection blocked its caller, in whole
23379
+ // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
23380
+ // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
23381
+ // detection + redaction, the work the host session actually waits on.
23382
+ //
23383
+ // Stamped ONLY on live in-flight captures. A capture that carries its own
23384
+ // `occurredAt` is replaying past work (the transcript backfill, the worktree
23385
+ // scan), and its scan duration is not latency any host session experienced,
23386
+ // so those rows leave this ABSENT rather than reporting a misleading number.
23387
+ // Absent is also what every pre-measurement client writes, and what a
23388
+ // clock failure degrades to — a reader must treat absence as "not measured"
23389
+ // and never as a zero, which would read as "inspection is free".
23390
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
23391
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
23392
+ // workspace's `redactFallback`, applied because the field could not be
23393
+ // masked in place (a shell command, a URL, or any argument on a host whose
23394
+ // hook contract offers no rewrite channel).
23395
+ //
23396
+ // It exists because the action alone cannot say why. A finding recorded as
23397
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
23398
+ // assigned Redact on a field that could not take one — and those are
23399
+ // different facts about the same row: the first is a policy the user chose,
23400
+ // the second is a masking the host could not perform. Absent means no
23401
+ // degrade happened, which is every ordinary capture.
23402
+ //
23403
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
23404
+ // is the CAPTURE while `actionTaken` is per FINDING:
23405
+ //
23406
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
23407
+ // `redact` alongside a finding ASSIGNED the same action stores both
23408
+ // identically and one reason for the pair; attributing it to both
23409
+ // describes the assigned one wrongly, and to neither loses the degrade.
23410
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
23411
+ // became, not the reason the capture ended as it did — a capture denied
23412
+ // by some other finding's own Block policy still carries `block` here,
23413
+ // and clearing the workspace's fallback would not have let it through.
23414
+ // Gate on the value against what a fallback can produce; never read the
23415
+ // field's presence as "this was the fallback's doing".
23416
+ //
23417
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
23418
+ // Closing either means moving the reason onto the finding row, which
23419
+ // already carries its own action.
23420
+ redactDegradedTo: ActionTaken.optional()
23421
+ }).meta({ id: "EventMetadata" });
23422
+ var Event = external_exports.object({
23423
+ id: external_exports.guid(),
23424
+ sourceTool: SourceTool,
23425
+ kind: EventKind,
23426
+ occurredAt: external_exports.iso.datetime(),
23427
+ contentHash: external_exports.string(),
23428
+ content: external_exports.string(),
23429
+ metadata: EventMetadata.optional()
23430
+ }).meta({ id: "Event" });
23431
+ var IngestEvent = Event.meta({ id: "IngestEvent" });
23432
+ var INGEST_BATCH_MAX = 100;
23433
+ var IngestBatch = external_exports.object({
23434
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
23435
+ // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
23436
+ // additionally rejects any event whose contentHash the store has already
23437
+ // recorded — for re-runnable bulk ingest (worktree scan, transcript
23438
+ // backfill), where a re-run mints fresh event ids for identical content and
23439
+ // would otherwise accumulate duplicates. Live hook traffic must NOT set it:
23440
+ // two genuinely separate prompts can be byte-identical and both belong on
23441
+ // the timeline.
23442
+ dedupe: external_exports.literal("content-hash").optional()
23443
+ }).meta({ id: "IngestBatch" });
23444
+
23220
23445
  // ../../packages/schema/src/zod/rule.ts
23221
23446
  var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
23222
23447
  var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
@@ -23285,7 +23510,10 @@ var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, Regex
23285
23510
  var MATCHER_TYPES = MatcherType.options;
23286
23511
  var AppliesTo = external_exports.strictObject({
23287
23512
  // Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
23288
- extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
23513
+ extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1).optional(),
23514
+ eventKinds: external_exports.array(EventKind).min(1).optional()
23515
+ }).refine((v) => v.extensions !== void 0 || v.eventKinds !== void 0, {
23516
+ message: "appliesTo needs extensions, eventKinds, or both"
23289
23517
  }).meta({ id: "AppliesTo" });
23290
23518
  var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
23291
23519
  var PostValidatorRef = external_exports.union(
@@ -23308,6 +23536,7 @@ var PostValidatorRef = external_exports.union(
23308
23536
  )}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
23309
23537
  }
23310
23538
  ).meta({ id: "PostValidatorRef" });
23539
+ var RuleEvidence = external_exports.enum(["code", "value"]).meta({ id: "RuleEvidence" });
23311
23540
  var RequiresNearby = external_exports.strictObject({
23312
23541
  // Each array, when present, must be non-empty and contain non-empty strings —
23313
23542
  // an empty/blank criterion would either never fire or (for labels) match
@@ -23330,6 +23559,8 @@ var RuleFixture = external_exports.strictObject({
23330
23559
  // Simulated file context for the scan, so fixtures can assert `appliesTo`
23331
23560
  // gating (e.g. a Python-only pattern must NOT fire in a .ts file).
23332
23561
  filePath: external_exports.string().optional(),
23562
+ // Simulated capture kind, so fixtures can assert `appliesTo.eventKinds`.
23563
+ eventKind: EventKind.optional(),
23333
23564
  expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
23334
23565
  }).meta({ id: "RuleFixture" });
23335
23566
  var Rule = external_exports.strictObject({
@@ -23355,7 +23586,9 @@ var Rule = external_exports.strictObject({
23355
23586
  appliesTo: AppliesTo.optional(),
23356
23587
  postValidators: external_exports.array(PostValidatorRef).optional(),
23357
23588
  requiresNearby: RequiresNearby.optional(),
23358
- examples: external_exports.array(external_exports.string()).optional()
23589
+ examples: external_exports.array(external_exports.string()).optional(),
23590
+ // Whether the matched text is itself sensitive. Absent means 'value'.
23591
+ evidence: RuleEvidence.optional()
23359
23592
  }).meta({ id: "Rule" });
23360
23593
  var Author = external_exports.object({
23361
23594
  name: external_exports.string(),
@@ -23372,7 +23605,11 @@ var PackManifest = external_exports.object({
23372
23605
  description: external_exports.string().optional(),
23373
23606
  author: Author.optional(),
23374
23607
  license: external_exports.string().optional(),
23375
- sourceUrl: external_exports.url().optional()
23608
+ sourceUrl: external_exports.url().optional(),
23609
+ // The built-in policy a FIRST install of this pack assigns
23610
+ // (installed_packs.policy_id). Absent leaves the pack unassigned, so its
23611
+ // rules follow the category policies. An existing install never takes it.
23612
+ defaultPolicy: BuiltinPolicyId.optional()
23376
23613
  }).meta({ id: "PackManifest" });
23377
23614
 
23378
23615
  // ../../packages/schema/src/zod/detection.ts
@@ -23400,10 +23637,12 @@ var DetectionListItem = external_exports.object({
23400
23637
  // Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
23401
23638
  // (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
23402
23639
  // detection is a PACK, and its policy is the archetype applied to all its
23403
- // rules. Absent == unassigned, which resolves to Monitor everywhere
23404
- // (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
23405
- // per-rule policies (see policyIdToAction). Typed z.string() (not
23406
- // the enum) to keep the OpenAPI response tolerant of a future custom id.
23640
+ // rules. Absent == unassigned, which resolves to Monitor by default
23641
+ // (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
23642
+ // (see the dashboard's `unassignedPolicy`). Every enforcement surface
23643
+ // expands it into per-rule policies (see policyIdToAction). Typed
23644
+ // z.string() (not the enum) to keep the OpenAPI response tolerant of a
23645
+ // future custom id.
23407
23646
  policyId: external_exports.string().optional(),
23408
23647
  // Set ONLY when a newer snapshot is available for this pack (OSS: the
23409
23648
  // bundled inventory recorded in available_packs differs from the installed
@@ -23472,10 +23711,12 @@ var DetectionDetail = external_exports.object({
23472
23711
  // Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
23473
23712
  // (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
23474
23713
  // detection is a PACK, and its policy is the archetype applied to all its
23475
- // rules. Absent == unassigned, which resolves to Monitor everywhere
23476
- // (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
23477
- // per-rule policies (see policyIdToAction). Typed z.string() (not
23478
- // the enum) to keep the OpenAPI response tolerant of a future custom id.
23714
+ // rules. Absent == unassigned, which resolves to Monitor by default
23715
+ // (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
23716
+ // (see the dashboard's `unassignedPolicy`). Every enforcement surface
23717
+ // expands it into per-rule policies (see policyIdToAction). Typed
23718
+ // z.string() (not the enum) to keep the OpenAPI response tolerant of a
23719
+ // future custom id.
23479
23720
  policyId: external_exports.string().optional()
23480
23721
  }).meta({ id: "DetectionDetail" });
23481
23722
  var LibraryItem = external_exports.object({
@@ -23505,126 +23746,6 @@ var ImportDetectionRequest = external_exports.object({
23505
23746
  })
23506
23747
  }).meta({ id: "ImportDetectionRequest" });
23507
23748
 
23508
- // ../../packages/schema/src/zod/event.ts
23509
- var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
23510
- var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
23511
- var EventMetadata = external_exports.object({
23512
- sessionId: external_exports.string().optional(),
23513
- repo: external_exports.string().optional(),
23514
- filePath: external_exports.string().optional(),
23515
- // The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
23516
- // set by the tool-scanning hooks. The tool NAME only — never the tool's
23517
- // arguments or output, which can carry the very value a finding masked
23518
- // (metadata is stored unredacted). Gives findings on non-file captures a
23519
- // display location ("via Bash") when no filePath exists.
23520
- toolName: external_exports.string().optional(),
23521
- // Set (true) by the worktree scanner when the file is excluded by the
23522
- // repo's .gitignore. Gitignored files ARE still scanned — local scratch and
23523
- // generated code can leak real secrets — but the provenance is recorded so
23524
- // policy/dashboards can treat those findings as informational rather than
23525
- // blocking. Omitted (not false) for tracked files and non-scan events.
23526
- gitignored: external_exports.boolean().optional(),
23527
- // Set (true) ONLY when the event's `content` is the COMPLETE file at
23528
- // capture time (a worktree scan reading from disk). Hook-captured edits
23529
- // (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
23530
- // this. The resolver-on-ingest keys its fixed-at-source dropout
23531
- // diff on this marker: only a whole-file snapshot can prove a previously
23532
- // open finding is gone; a fragment's absence proves nothing (the secret
23533
- // may live outside the hunk). Omitted (not false) for fragments and
23534
- // non-scan events, so pre-marker clients safely default to the
23535
- // non-authoritative path.
23536
- wholeFile: external_exports.boolean().optional(),
23537
- model: external_exports.string().optional(),
23538
- turnIndex: external_exports.number().int().nonnegative().optional(),
23539
- // Distributed-tracing correlation. `correlationId` ties a recorded event back
23540
- // to the request that captured/ingested it (a UUID, generated independently of
23541
- // the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
23542
- // originating span when telemetry is enabled. Both optional + backward
23543
- // compatible — populated by the plugin (see @akasecurity/plugin-sdk).
23544
- correlationId: external_exports.uuid().optional(),
23545
- traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
23546
- // Ids of the detection exceptions that downgraded findings in this capture
23547
- // to 'allow' — the enforcement audit trail's link back to the grant that
23548
- // authorized the bypass. Absent on captures where no exception applied.
23549
- exceptionIds: external_exports.array(external_exports.guid()).optional(),
23550
- // The assistant message this capture belongs to, and the conversation it sits
23551
- // in — set by the browser extension's network capture so a stored `response`
23552
- // row can be joined to the `llm_call` leaf describing the same turn. Absent
23553
- // on every other capture path, which has no such id.
23554
- //
23555
- // Non-empty for the reason WebExchange.messageId is: it is the join key, and
23556
- // a blank one matches no `llm_call` leaf. That refusal reaches only the
23557
- // places an event is PARSED; the local write path types the event and parses
23558
- // nothing, which is why `toCaptureAttributes` omits a blank one separately.
23559
- messageId: external_exports.string().min(1).optional(),
23560
- conversationId: external_exports.string().optional(),
23561
- // How long THIS capture's inspection blocked its caller, in whole
23562
- // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
23563
- // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
23564
- // detection + redaction, the work the host session actually waits on.
23565
- //
23566
- // Stamped ONLY on live in-flight captures. A capture that carries its own
23567
- // `occurredAt` is replaying past work (the transcript backfill, the worktree
23568
- // scan), and its scan duration is not latency any host session experienced,
23569
- // so those rows leave this ABSENT rather than reporting a misleading number.
23570
- // Absent is also what every pre-measurement client writes, and what a
23571
- // clock failure degrades to — a reader must treat absence as "not measured"
23572
- // and never as a zero, which would read as "inspection is free".
23573
- inspectionMs: external_exports.number().int().nonnegative().optional(),
23574
- // What a `redact` this capture COULD NOT CARRY OUT became instead — the
23575
- // workspace's `redactFallback`, applied because the field could not be
23576
- // masked in place (a shell command, a URL, or any argument on a host whose
23577
- // hook contract offers no rewrite channel).
23578
- //
23579
- // It exists because the action alone cannot say why. A finding recorded as
23580
- // `warn` reads identically whether its detection was ASSIGNED Warn or was
23581
- // assigned Redact on a field that could not take one — and those are
23582
- // different facts about the same row: the first is a policy the user chose,
23583
- // the second is a masking the host could not perform. Absent means no
23584
- // degrade happened, which is every ordinary capture.
23585
- //
23586
- // TWO LIMITS a reader of a stored row has to know, because the grain here
23587
- // is the CAPTURE while `actionTaken` is per FINDING:
23588
- //
23589
- // - It does not say WHICH finding degraded. A capture carrying a degraded
23590
- // `redact` alongside a finding ASSIGNED the same action stores both
23591
- // identically and one reason for the pair; attributing it to both
23592
- // describes the assigned one wrongly, and to neither loses the degrade.
23593
- // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
23594
- // became, not the reason the capture ended as it did — a capture denied
23595
- // by some other finding's own Block policy still carries `block` here,
23596
- // and clearing the workspace's fallback would not have let it through.
23597
- // Gate on the value against what a fallback can produce; never read the
23598
- // field's presence as "this was the fallback's doing".
23599
- //
23600
- // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
23601
- // Closing either means moving the reason onto the finding row, which
23602
- // already carries its own action.
23603
- redactDegradedTo: ActionTaken.optional()
23604
- }).meta({ id: "EventMetadata" });
23605
- var Event = external_exports.object({
23606
- id: external_exports.guid(),
23607
- sourceTool: SourceTool,
23608
- kind: EventKind,
23609
- occurredAt: external_exports.iso.datetime(),
23610
- contentHash: external_exports.string(),
23611
- content: external_exports.string(),
23612
- metadata: EventMetadata.optional()
23613
- }).meta({ id: "Event" });
23614
- var IngestEvent = Event.meta({ id: "IngestEvent" });
23615
- var INGEST_BATCH_MAX = 100;
23616
- var IngestBatch = external_exports.object({
23617
- events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
23618
- // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
23619
- // additionally rejects any event whose contentHash the store has already
23620
- // recorded — for re-runnable bulk ingest (worktree scan, transcript
23621
- // backfill), where a re-run mints fresh event ids for identical content and
23622
- // would otherwise accumulate duplicates. Live hook traffic must NOT set it:
23623
- // two genuinely separate prompts can be byte-identical and both belong on
23624
- // the timeline.
23625
- dedupe: external_exports.literal("content-hash").optional()
23626
- }).meta({ id: "IngestBatch" });
23627
-
23628
23749
  // ../../packages/schema/src/zod/exception.ts
23629
23750
  var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
23630
23751
  var ExceptionConditions = external_exports.object({
@@ -23785,8 +23906,6 @@ var Policy = external_exports.object({
23785
23906
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
23786
23907
  provenance: PolicyProvenance.optional()
23787
23908
  }).meta({ id: "Policy" });
23788
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
23789
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
23790
23909
  var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
23791
23910
  id: "RedactFallback"
23792
23911
  });
@@ -24143,7 +24262,7 @@ var VaultConsent = external_exports.object({
24143
24262
  });
24144
24263
 
24145
24264
  // ../../packages/schema/src/zod/local.ts
24146
- var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
24265
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 9;
24147
24266
  var MODEL_JUDGE_PAYLOAD_VERSION = 1;
24148
24267
  var RunMode = external_exports.enum(["standalone", "attached"]);
24149
24268
  var ControlPlaneConnection = external_exports.object({
@@ -24163,6 +24282,18 @@ var HistorySyncConsent = external_exports.object({
24163
24282
  payloadVersion: external_exports.number().int().positive(),
24164
24283
  endpoint: external_exports.string()
24165
24284
  });
24285
+ var ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH = 512;
24286
+ var AttachmentScopeEntry = external_exports.object({
24287
+ kind: external_exports.enum(["repo", "account"]),
24288
+ identity: printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH).min(1),
24289
+ label: printable(80).optional(),
24290
+ enrolledAt: external_exports.iso.datetime()
24291
+ });
24292
+ var AttachmentScope = external_exports.object({
24293
+ endpoint: external_exports.string().min(1),
24294
+ entries: external_exports.array(AttachmentScopeEntry)
24295
+ });
24296
+ var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
24166
24297
  var WebChatCaptureConsent = external_exports.object({
24167
24298
  acknowledgedAt: external_exports.iso.datetime(),
24168
24299
  version: external_exports.number().int().positive()
@@ -24233,6 +24364,23 @@ var WorkspaceSettings = external_exports.object({
24233
24364
  // both widenings. Absent until granted, and a grant for a different endpoint
24234
24365
  // or an older payload no longer counts.
24235
24366
  historySyncConsent: HistorySyncConsent.optional(),
24367
+ // The identities a SCOPED attachment forwards and the deployment they were
24368
+ // enrolled for (see AttachmentScope). Absent until something is enrolled.
24369
+ //
24370
+ // `z.unknown()`, NOT `AttachmentScope`, and the difference is this field's
24371
+ // whole failure mode. A settings.json that fails this schema reads as the
24372
+ // unonboarded defaults (readUserSettings in @akasecurity/persistence), and the
24373
+ // next save writes those defaults back over it. Typed, one entry with an
24374
+ // unknown `kind`, a control character or a bad timestamp would cost the
24375
+ // attachment, every consent and onboardedAt, permanently. Untyped, the value
24376
+ // is kept exactly as found and validated where it is used: parseAttachmentScope
24377
+ // drops a bad entry by itself, and on a scoped attachment resolveScope reads a
24378
+ // bad envelope as no entries, which keeps every event local.
24379
+ //
24380
+ // No default: absent must stay absent, so defaultWorkspaceSettings() and a
24381
+ // fresh settings.json do not change. No `.meta({ id })`, like every field
24382
+ // here. Not a ManagedSettingKey.
24383
+ attachmentScope: external_exports.unknown().optional(),
24236
24384
  // What the browser extension may record from a web chat, and the grant that
24237
24385
  // authorizes it. Absent until the user answers: recording something that was
24238
24386
  // never recorded before is never an assumed grant on upgrade, so the whole
@@ -25062,7 +25210,8 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
25062
25210
  ${latestResolutionStatusSql("f")} AS latest_status,
25063
25211
  e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
25064
25212
  e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
25065
- e.outbox_owed AS outbox_owed`;
25213
+ e.outbox_owed AS outbox_owed,
25214
+ f.line AS line, f.col AS col`;
25066
25215
 
25067
25216
  // ../../packages/persistence/src/repositories/installed-packs.ts
25068
25217
  import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
@@ -25289,6 +25438,7 @@ var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
25289
25438
  // ../../packages/persistence/src/egress-wire.ts
25290
25439
  import { createHash as createHash3 } from "crypto";
25291
25440
  var SLASH = "/".charCodeAt(0);
25441
+ var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
25292
25442
 
25293
25443
  // ../../packages/persistence/src/finding-key.ts
25294
25444
  import { createHash as createHash4 } from "crypto";
@@ -26305,6 +26455,7 @@ var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
26305
26455
  // ../../packages/plugin-sdk/src/repo.ts
26306
26456
  import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
26307
26457
  import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
26458
+ var NO_ATTRIBUTION = Object.freeze({});
26308
26459
 
26309
26460
  // ../../packages/plugin-sdk/src/events.ts
26310
26461
  import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
@@ -26474,6 +26625,9 @@ import { join as join23 } from "path";
26474
26625
  import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
26475
26626
  import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
26476
26627
 
26628
+ // ../../packages/plugin-sdk/src/policy-resolver.ts
26629
+ import { randomUUID as randomUUID14 } from "crypto";
26630
+
26477
26631
  // ../../packages/plugin-sdk/src/project-files.ts
26478
26632
  import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
26479
26633
  import { basename as basename5, join as join24 } from "path";
@@ -26505,16 +26659,20 @@ var codexProviderEnvShape = {
26505
26659
  var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
26506
26660
 
26507
26661
  // ../../packages/plugin-sdk/src/runtime.ts
26508
- import { randomUUID as randomUUID14 } from "crypto";
26662
+ import { randomUUID as randomUUID15 } from "crypto";
26663
+
26664
+ // ../../packages/plugin-sdk/src/scope-key.ts
26665
+ import { existsSync as existsSync12 } from "fs";
26666
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join25, normalize } from "path";
26509
26667
 
26510
26668
  // ../../packages/plugin-sdk/src/suppressions.ts
26511
26669
  var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
26512
26670
 
26513
26671
  // ../../packages/plugin-sdk/src/throttle.ts
26514
26672
  import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
26515
- import { join as join25 } from "path";
26673
+ import { join as join26 } from "path";
26516
26674
  function throttled(dataDir2, markerName, windowMs) {
26517
- const marker = join25(dataDir2, markerName);
26675
+ const marker = join26(dataDir2, markerName);
26518
26676
  try {
26519
26677
  if (Date.now() - statSync8(marker).mtimeMs < windowMs) return true;
26520
26678
  } catch {
@@ -26529,7 +26687,7 @@ function throttled(dataDir2, markerName, windowMs) {
26529
26687
 
26530
26688
  // src/history/reconcile-trigger.ts
26531
26689
  import { spawn } from "child_process";
26532
- import { dirname as dirname6, join as join27 } from "path";
26690
+ import { dirname as dirname7, join as join28 } from "path";
26533
26691
  import { fileURLToPath as fileURLToPath2 } from "url";
26534
26692
 
26535
26693
  // src/history/tail.ts
@@ -26543,7 +26701,7 @@ import {
26543
26701
  readSync as readSync2,
26544
26702
  writeFileSync as writeFileSync8
26545
26703
  } from "fs";
26546
- import { join as join26 } from "path";
26704
+ import { join as join27 } from "path";
26547
26705
  var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
26548
26706
  function safeSessionId(sessionId) {
26549
26707
  if (SAFE_SESSION_ID.test(sessionId) && sessionId !== "." && sessionId !== "..") {
@@ -26559,8 +26717,8 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
26559
26717
  try {
26560
26718
  const marker = `${RECONCILE_MARKER_PREFIX}-${safeSessionId(sessionId)}`;
26561
26719
  if (throttled(dataDir2, marker, RECONCILE_THROTTLE_MS)) return;
26562
- const here = dirname6(fileURLToPath2(import.meta.url));
26563
- const child = spawn(process.execPath, [join27(here, "reconcile.js"), sessionId, transcriptPath], {
26720
+ const here = dirname7(fileURLToPath2(import.meta.url));
26721
+ const child = spawn(process.execPath, [join28(here, "reconcile.js"), sessionId, transcriptPath], {
26564
26722
  detached: true,
26565
26723
  stdio: "ignore"
26566
26724
  });
@@ -26570,6 +26728,7 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
26570
26728
  }
26571
26729
 
26572
26730
  // src/hooks/shared.ts
26731
+ import { isAbsolute as isAbsolute3, normalize as normalize2, resolve as resolvePath } from "path";
26573
26732
  async function readStdin() {
26574
26733
  return new Promise((resolve3) => {
26575
26734
  let data = "";
@@ -26622,7 +26781,7 @@ function parseStopPayload(input2) {
26622
26781
 
26623
26782
  // src/hooks/store-health.ts
26624
26783
  import { mkdirSync as mkdirSync6, readFileSync as readFileSync22, writeFileSync as writeFileSync9 } from "fs";
26625
- import { dirname as dirname8, join as join35 } from "path";
26784
+ import { dirname as dirname9, join as join36 } from "path";
26626
26785
 
26627
26786
  // ../../packages/remote/src/http.ts
26628
26787
  import { request as httpRequest } from "http";
@@ -26637,12 +26796,12 @@ var REQUEST_TIMEOUT_MS = 2e3;
26637
26796
 
26638
26797
  // ../../packages/plugin-runtime/src/attached/forward-drops.ts
26639
26798
  import { readFileSync as readFileSync18 } from "fs";
26640
- import { join as join28 } from "path";
26799
+ import { join as join29 } from "path";
26641
26800
 
26642
26801
  // ../../packages/plugin-runtime/src/attached/forward-policy.ts
26643
- import { randomUUID as randomUUID15 } from "crypto";
26802
+ import { randomUUID as randomUUID16 } from "crypto";
26644
26803
  import { readFile, rename, writeFile } from "fs/promises";
26645
- import { join as join29 } from "path";
26804
+ import { join as join30 } from "path";
26646
26805
 
26647
26806
  // ../../packages/plugin-runtime/src/attached/history-sync.ts
26648
26807
  import { createHash as createHash7 } from "crypto";
@@ -26664,16 +26823,16 @@ var HISTORY_SYNC_THROTTLE_MS = 5 * 60 * 1e3;
26664
26823
 
26665
26824
  // ../../packages/plugin-runtime/src/attached/install-record.ts
26666
26825
  import { readFile as readFile2, stat } from "fs/promises";
26667
- import { basename as basename6, dirname as dirname7, join as join30, resolve as resolve2 } from "path";
26826
+ import { basename as basename6, dirname as dirname8, join as join31, resolve as resolve2 } from "path";
26668
26827
 
26669
26828
  // ../../packages/plugin-runtime/src/attached/plugin-block.ts
26670
26829
  import { readFileSync as readFileSync19 } from "fs";
26671
26830
  var INSTALL_RECORD_READ_TIMEOUT_MS = REQUEST_TIMEOUT_MS / 2;
26672
26831
 
26673
26832
  // ../../packages/plugin-runtime/src/attached/policy-store.ts
26674
- import { randomUUID as randomUUID16 } from "crypto";
26833
+ import { randomUUID as randomUUID17 } from "crypto";
26675
26834
  import { readFile as readFile3, rm, writeFile as writeFile2 } from "fs/promises";
26676
- import { join as join31 } from "path";
26835
+ import { join as join32 } from "path";
26677
26836
 
26678
26837
  // ../../packages/plugin-runtime/src/attached/atomic-publish.ts
26679
26838
  import { rename as rename2 } from "fs/promises";
@@ -26683,7 +26842,7 @@ var ATTEMPTS = 1 + IMMEDIATE_RETRIES + TIMED_RETRIES;
26683
26842
 
26684
26843
  // ../../packages/plugin-runtime/src/attached/posture-report-state.ts
26685
26844
  import { readFileSync as readFileSync20 } from "fs";
26686
- import { join as join32 } from "path";
26845
+ import { join as join33 } from "path";
26687
26846
  var OUTCOME_KEYS = {
26688
26847
  ok: true,
26689
26848
  unauthorized: true,
@@ -26704,13 +26863,13 @@ import { statSync as statSync9 } from "fs";
26704
26863
  import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
26705
26864
 
26706
26865
  // ../../packages/plugin-runtime/src/attached/posture-store.ts
26707
- import { randomUUID as randomUUID17 } from "crypto";
26866
+ import { randomUUID as randomUUID18 } from "crypto";
26708
26867
  import { readFile as readFile4, rm as rm2, writeFile as writeFile3 } from "fs/promises";
26709
- import { join as join33 } from "path";
26868
+ import { join as join34 } from "path";
26710
26869
 
26711
26870
  // ../../packages/plugin-runtime/src/attached/sync-state.ts
26712
26871
  import { readFileSync as readFileSync21 } from "fs";
26713
- import { join as join34 } from "path";
26872
+ import { join as join35 } from "path";
26714
26873
 
26715
26874
  // ../../packages/plugin-runtime/src/attached/status.ts
26716
26875
  var REFUSAL_LINES = {
@@ -26742,9 +26901,6 @@ var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
26742
26901
  // ../../packages/plugin-runtime/src/attached/factory.ts
26743
26902
  import { hostname as hostname6 } from "os";
26744
26903
 
26745
- // ../../packages/plugin-runtime/src/standalone-gateway.ts
26746
- import { randomUUID as randomUUID18 } from "crypto";
26747
-
26748
26904
  // ../../packages/plugin-runtime/src/handle-session-start.ts
26749
26905
  import { randomUUID as randomUUID19 } from "crypto";
26750
26906
  var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
@@ -26752,12 +26908,12 @@ var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
26752
26908
  // src/hooks/store-health.ts
26753
26909
  var STORE_REDIRECT_MARKER = "store-redirect-last-session";
26754
26910
  function markerDirs(dataDir2) {
26755
- return [dataDir2, dirname8(dataDir2)];
26911
+ return [dataDir2, dirname9(dataDir2)];
26756
26912
  }
26757
26913
  function alreadyClaimed(dirs, marker, sessionId) {
26758
26914
  return dirs.some((dir) => {
26759
26915
  try {
26760
- return readFileSync22(join35(dir, marker), "utf8") === sessionId;
26916
+ return readFileSync22(join36(dir, marker), "utf8") === sessionId;
26761
26917
  } catch {
26762
26918
  return false;
26763
26919
  }
@@ -26767,7 +26923,7 @@ function recordClaim(dirs, marker, sessionId) {
26767
26923
  for (const dir of dirs) {
26768
26924
  try {
26769
26925
  mkdirSync6(dir, { recursive: true, mode: DATA_DIR_MODE });
26770
- writeFileSync9(join35(dir, marker), sessionId, { mode: DATA_FILE_MODE });
26926
+ writeFileSync9(join36(dir, marker), sessionId, { mode: DATA_FILE_MODE });
26771
26927
  return;
26772
26928
  } catch {
26773
26929
  }
@@ -26792,7 +26948,7 @@ function formatMode(mode) {
26792
26948
  }
26793
26949
  function warnIfStoreRedirected(config2, sessionId, write = (message) => void process.stderr.write(message)) {
26794
26950
  try {
26795
- const paths = symlinkedStorePaths(dirname8(config2.dataDir));
26951
+ const paths = symlinkedStorePaths(dirname9(config2.dataDir));
26796
26952
  if (paths.length === 0) return;
26797
26953
  if (!sessionId) {
26798
26954
  write(storeRedirectedMessage(paths));