Skip to content
1 min read · 179 words

Type Alias: ShedRankFn ​

ts
type ShedRankFn = (name: string) => number;

Defined in: src/batteries/context/thrift/contracts.ts:277

Ranks a tool by last-resort shed priority: LOWER rank sheds FIRST. Ties are broken by encounter order (a stable sort), so two tools ranked equally shed in whatever order the caller's relevantToolNames listed them.

Parameters ​

ParameterTypeDescription
namestringThe tool's registered name.

Returns ​

number

A rank; lower sheds first. Any finite number is valid — there is no required range.

Remarks ​

This replaces a hard-coded, domain-specific tier list (the flagship agent's TOOL_SHED_ORDER, which knew tool names like provide_answer and search_docs_semantic) with an INJECTABLE policy. The battery ships a generic default (see the shedRank option on @nhtio/adk/batteries/context/thrift/subtractive_pass!subtractToFit) that treats every tool equally — it has no domain knowledge of which of a caller's tools are "delivery" tools vs. "gather" tools vs. "exotic reader" tools. A caller who DOES have that knowledge (as the flagship agent does) should supply a ShedRankFn that encodes it, exactly as the flagship's own TOOL_SHED_ORDER-derived function did in production.