/** * src/opencode-plugin.ts * * Official opencode plugin entrypoint. Lets the Agenthood Society load globally * via a single line in opencode config: * * { "plugin": ["agenthood"] } * * The plugin wires what the repo's `opencode.json` wires locally — the skills * directory and AGENTS.md instructions — by mutating the merged config in the * `config` hook, plus a primary `the-steward` router agent. It also registers * `agenthood_run_member`, a tool that executes a Society member as a real * runtime agent (enforced behavior + audit trail) instead of free-styling from * the skill text. The CLI (`dist/cli.js`) is untouched and spawned as-is. * * opencode resolves this module via the package `exports["./server"]` and * requires a default export of `{ id, server }` (see `@opencode-ai/plugin`'s * `PluginModule`). Config is loaded once at startup, not hot-reloaded: after * installing the plugin, opencode must be restarted. */ import type { ChildProcess } from 'node:child_process'; import type { Config, Plugin, ToolContext, ToolDefinition, ToolResult } from '@opencode-ai/plugin'; export type PluginConfig = Config & { skills?: { paths?: string[]; urls?: string[]; }; }; export interface AgenthoodConfigPaths { skillsPath: string; instructionsPath: string; } export interface DirectoryEntry { name: string; isDirectory: () => boolean; } export interface MemberDiscoveryFileSystem { readdir: (path: string) => DirectoryEntry[]; exists: (path: string) => boolean; warn: (message: string) => void; } export declare function discoverMemberNames(skillsDir: string, fs?: MemberDiscoveryFileSystem): string[]; export declare function getMemberNames(): string[]; export declare function wireAgenthoodConfig(cfg: PluginConfig, paths: AgenthoodConfigPaths, hasInstructions?: (path: string) => boolean): void; export declare function appendCapped(current: string, chunk: Buffer, max: number, label: string): string; export interface CollectedOutput { stdout: string; stderr: string; code: number | null; spawnError?: string; timedOut?: boolean; } /** Collects a spawned member run's stdout/stderr until close, spawn error, or timeout. */ export declare function collectOutput(child: ChildProcess, abort: AbortSignal, timeoutMs?: number): Promise; export declare function formatRunResult({ stdout, stderr, code, spawnError, timedOut }: CollectedOutput): string; export interface RunMemberDependencies { existsCli: (path: string) => boolean; spawnProcess: (command: string, args: string[], options: { cwd: string; }) => ChildProcess; } export interface RunMemberOptions { directory: string; abort: AbortSignal; dependencies: RunMemberDependencies; timeoutMs?: number; } /** Runs `agenthood run ""` in the caller's project and streams the result. */ export declare function runMember(member: string, task: string, options: RunMemberOptions): Promise; /** `agenthood_run_member` tool executor: spawns the CLI in the caller's project. */ export declare function executeRunMember({ member, task }: { member: string; task: string; }, context: ToolContext): Promise; export declare function buildRunMemberTool(names: string[]): Record; declare const _default: { id: string; server: Plugin; }; export default _default; //# sourceMappingURL=opencode-plugin.d.ts.map