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-links / loosened-links.ts
19 lines · 680 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.
10 *
11 * @param trace what settled beneath the hook on its latest `next` call
12 * @returns the links, nearest the caller first; none when none loosened
13 */
14export const loosenedLinks = (trace: readonly TraceEntry<'tool.check'>[]) =>
15 trace.filter(
16 (link, at) =>
17 Ranking.TIERS_HOLDING_USERS.includes(link.tier) &&
18 Ranking.isLooser(link.returned, Ranking.handedTo(trace, at)),
19 )