@akasecurity/ai-tc-codex 0.9.16 → 0.9.17

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,879 +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.11/node_modules/ignore/index.js
36
- var require_ignore = __commonJS({
37
- "../../node_modules/.pnpm/ignore@7.0.11/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 TRAILING_DOUBLESTAR = "\uE001";
173
- var extractBrackets = (pattern) => {
174
- const sources = [];
175
- const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
176
- const { length } = pattern;
177
- let out = EMPTY;
178
- let index = 0;
179
- while (index < length) {
180
- const char = pattern[index];
181
- if (char === ESCAPE) {
182
- const escaped = pattern[index + 1];
183
- if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
184
- out += pattern.slice(index, index + 2);
185
- } else {
186
- out += hold(
187
- REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : escaped
188
- );
189
- }
190
- index += 2;
191
- } else if (char === PLACEHOLDER) {
192
- out += hold(`[${PLACEHOLDER}]`);
193
- index++;
194
- } else if (char === "[") {
195
- const scanned = scanBracket(pattern, index);
196
- if (scanned === null) {
197
- out += hold(NEVER_MATCH);
198
- index = length;
199
- } else {
200
- out += hold(scanned.source);
201
- index = scanned.end + 1;
202
- }
203
- } else {
204
- out += char;
205
- index++;
206
- }
207
- }
208
- return {
209
- source: out,
210
- sources
211
- };
212
- };
213
- var DIRECT = null;
214
- var REGEX_INNER_SLASH = /\/(?!$)/;
215
- var REPLACERS = [
216
- [
217
- // Remove BOM
218
- // TODO:
219
- // Other similar zero-width characters?
220
- /^\uFEFF/,
221
- () => EMPTY,
222
- "\uFEFF"
223
- ],
224
- [
225
- // A trailing line terminator, left on when a whole file's contents are
226
- // added as one pattern rather than split into lines. git never sees one
227
- // -- it reads a `.gitignore` line by line -- so it is not part of the
228
- // pattern and is dropped here, apart from the trailing-space trimming,
229
- // which follows git in touching spaces and nothing else.
230
- /[\r\n]+$/,
231
- () => EMPTY
232
- ],
233
- // > Trailing spaces are ignored unless they are quoted with backslash ("\")
234
- [
235
- // Only spaces, never tabs or other whitespace: git trims a trailing run
236
- // of `' '` and nothing else (dir.c, `trim_trailing_spaces`, a single
237
- // `case ' '`), so a pattern ending in a tab keeps it as a literal.
238
- // (a\ ) -> (a )
239
- // (a ) -> (a)
240
- // (a ) -> (a)
241
- // (a \ ) -> (a )
242
- /((?:\\\\)*?)(\\? +)$/,
243
- (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
244
- ],
245
- // Replace (\ ) with ' '
246
- // Only a space: an escaped tab or other whitespace is already a literal by
247
- // the time it reaches here, and a bare tab must be left as one, not turned
248
- // into a space.
249
- // (\ ) -> ' '
250
- // (\\ ) -> '\\ '
251
- // (\\\ ) -> '\\ '
252
- [
253
- /(\\+?) /g,
254
- (_, m1) => {
255
- const { length } = m1;
256
- return m1.slice(0, length - length % 2) + SPACE;
257
- }
258
- ],
259
- // Escape metacharacters
260
- // which is written down by users but means special for regular expressions.
261
- // > There are 12 characters with special meanings:
262
- // > - the backslash \,
263
- // > - the caret ^,
264
- // > - the dollar sign $,
265
- // > - the period or dot .,
266
- // > - the vertical bar or pipe symbol |,
267
- // > - the question mark ?,
268
- // > - the asterisk or star *,
269
- // > - the plus sign +,
270
- // > - the opening parenthesis (,
271
- // > - the closing parenthesis ),
272
- // > - and the opening square bracket [,
273
- // > - the opening curly brace {,
274
- // > These special characters are often called "metacharacters".
275
- [
276
- /[\\$.|*+(){^]/g,
277
- (match) => `\\${match}`
278
- ],
279
- [
280
- // > a question mark (?) matches a single character
281
- /(?!\\)\?/g,
282
- () => "[^/]",
283
- "?"
284
- ],
285
- // leading slash
286
- [
287
- // > A leading slash matches the beginning of the pathname.
288
- // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
289
- // A leading slash matches the beginning of the pathname
290
- /^\//,
291
- () => "^",
292
- SLASH2
293
- ],
294
- // replace special metacharacter slash after the leading slash
295
- [
296
- /\//g,
297
- () => "\\/",
298
- SLASH2
299
- ],
300
- [
301
- // > A leading "**" followed by a slash means match in all directories.
302
- // > For example, "**/foo" matches file or directory "foo" anywhere,
303
- // > the same as pattern "foo".
304
- // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
305
- // > under directory "foo".
306
- // Notice that the '*'s have been replaced as '\\*'
307
- /^\^*(?:\\\*\\\*\\\/)+/,
308
- // '**/foo' <-> 'foo'
309
- () => "^(?:.*\\/)?",
310
- "*"
311
- ],
312
- // starting
313
- [
314
- // there will be no leading '/'
315
- // (which has been replaced by section "leading slash")
316
- // If starts with '**', adding a '^' to the regular expression also works
317
- DIRECT,
318
- (source, pattern) => {
319
- if (!source || source[0] === "^") {
320
- return source;
321
- }
322
- const anchor2 = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
323
- return anchor2 + source;
324
- }
325
- ],
326
- // two globstars
327
- [
328
- // Use lookahead assertions so that we could match more than one `'/**'`
329
- /\\\/\\\*\\\*(?=\\\/|$)/g,
330
- // Zero, one or several directories
331
- // should not use '*', or it will be replaced by the next replacer
332
- // Check if it is not the last `'/**'`
333
- (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
334
- "*"
335
- ],
336
- // normal intermediate wildcards
337
- [
338
- // Never replace escaped '*'
339
- // ignore rule '\*' will match the path '*'
340
- // 'abc.*/' -> go
341
- // 'abc.*' -> skip this rule,
342
- // coz trailing single wildcard will be handed by [trailing wildcard]
343
- /(^|[^\\]+)(\\\*)+(?=.+)/g,
344
- // '*.js' matches '.js'
345
- // '*.js' doesn't match 'abc'
346
- (_, p1, p2) => {
347
- const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
348
- return p1 + unescaped;
349
- },
350
- "*"
351
- ],
352
- // trailing wildcard, held apart from a literal star
353
- [
354
- // The step above leaves a trailing `*` alone, so a single `\*` is all that
355
- // can be left at the end here. Whether it is a wildcard or a literal
356
- // turns on the backslashes the user put in front of it: the escaper has
357
- // since doubled every one, so what stands here is those `2N` doubled
358
- // backslashes and then the star's own escape. An even number of the
359
- // original `N` leaves the star unescaped -- a wildcard -- and an odd
360
- // number escapes it -- a literal. This runs while the two are still
361
- // distinct, before the unescape steps below collapse the literal onto
362
- // the very `\*` a wildcard leaves behind.
363
- /(^|[^\\])((?:\\\\)*)\\\*$/,
364
- (match, p1, p2) => (
365
- // `p2` holds the doubled user backslashes; half of them is `N`.
366
- p2.length / 2 % 2 === 0 ? p1 + p2 + TRAILING_WILDCARD : match
367
- ),
368
- "*"
369
- ],
370
- [
371
- // unescape, revert step 3 except for back slash
372
- // For example, if a user escape a '\\*',
373
- // after step 3, the result will be '\\\\\\*'
374
- /\\\\\\(?=[$.|*+(){^])/g,
375
- () => ESCAPE,
376
- ESCAPE + ESCAPE
377
- ],
378
- [
379
- // '\\\\' -> '\\'
380
- /\\\\/g,
381
- () => ESCAPE,
382
- ESCAPE + ESCAPE
383
- ],
384
- [
385
- // Every real bracket expression -- POSIX classes included -- has already
386
- // been held aside by `extractBrackets`, so the only `[` left in the
387
- // pattern is an escaped, literal one.
388
- // `\` is escaped by step 3
389
- /\\\[([^\]/]*?)(\\*)($|\])/g,
390
- // '\\[bar]' -> '\\\\[bar\\]'
391
- (match, range, endEscape, close) => `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`,
392
- "["
393
- ],
394
- // ending
395
- [
396
- // 'js' will not match 'js.'
397
- // 'ab' will not match 'abc'
398
- DIRECT,
399
- // WTF!
400
- // https://git-scm.com/docs/gitignore
401
- // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
402
- // which re-fixes #24, #38
403
- // > If there is a separator at the end of the pattern then the pattern
404
- // > will only match directories, otherwise the pattern can match both
405
- // > files and directories.
406
- // 'js*' will not match 'a.js'
407
- // 'js/' will not match 'a.js'
408
- // 'js' will match 'a.js' and 'a.js/'
409
- (source) => {
410
- const last = source[source.length - 1];
411
- if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
412
- return source;
413
- }
414
- return last === SLASH2 ? `${source}$` : `${source}(?=$|\\/$)`;
415
- }
416
- ]
417
- ];
418
- var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
419
- var MODE_IGNORE = "regex";
420
- var MODE_CHECK_IGNORE = "checkRegex";
421
- var UNDERSCORE = "_";
422
- var replaceTrailingWildcard = (_, p1) => {
423
- const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
424
- return `${prefix}(?=$|\\/$)`;
425
- };
426
- var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
427
- var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
428
- var WILDCARD = "[^\\/]*";
429
- var separatorAfter = (run, at) => {
430
- let separator = EMPTY;
431
- for (let index = at + 1; index < run.length && !run[index].wildcard; index++) {
432
- separator += run[index].single;
433
- }
434
- return separator;
435
- };
436
- var pinWildcards = (source) => {
437
- if (source.indexOf(WILDCARD) < 0) {
438
- return source;
439
- }
440
- const tokens = [];
441
- const { length } = source;
442
- let index = 0;
443
- while (index < length) {
444
- const char = source[index];
445
- if (source.startsWith(WILDCARD, index)) {
446
- tokens.push({ wildcard: true });
447
- index += WILDCARD.length;
448
- } else if (char === "[") {
449
- let end = index + 1;
450
- if (source[end] === "^") {
451
- end++;
452
- }
453
- if (source[end] === "]") {
454
- end++;
455
- }
456
- while (end < length && source[end] !== "]") {
457
- end += source[end] === ESCAPE ? 2 : 1;
458
- }
459
- end++;
460
- tokens.push({ single: source.slice(index, end) });
461
- index = end;
462
- } else if (char === ESCAPE) {
463
- tokens.push({ single: source.slice(index, index + 2) });
464
- index += 2;
465
- } else if (char === "(") {
466
- let depth = 0;
467
- let end = index;
468
- do {
469
- if (source[end] === ESCAPE) {
470
- end++;
471
- } else if (source[end] === "(") {
472
- depth++;
473
- } else if (source[end] === ")") {
474
- depth--;
475
- }
476
- end++;
477
- } while (end < length && depth > 0);
478
- if ("*+?".indexOf(source[end]) >= 0) {
479
- end++;
480
- }
481
- tokens.push({ boundary: source.slice(index, end) });
482
- index = end;
483
- } else if (char === "^" || char === "$") {
484
- tokens.push({ boundary: char });
485
- index++;
486
- } else {
487
- tokens.push({ single: char });
488
- index++;
489
- }
490
- }
491
- let out = EMPTY;
492
- let run = [];
493
- const flush = () => {
494
- let lastWildcard;
495
- run.forEach((token, at) => {
496
- if (token.wildcard) {
497
- lastWildcard = at;
498
- }
499
- });
500
- run.forEach((token, at) => {
501
- if (!token.wildcard) {
502
- out += token.single;
503
- return;
504
- }
505
- out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
506
- });
507
- run = [];
508
- };
509
- tokens.forEach((token) => {
510
- if (token.boundary === void 0) {
511
- run.push(token);
512
- return;
513
- }
514
- flush();
515
- out += token.boundary;
516
- });
517
- flush();
518
- return out;
519
- };
520
- var makeRegexPrefix = (pattern) => {
521
- const { source, sources } = extractBrackets(pattern);
522
- const replaced = REPLACERS.reduce(
523
- // A pass whose matcher finds nothing hands back the very string it was
524
- // given, so asking first costs a search and saves a rewrite. Ten of the
525
- // fifteen passes never fire for a typical .gitignore line, and between
526
- // them they were 45% of this chain.
527
- (prev, [matcher, replacer, required2]) => {
528
- if (matcher === DIRECT) {
529
- return replacer(prev, pattern);
530
- }
531
- if (required2 !== UNDEFINED && prev.indexOf(required2) < 0) {
532
- return prev;
533
- }
534
- return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
535
- },
536
- source
537
- );
538
- return sources.length ? replaced.replace(
539
- REGEX_RESTORE_PLACEHOLDER,
540
- (match, index) => sources[index]
541
- ) : replaced;
542
- };
543
- var checkSourceOf = (body, prefix) => {
544
- if (body[body.length - 1] === SLASH2) {
545
- prefix = makeRegexPrefix(body.slice(0, -1));
546
- }
547
- const head = prefix.slice(0, -1);
548
- const last = prefix[prefix.length - 1];
549
- return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
550
- };
551
- var matchesBasename = (body) => {
552
- const index = body.indexOf(SLASH2);
553
- return index < 0 || index === body.length - 1;
554
- };
555
- var basenameOf = (path) => {
556
- const end = path.length - 1;
557
- const index = path.lastIndexOf(
558
- SLASH2,
559
- path[end] === SLASH2 ? end - 1 : end
560
- );
561
- return index < 0 ? path : path.slice(index + 1);
562
- };
563
- var parentOf = (path) => {
564
- if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
565
- const slices = path.split(SLASH2).filter(Boolean);
566
- slices.pop();
567
- return slices.length ? slices.join(SLASH2) + SLASH2 : EMPTY;
568
- }
569
- const end = path.length - 1;
570
- const cut = path.lastIndexOf(
571
- SLASH2,
572
- path.charCodeAt(end) === SLASH_CODE ? end - 1 : end
573
- );
574
- return cut < 0 ? EMPTY : path.slice(0, cut + 1);
575
- };
576
- var isString = (subject) => typeof subject === "string";
577
- var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
578
- var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
579
- var IgnoreRule = class {
580
- constructor(pattern, mark, body, ignoreCase, negative, prefix) {
581
- this.pattern = pattern;
582
- this.mark = mark;
583
- this.negative = negative;
584
- define(this, "body", body);
585
- define(this, "ignoreCase", ignoreCase);
586
- define(this, "regexPrefix", prefix);
587
- }
588
- // Worked out on first use and kept behind an own property, the way `regex`
589
- // caches itself in `_regex`. Deciding it in the constructor instead would
590
- // add a fourth `defineProperty` to every rule ever built, which cost 4% of
591
- // every compile -- including the compiles of rules that are never matched
592
- // against anything.
593
- get _basenameOnly() {
594
- return define(this, "_basenameOnly", matchesBasename(this.body));
595
- }
596
- get regex() {
597
- const key = UNDERSCORE + MODE_IGNORE;
598
- if (this[key]) {
599
- return this[key];
600
- }
601
- return this._make(MODE_IGNORE, key);
602
- }
603
- get checkRegex() {
604
- const key = UNDERSCORE + MODE_CHECK_IGNORE;
605
- if (this[key]) {
606
- return this[key];
607
- }
608
- return this._make(MODE_CHECK_IGNORE, key);
609
- }
610
- _make(mode, key) {
611
- const str = pinWildcards(
612
- mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix)
613
- );
614
- const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
615
- return define(this, key, regex);
616
- }
617
- };
618
- var createRule = ({
619
- pattern,
620
- mark
621
- }, ignoreCase) => {
622
- let negative = false;
623
- let body = pattern;
624
- if (body.indexOf("!") === 0) {
625
- negative = true;
626
- body = body.substr(1);
627
- }
628
- body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
629
- const regexPrefix = makeRegexPrefix(body);
630
- return new IgnoreRule(
631
- pattern,
632
- mark,
633
- body,
634
- ignoreCase,
635
- negative,
636
- regexPrefix
637
- );
638
- };
639
- var RuleManager = class {
640
- constructor(ignoreCase) {
641
- this._ignoreCase = ignoreCase;
642
- this._rules = [];
643
- this._basenameCount = 0;
644
- }
645
- _add(pattern) {
646
- if (pattern && pattern[KEY_IGNORE]) {
647
- this._rules = this._rules.concat(pattern._rules._rules);
648
- this._basenameCount += pattern._rules._basenameCount;
649
- this._added = true;
650
- return;
651
- }
652
- if (isString(pattern)) {
653
- pattern = {
654
- pattern
655
- };
656
- }
657
- if (checkPattern(pattern.pattern)) {
658
- const rule = createRule(pattern, this._ignoreCase);
659
- this._added = true;
660
- this._rules.push(rule);
661
- if (matchesBasename(rule.body)) {
662
- this._basenameCount++;
663
- }
664
- }
665
- }
666
- // @param {Array<string> | string | Ignore} pattern
667
- add(pattern) {
668
- this._added = false;
669
- makeArray(
670
- isString(pattern) ? splitPattern(pattern) : pattern
671
- ).forEach(this._add, this);
672
- if (this._added) {
673
- this._literalRules = UNDEFINED;
674
- }
675
- return this._added;
676
- }
677
- // Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
678
- // ending in a wildcard can match it (see `checkSourceOf`), so the rest
679
- // are left out once, rather than tested or compiled for every path.
680
- testLiteral(path) {
681
- const rules = this._literalRules || (this._literalRules = this._rules.filter(
682
- ({ body }) => body[body.length - (body[body.length - 1] === SLASH2 ? 2 : 1)] === "*"
683
- ));
684
- let ignored = false;
685
- let unignored = false;
686
- let matchedRule;
687
- for (let index = rules.length - 1; index >= 0; index--) {
688
- const rule = rules[index];
689
- if (rule.checkRegex.test(path)) {
690
- ignored = !rule.negative;
691
- unignored = rule.negative;
692
- matchedRule = rule.negative ? UNDEFINED : rule;
693
- break;
694
- }
695
- }
696
- const ret = {
697
- ignored,
698
- unignored
699
- };
700
- if (matchedRule) {
701
- ret.rule = matchedRule;
702
- }
703
- return ret;
704
- }
705
- // Test one single path without recursively checking parent directories
706
- //
707
- // - checkUnignored `boolean` whether should check if the path is unignored,
708
- // setting `checkUnignored` to `false` could reduce additional
709
- // path matching.
710
- // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
711
- // @returns {TestResult} true if a file is ignored
712
- test(path, checkUnignored, mode) {
713
- let ignored = false;
714
- let unignored = false;
715
- let matchedRule;
716
- const rules = this._rules;
717
- const { length } = rules;
718
- const shortcut = this._basenameCount * 2 >= length;
719
- const basename7 = shortcut ? basenameOf(path) : path;
720
- for (let index = 0; index < length; index++) {
721
- const rule = rules[index];
722
- const { negative } = rule;
723
- const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
724
- if (!skip && rule[mode].test(
725
- shortcut && rule._basenameOnly ? basename7 : path
726
- )) {
727
- ignored = !negative;
728
- unignored = negative;
729
- matchedRule = negative ? UNDEFINED : rule;
730
- }
731
- }
732
- const ret = {
733
- ignored,
734
- unignored
735
- };
736
- if (matchedRule) {
737
- ret.rule = matchedRule;
738
- }
739
- return ret;
740
- }
741
- };
742
- var throwError = (message, Ctor) => {
743
- throw new Ctor(message);
744
- };
745
- var checkPath = (path, originalPath, doThrow) => {
746
- if (!isString(path)) {
747
- return doThrow(
748
- `path must be a string, but got \`${originalPath}\``,
749
- TypeError
750
- );
751
- }
752
- if (!path) {
753
- return doThrow(`path must not be empty`, TypeError);
754
- }
755
- if (checkPath.isNotRelative(path)) {
756
- const r = "`path.relative()`d";
757
- return doThrow(
758
- `path should be a ${r} string, but got "${originalPath}"`,
759
- RangeError
760
- );
761
- }
762
- return true;
763
- };
764
- var isNotRelative = (path) => {
765
- const first = path.charCodeAt(0);
766
- if (first === SLASH_CODE) {
767
- return true;
768
- }
769
- if (first !== DOT_CODE) {
770
- return false;
771
- }
772
- if (path.length === 1) {
773
- return true;
774
- }
775
- const second = path.charCodeAt(1);
776
- if (second === SLASH_CODE) {
777
- return true;
778
- }
779
- if (second !== DOT_CODE) {
780
- return false;
781
- }
782
- return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
783
- };
784
- checkPath.isNotRelative = isNotRelative;
785
- checkPath.convert = (p) => p;
786
- var Ignore = class {
787
- constructor({
788
- ignorecase = true,
789
- ignoreCase = ignorecase,
790
- allowRelativePaths = false
791
- } = {}) {
792
- define(this, KEY_IGNORE, true);
793
- this._rules = new RuleManager(ignoreCase);
794
- this._strictPathCheck = !allowRelativePaths;
795
- this._initCache();
796
- }
797
- _initCache() {
798
- this._ignoreCache = /* @__PURE__ */ Object.create(null);
799
- this._testCache = /* @__PURE__ */ Object.create(null);
800
- }
801
- add(pattern) {
802
- if (this._rules.add(pattern)) {
803
- this._initCache();
804
- }
805
- return this;
806
- }
807
- // legacy
808
- addPattern(pattern) {
809
- return this.add(pattern);
810
- }
811
- // @returns {TestResult}
812
- _test(originalPath, cache, checkUnignored) {
813
- const path = originalPath && checkPath.convert(originalPath);
814
- checkPath(
815
- path,
816
- originalPath,
817
- this._strictPathCheck ? throwError : RETURN_FALSE
818
- );
819
- return this._t(path, cache, checkUnignored);
820
- }
821
- checkIgnore(path) {
822
- if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
823
- return this.test(path);
824
- }
825
- const dir = this._t(path, this._testCache, true);
826
- if (dir.ignored) {
827
- return dir;
828
- }
829
- const literal2 = this._rules.testLiteral(path);
830
- return literal2.ignored || literal2.unignored ? literal2 : dir;
831
- }
832
- _t(path, cache, checkUnignored) {
833
- if (path in cache) {
834
- return cache[path];
835
- }
836
- const parentPath = parentOf(path);
837
- const parent = parentPath ? this._t(parentPath, cache, checkUnignored) : UNDEFINED;
838
- return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
839
- }
840
- ignores(path) {
841
- return this._test(path, this._ignoreCache, false).ignored;
842
- }
843
- createFilter() {
844
- return (path) => !this.ignores(path);
845
- }
846
- filter(paths) {
847
- return makeArray(paths).filter(this.createFilter());
848
- }
849
- // @returns {TestResult}
850
- test(path) {
851
- return this._test(path, this._testCache, true);
852
- }
853
- };
854
- var factory = (options) => new Ignore(options);
855
- var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
856
- var setupWindows = () => {
857
- const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
858
- checkPath.convert = makePosix;
859
- const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
860
- checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
861
- };
862
- if (
863
- // Detect `process` so that it can run in browsers.
864
- typeof process !== "undefined" && process.platform === "win32"
865
- ) {
866
- setupWindows();
867
- }
868
- module.exports = factory;
869
- factory.default = factory;
870
- module.exports.isPathValid = isPathValid;
871
- define(module.exports, /* @__PURE__ */ Symbol.for("setupWindows"), setupWindows);
872
- }
873
- });
874
6
 
