export type Project = {
id: string;
user_id: string;
name: string;
description: string | null;
status: 'active' | 'archived' | 'completed';
created_at: string;
updated_at: string;
};
export type Task = {
id: string;
project_id: string;
initiative_id: string | null;
title: string;
description: string | null;
status: 'todo' | 'in_progress' | 'done';
priority: 'low' | 'medium' | 'high';
due_date: string | null;
assignee_id: string | null;
created_at: string;
updated_at: string;
created_by: string;
};
export type Document = {
id: string;
project_id: string;
title: string;
content: string;
document_type: 'requirement' | 'design' | 'technical' | 'meeting_notes' | 'other';
created_at: string;
updated_at: string;
created_by: string;
};
export type Profile = {
id: string;
created_at: string;
updated_at: string;
email: string;
username: string | null;
full_name: string | null;
avatar_url: string | null;
tenant_id: string | null;
};
export type AIConversation = {
id: string;
project_id: string;
user_id: string;
messages: any;
created_at: string;
updated_at: string;
};
export type Initiative = {
id: string;
tenant_id: string;
name: string;
description: string | null;
objective: string;
status: 'planning' | 'active' | 'on_hold' | 'completed' | 'cancelled';
priority: 'critical' | 'high' | 'medium' | 'low';
start_date: string | null;
target_date: string | null;
completed_date: string | null;
owner_id: string;
created_by: string;
created_at: string;
updated_at: string;
metadata: any;
tags: string[];
order_index: number;
parent_initiative_id: string | null;
owner?: Profile;
task_count?: number;
milestone_count?: number;
document_count?: number;
};
export type InitiativeMilestone = {
id: string;
initiative_id: string;
name: string;
description: string | null;
target_date: string;
completed_date: string | null;
status: 'pending' | 'in_progress' | 'completed' | 'missed';
order_index: number;
created_by: string;
created_at: string;
updated_at: string;
};
export type ProjectInsert = Omit<Project, 'id' | 'user_id' | 'created_at' | 'updated_at'>;
export type TaskInsert = Omit<Task, 'id' | 'created_at' | 'updated_at' | 'created_by'>;
export type DocumentInsert = Omit<Document, 'id' | 'created_at' | 'updated_at' | 'created_by'>;
export type InitiativeInsert = Omit<Initiative, 'id' | 'created_at' | 'updated_at' | 'created_by' | 'tenant_id' | 'completed_date' | 'order_index' | 'parent_initiative_id' | 'owner' | 'task_count' | 'milestone_count' | 'document_count'>;
export type InitiativeMilestoneInsert = Omit<InitiativeMilestone, 'id' | 'created_at' | 'updated_at' | 'created_by'>;
export interface ProjectContext {
project: Project;
statistics: {
total_documents: number;
total_tasks: number;
document_types: Record<string, number>;
task_status: Record<string, number>;
};
recent_documents: Document[];
recent_tasks: Task[];
team_members: Profile[];
}
export interface Filter {
status?: string;
search?: string;
created_after?: string;
created_before?: string;
type?: string;
project_id?: string;
assignee_id?: string;
}
export interface Pagination {
limit?: number;
offset?: number;
}
export interface Sort {
field?: string;
order?: 'asc' | 'desc';
}
export declare class HeliosError extends Error {
message: string;
code: string;
statusCode: number;
originalError?: any | undefined;
constructor(message: string, code?: string, statusCode?: number, originalError?: any | undefined);
}
export declare class NotFoundError extends HeliosError {
constructor(resource: string, id?: string);
}
export declare class UnauthorizedError extends HeliosError {
constructor(message?: string);
}
export declare class ValidationError extends HeliosError {
constructor(message: string, field?: string);
}
export declare class ApiClient {
private baseUrl;
private apiKey;
private currentUserId;
private currentTenantId;
constructor();
/**
* Make authenticated API request
*/
private request;
/**
* Authenticate with API key (validates the key and gets user info)
*/
authenticate(): Promise<Profile>;
/**
* Get current user ID
*/
getCurrentUserId(): string;
/**
* Get current tenant ID
*/
getCurrentTenantId(): string | null;
/**
* Project operations
*/
getProjects(filter?: Filter, pagination?: Pagination, sort?: Sort): Promise<Project[]>;
getProject(projectId: string): Promise<Project>;
createProject(projectData: ProjectInsert): Promise<Project>;
updateProject(projectId: string, updates: Partial<Project>): Promise<Project>;
/**
* Task operations
*/
getTasks(filter?: Filter & {
project_id?: string;
assignee_id?: string;
}, pagination?: Pagination, sort?: Sort): Promise<Task[]>;
getTask(taskId: string): Promise<Task>;
createTask(taskData: TaskInsert): Promise<Task>;
updateTask(taskId: string, updates: Partial<Task>): Promise<Task>;
/**
* Document operations
*/
getDocuments(filter?: Filter & {
project_id?: string;
document_type?: string;
}, pagination?: Pagination, sort?: Sort): Promise<Document[]>;
getDocument(documentId: string): Promise<Document>;
createDocument(documentData: DocumentInsert): Promise<Document>;
updateDocument(documentId: string, updates: Partial<Document>): Promise<Document>;
/**
* Get comprehensive project context for AI agents
*/
getProjectContext(projectId: string): Promise<ProjectContext>;
/**
* Initiative operations
*/
getInitiatives(filter?: Filter & {
project_id?: string;
status?: string;
priority?: string;
}, pagination?: Pagination, sort?: Sort): Promise<Initiative[]>;
getInitiative(initiativeId: string): Promise<Initiative>;
createInitiative(initiativeData: InitiativeInsert): Promise<Initiative>;
updateInitiative(initiativeId: string, updates: Partial<Initiative>): Promise<Initiative>;
getInitiativeContext(initiativeId: string): Promise<any>;
getInitiativeInsights(initiativeId: string): Promise<any>;
searchWorkspace(query: string, filters?: any, limit?: number): Promise<any>;
getEnhancedProjectContext(projectId: string): Promise<any>;
getWorkspaceContext(): Promise<any>;
/**
* Additional methods for MCP compatibility
*/
updateTasksByProject(projectId: string, updates: Partial<Task>): Promise<void>;
createTaskDependency(dependency: any): Promise<any>;
getTaskDependencies(taskId: string): Promise<any[]>;
getProjectDependencies(projectId: string): Promise<any[]>;
createWorkflowRule(rule: any): Promise<any>;
getWorkflowRules(filter: any): Promise<any[]>;
getWorkflowRule(ruleId: string): Promise<any>;
logWorkflowExecution(execution: any): Promise<any>;
createTriggerAutomation(automation: any): Promise<any>;
getWorkflowExecutions(filter: any): Promise<any[]>;
createDocumentCollaboration(collaboration: any): Promise<any>;
getDocumentCollaborations(documentId: string): Promise<any[]>;
}
export declare function getApiClient(): ApiClient;
export declare const apiClient: ApiClient;
export declare const supabaseService: ApiClient;