repo stringclasses 20
values | path stringlengths 6 94 | lang stringclasses 5
values | n_chars int64 81 200k | sha256 stringlengths 64 64 | content stringlengths 81 200k |
|---|---|---|---|---|---|
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/rateLimit.test.ts | ts | 14,961 | b8fd77861ef72c86ff9ed1d80d1baf8c872cab8c8725bffffa65a573f81f2b89 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
// Track rate limit state per key for the mock
const rateLimitState = new Map<string, { count: number; limit: number; resetAt: Date }>();
// Mock the Redis rate limiter with proper per-... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/auth.test.ts | ts | 5,190 | 27bedc4303ad3426b3a35d64d3abc877638393bc5df902d1cdd516b17751bd0b | import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
import { requireAuth, requireAdmin } from '../auth';
// Helper to create mock request
function createMockRequest(user?: Express.User): Partial<Request> {
return {
user,
session: {} as any... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/performanceMetrics.test.ts | ts | 20,228 | d4230fc204fb4aab48cc85071cfcbb5d297f51dfb4a751ed101204b27f23c4b0 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
// Mock the performance metrics module
const mockRecordRequest = vi.fn();
const mockToPrometheusFormat = vi.fn().mockReturnValue('# HELP test\n');
const mockGetSlowEndpoints = vi.fn().mo... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/csrf.oauthExempt.test.ts | ts | 1,102 | 4136cf52f0083cc7dac5e0240dd1796ce6990e52d64d2c6b6bee3a0c83c83bb7 | /**
* Guards the P0-1 fix: /oauth/* and /.well-known/* POST endpoints must
* be exempt from the double-submit-cookie CSRF middleware. Otherwise a
* production deployment with CSRF_MODE=enforce would 403 every DCR /
* token / revoke / consent-form request.
*/
import { describe, it, expect } from 'vitest';
import {... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/tokenAuth.test.ts | ts | 36,655 | 463adebb1dafa8ade8f07f36953832f75ec0350bbc94128ae67533c2e97cd1d6 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
import { requireApiToken, requireScope, apiTokenRateLimiter } from '../tokenAuth';
// Mock external services
vi.mock('../../services/users', () => ({
validateApiToken: vi.fn(),
getUs... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/turnstile.test.ts | ts | 8,579 | 83d7e24e753ee4bfadbba44d0392945c025adcc84234070fcd7ec6655a7418ce | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
function createM... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/security-headers.test.ts | ts | 11,570 | c31ac4d5610e3935a3060bd9528ac21a55757420a1e4f760d14c1ca61c89a2c6 | import { describe, it, expect } from 'vitest';
import express from 'express';
import helmet from 'helmet';
import request from 'supertest';
/**
* Security Headers Test Suite
*
* Tests the Helmet security headers configuration that mirrors the production
* setup in app.ts. Rather than importing createApp (which req... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/actorContext.test.ts | ts | 6,808 | 986369407afe331a5defe8237ac674aaf453b44d2de09a56de67535316c70972 | import { describe, it, expect } from 'vitest';
import express, { Express, Request, Response } from 'express';
import request from 'supertest';
import {
actorContextMiddleware,
getCurrentActor,
isNonHumanWriter,
runWithActor,
setActorUserId,
type ActorContext,
} from '../actorContext';
function makeApp(han... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/videoLimits.test.ts | ts | 14,724 | 563358d7f7a6208b1f31391cc4985feae371752ab0194866db5b2bfbaef8bc1a | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
// Mock the dependencies
const mockGetVideoTierLimits = vi.fn();
const mockGetUserVideoGenerationThisMonth = vi.fn();
vi.mock('../../config/pricing', () => ({
getVideoTierLimits: (tie... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/database.test.ts | ts | 11,097 | cbf8b232e4965e5f477629c6cf20d3a9ac2d3b31e0dbea0c775a8f2f82b6a368 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
// Mock the database service
const mockIsDatabaseHealthy = vi.fn();
const mockIsDatabaseConnected = vi.fn();
const mockIsConnectionFullyReady = vi.fn();
const mockWaitForConnection = vi.... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/errorHandler.test.ts | ts | 9,226 | 3bc9773646761f718c33158a1ac76dd3af731a6a0c06771bd4b68f46d405c381 | import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
import {
AppError,
errorHandler,
asyncHandler,
notFoundHandler,
} from '../errorHandler';
// Mock the logError function
vi.mock('../../services/errorLogger', () => ({
logError: vi.fn().mo... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/csrf.test.ts | ts | 14,424 | 021715b8b444f443d51e7b6790bd5c6527b776a95c021be24d32e0149a7f64be | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
import { csrfMiddleware, getCsrfToken, csrfTokenEndpoint } from '../csrf';
// Helper to create mock request
function createMockRequest(
overrides: Partial<Request> & { cookies?: Record... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/priority-enhanced.test.ts | ts | 16,244 | 954552c8fa2a9883324306d5482b64489073cdd51cf15485d2ad7c044d4f4164 | /**
* Enhanced tests for the priority middleware.
*
* Focuses on throttling behaviour under simulated high-load conditions,
* active-request lifecycle (increment / decrement), and metric correctness.
*
* The source module starts a setInterval for event-loop-lag monitoring.
* We use fake timers so the interval ne... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/auth.escalation.test.ts | ts | 14,121 | b7b224120857afd6e6479e6bb107d70de572e38d79016c4debe2a96e855718fc | /**
* Tests for privilege escalation protections in the auth middleware.
*
* These tests focus on security-critical aspects of authentication and
* authorization:
* - Ensuring unauthenticated users cannot reach protected endpoints
* - Ensuring non-admin users cannot escalate to admin privileges
* - Ensuring tier... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/priority.test.ts | ts | 8,105 | 0b5ef59039e9ee2ffa7062f3b9292563fc61c6f0a235106da12073e51e43856b | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
import {
priorityMiddleware,
getPriorityMetrics,
resetPriorityMetrics,
Priority,
} from '../priority';
// Helper to create mock request
function createMockRequest(path: string): ... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/mcpAudit.test.ts | ts | 10,347 | d3b7992a53dc7e9582bd284f6dbe2bf0d4bdb85829d1843f10bf98667ee718b4 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import express, { Express } from 'express';
import request from 'supertest';
// Hoist mock functions so they are available inside vi.mock factory
const { mockInsertOne, mockCreateIndex, mockCollection } = vi.hoisted(() => {
const mockInsertOne... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/asyncHandler.test.ts | ts | 19,920 | 5481e4e222f0b430cb225d81ef38c0b22498015c81ad1a58a9c5e2c7199fa719 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
// Mock the error logger service
const mockLogError = vi.fn().mockResolvedValue(undefined);
vi.mock('../../services/errorLogger', () => ({
logError: (...args: any[]) => mockLogError(..... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/validation.test.ts | ts | 7,681 | 2a8442e9baf311ab05dff6eb282e6282f23ddd3edd6c5fbe5f7be83d8b6dea79 | import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Request, Response, NextFunction } from 'express';
import { z } from 'zod';
import { validateRequest, validateQuery, validateParams } from '../validation';
// Helper to create mock request
function createMockRequest(overrides: Partial<Request> = {}... |
eren23/non_linear_ai_chat | backend/src/middleware/__tests__/concurrentLimiter.test.ts | ts | 3,571 | 61d4796ec5746430095c2076a421e8559c2c467e62507dd8b483dabb124937b9 | import { describe, it, expect, vi, beforeEach } from 'vitest';
import { EventEmitter } from 'events';
import type { Request, Response, NextFunction } from 'express';
import {
concurrentGenerationLimiter,
activeGenerations,
MAX_CONCURRENT_GENERATIONS_PER_USER,
} from '../concurrentLimiter';
function createReq(us... |
eren23/non_linear_ai_chat | backend/src/evals/types.ts | ts | 14,093 | b0d2a57161171b16590911cfe1cd90130cf22643135afc2d16fc476684add5a4 | /**
* Unified Evaluation Framework Types
*
* Shared type definitions across all evaluation domains:
* - LLM Response Quality
* - RAG Retrieval Accuracy
* - System Performance
*/
import { ObjectId } from 'mongodb';
// ============================================================================
// Core Evaluatio... |
eren23/non_linear_ai_chat | backend/src/evals/index.ts | ts | 2,279 | 42c86cdb72b1b1ee541d10fb7ee5711c6838a7b46dc5f8af02bca449e252f435 | /**
* Systematic Evaluation Framework
*
* Comprehensive evaluation system for Spider Chat covering:
* - LLM Response Quality
* - RAG Retrieval Accuracy
* - System Performance
*
* @example
* ```typescript
* import { EvalRunner, createScore } from './evals';
* import { precisionAtK, recallAtK } from './evals/m... |
eren23/non_linear_ai_chat | backend/src/evals/metrics/quality/index.ts | ts | 12,041 | b59cdfdaace3178ba76d4178874ca77e160f6c702874bf31ac208bf63453bed4 | /**
* LLM Quality Metrics
*
* Functions for calculating quality scores and aggregating
* LLM evaluation results. These work with scores from LLM-as-judge
* and human feedback.
*/
import type { EvalScore, LLMJudgeResult, HumanFeedback } from '../../types';
// =====================================================... |
eren23/non_linear_ai_chat | backend/src/evals/metrics/retrieval/retrieval.bench.ts | ts | 6,459 | 2d53ec463b128bc81b69dca30851b5a45ad8efab30c6faf5e81447c00d22909e | /**
* Benchmarks for RAG retrieval metrics
*
* Run with: npx vitest bench src/evals/metrics/retrieval/retrieval.bench.ts
*/
import { bench, describe } from 'vitest';
import {
precisionAtK,
recallAtK,
reciprocalRank,
meanReciprocalRank,
ndcgAtK,
evaluateRAGBatch,
} from './index';
import type { LabeledD... |
eren23/non_linear_ai_chat | backend/src/evals/metrics/retrieval/index.ts | ts | 12,538 | c0a5dd9175081b31a4c7f0ebee1db75dfc97028e0163f2ee57ee7b3d832a8f94 | /**
* RAG Retrieval Metrics
*
* Implements standard information retrieval metrics:
* - Precision@K: Proportion of retrieved items that are relevant
* - Recall@K: Proportion of relevant items that were retrieved
* - MRR (Mean Reciprocal Rank): Average of reciprocal ranks of first relevant result
* - NDCG@K: Norma... |
eren23/non_linear_ai_chat | backend/src/evals/metrics/retrieval/retrieval.test.ts | ts | 11,377 | 440661b39a361f7ea546688392360c8954cf27e5fc73fbf270748edb405be5af | /**
* Unit tests for RAG retrieval metrics
*/
import { describe, it, expect } from 'vitest';
import {
precisionAtK,
recallAtK,
reciprocalRank,
meanReciprocalRank,
dcgAtK,
ndcgAtK,
hitAtK,
falsePositiveRateAtK,
evaluateRAGBatch,
f1Score,
toBinaryRelevance,
} from './index';
import type { Labeled... |
eren23/non_linear_ai_chat | backend/src/evals/metrics/performance/index.ts | ts | 14,088 | d6e9bbcab220bfc6f737fdbed190b2b2b9ac41a3594560e8560704f5042d2503 | /**
* Performance Metrics
*
* Extended performance tracking building on the graphMetrics pattern.
* Tracks latency, throughput, and resource usage across the application.
*/
import type { EndpointMetrics, StreamingMetrics, PerformanceMetric } from '../../types';
// ===============================================... |
eren23/non_linear_ai_chat | backend/src/evals/memory/index.ts | ts | 19,203 | e4491e701e4a16b3d1a00e76fa51c5f3c47b41c8538ca178866d11aada0f1461 | /**
* Memory Extraction Evaluation
*
* Provides metrics and tests for assessing the quality and accuracy
* of memory extraction from conversations. Measures extraction precision,
* recall, deduplication effectiveness, and relevance decay.
*
* Uses the existing deduplication metrics infrastructure and adds
* add... |
eren23/non_linear_ai_chat | backend/src/evals/labeling/index.ts | ts | 15,733 | e2247877ed279109dcb14a2987c3ea35d1a8ebc5445af9b32deece1ba81c2ef5 | /**
* Ground Truth Labeling Infrastructure
*
* Provides tools for collecting, managing, and aggregating ground truth labels
* for RAG evaluation. Supports both admin annotation and user feedback consensus.
*
* Features:
* - Query-document relevance labeling
* - Consensus-based ground truth from multiple annotat... |
eren23/non_linear_ai_chat | backend/src/evals/datasets/testDataset.ts | ts | 45,059 | 9e90ea7bf59c4c4126f58cfa4c6728e07ad039df8574adfd662f1b808ebab7b1 | /**
* Evaluation Test Dataset
*
* 120 test cases covering:
* - Simple QA (30 cases)
* - Complex Reasoning (25 cases)
* - Synthesis Scenarios (20 cases)
* - Tool-Required (30 cases)
* - Edge Cases (15 cases)
*/
import type { EvalTestCase, LLMEvalInput } from '../types';
import { createLogger } from '../../ser... |
eren23/non_linear_ai_chat | backend/src/evals/datasets/syntheticGenerator.ts | ts | 17,282 | bf5b5a7476fcd98d1db1456865eefb869852797b0232b7908828eafe0715462e | /**
* Synthetic Dataset Generator
*
* Generates synthetic test data for RAG evaluation including:
* - Document-query-relevance triples
* - Multi-hop reasoning questions
* - Edge cases (ambiguous, negation, out-of-scope)
*
* Uses LLM to generate realistic test data with ground truth labels.
*/
import { z } fro... |
eren23/non_linear_ai_chat | backend/src/evals/admin/evalAdminRouter.ts | ts | 16,855 | 80dcb99119e5bf38b6d9822d39458c3219e04ccde9a600466511dc67a6b10c8a | /**
* Evaluation Admin API Routes
*
* Provides endpoints for viewing evaluation results, managing experiments,
* and monitoring feedback. Admin-only access required.
*/
import { Router, Request, Response } from 'express';
import { requireAuth, requireAdmin } from '../../middleware/auth';
import {
getRecentEvalR... |
eren23/non_linear_ai_chat | backend/src/evals/cli/runEval.ts | ts | 15,329 | 542293d43eee7573c00d3abebd3761254ca10822a82e3bb7a1dbe765899d7f54 | #!/usr/bin/env tsx
/**
* Evaluation CLI
*
* Command-line interface for running evaluations in different modes.
* Supports quick checks (for PRs), full evaluations, and regression testing.
*
* Usage:
* npm run eval:quick - Run quick evaluation (subset of tests)
* npm run eval:full - Run full evalu... |
eren23/non_linear_ai_chat | backend/src/evals/feedback/feedbackRouter.ts | ts | 6,592 | 4a4310c6630e0d60ebb6cbd61cb58072b9eb4cb84db962d61acbe0ddd265e85d | /**
* Feedback API Router
*
* Express routes for collecting and retrieving human feedback on LLM responses.
* Integrates with Langfuse for correlation and the eval storage for persistence.
*/
import { Router, Request, Response } from 'express';
import { z } from 'zod';
import { requireAuth } from '../../middlewar... |
eren23/non_linear_ai_chat | backend/src/evals/storage/evalStorage.ts | ts | 23,795 | b3487900a60d902b21b41e96e8ad71ca943f449a6d7c42af4bf87dfd8898d914 | /**
* Evaluation Storage Service
*
* Handles persistence of evaluation runs, scores, and results to MongoDB.
* Also manages ground truth datasets and feedback collection.
*/
import { Collection, ObjectId } from 'mongodb';
import { getDatabase } from '../../services/database';
/** Helper to get DB (handles both s... |
eren23/non_linear_ai_chat | backend/src/evals/chunking/index.ts | ts | 18,237 | 69fecbb37938bc74f8c923f9dcbaefb63c0c0cce171080a8a60fae48bda49cad | /**
* Chunking Quality Evaluation
*
* Provides metrics and evaluation tools for assessing the quality of text chunking
* used in RAG systems. Includes both heuristic and LLM-based evaluations.
*
* Metrics:
* - Boundary coherence: Are chunks split at semantically appropriate points?
* - Information preservation:... |
eren23/non_linear_ai_chat | backend/src/evals/judge/coherenceJudge.ts | ts | 8,155 | 74b8d9eb8070aba1011a839dcb7dd8a79a2f33706ee057c31027635e5b7fd435 | /**
* Coherence Judge
*
* LLM-as-judge for evaluating response coherence and clarity.
* Assesses logical flow, structure, and readability.
*/
import { z } from 'zod';
import type { LLMEvalInput, LLMJudgeResult } from '../types';
import { createLogger } from '../../services/logger.js';
// ========================... |
eren23/non_linear_ai_chat | backend/src/evals/judge/toolSelectionJudge.ts | ts | 8,799 | bf017fa1715495e2528773ac4243b24d544b32fb6b756ab7ed0f0461767bc053 | /**
* Tool Selection Judge
*
* LLM-as-judge for evaluating whether the correct tool was selected
* for a given query. Used for agent/tool-use evaluation.
*/
import { z } from 'zod';
import type { LLMEvalInput, LLMJudgeResult } from '../types';
import { createLogger } from '../../services/logger.js';
// =========... |
eren23/non_linear_ai_chat | backend/src/evals/judge/synthesisJudge.ts | ts | 7,399 | 33b6be569f937849abe5fcbd04440eec7ad85dad708c20cb853ef105e686db2f | /**
* Synthesis Judge
*
* LLM-as-judge for evaluating synthesis quality in multi-parent nodes.
* Assesses how well the response combines and integrates multiple sources.
*/
import { z } from 'zod';
import type { LLMEvalInput, LLMJudgeResult } from '../types';
import { createLogger } from '../../services/logger.j... |
eren23/non_linear_ai_chat | backend/src/evals/judge/index.ts | ts | 7,337 | 637152a07d8c2ebae3e45c37a7bee85235f88bf5236a858e1c39d96203ef4c98 | /**
* LLM-as-Judge Evaluators
*
* Provides automated quality assessment of LLM responses using
* another LLM as the judge. Uses Gemini Flash for cost-effective evaluation.
*
* @example
* ```typescript
* import { judgeRelevance, judgeCoherence, runFullEvaluation } from './judge';
*
* const result = await judge... |
eren23/non_linear_ai_chat | backend/src/evals/judge/relevanceJudge.ts | ts | 9,209 | 34a2550f14cf51bb0cfb94b578c25fa2230b17261d02314334aed2bf6f70b579 | /**
* Relevance Judge
*
* LLM-as-judge for evaluating response relevance to the query.
* Uses Gemini Flash for cost-effective evaluation.
*/
import { z } from 'zod';
import type { LLMEvalInput, LLMJudgeResult } from '../types';
import { createLogger } from '../../services/logger.js';
// =========================... |
eren23/non_linear_ai_chat | backend/src/evals/runners/abTestRunner.ts | ts | 18,379 | 1743eed373d376d137791cefa529810907a96fb61a4518c928496a3599170044 | /**
* A/B Testing Framework
*
* Enables prompt variant experiments with sticky user assignment
* and statistical significance testing.
*
* Features:
* - Experiment configuration and management
* - Deterministic variant assignment (sticky per user)
* - Statistical significance testing
* - Result aggregation an... |
eren23/non_linear_ai_chat | backend/src/evals/runners/evalRunner.ts | ts | 13,927 | 06ad7640c82ce712faa6a437be0e7045b97e55895c307b39c21dcc4af46c61f6 | /**
* Evaluation Runner
*
* Orchestrates evaluation runs across test cases, computing metrics
* and persisting results. This is the main entry point for running evals.
*/
import { v4 as uuidv4 } from 'uuid';
import type {
EvalDomain,
EvalRun,
EvalRunConfig,
EvalRunOptions,
EvalScore,
EvalTestCase,
Q... |
eren23/non_linear_ai_chat | backend/src/types/reminder.ts | ts | 4,404 | 0da759036ef0a6717483b0d7d805c119d340c9828b6593914e33b1d0ca47b7d8 | /**
* Reminder Types and Interfaces
*
* Defines the data structures for the reminder and task management system.
* Reminders are standalone time-based notifications that can optionally
* be linked to tasks (commitments).
*/
import { ObjectId } from 'mongodb';
/**
* Recurrence pattern for repeating reminders
*... |
eren23/non_linear_ai_chat | backend/src/types/note.ts | ts | 1,459 | 630c93c8de9e4d845e832c41a9ff414cefd6020bb505ff192081935da4c5c26e | /**
* Note types for the Obsidian-like note-taking system.
*/
import { ObjectId } from 'mongodb';
export interface NoteDocument {
_id: ObjectId;
userId: string;
// Content
title: string;
content: string;
// Linking (parsed from content on save)
outgoingLinks: {
notes: string[]; // Note IDs
... |
eren23/non_linear_ai_chat | backend/src/types/fileProgress.ts | ts | 1,625 | f7825f0ab4a61081bc52904f15f0389e9ed8764a1aa7506e60a33e0024ae05de | /**
* File processing progress types.
* Used for Socket.io progress events during file uploads.
*/
/**
* Processing stages for file uploads.
*/
export type ProcessingStage =
| 'uploading'
| 'validating'
| 'extracting'
| 'chunking'
| 'embedding'
| 'complete'
| 'failed';
/**
* Progress event emitted... |
eren23/non_linear_ai_chat | backend/src/types/yauzl.d.ts | ts | 725 | abf44055c8edb3052a3492e0068d12aa89b995c034649646bc1178318339cb9f | declare module 'yauzl' {
import type { EventEmitter } from 'node:events'
import type { Readable } from 'node:stream'
export interface Options {
lazyEntries?: boolean
decodeStrings?: boolean
validateEntrySizes?: boolean
strictFileNames?: boolean
}
export interface Entry {
fileName: string... |
eren23/non_linear_ai_chat | backend/src/types/express.d.ts | ts | 850 | 5280d7344e27226a2bf3dd709a4d5d780132208b8778485efcf87968137a6cc7 | /**
* Express Request augmentation — centralizes all custom properties added
* by middleware so route handlers can use `req.prop` without `(req as any)`.
*
* Properties declared in other files (tokenAuth.ts declares tokenScopes,
* tokenId, tokenName via `declare global`) still work; this file adds the
* remaining... |
eren23/non_linear_ai_chat | backend/src/types/telegram.ts | ts | 23,176 | 147b5bec10fb77066c1f99e133ee7d5794df463661ed7ce771aa224726b33ed0 | /**
* Type definitions for Telegram Media Processing & Memory-Augmented Responses
* All types are transient (in-memory only) - used during request processing
*/
// =============================================================================
// T001: TelegramMedia - Represents media file received from Telegram
// =... |
eren23/non_linear_ai_chat | backend/src/types/models.ts | ts | 7,019 | a5d0448de1c7c5685f9062a7b3df0cf742b91d6adb2aef64541dfa95631f188e | import { ObjectId } from 'mongodb';
/**
* Model registry types for dynamic model management.
*/
export type ModelCategory =
| 'flagship' // Best quality (GPT-5, Claude Opus, Gemini Pro)
| 'balanced' // Good quality/price (GPT-4o, Claude Sonnet)
| 'fast' // Speed optimized (GPT-4o-mini, Claude Hai... |
eren23/non_linear_ai_chat | backend/src/types/falAI.ts | ts | 1,035 | 27d545f3b0c232900f8b7682ef4462264162c5993d2dc278c702398febbc78ed | // backend/src/types/falAI.ts
export interface FalVideoRequest {
model: string;
prompt: string;
image_url?: string;
duration?: number;
aspect_ratio?: '16:9' | '9:16' | '1:1';
}
export interface FalVideoResponse {
video: {
url: string;
content_type?: string;
file_name?: string;
file_size?: ... |
eren23/non_linear_ai_chat | backend/src/bootstrap/workers.ts | ts | 15,488 | f941c723b88ac1c86d0a6770bf371a3a7fa4697f92337c9c14601d940bee39b4 | /**
* Background Workers Initialization
*
* Handles startup and shutdown of background workers and cron jobs.
*/
import cron from 'node-cron';
import { createLogger } from '../services/logger.js';
import { startTaskWorker, stopTaskWorker } from '../services/taskWorker';
import { startFactValidationWorker, stopFact... |
eren23/non_linear_ai_chat | backend/src/bootstrap/redis.ts | ts | 3,062 | e0db3b391018b03d3d845f64fa11d56c6be16c9652579d965b27076250c88237 | /**
* Redis Initialization
*
* Handles Redis connections for caching, rate limiting, and queues.
*/
import { createLogger } from '../services/logger.js';
import { initializeSupabaseClient } from '../services/supabase';
import { initializeImageCache } from '../services/imageCache';
import { initializeImageQueue } f... |
eren23/non_linear_ai_chat | backend/src/bootstrap/validateConfig.ts | ts | 2,788 | bdeb5699d958de5d5ffdf6547fa3a16ede1a1d1c100a43e5dd2992fea8f0071c | /**
* Startup Configuration Validation
*
* Validates environment configuration at startup to catch misconfigurations
* early rather than failing at runtime.
*/
import { createLogger } from '../services/logger.js';
const log = createLogger('config');
export function validateConfig(): void {
const warnings: str... |
eren23/non_linear_ai_chat | backend/src/bootstrap/database.ts | ts | 2,009 | 857f51888b7a04338fa1b56212f08e17f300b51e888184a6fe4dede302ad80c1 | /**
* Database Initialization
*
* Handles MongoDB connection and index creation.
*/
import { createLogger } from '../services/logger.js';
import { connectDatabase, getUserFactsCollection } from '../services/database';
import { initializeErrorLogs } from '../services/errorLogger';
import { initializeSecurityAuditLo... |
eren23/non_linear_ai_chat | backend/src/bootstrap/index.ts | ts | 3,775 | 89f0a2413cd6a208f479237d1ee1a6a3df34a90bd9ef987ce517c7d24cfdff93 | /**
* Main Bootstrap Module
*
* Orchestrates all initialization in the correct order.
*/
import { createLogger } from '../services/logger.js';
import { initializeDatabase, createDatabaseIndexes, markDatabaseReady } from './database';
import { initializeRedis } from './redis';
import { startWorkers } from './worker... |
eren23/non_linear_ai_chat | backend/src/bootstrap/__tests__/validateConfig.test.ts | ts | 9,618 | 4b4bf57c76d90e2119010ef820a73f35ba51e63037370cb1f9d8e0cbd5b38b96 | /**
* Tests for Startup Configuration Validation
*
* Verifies that validateConfig correctly identifies missing/invalid
* environment variables and reports warnings and errors.
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { validateConfig } from '../validateConfig';
describe... |
eren23/non_linear_ai_chat | backend/src/sockets/captureEvents.ts | ts | 2,781 | 09e6c05869a75cd9fc470f80f831275cb8088f1fb0402fc6acb366a4a95f1c43 | /**
* Capture Events Socket Bridge
*
* Bridges domain events for captures to Socket.io for real-time frontend updates.
*/
import type { Server as SocketIOServer } from 'socket.io';
import { domainEvents } from '../services/events/eventBus';
import { emitToUser } from './emitters';
import { createLogger } from '../... |
eren23/non_linear_ai_chat | backend/src/sockets/emitters.ts | ts | 3,843 | f95e1f8d11ec5b615f366f7ffeef108690309f655194deca83dfd7c4f8cd4ec7 | /**
* Socket.io Emit Helpers - Extracted from sockets/index.ts to break circular dependencies.
*
* These functions are used by services (socketHandler, reminderScheduler, taskWorker,
* backgroundAgent, audioEvents, captureEvents, diagramEvents) that also import from
* modules that sockets/index.ts depends on -- cr... |
eren23/non_linear_ai_chat | backend/src/sockets/agentEvents.ts | ts | 12,941 | ebcc8c8ef9f0d247b9f91ce81d7fb28d7a1ce7c61866b18cca46e121150225b2 | /**
* Agent Events Socket.io Bridge
*
* Subscribes to agent domain events and broadcasts them to the appropriate
* flow rooms via Socket.io. Human collaborators see agent actions in real-time.
*/
import type { Server as SocketIOServer } from 'socket.io';
import { ObjectId } from 'mongodb';
import { domainEvents }... |
eren23/non_linear_ai_chat | backend/src/sockets/index.ts | ts | 16,333 | 11d4c23713b5712a4a98e9790d908012a46dac4161740139cbd4a4007c59ca5c | /**
* Socket.io initialization and configuration
*
* Supports horizontal scaling via Redis adapter when REDIS_URL is configured.
* Without Redis, Socket.io works single-instance (still functional for development).
*/
import { Server as SocketIOServer } from 'socket.io';
import { Server as HTTPServer } from 'http'... |
eren23/non_linear_ai_chat | backend/src/sockets/audioEvents.ts | ts | 2,288 | 15d7b61b54340bca15f055a99b97e5e93b1ec70bc1df58919ba45c059118dc29 | /**
* Audio Events Socket Bridge
*
* Bridges domain events for audio capture to Socket.io for real-time frontend updates.
*/
import type { Server as SocketIOServer } from 'socket.io';
import { domainEvents } from '../services/events/eventBus';
import { emitToUser } from './emitters';
import { createLogger } from '... |
eren23/non_linear_ai_chat | backend/src/sockets/flowCollaboration.ts | ts | 33,082 | 58d6bb617bb5b60226e8fcdeee05b69af7850e3ffec4a0f4fb8597a73f2fb664 | /**
* Socket event handlers for flow collaboration
*/
import { Server as SocketIOServer, Socket } from 'socket.io';
import { z } from 'zod';
import { logError } from '../services/errorLogger';
import { createLogger } from '../services/logger';
import {
canCollaborate,
addCollaborator,
removeCollaborator,
loc... |
eren23/non_linear_ai_chat | backend/src/sockets/diagramEvents.ts | ts | 2,082 | 849de856998bc17546bc91f8169d9b61871a6697626ecf2097faf0b466131c0b | /**
* Diagram Events Socket Bridge
*
* Bridges domain events for diagram conversions to Socket.io for real-time frontend updates.
*/
import type { Server as SocketIOServer } from 'socket.io';
import { domainEvents } from '../services/events/eventBus';
import { emitToUser } from './emitters';
import { createLogger ... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/socketHandler.test.ts | ts | 22,471 | 7ac751937b7a61b2f55bd2e247feb8265c0b6998a4cc6a38ce28a93a9a86ef92 | /**
* Tests for Socket.io initialization and main socket handler.
*
* These tests verify:
* - Socket.io server initialization
* - Session authentication middleware
* - Connection/disconnection lifecycle
* - User emission utilities
* - Room emission utilities
* - File progress event throttling
* - Notification... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/collaborationIntegration.test.ts | ts | 29,575 | ba9ef574ef0f286d5d2864b6749b1f90d418343f4e56296f8428d429e90151da | /**
* Integration tests for collaboration socket scenarios.
*
* These tests simulate multi-user interactions using a test-local
* session manager that re-implements the collaboration logic.
* This avoids mocking module state and gives clean, isolated tests.
*
* Test groups:
* - Socket disconnect + reconnect wit... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/emitters.test.ts | ts | 3,298 | 8ff3be3502fbe39b5c0ef8b8edc51bd4b109d3965a9f6e22193bca893798a95a | import { describe, it, expect, vi, beforeEach } from 'vitest';
const mockTo = vi.fn().mockReturnThis();
const mockEmit = vi.fn();
const mockIo = {
to: mockTo,
emit: mockEmit,
};
mockTo.mockReturnValue({ emit: mockEmit });
vi.mock('socket.io', () => ({}));
import { setEmitterIO, emitToUser, emitFileProgress } fro... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/collaborationHandler.test.ts | ts | 41,736 | cc62ca8abae9f8d150f80eda89380a384810e2e5a4aca6b45f7f4c7dd64d4490 | /**
* Comprehensive tests for Socket.io collaboration handlers.
*
* These tests verify:
* - Rate limiting for all socket events
* - PII stripping from broadcasts
* - Input validation with Zod schemas
* - Room membership verification
* - Concurrent user handling
* - Edge update broadcasting
* - Lock lifecycle ... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/flowCollaboration.flowId.test.ts | ts | 4,247 | 9e258027e27bd33432da2e9f21f1a83d63524499b0621f3d940b78619a983f92 | /**
* Tests that socket emit payloads include flowId for cross-flow race condition safety.
*
* Bug 7 fix: All collab event payloads (node-updated, edge-updated, graph-mutated)
* must include flowId so the frontend can guard against applying events from the
* wrong flow during tab switches.
*/
import { describe, ... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/flowCollaboration.test.ts | ts | 33,764 | ccb880de6c7d1ada0d30ccc8a375ab5b4ee2ce318414e0cab89afe6247b232a6 | /**
* Tests for Socket.io flow collaboration handlers.
*
* These tests verify the real-time collaboration functionality:
* - Joining/leaving flow rooms
* - Node locking/unlocking
* - Cursor position broadcasting
* - Disconnect cleanup
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/diagramEvents.test.ts | ts | 4,876 | 772333f37dee2e691173cbed1f5b9291b131b890dc98e36a81f923cda7674b4f | /**
* Tests for diagram events socket bridge.
* Validates domain event → Socket.io bridging.
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
// ============================================================================
// Mocks
// =====================================================... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/audioEvents.test.ts | ts | 7,106 | ef5bbcc0163b8ab50453a5a3a4e87ddf22b4b13bd4fddc597af9a3582a30b744 | /**
* Tests for audio events socket bridge.
* Validates domain event -> Socket.io bridging for audio capture events.
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
// ============================================================================
// Mocks
// =============================... |
eren23/non_linear_ai_chat | backend/src/sockets/__tests__/socketAuth.security.test.ts | ts | 36,892 | 7c0fd39e31057b9a0d6ac2de0e6c3a943164bfe4dd59c2d61b95ddf04562e75c | /**
* Security-focused tests for WebSocket authentication, session fixation
* prevention, and OAuth redirect validation.
*
* Covers:
* - Socket.io authentication middleware enforcement (cookie parsing, session
* lookup, user deserialization, per-user connection limits)
* - Session fixation prevention via `req.... |
eren23/non_linear_ai_chat | backend/src/config/configSchema.ts | ts | 43,712 | 94bb81e693dba27a2d6eb9eba0ebf6d961a0ff66b0be03d002d0f9b38e26b36a | /**
* System Behavior Configuration Schema
*
* Defines all configurable items with defaults, validation rules, and metadata.
* These definitions are registered with the ConfigRegistry at module load.
*
* Categories:
* - generation: Global generation defaults
* - tierPolicy: Tier spending/model/storage policies
... |
eren23/non_linear_ai_chat | backend/src/config/mcpBudgetPolicy.ts | ts | 2,478 | 24bf5961b001f6b697dab9e503c82288afbb05be170822f4c1cf69858827fa6b | /**
* MCP Budget Policy - Tier-based limits for MCP agent sessions.
*
* Controls how many resources an MCP connection can consume per session.
* Follows the same pattern as agentBudgetPolicy.ts.
*/
import type { UserTier } from '../services/users.js';
import { configRegistry } from '../services/configRegistry';
... |
eren23/non_linear_ai_chat | backend/src/config/pricing.ts | ts | 14,337 | b9ebdb8e7e91499767248726ce9c5e3de336ec7a5b66c4d4cf1115f654cc6c04 | /**
* Centralized pricing configuration for AI models.
* Prices are in USD per 1M tokens unless otherwise specified.
*
* This is the SINGLE SOURCE OF TRUTH for:
* - Model pricing (static fallback)
* - Markup percentage
* - Cost calculation with markup
* - Pricing resolution chain (DB -> static -> pattern -> def... |
eren23/non_linear_ai_chat | backend/src/config/caching.ts | ts | 8,986 | cf4bcd23d60f6550d9e2abf8b1c45182a04f41903f79a714ad6aaf0e47a07e28 | /**
* Model-specific caching configuration for OpenRouter models.
* Based on OpenRouter's prompt caching documentation.
*/
import { createLogger } from '../services/logger.js';
const log = createLogger('config.caching');
export interface ModelCacheConfig {
enabled: boolean;
type: 'automatic' | 'explicit' | 'b... |
eren23/non_linear_ai_chat | backend/src/config/rateLimits.ts | ts | 2,848 | ad8732ca8d88b8dc363e04c6d4b8b2529850cfb08fde6713c07290d393102310 | /**
* Centralized rate limit configuration.
*
* All rate limits are now served from the ConfigRegistry, which loads defaults
* from configSchema.ts and allows runtime overrides via the admin API.
*
* Usage:
* import { RATE_LIMITS } from '../config/rateLimits';
* const limit = RATE_LIMITS.SOCKET_CURSOR;
*/
... |
eren23/non_linear_ai_chat | backend/src/config/tierPolicy.ts | ts | 3,249 | 9d1b3309747c55dea78ba92a1dfb239ec7499373151bb307a74604bc2a3bb094 | /**
* Single source of truth for tier policy that spans both:
* - hard limits (counts) enforced elsewhere (see services/limits.ts)
* - spending allowances / model gating (see services/spendingTracker.ts)
*/
import type { UserTier } from '../services/users'
import { configRegistry } from '../services/configRegistry... |
eren23/non_linear_ai_chat | backend/src/config/providerFamilies.ts | ts | 1,454 | b4d576cc668bdb0e3350a68b776430cf392cc51c9b6cfbc3f9cf8c9975371e9d | /**
* Shared provider family mapping — single source of truth.
*
* Maps provider prefixes (from model IDs like "openai/gpt-5.1-chat")
* to display-friendly provider family names for UI grouping.
*
* Previously duplicated in openRouterSync.ts, adminModels.ts, models.ts, modelCache.ts.
*/
import type { ProviderFa... |
eren23/non_linear_ai_chat | backend/src/config/timeouts.ts | ts | 3,045 | e7fd32359b93fb230322678ad248c2d055920b6302ed0ac4d42c52a7f2e661e6 | /**
* Centralized timeout configuration.
*
* All timeouts are now served from the ConfigRegistry, which loads defaults
* from configSchema.ts and allows runtime overrides via the admin API.
*
* Usage:
* import { TIMEOUTS } from '../config/timeouts';
* const timeout = TIMEOUTS.LLM_STREAM_MS;
*/
import { co... |
eren23/non_linear_ai_chat | backend/src/config/agentBudgetPolicy.ts | ts | 4,211 | b5c7288c1dd4cc92ac4587062bcf68850a92ac07c9ef6e7d34d06a8ffdd202af | /**
* Agent Budget Policy - Tier-based limits for AI agent sessions.
*
* Controls how many resources an agent can consume per session.
*/
import type { UserTier } from '../services/users.js';
import type { AgentBudgetLimits } from '../services/agent/types.js';
import { configRegistry } from '../services/configRegi... |
eren23/non_linear_ai_chat | backend/src/config/session.ts | ts | 3,747 | 14315aad28dc0aa5dd6f65ad00ae2b7642050929586101b724a188519689fc50 | /**
* Session Configuration and Security Validation
*
* This module provides secure session secret validation to prevent
* deployment with default or weak secrets.
*/
/**
* Known default secret patterns that must be rejected.
* These are patterns that appear in source code or documentation
* that attackers cou... |
eren23/non_linear_ai_chat | backend/src/config/index.ts | ts | 5,921 | fb348f77259f93a30b587d402be8a9cb76f0b027f82da4c9d1b485b3e461117e | /**
* Centralized Configuration Registry
*
* Single source of truth for all configuration values.
* Import from here instead of scattering magic numbers across files.
*
* @example
* import { CONFIG, TIMEOUTS } from '../config';
* const cooldown = CONFIG.memory.extractionCooldownMs;
*/
import { configRegistry ... |
eren23/non_linear_ai_chat | backend/src/config/models.ts | ts | 13,820 | d5cfc65fdbe12774bba0b9a0ebb4062660dfc422aa09f51fda8c5231ab7f8f35 | /**
* Model configuration for OpenRouter API.
* Static fallback list with provider family grouping.
*/
import type { ProviderFamily } from '../types/models';
import { getMediaModels } from './falModels';
export interface ModelInfo {
id: string;
name: string;
provider: string;
providerFamily: ProviderFamily... |
eren23/non_linear_ai_chat | backend/src/config/cors.ts | ts | 3,324 | 40a2839759fedbadb53d1b7eb70a551d1b5c6e3a2813d46ed543848767a93c2e | /**
* Shared CORS configuration
*
* Single source of truth for allowed origins, used by both Express (app.ts)
* and Socket.io (sockets/index.ts).
*/
import { createLogger } from '../services/logger.js';
const log = createLogger('config.cors');
const DEFAULT_ORIGINS = [
'http://localhost:5173',
'http://local... |
eren23/non_linear_ai_chat | backend/src/config/searchConfig.ts | ts | 2,248 | 6f52b2c2fb12ae5c0c9a147ccce6b4df4187b57e06a1eb3a33ee7e51c1457d08 | /**
* Centralized Search Configuration
*
* All search-related constants in one place. Previously scattered across
* globalSearch.ts, relatedContext.ts, rag.ts, and individual callers.
*
* Score threshold tiers:
* - discovery (0.3): High recall for exploratory search (globalSearch, relatedContext).
* Accep... |
eren23/non_linear_ai_chat | backend/src/config/memoryConfig.ts | ts | 9,936 | c2a9e2afe324a791918b7e9ce05aa5b1b84d24c204fd317871244b2d47ce4b67 | /**
* Centralized Memory Search Configuration
*
* All memory-related configuration is now served from the ConfigRegistry,
* which loads defaults from configSchema.ts and allows runtime overrides
* via the admin API.
*
* Phase 2.3 of Memory System Revolution Plan
*/
import { configRegistry } from '../services/c... |
eren23/non_linear_ai_chat | backend/src/config/falModels.ts | ts | 18,039 | 222698a1086f2f027c1710219db15d3d7cfbe1a27651b1b44a0e1c23acab536b | /**
* Centralized Fal.ai model registry — single source of truth.
*
* All Fal model metadata lives here: pricing, capabilities, duration formats,
* quality tiers, and UI metadata. Every other file derives what it needs
* via the exported helper functions.
*
* To add a new Fal model, add one entry to FAL_MODEL_RE... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/cors.test.ts | ts | 6,885 | 1d8843041178745fe0a197c603aa4fce0c46927267dda08adf08b191d4af0407 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
// Mock the logger to avoid side effects
vi.mock('../../services/logger.js', () => ({
createLogger: () => ({
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
debug: vi.fn(),
}),
}));
// We need fresh module imports per test to ... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/memoryConfig.test.ts | ts | 9,964 | df059f7047d392d08277ecb379027e8e9165f869d405c73a194bdb87f844a8f2 | import { describe, it, expect } from 'vitest';
import {
MEMORY_SEARCH_DEFAULTS,
MEMORY_SEARCH_CONTEXTS,
GRAPH_EXPANSION_CONFIG,
NOTES_CONTEXT_CONFIG,
LIBRARY_CONTEXT_CONFIG,
MEMORY_DEDUP_CONFIG,
MEMORY_EXTRACTION_CONFIG,
getSearchConfig,
mergeSearchOptions,
} from '../memoryConfig';
describe('MEMORY_... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/models.test.ts | ts | 6,675 | e0aedf873ce064a5d2420a7c48e20d86e52131504295838d125d151a40b70d49 | import { describe, it, expect } from 'vitest';
import {
MODELS,
DEFAULT_MODEL,
getModelList,
getModelInfo,
isValidModelSync,
excludeFalImageModels,
} from '../models';
describe('MODELS', () => {
it('should export a record of model configurations', () => {
expect(typeof MODELS).toBe('object');
exp... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/index.test.ts | ts | 8,710 | a2d9a652019f90741175c2000dc0e2b92c3ef79bf05769265aa058fab144f078 | import { describe, it, expect } from 'vitest';
import {
TIMEOUTS,
INTERVALS,
TTL,
MEMORY_CONFIG,
RATE_LIMITS,
FILE_CONFIG,
VECTOR_CONFIG,
UI_CONFIG,
CONFIG,
} from '../index';
describe('TIMEOUTS', () => {
it('should have all required timeout values', () => {
expect(TIMEOUTS.apiRequest).toBeDefi... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/agentBudgetPolicy.test.ts | ts | 2,203 | 4a3b86e6d70c2250a6b722914489299c2b123c4a6b0f34383c31aeaad6e72876 | import { describe, it, expect } from 'vitest';
import { AGENT_BUDGET_POLICY } from '../agentBudgetPolicy';
import type { UserTier } from '../../services/users';
describe('agentBudgetPolicy', () => {
it('should define entries for all user tiers', () => {
const tiers: UserTier[] = ['free', 'pro', 'premium', 'admin... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/rateLimits.test.ts | ts | 2,712 | eb12c473bb7510dbcea256bcd547a4159c349daac47968a0c3c48481ab1b56a6 | import { describe, it, expect } from 'vitest';
import { RATE_LIMITS } from '../rateLimits';
describe('RATE_LIMITS configuration', () => {
describe('HTTP_GLOBAL', () => {
it('should have a default request count of 500', () => {
expect(RATE_LIMITS.HTTP_GLOBAL.requests).toBe(500);
});
it('should have... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/timeouts.test.ts | ts | 2,856 | 998dd90fe87c1f358eec0d78617455b8e899431f177dcb3feb8bf2c80cc6cba1 | import { describe, it, expect, beforeEach, afterEach } from 'vitest';
describe('TIMEOUTS configuration', () => {
// Store original env values
const originalEnv: Record<string, string | undefined> = {};
const envKeys = [
'LLM_STREAM_TIMEOUT_MS',
'LLM_REQUEST_TIMEOUT_MS',
'REDIS_CIRCUIT_BREAKER_MS',
... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/falModels.test.ts | ts | 13,259 | 1e4ebb9c1380446fd90849a0c2ef18fb842930be6e30ba03f501d84018bf3beb | import { describe, it, expect } from 'vitest';
import {
FAL_MODEL_REGISTRY,
toModelRecords,
getVideoPricingMap,
getImagePricingMap,
getFalModelCapabilities,
getFalDurationLimits,
getFalDurationFormat,
isFalVideoModel,
getVideoModelMetadataMap,
getMediaModels,
} from '../falModels';
// -------------... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/tierPolicy.test.ts | ts | 9,863 | 9796eb43df46c5191d6fabf74c0d36fa4e0bcb0bca80c25feab6ef52a7ad751c | import { describe, it, expect } from 'vitest';
import { TIER_POLICY, TierPolicy } from '../tierPolicy';
import type { UserTier } from '../../services/users';
describe('tierPolicy', () => {
describe('TIER_POLICY structure', () => {
it('should define policies for all user tiers', () => {
const expectedTiers:... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/caching.test.ts | ts | 6,923 | ae11483f663fb8ac3684f77dd8b492a836b5a70074a3544fdd03718034948d2a | import { describe, it, expect } from 'vitest';
import {
CACHE_CONFIG,
normalizeModelId,
getCacheConfig,
supportsCaching,
requiresExplicitCacheControl,
hasAutomaticCaching,
getRecommendedTTL,
calculateCacheROI,
} from '../caching';
describe('CACHE_CONFIG', () => {
it('should have cache config for majo... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/pricingResolution.test.ts | ts | 17,329 | 038461f575987ca8e8c9aa57ccea58804d1db14c29352a460615cf6f9d3f511e | import { describe, it, expect, vi, afterEach } from 'vitest';
const { mockLoggerWarn } = vi.hoisted(() => ({
mockLoggerWarn: vi.fn(),
}));
vi.mock('../../services/logger.js', () => ({
createLogger: vi.fn(() => ({
info: vi.fn(),
warn: mockLoggerWarn,
error: vi.fn(),
debug: vi.fn(),
})),
}));
imp... |
eren23/non_linear_ai_chat | backend/src/config/__tests__/configSchema.test.ts | ts | 11,286 | c3b6fd6b4e688dda42f590c88205dc141a9376db5b46fecd0fe2512b4fbd6cff | /**
* Tests for configSchema - system behavior configuration schema and helpers.
*
* Covers:
* - CONFIG_DEFINITIONS structural validation (required fields present)
* - findDefinition: looking up definitions by category + key
* - getDefinitionsForCategory: filtering definitions by category
* - getAllCategories: l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.