/** * Canonical runtime service for filesystem, terminal, git, model, and plugin capabilities. * An ordered strategy table selects each dispatcher; an explicit fallback handles uncovered capabilities. */ import { type CapabilityAvailability, type CapabilityEnvironment, type ElizaCapabilityRouter, type FileCapability, type GitCapability, type LocalModelCapability, type RemotePluginCapability, type TerminalCapability } from "../capabilities/protocol.js"; import type { IAgentRuntime } from "../types/runtime.js"; import { Service } from "../types/service.js"; /** * Routing strategy interface. Each strategy decides how to dispatch a * capability invocation: locally (via a remote-mode plugin running in the * host process) or remotely (via HTTPS to a capability-host container, * a cloud coding runner or another paired user device). * * Strategies are an internal implementation detail of * {@link RuntimeCapabilityService}; external callers only see the * {@link ElizaCapabilityRouter} surface. */ export interface CapabilityStrategy { readonly id: string; readonly environment: CapabilityEnvironment; availability(): Promise; readonly fs?: FileCapability; readonly pty?: TerminalCapability; readonly git?: GitCapability; readonly model?: LocalModelCapability; readonly plugin?: RemotePluginCapability; } /** Options for constructing a {@link RuntimeCapabilityService}. */ export interface RuntimeCapabilityServiceOptions { /** * Strategy table keyed by capability dispatcher. The first matching * strategy wins per capability invocation. */ strategies?: CapabilityStrategy[]; /** * Fallback router used when no strategy matches. Defaults to * {@link UnavailableCapabilityRouter}. */ fallback?: ElizaCapabilityRouter; } /** * Service that owns the {@link CAPABILITY_ROUTER_SERVICE_TYPE} slot and exposes * the common router surface independently of where a capability executes. * * Usage: * * ```ts * const svc = runtime.getService(CAPABILITY_ROUTER_SERVICE_TYPE); * if (svc) { * const availability = await svc.availability(); * // capability dispatch via svc.fs /.pty /.git /.model /.plugin * } * ``` */ export declare class RuntimeCapabilityService extends Service implements ElizaCapabilityRouter { static serviceType: "capability-router"; capabilityDescription: string; private strategies; private fallback; constructor(runtime: IAgentRuntime, options?: RuntimeCapabilityServiceOptions); static start(runtime: IAgentRuntime): Promise; stop(): Promise; get environment(): CapabilityEnvironment; availability(): Promise; get fs(): FileCapability; get pty(): TerminalCapability; get git(): GitCapability; get model(): LocalModelCapability; get plugin(): RemotePluginCapability; /** * Replace the strategy table at runtime. Used when the host discovers a * new capability-providing remote plugin and registers it as a strategy. */ setStrategies(strategies: CapabilityStrategy[]): void; /** Replace the fallback router. */ setFallback(fallback: ElizaCapabilityRouter): void; private pickStrategy; }