@akasecurity/ai-tc-claude-code 0.9.5 → 0.9.6
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/.claude-plugin/plugin.json +1 -1
- package/commands/setup.md +23 -0
- package/package.json +4 -4
- package/scripts/apply-suppressions.js +61 -13
- package/scripts/backfill.js +64 -15
- package/scripts/filescan.js +73 -24
- package/scripts/firstrun.js +52 -8
- package/scripts/intro.js +49 -5
- package/scripts/message-display.js +58 -10
- package/scripts/onboard.js +49 -5
- package/scripts/post-tool-use.js +62 -13
- package/scripts/pre-tool-use.js +62 -13
- package/scripts/query.js +54 -10
- package/scripts/reconcile.js +60 -12
- package/scripts/remediate.js +67 -18
- package/scripts/scan-worker.js +61 -12
- package/scripts/session-start.js +86 -32
- package/scripts/start-light.js +52 -8
- package/scripts/statusline.js +51 -7
- package/scripts/stop.js +49 -5
- package/scripts/user-prompt-submit.js +175 -108
package/scripts/start-light.js
CHANGED
|
@@ -18255,6 +18255,40 @@ function escapeRegExp2(value) {
|
|
|
18255
18255
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18256
18256
|
}
|
|
18257
18257
|
|
|
18258
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18259
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18260
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18261
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18262
|
+
function listCache(kind) {
|
|
18263
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18264
|
+
}
|
|
18265
|
+
function memoizedRegExp(owner, build) {
|
|
18266
|
+
const cached2 = singles.get(owner);
|
|
18267
|
+
if (cached2 !== void 0) {
|
|
18268
|
+
cached2.lastIndex = 0;
|
|
18269
|
+
return cached2;
|
|
18270
|
+
}
|
|
18271
|
+
const compiled = build();
|
|
18272
|
+
singles.set(owner, compiled);
|
|
18273
|
+
return compiled;
|
|
18274
|
+
}
|
|
18275
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18276
|
+
const cache = listCache(kind);
|
|
18277
|
+
const cached2 = cache.get(owner);
|
|
18278
|
+
if (cached2 !== void 0) {
|
|
18279
|
+
if (cached2.stateful) {
|
|
18280
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18281
|
+
}
|
|
18282
|
+
return cached2.entries;
|
|
18283
|
+
}
|
|
18284
|
+
const entries = build();
|
|
18285
|
+
cache.set(owner, {
|
|
18286
|
+
entries,
|
|
18287
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18288
|
+
});
|
|
18289
|
+
return entries;
|
|
18290
|
+
}
|
|
18291
|
+
|
|
18258
18292
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18259
18293
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18260
18294
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18265,10 +18299,17 @@ var KeywordMatcher2 = class {
|
|
|
18265
18299
|
if (rule.matcher.type !== "keyword") return [];
|
|
18266
18300
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18267
18301
|
const spans = [];
|
|
18268
|
-
|
|
18269
|
-
|
|
18302
|
+
const compiled = memoizedRegExpList(
|
|
18303
|
+
"keyword",
|
|
18304
|
+
rule.matcher,
|
|
18305
|
+
() => keywords.map((kw) => {
|
|
18306
|
+
if (kw.length === 0) return void 0;
|
|
18307
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18308
|
+
})
|
|
18309
|
+
);
|
|
18310
|
+
for (const re of compiled) {
|
|
18311
|
+
if (re === void 0) continue;
|
|
18270
18312
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18271
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18272
18313
|
let m;
|
|
18273
18314
|
while ((m = re.exec(text)) !== null) {
|
|
18274
18315
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18284,7 +18325,10 @@ var RegexMatcher2 = class {
|
|
|
18284
18325
|
match(text, rule) {
|
|
18285
18326
|
if (rule.matcher.type !== "regex") return [];
|
|
18286
18327
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18287
|
-
const re =
|
|
18328
|
+
const re = memoizedRegExp(
|
|
18329
|
+
rule.matcher,
|
|
18330
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18331
|
+
);
|
|
18288
18332
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18289
18333
|
const spans = [];
|
|
18290
18334
|
let m;
|
|
@@ -18417,7 +18461,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
18417
18461
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18418
18462
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18419
18463
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18420
|
-
import { basename as basename5, join as join12
|
|
18464
|
+
import { basename as basename5, join as join12 } from "path";
|
|
18421
18465
|
|
|
18422
18466
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18423
18467
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -18615,8 +18659,8 @@ function table(headers, rows, opts = {}) {
|
|
|
18615
18659
|
const widths = headers.map(
|
|
18616
18660
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
18617
18661
|
);
|
|
18618
|
-
const
|
|
18619
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
18662
|
+
const sep4 = " ".repeat(gap);
|
|
18663
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
18620
18664
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
18621
18665
|
if (opts.rowSep === true) {
|
|
18622
18666
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -18628,7 +18672,7 @@ function table(headers, rows, opts = {}) {
|
|
|
18628
18672
|
});
|
|
18629
18673
|
return [headerLine, rule, ...body].join("\n");
|
|
18630
18674
|
}
|
|
18631
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
18675
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
18632
18676
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
18633
18677
|
}
|
|
18634
18678
|
function fenced(body) {
|
package/scripts/statusline.js
CHANGED
|
@@ -25926,6 +25926,40 @@ function escapeRegExp2(value) {
|
|
|
25926
25926
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25927
25927
|
}
|
|
25928
25928
|
|
|
25929
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
25930
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
25931
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
25932
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
25933
|
+
function listCache(kind) {
|
|
25934
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
25935
|
+
}
|
|
25936
|
+
function memoizedRegExp(owner, build) {
|
|
25937
|
+
const cached2 = singles.get(owner);
|
|
25938
|
+
if (cached2 !== void 0) {
|
|
25939
|
+
cached2.lastIndex = 0;
|
|
25940
|
+
return cached2;
|
|
25941
|
+
}
|
|
25942
|
+
const compiled = build();
|
|
25943
|
+
singles.set(owner, compiled);
|
|
25944
|
+
return compiled;
|
|
25945
|
+
}
|
|
25946
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
25947
|
+
const cache = listCache(kind);
|
|
25948
|
+
const cached2 = cache.get(owner);
|
|
25949
|
+
if (cached2 !== void 0) {
|
|
25950
|
+
if (cached2.stateful) {
|
|
25951
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
25952
|
+
}
|
|
25953
|
+
return cached2.entries;
|
|
25954
|
+
}
|
|
25955
|
+
const entries = build();
|
|
25956
|
+
cache.set(owner, {
|
|
25957
|
+
entries,
|
|
25958
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
25959
|
+
});
|
|
25960
|
+
return entries;
|
|
25961
|
+
}
|
|
25962
|
+
|
|
25929
25963
|
// ../../packages/detections/src/matchers/limits.ts
|
|
25930
25964
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
25931
25965
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -25936,10 +25970,17 @@ var KeywordMatcher2 = class {
|
|
|
25936
25970
|
if (rule.matcher.type !== "keyword") return [];
|
|
25937
25971
|
const { keywords, caseSensitive } = rule.matcher;
|
|
25938
25972
|
const spans = [];
|
|
25939
|
-
|
|
25940
|
-
|
|
25973
|
+
const compiled = memoizedRegExpList(
|
|
25974
|
+
"keyword",
|
|
25975
|
+
rule.matcher,
|
|
25976
|
+
() => keywords.map((kw) => {
|
|
25977
|
+
if (kw.length === 0) return void 0;
|
|
25978
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25979
|
+
})
|
|
25980
|
+
);
|
|
25981
|
+
for (const re of compiled) {
|
|
25982
|
+
if (re === void 0) continue;
|
|
25941
25983
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
25942
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
25943
25984
|
let m;
|
|
25944
25985
|
while ((m = re.exec(text)) !== null) {
|
|
25945
25986
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -25955,7 +25996,10 @@ var RegexMatcher2 = class {
|
|
|
25955
25996
|
match(text, rule) {
|
|
25956
25997
|
if (rule.matcher.type !== "regex") return [];
|
|
25957
25998
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
25958
|
-
const re =
|
|
25999
|
+
const re = memoizedRegExp(
|
|
26000
|
+
rule.matcher,
|
|
26001
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26002
|
+
);
|
|
25959
26003
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
25960
26004
|
const spans = [];
|
|
25961
26005
|
let m;
|
|
@@ -28113,7 +28157,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
28113
28157
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
28114
28158
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
28115
28159
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
28116
|
-
import { basename as basename5, join as join12
|
|
28160
|
+
import { basename as basename5, join as join12 } from "path";
|
|
28117
28161
|
|
|
28118
28162
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
28119
28163
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -28598,14 +28642,14 @@ function renderStatusBar(s, opts = {}) {
|
|
|
28598
28642
|
const unreviewed = `unreviewed ${SHADE.full}${String(u.critical)} ${SHADE.dark}${String(u.high)} ${SHADE.medium}${String(u.medium)} ${SHADE.light}${String(u.low)}`;
|
|
28599
28643
|
return `\u25B8\u25B8 AKA health ${String(s.score)}/100 ${unreviewed} \u2691 ${String(s.openFindings)} open findings`;
|
|
28600
28644
|
}
|
|
28601
|
-
const
|
|
28645
|
+
const sep4 = ` ${paint.dim("\u2502")} `;
|
|
28602
28646
|
const sq = "\u25A0";
|
|
28603
28647
|
const dot = s.score >= 80 ? paint.ok("\u25CF") : s.score >= 50 ? paint.high("\u25CF") : paint.critical("\u25CF");
|
|
28604
28648
|
const score = `${dot} health ${paint.bold(String(s.score))}${paint.dim("/100")}`;
|
|
28605
28649
|
const tally = `${paint.dim("unreviewed")} ${paint.critical(sq)}${String(u.critical)} ${paint.high(sq)}${String(u.high)} ${paint.medium(sq)}${String(u.medium)} ${paint.low(sq)}${String(u.low)}`;
|
|
28606
28650
|
const flag = s.openFindings > 0 ? paint.critical("\u2691") : paint.dim("\u2691");
|
|
28607
28651
|
const open2 = `${flag} ${String(s.openFindings)} open findings`;
|
|
28608
|
-
return `${paint.brand("\u25B8\u25B8 AKA")}${
|
|
28652
|
+
return `${paint.brand("\u25B8\u25B8 AKA")}${sep4}${score}${sep4}${tally}${sep4}${open2}`;
|
|
28609
28653
|
}
|
|
28610
28654
|
function renderStatusLine(summary) {
|
|
28611
28655
|
return renderStatusBar(findingStatus(summary), { color: true });
|
package/scripts/stop.js
CHANGED
|
@@ -18395,6 +18395,40 @@ function escapeRegExp2(value) {
|
|
|
18395
18395
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18396
18396
|
}
|
|
18397
18397
|
|
|
18398
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18399
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18400
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18401
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18402
|
+
function listCache(kind) {
|
|
18403
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18404
|
+
}
|
|
18405
|
+
function memoizedRegExp(owner, build) {
|
|
18406
|
+
const cached2 = singles.get(owner);
|
|
18407
|
+
if (cached2 !== void 0) {
|
|
18408
|
+
cached2.lastIndex = 0;
|
|
18409
|
+
return cached2;
|
|
18410
|
+
}
|
|
18411
|
+
const compiled = build();
|
|
18412
|
+
singles.set(owner, compiled);
|
|
18413
|
+
return compiled;
|
|
18414
|
+
}
|
|
18415
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18416
|
+
const cache = listCache(kind);
|
|
18417
|
+
const cached2 = cache.get(owner);
|
|
18418
|
+
if (cached2 !== void 0) {
|
|
18419
|
+
if (cached2.stateful) {
|
|
18420
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18421
|
+
}
|
|
18422
|
+
return cached2.entries;
|
|
18423
|
+
}
|
|
18424
|
+
const entries = build();
|
|
18425
|
+
cache.set(owner, {
|
|
18426
|
+
entries,
|
|
18427
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18428
|
+
});
|
|
18429
|
+
return entries;
|
|
18430
|
+
}
|
|
18431
|
+
|
|
18398
18432
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18399
18433
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18400
18434
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18405,10 +18439,17 @@ var KeywordMatcher2 = class {
|
|
|
18405
18439
|
if (rule.matcher.type !== "keyword") return [];
|
|
18406
18440
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18407
18441
|
const spans = [];
|
|
18408
|
-
|
|
18409
|
-
|
|
18442
|
+
const compiled = memoizedRegExpList(
|
|
18443
|
+
"keyword",
|
|
18444
|
+
rule.matcher,
|
|
18445
|
+
() => keywords.map((kw) => {
|
|
18446
|
+
if (kw.length === 0) return void 0;
|
|
18447
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18448
|
+
})
|
|
18449
|
+
);
|
|
18450
|
+
for (const re of compiled) {
|
|
18451
|
+
if (re === void 0) continue;
|
|
18410
18452
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18411
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18412
18453
|
let m;
|
|
18413
18454
|
while ((m = re.exec(text)) !== null) {
|
|
18414
18455
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18424,7 +18465,10 @@ var RegexMatcher2 = class {
|
|
|
18424
18465
|
match(text, rule) {
|
|
18425
18466
|
if (rule.matcher.type !== "regex") return [];
|
|
18426
18467
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18427
|
-
const re =
|
|
18468
|
+
const re = memoizedRegExp(
|
|
18469
|
+
rule.matcher,
|
|
18470
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18471
|
+
);
|
|
18428
18472
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18429
18473
|
const spans = [];
|
|
18430
18474
|
let m;
|
|
@@ -18557,7 +18601,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
18557
18601
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18558
18602
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18559
18603
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18560
|
-
import { basename as basename5, join as join12
|
|
18604
|
+
import { basename as basename5, join as join12 } from "path";
|
|
18561
18605
|
|
|
18562
18606
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18563
18607
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -26957,6 +26957,40 @@ function escapeRegExp2(value) {
|
|
|
26957
26957
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26958
26958
|
}
|
|
26959
26959
|
|
|
26960
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26961
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26962
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26963
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26964
|
+
function listCache(kind) {
|
|
26965
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26966
|
+
}
|
|
26967
|
+
function memoizedRegExp(owner, build) {
|
|
26968
|
+
const cached2 = singles.get(owner);
|
|
26969
|
+
if (cached2 !== void 0) {
|
|
26970
|
+
cached2.lastIndex = 0;
|
|
26971
|
+
return cached2;
|
|
26972
|
+
}
|
|
26973
|
+
const compiled = build();
|
|
26974
|
+
singles.set(owner, compiled);
|
|
26975
|
+
return compiled;
|
|
26976
|
+
}
|
|
26977
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26978
|
+
const cache = listCache(kind);
|
|
26979
|
+
const cached2 = cache.get(owner);
|
|
26980
|
+
if (cached2 !== void 0) {
|
|
26981
|
+
if (cached2.stateful) {
|
|
26982
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26983
|
+
}
|
|
26984
|
+
return cached2.entries;
|
|
26985
|
+
}
|
|
26986
|
+
const entries = build();
|
|
26987
|
+
cache.set(owner, {
|
|
26988
|
+
entries,
|
|
26989
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26990
|
+
});
|
|
26991
|
+
return entries;
|
|
26992
|
+
}
|
|
26993
|
+
|
|
26960
26994
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26961
26995
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26962
26996
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26967,10 +27001,17 @@ var KeywordMatcher2 = class {
|
|
|
26967
27001
|
if (rule.matcher.type !== "keyword") return [];
|
|
26968
27002
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26969
27003
|
const spans = [];
|
|
26970
|
-
|
|
26971
|
-
|
|
27004
|
+
const compiled = memoizedRegExpList(
|
|
27005
|
+
"keyword",
|
|
27006
|
+
rule.matcher,
|
|
27007
|
+
() => keywords.map((kw) => {
|
|
27008
|
+
if (kw.length === 0) return void 0;
|
|
27009
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
27010
|
+
})
|
|
27011
|
+
);
|
|
27012
|
+
for (const re of compiled) {
|
|
27013
|
+
if (re === void 0) continue;
|
|
26972
27014
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26973
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26974
27015
|
let m;
|
|
26975
27016
|
while ((m = re.exec(text)) !== null) {
|
|
26976
27017
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26986,7 +27027,10 @@ var RegexMatcher2 = class {
|
|
|
26986
27027
|
match(text, rule) {
|
|
26987
27028
|
if (rule.matcher.type !== "regex") return [];
|
|
26988
27029
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26989
|
-
const re =
|
|
27030
|
+
const re = memoizedRegExp(
|
|
27031
|
+
rule.matcher,
|
|
27032
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
27033
|
+
);
|
|
26990
27034
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26991
27035
|
const spans = [];
|
|
26992
27036
|
let m;
|
|
@@ -27094,11 +27138,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
27094
27138
|
const labels = req.labels;
|
|
27095
27139
|
if (labels && labels.length > 0) {
|
|
27096
27140
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
27097
|
-
for (const
|
|
27098
|
-
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
|
|
27141
|
+
for (const re of memoizedRegExpList(
|
|
27142
|
+
"label",
|
|
27143
|
+
req,
|
|
27144
|
+
() => labels.map((label) => {
|
|
27145
|
+
const trimmed = label.trim();
|
|
27146
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
27147
|
+
})
|
|
27148
|
+
)) {
|
|
27149
|
+
if (re?.test(haystack)) return true;
|
|
27102
27150
|
}
|
|
27103
27151
|
}
|
|
27104
27152
|
return false;
|
|
@@ -27366,13 +27414,14 @@ function probesFor(rule) {
|
|
|
27366
27414
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
27367
27415
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
27368
27416
|
}
|
|
27369
|
-
|
|
27417
|
+
var wallClock = () => performance.now();
|
|
27418
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
27370
27419
|
let ms = 0;
|
|
27371
27420
|
let probe = "";
|
|
27372
27421
|
for (const text of probesFor(rule)) {
|
|
27373
|
-
const start =
|
|
27422
|
+
const start = now();
|
|
27374
27423
|
scan(text, [rule]);
|
|
27375
|
-
const elapsed =
|
|
27424
|
+
const elapsed = now() - start;
|
|
27376
27425
|
if (elapsed > ms) {
|
|
27377
27426
|
ms = elapsed;
|
|
27378
27427
|
probe = text;
|
|
@@ -30011,7 +30060,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
30011
30060
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
30012
30061
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
30013
30062
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
30014
|
-
import { basename as basename5, join as join12
|
|
30063
|
+
import { basename as basename5, join as join12 } from "path";
|
|
30015
30064
|
|
|
30016
30065
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
30017
30066
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -30677,53 +30726,6 @@ var UNOPENABLE_VAULT = {
|
|
|
30677
30726
|
resolvePointerIdentity: () => Promise.resolve(null)
|
|
30678
30727
|
};
|
|
30679
30728
|
|
|
30680
|
-
// src/present.ts
|
|
30681
|
-
var fg = (hex3) => (text) => {
|
|
30682
|
-
const r = Number.parseInt(hex3.slice(1, 3), 16);
|
|
30683
|
-
const g = Number.parseInt(hex3.slice(3, 5), 16);
|
|
30684
|
-
const b = Number.parseInt(hex3.slice(5, 7), 16);
|
|
30685
|
-
return `\x1B[38;2;${String(r)};${String(g)};${String(b)}m${text}\x1B[0m`;
|
|
30686
|
-
};
|
|
30687
|
-
var paint = {
|
|
30688
|
-
brand: fg("#33e6c6"),
|
|
30689
|
-
// --color-brand · ▸▸ AKA wordmark (accent text)
|
|
30690
|
-
dim: fg("#838995"),
|
|
30691
|
-
// --color-text-3 · separators · "/100" · the "unreviewed" label
|
|
30692
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
30693
|
-
// the health score number
|
|
30694
|
-
ok: fg("#0db15f"),
|
|
30695
|
-
// --color-ok · healthy ● dot
|
|
30696
|
-
critical: fg("#e63448"),
|
|
30697
|
-
// --color-sev-critical · ■ and the open-findings flag
|
|
30698
|
-
high: fg("#e97a0a"),
|
|
30699
|
-
// --color-sev-high · ■ and the mid-health dot
|
|
30700
|
-
medium: fg("#f7bd00"),
|
|
30701
|
-
// --color-sev-medium · ■
|
|
30702
|
-
low: fg("#0581d4")
|
|
30703
|
-
// --color-sev-low · ■ (azure blue, not purple)
|
|
30704
|
-
};
|
|
30705
|
-
|
|
30706
|
-
// src/exception-guidance.ts
|
|
30707
|
-
function blockMessage(input) {
|
|
30708
|
-
const preview = input.blockedRef ? ` (${input.blockedRef.maskedValue})` : "";
|
|
30709
|
-
const commands = input.blockedRef ? [
|
|
30710
|
-
` aka exception approve ${input.blockedRef.reference} (asks for scope + reason, then resubmit)`,
|
|
30711
|
-
" aka exception approve <value> (same flow, pasting the blocked value itself)"
|
|
30712
|
-
] : [" aka exception approve (asks for scope + reason, then resubmit)"];
|
|
30713
|
-
const note = input.note ? ` ${input.note}` : "";
|
|
30714
|
-
return [
|
|
30715
|
-
`AKA blocked this ${input.subject} \u2014 flagged ${input.ruleIds}${preview}.${note} Remove the flagged content and resubmit.`,
|
|
30716
|
-
"If this is intentional and you accept the risk, grant an exception:",
|
|
30717
|
-
...commands,
|
|
30718
|
-
"More: aka exception --help"
|
|
30719
|
-
].join("\n");
|
|
30720
|
-
}
|
|
30721
|
-
function exceptionPointer(references) {
|
|
30722
|
-
const ref = references?.[0];
|
|
30723
|
-
if (ref === void 0) return "";
|
|
30724
|
-
return ` To allow this exact value intentionally, run: aka exception approve ${ref.reference}.`;
|
|
30725
|
-
}
|
|
30726
|
-
|
|
30727
30729
|
// src/hooks/clipboard.ts
|
|
30728
30730
|
import { spawnSync } from "child_process";
|
|
30729
30731
|
var defaultSpawner = (cmd, args, input) => {
|
|
@@ -30765,21 +30767,6 @@ function writeClipboard(text, opts) {
|
|
|
30765
30767
|
// src/hooks/onboarding-nudge.ts
|
|
30766
30768
|
var ONBOARDING_NUDGE = "AKA Security is installed but not calibrated \u2014 run /aka:setup to tune notifications to this machine (about a minute).";
|
|
30767
30769
|
|
|
30768
|
-
// src/hooks/resubmit-message.ts
|
|
30769
|
-
var REWRITE_OPEN = "----- safe prompt (copy everything between these lines) -----";
|
|
30770
|
-
var REWRITE_CLOSE = "----- end safe prompt -----";
|
|
30771
|
-
function resubmitMessage(opts) {
|
|
30772
|
-
const paste = opts.clipboardWrote ? "It is already on your clipboard \u2014 paste and resubmit." : "Copy it, then paste and resubmit.";
|
|
30773
|
-
return [
|
|
30774
|
-
`AKA blocked this prompt \u2014 flagged ${opts.ruleIds}. The flagged value never reached the model.`,
|
|
30775
|
-
`Here is your prompt with each detected secret replaced by a vault pointer. ${paste}`,
|
|
30776
|
-
REWRITE_OPEN,
|
|
30777
|
-
opts.rewrite,
|
|
30778
|
-
REWRITE_CLOSE,
|
|
30779
|
-
"The model works with the pointers; the real values stay in your local vault." + exceptionPointer(opts.blockedRef ? [opts.blockedRef] : void 0)
|
|
30780
|
-
].join("\n");
|
|
30781
|
-
}
|
|
30782
|
-
|
|
30783
30770
|
// src/hooks/shared.ts
|
|
30784
30771
|
async function readStdin() {
|
|
30785
30772
|
return new Promise((resolve) => {
|
|
@@ -31186,6 +31173,110 @@ function claimStoreUnavailableWarning(dataDir2, sessionId) {
|
|
|
31186
31173
|
return true;
|
|
31187
31174
|
}
|
|
31188
31175
|
|
|
31176
|
+
// src/present.ts
|
|
31177
|
+
var fg = (hex3) => (text) => {
|
|
31178
|
+
const r = Number.parseInt(hex3.slice(1, 3), 16);
|
|
31179
|
+
const g = Number.parseInt(hex3.slice(3, 5), 16);
|
|
31180
|
+
const b = Number.parseInt(hex3.slice(5, 7), 16);
|
|
31181
|
+
return `\x1B[38;2;${String(r)};${String(g)};${String(b)}m${text}\x1B[0m`;
|
|
31182
|
+
};
|
|
31183
|
+
var paint = {
|
|
31184
|
+
brand: fg("#33e6c6"),
|
|
31185
|
+
// --color-brand · ▸▸ AKA wordmark (accent text)
|
|
31186
|
+
dim: fg("#838995"),
|
|
31187
|
+
// --color-text-3 · separators · "/100" · the "unreviewed" label
|
|
31188
|
+
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
31189
|
+
// the health score number
|
|
31190
|
+
ok: fg("#0db15f"),
|
|
31191
|
+
// --color-ok · healthy ● dot
|
|
31192
|
+
critical: fg("#e63448"),
|
|
31193
|
+
// --color-sev-critical · ■ and the open-findings flag
|
|
31194
|
+
high: fg("#e97a0a"),
|
|
31195
|
+
// --color-sev-high · ■ and the mid-health dot
|
|
31196
|
+
medium: fg("#f7bd00"),
|
|
31197
|
+
// --color-sev-medium · ■
|
|
31198
|
+
low: fg("#0581d4")
|
|
31199
|
+
// --color-sev-low · ■ (azure blue, not purple)
|
|
31200
|
+
};
|
|
31201
|
+
|
|
31202
|
+
// src/exception-guidance.ts
|
|
31203
|
+
function blockMessage(input) {
|
|
31204
|
+
const preview = input.blockedRef ? ` (${input.blockedRef.maskedValue})` : "";
|
|
31205
|
+
const commands = input.blockedRef ? [
|
|
31206
|
+
` aka exception approve ${input.blockedRef.reference} (asks for scope + reason, then resubmit)`,
|
|
31207
|
+
" aka exception approve <value> (same flow, pasting the blocked value itself)"
|
|
31208
|
+
] : [" aka exception approve (asks for scope + reason, then resubmit)"];
|
|
31209
|
+
const note = input.note ? ` ${input.note}` : "";
|
|
31210
|
+
return [
|
|
31211
|
+
`AKA blocked this ${input.subject} \u2014 flagged ${input.ruleIds}${preview}.${note} Remove the flagged content and resubmit.`,
|
|
31212
|
+
"If this is intentional and you accept the risk, grant an exception:",
|
|
31213
|
+
...commands,
|
|
31214
|
+
"More: aka exception --help"
|
|
31215
|
+
].join("\n");
|
|
31216
|
+
}
|
|
31217
|
+
function exceptionPointer(references) {
|
|
31218
|
+
const ref = references?.[0];
|
|
31219
|
+
if (ref === void 0) return "";
|
|
31220
|
+
return ` To allow this exact value intentionally, run: aka exception approve ${ref.reference}.`;
|
|
31221
|
+
}
|
|
31222
|
+
|
|
31223
|
+
// src/hooks/resubmit-message.ts
|
|
31224
|
+
var REWRITE_OPEN = "----- safe prompt (copy everything between these lines) -----";
|
|
31225
|
+
var REWRITE_CLOSE = "----- end safe prompt -----";
|
|
31226
|
+
function resubmitMessage(opts) {
|
|
31227
|
+
const paste = opts.clipboardWrote ? "It is already on your clipboard \u2014 paste and resubmit." : "Copy it, then paste and resubmit.";
|
|
31228
|
+
return [
|
|
31229
|
+
`AKA blocked this prompt \u2014 flagged ${opts.ruleIds}. The flagged value never reached the model.`,
|
|
31230
|
+
`Here is your prompt with each detected secret replaced by a vault pointer. ${paste}`,
|
|
31231
|
+
REWRITE_OPEN,
|
|
31232
|
+
opts.rewrite,
|
|
31233
|
+
REWRITE_CLOSE,
|
|
31234
|
+
"The model works with the pointers; the real values stay in your local vault." + exceptionPointer(opts.blockedRef ? [opts.blockedRef] : void 0)
|
|
31235
|
+
].join("\n");
|
|
31236
|
+
}
|
|
31237
|
+
|
|
31238
|
+
// src/hooks/user-prompt-submit-decision.ts
|
|
31239
|
+
async function decideUserPromptSubmit(prompt, result, deps = {}) {
|
|
31240
|
+
if (result.action === "block" || result.action === "redact") {
|
|
31241
|
+
const ruleIds = uniqueRuleIds(result.findings);
|
|
31242
|
+
const blockedRef = result.blockedReferences?.[0];
|
|
31243
|
+
const rewrite = deps.tokenizePrompt ? await pointerizedRewrite(prompt, result.findings, deps.tokenizePrompt) : null;
|
|
31244
|
+
if (rewrite !== null) {
|
|
31245
|
+
const clipboardWrote = writeClipboardSafely(rewrite, deps.writeClipboard);
|
|
31246
|
+
return {
|
|
31247
|
+
decision: "block",
|
|
31248
|
+
reason: resubmitMessage({ ruleIds, rewrite, clipboardWrote, blockedRef })
|
|
31249
|
+
};
|
|
31250
|
+
}
|
|
31251
|
+
return { decision: "block", reason: blockMessage({ subject: "prompt", ruleIds, blockedRef }) };
|
|
31252
|
+
}
|
|
31253
|
+
if (result.action === "warn") {
|
|
31254
|
+
return {
|
|
31255
|
+
systemMessage: `AKA flagged sensitive content (${uniqueRuleIds(result.findings)}) \u2014 sent unchanged.${exceptionPointer(result.blockedReferences)}`
|
|
31256
|
+
};
|
|
31257
|
+
}
|
|
31258
|
+
return null;
|
|
31259
|
+
}
|
|
31260
|
+
function writeClipboardSafely(text, write) {
|
|
31261
|
+
try {
|
|
31262
|
+
return write?.(text) ?? false;
|
|
31263
|
+
} catch {
|
|
31264
|
+
return false;
|
|
31265
|
+
}
|
|
31266
|
+
}
|
|
31267
|
+
async function pointerizedRewrite(prompt, findings, tokenize) {
|
|
31268
|
+
try {
|
|
31269
|
+
const tokenized = await tokenize(prompt, findings);
|
|
31270
|
+
if (tokenized.pointers.length === 0) return null;
|
|
31271
|
+
for (const finding of findings) {
|
|
31272
|
+
if (finding.rawMatch !== "" && tokenized.text.includes(finding.rawMatch)) return null;
|
|
31273
|
+
}
|
|
31274
|
+
return tokenized.text;
|
|
31275
|
+
} catch {
|
|
31276
|
+
return null;
|
|
31277
|
+
}
|
|
31278
|
+
}
|
|
31279
|
+
|
|
31189
31280
|
// src/hooks/user-prompt-submit.ts
|
|
31190
31281
|
async function main() {
|
|
31191
31282
|
const input = parseJson(await readStdin());
|
|
@@ -31213,45 +31304,21 @@ async function main() {
|
|
|
31213
31304
|
} finally {
|
|
31214
31305
|
await runtime.close();
|
|
31215
31306
|
}
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
}
|
|
31226
|
-
}
|
|
31227
|
-
await emit({ decision: "block", reason });
|
|
31228
|
-
return;
|
|
31229
|
-
}
|
|
31230
|
-
if (result.action === "warn") {
|
|
31231
|
-
await emit({
|
|
31232
|
-
systemMessage: `AKA flagged sensitive content (${uniqueRuleIds(result.findings)}) \u2014 sent unchanged.${exceptionPointer(result.blockedReferences)}`
|
|
31233
|
-
});
|
|
31307
|
+
const decision = await decideUserPromptSubmit(prompt, result, {
|
|
31308
|
+
tokenizePrompt: isVaultConsentValid(config2.settings.vaultConsent) ? (text, findings) => createVaultGlue().tokenizeText(text, {
|
|
31309
|
+
findings,
|
|
31310
|
+
sighting: { location: "prompt", kind: "prompt" }
|
|
31311
|
+
}) : void 0,
|
|
31312
|
+
writeClipboard
|
|
31313
|
+
});
|
|
31314
|
+
if (decision !== null) {
|
|
31315
|
+
await emit(decision);
|
|
31234
31316
|
return;
|
|
31235
31317
|
}
|
|
31236
31318
|
if (!config2.onboarded && claimOnboardingNudge(config2.dataDir, sessionId)) {
|
|
31237
31319
|
await emit({ systemMessage: ONBOARDING_NUDGE });
|
|
31238
31320
|
}
|
|
31239
31321
|
}
|
|
31240
|
-
async function pointerizedRewrite(prompt, findings) {
|
|
31241
|
-
try {
|
|
31242
|
-
const tokenized = await createVaultGlue().tokenizeText(prompt, {
|
|
31243
|
-
findings,
|
|
31244
|
-
sighting: { location: "prompt", kind: "prompt" }
|
|
31245
|
-
});
|
|
31246
|
-
if (tokenized.pointers.length === 0) return null;
|
|
31247
|
-
for (const finding of findings) {
|
|
31248
|
-
if (finding.rawMatch !== "" && tokenized.text.includes(finding.rawMatch)) return null;
|
|
31249
|
-
}
|
|
31250
|
-
return tokenized.text;
|
|
31251
|
-
} catch {
|
|
31252
|
-
return null;
|
|
31253
|
-
}
|
|
31254
|
-
}
|
|
31255
31322
|
try {
|
|
31256
31323
|
await main();
|
|
31257
31324
|
} catch {
|