An environment for inquiry - complete documentation
This document specifies the application programming interfaces for Veritheia. All interfaces enforce journey-based data access and assessment-only AI operations. The contracts ensure extensibility while preventing system-generated insights.
The fundamental interface that all processes must implement:
public interface IAnalyticalProcess
{
ProcessDefinition GetDefinition();
Task<ProcessResult> ExecuteAsync(ProcessContext context);
IProcessResultRenderer GetResultRenderer();
}
Defines how process results are displayed to users:
public interface IProcessResultRenderer
{
Type GetComponentType();
object PrepareViewModel(ProcessResult result);
}
Abstracts LLM operations for consistent cognitive system access:
public interface ICognitiveAdapter
{
Task<EmbeddingResult> CreateEmbeddingsAsync(string text);
Task<string> GenerateTextAsync(string prompt, GenerationParameters parameters);
}
Provides unified data access respecting scope boundaries:
public interface IKnowledgeRepository
{
Task<IEnumerable<Document>> GetDocumentsInScopeAsync(Guid? scopeId);
Task<Document> GetDocumentAsync(Guid documentId);
Task<IEnumerable<ProcessedContent>> GetEmbeddingsAsync(Guid documentId);
Task<KnowledgeScope> GetScopeAsync(Guid scopeId);
Task SaveProcessResultAsync(ProcessResult result);
}
The IPlatformServices interface aggregates document processing capabilities available to all processes:
public interface IPlatformServices
{
IDocumentProcessor DocumentProcessor { get; }
ITextExtractor TextExtractor { get; }
IEmbeddingGenerator EmbeddingGenerator { get; }
IMetadataExtractor MetadataExtractor { get; }
IDocumentChunker DocumentChunker { get; }
}
This interface intentionally aggregates all platform services as a facade pattern. While this could be seen as violating ISP, it:
Processes only use the services they need from the facade.
Manages document processing pipeline:
public interface IDocumentProcessor
{
Task<ProcessedDocument> ProcessDocumentAsync(Guid documentId);
Task<bool> IsProcessedAsync(Guid documentId);
}
Extracts text from various document formats:
public interface ITextExtractor
{
Task<string> ExtractTextAsync(Stream documentStream, string mimeType);
bool SupportsFormat(string mimeType);
}
Creates vector embeddings using the cognitive system:
public interface IEmbeddingGenerator
{
Task<float[]> GenerateEmbeddingAsync(string text);
Task<List<float[]>> GenerateEmbeddingsAsync(List<string> texts);
int GetEmbeddingDimension();
}
Extracts structured metadata from documents:
public interface IMetadataExtractor
{
Task<DocumentMetadata> ExtractMetadataAsync(Stream documentStream, string mimeType);
}
Splits documents into semantic chunks:
public interface IDocumentChunker
{
Task<List<DocumentChunk>> ChunkDocumentAsync(string text, ChunkingStrategy strategy);
}
Manages user accounts and profiles:
public interface IUserService
{
Task<User> CreateUserAsync(CreateUserRequest request);
Task<User> GetUserAsync(Guid userId);
Task<User> GetCurrentUserAsync();
Task UpdateUserAsync(Guid userId, UpdateUserRequest request);
Task<IEnumerable<ProcessCapability>> GetUserCapabilitiesAsync(Guid userId);
}
Manages user journeys through processes:
public interface IJourneyService
{
Task<Journey> CreateJourneyAsync(CreateJourneyRequest request);
Task<Journey> GetJourneyAsync(Guid journeyId);
Task<IEnumerable<Journey>> GetUserJourneysAsync(Guid userId, JourneyFilter filter = null);
Task UpdateJourneyStateAsync(Guid journeyId, JourneyState newState);
Task<JourneyContext> GetJourneyContextAsync(Guid journeyId);
}
Manages narrative records within journeys:
public interface IJournalService
{
Task<Journal> CreateJournalAsync(Guid journeyId, JournalType type);
Task<JournalEntry> AddEntryAsync(Guid journalId, string content, EntryMetadata metadata = null);
Task<IEnumerable<Journal>> GetJourneyJournalsAsync(Guid journeyId);
Task<IEnumerable<JournalEntry>> GetRecentEntriesAsync(Guid journeyId, int count, JournalType? type = null);
Task<string> AssembleContextAsync(Guid journeyId, ContextRequest request);
}
Tracks evolving user intellectual patterns:
public interface IPersonaService
{
Task<Persona> GetPersonaAsync(Guid userId);
Task UpdateVocabularyAsync(Guid userId, IEnumerable<string> terms);
Task RecordPatternAsync(Guid userId, InquiryPattern pattern);
Task<PersonaContext> GetPersonaContextAsync(Guid userId, string domain = null);
}
Manages process discovery and metadata:
public interface IProcessRegistry
{
Task<IEnumerable<ProcessDefinition>> GetAvailableProcessesAsync();
Task<ProcessDefinition> GetProcessDefinitionAsync(string processType);
Task<IAnalyticalProcess> CreateProcessInstanceAsync(string processType);
}
Orchestrates process execution:
public interface IProcessEngine
{
Task<Guid> ExecuteAsync(string processType, Dictionary<string, object> inputs, Guid userId);
Task<ProcessExecution> GetExecutionAsync(Guid executionId);
Task<ProcessResult> GetResultAsync(Guid executionId);
}
Manages educational assignments (for Guided Composition):
public interface IAssignmentService
{
Task<Assignment> CreateAssignmentAsync(Assignment assignment);
Task<Assignment> GetAssignmentAsync(Guid assignmentId);
Task<IEnumerable<Assignment>> GetAssignmentsForUserAsync(Guid userId);
Task<StudentSubmission> SubmitResponseAsync(Guid assignmentId, string response, Guid studentId);
}
Describes a process and its requirements:
public class ProcessDefinition
{
public string ProcessType { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public ProcessCategory Category { get; set; }
public ProcessTriggerType TriggerType { get; set; }
public InputDefinition Inputs { get; set; }
}
Carries execution context through a process:
public class ProcessContext
{
public Guid ExecutionId { get; set; }
public Guid UserId { get; set; }
public Guid JourneyId { get; set; }
public Guid? ScopeId { get; set; }
public Dictionary<string, object> Inputs { get; set; }
public IServiceProvider Services { get; set; }
public JourneyContext JourneyContext { get; set; }
public T GetInput<T>(string key);
public T GetService<T>();
}
Encapsulates process execution results:
public class ProcessResult
{
public string ProcessType { get; set; }
public object Data { get; set; }
public Dictionary<string, object> Metadata { get; set; }
public DateTime ExecutedAt { get; set; }
public T GetData<T>();
}
Fluent API for defining process inputs:
public class InputDefinition
{
public InputDefinition AddTextArea(string name, string description, bool required = true);
public InputDefinition AddTextInput(string name, string description, bool required = true);
public InputDefinition AddDropdown(string name, string description, string[] options, bool required = true);
public InputDefinition AddScopeSelector(string name, string description, bool required = false);
public InputDefinition AddDocumentSelector(string name, string description, bool required = true);
public InputDefinition AddMultiSelect(string name, string description, string[] options, bool required = true);
}
Common properties for all entities:
public abstract class BaseEntity
{
public Guid Id { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}
Core user entity:
public class User : BaseEntity
{
public string Email { get; set; }
public string DisplayName { get; set; }
public Guid PersonaId { get; set; }
public DateTime LastActiveAt { get; set; }
}
Represents a user’s engagement with a process:
public class Journey : BaseEntity
{
public Guid UserId { get; set; }
public string ProcessType { get; set; }
public string Purpose { get; set; }
public JourneyState State { get; set; }
public Dictionary<string, object> Context { get; set; }
}
Narrative record within a journey:
public class Journal : BaseEntity
{
public Guid JourneyId { get; set; }
public JournalType Type { get; set; }
public bool IsShareable { get; set; }
}
Individual entry in a journal:
public class JournalEntry : BaseEntity
{
public Guid JournalId { get; set; }
public string Content { get; set; }
public EntrySignificance Significance { get; set; }
public List<string> Tags { get; set; }
}
Categorizes processes by their intellectual purpose:
public enum ProcessCategory
{
Methodological, // Research methodologies
Developmental, // Skill progression
Analytical, // Pattern discovery
Compositional, // Creative work
Reflective // Contemplative practices
}
Defines how processes are initiated:
public enum ProcessTriggerType
{
Manual, // User-initiated
Automatic, // Event-triggered
Scheduled // Time-based
}
Tracks process execution state:
public enum ProcessState
{
Pending, // Not yet started
Running, // Currently executing
Completed, // Finished successfully
Failed, // Terminated with error
Cancelled // User cancelled
}
Strategies for document chunking:
public enum ChunkingStrategy
{
Semantic, // Preserve meaning units
FixedSize, // Consistent token count
Paragraph, // Natural breaks
Sliding // Overlapping windows
}
Types of journals within a journey:
public enum JournalType
{
Research, // Findings and discoveries
Method, // Approaches and techniques
Decision, // Choices and rationales
Reflection // Insights and understanding
}
Current state of a journey:
public enum JourneyState
{
Active, // In progress
Paused, // Temporarily stopped
Completed, // Finished successfully
Abandoned // Discontinued
}
Importance level for journal entries:
public enum EntrySignificance
{
Routine, // Regular progress
Notable, // Worth highlighting
Critical, // Key decision or insight
Milestone // Major achievement
}
Parameters for creating a new journey:
public class CreateJourneyRequest
{
public Guid UserId { get; set; }
public Guid PersonaId { get; set; }
public string ProcessType { get; set; }
public string Purpose { get; set; }
}
Extensions register services using this pattern:
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddProcess<TProcess>(this IServiceCollection services)
where TProcess : class, IAnalyticalProcess;
}
Extension entities must:
BaseEntity
ProcessExecution
when storing process-specific dataExtension components must:
GET /api/processes
Returns: ProcessDefinition[]
GET /api/processes/{processType}
Returns: ProcessDefinition
POST /api/processes/{processType}/execute
Body: { inputs: { ... } }
Returns: { executionId: Guid }
GET /api/executions/{executionId}
Returns: ProcessExecution
GET /api/executions/{executionId}/result
Returns: ProcessResult
GET /api/documents
Query: scopeId={guid}
Returns: Document[]
GET /api/documents/{documentId}
Returns: Document
POST /api/documents
Body: multipart/form-data
Returns: Document
GET /api/scopes
Returns: KnowledgeScope[]
POST /api/scopes
Body: KnowledgeScope
Returns: KnowledgeScope
POST /api/search/keyword
Body: { query: string, scopeId?: Guid }
Returns: SearchResult[]
POST /api/search/semantic
Body: { query: string, scopeId?: Guid, threshold?: number }
Returns: SemanticSearchResult[]
{
"success": true,
"data": { ... },
"metadata": {
"timestamp": "2024-01-01T00:00:00Z",
"version": "v1"
}
}
{
"success": false,
"error": {
"code": "PROCESS_NOT_FOUND",
"message": "Process type 'InvalidProcess' is not registered",
"details": { ... }
}
}
{
"success": true,
"data": [ ... ],
"pagination": {
"page": 1,
"pageSize": 20,
"totalItems": 145,
"totalPages": 8
}
}
All contracts follow semantic versioning:
Backward compatibility is maintained within major versions.