Agents Core
Types
Types
AgentUsageStatsDocMethods
type AgentUsageStatsDocMethods = { [x: string]: never; }
AgentUsageStatsCollectionMethods
type AgentUsageStatsCollectionMethods = { findByAgent(agentId: string, periodType: "day" | "week" | "month"): Promise<AgentUsageStatsDocument[]>; findByOrgPeriod(orgId: string, period: string, periodType: "day" | "week" | "month"): Promise<AgentUsageStatsDocument[]>; }
AgentUsageStatsDocument
type AgentUsageStatsDocument = import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxDocumentBase<{ id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; }, AgentUsageStatsDocMethods, unknown> & { id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; } & AgentUsageStatsDocMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendObservables<{ id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; }> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendReactivity<{ id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; }, unknown>
AgentUsageStatsCollection
type AgentUsageStatsCollection = AgentUsageStatsCollectionMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/rx-collection").RxCollectionBase<{}, { id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; }, AgentUsageStatsDocMethods, AgentUsageStatsCollectionMethods, unknown> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxCollectionGenerated<{ id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; }, AgentUsageStatsDocMethods, unknown>
AgentDocMethods
type AgentDocMethods = { archive(): Promise<void>; updateTools(tools: string[]): Promise<void>; }
AgentCollectionMethods
type AgentCollectionMethods = { findByOrg(orgId: string): Promise<AgentDocument[]>; findOrgTemplates(orgId: string): Promise<AgentDocument[]>; findByUser(userId: string, orgId: string): Promise<AgentDocument[]>; }
AgentDocument
type AgentDocument = import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxDocumentBase<{ id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; }, AgentDocMethods, unknown> & { id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; } & AgentDocMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendObservables<{ id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; }> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendReactivity<{ id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; }, unknown>
AgentCollection
type AgentCollection = AgentCollectionMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/rx-collection").RxCollectionBase<{}, { id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; }, AgentDocMethods, AgentCollectionMethods, unknown> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxCollectionGenerated<{ id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; }, AgentDocMethods, unknown>
ConversationDocMethods
type ConversationDocMethods = { archive(): Promise<void>; updateLastMessage(): Promise<void>; }
ConversationCollectionMethods
type ConversationCollectionMethods = { findByUser(userId: string): Promise<ConversationDocument[]>; findByAgent(agentId: string): Promise<ConversationDocument[]>; findByContext(context: string, contextId: string): Promise<ConversationDocument[]>; }
ConversationDocument
type ConversationDocument = import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxDocumentBase<{ id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; }, ConversationDocMethods, unknown> & { id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; } & ConversationDocMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendObservables<{ id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; }> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendReactivity<{ id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; }, unknown>
ConversationCollection
type ConversationCollection = ConversationCollectionMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/rx-collection").RxCollectionBase<{}, { id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; }, ConversationDocMethods, ConversationCollectionMethods, unknown> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxCollectionGenerated<{ id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; }, ConversationDocMethods, unknown>
MessageDocMethods
type MessageDocMethods = { [x: string]: never; }
MessageCollectionMethods
type MessageCollectionMethods = { findByConversation(conversationId: string): Promise<MessageDocument[]>; getConversationTokenUsage(conversationId: string): Promise<{ total: number; prompt: number; completion: number; cost: number; }>; }
MessageDocument
type MessageDocument = import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxDocumentBase<{ id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; }, MessageDocMethods, unknown> & { id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; } & MessageDocMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendObservables<{ id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; }> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendReactivity<{ id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; }, unknown>
MessageCollection
type MessageCollection = MessageCollectionMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/rx-collection").RxCollectionBase<{}, { id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; }, MessageDocMethods, MessageCollectionMethods, unknown> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxCollectionGenerated<{ id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; }, MessageDocMethods, unknown>
ModelPricingDocMethods
type ModelPricingDocMethods = { [x: string]: never; }
ModelPricingCollectionMethods
type ModelPricingCollectionMethods = { findByProvider(provider: string): Promise<ModelPricingDocument[]>; findByModel(provider: string, model: string): Promise<ModelPricingDocument | null>; calculateCost(provider: string, model: string, promptTokens: number, completionTokens: number): Promise<{ prompt: number; completion: number; total: number; } | null>; }
ModelPricingDocument
type ModelPricingDocument = import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxDocumentBase<{ id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; }, ModelPricingDocMethods, unknown> & { id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; } & ModelPricingDocMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendObservables<{ id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; }> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendReactivity<{ id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; }, unknown>
ModelPricingCollection
type ModelPricingCollection = ModelPricingCollectionMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/rx-collection").RxCollectionBase<{}, { id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; }, ModelPricingDocMethods, ModelPricingCollectionMethods, unknown> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxCollectionGenerated<{ id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; }, ModelPricingDocMethods, unknown>
ProviderDocMethods
type ProviderDocMethods = { [x: string]: never; }
ProviderCollectionMethods
type ProviderCollectionMethods = { findByOrg(orgId: string): Promise<ProviderDocument[]>; findActiveByProvider(orgId: string, provider: string): Promise<ProviderDocument | null>; }
ProviderDocument
type ProviderDocument = import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxDocumentBase<{ id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; }, ProviderDocMethods, unknown> & { id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; } & ProviderDocMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendObservables<{ id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; }> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").ExtendReactivity<{ id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; }, unknown>
ProviderCollection
type ProviderCollection = ProviderCollectionMethods & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/rx-collection").RxCollectionBase<{}, { id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; }, ProviderDocMethods, ProviderCollectionMethods, unknown> & import("/Users/sthornock/code/epic/epic-flowstate/node_modules/rxdb/dist/types/index").RxCollectionGenerated<{ id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; }, ProviderDocMethods, unknown>
AgentUsageStats
type AgentUsageStats = { id: string; agentId: string; userId: string; orgId: string; period: string; periodType: "day" | "week" | "month"; conversationsCount: number; messagesCount: number; tokensPromptTotal: number; tokensCompletionTotal: number; tokensGrandTotal: number; costTotal: number; costByModel: Record<string, number>; toolCallsCount: number; toolCallsByName: Record<string, number>; averageLatencyMs: number; maxLatencyMs: number; }
Agent
type Agent = { id: string; orgId: string; type: "custom" | "developer" | "pm" | "devops"; name: string; createdBy: string; isOrgTemplate: boolean; provider: "anthropic" | "openai" | "xai"; model: string; allowedTools: string[]; createdAt: string; updatedAt: string; bio?: string | undefined; backstory?: string | undefined; tone?: string | undefined; temperature?: number | undefined; maxTokens?: number | undefined; systemPrompt?: string | undefined; avatar?: string | undefined; themeColor?: string | undefined; voice?: string | undefined; archivedAt?: string | undefined; }
Conversation
type Conversation = { id: string; agentId: string; userId: string; orgId: string; createdAt: string; updatedAt: string; title: string; archivedAt?: string | undefined; context?: string | undefined; contextId?: string | undefined; lastMessageAt?: string | undefined; }
Message
type Message = { id: string; createdAt: string; conversationId: string; role: "user" | "assistant"; content: string; toolCalls?: { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }[] | undefined; apiMetadata?: { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; } | undefined; }
ToolCall
type ToolCall = { toolName: string; arguments: Record<string, unknown>; result?: unknown; executionTime?: number | undefined; }
ApiMetadata
type ApiMetadata = { costTotal: number; provider: string; model: string; tokensPrompt: number; tokensCompletion: number; tokensTotal: number; costPrompt: number; costCompletion: number; latencyMs: number; streamingEnabled: boolean; rateLimitRemaining?: number | undefined; rateLimitReset?: string | undefined; }
ModelPricing
type ModelPricing = { id: string; provider: string; model: string; pricePerPromptToken: number; pricePerCompletionToken: number; currency: string; effectiveDate: string; deprecatedDate: string | null; }
Provider
type Provider = { id: string; orgId: string; provider: "anthropic" | "openai" | "xai"; createdAt: string; updatedAt: string; apiKey: string; isActive: boolean; baseUrl?: string | undefined; defaultModel?: string | undefined; rateLimitPerMinute?: number | undefined; }