donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
91 lines • 4.13 kB
TypeScript
import type { Request, Response } from 'express';
import type { AgentsManager } from '../managers/AgentsManager';
import type { GptConfigsManager } from '../managers/GptConfigsManager';
import type { GptConfigInput } from '../models/GptConfig';
/**
* API controller for managing GPT configurations used by Donobu flows.
*
* The GptConfigsApi provides comprehensive management of GPT configurations, which define
* the connection parameters, authentication credentials, and model settings for various
* AI providers. These configurations are referenced by agents and used during flow execution
* to connect to external AI services.
*
* **Security Features:**
* - Automatic redaction of sensitive fields (API keys, secret keys) in responses
* - Validation of configurations before storage
* - Cascade cleanup when configurations are deleted
*
* **Key Features:**
* - Automatic cleanup of dependent agent mappings on deletion
* - Comprehensive error handling and validation
* - Support for multiple AI provider types and authentication methods
*/
export declare class GptConfigsApi {
private readonly gptConfigsManager;
private readonly agentsManager;
/**
* Zod schema for validating GPT config names from URL parameters.
* Ensures names are non-empty strings with reasonable length constraints.
*/
private static readonly GPT_CONFIG_NAME_SCHEMA;
/**
* Field names that contain sensitive data and should be redacted in API responses.
* These fields are automatically replaced with asterisks to prevent credential exposure.
*/
private static readonly REDACTED_FIELD_NAMES;
constructor(gptConfigsManager: GptConfigsManager, agentsManager: AgentsManager);
/**
* Creates or updates a GPT configuration.
*
* This endpoint performs comprehensive validation of the GPT configuration before
* storage, including attempting a request to the GPT to verify connectivity and
* authentication. The configuration is validated against the provider's requirements
* and tested for functionality before being saved.
*
* **Validation Process:**
* 1. Schema validation against the configuration type
* 2. Credential validation via test request to the provider
* 3. Model availability verification (where supported)
* 4. Persistent storage of the validated configuration
*
* **Security:**
* - Sensitive fields are automatically redacted in the response
* - Original credentials are securely stored but never returned
*/
set(req: Request, res: Response): Promise<void>;
/**
* Retrieves a specific GPT configuration by name.
*
* Returns the requested GPT configuration with sensitive fields automatically
* redacted for security. The configuration includes all provider-specific
* settings and model parameters needed for AI service connectivity.
*/
get(req: Request, res: Response): Promise<void>;
/**
* Retrieves all stored GPT configurations.
*
* Returns a complete collection of all GPT configurations with sensitive
* fields redacted. This endpoint is useful for administrative interfaces
* and configuration management tools. The response maps configuration
* names to their respective settings.
*/
getAll(_req: Request, res: Response): Promise<void>;
/**
* Deletes a GPT configuration and cleans up dependent references.
*
* This endpoint permanently removes a GPT configuration and performs
* cascade cleanup to maintain system integrity:
*
* **Cleanup Process:**
* 1. Removes the configuration from storage
* 2. Identifies all agents referencing this configuration
* 3. Unlinks the configuration from all dependent agents
*/
delete(req: Request, res: Response): Promise<void>;
/**
* Redacts sensative data from the given GPT configuration so that the record
* can be safely returned through the API.
*/
static redactSensativeData(config: GptConfigInput): GptConfigInput;
}
//# sourceMappingURL=GptConfigsApi.d.ts.map