/** * Slim-index injection. * * Couples the pure renderer (`./render.ts`) to the wire shapes: * `InlineAgentSpec` (Pattern B) and `InlineGraphSpec` (Pattern C). The * SDK 2.0 by-id path (`tasks.start({ agent_id })`) has no `instructions` * field on the wire — the agent body lives on QAR's side — so the SDK * cannot inject for that variant. * * The rendered text appends to the consumer's existing `instructions` * content. Injection helpers are pure: input = spec + catalog, output = * new spec. No side effects. */ import type { InlineAgentSpec, InlineGraphSpec } from '../qar/specs.js'; import type { SkillsManager } from './manager.js'; import { type RenderOptions } from './render.js'; import type { ParsedSkill, SkillEvent } from './types.js'; /** * Result of an injection pass. The caller dispatches `events` to the * configured telemetry sink (the renderer doesn't know about it). Both * `spec` and `inserted` reflect the post-injection state. */ export interface InjectionResult { /** Spec with slim index appended to its `instructions`. */ readonly spec: TSpec; /** `true` iff anything was actually appended. False on empty catalog. */ readonly inserted: boolean; /** Skills that landed in the slim index. */ readonly included: readonly ParsedSkill[]; /** Telemetry events the renderer produced. */ readonly events: readonly SkillEvent[]; /** * Pinned skills the renderer omitted because rendering them would * push the block past the absolute hard cap (F5). Non-empty signals * the SDK boundary to throw `SkillsBudgetExceededError`. */ readonly omittedPinned: readonly ParsedSkill[]; } /** * Append the rendered slim index to a single `InlineAgentSpec`'s * `instructions` field. Mutates nothing; returns a new spec. * * For `Instructions === string`: append the rendered block on a new line. * For `Instructions === InstructionsPreset`: append into the preset's * `append` field (creating it if absent). * * Returns the original spec unchanged when the catalog is empty. */ export declare function injectIntoAgentSpec(spec: InlineAgentSpec, manager: SkillsManager, opts?: RenderOptions): InjectionResult; /** * Walk every agent inside an `InlineGraphSpec` and apply the slim-index * injection to nodes whose `spec` is an `InlineAgentSpec`. Static-ref * nodes (`{ agent_id }`) and recursive sub-graphs are returned untouched * (the static ref has no client-side instructions; sub-graphs recurse). */ export declare function injectIntoGraphSpec(graph: InlineGraphSpec, manager: SkillsManager, opts?: RenderOptions): InjectionResult; //# sourceMappingURL=inject.d.ts.map