/** * RLM Adapter — Recursive Language Model integration * * Connects the SwarmOrchestrator to any RLM-compatible HTTP endpoint * (see arxiv 2512.24601 / alexzhang13/rlm). BYOC — bring your own client. * * The adapter serialises each `AgentPayload` into a prompt string and POST it * to `/completion`. The server responds with a JSON body whose * `text` (or `content`) field becomes the agent result data. * * Usage: * ```typescript * const adapter = new RLMAdapter(); * adapter.registerAgent('rlm-planner', { * endpoint: 'http://localhost:8080', * model: 'rlm-7b', * maxDepth: 3, * }); * await adapter.initialize({}); * const result = await adapter.executeAgent('rlm-planner', payload, ctx); * ``` * * @module RLMAdapter * @version 1.0.0 */ import { BaseAdapter } from './base-adapter'; import type { AdapterConfig, AdapterCapabilities, AgentPayload, AgentContext, AgentResult } from '../types/agent-adapter'; /** * Minimal interface for a BYOC HTTP client capable of sending a JSON POST. * Pass any client that implements this — no hard dependency on any HTTP lib. */ export interface RLMHttpClient { post(url: string, body: Record, options?: { headers?: Record; timeoutMs?: number; }): Promise>; } /** * Configuration for a registered RLM agent. */ export interface RLMAgentConfig { /** * Base URL of the RLM HTTP server. * Example: `'http://localhost:8080'` */ endpoint: string; /** * Model identifier forwarded to the RLM server. * Default: `'rlm-default'` */ model?: string; /** * Maximum recursion depth the RLM server should apply. * Forwarded as `max_depth` in the request body. * Default: `1` (no sub-calls). */ maxDepth?: number; /** * Request timeout in milliseconds. * Default: `60 000` (60 s). */ timeoutMs?: number; /** * Optional system prompt prepended before the serialised payload. */ systemPrompt?: string; /** * Additional headers forwarded with every request (e.g. `Authorization`). */ headers?: Record; /** * Bring-your-own HTTP client. * When provided the adapter delegates all HTTP to this client instead of * using the built-in `fetch`-based transport. */ client?: RLMHttpClient; } /** * Adapter for RLM-compatible recursive language-model servers. */ export declare class RLMAdapter extends BaseAdapter { readonly name = "rlm"; readonly version = "1.0.0"; private agentConfigs; get capabilities(): AdapterCapabilities; initialize(config: AdapterConfig): Promise; /** * Register an agent backed by an RLM endpoint. * * @param agentId Unique agent identifier used when calling `executeAgent`. * @param config Per-agent RLM configuration. */ registerAgent(agentId: string, config: RLMAgentConfig): void; executeAgent(agentId: string, payload: AgentPayload, context: AgentContext): Promise; /** Build a plain-text prompt from the agent config + payload. */ private _buildPrompt; /** * Send a POST request using the BYOC client when provided, * otherwise fall back to the built-in `fetch`-based transport. */ private _post; } //# sourceMappingURL=rlm-adapter.d.ts.map