@akasecurity/ai-tc-codex 0.9.17-beta.1 → 0.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/package.json +4 -4
- package/scripts/apply-suppressions.js +371 -59
- package/scripts/backfill.js +472 -73
- package/scripts/content-retention.js +326 -49
- package/scripts/filescan.js +519 -117
- package/scripts/firstrun.js +372 -59
- package/scripts/history-sync.js +333 -49
- package/scripts/intro.js +307 -38
- package/scripts/onboard.js +371 -59
- package/scripts/post-tool-use.js +521 -81
- package/scripts/pre-tool-use.js +503 -74
- package/scripts/query.js +372 -59
- package/scripts/reconcile.js +372 -59
- package/scripts/remediate.js +472 -73
- package/scripts/scan-worker.js +343 -38
- package/scripts/session-start.js +441 -111
- package/scripts/start-light.js +343 -38
- package/scripts/stop.js +346 -39
- package/scripts/sync.js +519 -117
- package/scripts/user-prompt-submit.js +564 -134
package/scripts/sync.js
CHANGED
|
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
mod
|
|
33
33
|
));
|
|
34
34
|
|
|
35
|
-
// ../../node_modules/.pnpm/ignore@7.0.
|
|
35
|
+
// ../../node_modules/.pnpm/ignore@7.0.12/node_modules/ignore/index.js
|
|
36
36
|
var require_ignore = __commonJS({
|
|
37
|
-
"../../node_modules/.pnpm/ignore@7.0.
|
|
37
|
+
"../../node_modules/.pnpm/ignore@7.0.12/node_modules/ignore/index.js"(exports, module) {
|
|
38
38
|
"use strict";
|
|
39
39
|
function makeArray(subject) {
|
|
40
40
|
return Array.isArray(subject) ? subject : [subject];
|
|
@@ -44,7 +44,7 @@ var require_ignore = __commonJS({
|
|
|
44
44
|
var SPACE = " ";
|
|
45
45
|
var ESCAPE = "\\";
|
|
46
46
|
var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
|
|
47
|
-
var
|
|
47
|
+
var BOM = "\uFEFF";
|
|
48
48
|
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
49
49
|
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
50
50
|
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
@@ -180,7 +180,9 @@ var require_ignore = __commonJS({
|
|
|
180
180
|
const char = pattern[index];
|
|
181
181
|
if (char === ESCAPE) {
|
|
182
182
|
const escaped = pattern[index + 1];
|
|
183
|
-
if (escaped ===
|
|
183
|
+
if (escaped === UNDEFINED || escaped === SLASH3 && index + 2 === length) {
|
|
184
|
+
out += hold(NEVER_MATCH);
|
|
185
|
+
} else if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
|
|
184
186
|
out += pattern.slice(index, index + 2);
|
|
185
187
|
} else {
|
|
186
188
|
out += hold(
|
|
@@ -213,35 +215,6 @@ var require_ignore = __commonJS({
|
|
|
213
215
|
var DIRECT = null;
|
|
214
216
|
var REGEX_INNER_SLASH = /\/(?!$)/;
|
|
215
217
|
var REPLACERS = [
|
|
216
|
-
[
|
|
217
|
-
// Remove BOM
|
|
218
|
-
// TODO:
|
|
219
|
-
// Other similar zero-width characters?
|
|
220
|
-
/^\uFEFF/,
|
|
221
|
-
() => EMPTY,
|
|
222
|
-
"\uFEFF"
|
|
223
|
-
],
|
|
224
|
-
[
|
|
225
|
-
// A trailing line terminator, left on when a whole file's contents are
|
|
226
|
-
// added as one pattern rather than split into lines. git never sees one
|
|
227
|
-
// -- it reads a `.gitignore` line by line -- so it is not part of the
|
|
228
|
-
// pattern and is dropped here, apart from the trailing-space trimming,
|
|
229
|
-
// which follows git in touching spaces and nothing else.
|
|
230
|
-
/[\r\n]+$/,
|
|
231
|
-
() => EMPTY
|
|
232
|
-
],
|
|
233
|
-
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
234
|
-
[
|
|
235
|
-
// Only spaces, never tabs or other whitespace: git trims a trailing run
|
|
236
|
-
// of `' '` and nothing else (dir.c, `trim_trailing_spaces`, a single
|
|
237
|
-
// `case ' '`), so a pattern ending in a tab keeps it as a literal.
|
|
238
|
-
// (a\ ) -> (a )
|
|
239
|
-
// (a ) -> (a)
|
|
240
|
-
// (a ) -> (a)
|
|
241
|
-
// (a \ ) -> (a )
|
|
242
|
-
/((?:\\\\)*?)(\\? +)$/,
|
|
243
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
|
|
244
|
-
],
|
|
245
218
|
// Replace (\ ) with ' '
|
|
246
219
|
// Only a space: an escaped tab or other whitespace is already a literal by
|
|
247
220
|
// the time it reaches here, and a bare tab must be left as one, not turned
|
|
@@ -250,11 +223,12 @@ var require_ignore = __commonJS({
|
|
|
250
223
|
// (\\ ) -> '\\ '
|
|
251
224
|
// (\\\ ) -> '\\ '
|
|
252
225
|
[
|
|
253
|
-
|
|
254
|
-
(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
226
|
+
// A run of backslashes is taken whole, from its first one, so no match
|
|
227
|
+
// ever starts again inside it -- `(\\+?) ` did, which made a long run
|
|
228
|
+
// quadratic.
|
|
229
|
+
/(\\+)( ?)/g,
|
|
230
|
+
(_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
|
|
231
|
+
ESCAPE + SPACE
|
|
258
232
|
],
|
|
259
233
|
// Escape metacharacters
|
|
260
234
|
// which is written down by users but means special for regular expressions.
|
|
@@ -574,7 +548,7 @@ var require_ignore = __commonJS({
|
|
|
574
548
|
return cut < 0 ? EMPTY : path.slice(0, cut + 1);
|
|
575
549
|
};
|
|
576
550
|
var isString = (subject) => typeof subject === "string";
|
|
577
|
-
var checkPattern = (pattern) => pattern && isString(pattern) && !
|
|
551
|
+
var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
|
|
578
552
|
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
|
|
579
553
|
var IgnoreRule = class {
|
|
580
554
|
constructor(pattern, mark, body, ignoreCase, negative, prefix) {
|
|
@@ -615,15 +589,44 @@ var require_ignore = __commonJS({
|
|
|
615
589
|
return define(this, key, regex);
|
|
616
590
|
}
|
|
617
591
|
};
|
|
592
|
+
var isLineEnd = (char) => char === "\r" || char === "\n";
|
|
593
|
+
var trimEnd = (body) => {
|
|
594
|
+
let end = body.length;
|
|
595
|
+
while (end && isLineEnd(body[end - 1])) {
|
|
596
|
+
end--;
|
|
597
|
+
}
|
|
598
|
+
const lineEnd = end;
|
|
599
|
+
while (end && body[end - 1] === SPACE) {
|
|
600
|
+
end--;
|
|
601
|
+
}
|
|
602
|
+
if (end === lineEnd) {
|
|
603
|
+
return body.slice(0, end);
|
|
604
|
+
}
|
|
605
|
+
let backslashes = 0;
|
|
606
|
+
while (backslashes < end && body[end - backslashes - 1] === ESCAPE) {
|
|
607
|
+
backslashes++;
|
|
608
|
+
}
|
|
609
|
+
return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
|
|
610
|
+
};
|
|
618
611
|
var createRule = ({
|
|
619
612
|
pattern,
|
|
620
613
|
mark
|
|
621
614
|
}, ignoreCase) => {
|
|
615
|
+
let body = pattern[0] === BOM ? pattern.slice(1) : pattern;
|
|
616
|
+
if (body[0] === "#") {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
622
619
|
let negative = false;
|
|
623
|
-
|
|
624
|
-
if (body.indexOf("!") === 0) {
|
|
620
|
+
if (body[0] === "!") {
|
|
625
621
|
negative = true;
|
|
626
|
-
body = body.
|
|
622
|
+
body = body.slice(1);
|
|
623
|
+
}
|
|
624
|
+
const last = body[body.length - 1];
|
|
625
|
+
if (last === SPACE || last === "\r" || last === "\n") {
|
|
626
|
+
body = trimEnd(body);
|
|
627
|
+
}
|
|
628
|
+
if (!body) {
|
|
629
|
+
return;
|
|
627
630
|
}
|
|
628
631
|
body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
629
632
|
const regexPrefix = makeRegexPrefix(body);
|
|
@@ -654,8 +657,8 @@ var require_ignore = __commonJS({
|
|
|
654
657
|
pattern
|
|
655
658
|
};
|
|
656
659
|
}
|
|
657
|
-
|
|
658
|
-
|
|
660
|
+
const rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
|
|
661
|
+
if (rule) {
|
|
659
662
|
this._added = true;
|
|
660
663
|
this._rules.push(rule);
|
|
661
664
|
if (matchesBasename(rule.body)) {
|
|
@@ -20720,7 +20723,10 @@ function date4(params) {
|
|
|
20720
20723
|
var LongContextTier = external_exports.object({
|
|
20721
20724
|
thresholdInputTokens: external_exports.number().int().positive(),
|
|
20722
20725
|
input: external_exports.number().nonnegative().nullable(),
|
|
20723
|
-
output: external_exports.number().nonnegative().nullable()
|
|
20726
|
+
output: external_exports.number().nonnegative().nullable(),
|
|
20727
|
+
cacheRead: external_exports.number().nonnegative().nullable().optional(),
|
|
20728
|
+
cacheWrite5m: external_exports.number().nonnegative().nullable().optional(),
|
|
20729
|
+
cacheWrite1h: external_exports.number().nonnegative().nullable().optional()
|
|
20724
20730
|
});
|
|
20725
20731
|
var ModelPrice = external_exports.object({
|
|
20726
20732
|
/** USD per 1M uncached input tokens, at or below any long-context threshold. */
|
|
@@ -20729,7 +20735,8 @@ var ModelPrice = external_exports.object({
|
|
|
20729
20735
|
output: external_exports.number().nonnegative(),
|
|
20730
20736
|
/**
|
|
20731
20737
|
* Rate band above a size threshold, or `null` when the model is flat-rated.
|
|
20732
|
-
*
|
|
20738
|
+
* OpenAI, Google, xAI and some Anthropic models (Haiku 5.5) band; most
|
|
20739
|
+
* Claude models are flat across their window.
|
|
20733
20740
|
*/
|
|
20734
20741
|
longContext: LongContextTier.nullable(),
|
|
20735
20742
|
/** USD per 1M tokens written to a 5-minute ephemeral cache, or null if unpriced. */
|
|
@@ -20742,18 +20749,35 @@ var ModelPrice = external_exports.object({
|
|
|
20742
20749
|
webSearch: external_exports.number().nonnegative().nullable()
|
|
20743
20750
|
});
|
|
20744
20751
|
var WEB_SEARCH_PER_REQUEST = 0.01;
|
|
20745
|
-
function anthropicPrice(input2, output2, cacheRead) {
|
|
20752
|
+
function anthropicPrice(input2, output2, cacheRead, longContext = null) {
|
|
20746
20753
|
return Object.freeze({
|
|
20747
20754
|
input: input2,
|
|
20748
20755
|
output: output2,
|
|
20749
|
-
longContext: null,
|
|
20750
|
-
// flat across the full window on every current Claude
|
|
20756
|
+
longContext: longContext === null ? null : Object.freeze(longContext),
|
|
20751
20757
|
cacheWrite5m: input2 * 1.25,
|
|
20752
20758
|
cacheWrite1h: input2 * 2,
|
|
20753
20759
|
cacheRead,
|
|
20754
20760
|
webSearch: WEB_SEARCH_PER_REQUEST
|
|
20755
20761
|
});
|
|
20756
20762
|
}
|
|
20763
|
+
function anthropicBand(thresholdInputTokens, input2, output2, cacheRead) {
|
|
20764
|
+
return {
|
|
20765
|
+
thresholdInputTokens,
|
|
20766
|
+
input: input2,
|
|
20767
|
+
output: output2,
|
|
20768
|
+
cacheRead,
|
|
20769
|
+
cacheWrite5m: input2 * 1.25,
|
|
20770
|
+
cacheWrite1h: input2 * 2
|
|
20771
|
+
};
|
|
20772
|
+
}
|
|
20773
|
+
function scaledBand(thresholdInputTokens, base, scale) {
|
|
20774
|
+
return {
|
|
20775
|
+
thresholdInputTokens,
|
|
20776
|
+
input: base.input * scale.input,
|
|
20777
|
+
output: base.output * scale.output,
|
|
20778
|
+
...base.cacheRead === void 0 ? {} : { cacheRead: base.cacheRead * scale.cacheRead }
|
|
20779
|
+
};
|
|
20780
|
+
}
|
|
20757
20781
|
function tokenPrice(input2, output2, options = {}) {
|
|
20758
20782
|
return Object.freeze({
|
|
20759
20783
|
input: input2,
|
|
@@ -20786,17 +20810,19 @@ function serviceTierMultiplier(tier) {
|
|
|
20786
20810
|
function promptTokensOf(usage) {
|
|
20787
20811
|
return usage.promptTokens ?? (usage.inputTokens ?? 0) + (usage.cacheReadTokens ?? 0) + (usage.cacheWrite1hTokens ?? 0) + (usage.cacheWrite5mTokens ?? 0);
|
|
20788
20812
|
}
|
|
20813
|
+
function bandRate(column, base) {
|
|
20814
|
+
return column === void 0 ? base : column;
|
|
20815
|
+
}
|
|
20789
20816
|
function costOf(price, usage) {
|
|
20817
|
+
const band = price.longContext !== null && promptTokensOf(usage) > price.longContext.thresholdInputTokens ? price.longContext : null;
|
|
20790
20818
|
const metered = [
|
|
20791
|
-
[usage.
|
|
20792
|
-
[usage.
|
|
20793
|
-
[usage.
|
|
20819
|
+
[usage.inputTokens ?? 0, bandRate(band?.input, price.input)],
|
|
20820
|
+
[usage.outputTokens ?? 0, bandRate(band?.output, price.output)],
|
|
20821
|
+
[usage.cacheWrite1hTokens ?? 0, bandRate(band?.cacheWrite1h, price.cacheWrite1h)],
|
|
20822
|
+
[usage.cacheWrite5mTokens ?? 0, bandRate(band?.cacheWrite5m, price.cacheWrite5m)],
|
|
20823
|
+
[usage.cacheReadTokens ?? 0, bandRate(band?.cacheRead, price.cacheRead)]
|
|
20794
20824
|
];
|
|
20795
|
-
|
|
20796
|
-
if (band !== null && (band.input === null || band.output === null)) return null;
|
|
20797
|
-
const inputRate = band?.input ?? price.input;
|
|
20798
|
-
const outputRate = band?.output ?? price.output;
|
|
20799
|
-
let tokenCost = (usage.inputTokens ?? 0) * inputRate + (usage.outputTokens ?? 0) * outputRate;
|
|
20825
|
+
let tokenCost = 0;
|
|
20800
20826
|
for (const [tokens, rate] of metered) {
|
|
20801
20827
|
if (tokens === 0) continue;
|
|
20802
20828
|
if (rate === null) return null;
|
|
@@ -21086,10 +21112,20 @@ anthropic.model("claude-fable-5-1", {
|
|
|
21086
21112
|
});
|
|
21087
21113
|
anthropic.model("claude-fable-5", {
|
|
21088
21114
|
name: "Claude Fable 5",
|
|
21115
|
+
ctx: 1e6,
|
|
21116
|
+
maxOut: 128e3,
|
|
21089
21117
|
capability: "reasoning",
|
|
21090
21118
|
price: anthropicPrice(10, 50, 1),
|
|
21091
21119
|
on: [...CLAUDE_RESELLERS]
|
|
21092
21120
|
});
|
|
21121
|
+
anthropic.model("claude-opus-5-5", {
|
|
21122
|
+
name: "Claude Opus 5.5",
|
|
21123
|
+
ctx: 1e6,
|
|
21124
|
+
maxOut: 128e3,
|
|
21125
|
+
capability: "reasoning",
|
|
21126
|
+
price: anthropicPrice(4, 20, 0.2),
|
|
21127
|
+
on: [...CLAUDE_RESELLERS]
|
|
21128
|
+
});
|
|
21093
21129
|
anthropic.model("claude-opus-5", {
|
|
21094
21130
|
name: "Claude Opus 5",
|
|
21095
21131
|
ctx: 1e6,
|
|
@@ -21100,24 +21136,32 @@ anthropic.model("claude-opus-5", {
|
|
|
21100
21136
|
});
|
|
21101
21137
|
anthropic.model("claude-opus-4-8", {
|
|
21102
21138
|
name: "Claude Opus 4.8",
|
|
21139
|
+
ctx: 1e6,
|
|
21140
|
+
maxOut: 128e3,
|
|
21103
21141
|
capability: "reasoning",
|
|
21104
21142
|
price: anthropicPrice(5, 25, 0.5),
|
|
21105
21143
|
on: [...CLAUDE_RESELLERS]
|
|
21106
21144
|
});
|
|
21107
21145
|
anthropic.model("claude-opus-4-7", {
|
|
21108
21146
|
name: "Claude Opus 4.7",
|
|
21147
|
+
ctx: 1e6,
|
|
21148
|
+
maxOut: 128e3,
|
|
21109
21149
|
capability: "reasoning",
|
|
21110
21150
|
price: anthropicPrice(5, 25, 0.5),
|
|
21111
21151
|
on: [...CLAUDE_RESELLERS]
|
|
21112
21152
|
});
|
|
21113
21153
|
anthropic.model("claude-opus-4-6", {
|
|
21114
21154
|
name: "Claude Opus 4.6",
|
|
21155
|
+
ctx: 1e6,
|
|
21156
|
+
maxOut: 128e3,
|
|
21115
21157
|
capability: "reasoning",
|
|
21116
21158
|
price: anthropicPrice(5, 25, 0.5),
|
|
21117
21159
|
on: [...CLAUDE_RESELLERS]
|
|
21118
21160
|
});
|
|
21119
21161
|
anthropic.model("claude-opus-4-5", {
|
|
21120
21162
|
name: "Claude Opus 4.5",
|
|
21163
|
+
ctx: 2e5,
|
|
21164
|
+
maxOut: 64e3,
|
|
21121
21165
|
capability: "reasoning",
|
|
21122
21166
|
price: anthropicPrice(5, 25, 0.5),
|
|
21123
21167
|
on: [...CLAUDE_RESELLERS]
|
|
@@ -21128,6 +21172,14 @@ anthropic.model("claude-opus-4-1", {
|
|
|
21128
21172
|
price: anthropicPrice(15, 75, 1.5),
|
|
21129
21173
|
on: [...CLAUDE_RESELLERS]
|
|
21130
21174
|
});
|
|
21175
|
+
anthropic.model("claude-sonnet-5-5", {
|
|
21176
|
+
name: "Claude Sonnet 5.5",
|
|
21177
|
+
ctx: 1e6,
|
|
21178
|
+
maxOut: 128e3,
|
|
21179
|
+
capability: "reasoning",
|
|
21180
|
+
price: anthropicPrice(2, 10, 0.1),
|
|
21181
|
+
on: [...CLAUDE_RESELLERS]
|
|
21182
|
+
});
|
|
21131
21183
|
anthropic.model("claude-sonnet-5", {
|
|
21132
21184
|
name: "Claude Sonnet 5",
|
|
21133
21185
|
ctx: 1e6,
|
|
@@ -21138,16 +21190,30 @@ anthropic.model("claude-sonnet-5", {
|
|
|
21138
21190
|
});
|
|
21139
21191
|
anthropic.model("claude-sonnet-4-6", {
|
|
21140
21192
|
name: "Claude Sonnet 4.6",
|
|
21193
|
+
ctx: 1e6,
|
|
21194
|
+
maxOut: 128e3,
|
|
21141
21195
|
capability: "reasoning",
|
|
21142
21196
|
price: anthropicPrice(3, 15, 0.3),
|
|
21143
21197
|
on: [...CLAUDE_RESELLERS]
|
|
21144
21198
|
});
|
|
21145
21199
|
anthropic.model("claude-sonnet-4-5", {
|
|
21146
21200
|
name: "Claude Sonnet 4.5",
|
|
21201
|
+
ctx: 2e5,
|
|
21202
|
+
maxOut: 64e3,
|
|
21147
21203
|
capability: "reasoning",
|
|
21148
21204
|
price: anthropicPrice(3, 15, 0.3),
|
|
21149
21205
|
on: [...CLAUDE_RESELLERS]
|
|
21150
21206
|
});
|
|
21207
|
+
anthropic.model("claude-haiku-5-5", {
|
|
21208
|
+
name: "Claude Haiku 5.5",
|
|
21209
|
+
ctx: 1e6,
|
|
21210
|
+
maxOut: 128e3,
|
|
21211
|
+
capability: null,
|
|
21212
|
+
// A prompt over 100,000 tokens, cache reads and writes included, bills the
|
|
21213
|
+
// whole request at the higher band.
|
|
21214
|
+
price: anthropicPrice(0.1, 0.5, 0.01, anthropicBand(1e5, 0.5, 2.5, 0.05)),
|
|
21215
|
+
on: [...CLAUDE_RESELLERS]
|
|
21216
|
+
});
|
|
21151
21217
|
anthropic.model("claude-haiku-4-5", {
|
|
21152
21218
|
name: "Claude Haiku 4.5",
|
|
21153
21219
|
ctx: 2e5,
|
|
@@ -21170,7 +21236,13 @@ var OPENAI_TRAINING = {
|
|
|
21170
21236
|
consumerControl: "opt-out",
|
|
21171
21237
|
source: "https://developers.openai.com/api/docs/guides/your-data"
|
|
21172
21238
|
};
|
|
21173
|
-
|
|
21239
|
+
function gptPrice(input2, output2, cacheRead) {
|
|
21240
|
+
const base = { input: input2, output: output2, ...cacheRead === void 0 ? {} : { cacheRead } };
|
|
21241
|
+
return tokenPrice(input2, output2, {
|
|
21242
|
+
...base,
|
|
21243
|
+
longContext: scaledBand(272e3, base, { input: 2, output: 1.5, cacheRead: 2 })
|
|
21244
|
+
});
|
|
21245
|
+
}
|
|
21174
21246
|
var openai = vendor("openai", {
|
|
21175
21247
|
family: { id: "gpt", name: "GPT" },
|
|
21176
21248
|
region: "us",
|
|
@@ -21178,12 +21250,45 @@ var openai = vendor("openai", {
|
|
|
21178
21250
|
training: OPENAI_TRAINING
|
|
21179
21251
|
});
|
|
21180
21252
|
var OPENAI_RESELLERS = ["azure", "foundry"];
|
|
21253
|
+
openai.model("gpt-6-astra", {
|
|
21254
|
+
name: "GPT-6 Astra",
|
|
21255
|
+
ctx: 105e4,
|
|
21256
|
+
maxOut: 128e3,
|
|
21257
|
+
capability: "reasoning",
|
|
21258
|
+
price: gptPrice(10, 50, 1),
|
|
21259
|
+
on: [...OPENAI_RESELLERS]
|
|
21260
|
+
});
|
|
21261
|
+
openai.model("gpt-6.1-sol", {
|
|
21262
|
+
name: "GPT-6.1 Sol",
|
|
21263
|
+
ctx: 105e4,
|
|
21264
|
+
maxOut: 128e3,
|
|
21265
|
+
capability: "reasoning",
|
|
21266
|
+
price: gptPrice(2, 10, 0.1),
|
|
21267
|
+
on: [...OPENAI_RESELLERS]
|
|
21268
|
+
});
|
|
21269
|
+
openai.model("gpt-6-sol", {
|
|
21270
|
+
name: "GPT-6 Sol",
|
|
21271
|
+
ctx: 105e4,
|
|
21272
|
+
maxOut: 128e3,
|
|
21273
|
+
capability: "reasoning",
|
|
21274
|
+
price: gptPrice(2, 10, 0.2),
|
|
21275
|
+
on: [...OPENAI_RESELLERS]
|
|
21276
|
+
});
|
|
21277
|
+
openai.model("gpt-6-luna", {
|
|
21278
|
+
name: "GPT-6 Luna",
|
|
21279
|
+
ctx: 105e4,
|
|
21280
|
+
maxOut: 128e3,
|
|
21281
|
+
capability: null,
|
|
21282
|
+
price: gptPrice(0.1, 0.5, 0.01),
|
|
21283
|
+
on: [...OPENAI_RESELLERS]
|
|
21284
|
+
});
|
|
21181
21285
|
openai.model("gpt-5.6-sol", {
|
|
21182
21286
|
name: "GPT-5.6 Sol",
|
|
21287
|
+
// Promotional rate, published as available at least through 2026-11-21.
|
|
21183
21288
|
ctx: 105e4,
|
|
21184
21289
|
maxOut: 128e3,
|
|
21185
21290
|
capability: "reasoning",
|
|
21186
|
-
price:
|
|
21291
|
+
price: gptPrice(4, 20, 0.4),
|
|
21187
21292
|
on: [...OPENAI_RESELLERS]
|
|
21188
21293
|
});
|
|
21189
21294
|
openai.model("gpt-5.6-terra", {
|
|
@@ -21191,7 +21296,7 @@ openai.model("gpt-5.6-terra", {
|
|
|
21191
21296
|
ctx: 105e4,
|
|
21192
21297
|
maxOut: 128e3,
|
|
21193
21298
|
capability: "reasoning",
|
|
21194
|
-
price:
|
|
21299
|
+
price: gptPrice(2, 12, 0.2),
|
|
21195
21300
|
on: [...OPENAI_RESELLERS]
|
|
21196
21301
|
});
|
|
21197
21302
|
openai.model("gpt-5.6-luna", {
|
|
@@ -21199,7 +21304,7 @@ openai.model("gpt-5.6-luna", {
|
|
|
21199
21304
|
ctx: 105e4,
|
|
21200
21305
|
maxOut: 128e3,
|
|
21201
21306
|
capability: null,
|
|
21202
|
-
price:
|
|
21307
|
+
price: gptPrice(0.2, 1.2, 0.02),
|
|
21203
21308
|
on: [...OPENAI_RESELLERS]
|
|
21204
21309
|
});
|
|
21205
21310
|
openai.model("gpt-5.5", {
|
|
@@ -21207,7 +21312,15 @@ openai.model("gpt-5.5", {
|
|
|
21207
21312
|
ctx: 105e4,
|
|
21208
21313
|
maxOut: 128e3,
|
|
21209
21314
|
capability: "reasoning",
|
|
21210
|
-
price:
|
|
21315
|
+
price: gptPrice(5, 30, 0.5),
|
|
21316
|
+
on: [...OPENAI_RESELLERS]
|
|
21317
|
+
});
|
|
21318
|
+
openai.model("gpt-5.5-pro", {
|
|
21319
|
+
name: "GPT-5.5 Pro",
|
|
21320
|
+
ctx: 105e4,
|
|
21321
|
+
maxOut: 128e3,
|
|
21322
|
+
capability: "reasoning",
|
|
21323
|
+
price: gptPrice(30, 180),
|
|
21211
21324
|
on: [...OPENAI_RESELLERS]
|
|
21212
21325
|
});
|
|
21213
21326
|
openai.model("gpt-5.4", {
|
|
@@ -21215,7 +21328,7 @@ openai.model("gpt-5.4", {
|
|
|
21215
21328
|
ctx: 105e4,
|
|
21216
21329
|
maxOut: 128e3,
|
|
21217
21330
|
capability: "reasoning",
|
|
21218
|
-
price:
|
|
21331
|
+
price: gptPrice(2.5, 15, 0.25),
|
|
21219
21332
|
on: [...OPENAI_RESELLERS]
|
|
21220
21333
|
});
|
|
21221
21334
|
openai.model("gpt-5.4-mini", {
|
|
@@ -21261,6 +21374,7 @@ openai.model("gpt-5", {
|
|
|
21261
21374
|
openai.model("gpt-5-mini", {
|
|
21262
21375
|
name: "GPT-5 mini",
|
|
21263
21376
|
ctx: 4e5,
|
|
21377
|
+
maxOut: 128e3,
|
|
21264
21378
|
capability: null,
|
|
21265
21379
|
price: tokenPrice(0.25, 2, { cacheRead: 0.025 }),
|
|
21266
21380
|
on: [...OPENAI_RESELLERS]
|
|
@@ -21275,11 +21389,15 @@ openai.model("gpt-5-nano", {
|
|
|
21275
21389
|
});
|
|
21276
21390
|
openai.model("gpt-4.1", {
|
|
21277
21391
|
name: "GPT-4.1",
|
|
21392
|
+
ctx: 1047576,
|
|
21393
|
+
maxOut: 32768,
|
|
21278
21394
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
21279
21395
|
on: [...OPENAI_RESELLERS]
|
|
21280
21396
|
});
|
|
21281
21397
|
openai.model("gpt-4o", {
|
|
21282
21398
|
name: "GPT-4o",
|
|
21399
|
+
ctx: 128e3,
|
|
21400
|
+
maxOut: 16384,
|
|
21283
21401
|
price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
|
|
21284
21402
|
on: [...OPENAI_RESELLERS]
|
|
21285
21403
|
});
|
|
@@ -21303,6 +21421,8 @@ openai.model("gpt-4-turbo", {
|
|
|
21303
21421
|
});
|
|
21304
21422
|
openai.model("o3", {
|
|
21305
21423
|
name: "o3",
|
|
21424
|
+
ctx: 2e5,
|
|
21425
|
+
maxOut: 1e5,
|
|
21306
21426
|
capability: "reasoning",
|
|
21307
21427
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
21308
21428
|
on: [...OPENAI_RESELLERS]
|
|
@@ -21355,57 +21475,100 @@ var google = vendor("google", {
|
|
|
21355
21475
|
retention: "configurable",
|
|
21356
21476
|
training: GOOGLE_TRAINING
|
|
21357
21477
|
});
|
|
21478
|
+
google.model("gemini-3.8-flash", {
|
|
21479
|
+
name: "Gemini 3.8 Flash",
|
|
21480
|
+
ctx: 1048576,
|
|
21481
|
+
maxOut: 65536,
|
|
21482
|
+
capability: null,
|
|
21483
|
+
price: tokenPrice(0.75, 3.75, { cacheRead: 0.075 }),
|
|
21484
|
+
on: ["vertex"]
|
|
21485
|
+
});
|
|
21358
21486
|
google.model("gemini-3.7-flash", {
|
|
21359
21487
|
name: "Gemini 3.7 Flash",
|
|
21360
21488
|
capability: null,
|
|
21361
|
-
// Promotional rate; the published post-promotion rate is 1.50 / 7.50.
|
|
21362
21489
|
price: tokenPrice(0.75, 3.75),
|
|
21363
21490
|
on: ["vertex"]
|
|
21364
21491
|
});
|
|
21365
21492
|
google.model("gemini-3.6-flash", {
|
|
21366
21493
|
name: "Gemini 3.6 Flash",
|
|
21494
|
+
ctx: 1048576,
|
|
21495
|
+
maxOut: 65536,
|
|
21367
21496
|
capability: null,
|
|
21368
|
-
price: tokenPrice(0.75, 3.75),
|
|
21497
|
+
price: tokenPrice(0.75, 3.75, { cacheRead: 0.075 }),
|
|
21369
21498
|
on: ["vertex"]
|
|
21370
21499
|
});
|
|
21371
21500
|
google.model("gemini-3.5-flash", {
|
|
21372
21501
|
name: "Gemini 3.5 Flash",
|
|
21373
21502
|
capability: null,
|
|
21374
|
-
price: tokenPrice(1.5, 9),
|
|
21375
21503
|
on: ["vertex"]
|
|
21376
21504
|
});
|
|
21377
21505
|
google.model("gemini-3.5-flash-lite", {
|
|
21378
21506
|
name: "Gemini 3.5 Flash Lite",
|
|
21507
|
+
ctx: 1048576,
|
|
21508
|
+
maxOut: 65536,
|
|
21379
21509
|
capability: null,
|
|
21380
|
-
price: tokenPrice(0.3, 2.5),
|
|
21510
|
+
price: tokenPrice(0.3, 2.5, { cacheRead: 0.03 }),
|
|
21511
|
+
on: ["vertex"]
|
|
21512
|
+
});
|
|
21513
|
+
google.model("gemini-3.1-flash-lite", {
|
|
21514
|
+
name: "Gemini 3.1 Flash Lite",
|
|
21515
|
+
ctx: 1048576,
|
|
21516
|
+
maxOut: 65536,
|
|
21517
|
+
capability: null,
|
|
21518
|
+
price: tokenPrice(0.25, 1.5, { cacheRead: 0.025 }),
|
|
21519
|
+
on: ["vertex"]
|
|
21520
|
+
});
|
|
21521
|
+
google.model("gemini-3-flash-preview", {
|
|
21522
|
+
name: "Gemini 3 Flash Preview",
|
|
21523
|
+
ctx: 1048576,
|
|
21524
|
+
maxOut: 65536,
|
|
21525
|
+
capability: null,
|
|
21526
|
+
price: tokenPrice(0.5, 3, { cacheRead: 0.05 }),
|
|
21381
21527
|
on: ["vertex"]
|
|
21382
21528
|
});
|
|
21383
21529
|
google.model("gemini-3.1-pro-preview", {
|
|
21384
21530
|
name: "Gemini 3.1 Pro Preview",
|
|
21531
|
+
ctx: 1048576,
|
|
21532
|
+
maxOut: 65536,
|
|
21385
21533
|
capability: "reasoning",
|
|
21386
21534
|
price: tokenPrice(2, 12, {
|
|
21387
|
-
|
|
21535
|
+
cacheRead: 0.2,
|
|
21536
|
+
longContext: { thresholdInputTokens: 2e5, input: 4, output: 18, cacheRead: 0.4 }
|
|
21388
21537
|
}),
|
|
21538
|
+
aliases: ["gemini-3.1-pro-preview-customtools"],
|
|
21389
21539
|
on: ["vertex"]
|
|
21390
21540
|
});
|
|
21391
21541
|
google.model("gemini-2.5-pro", {
|
|
21392
21542
|
name: "Gemini 2.5 Pro",
|
|
21543
|
+
ctx: 1048576,
|
|
21544
|
+
maxOut: 65536,
|
|
21393
21545
|
capability: "reasoning",
|
|
21394
21546
|
price: tokenPrice(1.25, 10, {
|
|
21395
|
-
|
|
21547
|
+
cacheRead: 0.125,
|
|
21548
|
+
longContext: { thresholdInputTokens: 2e5, input: 2.5, output: 15, cacheRead: 0.25 }
|
|
21396
21549
|
}),
|
|
21397
21550
|
on: ["vertex"]
|
|
21398
21551
|
});
|
|
21399
21552
|
google.model("gemini-2.5-flash", {
|
|
21400
21553
|
name: "Gemini 2.5 Flash",
|
|
21554
|
+
ctx: 1048576,
|
|
21555
|
+
maxOut: 65536,
|
|
21401
21556
|
capability: null,
|
|
21402
|
-
price: tokenPrice(0.3, 2.5),
|
|
21557
|
+
price: tokenPrice(0.3, 2.5, { cacheRead: 0.03 }),
|
|
21403
21558
|
on: ["vertex"]
|
|
21404
21559
|
});
|
|
21405
21560
|
google.model("gemini-2.5-flash-lite", {
|
|
21406
21561
|
name: "Gemini 2.5 Flash Lite",
|
|
21562
|
+
ctx: 1048576,
|
|
21563
|
+
maxOut: 65536,
|
|
21407
21564
|
capability: null,
|
|
21408
|
-
price: tokenPrice(0.1, 0.4),
|
|
21565
|
+
price: tokenPrice(0.1, 0.4, { cacheRead: 0.01 }),
|
|
21566
|
+
on: ["vertex"]
|
|
21567
|
+
});
|
|
21568
|
+
google.model("gemini-embedding-2", {
|
|
21569
|
+
name: "Gemini Embedding 2",
|
|
21570
|
+
capability: "embedding",
|
|
21571
|
+
price: tokenPrice(0.2, 0),
|
|
21409
21572
|
on: ["vertex"]
|
|
21410
21573
|
});
|
|
21411
21574
|
google.model("gemini-1-5-pro", { name: "Gemini 1.5 Pro", on: ["vertex"] });
|
|
@@ -21421,43 +21584,62 @@ var xai = vendor("xai", {
|
|
|
21421
21584
|
source: "https://docs.x.ai/developers/faq/security"
|
|
21422
21585
|
}
|
|
21423
21586
|
});
|
|
21587
|
+
function grokPrice(input2, output2, cacheRead) {
|
|
21588
|
+
const base = { input: input2, output: output2, cacheRead };
|
|
21589
|
+
return tokenPrice(input2, output2, {
|
|
21590
|
+
cacheRead,
|
|
21591
|
+
longContext: scaledBand(2e5, base, { input: 2, output: 2, cacheRead: 2 })
|
|
21592
|
+
});
|
|
21593
|
+
}
|
|
21594
|
+
xai.model("grok-4.7", {
|
|
21595
|
+
name: "Grok 4.7",
|
|
21596
|
+
ctx: 5e5,
|
|
21597
|
+
capability: "reasoning",
|
|
21598
|
+
price: grokPrice(2, 6, 0.5)
|
|
21599
|
+
});
|
|
21424
21600
|
xai.model("grok-4.6", {
|
|
21425
21601
|
name: "Grok 4.6",
|
|
21426
21602
|
ctx: 5e5,
|
|
21427
21603
|
capability: "reasoning",
|
|
21428
|
-
price:
|
|
21429
|
-
cacheRead: 0.5,
|
|
21430
|
-
longContext: { thresholdInputTokens: 2e5, input: 4, output: 12 }
|
|
21431
|
-
}),
|
|
21604
|
+
price: grokPrice(2, 6, 0.5),
|
|
21432
21605
|
on: ["bedrock"]
|
|
21433
21606
|
});
|
|
21434
21607
|
xai.model("grok-4.5", {
|
|
21435
21608
|
name: "Grok 4.5",
|
|
21436
21609
|
ctx: 5e5,
|
|
21437
21610
|
capability: "reasoning",
|
|
21438
|
-
price:
|
|
21439
|
-
cacheRead: 0.3,
|
|
21440
|
-
longContext: { thresholdInputTokens: 2e5, input: 4, output: 12 }
|
|
21441
|
-
})
|
|
21611
|
+
price: grokPrice(2, 6, 0.3)
|
|
21442
21612
|
});
|
|
21443
21613
|
xai.model("grok-4.3", {
|
|
21444
21614
|
name: "Grok 4.3",
|
|
21445
21615
|
ctx: 1e6,
|
|
21446
21616
|
capability: "reasoning",
|
|
21447
|
-
price:
|
|
21448
|
-
cacheRead: 0.2,
|
|
21449
|
-
longContext: { thresholdInputTokens: 2e5, input: 2.5, output: 5 }
|
|
21450
|
-
}),
|
|
21617
|
+
price: grokPrice(1.25, 2.5, 0.2),
|
|
21451
21618
|
on: ["bedrock"]
|
|
21452
21619
|
});
|
|
21620
|
+
xai.model("grok-4.20-0309-reasoning", {
|
|
21621
|
+
name: "Grok 4.20 Reasoning",
|
|
21622
|
+
capability: "reasoning",
|
|
21623
|
+
ctx: 1e6,
|
|
21624
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
21625
|
+
});
|
|
21626
|
+
xai.model("grok-4.20-0309-non-reasoning", {
|
|
21627
|
+
name: "Grok 4.20",
|
|
21628
|
+
capability: null,
|
|
21629
|
+
ctx: 1e6,
|
|
21630
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
21631
|
+
});
|
|
21632
|
+
xai.model("grok-4.20-multi-agent-0309", {
|
|
21633
|
+
name: "Grok 4.20 Multi-Agent",
|
|
21634
|
+
capability: "reasoning",
|
|
21635
|
+
ctx: 1e6,
|
|
21636
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
21637
|
+
});
|
|
21453
21638
|
xai.model("grok-build-0.1", {
|
|
21454
21639
|
name: "Grok Build 0.1",
|
|
21455
21640
|
ctx: 256e3,
|
|
21456
21641
|
capability: "code",
|
|
21457
|
-
price:
|
|
21458
|
-
cacheRead: 0.2,
|
|
21459
|
-
longContext: { thresholdInputTokens: 2e5, input: 2, output: 4 }
|
|
21460
|
-
})
|
|
21642
|
+
price: grokPrice(1, 2, 0.2)
|
|
21461
21643
|
});
|
|
21462
21644
|
var deepseek = vendor("deepseek", {
|
|
21463
21645
|
family: { id: "deepseek", name: "DeepSeek" },
|
|
@@ -21470,16 +21652,25 @@ var deepseek = vendor("deepseek", {
|
|
|
21470
21652
|
source: "https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html"
|
|
21471
21653
|
}
|
|
21472
21654
|
});
|
|
21655
|
+
deepseek.model("deepseek-flash", {
|
|
21656
|
+
name: "DeepSeek V4.1 Flash",
|
|
21657
|
+
ctx: 1e6,
|
|
21658
|
+
maxOut: 384e3,
|
|
21659
|
+
capability: null,
|
|
21660
|
+
price: tokenPrice(0.3, 1.2, { cacheRead: 6e-3 })
|
|
21661
|
+
});
|
|
21473
21662
|
deepseek.model("deepseek-v4-flash", {
|
|
21474
21663
|
name: "DeepSeek V4 Flash",
|
|
21475
21664
|
ctx: 1e6,
|
|
21665
|
+
maxOut: 384e3,
|
|
21476
21666
|
capability: null,
|
|
21477
|
-
price: tokenPrice(0.
|
|
21667
|
+
price: tokenPrice(0.3, 1.2, { cacheRead: 6e-3 }),
|
|
21478
21668
|
on: ["bedrock", "together", "fireworks", "openrouter", "ollama", "local"]
|
|
21479
21669
|
});
|
|
21480
21670
|
deepseek.model("deepseek-v4-pro", {
|
|
21481
21671
|
name: "DeepSeek V4 Pro",
|
|
21482
21672
|
ctx: 1e6,
|
|
21673
|
+
maxOut: 384e3,
|
|
21483
21674
|
capability: "reasoning",
|
|
21484
21675
|
price: tokenPrice(1.32, 3.96, { cacheRead: 0.044 }),
|
|
21485
21676
|
on: ["bedrock", "together", "fireworks", "openrouter"]
|
|
@@ -21526,7 +21717,14 @@ cohere.model("command-r-plus-08-2024", {
|
|
|
21526
21717
|
ctx: 128e3,
|
|
21527
21718
|
maxOut: 4e3,
|
|
21528
21719
|
price: tokenPrice(2.5, 10),
|
|
21529
|
-
|
|
21720
|
+
on: ["bedrock"]
|
|
21721
|
+
});
|
|
21722
|
+
cohere.model("command-r-plus-04-2024", {
|
|
21723
|
+
name: "Command R+ (04-2024)",
|
|
21724
|
+
seen: "discovered",
|
|
21725
|
+
ctx: 128e3,
|
|
21726
|
+
maxOut: 4e3,
|
|
21727
|
+
price: tokenPrice(3, 15),
|
|
21530
21728
|
aliases: ["command-r-plus"],
|
|
21531
21729
|
on: ["bedrock"]
|
|
21532
21730
|
});
|
|
@@ -21594,6 +21792,65 @@ var mistral = vendor("mistral", {
|
|
|
21594
21792
|
retention: "unknown",
|
|
21595
21793
|
defaultHosting: "local"
|
|
21596
21794
|
});
|
|
21795
|
+
var MISTRAL_API = { defaultHosting: "api" };
|
|
21796
|
+
mistral.model("mistral-large-4", {
|
|
21797
|
+
...MISTRAL_API,
|
|
21798
|
+
name: "Mistral Large 4",
|
|
21799
|
+
ctx: 1e6,
|
|
21800
|
+
capability: null,
|
|
21801
|
+
// Public preview at a sale rate; the published original is 1.36 / 4.18 / 0.14.
|
|
21802
|
+
price: tokenPrice(0.68, 2.09, { cacheRead: 0.07 })
|
|
21803
|
+
});
|
|
21804
|
+
mistral.model("mistral-large-2512", {
|
|
21805
|
+
...MISTRAL_API,
|
|
21806
|
+
name: "Mistral Large 3",
|
|
21807
|
+
ctx: 256e3,
|
|
21808
|
+
capability: null,
|
|
21809
|
+
price: tokenPrice(0.5, 1.5, { cacheRead: 0.05 })
|
|
21810
|
+
});
|
|
21811
|
+
mistral.model("mistral-medium-3-5", {
|
|
21812
|
+
...MISTRAL_API,
|
|
21813
|
+
name: "Mistral Medium 3.5",
|
|
21814
|
+
ctx: 256e3,
|
|
21815
|
+
capability: null,
|
|
21816
|
+
price: tokenPrice(1.5, 7.5, { cacheRead: 0.15 })
|
|
21817
|
+
});
|
|
21818
|
+
mistral.model("mistral-small-2603", {
|
|
21819
|
+
...MISTRAL_API,
|
|
21820
|
+
name: "Mistral Small 4",
|
|
21821
|
+
ctx: 256e3,
|
|
21822
|
+
capability: null,
|
|
21823
|
+
price: tokenPrice(0.15, 0.6, { cacheRead: 0.015 })
|
|
21824
|
+
});
|
|
21825
|
+
mistral.model("ministral-14b-2512", {
|
|
21826
|
+
...MISTRAL_API,
|
|
21827
|
+
name: "Ministral 3 14B",
|
|
21828
|
+
ctx: 256e3,
|
|
21829
|
+
capability: null,
|
|
21830
|
+
price: tokenPrice(0.2, 0.2, { cacheRead: 0.02 })
|
|
21831
|
+
});
|
|
21832
|
+
mistral.model("ministral-8b-2512", {
|
|
21833
|
+
...MISTRAL_API,
|
|
21834
|
+
name: "Ministral 3 8B",
|
|
21835
|
+
ctx: 256e3,
|
|
21836
|
+
capability: null,
|
|
21837
|
+
price: tokenPrice(0.15, 0.15, { cacheRead: 0.015 })
|
|
21838
|
+
});
|
|
21839
|
+
mistral.model("ministral-3b-2512", {
|
|
21840
|
+
...MISTRAL_API,
|
|
21841
|
+
name: "Ministral 3 3B",
|
|
21842
|
+
ctx: 256e3,
|
|
21843
|
+
capability: null,
|
|
21844
|
+
price: tokenPrice(0.1, 0.1, { cacheRead: 0.01 })
|
|
21845
|
+
});
|
|
21846
|
+
mistral.model("codestral-2508", {
|
|
21847
|
+
...MISTRAL_API,
|
|
21848
|
+
name: "Codestral",
|
|
21849
|
+
ctx: 128e3,
|
|
21850
|
+
capability: "code",
|
|
21851
|
+
openWeights: false,
|
|
21852
|
+
price: tokenPrice(0.3, 0.9, { cacheRead: 0.03 })
|
|
21853
|
+
});
|
|
21597
21854
|
mistral.model("mixtral-8x7b", {
|
|
21598
21855
|
name: "Mixtral 8x7B",
|
|
21599
21856
|
seen: "discovered",
|
|
@@ -21757,11 +22014,14 @@ var COMPACT = new Intl.NumberFormat("en-US", {
|
|
|
21757
22014
|
// ../../packages/schema/src/token/token-report.ts
|
|
21758
22015
|
var num = (value) => value ?? 0;
|
|
21759
22016
|
function costUsageOf(a, promptTokens) {
|
|
22017
|
+
const write1h = num(a.ephemeral_1h_input_tokens);
|
|
22018
|
+
const write5m = num(a.ephemeral_5m_input_tokens);
|
|
22019
|
+
const unsplit = Math.max(num(a.cache_creation_input_tokens) - write1h - write5m, 0);
|
|
21760
22020
|
const usage = {
|
|
21761
22021
|
inputTokens: num(a.input_tokens),
|
|
21762
22022
|
outputTokens: num(a.output_tokens),
|
|
21763
|
-
cacheWrite1hTokens:
|
|
21764
|
-
cacheWrite5mTokens:
|
|
22023
|
+
cacheWrite1hTokens: write1h,
|
|
22024
|
+
cacheWrite5mTokens: write5m + unsplit,
|
|
21765
22025
|
cacheReadTokens: num(a.cache_read_input_tokens),
|
|
21766
22026
|
webSearchRequests: num(a.web_search_requests)
|
|
21767
22027
|
};
|
|
@@ -22548,6 +22808,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
22548
22808
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
22549
22809
|
// repeated rather than referenced because a store reader opens this file.
|
|
22550
22810
|
redact_degraded_to: ActionTaken.optional(),
|
|
22811
|
+
// Why a capture has no content and no findings: its field was refused
|
|
22812
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
22813
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
22814
|
+
// reader can tell a refused row from an empty clean one.
|
|
22815
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
22551
22816
|
// The scope key this capture was stamped with: the canonical repository
|
|
22552
22817
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
22553
22818
|
// against its working directory), else of its own working directory, or a
|
|
@@ -23889,7 +24154,19 @@ var EventMetadata = external_exports.object({
|
|
|
23889
24154
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
23890
24155
|
// Closing either means moving the reason onto the finding row, which
|
|
23891
24156
|
// already carries its own action.
|
|
23892
|
-
redactDegradedTo: ActionTaken.optional()
|
|
24157
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
24158
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
24159
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
24160
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
24161
|
+
// field instead of letting it through unscanned.
|
|
24162
|
+
//
|
|
24163
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
24164
|
+
// - 'unavailable': no worker could run it.
|
|
24165
|
+
//
|
|
24166
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
24167
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
24168
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
24169
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
23893
24170
|
}).meta({ id: "EventMetadata" });
|
|
23894
24171
|
var Event = external_exports.object({
|
|
23895
24172
|
id: external_exports.guid(),
|
|
@@ -25706,6 +25983,7 @@ function toCaptureAttributes(event) {
|
|
|
25706
25983
|
...metadata?.exceptionIds !== void 0 ? { exception_ids: metadata.exceptionIds } : {},
|
|
25707
25984
|
...metadata?.inspectionMs !== void 0 ? { inspection_ms: metadata.inspectionMs } : {},
|
|
25708
25985
|
...metadata?.redactDegradedTo !== void 0 ? { redact_degraded_to: metadata.redactDegradedTo } : {},
|
|
25986
|
+
...metadata?.scanIncomplete !== void 0 ? { scan_incomplete: metadata.scanIncomplete } : {},
|
|
25709
25987
|
// `model`/`turnIndex` have no dedicated CaptureAttributes field (no writer
|
|
25710
25988
|
// has ever populated either), but every legacy metadata key still rides
|
|
25711
25989
|
// the bag rather than being silently dropped — CaptureAttributes'
|
|
@@ -28695,7 +28973,8 @@ var TIMELINE_COLUMNS = `
|
|
|
28695
28973
|
json_extract(attributes, '$.internal') AS internal,
|
|
28696
28974
|
json_extract(attributes, '$.flagged') AS flagged`;
|
|
28697
28975
|
var CALL_PROMPT_TOKENS = `(coalesce(input_tokens, 0) + coalesce(cache_read_input_tokens, 0)
|
|
28698
|
-
+ coalesce(
|
|
28976
|
+
+ max(coalesce(cache_creation_input_tokens, 0),
|
|
28977
|
+
coalesce(ephemeral_1h_input_tokens, 0) + coalesce(ephemeral_5m_input_tokens, 0)))`;
|
|
28699
28978
|
var CALL_BAND = LONG_CONTEXT_THRESHOLDS.length === 0 ? "0" : LONG_CONTEXT_THRESHOLDS.map((t) => `(${CALL_PROMPT_TOKENS} > ${String(Math.trunc(t))})`).join(
|
|
28700
28979
|
" + "
|
|
28701
28980
|
);
|
|
@@ -38657,6 +38936,42 @@ function worstProbeMs(rule, now = wallClock, corroborate) {
|
|
|
38657
38936
|
}
|
|
38658
38937
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
38659
38938
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
38939
|
+
function repeatTo(unit, length) {
|
|
38940
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
38941
|
+
}
|
|
38942
|
+
function joinTo(length, open3, close, item) {
|
|
38943
|
+
const parts = [];
|
|
38944
|
+
let size = open3.length;
|
|
38945
|
+
for (let i = 0; size < length; i++) {
|
|
38946
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
38947
|
+
parts.push(next);
|
|
38948
|
+
size += next.length;
|
|
38949
|
+
}
|
|
38950
|
+
return (open3 + parts.join("") + close).slice(0, length);
|
|
38951
|
+
}
|
|
38952
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
38953
|
+
var GROWTH_CORPORA = [
|
|
38954
|
+
{
|
|
38955
|
+
name: "one-line JSON dictionary",
|
|
38956
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
38957
|
+
},
|
|
38958
|
+
{
|
|
38959
|
+
name: "JSON array of quoted SQL keywords",
|
|
38960
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
38961
|
+
},
|
|
38962
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
38963
|
+
{
|
|
38964
|
+
name: 'double-quoted keyword literal run ("where" )',
|
|
38965
|
+
build: (length) => repeatTo('"where" ', length)
|
|
38966
|
+
},
|
|
38967
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
38968
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
38969
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
38970
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
38971
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
38972
|
+
build: (length) => repeatTo(unit, length)
|
|
38973
|
+
}))
|
|
38974
|
+
];
|
|
38660
38975
|
function checkRuleTiming(rule, corroborate) {
|
|
38661
38976
|
const { ms, probe, corroboratedMs } = worstProbeMs(rule, wallClock, corroborate);
|
|
38662
38977
|
const work = corroboratedMs ?? 0;
|
|
@@ -38958,7 +39273,7 @@ var auth_jwt_no_verify_default = {
|
|
|
38958
39273
|
severity: "critical",
|
|
38959
39274
|
matcher: {
|
|
38960
39275
|
type: "regex",
|
|
38961
|
-
pattern: "(verify\\s*=\\s*false|verify_signature
|
|
39276
|
+
pattern: "(verify\\s*=\\s*false|verify_signature(?:(?!verify_signature).)*false|algorithms\\s*=\\s*\\[\\])",
|
|
38962
39277
|
flags: "gi"
|
|
38963
39278
|
},
|
|
38964
39279
|
requiresNearby: {
|
|
@@ -39046,7 +39361,7 @@ var cmd_inject_shell_default = {
|
|
|
39046
39361
|
severity: "critical",
|
|
39047
39362
|
matcher: {
|
|
39048
39363
|
type: "regex",
|
|
39049
|
-
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\([^)]*shell\\s*=\\s*True",
|
|
39364
|
+
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\((?:(?!subprocess\\.(?:run|Popen|call|check_output)\\s*\\()[^)])*shell\\s*=\\s*True",
|
|
39050
39365
|
flags: "gi"
|
|
39051
39366
|
},
|
|
39052
39367
|
requiresNearby: {
|
|
@@ -39175,7 +39490,7 @@ var deser_yaml_unsafe_default = {
|
|
|
39175
39490
|
severity: "high",
|
|
39176
39491
|
matcher: {
|
|
39177
39492
|
type: "regex",
|
|
39178
|
-
pattern: "\\byaml\\.load\\s*\\((?![^)]
|
|
39493
|
+
pattern: "\\byaml\\.load\\s*\\((?!(?:(?!yaml\\.load\\s*\\()[^)])*?(?:SafeLoader|safe_load))",
|
|
39179
39494
|
flags: "gi"
|
|
39180
39495
|
},
|
|
39181
39496
|
examples: ["data = yaml.load(user_input)", "config = yaml.load(f)"],
|
|
@@ -39392,7 +39707,7 @@ var sql_inject_concat_dot_default = {
|
|
|
39392
39707
|
severity: "high",
|
|
39393
39708
|
matcher: {
|
|
39394
39709
|
type: "regex",
|
|
39395
|
-
pattern: `["'][
|
|
39710
|
+
pattern: `["'](?=([^"'\\n]*?(?:select|insert|update|delete|drop|where)))\\1(?:(?!["'][^"'\\n]*?(?:select|insert|update|delete|drop|where))[^\\n])*?["']\\s*\\.`,
|
|
39396
39711
|
flags: "gi"
|
|
39397
39712
|
},
|
|
39398
39713
|
appliesTo: {
|
|
@@ -39410,7 +39725,7 @@ var sql_inject_concat_default = {
|
|
|
39410
39725
|
severity: "high",
|
|
39411
39726
|
matcher: {
|
|
39412
39727
|
type: "regex",
|
|
39413
|
-
pattern: `["']\\s*(?:select\\b[^\\n]*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b[^\\n]*?=)[^\\n]*?["']\\s*\\+`,
|
|
39728
|
+
pattern: `(["'])\\s*(?=(select\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?=))\\2(?:(?!\\1\\s*(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b))[^\\n])*?["']\\s*\\+`,
|
|
39414
39729
|
flags: "gi"
|
|
39415
39730
|
},
|
|
39416
39731
|
examples: ['"SELECT * FROM users WHERE id = " + userId']
|
|
@@ -39425,7 +39740,7 @@ var sql_inject_format_default = {
|
|
|
39425
39740
|
severity: "high",
|
|
39426
39741
|
matcher: {
|
|
39427
39742
|
type: "regex",
|
|
39428
|
-
pattern: "\\b(?:select\\b[^\\n]*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b|where\\b[^\\n]*?=)[^\\n]*?(?:[%][sd]|\\{[^}]+\\})",
|
|
39743
|
+
pattern: "\\b(?=(select\\b(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))[^\\n])*?\\bfrom\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))\\1(?:(?!\\b(?:select\\b|insert\\s+into\\b|update\\s+\\S+\\s+set\\b|delete\\s+from\\b|drop\\s+(?:table|database)\\b))[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})|\\b(?=(where\\b(?:(?!\\bwhere\\b)[^\\n])*?=))\\2(?:(?!\\bwhere\\b)[^\\n])*?(?:[%][sd]|\\{[^{}\\n]+\\})",
|
|
39429
39744
|
flags: "gi"
|
|
39430
39745
|
},
|
|
39431
39746
|
examples: [
|
|
@@ -39443,7 +39758,7 @@ var sql_inject_interp_default = {
|
|
|
39443
39758
|
severity: "high",
|
|
39444
39759
|
matcher: {
|
|
39445
39760
|
type: "regex",
|
|
39446
|
-
pattern: "(select|insert|update|delete|where)[^\\n]*?(#\\{|\\$[a-z_])",
|
|
39761
|
+
pattern: "(select|insert|update|delete|where)(?:(?!(?:select|insert|update|delete|where))[^\\n])*?(#\\{|\\$[a-z_])",
|
|
39447
39762
|
flags: "gi"
|
|
39448
39763
|
},
|
|
39449
39764
|
examples: [
|
|
@@ -39818,7 +40133,7 @@ var stack_trace_default = {
|
|
|
39818
40133
|
severity: "low",
|
|
39819
40134
|
matcher: {
|
|
39820
40135
|
type: "regex",
|
|
39821
|
-
pattern: "(
|
|
40136
|
+
pattern: "(?:^|(?<!\\s)\\s+)at\\s+[A-Za-z0-9._$<>]+\\.[A-Za-z0-9_$]+\\s*\\([A-Za-z0-9._\\-/:]+:\\d+:\\d+\\)",
|
|
39822
40137
|
flags: "g"
|
|
39823
40138
|
},
|
|
39824
40139
|
examples: ["at com.example.service.UserService.findUser(UserService.java:42:13)"]
|
|
@@ -40976,7 +41291,7 @@ var BUNDLED_PACKS = [
|
|
|
40976
41291
|
{
|
|
40977
41292
|
packId: "code-flaws",
|
|
40978
41293
|
name: "Code Security Flaws",
|
|
40979
|
-
version: "0.1.
|
|
41294
|
+
version: "0.1.2",
|
|
40980
41295
|
rawRules: [
|
|
40981
41296
|
sql_inject_concat_default,
|
|
40982
41297
|
sql_inject_concat_dot_default,
|
|
@@ -41026,7 +41341,7 @@ var BUNDLED_PACKS = [
|
|
|
41026
41341
|
{
|
|
41027
41342
|
packId: "core-code-context",
|
|
41028
41343
|
name: "Code Context",
|
|
41029
|
-
version: "0.2.
|
|
41344
|
+
version: "0.2.2",
|
|
41030
41345
|
rawRules: [
|
|
41031
41346
|
internal_ip_default,
|
|
41032
41347
|
localhost_ref_default,
|
|
@@ -41495,9 +41810,10 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41495
41810
|
if (job.timer !== void 0) return;
|
|
41496
41811
|
job.startedAt = performance.now();
|
|
41497
41812
|
job.progressAt = job.startedAt;
|
|
41813
|
+
const budget = job.deadlineAt === void 0 ? job.budgetMs : Math.max(0, Math.min(job.budgetMs, job.deadlineAt - job.startedAt));
|
|
41498
41814
|
job.timer = setTimeout(() => {
|
|
41499
41815
|
onDeadline(job);
|
|
41500
|
-
},
|
|
41816
|
+
}, budget);
|
|
41501
41817
|
}
|
|
41502
41818
|
function runOne(spec, fail) {
|
|
41503
41819
|
if (closed) {
|
|
@@ -41508,6 +41824,12 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41508
41824
|
fail({ status: "unavailable", reason: `the scan worker crashed: ${broken}` });
|
|
41509
41825
|
return;
|
|
41510
41826
|
}
|
|
41827
|
+
const now = performance.now();
|
|
41828
|
+
const deadlineAt = spec.deadlineAt;
|
|
41829
|
+
if (deadlineAt !== void 0 && deadlineAt <= now) {
|
|
41830
|
+
fail({ status: "timeout", culpritIndex: void 0, elapsedMs: 0 });
|
|
41831
|
+
return;
|
|
41832
|
+
}
|
|
41511
41833
|
const started = ensureWorker();
|
|
41512
41834
|
if (!(started instanceof Worker)) {
|
|
41513
41835
|
broken = started.error;
|
|
@@ -41515,11 +41837,11 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41515
41837
|
return;
|
|
41516
41838
|
}
|
|
41517
41839
|
const id = nextJobId++;
|
|
41518
|
-
const now = performance.now();
|
|
41519
41840
|
const job = {
|
|
41520
41841
|
id,
|
|
41521
41842
|
worker: started,
|
|
41522
41843
|
budgetMs: spec.budgetMs,
|
|
41844
|
+
deadlineAt,
|
|
41523
41845
|
startedAt: now,
|
|
41524
41846
|
progressIndex: -1,
|
|
41525
41847
|
progressAt: now,
|
|
@@ -41533,14 +41855,19 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41533
41855
|
if (readyWorker === started) {
|
|
41534
41856
|
beginDeadline(job);
|
|
41535
41857
|
} else {
|
|
41858
|
+
const startBudget = spec.startBudgetMs ?? startBudgetMs;
|
|
41859
|
+
const callerLimited = deadlineAt !== void 0 && deadlineAt - now < startBudget;
|
|
41860
|
+
const startWaitMs = callerLimited ? deadlineAt - now : startBudget;
|
|
41536
41861
|
job.startupTimer = setTimeout(() => {
|
|
41537
41862
|
if (pending !== job) return;
|
|
41538
41863
|
kill(job.worker);
|
|
41539
|
-
failPending(
|
|
41540
|
-
status: "
|
|
41541
|
-
|
|
41542
|
-
|
|
41543
|
-
|
|
41864
|
+
failPending(
|
|
41865
|
+
callerLimited ? { status: "timeout", culpritIndex: void 0, elapsedMs: performance.now() - now } : {
|
|
41866
|
+
status: "unavailable",
|
|
41867
|
+
reason: `the scan worker did not start within ${String(startBudget)}ms`
|
|
41868
|
+
}
|
|
41869
|
+
);
|
|
41870
|
+
}, startWaitMs);
|
|
41544
41871
|
}
|
|
41545
41872
|
try {
|
|
41546
41873
|
started.postMessage(spec.build(id));
|
|
@@ -41569,7 +41896,9 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41569
41896
|
return enqueue((resolve4) => {
|
|
41570
41897
|
runOne(
|
|
41571
41898
|
{
|
|
41572
|
-
budgetMs,
|
|
41899
|
+
budgetMs: scanOpts?.budgetMs ?? budgetMs,
|
|
41900
|
+
startBudgetMs: scanOpts?.startBudgetMs,
|
|
41901
|
+
deadlineAt: scanOpts?.deadlineAt,
|
|
41573
41902
|
build: (id) => ({
|
|
41574
41903
|
kind: "scan",
|
|
41575
41904
|
id,
|
|
@@ -41763,6 +42092,9 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
41763
42092
|
let unverified = partition.unverified;
|
|
41764
42093
|
let isolated = unverified.length > 0 ? createIsolatedScanner({ verified, unverified }, opts) : void 0;
|
|
41765
42094
|
let retired = false;
|
|
42095
|
+
let bounded;
|
|
42096
|
+
let boundedWarned = false;
|
|
42097
|
+
let closed = false;
|
|
41766
42098
|
function inProcess(text, context) {
|
|
41767
42099
|
return scan(text, verified, context);
|
|
41768
42100
|
}
|
|
@@ -41824,11 +42156,48 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
41824
42156
|
await degrade();
|
|
41825
42157
|
return inProcess(text, context);
|
|
41826
42158
|
}
|
|
42159
|
+
async function scanBounded(text, context, bound) {
|
|
42160
|
+
const remainingMs = bound.remainingMs;
|
|
42161
|
+
let outcome;
|
|
42162
|
+
if (closed) {
|
|
42163
|
+
outcome = { status: "unavailable", reason: "the scan worker is closed" };
|
|
42164
|
+
} else if (remainingMs !== void 0 && !(remainingMs > 0)) {
|
|
42165
|
+
outcome = { status: "timeout", culpritIndex: void 0, elapsedMs: 0 };
|
|
42166
|
+
} else {
|
|
42167
|
+
bounded ??= createIsolatedScanner({ verified, unverified }, opts);
|
|
42168
|
+
const deadlineAt = remainingMs === void 0 ? void 0 : performance.now() + remainingMs;
|
|
42169
|
+
try {
|
|
42170
|
+
outcome = await bounded.scan(text, context, {
|
|
42171
|
+
budgetMs: bound.budgetMs,
|
|
42172
|
+
startBudgetMs: bound.startBudgetMs,
|
|
42173
|
+
deadlineAt
|
|
42174
|
+
});
|
|
42175
|
+
} catch (error62) {
|
|
42176
|
+
outcome = {
|
|
42177
|
+
status: "unavailable",
|
|
42178
|
+
reason: error62 instanceof Error ? error62.message : "the scan worker failed unexpectedly"
|
|
42179
|
+
};
|
|
42180
|
+
}
|
|
42181
|
+
}
|
|
42182
|
+
if (outcome.status !== "ok" && !boundedWarned) {
|
|
42183
|
+
boundedWarned = true;
|
|
42184
|
+
process.stderr.write(
|
|
42185
|
+
outcome.status === "timeout" ? `[aka] a large input could not be scanned within its time limit and was refused.
|
|
42186
|
+
` : `[aka] a large input could not be scanned and was refused: ${outcome.reason}.
|
|
42187
|
+
`
|
|
42188
|
+
);
|
|
42189
|
+
}
|
|
42190
|
+
return outcome;
|
|
42191
|
+
}
|
|
41827
42192
|
return {
|
|
41828
42193
|
scan: guardedScan,
|
|
42194
|
+
scanBounded,
|
|
41829
42195
|
degraded: () => retired,
|
|
41830
42196
|
async close() {
|
|
41831
|
-
|
|
42197
|
+
closed = true;
|
|
42198
|
+
const live = bounded;
|
|
42199
|
+
bounded = void 0;
|
|
42200
|
+
await Promise.all([retire(), live?.close()]);
|
|
41832
42201
|
}
|
|
41833
42202
|
};
|
|
41834
42203
|
}
|
|
@@ -41984,6 +42353,16 @@ function conditionsMatch(conditions, ctx) {
|
|
|
41984
42353
|
if (conditions.provider !== void 0) return false;
|
|
41985
42354
|
return true;
|
|
41986
42355
|
}
|
|
42356
|
+
function readRemainingMs(largeInput) {
|
|
42357
|
+
const read = largeInput.remainingMs;
|
|
42358
|
+
if (read === void 0) return void 0;
|
|
42359
|
+
try {
|
|
42360
|
+
const remaining = read();
|
|
42361
|
+
return typeof remaining !== "number" || Number.isNaN(remaining) ? 0 : remaining;
|
|
42362
|
+
} catch {
|
|
42363
|
+
return 0;
|
|
42364
|
+
}
|
|
42365
|
+
}
|
|
41987
42366
|
var bundlesPacked = false;
|
|
41988
42367
|
function createPluginRuntime(gateway, settings, opts) {
|
|
41989
42368
|
if (!bundlesPacked) {
|
|
@@ -41993,6 +42372,7 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
41993
42372
|
const policyMode = settings.policy;
|
|
41994
42373
|
let redactFallback = settings.redactFallback;
|
|
41995
42374
|
const dataDir2 = opts?.dataDir;
|
|
42375
|
+
const largeInput = opts?.largeInput;
|
|
41996
42376
|
let rules = [];
|
|
41997
42377
|
let evidenceOf = evidenceLookup(rules);
|
|
41998
42378
|
let scanner;
|
|
@@ -42205,7 +42585,24 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
42205
42585
|
await ensureInitialized();
|
|
42206
42586
|
if (!scanner) throw new Error("the runtime initialized without a scanner");
|
|
42207
42587
|
const shielded = shieldPointers(text);
|
|
42208
|
-
|
|
42588
|
+
let matched;
|
|
42589
|
+
if (largeInput !== void 0 && shielded.text.length >= largeInput.thresholdChars) {
|
|
42590
|
+
const outcome = await scanner.scanBounded(shielded.text, context, {
|
|
42591
|
+
budgetMs: largeInput.budgetMs,
|
|
42592
|
+
startBudgetMs: largeInput.startBudgetMs,
|
|
42593
|
+
remainingMs: readRemainingMs(largeInput)
|
|
42594
|
+
});
|
|
42595
|
+
if (outcome.status !== "ok") {
|
|
42596
|
+
return {
|
|
42597
|
+
decision: { action: "block", text: null, findings: [], scanIncomplete: outcome.status },
|
|
42598
|
+
excepted: /* @__PURE__ */ new Set(),
|
|
42599
|
+
exceptionIds: []
|
|
42600
|
+
};
|
|
42601
|
+
}
|
|
42602
|
+
matched = outcome.findings;
|
|
42603
|
+
} else {
|
|
42604
|
+
matched = await scanner.scan(shielded.text, context);
|
|
42605
|
+
}
|
|
42209
42606
|
const findings = dropShieldedFindings(matched, shielded.spans);
|
|
42210
42607
|
const fpCache = /* @__PURE__ */ new Map();
|
|
42211
42608
|
const { excepted, exceptionIds } = await applyExceptions(findings, ctx, fpCache);
|
|
@@ -42246,20 +42643,24 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
42246
42643
|
}
|
|
42247
42644
|
async function persistCapture(input2, opts2, { decision, excepted, exceptionIds, timingStartedAt }) {
|
|
42248
42645
|
const filePath = input2.metadata?.filePath;
|
|
42249
|
-
if (opts2.persist === "with-findings" && decision.findings.length === 0)
|
|
42646
|
+
if (opts2.persist === "with-findings" && decision.findings.length === 0 && decision.scanIncomplete === void 0) {
|
|
42647
|
+
return;
|
|
42648
|
+
}
|
|
42250
42649
|
try {
|
|
42251
42650
|
const contentHash = contentHashOf(input2.text);
|
|
42252
42651
|
const maskedFindings = decision.findings.filter(
|
|
42253
42652
|
(match) => isActionAtLeast(actionForFinding(match, excepted, opts2.rewritable), "redact")
|
|
42254
42653
|
);
|
|
42255
|
-
const storedContent = maskedFindings.length > 0 ? redact(input2.text, maskedFindings) : input2.text;
|
|
42654
|
+
const storedContent = decision.scanIncomplete !== void 0 ? "" : maskedFindings.length > 0 ? redact(input2.text, maskedFindings) : input2.text;
|
|
42256
42655
|
const inspectionMs = elapsedMs(timingStartedAt);
|
|
42257
42656
|
const redactDegradedTo = decision.redactDegradedTo;
|
|
42258
|
-
const
|
|
42657
|
+
const scanIncomplete = decision.scanIncomplete;
|
|
42658
|
+
const metadata = exceptionIds.length > 0 || inspectionMs !== void 0 || redactDegradedTo !== void 0 || scanIncomplete !== void 0 ? {
|
|
42259
42659
|
...input2.metadata,
|
|
42260
42660
|
...exceptionIds.length > 0 ? { exceptionIds } : {},
|
|
42261
42661
|
...inspectionMs !== void 0 ? { inspectionMs } : {},
|
|
42262
|
-
...redactDegradedTo !== void 0 ? { redactDegradedTo } : {}
|
|
42662
|
+
...redactDegradedTo !== void 0 ? { redactDegradedTo } : {},
|
|
42663
|
+
...scanIncomplete !== void 0 ? { scanIncomplete } : {}
|
|
42263
42664
|
} : input2.metadata;
|
|
42264
42665
|
const event = buildIngestEvent({
|
|
42265
42666
|
kind: input2.kind,
|
|
@@ -43936,6 +44337,7 @@ var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
|
43936
44337
|
var TRACE_ID = EventMetadata.shape.traceId;
|
|
43937
44338
|
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
43938
44339
|
var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
44340
|
+
var SCAN_INCOMPLETE = EventMetadata.shape.scanIncomplete.unwrap();
|
|
43939
44341
|
|
|
43940
44342
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
43941
44343
|
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|