875
7
  // src/intro.ts
876
- import { readFileSync as readFileSync19 } from "fs";
8
+ import { readFileSync as readFileSync3 } from "fs";
877
9
 
878
10
  // src/present.ts
879
11
  var SHADE = {
@@ -928,26 +60,6 @@ function fenced(body) {
928
60
  return [fence, body, fence].join("\n");
929
61
  }
930
62
 
931
- // ../../packages/plugin-sdk/src/config.ts
932
- import { existsSync as existsSync8 } from "fs";
933
- import { join as join16 } from "path";
934
-
935
- // ../../packages/persistence/src/attached-derived.ts
936
- import { rmSync } from "fs";
937
- import { join } from "path";
938
-
939
- // ../../packages/persistence/src/control-plane-credential.ts
940
- import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
941
- import { join as join2 } from "path";
942
-
943
- // ../../packages/schema/src/drizzle/deferred-migrations.ts
944
- var DEFERRED_MIGRATION_TAGS = [
945
- "0031_audit_capture_by_time_index",
946
- "0032_audit_capture_by_id_index",
947
- "0033_audit_capture_location_index",
948
- "0034_findings_read_indexes"
949
- ];
950
-
951
63
  // ../../packages/schema/src/exception-scope.ts
952
64
  var MINUTE_MS = 6e4;
953
65
  var HOUR_MS = 60 * MINUTE_MS;
@@ -3767,9 +2879,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
3767
2879
  function stripTabAndNewline(value) {
3768
2880
  return value.replace(asciiTabOrNewline, "");
3769
2881
  }
3770
- function urlHostnameOk(url2, hostname5) {
3771
- hostname5.lastIndex = 0;
3772
- return hostname5.test(url2.hostname);
2882
+ function urlHostnameOk(url2, hostname3) {
2883
+ hostname3.lastIndex = 0;
2884
+ return hostname3.test(url2.hostname);
3773
2885
  }
3774
2886
  function urlProtocolOk(url2, protocol) {
3775
2887
  protocol.lastIndex = 0;
@@ -5980,7 +5092,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5980
5092
  var NONE = 0;
5981
5093
  var ASSUMED = 1;
5982
5094
  var PROVEN = 2;
5983
- function isRecursive(inst, stack, resolve2) {
5095
+ function isRecursive(inst, stack, resolve) {
5984
5096
  const cached2 = recursive.get(inst);
5985
5097
  if (cached2 !== void 0)
5986
5098
  return cached2 ? PROVEN : NONE;
@@ -5990,7 +5102,7 @@ function isRecursive(inst, stack, resolve2) {
5990
5102
  let result = NONE;
5991
5103
  const check2 = (child) => {
5992
5104
  if (result !== PROVEN && child?._zod) {
5993
- const answer = isRecursive(child, stack, resolve2);
5105
+ const answer = isRecursive(child, stack, resolve);
5994
5106
  if (answer > result)
5995
5107
  result = answer;
5996
5108
  }
@@ -6001,7 +5113,7 @@ function isRecursive(inst, stack, resolve2) {
6001
5113
  const desc = Object.getOwnPropertyDescriptor(sh, key);
6002
5114
  if (spread && !desc.enumerable)
6003
5115
  continue;
6004
- 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;
6005
5117
  if (child > answer)
6006
5118
  answer = child;
6007
5119
  }
@@ -6065,7 +5177,7 @@ function isRecursive(inst, stack, resolve2) {
6065
5177
  break;
6066
5178
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
6067
5179
  case "lazy": {
6068
- const inner = def._cachedInner ?? (resolve2 ? inst._zod.innerType : void 0);
5180
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
6069
5181
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
6070
5182
  break;
6071
5183
  }
@@ -20738,8 +19850,8 @@ var PLATFORM_HOSTING = /* @__PURE__ */ new Map([
20738
19850
  ["ollama", "local"],
20739
19851
  ["local", "local"]
20740
19852
  ]);
20741
- function hostingFor(platform2) {
20742
- return PLATFORM_HOSTING.get(platform2) ?? "api";
19853
+ function hostingFor(platform) {
19854
+ return PLATFORM_HOSTING.get(platform) ?? "api";
20743
19855
  }
20744
19856
  var FIRST_PARTY = /* @__PURE__ */ new Map([
20745
19857
  ["anthropic", "anthropic"],
@@ -20753,8 +19865,8 @@ var FIRST_PARTY = /* @__PURE__ */ new Map([
20753
19865
  function firstPartyPlatformFor(vendor2) {
20754
19866
  return FIRST_PARTY.get(vendor2) ?? null;
20755
19867
  }
20756
- function isFirstParty(vendor2, platform2) {
20757
- return FIRST_PARTY.get(vendor2) === platform2;
19868
+ function isFirstParty(vendor2, platform) {
19869
+ return FIRST_PARTY.get(vendor2) === platform;
20758
19870
  }
20759
19871
  var PLATFORM_NAMESPACES = Object.freeze([
20760
19872
  "anthropic",
@@ -20815,14 +19927,14 @@ var ModelVendorBuilder = class {
20815
19927
  );
20816
19928
  }
20817
19929
  for (const ref of spec.on ?? []) {
20818
- const { platform: platform2, price, retention, region } = normalizeRef(ref);
20819
- const firstParty = isFirstParty(this.vendor, platform2);
20820
- const hosting = hostingFor(platform2);
19930
+ const { platform, price, retention, region } = normalizeRef(ref);
19931
+ const firstParty = isFirstParty(this.vendor, platform);
19932
+ const hosting = hostingFor(platform);
20821
19933
  const isSelfHosted = hosting === "local";
20822
19934
  platforms.set(
20823
- platform2,
19935
+ platform,
20824
19936
  Object.freeze({
20825
- platform: platform2,
19937
+ platform,
20826
19938
  hosting,
20827
19939
  firstParty,
20828
19940
  price: price ?? (isSelfHosted ? ZERO_PRICE : firstParty ? spec.price ?? null : null),
@@ -20972,7 +20084,7 @@ anthropic.model("claude-haiku-4-5", {
20972
20084
  name: "Claude Haiku 4.5",
20973
20085
  ctx: 2e5,
20974
20086
  maxOut: 64e3,
20975
- // Reviewed: fast/cheap tier, no flagged reasoning or code specialisation.
20087
+ // Reviewed: fast/cheap general-purpose tier, not a reasoning or code model.
20976
20088
  capability: null,
20977
20089
  price: anthropicPrice(1, 5, 0.1),
20978
20090
  // The vendor documents `claude-haiku-4-5-20251001` as the versioned id and
@@ -21103,6 +20215,11 @@ openai.model("gpt-4o", {
21103
20215
  price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
21104
20216
  on: [...OPENAI_RESELLERS]
21105
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
+ });
21106
20223
  openai.model("gpt-4o-mini", {
21107
20224
  name: "GPT-4o mini",
21108
20225
  price: tokenPrice(0.15, 0.6, { cacheRead: 0.075 }),
@@ -21122,6 +20239,24 @@ openai.model("o3", {
21122
20239
  price: tokenPrice(2, 8, { cacheRead: 0.5 }),
21123
20240
  on: [...OPENAI_RESELLERS]
21124
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
+ });
21125
20260
  openai.model("gpt-oss-120b", {
21126
20261
  name: "GPT-OSS 120B",
21127
20262
  openWeights: true,
@@ -21408,10 +20543,21 @@ var MODEL_ENTRIES = Object.freeze([
21408
20543
  ...alibaba.models(),
21409
20544
  ...amazon.models()
21410
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
+ );
21411
20557
  var MODEL_INDEX = buildModelIndex(MODEL_ENTRIES);
21412
20558
 
21413
20559
  // ../../packages/schema/src/model/governance.ts
21414
- var ModelCapability = external_exports.enum(["reasoning", "code"]);
20560
+ var ModelCapability = external_exports.enum(["reasoning", "code", "embedding"]);
21415
20561
  var DataRetention = external_exports.enum([
21416
20562
  "zero_retention",
21417
20563
  "no_storage",
@@ -22172,6 +21318,11 @@ var CaptureAttributes = external_exports.object({
22172
21318
  // here too. The full statement is on EventMetadata.redactDegradedTo; it is
22173
21319
  // repeated rather than referenced because a store reader opens this file.
22174
21320
  redact_degraded_to: ActionTaken.optional(),
21321
+ // Why a capture has no content and no findings: its field was refused
21322
+ // because its bounded scan did not finish (see EventMetadata.scanIncomplete,
21323
+ // whose value this is). Absent on every capture that was scanned, so a
21324
+ // reader can tell a refused row from an empty clean one.
21325
+ scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
22175
21326
  // The scope key this capture was stamped with: the canonical repository
22176
21327
  // (`host/owner/repo`) of the path the capture names (a relative path is read
22177
21328
  // against its working directory), else of its own working directory, or a
@@ -22349,8 +21500,9 @@ var SessionTokenReport = external_exports.object({
22349
21500
  totalTokens: external_exports.number().int().nonnegative(),
22350
21501
  // Σ of the PRICED rollups only; null when no rollup had a known price.
22351
21502
  estimatedCostUsd: external_exports.number().nullable(),
22352
- // True whenever any rollup has a null cost (unknown provider/model), so the
22353
- // total understates real spend — the UI renders `≥ $X` instead of a falsely
21503
+ // True whenever any call priced to null (an unknown provider/model, or a call
21504
+ // over a long-context threshold whose rate is unpublished), so the total
21505
+ // understates real spend — the UI renders `≥ $X` instead of a falsely
22354
21506
  // precise figure rather than silently dropping the unpriced calls.
22355
21507
  costIsPartial: external_exports.boolean()
22356
21508
  });
@@ -23196,7 +22348,15 @@ var StorePostureSnapshot = external_exports.object({
23196
22348
  policyCounts: StorePosturePolicyCounts,
23197
22349
  // OPTIONAL, not nullable: a reporter that predates this member keeps
23198
22350
  // getting its 200 without a payload change.
23199
- plugin: StorePosturePlugin.optional()
22351
+ plugin: StorePosturePlugin.optional(),
22352
+ // OPTIONAL, and sent only by a scoped attachment, always as `scoped`. A
22353
+ // machine attachment omits it, so its body is byte for byte the one it
22354
+ // sent before this member existed. Absent therefore means machine-wide OR
22355
+ // a reporter older than this member, never "scoped". Both values parse, so
22356
+ // a sender that one day spells `machine` breaks no receiver; any other
22357
+ // value fails the whole snapshot, which is why the reporter sends a
22358
+ // constant and never the raw mode.
22359
+ attachmentMode: AttachmentMode.optional()
23200
22360
  }).meta({ id: "StorePostureSnapshot" });
23201
22361
  var CAPTURE_VERSION_PREFIX = "capture/";
23202
22362
  var RecordAuditEventRequest = AuditEventInput.extend({
@@ -23473,7 +22633,19 @@ var EventMetadata = external_exports.object({
23473
22633
  // Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
23474
22634
  // Closing either means moving the reason onto the finding row, which
23475
22635
  // already carries its own action.
23476
- redactDegradedTo: ActionTaken.optional()
22636
+ redactDegradedTo: ActionTaken.optional(),
22637
+ // Set when this capture's field was REFUSED rather than scanned: a hook
22638
+ // bounds the scan of a large field (see `LargeInputScanOptions` in
22639
+ // @akasecurity/plugin-sdk), and a scan that did not finish blocks the
22640
+ // field instead of letting it through unscanned.
22641
+ //
22642
+ // - 'timeout': the bounded scan ran out of time.
22643
+ // - 'unavailable': no worker could run it.
22644
+ //
22645
+ // A refused row stores '' as its content and has no findings, which is
22646
+ // exactly what a clean, empty capture looks like — this marker is the only
22647
+ // thing that tells the two apart. Absent on every capture that was scanned.
22648
+ scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
23477
22649
  }).meta({ id: "EventMetadata" });
23478
22650
  var Event = external_exports.object({
23479
22651
  id: external_exports.guid(),
@@ -23643,7 +22815,7 @@ var Rule = external_exports.strictObject({
23643
22815
  postValidators: external_exports.array(PostValidatorRef).optional(),
23644
22816
  requiresNearby: RequiresNearby.optional(),
23645
22817
  examples: external_exports.array(external_exports.string()).optional(),
23646
- // Whether the matched text is itself sensitive. Absent means 'value'.
22818
+ // Whether the matched text is itself sensitive (see RuleEvidence).
23647
22819
  evidence: RuleEvidence.optional()
23648
22820
  }).meta({ id: "Rule" });
23649
22821
  var Author = external_exports.object({
@@ -23735,7 +22907,13 @@ var DetectionRule = external_exports.object({
23735
22907
  // Representative matching strings the rule author shipped with the rule. The
23736
22908
  // cheapest honest answer to "show me what this rule catches" — every bundled
23737
22909
  // rule has them, and they are already in the stored snapshot.
23738
- examples: external_exports.array(external_exports.string()).optional()
22910
+ examples: external_exports.array(external_exports.string()).optional(),
22911
+ // The rule's DECLARED evidence, as stored. Absent defers to the engine's
22912
+ // classification (ruleEvidence in @akasecurity/detections): a bundled
22913
+ // code-flaw rule reads as 'code' and anything else as 'value', and a rule
22914
+ // in a value category (secret/pii/financial/phi) is always 'value',
22915
+ // whatever it declares.
22916
+ evidence: RuleEvidence.optional()
23739
22917
  }).meta({ id: "DetectionRule" });
23740
22918
  var DetectionUpdate = external_exports.object({
23741
22919
  available: external_exports.boolean(),
@@ -24001,11 +23179,14 @@ var PolicyBundle = external_exports.object({
24001
23179
  ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
24002
23180
  // Model ids (the raw `model` string a harness reports, e.g.
24003
23181
  // `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
24004
- // a session onto one (PreModelSwitch) and refuses a turn that would run on
24005
- // one (UserPromptSubmit). Optional so an older backend — and an older
24006
- // on-disk cache — still parses; consumers read `?? []`, which is the
24007
- // unenforced behaviour that predates this field and the safe direction to
24008
- // default.
23182
+ // a session onto one (PreModelSwitch), refuses a turn that would run on one
23183
+ // (UserPromptSubmit) and refuses a subagent spawn onto one (PreToolUse),
23184
+ // wherever the organization governs the event: everywhere on a
23185
+ // machine-wide attachment, and only in enrolled repositories on a scoped
23186
+ // one (the plugin runtime's `governanceApplies`).
23187
+ // Optional so an older backend — and an older on-disk cache — still
23188
+ // parses; consumers read `?? []`, which is the unenforced behaviour that
23189
+ // predates this field and the safe direction to default.
24009
23190
  //
24010
23191
  // Ids, not display names: the governance decision is keyed on the exact
24011
23192
  // string the harness reports (`model_status_override.versionId` in the
@@ -24345,6 +23526,8 @@ var AttachmentScopeEntry = external_exports.object({
24345
23526
  });
24346
23527
  var AttachmentScope = external_exports.object({
24347
23528
  endpoint: external_exports.string().min(1),
23529
+ tenantName: PluginWhoami.shape.tenantName.optional(),
23530
+ userEmail: PluginWhoami.shape.userEmail.optional(),
24348
23531
  entries: external_exports.array(AttachmentScopeEntry)
24349
23532
  });
24350
23533
  var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
@@ -24553,6 +23736,27 @@ var ManagedSettings = external_exports.object({
24553
23736
  };
24554
23737
  }).meta({ id: "ManagedSettings" });
24555
23738
 
23739
+ // ../../packages/schema/src/zod/mod-policy-snapshot.ts
23740
+ var MOD_POLICY_SNAPSHOT_VERSION = 1;
23741
+ var MOD_POLICY_SNAPSHOT_MAX_BYTES = 4 * 1024 * 1024;
23742
+ var ModPolicySnapshot = external_exports.object({
23743
+ version: external_exports.literal(MOD_POLICY_SNAPSHOT_VERSION),
23744
+ generatedAt: external_exports.iso.datetime(),
23745
+ // The complete effective ruleset, as the hook's runtime scans with it: the
23746
+ // user's enabled installed packs (user-modified and custom packs included).
23747
+ // Absent means the store holds no authoritative snapshot, and the reader
23748
+ // scans with the packs it ships — the hook's own fallback.
23749
+ rules: external_exports.array(Rule).optional(),
23750
+ // Rule-targeted actions (first enabled policy per rule wins).
23751
+ ruleActions: external_exports.record(external_exports.string(), ActionTaken),
23752
+ // The resolved action per detection category.
23753
+ categoryActions: external_exports.record(external_exports.string(), ActionTaken),
23754
+ // Rules with an active exception grant. Honouring a grant means matching a
23755
+ // keyed fingerprint of the value and consuming a use, which only the hook can
23756
+ // do, so the mod leaves a finding of one of these rules for the hook to decide.
23757
+ exceptionRuleIds: external_exports.array(external_exports.string())
23758
+ }).meta({ id: "ModPolicySnapshot" });
23759
+
24556
23760
  // ../../packages/schema/src/zod/project-files.ts
24557
23761
  var ProjectFileInput = external_exports.object({
24558
23762
  path: external_exports.string().min(1),
@@ -24867,7 +24071,16 @@ var AttachInput = external_exports.object({
24867
24071
  // 200 matches the tenantName bound beside it in control-plane.ts; nothing
24868
24072
  // renders a longer one usefully.
24869
24073
  label: printable(200).optional(),
24870
- accessKey: external_exports.string()
24074
+ accessKey: external_exports.string(),
24075
+ // How much of this machine the attachment is for: everything, or only the
24076
+ // repositories its user enrolls. Optional, so an input without it still
24077
+ // parses; what an absent mode means is for whatever reads it to decide, not
24078
+ // this shape. This member validates the VALUE rather than leaving that to the
24079
+ // call site, a deliberate exception to this module's shape-only rule: a shape
24080
+ // rejection names the field, so a value that is not a mode is refused as a bad
24081
+ // `mode` rather than stripped or passed on. The dashboard's attach action reads
24082
+ // it as the mode to attach in.
24083
+ mode: AttachmentMode.optional()
24871
24084
  });
24872
24085
 
24873
24086
  // ../../packages/schema/src/zod/triage.ts
@@ -25080,1271 +24293,9 @@ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
25080
24293
  var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
25081
24294
  var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
25082
24295
 
25083
- // ../../packages/persistence/src/paths.ts
25084
- import {
25085
- chmodSync,
25086
- linkSync,
25087
- lstatSync,
25088
- mkdirSync,
25089
- renameSync,
25090
- rmSync as rmSync2,
25091
- writeFileSync
25092
- } from "fs";
25093
- import { threadId } from "worker_threads";
25094
-
25095
- // ../../packages/persistence/src/database.ts
25096
- import { randomUUID as randomUUID11 } from "crypto";
25097
- import { dirname as dirname2, join as join7, sep } from "path";
25098
- import { DatabaseSync } from "node:sqlite";
25099
-
25100
- // ../../packages/persistence/src/ids.ts
25101
- import { createHash } from "crypto";
25102
-
25103
- // ../../packages/persistence/src/internal/snapshot.ts
25104
- import { randomUUID } from "crypto";
25105
- import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync4, statSync as statSync2 } from "fs";
25106
- import { basename, dirname, join as join3 } from "path";
25107
- var STALE_PARTIAL_MS = 5 * 6e4;
25108
- var SNAPSHOT_STAGING_SUFFIX = ".partial";
25109
- var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
25110
-
25111
- // ../../packages/persistence/src/internal/sql-functions.ts
25112
- var utf8 = new TextDecoder();
25113
-
25114
- // ../../packages/persistence/src/internal/outbox-lane.ts
25115
- var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
25116
- var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
25117
-
25118
- // ../../packages/persistence/src/sync-failure.ts
25119
- var SYNC_FAILURE_REASONS = SyncFailureReason.options;
25120
-
25121
- // ../../packages/persistence/src/repositories/history-sync.ts
25122
- var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
25123
- var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
25124
- var COUNTED_EVENT_TYPES = [
25125
- ...STRUCTURAL_EVENT_TYPES,
25126
- ...OUTBOX_CAPTURE_EVENT_TYPES
25127
- ];
25128
- var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
25129
- var COUNTED_SCOPE = `
25130
- WHERE event_type IN (${COUNTED_TYPE_LIST})
25131
- AND (
25132
- event_type IN (${TYPE_LIST})
25133
- OR synced_at IS NOT NULL
25134
- OR outbox_owed = 1
25135
- )`;
25136
-
25137
- // ../../packages/persistence/src/repositories/activity.ts
25138
- var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
25139
- var DB_EVENT_TYPE_TO_KIND = {
25140
- session: "session",
25141
- prompt: "prompt",
25142
- response: "response",
25143
- tool_call: "tool",
25144
- hook: "hook",
25145
- detection: "detection",
25146
- share: "share",
25147
- permission: "permission",
25148
- commit: "commit",
25149
- error: "error",
25150
- active: "active"
25151
- };
25152
- var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
25153
- var DEFAULT_HARNESS = HARNESS.ClaudeCode;
25154
-
25155
- // ../../packages/persistence/src/repositories/exceptions.ts
25156
- import { randomUUID as randomUUID2 } from "crypto";
25157
- var BLOCKED_DETECTIONS_TTL_MS = 30 * 60 * 1e3;
25158
- var BLOCKED_DETECTIONS_RETENTION_MS = 24 * 60 * 60 * 1e3;
25159
- var ACTIVE_PREDICATE = `revoked_at IS NULL
25160
- AND (expires_at IS NULL OR expires_at > :now)
25161
- AND (max_uses IS NULL OR use_count < max_uses)`;
25162
- var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
25163
- AND conditions IS NULL
25164
- AND ${ACTIVE_PREDICATE}`;
25165
-
25166
- // ../../packages/persistence/src/repositories/resolution-sql.ts
25167
- function latestResolutionColumnSql(column, findingsAlias) {
25168
- return `(
25169
- SELECT fr.${column} FROM finding_resolution fr
25170
- WHERE fr.finding_key = ${findingsAlias}.finding_key
25171
- ORDER BY fr.created_at DESC, fr.rowid DESC
25172
- LIMIT 1
25173
- )`;
25174
- }
25175
- function latestResolutionStatusSql(findingsAlias) {
25176
- return latestResolutionColumnSql("status", findingsAlias);
25177
- }
25178
- var LATEST_RESOLUTION_BY_KEY_SQL = `(
25179
- SELECT finding_key, status, method, resolved_at FROM (
25180
- SELECT fr.finding_key, fr.status, fr.method, fr.resolved_at,
25181
- ROW_NUMBER() OVER (
25182
- PARTITION BY fr.finding_key
25183
- ORDER BY fr.created_at DESC, fr.rowid DESC
25184
- ) AS rn
25185
- FROM finding_resolution fr
25186
- ) WHERE rn = 1
25187
- )`;
25188
-
25189
- // ../../packages/persistence/src/repositories/findings.ts
25190
- var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
25191
- d.severity AS severity, f.masked_match AS masked_match,
25192
- f.action_taken AS action_taken, f.confidence AS confidence,
25193
- e.started_at AS occurred_at,
25194
- e.source_tool AS source_tool,
25195
- e.repo AS repo,
25196
- e.file_path AS file,
25197
- e.tool_name AS tool_name,
25198
- f.audit_event_id AS event_id, e.root_session_id AS session_id,
25199
- e.event_type AS kind, f.finding_key AS finding_key,
25200
- ${latestResolutionStatusSql("f")} AS latest_status,
25201
- e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
25202
- e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
25203
- e.outbox_owed AS outbox_owed,
25204
- f.line AS line, f.col AS col`;
25205
-
25206
- // ../../packages/persistence/src/repositories/installed-packs.ts
25207
- import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
25208
-
25209
- // ../../packages/persistence/src/policy-floor.ts
25210
- import { readFileSync as readFileSync5 } from "fs";
25211
- import { join as join6 } from "path";
25212
-
25213
- // ../../packages/persistence/src/local-layout.ts
25214
- import { renameSync as renameSync3 } from "fs";
25215
- import { mkdir } from "fs/promises";
25216
- import { homedir } from "os";
25217
- import { join as join4 } from "path";
25218
-
25219
- // ../../packages/persistence/src/settings.ts
25220
- import { readFileSync as readFileSync4 } from "fs";
25221
- import { join as join5 } from "path";
25222
-
25223
- // ../../packages/persistence/src/file-lock.ts
25224
- import { randomUUID as randomUUID3 } from "crypto";
25225
- import {
25226
- closeSync,
25227
- existsSync as existsSync2,
25228
- openSync,
25229
- readFileSync as readFileSync2,
25230
- rmSync as rmSync5,
25231
- statSync as statSync3,
25232
- writeFileSync as writeFileSync2
25233
- } from "fs";
25234
- import { hostname as hostname3 } from "os";
25235
- var PARK = new Int32Array(new SharedArrayBuffer(4));
25236
-
25237
- // ../../packages/persistence/src/managed-settings.ts
25238
- import { readFileSync as readFileSync3 } from "fs";
25239
- import { posix, win32 } from "path";
25240
-
25241
- // ../../packages/persistence/src/repositories/inventory-assets.ts
25242
- import { randomUUID as randomUUID5 } from "crypto";
25243
- var VALID_HARNESS_IDS = new Set(HarnessId.options);
25244
- var HARNESS_LABELS = {
25245
- [HARNESS.ClaudeCode]: "Claude Code",
25246
- [HARNESS.Cursor]: "Cursor",
25247
- [HARNESS.Codex]: "Codex",
25248
- [HARNESS.Antigravity]: "Antigravity",
25249
- [HARNESS.Copilot]: "GitHub Copilot"
25250
- };
25251
- var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
25252
- var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
25253
- var TITLE_NEEDLES = {
25254
- ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
25255
- Cursor: stripSeparators(SOURCE_TOOL.Cursor),
25256
- Codex: stripSeparators(SOURCE_TOOL.Codex),
25257
- Antigravity: stripSeparators(SOURCE_TOOL.Antigravity),
25258
- // 'githubcopilot', not 'copilot'. The needle is the stripped WIRE id like
25259
- // every other row, and the wire id carries the vendor: a bare 'copilot'
25260
- // needle would also match any title that merely contains the word.
25261
- Copilot: stripSeparators(SOURCE_TOOL.Copilot)
25262
- };
25263
-
25264
- // ../../packages/persistence/src/repositories/policies.ts
25265
- import { randomUUID as randomUUID6 } from "crypto";
25266
-
25267
- // ../../packages/persistence/src/repositories/project-files.ts
25268
- import { randomUUID as randomUUID7 } from "crypto";
25269
-
25270
- // ../../packages/persistence/src/repositories/resolutions.ts
25271
- import { randomUUID as randomUUID8 } from "crypto";
25272
-
25273
- // ../../packages/persistence/src/repositories/secret-vault.ts
25274
- import { randomUUID as randomUUID9 } from "crypto";
25275
-
25276
- // ../../packages/persistence/src/repositories/security.ts
25277
- var OPEN_AT_REST_FINDINGS_SQL = `FROM inspection_findings f
25278
- JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
25279
- JOIN inspection_definitions d ON d.id = f.inspection_definition_id
25280
- LEFT JOIN ${LATEST_RESOLUTION_BY_KEY_SQL} latest
25281
- ON latest.finding_key = f.finding_key
25282
- WHERE e.event_type IN (${CAPTURE_EVENT_TYPES_SQL})
25283
- AND e.event_type = 'code_change'
25284
- AND (
25285
- f.finding_key IS NULL
25286
- OR latest.status IS NULL
25287
- OR latest.status NOT IN ('resolved', 'dismissed')
25288
- )`;
25289
- var SCAN_COVERAGE = {
25290
- [HARNESS.Antigravity]: { coverage: 60, supported: true },
25291
- [HARNESS.Api]: { coverage: 0, supported: false },
25292
- [HARNESS.ChatGpt]: { coverage: 40, supported: true },
25293
- [HARNESS.ClaudeAi]: { coverage: 40, supported: true },
25294
- [HARNESS.ClaudeCode]: { coverage: 100, supported: true },
25295
- [HARNESS.Codex]: { coverage: 80, supported: true },
25296
- [HARNESS.Copilot]: { coverage: 30, supported: true },
25297
- [HARNESS.Cursor]: { coverage: 0, supported: false }
25298
- };
25299
-
25300
- // ../../packages/persistence/src/repositories/shares.ts
25301
- import { randomUUID as randomUUID10 } from "crypto";
25302
-
25303
- // ../../packages/persistence/src/database.ts
25304
- var CAPTURE_GRAIN = new Set(EventKind.options);
25305
- var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
25306
-
25307
- // ../../packages/persistence/src/egress-wire.ts
25308
- import { createHash as createHash3 } from "crypto";
25309
- var SLASH = "/".charCodeAt(0);
25310
- var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
25311
-
25312
- // ../../packages/persistence/src/finding-key.ts
25313
- import { createHash as createHash4 } from "crypto";
25314
-
25315
- // ../../packages/persistence/src/fingerprint.ts
25316
- import { createHmac, randomBytes } from "crypto";
25317
- import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
25318
- import { join as join8 } from "path";
25319
- import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
25320
-
25321
- // ../../packages/persistence/src/forward-health.ts
25322
- import { readFileSync as readFileSync7 } from "fs";
25323
- import { join as join9 } from "path";
25324
-
25325
- // ../../packages/persistence/src/history-backfill.ts
25326
- import { existsSync as existsSync4 } from "fs";
25327
- import { join as join10 } from "path";
25328
-
25329
- // ../../packages/persistence/src/history-preview.ts
25330
- import { existsSync as existsSync5 } from "fs";
25331
- import { join as join11 } from "path";
25332
- import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
25333
-
25334
- // ../../packages/persistence/src/history-sync-state.ts
25335
- import { readFileSync as readFileSync8 } from "fs";
25336
- import { join as join12 } from "path";
25337
-
25338
- // ../../packages/persistence/src/store-symlinks.ts
25339
- import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
25340
- import { dirname as dirname3, join as join13, resolve } from "path";
25341
-
25342
- // ../../packages/persistence/src/vault/crypto.ts
25343
- import {
25344
- createCipheriv,
25345
- createDecipheriv,
25346
- createHmac as createHmac2,
25347
- hkdfSync,
25348
- timingSafeEqual
25349
- } from "crypto";
25350
-
25351
- // ../../packages/persistence/src/vault/key-provider.ts
25352
- import { execFileSync } from "child_process";
25353
- import { randomBytes as randomBytes2 } from "crypto";
25354
- import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
25355
- import { join as join14 } from "path";
25356
-
25357
- // ../../packages/persistence/src/vault/vault.ts
25358
- import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
25359
-
25360
- // ../../packages/persistence/src/warn-era-cap.ts
25361
- import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
25362
- import { join as join15 } from "path";
25363
-
25364
- // ../../packages/plugin-sdk/src/provider-env.ts
25365
- var booleanish = external_exports.string().optional().transform((v) => {
25366
- if (v === void 0) return void 0;
25367
- const t = v.trim().toLowerCase();
25368
- if (t === "" || t === "false" || t === "0") return false;
25369
- return true;
25370
- }).catch(void 0);
25371
- var optionalBaseUrl = external_exports.preprocess((v) => {
25372
- if (typeof v === "string" && v.trim() === "") return void 0;
25373
- return v;
25374
- }, external_exports.string().optional()).catch(void 0);
25375
- var providerEnvShape = {
25376
- CLAUDE_CODE_USE_BEDROCK: booleanish,
25377
- CLAUDE_CODE_USE_VERTEX: booleanish,
25378
- ANTHROPIC_BASE_URL: optionalBaseUrl
25379
- };
25380
- var ProviderEnvSchema = external_exports.object(providerEnvShape);
25381
-
25382
- // ../../packages/plugin-sdk/src/config-inventory.ts
25383
- import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
25384
- import { homedir as homedir2 } from "os";
25385
- import { basename as basename3, join as join18 } from "path";
25386
-
25387
- // ../../packages/detections/src/egress/registry.ts
25388
- var EXTRACTOR_VERSION = "3";
25389
- var PROVIDER_REGISTRY = [
25390
- {
25391
- id: "stripe",
25392
- name: "Stripe",
25393
- category: "Payments",
25394
- hostSuffixes: ["stripe.com"],
25395
- apiBase: "https://api.stripe.com",
25396
- defaultDataClasses: ["pii", "customer"],
25397
- sdks: {
25398
- npm: ["stripe"],
25399
- pypi: ["stripe"],
25400
- go: ["github.com/stripe/stripe-go"],
25401
- maven: ["com.stripe"],
25402
- rubygems: ["stripe"],
25403
- composer: ["stripe/stripe-php"],
25404
- nuget: ["Stripe.net"]
25405
- }
25406
- },
25407
- {
25408
- id: "datadog",
25409
- name: "Datadog",
25410
- category: "Observability",
25411
- hostSuffixes: ["datadoghq.com", "datadoghq.eu"],
25412
- apiBase: "https://api.datadoghq.com",
25413
- defaultDataClasses: ["telemetry", "logs", "metrics"],
25414
- sdks: {
25415
- npm: ["dd-trace", "@datadog/browser-logs"],
25416
- pypi: ["datadog", "ddtrace"],
25417
- go: ["github.com/DataDog/dd-trace-go"],
25418
- maven: ["com.datadoghq"],
25419
- rubygems: ["ddtrace", "dogapi"],
25420
- nuget: ["Datadog.Trace"]
25421
- }
25422
- },
25423
- {
25424
- id: "newrelic",
25425
- name: "New Relic",
25426
- category: "Observability",
25427
- hostSuffixes: ["newrelic.com", "nr-data.net"],
25428
- apiBase: "https://api.newrelic.com",
25429
- defaultDataClasses: ["telemetry", "logs", "metrics"],
25430
- sdks: {
25431
- npm: ["newrelic"],
25432
- pypi: ["newrelic"],
25433
- go: ["github.com/newrelic/go-agent"],
25434
- maven: ["com.newrelic.agent.java"],
25435
- rubygems: ["newrelic_rpm"],
25436
- nuget: ["NewRelic.Agent"]
25437
- }
25438
- },
25439
- {
25440
- id: "sentry",
25441
- name: "Sentry",
25442
- category: "Error tracking",
25443
- hostSuffixes: ["sentry.io"],
25444
- apiBase: "https://sentry.io",
25445
- defaultDataClasses: ["source", "telemetry"],
25446
- sdks: {
25447
- npm: ["@sentry/node", "@sentry/react", "@sentry/nextjs"],
25448
- pypi: ["sentry-sdk"],
25449
- go: ["github.com/getsentry/sentry-go"],
25450
- maven: ["io.sentry"],
25451
- rubygems: ["sentry-ruby"],
25452
- cargo: ["sentry"],
25453
- composer: ["sentry/sentry"],
25454
- nuget: ["Sentry"]
25455
- }
25456
- },
25457
- {
25458
- id: "openai",
25459
- name: "OpenAI",
25460
- category: "LLM provider",
25461
- hostSuffixes: ["openai.com"],
25462
- apiBase: "https://api.openai.com",
25463
- defaultDataClasses: ["pii", "source"],
25464
- sdks: {
25465
- npm: ["openai"],
25466
- pypi: ["openai"],
25467
- go: ["github.com/sashabaranov/go-openai"],
25468
- maven: ["com.openai"],
25469
- rubygems: ["ruby-openai"],
25470
- cargo: ["async-openai"],
25471
- composer: ["openai-php/client"],
25472
- nuget: ["OpenAI"]
25473
- }
25474
- },
25475
- {
25476
- id: "anthropic",
25477
- name: "Anthropic",
25478
- category: "LLM provider",
25479
- hostSuffixes: ["anthropic.com"],
25480
- apiBase: "https://api.anthropic.com",
25481
- defaultDataClasses: ["pii", "source"],
25482
- sdks: {
25483
- npm: ["@anthropic-ai/sdk"],
25484
- pypi: ["anthropic"],
25485
- go: ["github.com/anthropics/anthropic-sdk-go"],
25486
- nuget: ["Anthropic.SDK"]
25487
- }
25488
- },
25489
- {
25490
- id: "aws",
25491
- name: "Amazon Web Services",
25492
- category: "Cloud platform",
25493
- hostSuffixes: ["amazonaws.com"],
25494
- apiBase: "https://s3.amazonaws.com",
25495
- defaultDataClasses: ["secrets", "customer"],
25496
- sdks: {
25497
- npm: ["@aws-sdk/client-s3", "aws-sdk"],
25498
- pypi: ["boto3"],
25499
- go: ["github.com/aws/aws-sdk-go", "github.com/aws/aws-sdk-go-v2"],
25500
- maven: ["com.amazonaws", "software.amazon.awssdk"],
25501
- rubygems: ["aws-sdk-s3"],
25502
- cargo: ["aws-sdk-s3"],
25503
- nuget: ["AWSSDK.S3"]
25504
- }
25505
- },
25506
- {
25507
- id: "gcp",
25508
- name: "Google Cloud",
25509
- category: "Cloud platform",
25510
- hostSuffixes: ["googleapis.com"],
25511
- apiBase: "https://storage.googleapis.com",
25512
- defaultDataClasses: ["customer", "logs"],
25513
- sdks: {
25514
- npm: ["@google-cloud/storage"],
25515
- pypi: ["google-cloud-storage"],
25516
- go: ["cloud.google.com/go"],
25517
- maven: ["com.google.cloud"],
25518
- rubygems: ["google-cloud-storage"],
25519
- nuget: ["Google.Cloud.Storage.V1"]
25520
- }
25521
- },
25522
- {
25523
- id: "google-fonts",
25524
- name: "Google Fonts",
25525
- category: "CDN / edge",
25526
- hostSuffixes: ["fonts.googleapis.com", "fonts.gstatic.com"],
25527
- apiBase: "https://fonts.googleapis.com",
25528
- defaultDataClasses: ["none"],
25529
- sdks: {}
25530
- },
25531
- {
25532
- id: "azure",
25533
- name: "Microsoft Azure",
25534
- category: "Cloud platform",
25535
- hostSuffixes: ["azure.com", "windows.net"],
25536
- apiBase: "https://management.azure.com",
25537
- defaultDataClasses: ["customer", "logs"],
25538
- sdks: {
25539
- npm: ["@azure/storage-blob"],
25540
- pypi: ["azure-storage-blob"],
25541
- go: ["github.com/Azure/azure-sdk-for-go"],
25542
- maven: ["com.azure"],
25543
- rubygems: ["azure-storage-blob"],
25544
- nuget: ["Azure.Storage.Blobs"]
25545
- }
25546
- },
25547
- {
25548
- id: "slack",
25549
- name: "Slack",
25550
- category: "Notifications",
25551
- hostSuffixes: ["slack.com"],
25552
- apiBase: "https://slack.com/api",
25553
- defaultDataClasses: ["logs"],
25554
- sdks: {
25555
- npm: ["@slack/web-api"],
25556
- pypi: ["slack-sdk"],
25557
- go: ["github.com/slack-go/slack"],
25558
- maven: ["com.slack.api"],
25559
- rubygems: ["slack-ruby-client"],
25560
- composer: ["slack-php/slack-api"],
25561
- nuget: ["SlackNet"]
25562
- }
25563
- },
25564
- {
25565
- id: "segment",
25566
- name: "Segment",
25567
- category: "Analytics",
25568
- hostSuffixes: ["segment.io", "segment.com"],
25569
- apiBase: "https://api.segment.io",
25570
- defaultDataClasses: ["customer"],
25571
- sdks: {
25572
- npm: ["@segment/analytics-node", "analytics-node"],
25573
- pypi: ["segment-analytics-python"],
25574
- go: ["github.com/segmentio/analytics-go"],
25575
- maven: ["com.segment.analytics.java"],
25576
- rubygems: ["analytics-ruby"],
25577
- nuget: ["Analytics"]
25578
- }
25579
- },
25580
- {
25581
- id: "twilio",
25582
- name: "Twilio",
25583
- category: "Communications",
25584
- hostSuffixes: ["twilio.com"],
25585
- apiBase: "https://api.twilio.com",
25586
- defaultDataClasses: ["pii", "customer"],
25587
- sdks: {
25588
- npm: ["twilio"],
25589
- pypi: ["twilio"],
25590
- go: ["github.com/twilio/twilio-go"],
25591
- maven: ["com.twilio.sdk"],
25592
- rubygems: ["twilio-ruby"],
25593
- composer: ["twilio/sdk"],
25594
- nuget: ["Twilio"]
25595
- }
25596
- },
25597
- {
25598
- id: "sendgrid",
25599
- name: "SendGrid",
25600
- category: "Email",
25601
- hostSuffixes: ["sendgrid.com"],
25602
- apiBase: "https://api.sendgrid.com",
25603
- defaultDataClasses: ["pii"],
25604
- sdks: {
25605
- npm: ["@sendgrid/mail"],
25606
- pypi: ["sendgrid"],
25607
- go: ["github.com/sendgrid/sendgrid-go"],
25608
- maven: ["com.sendgrid"],
25609
- rubygems: ["sendgrid-ruby"],
25610
- composer: ["sendgrid/sendgrid"],
25611
- nuget: ["SendGrid"]
25612
- }
25613
- },
25614
- {
25615
- id: "mailgun",
25616
- name: "Mailgun",
25617
- category: "Email",
25618
- hostSuffixes: ["mailgun.net"],
25619
- apiBase: "https://api.mailgun.net",
25620
- defaultDataClasses: ["pii"],
25621
- sdks: {
25622
- npm: ["mailgun.js"],
25623
- pypi: ["mailgun"],
25624
- rubygems: ["mailgun-ruby"],
25625
- composer: ["mailgun/mailgun-php"],
25626
- nuget: ["Mailgun"]
25627
- }
25628
- },
25629
- {
25630
- id: "mixpanel",
25631
- name: "Mixpanel",
25632
- category: "Analytics",
25633
- hostSuffixes: ["mixpanel.com"],
25634
- apiBase: "https://api.mixpanel.com",
25635
- defaultDataClasses: ["customer", "telemetry"],
25636
- sdks: {
25637
- npm: ["mixpanel"],
25638
- pypi: ["mixpanel"],
25639
- rubygems: ["mixpanel-ruby"],
25640
- nuget: ["Mixpanel"]
25641
- }
25642
- },
25643
- {
25644
- id: "amplitude",
25645
- name: "Amplitude",
25646
- category: "Analytics",
25647
- hostSuffixes: ["amplitude.com"],
25648
- apiBase: "https://api2.amplitude.com",
25649
- defaultDataClasses: ["customer", "telemetry"],
25650
- sdks: {
25651
- npm: ["@amplitude/analytics-node"],
25652
- pypi: ["amplitude-analytics"],
25653
- nuget: ["Amplitude"]
25654
- }
25655
- },
25656
- {
25657
- id: "posthog",
25658
- name: "PostHog",
25659
- category: "Analytics",
25660
- hostSuffixes: ["posthog.com"],
25661
- apiBase: "https://us.i.posthog.com",
25662
- defaultDataClasses: ["customer", "telemetry"],
25663
- sdks: {
25664
- npm: ["posthog-node", "posthog-js"],
25665
- pypi: ["posthog"],
25666
- go: ["github.com/posthog/posthog-go"],
25667
- rubygems: ["posthog-ruby"],
25668
- composer: ["posthog/posthog-php"],
25669
- nuget: ["PostHog"]
25670
- }
25671
- },
25672
- {
25673
- id: "honeycomb",
25674
- name: "Honeycomb",
25675
- category: "Observability",
25676
- hostSuffixes: ["honeycomb.io"],
25677
- apiBase: "https://api.honeycomb.io",
25678
- defaultDataClasses: ["telemetry", "metrics"],
25679
- sdks: {
25680
- npm: ["libhoney"],
25681
- pypi: ["libhoney"],
25682
- go: ["github.com/honeycombio/libhoney-go"],
25683
- rubygems: ["libhoney"]
25684
- }
25685
- },
25686
- {
25687
- id: "grafana",
25688
- name: "Grafana Cloud",
25689
- category: "Observability",
25690
- hostSuffixes: ["grafana.net"],
25691
- apiBase: "https://grafana.net",
25692
- defaultDataClasses: ["logs", "metrics"],
25693
- sdks: {
25694
- npm: ["@grafana/faro-web-sdk"]
25695
- }
25696
- },
25697
- {
25698
- id: "splunk",
25699
- name: "Splunk",
25700
- category: "Observability",
25701
- hostSuffixes: ["splunkcloud.com", "splunk.com"],
25702
- apiBase: "https://http-inputs.splunkcloud.com",
25703
- defaultDataClasses: ["logs"],
25704
- sdks: {
25705
- npm: ["splunk-logging"],
25706
- pypi: ["splunk-sdk"],
25707
- maven: ["com.splunk"],
25708
- nuget: ["Splunk.Logging.Common"]
25709
- }
25710
- },
25711
- {
25712
- id: "pagerduty",
25713
- name: "PagerDuty",
25714
- category: "Incident response",
25715
- hostSuffixes: ["pagerduty.com"],
25716
- apiBase: "https://api.pagerduty.com",
25717
- defaultDataClasses: ["logs"],
25718
- sdks: {
25719
- npm: ["@pagerduty/pdjs"],
25720
- pypi: ["pdpyras"],
25721
- go: ["github.com/PagerDuty/go-pagerduty"],
25722
- rubygems: ["pagerduty"]
25723
- }
25724
- },
25725
- {
25726
- id: "github",
25727
- name: "GitHub",
25728
- category: "Developer platform",
25729
- hostSuffixes: ["github.com", "githubusercontent.com"],
25730
- apiBase: "https://api.github.com",
25731
- defaultDataClasses: ["source"],
25732
- sdks: {
25733
- npm: ["@octokit/rest", "octokit"],
25734
- pypi: ["pygithub"],
25735
- go: ["github.com/google/go-github"],
25736
- maven: ["org.kohsuke.github-api"],
25737
- rubygems: ["octokit"],
25738
- cargo: ["octocrab"],
25739
- composer: ["knplabs/github-api"],
25740
- nuget: ["Octokit"]
25741
- }
25742
- },
25743
- {
25744
- id: "gitlab",
25745
- name: "GitLab",
25746
- category: "Developer platform",
25747
- hostSuffixes: ["gitlab.com"],
25748
- apiBase: "https://gitlab.com/api",
25749
- defaultDataClasses: ["source"],
25750
- sdks: {
25751
- npm: ["@gitbeaker/rest"],
25752
- pypi: ["python-gitlab"],
25753
- go: ["gitlab.com/gitlab-org/api/client-go"],
25754
- rubygems: ["gitlab"],
25755
- nuget: ["GitLabApiClient"]
25756
- }
25757
- },
25758
- {
25759
- id: "auth0",
25760
- name: "Auth0",
25761
- category: "Identity",
25762
- hostSuffixes: ["auth0.com"],
25763
- apiBase: "https://login.auth0.com",
25764
- defaultDataClasses: ["pii"],
25765
- sdks: {
25766
- npm: ["auth0"],
25767
- pypi: ["auth0-python"],
25768
- go: ["github.com/auth0/go-auth0"],
25769
- maven: ["com.auth0"],
25770
- rubygems: ["auth0"],
25771
- composer: ["auth0/auth0-php"],
25772
- nuget: ["Auth0.ManagementApi"]
25773
- }
25774
- },
25775
- {
25776
- id: "okta",
25777
- name: "Okta",
25778
- category: "Identity",
25779
- hostSuffixes: ["okta.com", "oktapreview.com"],
25780
- apiBase: "https://login.okta.com",
25781
- defaultDataClasses: ["pii"],
25782
- sdks: {
25783
- npm: ["@okta/okta-sdk-nodejs"],
25784
- pypi: ["okta"],
25785
- go: ["github.com/okta/okta-sdk-golang"],
25786
- maven: ["com.okta.sdk"],
25787
- nuget: ["Okta.Sdk"]
25788
- }
25789
- },
25790
- {
25791
- id: "clerk",
25792
- name: "Clerk",
25793
- category: "Identity",
25794
- hostSuffixes: ["clerk.com", "clerk.dev"],
25795
- apiBase: "https://api.clerk.com",
25796
- defaultDataClasses: ["pii"],
25797
- sdks: {
25798
- npm: ["@clerk/backend", "@clerk/nextjs"],
25799
- pypi: ["clerk-backend-api"],
25800
- go: ["github.com/clerk/clerk-sdk-go"]
25801
- }
25802
- },
25803
- {
25804
- id: "supabase",
25805
- name: "Supabase",
25806
- category: "Backend platform",
25807
- hostSuffixes: ["supabase.co", "supabase.com"],
25808
- apiBase: "https://api.supabase.com",
25809
- defaultDataClasses: ["pii", "customer"],
25810
- sdks: {
25811
- npm: ["@supabase/supabase-js"],
25812
- pypi: ["supabase"],
25813
- cargo: ["postgrest"]
25814
- }
25815
- },
25816
- {
25817
- id: "firebase",
25818
- name: "Firebase",
25819
- category: "Backend platform",
25820
- hostSuffixes: ["firebaseio.com", "firebase.google.com"],
25821
- apiBase: "https://firebaseio.com",
25822
- defaultDataClasses: ["customer"],
25823
- sdks: {
25824
- npm: ["firebase", "firebase-admin"],
25825
- pypi: ["firebase-admin"],
25826
- go: ["firebase.google.com/go"],
25827
- maven: ["com.google.firebase"]
25828
- }
25829
- },
25830
- {
25831
- id: "mongodb-atlas",
25832
- name: "MongoDB Atlas",
25833
- category: "Database SaaS",
25834
- hostSuffixes: ["mongodb.net", "mongodb.com"],
25835
- apiBase: "https://cloud.mongodb.com",
25836
- defaultDataClasses: ["customer"],
25837
- sdks: {
25838
- npm: ["mongodb"],
25839
- pypi: ["pymongo"],
25840
- go: ["go.mongodb.org/mongo-driver"],
25841
- maven: ["org.mongodb"],
25842
- rubygems: ["mongo"],
25843
- cargo: ["mongodb"],
25844
- nuget: ["MongoDB.Driver"]
25845
- }
25846
- },
25847
- {
25848
- id: "planetscale",
25849
- name: "PlanetScale",
25850
- category: "Database SaaS",
25851
- hostSuffixes: ["psdb.cloud", "planetscale.com"],
25852
- apiBase: "https://api.planetscale.com",
25853
- defaultDataClasses: ["customer"],
25854
- sdks: {
25855
- npm: ["@planetscale/database"],
25856
- go: ["github.com/planetscale/planetscale-go"]
25857
- }
25858
- },
25859
- {
25860
- id: "algolia",
25861
- name: "Algolia",
25862
- category: "Search SaaS",
25863
- hostSuffixes: ["algolia.net", "algolianet.com"],
25864
- apiBase: "https://algolia.net",
25865
- defaultDataClasses: ["customer"],
25866
- sdks: {
25867
- npm: ["algoliasearch"],
25868
- pypi: ["algoliasearch"],
25869
- go: ["github.com/algolia/algoliasearch-client-go"],
25870
- maven: ["com.algolia"],
25871
- rubygems: ["algolia"],
25872
- composer: ["algolia/algoliasearch-client-php"],
25873
- nuget: ["Algolia.Search"]
25874
- }
25875
- },
25876
- {
25877
- id: "cloudflare",
25878
- name: "Cloudflare",
25879
- category: "CDN / edge",
25880
- hostSuffixes: ["cloudflare.com", "workers.dev"],
25881
- apiBase: "https://api.cloudflare.com",
25882
- defaultDataClasses: ["logs"],
25883
- sdks: {
25884
- npm: ["cloudflare"],
25885
- pypi: ["cloudflare"],
25886
- go: ["github.com/cloudflare/cloudflare-go"],
25887
- nuget: ["CloudFlare.Client"]
25888
- }
25889
- },
25890
- {
25891
- id: "huggingface",
25892
- name: "Hugging Face",
25893
- category: "LLM provider",
25894
- hostSuffixes: ["huggingface.co"],
25895
- apiBase: "https://api-inference.huggingface.co",
25896
- defaultDataClasses: ["source"],
25897
- sdks: {
25898
- npm: ["@huggingface/inference"],
25899
- pypi: ["huggingface-hub", "transformers"],
25900
- rubygems: ["hugging-face"]
25901
- }
25902
- },
25903
- {
25904
- id: "cohere",
25905
- name: "Cohere",
25906
- category: "LLM provider",
25907
- hostSuffixes: ["cohere.com", "cohere.ai"],
25908
- apiBase: "https://api.cohere.com",
25909
- defaultDataClasses: ["pii", "source"],
25910
- sdks: {
25911
- npm: ["cohere-ai"],
25912
- pypi: ["cohere"],
25913
- go: ["github.com/cohere-ai/cohere-go"]
25914
- }
25915
- },
25916
- {
25917
- id: "mistral",
25918
- name: "Mistral AI",
25919
- category: "LLM provider",
25920
- hostSuffixes: ["mistral.ai"],
25921
- apiBase: "https://api.mistral.ai",
25922
- defaultDataClasses: ["pii", "source"],
25923
- sdks: {
25924
- npm: ["@mistralai/mistralai"],
25925
- pypi: ["mistralai"],
25926
- go: ["github.com/gage-technologies/mistral-go"]
25927
- }
25928
- }
25929
- ];
25930
- var EXCLUDED_HOST_SUFFIXES = [
25931
- "localhost",
25932
- "test",
25933
- "example",
25934
- "invalid",
25935
- "example.com",
25936
- "example.org",
25937
- "example.net",
25938
- "w3.org",
25939
- "schemas.openxmlformats.org",
25940
- "schemas.microsoft.com",
25941
- "schemas.android.com",
25942
- "maven.apache.org"
25943
- ];
25944
- var EGRESS_VERSION_MATERIAL = `${EXTRACTOR_VERSION}
25945
- ${JSON.stringify(PROVIDER_REGISTRY)}
25946
- ${JSON.stringify(EXCLUDED_HOST_SUFFIXES)}`;
25947
-
25948
- // ../../packages/detections/src/egress/extract.ts
25949
- var SECRET_KEY_NAMES = "api[_-]?key|apikey|private[_-]?key|access[_-]?key|access[_-]?token|token|secret|credentials?|password|passwd|pwd|authorization|sig|signature|sas|assertion";
25950
- var AUTH_SCHEMES = "Bearer|Basic|Token|Digest|ApiKey|SSWS|AWS4-HMAC-SHA256";
25951
- var SECRET_VALUE = new RegExp(
25952
- `((?:${SECRET_KEY_NAMES})['"\`]?\\s*[:=]\\s*['"\`]?)(?!(?:${AUTH_SCHEMES})[\\s'"\`])[^\\s'"\`&]+`,
25953
- "gi"
25954
- );
25955
- var AUTH_SCHEME_VALUE = new RegExp(
25956
- `((?:${SECRET_KEY_NAMES})['"\`]?\\s*[:=]\\s*['"\`]?)(${AUTH_SCHEMES})\\s+[^\\s'"\`]+`,
25957
- "gi"
25958
- );
25959
- var WEBHOOK_SECRET_PATHS = [
25960
- { hosts: ["hooks.slack.com"], prefix: "/services/" },
25961
- {
25962
- hosts: ["discord.com", "discordapp.com", "ptb.discord.com", "canary.discord.com"],
25963
- prefix: "/api/webhooks/"
25964
- },
25965
- { hosts: ["hooks.zapier.com"], prefix: "/hooks/" },
25966
- { hosts: ["outlook.office.com", "outlook.office365.com"], prefix: "/webhook/" }
25967
- ];
25968
- function escapeRegExp(literal2) {
25969
- return literal2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25970
- }
25971
- var WEBHOOK_URL = new RegExp(
25972
- `(https?://(?:${WEBHOOK_SECRET_PATHS.flatMap(
25973
- (entry) => entry.hosts.map((host) => `${escapeRegExp(host)}${escapeRegExp(entry.prefix)}`)
25974
- ).join("|")}))[^\\s'"\`<>()[\\]{},;]+`,
25975
- "gi"
25976
- );
25977
-
25978
- // ../../packages/detections/src/escape-regexp.ts
25979
- function escapeRegExp2(value) {
25980
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25981
- }
25982
-
25983
- // ../../packages/detections/src/format-chars.ts
25984
- var HAS_FORMAT_CHAR = new RegExp("\\p{Cf}", "u");
25985
- var FORMAT_CHAR_GLOBAL = new RegExp("\\p{Cf}", "gu");
25986
-
25987
- // ../../packages/detections/src/regex-cache.ts
25988
- var singles = /* @__PURE__ */ new WeakMap();
25989
- var keywordLists = /* @__PURE__ */ new WeakMap();
25990
- var labelLists = /* @__PURE__ */ new WeakMap();
25991
- function listCache(kind) {
25992
- return kind === "keyword" ? keywordLists : labelLists;
25993
- }
25994
- function memoizedRegExp(owner, build) {
25995
- const cached2 = singles.get(owner);
25996
- if (cached2 !== void 0) {
25997
- cached2.lastIndex = 0;
25998
- return cached2;
25999
- }
26000
- const compiled = build();
26001
- singles.set(owner, compiled);
26002
- return compiled;
26003
- }
26004
- function memoizedRegExpList(kind, owner, build) {
26005
- const cache = listCache(kind);
26006
- const cached2 = cache.get(owner);
26007
- if (cached2 !== void 0) {
26008
- if (cached2.stateful) {
26009
- for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
26010
- }
26011
- return cached2.entries;
26012
- }
26013
- const entries = build();
26014
- cache.set(owner, {
26015
- entries,
26016
- stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
26017
- });
26018
- return entries;
26019
- }
26020
-
26021
- // ../../packages/detections/src/matchers/limits.ts
26022
- var MAX_MATCHES_PER_RULE = 1e4;
26023
- var MAX_REGEX_INPUT_LENGTH = 2e5;
26024
-
26025
- // ../../packages/detections/src/matchers/keyword.ts
26026
- var KeywordMatcher2 = class {
26027
- match(text, rule) {
26028
- if (rule.matcher.type !== "keyword") return [];
26029
- const { keywords, caseSensitive } = rule.matcher;
26030
- const spans = [];
26031
- const compiled = memoizedRegExpList(
26032
- "keyword",
26033
- rule.matcher,
26034
- () => keywords.map((kw) => {
26035
- if (kw.length === 0) return void 0;
26036
- return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
26037
- })
26038
- );
26039
- for (const re of compiled) {
26040
- if (re === void 0) continue;
26041
- if (spans.length >= MAX_MATCHES_PER_RULE) break;
26042
- let m;
26043
- while ((m = re.exec(text)) !== null) {
26044
- spans.push({ start: m.index, end: m.index + m[0].length });
26045
- if (spans.length >= MAX_MATCHES_PER_RULE) break;
26046
- }
26047
- }
26048
- return spans;
26049
- }
26050
- };
26051
-
26052
- // ../../packages/detections/src/matchers/regex.ts
26053
- var RegexMatcher2 = class {
26054
- match(text, rule) {
26055
- if (rule.matcher.type !== "regex") return [];
26056
- const { pattern, flags, captureGroup } = rule.matcher;
26057
- const re = memoizedRegExp(
26058
- rule.matcher,
26059
- () => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
26060
- );
26061
- const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
26062
- const spans = [];
26063
- let m;
26064
- const maxIterations = scanText2.length + 1;
26065
- let iterations = 0;
26066
- while ((m = re.exec(scanText2)) !== null) {
26067
- if (++iterations > maxIterations) break;
26068
- const group = captureGroup != null ? m[captureGroup] : m[0];
26069
- if (m[0].length === 0) re.lastIndex++;
26070
- if (group && spans.length < MAX_MATCHES_PER_RULE) {
26071
- const groupIndices = captureGroup != null ? m.indices?.[captureGroup] : void 0;
26072
- const start = groupIndices ? groupIndices[0] : m.index;
26073
- spans.push({ start, end: start + group.length });
26074
- }
26075
- if (!flags.includes("g") || spans.length >= MAX_MATCHES_PER_RULE) break;
26076
- }
26077
- return spans;
26078
- }
26079
- };
26080
-
26081
- // ../../packages/detections/src/engine.ts
26082
- var keywordMatcher = new KeywordMatcher2();
26083
- var regexMatcher = new RegexMatcher2();
26084
-
26085
- // ../../packages/detections/src/posture/config-posture.ts
26086
- var RULE_VERSION = "1";
26087
- var KNOWN_TOOLS = /* @__PURE__ */ new Set([
26088
- "prettier",
26089
- "eslint",
26090
- "biome",
26091
- "black",
26092
- "ruff",
26093
- "gofmt",
26094
- "rustfmt",
26095
- "node",
26096
- "npx",
26097
- "npm",
26098
- "pnpm",
26099
- "yarn",
26100
- "make",
26101
- "git",
26102
- "jq",
26103
- "echo"
26104
- ]);
26105
- var EGRESS_RE = /\b(curl|wget|nc|ncat|netcat|ssh|scp|rsync)\b|https?:\/\//;
26106
- var MUTATION_RE = /(--write|--fix|\s-w\b|\s-i\b|(?<![\d&>])>\s?\S)/;
26107
- var CONFIG_POSTURE_RULES = [
26108
- {
26109
- ruleId: "hook-conflict",
26110
- version: RULE_VERSION,
26111
- name: "Overlapping hooks \u2014 run order is undefined",
26112
- category: "config",
26113
- severity: "medium",
26114
- definition: JSON.stringify({
26115
- kind: "hook-conflict",
26116
- mutation: MUTATION_RE.source,
26117
- note: "two hooks on the same event with overlapping matchers, both mutating the tool target"
26118
- })
26119
- },
26120
- {
26121
- ruleId: "hook-unknown",
26122
- version: RULE_VERSION,
26123
- name: "Unknown hook \u2014 not attributable to a plugin or known tool",
26124
- category: "config",
26125
- // medium, not high: with a deliberately tiny allowlist this v1 heuristic
26126
- // fires on ordinary interpreter hooks (python3 x.py) and compound commands
26127
- // (cd … && tool); 'high' is reserved for egress, which is genuinely
26128
- // dangerous. Revisit when the known-hooks registry replaces the allowlist.
26129
- severity: "medium",
26130
- definition: JSON.stringify({ kind: "hook-unknown", knownTools: [...KNOWN_TOOLS] })
26131
- },
26132
- {
26133
- ruleId: "hook-external-egress",
26134
- version: RULE_VERSION,
26135
- name: "Hook command can send data externally",
26136
- category: "config",
26137
- severity: "high",
26138
- definition: JSON.stringify({ kind: "hook-external-egress", pattern: EGRESS_RE.source })
26139
- }
26140
- ];
26141
-
26142
- // ../../packages/detections/src/posture/web-capture-posture.ts
26143
- var RULE_VERSION2 = "1";
26144
- var DRIFT_MIN_PARSE_FAILURES = 2;
26145
- var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
26146
- "blind",
26147
- "degraded"
26148
- ]);
26149
- var WEB_CAPTURE_DRIFT_RULE = {
26150
- ruleId: "web-capture-drift",
26151
- version: RULE_VERSION2,
26152
- name: "Web chat capture is not reading the site",
26153
- category: "config",
26154
- severity: "medium",
26155
- definition: JSON.stringify({
26156
- kind: "web-capture-drift",
26157
- states: [...WEB_CAPTURE_DRIFT_STATES],
26158
- minParseFailures: DRIFT_MIN_PARSE_FAILURES
26159
- })
26160
- };
26161
- var STATIC_COPY = {
26162
- active: { headline: "turns are being observed on this site" },
26163
- unreported: {
26164
- // Says "recently" rather than "yet": the store read is bounded to
26165
- // CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
26166
- // reported for AND one whose last report has aged out. The two are the
26167
- // same fact to a reader — nobody has confirmed anything lately — and the
26168
- // copy may not claim the stronger of them.
26169
- headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
26170
- },
26171
- standby: {
26172
- headline: "this build declares no endpoints for the site, so nothing is observed yet"
26173
- },
26174
- unpatched: {
26175
- // Says what the flags say and no more. `patched` is false both for a tap
26176
- // that installed and hooked neither transport and for one that never ran
26177
- // at all — a page reports the same status either way, so the copy may not
26178
- // assert one of them.
26179
- headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
26180
- },
26181
- idle: { headline: "watching; no turn has been observed yet" },
26182
- blind: {
26183
- headline: "messages were sent in the page that the network capture never saw",
26184
- 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."
26185
- },
26186
- degraded: {
26187
- headline: "the site's payloads no longer carry the fields the extension reads",
26188
- 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."
26189
- }
26190
- };
26191
-
26192
- // ../../packages/detections/src/security/redos-probe.ts
26193
- var BUDGET_MS = 100;
26194
- var EXPONENTIAL_UNITS = [
26195
- "a",
26196
- "0",
26197
- " ",
26198
- "x",
26199
- "ab",
26200
- "a.",
26201
- "a-",
26202
- "a_",
26203
- "a@",
26204
- "a/",
26205
- "a:",
26206
- "a=",
26207
- "a;",
26208
- "aA0",
26209
- " "
26210
- ];
26211
- var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
26212
- (unit) => [23, 25].map((len) => unit.repeat(Math.ceil(len / unit.length)).slice(0, len) + "!")
26213
- );
26214
- var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
26215
- (unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
26216
- );
26217
- var CPU_CORROBORATION_SHARE = 0.2;
26218
- var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
26219
-
26220
- // ../../packages/plugin-sdk/src/repo.ts
26221
- import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
26222
- import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
26223
- var NO_ATTRIBUTION = Object.freeze({});
26224
-
26225
- // ../../packages/plugin-sdk/src/events.ts
26226
- import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
26227
-
26228
- // ../../packages/plugin-sdk/src/isolated-scan.ts
26229
- import { existsSync as existsSync10 } from "fs";
26230
- import { fileURLToPath } from "url";
26231
- import { Worker } from "worker_threads";
26232
-
26233
- // ../../packages/plugin-sdk/src/hook-fail-opens.ts
26234
- import { readFileSync as readFileSync12 } from "fs";
26235
- import { join as join19 } from "path";
26236
-
26237
- // ../../packages/plugin-sdk/src/host-floor.ts
26238
- import { readFileSync as readFileSync14 } from "fs";
26239
- import { join as join21 } from "path";
26240
-
26241
- // ../../packages/plugin-sdk/src/model-governance.ts
26242
- import {
26243
- closeSync as closeSync2,
26244
- fstatSync,
26245
- mkdirSync as mkdirSync2,
26246
- openSync as openSync2,
26247
- readFileSync as readFileSync13,
26248
- readSync,
26249
- writeFileSync as writeFileSync5
26250
- } from "fs";
26251
- import { join as join20 } from "path";
26252
- var TAIL_BYTES = 256 * 1024;
26253
-
26254
- // ../../packages/plugin-sdk/src/host-floor.ts
26255
- var HOST_FEATURE = {
26256
- ModelSwitch: "model-switch",
26257
- VaultPointerDisplay: "vault-pointer-display"
26258
- };
26259
- var HOST_FLOORS = {
26260
- [HOST_FEATURE.ModelSwitch]: {
26261
- label: "model-switch protection",
26262
- hookEvents: ["PreModelSwitch", "PostModelSwitch"],
26263
- since: "2.1.251"
26264
- },
26265
- [HOST_FEATURE.VaultPointerDisplay]: {
26266
- label: "vault pointer display",
26267
- hookEvents: ["MessageDisplay"],
26268
- since: "2.1.152"
26269
- }
26270
- };
26271
- var ANTIGRAVITY_HOST_FEATURE = {
26272
- EndOfTurnCapture: "end-of-turn-capture"
26273
- };
26274
- var ANTIGRAVITY_HOST_FLOORS = {
26275
- [ANTIGRAVITY_HOST_FEATURE.EndOfTurnCapture]: {
26276
- label: "end-of-turn history capture",
26277
- hookEvents: ["Stop"],
26278
- since: "1.1.10"
26279
- }
26280
- };
26281
-
26282
- // ../../packages/plugin-sdk/src/ignore-layers.ts
26283
- var import_ignore = __toESM(require_ignore(), 1);
26284
- import { readFileSync as readFileSync15 } from "fs";
26285
- import { join as join22 } from "path";
26286
-
26287
- // ../../packages/plugin-sdk/src/inventory-resolver.ts
26288
- import { arch, hostname as hostname4, platform, release } from "os";
26289
-
26290
- // ../../packages/plugin-sdk/src/nudge.ts
26291
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
26292
- import { join as join23 } from "path";
26293
-
26294
- // ../../packages/plugin-sdk/src/paths.ts
26295
- import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
26296
- import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
26297
-
26298
- // ../../packages/plugin-sdk/src/policy-resolver.ts
26299
- import { randomUUID as randomUUID14 } from "crypto";
26300
-
26301
- // ../../packages/plugin-sdk/src/project-files.ts
26302
- import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
26303
- import { basename as basename5, join as join24 } from "path";
26304
-
26305
- // ../../packages/plugin-sdk/src/provider-env-antigravity.ts
26306
- var optionalBaseUrl2 = external_exports.preprocess((v) => {
26307
- if (typeof v === "string" && v.trim() === "") return void 0;
26308
- return v;
26309
- }, external_exports.string().optional()).catch(void 0);
26310
- var optionalFlag = external_exports.preprocess((v) => {
26311
- if (typeof v !== "string") return false;
26312
- const normalized = v.trim().toLowerCase();
26313
- return normalized !== "" && normalized !== "0" && normalized !== "false";
26314
- }, external_exports.boolean()).catch(false);
26315
- var antigravityProviderEnvShape = {
26316
- GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
26317
- GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
26318
- };
26319
- var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
26320
-
26321
- // ../../packages/plugin-sdk/src/provider-env-codex.ts
26322
- var optionalBaseUrl3 = external_exports.preprocess((v) => {
26323
- if (typeof v === "string" && v.trim() === "") return void 0;
26324
- return v;
26325
- }, external_exports.string().optional()).catch(void 0);
26326
- var codexProviderEnvShape = {
26327
- OPENAI_BASE_URL: optionalBaseUrl3
26328
- };
26329
- var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
26330
-
26331
- // ../../packages/plugin-sdk/src/runtime.ts
26332
- import { randomUUID as randomUUID15 } from "crypto";
26333
-
26334
- // ../../packages/plugin-sdk/src/scope-key.ts
26335
- import { existsSync as existsSync12 } from "fs";
26336
- import { dirname as dirname6, isAbsolute as isAbsolute2, join as join25, normalize } from "path";
26337
-
26338
- // ../../packages/plugin-sdk/src/suppressions.ts
26339
- var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
26340
-
26341
- // ../../packages/plugin-sdk/src/throttle.ts
26342
- import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
26343
- import { join as join26 } from "path";
26344
-
26345
24296
  // ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
26346
- import { writeFileSync as writeFileSync8 } from "fs";
26347
- import { join as join27 } from "path";
24297
+ import { writeFileSync } from "fs";
24298
+ import { join } from "path";
26348
24299
 
26349
24300
  // ../../packages/setup-wizard/src/triage/merge.ts
26350
24301
  var RANK = Object.fromEntries(
@@ -26352,9 +24303,9 @@ var RANK = Object.fromEntries(
26352
24303
  );
26353
24304
 
26354
24305
  // ../../packages/setup-wizard/src/triage/plan-file.ts
26355
- import { mkdtempSync, readFileSync as readFileSync17, rmdirSync, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "fs";
24306
+ import { mkdtempSync, readFileSync, rmdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
26356
24307
  import { tmpdir } from "os";
26357
- import { basename as basename6, dirname as dirname7, join as join28 } from "path";
24308
+ import { basename, dirname, join as join2 } from "path";
26358
24309
  var SuppressionEntrySchema = external_exports.object({
26359
24310
  ruleId: external_exports.string(),
26360
24311
  category: DetectionCategory,
@@ -26396,10 +24347,10 @@ var PersistedPlanSchema = external_exports.object({
26396
24347
  });
26397
24348
 
26398
24349
  // src/skills-registry.ts
26399
- import { readdirSync as readdirSync5, readFileSync as readFileSync18 } from "fs";
26400
- import { join as join29 } from "path";
26401
- import { fileURLToPath as fileURLToPath2 } from "url";
26402
- var SKILLS_DIR = fileURLToPath2(new URL("../skills", import.meta.url));
24350
+ import { readdirSync, readFileSync as readFileSync2 } from "fs";
24351
+ import { join as join3 } from "path";
24352
+ import { fileURLToPath } from "url";
24353
+ var SKILLS_DIR = fileURLToPath(new URL("../skills", import.meta.url));
26403
24354
 
26404
24355
  // src/render.ts
26405
24356
  var SEVERITY_GLYPH = {
@@ -26437,7 +24388,7 @@ function authorName(author) {
26437
24388
  var manifestPath = process.argv[2];
26438
24389
  var manifest = {};
26439
24390
  try {
26440
- manifest = JSON.parse(readFileSync19(manifestPath ?? "", "utf8"));
24391
+ manifest = JSON.parse(readFileSync3(manifestPath ?? "", "utf8"));
26441
24392
  } catch {
26442
24393
  }
26443
24394
  process.stdout.write(