import type { AgentSpec } from '@contractspec/lib.contracts-spec/agent'; import type { OpenCodeAgentType } from '../types'; import { type OpenCodeTool } from './tool-bridge'; /** * OpenCode agent configuration in JSON format. */ export interface OpenCodeAgentJSON { /** Agent name */ name: string; /** Agent version */ version?: string; /** Agent description */ description?: string; /** System instructions */ instructions?: string; /** Agent type */ agent_type: OpenCodeAgentType; /** Available tools */ tools?: OpenCodeTool[]; /** Configuration options */ config?: OpenCodeAgentConfig; } /** * OpenCode agent configuration options. */ export interface OpenCodeAgentConfig { /** Maximum agentic iterations */ max_steps?: number; /** Temperature for generation */ temperature?: number; /** Model to use */ model?: string; /** Tool permissions */ permissions?: Record; } /** * OpenCode agent markdown format (for .opencode/agent/*.md files). */ export interface OpenCodeAgentMarkdown { /** Frontmatter */ frontmatter: { name: string; type: OpenCodeAgentType; version?: string; model?: string; temperature?: number; max_steps?: number; tools?: string[]; }; /** Body content */ body: string; } /** * Infer the appropriate OpenCode agent type from an AgentSpec. * * The inference is based on: * - Tool capabilities (file editing, bash execution → build) * - Instructions content (planning keywords → plan) * - Exploration keywords (search, find → explore) */ export declare function inferAgentType(spec: AgentSpec): OpenCodeAgentType; /** * Convert an AgentSpec to OpenCode agent JSON configuration. */ export declare function specToOpenCodeConfig(spec: AgentSpec, options?: { agentType?: OpenCodeAgentType; model?: string; temperature?: number; maxSteps?: number; }): OpenCodeAgentJSON; /** * Convert an AgentSpec to OpenCode agent markdown format. */ export declare function specToOpenCodeMarkdown(spec: AgentSpec, options?: { agentType?: OpenCodeAgentType; model?: string; temperature?: number; maxSteps?: number; }): OpenCodeAgentMarkdown; /** * Serialize OpenCode agent markdown to string. */ export declare function serializeOpenCodeMarkdown(markdown: OpenCodeAgentMarkdown): string; /** * Convert OpenCode agent configuration to partial AgentSpec. * Note: This is a partial conversion as OpenCode config may not have all spec fields. */ export declare function openCodeConfigToSpec(config: OpenCodeAgentJSON): Partial;