@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/session-start.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 === SLASH4 && 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)) {
|
|
@@ -20723,7 +20726,10 @@ function date4(params) {
|
|
|
20723
20726
|
var LongContextTier = external_exports.object({
|
|
20724
20727
|
thresholdInputTokens: external_exports.number().int().positive(),
|
|
20725
20728
|
input: external_exports.number().nonnegative().nullable(),
|
|
20726
|
-
output: external_exports.number().nonnegative().nullable()
|
|
20729
|
+
output: external_exports.number().nonnegative().nullable(),
|
|
20730
|
+
cacheRead: external_exports.number().nonnegative().nullable().optional(),
|
|
20731
|
+
cacheWrite5m: external_exports.number().nonnegative().nullable().optional(),
|
|
20732
|
+
cacheWrite1h: external_exports.number().nonnegative().nullable().optional()
|
|
20727
20733
|
});
|
|
20728
20734
|
var ModelPrice = external_exports.object({
|
|
20729
20735
|
/** USD per 1M uncached input tokens, at or below any long-context threshold. */
|
|
@@ -20732,7 +20738,8 @@ var ModelPrice = external_exports.object({
|
|
|
20732
20738
|
output: external_exports.number().nonnegative(),
|
|
20733
20739
|
/**
|
|
20734
20740
|
* Rate band above a size threshold, or `null` when the model is flat-rated.
|
|
20735
|
-
*
|
|
20741
|
+
* OpenAI, Google, xAI and some Anthropic models (Haiku 5.5) band; most
|
|
20742
|
+
* Claude models are flat across their window.
|
|
20736
20743
|
*/
|
|
20737
20744
|
longContext: LongContextTier.nullable(),
|
|
20738
20745
|
/** USD per 1M tokens written to a 5-minute ephemeral cache, or null if unpriced. */
|
|
@@ -20745,18 +20752,35 @@ var ModelPrice = external_exports.object({
|
|
|
20745
20752
|
webSearch: external_exports.number().nonnegative().nullable()
|
|
20746
20753
|
});
|
|
20747
20754
|
var WEB_SEARCH_PER_REQUEST = 0.01;
|
|
20748
|
-
function anthropicPrice(input2, output2, cacheRead) {
|
|
20755
|
+
function anthropicPrice(input2, output2, cacheRead, longContext = null) {
|
|
20749
20756
|
return Object.freeze({
|
|
20750
20757
|
input: input2,
|
|
20751
20758
|
output: output2,
|
|
20752
|
-
longContext: null,
|
|
20753
|
-
// flat across the full window on every current Claude
|
|
20759
|
+
longContext: longContext === null ? null : Object.freeze(longContext),
|
|
20754
20760
|
cacheWrite5m: input2 * 1.25,
|
|
20755
20761
|
cacheWrite1h: input2 * 2,
|
|
20756
20762
|
cacheRead,
|
|
20757
20763
|
webSearch: WEB_SEARCH_PER_REQUEST
|
|
20758
20764
|
});
|
|
20759
20765
|
}
|
|
20766
|
+
function anthropicBand(thresholdInputTokens, input2, output2, cacheRead) {
|
|
20767
|
+
return {
|
|
20768
|
+
thresholdInputTokens,
|
|
20769
|
+
input: input2,
|
|
20770
|
+
output: output2,
|
|
20771
|
+
cacheRead,
|
|
20772
|
+
cacheWrite5m: input2 * 1.25,
|
|
20773
|
+
cacheWrite1h: input2 * 2
|
|
20774
|
+
};
|
|
20775
|
+
}
|
|
20776
|
+
function scaledBand(thresholdInputTokens, base, scale) {
|
|
20777
|
+
return {
|
|
20778
|
+
thresholdInputTokens,
|
|
20779
|
+
input: base.input * scale.input,
|
|
20780
|
+
output: base.output * scale.output,
|
|
20781
|
+
...base.cacheRead === void 0 ? {} : { cacheRead: base.cacheRead * scale.cacheRead }
|
|
20782
|
+
};
|
|
20783
|
+
}
|
|
20760
20784
|
function tokenPrice(input2, output2, options = {}) {
|
|
20761
20785
|
return Object.freeze({
|
|
20762
20786
|
input: input2,
|
|
@@ -20789,17 +20813,19 @@ function serviceTierMultiplier(tier) {
|
|
|
20789
20813
|
function promptTokensOf(usage) {
|
|
20790
20814
|
return usage.promptTokens ?? (usage.inputTokens ?? 0) + (usage.cacheReadTokens ?? 0) + (usage.cacheWrite1hTokens ?? 0) + (usage.cacheWrite5mTokens ?? 0);
|
|
20791
20815
|
}
|
|
20816
|
+
function bandRate(column, base) {
|
|
20817
|
+
return column === void 0 ? base : column;
|
|
20818
|
+
}
|
|
20792
20819
|
function costOf(price, usage) {
|
|
20820
|
+
const band = price.longContext !== null && promptTokensOf(usage) > price.longContext.thresholdInputTokens ? price.longContext : null;
|
|
20793
20821
|
const metered = [
|
|
20794
|
-
[usage.
|
|
20795
|
-
[usage.
|
|
20796
|
-
[usage.
|
|
20822
|
+
[usage.inputTokens ?? 0, bandRate(band?.input, price.input)],
|
|
20823
|
+
[usage.outputTokens ?? 0, bandRate(band?.output, price.output)],
|
|
20824
|
+
[usage.cacheWrite1hTokens ?? 0, bandRate(band?.cacheWrite1h, price.cacheWrite1h)],
|
|
20825
|
+
[usage.cacheWrite5mTokens ?? 0, bandRate(band?.cacheWrite5m, price.cacheWrite5m)],
|
|
20826
|
+
[usage.cacheReadTokens ?? 0, bandRate(band?.cacheRead, price.cacheRead)]
|
|
20797
20827
|
];
|
|
20798
|
-
|
|
20799
|
-
if (band !== null && (band.input === null || band.output === null)) return null;
|
|
20800
|
-
const inputRate = band?.input ?? price.input;
|
|
20801
|
-
const outputRate = band?.output ?? price.output;
|
|
20802
|
-
let tokenCost = (usage.inputTokens ?? 0) * inputRate + (usage.outputTokens ?? 0) * outputRate;
|
|
20828
|
+
let tokenCost = 0;
|
|
20803
20829
|
for (const [tokens, rate] of metered) {
|
|
20804
20830
|
if (tokens === 0) continue;
|
|
20805
20831
|
if (rate === null) return null;
|
|
@@ -21089,10 +21115,20 @@ anthropic.model("claude-fable-5-1", {
|
|
|
21089
21115
|
});
|
|
21090
21116
|
anthropic.model("claude-fable-5", {
|
|
21091
21117
|
name: "Claude Fable 5",
|
|
21118
|
+
ctx: 1e6,
|
|
21119
|
+
maxOut: 128e3,
|
|
21092
21120
|
capability: "reasoning",
|
|
21093
21121
|
price: anthropicPrice(10, 50, 1),
|
|
21094
21122
|
on: [...CLAUDE_RESELLERS]
|
|
21095
21123
|
});
|
|
21124
|
+
anthropic.model("claude-opus-5-5", {
|
|
21125
|
+
name: "Claude Opus 5.5",
|
|
21126
|
+
ctx: 1e6,
|
|
21127
|
+
maxOut: 128e3,
|
|
21128
|
+
capability: "reasoning",
|
|
21129
|
+
price: anthropicPrice(4, 20, 0.2),
|
|
21130
|
+
on: [...CLAUDE_RESELLERS]
|
|
21131
|
+
});
|
|
21096
21132
|
anthropic.model("claude-opus-5", {
|
|
21097
21133
|
name: "Claude Opus 5",
|
|
21098
21134
|
ctx: 1e6,
|
|
@@ -21103,24 +21139,32 @@ anthropic.model("claude-opus-5", {
|
|
|
21103
21139
|
});
|
|
21104
21140
|
anthropic.model("claude-opus-4-8", {
|
|
21105
21141
|
name: "Claude Opus 4.8",
|
|
21142
|
+
ctx: 1e6,
|
|
21143
|
+
maxOut: 128e3,
|
|
21106
21144
|
capability: "reasoning",
|
|
21107
21145
|
price: anthropicPrice(5, 25, 0.5),
|
|
21108
21146
|
on: [...CLAUDE_RESELLERS]
|
|
21109
21147
|
});
|
|
21110
21148
|
anthropic.model("claude-opus-4-7", {
|
|
21111
21149
|
name: "Claude Opus 4.7",
|
|
21150
|
+
ctx: 1e6,
|
|
21151
|
+
maxOut: 128e3,
|
|
21112
21152
|
capability: "reasoning",
|
|
21113
21153
|
price: anthropicPrice(5, 25, 0.5),
|
|
21114
21154
|
on: [...CLAUDE_RESELLERS]
|
|
21115
21155
|
});
|
|
21116
21156
|
anthropic.model("claude-opus-4-6", {
|
|
21117
21157
|
name: "Claude Opus 4.6",
|
|
21158
|
+
ctx: 1e6,
|
|
21159
|
+
maxOut: 128e3,
|
|
21118
21160
|
capability: "reasoning",
|
|
21119
21161
|
price: anthropicPrice(5, 25, 0.5),
|
|
21120
21162
|
on: [...CLAUDE_RESELLERS]
|
|
21121
21163
|
});
|
|
21122
21164
|
anthropic.model("claude-opus-4-5", {
|
|
21123
21165
|
name: "Claude Opus 4.5",
|
|
21166
|
+
ctx: 2e5,
|
|
21167
|
+
maxOut: 64e3,
|
|
21124
21168
|
capability: "reasoning",
|
|
21125
21169
|
price: anthropicPrice(5, 25, 0.5),
|
|
21126
21170
|
on: [...CLAUDE_RESELLERS]
|
|
@@ -21131,6 +21175,14 @@ anthropic.model("claude-opus-4-1", {
|
|
|
21131
21175
|
price: anthropicPrice(15, 75, 1.5),
|
|
21132
21176
|
on: [...CLAUDE_RESELLERS]
|
|
21133
21177
|
});
|
|
21178
|
+
anthropic.model("claude-sonnet-5-5", {
|
|
21179
|
+
name: "Claude Sonnet 5.5",
|
|
21180
|
+
ctx: 1e6,
|
|
21181
|
+
maxOut: 128e3,
|
|
21182
|
+
capability: "reasoning",
|
|
21183
|
+
price: anthropicPrice(2, 10, 0.1),
|
|
21184
|
+
on: [...CLAUDE_RESELLERS]
|
|
21185
|
+
});
|
|
21134
21186
|
anthropic.model("claude-sonnet-5", {
|
|
21135
21187
|
name: "Claude Sonnet 5",
|
|
21136
21188
|
ctx: 1e6,
|
|
@@ -21141,16 +21193,30 @@ anthropic.model("claude-sonnet-5", {
|
|
|
21141
21193
|
});
|
|
21142
21194
|
anthropic.model("claude-sonnet-4-6", {
|
|
21143
21195
|
name: "Claude Sonnet 4.6",
|
|
21196
|
+
ctx: 1e6,
|
|
21197
|
+
maxOut: 128e3,
|
|
21144
21198
|
capability: "reasoning",
|
|
21145
21199
|
price: anthropicPrice(3, 15, 0.3),
|
|
21146
21200
|
on: [...CLAUDE_RESELLERS]
|
|
21147
21201
|
});
|
|
21148
21202
|
anthropic.model("claude-sonnet-4-5", {
|
|
21149
21203
|
name: "Claude Sonnet 4.5",
|
|
21204
|
+
ctx: 2e5,
|
|
21205
|
+
maxOut: 64e3,
|
|
21150
21206
|
capability: "reasoning",
|
|
21151
21207
|
price: anthropicPrice(3, 15, 0.3),
|
|
21152
21208
|
on: [...CLAUDE_RESELLERS]
|
|
21153
21209
|
});
|
|
21210
|
+
anthropic.model("claude-haiku-5-5", {
|
|
21211
|
+
name: "Claude Haiku 5.5",
|
|
21212
|
+
ctx: 1e6,
|
|
21213
|
+
maxOut: 128e3,
|
|
21214
|
+
capability: null,
|
|
21215
|
+
// A prompt over 100,000 tokens, cache reads and writes included, bills the
|
|
21216
|
+
// whole request at the higher band.
|
|
21217
|
+
price: anthropicPrice(0.1, 0.5, 0.01, anthropicBand(1e5, 0.5, 2.5, 0.05)),
|
|
21218
|
+
on: [...CLAUDE_RESELLERS]
|
|
21219
|
+
});
|
|
21154
21220
|
anthropic.model("claude-haiku-4-5", {
|
|
21155
21221
|
name: "Claude Haiku 4.5",
|
|
21156
21222
|
ctx: 2e5,
|
|
@@ -21173,7 +21239,13 @@ var OPENAI_TRAINING = {
|
|
|
21173
21239
|
consumerControl: "opt-out",
|
|
21174
21240
|
source: "https://developers.openai.com/api/docs/guides/your-data"
|
|
21175
21241
|
};
|
|
21176
|
-
|
|
21242
|
+
function gptPrice(input2, output2, cacheRead) {
|
|
21243
|
+
const base = { input: input2, output: output2, ...cacheRead === void 0 ? {} : { cacheRead } };
|
|
21244
|
+
return tokenPrice(input2, output2, {
|
|
21245
|
+
...base,
|
|
21246
|
+
longContext: scaledBand(272e3, base, { input: 2, output: 1.5, cacheRead: 2 })
|
|
21247
|
+
});
|
|
21248
|
+
}
|
|
21177
21249
|
var openai = vendor("openai", {
|
|
21178
21250
|
family: { id: "gpt", name: "GPT" },
|
|
21179
21251
|
region: "us",
|
|
@@ -21181,12 +21253,45 @@ var openai = vendor("openai", {
|
|
|
21181
21253
|
training: OPENAI_TRAINING
|
|
21182
21254
|
});
|
|
21183
21255
|
var OPENAI_RESELLERS = ["azure", "foundry"];
|
|
21256
|
+
openai.model("gpt-6-astra", {
|
|
21257
|
+
name: "GPT-6 Astra",
|
|
21258
|
+
ctx: 105e4,
|
|
21259
|
+
maxOut: 128e3,
|
|
21260
|
+
capability: "reasoning",
|
|
21261
|
+
price: gptPrice(10, 50, 1),
|
|
21262
|
+
on: [...OPENAI_RESELLERS]
|
|
21263
|
+
});
|
|
21264
|
+
openai.model("gpt-6.1-sol", {
|
|
21265
|
+
name: "GPT-6.1 Sol",
|
|
21266
|
+
ctx: 105e4,
|
|
21267
|
+
maxOut: 128e3,
|
|
21268
|
+
capability: "reasoning",
|
|
21269
|
+
price: gptPrice(2, 10, 0.1),
|
|
21270
|
+
on: [...OPENAI_RESELLERS]
|
|
21271
|
+
});
|
|
21272
|
+
openai.model("gpt-6-sol", {
|
|
21273
|
+
name: "GPT-6 Sol",
|
|
21274
|
+
ctx: 105e4,
|
|
21275
|
+
maxOut: 128e3,
|
|
21276
|
+
capability: "reasoning",
|
|
21277
|
+
price: gptPrice(2, 10, 0.2),
|
|
21278
|
+
on: [...OPENAI_RESELLERS]
|
|
21279
|
+
});
|
|
21280
|
+
openai.model("gpt-6-luna", {
|
|
21281
|
+
name: "GPT-6 Luna",
|
|
21282
|
+
ctx: 105e4,
|
|
21283
|
+
maxOut: 128e3,
|
|
21284
|
+
capability: null,
|
|
21285
|
+
price: gptPrice(0.1, 0.5, 0.01),
|
|
21286
|
+
on: [...OPENAI_RESELLERS]
|
|
21287
|
+
});
|
|
21184
21288
|
openai.model("gpt-5.6-sol", {
|
|
21185
21289
|
name: "GPT-5.6 Sol",
|
|
21290
|
+
// Promotional rate, published as available at least through 2026-11-21.
|
|
21186
21291
|
ctx: 105e4,
|
|
21187
21292
|
maxOut: 128e3,
|
|
21188
21293
|
capability: "reasoning",
|
|
21189
|
-
price:
|
|
21294
|
+
price: gptPrice(4, 20, 0.4),
|
|
21190
21295
|
on: [...OPENAI_RESELLERS]
|
|
21191
21296
|
});
|
|
21192
21297
|
openai.model("gpt-5.6-terra", {
|
|
@@ -21194,7 +21299,7 @@ openai.model("gpt-5.6-terra", {
|
|
|
21194
21299
|
ctx: 105e4,
|
|
21195
21300
|
maxOut: 128e3,
|
|
21196
21301
|
capability: "reasoning",
|
|
21197
|
-
price:
|
|
21302
|
+
price: gptPrice(2, 12, 0.2),
|
|
21198
21303
|
on: [...OPENAI_RESELLERS]
|
|
21199
21304
|
});
|
|
21200
21305
|
openai.model("gpt-5.6-luna", {
|
|
@@ -21202,7 +21307,7 @@ openai.model("gpt-5.6-luna", {
|
|
|
21202
21307
|
ctx: 105e4,
|
|
21203
21308
|
maxOut: 128e3,
|
|
21204
21309
|
capability: null,
|
|
21205
|
-
price:
|
|
21310
|
+
price: gptPrice(0.2, 1.2, 0.02),
|
|
21206
21311
|
on: [...OPENAI_RESELLERS]
|
|
21207
21312
|
});
|
|
21208
21313
|
openai.model("gpt-5.5", {
|
|
@@ -21210,7 +21315,15 @@ openai.model("gpt-5.5", {
|
|
|
21210
21315
|
ctx: 105e4,
|
|
21211
21316
|
maxOut: 128e3,
|
|
21212
21317
|
capability: "reasoning",
|
|
21213
|
-
price:
|
|
21318
|
+
price: gptPrice(5, 30, 0.5),
|
|
21319
|
+
on: [...OPENAI_RESELLERS]
|
|
21320
|
+
});
|
|
21321
|
+
openai.model("gpt-5.5-pro", {
|
|
21322
|
+
name: "GPT-5.5 Pro",
|
|
21323
|
+
ctx: 105e4,
|
|
21324
|
+
maxOut: 128e3,
|
|
21325
|
+
capability: "reasoning",
|
|
21326
|
+
price: gptPrice(30, 180),
|
|
21214
21327
|
on: [...OPENAI_RESELLERS]
|
|
21215
21328
|
});
|
|
21216
21329
|
openai.model("gpt-5.4", {
|
|
@@ -21218,7 +21331,7 @@ openai.model("gpt-5.4", {
|
|
|
21218
21331
|
ctx: 105e4,
|
|
21219
21332
|
maxOut: 128e3,
|
|
21220
21333
|
capability: "reasoning",
|
|
21221
|
-
price:
|
|
21334
|
+
price: gptPrice(2.5, 15, 0.25),
|
|
21222
21335
|
on: [...OPENAI_RESELLERS]
|
|
21223
21336
|
});
|
|
21224
21337
|
openai.model("gpt-5.4-mini", {
|
|
@@ -21264,6 +21377,7 @@ openai.model("gpt-5", {
|
|
|
21264
21377
|
openai.model("gpt-5-mini", {
|
|
21265
21378
|
name: "GPT-5 mini",
|
|
21266
21379
|
ctx: 4e5,
|
|
21380
|
+
maxOut: 128e3,
|
|
21267
21381
|
capability: null,
|
|
21268
21382
|
price: tokenPrice(0.25, 2, { cacheRead: 0.025 }),
|
|
21269
21383
|
on: [...OPENAI_RESELLERS]
|
|
@@ -21278,11 +21392,15 @@ openai.model("gpt-5-nano", {
|
|
|
21278
21392
|
});
|
|
21279
21393
|
openai.model("gpt-4.1", {
|
|
21280
21394
|
name: "GPT-4.1",
|
|
21395
|
+
ctx: 1047576,
|
|
21396
|
+
maxOut: 32768,
|
|
21281
21397
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
21282
21398
|
on: [...OPENAI_RESELLERS]
|
|
21283
21399
|
});
|
|
21284
21400
|
openai.model("gpt-4o", {
|
|
21285
21401
|
name: "GPT-4o",
|
|
21402
|
+
ctx: 128e3,
|
|
21403
|
+
maxOut: 16384,
|
|
21286
21404
|
price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
|
|
21287
21405
|
on: [...OPENAI_RESELLERS]
|
|
21288
21406
|
});
|
|
@@ -21306,6 +21424,8 @@ openai.model("gpt-4-turbo", {
|
|
|
21306
21424
|
});
|
|
21307
21425
|
openai.model("o3", {
|
|
21308
21426
|
name: "o3",
|
|
21427
|
+
ctx: 2e5,
|
|
21428
|
+
maxOut: 1e5,
|
|
21309
21429
|
capability: "reasoning",
|
|
21310
21430
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
21311
21431
|
on: [...OPENAI_RESELLERS]
|
|
@@ -21358,57 +21478,100 @@ var google = vendor("google", {
|
|
|
21358
21478
|
retention: "configurable",
|
|
21359
21479
|
training: GOOGLE_TRAINING
|
|
21360
21480
|
});
|
|
21481
|
+
google.model("gemini-3.8-flash", {
|
|
21482
|
+
name: "Gemini 3.8 Flash",
|
|
21483
|
+
ctx: 1048576,
|
|
21484
|
+
maxOut: 65536,
|
|
21485
|
+
capability: null,
|
|
21486
|
+
price: tokenPrice(0.75, 3.75, { cacheRead: 0.075 }),
|
|
21487
|
+
on: ["vertex"]
|
|
21488
|
+
});
|
|
21361
21489
|
google.model("gemini-3.7-flash", {
|
|
21362
21490
|
name: "Gemini 3.7 Flash",
|
|
21363
21491
|
capability: null,
|
|
21364
|
-
// Promotional rate; the published post-promotion rate is 1.50 / 7.50.
|
|
21365
21492
|
price: tokenPrice(0.75, 3.75),
|
|
21366
21493
|
on: ["vertex"]
|
|
21367
21494
|
});
|
|
21368
21495
|
google.model("gemini-3.6-flash", {
|
|
21369
21496
|
name: "Gemini 3.6 Flash",
|
|
21497
|
+
ctx: 1048576,
|
|
21498
|
+
maxOut: 65536,
|
|
21370
21499
|
capability: null,
|
|
21371
|
-
price: tokenPrice(0.75, 3.75),
|
|
21500
|
+
price: tokenPrice(0.75, 3.75, { cacheRead: 0.075 }),
|
|
21372
21501
|
on: ["vertex"]
|
|
21373
21502
|
});
|
|
21374
21503
|
google.model("gemini-3.5-flash", {
|
|
21375
21504
|
name: "Gemini 3.5 Flash",
|
|
21376
21505
|
capability: null,
|
|
21377
|
-
price: tokenPrice(1.5, 9),
|
|
21378
21506
|
on: ["vertex"]
|
|
21379
21507
|
});
|
|
21380
21508
|
google.model("gemini-3.5-flash-lite", {
|
|
21381
21509
|
name: "Gemini 3.5 Flash Lite",
|
|
21510
|
+
ctx: 1048576,
|
|
21511
|
+
maxOut: 65536,
|
|
21512
|
+
capability: null,
|
|
21513
|
+
price: tokenPrice(0.3, 2.5, { cacheRead: 0.03 }),
|
|
21514
|
+
on: ["vertex"]
|
|
21515
|
+
});
|
|
21516
|
+
google.model("gemini-3.1-flash-lite", {
|
|
21517
|
+
name: "Gemini 3.1 Flash Lite",
|
|
21518
|
+
ctx: 1048576,
|
|
21519
|
+
maxOut: 65536,
|
|
21520
|
+
capability: null,
|
|
21521
|
+
price: tokenPrice(0.25, 1.5, { cacheRead: 0.025 }),
|
|
21522
|
+
on: ["vertex"]
|
|
21523
|
+
});
|
|
21524
|
+
google.model("gemini-3-flash-preview", {
|
|
21525
|
+
name: "Gemini 3 Flash Preview",
|
|
21526
|
+
ctx: 1048576,
|
|
21527
|
+
maxOut: 65536,
|
|
21382
21528
|
capability: null,
|
|
21383
|
-
price: tokenPrice(0.3,
|
|
21529
|
+
price: tokenPrice(0.5, 3, { cacheRead: 0.05 }),
|
|
21384
21530
|
on: ["vertex"]
|
|
21385
21531
|
});
|
|
21386
21532
|
google.model("gemini-3.1-pro-preview", {
|
|
21387
21533
|
name: "Gemini 3.1 Pro Preview",
|
|
21534
|
+
ctx: 1048576,
|
|
21535
|
+
maxOut: 65536,
|
|
21388
21536
|
capability: "reasoning",
|
|
21389
21537
|
price: tokenPrice(2, 12, {
|
|
21390
|
-
|
|
21538
|
+
cacheRead: 0.2,
|
|
21539
|
+
longContext: { thresholdInputTokens: 2e5, input: 4, output: 18, cacheRead: 0.4 }
|
|
21391
21540
|
}),
|
|
21541
|
+
aliases: ["gemini-3.1-pro-preview-customtools"],
|
|
21392
21542
|
on: ["vertex"]
|
|
21393
21543
|
});
|
|
21394
21544
|
google.model("gemini-2.5-pro", {
|
|
21395
21545
|
name: "Gemini 2.5 Pro",
|
|
21546
|
+
ctx: 1048576,
|
|
21547
|
+
maxOut: 65536,
|
|
21396
21548
|
capability: "reasoning",
|
|
21397
21549
|
price: tokenPrice(1.25, 10, {
|
|
21398
|
-
|
|
21550
|
+
cacheRead: 0.125,
|
|
21551
|
+
longContext: { thresholdInputTokens: 2e5, input: 2.5, output: 15, cacheRead: 0.25 }
|
|
21399
21552
|
}),
|
|
21400
21553
|
on: ["vertex"]
|
|
21401
21554
|
});
|
|
21402
21555
|
google.model("gemini-2.5-flash", {
|
|
21403
21556
|
name: "Gemini 2.5 Flash",
|
|
21557
|
+
ctx: 1048576,
|
|
21558
|
+
maxOut: 65536,
|
|
21404
21559
|
capability: null,
|
|
21405
|
-
price: tokenPrice(0.3, 2.5),
|
|
21560
|
+
price: tokenPrice(0.3, 2.5, { cacheRead: 0.03 }),
|
|
21406
21561
|
on: ["vertex"]
|
|
21407
21562
|
});
|
|
21408
21563
|
google.model("gemini-2.5-flash-lite", {
|
|
21409
21564
|
name: "Gemini 2.5 Flash Lite",
|
|
21565
|
+
ctx: 1048576,
|
|
21566
|
+
maxOut: 65536,
|
|
21410
21567
|
capability: null,
|
|
21411
|
-
price: tokenPrice(0.1, 0.4),
|
|
21568
|
+
price: tokenPrice(0.1, 0.4, { cacheRead: 0.01 }),
|
|
21569
|
+
on: ["vertex"]
|
|
21570
|
+
});
|
|
21571
|
+
google.model("gemini-embedding-2", {
|
|
21572
|
+
name: "Gemini Embedding 2",
|
|
21573
|
+
capability: "embedding",
|
|
21574
|
+
price: tokenPrice(0.2, 0),
|
|
21412
21575
|
on: ["vertex"]
|
|
21413
21576
|
});
|
|
21414
21577
|
google.model("gemini-1-5-pro", { name: "Gemini 1.5 Pro", on: ["vertex"] });
|
|
@@ -21424,43 +21587,62 @@ var xai = vendor("xai", {
|
|
|
21424
21587
|
source: "https://docs.x.ai/developers/faq/security"
|
|
21425
21588
|
}
|
|
21426
21589
|
});
|
|
21590
|
+
function grokPrice(input2, output2, cacheRead) {
|
|
21591
|
+
const base = { input: input2, output: output2, cacheRead };
|
|
21592
|
+
return tokenPrice(input2, output2, {
|
|
21593
|
+
cacheRead,
|
|
21594
|
+
longContext: scaledBand(2e5, base, { input: 2, output: 2, cacheRead: 2 })
|
|
21595
|
+
});
|
|
21596
|
+
}
|
|
21597
|
+
xai.model("grok-4.7", {
|
|
21598
|
+
name: "Grok 4.7",
|
|
21599
|
+
ctx: 5e5,
|
|
21600
|
+
capability: "reasoning",
|
|
21601
|
+
price: grokPrice(2, 6, 0.5)
|
|
21602
|
+
});
|
|
21427
21603
|
xai.model("grok-4.6", {
|
|
21428
21604
|
name: "Grok 4.6",
|
|
21429
21605
|
ctx: 5e5,
|
|
21430
21606
|
capability: "reasoning",
|
|
21431
|
-
price:
|
|
21432
|
-
cacheRead: 0.5,
|
|
21433
|
-
longContext: { thresholdInputTokens: 2e5, input: 4, output: 12 }
|
|
21434
|
-
}),
|
|
21607
|
+
price: grokPrice(2, 6, 0.5),
|
|
21435
21608
|
on: ["bedrock"]
|
|
21436
21609
|
});
|
|
21437
21610
|
xai.model("grok-4.5", {
|
|
21438
21611
|
name: "Grok 4.5",
|
|
21439
21612
|
ctx: 5e5,
|
|
21440
21613
|
capability: "reasoning",
|
|
21441
|
-
price:
|
|
21442
|
-
cacheRead: 0.3,
|
|
21443
|
-
longContext: { thresholdInputTokens: 2e5, input: 4, output: 12 }
|
|
21444
|
-
})
|
|
21614
|
+
price: grokPrice(2, 6, 0.3)
|
|
21445
21615
|
});
|
|
21446
21616
|
xai.model("grok-4.3", {
|
|
21447
21617
|
name: "Grok 4.3",
|
|
21448
21618
|
ctx: 1e6,
|
|
21449
21619
|
capability: "reasoning",
|
|
21450
|
-
price:
|
|
21451
|
-
cacheRead: 0.2,
|
|
21452
|
-
longContext: { thresholdInputTokens: 2e5, input: 2.5, output: 5 }
|
|
21453
|
-
}),
|
|
21620
|
+
price: grokPrice(1.25, 2.5, 0.2),
|
|
21454
21621
|
on: ["bedrock"]
|
|
21455
21622
|
});
|
|
21623
|
+
xai.model("grok-4.20-0309-reasoning", {
|
|
21624
|
+
name: "Grok 4.20 Reasoning",
|
|
21625
|
+
capability: "reasoning",
|
|
21626
|
+
ctx: 1e6,
|
|
21627
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
21628
|
+
});
|
|
21629
|
+
xai.model("grok-4.20-0309-non-reasoning", {
|
|
21630
|
+
name: "Grok 4.20",
|
|
21631
|
+
capability: null,
|
|
21632
|
+
ctx: 1e6,
|
|
21633
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
21634
|
+
});
|
|
21635
|
+
xai.model("grok-4.20-multi-agent-0309", {
|
|
21636
|
+
name: "Grok 4.20 Multi-Agent",
|
|
21637
|
+
capability: "reasoning",
|
|
21638
|
+
ctx: 1e6,
|
|
21639
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
21640
|
+
});
|
|
21456
21641
|
xai.model("grok-build-0.1", {
|
|
21457
21642
|
name: "Grok Build 0.1",
|
|
21458
21643
|
ctx: 256e3,
|
|
21459
21644
|
capability: "code",
|
|
21460
|
-
price:
|
|
21461
|
-
cacheRead: 0.2,
|
|
21462
|
-
longContext: { thresholdInputTokens: 2e5, input: 2, output: 4 }
|
|
21463
|
-
})
|
|
21645
|
+
price: grokPrice(1, 2, 0.2)
|
|
21464
21646
|
});
|
|
21465
21647
|
var deepseek = vendor("deepseek", {
|
|
21466
21648
|
family: { id: "deepseek", name: "DeepSeek" },
|
|
@@ -21473,16 +21655,25 @@ var deepseek = vendor("deepseek", {
|
|
|
21473
21655
|
source: "https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html"
|
|
21474
21656
|
}
|
|
21475
21657
|
});
|
|
21658
|
+
deepseek.model("deepseek-flash", {
|
|
21659
|
+
name: "DeepSeek V4.1 Flash",
|
|
21660
|
+
ctx: 1e6,
|
|
21661
|
+
maxOut: 384e3,
|
|
21662
|
+
capability: null,
|
|
21663
|
+
price: tokenPrice(0.3, 1.2, { cacheRead: 6e-3 })
|
|
21664
|
+
});
|
|
21476
21665
|
deepseek.model("deepseek-v4-flash", {
|
|
21477
21666
|
name: "DeepSeek V4 Flash",
|
|
21478
21667
|
ctx: 1e6,
|
|
21668
|
+
maxOut: 384e3,
|
|
21479
21669
|
capability: null,
|
|
21480
|
-
price: tokenPrice(0.
|
|
21670
|
+
price: tokenPrice(0.3, 1.2, { cacheRead: 6e-3 }),
|
|
21481
21671
|
on: ["bedrock", "together", "fireworks", "openrouter", "ollama", "local"]
|
|
21482
21672
|
});
|
|
21483
21673
|
deepseek.model("deepseek-v4-pro", {
|
|
21484
21674
|
name: "DeepSeek V4 Pro",
|
|
21485
21675
|
ctx: 1e6,
|
|
21676
|
+
maxOut: 384e3,
|
|
21486
21677
|
capability: "reasoning",
|
|
21487
21678
|
price: tokenPrice(1.32, 3.96, { cacheRead: 0.044 }),
|
|
21488
21679
|
on: ["bedrock", "together", "fireworks", "openrouter"]
|
|
@@ -21529,7 +21720,14 @@ cohere.model("command-r-plus-08-2024", {
|
|
|
21529
21720
|
ctx: 128e3,
|
|
21530
21721
|
maxOut: 4e3,
|
|
21531
21722
|
price: tokenPrice(2.5, 10),
|
|
21532
|
-
|
|
21723
|
+
on: ["bedrock"]
|
|
21724
|
+
});
|
|
21725
|
+
cohere.model("command-r-plus-04-2024", {
|
|
21726
|
+
name: "Command R+ (04-2024)",
|
|
21727
|
+
seen: "discovered",
|
|
21728
|
+
ctx: 128e3,
|
|
21729
|
+
maxOut: 4e3,
|
|
21730
|
+
price: tokenPrice(3, 15),
|
|
21533
21731
|
aliases: ["command-r-plus"],
|
|
21534
21732
|
on: ["bedrock"]
|
|
21535
21733
|
});
|
|
@@ -21597,6 +21795,65 @@ var mistral = vendor("mistral", {
|
|
|
21597
21795
|
retention: "unknown",
|
|
21598
21796
|
defaultHosting: "local"
|
|
21599
21797
|
});
|
|
21798
|
+
var MISTRAL_API = { defaultHosting: "api" };
|
|
21799
|
+
mistral.model("mistral-large-4", {
|
|
21800
|
+
...MISTRAL_API,
|
|
21801
|
+
name: "Mistral Large 4",
|
|
21802
|
+
ctx: 1e6,
|
|
21803
|
+
capability: null,
|
|
21804
|
+
// Public preview at a sale rate; the published original is 1.36 / 4.18 / 0.14.
|
|
21805
|
+
price: tokenPrice(0.68, 2.09, { cacheRead: 0.07 })
|
|
21806
|
+
});
|
|
21807
|
+
mistral.model("mistral-large-2512", {
|
|
21808
|
+
...MISTRAL_API,
|
|
21809
|
+
name: "Mistral Large 3",
|
|
21810
|
+
ctx: 256e3,
|
|
21811
|
+
capability: null,
|
|
21812
|
+
price: tokenPrice(0.5, 1.5, { cacheRead: 0.05 })
|
|
21813
|
+
});
|
|
21814
|
+
mistral.model("mistral-medium-3-5", {
|
|
21815
|
+
...MISTRAL_API,
|
|
21816
|
+
name: "Mistral Medium 3.5",
|
|
21817
|
+
ctx: 256e3,
|
|
21818
|
+
capability: null,
|
|
21819
|
+
price: tokenPrice(1.5, 7.5, { cacheRead: 0.15 })
|
|
21820
|
+
});
|
|
21821
|
+
mistral.model("mistral-small-2603", {
|
|
21822
|
+
...MISTRAL_API,
|
|
21823
|
+
name: "Mistral Small 4",
|
|
21824
|
+
ctx: 256e3,
|
|
21825
|
+
capability: null,
|
|
21826
|
+
price: tokenPrice(0.15, 0.6, { cacheRead: 0.015 })
|
|
21827
|
+
});
|
|
21828
|
+
mistral.model("ministral-14b-2512", {
|
|
21829
|
+
...MISTRAL_API,
|
|
21830
|
+
name: "Ministral 3 14B",
|
|
21831
|
+
ctx: 256e3,
|
|
21832
|
+
capability: null,
|
|
21833
|
+
price: tokenPrice(0.2, 0.2, { cacheRead: 0.02 })
|
|
21834
|
+
});
|
|
21835
|
+
mistral.model("ministral-8b-2512", {
|
|
21836
|
+
...MISTRAL_API,
|
|
21837
|
+
name: "Ministral 3 8B",
|
|
21838
|
+
ctx: 256e3,
|
|
21839
|
+
capability: null,
|
|
21840
|
+
price: tokenPrice(0.15, 0.15, { cacheRead: 0.015 })
|
|
21841
|
+
});
|
|
21842
|
+
mistral.model("ministral-3b-2512", {
|
|
21843
|
+
...MISTRAL_API,
|
|
21844
|
+
name: "Ministral 3 3B",
|
|
21845
|
+
ctx: 256e3,
|
|
21846
|
+
capability: null,
|
|
21847
|
+
price: tokenPrice(0.1, 0.1, { cacheRead: 0.01 })
|
|
21848
|
+
});
|
|
21849
|
+
mistral.model("codestral-2508", {
|
|
21850
|
+
...MISTRAL_API,
|
|
21851
|
+
name: "Codestral",
|
|
21852
|
+
ctx: 128e3,
|
|
21853
|
+
capability: "code",
|
|
21854
|
+
openWeights: false,
|
|
21855
|
+
price: tokenPrice(0.3, 0.9, { cacheRead: 0.03 })
|
|
21856
|
+
});
|
|
21600
21857
|
mistral.model("mixtral-8x7b", {
|
|
21601
21858
|
name: "Mixtral 8x7B",
|
|
21602
21859
|
seen: "discovered",
|
|
@@ -21760,11 +22017,14 @@ var COMPACT = new Intl.NumberFormat("en-US", {
|
|
|
21760
22017
|
// ../../packages/schema/src/token/token-report.ts
|
|
21761
22018
|
var num = (value) => value ?? 0;
|
|
21762
22019
|
function costUsageOf(a, promptTokens) {
|
|
22020
|
+
const write1h = num(a.ephemeral_1h_input_tokens);
|
|
22021
|
+
const write5m = num(a.ephemeral_5m_input_tokens);
|
|
22022
|
+
const unsplit = Math.max(num(a.cache_creation_input_tokens) - write1h - write5m, 0);
|
|
21763
22023
|
const usage = {
|
|
21764
22024
|
inputTokens: num(a.input_tokens),
|
|
21765
22025
|
outputTokens: num(a.output_tokens),
|
|
21766
|
-
cacheWrite1hTokens:
|
|
21767
|
-
cacheWrite5mTokens:
|
|
22026
|
+
cacheWrite1hTokens: write1h,
|
|
22027
|
+
cacheWrite5mTokens: write5m + unsplit,
|
|
21768
22028
|
cacheReadTokens: num(a.cache_read_input_tokens),
|
|
21769
22029
|
webSearchRequests: num(a.web_search_requests)
|
|
21770
22030
|
};
|
|
@@ -22554,6 +22814,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
22554
22814
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
22555
22815
|
// repeated rather than referenced because a store reader opens this file.
|
|
22556
22816
|
redact_degraded_to: ActionTaken.optional(),
|
|
22817
|
+
// Why a capture has no content and no findings: its field was refused
|
|
22818
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
22819
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
22820
|
+
// reader can tell a refused row from an empty clean one.
|
|
22821
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
22557
22822
|
// The scope key this capture was stamped with: the canonical repository
|
|
22558
22823
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
22559
22824
|
// against its working directory), else of its own working directory, or a
|
|
@@ -24009,7 +24274,19 @@ var EventMetadata = external_exports.object({
|
|
|
24009
24274
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
24010
24275
|
// Closing either means moving the reason onto the finding row, which
|
|
24011
24276
|
// already carries its own action.
|
|
24012
|
-
redactDegradedTo: ActionTaken.optional()
|
|
24277
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
24278
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
24279
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
24280
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
24281
|
+
// field instead of letting it through unscanned.
|
|
24282
|
+
//
|
|
24283
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
24284
|
+
// - 'unavailable': no worker could run it.
|
|
24285
|
+
//
|
|
24286
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
24287
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
24288
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
24289
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
24013
24290
|
}).meta({ id: "EventMetadata" });
|
|
24014
24291
|
var Event = external_exports.object({
|
|
24015
24292
|
id: external_exports.guid(),
|
|
@@ -25829,6 +26106,7 @@ function toCaptureAttributes(event) {
|
|
|
25829
26106
|
...metadata?.exceptionIds !== void 0 ? { exception_ids: metadata.exceptionIds } : {},
|
|
25830
26107
|
...metadata?.inspectionMs !== void 0 ? { inspection_ms: metadata.inspectionMs } : {},
|
|
25831
26108
|
...metadata?.redactDegradedTo !== void 0 ? { redact_degraded_to: metadata.redactDegradedTo } : {},
|
|
26109
|
+
...metadata?.scanIncomplete !== void 0 ? { scan_incomplete: metadata.scanIncomplete } : {},
|
|
25832
26110
|
// `model`/`turnIndex` have no dedicated CaptureAttributes field (no writer
|
|
25833
26111
|
// has ever populated either), but every legacy metadata key still rides
|
|
25834
26112
|
// the bag rather than being silently dropped — CaptureAttributes'
|
|
@@ -28791,7 +29069,8 @@ var TIMELINE_COLUMNS = `
|
|
|
28791
29069
|
json_extract(attributes, '$.internal') AS internal,
|
|
28792
29070
|
json_extract(attributes, '$.flagged') AS flagged`;
|
|
28793
29071
|
var CALL_PROMPT_TOKENS = `(coalesce(input_tokens, 0) + coalesce(cache_read_input_tokens, 0)
|
|
28794
|
-
+ coalesce(
|
|
29072
|
+
+ max(coalesce(cache_creation_input_tokens, 0),
|
|
29073
|
+
coalesce(ephemeral_1h_input_tokens, 0) + coalesce(ephemeral_5m_input_tokens, 0)))`;
|
|
28795
29074
|
var CALL_BAND = LONG_CONTEXT_THRESHOLDS.length === 0 ? "0" : LONG_CONTEXT_THRESHOLDS.map((t) => `(${CALL_PROMPT_TOKENS} > ${String(Math.trunc(t))})`).join(
|
|
28796
29075
|
" + "
|
|
28797
29076
|
);
|
|
@@ -37817,6 +38096,42 @@ function worstProbeMs(rule, now = wallClock, corroborate) {
|
|
|
37817
38096
|
}
|
|
37818
38097
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
37819
38098
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
38099
|
+
function repeatTo(unit, length) {
|
|
38100
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
38101
|
+
}
|
|
38102
|
+
function joinTo(length, open3, close, item) {
|
|
38103
|
+
const parts = [];
|
|
38104
|
+
let size = open3.length;
|
|
38105
|
+
for (let i = 0; size < length; i++) {
|
|
38106
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
38107
|
+
parts.push(next);
|
|
38108
|
+
size += next.length;
|
|
38109
|
+
}
|
|
38110
|
+
return (open3 + parts.join("") + close).slice(0, length);
|
|
38111
|
+
}
|
|
38112
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
38113
|
+
var GROWTH_CORPORA = [
|
|
38114
|
+
{
|
|
38115
|
+
name: "one-line JSON dictionary",
|
|
38116
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
38117
|
+
},
|
|
38118
|
+
{
|
|
38119
|
+
name: "JSON array of quoted SQL keywords",
|
|
38120
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
38121
|
+
},
|
|
38122
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
38123
|
+
{
|
|
38124
|
+
name: 'double-quoted keyword literal run ("where" )',
|
|
38125
|
+
build: (length) => repeatTo('"where" ', length)
|
|
38126
|
+
},
|
|
38127
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
38128
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
38129
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
38130
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
38131
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
38132
|
+
build: (length) => repeatTo(unit, length)
|
|
38133
|
+
}))
|
|
38134
|
+
];
|
|
37820
38135
|
function checkRuleTiming(rule, corroborate) {
|
|
37821
38136
|
const { ms, probe, corroboratedMs } = worstProbeMs(rule, wallClock, corroborate);
|
|
37822
38137
|
const work = corroboratedMs ?? 0;
|
|
@@ -38118,7 +38433,7 @@ var auth_jwt_no_verify_default = {
|
|
|
38118
38433
|
severity: "critical",
|
|
38119
38434
|
matcher: {
|
|
38120
38435
|
type: "regex",
|
|
38121
|
-
pattern: "(verify\\s*=\\s*false|verify_signature
|
|
38436
|
+
pattern: "(verify\\s*=\\s*false|verify_signature(?:(?!verify_signature).)*false|algorithms\\s*=\\s*\\[\\])",
|
|
38122
38437
|
flags: "gi"
|
|
38123
38438
|
},
|
|
38124
38439
|
requiresNearby: {
|
|
@@ -38206,7 +38521,7 @@ var cmd_inject_shell_default = {
|
|
|
38206
38521
|
severity: "critical",
|
|
38207
38522
|
matcher: {
|
|
38208
38523
|
type: "regex",
|
|
38209
|
-
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\([^)]*shell\\s*=\\s*True",
|
|
38524
|
+
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\((?:(?!subprocess\\.(?:run|Popen|call|check_output)\\s*\\()[^)])*shell\\s*=\\s*True",
|
|
38210
38525
|
flags: "gi"
|
|
38211
38526
|
},
|
|
38212
38527
|
requiresNearby: {
|
|
@@ -38335,7 +38650,7 @@ var deser_yaml_unsafe_default = {
|
|
|
38335
38650
|
severity: "high",
|
|
38336
38651
|
matcher: {
|
|
38337
38652
|
type: "regex",
|
|
38338
|
-
pattern: "\\byaml\\.load\\s*\\((?![^)]
|
|
38653
|
+
pattern: "\\byaml\\.load\\s*\\((?!(?:(?!yaml\\.load\\s*\\()[^)])*?(?:SafeLoader|safe_load))",
|
|
38339
38654
|
flags: "gi"
|
|
38340
38655
|
},
|
|
38341
38656
|
examples: ["data = yaml.load(user_input)", "config = yaml.load(f)"],
|
|
@@ -38552,7 +38867,7 @@ var sql_inject_concat_dot_default = {
|
|
|
38552
38867
|
severity: "high",
|
|
38553
38868
|
matcher: {
|
|
38554
38869
|
type: "regex",
|
|
38555
|
-
pattern: `["'][
|
|
38870
|
+
pattern: `["'](?=([^"'\\n]*?(?:select|insert|update|delete|drop|where)))\\1(?:(?!["'][^"'\\n]*?(?:select|insert|update|delete|drop|where))[^\\n])*?["']\\s*\\.`,
|
|
38556
38871
|
flags: "gi"
|
|
38557
38872
|
},
|
|
38558
38873
|
appliesTo: {
|
|
@@ -38570,7 +38885,7 @@ var sql_inject_concat_default = {
|
|
|
38570
38885
|
severity: "high",
|
|
38571
38886
|
matcher: {
|
|
38572
38887
|
type: "regex",
|
|
38573
|
-
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*\\+`,
|
|
38888
|
+
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*\\+`,
|
|
38574
38889
|
flags: "gi"
|
|
38575
38890
|
},
|
|
38576
38891
|
examples: ['"SELECT * FROM users WHERE id = " + userId']
|
|
@@ -38585,7 +38900,7 @@ var sql_inject_format_default = {
|
|
|
38585
38900
|
severity: "high",
|
|
38586
38901
|
matcher: {
|
|
38587
38902
|
type: "regex",
|
|
38588
|
-
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]|\\{[^}]+\\})",
|
|
38903
|
+
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]+\\})",
|
|
38589
38904
|
flags: "gi"
|
|
38590
38905
|
},
|
|
38591
38906
|
examples: [
|
|
@@ -38603,7 +38918,7 @@ var sql_inject_interp_default = {
|
|
|
38603
38918
|
severity: "high",
|
|
38604
38919
|
matcher: {
|
|
38605
38920
|
type: "regex",
|
|
38606
|
-
pattern: "(select|insert|update|delete|where)[^\\n]*?(#\\{|\\$[a-z_])",
|
|
38921
|
+
pattern: "(select|insert|update|delete|where)(?:(?!(?:select|insert|update|delete|where))[^\\n])*?(#\\{|\\$[a-z_])",
|
|
38607
38922
|
flags: "gi"
|
|
38608
38923
|
},
|
|
38609
38924
|
examples: [
|
|
@@ -38978,7 +39293,7 @@ var stack_trace_default = {
|
|
|
38978
39293
|
severity: "low",
|
|
38979
39294
|
matcher: {
|
|
38980
39295
|
type: "regex",
|
|
38981
|
-
pattern: "(
|
|
39296
|
+
pattern: "(?:^|(?<!\\s)\\s+)at\\s+[A-Za-z0-9._$<>]+\\.[A-Za-z0-9_$]+\\s*\\([A-Za-z0-9._\\-/:]+:\\d+:\\d+\\)",
|
|
38982
39297
|
flags: "g"
|
|
38983
39298
|
},
|
|
38984
39299
|
examples: ["at com.example.service.UserService.findUser(UserService.java:42:13)"]
|
|
@@ -40136,7 +40451,7 @@ var BUNDLED_PACKS = [
|
|
|
40136
40451
|
{
|
|
40137
40452
|
packId: "code-flaws",
|
|
40138
40453
|
name: "Code Security Flaws",
|
|
40139
|
-
version: "0.1.
|
|
40454
|
+
version: "0.1.2",
|
|
40140
40455
|
rawRules: [
|
|
40141
40456
|
sql_inject_concat_default,
|
|
40142
40457
|
sql_inject_concat_dot_default,
|
|
@@ -40186,7 +40501,7 @@ var BUNDLED_PACKS = [
|
|
|
40186
40501
|
{
|
|
40187
40502
|
packId: "core-code-context",
|
|
40188
40503
|
name: "Code Context",
|
|
40189
|
-
version: "0.2.
|
|
40504
|
+
version: "0.2.2",
|
|
40190
40505
|
rawRules: [
|
|
40191
40506
|
internal_ip_default,
|
|
40192
40507
|
localhost_ref_default,
|
|
@@ -41204,9 +41519,10 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41204
41519
|
if (job.timer !== void 0) return;
|
|
41205
41520
|
job.startedAt = performance.now();
|
|
41206
41521
|
job.progressAt = job.startedAt;
|
|
41522
|
+
const budget = job.deadlineAt === void 0 ? job.budgetMs : Math.max(0, Math.min(job.budgetMs, job.deadlineAt - job.startedAt));
|
|
41207
41523
|
job.timer = setTimeout(() => {
|
|
41208
41524
|
onDeadline(job);
|
|
41209
|
-
},
|
|
41525
|
+
}, budget);
|
|
41210
41526
|
}
|
|
41211
41527
|
function runOne(spec, fail) {
|
|
41212
41528
|
if (closed) {
|
|
@@ -41217,6 +41533,12 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41217
41533
|
fail({ status: "unavailable", reason: `the scan worker crashed: ${broken}` });
|
|
41218
41534
|
return;
|
|
41219
41535
|
}
|
|
41536
|
+
const now = performance.now();
|
|
41537
|
+
const deadlineAt = spec.deadlineAt;
|
|
41538
|
+
if (deadlineAt !== void 0 && deadlineAt <= now) {
|
|
41539
|
+
fail({ status: "timeout", culpritIndex: void 0, elapsedMs: 0 });
|
|
41540
|
+
return;
|
|
41541
|
+
}
|
|
41220
41542
|
const started = ensureWorker();
|
|
41221
41543
|
if (!(started instanceof Worker)) {
|
|
41222
41544
|
broken = started.error;
|
|
@@ -41224,11 +41546,11 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41224
41546
|
return;
|
|
41225
41547
|
}
|
|
41226
41548
|
const id = nextJobId++;
|
|
41227
|
-
const now = performance.now();
|
|
41228
41549
|
const job = {
|
|
41229
41550
|
id,
|
|
41230
41551
|
worker: started,
|
|
41231
41552
|
budgetMs: spec.budgetMs,
|
|
41553
|
+
deadlineAt,
|
|
41232
41554
|
startedAt: now,
|
|
41233
41555
|
progressIndex: -1,
|
|
41234
41556
|
progressAt: now,
|
|
@@ -41242,14 +41564,19 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41242
41564
|
if (readyWorker === started) {
|
|
41243
41565
|
beginDeadline(job);
|
|
41244
41566
|
} else {
|
|
41567
|
+
const startBudget = spec.startBudgetMs ?? startBudgetMs;
|
|
41568
|
+
const callerLimited = deadlineAt !== void 0 && deadlineAt - now < startBudget;
|
|
41569
|
+
const startWaitMs = callerLimited ? deadlineAt - now : startBudget;
|
|
41245
41570
|
job.startupTimer = setTimeout(() => {
|
|
41246
41571
|
if (pending !== job) return;
|
|
41247
41572
|
kill(job.worker);
|
|
41248
|
-
failPending(
|
|
41249
|
-
status: "
|
|
41250
|
-
|
|
41251
|
-
|
|
41252
|
-
|
|
41573
|
+
failPending(
|
|
41574
|
+
callerLimited ? { status: "timeout", culpritIndex: void 0, elapsedMs: performance.now() - now } : {
|
|
41575
|
+
status: "unavailable",
|
|
41576
|
+
reason: `the scan worker did not start within ${String(startBudget)}ms`
|
|
41577
|
+
}
|
|
41578
|
+
);
|
|
41579
|
+
}, startWaitMs);
|
|
41253
41580
|
}
|
|
41254
41581
|
try {
|
|
41255
41582
|
started.postMessage(spec.build(id));
|
|
@@ -41278,7 +41605,9 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
41278
41605
|
return enqueue((resolve3) => {
|
|
41279
41606
|
runOne(
|
|
41280
41607
|
{
|
|
41281
|
-
budgetMs,
|
|
41608
|
+
budgetMs: scanOpts?.budgetMs ?? budgetMs,
|
|
41609
|
+
startBudgetMs: scanOpts?.startBudgetMs,
|
|
41610
|
+
deadlineAt: scanOpts?.deadlineAt,
|
|
41282
41611
|
build: (id) => ({
|
|
41283
41612
|
kind: "scan",
|
|
41284
41613
|
id,
|
|
@@ -43245,6 +43574,7 @@ var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
|
43245
43574
|
var TRACE_ID = EventMetadata.shape.traceId;
|
|
43246
43575
|
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
43247
43576
|
var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
43577
|
+
var SCAN_INCOMPLETE = EventMetadata.shape.scanIncomplete.unwrap();
|
|
43248
43578
|
|
|
43249
43579
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
43250
43580
|
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|