spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / hooks / held-verdict / verdicts / loosened-by-users.ts
25 lines · 915 BRaw
1import type { TraceEntry } from 'claude-code'
2
3import Ranking from './ranking'
4
5/**
6 * The links of one run of `tool.check` that may hold a plugin a person
7 * installed and that answered more permissively than they were handed.
8 *
9 * Read off `next.trace`, whose `tier` the engine pins. A batch is named as
10 * the engine names it, its members joined; whether a person's plugin did
11 * the loosening is settled by the run past the user tier, never here.
12 *
13 * @param trace what settled beneath the hook on its latest `next` call
14 * @returns their names, nearest the caller first; none when none loosened
15 */
16export const loosenedByUsers = (
17 trace: readonly TraceEntry<'tool.check'>[],
18): readonly string[] =>
19 trace
20 .filter(
21 (link, at) =>
22 Ranking.TIERS_HOLDING_USERS.includes(link.tier) &&
23 Ranking.isLooser(link.returned, Ranking.handedTo(trace, at)),
24 )
25 .map(link => link.plugin)