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 / lifted-by-users.ts
27 lines · 960 BRaw
1import type { TraceEntry } from 'claude-code'
2
3import { loosenedLinks } from './loosened-links'
4import Ranking from './ranking'
5
6/**
7 * The links of one run of `tool.check` that may hold a plugin a person
8 * installed and that answered over the organization's ceiling on the tool.
9 *
10 * A link that loosened the verdict it was handed and stayed within the
11 * ceiling is not among them. Read off `next.trace`, to name who is told.
12 *
13 * @param trace what settled beneath the hook on its latest `next` call
14 * @param ceiling the question's `ceiling`, which the engine pins
15 * @returns their names, nearest the caller first; none under no ceiling
16 */
17export const liftedByUsers = (
18 trace: readonly TraceEntry<'tool.check'>[],
19 ceiling: string | undefined,
20): readonly string[] =>
21 loosenedLinks(trace)
22 .filter(
23 link =>
24 link.returned !== undefined &&
25 Ranking.isOverCeiling(link.returned, ceiling),
26 )
27 .map(link => link.plugin)