@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.
package/scripts/intro.js CHANGED
@@ -1,847 +1,11 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- try {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- } catch (e) {
11
- throw mod = 0, e;
12
- }
13
- };
14
2
  var __export = (target, all) => {
15
3
  for (var name in all)
16
4
  __defProp(target, name, { get: all[name], enumerable: true });
17
5
  };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
- // If the importer is in node compatibility mode or this is not an ESM
28
- // file that has been converted to a CommonJS file using a Babel-
29
- // compatible transform (i.e. "__esModule" has not been set), then set
30
- // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
- mod
33
- ));
34
-
35
- // ../../node_modules/.pnpm/ignore@7.0.10/node_modules/ignore/index.js
36
- var require_ignore = __commonJS({
37
- "../../node_modules/.pnpm/ignore@7.0.10/node_modules/ignore/index.js"(exports, module) {
38
- "use strict";
39
- function makeArray(subject) {
40
- return Array.isArray(subject) ? subject : [subject];
41
- }
42
- var UNDEFINED = void 0;
43
- var EMPTY = "";
44
- var SPACE = " ";
45
- var ESCAPE = "\\";
46
- var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
47
- var REGEX_TEST_BLANK_LINE = /^\uFEFF? *$/;
48
- var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
49
- var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
50
- var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
51
- var REGEX_SPLITALL_CRLF = /\r?\n/g;
52
- var DOUBLE_SLASH = "//";
53
- var SLASH_CODE = 47;
54
- var DOT_CODE = 46;
55
- var SLASH2 = "/";
56
- var TMP_KEY_IGNORE = "node-ignore";
57
- if (typeof Symbol !== "undefined") {
58
- TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
59
- }
60
- var KEY_IGNORE = TMP_KEY_IGNORE;
61
- var define = (object2, key, value) => {
62
- Object.defineProperty(object2, key, { value });
63
- return value;
64
- };
65
- var RETURN_FALSE = () => false;
66
- var cleanRangeBackSlash = (slashes) => {
67
- const { length } = slashes;
68
- return slashes.slice(0, length - length % 2);
69
- };
70
- var POSIX_CLASSES = {
71
- alnum: "0-9A-Za-z",
72
- alpha: "A-Za-z",
73
- blank: " \\t",
74
- cntrl: "\\x00-\\x1f\\x7f",
75
- digit: "0-9",
76
- graph: "!-.0-~",
77
- lower: "a-z",
78
- print: " -.0-~",
79
- punct: "!-.:-@\\[-`{-~",
80
- // git's `sane-ctype.h` classifies \v and \f as control, not space,
81
- // unlike C's `isspace`
82
- space: " \\t\\n\\r",
83
- upper: "A-Z",
84
- xdigit: "0-9A-Fa-f"
85
- };
86
- var CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
87
- var escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
88
- var NON_SLASH = "(?!\\/)";
89
- var classSource = (negated, body) => {
90
- if (negated) {
91
- return `[^\\/${body}]`;
92
- }
93
- const source = `[${body}]`;
94
- return new RegExp(source).test("/") ? NON_SLASH + source : source;
95
- };
96
- var scanBracket = (pattern, start) => {
97
- const { length } = pattern;
98
- let index = start + 1;
99
- let negated = EMPTY;
100
- const lead = pattern[index];
101
- if (lead === "!" || lead === "^") {
102
- negated = "^";
103
- index++;
104
- }
105
- let body = EMPTY;
106
- let prev = EMPTY;
107
- for (; ; ) {
108
- const char = pattern[index];
109
- if (char === UNDEFINED) {
110
- return null;
111
- }
112
- if (char === ESCAPE) {
113
- const escaped = pattern[index + 1];
114
- if (escaped === UNDEFINED) {
115
- return null;
116
- }
117
- body += escapeMember(escaped);
118
- prev = escaped;
119
- index++;
120
- } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
121
- index++;
122
- let to = pattern[index];
123
- if (to === ESCAPE) {
124
- to = pattern[index += 1];
125
- }
126
- if (prev <= to) {
127
- body += `-${escapeMember(to)}`;
128
- }
129
- prev = EMPTY;
130
- } else if (char === "[" && pattern[index + 1] === ":") {
131
- const nameStart = index + 2;
132
- let end = nameStart;
133
- while (end < length && pattern[end] !== "]") {
134
- end++;
135
- }
136
- if (end === length) {
137
- return null;
138
- }
139
- if (end > nameStart && pattern[end - 1] === ":") {
140
- const expanded = POSIX_CLASSES[pattern.slice(nameStart, end - 1)];
141
- if (expanded === UNDEFINED) {
142
- return null;
143
- }
144
- body += expanded;
145
- prev = EMPTY;
146
- index = end;
147
- } else {
148
- body += escapeMember("[");
149
- prev = "[";
150
- index = nameStart - 2;
151
- }
152
- } else {
153
- body += escapeMember(char);
154
- prev = char;
155
- }
156
- index++;
157
- if (pattern[index] === "]") {
158
- return {
159
- end: index,
160
- source: classSource(negated, body)
161
- };
162
- }
163
- }
164
- };
165
- var NEVER_MATCH = "[]";
166
- var PLACEHOLDER = "\0";
167
- var REGEX_RESTORE_PLACEHOLDER = new RegExp(
168
- `${PLACEHOLDER}(\\d+)${PLACEHOLDER}`,
169
- "g"
170
- );
171
- var TRAILING_WILDCARD = "\uE000";
172
- var extractBrackets = (pattern) => {
173
- const sources = [];
174
- const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
175
- const { length } = pattern;
176
- let out = EMPTY;
177
- let index = 0;
178
- while (index < length) {
179
- const char = pattern[index];
180
- if (char === ESCAPE) {
181
- const escaped = pattern[index + 1];
182
- if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
183
- out += pattern.slice(index, index + 2);
184
- } else {
185
- out += hold(
186
- REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : escaped
187
- );
188
- }
189
- index += 2;
190
- } else if (char === PLACEHOLDER) {
191
- out += hold(`[${PLACEHOLDER}]`);
192
- index++;
193
- } else if (char === "[") {
194
- const scanned = scanBracket(pattern, index);
195
- if (scanned === null) {
196
- out += hold(NEVER_MATCH);
197
- index = length;
198
- } else {
199
- out += hold(scanned.source);
200
- index = scanned.end + 1;
201
- }
202
- } else {
203
- out += char;
204
- index++;
205
- }
206
- }
207
- return {
208
- source: out,
209
- sources
210
- };
211
- };
212
- var DIRECT = null;
213
- var REGEX_INNER_SLASH = /\/(?!$)/;
214
- var REPLACERS = [
215
- [
216
- // Remove BOM
217
- // TODO:
218
- // Other similar zero-width characters?
219
- /^\uFEFF/,
220
- () => EMPTY,
221
- "\uFEFF"
222
- ],
223
- [
224
- // A trailing line terminator, left on when a whole file's contents are
225
- // added as one pattern rather than split into lines. git never sees one
226
- // -- it reads a `.gitignore` line by line -- so it is not part of the
227
- // pattern and is dropped here, apart from the trailing-space trimming,
228
- // which follows git in touching spaces and nothing else.
229
- /[\r\n]+$/,
230
- () => EMPTY
231
- ],
232
- // > Trailing spaces are ignored unless they are quoted with backslash ("\")
233
- [
234
- // Only spaces, never tabs or other whitespace: git trims a trailing run
235
- // of `' '` and nothing else (dir.c, `trim_trailing_spaces`, a single
236
- // `case ' '`), so a pattern ending in a tab keeps it as a literal.
237
- // (a\ ) -> (a )
238
- // (a ) -> (a)
239
- // (a ) -> (a)
240
- // (a \ ) -> (a )
241
- /((?:\\\\)*?)(\\? +)$/,
242
- (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
243
- ],
244
- // Replace (\ ) with ' '
245
- // Only a space: an escaped tab or other whitespace is already a literal by
246
- // the time it reaches here, and a bare tab must be left as one, not turned
247
- // into a space.
248
- // (\ ) -> ' '
249
- // (\\ ) -> '\\ '
250
- // (\\\ ) -> '\\ '
251
- [
252
- /(\\+?) /g,
253
- (_, m1) => {
254
- const { length } = m1;
255
- return m1.slice(0, length - length % 2) + SPACE;
256
- }
257
- ],
258
- // Escape metacharacters
259
- // which is written down by users but means special for regular expressions.
260
- // > There are 12 characters with special meanings:
261
- // > - the backslash \,
262
- // > - the caret ^,
263
- // > - the dollar sign $,
264
- // > - the period or dot .,
265
- // > - the vertical bar or pipe symbol |,
266
- // > - the question mark ?,
267
- // > - the asterisk or star *,
268
- // > - the plus sign +,
269
- // > - the opening parenthesis (,
270
- // > - the closing parenthesis ),
271
- // > - and the opening square bracket [,
272
- // > - the opening curly brace {,
273
- // > These special characters are often called "metacharacters".
274
- [
275
- /[\\$.|*+(){^]/g,
276
- (match) => `\\${match}`
277
- ],
278
- [
279
- // > a question mark (?) matches a single character
280
- /(?!\\)\?/g,
281
- () => "[^/]",
282
- "?"
283
- ],
284
- // leading slash
285
- [
286
- // > A leading slash matches the beginning of the pathname.
287
- // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
288
- // A leading slash matches the beginning of the pathname
289
- /^\//,
290
- () => "^",
291
- SLASH2
292
- ],
293
- // replace special metacharacter slash after the leading slash
294
- [
295
- /\//g,
296
- () => "\\/",
297
- SLASH2
298
- ],
299
- [
300
- // > A leading "**" followed by a slash means match in all directories.
301
- // > For example, "**/foo" matches file or directory "foo" anywhere,
302
- // > the same as pattern "foo".
303
- // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
304
- // > under directory "foo".
305
- // Notice that the '*'s have been replaced as '\\*'
306
- /^\^*(?:\\\*\\\*\\\/)+/,
307
- // '**/foo' <-> 'foo'
308
- () => "^(?:.*\\/)?",
309
- "*"
310
- ],
311
- // starting
312
- [
313
- // there will be no leading '/'
314
- // (which has been replaced by section "leading slash")
315
- // If starts with '**', adding a '^' to the regular expression also works
316
- DIRECT,
317
- (source, pattern) => {
318
- if (!source || source[0] === "^") {
319
- return source;
320
- }
321
- const anchor2 = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
322
- return anchor2 + source;
323
- }
324
- ],
325
- // two globstars
326
- [
327
- // Use lookahead assertions so that we could match more than one `'/**'`
328
- /\\\/\\\*\\\*(?=\\\/|$)/g,
329
- // Zero, one or several directories
330
- // should not use '*', or it will be replaced by the next replacer
331
- // Check if it is not the last `'/**'`
332
- (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : "\\/.+",
333
- "*"
334
- ],
335
- // normal intermediate wildcards
336
- [
337
- // Never replace escaped '*'
338
- // ignore rule '\*' will match the path '*'
339
- // 'abc.*/' -> go
340
- // 'abc.*' -> skip this rule,
341
- // coz trailing single wildcard will be handed by [trailing wildcard]
342
- /(^|[^\\]+)(\\\*)+(?=.+)/g,
343
- // '*.js' matches '.js'
344
- // '*.js' doesn't match 'abc'
345
- (_, p1, p2) => {
346
- const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
347
- return p1 + unescaped;
348
- },
349
- "*"
350
- ],
351
- // trailing wildcard, held apart from a literal star
352
- [
353
- // The step above leaves a trailing `*` alone, so a single `\*` is all that
354
- // can be left at the end here. Whether it is a wildcard or a literal
355
- // turns on the backslashes the user put in front of it: the escaper has
356
- // since doubled every one, so what stands here is those `2N` doubled
357
- // backslashes and then the star's own escape. An even number of the
358
- // original `N` leaves the star unescaped -- a wildcard -- and an odd
359
- // number escapes it -- a literal. This runs while the two are still
360
- // distinct, before the unescape steps below collapse the literal onto
361
- // the very `\*` a wildcard leaves behind.
362
- /(^|[^\\])((?:\\\\)*)\\\*$/,
363
- (match, p1, p2) => (
364
- // `p2` holds the doubled user backslashes; half of them is `N`.
365
- p2.length / 2 % 2 === 0 ? p1 + p2 + TRAILING_WILDCARD : match
366
- ),
367
- "*"
368
- ],
369
- [
370
- // unescape, revert step 3 except for back slash
371
- // For example, if a user escape a '\\*',
372
- // after step 3, the result will be '\\\\\\*'
373
- /\\\\\\(?=[$.|*+(){^])/g,
374
- () => ESCAPE,
375
- ESCAPE + ESCAPE
376
- ],
377
- [
378
- // '\\\\' -> '\\'
379
- /\\\\/g,
380
- () => ESCAPE,
381
- ESCAPE + ESCAPE
382
- ],
383
- [
384
- // Every real bracket expression -- POSIX classes included -- has already
385
- // been held aside by `extractBrackets`, so the only `[` left in the
386
- // pattern is an escaped, literal one.
387
- // `\` is escaped by step 3
388
- /\\\[([^\]/]*?)(\\*)($|\])/g,
389
- // '\\[bar]' -> '\\\\[bar\\]'
390
- (match, range, endEscape, close) => `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`,
391
- "["
392
- ],
393
- // ending
394
- [
395
- // 'js' will not match 'js.'
396
- // 'ab' will not match 'abc'
397
- DIRECT,
398
- // WTF!
399
- // https://git-scm.com/docs/gitignore
400
- // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
401
- // which re-fixes #24, #38
402
- // > If there is a separator at the end of the pattern then the pattern
403
- // > will only match directories, otherwise the pattern can match both
404
- // > files and directories.
405
- // 'js*' will not match 'a.js'
406
- // 'js/' will not match 'a.js'
407
- // 'js' will match 'a.js' and 'a.js/'
408
- (source) => {
409
- const last = source[source.length - 1];
410
- if (!last || last === TRAILING_WILDCARD) {
411
- return source;
412
- }
413
- return last === SLASH2 ? `${source}$` : `${source}(?=$|\\/$)`;
414
- }
415
- ]
416
- ];
417
- var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
418
- var MODE_IGNORE = "regex";
419
- var MODE_CHECK_IGNORE = "checkRegex";
420
- 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
- }
430
- };
431
- var WILDCARD = "[^\\/]*";
432
- var separatorAfter = (run, at) => {
433
- let separator = EMPTY;
434
- for (let index = at + 1; index < run.length && !run[index].wildcard; index++) {
435
- separator += run[index].single;
436
- }
437
- return separator;
438
- };
439
- var pinWildcards = (source) => {
440
- if (source.indexOf(WILDCARD) < 0) {
441
- return source;
442
- }
443
- const tokens = [];
444
- const { length } = source;
445
- let index = 0;
446
- while (index < length) {
447
- const char = source[index];
448
- if (source.startsWith(WILDCARD, index)) {
449
- tokens.push({ wildcard: true });
450
- index += WILDCARD.length;
451
- } else if (char === "[") {
452
- let end = index + 1;
453
- if (source[end] === "^") {
454
- end++;
455
- }
456
- if (source[end] === "]") {
457
- end++;
458
- }
459
- while (end < length && source[end] !== "]") {
460
- end += source[end] === ESCAPE ? 2 : 1;
461
- }
462
- end++;
463
- tokens.push({ single: source.slice(index, end) });
464
- index = end;
465
- } else if (char === ESCAPE) {
466
- tokens.push({ single: source.slice(index, index + 2) });
467
- index += 2;
468
- } else if (char === "(") {
469
- let depth = 0;
470
- let end = index;
471
- do {
472
- if (source[end] === ESCAPE) {
473
- end++;
474
- } else if (source[end] === "(") {
475
- depth++;
476
- } else if (source[end] === ")") {
477
- depth--;
478
- }
479
- end++;
480
- } while (end < length && depth > 0);
481
- if ("*+?".indexOf(source[end]) >= 0) {
482
- end++;
483
- }
484
- tokens.push({ boundary: source.slice(index, end) });
485
- index = end;
486
- } else if (char === "^" || char === "$") {
487
- tokens.push({ boundary: char });
488
- index++;
489
- } else {
490
- tokens.push({ single: char });
491
- index++;
492
- }
493
- }
494
- let out = EMPTY;
495
- let run = [];
496
- const flush = () => {
497
- let lastWildcard;
498
- run.forEach((token, at) => {
499
- if (token.wildcard) {
500
- lastWildcard = at;
501
- }
502
- });
503
- run.forEach((token, at) => {
504
- if (!token.wildcard) {
505
- out += token.single;
506
- return;
507
- }
508
- out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
509
- });
510
- run = [];
511
- };
512
- tokens.forEach((token) => {
513
- if (token.boundary === void 0) {
514
- run.push(token);
515
- return;
516
- }
517
- flush();
518
- out += token.boundary;
519
- });
520
- flush();
521
- return out;
522
- };
523
- var makeRegexPrefix = (pattern) => {
524
- const { source, sources } = extractBrackets(pattern);
525
- const replaced = REPLACERS.reduce(
526
- // A pass whose matcher finds nothing hands back the very string it was
527
- // given, so asking first costs a search and saves a rewrite. Ten of the
528
- // fifteen passes never fire for a typical .gitignore line, and between
529
- // them they were 45% of this chain.
530
- (prev, [matcher, replacer, required2]) => {
531
- if (matcher === DIRECT) {
532
- return replacer(prev, pattern);
533
- }
534
- if (required2 !== UNDEFINED && prev.indexOf(required2) < 0) {
535
- return prev;
536
- }
537
- return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
538
- },
539
- source
540
- );
541
- return sources.length ? replaced.replace(
542
- REGEX_RESTORE_PLACEHOLDER,
543
- (match, index) => sources[index]
544
- ) : replaced;
545
- };
546
- var matchesBasename = (body) => {
547
- const index = body.indexOf(SLASH2);
548
- return index < 0 || index === body.length - 1;
549
- };
550
- var basenameOf = (path) => {
551
- const end = path.length - 1;
552
- const index = path.lastIndexOf(
553
- SLASH2,
554
- path[end] === SLASH2 ? end - 1 : end
555
- );
556
- return index < 0 ? path : path.slice(index + 1);
557
- };
558
- var parentOf = (path) => {
559
- if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
560
- const slices = path.split(SLASH2).filter(Boolean);
561
- slices.pop();
562
- return slices.length ? slices.join(SLASH2) + SLASH2 : EMPTY;
563
- }
564
- const end = path.length - 1;
565
- const cut = path.lastIndexOf(
566
- SLASH2,
567
- path.charCodeAt(end) === SLASH_CODE ? end - 1 : end
568
- );
569
- return cut < 0 ? EMPTY : path.slice(0, cut + 1);
570
- };
571
- var isString = (subject) => typeof subject === "string";
572
- var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
573
- var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
574
- var IgnoreRule = class {
575
- constructor(pattern, mark, body, ignoreCase, negative, prefix) {
576
- this.pattern = pattern;
577
- this.mark = mark;
578
- this.negative = negative;
579
- define(this, "body", body);
580
- define(this, "ignoreCase", ignoreCase);
581
- define(this, "regexPrefix", prefix);
582
- }
583
- // Worked out on first use and kept behind an own property, the way `regex`
584
- // caches itself in `_regex`. Deciding it in the constructor instead would
585
- // add a fourth `defineProperty` to every rule ever built, which cost 4% of
586
- // every compile -- including the compiles of rules that are never matched
587
- // against anything.
588
- get _basenameOnly() {
589
- return define(this, "_basenameOnly", matchesBasename(this.body));
590
- }
591
- get regex() {
592
- const key = UNDERSCORE + MODE_IGNORE;
593
- if (this[key]) {
594
- return this[key];
595
- }
596
- return this._make(MODE_IGNORE, key);
597
- }
598
- get checkRegex() {
599
- const key = UNDERSCORE + MODE_CHECK_IGNORE;
600
- if (this[key]) {
601
- return this[key];
602
- }
603
- return this._make(MODE_CHECK_IGNORE, key);
604
- }
605
- _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 regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
612
- return define(this, key, regex);
613
- }
614
- };
615
- var createRule = ({
616
- pattern,
617
- mark
618
- }, ignoreCase) => {
619
- let negative = false;
620
- let body = pattern;
621
- if (body.indexOf("!") === 0) {
622
- negative = true;
623
- body = body.substr(1);
624
- }
625
- body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
626
- const regexPrefix = makeRegexPrefix(body);
627
- return new IgnoreRule(
628
- pattern,
629
- mark,
630
- body,
631
- ignoreCase,
632
- negative,
633
- regexPrefix
634
- );
635
- };
636
- var RuleManager = class {
637
- constructor(ignoreCase) {
638
- this._ignoreCase = ignoreCase;
639
- this._rules = [];
640
- this._basenameCount = 0;
641
- }
642
- _add(pattern) {
643
- if (pattern && pattern[KEY_IGNORE]) {
644
- this._rules = this._rules.concat(pattern._rules._rules);
645
- this._basenameCount += pattern._rules._basenameCount;
646
- this._added = true;
647
- return;
648
- }
649
- if (isString(pattern)) {
650
- pattern = {
651
- pattern
652
- };
653
- }
654
- if (checkPattern(pattern.pattern)) {
655
- const rule = createRule(pattern, this._ignoreCase);
656
- this._added = true;
657
- this._rules.push(rule);
658
- if (matchesBasename(rule.body)) {
659
- this._basenameCount++;
660
- }
661
- }
662
- }
663
- // @param {Array<string> | string | Ignore} pattern
664
- add(pattern) {
665
- this._added = false;
666
- makeArray(
667
- isString(pattern) ? splitPattern(pattern) : pattern
668
- ).forEach(this._add, this);
669
- return this._added;
670
- }
671
- // Test one single path without recursively checking parent directories
672
- //
673
- // - checkUnignored `boolean` whether should check if the path is unignored,
674
- // setting `checkUnignored` to `false` could reduce additional
675
- // path matching.
676
- // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
677
- // @returns {TestResult} true if a file is ignored
678
- test(path, checkUnignored, mode) {
679
- let ignored = false;
680
- let unignored = false;
681
- let matchedRule;
682
- const rules = this._rules;
683
- const { length } = rules;
684
- const shortcut = this._basenameCount * 2 >= length;
685
- const basename7 = shortcut ? basenameOf(path) : path;
686
- for (let index = 0; index < length; index++) {
687
- const rule = rules[index];
688
- const { negative } = rule;
689
- const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
690
- if (!skip && rule[mode].test(
691
- shortcut && rule._basenameOnly ? basename7 : path
692
- )) {
693
- ignored = !negative;
694
- unignored = negative;
695
- matchedRule = negative ? UNDEFINED : rule;
696
- }
697
- }
698
- const ret = {
699
- ignored,
700
- unignored
701
- };
702
- if (matchedRule) {
703
- ret.rule = matchedRule;
704
- }
705
- return ret;
706
- }
707
- };
708
- var throwError = (message, Ctor) => {
709
- throw new Ctor(message);
710
- };
711
- var checkPath = (path, originalPath, doThrow) => {
712
- if (!isString(path)) {
713
- return doThrow(
714
- `path must be a string, but got \`${originalPath}\``,
715
- TypeError
716
- );
717
- }
718
- if (!path) {
719
- return doThrow(`path must not be empty`, TypeError);
720
- }
721
- if (checkPath.isNotRelative(path)) {
722
- const r = "`path.relative()`d";
723
- return doThrow(
724
- `path should be a ${r} string, but got "${originalPath}"`,
725
- RangeError
726
- );
727
- }
728
- return true;
729
- };
730
- var isNotRelative = (path) => {
731
- const first = path.charCodeAt(0);
732
- if (first === SLASH_CODE) {
733
- return true;
734
- }
735
- if (first !== DOT_CODE) {
736
- return false;
737
- }
738
- if (path.length === 1) {
739
- return true;
740
- }
741
- const second = path.charCodeAt(1);
742
- if (second === SLASH_CODE) {
743
- return true;
744
- }
745
- if (second !== DOT_CODE) {
746
- return false;
747
- }
748
- return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
749
- };
750
- checkPath.isNotRelative = isNotRelative;
751
- checkPath.convert = (p) => p;
752
- var Ignore = class {
753
- constructor({
754
- ignorecase = true,
755
- ignoreCase = ignorecase,
756
- allowRelativePaths = false
757
- } = {}) {
758
- define(this, KEY_IGNORE, true);
759
- this._rules = new RuleManager(ignoreCase);
760
- this._strictPathCheck = !allowRelativePaths;
761
- this._initCache();
762
- }
763
- _initCache() {
764
- this._ignoreCache = /* @__PURE__ */ Object.create(null);
765
- this._testCache = /* @__PURE__ */ Object.create(null);
766
- }
767
- add(pattern) {
768
- if (this._rules.add(pattern)) {
769
- this._initCache();
770
- }
771
- return this;
772
- }
773
- // legacy
774
- addPattern(pattern) {
775
- return this.add(pattern);
776
- }
777
- // @returns {TestResult}
778
- _test(originalPath, cache, checkUnignored) {
779
- const path = originalPath && checkPath.convert(originalPath);
780
- checkPath(
781
- path,
782
- originalPath,
783
- this._strictPathCheck ? throwError : RETURN_FALSE
784
- );
785
- return this._t(path, cache, checkUnignored);
786
- }
787
- checkIgnore(path) {
788
- if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
789
- return this.test(path);
790
- }
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
- }
797
- }
798
- return this._rules.test(path, false, MODE_CHECK_IGNORE);
799
- }
800
- _t(path, cache, checkUnignored) {
801
- if (path in cache) {
802
- return cache[path];
803
- }
804
- const parentPath = parentOf(path);
805
- const parent = parentPath ? this._t(parentPath, cache, checkUnignored) : UNDEFINED;
806
- return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
807
- }
808
- ignores(path) {
809
- return this._test(path, this._ignoreCache, false).ignored;
810
- }
811
- createFilter() {
812
- return (path) => !this.ignores(path);
813
- }
814
- filter(paths) {
815
- return makeArray(paths).filter(this.createFilter());
816
- }
817
- // @returns {TestResult}
818
- test(path) {
819
- return this._test(path, this._testCache, true);
820
- }
821
- };
822
- var factory = (options) => new Ignore(options);
823
- var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
824
- var setupWindows = () => {
825
- const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
826
- checkPath.convert = makePosix;
827
- const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
828
- checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
829
- };
830
- if (
831
- // Detect `process` so that it can run in browsers.
832
- typeof process !== "undefined" && process.platform === "win32"
833
- ) {
834
- setupWindows();
835
- }
836
- module.exports = factory;
837
- factory.default = factory;
838
- module.exports.isPathValid = isPathValid;
839
- define(module.exports, /* @__PURE__ */ Symbol.for("setupWindows"), setupWindows);
840
- }
841
- });
842
6
 
