/** * Expression primitives — function-level building blocks for fluent * composition. * * Mirrors Python's primitives in `adk_fluent._primitives`: * tap, expect, mapOver, gate, race, dispatch, join. * * These primitives produce zero-cost (no LLM) builder steps that can be * inserted anywhere in a Pipeline / FanOut / Loop / Fallback chain via * `.then()` or by passing them to `.step()` / `.branch()`. */ import { BuilderBase } from "../core/builder-base.js"; import type { State, StatePredicate } from "../core/types.js"; /** * Lightweight, hand-rolled primitive class. Each primitive is a tiny * BuilderBase subclass that records its kind in `_config["_kind"]` so the * runtime layer can dispatch on it. * * Factory helpers below call `Primitive.create()` to populate private * config / list fields up-front instead of poking at protected maps with * bracket notation. */ export declare class Primitive extends BuilderBase> { constructor(name: string, kind: string); /** * Construct a Primitive with private payload baked in. Used by the * factory helpers (`tap`, `gate`, `mapOver`, ...) so they can stay free * of bracket-notation access into protected fields. */ static create(name: string, kind: string, config?: Record, lists?: Record): Primitive; build(): Record; } /** * Inline observer step (no LLM, zero cost). Reads state, runs `fn` for its * side effects (logging, metrics, breakpoint), never mutates state. * * pipeline.then(tap((s) => console.log("midpoint", s))) */ export declare function tap(fn: (state: State) => void, name?: string): Primitive; /** * Inline state assertion. Throws if `pred(state)` is false. Unlike `tap`, * this is a contract check rather than a side-effect observer. */ export declare function expect(pred: StatePredicate, msg?: string, name?: string): Primitive; /** * Map an agent over the items in `state[key]`. Returns a new list of * results in `state[key + "_results"]`. */ export declare function mapOver(key: string, agent: BuilderBase, name?: string): Primitive; /** * Conditional execution: skip the wrapped agent unless `pred(state)` * returns true. */ export declare function gate(pred: StatePredicate, agent: BuilderBase, name?: string): Primitive; /** * First-to-complete wins. Runs all agents concurrently and returns the * result of the first one to finish. */ export declare function race(...agents: BuilderBase[]): Primitive; /** * Fire-and-forget background task. Launches the agent without blocking the * pipeline; an optional `onComplete` callback fires when it finishes. */ export interface DispatchOptions { name?: string; onComplete?: (result: unknown) => void; } export declare function dispatch(agent: BuilderBase, opts?: DispatchOptions): Primitive; /** * Wait for all background tasks (launched via `dispatch`) to complete * before continuing the pipeline. */ export declare function join(name?: string): Primitive; //# sourceMappingURL=index.d.ts.map