/** * Skill Composer — Meta-operations for composing agent execution * * Provides chain(), batch(), loop(), and verify() combinators that orchestrate * multiple agent calls into higher-level workflows. Works with any AdapterRegistry. * * Inspired by Claw-Code's skill composition pattern. * * @module SkillComposer * @version 1.0.0 */ import type { AgentPayload, AgentContext, AgentResult } from '../types/agent-adapter'; import type { AdapterRegistry } from '../adapters/adapter-registry'; /** * A single composable execution step. */ export interface ComposableStep { /** The agent to execute */ agentId: string; /** Payload to send to the agent */ payload: AgentPayload; /** Partial context overrides (merged with base context) */ context?: Partial; } /** * Result of a composed workflow. */ export interface ComposedResult { /** Whether all steps succeeded */ success: boolean; /** Individual results for each step */ results: AgentResult[]; /** Total execution time in milliseconds */ totalMs: number; /** Number of steps that succeeded */ successCount: number; /** Number of steps that failed */ failureCount: number; } /** * Options for the loop combinator. */ export interface LoopOptions { /** Maximum iterations (default 10) */ maxIterations?: number; /** Condition: return true to continue looping, false to stop */ condition: (result: AgentResult, iteration: number) => boolean; } /** * Options for the verify combinator. */ export interface VerifyOptions { /** Maximum retry attempts (default 3) */ maxRetries?: number; /** Validator: return true if the result is acceptable */ validator: (result: AgentResult) => boolean; } /** * Composes agent execution into higher-level workflows. * * @example * ```typescript * const composer = new SkillComposer(registry, { agentId: 'orchestrator' }); * * // Sequential chain — output of each step feeds into next * const results = await composer.chain([ * { agentId: 'researcher', payload: { action: 'search', params: { query: 'AI safety' } } }, * { agentId: 'writer', payload: { action: 'draft', params: {} } }, * { agentId: 'reviewer', payload: { action: 'review', params: {} } }, * ]); * * // Parallel batch with concurrency limit * const batchResults = await composer.batch(steps, 5); * ``` */ export declare class SkillComposer { private registry; private baseContext; /** * @param registry The adapter registry to execute agents through * @param baseContext Default execution context (merged with step-level overrides) */ constructor(registry: AdapterRegistry, baseContext: AgentContext); /** * Execute steps sequentially. Each step's result is passed as * `blackboardSnapshot.previousResult` to the next step. * * Stops on first failure unless `continueOnError` is true. */ chain(steps: ComposableStep[], continueOnError?: boolean): Promise; /** * Execute steps in parallel with an optional concurrency limit. * * @param steps Steps to execute * @param concurrency Max parallel executions (default: all at once) */ batch(steps: ComposableStep[], concurrency?: number): Promise; /** * Repeatedly execute a step while `condition` returns true. * * @param step The step to repeat * @param options Loop options (condition + maxIterations) */ loop(step: ComposableStep, options: LoopOptions): Promise; /** * Execute a step and retry until the validator accepts the result or retries are exhausted. * * @param step The step to execute and verify * @param options Verify options (validator + maxRetries) */ verify(step: ComposableStep, options: VerifyOptions): Promise; } //# sourceMappingURL=skill-composer.d.ts.map