843
7
  // src/intro.ts
844
- import { readFileSync as readFileSync19 } from "fs";
8
+ import { readFileSync as readFileSync3 } from "fs";
845
9
 
846
10
  // src/present.ts
847
11
  var SHADE = {
@@ -896,26 +60,6 @@ function fenced(body) {
896
60
  return [fence, body, fence].join("\n");
897
61
  }
898
62
 
899
- // ../../packages/plugin-sdk/src/config.ts
900
- import { existsSync as existsSync8 } from "fs";
901
- import { join as join16 } from "path";
902
-
903
- // ../../packages/persistence/src/attached-derived.ts
904
- import { rmSync } from "fs";
905
- import { join } from "path";
906
-
907
- // ../../packages/persistence/src/control-plane-credential.ts
908
- import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
909
- import { join as join2 } from "path";
910
-
911
- // ../../packages/schema/src/drizzle/deferred-migrations.ts
912
- var DEFERRED_MIGRATION_TAGS = [
913
- "0031_audit_capture_by_time_index",
914
- "0032_audit_capture_by_id_index",
915
- "0033_audit_capture_location_index",
916
- "0034_findings_read_indexes"
917
- ];
918
-
919
63
  // ../../packages/schema/src/exception-scope.ts
920
64
  var MINUTE_MS = 6e4;
921
65
  var HOUR_MS = 60 * MINUTE_MS;
@@ -3735,9 +2879,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
3735
2879
  function stripTabAndNewline(value) {
3736
2880
  return value.replace(asciiTabOrNewline, "");
3737
2881
  }
3738
- function urlHostnameOk(url2, hostname5) {
3739
- hostname5.lastIndex = 0;
3740
- return hostname5.test(url2.hostname);
2882
+ function urlHostnameOk(url2, hostname3) {
2883
+ hostname3.lastIndex = 0;
2884
+ return hostname3.test(url2.hostname);
3741
2885
  }
3742
2886
  function urlProtocolOk(url2, protocol) {
3743
2887
  protocol.lastIndex = 0;
@@ -5948,7 +5092,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5948
5092
  var NONE = 0;
5949
5093
  var ASSUMED = 1;
5950
5094
  var PROVEN = 2;
5951
- function isRecursive(inst, stack, resolve2) {
5095
+ function isRecursive(inst, stack, resolve) {
5952
5096
  const cached2 = recursive.get(inst);
5953
5097
  if (cached2 !== void 0)
5954
5098
  return cached2 ? PROVEN : NONE;
@@ -5958,7 +5102,7 @@ function isRecursive(inst, stack, resolve2) {
5958
5102
  let result = NONE;
5959
5103
  const check2 = (child) => {
5960
5104
  if (result !== PROVEN && child?._zod) {
5961
- const answer = isRecursive(child, stack, resolve2);
5105
+ const answer = isRecursive(child, stack, resolve);
5962
5106
  if (answer > result)
5963
5107
  result = answer;
5964
5108
  }
@@ -5969,7 +5113,7 @@ function isRecursive(inst, stack, resolve2) {
5969
5113
  const desc = Object.getOwnPropertyDescriptor(sh, key);
5970
5114
  if (spread && !desc.enumerable)
5971
5115
  continue;
5972
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve2) : NONE;
5116
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
5973
5117
  if (child > answer)
5974
5118
  answer = child;
5975
5119
  }
@@ -6033,7 +5177,7 @@ function isRecursive(inst, stack, resolve2) {
6033
5177
  break;
6034
5178
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
6035
5179
  case "lazy": {
6036
- const inner = def._cachedInner ?? (resolve2 ? inst._zod.innerType : void 0);
5180
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
6037
5181
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
6038
5182
  break;
6039
5183
  }
@@ -20706,8 +19850,8 @@ var PLATFORM_HOSTING = /* @__PURE__ */ new Map([
20706
19850
  ["ollama", "local"],
20707
19851
  ["local", "local"]
20708
19852
  ]);
20709
- function hostingFor(platform2) {
20710
- return PLATFORM_HOSTING.get(platform2) ?? "api";
19853
+ function hostingFor(platform) {
19854
+ return PLATFORM_HOSTING.get(platform) ?? "api";
20711
19855
  }
20712
19856
  var FIRST_PARTY = /* @__PURE__ */ new Map([
20713
19857
  ["anthropic", "anthropic"],
@@ -20721,8 +19865,8 @@ var FIRST_PARTY = /* @__PURE__ */ new Map([
20721
19865
  function firstPartyPlatformFor(vendor2) {
20722
19866
  return FIRST_PARTY.get(vendor2) ?? null;
20723
19867
  }
20724
- function isFirstParty(vendor2, platform2) {
20725
- return FIRST_PARTY.get(vendor2) === platform2;
19868
+ function isFirstParty(vendor2, platform) {
19869
+ return FIRST_PARTY.get(vendor2) === platform;
20726
19870
  }
20727
19871
  var PLATFORM_NAMESPACES = Object.freeze([
20728
19872
  "anthropic",
@@ -20783,14 +19927,14 @@ var ModelVendorBuilder = class {
20783
19927
  );
20784
19928
  }
20785
19929
  for (const ref of spec.on ?? []) {
20786
- const { platform: platform2, price, retention, region } = normalizeRef(ref);
20787
- const firstParty = isFirstParty(this.vendor, platform2);
20788
- const hosting = hostingFor(platform2);
19930
+ const { platform, price, retention, region } = normalizeRef(ref);
19931
+ const firstParty = isFirstParty(this.vendor, platform);
19932
+ const hosting = hostingFor(platform);
20789
19933
  const isSelfHosted = hosting === "local";
20790
19934
  platforms.set(
20791
- platform2,
19935
+ platform,
20792
19936
  Object.freeze({
20793
- platform: platform2,
19937
+ platform,
20794
19938
  hosting,
20795
19939
  firstParty,
20796
19940
  price: price ?? (isSelfHosted ? ZERO_PRICE : firstParty ? spec.price ?? null : null),
@@ -20940,7 +20084,7 @@ anthropic.model("claude-haiku-4-5", {
20940
20084
  name: "Claude Haiku 4.5",
20941
20085
  ctx: 2e5,
20942
20086
  maxOut: 64e3,
20943
- // Reviewed: fast/cheap tier, no flagged reasoning or code specialisation.
20087
+ // Reviewed: fast/cheap general-purpose tier, not a reasoning or code model.
20944
20088
  capability: null,
20945
20089
  price: anthropicPrice(1, 5, 0.1),
20946
20090
  // The vendor documents `claude-haiku-4-5-20251001` as the versioned id and
@@ -21071,6 +20215,11 @@ openai.model("gpt-4o", {
21071
20215
  price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
21072
20216
  on: [...OPENAI_RESELLERS]
21073
20217
  });
20218
+ openai.model("gpt-4o-2024-05-13", {
20219
+ name: "GPT-4o (2024-05-13)",
20220
+ price: tokenPrice(5, 15),
20221
+ on: [...OPENAI_RESELLERS]
20222
+ });
21074
20223
  openai.model("gpt-4o-mini", {
21075
20224
  name: "GPT-4o mini",
21076
20225
  price: tokenPrice(0.15, 0.6, { cacheRead: 0.075 }),
@@ -21090,6 +20239,24 @@ openai.model("o3", {
21090
20239
  price: tokenPrice(2, 8, { cacheRead: 0.5 }),
21091
20240
  on: [...OPENAI_RESELLERS]
21092
20241
  });
20242
+ openai.model("text-embedding-3-small", {
20243
+ name: "text-embedding-3-small",
20244
+ capability: "embedding",
20245
+ price: tokenPrice(0.02, 0),
20246
+ on: [...OPENAI_RESELLERS]
20247
+ });
20248
+ openai.model("text-embedding-3-large", {
20249
+ name: "text-embedding-3-large",
20250
+ capability: "embedding",
20251
+ price: tokenPrice(0.13, 0),
20252
+ on: [...OPENAI_RESELLERS]
20253
+ });
20254
+ openai.model("text-embedding-ada-002", {
20255
+ name: "text-embedding-ada-002",
20256
+ capability: "embedding",
20257
+ price: tokenPrice(0.1, 0),
20258
+ on: [...OPENAI_RESELLERS]
20259
+ });
21093
20260
  openai.model("gpt-oss-120b", {
21094
20261
  name: "GPT-OSS 120B",
21095
20262
  openWeights: true,
@@ -21376,10 +20543,21 @@ var MODEL_ENTRIES = Object.freeze([
21376
20543
  ...alibaba.models(),
21377
20544
  ...amazon.models()
21378
20545
  ]);
20546
+ var LONG_CONTEXT_THRESHOLDS = Object.freeze(
20547
+ [
20548
+ ...new Set(
20549
+ MODEL_ENTRIES.flatMap(
20550
+ (entry) => [...entry.platforms.values()].flatMap(
20551
+ (offering) => offering.price?.longContext ? [offering.price.longContext.thresholdInputTokens] : []
20552
+ )
20553
+ )
20554
+ )
20555
+ ].sort((a, b) => a - b)
20556
+ );
21379
20557
  var MODEL_INDEX = buildModelIndex(MODEL_ENTRIES);
21380
20558
 
21381
20559
  // ../../packages/schema/src/model/governance.ts
21382
- var ModelCapability = external_exports.enum(["reasoning", "code"]);
20560
+ var ModelCapability = external_exports.enum(["reasoning", "code", "embedding"]);
21383
20561
  var DataRetention = external_exports.enum([
21384
20562
  "zero_retention",
21385
20563
  "no_storage",
@@ -21571,11 +20749,33 @@ var ResolutionMethod = external_exports.enum([
21571
20749
  "false-positive",
21572
20750
  "redetected"
21573
20751
  ]).meta({ id: "ResolutionMethod" });
20752
+ var FindingContextBasis = external_exports.enum(["file", "excerpt"]).meta({ id: "FindingContextBasis" });
20753
+ var FindingContext = external_exports.object({
20754
+ basis: FindingContextBasis,
20755
+ // 1-based line number of `lines[0]`.
20756
+ firstLine: external_exports.number().int().positive(),
20757
+ lines: external_exports.array(external_exports.string()).min(1).max(5),
20758
+ match: external_exports.object({
20759
+ // 1-based line number, within [firstLine, firstLine + lines.length).
20760
+ line: external_exports.number().int().positive(),
20761
+ // Offsets into that entry of `lines`, end exclusive.
20762
+ start: external_exports.number().int().nonnegative(),
20763
+ end: external_exports.number().int().nonnegative()
20764
+ }).nullable()
20765
+ }).meta({ id: "FindingContext" });
20766
+ var FindingLocation = external_exports.object({
20767
+ line: external_exports.number().int().positive(),
20768
+ col: external_exports.number().int().positive(),
20769
+ context: FindingContext.nullable()
20770
+ });
21574
20771
  var FindingMatch = external_exports.object({
21575
20772
  // Masked preview of the matched value. Never raw content.
21576
20773
  maskedValue: external_exports.string(),
21577
- // Redacted source-line prefix. Currently empty (pending privacy review).
21578
- contextPrefix: external_exports.string()
20774
+ // Deprecated: always empty. Superseded by `context`.
20775
+ contextPrefix: external_exports.string(),
20776
+ // The masked lines around the match. Absent when the finding predates
20777
+ // context capture or none could be built safely.
20778
+ context: FindingContext.optional()
21579
20779
  }).meta({ id: "FindingMatch" });
21580
20780
  var FindingDetectionRef = external_exports.object({
21581
20781
  id: external_exports.string(),
@@ -21595,6 +20795,11 @@ var FindingInstance = external_exports.object({
21595
20795
  provider: FindingProvider,
21596
20796
  repo: external_exports.string(),
21597
20797
  file: external_exports.string(),
20798
+ // 1-based line and column of the match start in the scanned text (the
20799
+ // column in UTF-16 code units). Absent for findings that predate location
20800
+ // capture or have no source text.
20801
+ line: external_exports.number().int().positive().optional(),
20802
+ col: external_exports.number().int().positive().optional(),
21598
20803
  // Who the capturing event is attributed to. Optional: a single-user store
21599
20804
  // has no one to attribute a finding to and never sets it.
21600
20805
  user: FindingUser.optional(),
@@ -21656,6 +20861,13 @@ var FindingStats = external_exports.object({
21656
20861
  low: external_exports.number().int().nonnegative()
21657
20862
  })
21658
20863
  }).meta({ id: "FindingStats" });
20864
+ var FindingsOverview = external_exports.object({
20865
+ findings: external_exports.number().int().nonnegative(),
20866
+ open: external_exports.number().int().nonnegative(),
20867
+ handled: external_exports.number().int().nonnegative(),
20868
+ resolved: external_exports.number().int().nonnegative(),
20869
+ dismissed: external_exports.number().int().nonnegative()
20870
+ }).meta({ id: "FindingsOverview" });
21659
20871
  var FindingFacetItem = external_exports.object({
21660
20872
  value: external_exports.string(),
21661
20873
  count: external_exports.number().int().nonnegative()
@@ -21773,6 +20985,7 @@ var FindingInstanceDetail = FindingInstance.extend({
21773
20985
  policy: FindingPolicyRef
21774
20986
  }).meta({ id: "FindingInstanceDetail" });
21775
20987
  var MAX_FLAT_FINDINGS_LIMIT = 200;
20988
+ var FindingContextQuery = external_exports.object({ id: external_exports.string().min(1).max(256) });
21776
20989
  var ListFindingInstancesQuery = external_exports.object({
21777
20990
  severity: external_exports.array(Severity).optional(),
21778
20991
  // Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
@@ -22104,7 +21317,23 @@ var CaptureAttributes = external_exports.object({
22104
21317
  // capture denied by another finding's own Block policy carries `block`
22105
21318
  // here too. The full statement is on EventMetadata.redactDegradedTo; it is
22106
21319
  // repeated rather than referenced because a store reader opens this file.
22107
- redact_degraded_to: ActionTaken.optional()
21320
+ redact_degraded_to: ActionTaken.optional(),
21321
+ // The scope key this capture was stamped with: the canonical repository
21322
+ // (`host/owner/repo`) of the path the capture names (a relative path is read
21323
+ // against its working directory), else of its own working directory, or a
21324
+ // chat account's identity. The store's local `scope_key` column reads it, so
21325
+ // a scoped attachment has a per-row key to work from. Absent when no key
21326
+ // could be derived.
21327
+ //
21328
+ // LOCAL ONLY. That is the contract for every path that sends a row. Producers
21329
+ // stamp it in every attachment mode, and the two structural choke points strip
21330
+ // it: the attached gateway's `reKeyForForward` on the live path, and the
21331
+ // history drain's `rebuildAuditEvent`, which drops it through `withoutScopeKey`.
21332
+ // A capture row's bag reaches the wire through `rebuildCapture`, which builds
21333
+ // the metadata from named keys and never names this one; `toCaptureAttributes`,
21334
+ // which builds the bag from a wire event, never emits it. What a scoped
21335
+ // attachment does with the key is not part of this shape's contract.
21336
+ scope_key: external_exports.string().optional()
22108
21337
  }).catchall(external_exports.unknown());
22109
21338
  var CaptureStatusAttributes = external_exports.object({
22110
21339
  source_tool: external_exports.string().optional(),
@@ -22134,6 +21363,12 @@ var ToolCallInspection = external_exports.object({
22134
21363
  actionTaken: ActionTaken,
22135
21364
  confidence: external_exports.number().min(0).max(1)
22136
21365
  });
21366
+ var findingLocationFields = {
21367
+ line: external_exports.number().int().positive().optional(),
21368
+ col: external_exports.number().int().positive().optional(),
21369
+ context: FindingContext.nullable().optional()
21370
+ };
21371
+ var ToolCallInspectionInput = ToolCallInspection.extend(findingLocationFields);
22137
21372
  var ToolCallInput = external_exports.object({
22138
21373
  sessionId: external_exports.string().min(1),
22139
21374
  toolUseId: external_exports.string().min(1),
@@ -22143,7 +21378,7 @@ var ToolCallInput = external_exports.object({
22143
21378
  attributes: ToolCallAttributes,
22144
21379
  // Secrets detected in the tool's (masked) target — written as linked
22145
21380
  // `inspection_findings`. Empty for a clean tool call.
22146
- inspections: external_exports.array(ToolCallInspection).default([])
21381
+ inspections: external_exports.array(ToolCallInspectionInput).default([])
22147
21382
  });
22148
21383
  var InventoryInput = external_exports.object({
22149
21384
  objectType: InventoryObjectType,
@@ -22217,7 +21452,8 @@ var InspectionFindingInput = external_exports.object({
22217
21452
  // same findingKey — mirrors the legacy `findings.first_detected_at`.
22218
21453
  // Optional: when omitted, the writer derives it from the referenced audit
22219
21454
  // event's startedAt on first insert (see SqliteInspectionFindingsRepository).
22220
- firstDetectedAt: external_exports.iso.datetime().optional()
21455
+ firstDetectedAt: external_exports.iso.datetime().optional(),
21456
+ ...findingLocationFields
22221
21457
  });
22222
21458
  var InventoryContext = external_exports.object({
22223
21459
  host: InventoryInput.optional(),
@@ -22259,8 +21495,9 @@ var SessionTokenReport = external_exports.object({
22259
21495
  totalTokens: external_exports.number().int().nonnegative(),
22260
21496
  // Σ of the PRICED rollups only; null when no rollup had a known price.
22261
21497
  estimatedCostUsd: external_exports.number().nullable(),
22262
- // True whenever any rollup has a null cost (unknown provider/model), so the
22263
- // total understates real spend — the UI renders `≥ $X` instead of a falsely
21498
+ // True whenever any call priced to null (an unknown provider/model, or a call
21499
+ // over a long-context threshold whose rate is unpublished), so the total
21500
+ // understates real spend — the UI renders `≥ $X` instead of a falsely
22264
21501
  // precise figure rather than silently dropping the unpriced calls.
22265
21502
  costIsPartial: external_exports.boolean()
22266
21503
  });
@@ -22992,6 +22229,17 @@ var AttachedCredential = external_exports.object({
22992
22229
  keyPrefix: external_exports.string().min(1).max(16).optional(),
22993
22230
  mintedAt: external_exports.iso.datetime().optional()
22994
22231
  });
22232
+ var AttachmentMode = external_exports.enum(["machine", "scoped"]);
22233
+ var ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION = 2;
22234
+ var AttachedCredentialV1 = AttachedCredential;
22235
+ var AttachedCredentialV2 = AttachedCredential.extend({
22236
+ specVersion: external_exports.literal(ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION),
22237
+ mode: external_exports.literal("scoped")
22238
+ });
22239
+ var AttachedCredentialAny = external_exports.discriminatedUnion("specVersion", [
22240
+ AttachedCredentialV1,
22241
+ AttachedCredentialV2
22242
+ ]);
22995
22243
  var MAX_DATE_MS = 253402300799999;
22996
22244
  var MAX_INT4 = 2147483647;
22997
22245
  var StorePosturePack = external_exports.object({
@@ -23095,7 +22343,15 @@ var StorePostureSnapshot = external_exports.object({
23095
22343
  policyCounts: StorePosturePolicyCounts,
23096
22344
  // OPTIONAL, not nullable: a reporter that predates this member keeps
23097
22345
  // getting its 200 without a payload change.
23098
- plugin: StorePosturePlugin.optional()
22346
+ plugin: StorePosturePlugin.optional(),
22347
+ // OPTIONAL, and sent only by a scoped attachment, always as `scoped`. A
22348
+ // machine attachment omits it, so its body is byte for byte the one it
22349
+ // sent before this member existed. Absent therefore means machine-wide OR
22350
+ // a reporter older than this member, never "scoped". Both values parse, so
22351
+ // a sender that one day spells `machine` breaks no receiver; any other
22352
+ // value fails the whole snapshot, which is why the reporter sends a
22353
+ // constant and never the raw mode.
22354
+ attachmentMode: AttachmentMode.optional()
23099
22355
  }).meta({ id: "StorePostureSnapshot" });
23100
22356
  var CAPTURE_VERSION_PREFIX = "capture/";
23101
22357
  var RecordAuditEventRequest = AuditEventInput.extend({
@@ -23273,112 +22529,240 @@ var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
23273
22529
  var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
23274
22530
  var PublisherKind = external_exports.enum(["labs", "user", "org"]);
23275
22531
 
23276
- // ../../packages/schema/src/zod/rule.ts
23277
- var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
23278
- var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
23279
- var KeywordMatcher = external_exports.strictObject({
23280
- type: external_exports.literal("keyword"),
23281
- // An empty keyword matches at every position, yielding one zero-length span
23282
- // per character. Rejected here because a keyword that matches everything is
23283
- // never intentional.
23284
- keywords: external_exports.array(external_exports.string().min(1)).min(1),
23285
- caseSensitive: external_exports.boolean().default(false)
23286
- });
23287
- function isValidRegex(pattern, flags) {
23288
- try {
23289
- new RegExp(pattern, flags);
23290
- return true;
23291
- } catch {
23292
- return false;
23293
- }
23294
- }
23295
- function probeFlags(flags) {
23296
- return flags.replace(/[gy]/g, "");
23297
- }
23298
- function matchesEmptyString(pattern, flags) {
23299
- try {
23300
- const re = new RegExp(pattern, probeFlags(flags));
23301
- return re.exec("")?.[0].length === 0;
23302
- } catch {
23303
- return false;
23304
- }
23305
- }
23306
- function spansWholeMatch(captureGroup) {
23307
- return captureGroup === void 0 || captureGroup === 0;
23308
- }
23309
- function captureGroupCount(pattern, flags) {
23310
- try {
23311
- const probe = new RegExp(`${pattern}|`, probeFlags(flags));
23312
- const result = probe.exec("");
23313
- return result ? result.length - 1 : void 0;
23314
- } catch {
23315
- return void 0;
23316
- }
23317
- }
23318
- var MAX_PATTERN_LENGTH = 2e3;
23319
- var RegexMatcher = external_exports.strictObject({
23320
- type: external_exports.literal("regex"),
23321
- pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
23322
- flags: external_exports.string().default("gi"),
23323
- captureGroup: external_exports.number().int().nonnegative().optional()
23324
- }).refine((v) => isValidRegex(v.pattern, v.flags), {
23325
- message: "pattern/flags do not form a valid JavaScript regular expression",
23326
- path: ["pattern"]
23327
- }).refine((v) => !spansWholeMatch(v.captureGroup) || !matchesEmptyString(v.pattern, v.flags), {
23328
- message: 'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher \u2014 scope the quantifier to a captureGroup, or require at least one character',
23329
- path: ["pattern"]
23330
- }).superRefine((v, ctx) => {
23331
- if (v.captureGroup === void 0) return;
23332
- const groups = captureGroupCount(v.pattern, v.flags);
23333
- if (groups === void 0 || v.captureGroup <= groups) return;
23334
- ctx.addIssue({
23335
- code: "custom",
23336
- path: ["captureGroup"],
23337
- message: `captureGroup ${String(v.captureGroup)} is out of range \u2014 the pattern declares ${String(groups)} capture group(s), so valid values are 0-${String(groups)}. An out-of-range group never matches, which would make the rule silently never fire.`
23338
- });
23339
- });
23340
- var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher]).meta({ id: "Matcher" });
23341
- var MATCHER_TYPES = MatcherType.options;
23342
- var AppliesTo = external_exports.strictObject({
23343
- // Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
23344
- extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
23345
- }).meta({ id: "AppliesTo" });
23346
- var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
23347
- var PostValidatorRef = external_exports.union(
23348
- [
23349
- PostValidatorName,
23350
- external_exports.strictObject({
23351
- name: PostValidatorName,
23352
- config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
23353
- })
23354
- ],
23355
- {
23356
- // A union reports one collapsed issue for every way its arms can fail, so
23357
- // this has to describe the whole shape rather than just the name — it is
23358
- // what an author sees for a misspelled name AND for a stray key in the
23359
- // object form. The names come from the enum so the message cannot go
23360
- // stale. Without it Zod says only "Invalid input", which is precisely the
23361
- // no-feedback outcome this schema exists to remove.
23362
- error: () => `not a valid post-validator: use a bare name (${PostValidatorName.options.map((name) => JSON.stringify(name)).join(
23363
- " or "
23364
- )}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
23365
- }
23366
- ).meta({ id: "PostValidatorRef" });
23367
- var RequiresNearby = external_exports.strictObject({
23368
- // Each array, when present, must be non-empty and contain non-empty strings —
23369
- // an empty/blank criterion would either never fire or (for labels) match
23370
- // everything.
23371
- categories: external_exports.array(DetectionCategory).min(1).optional(),
23372
- ruleIds: external_exports.array(external_exports.string().min(1)).min(1).optional(),
23373
- labels: external_exports.array(external_exports.string().min(1)).min(1).optional(),
23374
- windowChars: external_exports.number().int().positive().default(160),
23375
- // Optional confidence bump applied when a gated match is corroborated. Capped
23376
- // small: it nudges confidence, it does not assert certainty.
23377
- confidenceBoost: external_exports.number().min(0).max(0.3).optional()
23378
- }).refine(
23379
- (v) => (v.categories?.length ?? 0) + (v.ruleIds?.length ?? 0) + (v.labels?.length ?? 0) > 0,
23380
- { message: "requiresNearby needs at least one of categories, ruleIds, or labels" }
23381
- ).meta({ id: "RequiresNearby" });
22532
+ // ../../packages/schema/src/zod/builtin-policy-id.ts
22533
+ var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
22534
+ var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
22535
+
22536
+ // ../../packages/schema/src/zod/event.ts
22537
+ var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
22538
+ var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
22539
+ var EventMetadata = external_exports.object({
22540
+ sessionId: external_exports.string().optional(),
22541
+ repo: external_exports.string().optional(),
22542
+ filePath: external_exports.string().optional(),
22543
+ // The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
22544
+ // set by the tool-scanning hooks. The tool NAME only — never the tool's
22545
+ // arguments or output, which can carry the very value a finding masked
22546
+ // (metadata is stored unredacted). Gives findings on non-file captures a
22547
+ // display location ("via Bash") when no filePath exists.
22548
+ toolName: external_exports.string().optional(),
22549
+ // Set (true) by the worktree scanner when the file is excluded by the
22550
+ // repo's .gitignore. Gitignored files ARE still scanned — local scratch and
22551
+ // generated code can leak real secrets — but the provenance is recorded so
22552
+ // policy/dashboards can treat those findings as informational rather than
22553
+ // blocking. Omitted (not false) for tracked files and non-scan events.
22554
+ gitignored: external_exports.boolean().optional(),
22555
+ // Set (true) ONLY when the event's `content` is the COMPLETE file at
22556
+ // capture time (a worktree scan reading from disk). Hook-captured edits
22557
+ // (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
22558
+ // this. The resolver-on-ingest keys its fixed-at-source dropout
22559
+ // diff on this marker: only a whole-file snapshot can prove a previously
22560
+ // open finding is gone; a fragment's absence proves nothing (the secret
22561
+ // may live outside the hunk). Omitted (not false) for fragments and
22562
+ // non-scan events, so pre-marker clients safely default to the
22563
+ // non-authoritative path.
22564
+ wholeFile: external_exports.boolean().optional(),
22565
+ model: external_exports.string().optional(),
22566
+ turnIndex: external_exports.number().int().nonnegative().optional(),
22567
+ // Distributed-tracing correlation. `correlationId` ties a recorded event back
22568
+ // to the request that captured/ingested it (a UUID, generated independently of
22569
+ // the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
22570
+ // originating span when telemetry is enabled. Both optional + backward
22571
+ // compatible — populated by the plugin (see @akasecurity/plugin-sdk).
22572
+ correlationId: external_exports.uuid().optional(),
22573
+ traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
22574
+ // Ids of the detection exceptions that downgraded findings in this capture
22575
+ // to 'allow' — the enforcement audit trail's link back to the grant that
22576
+ // authorized the bypass. Absent on captures where no exception applied.
22577
+ exceptionIds: external_exports.array(external_exports.guid()).optional(),
22578
+ // The assistant message this capture belongs to, and the conversation it sits
22579
+ // in — set by the browser extension's network capture so a stored `response`
22580
+ // row can be joined to the `llm_call` leaf describing the same turn. Absent
22581
+ // on every other capture path, which has no such id.
22582
+ //
22583
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
22584
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
22585
+ // places an event is PARSED; the local write path types the event and parses
22586
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
22587
+ messageId: external_exports.string().min(1).optional(),
22588
+ conversationId: external_exports.string().optional(),
22589
+ // How long THIS capture's inspection blocked its caller, in whole
22590
+ // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
22591
+ // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
22592
+ // detection + redaction, the work the host session actually waits on.
22593
+ //
22594
+ // Stamped ONLY on live in-flight captures. A capture that carries its own
22595
+ // `occurredAt` is replaying past work (the transcript backfill, the worktree
22596
+ // scan), and its scan duration is not latency any host session experienced,
22597
+ // so those rows leave this ABSENT rather than reporting a misleading number.
22598
+ // Absent is also what every pre-measurement client writes, and what a
22599
+ // clock failure degrades to — a reader must treat absence as "not measured"
22600
+ // and never as a zero, which would read as "inspection is free".
22601
+ inspectionMs: external_exports.number().int().nonnegative().optional(),
22602
+ // What a `redact` this capture COULD NOT CARRY OUT became instead — the
22603
+ // workspace's `redactFallback`, applied because the field could not be
22604
+ // masked in place (a shell command, a URL, or any argument on a host whose
22605
+ // hook contract offers no rewrite channel).
22606
+ //
22607
+ // It exists because the action alone cannot say why. A finding recorded as
22608
+ // `warn` reads identically whether its detection was ASSIGNED Warn or was
22609
+ // assigned Redact on a field that could not take one — and those are
22610
+ // different facts about the same row: the first is a policy the user chose,
22611
+ // the second is a masking the host could not perform. Absent means no
22612
+ // degrade happened, which is every ordinary capture.
22613
+ //
22614
+ // TWO LIMITS a reader of a stored row has to know, because the grain here
22615
+ // is the CAPTURE while `actionTaken` is per FINDING:
22616
+ //
22617
+ // - It does not say WHICH finding degraded. A capture carrying a degraded
22618
+ // `redact` alongside a finding ASSIGNED the same action stores both
22619
+ // identically and one reason for the pair; attributing it to both
22620
+ // describes the assigned one wrongly, and to neither loses the degrade.
22621
+ // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
22622
+ // became, not the reason the capture ended as it did — a capture denied
22623
+ // by some other finding's own Block policy still carries `block` here,
22624
+ // and clearing the workspace's fallback would not have let it through.
22625
+ // Gate on the value against what a fallback can produce; never read the
22626
+ // field's presence as "this was the fallback's doing".
22627
+ //
22628
+ // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
22629
+ // Closing either means moving the reason onto the finding row, which
22630
+ // already carries its own action.
22631
+ redactDegradedTo: ActionTaken.optional()
22632
+ }).meta({ id: "EventMetadata" });
22633
+ var Event = external_exports.object({
22634
+ id: external_exports.guid(),
22635
+ sourceTool: SourceTool,
22636
+ kind: EventKind,
22637
+ occurredAt: external_exports.iso.datetime(),
22638
+ contentHash: external_exports.string(),
22639
+ content: external_exports.string(),
22640
+ metadata: EventMetadata.optional()
22641
+ }).meta({ id: "Event" });
22642
+ var IngestEvent = Event.meta({ id: "IngestEvent" });
22643
+ var INGEST_BATCH_MAX = 100;
22644
+ var IngestBatch = external_exports.object({
22645
+ events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
22646
+ // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
22647
+ // additionally rejects any event whose contentHash the store has already
22648
+ // recorded — for re-runnable bulk ingest (worktree scan, transcript
22649
+ // backfill), where a re-run mints fresh event ids for identical content and
22650
+ // would otherwise accumulate duplicates. Live hook traffic must NOT set it:
22651
+ // two genuinely separate prompts can be byte-identical and both belong on
22652
+ // the timeline.
22653
+ dedupe: external_exports.literal("content-hash").optional()
22654
+ }).meta({ id: "IngestBatch" });
22655
+
22656
+ // ../../packages/schema/src/zod/rule.ts
22657
+ var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
22658
+ var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
22659
+ var KeywordMatcher = external_exports.strictObject({
22660
+ type: external_exports.literal("keyword"),
22661
+ // An empty keyword matches at every position, yielding one zero-length span
22662
+ // per character. Rejected here because a keyword that matches everything is
22663
+ // never intentional.
22664
+ keywords: external_exports.array(external_exports.string().min(1)).min(1),
22665
+ caseSensitive: external_exports.boolean().default(false)
22666
+ });
22667
+ function isValidRegex(pattern, flags) {
22668
+ try {
22669
+ new RegExp(pattern, flags);
22670
+ return true;
22671
+ } catch {
22672
+ return false;
22673
+ }
22674
+ }
22675
+ function probeFlags(flags) {
22676
+ return flags.replace(/[gy]/g, "");
22677
+ }
22678
+ function matchesEmptyString(pattern, flags) {
22679
+ try {
22680
+ const re = new RegExp(pattern, probeFlags(flags));
22681
+ return re.exec("")?.[0].length === 0;
22682
+ } catch {
22683
+ return false;
22684
+ }
22685
+ }
22686
+ function spansWholeMatch(captureGroup) {
22687
+ return captureGroup === void 0 || captureGroup === 0;
22688
+ }
22689
+ function captureGroupCount(pattern, flags) {
22690
+ try {
22691
+ const probe = new RegExp(`${pattern}|`, probeFlags(flags));
22692
+ const result = probe.exec("");
22693
+ return result ? result.length - 1 : void 0;
22694
+ } catch {
22695
+ return void 0;
22696
+ }
22697
+ }
22698
+ var MAX_PATTERN_LENGTH = 2e3;
22699
+ var RegexMatcher = external_exports.strictObject({
22700
+ type: external_exports.literal("regex"),
22701
+ pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
22702
+ flags: external_exports.string().default("gi"),
22703
+ captureGroup: external_exports.number().int().nonnegative().optional()
22704
+ }).refine((v) => isValidRegex(v.pattern, v.flags), {
22705
+ message: "pattern/flags do not form a valid JavaScript regular expression",
22706
+ path: ["pattern"]
22707
+ }).refine((v) => !spansWholeMatch(v.captureGroup) || !matchesEmptyString(v.pattern, v.flags), {
22708
+ message: 'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher \u2014 scope the quantifier to a captureGroup, or require at least one character',
22709
+ path: ["pattern"]
22710
+ }).superRefine((v, ctx) => {
22711
+ if (v.captureGroup === void 0) return;
22712
+ const groups = captureGroupCount(v.pattern, v.flags);
22713
+ if (groups === void 0 || v.captureGroup <= groups) return;
22714
+ ctx.addIssue({
22715
+ code: "custom",
22716
+ path: ["captureGroup"],
22717
+ message: `captureGroup ${String(v.captureGroup)} is out of range \u2014 the pattern declares ${String(groups)} capture group(s), so valid values are 0-${String(groups)}. An out-of-range group never matches, which would make the rule silently never fire.`
22718
+ });
22719
+ });
22720
+ var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher]).meta({ id: "Matcher" });
22721
+ var MATCHER_TYPES = MatcherType.options;
22722
+ var AppliesTo = external_exports.strictObject({
22723
+ // Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
22724
+ extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1).optional(),
22725
+ eventKinds: external_exports.array(EventKind).min(1).optional()
22726
+ }).refine((v) => v.extensions !== void 0 || v.eventKinds !== void 0, {
22727
+ message: "appliesTo needs extensions, eventKinds, or both"
22728
+ }).meta({ id: "AppliesTo" });
22729
+ var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
22730
+ var PostValidatorRef = external_exports.union(
22731
+ [
22732
+ PostValidatorName,
22733
+ external_exports.strictObject({
22734
+ name: PostValidatorName,
22735
+ config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
22736
+ })
22737
+ ],
22738
+ {
22739
+ // A union reports one collapsed issue for every way its arms can fail, so
22740
+ // this has to describe the whole shape rather than just the name — it is
22741
+ // what an author sees for a misspelled name AND for a stray key in the
22742
+ // object form. The names come from the enum so the message cannot go
22743
+ // stale. Without it Zod says only "Invalid input", which is precisely the
22744
+ // no-feedback outcome this schema exists to remove.
22745
+ error: () => `not a valid post-validator: use a bare name (${PostValidatorName.options.map((name) => JSON.stringify(name)).join(
22746
+ " or "
22747
+ )}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
22748
+ }
22749
+ ).meta({ id: "PostValidatorRef" });
22750
+ var RuleEvidence = external_exports.enum(["code", "value"]).meta({ id: "RuleEvidence" });
22751
+ var RequiresNearby = external_exports.strictObject({
22752
+ // Each array, when present, must be non-empty and contain non-empty strings —
22753
+ // an empty/blank criterion would either never fire or (for labels) match
22754
+ // everything.
22755
+ categories: external_exports.array(DetectionCategory).min(1).optional(),
22756
+ ruleIds: external_exports.array(external_exports.string().min(1)).min(1).optional(),
22757
+ labels: external_exports.array(external_exports.string().min(1)).min(1).optional(),
22758
+ windowChars: external_exports.number().int().positive().default(160),
22759
+ // Optional confidence bump applied when a gated match is corroborated. Capped
22760
+ // small: it nudges confidence, it does not assert certainty.
22761
+ confidenceBoost: external_exports.number().min(0).max(0.3).optional()
22762
+ }).refine(
22763
+ (v) => (v.categories?.length ?? 0) + (v.ruleIds?.length ?? 0) + (v.labels?.length ?? 0) > 0,
22764
+ { message: "requiresNearby needs at least one of categories, ruleIds, or labels" }
22765
+ ).meta({ id: "RequiresNearby" });
23382
22766
  var RuleFixture = external_exports.strictObject({
23383
22767
  label: external_exports.string(),
23384
22768
  text: external_exports.string().max(5e4),
@@ -23386,6 +22770,8 @@ var RuleFixture = external_exports.strictObject({
23386
22770
  // Simulated file context for the scan, so fixtures can assert `appliesTo`
23387
22771
  // gating (e.g. a Python-only pattern must NOT fire in a .ts file).
23388
22772
  filePath: external_exports.string().optional(),
22773
+ // Simulated capture kind, so fixtures can assert `appliesTo.eventKinds`.
22774
+ eventKind: EventKind.optional(),
23389
22775
  expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
23390
22776
  }).meta({ id: "RuleFixture" });
23391
22777
  var Rule = external_exports.strictObject({
@@ -23411,7 +22797,9 @@ var Rule = external_exports.strictObject({
23411
22797
  appliesTo: AppliesTo.optional(),
23412
22798
  postValidators: external_exports.array(PostValidatorRef).optional(),
23413
22799
  requiresNearby: RequiresNearby.optional(),
23414
- examples: external_exports.array(external_exports.string()).optional()
22800
+ examples: external_exports.array(external_exports.string()).optional(),
22801
+ // Whether the matched text is itself sensitive (see RuleEvidence).
22802
+ evidence: RuleEvidence.optional()
23415
22803
  }).meta({ id: "Rule" });
23416
22804
  var Author = external_exports.object({
23417
22805
  name: external_exports.string(),
@@ -23428,7 +22816,11 @@ var PackManifest = external_exports.object({
23428
22816
  description: external_exports.string().optional(),
23429
22817
  author: Author.optional(),
23430
22818
  license: external_exports.string().optional(),
23431
- sourceUrl: external_exports.url().optional()
22819
+ sourceUrl: external_exports.url().optional(),
22820
+ // The built-in policy a FIRST install of this pack assigns
22821
+ // (installed_packs.policy_id). Absent leaves the pack unassigned, so its
22822
+ // rules follow the category policies. An existing install never takes it.
22823
+ defaultPolicy: BuiltinPolicyId.optional()
23432
22824
  }).meta({ id: "PackManifest" });
23433
22825
 
23434
22826
  // ../../packages/schema/src/zod/detection.ts
@@ -23456,10 +22848,12 @@ var DetectionListItem = external_exports.object({
23456
22848
  // Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
23457
22849
  // (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
23458
22850
  // detection is a PACK, and its policy is the archetype applied to all its
23459
- // rules. Absent == unassigned, which resolves to Monitor everywhere
23460
- // (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
23461
- // per-rule policies (see policyIdToAction). Typed z.string() (not
23462
- // the enum) to keep the OpenAPI response tolerant of a future custom id.
22851
+ // rules. Absent == unassigned, which resolves to Monitor by default
22852
+ // (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
22853
+ // (see the dashboard's `unassignedPolicy`). Every enforcement surface
22854
+ // expands it into per-rule policies (see policyIdToAction). Typed
22855
+ // z.string() (not the enum) to keep the OpenAPI response tolerant of a
22856
+ // future custom id.
23463
22857
  policyId: external_exports.string().optional(),
23464
22858
  // Set ONLY when a newer snapshot is available for this pack (OSS: the
23465
22859
  // bundled inventory recorded in available_packs differs from the installed
@@ -23496,7 +22890,13 @@ var DetectionRule = external_exports.object({
23496
22890
  // Representative matching strings the rule author shipped with the rule. The
23497
22891
  // cheapest honest answer to "show me what this rule catches" — every bundled
23498
22892
  // rule has them, and they are already in the stored snapshot.
23499
- examples: external_exports.array(external_exports.string()).optional()
22893
+ examples: external_exports.array(external_exports.string()).optional(),
22894
+ // The rule's DECLARED evidence, as stored. Absent defers to the engine's
22895
+ // classification (ruleEvidence in @akasecurity/detections): a bundled
22896
+ // code-flaw rule reads as 'code' and anything else as 'value', and a rule
22897
+ // in a value category (secret/pii/financial/phi) is always 'value',
22898
+ // whatever it declares.
22899
+ evidence: RuleEvidence.optional()
23500
22900
  }).meta({ id: "DetectionRule" });
23501
22901
  var DetectionUpdate = external_exports.object({
23502
22902
  available: external_exports.boolean(),
@@ -23528,10 +22928,12 @@ var DetectionDetail = external_exports.object({
23528
22928
  // Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
23529
22929
  // (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
23530
22930
  // detection is a PACK, and its policy is the archetype applied to all its
23531
- // rules. Absent == unassigned, which resolves to Monitor everywhere
23532
- // (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
23533
- // per-rule policies (see policyIdToAction). Typed z.string() (not
23534
- // the enum) to keep the OpenAPI response tolerant of a future custom id.
22931
+ // rules. Absent == unassigned, which resolves to Monitor by default
22932
+ // (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
22933
+ // (see the dashboard's `unassignedPolicy`). Every enforcement surface
22934
+ // expands it into per-rule policies (see policyIdToAction). Typed
22935
+ // z.string() (not the enum) to keep the OpenAPI response tolerant of a
22936
+ // future custom id.
23535
22937
  policyId: external_exports.string().optional()
23536
22938
  }).meta({ id: "DetectionDetail" });
23537
22939
  var LibraryItem = external_exports.object({
@@ -23549,137 +22951,17 @@ var LibraryItem = external_exports.object({
23549
22951
  description: external_exports.string().optional(),
23550
22952
  updatedAt: external_exports.iso.datetime(),
23551
22953
  state: LibraryStateEnum,
23552
- importedAs: external_exports.string().nullable()
23553
- }).meta({ id: "LibraryItem" });
23554
- var ListLibraryResponse = external_exports.object({
23555
- categories: external_exports.array(DetectionCategory),
23556
- items: external_exports.array(LibraryItem)
23557
- }).meta({ id: "ListLibraryResponse" });
23558
- var ImportDetectionRequest = external_exports.object({
23559
- libraryId: external_exports.string().refine((v) => /^[^/]+\/[^/]+$/.test(v), {
23560
- message: "libraryId must be in namespace/packId format"
23561
- })
23562
- }).meta({ id: "ImportDetectionRequest" });
23563
-
23564
- // ../../packages/schema/src/zod/event.ts
23565
- var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
23566
- var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
23567
- var EventMetadata = external_exports.object({
23568
- sessionId: external_exports.string().optional(),
23569
- repo: external_exports.string().optional(),
23570
- filePath: external_exports.string().optional(),
23571
- // The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
23572
- // set by the tool-scanning hooks. The tool NAME only — never the tool's
23573
- // arguments or output, which can carry the very value a finding masked
23574
- // (metadata is stored unredacted). Gives findings on non-file captures a
23575
- // display location ("via Bash") when no filePath exists.
23576
- toolName: external_exports.string().optional(),
23577
- // Set (true) by the worktree scanner when the file is excluded by the
23578
- // repo's .gitignore. Gitignored files ARE still scanned — local scratch and
23579
- // generated code can leak real secrets — but the provenance is recorded so
23580
- // policy/dashboards can treat those findings as informational rather than
23581
- // blocking. Omitted (not false) for tracked files and non-scan events.
23582
- gitignored: external_exports.boolean().optional(),
23583
- // Set (true) ONLY when the event's `content` is the COMPLETE file at
23584
- // capture time (a worktree scan reading from disk). Hook-captured edits
23585
- // (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
23586
- // this. The resolver-on-ingest keys its fixed-at-source dropout
23587
- // diff on this marker: only a whole-file snapshot can prove a previously
23588
- // open finding is gone; a fragment's absence proves nothing (the secret
23589
- // may live outside the hunk). Omitted (not false) for fragments and
23590
- // non-scan events, so pre-marker clients safely default to the
23591
- // non-authoritative path.
23592
- wholeFile: external_exports.boolean().optional(),
23593
- model: external_exports.string().optional(),
23594
- turnIndex: external_exports.number().int().nonnegative().optional(),
23595
- // Distributed-tracing correlation. `correlationId` ties a recorded event back
23596
- // to the request that captured/ingested it (a UUID, generated independently of
23597
- // the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
23598
- // originating span when telemetry is enabled. Both optional + backward
23599
- // compatible — populated by the plugin (see @akasecurity/plugin-sdk).
23600
- correlationId: external_exports.uuid().optional(),
23601
- traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
23602
- // Ids of the detection exceptions that downgraded findings in this capture
23603
- // to 'allow' — the enforcement audit trail's link back to the grant that
23604
- // authorized the bypass. Absent on captures where no exception applied.
23605
- exceptionIds: external_exports.array(external_exports.guid()).optional(),
23606
- // The assistant message this capture belongs to, and the conversation it sits
23607
- // in — set by the browser extension's network capture so a stored `response`
23608
- // row can be joined to the `llm_call` leaf describing the same turn. Absent
23609
- // on every other capture path, which has no such id.
23610
- //
23611
- // Non-empty for the reason WebExchange.messageId is: it is the join key, and
23612
- // a blank one matches no `llm_call` leaf. That refusal reaches only the
23613
- // places an event is PARSED; the local write path types the event and parses
23614
- // nothing, which is why `toCaptureAttributes` omits a blank one separately.
23615
- messageId: external_exports.string().min(1).optional(),
23616
- conversationId: external_exports.string().optional(),
23617
- // How long THIS capture's inspection blocked its caller, in whole
23618
- // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
23619
- // front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
23620
- // detection + redaction, the work the host session actually waits on.
23621
- //
23622
- // Stamped ONLY on live in-flight captures. A capture that carries its own
23623
- // `occurredAt` is replaying past work (the transcript backfill, the worktree
23624
- // scan), and its scan duration is not latency any host session experienced,
23625
- // so those rows leave this ABSENT rather than reporting a misleading number.
23626
- // Absent is also what every pre-measurement client writes, and what a
23627
- // clock failure degrades to — a reader must treat absence as "not measured"
23628
- // and never as a zero, which would read as "inspection is free".
23629
- inspectionMs: external_exports.number().int().nonnegative().optional(),
23630
- // What a `redact` this capture COULD NOT CARRY OUT became instead — the
23631
- // workspace's `redactFallback`, applied because the field could not be
23632
- // masked in place (a shell command, a URL, or any argument on a host whose
23633
- // hook contract offers no rewrite channel).
23634
- //
23635
- // It exists because the action alone cannot say why. A finding recorded as
23636
- // `warn` reads identically whether its detection was ASSIGNED Warn or was
23637
- // assigned Redact on a field that could not take one — and those are
23638
- // different facts about the same row: the first is a policy the user chose,
23639
- // the second is a masking the host could not perform. Absent means no
23640
- // degrade happened, which is every ordinary capture.
23641
- //
23642
- // TWO LIMITS a reader of a stored row has to know, because the grain here
23643
- // is the CAPTURE while `actionTaken` is per FINDING:
23644
- //
23645
- // - It does not say WHICH finding degraded. A capture carrying a degraded
23646
- // `redact` alongside a finding ASSIGNED the same action stores both
23647
- // identically and one reason for the pair; attributing it to both
23648
- // describes the assigned one wrongly, and to neither loses the degrade.
23649
- // - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
23650
- // became, not the reason the capture ended as it did — a capture denied
23651
- // by some other finding's own Block policy still carries `block` here,
23652
- // and clearing the workspace's fallback would not have let it through.
23653
- // Gate on the value against what a fallback can produce; never read the
23654
- // field's presence as "this was the fallback's doing".
23655
- //
23656
- // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
23657
- // Closing either means moving the reason onto the finding row, which
23658
- // already carries its own action.
23659
- redactDegradedTo: ActionTaken.optional()
23660
- }).meta({ id: "EventMetadata" });
23661
- var Event = external_exports.object({
23662
- id: external_exports.guid(),
23663
- sourceTool: SourceTool,
23664
- kind: EventKind,
23665
- occurredAt: external_exports.iso.datetime(),
23666
- contentHash: external_exports.string(),
23667
- content: external_exports.string(),
23668
- metadata: EventMetadata.optional()
23669
- }).meta({ id: "Event" });
23670
- var IngestEvent = Event.meta({ id: "IngestEvent" });
23671
- var INGEST_BATCH_MAX = 100;
23672
- var IngestBatch = external_exports.object({
23673
- events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
23674
- // Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
23675
- // additionally rejects any event whose contentHash the store has already
23676
- // recorded — for re-runnable bulk ingest (worktree scan, transcript
23677
- // backfill), where a re-run mints fresh event ids for identical content and
23678
- // would otherwise accumulate duplicates. Live hook traffic must NOT set it:
23679
- // two genuinely separate prompts can be byte-identical and both belong on
23680
- // the timeline.
23681
- dedupe: external_exports.literal("content-hash").optional()
23682
- }).meta({ id: "IngestBatch" });
22954
+ importedAs: external_exports.string().nullable()
22955
+ }).meta({ id: "LibraryItem" });
22956
+ var ListLibraryResponse = external_exports.object({
22957
+ categories: external_exports.array(DetectionCategory),
22958
+ items: external_exports.array(LibraryItem)
22959
+ }).meta({ id: "ListLibraryResponse" });
22960
+ var ImportDetectionRequest = external_exports.object({
22961
+ libraryId: external_exports.string().refine((v) => /^[^/]+\/[^/]+$/.test(v), {
22962
+ message: "libraryId must be in namespace/packId format"
22963
+ })
22964
+ }).meta({ id: "ImportDetectionRequest" });
23683
22965
 
23684
22966
  // ../../packages/schema/src/zod/exception.ts
23685
22967
  var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
@@ -23841,8 +23123,6 @@ var Policy = external_exports.object({
23841
23123
  // test `prohibitedModels` passes and `reversibleRuleIds` fails.
23842
23124
  provenance: PolicyProvenance.optional()
23843
23125
  }).meta({ id: "Policy" });
23844
- var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
23845
- var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
23846
23126
  var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
23847
23127
  id: "RedactFallback"
23848
23128
  });
@@ -23882,11 +23162,14 @@ var PolicyBundle = external_exports.object({
23882
23162
  ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
23883
23163
  // Model ids (the raw `model` string a harness reports, e.g.
23884
23164
  // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
23885
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
23886
- // one (UserPromptSubmit). Optional so an older backend — and an older
23887
- // on-disk cache — still parses; consumers read `?? []`, which is the
23888
- // unenforced behaviour that predates this field and the safe direction to
23889
- // default.
23165
+ // a session onto one (PreModelSwitch), refuses a turn that would run on one
23166
+ // (UserPromptSubmit) and refuses a subagent spawn onto one (PreToolUse),
23167
+ // wherever the organization governs the event: everywhere on a
23168
+ // machine-wide attachment, and only in enrolled repositories on a scoped
23169
+ // one (the plugin runtime's `governanceApplies`).
23170
+ // Optional so an older backend — and an older on-disk cache — still
23171
+ // parses; consumers read `?? []`, which is the unenforced behaviour that
23172
+ // predates this field and the safe direction to default.
23890
23173
  //
23891
23174
  // Ids, not display names: the governance decision is keyed on the exact
23892
23175
  // string the harness reports (`model_status_override.versionId` in the
@@ -24198,7 +23481,7 @@ var VaultConsent = external_exports.object({
24198
23481
  });
24199
23482
 
24200
23483
  // ../../packages/schema/src/zod/local.ts
24201
- var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
23484
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 9;
24202
23485
  var RunMode = external_exports.enum(["standalone", "attached"]);
24203
23486
  var ControlPlaneConnection = external_exports.object({
24204
23487
  endpoint: external_exports.string().min(1),
@@ -24217,6 +23500,20 @@ var HistorySyncConsent = external_exports.object({
24217
23500
  payloadVersion: external_exports.number().int().positive(),
24218
23501
  endpoint: external_exports.string()
24219
23502
  });
23503
+ var ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH = 512;
23504
+ var AttachmentScopeEntry = external_exports.object({
23505
+ kind: external_exports.enum(["repo", "account"]),
23506
+ identity: printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH).min(1),
23507
+ label: printable(80).optional(),
23508
+ enrolledAt: external_exports.iso.datetime()
23509
+ });
23510
+ var AttachmentScope = external_exports.object({
23511
+ endpoint: external_exports.string().min(1),
23512
+ tenantName: PluginWhoami.shape.tenantName.optional(),
23513
+ userEmail: PluginWhoami.shape.userEmail.optional(),
23514
+ entries: external_exports.array(AttachmentScopeEntry)
23515
+ });
23516
+ var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
24220
23517
  var WebChatCaptureConsent = external_exports.object({
24221
23518
  acknowledgedAt: external_exports.iso.datetime(),
24222
23519
  version: external_exports.number().int().positive()
@@ -24287,6 +23584,23 @@ var WorkspaceSettings = external_exports.object({
24287
23584
  // both widenings. Absent until granted, and a grant for a different endpoint
24288
23585
  // or an older payload no longer counts.
24289
23586
  historySyncConsent: HistorySyncConsent.optional(),
23587
+ // The identities a SCOPED attachment forwards and the deployment they were
23588
+ // enrolled for (see AttachmentScope). Absent until something is enrolled.
23589
+ //
23590
+ // `z.unknown()`, NOT `AttachmentScope`, and the difference is this field's
23591
+ // whole failure mode. A settings.json that fails this schema reads as the
23592
+ // unonboarded defaults (readUserSettings in @akasecurity/persistence), and the
23593
+ // next save writes those defaults back over it. Typed, one entry with an
23594
+ // unknown `kind`, a control character or a bad timestamp would cost the
23595
+ // attachment, every consent and onboardedAt, permanently. Untyped, the value
23596
+ // is kept exactly as found and validated where it is used: parseAttachmentScope
23597
+ // drops a bad entry by itself, and on a scoped attachment resolveScope reads a
23598
+ // bad envelope as no entries, which keeps every event local.
23599
+ //
23600
+ // No default: absent must stay absent, so defaultWorkspaceSettings() and a
23601
+ // fresh settings.json do not change. No `.meta({ id })`, like every field
23602
+ // here. Not a ManagedSettingKey.
23603
+ attachmentScope: external_exports.unknown().optional(),
24290
23604
  // What the browser extension may record from a web chat, and the grant that
24291
23605
  // authorizes it. Absent until the user answers: recording something that was
24292
23606
  // never recorded before is never an assumed grant on upgrade, so the whole
@@ -24405,6 +23719,27 @@ var ManagedSettings = external_exports.object({
24405
23719
  };
24406
23720
  }).meta({ id: "ManagedSettings" });
24407
23721
 
23722
+ // ../../packages/schema/src/zod/mod-policy-snapshot.ts
23723
+ var MOD_POLICY_SNAPSHOT_VERSION = 1;
23724
+ var MOD_POLICY_SNAPSHOT_MAX_BYTES = 4 * 1024 * 1024;
23725
+ var ModPolicySnapshot = external_exports.object({
23726
+ version: external_exports.literal(MOD_POLICY_SNAPSHOT_VERSION),
23727
+ generatedAt: external_exports.iso.datetime(),
23728
+ // The complete effective ruleset, as the hook's runtime scans with it: the
23729
+ // user's enabled installed packs (user-modified and custom packs included).
23730
+ // Absent means the store holds no authoritative snapshot, and the reader
23731
+ // scans with the packs it ships — the hook's own fallback.
23732
+ rules: external_exports.array(Rule).optional(),
23733
+ // Rule-targeted actions (first enabled policy per rule wins).
23734
+ ruleActions: external_exports.record(external_exports.string(), ActionTaken),
23735
+ // The resolved action per detection category.
23736
+ categoryActions: external_exports.record(external_exports.string(), ActionTaken),
23737
+ // Rules with an active exception grant. Honouring a grant means matching a
23738
+ // keyed fingerprint of the value and consuming a use, which only the hook can
23739
+ // do, so the mod leaves a finding of one of these rules for the hook to decide.
23740
+ exceptionRuleIds: external_exports.array(external_exports.string())
23741
+ }).meta({ id: "ModPolicySnapshot" });
23742
+
24408
23743
  // ../../packages/schema/src/zod/project-files.ts
24409
23744
  var ProjectFileInput = external_exports.object({
24410
23745
  path: external_exports.string().min(1),
@@ -24719,7 +24054,16 @@ var AttachInput = external_exports.object({
24719
24054
  // 200 matches the tenantName bound beside it in control-plane.ts; nothing
24720
24055
  // renders a longer one usefully.
24721
24056
  label: printable(200).optional(),
24722
- accessKey: external_exports.string()
24057
+ accessKey: external_exports.string(),
24058
+ // How much of this machine the attachment is for: everything, or only the
24059
+ // repositories its user enrolls. Optional, so an input without it still
24060
+ // parses; what an absent mode means is for whatever reads it to decide, not
24061
+ // this shape. This member validates the VALUE rather than leaving that to the
24062
+ // call site, a deliberate exception to this module's shape-only rule: a shape
24063
+ // rejection names the field, so a value that is not a mode is refused as a bad
24064
+ // `mode` rather than stripped or passed on. The dashboard's attach action reads
24065
+ // it as the mode to attach in.
24066
+ mode: AttachmentMode.optional()
24723
24067
  });
24724
24068
 
24725
24069
  // ../../packages/schema/src/zod/triage.ts
@@ -24932,1261 +24276,9 @@ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
24932
24276
  var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
24933
24277
  var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
24934
24278
 
24935
- // ../../packages/persistence/src/paths.ts
24936
- import {
24937
- chmodSync,
24938
- linkSync,
24939
- lstatSync,
24940
- mkdirSync,
24941
- renameSync,
24942
- rmSync as rmSync2,
24943
- writeFileSync
24944
- } from "fs";
24945
- import { threadId } from "worker_threads";
24946
-
24947
- // ../../packages/persistence/src/database.ts
24948
- import { randomUUID as randomUUID11 } from "crypto";
24949
- import { dirname as dirname2, join as join7, sep } from "path";
24950
- import { DatabaseSync } from "node:sqlite";
24951
-
24952
- // ../../packages/persistence/src/ids.ts
24953
- import { createHash } from "crypto";
24954
-
24955
- // ../../packages/persistence/src/internal/snapshot.ts
24956
- import { randomUUID } from "crypto";
24957
- import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync4, statSync as statSync2 } from "fs";
24958
- import { basename, dirname, join as join3 } from "path";
24959
- var STALE_PARTIAL_MS = 5 * 6e4;
24960
- var SNAPSHOT_STAGING_SUFFIX = ".partial";
24961
- var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
24962
-
24963
- // ../../packages/persistence/src/internal/sql-functions.ts
24964
- var utf8 = new TextDecoder();
24965
-
24966
- // ../../packages/persistence/src/internal/outbox-lane.ts
24967
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
24968
- var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
24969
-
24970
- // ../../packages/persistence/src/sync-failure.ts
24971
- var SYNC_FAILURE_REASONS = SyncFailureReason.options;
24972
-
24973
- // ../../packages/persistence/src/repositories/history-sync.ts
24974
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
24975
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
24976
- var COUNTED_EVENT_TYPES = [
24977
- ...STRUCTURAL_EVENT_TYPES,
24978
- ...OUTBOX_CAPTURE_EVENT_TYPES
24979
- ];
24980
- var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
24981
- var COUNTED_SCOPE = `
24982
- WHERE event_type IN (${COUNTED_TYPE_LIST})
24983
- AND (
24984
- event_type IN (${TYPE_LIST})
24985
- OR synced_at IS NOT NULL
24986
- OR outbox_owed = 1
24987
- )`;
24988
-
24989
- // ../../packages/persistence/src/repositories/activity.ts
24990
- var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
24991
- var DB_EVENT_TYPE_TO_KIND = {
24992
- session: "session",
24993
- prompt: "prompt",
24994
- response: "response",
24995
- tool_call: "tool",
24996
- hook: "hook",
24997
- detection: "detection",
24998
- share: "share",
24999
- permission: "permission",
25000
- commit: "commit",
25001
- error: "error",
25002
- active: "active"
25003
- };
25004
- var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
25005
- var DEFAULT_HARNESS = HARNESS.ClaudeCode;
25006
-
25007
- // ../../packages/persistence/src/repositories/exceptions.ts
25008
- import { randomUUID as randomUUID2 } from "crypto";
25009
- var BLOCKED_DETECTIONS_TTL_MS = 30 * 60 * 1e3;
25010
- var BLOCKED_DETECTIONS_RETENTION_MS = 24 * 60 * 60 * 1e3;
25011
- var ACTIVE_PREDICATE = `revoked_at IS NULL
25012
- AND (expires_at IS NULL OR expires_at > :now)
25013
- AND (max_uses IS NULL OR use_count < max_uses)`;
25014
- var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
25015
- AND conditions IS NULL
25016
- AND ${ACTIVE_PREDICATE}`;
25017
-
25018
- // ../../packages/persistence/src/repositories/resolution-sql.ts
25019
- function latestResolutionColumnSql(column, findingsAlias) {
25020
- return `(
25021
- SELECT fr.${column} FROM finding_resolution fr
25022
- WHERE fr.finding_key = ${findingsAlias}.finding_key
25023
- ORDER BY fr.created_at DESC, fr.rowid DESC
25024
- LIMIT 1
25025
- )`;
25026
- }
25027
- function latestResolutionStatusSql(findingsAlias) {
25028
- return latestResolutionColumnSql("status", findingsAlias);
25029
- }
25030
- var LATEST_RESOLUTION_BY_KEY_SQL = `(
25031
- SELECT finding_key, status, method, resolved_at FROM (
25032
- SELECT fr.finding_key, fr.status, fr.method, fr.resolved_at,
25033
- ROW_NUMBER() OVER (
25034
- PARTITION BY fr.finding_key
25035
- ORDER BY fr.created_at DESC, fr.rowid DESC
25036
- ) AS rn
25037
- FROM finding_resolution fr
25038
- ) WHERE rn = 1
25039
- )`;
25040
-
25041
- // ../../packages/persistence/src/repositories/findings.ts
25042
- var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
25043
- d.severity AS severity, f.masked_match AS masked_match,
25044
- f.action_taken AS action_taken, f.confidence AS confidence,
25045
- e.started_at AS occurred_at,
25046
- e.source_tool AS source_tool,
25047
- e.repo AS repo,
25048
- e.file_path AS file,
25049
- e.tool_name AS tool_name,
25050
- f.audit_event_id AS event_id, e.root_session_id AS session_id,
25051
- e.event_type AS kind, f.finding_key AS finding_key,
25052
- ${latestResolutionStatusSql("f")} AS latest_status,
25053
- e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
25054
- e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
25055
- e.outbox_owed AS outbox_owed`;
25056
-
25057
- // ../../packages/persistence/src/repositories/installed-packs.ts
25058
- import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
25059
-
25060
- // ../../packages/persistence/src/policy-floor.ts
25061
- import { readFileSync as readFileSync5 } from "fs";
25062
- import { join as join6 } from "path";
25063
-
25064
- // ../../packages/persistence/src/local-layout.ts
25065
- import { renameSync as renameSync3 } from "fs";
25066
- import { mkdir } from "fs/promises";
25067
- import { homedir } from "os";
25068
- import { join as join4 } from "path";
25069
-
25070
- // ../../packages/persistence/src/settings.ts
25071
- import { readFileSync as readFileSync4 } from "fs";
25072
- import { join as join5 } from "path";
25073
-
25074
- // ../../packages/persistence/src/file-lock.ts
25075
- import { randomUUID as randomUUID3 } from "crypto";
25076
- import {
25077
- closeSync,
25078
- existsSync as existsSync2,
25079
- openSync,
25080
- readFileSync as readFileSync2,
25081
- rmSync as rmSync5,
25082
- statSync as statSync3,
25083
- writeFileSync as writeFileSync2
25084
- } from "fs";
25085
- import { hostname as hostname3 } from "os";
25086
- var PARK = new Int32Array(new SharedArrayBuffer(4));
25087
-
25088
- // ../../packages/persistence/src/managed-settings.ts
25089
- import { readFileSync as readFileSync3 } from "fs";
25090
- import { posix, win32 } from "path";
25091
-
25092
- // ../../packages/persistence/src/repositories/inventory-assets.ts
25093
- import { randomUUID as randomUUID5 } from "crypto";
25094
- var VALID_HARNESS_IDS = new Set(HarnessId.options);
25095
- var HARNESS_LABELS = {
25096
- [HARNESS.ClaudeCode]: "Claude Code",
25097
- [HARNESS.Cursor]: "Cursor",
25098
- [HARNESS.Codex]: "Codex",
25099
- [HARNESS.Antigravity]: "Antigravity",
25100
- [HARNESS.Copilot]: "GitHub Copilot"
25101
- };
25102
- var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
25103
- var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
25104
- var TITLE_NEEDLES = {
25105
- ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
25106
- Cursor: stripSeparators(SOURCE_TOOL.Cursor),
25107
- Codex: stripSeparators(SOURCE_TOOL.Codex),
25108
- Antigravity: stripSeparators(SOURCE_TOOL.Antigravity),
25109
- // 'githubcopilot', not 'copilot'. The needle is the stripped WIRE id like
25110
- // every other row, and the wire id carries the vendor: a bare 'copilot'
25111
- // needle would also match any title that merely contains the word.
25112
- Copilot: stripSeparators(SOURCE_TOOL.Copilot)
25113
- };
25114
-
25115
- // ../../packages/persistence/src/repositories/policies.ts
25116
- import { randomUUID as randomUUID6 } from "crypto";
25117
-
25118
- // ../../packages/persistence/src/repositories/project-files.ts
25119
- import { randomUUID as randomUUID7 } from "crypto";
25120
-
25121
- // ../../packages/persistence/src/repositories/resolutions.ts
25122
- import { randomUUID as randomUUID8 } from "crypto";
25123
-
25124
- // ../../packages/persistence/src/repositories/secret-vault.ts
25125
- import { randomUUID as randomUUID9 } from "crypto";
25126
-
25127
- // ../../packages/persistence/src/repositories/security.ts
25128
- var OPEN_AT_REST_FINDINGS_SQL = `FROM inspection_findings f
25129
- JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
25130
- JOIN inspection_definitions d ON d.id = f.inspection_definition_id
25131
- LEFT JOIN ${LATEST_RESOLUTION_BY_KEY_SQL} latest
25132
- ON latest.finding_key = f.finding_key
25133
- WHERE e.event_type IN (${CAPTURE_EVENT_TYPES_SQL})
25134
- AND e.event_type = 'code_change'
25135
- AND (
25136
- f.finding_key IS NULL
25137
- OR latest.status IS NULL
25138
- OR latest.status NOT IN ('resolved', 'dismissed')
25139
- )`;
25140
- var SCAN_COVERAGE = {
25141
- [HARNESS.Antigravity]: { coverage: 60, supported: true },
25142
- [HARNESS.Api]: { coverage: 0, supported: false },
25143
- [HARNESS.ChatGpt]: { coverage: 40, supported: true },
25144
- [HARNESS.ClaudeAi]: { coverage: 40, supported: true },
25145
- [HARNESS.ClaudeCode]: { coverage: 100, supported: true },
25146
- [HARNESS.Codex]: { coverage: 80, supported: true },
25147
- [HARNESS.Copilot]: { coverage: 30, supported: true },
25148
- [HARNESS.Cursor]: { coverage: 0, supported: false }
25149
- };
25150
-
25151
- // ../../packages/persistence/src/repositories/shares.ts
25152
- import { randomUUID as randomUUID10 } from "crypto";
25153
-
25154
- // ../../packages/persistence/src/database.ts
25155
- var CAPTURE_GRAIN = new Set(EventKind.options);
25156
- var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
25157
-
25158
- // ../../packages/persistence/src/egress-wire.ts
25159
- import { createHash as createHash3 } from "crypto";
25160
- var SLASH = "/".charCodeAt(0);
25161
-
25162
- // ../../packages/persistence/src/finding-key.ts
25163
- import { createHash as createHash4 } from "crypto";
25164
-
25165
- // ../../packages/persistence/src/fingerprint.ts
25166
- import { createHmac, randomBytes } from "crypto";
25167
- import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
25168
- import { join as join8 } from "path";
25169
- import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
25170
-
25171
- // ../../packages/persistence/src/forward-health.ts
25172
- import { readFileSync as readFileSync7 } from "fs";
25173
- import { join as join9 } from "path";
25174
-
25175
- // ../../packages/persistence/src/history-backfill.ts
25176
- import { existsSync as existsSync4 } from "fs";
25177
- import { join as join10 } from "path";
25178
-
25179
- // ../../packages/persistence/src/history-preview.ts
25180
- import { existsSync as existsSync5 } from "fs";
25181
- import { join as join11 } from "path";
25182
- import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
25183
-
25184
- // ../../packages/persistence/src/history-sync-state.ts
25185
- import { readFileSync as readFileSync8 } from "fs";
25186
- import { join as join12 } from "path";
25187
-
25188
- // ../../packages/persistence/src/store-symlinks.ts
25189
- import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
25190
- import { dirname as dirname3, join as join13, resolve } from "path";
25191
-
25192
- // ../../packages/persistence/src/vault/crypto.ts
25193
- import {
25194
- createCipheriv,
25195
- createDecipheriv,
25196
- createHmac as createHmac2,
25197
- hkdfSync,
25198
- timingSafeEqual
25199
- } from "crypto";
25200
-
25201
- // ../../packages/persistence/src/vault/key-provider.ts
25202
- import { execFileSync } from "child_process";
25203
- import { randomBytes as randomBytes2 } from "crypto";
25204
- import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
25205
- import { join as join14 } from "path";
25206
-
25207
- // ../../packages/persistence/src/vault/vault.ts
25208
- import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
25209
-
25210
- // ../../packages/persistence/src/warn-era-cap.ts
25211
- import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
25212
- import { join as join15 } from "path";
25213
-
25214
- // ../../packages/plugin-sdk/src/provider-env.ts
25215
- var booleanish = external_exports.string().optional().transform((v) => {
25216
- if (v === void 0) return void 0;
25217
- const t = v.trim().toLowerCase();
25218
- if (t === "" || t === "false" || t === "0") return false;
25219
- return true;
25220
- }).catch(void 0);
25221
- var optionalBaseUrl = external_exports.preprocess((v) => {
25222
- if (typeof v === "string" && v.trim() === "") return void 0;
25223
- return v;
25224
- }, external_exports.string().optional()).catch(void 0);
25225
- var providerEnvShape = {
25226
- CLAUDE_CODE_USE_BEDROCK: booleanish,
25227
- CLAUDE_CODE_USE_VERTEX: booleanish,
25228
- ANTHROPIC_BASE_URL: optionalBaseUrl
25229
- };
25230
- var ProviderEnvSchema = external_exports.object(providerEnvShape);
25231
-
25232
- // ../../packages/plugin-sdk/src/config-inventory.ts
25233
- import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
25234
- import { homedir as homedir2 } from "os";
25235
- import { basename as basename3, join as join18 } from "path";
25236
-
25237
- // ../../packages/detections/src/egress/registry.ts
25238
- var EXTRACTOR_VERSION = "3";
25239
- var PROVIDER_REGISTRY = [
25240
- {
25241
- id: "stripe",
25242
- name: "Stripe",
25243
- category: "Payments",
25244
- hostSuffixes: ["stripe.com"],
25245
- apiBase: "https://api.stripe.com",
25246
- defaultDataClasses: ["pii", "customer"],
25247
- sdks: {
25248
- npm: ["stripe"],
25249
- pypi: ["stripe"],
25250
- go: ["github.com/stripe/stripe-go"],
25251
- maven: ["com.stripe"],
25252
- rubygems: ["stripe"],
25253
- composer: ["stripe/stripe-php"],
25254
- nuget: ["Stripe.net"]
25255
- }
25256
- },
25257
- {
25258
- id: "datadog",
25259
- name: "Datadog",
25260
- category: "Observability",
25261
- hostSuffixes: ["datadoghq.com", "datadoghq.eu"],
25262
- apiBase: "https://api.datadoghq.com",
25263
- defaultDataClasses: ["telemetry", "logs", "metrics"],
25264
- sdks: {
25265
- npm: ["dd-trace", "@datadog/browser-logs"],
25266
- pypi: ["datadog", "ddtrace"],
25267
- go: ["github.com/DataDog/dd-trace-go"],
25268
- maven: ["com.datadoghq"],
25269
- rubygems: ["ddtrace", "dogapi"],
25270
- nuget: ["Datadog.Trace"]
25271
- }
25272
- },
25273
- {
25274
- id: "newrelic",
25275
- name: "New Relic",
25276
- category: "Observability",
25277
- hostSuffixes: ["newrelic.com", "nr-data.net"],
25278
- apiBase: "https://api.newrelic.com",
25279
- defaultDataClasses: ["telemetry", "logs", "metrics"],
25280
- sdks: {
25281
- npm: ["newrelic"],
25282
- pypi: ["newrelic"],
25283
- go: ["github.com/newrelic/go-agent"],
25284
- maven: ["com.newrelic.agent.java"],
25285
- rubygems: ["newrelic_rpm"],
25286
- nuget: ["NewRelic.Agent"]
25287
- }
25288
- },
25289
- {
25290
- id: "sentry",
25291
- name: "Sentry",
25292
- category: "Error tracking",
25293
- hostSuffixes: ["sentry.io"],
25294
- apiBase: "https://sentry.io",
25295
- defaultDataClasses: ["source", "telemetry"],
25296
- sdks: {
25297
- npm: ["@sentry/node", "@sentry/react", "@sentry/nextjs"],
25298
- pypi: ["sentry-sdk"],
25299
- go: ["github.com/getsentry/sentry-go"],
25300
- maven: ["io.sentry"],
25301
- rubygems: ["sentry-ruby"],
25302
- cargo: ["sentry"],
25303
- composer: ["sentry/sentry"],
25304
- nuget: ["Sentry"]
25305
- }
25306
- },
25307
- {
25308
- id: "openai",
25309
- name: "OpenAI",
25310
- category: "LLM provider",
25311
- hostSuffixes: ["openai.com"],
25312
- apiBase: "https://api.openai.com",
25313
- defaultDataClasses: ["pii", "source"],
25314
- sdks: {
25315
- npm: ["openai"],
25316
- pypi: ["openai"],
25317
- go: ["github.com/sashabaranov/go-openai"],
25318
- maven: ["com.openai"],
25319
- rubygems: ["ruby-openai"],
25320
- cargo: ["async-openai"],
25321
- composer: ["openai-php/client"],
25322
- nuget: ["OpenAI"]
25323
- }
25324
- },
25325
- {
25326
- id: "anthropic",
25327
- name: "Anthropic",
25328
- category: "LLM provider",
25329
- hostSuffixes: ["anthropic.com"],
25330
- apiBase: "https://api.anthropic.com",
25331
- defaultDataClasses: ["pii", "source"],
25332
- sdks: {
25333
- npm: ["@anthropic-ai/sdk"],
25334
- pypi: ["anthropic"],
25335
- go: ["github.com/anthropics/anthropic-sdk-go"],
25336
- nuget: ["Anthropic.SDK"]
25337
- }
25338
- },
25339
- {
25340
- id: "aws",
25341
- name: "Amazon Web Services",
25342
- category: "Cloud platform",
25343
- hostSuffixes: ["amazonaws.com"],
25344
- apiBase: "https://s3.amazonaws.com",
25345
- defaultDataClasses: ["secrets", "customer"],
25346
- sdks: {
25347
- npm: ["@aws-sdk/client-s3", "aws-sdk"],
25348
- pypi: ["boto3"],
25349
- go: ["github.com/aws/aws-sdk-go", "github.com/aws/aws-sdk-go-v2"],
25350
- maven: ["com.amazonaws", "software.amazon.awssdk"],
25351
- rubygems: ["aws-sdk-s3"],
25352
- cargo: ["aws-sdk-s3"],
25353
- nuget: ["AWSSDK.S3"]
25354
- }
25355
- },
25356
- {
25357
- id: "gcp",
25358
- name: "Google Cloud",
25359
- category: "Cloud platform",
25360
- hostSuffixes: ["googleapis.com"],
25361
- apiBase: "https://storage.googleapis.com",
25362
- defaultDataClasses: ["customer", "logs"],
25363
- sdks: {
25364
- npm: ["@google-cloud/storage"],
25365
- pypi: ["google-cloud-storage"],
25366
- go: ["cloud.google.com/go"],
25367
- maven: ["com.google.cloud"],
25368
- rubygems: ["google-cloud-storage"],
25369
- nuget: ["Google.Cloud.Storage.V1"]
25370
- }
25371
- },
25372
- {
25373
- id: "google-fonts",
25374
- name: "Google Fonts",
25375
- category: "CDN / edge",
25376
- hostSuffixes: ["fonts.googleapis.com", "fonts.gstatic.com"],
25377
- apiBase: "https://fonts.googleapis.com",
25378
- defaultDataClasses: ["none"],
25379
- sdks: {}
25380
- },
25381
- {
25382
- id: "azure",
25383
- name: "Microsoft Azure",
25384
- category: "Cloud platform",
25385
- hostSuffixes: ["azure.com", "windows.net"],
25386
- apiBase: "https://management.azure.com",
25387
- defaultDataClasses: ["customer", "logs"],
25388
- sdks: {
25389
- npm: ["@azure/storage-blob"],
25390
- pypi: ["azure-storage-blob"],
25391
- go: ["github.com/Azure/azure-sdk-for-go"],
25392
- maven: ["com.azure"],
25393
- rubygems: ["azure-storage-blob"],
25394
- nuget: ["Azure.Storage.Blobs"]
25395
- }
25396
- },
25397
- {
25398
- id: "slack",
25399
- name: "Slack",
25400
- category: "Notifications",
25401
- hostSuffixes: ["slack.com"],
25402
- apiBase: "https://slack.com/api",
25403
- defaultDataClasses: ["logs"],
25404
- sdks: {
25405
- npm: ["@slack/web-api"],
25406
- pypi: ["slack-sdk"],
25407
- go: ["github.com/slack-go/slack"],
25408
- maven: ["com.slack.api"],
25409
- rubygems: ["slack-ruby-client"],
25410
- composer: ["slack-php/slack-api"],
25411
- nuget: ["SlackNet"]
25412
- }
25413
- },
25414
- {
25415
- id: "segment",
25416
- name: "Segment",
25417
- category: "Analytics",
25418
- hostSuffixes: ["segment.io", "segment.com"],
25419
- apiBase: "https://api.segment.io",
25420
- defaultDataClasses: ["customer"],
25421
- sdks: {
25422
- npm: ["@segment/analytics-node", "analytics-node"],
25423
- pypi: ["segment-analytics-python"],
25424
- go: ["github.com/segmentio/analytics-go"],
25425
- maven: ["com.segment.analytics.java"],
25426
- rubygems: ["analytics-ruby"],
25427
- nuget: ["Analytics"]
25428
- }
25429
- },
25430
- {
25431
- id: "twilio",
25432
- name: "Twilio",
25433
- category: "Communications",
25434
- hostSuffixes: ["twilio.com"],
25435
- apiBase: "https://api.twilio.com",
25436
- defaultDataClasses: ["pii", "customer"],
25437
- sdks: {
25438
- npm: ["twilio"],
25439
- pypi: ["twilio"],
25440
- go: ["github.com/twilio/twilio-go"],
25441
- maven: ["com.twilio.sdk"],
25442
- rubygems: ["twilio-ruby"],
25443
- composer: ["twilio/sdk"],
25444
- nuget: ["Twilio"]
25445
- }
25446
- },
25447
- {
25448
- id: "sendgrid",
25449
- name: "SendGrid",
25450
- category: "Email",
25451
- hostSuffixes: ["sendgrid.com"],
25452
- apiBase: "https://api.sendgrid.com",
25453
- defaultDataClasses: ["pii"],
25454
- sdks: {
25455
- npm: ["@sendgrid/mail"],
25456
- pypi: ["sendgrid"],
25457
- go: ["github.com/sendgrid/sendgrid-go"],
25458
- maven: ["com.sendgrid"],
25459
- rubygems: ["sendgrid-ruby"],
25460
- composer: ["sendgrid/sendgrid"],
25461
- nuget: ["SendGrid"]
25462
- }
25463
- },
25464
- {
25465
- id: "mailgun",
25466
- name: "Mailgun",
25467
- category: "Email",
25468
- hostSuffixes: ["mailgun.net"],
25469
- apiBase: "https://api.mailgun.net",
25470
- defaultDataClasses: ["pii"],
25471
- sdks: {
25472
- npm: ["mailgun.js"],
25473
- pypi: ["mailgun"],
25474
- rubygems: ["mailgun-ruby"],
25475
- composer: ["mailgun/mailgun-php"],
25476
- nuget: ["Mailgun"]
25477
- }
25478
- },
25479
- {
25480
- id: "mixpanel",
25481
- name: "Mixpanel",
25482
- category: "Analytics",
25483
- hostSuffixes: ["mixpanel.com"],
25484
- apiBase: "https://api.mixpanel.com",
25485
- defaultDataClasses: ["customer", "telemetry"],
25486
- sdks: {
25487
- npm: ["mixpanel"],
25488
- pypi: ["mixpanel"],
25489
- rubygems: ["mixpanel-ruby"],
25490
- nuget: ["Mixpanel"]
25491
- }
25492
- },
25493
- {
25494
- id: "amplitude",
25495
- name: "Amplitude",
25496
- category: "Analytics",
25497
- hostSuffixes: ["amplitude.com"],
25498
- apiBase: "https://api2.amplitude.com",
25499
- defaultDataClasses: ["customer", "telemetry"],
25500
- sdks: {
25501
- npm: ["@amplitude/analytics-node"],
25502
- pypi: ["amplitude-analytics"],
25503
- nuget: ["Amplitude"]
25504
- }
25505
- },
25506
- {
25507
- id: "posthog",
25508
- name: "PostHog",
25509
- category: "Analytics",
25510
- hostSuffixes: ["posthog.com"],
25511
- apiBase: "https://us.i.posthog.com",
25512
- defaultDataClasses: ["customer", "telemetry"],
25513
- sdks: {
25514
- npm: ["posthog-node", "posthog-js"],
25515
- pypi: ["posthog"],
25516
- go: ["github.com/posthog/posthog-go"],
25517
- rubygems: ["posthog-ruby"],
25518
- composer: ["posthog/posthog-php"],
25519
- nuget: ["PostHog"]
25520
- }
25521
- },
25522
- {
25523
- id: "honeycomb",
25524
- name: "Honeycomb",
25525
- category: "Observability",
25526
- hostSuffixes: ["honeycomb.io"],
25527
- apiBase: "https://api.honeycomb.io",
25528
- defaultDataClasses: ["telemetry", "metrics"],
25529
- sdks: {
25530
- npm: ["libhoney"],
25531
- pypi: ["libhoney"],
25532
- go: ["github.com/honeycombio/libhoney-go"],
25533
- rubygems: ["libhoney"]
25534
- }
25535
- },
25536
- {
25537
- id: "grafana",
25538
- name: "Grafana Cloud",
25539
- category: "Observability",
25540
- hostSuffixes: ["grafana.net"],
25541
- apiBase: "https://grafana.net",
25542
- defaultDataClasses: ["logs", "metrics"],
25543
- sdks: {
25544
- npm: ["@grafana/faro-web-sdk"]
25545
- }
25546
- },
25547
- {
25548
- id: "splunk",
25549
- name: "Splunk",
25550
- category: "Observability",
25551
- hostSuffixes: ["splunkcloud.com", "splunk.com"],
25552
- apiBase: "https://http-inputs.splunkcloud.com",
25553
- defaultDataClasses: ["logs"],
25554
- sdks: {
25555
- npm: ["splunk-logging"],
25556
- pypi: ["splunk-sdk"],
25557
- maven: ["com.splunk"],
25558
- nuget: ["Splunk.Logging.Common"]
25559
- }
25560
- },
25561
- {
25562
- id: "pagerduty",
25563
- name: "PagerDuty",
25564
- category: "Incident response",
25565
- hostSuffixes: ["pagerduty.com"],
25566
- apiBase: "https://api.pagerduty.com",
25567
- defaultDataClasses: ["logs"],
25568
- sdks: {
25569
- npm: ["@pagerduty/pdjs"],
25570
- pypi: ["pdpyras"],
25571
- go: ["github.com/PagerDuty/go-pagerduty"],
25572
- rubygems: ["pagerduty"]
25573
- }
25574
- },
25575
- {
25576
- id: "github",
25577
- name: "GitHub",
25578
- category: "Developer platform",
25579
- hostSuffixes: ["github.com", "githubusercontent.com"],
25580
- apiBase: "https://api.github.com",
25581
- defaultDataClasses: ["source"],
25582
- sdks: {
25583
- npm: ["@octokit/rest", "octokit"],
25584
- pypi: ["pygithub"],
25585
- go: ["github.com/google/go-github"],
25586
- maven: ["org.kohsuke.github-api"],
25587
- rubygems: ["octokit"],
25588
- cargo: ["octocrab"],
25589
- composer: ["knplabs/github-api"],
25590
- nuget: ["Octokit"]
25591
- }
25592
- },
25593
- {
25594
- id: "gitlab",
25595
- name: "GitLab",
25596
- category: "Developer platform",
25597
- hostSuffixes: ["gitlab.com"],
25598
- apiBase: "https://gitlab.com/api",
25599
- defaultDataClasses: ["source"],
25600
- sdks: {
25601
- npm: ["@gitbeaker/rest"],
25602
- pypi: ["python-gitlab"],
25603
- go: ["gitlab.com/gitlab-org/api/client-go"],
25604
- rubygems: ["gitlab"],
25605
- nuget: ["GitLabApiClient"]
25606
- }
25607
- },
25608
- {
25609
- id: "auth0",
25610
- name: "Auth0",
25611
- category: "Identity",
25612
- hostSuffixes: ["auth0.com"],
25613
- apiBase: "https://login.auth0.com",
25614
- defaultDataClasses: ["pii"],
25615
- sdks: {
25616
- npm: ["auth0"],
25617
- pypi: ["auth0-python"],
25618
- go: ["github.com/auth0/go-auth0"],
25619
- maven: ["com.auth0"],
25620
- rubygems: ["auth0"],
25621
- composer: ["auth0/auth0-php"],
25622
- nuget: ["Auth0.ManagementApi"]
25623
- }
25624
- },
25625
- {
25626
- id: "okta",
25627
- name: "Okta",
25628
- category: "Identity",
25629
- hostSuffixes: ["okta.com", "oktapreview.com"],
25630
- apiBase: "https://login.okta.com",
25631
- defaultDataClasses: ["pii"],
25632
- sdks: {
25633
- npm: ["@okta/okta-sdk-nodejs"],
25634
- pypi: ["okta"],
25635
- go: ["github.com/okta/okta-sdk-golang"],
25636
- maven: ["com.okta.sdk"],
25637
- nuget: ["Okta.Sdk"]
25638
- }
25639
- },
25640
- {
25641
- id: "clerk",
25642
- name: "Clerk",
25643
- category: "Identity",
25644
- hostSuffixes: ["clerk.com", "clerk.dev"],
25645
- apiBase: "https://api.clerk.com",
25646
- defaultDataClasses: ["pii"],
25647
- sdks: {
25648
- npm: ["@clerk/backend", "@clerk/nextjs"],
25649
- pypi: ["clerk-backend-api"],
25650
- go: ["github.com/clerk/clerk-sdk-go"]
25651
- }
25652
- },
25653
- {
25654
- id: "supabase",
25655
- name: "Supabase",
25656
- category: "Backend platform",
25657
- hostSuffixes: ["supabase.co", "supabase.com"],
25658
- apiBase: "https://api.supabase.com",
25659
- defaultDataClasses: ["pii", "customer"],
25660
- sdks: {
25661
- npm: ["@supabase/supabase-js"],
25662
- pypi: ["supabase"],
25663
- cargo: ["postgrest"]
25664
- }
25665
- },
25666
- {
25667
- id: "firebase",
25668
- name: "Firebase",
25669
- category: "Backend platform",
25670
- hostSuffixes: ["firebaseio.com", "firebase.google.com"],
25671
- apiBase: "https://firebaseio.com",
25672
- defaultDataClasses: ["customer"],
25673
- sdks: {
25674
- npm: ["firebase", "firebase-admin"],
25675
- pypi: ["firebase-admin"],
25676
- go: ["firebase.google.com/go"],
25677
- maven: ["com.google.firebase"]
25678
- }
25679
- },
25680
- {
25681
- id: "mongodb-atlas",
25682
- name: "MongoDB Atlas",
25683
- category: "Database SaaS",
25684
- hostSuffixes: ["mongodb.net", "mongodb.com"],
25685
- apiBase: "https://cloud.mongodb.com",
25686
- defaultDataClasses: ["customer"],
25687
- sdks: {
25688
- npm: ["mongodb"],
25689
- pypi: ["pymongo"],
25690
- go: ["go.mongodb.org/mongo-driver"],
25691
- maven: ["org.mongodb"],
25692
- rubygems: ["mongo"],
25693
- cargo: ["mongodb"],
25694
- nuget: ["MongoDB.Driver"]
25695
- }
25696
- },
25697
- {
25698
- id: "planetscale",
25699
- name: "PlanetScale",
25700
- category: "Database SaaS",
25701
- hostSuffixes: ["psdb.cloud", "planetscale.com"],
25702
- apiBase: "https://api.planetscale.com",
25703
- defaultDataClasses: ["customer"],
25704
- sdks: {
25705
- npm: ["@planetscale/database"],
25706
- go: ["github.com/planetscale/planetscale-go"]
25707
- }
25708
- },
25709
- {
25710
- id: "algolia",
25711
- name: "Algolia",
25712
- category: "Search SaaS",
25713
- hostSuffixes: ["algolia.net", "algolianet.com"],
25714
- apiBase: "https://algolia.net",
25715
- defaultDataClasses: ["customer"],
25716
- sdks: {
25717
- npm: ["algoliasearch"],
25718
- pypi: ["algoliasearch"],
25719
- go: ["github.com/algolia/algoliasearch-client-go"],
25720
- maven: ["com.algolia"],
25721
- rubygems: ["algolia"],
25722
- composer: ["algolia/algoliasearch-client-php"],
25723
- nuget: ["Algolia.Search"]
25724
- }
25725
- },
25726
- {
25727
- id: "cloudflare",
25728
- name: "Cloudflare",
25729
- category: "CDN / edge",
25730
- hostSuffixes: ["cloudflare.com", "workers.dev"],
25731
- apiBase: "https://api.cloudflare.com",
25732
- defaultDataClasses: ["logs"],
25733
- sdks: {
25734
- npm: ["cloudflare"],
25735
- pypi: ["cloudflare"],
25736
- go: ["github.com/cloudflare/cloudflare-go"],
25737
- nuget: ["CloudFlare.Client"]
25738
- }
25739
- },
25740
- {
25741
- id: "huggingface",
25742
- name: "Hugging Face",
25743
- category: "LLM provider",
25744
- hostSuffixes: ["huggingface.co"],
25745
- apiBase: "https://api-inference.huggingface.co",
25746
- defaultDataClasses: ["source"],
25747
- sdks: {
25748
- npm: ["@huggingface/inference"],
25749
- pypi: ["huggingface-hub", "transformers"],
25750
- rubygems: ["hugging-face"]
25751
- }
25752
- },
25753
- {
25754
- id: "cohere",
25755
- name: "Cohere",
25756
- category: "LLM provider",
25757
- hostSuffixes: ["cohere.com", "cohere.ai"],
25758
- apiBase: "https://api.cohere.com",
25759
- defaultDataClasses: ["pii", "source"],
25760
- sdks: {
25761
- npm: ["cohere-ai"],
25762
- pypi: ["cohere"],
25763
- go: ["github.com/cohere-ai/cohere-go"]
25764
- }
25765
- },
25766
- {
25767
- id: "mistral",
25768
- name: "Mistral AI",
25769
- category: "LLM provider",
25770
- hostSuffixes: ["mistral.ai"],
25771
- apiBase: "https://api.mistral.ai",
25772
- defaultDataClasses: ["pii", "source"],
25773
- sdks: {
25774
- npm: ["@mistralai/mistralai"],
25775
- pypi: ["mistralai"],
25776
- go: ["github.com/gage-technologies/mistral-go"]
25777
- }
25778
- }
25779
- ];
25780
- var EXCLUDED_HOST_SUFFIXES = [
25781
- "localhost",
25782
- "test",
25783
- "example",
25784
- "invalid",
25785
- "example.com",
25786
- "example.org",
25787
- "example.net",
25788
- "w3.org",
25789
- "schemas.openxmlformats.org",
25790
- "schemas.microsoft.com",
25791
- "schemas.android.com",
25792
- "maven.apache.org"
25793
- ];
25794
- var EGRESS_VERSION_MATERIAL = `${EXTRACTOR_VERSION}
25795
- ${JSON.stringify(PROVIDER_REGISTRY)}
25796
- ${JSON.stringify(EXCLUDED_HOST_SUFFIXES)}`;
25797
-
25798
- // ../../packages/detections/src/egress/extract.ts
25799
- var SECRET_KEY_NAMES = "api[_-]?key|apikey|private[_-]?key|access[_-]?key|access[_-]?token|token|secret|credentials?|password|passwd|pwd|authorization|sig|signature|sas|assertion";
25800
- var AUTH_SCHEMES = "Bearer|Basic|Token|Digest|ApiKey|SSWS|AWS4-HMAC-SHA256";
25801
- var SECRET_VALUE = new RegExp(
25802
- `((?:${SECRET_KEY_NAMES})['"\`]?\\s*[:=]\\s*['"\`]?)(?!(?:${AUTH_SCHEMES})[\\s'"\`])[^\\s'"\`&]+`,
25803
- "gi"
25804
- );
25805
- var AUTH_SCHEME_VALUE = new RegExp(
25806
- `((?:${SECRET_KEY_NAMES})['"\`]?\\s*[:=]\\s*['"\`]?)(${AUTH_SCHEMES})\\s+[^\\s'"\`]+`,
25807
- "gi"
25808
- );
25809
- var WEBHOOK_SECRET_PATHS = [
25810
- { hosts: ["hooks.slack.com"], prefix: "/services/" },
25811
- {
25812
- hosts: ["discord.com", "discordapp.com", "ptb.discord.com", "canary.discord.com"],
25813
- prefix: "/api/webhooks/"
25814
- },
25815
- { hosts: ["hooks.zapier.com"], prefix: "/hooks/" },
25816
- { hosts: ["outlook.office.com", "outlook.office365.com"], prefix: "/webhook/" }
25817
- ];
25818
- function escapeRegExp(literal2) {
25819
- return literal2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25820
- }
25821
- var WEBHOOK_URL = new RegExp(
25822
- `(https?://(?:${WEBHOOK_SECRET_PATHS.flatMap(
25823
- (entry) => entry.hosts.map((host) => `${escapeRegExp(host)}${escapeRegExp(entry.prefix)}`)
25824
- ).join("|")}))[^\\s'"\`<>()[\\]{},;]+`,
25825
- "gi"
25826
- );
25827
-
25828
- // ../../packages/detections/src/escape-regexp.ts
25829
- function escapeRegExp2(value) {
25830
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25831
- }
25832
-
25833
- // ../../packages/detections/src/format-chars.ts
25834
- var HAS_FORMAT_CHAR = new RegExp("\\p{Cf}", "u");
25835
- var FORMAT_CHAR_GLOBAL = new RegExp("\\p{Cf}", "gu");
25836
-
25837
- // ../../packages/detections/src/regex-cache.ts
25838
- var singles = /* @__PURE__ */ new WeakMap();
25839
- var keywordLists = /* @__PURE__ */ new WeakMap();
25840
- var labelLists = /* @__PURE__ */ new WeakMap();
25841
- function listCache(kind) {
25842
- return kind === "keyword" ? keywordLists : labelLists;
25843
- }
25844
- function memoizedRegExp(owner, build) {
25845
- const cached2 = singles.get(owner);
25846
- if (cached2 !== void 0) {
25847
- cached2.lastIndex = 0;
25848
- return cached2;
25849
- }
25850
- const compiled = build();
25851
- singles.set(owner, compiled);
25852
- return compiled;
25853
- }
25854
- function memoizedRegExpList(kind, owner, build) {
25855
- const cache = listCache(kind);
25856
- const cached2 = cache.get(owner);
25857
- if (cached2 !== void 0) {
25858
- if (cached2.stateful) {
25859
- for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
25860
- }
25861
- return cached2.entries;
25862
- }
25863
- const entries = build();
25864
- cache.set(owner, {
25865
- entries,
25866
- stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
25867
- });
25868
- return entries;
25869
- }
25870
-
25871
- // ../../packages/detections/src/matchers/limits.ts
25872
- var MAX_MATCHES_PER_RULE = 1e4;
25873
- var MAX_REGEX_INPUT_LENGTH = 2e5;
25874
-
25875
- // ../../packages/detections/src/matchers/keyword.ts
25876
- var KeywordMatcher2 = class {
25877
- match(text, rule) {
25878
- if (rule.matcher.type !== "keyword") return [];
25879
- const { keywords, caseSensitive } = rule.matcher;
25880
- const spans = [];
25881
- const compiled = memoizedRegExpList(
25882
- "keyword",
25883
- rule.matcher,
25884
- () => keywords.map((kw) => {
25885
- if (kw.length === 0) return void 0;
25886
- return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
25887
- })
25888
- );
25889
- for (const re of compiled) {
25890
- if (re === void 0) continue;
25891
- if (spans.length >= MAX_MATCHES_PER_RULE) break;
25892
- let m;
25893
- while ((m = re.exec(text)) !== null) {
25894
- spans.push({ start: m.index, end: m.index + m[0].length });
25895
- if (spans.length >= MAX_MATCHES_PER_RULE) break;
25896
- }
25897
- }
25898
- return spans;
25899
- }
25900
- };
25901
-
25902
- // ../../packages/detections/src/matchers/regex.ts
25903
- var RegexMatcher2 = class {
25904
- match(text, rule) {
25905
- if (rule.matcher.type !== "regex") return [];
25906
- const { pattern, flags, captureGroup } = rule.matcher;
25907
- const re = memoizedRegExp(
25908
- rule.matcher,
25909
- () => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
25910
- );
25911
- const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
25912
- const spans = [];
25913
- let m;
25914
- const maxIterations = scanText2.length + 1;
25915
- let iterations = 0;
25916
- while ((m = re.exec(scanText2)) !== null) {
25917
- if (++iterations > maxIterations) break;
25918
- const group = captureGroup != null ? m[captureGroup] : m[0];
25919
- if (m[0].length === 0) re.lastIndex++;
25920
- if (group && spans.length < MAX_MATCHES_PER_RULE) {
25921
- const groupIndices = captureGroup != null ? m.indices?.[captureGroup] : void 0;
25922
- const start = groupIndices ? groupIndices[0] : m.index;
25923
- spans.push({ start, end: start + group.length });
25924
- }
25925
- if (!flags.includes("g") || spans.length >= MAX_MATCHES_PER_RULE) break;
25926
- }
25927
- return spans;
25928
- }
25929
- };
25930
-
25931
- // ../../packages/detections/src/engine.ts
25932
- var keywordMatcher = new KeywordMatcher2();
25933
- var regexMatcher = new RegexMatcher2();
25934
-
25935
- // ../../packages/detections/src/posture/config-posture.ts
25936
- var RULE_VERSION = "1";
25937
- var KNOWN_TOOLS = /* @__PURE__ */ new Set([
25938
- "prettier",
25939
- "eslint",
25940
- "biome",
25941
- "black",
25942
- "ruff",
25943
- "gofmt",
25944
- "rustfmt",
25945
- "node",
25946
- "npx",
25947
- "npm",
25948
- "pnpm",
25949
- "yarn",
25950
- "make",
25951
- "git",
25952
- "jq",
25953
- "echo"
25954
- ]);
25955
- var EGRESS_RE = /\b(curl|wget|nc|ncat|netcat|ssh|scp|rsync)\b|https?:\/\//;
25956
- var MUTATION_RE = /(--write|--fix|\s-w\b|\s-i\b|(?<![\d&>])>\s?\S)/;
25957
- var CONFIG_POSTURE_RULES = [
25958
- {
25959
- ruleId: "hook-conflict",
25960
- version: RULE_VERSION,
25961
- name: "Overlapping hooks \u2014 run order is undefined",
25962
- category: "config",
25963
- severity: "medium",
25964
- definition: JSON.stringify({
25965
- kind: "hook-conflict",
25966
- mutation: MUTATION_RE.source,
25967
- note: "two hooks on the same event with overlapping matchers, both mutating the tool target"
25968
- })
25969
- },
25970
- {
25971
- ruleId: "hook-unknown",
25972
- version: RULE_VERSION,
25973
- name: "Unknown hook \u2014 not attributable to a plugin or known tool",
25974
- category: "config",
25975
- // medium, not high: with a deliberately tiny allowlist this v1 heuristic
25976
- // fires on ordinary interpreter hooks (python3 x.py) and compound commands
25977
- // (cd … && tool); 'high' is reserved for egress, which is genuinely
25978
- // dangerous. Revisit when the known-hooks registry replaces the allowlist.
25979
- severity: "medium",
25980
- definition: JSON.stringify({ kind: "hook-unknown", knownTools: [...KNOWN_TOOLS] })
25981
- },
25982
- {
25983
- ruleId: "hook-external-egress",
25984
- version: RULE_VERSION,
25985
- name: "Hook command can send data externally",
25986
- category: "config",
25987
- severity: "high",
25988
- definition: JSON.stringify({ kind: "hook-external-egress", pattern: EGRESS_RE.source })
25989
- }
25990
- ];
25991
-
25992
- // ../../packages/detections/src/posture/web-capture-posture.ts
25993
- var RULE_VERSION2 = "1";
25994
- var DRIFT_MIN_PARSE_FAILURES = 2;
25995
- var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
25996
- "blind",
25997
- "degraded"
25998
- ]);
25999
- var WEB_CAPTURE_DRIFT_RULE = {
26000
- ruleId: "web-capture-drift",
26001
- version: RULE_VERSION2,
26002
- name: "Web chat capture is not reading the site",
26003
- category: "config",
26004
- severity: "medium",
26005
- definition: JSON.stringify({
26006
- kind: "web-capture-drift",
26007
- states: [...WEB_CAPTURE_DRIFT_STATES],
26008
- minParseFailures: DRIFT_MIN_PARSE_FAILURES
26009
- })
26010
- };
26011
- var STATIC_COPY = {
26012
- active: { headline: "turns are being observed on this site" },
26013
- unreported: {
26014
- // Says "recently" rather than "yet": the store read is bounded to
26015
- // CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
26016
- // reported for AND one whose last report has aged out. The two are the
26017
- // same fact to a reader — nobody has confirmed anything lately — and the
26018
- // copy may not claim the stronger of them.
26019
- headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
26020
- },
26021
- standby: {
26022
- headline: "this build declares no endpoints for the site, so nothing is observed yet"
26023
- },
26024
- unpatched: {
26025
- // Says what the flags say and no more. `patched` is false both for a tap
26026
- // that installed and hooked neither transport and for one that never ran
26027
- // at all — a page reports the same status either way, so the copy may not
26028
- // assert one of them.
26029
- headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
26030
- },
26031
- idle: { headline: "watching; no turn has been observed yet" },
26032
- blind: {
26033
- headline: "messages were sent in the page that the network capture never saw",
26034
- remediation: "reload the tab. If it persists after `aka update` and reloading the extension at chrome://extensions, the site's send path has changed and needs a new extension build."
26035
- },
26036
- degraded: {
26037
- headline: "the site's payloads no longer carry the fields the extension reads",
26038
- remediation: "run `aka update`, then reload the extension at chrome://extensions. If it stays degraded after an update, the site's contract has changed and needs a new extension build."
26039
- }
26040
- };
26041
-
26042
- // ../../packages/detections/src/security/redos-probe.ts
26043
- var BUDGET_MS = 100;
26044
- var EXPONENTIAL_UNITS = [
26045
- "a",
26046
- "0",
26047
- " ",
26048
- "x",
26049
- "ab",
26050
- "a.",
26051
- "a-",
26052
- "a_",
26053
- "a@",
26054
- "a/",
26055
- "a:",
26056
- "a=",
26057
- "a;",
26058
- "aA0",
26059
- " "
26060
- ];
26061
- var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
26062
- (unit) => [23, 25].map((len) => unit.repeat(Math.ceil(len / unit.length)).slice(0, len) + "!")
26063
- );
26064
- var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
26065
- (unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
26066
- );
26067
- var CPU_CORROBORATION_SHARE = 0.2;
26068
- var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
26069
-
26070
- // ../../packages/plugin-sdk/src/repo.ts
26071
- import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
26072
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
26073
-
26074
- // ../../packages/plugin-sdk/src/events.ts
26075
- import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
26076
-
26077
- // ../../packages/plugin-sdk/src/isolated-scan.ts
26078
- import { existsSync as existsSync10 } from "fs";
26079
- import { fileURLToPath } from "url";
26080
- import { Worker } from "worker_threads";
26081
-
26082
- // ../../packages/plugin-sdk/src/hook-fail-opens.ts
26083
- import { readFileSync as readFileSync12 } from "fs";
26084
- import { join as join19 } from "path";
26085
-
26086
- // ../../packages/plugin-sdk/src/host-floor.ts
26087
- import { readFileSync as readFileSync14 } from "fs";
26088
- import { join as join21 } from "path";
26089
-
26090
- // ../../packages/plugin-sdk/src/model-governance.ts
26091
- import {
26092
- closeSync as closeSync2,
26093
- fstatSync,
26094
- mkdirSync as mkdirSync2,
26095
- openSync as openSync2,
26096
- readFileSync as readFileSync13,
26097
- readSync,
26098
- writeFileSync as writeFileSync5
26099
- } from "fs";
26100
- import { join as join20 } from "path";
26101
- var TAIL_BYTES = 256 * 1024;
26102
-
26103
- // ../../packages/plugin-sdk/src/host-floor.ts
26104
- var HOST_FEATURE = {
26105
- ModelSwitch: "model-switch",
26106
- VaultPointerDisplay: "vault-pointer-display"
26107
- };
26108
- var HOST_FLOORS = {
26109
- [HOST_FEATURE.ModelSwitch]: {
26110
- label: "model-switch protection",
26111
- hookEvents: ["PreModelSwitch", "PostModelSwitch"],
26112
- since: "2.1.251"
26113
- },
26114
- [HOST_FEATURE.VaultPointerDisplay]: {
26115
- label: "vault pointer display",
26116
- hookEvents: ["MessageDisplay"],
26117
- since: "2.1.152"
26118
- }
26119
- };
26120
- var ANTIGRAVITY_HOST_FEATURE = {
26121
- EndOfTurnCapture: "end-of-turn-capture"
26122
- };
26123
- var ANTIGRAVITY_HOST_FLOORS = {
26124
- [ANTIGRAVITY_HOST_FEATURE.EndOfTurnCapture]: {
26125
- label: "end-of-turn history capture",
26126
- hookEvents: ["Stop"],
26127
- since: "1.1.10"
26128
- }
26129
- };
26130
-
26131
- // ../../packages/plugin-sdk/src/ignore-layers.ts
26132
- var import_ignore = __toESM(require_ignore(), 1);
26133
- import { readFileSync as readFileSync15 } from "fs";
26134
- import { join as join22 } from "path";
26135
-
26136
- // ../../packages/plugin-sdk/src/inventory-resolver.ts
26137
- import { arch, hostname as hostname4, platform, release } from "os";
26138
-
26139
- // ../../packages/plugin-sdk/src/nudge.ts
26140
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
26141
- import { join as join23 } from "path";
26142
-
26143
- // ../../packages/plugin-sdk/src/paths.ts
26144
- import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
26145
- import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
26146
-
26147
- // ../../packages/plugin-sdk/src/project-files.ts
26148
- import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
26149
- import { basename as basename5, join as join24 } from "path";
26150
-
26151
- // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
26152
- var optionalBaseUrl2 = external_exports.preprocess((v) => {
26153
- if (typeof v === "string" && v.trim() === "") return void 0;
26154
- return v;
26155
- }, external_exports.string().optional()).catch(void 0);
26156
- var optionalFlag = external_exports.preprocess((v) => {
26157
- if (typeof v !== "string") return false;
26158
- const normalized = v.trim().toLowerCase();
26159
- return normalized !== "" && normalized !== "0" && normalized !== "false";
26160
- }, external_exports.boolean()).catch(false);
26161
- var antigravityProviderEnvShape = {
26162
- GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
26163
- GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
26164
- };
26165
- var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
26166
-
26167
- // ../../packages/plugin-sdk/src/provider-env-codex.ts
26168
- var optionalBaseUrl3 = external_exports.preprocess((v) => {
26169
- if (typeof v === "string" && v.trim() === "") return void 0;
26170
- return v;
26171
- }, external_exports.string().optional()).catch(void 0);
26172
- var codexProviderEnvShape = {
26173
- OPENAI_BASE_URL: optionalBaseUrl3
26174
- };
26175
- var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
26176
-
26177
- // ../../packages/plugin-sdk/src/runtime.ts
26178
- import { randomUUID as randomUUID14 } from "crypto";
26179
-
26180
- // ../../packages/plugin-sdk/src/suppressions.ts
26181
- var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
26182
-
26183
- // ../../packages/plugin-sdk/src/throttle.ts
26184
- import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
26185
- import { join as join25 } from "path";
26186
-
26187
24279
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
26188
- import { writeFileSync as writeFileSync8 } from "fs";
26189
- import { join as join26 } from "path";
24280
+ import { writeFileSync } from "fs";
24281
+ import { join } from "path";
26190
24282
 
26191
24283
  // ../../packages/setup-wizard/src/triage/merge.ts
26192
24284
  var RANK = Object.fromEntries(
@@ -26194,9 +24286,9 @@ var RANK = Object.fromEntries(
26194
24286
  );
26195
24287
 
26196
24288
  // ../../packages/setup-wizard/src/triage/plan-file.ts
26197
- import { mkdtempSync, readFileSync as readFileSync17, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24289
+ import { mkdtempSync, readFileSync, rmdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
26198
24290
  import { tmpdir } from "os";
26199
- import { basename as basename6, dirname as dirname6, join as join27 } from "path";
24291
+ import { basename, dirname, join as join2 } from "path";
26200
24292
  var SuppressionEntrySchema = external_exports.object({
26201
24293
  ruleId: external_exports.string(),
26202
24294
  category: DetectionCategory,
@@ -26238,10 +24330,10 @@ var PersistedPlanSchema = external_exports.object({
26238
24330
  });
26239
24331
 
26240
24332
  // src/skills-registry.ts
26241
- import { readdirSync as readdirSync5, readFileSync as readFileSync18 } from "fs";
26242
- import { join as join28 } from "path";
26243
- import { fileURLToPath as fileURLToPath2 } from "url";
26244
- var SKILLS_DIR = fileURLToPath2(new URL("../skills", import.meta.url));
24333
+ import { readdirSync, readFileSync as readFileSync2 } from "fs";
24334
+ import { join as join3 } from "path";
24335
+ import { fileURLToPath } from "url";
24336
+ var SKILLS_DIR = fileURLToPath(new URL("../skills", import.meta.url));
26245
24337
 
26246
24338
  // src/render.ts
26247
24339
  var SEVERITY_GLYPH = {
@@ -26279,7 +24371,7 @@ function authorName(author) {
26279
24371
  var manifestPath = process.argv[2];
26280
24372
  var manifest = {};
26281
24373
  try {
26282
- manifest = JSON.parse(readFileSync19(manifestPath ?? "", "utf8"));
24374
+ manifest = JSON.parse(readFileSync3(manifestPath ?? "", "utf8"));
26283
24375
  } catch {
26284
24376
  }
26285
24377
  process.stdout.write(