@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
|
@@ -19856,7 +19856,10 @@ function date4(params) {
|
|
|
19856
19856
|
var LongContextTier = external_exports.object({
|
|
19857
19857
|
thresholdInputTokens: external_exports.number().int().positive(),
|
|
19858
19858
|
input: external_exports.number().nonnegative().nullable(),
|
|
19859
|
-
output: external_exports.number().nonnegative().nullable()
|
|
19859
|
+
output: external_exports.number().nonnegative().nullable(),
|
|
19860
|
+
cacheRead: external_exports.number().nonnegative().nullable().optional(),
|
|
19861
|
+
cacheWrite5m: external_exports.number().nonnegative().nullable().optional(),
|
|
19862
|
+
cacheWrite1h: external_exports.number().nonnegative().nullable().optional()
|
|
19860
19863
|
});
|
|
19861
19864
|
var ModelPrice = external_exports.object({
|
|
19862
19865
|
/** USD per 1M uncached input tokens, at or below any long-context threshold. */
|
|
@@ -19865,7 +19868,8 @@ var ModelPrice = external_exports.object({
|
|
|
19865
19868
|
output: external_exports.number().nonnegative(),
|
|
19866
19869
|
/**
|
|
19867
19870
|
* Rate band above a size threshold, or `null` when the model is flat-rated.
|
|
19868
|
-
*
|
|
19871
|
+
* OpenAI, Google, xAI and some Anthropic models (Haiku 5.5) band; most
|
|
19872
|
+
* Claude models are flat across their window.
|
|
19869
19873
|
*/
|
|
19870
19874
|
longContext: LongContextTier.nullable(),
|
|
19871
19875
|
/** USD per 1M tokens written to a 5-minute ephemeral cache, or null if unpriced. */
|
|
@@ -19878,18 +19882,35 @@ var ModelPrice = external_exports.object({
|
|
|
19878
19882
|
webSearch: external_exports.number().nonnegative().nullable()
|
|
19879
19883
|
});
|
|
19880
19884
|
var WEB_SEARCH_PER_REQUEST = 0.01;
|
|
19881
|
-
function anthropicPrice(input2, output2, cacheRead) {
|
|
19885
|
+
function anthropicPrice(input2, output2, cacheRead, longContext = null) {
|
|
19882
19886
|
return Object.freeze({
|
|
19883
19887
|
input: input2,
|
|
19884
19888
|
output: output2,
|
|
19885
|
-
longContext: null,
|
|
19886
|
-
// flat across the full window on every current Claude
|
|
19889
|
+
longContext: longContext === null ? null : Object.freeze(longContext),
|
|
19887
19890
|
cacheWrite5m: input2 * 1.25,
|
|
19888
19891
|
cacheWrite1h: input2 * 2,
|
|
19889
19892
|
cacheRead,
|
|
19890
19893
|
webSearch: WEB_SEARCH_PER_REQUEST
|
|
19891
19894
|
});
|
|
19892
19895
|
}
|
|
19896
|
+
function anthropicBand(thresholdInputTokens, input2, output2, cacheRead) {
|
|
19897
|
+
return {
|
|
19898
|
+
thresholdInputTokens,
|
|
19899
|
+
input: input2,
|
|
19900
|
+
output: output2,
|
|
19901
|
+
cacheRead,
|
|
19902
|
+
cacheWrite5m: input2 * 1.25,
|
|
19903
|
+
cacheWrite1h: input2 * 2
|
|
19904
|
+
};
|
|
19905
|
+
}
|
|
19906
|
+
function scaledBand(thresholdInputTokens, base, scale) {
|
|
19907
|
+
return {
|
|
19908
|
+
thresholdInputTokens,
|
|
19909
|
+
input: base.input * scale.input,
|
|
19910
|
+
output: base.output * scale.output,
|
|
19911
|
+
...base.cacheRead === void 0 ? {} : { cacheRead: base.cacheRead * scale.cacheRead }
|
|
19912
|
+
};
|
|
19913
|
+
}
|
|
19893
19914
|
function tokenPrice(input2, output2, options = {}) {
|
|
19894
19915
|
return Object.freeze({
|
|
19895
19916
|
input: input2,
|
|
@@ -19922,17 +19943,19 @@ function serviceTierMultiplier(tier) {
|
|
|
19922
19943
|
function promptTokensOf(usage) {
|
|
19923
19944
|
return usage.promptTokens ?? (usage.inputTokens ?? 0) + (usage.cacheReadTokens ?? 0) + (usage.cacheWrite1hTokens ?? 0) + (usage.cacheWrite5mTokens ?? 0);
|
|
19924
19945
|
}
|
|
19946
|
+
function bandRate(column, base) {
|
|
19947
|
+
return column === void 0 ? base : column;
|
|
19948
|
+
}
|
|
19925
19949
|
function costOf(price, usage) {
|
|
19950
|
+
const band = price.longContext !== null && promptTokensOf(usage) > price.longContext.thresholdInputTokens ? price.longContext : null;
|
|
19926
19951
|
const metered = [
|
|
19927
|
-
[usage.
|
|
19928
|
-
[usage.
|
|
19929
|
-
[usage.
|
|
19952
|
+
[usage.inputTokens ?? 0, bandRate(band?.input, price.input)],
|
|
19953
|
+
[usage.outputTokens ?? 0, bandRate(band?.output, price.output)],
|
|
19954
|
+
[usage.cacheWrite1hTokens ?? 0, bandRate(band?.cacheWrite1h, price.cacheWrite1h)],
|
|
19955
|
+
[usage.cacheWrite5mTokens ?? 0, bandRate(band?.cacheWrite5m, price.cacheWrite5m)],
|
|
19956
|
+
[usage.cacheReadTokens ?? 0, bandRate(band?.cacheRead, price.cacheRead)]
|
|
19930
19957
|
];
|
|
19931
|
-
|
|
19932
|
-
if (band !== null && (band.input === null || band.output === null)) return null;
|
|
19933
|
-
const inputRate = band?.input ?? price.input;
|
|
19934
|
-
const outputRate = band?.output ?? price.output;
|
|
19935
|
-
let tokenCost = (usage.inputTokens ?? 0) * inputRate + (usage.outputTokens ?? 0) * outputRate;
|
|
19958
|
+
let tokenCost = 0;
|
|
19936
19959
|
for (const [tokens, rate] of metered) {
|
|
19937
19960
|
if (tokens === 0) continue;
|
|
19938
19961
|
if (rate === null) return null;
|
|
@@ -20222,10 +20245,20 @@ anthropic.model("claude-fable-5-1", {
|
|
|
20222
20245
|
});
|
|
20223
20246
|
anthropic.model("claude-fable-5", {
|
|
20224
20247
|
name: "Claude Fable 5",
|
|
20248
|
+
ctx: 1e6,
|
|
20249
|
+
maxOut: 128e3,
|
|
20225
20250
|
capability: "reasoning",
|
|
20226
20251
|
price: anthropicPrice(10, 50, 1),
|
|
20227
20252
|
on: [...CLAUDE_RESELLERS]
|
|
20228
20253
|
});
|
|
20254
|
+
anthropic.model("claude-opus-5-5", {
|
|
20255
|
+
name: "Claude Opus 5.5",
|
|
20256
|
+
ctx: 1e6,
|
|
20257
|
+
maxOut: 128e3,
|
|
20258
|
+
capability: "reasoning",
|
|
20259
|
+
price: anthropicPrice(4, 20, 0.2),
|
|
20260
|
+
on: [...CLAUDE_RESELLERS]
|
|
20261
|
+
});
|
|
20229
20262
|
anthropic.model("claude-opus-5", {
|
|
20230
20263
|
name: "Claude Opus 5",
|
|
20231
20264
|
ctx: 1e6,
|
|
@@ -20236,24 +20269,32 @@ anthropic.model("claude-opus-5", {
|
|
|
20236
20269
|
});
|
|
20237
20270
|
anthropic.model("claude-opus-4-8", {
|
|
20238
20271
|
name: "Claude Opus 4.8",
|
|
20272
|
+
ctx: 1e6,
|
|
20273
|
+
maxOut: 128e3,
|
|
20239
20274
|
capability: "reasoning",
|
|
20240
20275
|
price: anthropicPrice(5, 25, 0.5),
|
|
20241
20276
|
on: [...CLAUDE_RESELLERS]
|
|
20242
20277
|
});
|
|
20243
20278
|
anthropic.model("claude-opus-4-7", {
|
|
20244
20279
|
name: "Claude Opus 4.7",
|
|
20280
|
+
ctx: 1e6,
|
|
20281
|
+
maxOut: 128e3,
|
|
20245
20282
|
capability: "reasoning",
|
|
20246
20283
|
price: anthropicPrice(5, 25, 0.5),
|
|
20247
20284
|
on: [...CLAUDE_RESELLERS]
|
|
20248
20285
|
});
|
|
20249
20286
|
anthropic.model("claude-opus-4-6", {
|
|
20250
20287
|
name: "Claude Opus 4.6",
|
|
20288
|
+
ctx: 1e6,
|
|
20289
|
+
maxOut: 128e3,
|
|
20251
20290
|
capability: "reasoning",
|
|
20252
20291
|
price: anthropicPrice(5, 25, 0.5),
|
|
20253
20292
|
on: [...CLAUDE_RESELLERS]
|
|
20254
20293
|
});
|
|
20255
20294
|
anthropic.model("claude-opus-4-5", {
|
|
20256
20295
|
name: "Claude Opus 4.5",
|
|
20296
|
+
ctx: 2e5,
|
|
20297
|
+
maxOut: 64e3,
|
|
20257
20298
|
capability: "reasoning",
|
|
20258
20299
|
price: anthropicPrice(5, 25, 0.5),
|
|
20259
20300
|
on: [...CLAUDE_RESELLERS]
|
|
@@ -20264,6 +20305,14 @@ anthropic.model("claude-opus-4-1", {
|
|
|
20264
20305
|
price: anthropicPrice(15, 75, 1.5),
|
|
20265
20306
|
on: [...CLAUDE_RESELLERS]
|
|
20266
20307
|
});
|
|
20308
|
+
anthropic.model("claude-sonnet-5-5", {
|
|
20309
|
+
name: "Claude Sonnet 5.5",
|
|
20310
|
+
ctx: 1e6,
|
|
20311
|
+
maxOut: 128e3,
|
|
20312
|
+
capability: "reasoning",
|
|
20313
|
+
price: anthropicPrice(2, 10, 0.1),
|
|
20314
|
+
on: [...CLAUDE_RESELLERS]
|
|
20315
|
+
});
|
|
20267
20316
|
anthropic.model("claude-sonnet-5", {
|
|
20268
20317
|
name: "Claude Sonnet 5",
|
|
20269
20318
|
ctx: 1e6,
|
|
@@ -20274,16 +20323,30 @@ anthropic.model("claude-sonnet-5", {
|
|
|
20274
20323
|
});
|
|
20275
20324
|
anthropic.model("claude-sonnet-4-6", {
|
|
20276
20325
|
name: "Claude Sonnet 4.6",
|
|
20326
|
+
ctx: 1e6,
|
|
20327
|
+
maxOut: 128e3,
|
|
20277
20328
|
capability: "reasoning",
|
|
20278
20329
|
price: anthropicPrice(3, 15, 0.3),
|
|
20279
20330
|
on: [...CLAUDE_RESELLERS]
|
|
20280
20331
|
});
|
|
20281
20332
|
anthropic.model("claude-sonnet-4-5", {
|
|
20282
20333
|
name: "Claude Sonnet 4.5",
|
|
20334
|
+
ctx: 2e5,
|
|
20335
|
+
maxOut: 64e3,
|
|
20283
20336
|
capability: "reasoning",
|
|
20284
20337
|
price: anthropicPrice(3, 15, 0.3),
|
|
20285
20338
|
on: [...CLAUDE_RESELLERS]
|
|
20286
20339
|
});
|
|
20340
|
+
anthropic.model("claude-haiku-5-5", {
|
|
20341
|
+
name: "Claude Haiku 5.5",
|
|
20342
|
+
ctx: 1e6,
|
|
20343
|
+
maxOut: 128e3,
|
|
20344
|
+
capability: null,
|
|
20345
|
+
// A prompt over 100,000 tokens, cache reads and writes included, bills the
|
|
20346
|
+
// whole request at the higher band.
|
|
20347
|
+
price: anthropicPrice(0.1, 0.5, 0.01, anthropicBand(1e5, 0.5, 2.5, 0.05)),
|
|
20348
|
+
on: [...CLAUDE_RESELLERS]
|
|
20349
|
+
});
|
|
20287
20350
|
anthropic.model("claude-haiku-4-5", {
|
|
20288
20351
|
name: "Claude Haiku 4.5",
|
|
20289
20352
|
ctx: 2e5,
|
|
@@ -20306,7 +20369,13 @@ var OPENAI_TRAINING = {
|
|
|
20306
20369
|
consumerControl: "opt-out",
|
|
20307
20370
|
source: "https://developers.openai.com/api/docs/guides/your-data"
|
|
20308
20371
|
};
|
|
20309
|
-
|
|
20372
|
+
function gptPrice(input2, output2, cacheRead) {
|
|
20373
|
+
const base = { input: input2, output: output2, ...cacheRead === void 0 ? {} : { cacheRead } };
|
|
20374
|
+
return tokenPrice(input2, output2, {
|
|
20375
|
+
...base,
|
|
20376
|
+
longContext: scaledBand(272e3, base, { input: 2, output: 1.5, cacheRead: 2 })
|
|
20377
|
+
});
|
|
20378
|
+
}
|
|
20310
20379
|
var openai = vendor("openai", {
|
|
20311
20380
|
family: { id: "gpt", name: "GPT" },
|
|
20312
20381
|
region: "us",
|
|
@@ -20314,12 +20383,45 @@ var openai = vendor("openai", {
|
|
|
20314
20383
|
training: OPENAI_TRAINING
|
|
20315
20384
|
});
|
|
20316
20385
|
var OPENAI_RESELLERS = ["azure", "foundry"];
|
|
20386
|
+
openai.model("gpt-6-astra", {
|
|
20387
|
+
name: "GPT-6 Astra",
|
|
20388
|
+
ctx: 105e4,
|
|
20389
|
+
maxOut: 128e3,
|
|
20390
|
+
capability: "reasoning",
|
|
20391
|
+
price: gptPrice(10, 50, 1),
|
|
20392
|
+
on: [...OPENAI_RESELLERS]
|
|
20393
|
+
});
|
|
20394
|
+
openai.model("gpt-6.1-sol", {
|
|
20395
|
+
name: "GPT-6.1 Sol",
|
|
20396
|
+
ctx: 105e4,
|
|
20397
|
+
maxOut: 128e3,
|
|
20398
|
+
capability: "reasoning",
|
|
20399
|
+
price: gptPrice(2, 10, 0.1),
|
|
20400
|
+
on: [...OPENAI_RESELLERS]
|
|
20401
|
+
});
|
|
20402
|
+
openai.model("gpt-6-sol", {
|
|
20403
|
+
name: "GPT-6 Sol",
|
|
20404
|
+
ctx: 105e4,
|
|
20405
|
+
maxOut: 128e3,
|
|
20406
|
+
capability: "reasoning",
|
|
20407
|
+
price: gptPrice(2, 10, 0.2),
|
|
20408
|
+
on: [...OPENAI_RESELLERS]
|
|
20409
|
+
});
|
|
20410
|
+
openai.model("gpt-6-luna", {
|
|
20411
|
+
name: "GPT-6 Luna",
|
|
20412
|
+
ctx: 105e4,
|
|
20413
|
+
maxOut: 128e3,
|
|
20414
|
+
capability: null,
|
|
20415
|
+
price: gptPrice(0.1, 0.5, 0.01),
|
|
20416
|
+
on: [...OPENAI_RESELLERS]
|
|
20417
|
+
});
|
|
20317
20418
|
openai.model("gpt-5.6-sol", {
|
|
20318
20419
|
name: "GPT-5.6 Sol",
|
|
20420
|
+
// Promotional rate, published as available at least through 2026-11-21.
|
|
20319
20421
|
ctx: 105e4,
|
|
20320
20422
|
maxOut: 128e3,
|
|
20321
20423
|
capability: "reasoning",
|
|
20322
|
-
price:
|
|
20424
|
+
price: gptPrice(4, 20, 0.4),
|
|
20323
20425
|
on: [...OPENAI_RESELLERS]
|
|
20324
20426
|
});
|
|
20325
20427
|
openai.model("gpt-5.6-terra", {
|
|
@@ -20327,7 +20429,7 @@ openai.model("gpt-5.6-terra", {
|
|
|
20327
20429
|
ctx: 105e4,
|
|
20328
20430
|
maxOut: 128e3,
|
|
20329
20431
|
capability: "reasoning",
|
|
20330
|
-
price:
|
|
20432
|
+
price: gptPrice(2, 12, 0.2),
|
|
20331
20433
|
on: [...OPENAI_RESELLERS]
|
|
20332
20434
|
});
|
|
20333
20435
|
openai.model("gpt-5.6-luna", {
|
|
@@ -20335,7 +20437,7 @@ openai.model("gpt-5.6-luna", {
|
|
|
20335
20437
|
ctx: 105e4,
|
|
20336
20438
|
maxOut: 128e3,
|
|
20337
20439
|
capability: null,
|
|
20338
|
-
price:
|
|
20440
|
+
price: gptPrice(0.2, 1.2, 0.02),
|
|
20339
20441
|
on: [...OPENAI_RESELLERS]
|
|
20340
20442
|
});
|
|
20341
20443
|
openai.model("gpt-5.5", {
|
|
@@ -20343,7 +20445,15 @@ openai.model("gpt-5.5", {
|
|
|
20343
20445
|
ctx: 105e4,
|
|
20344
20446
|
maxOut: 128e3,
|
|
20345
20447
|
capability: "reasoning",
|
|
20346
|
-
price:
|
|
20448
|
+
price: gptPrice(5, 30, 0.5),
|
|
20449
|
+
on: [...OPENAI_RESELLERS]
|
|
20450
|
+
});
|
|
20451
|
+
openai.model("gpt-5.5-pro", {
|
|
20452
|
+
name: "GPT-5.5 Pro",
|
|
20453
|
+
ctx: 105e4,
|
|
20454
|
+
maxOut: 128e3,
|
|
20455
|
+
capability: "reasoning",
|
|
20456
|
+
price: gptPrice(30, 180),
|
|
20347
20457
|
on: [...OPENAI_RESELLERS]
|
|
20348
20458
|
});
|
|
20349
20459
|
openai.model("gpt-5.4", {
|
|
@@ -20351,7 +20461,7 @@ openai.model("gpt-5.4", {
|
|
|
20351
20461
|
ctx: 105e4,
|
|
20352
20462
|
maxOut: 128e3,
|
|
20353
20463
|
capability: "reasoning",
|
|
20354
|
-
price:
|
|
20464
|
+
price: gptPrice(2.5, 15, 0.25),
|
|
20355
20465
|
on: [...OPENAI_RESELLERS]
|
|
20356
20466
|
});
|
|
20357
20467
|
openai.model("gpt-5.4-mini", {
|
|
@@ -20397,6 +20507,7 @@ openai.model("gpt-5", {
|
|
|
20397
20507
|
openai.model("gpt-5-mini", {
|
|
20398
20508
|
name: "GPT-5 mini",
|
|
20399
20509
|
ctx: 4e5,
|
|
20510
|
+
maxOut: 128e3,
|
|
20400
20511
|
capability: null,
|
|
20401
20512
|
price: tokenPrice(0.25, 2, { cacheRead: 0.025 }),
|
|
20402
20513
|
on: [...OPENAI_RESELLERS]
|
|
@@ -20411,11 +20522,15 @@ openai.model("gpt-5-nano", {
|
|
|
20411
20522
|
});
|
|
20412
20523
|
openai.model("gpt-4.1", {
|
|
20413
20524
|
name: "GPT-4.1",
|
|
20525
|
+
ctx: 1047576,
|
|
20526
|
+
maxOut: 32768,
|
|
20414
20527
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
20415
20528
|
on: [...OPENAI_RESELLERS]
|
|
20416
20529
|
});
|
|
20417
20530
|
openai.model("gpt-4o", {
|
|
20418
20531
|
name: "GPT-4o",
|
|
20532
|
+
ctx: 128e3,
|
|
20533
|
+
maxOut: 16384,
|
|
20419
20534
|
price: tokenPrice(2.5, 10, { cacheRead: 1.25 }),
|
|
20420
20535
|
on: [...OPENAI_RESELLERS]
|
|
20421
20536
|
});
|
|
@@ -20439,6 +20554,8 @@ openai.model("gpt-4-turbo", {
|
|
|
20439
20554
|
});
|
|
20440
20555
|
openai.model("o3", {
|
|
20441
20556
|
name: "o3",
|
|
20557
|
+
ctx: 2e5,
|
|
20558
|
+
maxOut: 1e5,
|
|
20442
20559
|
capability: "reasoning",
|
|
20443
20560
|
price: tokenPrice(2, 8, { cacheRead: 0.5 }),
|
|
20444
20561
|
on: [...OPENAI_RESELLERS]
|
|
@@ -20491,57 +20608,100 @@ var google = vendor("google", {
|
|
|
20491
20608
|
retention: "configurable",
|
|
20492
20609
|
training: GOOGLE_TRAINING
|
|
20493
20610
|
});
|
|
20611
|
+
google.model("gemini-3.8-flash", {
|
|
20612
|
+
name: "Gemini 3.8 Flash",
|
|
20613
|
+
ctx: 1048576,
|
|
20614
|
+
maxOut: 65536,
|
|
20615
|
+
capability: null,
|
|
20616
|
+
price: tokenPrice(0.75, 3.75, { cacheRead: 0.075 }),
|
|
20617
|
+
on: ["vertex"]
|
|
20618
|
+
});
|
|
20494
20619
|
google.model("gemini-3.7-flash", {
|
|
20495
20620
|
name: "Gemini 3.7 Flash",
|
|
20496
20621
|
capability: null,
|
|
20497
|
-
// Promotional rate; the published post-promotion rate is 1.50 / 7.50.
|
|
20498
20622
|
price: tokenPrice(0.75, 3.75),
|
|
20499
20623
|
on: ["vertex"]
|
|
20500
20624
|
});
|
|
20501
20625
|
google.model("gemini-3.6-flash", {
|
|
20502
20626
|
name: "Gemini 3.6 Flash",
|
|
20627
|
+
ctx: 1048576,
|
|
20628
|
+
maxOut: 65536,
|
|
20503
20629
|
capability: null,
|
|
20504
|
-
price: tokenPrice(0.75, 3.75),
|
|
20630
|
+
price: tokenPrice(0.75, 3.75, { cacheRead: 0.075 }),
|
|
20505
20631
|
on: ["vertex"]
|
|
20506
20632
|
});
|
|
20507
20633
|
google.model("gemini-3.5-flash", {
|
|
20508
20634
|
name: "Gemini 3.5 Flash",
|
|
20509
20635
|
capability: null,
|
|
20510
|
-
price: tokenPrice(1.5, 9),
|
|
20511
20636
|
on: ["vertex"]
|
|
20512
20637
|
});
|
|
20513
20638
|
google.model("gemini-3.5-flash-lite", {
|
|
20514
20639
|
name: "Gemini 3.5 Flash Lite",
|
|
20640
|
+
ctx: 1048576,
|
|
20641
|
+
maxOut: 65536,
|
|
20515
20642
|
capability: null,
|
|
20516
|
-
price: tokenPrice(0.3, 2.5),
|
|
20643
|
+
price: tokenPrice(0.3, 2.5, { cacheRead: 0.03 }),
|
|
20644
|
+
on: ["vertex"]
|
|
20645
|
+
});
|
|
20646
|
+
google.model("gemini-3.1-flash-lite", {
|
|
20647
|
+
name: "Gemini 3.1 Flash Lite",
|
|
20648
|
+
ctx: 1048576,
|
|
20649
|
+
maxOut: 65536,
|
|
20650
|
+
capability: null,
|
|
20651
|
+
price: tokenPrice(0.25, 1.5, { cacheRead: 0.025 }),
|
|
20652
|
+
on: ["vertex"]
|
|
20653
|
+
});
|
|
20654
|
+
google.model("gemini-3-flash-preview", {
|
|
20655
|
+
name: "Gemini 3 Flash Preview",
|
|
20656
|
+
ctx: 1048576,
|
|
20657
|
+
maxOut: 65536,
|
|
20658
|
+
capability: null,
|
|
20659
|
+
price: tokenPrice(0.5, 3, { cacheRead: 0.05 }),
|
|
20517
20660
|
on: ["vertex"]
|
|
20518
20661
|
});
|
|
20519
20662
|
google.model("gemini-3.1-pro-preview", {
|
|
20520
20663
|
name: "Gemini 3.1 Pro Preview",
|
|
20664
|
+
ctx: 1048576,
|
|
20665
|
+
maxOut: 65536,
|
|
20521
20666
|
capability: "reasoning",
|
|
20522
20667
|
price: tokenPrice(2, 12, {
|
|
20523
|
-
|
|
20668
|
+
cacheRead: 0.2,
|
|
20669
|
+
longContext: { thresholdInputTokens: 2e5, input: 4, output: 18, cacheRead: 0.4 }
|
|
20524
20670
|
}),
|
|
20671
|
+
aliases: ["gemini-3.1-pro-preview-customtools"],
|
|
20525
20672
|
on: ["vertex"]
|
|
20526
20673
|
});
|
|
20527
20674
|
google.model("gemini-2.5-pro", {
|
|
20528
20675
|
name: "Gemini 2.5 Pro",
|
|
20676
|
+
ctx: 1048576,
|
|
20677
|
+
maxOut: 65536,
|
|
20529
20678
|
capability: "reasoning",
|
|
20530
20679
|
price: tokenPrice(1.25, 10, {
|
|
20531
|
-
|
|
20680
|
+
cacheRead: 0.125,
|
|
20681
|
+
longContext: { thresholdInputTokens: 2e5, input: 2.5, output: 15, cacheRead: 0.25 }
|
|
20532
20682
|
}),
|
|
20533
20683
|
on: ["vertex"]
|
|
20534
20684
|
});
|
|
20535
20685
|
google.model("gemini-2.5-flash", {
|
|
20536
20686
|
name: "Gemini 2.5 Flash",
|
|
20687
|
+
ctx: 1048576,
|
|
20688
|
+
maxOut: 65536,
|
|
20537
20689
|
capability: null,
|
|
20538
|
-
price: tokenPrice(0.3, 2.5),
|
|
20690
|
+
price: tokenPrice(0.3, 2.5, { cacheRead: 0.03 }),
|
|
20539
20691
|
on: ["vertex"]
|
|
20540
20692
|
});
|
|
20541
20693
|
google.model("gemini-2.5-flash-lite", {
|
|
20542
20694
|
name: "Gemini 2.5 Flash Lite",
|
|
20695
|
+
ctx: 1048576,
|
|
20696
|
+
maxOut: 65536,
|
|
20543
20697
|
capability: null,
|
|
20544
|
-
price: tokenPrice(0.1, 0.4),
|
|
20698
|
+
price: tokenPrice(0.1, 0.4, { cacheRead: 0.01 }),
|
|
20699
|
+
on: ["vertex"]
|
|
20700
|
+
});
|
|
20701
|
+
google.model("gemini-embedding-2", {
|
|
20702
|
+
name: "Gemini Embedding 2",
|
|
20703
|
+
capability: "embedding",
|
|
20704
|
+
price: tokenPrice(0.2, 0),
|
|
20545
20705
|
on: ["vertex"]
|
|
20546
20706
|
});
|
|
20547
20707
|
google.model("gemini-1-5-pro", { name: "Gemini 1.5 Pro", on: ["vertex"] });
|
|
@@ -20557,43 +20717,62 @@ var xai = vendor("xai", {
|
|
|
20557
20717
|
source: "https://docs.x.ai/developers/faq/security"
|
|
20558
20718
|
}
|
|
20559
20719
|
});
|
|
20720
|
+
function grokPrice(input2, output2, cacheRead) {
|
|
20721
|
+
const base = { input: input2, output: output2, cacheRead };
|
|
20722
|
+
return tokenPrice(input2, output2, {
|
|
20723
|
+
cacheRead,
|
|
20724
|
+
longContext: scaledBand(2e5, base, { input: 2, output: 2, cacheRead: 2 })
|
|
20725
|
+
});
|
|
20726
|
+
}
|
|
20727
|
+
xai.model("grok-4.7", {
|
|
20728
|
+
name: "Grok 4.7",
|
|
20729
|
+
ctx: 5e5,
|
|
20730
|
+
capability: "reasoning",
|
|
20731
|
+
price: grokPrice(2, 6, 0.5)
|
|
20732
|
+
});
|
|
20560
20733
|
xai.model("grok-4.6", {
|
|
20561
20734
|
name: "Grok 4.6",
|
|
20562
20735
|
ctx: 5e5,
|
|
20563
20736
|
capability: "reasoning",
|
|
20564
|
-
price:
|
|
20565
|
-
cacheRead: 0.5,
|
|
20566
|
-
longContext: { thresholdInputTokens: 2e5, input: 4, output: 12 }
|
|
20567
|
-
}),
|
|
20737
|
+
price: grokPrice(2, 6, 0.5),
|
|
20568
20738
|
on: ["bedrock"]
|
|
20569
20739
|
});
|
|
20570
20740
|
xai.model("grok-4.5", {
|
|
20571
20741
|
name: "Grok 4.5",
|
|
20572
20742
|
ctx: 5e5,
|
|
20573
20743
|
capability: "reasoning",
|
|
20574
|
-
price:
|
|
20575
|
-
cacheRead: 0.3,
|
|
20576
|
-
longContext: { thresholdInputTokens: 2e5, input: 4, output: 12 }
|
|
20577
|
-
})
|
|
20744
|
+
price: grokPrice(2, 6, 0.3)
|
|
20578
20745
|
});
|
|
20579
20746
|
xai.model("grok-4.3", {
|
|
20580
20747
|
name: "Grok 4.3",
|
|
20581
20748
|
ctx: 1e6,
|
|
20582
20749
|
capability: "reasoning",
|
|
20583
|
-
price:
|
|
20584
|
-
cacheRead: 0.2,
|
|
20585
|
-
longContext: { thresholdInputTokens: 2e5, input: 2.5, output: 5 }
|
|
20586
|
-
}),
|
|
20750
|
+
price: grokPrice(1.25, 2.5, 0.2),
|
|
20587
20751
|
on: ["bedrock"]
|
|
20588
20752
|
});
|
|
20753
|
+
xai.model("grok-4.20-0309-reasoning", {
|
|
20754
|
+
name: "Grok 4.20 Reasoning",
|
|
20755
|
+
capability: "reasoning",
|
|
20756
|
+
ctx: 1e6,
|
|
20757
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
20758
|
+
});
|
|
20759
|
+
xai.model("grok-4.20-0309-non-reasoning", {
|
|
20760
|
+
name: "Grok 4.20",
|
|
20761
|
+
capability: null,
|
|
20762
|
+
ctx: 1e6,
|
|
20763
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
20764
|
+
});
|
|
20765
|
+
xai.model("grok-4.20-multi-agent-0309", {
|
|
20766
|
+
name: "Grok 4.20 Multi-Agent",
|
|
20767
|
+
capability: "reasoning",
|
|
20768
|
+
ctx: 1e6,
|
|
20769
|
+
price: grokPrice(1.25, 2.5, 0.2)
|
|
20770
|
+
});
|
|
20589
20771
|
xai.model("grok-build-0.1", {
|
|
20590
20772
|
name: "Grok Build 0.1",
|
|
20591
20773
|
ctx: 256e3,
|
|
20592
20774
|
capability: "code",
|
|
20593
|
-
price:
|
|
20594
|
-
cacheRead: 0.2,
|
|
20595
|
-
longContext: { thresholdInputTokens: 2e5, input: 2, output: 4 }
|
|
20596
|
-
})
|
|
20775
|
+
price: grokPrice(1, 2, 0.2)
|
|
20597
20776
|
});
|
|
20598
20777
|
var deepseek = vendor("deepseek", {
|
|
20599
20778
|
family: { id: "deepseek", name: "DeepSeek" },
|
|
@@ -20606,16 +20785,25 @@ var deepseek = vendor("deepseek", {
|
|
|
20606
20785
|
source: "https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html"
|
|
20607
20786
|
}
|
|
20608
20787
|
});
|
|
20788
|
+
deepseek.model("deepseek-flash", {
|
|
20789
|
+
name: "DeepSeek V4.1 Flash",
|
|
20790
|
+
ctx: 1e6,
|
|
20791
|
+
maxOut: 384e3,
|
|
20792
|
+
capability: null,
|
|
20793
|
+
price: tokenPrice(0.3, 1.2, { cacheRead: 6e-3 })
|
|
20794
|
+
});
|
|
20609
20795
|
deepseek.model("deepseek-v4-flash", {
|
|
20610
20796
|
name: "DeepSeek V4 Flash",
|
|
20611
20797
|
ctx: 1e6,
|
|
20798
|
+
maxOut: 384e3,
|
|
20612
20799
|
capability: null,
|
|
20613
|
-
price: tokenPrice(0.
|
|
20800
|
+
price: tokenPrice(0.3, 1.2, { cacheRead: 6e-3 }),
|
|
20614
20801
|
on: ["bedrock", "together", "fireworks", "openrouter", "ollama", "local"]
|
|
20615
20802
|
});
|
|
20616
20803
|
deepseek.model("deepseek-v4-pro", {
|
|
20617
20804
|
name: "DeepSeek V4 Pro",
|
|
20618
20805
|
ctx: 1e6,
|
|
20806
|
+
maxOut: 384e3,
|
|
20619
20807
|
capability: "reasoning",
|
|
20620
20808
|
price: tokenPrice(1.32, 3.96, { cacheRead: 0.044 }),
|
|
20621
20809
|
on: ["bedrock", "together", "fireworks", "openrouter"]
|
|
@@ -20662,7 +20850,14 @@ cohere.model("command-r-plus-08-2024", {
|
|
|
20662
20850
|
ctx: 128e3,
|
|
20663
20851
|
maxOut: 4e3,
|
|
20664
20852
|
price: tokenPrice(2.5, 10),
|
|
20665
|
-
|
|
20853
|
+
on: ["bedrock"]
|
|
20854
|
+
});
|
|
20855
|
+
cohere.model("command-r-plus-04-2024", {
|
|
20856
|
+
name: "Command R+ (04-2024)",
|
|
20857
|
+
seen: "discovered",
|
|
20858
|
+
ctx: 128e3,
|
|
20859
|
+
maxOut: 4e3,
|
|
20860
|
+
price: tokenPrice(3, 15),
|
|
20666
20861
|
aliases: ["command-r-plus"],
|
|
20667
20862
|
on: ["bedrock"]
|
|
20668
20863
|
});
|
|
@@ -20730,6 +20925,65 @@ var mistral = vendor("mistral", {
|
|
|
20730
20925
|
retention: "unknown",
|
|
20731
20926
|
defaultHosting: "local"
|
|
20732
20927
|
});
|
|
20928
|
+
var MISTRAL_API = { defaultHosting: "api" };
|
|
20929
|
+
mistral.model("mistral-large-4", {
|
|
20930
|
+
...MISTRAL_API,
|
|
20931
|
+
name: "Mistral Large 4",
|
|
20932
|
+
ctx: 1e6,
|
|
20933
|
+
capability: null,
|
|
20934
|
+
// Public preview at a sale rate; the published original is 1.36 / 4.18 / 0.14.
|
|
20935
|
+
price: tokenPrice(0.68, 2.09, { cacheRead: 0.07 })
|
|
20936
|
+
});
|
|
20937
|
+
mistral.model("mistral-large-2512", {
|
|
20938
|
+
...MISTRAL_API,
|
|
20939
|
+
name: "Mistral Large 3",
|
|
20940
|
+
ctx: 256e3,
|
|
20941
|
+
capability: null,
|
|
20942
|
+
price: tokenPrice(0.5, 1.5, { cacheRead: 0.05 })
|
|
20943
|
+
});
|
|
20944
|
+
mistral.model("mistral-medium-3-5", {
|
|
20945
|
+
...MISTRAL_API,
|
|
20946
|
+
name: "Mistral Medium 3.5",
|
|
20947
|
+
ctx: 256e3,
|
|
20948
|
+
capability: null,
|
|
20949
|
+
price: tokenPrice(1.5, 7.5, { cacheRead: 0.15 })
|
|
20950
|
+
});
|
|
20951
|
+
mistral.model("mistral-small-2603", {
|
|
20952
|
+
...MISTRAL_API,
|
|
20953
|
+
name: "Mistral Small 4",
|
|
20954
|
+
ctx: 256e3,
|
|
20955
|
+
capability: null,
|
|
20956
|
+
price: tokenPrice(0.15, 0.6, { cacheRead: 0.015 })
|
|
20957
|
+
});
|
|
20958
|
+
mistral.model("ministral-14b-2512", {
|
|
20959
|
+
...MISTRAL_API,
|
|
20960
|
+
name: "Ministral 3 14B",
|
|
20961
|
+
ctx: 256e3,
|
|
20962
|
+
capability: null,
|
|
20963
|
+
price: tokenPrice(0.2, 0.2, { cacheRead: 0.02 })
|
|
20964
|
+
});
|
|
20965
|
+
mistral.model("ministral-8b-2512", {
|
|
20966
|
+
...MISTRAL_API,
|
|
20967
|
+
name: "Ministral 3 8B",
|
|
20968
|
+
ctx: 256e3,
|
|
20969
|
+
capability: null,
|
|
20970
|
+
price: tokenPrice(0.15, 0.15, { cacheRead: 0.015 })
|
|
20971
|
+
});
|
|
20972
|
+
mistral.model("ministral-3b-2512", {
|
|
20973
|
+
...MISTRAL_API,
|
|
20974
|
+
name: "Ministral 3 3B",
|
|
20975
|
+
ctx: 256e3,
|
|
20976
|
+
capability: null,
|
|
20977
|
+
price: tokenPrice(0.1, 0.1, { cacheRead: 0.01 })
|
|
20978
|
+
});
|
|
20979
|
+
mistral.model("codestral-2508", {
|
|
20980
|
+
...MISTRAL_API,
|
|
20981
|
+
name: "Codestral",
|
|
20982
|
+
ctx: 128e3,
|
|
20983
|
+
capability: "code",
|
|
20984
|
+
openWeights: false,
|
|
20985
|
+
price: tokenPrice(0.3, 0.9, { cacheRead: 0.03 })
|
|
20986
|
+
});
|
|
20733
20987
|
mistral.model("mixtral-8x7b", {
|
|
20734
20988
|
name: "Mixtral 8x7B",
|
|
20735
20989
|
seen: "discovered",
|
|
@@ -20893,11 +21147,14 @@ var COMPACT = new Intl.NumberFormat("en-US", {
|
|
|
20893
21147
|
// ../../packages/schema/src/token/token-report.ts
|
|
20894
21148
|
var num = (value) => value ?? 0;
|
|
20895
21149
|
function costUsageOf(a, promptTokens) {
|
|
21150
|
+
const write1h = num(a.ephemeral_1h_input_tokens);
|
|
21151
|
+
const write5m = num(a.ephemeral_5m_input_tokens);
|
|
21152
|
+
const unsplit = Math.max(num(a.cache_creation_input_tokens) - write1h - write5m, 0);
|
|
20896
21153
|
const usage = {
|
|
20897
21154
|
inputTokens: num(a.input_tokens),
|
|
20898
21155
|
outputTokens: num(a.output_tokens),
|
|
20899
|
-
cacheWrite1hTokens:
|
|
20900
|
-
cacheWrite5mTokens:
|
|
21156
|
+
cacheWrite1hTokens: write1h,
|
|
21157
|
+
cacheWrite5mTokens: write5m + unsplit,
|
|
20901
21158
|
cacheReadTokens: num(a.cache_read_input_tokens),
|
|
20902
21159
|
webSearchRequests: num(a.web_search_requests)
|
|
20903
21160
|
};
|
|
@@ -21684,6 +21941,11 @@ var CaptureAttributes = external_exports.object({
|
|
|
21684
21941
|
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
21685
21942
|
// repeated rather than referenced because a store reader opens this file.
|
|
21686
21943
|
redact_degraded_to: ActionTaken.optional(),
|
|
21944
|
+
// Why a capture has no content and no findings: its field was refused
|
|
21945
|
+
// because its bounded scan did not finish (see EventMetadata.scanIncomplete,
|
|
21946
|
+
// whose value this is). Absent on every capture that was scanned, so a
|
|
21947
|
+
// reader can tell a refused row from an empty clean one.
|
|
21948
|
+
scan_incomplete: external_exports.enum(["timeout", "unavailable"]).optional(),
|
|
21687
21949
|
// The scope key this capture was stamped with: the canonical repository
|
|
21688
21950
|
// (`host/owner/repo`) of the path the capture names (a relative path is read
|
|
21689
21951
|
// against its working directory), else of its own working directory, or a
|
|
@@ -23025,7 +23287,19 @@ var EventMetadata = external_exports.object({
|
|
|
23025
23287
|
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
23026
23288
|
// Closing either means moving the reason onto the finding row, which
|
|
23027
23289
|
// already carries its own action.
|
|
23028
|
-
redactDegradedTo: ActionTaken.optional()
|
|
23290
|
+
redactDegradedTo: ActionTaken.optional(),
|
|
23291
|
+
// Set when this capture's field was REFUSED rather than scanned: a hook
|
|
23292
|
+
// bounds the scan of a large field (see `LargeInputScanOptions` in
|
|
23293
|
+
// @akasecurity/plugin-sdk), and a scan that did not finish blocks the
|
|
23294
|
+
// field instead of letting it through unscanned.
|
|
23295
|
+
//
|
|
23296
|
+
// - 'timeout': the bounded scan ran out of time.
|
|
23297
|
+
// - 'unavailable': no worker could run it.
|
|
23298
|
+
//
|
|
23299
|
+
// A refused row stores '' as its content and has no findings, which is
|
|
23300
|
+
// exactly what a clean, empty capture looks like — this marker is the only
|
|
23301
|
+
// thing that tells the two apart. Absent on every capture that was scanned.
|
|
23302
|
+
scanIncomplete: external_exports.enum(["timeout", "unavailable"]).optional()
|
|
23029
23303
|
}).meta({ id: "EventMetadata" });
|
|
23030
23304
|
var Event = external_exports.object({
|
|
23031
23305
|
id: external_exports.guid(),
|
|
@@ -24842,6 +25116,7 @@ function toCaptureAttributes(event) {
|
|
|
24842
25116
|
...metadata?.exceptionIds !== void 0 ? { exception_ids: metadata.exceptionIds } : {},
|
|
24843
25117
|
...metadata?.inspectionMs !== void 0 ? { inspection_ms: metadata.inspectionMs } : {},
|
|
24844
25118
|
...metadata?.redactDegradedTo !== void 0 ? { redact_degraded_to: metadata.redactDegradedTo } : {},
|
|
25119
|
+
...metadata?.scanIncomplete !== void 0 ? { scan_incomplete: metadata.scanIncomplete } : {},
|
|
24845
25120
|
// `model`/`turnIndex` have no dedicated CaptureAttributes field (no writer
|
|
24846
25121
|
// has ever populated either), but every legacy metadata key still rides
|
|
24847
25122
|
// the bag rather than being silently dropped — CaptureAttributes'
|
|
@@ -27830,7 +28105,8 @@ var TIMELINE_COLUMNS = `
|
|
|
27830
28105
|
json_extract(attributes, '$.internal') AS internal,
|
|
27831
28106
|
json_extract(attributes, '$.flagged') AS flagged`;
|
|
27832
28107
|
var CALL_PROMPT_TOKENS = `(coalesce(input_tokens, 0) + coalesce(cache_read_input_tokens, 0)
|
|
27833
|
-
+ coalesce(
|
|
28108
|
+
+ max(coalesce(cache_creation_input_tokens, 0),
|
|
28109
|
+
coalesce(ephemeral_1h_input_tokens, 0) + coalesce(ephemeral_5m_input_tokens, 0)))`;
|
|
27834
28110
|
var CALL_BAND = LONG_CONTEXT_THRESHOLDS.length === 0 ? "0" : LONG_CONTEXT_THRESHOLDS.map((t) => `(${CALL_PROMPT_TOKENS} > ${String(Math.trunc(t))})`).join(
|
|
27835
28111
|
" + "
|
|
27836
28112
|
);
|
|
@@ -36865,6 +37141,42 @@ function worstProbeMs(rule, now = wallClock, corroborate) {
|
|
|
36865
37141
|
}
|
|
36866
37142
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
36867
37143
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
37144
|
+
function repeatTo(unit, length) {
|
|
37145
|
+
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
37146
|
+
}
|
|
37147
|
+
function joinTo(length, open3, close, item) {
|
|
37148
|
+
const parts = [];
|
|
37149
|
+
let size = open3.length;
|
|
37150
|
+
for (let i = 0; size < length; i++) {
|
|
37151
|
+
const next = (i === 0 ? "" : ",") + item(i);
|
|
37152
|
+
parts.push(next);
|
|
37153
|
+
size += next.length;
|
|
37154
|
+
}
|
|
37155
|
+
return (open3 + parts.join("") + close).slice(0, length);
|
|
37156
|
+
}
|
|
37157
|
+
var SQL_WORDS = ["select", "insert", "update", "delete", "drop", "where"];
|
|
37158
|
+
var GROWTH_CORPORA = [
|
|
37159
|
+
{
|
|
37160
|
+
name: "one-line JSON dictionary",
|
|
37161
|
+
build: (length) => joinTo(length, "{", "}", (i) => `"id-${String(i)}":"label ${String(i)}"`)
|
|
37162
|
+
},
|
|
37163
|
+
{
|
|
37164
|
+
name: "JSON array of quoted SQL keywords",
|
|
37165
|
+
build: (length) => joinTo(length, "[", "]", (i) => `"${SQL_WORDS[i % SQL_WORDS.length] ?? ""} ${String(i)}"`)
|
|
37166
|
+
},
|
|
37167
|
+
{ name: "single-quoted keyword run ('where)", build: (length) => repeatTo("'where", length) },
|
|
37168
|
+
{
|
|
37169
|
+
name: 'double-quoted keyword literal run ("where" )',
|
|
37170
|
+
build: (length) => repeatTo('"where" ', length)
|
|
37171
|
+
},
|
|
37172
|
+
{ name: "double-quote run", build: (length) => repeatTo('"', length) },
|
|
37173
|
+
{ name: "space run", build: (length) => repeatTo(" ", length) },
|
|
37174
|
+
{ name: "newline run", build: (length) => repeatTo("\n", length) },
|
|
37175
|
+
...["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map((unit) => ({
|
|
37176
|
+
name: `unit run ${JSON.stringify(unit)}`,
|
|
37177
|
+
build: (length) => repeatTo(unit, length)
|
|
37178
|
+
}))
|
|
37179
|
+
];
|
|
36868
37180
|
function checkRuleTiming(rule, corroborate) {
|
|
36869
37181
|
const { ms, probe, corroboratedMs } = worstProbeMs(rule, wallClock, corroborate);
|
|
36870
37182
|
const work = corroboratedMs ?? 0;
|
|
@@ -37166,7 +37478,7 @@ var auth_jwt_no_verify_default = {
|
|
|
37166
37478
|
severity: "critical",
|
|
37167
37479
|
matcher: {
|
|
37168
37480
|
type: "regex",
|
|
37169
|
-
pattern: "(verify\\s*=\\s*false|verify_signature
|
|
37481
|
+
pattern: "(verify\\s*=\\s*false|verify_signature(?:(?!verify_signature).)*false|algorithms\\s*=\\s*\\[\\])",
|
|
37170
37482
|
flags: "gi"
|
|
37171
37483
|
},
|
|
37172
37484
|
requiresNearby: {
|
|
@@ -37254,7 +37566,7 @@ var cmd_inject_shell_default = {
|
|
|
37254
37566
|
severity: "critical",
|
|
37255
37567
|
matcher: {
|
|
37256
37568
|
type: "regex",
|
|
37257
|
-
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\([^)]*shell\\s*=\\s*True",
|
|
37569
|
+
pattern: "subprocess\\.(run|Popen|call|check_output)\\s*\\((?:(?!subprocess\\.(?:run|Popen|call|check_output)\\s*\\()[^)])*shell\\s*=\\s*True",
|
|
37258
37570
|
flags: "gi"
|
|
37259
37571
|
},
|
|
37260
37572
|
requiresNearby: {
|
|
@@ -37383,7 +37695,7 @@ var deser_yaml_unsafe_default = {
|
|
|
37383
37695
|
severity: "high",
|
|
37384
37696
|
matcher: {
|
|
37385
37697
|
type: "regex",
|
|
37386
|
-
pattern: "\\byaml\\.load\\s*\\((?![^)]
|
|
37698
|
+
pattern: "\\byaml\\.load\\s*\\((?!(?:(?!yaml\\.load\\s*\\()[^)])*?(?:SafeLoader|safe_load))",
|
|
37387
37699
|
flags: "gi"
|
|
37388
37700
|
},
|
|
37389
37701
|
examples: ["data = yaml.load(user_input)", "config = yaml.load(f)"],
|
|
@@ -37600,7 +37912,7 @@ var sql_inject_concat_dot_default = {
|
|
|
37600
37912
|
severity: "high",
|
|
37601
37913
|
matcher: {
|
|
37602
37914
|
type: "regex",
|
|
37603
|
-
pattern: `["'][
|
|
37915
|
+
pattern: `["'](?=([^"'\\n]*?(?:select|insert|update|delete|drop|where)))\\1(?:(?!["'][^"'\\n]*?(?:select|insert|update|delete|drop|where))[^\\n])*?["']\\s*\\.`,
|
|
37604
37916
|
flags: "gi"
|
|
37605
37917
|
},
|
|
37606
37918
|
appliesTo: {
|
|
@@ -37618,7 +37930,7 @@ var sql_inject_concat_default = {
|
|
|
37618
37930
|
severity: "high",
|
|
37619
37931
|
matcher: {
|
|
37620
37932
|
type: "regex",
|
|
37621
|
-
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*\\+`,
|
|
37933
|
+
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*\\+`,
|
|
37622
37934
|
flags: "gi"
|
|
37623
37935
|
},
|
|
37624
37936
|
examples: ['"SELECT * FROM users WHERE id = " + userId']
|
|
@@ -37633,7 +37945,7 @@ var sql_inject_format_default = {
|
|
|
37633
37945
|
severity: "high",
|
|
37634
37946
|
matcher: {
|
|
37635
37947
|
type: "regex",
|
|
37636
|
-
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]|\\{[^}]+\\})",
|
|
37948
|
+
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]+\\})",
|
|
37637
37949
|
flags: "gi"
|
|
37638
37950
|
},
|
|
37639
37951
|
examples: [
|
|
@@ -37651,7 +37963,7 @@ var sql_inject_interp_default = {
|
|
|
37651
37963
|
severity: "high",
|
|
37652
37964
|
matcher: {
|
|
37653
37965
|
type: "regex",
|
|
37654
|
-
pattern: "(select|insert|update|delete|where)[^\\n]*?(#\\{|\\$[a-z_])",
|
|
37966
|
+
pattern: "(select|insert|update|delete|where)(?:(?!(?:select|insert|update|delete|where))[^\\n])*?(#\\{|\\$[a-z_])",
|
|
37655
37967
|
flags: "gi"
|
|
37656
37968
|
},
|
|
37657
37969
|
examples: [
|
|
@@ -38026,7 +38338,7 @@ var stack_trace_default = {
|
|
|
38026
38338
|
severity: "low",
|
|
38027
38339
|
matcher: {
|
|
38028
38340
|
type: "regex",
|
|
38029
|
-
pattern: "(
|
|
38341
|
+
pattern: "(?:^|(?<!\\s)\\s+)at\\s+[A-Za-z0-9._$<>]+\\.[A-Za-z0-9_$]+\\s*\\([A-Za-z0-9._\\-/:]+:\\d+:\\d+\\)",
|
|
38030
38342
|
flags: "g"
|
|
38031
38343
|
},
|
|
38032
38344
|
examples: ["at com.example.service.UserService.findUser(UserService.java:42:13)"]
|
|
@@ -39184,7 +39496,7 @@ var BUNDLED_PACKS = [
|
|
|
39184
39496
|
{
|
|
39185
39497
|
packId: "code-flaws",
|
|
39186
39498
|
name: "Code Security Flaws",
|
|
39187
|
-
version: "0.1.
|
|
39499
|
+
version: "0.1.2",
|
|
39188
39500
|
rawRules: [
|
|
39189
39501
|
sql_inject_concat_default,
|
|
39190
39502
|
sql_inject_concat_dot_default,
|
|
@@ -39234,7 +39546,7 @@ var BUNDLED_PACKS = [
|
|
|
39234
39546
|
{
|
|
39235
39547
|
packId: "core-code-context",
|
|
39236
39548
|
name: "Code Context",
|
|
39237
|
-
version: "0.2.
|
|
39549
|
+
version: "0.2.2",
|
|
39238
39550
|
rawRules: [
|
|
39239
39551
|
internal_ip_default,
|
|
39240
39552
|
localhost_ref_default,
|
|
@@ -39684,9 +39996,10 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
39684
39996
|
if (job.timer !== void 0) return;
|
|
39685
39997
|
job.startedAt = performance.now();
|
|
39686
39998
|
job.progressAt = job.startedAt;
|
|
39999
|
+
const budget = job.deadlineAt === void 0 ? job.budgetMs : Math.max(0, Math.min(job.budgetMs, job.deadlineAt - job.startedAt));
|
|
39687
40000
|
job.timer = setTimeout(() => {
|
|
39688
40001
|
onDeadline(job);
|
|
39689
|
-
},
|
|
40002
|
+
}, budget);
|
|
39690
40003
|
}
|
|
39691
40004
|
function runOne(spec, fail) {
|
|
39692
40005
|
if (closed) {
|
|
@@ -39697,6 +40010,12 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
39697
40010
|
fail({ status: "unavailable", reason: `the scan worker crashed: ${broken}` });
|
|
39698
40011
|
return;
|
|
39699
40012
|
}
|
|
40013
|
+
const now = performance.now();
|
|
40014
|
+
const deadlineAt = spec.deadlineAt;
|
|
40015
|
+
if (deadlineAt !== void 0 && deadlineAt <= now) {
|
|
40016
|
+
fail({ status: "timeout", culpritIndex: void 0, elapsedMs: 0 });
|
|
40017
|
+
return;
|
|
40018
|
+
}
|
|
39700
40019
|
const started = ensureWorker();
|
|
39701
40020
|
if (!(started instanceof Worker)) {
|
|
39702
40021
|
broken = started.error;
|
|
@@ -39704,11 +40023,11 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
39704
40023
|
return;
|
|
39705
40024
|
}
|
|
39706
40025
|
const id = nextJobId++;
|
|
39707
|
-
const now = performance.now();
|
|
39708
40026
|
const job = {
|
|
39709
40027
|
id,
|
|
39710
40028
|
worker: started,
|
|
39711
40029
|
budgetMs: spec.budgetMs,
|
|
40030
|
+
deadlineAt,
|
|
39712
40031
|
startedAt: now,
|
|
39713
40032
|
progressIndex: -1,
|
|
39714
40033
|
progressAt: now,
|
|
@@ -39722,14 +40041,19 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
39722
40041
|
if (readyWorker === started) {
|
|
39723
40042
|
beginDeadline(job);
|
|
39724
40043
|
} else {
|
|
40044
|
+
const startBudget = spec.startBudgetMs ?? startBudgetMs;
|
|
40045
|
+
const callerLimited = deadlineAt !== void 0 && deadlineAt - now < startBudget;
|
|
40046
|
+
const startWaitMs = callerLimited ? deadlineAt - now : startBudget;
|
|
39725
40047
|
job.startupTimer = setTimeout(() => {
|
|
39726
40048
|
if (pending !== job) return;
|
|
39727
40049
|
kill(job.worker);
|
|
39728
|
-
failPending(
|
|
39729
|
-
status: "
|
|
39730
|
-
|
|
39731
|
-
|
|
39732
|
-
|
|
40050
|
+
failPending(
|
|
40051
|
+
callerLimited ? { status: "timeout", culpritIndex: void 0, elapsedMs: performance.now() - now } : {
|
|
40052
|
+
status: "unavailable",
|
|
40053
|
+
reason: `the scan worker did not start within ${String(startBudget)}ms`
|
|
40054
|
+
}
|
|
40055
|
+
);
|
|
40056
|
+
}, startWaitMs);
|
|
39733
40057
|
}
|
|
39734
40058
|
try {
|
|
39735
40059
|
started.postMessage(spec.build(id));
|
|
@@ -39758,7 +40082,9 @@ function createIsolatedScanner(data, opts = {}) {
|
|
|
39758
40082
|
return enqueue((resolve3) => {
|
|
39759
40083
|
runOne(
|
|
39760
40084
|
{
|
|
39761
|
-
budgetMs,
|
|
40085
|
+
budgetMs: scanOpts?.budgetMs ?? budgetMs,
|
|
40086
|
+
startBudgetMs: scanOpts?.startBudgetMs,
|
|
40087
|
+
deadlineAt: scanOpts?.deadlineAt,
|
|
39762
40088
|
build: (id) => ({
|
|
39763
40089
|
kind: "scan",
|
|
39764
40090
|
id,
|
|
@@ -39952,6 +40278,9 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
39952
40278
|
let unverified = partition.unverified;
|
|
39953
40279
|
let isolated = unverified.length > 0 ? createIsolatedScanner({ verified, unverified }, opts) : void 0;
|
|
39954
40280
|
let retired = false;
|
|
40281
|
+
let bounded;
|
|
40282
|
+
let boundedWarned = false;
|
|
40283
|
+
let closed = false;
|
|
39955
40284
|
function inProcess(text, context) {
|
|
39956
40285
|
return scan(text, verified, context);
|
|
39957
40286
|
}
|
|
@@ -40013,11 +40342,48 @@ function createGuardedScanner(partition, gateway, opts) {
|
|
|
40013
40342
|
await degrade();
|
|
40014
40343
|
return inProcess(text, context);
|
|
40015
40344
|
}
|
|
40345
|
+
async function scanBounded(text, context, bound) {
|
|
40346
|
+
const remainingMs = bound.remainingMs;
|
|
40347
|
+
let outcome;
|
|
40348
|
+
if (closed) {
|
|
40349
|
+
outcome = { status: "unavailable", reason: "the scan worker is closed" };
|
|
40350
|
+
} else if (remainingMs !== void 0 && !(remainingMs > 0)) {
|
|
40351
|
+
outcome = { status: "timeout", culpritIndex: void 0, elapsedMs: 0 };
|
|
40352
|
+
} else {
|
|
40353
|
+
bounded ??= createIsolatedScanner({ verified, unverified }, opts);
|
|
40354
|
+
const deadlineAt = remainingMs === void 0 ? void 0 : performance.now() + remainingMs;
|
|
40355
|
+
try {
|
|
40356
|
+
outcome = await bounded.scan(text, context, {
|
|
40357
|
+
budgetMs: bound.budgetMs,
|
|
40358
|
+
startBudgetMs: bound.startBudgetMs,
|
|
40359
|
+
deadlineAt
|
|
40360
|
+
});
|
|
40361
|
+
} catch (error62) {
|
|
40362
|
+
outcome = {
|
|
40363
|
+
status: "unavailable",
|
|
40364
|
+
reason: error62 instanceof Error ? error62.message : "the scan worker failed unexpectedly"
|
|
40365
|
+
};
|
|
40366
|
+
}
|
|
40367
|
+
}
|
|
40368
|
+
if (outcome.status !== "ok" && !boundedWarned) {
|
|
40369
|
+
boundedWarned = true;
|
|
40370
|
+
process.stderr.write(
|
|
40371
|
+
outcome.status === "timeout" ? `[aka] a large input could not be scanned within its time limit and was refused.
|
|
40372
|
+
` : `[aka] a large input could not be scanned and was refused: ${outcome.reason}.
|
|
40373
|
+
`
|
|
40374
|
+
);
|
|
40375
|
+
}
|
|
40376
|
+
return outcome;
|
|
40377
|
+
}
|
|
40016
40378
|
return {
|
|
40017
40379
|
scan: guardedScan,
|
|
40380
|
+
scanBounded,
|
|
40018
40381
|
degraded: () => retired,
|
|
40019
40382
|
async close() {
|
|
40020
|
-
|
|
40383
|
+
closed = true;
|
|
40384
|
+
const live = bounded;
|
|
40385
|
+
bounded = void 0;
|
|
40386
|
+
await Promise.all([retire(), live?.close()]);
|
|
40021
40387
|
}
|
|
40022
40388
|
};
|
|
40023
40389
|
}
|
|
@@ -40303,6 +40669,19 @@ function conditionsMatch(conditions, ctx) {
|
|
|
40303
40669
|
if (conditions.provider !== void 0) return false;
|
|
40304
40670
|
return true;
|
|
40305
40671
|
}
|
|
40672
|
+
var LARGE_INPUT_THRESHOLD_CHARS = 32768;
|
|
40673
|
+
var LARGE_INPUT_SCAN_BUDGET_MS = 2e3;
|
|
40674
|
+
var LARGE_INPUT_START_BUDGET_MS = 1500;
|
|
40675
|
+
function readRemainingMs(largeInput) {
|
|
40676
|
+
const read = largeInput.remainingMs;
|
|
40677
|
+
if (read === void 0) return void 0;
|
|
40678
|
+
try {
|
|
40679
|
+
const remaining = read();
|
|
40680
|
+
return typeof remaining !== "number" || Number.isNaN(remaining) ? 0 : remaining;
|
|
40681
|
+
} catch {
|
|
40682
|
+
return 0;
|
|
40683
|
+
}
|
|
40684
|
+
}
|
|
40306
40685
|
var bundlesPacked = false;
|
|
40307
40686
|
function createPluginRuntime(gateway, settings, opts) {
|
|
40308
40687
|
if (!bundlesPacked) {
|
|
@@ -40312,6 +40691,7 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
40312
40691
|
const policyMode = settings.policy;
|
|
40313
40692
|
let redactFallback = settings.redactFallback;
|
|
40314
40693
|
const dataDir2 = opts?.dataDir;
|
|
40694
|
+
const largeInput = opts?.largeInput;
|
|
40315
40695
|
let rules = [];
|
|
40316
40696
|
let evidenceOf = evidenceLookup(rules);
|
|
40317
40697
|
let scanner;
|
|
@@ -40524,7 +40904,24 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
40524
40904
|
await ensureInitialized();
|
|
40525
40905
|
if (!scanner) throw new Error("the runtime initialized without a scanner");
|
|
40526
40906
|
const shielded = shieldPointers(text);
|
|
40527
|
-
|
|
40907
|
+
let matched;
|
|
40908
|
+
if (largeInput !== void 0 && shielded.text.length >= largeInput.thresholdChars) {
|
|
40909
|
+
const outcome = await scanner.scanBounded(shielded.text, context, {
|
|
40910
|
+
budgetMs: largeInput.budgetMs,
|
|
40911
|
+
startBudgetMs: largeInput.startBudgetMs,
|
|
40912
|
+
remainingMs: readRemainingMs(largeInput)
|
|
40913
|
+
});
|
|
40914
|
+
if (outcome.status !== "ok") {
|
|
40915
|
+
return {
|
|
40916
|
+
decision: { action: "block", text: null, findings: [], scanIncomplete: outcome.status },
|
|
40917
|
+
excepted: /* @__PURE__ */ new Set(),
|
|
40918
|
+
exceptionIds: []
|
|
40919
|
+
};
|
|
40920
|
+
}
|
|
40921
|
+
matched = outcome.findings;
|
|
40922
|
+
} else {
|
|
40923
|
+
matched = await scanner.scan(shielded.text, context);
|
|
40924
|
+
}
|
|
40528
40925
|
const findings = dropShieldedFindings(matched, shielded.spans);
|
|
40529
40926
|
const fpCache = /* @__PURE__ */ new Map();
|
|
40530
40927
|
const { excepted, exceptionIds } = await applyExceptions(findings, ctx, fpCache);
|
|
@@ -40565,20 +40962,24 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
40565
40962
|
}
|
|
40566
40963
|
async function persistCapture(input2, opts2, { decision, excepted, exceptionIds, timingStartedAt }) {
|
|
40567
40964
|
const filePath = input2.metadata?.filePath;
|
|
40568
|
-
if (opts2.persist === "with-findings" && decision.findings.length === 0)
|
|
40965
|
+
if (opts2.persist === "with-findings" && decision.findings.length === 0 && decision.scanIncomplete === void 0) {
|
|
40966
|
+
return;
|
|
40967
|
+
}
|
|
40569
40968
|
try {
|
|
40570
40969
|
const contentHash = contentHashOf(input2.text);
|
|
40571
40970
|
const maskedFindings = decision.findings.filter(
|
|
40572
40971
|
(match) => isActionAtLeast(actionForFinding(match, excepted, opts2.rewritable), "redact")
|
|
40573
40972
|
);
|
|
40574
|
-
const storedContent = maskedFindings.length > 0 ? redact(input2.text, maskedFindings) : input2.text;
|
|
40973
|
+
const storedContent = decision.scanIncomplete !== void 0 ? "" : maskedFindings.length > 0 ? redact(input2.text, maskedFindings) : input2.text;
|
|
40575
40974
|
const inspectionMs = elapsedMs(timingStartedAt);
|
|
40576
40975
|
const redactDegradedTo = decision.redactDegradedTo;
|
|
40577
|
-
const
|
|
40976
|
+
const scanIncomplete = decision.scanIncomplete;
|
|
40977
|
+
const metadata = exceptionIds.length > 0 || inspectionMs !== void 0 || redactDegradedTo !== void 0 || scanIncomplete !== void 0 ? {
|
|
40578
40978
|
...input2.metadata,
|
|
40579
40979
|
...exceptionIds.length > 0 ? { exceptionIds } : {},
|
|
40580
40980
|
...inspectionMs !== void 0 ? { inspectionMs } : {},
|
|
40581
|
-
...redactDegradedTo !== void 0 ? { redactDegradedTo } : {}
|
|
40981
|
+
...redactDegradedTo !== void 0 ? { redactDegradedTo } : {},
|
|
40982
|
+
...scanIncomplete !== void 0 ? { scanIncomplete } : {}
|
|
40582
40983
|
} : input2.metadata;
|
|
40583
40984
|
const event = buildIngestEvent({
|
|
40584
40985
|
kind: input2.kind,
|
|
@@ -40699,51 +41100,15 @@ function createPluginRuntime(gateway, settings, opts) {
|
|
|
40699
41100
|
};
|
|
40700
41101
|
}
|
|
40701
41102
|
|
|
40702
|
-
// src/
|
|
40703
|
-
var
|
|
40704
|
-
|
|
40705
|
-
|
|
40706
|
-
|
|
40707
|
-
|
|
40708
|
-
|
|
40709
|
-
|
|
40710
|
-
|
|
40711
|
-
// --color-brand · ▸▸ AKA wordmark (accent text)
|
|
40712
|
-
dim: fg("#838995"),
|
|
40713
|
-
// --color-text-3 · separators · "/100" · the "unreviewed" label
|
|
40714
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
40715
|
-
// the health score number
|
|
40716
|
-
ok: fg("#0db15f"),
|
|
40717
|
-
// --color-ok · healthy ● dot
|
|
40718
|
-
critical: fg("#e63448"),
|
|
40719
|
-
// --color-sev-critical · ■ and the open-findings flag
|
|
40720
|
-
high: fg("#e97a0a"),
|
|
40721
|
-
// --color-sev-high · ■ and the mid-health dot
|
|
40722
|
-
medium: fg("#f7bd00"),
|
|
40723
|
-
// --color-sev-medium · ■
|
|
40724
|
-
low: fg("#0581d4")
|
|
40725
|
-
// --color-sev-low · ■ (azure blue, not purple)
|
|
40726
|
-
};
|
|
40727
|
-
|
|
40728
|
-
// src/exception-guidance.ts
|
|
40729
|
-
function blockMessage(input2) {
|
|
40730
|
-
const preview = input2.blockedRef ? ` (${input2.blockedRef.maskedValue})` : "";
|
|
40731
|
-
const commands = input2.blockedRef ? [
|
|
40732
|
-
` aka exception approve ${input2.blockedRef.reference} (asks for scope + reason, then resubmit)`,
|
|
40733
|
-
" aka exception approve <value> (same flow, pasting the blocked value itself)"
|
|
40734
|
-
] : [" aka exception approve (asks for scope + reason, then resubmit)"];
|
|
40735
|
-
const note = input2.note ? ` ${input2.note}` : "";
|
|
40736
|
-
return [
|
|
40737
|
-
`AKA blocked this ${input2.subject} \u2014 flagged ${input2.ruleIds}${preview}.${note} Remove the flagged content and resubmit.`,
|
|
40738
|
-
"If this is intentional and you accept the risk, grant an exception:",
|
|
40739
|
-
...commands,
|
|
40740
|
-
"More: aka exception --help"
|
|
40741
|
-
].join("\n");
|
|
40742
|
-
}
|
|
40743
|
-
function exceptionPointer(references) {
|
|
40744
|
-
const ref = references?.[0];
|
|
40745
|
-
if (ref === void 0) return "";
|
|
40746
|
-
return ` To allow this exact value intentionally, run: aka exception approve ${ref.reference}.`;
|
|
41103
|
+
// src/hooks/large-input.ts
|
|
41104
|
+
var HOOK_SCAN_DEADLINE_MS = 6e3;
|
|
41105
|
+
function largeInputBound(deadlineAt, now = () => performance.now()) {
|
|
41106
|
+
return {
|
|
41107
|
+
thresholdChars: LARGE_INPUT_THRESHOLD_CHARS,
|
|
41108
|
+
budgetMs: LARGE_INPUT_SCAN_BUDGET_MS,
|
|
41109
|
+
startBudgetMs: LARGE_INPUT_START_BUDGET_MS,
|
|
41110
|
+
remainingMs: () => deadlineAt - now()
|
|
41111
|
+
};
|
|
40747
41112
|
}
|
|
40748
41113
|
|
|
40749
41114
|
// src/hooks/model-guard.ts
|
|
@@ -42214,6 +42579,7 @@ var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
|
42214
42579
|
var TRACE_ID = EventMetadata.shape.traceId;
|
|
42215
42580
|
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
42216
42581
|
var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
42582
|
+
var SCAN_INCOMPLETE = EventMetadata.shape.scanIncomplete.unwrap();
|
|
42217
42583
|
|
|
42218
42584
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
42219
42585
|
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|
|
@@ -43395,6 +43761,79 @@ function warnIfStoreRedirected(config2, sessionId, write = (message) => void pro
|
|
|
43395
43761
|
}
|
|
43396
43762
|
}
|
|
43397
43763
|
|
|
43764
|
+
// src/present.ts
|
|
43765
|
+
var fg = (hex3) => (text) => {
|
|
43766
|
+
const r = Number.parseInt(hex3.slice(1, 3), 16);
|
|
43767
|
+
const g = Number.parseInt(hex3.slice(3, 5), 16);
|
|
43768
|
+
const b = Number.parseInt(hex3.slice(5, 7), 16);
|
|
43769
|
+
return `\x1B[38;2;${String(r)};${String(g)};${String(b)}m${text}\x1B[0m`;
|
|
43770
|
+
};
|
|
43771
|
+
var paint = {
|
|
43772
|
+
brand: fg("#33e6c6"),
|
|
43773
|
+
// --color-brand · ▸▸ AKA wordmark (accent text)
|
|
43774
|
+
dim: fg("#838995"),
|
|
43775
|
+
// --color-text-3 · separators · "/100" · the "unreviewed" label
|
|
43776
|
+
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
43777
|
+
// the health score number
|
|
43778
|
+
ok: fg("#0db15f"),
|
|
43779
|
+
// --color-ok · healthy ● dot
|
|
43780
|
+
critical: fg("#e63448"),
|
|
43781
|
+
// --color-sev-critical · ■ and the open-findings flag
|
|
43782
|
+
high: fg("#e97a0a"),
|
|
43783
|
+
// --color-sev-high · ■ and the mid-health dot
|
|
43784
|
+
medium: fg("#f7bd00"),
|
|
43785
|
+
// --color-sev-medium · ■
|
|
43786
|
+
low: fg("#0581d4")
|
|
43787
|
+
// --color-sev-low · ■ (azure blue, not purple)
|
|
43788
|
+
};
|
|
43789
|
+
|
|
43790
|
+
// src/exception-guidance.ts
|
|
43791
|
+
function blockMessage(input2) {
|
|
43792
|
+
const preview = input2.blockedRef ? ` (${input2.blockedRef.maskedValue})` : "";
|
|
43793
|
+
const commands = input2.blockedRef ? [
|
|
43794
|
+
` aka exception approve ${input2.blockedRef.reference} (asks for scope + reason, then resubmit)`,
|
|
43795
|
+
" aka exception approve <value> (same flow, pasting the blocked value itself)"
|
|
43796
|
+
] : [" aka exception approve (asks for scope + reason, then resubmit)"];
|
|
43797
|
+
const note = input2.note ? ` ${input2.note}` : "";
|
|
43798
|
+
return [
|
|
43799
|
+
`AKA blocked this ${input2.subject} \u2014 flagged ${input2.ruleIds}${preview}.${note} Remove the flagged content and resubmit.`,
|
|
43800
|
+
"If this is intentional and you accept the risk, grant an exception:",
|
|
43801
|
+
...commands,
|
|
43802
|
+
"More: aka exception --help"
|
|
43803
|
+
].join("\n");
|
|
43804
|
+
}
|
|
43805
|
+
function tooLargeToScanMessage(subject) {
|
|
43806
|
+
return `This ${subject} is too large for AKA to scan within the time limit, so it was blocked. Shorten it or send it in smaller parts.`;
|
|
43807
|
+
}
|
|
43808
|
+
function exceptionPointer(references) {
|
|
43809
|
+
const ref = references?.[0];
|
|
43810
|
+
if (ref === void 0) return "";
|
|
43811
|
+
return ` To allow this exact value intentionally, run: aka exception approve ${ref.reference}.`;
|
|
43812
|
+
}
|
|
43813
|
+
|
|
43814
|
+
// src/hooks/user-prompt-submit-decision.ts
|
|
43815
|
+
function decideUserPromptSubmit(result) {
|
|
43816
|
+
if (result.scanIncomplete !== void 0) {
|
|
43817
|
+
return { decision: "block", reason: tooLargeToScanMessage("prompt") };
|
|
43818
|
+
}
|
|
43819
|
+
if (result.action === "block" || result.action === "redact") {
|
|
43820
|
+
return {
|
|
43821
|
+
decision: "block",
|
|
43822
|
+
reason: blockMessage({
|
|
43823
|
+
subject: "prompt",
|
|
43824
|
+
ruleIds: uniqueRuleIds(result.findings),
|
|
43825
|
+
blockedRef: result.blockedReferences?.[0]
|
|
43826
|
+
})
|
|
43827
|
+
};
|
|
43828
|
+
}
|
|
43829
|
+
if (result.action === "warn") {
|
|
43830
|
+
return {
|
|
43831
|
+
systemMessage: `AKA flagged sensitive content (${uniqueRuleIds(result.findings)}) \u2014 sent unchanged.${exceptionPointer(result.blockedReferences)}`
|
|
43832
|
+
};
|
|
43833
|
+
}
|
|
43834
|
+
return null;
|
|
43835
|
+
}
|
|
43836
|
+
|
|
43398
43837
|
// src/hooks/user-prompt-submit.ts
|
|
43399
43838
|
async function main() {
|
|
43400
43839
|
const input2 = parseJson(await readStdin());
|
|
@@ -43423,7 +43862,10 @@ async function main() {
|
|
|
43423
43862
|
)) {
|
|
43424
43863
|
return;
|
|
43425
43864
|
}
|
|
43426
|
-
const runtime = createPluginRuntime(gateway, config2.settings, {
|
|
43865
|
+
const runtime = createPluginRuntime(gateway, config2.settings, {
|
|
43866
|
+
dataDir: config2.dataDir,
|
|
43867
|
+
largeInput: largeInputBound(HOOK_SCAN_DEADLINE_MS)
|
|
43868
|
+
});
|
|
43427
43869
|
let result;
|
|
43428
43870
|
try {
|
|
43429
43871
|
result = await runtime.capture({
|
|
@@ -43436,21 +43878,9 @@ async function main() {
|
|
|
43436
43878
|
} finally {
|
|
43437
43879
|
await runtime.close();
|
|
43438
43880
|
}
|
|
43439
|
-
|
|
43440
|
-
|
|
43441
|
-
|
|
43442
|
-
reason: blockMessage({
|
|
43443
|
-
subject: "prompt",
|
|
43444
|
-
ruleIds: uniqueRuleIds(result.findings),
|
|
43445
|
-
blockedRef: result.blockedReferences?.[0]
|
|
43446
|
-
})
|
|
43447
|
-
});
|
|
43448
|
-
return;
|
|
43449
|
-
}
|
|
43450
|
-
if (result.action === "warn") {
|
|
43451
|
-
await emit({
|
|
43452
|
-
systemMessage: `AKA flagged sensitive content (${uniqueRuleIds(result.findings)}) \u2014 sent unchanged.${exceptionPointer(result.blockedReferences)}`
|
|
43453
|
-
});
|
|
43881
|
+
const decision = decideUserPromptSubmit(result);
|
|
43882
|
+
if (decision !== null) {
|
|
43883
|
+
await emit(decision);
|
|
43454
43884
|
return;
|
|
43455
43885
|
}
|
|
43456
43886
|
if (!config2.onboarded && claimOnboardingNudge(config2.dataDir, sessionId)) {
|