@akasecurity/ai-tc-codex 0.9.15 → 0.9.17-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/hooks/hooks.json +1 -1
- package/package.json +5 -5
- package/scripts/apply-suppressions.js +2046 -1541
- package/scripts/backfill.js +2724 -1573
- package/scripts/content-retention.js +1506 -2220
- package/scripts/filescan.js +2927 -756
- package/scripts/firstrun.js +2566 -1936
- package/scripts/history-sync.js +1510 -2253
- package/scripts/intro.js +493 -2401
- package/scripts/onboard.js +3505 -1331
- package/scripts/post-tool-use.js +3213 -1990
- package/scripts/pre-tool-use.js +2650 -1516
- package/scripts/query.js +2566 -1936
- package/scripts/reconcile.js +2581 -1479
- package/scripts/remediate.js +2638 -1547
- package/scripts/scan-worker.js +377 -161
- package/scripts/session-start.js +3538 -1045
- package/scripts/start-light.js +381 -1456
- package/scripts/stop.js +626 -1311
- package/scripts/sync.js +3475 -1284
- package/scripts/user-prompt-submit.js +2766 -1595
- package/skills/setup/SKILL.md +27 -12
package/scripts/start-light.js
CHANGED
|
@@ -1,864 +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.10/node_modules/ignore/index.js
|
|
36
|
-
var require_ignore = __commonJS({
|
|
37
|
-
"../../node_modules/.pnpm/ignore@7.0.10/node_modules/ignore/index.js"(exports, module) {
|
|
38
|
-
"use strict";
|
|
39
|
-
function makeArray(subject) {
|
|
40
|
-
return Array.isArray(subject) ? subject : [subject];
|
|
41
|
-
}
|
|
42
|
-
var UNDEFINED = void 0;
|
|
43
|
-
var EMPTY = "";
|
|
44
|
-
var SPACE = " ";
|
|
45
|
-
var ESCAPE = "\\";
|
|
46
|
-
var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
|
|
47
|
-
var REGEX_TEST_BLANK_LINE = /^\uFEFF? *$/;
|
|
48
|
-
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
49
|
-
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
50
|
-
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
51
|
-
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
52
|
-
var DOUBLE_SLASH = "//";
|
|
53
|
-
var SLASH_CODE = 47;
|
|
54
|
-
var DOT_CODE = 46;
|
|
55
|
-
var SLASH2 = "/";
|
|
56
|
-
var TMP_KEY_IGNORE = "node-ignore";
|
|
57
|
-
if (typeof Symbol !== "undefined") {
|
|
58
|
-
TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
|
|
59
|
-
}
|
|
60
|
-
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
61
|
-
var define = (object2, key, value) => {
|
|
62
|
-
Object.defineProperty(object2, key, { value });
|
|
63
|
-
return value;
|
|
64
|
-
};
|
|
65
|
-
var RETURN_FALSE = () => false;
|
|
66
|
-
var cleanRangeBackSlash = (slashes) => {
|
|
67
|
-
const { length } = slashes;
|
|
68
|
-
return slashes.slice(0, length - length % 2);
|
|
69
|
-
};
|
|
70
|
-
var POSIX_CLASSES = {
|
|
71
|
-
alnum: "0-9A-Za-z",
|
|
72
|
-
alpha: "A-Za-z",
|
|
73
|
-
blank: " \\t",
|
|
74
|
-
cntrl: "\\x00-\\x1f\\x7f",
|
|
75
|
-
digit: "0-9",
|
|
76
|
-
graph: "!-.0-~",
|
|
77
|
-
lower: "a-z",
|
|
78
|
-
print: " -.0-~",
|
|
79
|
-
punct: "!-.:-@\\[-`{-~",
|
|
80
|
-
// git's `sane-ctype.h` classifies \v and \f as control, not space,
|
|
81
|
-
// unlike C's `isspace`
|
|
82
|
-
space: " \\t\\n\\r",
|
|
83
|
-
upper: "A-Z",
|
|
84
|
-
xdigit: "0-9A-Fa-f"
|
|
85
|
-
};
|
|
86
|
-
var CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
|
|
87
|
-
var escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
|
|
88
|
-
var NON_SLASH = "(?!\\/)";
|
|
89
|
-
var classSource = (negated, body) => {
|
|
90
|
-
if (negated) {
|
|
91
|
-
return `[^\\/${body}]`;
|
|
92
|
-
}
|
|
93
|
-
const source = `[${body}]`;
|
|
94
|
-
return new RegExp(source).test("/") ? NON_SLASH + source : source;
|
|
95
|
-
};
|
|
96
|
-
var scanBracket = (pattern, start) => {
|
|
97
|
-
const { length } = pattern;
|
|
98
|
-
let index = start + 1;
|
|
99
|
-
let negated = EMPTY;
|
|
100
|
-
const lead = pattern[index];
|
|
101
|
-
if (lead === "!" || lead === "^") {
|
|
102
|
-
negated = "^";
|
|
103
|
-
index++;
|
|
104
|
-
}
|
|
105
|
-
let body = EMPTY;
|
|
106
|
-
let prev = EMPTY;
|
|
107
|
-
for (; ; ) {
|
|
108
|
-
const char = pattern[index];
|
|
109
|
-
if (char === UNDEFINED) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
if (char === ESCAPE) {
|
|
113
|
-
const escaped = pattern[index + 1];
|
|
114
|
-
if (escaped === UNDEFINED) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
body += escapeMember(escaped);
|
|
118
|
-
prev = escaped;
|
|
119
|
-
index++;
|
|
120
|
-
} else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
|
|
121
|
-
index++;
|
|
122
|
-
let to = pattern[index];
|
|
123
|
-
if (to === ESCAPE) {
|
|
124
|
-
to = pattern[index += 1];
|
|
125
|
-
}
|
|
126
|
-
if (prev <= to) {
|
|
127
|
-
body += `-${escapeMember(to)}`;
|
|
128
|
-
}
|
|
129
|
-
prev = EMPTY;
|
|
130
|
-
} else if (char === "[" && pattern[index + 1] === ":") {
|
|
131
|
-
const nameStart = index + 2;
|
|
132
|
-
let end = nameStart;
|
|
133
|
-
while (end < length && pattern[end] !== "]") {
|
|
134
|
-
end++;
|
|
135
|
-
}
|
|
136
|
-
if (end === length) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
if (end > nameStart && pattern[end - 1] === ":") {
|
|
140
|
-
const expanded = POSIX_CLASSES[pattern.slice(nameStart, end - 1)];
|
|
141
|
-
if (expanded === UNDEFINED) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
body += expanded;
|
|
145
|
-
prev = EMPTY;
|
|
146
|
-
index = end;
|
|
147
|
-
} else {
|
|
148
|
-
body += escapeMember("[");
|
|
149
|
-
prev = "[";
|
|
150
|
-
index = nameStart - 2;
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
body += escapeMember(char);
|
|
154
|
-
prev = char;
|
|
155
|
-
}
|
|
156
|
-
index++;
|
|
157
|
-
if (pattern[index] === "]") {
|
|
158
|
-
return {
|
|
159
|
-
end: index,
|
|
160
|
-
source: classSource(negated, body)
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
var NEVER_MATCH = "[]";
|
|
166
|
-
var PLACEHOLDER = "\0";
|
|
167
|
-
var REGEX_RESTORE_PLACEHOLDER = new RegExp(
|
|
168
|
-
`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`,
|
|
169
|
-
"g"
|
|
170
|
-
);
|
|
171
|
-
var TRAILING_WILDCARD = "\uE000";
|
|
172
|
-
var extractBrackets = (pattern) => {
|
|
173
|
-
const sources = [];
|
|
174
|
-
const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
|
|
175
|
-
const { length } = pattern;
|
|
176
|
-
let out = EMPTY;
|
|
177
|
-
let index = 0;
|
|
178
|
-
while (index < length) {
|
|
179
|
-
const char = pattern[index];
|
|
180
|
-
if (char === ESCAPE) {
|
|
181
|
-
const escaped = pattern[index + 1];
|
|
182
|
-
if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
|
|
183
|
-
out += pattern.slice(index, index + 2);
|
|
184
|
-
} else {
|
|
185
|
-
out += hold(
|
|
186
|
-
REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : escaped
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
index += 2;
|
|
190
|
-
} else if (char === PLACEHOLDER) {
|
|
191
|
-
out += hold(`[${PLACEHOLDER}]`);
|
|
192
|
-
index++;
|
|
193
|
-
} else if (char === "[") {
|
|
194
|
-
const scanned = scanBracket(pattern, index);
|
|
195
|
-
if (scanned === null) {
|
|
196
|
-
out += hold(NEVER_MATCH);
|
|
197
|
-
index = length;
|
|
198
|
-
} else {
|
|
199
|
-
out += hold(scanned.source);
|
|
200
|
-
index = scanned.end + 1;
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
out += char;
|
|
204
|
-
index++;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return {
|
|
208
|
-
source: out,
|
|
209
|
-
sources
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
var DIRECT = null;
|
|
213
|
-
var REGEX_INNER_SLASH = /\/(?!$)/;
|
|
214
|
-
var REPLACERS = [
|
|
215
|
-
[
|
|
216
|
-
// Remove BOM
|
|
217
|
-
// TODO:
|
|
218
|
-
// Other similar zero-width characters?
|
|
219
|
-
/^\uFEFF/,
|
|
220
|
-
() => EMPTY,
|
|
221
|
-
"\uFEFF"
|
|
222
|
-
],
|
|
223
|
-
[
|
|
224
|
-
// A trailing line terminator, left on when a whole file's contents are
|
|
225
|
-
// added as one pattern rather than split into lines. git never sees one
|
|
226
|
-
// -- it reads a `.gitignore` line by line -- so it is not part of the
|
|
227
|
-
// pattern and is dropped here, apart from the trailing-space trimming,
|
|
228
|
-
// which follows git in touching spaces and nothing else.
|
|
229
|
-
/[\r\n]+$/,
|
|
230
|
-
() => EMPTY
|
|
231
|
-
],
|
|
232
|
-
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
233
|
-
[
|
|
234
|
-
// Only spaces, never tabs or other whitespace: git trims a trailing run
|
|
235
|
-
// of `' '` and nothing else (dir.c, `trim_trailing_spaces`, a single
|
|
236
|
-
// `case ' '`), so a pattern ending in a tab keeps it as a literal.
|
|
237
|
-
// (a\ ) -> (a )
|
|
238
|
-
// (a ) -> (a)
|
|
239
|
-
// (a ) -> (a)
|
|
240
|
-
// (a \ ) -> (a )
|
|
241
|
-
/((?:\\\\)*?)(\\? +)$/,
|
|
242
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
|
|
243
|
-
],
|
|
244
|
-
// Replace (\ ) with ' '
|
|
245
|
-
// Only a space: an escaped tab or other whitespace is already a literal by
|
|
246
|
-
// the time it reaches here, and a bare tab must be left as one, not turned
|
|
247
|
-
// into a space.
|
|
248
|
-
// (\ ) -> ' '
|
|
249
|
-
// (\\ ) -> '\\ '
|
|
250
|
-
// (\\\ ) -> '\\ '
|
|
251
|
-
[
|
|
252
|
-
/(\\+?) /g,
|
|
253
|
-
(_, m1) => {
|
|
254
|
-
const { length } = m1;
|
|
255
|
-
return m1.slice(0, length - length % 2) + SPACE;
|
|
256
|
-
}
|
|
257
|
-
],
|
|
258
|
-
// Escape metacharacters
|
|
259
|
-
// which is written down by users but means special for regular expressions.
|
|
260
|
-
// > There are 12 characters with special meanings:
|
|
261
|
-
// > - the backslash \,
|
|
262
|
-
// > - the caret ^,
|
|
263
|
-
// > - the dollar sign $,
|
|
264
|
-
// > - the period or dot .,
|
|
265
|
-
// > - the vertical bar or pipe symbol |,
|
|
266
|
-
// > - the question mark ?,
|
|
267
|
-
// > - the asterisk or star *,
|
|
268
|
-
// > - the plus sign +,
|
|
269
|
-
// > - the opening parenthesis (,
|
|
270
|
-
// > - the closing parenthesis ),
|
|
271
|
-
// > - and the opening square bracket [,
|
|
272
|
-
// > - the opening curly brace {,
|
|
273
|
-
// > These special characters are often called "metacharacters".
|
|
274
|
-
[
|
|
275
|
-
/[\\$.|*+(){^]/g,
|
|
276
|
-
(match) => `\\${match}`
|
|
277
|
-
],
|
|
278
|
-
[
|
|
279
|
-
// > a question mark (?) matches a single character
|
|
280
|
-
/(?!\\)\?/g,
|
|
281
|
-
() => "[^/]",
|
|
282
|
-
"?"
|
|
283
|
-
],
|
|
284
|
-
// leading slash
|
|
285
|
-
[
|
|
286
|
-
// > A leading slash matches the beginning of the pathname.
|
|
287
|
-
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
288
|
-
// A leading slash matches the beginning of the pathname
|
|
289
|
-
/^\//,
|
|
290
|
-
() => "^",
|
|
291
|
-
SLASH2
|
|
292
|
-
],
|
|
293
|
-
// replace special metacharacter slash after the leading slash
|
|
294
|
-
[
|
|
295
|
-
/\//g,
|
|
296
|
-
() => "\\/",
|
|
297
|
-
SLASH2
|
|
298
|
-
],
|
|
299
|
-
[
|
|
300
|
-
// > A leading "**" followed by a slash means match in all directories.
|
|
301
|
-
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
302
|
-
// > the same as pattern "foo".
|
|
303
|
-
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
304
|
-
// > under directory "foo".
|
|
305
|
-
// Notice that the '*'s have been replaced as '\\*'
|
|
306
|
-
/^\^*(?:\\\*\\\*\\\/)+/,
|
|
307
|
-
// '**/foo' <-> 'foo'
|
|
308
|
-
() => "^(?:.*\\/)?",
|
|
309
|
-
"*"
|
|
310
|
-
],
|
|
311
|
-
// starting
|
|
312
|
-
[
|
|
313
|
-
// there will be no leading '/'
|
|
314
|
-
// (which has been replaced by section "leading slash")
|
|
315
|
-
// If starts with '**', adding a '^' to the regular expression also works
|
|
316
|
-
DIRECT,
|
|
317
|
-
(source, pattern) => {
|
|
318
|
-
if (!source || source[0] === "^") {
|
|
319
|
-
return source;
|
|
320
|
-
}
|
|
321
|
-
const anchor2 = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
|
|
322
|
-
return anchor2 + source;
|
|
323
|
-
}
|
|
324
|
-
],
|
|
325
|
-
// two globstars
|
|
326
|
-
[
|
|
327
|
-
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
328
|
-
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
329
|
-
// Zero, one or several directories
|
|
330
|
-
// should not use '*', or it will be replaced by the next replacer
|
|
331
|
-
// Check if it is not the last `'/**'`
|
|
332
|
-
(_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : "\\/.+",
|
|
333
|
-
"*"
|
|
334
|
-
],
|
|
335
|
-
// normal intermediate wildcards
|
|
336
|
-
[
|
|
337
|
-
// Never replace escaped '*'
|
|
338
|
-
// ignore rule '\*' will match the path '*'
|
|
339
|
-
// 'abc.*/' -> go
|
|
340
|
-
// 'abc.*' -> skip this rule,
|
|
341
|
-
// coz trailing single wildcard will be handed by [trailing wildcard]
|
|
342
|
-
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
|
343
|
-
// '*.js' matches '.js'
|
|
344
|
-
// '*.js' doesn't match 'abc'
|
|
345
|
-
(_, p1, p2) => {
|
|
346
|
-
const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
|
|
347
|
-
return p1 + unescaped;
|
|
348
|
-
},
|
|
349
|
-
"*"
|
|
350
|
-
],
|
|
351
|
-
// trailing wildcard, held apart from a literal star
|
|
352
|
-
[
|
|
353
|
-
// The step above leaves a trailing `*` alone, so a single `\*` is all that
|
|
354
|
-
// can be left at the end here. Whether it is a wildcard or a literal
|
|
355
|
-
// turns on the backslashes the user put in front of it: the escaper has
|
|
356
|
-
// since doubled every one, so what stands here is those `2N` doubled
|
|
357
|
-
// backslashes and then the star's own escape. An even number of the
|
|
358
|
-
// original `N` leaves the star unescaped -- a wildcard -- and an odd
|
|
359
|
-
// number escapes it -- a literal. This runs while the two are still
|
|
360
|
-
// distinct, before the unescape steps below collapse the literal onto
|
|
361
|
-
// the very `\*` a wildcard leaves behind.
|
|
362
|
-
/(^|[^\\])((?:\\\\)*)\\\*$/,
|
|
363
|
-
(match, p1, p2) => (
|
|
364
|
-
// `p2` holds the doubled user backslashes; half of them is `N`.
|
|
365
|
-
p2.length / 2 % 2 === 0 ? p1 + p2 + TRAILING_WILDCARD : match
|
|
366
|
-
),
|
|
367
|
-
"*"
|
|
368
|
-
],
|
|
369
|
-
[
|
|
370
|
-
// unescape, revert step 3 except for back slash
|
|
371
|
-
// For example, if a user escape a '\\*',
|
|
372
|
-
// after step 3, the result will be '\\\\\\*'
|
|
373
|
-
/\\\\\\(?=[$.|*+(){^])/g,
|
|
374
|
-
() => ESCAPE,
|
|
375
|
-
ESCAPE + ESCAPE
|
|
376
|
-
],
|
|
377
|
-
[
|
|
378
|
-
// '\\\\' -> '\\'
|
|
379
|
-
/\\\\/g,
|
|
380
|
-
() => ESCAPE,
|
|
381
|
-
ESCAPE + ESCAPE
|
|
382
|
-
],
|
|
383
|
-
[
|
|
384
|
-
// Every real bracket expression -- POSIX classes included -- has already
|
|
385
|
-
// been held aside by `extractBrackets`, so the only `[` left in the
|
|
386
|
-
// pattern is an escaped, literal one.
|
|
387
|
-
// `\` is escaped by step 3
|
|
388
|
-
/\\\[([^\]/]*?)(\\*)($|\])/g,
|
|
389
|
-
// '\\[bar]' -> '\\\\[bar\\]'
|
|
390
|
-
(match, range, endEscape, close) => `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`,
|
|
391
|
-
"["
|
|
392
|
-
],
|
|
393
|
-
// ending
|
|
394
|
-
[
|
|
395
|
-
// 'js' will not match 'js.'
|
|
396
|
-
// 'ab' will not match 'abc'
|
|
397
|
-
DIRECT,
|
|
398
|
-
// WTF!
|
|
399
|
-
// https://git-scm.com/docs/gitignore
|
|
400
|
-
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
401
|
-
// which re-fixes #24, #38
|
|
402
|
-
// > If there is a separator at the end of the pattern then the pattern
|
|
403
|
-
// > will only match directories, otherwise the pattern can match both
|
|
404
|
-
// > files and directories.
|
|
405
|
-
// 'js*' will not match 'a.js'
|
|
406
|
-
// 'js/' will not match 'a.js'
|
|
407
|
-
// 'js' will match 'a.js' and 'a.js/'
|
|
408
|
-
(source) => {
|
|
409
|
-
const last = source[source.length - 1];
|
|
410
|
-
if (!last || last === TRAILING_WILDCARD) {
|
|
411
|
-
return source;
|
|
412
|
-
}
|
|
413
|
-
return last === SLASH2 ? `${source}$` : `${source}(?=$|\\/$)`;
|
|
414
|
-
}
|
|
415
|
-
]
|
|
416
|
-
];
|
|
417
|
-
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
|
|
418
|
-
var MODE_IGNORE = "regex";
|
|
419
|
-
var MODE_CHECK_IGNORE = "checkRegex";
|
|
420
|
-
var UNDERSCORE = "_";
|
|
421
|
-
var TRAILING_WILD_CARD_REPLACERS = {
|
|
422
|
-
[MODE_IGNORE](_, p1) {
|
|
423
|
-
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
424
|
-
return `${prefix}(?=$|\\/$)`;
|
|
425
|
-
},
|
|
426
|
-
[MODE_CHECK_IGNORE](_, p1) {
|
|
427
|
-
const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
|
|
428
|
-
return `${prefix}(?=$|\\/$)`;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
var WILDCARD = "[^\\/]*";
|
|
432
|
-
var separatorAfter = (run, at) => {
|
|
433
|
-
let separator = EMPTY;
|
|
434
|
-
for (let index = at + 1; index < run.length && !run[index].wildcard; index++) {
|
|
435
|
-
separator += run[index].single;
|
|
436
|
-
}
|
|
437
|
-
return separator;
|
|
438
|
-
};
|
|
439
|
-
var pinWildcards = (source) => {
|
|
440
|
-
if (source.indexOf(WILDCARD) < 0) {
|
|
441
|
-
return source;
|
|
442
|
-
}
|
|
443
|
-
const tokens = [];
|
|
444
|
-
const { length } = source;
|
|
445
|
-
let index = 0;
|
|
446
|
-
while (index < length) {
|
|
447
|
-
const char = source[index];
|
|
448
|
-
if (source.startsWith(WILDCARD, index)) {
|
|
449
|
-
tokens.push({ wildcard: true });
|
|
450
|
-
index += WILDCARD.length;
|
|
451
|
-
} else if (char === "[") {
|
|
452
|
-
let end = index + 1;
|
|
453
|
-
if (source[end] === "^") {
|
|
454
|
-
end++;
|
|
455
|
-
}
|
|
456
|
-
if (source[end] === "]") {
|
|
457
|
-
end++;
|
|
458
|
-
}
|
|
459
|
-
while (end < length && source[end] !== "]") {
|
|
460
|
-
end += source[end] === ESCAPE ? 2 : 1;
|
|
461
|
-
}
|
|
462
|
-
end++;
|
|
463
|
-
tokens.push({ single: source.slice(index, end) });
|
|
464
|
-
index = end;
|
|
465
|
-
} else if (char === ESCAPE) {
|
|
466
|
-
tokens.push({ single: source.slice(index, index + 2) });
|
|
467
|
-
index += 2;
|
|
468
|
-
} else if (char === "(") {
|
|
469
|
-
let depth = 0;
|
|
470
|
-
let end = index;
|
|
471
|
-
do {
|
|
472
|
-
if (source[end] === ESCAPE) {
|
|
473
|
-
end++;
|
|
474
|
-
} else if (source[end] === "(") {
|
|
475
|
-
depth++;
|
|
476
|
-
} else if (source[end] === ")") {
|
|
477
|
-
depth--;
|
|
478
|
-
}
|
|
479
|
-
end++;
|
|
480
|
-
} while (end < length && depth > 0);
|
|
481
|
-
if ("*+?".indexOf(source[end]) >= 0) {
|
|
482
|
-
end++;
|
|
483
|
-
}
|
|
484
|
-
tokens.push({ boundary: source.slice(index, end) });
|
|
485
|
-
index = end;
|
|
486
|
-
} else if (char === "^" || char === "$") {
|
|
487
|
-
tokens.push({ boundary: char });
|
|
488
|
-
index++;
|
|
489
|
-
} else {
|
|
490
|
-
tokens.push({ single: char });
|
|
491
|
-
index++;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
let out = EMPTY;
|
|
495
|
-
let run = [];
|
|
496
|
-
const flush = () => {
|
|
497
|
-
let lastWildcard;
|
|
498
|
-
run.forEach((token, at) => {
|
|
499
|
-
if (token.wildcard) {
|
|
500
|
-
lastWildcard = at;
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
run.forEach((token, at) => {
|
|
504
|
-
if (!token.wildcard) {
|
|
505
|
-
out += token.single;
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
|
|
509
|
-
});
|
|
510
|
-
run = [];
|
|
511
|
-
};
|
|
512
|
-
tokens.forEach((token) => {
|
|
513
|
-
if (token.boundary === void 0) {
|
|
514
|
-
run.push(token);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
flush();
|
|
518
|
-
out += token.boundary;
|
|
519
|
-
});
|
|
520
|
-
flush();
|
|
521
|
-
return out;
|
|
522
|
-
};
|
|
523
|
-
var makeRegexPrefix = (pattern) => {
|
|
524
|
-
const { source, sources } = extractBrackets(pattern);
|
|
525
|
-
const replaced = REPLACERS.reduce(
|
|
526
|
-
// A pass whose matcher finds nothing hands back the very string it was
|
|
527
|
-
// given, so asking first costs a search and saves a rewrite. Ten of the
|
|
528
|
-
// fifteen passes never fire for a typical .gitignore line, and between
|
|
529
|
-
// them they were 45% of this chain.
|
|
530
|
-
(prev, [matcher, replacer, required2]) => {
|
|
531
|
-
if (matcher === DIRECT) {
|
|
532
|
-
return replacer(prev, pattern);
|
|
533
|
-
}
|
|
534
|
-
if (required2 !== UNDEFINED && prev.indexOf(required2) < 0) {
|
|
535
|
-
return prev;
|
|
536
|
-
}
|
|
537
|
-
return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
|
|
538
|
-
},
|
|
539
|
-
source
|
|
540
|
-
);
|
|
541
|
-
return sources.length ? replaced.replace(
|
|
542
|
-
REGEX_RESTORE_PLACEHOLDER,
|
|
543
|
-
(match, index) => sources[index]
|
|
544
|
-
) : replaced;
|
|
545
|
-
};
|
|
546
|
-
var matchesBasename = (body) => {
|
|
547
|
-
const index = body.indexOf(SLASH2);
|
|
548
|
-
return index < 0 || index === body.length - 1;
|
|
549
|
-
};
|
|
550
|
-
var basenameOf = (path) => {
|
|
551
|
-
const end = path.length - 1;
|
|
552
|
-
const index = path.lastIndexOf(
|
|
553
|
-
SLASH2,
|
|
554
|
-
path[end] === SLASH2 ? end - 1 : end
|
|
555
|
-
);
|
|
556
|
-
return index < 0 ? path : path.slice(index + 1);
|
|
557
|
-
};
|
|
558
|
-
var parentOf = (path) => {
|
|
559
|
-
if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
|
|
560
|
-
const slices = path.split(SLASH2).filter(Boolean);
|
|
561
|
-
slices.pop();
|
|
562
|
-
return slices.length ? slices.join(SLASH2) + SLASH2 : EMPTY;
|
|
563
|
-
}
|
|
564
|
-
const end = path.length - 1;
|
|
565
|
-
const cut = path.lastIndexOf(
|
|
566
|
-
SLASH2,
|
|
567
|
-
path.charCodeAt(end) === SLASH_CODE ? end - 1 : end
|
|
568
|
-
);
|
|
569
|
-
return cut < 0 ? EMPTY : path.slice(0, cut + 1);
|
|
570
|
-
};
|
|
571
|
-
var isString = (subject) => typeof subject === "string";
|
|
572
|
-
var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
|
573
|
-
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
|
|
574
|
-
var IgnoreRule = class {
|
|
575
|
-
constructor(pattern, mark, body, ignoreCase, negative, prefix) {
|
|
576
|
-
this.pattern = pattern;
|
|
577
|
-
this.mark = mark;
|
|
578
|
-
this.negative = negative;
|
|
579
|
-
define(this, "body", body);
|
|
580
|
-
define(this, "ignoreCase", ignoreCase);
|
|
581
|
-
define(this, "regexPrefix", prefix);
|
|
582
|
-
}
|
|
583
|
-
// Worked out on first use and kept behind an own property, the way `regex`
|
|
584
|
-
// caches itself in `_regex`. Deciding it in the constructor instead would
|
|
585
|
-
// add a fourth `defineProperty` to every rule ever built, which cost 4% of
|
|
586
|
-
// every compile -- including the compiles of rules that are never matched
|
|
587
|
-
// against anything.
|
|
588
|
-
get _basenameOnly() {
|
|
589
|
-
return define(this, "_basenameOnly", matchesBasename(this.body));
|
|
590
|
-
}
|
|
591
|
-
get regex() {
|
|
592
|
-
const key = UNDERSCORE + MODE_IGNORE;
|
|
593
|
-
if (this[key]) {
|
|
594
|
-
return this[key];
|
|
595
|
-
}
|
|
596
|
-
return this._make(MODE_IGNORE, key);
|
|
597
|
-
}
|
|
598
|
-
get checkRegex() {
|
|
599
|
-
const key = UNDERSCORE + MODE_CHECK_IGNORE;
|
|
600
|
-
if (this[key]) {
|
|
601
|
-
return this[key];
|
|
602
|
-
}
|
|
603
|
-
return this._make(MODE_CHECK_IGNORE, key);
|
|
604
|
-
}
|
|
605
|
-
_make(mode, key) {
|
|
606
|
-
const str = pinWildcards(this.regexPrefix.replace(
|
|
607
|
-
REGEX_REPLACE_TRAILING_WILDCARD,
|
|
608
|
-
// It does not need to bind pattern
|
|
609
|
-
TRAILING_WILD_CARD_REPLACERS[mode]
|
|
610
|
-
));
|
|
611
|
-
const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
612
|
-
return define(this, key, regex);
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
var createRule = ({
|
|
616
|
-
pattern,
|
|
617
|
-
mark
|
|
618
|
-
}, ignoreCase) => {
|
|
619
|
-
let negative = false;
|
|
620
|
-
let body = pattern;
|
|
621
|
-
if (body.indexOf("!") === 0) {
|
|
622
|
-
negative = true;
|
|
623
|
-
body = body.substr(1);
|
|
624
|
-
}
|
|
625
|
-
body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
626
|
-
const regexPrefix = makeRegexPrefix(body);
|
|
627
|
-
return new IgnoreRule(
|
|
628
|
-
pattern,
|
|
629
|
-
mark,
|
|
630
|
-
body,
|
|
631
|
-
ignoreCase,
|
|
632
|
-
negative,
|
|
633
|
-
regexPrefix
|
|
634
|
-
);
|
|
635
|
-
};
|
|
636
|
-
var RuleManager = class {
|
|
637
|
-
constructor(ignoreCase) {
|
|
638
|
-
this._ignoreCase = ignoreCase;
|
|
639
|
-
this._rules = [];
|
|
640
|
-
this._basenameCount = 0;
|
|
641
|
-
}
|
|
642
|
-
_add(pattern) {
|
|
643
|
-
if (pattern && pattern[KEY_IGNORE]) {
|
|
644
|
-
this._rules = this._rules.concat(pattern._rules._rules);
|
|
645
|
-
this._basenameCount += pattern._rules._basenameCount;
|
|
646
|
-
this._added = true;
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (isString(pattern)) {
|
|
650
|
-
pattern = {
|
|
651
|
-
pattern
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
if (checkPattern(pattern.pattern)) {
|
|
655
|
-
const rule = createRule(pattern, this._ignoreCase);
|
|
656
|
-
this._added = true;
|
|
657
|
-
this._rules.push(rule);
|
|
658
|
-
if (matchesBasename(rule.body)) {
|
|
659
|
-
this._basenameCount++;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
// @param {Array<string> | string | Ignore} pattern
|
|
664
|
-
add(pattern) {
|
|
665
|
-
this._added = false;
|
|
666
|
-
makeArray(
|
|
667
|
-
isString(pattern) ? splitPattern(pattern) : pattern
|
|
668
|
-
).forEach(this._add, this);
|
|
669
|
-
return this._added;
|
|
670
|
-
}
|
|
671
|
-
// Test one single path without recursively checking parent directories
|
|
672
|
-
//
|
|
673
|
-
// - checkUnignored `boolean` whether should check if the path is unignored,
|
|
674
|
-
// setting `checkUnignored` to `false` could reduce additional
|
|
675
|
-
// path matching.
|
|
676
|
-
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
677
|
-
// @returns {TestResult} true if a file is ignored
|
|
678
|
-
test(path, checkUnignored, mode) {
|
|
679
|
-
let ignored = false;
|
|
680
|
-
let unignored = false;
|
|
681
|
-
let matchedRule;
|
|
682
|
-
const rules = this._rules;
|
|
683
|
-
const { length } = rules;
|
|
684
|
-
const shortcut = this._basenameCount * 2 >= length;
|
|
685
|
-
const basename7 = shortcut ? basenameOf(path) : path;
|
|
686
|
-
for (let index = 0; index < length; index++) {
|
|
687
|
-
const rule = rules[index];
|
|
688
|
-
const { negative } = rule;
|
|
689
|
-
const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
|
|
690
|
-
if (!skip && rule[mode].test(
|
|
691
|
-
shortcut && rule._basenameOnly ? basename7 : path
|
|
692
|
-
)) {
|
|
693
|
-
ignored = !negative;
|
|
694
|
-
unignored = negative;
|
|
695
|
-
matchedRule = negative ? UNDEFINED : rule;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
const ret = {
|
|
699
|
-
ignored,
|
|
700
|
-
unignored
|
|
701
|
-
};
|
|
702
|
-
if (matchedRule) {
|
|
703
|
-
ret.rule = matchedRule;
|
|
704
|
-
}
|
|
705
|
-
return ret;
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
var throwError = (message, Ctor) => {
|
|
709
|
-
throw new Ctor(message);
|
|
710
|
-
};
|
|
711
|
-
var checkPath = (path, originalPath, doThrow) => {
|
|
712
|
-
if (!isString(path)) {
|
|
713
|
-
return doThrow(
|
|
714
|
-
`path must be a string, but got \`${originalPath}\``,
|
|
715
|
-
TypeError
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
if (!path) {
|
|
719
|
-
return doThrow(`path must not be empty`, TypeError);
|
|
720
|
-
}
|
|
721
|
-
if (checkPath.isNotRelative(path)) {
|
|
722
|
-
const r = "`path.relative()`d";
|
|
723
|
-
return doThrow(
|
|
724
|
-
`path should be a ${r} string, but got "${originalPath}"`,
|
|
725
|
-
RangeError
|
|
726
|
-
);
|
|
727
|
-
}
|
|
728
|
-
return true;
|
|
729
|
-
};
|
|
730
|
-
var isNotRelative = (path) => {
|
|
731
|
-
const first = path.charCodeAt(0);
|
|
732
|
-
if (first === SLASH_CODE) {
|
|
733
|
-
return true;
|
|
734
|
-
}
|
|
735
|
-
if (first !== DOT_CODE) {
|
|
736
|
-
return false;
|
|
737
|
-
}
|
|
738
|
-
if (path.length === 1) {
|
|
739
|
-
return true;
|
|
740
|
-
}
|
|
741
|
-
const second = path.charCodeAt(1);
|
|
742
|
-
if (second === SLASH_CODE) {
|
|
743
|
-
return true;
|
|
744
|
-
}
|
|
745
|
-
if (second !== DOT_CODE) {
|
|
746
|
-
return false;
|
|
747
|
-
}
|
|
748
|
-
return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
|
|
749
|
-
};
|
|
750
|
-
checkPath.isNotRelative = isNotRelative;
|
|
751
|
-
checkPath.convert = (p) => p;
|
|
752
|
-
var Ignore = class {
|
|
753
|
-
constructor({
|
|
754
|
-
ignorecase = true,
|
|
755
|
-
ignoreCase = ignorecase,
|
|
756
|
-
allowRelativePaths = false
|
|
757
|
-
} = {}) {
|
|
758
|
-
define(this, KEY_IGNORE, true);
|
|
759
|
-
this._rules = new RuleManager(ignoreCase);
|
|
760
|
-
this._strictPathCheck = !allowRelativePaths;
|
|
761
|
-
this._initCache();
|
|
762
|
-
}
|
|
763
|
-
_initCache() {
|
|
764
|
-
this._ignoreCache = /* @__PURE__ */ Object.create(null);
|
|
765
|
-
this._testCache = /* @__PURE__ */ Object.create(null);
|
|
766
|
-
}
|
|
767
|
-
add(pattern) {
|
|
768
|
-
if (this._rules.add(pattern)) {
|
|
769
|
-
this._initCache();
|
|
770
|
-
}
|
|
771
|
-
return this;
|
|
772
|
-
}
|
|
773
|
-
// legacy
|
|
774
|
-
addPattern(pattern) {
|
|
775
|
-
return this.add(pattern);
|
|
776
|
-
}
|
|
777
|
-
// @returns {TestResult}
|
|
778
|
-
_test(originalPath, cache, checkUnignored) {
|
|
779
|
-
const path = originalPath && checkPath.convert(originalPath);
|
|
780
|
-
checkPath(
|
|
781
|
-
path,
|
|
782
|
-
originalPath,
|
|
783
|
-
this._strictPathCheck ? throwError : RETURN_FALSE
|
|
784
|
-
);
|
|
785
|
-
return this._t(path, cache, checkUnignored);
|
|
786
|
-
}
|
|
787
|
-
checkIgnore(path) {
|
|
788
|
-
if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
|
|
789
|
-
return this.test(path);
|
|
790
|
-
}
|
|
791
|
-
const parentPath = parentOf(path);
|
|
792
|
-
if (parentPath) {
|
|
793
|
-
const parent = this._t(parentPath, this._testCache, true);
|
|
794
|
-
if (parent.ignored) {
|
|
795
|
-
return parent;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
return this._rules.test(path, false, MODE_CHECK_IGNORE);
|
|
799
|
-
}
|
|
800
|
-
_t(path, cache, checkUnignored) {
|
|
801
|
-
if (path in cache) {
|
|
802
|
-
return cache[path];
|
|
803
|
-
}
|
|
804
|
-
const parentPath = parentOf(path);
|
|
805
|
-
const parent = parentPath ? this._t(parentPath, cache, checkUnignored) : UNDEFINED;
|
|
806
|
-
return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
807
|
-
}
|
|
808
|
-
ignores(path) {
|
|
809
|
-
return this._test(path, this._ignoreCache, false).ignored;
|
|
810
|
-
}
|
|
811
|
-
createFilter() {
|
|
812
|
-
return (path) => !this.ignores(path);
|
|
813
|
-
}
|
|
814
|
-
filter(paths) {
|
|
815
|
-
return makeArray(paths).filter(this.createFilter());
|
|
816
|
-
}
|
|
817
|
-
// @returns {TestResult}
|
|
818
|
-
test(path) {
|
|
819
|
-
return this._test(path, this._testCache, true);
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
var factory = (options) => new Ignore(options);
|
|
823
|
-
var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
|
|
824
|
-
var setupWindows = () => {
|
|
825
|
-
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
826
|
-
checkPath.convert = makePosix;
|
|
827
|
-
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
828
|
-
checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
|
|
829
|
-
};
|
|
830
|
-
if (
|
|
831
|
-
// Detect `process` so that it can run in browsers.
|
|
832
|
-
typeof process !== "undefined" && process.platform === "win32"
|
|
833
|
-
) {
|
|
834
|
-
setupWindows();
|
|
835
|
-
}
|
|
836
|
-
module.exports = factory;
|
|
837
|
-
factory.default = factory;
|
|
838
|
-
module.exports.isPathValid = isPathValid;
|
|
839
|
-
define(module.exports, /* @__PURE__ */ Symbol.for("setupWindows"), setupWindows);
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
|
|
843
|
-
// ../../packages/plugin-sdk/src/config.ts
|
|
844
|
-
import { existsSync as existsSync8 } from "fs";
|
|
845
|
-
import { join as join16 } from "path";
|
|
846
|
-
|
|
847
|
-
// ../../packages/persistence/src/attached-derived.ts
|
|
848
|
-
import { rmSync } from "fs";
|
|
849
|
-
import { join } from "path";
|
|
850
|
-
|
|
851
|
-
// ../../packages/persistence/src/control-plane-credential.ts
|
|
852
|
-
import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
|
|
853
|
-
import { join as join2 } from "path";
|
|
854
|
-
|
|
855
|
-
// ../../packages/schema/src/drizzle/deferred-migrations.ts
|
|
856
|
-
var DEFERRED_MIGRATION_TAGS = [
|
|
857
|
-
"0031_audit_capture_by_time_index",
|
|
858
|
-
"0032_audit_capture_by_id_index",
|
|
859
|
-
"0033_audit_capture_location_index",
|
|
860
|
-
"0034_findings_read_indexes"
|
|
861
|
-
];
|
|
862
6
|
|
|
863
7
|
// ../../packages/schema/src/exception-scope.ts
|
|
864
8
|
var MINUTE_MS = 6e4;
|
|
@@ -3679,9 +2823,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
|
|
|
3679
2823
|
function stripTabAndNewline(value) {
|
|
3680
2824
|
return value.replace(asciiTabOrNewline, "");
|
|
3681
2825
|
}
|
|
3682
|
-
function urlHostnameOk(url2,
|
|
3683
|
-
|
|
3684
|
-
return
|
|
2826
|
+
function urlHostnameOk(url2, hostname3) {
|
|
2827
|
+
hostname3.lastIndex = 0;
|
|
2828
|
+
return hostname3.test(url2.hostname);
|
|
3685
2829
|
}
|
|
3686
2830
|
function urlProtocolOk(url2, protocol) {
|
|
3687
2831
|
protocol.lastIndex = 0;
|
|
@@ -5892,7 +5036,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
5892
5036
|
var NONE = 0;
|
|
5893
5037
|
var ASSUMED = 1;
|
|
5894
5038
|
var PROVEN = 2;
|
|
5895
|
-
function isRecursive(inst, stack,
|
|
5039
|
+
function isRecursive(inst, stack, resolve) {
|
|
5896
5040
|
const cached2 = recursive.get(inst);
|
|
5897
5041
|
if (cached2 !== void 0)
|
|
5898
5042
|
return cached2 ? PROVEN : NONE;
|
|
@@ -5902,7 +5046,7 @@ function isRecursive(inst, stack, resolve2) {
|
|
|
5902
5046
|
let result = NONE;
|
|
5903
5047
|
const check2 = (child) => {
|
|
5904
5048
|
if (result !== PROVEN && child?._zod) {
|
|
5905
|
-
const answer = isRecursive(child, stack,
|
|
5049
|
+
const answer = isRecursive(child, stack, resolve);
|
|
5906
5050
|
if (answer > result)
|
|
5907
5051
|
result = answer;
|
|
5908
5052
|
}
|
|
@@ -5913,7 +5057,7 @@ function isRecursive(inst, stack, resolve2) {
|
|
|
5913
5057
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
5914
5058
|
if (spread && !desc.enumerable)
|
|
5915
5059
|
continue;
|
|
5916
|
-
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;
|
|
5917
5061
|
if (child > answer)
|
|
5918
5062
|
answer = child;
|
|
5919
5063
|
}
|
|
@@ -5977,7 +5121,7 @@ function isRecursive(inst, stack, resolve2) {
|
|
|
5977
5121
|
break;
|
|
5978
5122
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5979
5123
|
case "lazy": {
|
|
5980
|
-
const inner = def._cachedInner ?? (
|
|
5124
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
5981
5125
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
5982
5126
|
break;
|
|
5983
5127
|
}
|
|
@@ -20650,8 +19794,8 @@ var PLATFORM_HOSTING = /* @__PURE__ */ new Map([
|
|
|
20650
19794
|
["ollama", "local"],
|
|
20651
19795
|
["local", "local"]
|
|
20652
19796
|
]);
|
|
20653
|
-
function hostingFor(
|
|
20654
|
-
return PLATFORM_HOSTING.get(
|
|
19797
|
+
function hostingFor(platform) {
|
|
19798
|
+
return PLATFORM_HOSTING.get(platform) ?? "api";
|
|
20655
19799
|
}
|
|
20656
19800
|
var FIRST_PARTY = /* @__PURE__ */ new Map([
|
|
20657
19801
|
["anthropic", "anthropic"],
|
|
@@ -20665,8 +19809,8 @@ var FIRST_PARTY = /* @__PURE__ */ new Map([
|
|
|
20665
19809
|
function firstPartyPlatformFor(vendor2) {
|
|
20666
19810
|
return FIRST_PARTY.get(vendor2) ?? null;
|
|
20667
19811
|
}
|
|
20668
|
-
function isFirstParty(vendor2,
|
|
20669
|
-
return FIRST_PARTY.get(vendor2) ===
|
|
19812
|
+
function isFirstParty(vendor2, platform) {
|
|
19813
|
+
return FIRST_PARTY.get(vendor2) === platform;
|
|
20670
19814
|
}
|
|
20671
19815
|
var PLATFORM_NAMESPACES = Object.freeze([
|
|
20672
19816
|
"anthropic",
|
|
@@ -20727,14 +19871,14 @@ var ModelVendorBuilder = class {
|
|
|
20727
19871
|
);
|
|
20728
19872
|
}
|
|
20729
19873
|
for (const ref of spec.on ?? []) {
|
|
20730
|
-
const { platform
|
|
20731
|
-
const firstParty = isFirstParty(this.vendor,
|
|
20732
|
-
const hosting = hostingFor(
|
|
19874
|
+
const { platform, price, retention, region } = normalizeRef(ref);
|
|
19875
|
+
const firstParty = isFirstParty(this.vendor, platform);
|
|
19876
|
+
const hosting = hostingFor(platform);
|
|
20733
19877
|
const isSelfHosted = hosting === "local";
|
|
20734
19878
|
platforms.set(
|
|
20735
|
-
|
|
19879
|
+
platform,
|
|
20736
19880
|
Object.freeze({
|
|
20737
|
-
platform
|
|
19881
|
+
platform,
|
|
20738
19882
|
hosting,
|
|
20739
19883
|
firstParty,
|
|
20740
19884
|
price: price ?? (isSelfHosted ? ZERO_PRICE : firstParty ? spec.price ?? null : null),
|
|
@@ -20884,7 +20028,7 @@ anthropic.model("claude-haiku-4-5", {
|
|
|
20884
20028
|
name: "Claude Haiku 4.5",
|
|
20885
20029
|
ctx: 2e5,
|
|
20886
20030
|
maxOut: 64e3,
|
|
20887
|
-
// Reviewed: fast/cheap tier,
|
|
20031
|
+
// Reviewed: fast/cheap general-purpose tier, not a reasoning or code model.
|
|
20888
20032
|
capability: null,
|
|
20889
20033
|
price: anthropicPrice(1, 5, 0.1),
|
|
20890
20034
|
// The vendor documents `claude-haiku-4-5-20251001` as the versioned id and
|
|
@@ -21015,6 +20159,11 @@ openai.model("gpt-4o", {
|
|
|
21015
20159
|
price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
|
|
21016
20160
|
on: [...OPENAI_RESELLERS]
|
|
21017
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
|
+
});
|
|
21018
20167
|
openai.model("gpt-4o-mini", {
|
|
21019
20168
|
name: "GPT-4o mini",
|
|
21020
20169
|
price: tokenPrice(0.15, 0.6, { cacheRead: 0.075 }),
|
|
@@ -21034,6 +20183,24 @@ openai.model("o3", {
|
|
|
21034
20183
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
21035
20184
|
on: [...OPENAI_RESELLERS]
|
|
21036
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
|
+
});
|
|
21037
20204
|
openai.model("gpt-oss-120b", {
|
|
21038
20205
|
name: "GPT-OSS 120B",
|
|
21039
20206
|
openWeights: true,
|
|
@@ -21320,10 +20487,21 @@ var MODEL_ENTRIES = Object.freeze([
|
|
|
21320
20487
|
...alibaba.models(),
|
|
21321
20488
|
...amazon.models()
|
|
21322
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
|
+
);
|
|
21323
20501
|
var MODEL_INDEX = buildModelIndex(MODEL_ENTRIES);
|
|
21324
20502
|
|
|
21325
20503
|
// ../../packages/schema/src/model/governance.ts
|
|
21326
|
-
var ModelCapability = external_exports.enum(["reasoning", "code"]);
|
|
20504
|
+
var ModelCapability = external_exports.enum(["reasoning", "code", "embedding"]);
|
|
21327
20505
|
var DataRetention = external_exports.enum([
|
|
21328
20506
|
"zero_retention",
|
|
21329
20507
|
"no_storage",
|
|
@@ -21515,11 +20693,33 @@ var ResolutionMethod = external_exports.enum([
|
|
|
21515
20693
|
"false-positive",
|
|
21516
20694
|
"redetected"
|
|
21517
20695
|
]).meta({ id: "ResolutionMethod" });
|
|
20696
|
+
var FindingContextBasis = external_exports.enum(["file", "excerpt"]).meta({ id: "FindingContextBasis" });
|
|
20697
|
+
var FindingContext = external_exports.object({
|
|
20698
|
+
basis: FindingContextBasis,
|
|
20699
|
+
// 1-based line number of `lines[0]`.
|
|
20700
|
+
firstLine: external_exports.number().int().positive(),
|
|
20701
|
+
lines: external_exports.array(external_exports.string()).min(1).max(5),
|
|
20702
|
+
match: external_exports.object({
|
|
20703
|
+
// 1-based line number, within [firstLine, firstLine + lines.length).
|
|
20704
|
+
line: external_exports.number().int().positive(),
|
|
20705
|
+
// Offsets into that entry of `lines`, end exclusive.
|
|
20706
|
+
start: external_exports.number().int().nonnegative(),
|
|
20707
|
+
end: external_exports.number().int().nonnegative()
|
|
20708
|
+
}).nullable()
|
|
20709
|
+
}).meta({ id: "FindingContext" });
|
|
20710
|
+
var FindingLocation = external_exports.object({
|
|
20711
|
+
line: external_exports.number().int().positive(),
|
|
20712
|
+
col: external_exports.number().int().positive(),
|
|
20713
|
+
context: FindingContext.nullable()
|
|
20714
|
+
});
|
|
21518
20715
|
var FindingMatch = external_exports.object({
|
|
21519
20716
|
// Masked preview of the matched value. Never raw content.
|
|
21520
20717
|
maskedValue: external_exports.string(),
|
|
21521
|
-
//
|
|
21522
|
-
contextPrefix: external_exports.string()
|
|
20718
|
+
// Deprecated: always empty. Superseded by `context`.
|
|
20719
|
+
contextPrefix: external_exports.string(),
|
|
20720
|
+
// The masked lines around the match. Absent when the finding predates
|
|
20721
|
+
// context capture or none could be built safely.
|
|
20722
|
+
context: FindingContext.optional()
|
|
21523
20723
|
}).meta({ id: "FindingMatch" });
|
|
21524
20724
|
var FindingDetectionRef = external_exports.object({
|
|
21525
20725
|
id: external_exports.string(),
|
|
@@ -21539,6 +20739,11 @@ var FindingInstance = external_exports.object({
|
|
|
21539
20739
|
provider: FindingProvider,
|
|
21540
20740
|
repo: external_exports.string(),
|
|
21541
20741
|
file: external_exports.string(),
|
|
20742
|
+
// 1-based line and column of the match start in the scanned text (the
|
|
20743
|
+
// column in UTF-16 code units). Absent for findings that predate location
|
|
20744
|
+
// capture or have no source text.
|
|
20745
|
+
line: external_exports.number().int().positive().optional(),
|
|
20746
|
+
col: external_exports.number().int().positive().optional(),
|
|
21542
20747
|
// Who the capturing event is attributed to. Optional: a single-user store
|
|
21543
20748
|
// has no one to attribute a finding to and never sets it.
|
|
21544
20749
|
user: FindingUser.optional(),
|
|
@@ -21600,6 +20805,13 @@ var FindingStats = external_exports.object({
|
|
|
21600
20805
|
low: external_exports.number().int().nonnegative()
|
|
21601
20806
|
})
|
|
21602
20807
|
}).meta({ id: "FindingStats" });
|
|
20808
|
+
var FindingsOverview = external_exports.object({
|
|
20809
|
+
findings: external_exports.number().int().nonnegative(),
|
|
20810
|
+
open: external_exports.number().int().nonnegative(),
|
|
20811
|
+
handled: external_exports.number().int().nonnegative(),
|
|
20812
|
+
resolved: external_exports.number().int().nonnegative(),
|
|
20813
|
+
dismissed: external_exports.number().int().nonnegative()
|
|
20814
|
+
}).meta({ id: "FindingsOverview" });
|
|
21603
20815
|
var FindingFacetItem = external_exports.object({
|
|
21604
20816
|
value: external_exports.string(),
|
|
21605
20817
|
count: external_exports.number().int().nonnegative()
|
|
@@ -21717,6 +20929,7 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
21717
20929
|
policy: FindingPolicyRef
|
|
21718
20930
|
}).meta({ id: "FindingInstanceDetail" });
|
|
21719
20931
|
var MAX_FLAT_FINDINGS_LIMIT = 200;
|
|
20932
|
+
var FindingContextQuery = external_exports.object({ id: external_exports.string().min(1).max(256) });
|
|
21720
20933
|
var ListFindingInstancesQuery = external_exports.object({
|
|
21721
20934
|
severity: external_exports.array(Severity).optional(),
|
|
21722
20935
|
// Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
|
|
@@ -22048,7 +21261,23 @@ var CaptureAttributes = external_exports.object({
|
|
|
22048
21261
|
// capture denied by another finding's own Block policy carries `block`
|
|
22049
21262
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
22050
21263
|
// repeated rather than referenced because a store reader opens this file.
|
|
22051
|
-
redact_degraded_to: ActionTaken.optional()
|
|
21264
|
+
redact_degraded_to: ActionTaken.optional(),
|
|
21265
|
+
// The scope key this capture was stamped with: the canonical repository
|
|
21266
|
+
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
21267
|
+
// against its working directory), else of its own working directory, or a
|
|
21268
|
+
// chat account's identity. The store's local `scope_key` column reads it, so
|
|
21269
|
+
// a scoped attachment has a per-row key to work from. Absent when no key
|
|
21270
|
+
// could be derived.
|
|
21271
|
+
//
|
|
21272
|
+
// LOCAL ONLY. That is the contract for every path that sends a row. Producers
|
|
21273
|
+
// stamp it in every attachment mode, and the two structural choke points strip
|
|
21274
|
+
// it: the attached gateway's `reKeyForForward` on the live path, and the
|
|
21275
|
+
// history drain's `rebuildAuditEvent`, which drops it through `withoutScopeKey`.
|
|
21276
|
+
// A capture row's bag reaches the wire through `rebuildCapture`, which builds
|
|
21277
|
+
// the metadata from named keys and never names this one; `toCaptureAttributes`,
|
|
21278
|
+
// which builds the bag from a wire event, never emits it. What a scoped
|
|
21279
|
+
// attachment does with the key is not part of this shape's contract.
|
|
21280
|
+
scope_key: external_exports.string().optional()
|
|
22052
21281
|
}).catchall(external_exports.unknown());
|
|
22053
21282
|
var CaptureStatusAttributes = external_exports.object({
|
|
22054
21283
|
source_tool: external_exports.string().optional(),
|
|
@@ -22078,6 +21307,12 @@ var ToolCallInspection = external_exports.object({
|
|
|
22078
21307
|
actionTaken: ActionTaken,
|
|
22079
21308
|
confidence: external_exports.number().min(0).max(1)
|
|
22080
21309
|
});
|
|
21310
|
+
var findingLocationFields = {
|
|
21311
|
+
line: external_exports.number().int().positive().optional(),
|
|
21312
|
+
col: external_exports.number().int().positive().optional(),
|
|
21313
|
+
context: FindingContext.nullable().optional()
|
|
21314
|
+
};
|
|
21315
|
+
var ToolCallInspectionInput = ToolCallInspection.extend(findingLocationFields);
|
|
22081
21316
|
var ToolCallInput = external_exports.object({
|
|
22082
21317
|
sessionId: external_exports.string().min(1),
|
|
22083
21318
|
toolUseId: external_exports.string().min(1),
|
|
@@ -22087,7 +21322,7 @@ var ToolCallInput = external_exports.object({
|
|
|
22087
21322
|
attributes: ToolCallAttributes,
|
|
22088
21323
|
// Secrets detected in the tool's (masked) target — written as linked
|
|
22089
21324
|
// `inspection_findings`. Empty for a clean tool call.
|
|
22090
|
-
inspections: external_exports.array(
|
|
21325
|
+
inspections: external_exports.array(ToolCallInspectionInput).default([])
|
|
22091
21326
|
});
|
|
22092
21327
|
var InventoryInput = external_exports.object({
|
|
22093
21328
|
objectType: InventoryObjectType,
|
|
@@ -22161,7 +21396,8 @@ var InspectionFindingInput = external_exports.object({
|
|
|
22161
21396
|
// same findingKey — mirrors the legacy `findings.first_detected_at`.
|
|
22162
21397
|
// Optional: when omitted, the writer derives it from the referenced audit
|
|
22163
21398
|
// event's startedAt on first insert (see SqliteInspectionFindingsRepository).
|
|
22164
|
-
firstDetectedAt: external_exports.iso.datetime().optional()
|
|
21399
|
+
firstDetectedAt: external_exports.iso.datetime().optional(),
|
|
21400
|
+
...findingLocationFields
|
|
22165
21401
|
});
|
|
22166
21402
|
var InventoryContext = external_exports.object({
|
|
22167
21403
|
host: InventoryInput.optional(),
|
|
@@ -22203,8 +21439,9 @@ var SessionTokenReport = external_exports.object({
|
|
|
22203
21439
|
totalTokens: external_exports.number().int().nonnegative(),
|
|
22204
21440
|
// Σ of the PRICED rollups only; null when no rollup had a known price.
|
|
22205
21441
|
estimatedCostUsd: external_exports.number().nullable(),
|
|
22206
|
-
// True whenever any
|
|
22207
|
-
//
|
|
21442
|
+
// True whenever any call priced to null (an unknown provider/model, or a call
|
|
21443
|
+
// over a long-context threshold whose rate is unpublished), so the total
|
|
21444
|
+
// understates real spend — the UI renders `≥ $X` instead of a falsely
|
|
22208
21445
|
// precise figure rather than silently dropping the unpriced calls.
|
|
22209
21446
|
costIsPartial: external_exports.boolean()
|
|
22210
21447
|
});
|
|
@@ -22936,6 +22173,17 @@ var AttachedCredential = external_exports.object({
|
|
|
22936
22173
|
keyPrefix: external_exports.string().min(1).max(16).optional(),
|
|
22937
22174
|
mintedAt: external_exports.iso.datetime().optional()
|
|
22938
22175
|
});
|
|
22176
|
+
var AttachmentMode = external_exports.enum(["machine", "scoped"]);
|
|
22177
|
+
var ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION = 2;
|
|
22178
|
+
var AttachedCredentialV1 = AttachedCredential;
|
|
22179
|
+
var AttachedCredentialV2 = AttachedCredential.extend({
|
|
22180
|
+
specVersion: external_exports.literal(ATTACHED_CREDENTIAL_SCOPED_SPEC_VERSION),
|
|
22181
|
+
mode: external_exports.literal("scoped")
|
|
22182
|
+
});
|
|
22183
|
+
var AttachedCredentialAny = external_exports.discriminatedUnion("specVersion", [
|
|
22184
|
+
AttachedCredentialV1,
|
|
22185
|
+
AttachedCredentialV2
|
|
22186
|
+
]);
|
|
22939
22187
|
var MAX_DATE_MS = 253402300799999;
|
|
22940
22188
|
var MAX_INT4 = 2147483647;
|
|
22941
22189
|
var StorePosturePack = external_exports.object({
|
|
@@ -23039,7 +22287,15 @@ var StorePostureSnapshot = external_exports.object({
|
|
|
23039
22287
|
policyCounts: StorePosturePolicyCounts,
|
|
23040
22288
|
// OPTIONAL, not nullable: a reporter that predates this member keeps
|
|
23041
22289
|
// getting its 200 without a payload change.
|
|
23042
|
-
plugin: StorePosturePlugin.optional()
|
|
22290
|
+
plugin: StorePosturePlugin.optional(),
|
|
22291
|
+
// OPTIONAL, and sent only by a scoped attachment, always as `scoped`. A
|
|
22292
|
+
// machine attachment omits it, so its body is byte for byte the one it
|
|
22293
|
+
// sent before this member existed. Absent therefore means machine-wide OR
|
|
22294
|
+
// a reporter older than this member, never "scoped". Both values parse, so
|
|
22295
|
+
// a sender that one day spells `machine` breaks no receiver; any other
|
|
22296
|
+
// value fails the whole snapshot, which is why the reporter sends a
|
|
22297
|
+
// constant and never the raw mode.
|
|
22298
|
+
attachmentMode: AttachmentMode.optional()
|
|
23043
22299
|
}).meta({ id: "StorePostureSnapshot" });
|
|
23044
22300
|
var CAPTURE_VERSION_PREFIX = "capture/";
|
|
23045
22301
|
var RecordAuditEventRequest = AuditEventInput.extend({
|
|
@@ -23217,6 +22473,130 @@ var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
|
23217
22473
|
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
23218
22474
|
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
23219
22475
|
|
|
22476
|
+
// ../../packages/schema/src/zod/builtin-policy-id.ts
|
|
22477
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22478
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22479
|
+
|
|
22480
|
+
// ../../packages/schema/src/zod/event.ts
|
|
22481
|
+
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
22482
|
+
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
22483
|
+
var EventMetadata = external_exports.object({
|
|
22484
|
+
sessionId: external_exports.string().optional(),
|
|
22485
|
+
repo: external_exports.string().optional(),
|
|
22486
|
+
filePath: external_exports.string().optional(),
|
|
22487
|
+
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
22488
|
+
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
22489
|
+
// arguments or output, which can carry the very value a finding masked
|
|
22490
|
+
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
22491
|
+
// display location ("via Bash") when no filePath exists.
|
|
22492
|
+
toolName: external_exports.string().optional(),
|
|
22493
|
+
// Set (true) by the worktree scanner when the file is excluded by the
|
|
22494
|
+
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
22495
|
+
// generated code can leak real secrets — but the provenance is recorded so
|
|
22496
|
+
// policy/dashboards can treat those findings as informational rather than
|
|
22497
|
+
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
22498
|
+
gitignored: external_exports.boolean().optional(),
|
|
22499
|
+
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
22500
|
+
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
22501
|
+
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
22502
|
+
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
22503
|
+
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
22504
|
+
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
22505
|
+
// may live outside the hunk). Omitted (not false) for fragments and
|
|
22506
|
+
// non-scan events, so pre-marker clients safely default to the
|
|
22507
|
+
// non-authoritative path.
|
|
22508
|
+
wholeFile: external_exports.boolean().optional(),
|
|
22509
|
+
model: external_exports.string().optional(),
|
|
22510
|
+
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
22511
|
+
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
22512
|
+
// to the request that captured/ingested it (a UUID, generated independently of
|
|
22513
|
+
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
22514
|
+
// originating span when telemetry is enabled. Both optional + backward
|
|
22515
|
+
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
22516
|
+
correlationId: external_exports.uuid().optional(),
|
|
22517
|
+
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
22518
|
+
// Ids of the detection exceptions that downgraded findings in this capture
|
|
22519
|
+
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
22520
|
+
// authorized the bypass. Absent on captures where no exception applied.
|
|
22521
|
+
exceptionIds: external_exports.array(external_exports.guid()).optional(),
|
|
22522
|
+
// The assistant message this capture belongs to, and the conversation it sits
|
|
22523
|
+
// in — set by the browser extension's network capture so a stored `response`
|
|
22524
|
+
// row can be joined to the `llm_call` leaf describing the same turn. Absent
|
|
22525
|
+
// on every other capture path, which has no such id.
|
|
22526
|
+
//
|
|
22527
|
+
// Non-empty for the reason WebExchange.messageId is: it is the join key, and
|
|
22528
|
+
// a blank one matches no `llm_call` leaf. That refusal reaches only the
|
|
22529
|
+
// places an event is PARSED; the local write path types the event and parses
|
|
22530
|
+
// nothing, which is why `toCaptureAttributes` omits a blank one separately.
|
|
22531
|
+
messageId: external_exports.string().min(1).optional(),
|
|
22532
|
+
conversationId: external_exports.string().optional(),
|
|
22533
|
+
// How long THIS capture's inspection blocked its caller, in whole
|
|
22534
|
+
// milliseconds — the plugin's own added latency, NOT the LLM call it sat in
|
|
22535
|
+
// front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
|
|
22536
|
+
// detection + redaction, the work the host session actually waits on.
|
|
22537
|
+
//
|
|
22538
|
+
// Stamped ONLY on live in-flight captures. A capture that carries its own
|
|
22539
|
+
// `occurredAt` is replaying past work (the transcript backfill, the worktree
|
|
22540
|
+
// scan), and its scan duration is not latency any host session experienced,
|
|
22541
|
+
// so those rows leave this ABSENT rather than reporting a misleading number.
|
|
22542
|
+
// Absent is also what every pre-measurement client writes, and what a
|
|
22543
|
+
// clock failure degrades to — a reader must treat absence as "not measured"
|
|
22544
|
+
// and never as a zero, which would read as "inspection is free".
|
|
22545
|
+
inspectionMs: external_exports.number().int().nonnegative().optional(),
|
|
22546
|
+
// What a `redact` this capture COULD NOT CARRY OUT became instead — the
|
|
22547
|
+
// workspace's `redactFallback`, applied because the field could not be
|
|
22548
|
+
// masked in place (a shell command, a URL, or any argument on a host whose
|
|
22549
|
+
// hook contract offers no rewrite channel).
|
|
22550
|
+
//
|
|
22551
|
+
// It exists because the action alone cannot say why. A finding recorded as
|
|
22552
|
+
// `warn` reads identically whether its detection was ASSIGNED Warn or was
|
|
22553
|
+
// assigned Redact on a field that could not take one — and those are
|
|
22554
|
+
// different facts about the same row: the first is a policy the user chose,
|
|
22555
|
+
// the second is a masking the host could not perform. Absent means no
|
|
22556
|
+
// degrade happened, which is every ordinary capture.
|
|
22557
|
+
//
|
|
22558
|
+
// TWO LIMITS a reader of a stored row has to know, because the grain here
|
|
22559
|
+
// is the CAPTURE while `actionTaken` is per FINDING:
|
|
22560
|
+
//
|
|
22561
|
+
// - It does not say WHICH finding degraded. A capture carrying a degraded
|
|
22562
|
+
// `redact` alongside a finding ASSIGNED the same action stores both
|
|
22563
|
+
// identically and one reason for the pair; attributing it to both
|
|
22564
|
+
// describes the assigned one wrongly, and to neither loses the degrade.
|
|
22565
|
+
// - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
|
|
22566
|
+
// became, not the reason the capture ended as it did — a capture denied
|
|
22567
|
+
// by some other finding's own Block policy still carries `block` here,
|
|
22568
|
+
// and clearing the workspace's fallback would not have let it through.
|
|
22569
|
+
// Gate on the value against what a fallback can produce; never read the
|
|
22570
|
+
// field's presence as "this was the fallback's doing".
|
|
22571
|
+
//
|
|
22572
|
+
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
22573
|
+
// Closing either means moving the reason onto the finding row, which
|
|
22574
|
+
// already carries its own action.
|
|
22575
|
+
redactDegradedTo: ActionTaken.optional()
|
|
22576
|
+
}).meta({ id: "EventMetadata" });
|
|
22577
|
+
var Event = external_exports.object({
|
|
22578
|
+
id: external_exports.guid(),
|
|
22579
|
+
sourceTool: SourceTool,
|
|
22580
|
+
kind: EventKind,
|
|
22581
|
+
occurredAt: external_exports.iso.datetime(),
|
|
22582
|
+
contentHash: external_exports.string(),
|
|
22583
|
+
content: external_exports.string(),
|
|
22584
|
+
metadata: EventMetadata.optional()
|
|
22585
|
+
}).meta({ id: "Event" });
|
|
22586
|
+
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
22587
|
+
var INGEST_BATCH_MAX = 100;
|
|
22588
|
+
var IngestBatch = external_exports.object({
|
|
22589
|
+
events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
|
|
22590
|
+
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
22591
|
+
// additionally rejects any event whose contentHash the store has already
|
|
22592
|
+
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
22593
|
+
// backfill), where a re-run mints fresh event ids for identical content and
|
|
22594
|
+
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
22595
|
+
// two genuinely separate prompts can be byte-identical and both belong on
|
|
22596
|
+
// the timeline.
|
|
22597
|
+
dedupe: external_exports.literal("content-hash").optional()
|
|
22598
|
+
}).meta({ id: "IngestBatch" });
|
|
22599
|
+
|
|
23220
22600
|
// ../../packages/schema/src/zod/rule.ts
|
|
23221
22601
|
var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
|
|
23222
22602
|
var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
|
|
@@ -23285,7 +22665,10 @@ var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, Regex
|
|
|
23285
22665
|
var MATCHER_TYPES = MatcherType.options;
|
|
23286
22666
|
var AppliesTo = external_exports.strictObject({
|
|
23287
22667
|
// Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
|
|
23288
|
-
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
|
|
22668
|
+
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1).optional(),
|
|
22669
|
+
eventKinds: external_exports.array(EventKind).min(1).optional()
|
|
22670
|
+
}).refine((v) => v.extensions !== void 0 || v.eventKinds !== void 0, {
|
|
22671
|
+
message: "appliesTo needs extensions, eventKinds, or both"
|
|
23289
22672
|
}).meta({ id: "AppliesTo" });
|
|
23290
22673
|
var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
|
|
23291
22674
|
var PostValidatorRef = external_exports.union(
|
|
@@ -23308,6 +22691,7 @@ var PostValidatorRef = external_exports.union(
|
|
|
23308
22691
|
)}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
|
|
23309
22692
|
}
|
|
23310
22693
|
).meta({ id: "PostValidatorRef" });
|
|
22694
|
+
var RuleEvidence = external_exports.enum(["code", "value"]).meta({ id: "RuleEvidence" });
|
|
23311
22695
|
var RequiresNearby = external_exports.strictObject({
|
|
23312
22696
|
// Each array, when present, must be non-empty and contain non-empty strings —
|
|
23313
22697
|
// an empty/blank criterion would either never fire or (for labels) match
|
|
@@ -23330,6 +22714,8 @@ var RuleFixture = external_exports.strictObject({
|
|
|
23330
22714
|
// Simulated file context for the scan, so fixtures can assert `appliesTo`
|
|
23331
22715
|
// gating (e.g. a Python-only pattern must NOT fire in a .ts file).
|
|
23332
22716
|
filePath: external_exports.string().optional(),
|
|
22717
|
+
// Simulated capture kind, so fixtures can assert `appliesTo.eventKinds`.
|
|
22718
|
+
eventKind: EventKind.optional(),
|
|
23333
22719
|
expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
|
|
23334
22720
|
}).meta({ id: "RuleFixture" });
|
|
23335
22721
|
var Rule = external_exports.strictObject({
|
|
@@ -23355,7 +22741,9 @@ var Rule = external_exports.strictObject({
|
|
|
23355
22741
|
appliesTo: AppliesTo.optional(),
|
|
23356
22742
|
postValidators: external_exports.array(PostValidatorRef).optional(),
|
|
23357
22743
|
requiresNearby: RequiresNearby.optional(),
|
|
23358
|
-
examples: external_exports.array(external_exports.string()).optional()
|
|
22744
|
+
examples: external_exports.array(external_exports.string()).optional(),
|
|
22745
|
+
// Whether the matched text is itself sensitive (see RuleEvidence).
|
|
22746
|
+
evidence: RuleEvidence.optional()
|
|
23359
22747
|
}).meta({ id: "Rule" });
|
|
23360
22748
|
var Author = external_exports.object({
|
|
23361
22749
|
name: external_exports.string(),
|
|
@@ -23372,7 +22760,11 @@ var PackManifest = external_exports.object({
|
|
|
23372
22760
|
description: external_exports.string().optional(),
|
|
23373
22761
|
author: Author.optional(),
|
|
23374
22762
|
license: external_exports.string().optional(),
|
|
23375
|
-
sourceUrl: external_exports.url().optional()
|
|
22763
|
+
sourceUrl: external_exports.url().optional(),
|
|
22764
|
+
// The built-in policy a FIRST install of this pack assigns
|
|
22765
|
+
// (installed_packs.policy_id). Absent leaves the pack unassigned, so its
|
|
22766
|
+
// rules follow the category policies. An existing install never takes it.
|
|
22767
|
+
defaultPolicy: BuiltinPolicyId.optional()
|
|
23376
22768
|
}).meta({ id: "PackManifest" });
|
|
23377
22769
|
|
|
23378
22770
|
// ../../packages/schema/src/zod/detection.ts
|
|
@@ -23400,10 +22792,12 @@ var DetectionListItem = external_exports.object({
|
|
|
23400
22792
|
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
23401
22793
|
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
23402
22794
|
// detection is a PACK, and its policy is the archetype applied to all its
|
|
23403
|
-
// rules. Absent == unassigned, which resolves to Monitor
|
|
23404
|
-
// (DEFAULT_PACK_POLICY_ID)
|
|
23405
|
-
//
|
|
23406
|
-
//
|
|
22795
|
+
// rules. Absent == unassigned, which resolves to Monitor by default
|
|
22796
|
+
// (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
|
|
22797
|
+
// (see the dashboard's `unassignedPolicy`). Every enforcement surface
|
|
22798
|
+
// expands it into per-rule policies (see policyIdToAction). Typed
|
|
22799
|
+
// z.string() (not the enum) to keep the OpenAPI response tolerant of a
|
|
22800
|
+
// future custom id.
|
|
23407
22801
|
policyId: external_exports.string().optional(),
|
|
23408
22802
|
// Set ONLY when a newer snapshot is available for this pack (OSS: the
|
|
23409
22803
|
// bundled inventory recorded in available_packs differs from the installed
|
|
@@ -23440,7 +22834,13 @@ var DetectionRule = external_exports.object({
|
|
|
23440
22834
|
// Representative matching strings the rule author shipped with the rule. The
|
|
23441
22835
|
// cheapest honest answer to "show me what this rule catches" — every bundled
|
|
23442
22836
|
// rule has them, and they are already in the stored snapshot.
|
|
23443
|
-
examples: external_exports.array(external_exports.string()).optional()
|
|
22837
|
+
examples: external_exports.array(external_exports.string()).optional(),
|
|
22838
|
+
// The rule's DECLARED evidence, as stored. Absent defers to the engine's
|
|
22839
|
+
// classification (ruleEvidence in @akasecurity/detections): a bundled
|
|
22840
|
+
// code-flaw rule reads as 'code' and anything else as 'value', and a rule
|
|
22841
|
+
// in a value category (secret/pii/financial/phi) is always 'value',
|
|
22842
|
+
// whatever it declares.
|
|
22843
|
+
evidence: RuleEvidence.optional()
|
|
23444
22844
|
}).meta({ id: "DetectionRule" });
|
|
23445
22845
|
var DetectionUpdate = external_exports.object({
|
|
23446
22846
|
available: external_exports.boolean(),
|
|
@@ -23472,10 +22872,12 @@ var DetectionDetail = external_exports.object({
|
|
|
23472
22872
|
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
23473
22873
|
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
23474
22874
|
// detection is a PACK, and its policy is the archetype applied to all its
|
|
23475
|
-
// rules. Absent == unassigned, which resolves to Monitor
|
|
23476
|
-
// (DEFAULT_PACK_POLICY_ID)
|
|
23477
|
-
//
|
|
23478
|
-
//
|
|
22875
|
+
// rules. Absent == unassigned, which resolves to Monitor by default
|
|
22876
|
+
// (DEFAULT_PACK_POLICY_ID); a host may resolve it to a policy of its own
|
|
22877
|
+
// (see the dashboard's `unassignedPolicy`). Every enforcement surface
|
|
22878
|
+
// expands it into per-rule policies (see policyIdToAction). Typed
|
|
22879
|
+
// z.string() (not the enum) to keep the OpenAPI response tolerant of a
|
|
22880
|
+
// future custom id.
|
|
23479
22881
|
policyId: external_exports.string().optional()
|
|
23480
22882
|
}).meta({ id: "DetectionDetail" });
|
|
23481
22883
|
var LibraryItem = external_exports.object({
|
|
@@ -23505,126 +22907,6 @@ var ImportDetectionRequest = external_exports.object({
|
|
|
23505
22907
|
})
|
|
23506
22908
|
}).meta({ id: "ImportDetectionRequest" });
|
|
23507
22909
|
|
|
23508
|
-
// ../../packages/schema/src/zod/event.ts
|
|
23509
|
-
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
23510
|
-
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
23511
|
-
var EventMetadata = external_exports.object({
|
|
23512
|
-
sessionId: external_exports.string().optional(),
|
|
23513
|
-
repo: external_exports.string().optional(),
|
|
23514
|
-
filePath: external_exports.string().optional(),
|
|
23515
|
-
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
23516
|
-
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
23517
|
-
// arguments or output, which can carry the very value a finding masked
|
|
23518
|
-
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
23519
|
-
// display location ("via Bash") when no filePath exists.
|
|
23520
|
-
toolName: external_exports.string().optional(),
|
|
23521
|
-
// Set (true) by the worktree scanner when the file is excluded by the
|
|
23522
|
-
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
23523
|
-
// generated code can leak real secrets — but the provenance is recorded so
|
|
23524
|
-
// policy/dashboards can treat those findings as informational rather than
|
|
23525
|
-
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
23526
|
-
gitignored: external_exports.boolean().optional(),
|
|
23527
|
-
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
23528
|
-
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
23529
|
-
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
23530
|
-
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
23531
|
-
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
23532
|
-
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
23533
|
-
// may live outside the hunk). Omitted (not false) for fragments and
|
|
23534
|
-
// non-scan events, so pre-marker clients safely default to the
|
|
23535
|
-
// non-authoritative path.
|
|
23536
|
-
wholeFile: external_exports.boolean().optional(),
|
|
23537
|
-
model: external_exports.string().optional(),
|
|
23538
|
-
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
23539
|
-
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
23540
|
-
// to the request that captured/ingested it (a UUID, generated independently of
|
|
23541
|
-
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
23542
|
-
// originating span when telemetry is enabled. Both optional + backward
|
|
23543
|
-
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
23544
|
-
correlationId: external_exports.uuid().optional(),
|
|
23545
|
-
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
23546
|
-
// Ids of the detection exceptions that downgraded findings in this capture
|
|
23547
|
-
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
23548
|
-
// authorized the bypass. Absent on captures where no exception applied.
|
|
23549
|
-
exceptionIds: external_exports.array(external_exports.guid()).optional(),
|
|
23550
|
-
// The assistant message this capture belongs to, and the conversation it sits
|
|
23551
|
-
// in — set by the browser extension's network capture so a stored `response`
|
|
23552
|
-
// row can be joined to the `llm_call` leaf describing the same turn. Absent
|
|
23553
|
-
// on every other capture path, which has no such id.
|
|
23554
|
-
//
|
|
23555
|
-
// Non-empty for the reason WebExchange.messageId is: it is the join key, and
|
|
23556
|
-
// a blank one matches no `llm_call` leaf. That refusal reaches only the
|
|
23557
|
-
// places an event is PARSED; the local write path types the event and parses
|
|
23558
|
-
// nothing, which is why `toCaptureAttributes` omits a blank one separately.
|
|
23559
|
-
messageId: external_exports.string().min(1).optional(),
|
|
23560
|
-
conversationId: external_exports.string().optional(),
|
|
23561
|
-
// How long THIS capture's inspection blocked its caller, in whole
|
|
23562
|
-
// milliseconds — the plugin's own added latency, NOT the LLM call it sat in
|
|
23563
|
-
// front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
|
|
23564
|
-
// detection + redaction, the work the host session actually waits on.
|
|
23565
|
-
//
|
|
23566
|
-
// Stamped ONLY on live in-flight captures. A capture that carries its own
|
|
23567
|
-
// `occurredAt` is replaying past work (the transcript backfill, the worktree
|
|
23568
|
-
// scan), and its scan duration is not latency any host session experienced,
|
|
23569
|
-
// so those rows leave this ABSENT rather than reporting a misleading number.
|
|
23570
|
-
// Absent is also what every pre-measurement client writes, and what a
|
|
23571
|
-
// clock failure degrades to — a reader must treat absence as "not measured"
|
|
23572
|
-
// and never as a zero, which would read as "inspection is free".
|
|
23573
|
-
inspectionMs: external_exports.number().int().nonnegative().optional(),
|
|
23574
|
-
// What a `redact` this capture COULD NOT CARRY OUT became instead — the
|
|
23575
|
-
// workspace's `redactFallback`, applied because the field could not be
|
|
23576
|
-
// masked in place (a shell command, a URL, or any argument on a host whose
|
|
23577
|
-
// hook contract offers no rewrite channel).
|
|
23578
|
-
//
|
|
23579
|
-
// It exists because the action alone cannot say why. A finding recorded as
|
|
23580
|
-
// `warn` reads identically whether its detection was ASSIGNED Warn or was
|
|
23581
|
-
// assigned Redact on a field that could not take one — and those are
|
|
23582
|
-
// different facts about the same row: the first is a policy the user chose,
|
|
23583
|
-
// the second is a masking the host could not perform. Absent means no
|
|
23584
|
-
// degrade happened, which is every ordinary capture.
|
|
23585
|
-
//
|
|
23586
|
-
// TWO LIMITS a reader of a stored row has to know, because the grain here
|
|
23587
|
-
// is the CAPTURE while `actionTaken` is per FINDING:
|
|
23588
|
-
//
|
|
23589
|
-
// - It does not say WHICH finding degraded. A capture carrying a degraded
|
|
23590
|
-
// `redact` alongside a finding ASSIGNED the same action stores both
|
|
23591
|
-
// identically and one reason for the pair; attributing it to both
|
|
23592
|
-
// describes the assigned one wrongly, and to neither loses the degrade.
|
|
23593
|
-
// - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
|
|
23594
|
-
// became, not the reason the capture ended as it did — a capture denied
|
|
23595
|
-
// by some other finding's own Block policy still carries `block` here,
|
|
23596
|
-
// and clearing the workspace's fallback would not have let it through.
|
|
23597
|
-
// Gate on the value against what a fallback can produce; never read the
|
|
23598
|
-
// field's presence as "this was the fallback's doing".
|
|
23599
|
-
//
|
|
23600
|
-
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
23601
|
-
// Closing either means moving the reason onto the finding row, which
|
|
23602
|
-
// already carries its own action.
|
|
23603
|
-
redactDegradedTo: ActionTaken.optional()
|
|
23604
|
-
}).meta({ id: "EventMetadata" });
|
|
23605
|
-
var Event = external_exports.object({
|
|
23606
|
-
id: external_exports.guid(),
|
|
23607
|
-
sourceTool: SourceTool,
|
|
23608
|
-
kind: EventKind,
|
|
23609
|
-
occurredAt: external_exports.iso.datetime(),
|
|
23610
|
-
contentHash: external_exports.string(),
|
|
23611
|
-
content: external_exports.string(),
|
|
23612
|
-
metadata: EventMetadata.optional()
|
|
23613
|
-
}).meta({ id: "Event" });
|
|
23614
|
-
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
23615
|
-
var INGEST_BATCH_MAX = 100;
|
|
23616
|
-
var IngestBatch = external_exports.object({
|
|
23617
|
-
events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
|
|
23618
|
-
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
23619
|
-
// additionally rejects any event whose contentHash the store has already
|
|
23620
|
-
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
23621
|
-
// backfill), where a re-run mints fresh event ids for identical content and
|
|
23622
|
-
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
23623
|
-
// two genuinely separate prompts can be byte-identical and both belong on
|
|
23624
|
-
// the timeline.
|
|
23625
|
-
dedupe: external_exports.literal("content-hash").optional()
|
|
23626
|
-
}).meta({ id: "IngestBatch" });
|
|
23627
|
-
|
|
23628
22910
|
// ../../packages/schema/src/zod/exception.ts
|
|
23629
22911
|
var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
|
|
23630
22912
|
var ExceptionConditions = external_exports.object({
|
|
@@ -23785,8 +23067,6 @@ var Policy = external_exports.object({
|
|
|
23785
23067
|
// test `prohibitedModels` passes and `reversibleRuleIds` fails.
|
|
23786
23068
|
provenance: PolicyProvenance.optional()
|
|
23787
23069
|
}).meta({ id: "Policy" });
|
|
23788
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
23789
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
23790
23070
|
var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
|
|
23791
23071
|
id: "RedactFallback"
|
|
23792
23072
|
});
|
|
@@ -23826,11 +23106,14 @@ var PolicyBundle = external_exports.object({
|
|
|
23826
23106
|
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
23827
23107
|
// Model ids (the raw `model` string a harness reports, e.g.
|
|
23828
23108
|
// `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
|
|
23829
|
-
// a session onto one (PreModelSwitch)
|
|
23830
|
-
//
|
|
23831
|
-
//
|
|
23832
|
-
//
|
|
23833
|
-
//
|
|
23109
|
+
// a session onto one (PreModelSwitch), refuses a turn that would run on one
|
|
23110
|
+
// (UserPromptSubmit) and refuses a subagent spawn onto one (PreToolUse),
|
|
23111
|
+
// wherever the organization governs the event: everywhere on a
|
|
23112
|
+
// machine-wide attachment, and only in enrolled repositories on a scoped
|
|
23113
|
+
// one (the plugin runtime's `governanceApplies`).
|
|
23114
|
+
// Optional so an older backend — and an older on-disk cache — still
|
|
23115
|
+
// parses; consumers read `?? []`, which is the unenforced behaviour that
|
|
23116
|
+
// predates this field and the safe direction to default.
|
|
23834
23117
|
//
|
|
23835
23118
|
// Ids, not display names: the governance decision is keyed on the exact
|
|
23836
23119
|
// string the harness reports (`model_status_override.versionId` in the
|
|
@@ -24147,7 +23430,7 @@ var VaultConsent = external_exports.object({
|
|
|
24147
23430
|
});
|
|
24148
23431
|
|
|
24149
23432
|
// ../../packages/schema/src/zod/local.ts
|
|
24150
|
-
var WORKSPACE_SETTINGS_SPEC_VERSION =
|
|
23433
|
+
var WORKSPACE_SETTINGS_SPEC_VERSION = 9;
|
|
24151
23434
|
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
24152
23435
|
var ControlPlaneConnection = external_exports.object({
|
|
24153
23436
|
endpoint: external_exports.string().min(1),
|
|
@@ -24166,6 +23449,20 @@ var HistorySyncConsent = external_exports.object({
|
|
|
24166
23449
|
payloadVersion: external_exports.number().int().positive(),
|
|
24167
23450
|
endpoint: external_exports.string()
|
|
24168
23451
|
});
|
|
23452
|
+
var ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH = 512;
|
|
23453
|
+
var AttachmentScopeEntry = external_exports.object({
|
|
23454
|
+
kind: external_exports.enum(["repo", "account"]),
|
|
23455
|
+
identity: printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH).min(1),
|
|
23456
|
+
label: printable(80).optional(),
|
|
23457
|
+
enrolledAt: external_exports.iso.datetime()
|
|
23458
|
+
});
|
|
23459
|
+
var AttachmentScope = external_exports.object({
|
|
23460
|
+
endpoint: external_exports.string().min(1),
|
|
23461
|
+
tenantName: PluginWhoami.shape.tenantName.optional(),
|
|
23462
|
+
userEmail: PluginWhoami.shape.userEmail.optional(),
|
|
23463
|
+
entries: external_exports.array(AttachmentScopeEntry)
|
|
23464
|
+
});
|
|
23465
|
+
var AttachmentScopeEnvelope = AttachmentScope.extend({ entries: external_exports.array(external_exports.unknown()) });
|
|
24169
23466
|
var WebChatCaptureConsent = external_exports.object({
|
|
24170
23467
|
acknowledgedAt: external_exports.iso.datetime(),
|
|
24171
23468
|
version: external_exports.number().int().positive()
|
|
@@ -24236,6 +23533,23 @@ var WorkspaceSettings = external_exports.object({
|
|
|
24236
23533
|
// both widenings. Absent until granted, and a grant for a different endpoint
|
|
24237
23534
|
// or an older payload no longer counts.
|
|
24238
23535
|
historySyncConsent: HistorySyncConsent.optional(),
|
|
23536
|
+
// The identities a SCOPED attachment forwards and the deployment they were
|
|
23537
|
+
// enrolled for (see AttachmentScope). Absent until something is enrolled.
|
|
23538
|
+
//
|
|
23539
|
+
// `z.unknown()`, NOT `AttachmentScope`, and the difference is this field's
|
|
23540
|
+
// whole failure mode. A settings.json that fails this schema reads as the
|
|
23541
|
+
// unonboarded defaults (readUserSettings in @akasecurity/persistence), and the
|
|
23542
|
+
// next save writes those defaults back over it. Typed, one entry with an
|
|
23543
|
+
// unknown `kind`, a control character or a bad timestamp would cost the
|
|
23544
|
+
// attachment, every consent and onboardedAt, permanently. Untyped, the value
|
|
23545
|
+
// is kept exactly as found and validated where it is used: parseAttachmentScope
|
|
23546
|
+
// drops a bad entry by itself, and on a scoped attachment resolveScope reads a
|
|
23547
|
+
// bad envelope as no entries, which keeps every event local.
|
|
23548
|
+
//
|
|
23549
|
+
// No default: absent must stay absent, so defaultWorkspaceSettings() and a
|
|
23550
|
+
// fresh settings.json do not change. No `.meta({ id })`, like every field
|
|
23551
|
+
// here. Not a ManagedSettingKey.
|
|
23552
|
+
attachmentScope: external_exports.unknown().optional(),
|
|
24239
23553
|
// What the browser extension may record from a web chat, and the grant that
|
|
24240
23554
|
// authorizes it. Absent until the user answers: recording something that was
|
|
24241
23555
|
// never recorded before is never an assumed grant on upgrade, so the whole
|
|
@@ -24354,6 +23668,27 @@ var ManagedSettings = external_exports.object({
|
|
|
24354
23668
|
};
|
|
24355
23669
|
}).meta({ id: "ManagedSettings" });
|
|
24356
23670
|
|
|
23671
|
+
// ../../packages/schema/src/zod/mod-policy-snapshot.ts
|
|
23672
|
+
var MOD_POLICY_SNAPSHOT_VERSION = 1;
|
|
23673
|
+
var MOD_POLICY_SNAPSHOT_MAX_BYTES = 4 * 1024 * 1024;
|
|
23674
|
+
var ModPolicySnapshot = external_exports.object({
|
|
23675
|
+
version: external_exports.literal(MOD_POLICY_SNAPSHOT_VERSION),
|
|
23676
|
+
generatedAt: external_exports.iso.datetime(),
|
|
23677
|
+
// The complete effective ruleset, as the hook's runtime scans with it: the
|
|
23678
|
+
// user's enabled installed packs (user-modified and custom packs included).
|
|
23679
|
+
// Absent means the store holds no authoritative snapshot, and the reader
|
|
23680
|
+
// scans with the packs it ships — the hook's own fallback.
|
|
23681
|
+
rules: external_exports.array(Rule).optional(),
|
|
23682
|
+
// Rule-targeted actions (first enabled policy per rule wins).
|
|
23683
|
+
ruleActions: external_exports.record(external_exports.string(), ActionTaken),
|
|
23684
|
+
// The resolved action per detection category.
|
|
23685
|
+
categoryActions: external_exports.record(external_exports.string(), ActionTaken),
|
|
23686
|
+
// Rules with an active exception grant. Honouring a grant means matching a
|
|
23687
|
+
// keyed fingerprint of the value and consuming a use, which only the hook can
|
|
23688
|
+
// do, so the mod leaves a finding of one of these rules for the hook to decide.
|
|
23689
|
+
exceptionRuleIds: external_exports.array(external_exports.string())
|
|
23690
|
+
}).meta({ id: "ModPolicySnapshot" });
|
|
23691
|
+
|
|
24357
23692
|
// ../../packages/schema/src/zod/project-files.ts
|
|
24358
23693
|
var ProjectFileInput = external_exports.object({
|
|
24359
23694
|
path: external_exports.string().min(1),
|
|
@@ -24668,7 +24003,16 @@ var AttachInput = external_exports.object({
|
|
|
24668
24003
|
// 200 matches the tenantName bound beside it in control-plane.ts; nothing
|
|
24669
24004
|
// renders a longer one usefully.
|
|
24670
24005
|
label: printable(200).optional(),
|
|
24671
|
-
accessKey: external_exports.string()
|
|
24006
|
+
accessKey: external_exports.string(),
|
|
24007
|
+
// How much of this machine the attachment is for: everything, or only the
|
|
24008
|
+
// repositories its user enrolls. Optional, so an input without it still
|
|
24009
|
+
// parses; what an absent mode means is for whatever reads it to decide, not
|
|
24010
|
+
// this shape. This member validates the VALUE rather than leaving that to the
|
|
24011
|
+
// call site, a deliberate exception to this module's shape-only rule: a shape
|
|
24012
|
+
// rejection names the field, so a value that is not a mode is refused as a bad
|
|
24013
|
+
// `mode` rather than stripped or passed on. The dashboard's attach action reads
|
|
24014
|
+
// it as the mode to attach in.
|
|
24015
|
+
mode: AttachmentMode.optional()
|
|
24672
24016
|
});
|
|
24673
24017
|
|
|
24674
24018
|
// ../../packages/schema/src/zod/triage.ts
|
|
@@ -24881,308 +24225,6 @@ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
|
24881
24225
|
var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
|
|
24882
24226
|
var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
|
|
24883
24227
|
|
|
24884
|
-
// ../../packages/persistence/src/paths.ts
|
|
24885
|
-
import {
|
|
24886
|
-
chmodSync,
|
|
24887
|
-
linkSync,
|
|
24888
|
-
lstatSync,
|
|
24889
|
-
mkdirSync,
|
|
24890
|
-
renameSync,
|
|
24891
|
-
rmSync as rmSync2,
|
|
24892
|
-
writeFileSync
|
|
24893
|
-
} from "fs";
|
|
24894
|
-
import { threadId } from "worker_threads";
|
|
24895
|
-
|
|
24896
|
-
// ../../packages/persistence/src/database.ts
|
|
24897
|
-
import { randomUUID as randomUUID11 } from "crypto";
|
|
24898
|
-
import { dirname as dirname2, join as join7, sep } from "path";
|
|
24899
|
-
import { DatabaseSync } from "node:sqlite";
|
|
24900
|
-
|
|
24901
|
-
// ../../packages/persistence/src/ids.ts
|
|
24902
|
-
import { createHash } from "crypto";
|
|
24903
|
-
|
|
24904
|
-
// ../../packages/persistence/src/internal/snapshot.ts
|
|
24905
|
-
import { randomUUID } from "crypto";
|
|
24906
|
-
import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync4, statSync as statSync2 } from "fs";
|
|
24907
|
-
import { basename, dirname, join as join3 } from "path";
|
|
24908
|
-
var STALE_PARTIAL_MS = 5 * 6e4;
|
|
24909
|
-
var SNAPSHOT_STAGING_SUFFIX = ".partial";
|
|
24910
|
-
var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
|
|
24911
|
-
|
|
24912
|
-
// ../../packages/persistence/src/internal/sql-functions.ts
|
|
24913
|
-
var utf8 = new TextDecoder();
|
|
24914
|
-
|
|
24915
|
-
// ../../packages/persistence/src/internal/outbox-lane.ts
|
|
24916
|
-
var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
|
|
24917
|
-
var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
24918
|
-
|
|
24919
|
-
// ../../packages/persistence/src/sync-failure.ts
|
|
24920
|
-
var SYNC_FAILURE_REASONS = SyncFailureReason.options;
|
|
24921
|
-
|
|
24922
|
-
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
24923
|
-
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
24924
|
-
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
24925
|
-
var COUNTED_EVENT_TYPES = [
|
|
24926
|
-
...STRUCTURAL_EVENT_TYPES,
|
|
24927
|
-
...OUTBOX_CAPTURE_EVENT_TYPES
|
|
24928
|
-
];
|
|
24929
|
-
var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
24930
|
-
var COUNTED_SCOPE = `
|
|
24931
|
-
WHERE event_type IN (${COUNTED_TYPE_LIST})
|
|
24932
|
-
AND (
|
|
24933
|
-
event_type IN (${TYPE_LIST})
|
|
24934
|
-
OR synced_at IS NOT NULL
|
|
24935
|
-
OR outbox_owed = 1
|
|
24936
|
-
)`;
|
|
24937
|
-
|
|
24938
|
-
// ../../packages/persistence/src/repositories/activity.ts
|
|
24939
|
-
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
24940
|
-
var DB_EVENT_TYPE_TO_KIND = {
|
|
24941
|
-
session: "session",
|
|
24942
|
-
prompt: "prompt",
|
|
24943
|
-
response: "response",
|
|
24944
|
-
tool_call: "tool",
|
|
24945
|
-
hook: "hook",
|
|
24946
|
-
detection: "detection",
|
|
24947
|
-
share: "share",
|
|
24948
|
-
permission: "permission",
|
|
24949
|
-
commit: "commit",
|
|
24950
|
-
error: "error",
|
|
24951
|
-
active: "active"
|
|
24952
|
-
};
|
|
24953
|
-
var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
|
|
24954
|
-
var DEFAULT_HARNESS = HARNESS.ClaudeCode;
|
|
24955
|
-
|
|
24956
|
-
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
24957
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
24958
|
-
var BLOCKED_DETECTIONS_TTL_MS = 30 * 60 * 1e3;
|
|
24959
|
-
var BLOCKED_DETECTIONS_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
24960
|
-
var ACTIVE_PREDICATE = `revoked_at IS NULL
|
|
24961
|
-
AND (expires_at IS NULL OR expires_at > :now)
|
|
24962
|
-
AND (max_uses IS NULL OR use_count < max_uses)`;
|
|
24963
|
-
var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
|
|
24964
|
-
AND conditions IS NULL
|
|
24965
|
-
AND ${ACTIVE_PREDICATE}`;
|
|
24966
|
-
|
|
24967
|
-
// ../../packages/persistence/src/repositories/resolution-sql.ts
|
|
24968
|
-
function latestResolutionColumnSql(column, findingsAlias) {
|
|
24969
|
-
return `(
|
|
24970
|
-
SELECT fr.${column} FROM finding_resolution fr
|
|
24971
|
-
WHERE fr.finding_key = ${findingsAlias}.finding_key
|
|
24972
|
-
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
24973
|
-
LIMIT 1
|
|
24974
|
-
)`;
|
|
24975
|
-
}
|
|
24976
|
-
function latestResolutionStatusSql(findingsAlias) {
|
|
24977
|
-
return latestResolutionColumnSql("status", findingsAlias);
|
|
24978
|
-
}
|
|
24979
|
-
var LATEST_RESOLUTION_BY_KEY_SQL = `(
|
|
24980
|
-
SELECT finding_key, status, method, resolved_at FROM (
|
|
24981
|
-
SELECT fr.finding_key, fr.status, fr.method, fr.resolved_at,
|
|
24982
|
-
ROW_NUMBER() OVER (
|
|
24983
|
-
PARTITION BY fr.finding_key
|
|
24984
|
-
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
24985
|
-
) AS rn
|
|
24986
|
-
FROM finding_resolution fr
|
|
24987
|
-
) WHERE rn = 1
|
|
24988
|
-
)`;
|
|
24989
|
-
|
|
24990
|
-
// ../../packages/persistence/src/repositories/findings.ts
|
|
24991
|
-
var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
|
|
24992
|
-
d.severity AS severity, f.masked_match AS masked_match,
|
|
24993
|
-
f.action_taken AS action_taken, f.confidence AS confidence,
|
|
24994
|
-
e.started_at AS occurred_at,
|
|
24995
|
-
e.source_tool AS source_tool,
|
|
24996
|
-
e.repo AS repo,
|
|
24997
|
-
e.file_path AS file,
|
|
24998
|
-
e.tool_name AS tool_name,
|
|
24999
|
-
f.audit_event_id AS event_id, e.root_session_id AS session_id,
|
|
25000
|
-
e.event_type AS kind, f.finding_key AS finding_key,
|
|
25001
|
-
${latestResolutionStatusSql("f")} AS latest_status,
|
|
25002
|
-
e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
|
|
25003
|
-
e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
|
|
25004
|
-
e.outbox_owed AS outbox_owed`;
|
|
25005
|
-
|
|
25006
|
-
// ../../packages/persistence/src/repositories/installed-packs.ts
|
|
25007
|
-
import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
|
|
25008
|
-
|
|
25009
|
-
// ../../packages/persistence/src/policy-floor.ts
|
|
25010
|
-
import { readFileSync as readFileSync5 } from "fs";
|
|
25011
|
-
import { join as join6 } from "path";
|
|
25012
|
-
|
|
25013
|
-
// ../../packages/persistence/src/local-layout.ts
|
|
25014
|
-
import { renameSync as renameSync3 } from "fs";
|
|
25015
|
-
import { mkdir } from "fs/promises";
|
|
25016
|
-
import { homedir } from "os";
|
|
25017
|
-
import { join as join4 } from "path";
|
|
25018
|
-
|
|
25019
|
-
// ../../packages/persistence/src/settings.ts
|
|
25020
|
-
import { readFileSync as readFileSync4 } from "fs";
|
|
25021
|
-
import { join as join5 } from "path";
|
|
25022
|
-
|
|
25023
|
-
// ../../packages/persistence/src/file-lock.ts
|
|
25024
|
-
import { randomUUID as randomUUID3 } from "crypto";
|
|
25025
|
-
import {
|
|
25026
|
-
closeSync,
|
|
25027
|
-
existsSync as existsSync2,
|
|
25028
|
-
openSync,
|
|
25029
|
-
readFileSync as readFileSync2,
|
|
25030
|
-
rmSync as rmSync5,
|
|
25031
|
-
statSync as statSync3,
|
|
25032
|
-
writeFileSync as writeFileSync2
|
|
25033
|
-
} from "fs";
|
|
25034
|
-
import { hostname as hostname3 } from "os";
|
|
25035
|
-
var PARK = new Int32Array(new SharedArrayBuffer(4));
|
|
25036
|
-
|
|
25037
|
-
// ../../packages/persistence/src/managed-settings.ts
|
|
25038
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
25039
|
-
import { posix, win32 } from "path";
|
|
25040
|
-
|
|
25041
|
-
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
25042
|
-
import { randomUUID as randomUUID5 } from "crypto";
|
|
25043
|
-
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
25044
|
-
var HARNESS_LABELS = {
|
|
25045
|
-
[HARNESS.ClaudeCode]: "Claude Code",
|
|
25046
|
-
[HARNESS.Cursor]: "Cursor",
|
|
25047
|
-
[HARNESS.Codex]: "Codex",
|
|
25048
|
-
[HARNESS.Antigravity]: "Antigravity",
|
|
25049
|
-
[HARNESS.Copilot]: "GitHub Copilot"
|
|
25050
|
-
};
|
|
25051
|
-
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
25052
|
-
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
25053
|
-
var TITLE_NEEDLES = {
|
|
25054
|
-
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
25055
|
-
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
25056
|
-
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
25057
|
-
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity),
|
|
25058
|
-
// 'githubcopilot', not 'copilot'. The needle is the stripped WIRE id like
|
|
25059
|
-
// every other row, and the wire id carries the vendor: a bare 'copilot'
|
|
25060
|
-
// needle would also match any title that merely contains the word.
|
|
25061
|
-
Copilot: stripSeparators(SOURCE_TOOL.Copilot)
|
|
25062
|
-
};
|
|
25063
|
-
|
|
25064
|
-
// ../../packages/persistence/src/repositories/policies.ts
|
|
25065
|
-
import { randomUUID as randomUUID6 } from "crypto";
|
|
25066
|
-
|
|
25067
|
-
// ../../packages/persistence/src/repositories/project-files.ts
|
|
25068
|
-
import { randomUUID as randomUUID7 } from "crypto";
|
|
25069
|
-
|
|
25070
|
-
// ../../packages/persistence/src/repositories/resolutions.ts
|
|
25071
|
-
import { randomUUID as randomUUID8 } from "crypto";
|
|
25072
|
-
|
|
25073
|
-
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
25074
|
-
import { randomUUID as randomUUID9 } from "crypto";
|
|
25075
|
-
|
|
25076
|
-
// ../../packages/persistence/src/repositories/security.ts
|
|
25077
|
-
var OPEN_AT_REST_FINDINGS_SQL = `FROM inspection_findings f
|
|
25078
|
-
JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
|
|
25079
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
25080
|
-
LEFT JOIN ${LATEST_RESOLUTION_BY_KEY_SQL} latest
|
|
25081
|
-
ON latest.finding_key = f.finding_key
|
|
25082
|
-
WHERE e.event_type IN (${CAPTURE_EVENT_TYPES_SQL})
|
|
25083
|
-
AND e.event_type = 'code_change'
|
|
25084
|
-
AND (
|
|
25085
|
-
f.finding_key IS NULL
|
|
25086
|
-
OR latest.status IS NULL
|
|
25087
|
-
OR latest.status NOT IN ('resolved', 'dismissed')
|
|
25088
|
-
)`;
|
|
25089
|
-
var SCAN_COVERAGE = {
|
|
25090
|
-
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
25091
|
-
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
25092
|
-
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
25093
|
-
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
25094
|
-
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
25095
|
-
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
25096
|
-
[HARNESS.Copilot]: { coverage: 30, supported: true },
|
|
25097
|
-
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
25098
|
-
};
|
|
25099
|
-
|
|
25100
|
-
// ../../packages/persistence/src/repositories/shares.ts
|
|
25101
|
-
import { randomUUID as randomUUID10 } from "crypto";
|
|
25102
|
-
|
|
25103
|
-
// ../../packages/persistence/src/database.ts
|
|
25104
|
-
var CAPTURE_GRAIN = new Set(EventKind.options);
|
|
25105
|
-
var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
|
|
25106
|
-
|
|
25107
|
-
// ../../packages/persistence/src/egress-wire.ts
|
|
25108
|
-
import { createHash as createHash3 } from "crypto";
|
|
25109
|
-
var SLASH = "/".charCodeAt(0);
|
|
25110
|
-
|
|
25111
|
-
// ../../packages/persistence/src/finding-key.ts
|
|
25112
|
-
import { createHash as createHash4 } from "crypto";
|
|
25113
|
-
|
|
25114
|
-
// ../../packages/persistence/src/fingerprint.ts
|
|
25115
|
-
import { createHmac, randomBytes } from "crypto";
|
|
25116
|
-
import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
25117
|
-
import { join as join8 } from "path";
|
|
25118
|
-
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
25119
|
-
|
|
25120
|
-
// ../../packages/persistence/src/forward-health.ts
|
|
25121
|
-
import { readFileSync as readFileSync7 } from "fs";
|
|
25122
|
-
import { join as join9 } from "path";
|
|
25123
|
-
|
|
25124
|
-
// ../../packages/persistence/src/history-backfill.ts
|
|
25125
|
-
import { existsSync as existsSync4 } from "fs";
|
|
25126
|
-
import { join as join10 } from "path";
|
|
25127
|
-
|
|
25128
|
-
// ../../packages/persistence/src/history-preview.ts
|
|
25129
|
-
import { existsSync as existsSync5 } from "fs";
|
|
25130
|
-
import { join as join11 } from "path";
|
|
25131
|
-
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
25132
|
-
|
|
25133
|
-
// ../../packages/persistence/src/history-sync-state.ts
|
|
25134
|
-
import { readFileSync as readFileSync8 } from "fs";
|
|
25135
|
-
import { join as join12 } from "path";
|
|
25136
|
-
|
|
25137
|
-
// ../../packages/persistence/src/store-symlinks.ts
|
|
25138
|
-
import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
|
|
25139
|
-
import { dirname as dirname3, join as join13, resolve } from "path";
|
|
25140
|
-
|
|
25141
|
-
// ../../packages/persistence/src/vault/crypto.ts
|
|
25142
|
-
import {
|
|
25143
|
-
createCipheriv,
|
|
25144
|
-
createDecipheriv,
|
|
25145
|
-
createHmac as createHmac2,
|
|
25146
|
-
hkdfSync,
|
|
25147
|
-
timingSafeEqual
|
|
25148
|
-
} from "crypto";
|
|
25149
|
-
|
|
25150
|
-
// ../../packages/persistence/src/vault/key-provider.ts
|
|
25151
|
-
import { execFileSync } from "child_process";
|
|
25152
|
-
import { randomBytes as randomBytes2 } from "crypto";
|
|
25153
|
-
import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
25154
|
-
import { join as join14 } from "path";
|
|
25155
|
-
|
|
25156
|
-
// ../../packages/persistence/src/vault/vault.ts
|
|
25157
|
-
import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
|
|
25158
|
-
|
|
25159
|
-
// ../../packages/persistence/src/warn-era-cap.ts
|
|
25160
|
-
import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
25161
|
-
import { join as join15 } from "path";
|
|
25162
|
-
|
|
25163
|
-
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
25164
|
-
var booleanish = external_exports.string().optional().transform((v) => {
|
|
25165
|
-
if (v === void 0) return void 0;
|
|
25166
|
-
const t = v.trim().toLowerCase();
|
|
25167
|
-
if (t === "" || t === "false" || t === "0") return false;
|
|
25168
|
-
return true;
|
|
25169
|
-
}).catch(void 0);
|
|
25170
|
-
var optionalBaseUrl = external_exports.preprocess((v) => {
|
|
25171
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
25172
|
-
return v;
|
|
25173
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
25174
|
-
var providerEnvShape = {
|
|
25175
|
-
CLAUDE_CODE_USE_BEDROCK: booleanish,
|
|
25176
|
-
CLAUDE_CODE_USE_VERTEX: booleanish,
|
|
25177
|
-
ANTHROPIC_BASE_URL: optionalBaseUrl
|
|
25178
|
-
};
|
|
25179
|
-
var ProviderEnvSchema = external_exports.object(providerEnvShape);
|
|
25180
|
-
|
|
25181
|
-
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
25182
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
|
|
25183
|
-
import { homedir as homedir2 } from "os";
|
|
25184
|
-
import { basename as basename3, join as join18 } from "path";
|
|
25185
|
-
|
|
25186
24228
|
// ../../packages/detections/src/egress/registry.ts
|
|
25187
24229
|
var EXTRACTOR_VERSION = "3";
|
|
25188
24230
|
var PROVIDER_REGISTRY = [
|
|
@@ -25857,12 +24899,12 @@ var RegexMatcher2 = class {
|
|
|
25857
24899
|
rule.matcher,
|
|
25858
24900
|
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
25859
24901
|
);
|
|
25860
|
-
const
|
|
24902
|
+
const scanText = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
25861
24903
|
const spans = [];
|
|
25862
24904
|
let m;
|
|
25863
|
-
const maxIterations =
|
|
24905
|
+
const maxIterations = scanText.length + 1;
|
|
25864
24906
|
let iterations = 0;
|
|
25865
|
-
while ((m = re.exec(
|
|
24907
|
+
while ((m = re.exec(scanText)) !== null) {
|
|
25866
24908
|
if (++iterations > maxIterations) break;
|
|
25867
24909
|
const group = captureGroup != null ? m[captureGroup] : m[0];
|
|
25868
24910
|
if (m[0].length === 0) re.lastIndex++;
|
|
@@ -26016,123 +25058,6 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
26016
25058
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
26017
25059
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
26018
25060
|
|
|
26019
|
-
// ../../packages/plugin-sdk/src/repo.ts
|
|
26020
|
-
import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
26021
|
-
import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
|
|
26022
|
-
|
|
26023
|
-
// ../../packages/plugin-sdk/src/events.ts
|
|
26024
|
-
import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
|
|
26025
|
-
|
|
26026
|
-
// ../../packages/plugin-sdk/src/isolated-scan.ts
|
|
26027
|
-
import { existsSync as existsSync10 } from "fs";
|
|
26028
|
-
import { fileURLToPath } from "url";
|
|
26029
|
-
import { Worker } from "worker_threads";
|
|
26030
|
-
|
|
26031
|
-
// ../../packages/plugin-sdk/src/hook-fail-opens.ts
|
|
26032
|
-
import { readFileSync as readFileSync12 } from "fs";
|
|
26033
|
-
import { join as join19 } from "path";
|
|
26034
|
-
|
|
26035
|
-
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
26036
|
-
import { readFileSync as readFileSync14 } from "fs";
|
|
26037
|
-
import { join as join21 } from "path";
|
|
26038
|
-
|
|
26039
|
-
// ../../packages/plugin-sdk/src/model-governance.ts
|
|
26040
|
-
import {
|
|
26041
|
-
closeSync as closeSync2,
|
|
26042
|
-
fstatSync,
|
|
26043
|
-
mkdirSync as mkdirSync2,
|
|
26044
|
-
openSync as openSync2,
|
|
26045
|
-
readFileSync as readFileSync13,
|
|
26046
|
-
readSync,
|
|
26047
|
-
writeFileSync as writeFileSync5
|
|
26048
|
-
} from "fs";
|
|
26049
|
-
import { join as join20 } from "path";
|
|
26050
|
-
var TAIL_BYTES = 256 * 1024;
|
|
26051
|
-
|
|
26052
|
-
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
26053
|
-
var HOST_FEATURE = {
|
|
26054
|
-
ModelSwitch: "model-switch",
|
|
26055
|
-
VaultPointerDisplay: "vault-pointer-display"
|
|
26056
|
-
};
|
|
26057
|
-
var HOST_FLOORS = {
|
|
26058
|
-
[HOST_FEATURE.ModelSwitch]: {
|
|
26059
|
-
label: "model-switch protection",
|
|
26060
|
-
hookEvents: ["PreModelSwitch", "PostModelSwitch"],
|
|
26061
|
-
since: "2.1.251"
|
|
26062
|
-
},
|
|
26063
|
-
[HOST_FEATURE.VaultPointerDisplay]: {
|
|
26064
|
-
label: "vault pointer display",
|
|
26065
|
-
hookEvents: ["MessageDisplay"],
|
|
26066
|
-
since: "2.1.152"
|
|
26067
|
-
}
|
|
26068
|
-
};
|
|
26069
|
-
var ANTIGRAVITY_HOST_FEATURE = {
|
|
26070
|
-
EndOfTurnCapture: "end-of-turn-capture"
|
|
26071
|
-
};
|
|
26072
|
-
var ANTIGRAVITY_HOST_FLOORS = {
|
|
26073
|
-
[ANTIGRAVITY_HOST_FEATURE.EndOfTurnCapture]: {
|
|
26074
|
-
label: "end-of-turn history capture",
|
|
26075
|
-
hookEvents: ["Stop"],
|
|
26076
|
-
since: "1.1.10"
|
|
26077
|
-
}
|
|
26078
|
-
};
|
|
26079
|
-
|
|
26080
|
-
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
26081
|
-
var import_ignore = __toESM(require_ignore(), 1);
|
|
26082
|
-
import { readFileSync as readFileSync15 } from "fs";
|
|
26083
|
-
import { join as join22 } from "path";
|
|
26084
|
-
|
|
26085
|
-
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
26086
|
-
import { arch, hostname as hostname4, platform, release } from "os";
|
|
26087
|
-
|
|
26088
|
-
// ../../packages/plugin-sdk/src/nudge.ts
|
|
26089
|
-
import { mkdirSync as mkdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
|
|
26090
|
-
import { join as join23 } from "path";
|
|
26091
|
-
|
|
26092
|
-
// ../../packages/plugin-sdk/src/paths.ts
|
|
26093
|
-
import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
|
|
26094
|
-
import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
|
|
26095
|
-
|
|
26096
|
-
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26097
|
-
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
|
|
26098
|
-
import { basename as basename5, join as join24 } from "path";
|
|
26099
|
-
|
|
26100
|
-
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
26101
|
-
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
26102
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
26103
|
-
return v;
|
|
26104
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
26105
|
-
var optionalFlag = external_exports.preprocess((v) => {
|
|
26106
|
-
if (typeof v !== "string") return false;
|
|
26107
|
-
const normalized = v.trim().toLowerCase();
|
|
26108
|
-
return normalized !== "" && normalized !== "0" && normalized !== "false";
|
|
26109
|
-
}, external_exports.boolean()).catch(false);
|
|
26110
|
-
var antigravityProviderEnvShape = {
|
|
26111
|
-
GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
|
|
26112
|
-
GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
|
|
26113
|
-
};
|
|
26114
|
-
var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
|
|
26115
|
-
|
|
26116
|
-
// ../../packages/plugin-sdk/src/provider-env-codex.ts
|
|
26117
|
-
var optionalBaseUrl3 = external_exports.preprocess((v) => {
|
|
26118
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
26119
|
-
return v;
|
|
26120
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
26121
|
-
var codexProviderEnvShape = {
|
|
26122
|
-
OPENAI_BASE_URL: optionalBaseUrl3
|
|
26123
|
-
};
|
|
26124
|
-
var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
|
|
26125
|
-
|
|
26126
|
-
// ../../packages/plugin-sdk/src/runtime.ts
|
|
26127
|
-
import { randomUUID as randomUUID14 } from "crypto";
|
|
26128
|
-
|
|
26129
|
-
// ../../packages/plugin-sdk/src/suppressions.ts
|
|
26130
|
-
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
26131
|
-
|
|
26132
|
-
// ../../packages/plugin-sdk/src/throttle.ts
|
|
26133
|
-
import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
26134
|
-
import { join as join25 } from "path";
|
|
26135
|
-
|
|
26136
25061
|
// ../../packages/setup-wizard/src/onboard-posture.ts
|
|
26137
25062
|
function parsePosture(json2) {
|
|
26138
25063
|
const raw = JSON.parse(json2);
|
|
@@ -26169,8 +25094,8 @@ function parseCurrent(json2) {
|
|
|
26169
25094
|
}
|
|
26170
25095
|
|
|
26171
25096
|
// ../../packages/setup-wizard/src/remediation/rotation-checklist.ts
|
|
26172
|
-
import { writeFileSync
|
|
26173
|
-
import { join
|
|
25097
|
+
import { writeFileSync } from "fs";
|
|
25098
|
+
import { join } from "path";
|
|
26174
25099
|
|
|
26175
25100
|
// ../../packages/setup-wizard/src/triage/gate-display.ts
|
|
26176
25101
|
var ACTION_RANK = {
|
|
@@ -26197,9 +25122,9 @@ var RANK = Object.fromEntries(
|
|
|
26197
25122
|
);
|
|
26198
25123
|
|
|
26199
25124
|
// ../../packages/setup-wizard/src/triage/plan-file.ts
|
|
26200
|
-
import { mkdtempSync, readFileSync
|
|
25125
|
+
import { mkdtempSync, readFileSync, rmdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
26201
25126
|
import { tmpdir } from "os";
|
|
26202
|
-
import { basename
|
|
25127
|
+
import { basename, dirname, join as join2 } from "path";
|
|
26203
25128
|
var SuppressionEntrySchema = external_exports.object({
|
|
26204
25129
|
ruleId: external_exports.string(),
|
|
26205
25130
|
category: DetectionCategory,
|
|
@@ -26298,8 +25223,8 @@ function table(headers, rows, opts = {}) {
|
|
|
26298
25223
|
const widths = headers.map(
|
|
26299
25224
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
26300
25225
|
);
|
|
26301
|
-
const
|
|
26302
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
25226
|
+
const sep = " ".repeat(gap);
|
|
25227
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep);
|
|
26303
25228
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
26304
25229
|
if (opts.rowSep === true) {
|
|
26305
25230
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -26311,7 +25236,7 @@ function table(headers, rows, opts = {}) {
|
|
|
26311
25236
|
});
|
|
26312
25237
|
return [headerLine, rule, ...body].join("\n");
|
|
26313
25238
|
}
|
|
26314
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
25239
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep);
|
|
26315
25240
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
26316
25241
|
}
|
|
26317
25242
|
function fenced(body) {
|
|
@@ -26324,10 +25249,10 @@ function show(body) {
|
|
|
26324
25249
|
}
|
|
26325
25250
|
|
|
26326
25251
|
// src/skills-registry.ts
|
|
26327
|
-
import { readdirSync
|
|
26328
|
-
import { join as
|
|
26329
|
-
import { fileURLToPath
|
|
26330
|
-
var SKILLS_DIR =
|
|
25252
|
+
import { readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
25253
|
+
import { join as join3 } from "path";
|
|
25254
|
+
import { fileURLToPath } from "url";
|
|
25255
|
+
var SKILLS_DIR = fileURLToPath(new URL("../skills", import.meta.url));
|
|
26331
25256
|
|
|
26332
25257
|
// src/render.ts
|
|
26333
25258
|
var SEVERITY_GLYPH = {
|