@clear-capabilities/agentic-security-scanner 0.121.0 → 0.123.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.123.0 — report clarity: risk-demotion labels, depth discoverability, HTML export docs
4
+
5
+ Acting on user feedback that findings could overstate severity, that explanations
6
+ felt thin, and that the browser report was hard to find. No detector/severity logic
7
+ changed — these are presentation + docs improvements in `scanner/src/report/`.
8
+
9
+ - **"Likely lower risk" labels.** A high/critical finding the reachability /
10
+ exploitability / confidence pipeline has already marked down now renders a visible
11
+ `↓ likely lower risk — …` note (not reachable in prod / sanitized / low
12
+ exploitability / low confidence) in the CLI firehose, the pro table, and the HTML
13
+ report. Severity stays canonical (SARIF/exit codes/baselines unchanged) — this only
14
+ annotates, so a hardcoded rule severity isn't taken at face value.
15
+ - **Depth is discoverable.** The one-screen ship verdict now points to
16
+ `/triage --explain <id>` (the why-it-fired narrative + data-flow trace + fix) and to
17
+ the shareable HTML report, so users don't conclude the terse default is all there is.
18
+ - **HTML report surfaced in the README.** Documents `scan . --format html --output
19
+ report.html` (self-contained browser page: severity charts, STRIDE, filterable
20
+ findings) alongside json / md / sarif / csv.
21
+
22
+ ## 0.122.0 — cache economics Phase B (depth-first, subagent offload, cost HUD)
23
+
24
+ Completes the cache-economics program (PRD `docs/CACHE_ECONOMICS_PRD.md`, F4–F6) on
25
+ top of the v0.121.0 measured foundation. All in `hooks/model-cost-advisor.js`,
26
+ `hooks/lib/transcript.js`, and `scanner/src/posture/cache-economics.js`.
27
+
28
+ - **F4 — depth-first routing.** A model switch is now chosen over a cache-safe effort
29
+ drop only when it saves *materially* more (`A.savings ≥ B.savings × (1 +
30
+ depthFirstMargin)`, default 0.25). Effort is the primary lever; switching is the
31
+ break-even-gated exception.
32
+ - **F5 — subagent offload.** For a simple one-off whose cheap-model switch is
33
+ cache-blocked (deep warm cache), the advisor suggests running it as a **Haiku
34
+ subagent** — full cheap-model savings without discarding the main session's cache.
35
+ Config `subagentAdvice` (default true).
36
+ - **F6 — cost HUD + cache budget.** `cache-statusline` CLI prints a one-line HUD
37
+ (`$ spent · % cached · $/turn`) for a Claude Code `statusLine` command and writes
38
+ `.agentic-security/cache-telemetry.json`; the `query_cache_telemetry` MCP tool gains
39
+ a `statusline` field. A soft `sessionBudgetUsd` biases the `costQualityTradeoff`
40
+ dial toward cheaper as real session spend (priced from the transcript) approaches it.
41
+
3
42
  ## 0.121.0 — prompt-cache economics (measured, cache-aware cost optimization)
4
43
 
5
44
  Cache-economics core (PRD `docs/CACHE_ECONOMICS_PRD.md`, features F1–F3). Turns
@@ -1642,6 +1642,25 @@ async function main() {
1642
1642
  else console.log(formatCacheReport(result));
1643
1643
  process.exit(0);
1644
1644
  }
