Skip to content

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.

TypeScript
671 B
Raw Blame
import type { TraceEntry } from 'claude-code'

/**
 * The verdict handed up to one link of a run: what the nearest link beneath
 * it that settled on anything settled on.
 *
 * Undefined for a link that answered without calling `next`: the trace ends
 * short of the engine there, and nothing beneath it ran.
 *
 * @param trace a run as `next.trace` lists it, nearest the caller first
 * @param at the link's place in that list
 * @returns the verdict, or undefined when nothing settled beneath the link
 */
export const handedTo = (
  trace: readonly TraceEntry<'tool.check'>[],
  at: number,
) => trace.slice(at + 1).find(link => link.returned !== undefined)?.returned