import { ToolContract } from "../tool/tool.mjs"; import { LoadSkillInput, SkillRecord } from "./contracts/skill-record.type.mjs"; //#region ../ai/src/skills/load-skill-tool.d.ts /** Result the `loadSkill` tool feeds back to the model. */ type LoadSkillResult = { body: string; name: string; version: number; } | { error: string; }; /** Dependencies the `loadSkill` tool closes over — kept narrow for testing. */ type LoadSkillToolDeps = { /** Resolve a skill's full record across the merged sources. */load: (name: string, version?: number) => Promise; /** Per-run budget cap on `loadSkill` calls (default 5, enforced by caller-supplied counter). */ maxLoadsPerRun: number; /** Fired on each successful load (`type: "loaded"`); errors swallowed by the sink wrapper. */ onLoaded?: (record: SkillRecord) => void; }; /** * Build the `loadSkill` tool for one run. Returns the skill **body** as * the tool result, which the agent loop feeds straight back to the model * (the standard `role:"tool"` message path) — making the loaded procedure * visible on the next trip. * * The per-run counter is closed over here (one tool instance per run), so * the budget is naturally scoped to this execution: * - Past `maxLoadsPerRun` ⇒ returns `{ error: "skill load budget exhausted" }` * as a RESULT, never a throw — the model self-corrects, exactly how the * agent loop treats any tool error. * - Unknown skill (`load` ⇒ undefined) ⇒ `{ error: "unknown skill: " }`. * * `execute` itself never throws — both failure modes are error results, so * the run continues. */ declare function loadSkillTool(deps: LoadSkillToolDeps): ToolContract; //#endregion export { LoadSkillResult, LoadSkillToolDeps, loadSkillTool }; //# sourceMappingURL=load-skill-tool.d.mts.map