1645
+ case 'cache-statusline': {
1646
+ // F6 — one-line cost HUD for a Claude Code statusLine command. Also writes
1647
+ // .agentic-security/cache-telemetry.json for other pollers. Always exits 0.
1648
+ const { analyzeTranscript, renderCacheStatusLine } = await import('../src/posture/cache-economics.js');
1649
+ const projectDir = path.resolve(args.flags.root || process.env.CLAUDE_PROJECT_DIR || process.cwd());
1650
+ const result = analyzeTranscript({ transcriptPath: args.flags.transcript, projectDir });
1651
+ if (result.ok) {
1652
+ try {
1653
+ const dir = path.join(projectDir, '.agentic-security');
1654
+ fs.mkdirSync(dir, { recursive: true });
1655
+ fs.writeFileSync(path.join(dir, 'cache-telemetry.json'),
1656
+ JSON.stringify({ updatedAt: new Date().toISOString(), metrics: result.metrics, leaks: result.leaks }, null, 2));
1657
+ } catch { /* best-effort */ }
1658
+ console.log(renderCacheStatusLine(result.metrics));
1659
+ } else {
1660
+ console.log('agentic-security: no session cost yet');
1661
+ }
1662
+ process.exit(0);
1663
+ }
1645
1664
  case 'mcp': {
1646
1665
  const { runStdio } = await import('../src/mcp/stdio.js');
1647
1666
  const root = args.flags.root || process.env.AGENTIC_SECURITY_MCP_ROOT || process.cwd();
package/dist/752.index.js CHANGED
@@ -7,7 +7,8 @@ export const modules = {
7
7
 
8
8
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
9
  /* harmony export */ analyzeTranscript: () => (/* binding */ analyzeTranscript),
10
- /* harmony export */ formatCacheReport: () => (/* binding */ formatCacheReport)
10
+ /* harmony export */ formatCacheReport: () => (/* binding */ formatCacheReport),
11
+ /* harmony export */ renderCacheStatusLine: () => (/* binding */ renderCacheStatusLine)
11
12
  /* harmony export */ });
12
13
  /* unused harmony export _internal */
13
14
  /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
@@ -218,6 +219,14 @@ const CAUSE_LABEL = {
218
219
  'prefix-change': 'prefix changed (system prompt / tools / context edit)',
219
220
  };
220
221
 
222
+ // F6 — one-line HUD for a Claude Code statusLine command (mirrors
223
+ // watch-mode.js renderStatusLine). Takes the metrics from computeCacheEconomics.
224
+ function renderCacheStatusLine(metrics) {
225
+ if (!metrics || !metrics.turns) return 'agentic-security: no session cost yet';
226
+ const hit = Math.round(metrics.cacheHitRatio * 100);
227
+ return `agentic-security: ${money(metrics.actualUsd)} · ${hit}% cached · ${money(metrics.costPerTurnUsd)}/turn`;
228
+ }
229
+
221
230
  function formatCacheReport(result) {
222
231
  if (!result.ok) {
223
232
  return result.reason === 'no-transcript'
package/dist/985.index.js CHANGED
@@ -1420,6 +1420,7 @@ const query_cache_telemetry = {
1420
1420
  metrics: result.metrics,
1421
1421
  leaks: result.leaks,
1422
1422
  report: (0,cache_economics.formatCacheReport)(result),
1423
+ statusline: (0,cache_economics.renderCacheStatusLine)(result.metrics),
1423
1424
  };
1424
1425
  },
1425
1426
  };
@@ -1947,7 +1948,8 @@ function runStdio({
1947
1948
 
1948
1949
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1949
1950
  /* harmony export */ analyzeTranscript: () => (/* binding */ analyzeTranscript),
1950
- /* harmony export */ formatCacheReport: () => (/* binding */ formatCacheReport)
1951
+ /* harmony export */ formatCacheReport: () => (/* binding */ formatCacheReport),
1952
+ /* harmony export */ renderCacheStatusLine: () => (/* binding */ renderCacheStatusLine)
1951
1953
  /* harmony export */ });
1952
1954
  /* unused harmony export _internal */
1953
1955
  /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
@@ -2158,6 +2160,14 @@ const CAUSE_LABEL = {
2158
2160
  'prefix-change': 'prefix changed (system prompt / tools / context edit)',
2159
2161
  };
2160
2162
 
2163
+ // F6 — one-line HUD for a Claude Code statusLine command (mirrors
2164
+ // watch-mode.js renderStatusLine). Takes the metrics from computeCacheEconomics.
2165
+ function renderCacheStatusLine(metrics) {
2166
+ if (!metrics || !metrics.turns) return 'agentic-security: no session cost yet';
2167
+ const hit = Math.round(metrics.cacheHitRatio * 100);
2168
+ return `agentic-security: ${money(metrics.actualUsd)} · ${hit}% cached · ${money(metrics.costPerTurnUsd)}/turn`;
2169
+ }
2170
+
2161
2171
  function formatCacheReport(result) {
2162
2172
  if (!result.ok) {
2163
2173
  return result.reason === 'no-transcript'