@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
52 lines • 3.88 kB
TypeScript
import { type ToolExposure } from "../extensions/types.ts";
import type { ToolDefinitionEntry, ToolRegistryBuild } from "./bootstrap.ts";
type ToolDefinitions = ReadonlyMap<string, ToolDefinitionEntry>;
/** Normalized exposure of a registered tool (C-EX-1); a name without a definition is `direct`. */
export declare function toolExposureOf(definitions: ToolDefinitions, name: string): ToolExposure;
/** Fixed and declared eval-only tools, unless an SDK embedder supplied an override. */
export declare function resolveEvalOnlyToolNames(definitions: ToolDefinitions, override: ReadonlySet<string> | undefined): ReadonlySet<string>;
/** The eval-only names while an `eval` tool is registered (the routing is armed); `undefined` while it is not. */
export declare function armedEvalOnlyToolNames(evalOnly: ReadonlySet<string> | undefined, toolRegistry: ReadonlyMap<string, unknown>): ReadonlySet<string> | undefined;
/** The registered tools the armed eval-only routing withholds from the model; empty while it is not armed. */
export declare function registeredEvalOnlyToolNames(armedEvalOnly: ReadonlySet<string> | undefined, toolRegistry: ReadonlyMap<string, unknown>): ReadonlySet<string>;
/** The tool flags a session is created with (`--tools`, `--no-tools`, `--no-builtin-tools`, `--exclude-tools`). */
export interface ToolSelection {
readonly tools?: readonly string[] | undefined;
readonly noTools?: "all" | "builtin" | undefined;
readonly excludeTools?: readonly string[] | undefined;
}
export interface ResolvedToolSelection {
/** Builtin-extension tools outside this set are not registered; absent means all of them. */
readonly defaultToolNames: string[] | undefined;
readonly allowedToolNames: string[] | undefined;
readonly excludedToolNames: string[] | undefined;
/** The active set a new session requests before its extension tools join it. */
readonly initialActiveToolNames: string[];
}
/** Resolves the tool flags with the settings' `defaultTools`, as `createAgentSession` does. */
export declare function resolveToolSelection(selection: ToolSelection, configuredDefaultToolNames: readonly string[] | undefined): ResolvedToolSelection;
export interface ActiveToolRequest {
/** The names asked for: the caller's explicit list, else the session's previous request. */
readonly requested: readonly string[];
/** Whether `requested` is the caller's explicit list; a refresh without one adds newly registered tools. */
readonly explicit: boolean;
readonly includeAllExtensionTools?: boolean | undefined;
/** On a reload, a requested tool stays only while the same registration provides it. */
readonly previousRegistrationIds?: ReadonlyMap<string, string> | undefined;
/** Tools to activate that were not active before, such as tools newly added to `defaultTools`. */
readonly addedToolNames?: readonly string[] | undefined;
readonly previousRegistryNames: ReadonlySet<string>;
readonly allowedToolNames?: ReadonlySet<string> | undefined;
}
/** The names a registry refresh asks to activate, before the eval-only routing and exposure narrow them. */
export declare function requestedActiveToolNames(registry: ToolRegistryBuild, request: ActiveToolRequest): string[];
export interface DirectActiveTools {
/** The tools the model calls directly, in request order. */
readonly active: string[];
/** Requested tools held back by the armed eval-only routing. */
readonly withheld: string[];
}
/** Narrows requested names to the model's direct tools: registered, not hidden, and not routed through eval. */
export declare function directActiveToolNames(requested: readonly string[], registry: Pick<ToolRegistryBuild, "definitions" | "toolRegistry">, armedEvalOnly: ReadonlySet<string> | undefined): DirectActiveTools;
export {};
//# sourceMappingURL=active-tools.d.ts.map