pit-manager
Version:
Centralized prompt management system for Human Behavior AI agents
106 lines • 3.3 kB
TypeScript
/**
* Supabase client wrapper for PIT TypeScript online storage.
*/
export interface ChainExecutionGroup {
id: string;
group_id: string;
chain_id: string;
repo_id: string;
session_id?: string;
process_id?: string;
start_time: string;
end_time?: string;
status: 'running' | 'completed' | 'failed';
total_executions: number;
total_tokens: number;
metadata: Record<string, any>;
created_at: string;
updated_at: string;
}
export interface ExecutionData {
id: string;
execution_id: string;
model: string;
prompt_hash: string;
tag: string;
tokens: {
prompt: number;
completion: number;
total: number;
};
latency_ms: number;
cost: number;
chain_id?: string;
parent_execution_id?: string;
chain_group_id?: string;
metadata: Record<string, any>;
created_at: string;
}
export declare class SupabaseManager {
private client;
private url;
private serviceKey;
constructor(url?: string, serviceKey?: string);
/**
* Get the SQL schema for PIT database tables including chain execution groups.
*/
getDatabaseSchema(): string;
/**
* Generate a secure repository key.
*/
generateRepoKey(): string;
/**
* Hash a repository key for secure storage.
*/
hashRepoKey(repoKey: string): string;
/**
* Create a new repository and return its ID and key.
*/
createRepository(name: string, metadata?: Record<string, any>): Promise<{
repoId: string;
repoKey: string;
}>;
/**
* Get repository by key.
*/
getRepositoryByKey(repoKey: string): Promise<Record<string, any> | null>;
/**
* Create a new chain execution group for process-unique tracking.
*/
createChainExecutionGroup(repoId: string, chainId: string, sessionId?: string, processId?: string, metadata?: Record<string, any>): Promise<string>;
/**
* Get a chain execution group by ID.
*/
getChainExecutionGroup(groupId: string): Promise<ChainExecutionGroup | null>;
/**
* Update a chain execution group.
*/
updateChainExecutionGroup(groupId: string, updates: {
status?: 'running' | 'completed' | 'failed';
end_time?: string;
total_executions?: number;
total_tokens?: number;
metadata?: Record<string, any>;
}): Promise<void>;
/**
* Get chain execution groups for a repository.
*/
getChainExecutionGroups(repoId: string, chainId?: string, limit?: number): Promise<ChainExecutionGroup[]>;
/**
* Track an execution in the database with optional chain group association.
*/
trackExecution(repoId: string, executionData: ExecutionData, chainGroupId?: string): Promise<void>;
/**
* Update chain group statistics when an execution is tracked.
*/
private updateChainGroupStats;
/**
* Get executions for a repository with optional chain group filtering.
*/
getExecutions(repoId: string, limit?: number, chainGroupId?: string): Promise<ExecutionData[]>;
/**
* Get all executions for a specific chain group.
*/
getExecutionsByChainGroup(chainGroupId: string): Promise<ExecutionData[]>;
}
//# sourceMappingURL=supabase-client.d.ts.map