export class OpenFangError extends Error { status: number; body: string; constructor(message: string, status: number, body: string); } export interface AgentCreateOpts { template?: string; name?: string; model?: string; [key: string]: unknown; } export interface MessageOpts { attachments?: string[]; [key: string]: unknown; } export interface StreamEvent { type?: string; delta?: string; raw?: string; [key: string]: unknown; } export class OpenFang { baseUrl: string; agents: AgentResource; sessions: SessionResource; workflows: WorkflowResource; skills: SkillResource; channels: ChannelResource; tools: ToolResource; models: ModelResource; providers: ProviderResource; memory: MemoryResource; triggers: TriggerResource; schedules: ScheduleResource; constructor(baseUrl: string, opts?: { headers?: Record }); health(): Promise; healthDetail(): Promise; status(): Promise; version(): Promise; metrics(): Promise; usage(): Promise; config(): Promise; } export class AgentResource { list(): Promise; get(id: string): Promise; create(opts: AgentCreateOpts): Promise<{ id: string; [key: string]: unknown }>; delete(id: string): Promise; stop(id: string): Promise; clone(id: string): Promise; update(id: string, data: Record): Promise; setMode(id: string, mode: string): Promise; setModel(id: string, model: string): Promise; message(id: string, text: string, opts?: MessageOpts): Promise; stream(id: string, text: string, opts?: MessageOpts): AsyncGenerator; session(id: string): Promise; resetSession(id: string): Promise; compactSession(id: string): Promise; listSessions(id: string): Promise; createSession(id: string, label?: string): Promise; switchSession(id: string, sessionId: string): Promise; getSkills(id: string): Promise; setSkills(id: string, skills: unknown): Promise; upload(id: string, file: Blob | File, filename: string): Promise; setIdentity(id: string, identity: Record): Promise; patchConfig(id: string, config: Record): Promise; } export class SessionResource { list(): Promise; delete(id: string): Promise; setLabel(id: string, label: string): Promise; } export class WorkflowResource { list(): Promise; create(workflow: Record): Promise; run(id: string, input?: Record): Promise; runs(id: string): Promise; } export class SkillResource { list(): Promise; install(skill: Record): Promise; uninstall(skill: Record): Promise; search(query: string): Promise; } export class ChannelResource { list(): Promise; configure(name: string, config: Record): Promise; remove(name: string): Promise; test(name: string): Promise; } export class ToolResource { list(): Promise; } export class ModelResource { list(): Promise; get(id: string): Promise; aliases(): Promise; } export class ProviderResource { list(): Promise; setKey(name: string, key: string): Promise; deleteKey(name: string): Promise; test(name: string): Promise; } export class MemoryResource { getAll(agentId: string): Promise>; get(agentId: string, key: string): Promise; set(agentId: string, key: string, value: unknown): Promise; delete(agentId: string, key: string): Promise; } export class TriggerResource { list(): Promise; create(trigger: Record): Promise; update(id: string, trigger: Record): Promise; delete(id: string): Promise; } export class ScheduleResource { list(): Promise; create(schedule: Record): Promise; update(id: string, schedule: Record): Promise; delete(id: string): Promise; run(id: string): Promise; }