/** * PiAgentRegistrar — IAgentRegistrar adapter for Pi (plugin) platform agents. * * Maintains an in-memory registry of AgentDefinitions. Does NOT import from * any Pi SDK (@opencode-ai/plugin or @opencode-ai/sdk). The actual Pi API * hookup (pi.on("before_agent_start", ...)) happens in the extension entry * point, not here. * * Exports additional helper methods so the extension entry point can read * the current registry state when handling Pi events. * * @module */ import type { IAgentRegistrar } from "../../ports/agent-registrar.ts"; import type { AgentDefinition } from "../../types.ts"; /** * IAgentRegistrar implementation that manages agent definitions in memory. * * Agents are keyed by their `id` field. The registrar supports batch * register/unregister, diff-based sync, and listing. * * The extension entry point uses the exported `getRegisteredAgents()` and * `getSkillPaths()` helpers to inject agent configurations into Pi's * `before_agent_start` and `resources_discover` events. */ export declare class PiAgentRegistrar implements IAgentRegistrar { /** Internal agent registry, keyed by agent ID. */ private readonly agents; /** Skill directory paths associated with registered agents, keyed by agent ID. */ private readonly skillPaths; /** * Register (or update) a batch of agent definitions. * * Idempotent — registering the same definition for an existing agent ID * has no effect. * * @param agentDefs - Agent definitions to register. */ register(agentDefs: AgentDefinition[]): Promise; /** * Unregister agents by their IDs. * * Removes the agent definition and its associated skill path (if any). * Silently skips IDs that are not currently registered. * * @param agentIds - IDs of agents to unregister. */ unregister(agentIds: string[]): Promise; /** * Sync the registry with a new complete set of agent definitions. * * Computes the diff against the current state: * - **added**: IDs in the new set that are either new or whose definition changed * - **removed**: IDs in the current set that are absent from the new set * - **unchanged**: IDs present in both sets with identical definitions * * Applies the computed changes to the internal registry. * * @param agentDefs - The complete new set of agent definitions. * @returns A diff summary with added, removed, and unchanged IDs. */ sync(agentDefs: AgentDefinition[]): Promise<{ added: string[]; removed: string[]; unchanged: string[]; }>; /** * List currently registered agent IDs. * * @returns A sorted array of registered agent IDs. */ list(): Promise; /** * Retrieve all currently registered agent definitions. * * Used by the extension entry point when handling Pi's `before_agent_start` * event to inject agent system prompts into the Pi runtime. * * @returns An array of all currently registered AgentDefinitions. */ getRegisteredAgents(): AgentDefinition[]; /** * Register a skill directory path for a specific agent. * * Skill paths are contributed to Pi's `resources_discover` event so that * Pi knows which skill files to load for each agent. * * @param agentId - The agent ID to associate the skill path with. * @param path - The filesystem path to the skill directory. */ registerSkillPath(agentId: string, path: string): void; /** * Retrieve all registered skill directory paths. * * Used by the extension entry point when handling Pi's `resources_discover` * event to tell Pi which skill resources are available. * * @returns An array of filesystem paths to skill directories. */ getSkillPaths(): string[]; /** * Remove a previously registered skill path for a specific agent. * * @param agentId - The agent ID whose skill path should be removed. */ unregisterSkillPath(agentId: string): void; } //# sourceMappingURL=agent-registrar.d.ts.map