import type { IndemnClient } from './client.js'; import type { Agent, CreateAgentInput, UpdateAgentInput } from './types.js'; export class AgentsSDK { constructor(private client: IndemnClient) {} async listAgents(): Promise { return this.client.copilotGet( '/organization/:org_id/ai-studio/v2/bots', ); } async getAgent(id: string): Promise { const result = await this.client.copilotGet( `/organization/:org_id/ai-studio/v2/bots/${id}`, ); // v2 endpoint returns array even for single bot return Array.isArray(result) ? result[0] : result; } async createAgent(input: CreateAgentInput): Promise { return this.client.copilotPost( '/organization/:org_id/ai-studio/bots', { name: input.name, channels: input.channels || ['WEB'] }, ); } async updateAgent(id: string, input: UpdateAgentInput): Promise { return this.client.copilotPut( `/organization/:org_id/ai-studio/bots/${id}`, input, ); } async deleteAgent(id: string): Promise { await this.client.copilotDelete( `/organization/:org_id/ai-studio/bots/${id}`, ); } async cloneAgent(id: string): Promise { return this.client.copilotPost( '/organization/:org_id/ai-studio/v2/bots/clone', { source_id_bot: id }, ); } }