@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/.codex-plugin/plugin.json +1 -1
- package/package.json +6 -6
- package/scripts/apply-suppressions.js +739 -1263
- package/scripts/backfill.js +1040 -1291
- package/scripts/content-retention.js +781 -2074
- package/scripts/filescan.js +1266 -497
- package/scripts/firstrun.js +1277 -1701
- package/scripts/history-sync.js +777 -2107
- package/scripts/intro.js +141 -2190
- package/scripts/onboard.js +2806 -1186
- package/scripts/post-tool-use.js +1512 -1728
- package/scripts/pre-tool-use.js +1094 -1319
- package/scripts/query.js +1277 -1701
- package/scripts/reconcile.js +897 -1288
- package/scripts/remediate.js +1081 -1341
- package/scripts/scan-worker.js +147 -14
- package/scripts/session-start.js +1895 -827
- package/scripts/start-light.js +176 -1360
- package/scripts/stop.js +322 -1113
- package/scripts/sync.js +1818 -1029
- package/scripts/user-prompt-submit.js +1295 -1489
package/scripts/start-light.js
CHANGED
|
@@ -1,896 +1,8 @@
|
|
|
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
|
-
|
|
875
|
-
// ../../packages/plugin-sdk/src/config.ts
|
|
876
|
-
import { existsSync as existsSync8 } from "fs";
|
|
877
|
-
import { join as join16 } from "path";
|
|
878
|
-
|
|
879
|
-
// ../../packages/persistence/src/attached-derived.ts
|
|
880
|
-
import { rmSync } from "fs";
|
|
881
|
-
import { join } from "path";
|
|
882
|
-
|
|
883
|
-
// ../../packages/persistence/src/control-plane-credential.ts
|
|
884
|
-
import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
|
|
885
|
-
import { join as join2 } from "path";
|
|
886
|
-
|
|
887
|
-
// ../../packages/schema/src/drizzle/deferred-migrations.ts
|
|
888
|
-
var DEFERRED_MIGRATION_TAGS = [
|
|
889
|
-
"0031_audit_capture_by_time_index",
|
|
890
|
-
"0032_audit_capture_by_id_index",
|
|
891
|
-
"0033_audit_capture_location_index",
|
|
892
|
-
"0034_findings_read_indexes"
|
|
893
|
-
];
|
|
894
6
|
|
|
895
7
|
// ../../packages/schema/src/exception-scope.ts
|
|
896
8
|
var MINUTE_MS = 6e4;
|
|
@@ -3711,9 +2823,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
|
|
|
3711
2823
|
function stripTabAndNewline(value) {
|
|
3712
2824
|
return value.replace(asciiTabOrNewline, "");
|
|
3713
2825
|
}
|
|
3714
|
-
function urlHostnameOk(url2,
|
|
3715
|
-
|
|
3716
|
-
return
|
|
2826
|
+
function urlHostnameOk(url2, hostname3) {
|
|
2827
|
+
hostname3.lastIndex = 0;
|
|
2828
|
+
return hostname3.test(url2.hostname);
|
|
3717
2829
|
}
|
|
3718
2830
|
function urlProtocolOk(url2, protocol) {
|
|
3719
2831
|
protocol.lastIndex = 0;
|
|
@@ -5924,7 +5036,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
5924
5036
|
var NONE = 0;
|
|
5925
5037
|
var ASSUMED = 1;
|
|
5926
5038
|
var PROVEN = 2;
|
|
5927
|
-
function isRecursive(inst, stack,
|
|
5039
|
+
function isRecursive(inst, stack, resolve) {
|
|
5928
5040
|
const cached2 = recursive.get(inst);
|
|
5929
5041
|
if (cached2 !== void 0)
|
|
5930
5042
|
return cached2 ? PROVEN : NONE;
|
|
@@ -5934,7 +5046,7 @@ function isRecursive(inst, stack, resolve2) {
|
|
|
5934
5046
|
let result = NONE;
|
|
5935
5047
|
const check2 = (child) => {
|
|
5936
5048
|
if (result !== PROVEN && child?._zod) {
|
|
5937
|
-
const answer = isRecursive(child, stack,
|
|
5049
|
+
const answer = isRecursive(child, stack, resolve);
|
|
5938
5050
|
if (answer > result)
|
|
5939
5051
|
result = answer;
|
|
5940
5052
|
}
|
|
@@ -5945,7 +5057,7 @@ function isRecursive(inst, stack, resolve2) {
|
|
|
5945
5057
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
5946
5058
|
if (spread && !desc.enumerable)
|
|
5947
5059
|
continue;
|
|
5948
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
5060
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
5949
5061
|
if (child > answer)
|
|
5950
5062
|
answer = child;
|
|
5951
5063
|
}
|
|
@@ -6009,7 +5121,7 @@ function isRecursive(inst, stack, resolve2) {
|
|
|
6009
5121
|
break;
|
|
6010
5122
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
6011
5123
|
case "lazy": {
|
|
6012
|
-
const inner = def._cachedInner ?? (
|
|
5124
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
6013
5125
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
6014
5126
|
break;
|
|
6015
5127
|
}
|
|
@@ -20682,8 +19794,8 @@ var PLATFORM_HOSTING = /* @__PURE__ */ new Map([
|
|
|
20682
19794
|
["ollama", "local"],
|
|
20683
19795
|
["local", "local"]
|
|
20684
19796
|
]);
|
|
20685
|
-
function hostingFor(
|
|
20686
|
-
return PLATFORM_HOSTING.get(
|
|
19797
|
+
function hostingFor(platform) {
|
|
19798
|
+
return PLATFORM_HOSTING.get(platform) ?? "api";
|
|
20687
19799
|
}
|
|
20688
19800
|
var FIRST_PARTY = /* @__PURE__ */ new Map([
|
|
20689
19801
|
["anthropic", "anthropic"],
|
|
@@ -20697,8 +19809,8 @@ var FIRST_PARTY = /* @__PURE__ */ new Map([
|
|
|
20697
19809
|
function firstPartyPlatformFor(vendor2) {
|
|
20698
19810
|
return FIRST_PARTY.get(vendor2) ?? null;
|
|
20699
19811
|
}
|
|
20700
|
-
function isFirstParty(vendor2,
|
|
20701
|
-
return FIRST_PARTY.get(vendor2) ===
|
|
19812
|
+
function isFirstParty(vendor2, platform) {
|
|
19813
|
+
return FIRST_PARTY.get(vendor2) === platform;
|
|
20702
19814
|
}
|
|
20703
19815
|
var PLATFORM_NAMESPACES = Object.freeze([
|
|
20704
19816
|
"anthropic",
|
|
@@ -20759,14 +19871,14 @@ var ModelVendorBuilder = class {
|
|
|
20759
19871
|
);
|
|
20760
19872
|
}
|
|
20761
19873
|
for (const ref of spec.on ?? []) {
|
|
20762
|
-
const { platform
|
|
20763
|
-
const firstParty = isFirstParty(this.vendor,
|
|
20764
|
-
const hosting = hostingFor(
|
|
19874
|
+
const { platform, price, retention, region } = normalizeRef(ref);
|
|
19875
|
+
const firstParty = isFirstParty(this.vendor, platform);
|
|
19876
|
+
const hosting = hostingFor(platform);
|
|
20765
19877
|
const isSelfHosted = hosting === "local";
|
|
20766
19878
|
platforms.set(
|
|
20767
|
-
|
|
19879
|
+
platform,
|
|
20768
19880
|
Object.freeze({
|
|
20769
|
-
platform
|
|
19881
|
+
platform,
|
|
20770
19882
|
hosting,
|
|
20771
19883
|
firstParty,
|
|
20772
19884
|
price: price ?? (isSelfHosted ? ZERO_PRICE : firstParty ? spec.price ?? null : null),
|
|
@@ -20916,7 +20028,7 @@ anthropic.model("claude-haiku-4-5", {
|
|
|
20916
20028
|
name: "Claude Haiku 4.5",
|
|
20917
20029
|
ctx: 2e5,
|
|
20918
20030
|
maxOut: 64e3,
|
|
20919
|
-
// Reviewed: fast/cheap tier,
|
|
20031
|
+
// Reviewed: fast/cheap general-purpose tier, not a reasoning or code model.
|
|
20920
20032
|
capability: null,
|
|
20921
20033
|
price: anthropicPrice(1, 5, 0.1),
|
|
20922
20034
|
// The vendor documents `claude-haiku-4-5-20251001` as the versioned id and
|
|
@@ -21047,6 +20159,11 @@ openai.model("gpt-4o", {
|
|
|
21047
20159
|
price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
|
|
21048
20160
|
on: [...OPENAI_RESELLERS]
|
|
21049
20161
|
});
|
|
20162
|
+
openai.model("gpt-4o-2024-05-13", {
|
|
20163
|
+
name: "GPT-4o (2024-05-13)",
|
|
20164
|
+
price: tokenPrice(5, 15),
|
|
20165
|
+
on: [...OPENAI_RESELLERS]
|
|
20166
|
+
});
|
|
21050
20167
|
openai.model("gpt-4o-mini", {
|
|
21051
20168
|
name: "GPT-4o mini",
|
|
21052
20169
|
price: tokenPrice(0.15, 0.6, { cacheRead: 0.075 }),
|
|
@@ -21066,6 +20183,24 @@ openai.model("o3", {
|
|
|
21066
20183
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
21067
20184
|
on: [...OPENAI_RESELLERS]
|
|
21068
20185
|
});
|
|
20186
|
+
openai.model("text-embedding-3-small", {
|
|
20187
|
+
name: "text-embedding-3-small",
|
|
20188
|
+
capability: "embedding",
|
|
20189
|
+
price: tokenPrice(0.02, 0),
|
|
20190
|
+
on: [...OPENAI_RESELLERS]
|
|
20191
|
+
});
|
|
20192
|
+
openai.model("text-embedding-3-large", {
|
|
20193
|
+
name: "text-embedding-3-large",
|
|
20194
|
+
capability: "embedding",
|
|
20195
|
+
price: tokenPrice(0.13, 0),
|
|
20196
|
+
on: [...OPENAI_RESELLERS]
|
|
20197
|
+
});
|
|
20198
|
+
openai.model("text-embedding-ada-002", {
|
|
20199
|
+
name: "text-embedding-ada-002",
|
|
20200
|
+
capability: "embedding",
|
|
20201
|
+
price: tokenPrice(0.1, 0),
|
|
20202
|
+
on: [...OPENAI_RESELLERS]
|
|
20203
|
+
});
|
|
21069
20204
|
openai.model("gpt-oss-120b", {
|
|
21070
20205
|
name: "GPT-OSS 120B",
|
|
21071
20206
|
openWeights: true,
|
|
@@ -21352,10 +20487,21 @@ var MODEL_ENTRIES = Object.freeze([
|
|
|
21352
20487
|
...alibaba.models(),
|
|
21353
20488
|
...amazon.models()
|
|
21354
20489
|
]);
|
|
20490
|
+
var LONG_CONTEXT_THRESHOLDS = Object.freeze(
|
|
20491
|
+
[
|
|
20492
|
+
...new Set(
|
|
20493
|
+
MODEL_ENTRIES.flatMap(
|
|
20494
|
+
(entry) => [...entry.platforms.values()].flatMap(
|
|
20495
|
+
(offering) => offering.price?.longContext ? [offering.price.longContext.thresholdInputTokens] : []
|
|
20496
|
+
)
|
|
20497
|
+
)
|
|
20498
|
+
)
|
|
20499
|
+
].sort((a, b) => a - b)
|
|
20500
|
+
);
|
|
21355
20501
|
var MODEL_INDEX = buildModelIndex(MODEL_ENTRIES);
|
|
21356
20502
|
|
|
21357
20503
|
// ../../packages/schema/src/model/governance.ts
|
|
21358
|
-
var ModelCapability = external_exports.enum(["reasoning", "code"]);
|
|
20504
|
+
var ModelCapability = external_exports.enum(["reasoning", "code", "embedding"]);
|
|
21359
20505
|
var DataRetention = external_exports.enum([
|
|
21360
20506
|
"zero_retention",
|
|
21361
20507
|
"no_storage",
|
|
@@ -22116,6 +21262,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
22116
21262
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
22117
21263
|
// repeated rather than referenced because a store reader opens this file.
|
|
22118
21264
|
redact_degraded_to: ActionTaken.optional(),
|
|
21265
|
+
// Why a capture has no content and no findings: its field was refused
|
|
21266
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
21267
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
21268
|
+
// reader can tell a refused row from an empty clean one.
|
|
21269
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
22119
21270
|
// The scope key this capture was stamped with: the canonical repository
|
|
22120
21271
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
22121
21272
|
// against its working directory), else of its own working directory, or a
|
|
@@ -22293,8 +21444,9 @@ var SessionTokenReport = external_exports.object({
|
|
|
22293
21444
|
totalTokens: external_exports.number().int().nonnegative(),
|
|
22294
21445
|
// Σ of the PRICED rollups only; null when no rollup had a known price.
|
|
22295
21446
|
estimatedCostUsd: external_exports.number().nullable(),
|
|
22296
|
-
// True whenever any
|
|
22297
|
-
//
|
|
21447
|
+
// True whenever any call priced to null (an unknown provider/model, or a call
|
|
21448
|
+
// over a long-context threshold whose rate is unpublished), so the total
|
|
21449
|
+
// understates real spend — the UI renders `≥ $X` instead of a falsely
|
|
22298
21450
|
// precise figure rather than silently dropping the unpriced calls.
|
|
22299
21451
|
costIsPartial: external_exports.boolean()
|
|
22300
21452
|
});
|
|
@@ -23140,7 +22292,15 @@ var StorePostureSnapshot = external_exports.object({
|
|
|
23140
22292
|
policyCounts: StorePosturePolicyCounts,
|
|
23141
22293
|
// OPTIONAL, not nullable: a reporter that predates this member keeps
|
|
23142
22294
|
// getting its 200 without a payload change.
|
|
23143
|
-
plugin: StorePosturePlugin.optional()
|
|
22295
|
+
plugin: StorePosturePlugin.optional(),
|
|
22296
|
+
// OPTIONAL, and sent only by a scoped attachment, always as `scoped`. A
|
|
22297
|
+
// machine attachment omits it, so its body is byte for byte the one it
|
|
22298
|
+
// sent before this member existed. Absent therefore means machine-wide OR
|
|
22299
|
+
// a reporter older than this member, never "scoped". Both values parse, so
|
|
22300
|
+
// a sender that one day spells `machine` breaks no receiver; any other
|
|
22301
|
+
// value fails the whole snapshot, which is why the reporter sends a
|
|
22302
|
+
// constant and never the raw mode.
|
|
22303
|
+
attachmentMode: AttachmentMode.optional()
|
|
23144
22304
|
}).meta({ id: "StorePostureSnapshot" });
|
|
23145
22305
|
var CAPTURE_VERSION_PREFIX = "capture/";
|
|
23146
22306
|
var RecordAuditEventRequest = AuditEventInput.extend({
|
|
@@ -23417,7 +22577,19 @@ var EventMetadata = external_exports.object({
|
|
|
23417
22577
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
23418
22578
|
// Closing either means moving the reason onto the finding row, which
|
|
23419
22579
|
// already carries its own action.
|
|
23420
|
-
redactDegradedTo: ActionTaken.optional()
|
|
22580
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
22581
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
22582
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
22583
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
22584
|
+
// field instead of letting it through unscanned.
|
|
22585
|
+
//
|
|
22586
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
22587
|
+
// - 'unavailable': no worker could run it.
|
|
22588
|
+
//
|
|
22589
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
22590
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
22591
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
22592
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
23421
22593
|
}).meta({ id: "EventMetadata" });
|
|
23422
22594
|
var Event = external_exports.object({
|
|
23423
22595
|
id: external_exports.guid(),
|
|
@@ -23587,7 +22759,7 @@ var Rule = external_exports.strictObject({
|
|
|
23587
22759
|
postValidators: external_exports.array(PostValidatorRef).optional(),
|
|
23588
22760
|
requiresNearby: RequiresNearby.optional(),
|
|
23589
22761
|
examples: external_exports.array(external_exports.string()).optional(),
|
|
23590
|
-
// Whether the matched text is itself sensitive
|
|
22762
|
+
// Whether the matched text is itself sensitive (see RuleEvidence).
|
|
23591
22763
|
evidence: RuleEvidence.optional()
|
|
23592
22764
|
}).meta({ id: "Rule" });
|
|
23593
22765
|
var Author = external_exports.object({
|
|
@@ -23679,7 +22851,13 @@ var DetectionRule = external_exports.object({
|
|
|
23679
22851
|
// Representative matching strings the rule author shipped with the rule. The
|
|
23680
22852
|
// cheapest honest answer to "show me what this rule catches" — every bundled
|
|
23681
22853
|
// rule has them, and they are already in the stored snapshot.
|
|
23682
|
-
examples: external_exports.array(external_exports.string()).optional()
|
|
22854
|
+
examples: external_exports.array(external_exports.string()).optional(),
|
|
22855
|
+
// The rule's DECLARED evidence, as stored. Absent defers to the engine's
|
|
22856
|
+
// classification (ruleEvidence in @akasecurity/detections): a bundled
|
|
22857
|
+
// code-flaw rule reads as 'code' and anything else as 'value', and a rule
|
|
22858
|
+
// in a value category (secret/pii/financial/phi) is always 'value',
|
|
22859
|
+
// whatever it declares.
|
|
22860
|
+
evidence: RuleEvidence.optional()
|
|
23683
22861
|
}).meta({ id: "DetectionRule" });
|
|
23684
22862
|
var DetectionUpdate = external_exports.object({
|
|
23685
22863
|
available: external_exports.boolean(),
|
|
@@ -23945,11 +23123,14 @@ var PolicyBundle = external_exports.object({
|
|
|
23945
23123
|
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
23946
23124
|
// Model ids (the raw `model` string a harness reports, e.g.
|
|
23947
23125
|
// `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
|
|
23948
|
-
// a session onto one (PreModelSwitch)
|
|
23949
|
-
//
|
|
23950
|
-
//
|
|
23951
|
-
//
|
|
23952
|
-
//
|
|
23126
|
+
// a session onto one (PreModelSwitch), refuses a turn that would run on one
|
|
23127
|
+
// (UserPromptSubmit) and refuses a subagent spawn onto one (PreToolUse),
|
|
23128
|
+
// wherever the organization governs the event: everywhere on a
|
|
23129
|
+
// machine-wide attachment, and only in enrolled repositories on a scoped
|
|
23130
|
+
// one (the plugin runtime's `governanceApplies`).
|
|
23131
|
+
// Optional so an older backend — and an older on-disk cache — still
|
|
23132
|
+
// parses; consumers read `?? []`, which is the unenforced behaviour that
|
|
23133
|
+
// predates this field and the safe direction to default.
|
|
23953
23134
|
//
|
|
23954
23135
|
// Ids, not display names: the governance decision is keyed on the exact
|
|
23955
23136
|
// string the harness reports (`model_status_override.versionId` in the
|
|
@@ -24294,6 +23475,8 @@ var AttachmentScopeEntry = external_exports.object({
|
|
|
24294
23475
|
});
|
|
24295
23476
|
var AttachmentScope = external_exports.object({
|
|
24296
23477
|
endpoint: external_exports.string().min(1),
|
|
23478
|
+
tenantName: PluginWhoami.shape.tenantName.optional(),
|
|
23479
|
+
userEmail: PluginWhoami.shape.userEmail.optional(),
|
|
24297
23480
|
entries: external_exports.array(AttachmentScopeEntry)
|
|
24298
23481
|
});
|
|
24299
23482
|
var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
|
|
@@ -24502,6 +23685,27 @@ var ManagedSettings = external_exports.object({
|
|
|
24502
23685
|
};
|
|
24503
23686
|
}).meta({ id: "ManagedSettings" });
|
|
24504
23687
|
|
|
23688
|
+
// ../../packages/schema/src/zod/mod-policy-snapshot.ts
|
|
23689
|
+
var MOD_POLICY_SNAPSHOT_VERSION = 1;
|
|
23690
|
+
var MOD_POLICY_SNAPSHOT_MAX_BYTES = 4 * 1024 * 1024;
|
|
23691
|
+
var ModPolicySnapshot = external_exports.object({
|
|
23692
|
+
version: external_exports.literal(MOD_POLICY_SNAPSHOT_VERSION),
|
|
23693
|
+
generatedAt: external_exports.iso.datetime(),
|
|
23694
|
+
// The complete effective ruleset, as the hook's runtime scans with it: the
|
|
23695
|
+
// user's enabled installed packs (user-modified and custom packs included).
|
|
23696
|
+
// Absent means the store holds no authoritative snapshot, and the reader
|
|
23697
|
+
// scans with the packs it ships — the hook's own fallback.
|
|
23698
|
+
rules: external_exports.array(Rule).optional(),
|
|
23699
|
+
// Rule-targeted actions (first enabled policy per rule wins).
|
|
23700
|
+
ruleActions: external_exports.record(external_exports.string(), ActionTaken),
|
|
23701
|
+
// The resolved action per detection category.
|
|
23702
|
+
categoryActions: external_exports.record(external_exports.string(), ActionTaken),
|
|
23703
|
+
// Rules with an active exception grant. Honouring a grant means matching a
|
|
23704
|
+
// keyed fingerprint of the value and consuming a use, which only the hook can
|
|
23705
|
+
// do, so the mod leaves a finding of one of these rules for the hook to decide.
|
|
23706
|
+
exceptionRuleIds: external_exports.array(external_exports.string())
|
|
23707
|
+
}).meta({ id: "ModPolicySnapshot" });
|
|
23708
|
+
|
|
24505
23709
|
// ../../packages/schema/src/zod/project-files.ts
|
|
24506
23710
|
var ProjectFileInput = external_exports.object({
|
|
24507
23711
|
path: external_exports.string().min(1),
|
|
@@ -24816,7 +24020,16 @@ var AttachInput = external_exports.object({
|
|
|
24816
24020
|
// 200 matches the tenantName bound beside it in control-plane.ts; nothing
|
|
24817
24021
|
// renders a longer one usefully.
|
|
24818
24022
|
label: printable(200).optional(),
|
|
24819
|
-
accessKey: external_exports.string()
|
|
24023
|
+
accessKey: external_exports.string(),
|
|
24024
|
+
// How much of this machine the attachment is for: everything, or only the
|
|
24025
|
+
// repositories its user enrolls. Optional, so an input without it still
|
|
24026
|
+
// parses; what an absent mode means is for whatever reads it to decide, not
|
|
24027
|
+
// this shape. This member validates the VALUE rather than leaving that to the
|
|
24028
|
+
// call site, a deliberate exception to this module's shape-only rule: a shape
|
|
24029
|
+
// rejection names the field, so a value that is not a mode is refused as a bad
|
|
24030
|
+
// `mode` rather than stripped or passed on. The dashboard's attach action reads
|
|
24031
|
+
// it as the mode to attach in.
|
|
24032
|
+
mode: AttachmentMode.optional()
|
|
24820
24033
|
});
|
|
24821
24034
|
|
|
24822
24035
|
// ../../packages/schema/src/zod/triage.ts
|
|
@@ -25029,310 +24242,6 @@ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
|
25029
24242
|
var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
|
|
25030
24243
|
var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
|
|
25031
24244
|
|
|
25032
|
-
// ../../packages/persistence/src/paths.ts
|
|
25033
|
-
import {
|
|
25034
|
-
chmodSync,
|
|
25035
|
-
linkSync,
|
|
25036
|
-
lstatSync,
|
|
25037
|
-
mkdirSync,
|
|
25038
|
-
renameSync,
|
|
25039
|
-
rmSync as rmSync2,
|
|
25040
|
-
writeFileSync
|
|
25041
|
-
} from "fs";
|
|
25042
|
-
import { threadId } from "worker_threads";
|
|
25043
|
-
|
|
25044
|
-
// ../../packages/persistence/src/database.ts
|
|
25045
|
-
import { randomUUID as randomUUID11 } from "crypto";
|
|
25046
|
-
import { dirname as dirname2, join as join7, sep } from "path";
|
|
25047
|
-
import { DatabaseSync } from "node:sqlite";
|
|
25048
|
-
|
|
25049
|
-
// ../../packages/persistence/src/ids.ts
|
|
25050
|
-
import { createHash } from "crypto";
|
|
25051
|
-
|
|
25052
|
-
// ../../packages/persistence/src/internal/snapshot.ts
|
|
25053
|
-
import { randomUUID } from "crypto";
|
|
25054
|
-
import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync4, statSync as statSync2 } from "fs";
|
|
25055
|
-
import { basename, dirname, join as join3 } from "path";
|
|
25056
|
-
var STALE_PARTIAL_MS = 5 * 6e4;
|
|
25057
|
-
var SNAPSHOT_STAGING_SUFFIX = ".partial";
|
|
25058
|
-
var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
|
|
25059
|
-
|
|
25060
|
-
// ../../packages/persistence/src/internal/sql-functions.ts
|
|
25061
|
-
var utf8 = new TextDecoder();
|
|
25062
|
-
|
|
25063
|
-
// ../../packages/persistence/src/internal/outbox-lane.ts
|
|
25064
|
-
var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
|
|
25065
|
-
var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
25066
|
-
|
|
25067
|
-
// ../../packages/persistence/src/sync-failure.ts
|
|
25068
|
-
var SYNC_FAILURE_REASONS = SyncFailureReason.options;
|
|
25069
|
-
|
|
25070
|
-
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
25071
|
-
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
25072
|
-
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
25073
|
-
var COUNTED_EVENT_TYPES = [
|
|
25074
|
-
...STRUCTURAL_EVENT_TYPES,
|
|
25075
|
-
...OUTBOX_CAPTURE_EVENT_TYPES
|
|
25076
|
-
];
|
|
25077
|
-
var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
25078
|
-
var COUNTED_SCOPE = `
|
|
25079
|
-
WHERE event_type IN (${COUNTED_TYPE_LIST})
|
|
25080
|
-
AND (
|
|
25081
|
-
event_type IN (${TYPE_LIST})
|
|
25082
|
-
OR synced_at IS NOT NULL
|
|
25083
|
-
OR outbox_owed = 1
|
|
25084
|
-
)`;
|
|
25085
|
-
|
|
25086
|
-
// ../../packages/persistence/src/repositories/activity.ts
|
|
25087
|
-
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
25088
|
-
var DB_EVENT_TYPE_TO_KIND = {
|
|
25089
|
-
session: "session",
|
|
25090
|
-
prompt: "prompt",
|
|
25091
|
-
response: "response",
|
|
25092
|
-
tool_call: "tool",
|
|
25093
|
-
hook: "hook",
|
|
25094
|
-
detection: "detection",
|
|
25095
|
-
share: "share",
|
|
25096
|
-
permission: "permission",
|
|
25097
|
-
commit: "commit",
|
|
25098
|
-
error: "error",
|
|
25099
|
-
active: "active"
|
|
25100
|
-
};
|
|
25101
|
-
var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
|
|
25102
|
-
var DEFAULT_HARNESS = HARNESS.ClaudeCode;
|
|
25103
|
-
|
|
25104
|
-
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
25105
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
25106
|
-
var BLOCKED_DETECTIONS_TTL_MS = 30 * 60 * 1e3;
|
|
25107
|
-
var BLOCKED_DETECTIONS_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
25108
|
-
var ACTIVE_PREDICATE = `revoked_at IS NULL
|
|
25109
|
-
AND (expires_at IS NULL OR expires_at > :now)
|
|
25110
|
-
AND (max_uses IS NULL OR use_count < max_uses)`;
|
|
25111
|
-
var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
|
|
25112
|
-
AND conditions IS NULL
|
|
25113
|
-
AND ${ACTIVE_PREDICATE}`;
|
|
25114
|
-
|
|
25115
|
-
// ../../packages/persistence/src/repositories/resolution-sql.ts
|
|
25116
|
-
function latestResolutionColumnSql(column, findingsAlias) {
|
|
25117
|
-
return `(
|
|
25118
|
-
SELECT fr.${column} FROM finding_resolution fr
|
|
25119
|
-
WHERE fr.finding_key = ${findingsAlias}.finding_key
|
|
25120
|
-
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
25121
|
-
LIMIT 1
|
|
25122
|
-
)`;
|
|
25123
|
-
}
|
|
25124
|
-
function latestResolutionStatusSql(findingsAlias) {
|
|
25125
|
-
return latestResolutionColumnSql("status", findingsAlias);
|
|
25126
|
-
}
|
|
25127
|
-
var LATEST_RESOLUTION_BY_KEY_SQL = `(
|
|
25128
|
-
SELECT finding_key, status, method, resolved_at FROM (
|
|
25129
|
-
SELECT fr.finding_key, fr.status, fr.method, fr.resolved_at,
|
|
25130
|
-
ROW_NUMBER() OVER (
|
|
25131
|
-
PARTITION BY fr.finding_key
|
|
25132
|
-
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
25133
|
-
) AS rn
|
|
25134
|
-
FROM finding_resolution fr
|
|
25135
|
-
) WHERE rn = 1
|
|
25136
|
-
)`;
|
|
25137
|
-
|
|
25138
|
-
// ../../packages/persistence/src/repositories/findings.ts
|
|
25139
|
-
var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
|
|
25140
|
-
d.severity AS severity, f.masked_match AS masked_match,
|
|
25141
|
-
f.action_taken AS action_taken, f.confidence AS confidence,
|
|
25142
|
-
e.started_at AS occurred_at,
|
|
25143
|
-
e.source_tool AS source_tool,
|
|
25144
|
-
e.repo AS repo,
|
|
25145
|
-
e.file_path AS file,
|
|
25146
|
-
e.tool_name AS tool_name,
|
|
25147
|
-
f.audit_event_id AS event_id, e.root_session_id AS session_id,
|
|
25148
|
-
e.event_type AS kind, f.finding_key AS finding_key,
|
|
25149
|
-
${latestResolutionStatusSql("f")} AS latest_status,
|
|
25150
|
-
e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
|
|
25151
|
-
e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
|
|
25152
|
-
e.outbox_owed AS outbox_owed,
|
|
25153
|
-
f.line AS line, f.col AS col`;
|
|
25154
|
-
|
|
25155
|
-
// ../../packages/persistence/src/repositories/installed-packs.ts
|
|
25156
|
-
import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
|
|
25157
|
-
|
|
25158
|
-
// ../../packages/persistence/src/policy-floor.ts
|
|
25159
|
-
import { readFileSync as readFileSync5 } from "fs";
|
|
25160
|
-
import { join as join6 } from "path";
|
|
25161
|
-
|
|
25162
|
-
// ../../packages/persistence/src/local-layout.ts
|
|
25163
|
-
import { renameSync as renameSync3 } from "fs";
|
|
25164
|
-
import { mkdir } from "fs/promises";
|
|
25165
|
-
import { homedir } from "os";
|
|
25166
|
-
import { join as join4 } from "path";
|
|
25167
|
-
|
|
25168
|
-
// ../../packages/persistence/src/settings.ts
|
|
25169
|
-
import { readFileSync as readFileSync4 } from "fs";
|
|
25170
|
-
import { join as join5 } from "path";
|
|
25171
|
-
|
|
25172
|
-
// ../../packages/persistence/src/file-lock.ts
|
|
25173
|
-
import { randomUUID as randomUUID3 } from "crypto";
|
|
25174
|
-
import {
|
|
25175
|
-
closeSync,
|
|
25176
|
-
existsSync as existsSync2,
|
|
25177
|
-
openSync,
|
|
25178
|
-
readFileSync as readFileSync2,
|
|
25179
|
-
rmSync as rmSync5,
|
|
25180
|
-
statSync as statSync3,
|
|
25181
|
-
writeFileSync as writeFileSync2
|
|
25182
|
-
} from "fs";
|
|
25183
|
-
import { hostname as hostname3 } from "os";
|
|
25184
|
-
var PARK = new Int32Array(new SharedArrayBuffer(4));
|
|
25185
|
-
|
|
25186
|
-
// ../../packages/persistence/src/managed-settings.ts
|
|
25187
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
25188
|
-
import { posix, win32 } from "path";
|
|
25189
|
-
|
|
25190
|
-
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
25191
|
-
import { randomUUID as randomUUID5 } from "crypto";
|
|
25192
|
-
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
25193
|
-
var HARNESS_LABELS = {
|
|
25194
|
-
[HARNESS.ClaudeCode]: "Claude Code",
|
|
25195
|
-
[HARNESS.Cursor]: "Cursor",
|
|
25196
|
-
[HARNESS.Codex]: "Codex",
|
|
25197
|
-
[HARNESS.Antigravity]: "Antigravity",
|
|
25198
|
-
[HARNESS.Copilot]: "GitHub Copilot"
|
|
25199
|
-
};
|
|
25200
|
-
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
25201
|
-
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
25202
|
-
var TITLE_NEEDLES = {
|
|
25203
|
-
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
25204
|
-
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
25205
|
-
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
25206
|
-
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity),
|
|
25207
|
-
// 'githubcopilot', not 'copilot'. The needle is the stripped WIRE id like
|
|
25208
|
-
// every other row, and the wire id carries the vendor: a bare 'copilot'
|
|
25209
|
-
// needle would also match any title that merely contains the word.
|
|
25210
|
-
Copilot: stripSeparators(SOURCE_TOOL.Copilot)
|
|
25211
|
-
};
|
|
25212
|
-
|
|
25213
|
-
// ../../packages/persistence/src/repositories/policies.ts
|
|
25214
|
-
import { randomUUID as randomUUID6 } from "crypto";
|
|
25215
|
-
|
|
25216
|
-
// ../../packages/persistence/src/repositories/project-files.ts
|
|
25217
|
-
import { randomUUID as randomUUID7 } from "crypto";
|
|
25218
|
-
|
|
25219
|
-
// ../../packages/persistence/src/repositories/resolutions.ts
|
|
25220
|
-
import { randomUUID as randomUUID8 } from "crypto";
|
|
25221
|
-
|
|
25222
|
-
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
25223
|
-
import { randomUUID as randomUUID9 } from "crypto";
|
|
25224
|
-
|
|
25225
|
-
// ../../packages/persistence/src/repositories/security.ts
|
|
25226
|
-
var OPEN_AT_REST_FINDINGS_SQL = `FROM inspection_findings f
|
|
25227
|
-
JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
|
|
25228
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
25229
|
-
LEFT JOIN ${LATEST_RESOLUTION_BY_KEY_SQL} latest
|
|
25230
|
-
ON latest.finding_key = f.finding_key
|
|
25231
|
-
WHERE e.event_type IN (${CAPTURE_EVENT_TYPES_SQL})
|
|
25232
|
-
AND e.event_type = 'code_change'
|
|
25233
|
-
AND (
|
|
25234
|
-
f.finding_key IS NULL
|
|
25235
|
-
OR latest.status IS NULL
|
|
25236
|
-
OR latest.status NOT IN ('resolved', 'dismissed')
|
|
25237
|
-
)`;
|
|
25238
|
-
var SCAN_COVERAGE = {
|
|
25239
|
-
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
25240
|
-
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
25241
|
-
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
25242
|
-
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
25243
|
-
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
25244
|
-
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
25245
|
-
[HARNESS.Copilot]: { coverage: 30, supported: true },
|
|
25246
|
-
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
25247
|
-
};
|
|
25248
|
-
|
|
25249
|
-
// ../../packages/persistence/src/repositories/shares.ts
|
|
25250
|
-
import { randomUUID as randomUUID10 } from "crypto";
|
|
25251
|
-
|
|
25252
|
-
// ../../packages/persistence/src/database.ts
|
|
25253
|
-
var CAPTURE_GRAIN = new Set(EventKind.options);
|
|
25254
|
-
var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
|
|
25255
|
-
|
|
25256
|
-
// ../../packages/persistence/src/egress-wire.ts
|
|
25257
|
-
import { createHash as createHash3 } from "crypto";
|
|
25258
|
-
var SLASH = "/".charCodeAt(0);
|
|
25259
|
-
var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
|
|
25260
|
-
|
|
25261
|
-
// ../../packages/persistence/src/finding-key.ts
|
|
25262
|
-
import { createHash as createHash4 } from "crypto";
|
|
25263
|
-
|
|
25264
|
-
// ../../packages/persistence/src/fingerprint.ts
|
|
25265
|
-
import { createHmac, randomBytes } from "crypto";
|
|
25266
|
-
import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
25267
|
-
import { join as join8 } from "path";
|
|
25268
|
-
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
25269
|
-
|
|
25270
|
-
// ../../packages/persistence/src/forward-health.ts
|
|
25271
|
-
import { readFileSync as readFileSync7 } from "fs";
|
|
25272
|
-
import { join as join9 } from "path";
|
|
25273
|
-
|
|
25274
|
-
// ../../packages/persistence/src/history-backfill.ts
|
|
25275
|
-
import { existsSync as existsSync4 } from "fs";
|
|
25276
|
-
import { join as join10 } from "path";
|
|
25277
|
-
|
|
25278
|
-
// ../../packages/persistence/src/history-preview.ts
|
|
25279
|
-
import { existsSync as existsSync5 } from "fs";
|
|
25280
|
-
import { join as join11 } from "path";
|
|
25281
|
-
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
25282
|
-
|
|
25283
|
-
// ../../packages/persistence/src/history-sync-state.ts
|
|
25284
|
-
import { readFileSync as readFileSync8 } from "fs";
|
|
25285
|
-
import { join as join12 } from "path";
|
|
25286
|
-
|
|
25287
|
-
// ../../packages/persistence/src/store-symlinks.ts
|
|
25288
|
-
import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
|
|
25289
|
-
import { dirname as dirname3, join as join13, resolve } from "path";
|
|
25290
|
-
|
|
25291
|
-
// ../../packages/persistence/src/vault/crypto.ts
|
|
25292
|
-
import {
|
|
25293
|
-
createCipheriv,
|
|
25294
|
-
createDecipheriv,
|
|
25295
|
-
createHmac as createHmac2,
|
|
25296
|
-
hkdfSync,
|
|
25297
|
-
timingSafeEqual
|
|
25298
|
-
} from "crypto";
|
|
25299
|
-
|
|
25300
|
-
// ../../packages/persistence/src/vault/key-provider.ts
|
|
25301
|
-
import { execFileSync } from "child_process";
|
|
25302
|
-
import { randomBytes as randomBytes2 } from "crypto";
|
|
25303
|
-
import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
25304
|
-
import { join as join14 } from "path";
|
|
25305
|
-
|
|
25306
|
-
// ../../packages/persistence/src/vault/vault.ts
|
|
25307
|
-
import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
|
|
25308
|
-
|
|
25309
|
-
// ../../packages/persistence/src/warn-era-cap.ts
|
|
25310
|
-
import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
25311
|
-
import { join as join15 } from "path";
|
|
25312
|
-
|
|
25313
|
-
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
25314
|
-
var booleanish = external_exports.string().optional().transform((v) => {
|
|
25315
|
-
if (v === void 0) return void 0;
|
|
25316
|
-
const t = v.trim().toLowerCase();
|
|
25317
|
-
if (t === "" || t === "false" || t === "0") return false;
|
|
25318
|
-
return true;
|
|
25319
|
-
}).catch(void 0);
|
|
25320
|
-
var optionalBaseUrl = external_exports.preprocess((v) => {
|
|
25321
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
25322
|
-
return v;
|
|
25323
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
25324
|
-
var providerEnvShape = {
|
|
25325
|
-
CLAUDE_CODE_USE_BEDROCK: booleanish,
|
|
25326
|
-
CLAUDE_CODE_USE_VERTEX: booleanish,
|
|
25327
|
-
ANTHROPIC_BASE_URL: optionalBaseUrl
|
|
25328
|
-
};
|
|
25329
|
-
var ProviderEnvSchema = external_exports.object(providerEnvShape);
|
|
25330
|
-
|
|
25331
|
-
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
25332
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
|
|
25333
|
-
import { homedir as homedir2 } from "os";
|
|
25334
|
-
import { basename as basename3, join as join18 } from "path";
|
|
25335
|
-
|
|
25336
24245
|
// ../../packages/detections/src/egress/registry.ts
|
|
25337
24246
|
var EXTRACTOR_VERSION = "3";
|
|
25338
24247
|
var PROVIDER_REGISTRY = [
|
|
@@ -26007,12 +24916,12 @@ var RegexMatcher2 = class {
|
|
|
26007
24916
|
rule.matcher,
|
|
26008
24917
|
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26009
24918
|
);
|
|
26010
|
-
const
|
|
24919
|
+
const scanText = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26011
24920
|
const spans = [];
|
|
26012
24921
|
let m;
|
|
26013
|
-
const maxIterations =
|
|
24922
|
+
const maxIterations = scanText.length + 1;
|
|
26014
24923
|
let iterations = 0;
|
|
26015
|
-
while ((m = re.exec(
|
|
24924
|
+
while ((m = re.exec(scanText)) !== null) {
|
|
26016
24925
|
if (++iterations > maxIterations) break;
|
|
26017
24926
|
const group = captureGroup != null ? m[captureGroup] : m[0];
|
|
26018
24927
|
if (m[0].length === 0) re.lastIndex++;
|
|
@@ -26165,131 +25074,38 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
26165
25074
|
);
|
|
26166
25075
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
26167
25076
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
26168
|
-
|
|
26169
|
-
|
|
26170
|
-
|
|
26171
|
-
|
|
26172
|
-
|
|
26173
|
-
|
|
26174
|
-
|
|
26175
|
-
|
|
26176
|
-
|
|
26177
|
-
|
|
26178
|
-
import { existsSync as existsSync10 } from "fs";
|
|
26179
|
-
import { fileURLToPath } from "url";
|
|
26180
|
-
import { Worker } from "worker_threads";
|
|
26181
|
-
|
|
26182
|
-
// ../../packages/plugin-sdk/src/hook-fail-opens.ts
|
|
26183
|
-
import { readFileSync as readFileSync12 } from "fs";
|
|
26184
|
-
import { join as join19 } from "path";
|
|
26185
|
-
|
|
26186
|
-
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
26187
|
-
import { readFileSync as readFileSync14 } from "fs";
|
|
26188
|
-
import { join as join21 } from "path";
|
|
26189
|
-
|
|
26190
|
-
// ../../packages/plugin-sdk/src/model-governance.ts
|
|
26191
|
-
import {
|
|
26192
|
-
closeSync as closeSync2,
|
|
26193
|
-
fstatSync,
|
|
26194
|
-
mkdirSync as mkdirSync2,
|
|
26195
|
-
openSync as openSync2,
|
|
26196
|
-
readFileSync as readFileSync13,
|
|
26197
|
-
readSync,
|
|
26198
|
-
writeFileSync as writeFileSync5
|
|
26199
|
-
} from "fs";
|
|
26200
|
-
import { join as join20 } from "path";
|
|
26201
|
-
var TAIL_BYTES = 256 * 1024;
|
|
26202
|
-
|
|
26203
|
-
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
26204
|
-
var HOST_FEATURE = {
|
|
26205
|
-
ModelSwitch: "model-switch",
|
|
26206
|
-
VaultPointerDisplay: "vault-pointer-display"
|
|
26207
|
-
};
|
|
26208
|
-
var HOST_FLOORS = {
|
|
26209
|
-
[HOST_FEATURE.ModelSwitch]: {
|
|
26210
|
-
label: "model-switch protection",
|
|
26211
|
-
hookEvents: ["PreModelSwitch", "PostModelSwitch"],
|
|
26212
|
-
since: "2.1.251"
|
|
26213
|
-
},
|
|
26214
|
-
[HOST_FEATURE.VaultPointerDisplay]: {
|
|
26215
|
-
label: "vault pointer display",
|
|
26216
|
-
hookEvents: ["MessageDisplay"],
|
|
26217
|
-
since: "2.1.152"
|
|
26218
|
-
}
|
|
26219
|
-
};
|
|
26220
|
-
var ANTIGRAVITY_HOST_FEATURE = {
|
|
26221
|
-
EndOfTurnCapture: "end-of-turn-capture"
|
|
26222
|
-
};
|
|
26223
|
-
var ANTIGRAVITY_HOST_FLOORS = {
|
|
26224
|
-
[ANTIGRAVITY_HOST_FEATURE.EndOfTurnCapture]: {
|
|
26225
|
-
label: "end-of-turn history capture",
|
|
26226
|
-
hookEvents: ["Stop"],
|
|
26227
|
-
since: "1.1.10"
|
|
25077
|
+
function repeatTo(unit, length) {
|
|
25078
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
25079
|
+
}
|
|
25080
|
+
function joinTo(length, open2, close, item) {
|
|
25081
|
+
const parts = [];
|
|
25082
|
+
let size = open2.length;
|
|
25083
|
+
for (let i = 0; size < length; i++) {
|
|
25084
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
25085
|
+
parts.push(next);
|
|
25086
|
+
size += next.length;
|
|
26228
25087
|
}
|
|
26229
|
-
|
|
26230
|
-
|
|
26231
|
-
|
|
26232
|
-
var
|
|
26233
|
-
|
|
26234
|
-
|
|
26235
|
-
|
|
26236
|
-
|
|
26237
|
-
|
|
26238
|
-
|
|
26239
|
-
|
|
26240
|
-
|
|
26241
|
-
|
|
26242
|
-
|
|
26243
|
-
|
|
26244
|
-
|
|
26245
|
-
|
|
26246
|
-
|
|
26247
|
-
|
|
26248
|
-
|
|
26249
|
-
|
|
26250
|
-
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26251
|
-
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
|
|
26252
|
-
import { basename as basename5, join as join24 } from "path";
|
|
26253
|
-
|
|
26254
|
-
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
26255
|
-
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
26256
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
26257
|
-
return v;
|
|
26258
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
26259
|
-
var optionalFlag = external_exports.preprocess((v) => {
|
|
26260
|
-
if (typeof v !== "string") return false;
|
|
26261
|
-
const normalized = v.trim().toLowerCase();
|
|
26262
|
-
return normalized !== "" && normalized !== "0" && normalized !== "false";
|
|
26263
|
-
}, external_exports.boolean()).catch(false);
|
|
26264
|
-
var antigravityProviderEnvShape = {
|
|
26265
|
-
GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
|
|
26266
|
-
GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
|
|
26267
|
-
};
|
|
26268
|
-
var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
|
|
26269
|
-
|
|
26270
|
-
// ../../packages/plugin-sdk/src/provider-env-codex.ts
|
|
26271
|
-
var optionalBaseUrl3 = external_exports.preprocess((v) => {
|
|
26272
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
26273
|
-
return v;
|
|
26274
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
26275
|
-
var codexProviderEnvShape = {
|
|
26276
|
-
OPENAI_BASE_URL: optionalBaseUrl3
|
|
26277
|
-
};
|
|
26278
|
-
var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
|
|
26279
|
-
|
|
26280
|
-
// ../../packages/plugin-sdk/src/runtime.ts
|
|
26281
|
-
import { randomUUID as randomUUID15 } from "crypto";
|
|
26282
|
-
|
|
26283
|
-
// ../../packages/plugin-sdk/src/scope-key.ts
|
|
26284
|
-
import { existsSync as existsSync12 } from "fs";
|
|
26285
|
-
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join25, normalize } from "path";
|
|
26286
|
-
|
|
26287
|
-
// ../../packages/plugin-sdk/src/suppressions.ts
|
|
26288
|
-
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
26289
|
-
|
|
26290
|
-
// ../../packages/plugin-sdk/src/throttle.ts
|
|
26291
|
-
import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
26292
|
-
import { join as join26 } from "path";
|
|
25088
|
+
return (open2 + parts.join("") + close).slice(0, length);
|
|
25089
|
+
}
|
|
25090
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
25091
|
+
var GROWTH_CORPORA = [
|
|
25092
|
+
{
|
|
25093
|
+
name: "one-line JSON dictionary",
|
|
25094
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
25095
|
+
},
|
|
25096
|
+
{
|
|
25097
|
+
name: "JSON array of quoted SQL keywords",
|
|
25098
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
25099
|
+
},
|
|
25100
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
25101
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
25102
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
25103
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
25104
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
25105
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
25106
|
+
build: (length) => repeatTo(unit, length)
|
|
25107
|
+
}))
|
|
25108
|
+
];
|
|
26293
25109
|
|
|
26294
25110
|
// ../../packages/setup-wizard/src/onboard-posture.ts
|
|
26295
25111
|
function parsePosture(json2) {
|
|
@@ -26327,8 +25143,8 @@ function parseCurrent(json2) {
|
|
|
26327
25143
|
}
|
|
26328
25144
|
|
|
26329
25145
|
// ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
|
|
26330
|
-
import { writeFileSync
|
|
26331
|
-
import { join
|
|
25146
|
+
import { writeFileSync } from "fs";
|
|
25147
|
+
import { join } from "path";
|
|
26332
25148
|
|
|
26333
25149
|
// ../../packages/setup-wizard/src/triage/gate-display.ts
|
|
26334
25150
|
var ACTION_RANK = {
|
|
@@ -26355,9 +25171,9 @@ var RANK = Object.fromEntries(
|
|
|
26355
25171
|
);
|
|
26356
25172
|
|
|
26357
25173
|
// ../../packages/setup-wizard/src/triage/plan-file.ts
|
|
26358
|
-
import { mkdtempSync, readFileSync
|
|
25174
|
+
import { mkdtempSync, readFileSync, rmdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
26359
25175
|
import { tmpdir } from "os";
|
|
26360
|
-
import { basename
|
|
25176
|
+
import { basename, dirname, join as join2 } from "path";
|
|
26361
25177
|
var SuppressionEntrySchema = external_exports.object({
|
|
26362
25178
|
ruleId: external_exports.string(),
|
|
26363
25179
|
category: DetectionCategory,
|
|
@@ -26456,8 +25272,8 @@ function table(headers, rows, opts = {}) {
|
|
|
26456
25272
|
const widths = headers.map(
|
|
26457
25273
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
26458
25274
|
);
|
|
26459
|
-
const
|
|
26460
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
25275
|
+
const sep = " ".repeat(gap);
|
|
25276
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep);
|
|
26461
25277
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
26462
25278
|
if (opts.rowSep === true) {
|
|
26463
25279
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -26469,7 +25285,7 @@ function table(headers, rows, opts = {}) {
|
|
|
26469
25285
|
});
|
|
26470
25286
|
return [headerLine, rule, ...body].join("\n");
|
|
26471
25287
|
}
|
|
26472
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
25288
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep);
|
|
26473
25289
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
26474
25290
|
}
|
|
26475
25291
|
function fenced(body) {
|
|
@@ -26482,10 +25298,10 @@ function show(body) {
|
|
|
26482
25298
|
}
|
|
26483
25299
|
|
|
26484
25300
|
// src/skills-registry.ts
|
|
26485
|
-
import { readdirSync
|
|
26486
|
-
import { join as
|
|
26487
|
-
import { fileURLToPath
|
|
26488
|
-
var SKILLS_DIR =
|
|
25301
|
+
import { readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
25302
|
+
import { join as join3 } from "path";
|
|
25303
|
+
import { fileURLToPath } from "url";
|
|
25304
|
+
var SKILLS_DIR = fileURLToPath(new URL("../skills", import.meta.url));
|
|
26489
25305
|
|
|
26490
25306
|
// src/render.ts
|
|
26491
25307
|
var SEVERITY_GLYPH = {
|