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
frontend/src/hooks/useTagSuggestions.ts
ts
4,988
6df6776645efb58a52d3b154c5be50e1399c99f17de5cd5c204d013f010c3c04
/** * Hook for AI-powered tag and mention suggestions. * Debounces content changes and fetches suggestions when content is substantial. */ import { useState, useCallback, useRef, useEffect } from 'react'; import { suggestTags, AITagSuggestResponse } from '../lib/notesApi'; export interface TagSuggestionsState { ...
eren23/non_linear_ai_chat
frontend/src/hooks/useTabSync.ts
ts
5,207
d16af24eb43041a40bbe94d1748d7cc02a8932e5d1635f887d6ab51a2432c264
import { useEffect, useRef, useCallback } from 'react'; import useGraphStore from '@/store/useGraphStore'; import { getFlow } from '@/lib/flowsApi'; import { shallow } from 'zustand/shallow'; import type { TabState } from '@/store/types'; /** * Centralized tab-to-canvas navigation controller. * * The selected tab (...
eren23/non_linear_ai_chat
frontend/src/hooks/useAudioRecorder.ts
ts
5,938
bb502d91651e6361f85652ae8ec9dee40b21e51c9075903daea36a5711f16f4b
/** * Hook for recording audio and transcribing it to text. * Uses browser MediaRecorder API with WebM/Opus codec. */ import { useState, useRef, useCallback, useEffect } from 'react'; import { transcribeAudio, TranscriptionResult } from '../lib/audioApi'; export type RecorderState = 'idle' | 'requesting' | 'record...
eren23/non_linear_ai_chat
frontend/src/hooks/useRelatedContext.ts
ts
3,846
6cf00be07c2c2d4b4896952b6b74e7634387aa6d728bb12c326a86cc4d14175b
/** * useRelatedContext - Hook for fetching related context as the user types. * * Debounces input text and queries the backend for related memories, notes, * and nodes from other flows. Used by the RelatedContext sidebar panel. */ import { useState, useEffect, useRef, useCallback } from 'react'; import { apiFetc...
eren23/non_linear_ai_chat
frontend/src/hooks/useUserLimits.ts
ts
2,936
6454b424b6e28a3320e144be4db4367074c2a50e0cd17e9fda707ebde006eb8d
import { useState, useEffect, useCallback, useRef } from 'react'; import { useAuthStore } from '@/store/useAuthStore'; import { createBackoffPoller, type BackoffPoller } from '@/lib/pollingUtils'; export interface UserLimitsData { tier: string; spending: { monthlyAllowanceUsd: number; currentSpend: number;...
eren23/non_linear_ai_chat
frontend/src/hooks/useKnowledgeItems.ts
ts
4,232
23c17cf10ec359adfb436e83610540528437a3a90feb89712955312ba7868874
/** * useKnowledgeItems β€” Hook for fetching & filtering unified knowledge items. */ import { useState, useEffect, useCallback, useMemo } from 'react'; import { fetchKnowledgeItems, type KnowledgeItem, type KnowledgeContentType, type KnowledgeCounts, } from '../lib/knowledgeGraphApi'; import { useNotesStore }...
eren23/non_linear_ai_chat
frontend/src/hooks/useGlobalSearch.ts
ts
7,269
25b0a0b8ab538787095e65ac911add99a0a1a3fc2e808e5e2f4983e5b0855530
/** * useGlobalSearch - Hook for unified global search across all data sources. * * Debounces input and filter changes, manages AbortController for request * cancellation, provides source type filtering, and caches recent results * to avoid redundant API calls. */ import { useState, useEffect, useRef, useCallbac...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useUserLimits.test.tsx
tsx
10,064
f2f25d649e1ab0e0877833984e04fec4abc6d6921e26a4f973abbca59a97758a
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // --------------------------------------------------------------------------- // Hoisted mocks – vi.hoisted() ensures these are available inside vi.mock(...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/usePendingInvitesCount.test.tsx
tsx
5,037
48abf505227de0655a27c4dbdaaa14255f875dcfcd51f9766e22e64632f6594a
/** * Tests for usePendingInvitesCount hook. * * Tests cover: * - Export verification * - Expected return structure * - API endpoint verification * - Polling behavior documentation * * Note: Full React hook tests require jsdom environment. * These tests focus on testable exports and behavior patterns. */ im...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useCollaboration.test.tsx
tsx
19,590
ab7f02a5646689728e746858eaa408d45077b93f771f28722958e658bbc669eb
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act, waitFor } from '@testing-library/react'; // Hoist all mock functions so they're available during vi.mock() hoisting const { mockSocket, mockConnectSocket, mockDisconnectSocket, m...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useChatNodeFiles.test.tsx
tsx
12,732
22e3ab37d0bcfd294639909a9077b1cd0725bc7095b5310335d6270284ff3286
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // Mock file API const mockGetFlowFiles = vi.fn(); const mockAttachFileToNode = vi.fn(); const mockDetachFileFromNode = vi.fn(); vi.mock('@/lib/filesApi', () => ({ ...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useTabSync.test.tsx
tsx
8,854
296a298cf17fe18c2bb3461739acbbc258bfe088a826813d58f2cfd0aab85c84
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useTabSync } from '../useTabSync'; const mockGetFlow = vi.fn(); vi.mock('@/lib/flowsApi', () => ({ getFlow: (...args: unknown[]) => mockGetFlo...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useSlashCommands.test.tsx
tsx
11,058
523cb7bfde1461667006bc333c23805807309a25135b96aef76a6173f3cf0a5c
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // Mock dependencies vi.mock('../../components/controls/SlashCommandMenu', () => ({ defaultSlashCommands: [ { id: 'summarize', name: '/summarize', description:...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useTagSuggestions.test.tsx
tsx
12,551
06321ce33ada11f353dfd0fb660b73b414c69995119ddc6dc07d980aa029c254
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // Mock suggestTags API with vi.hoisted const { mockSuggestTags } = vi.hoisted(() => ({ mockSuggestTags: vi.fn(), })); vi.mock('@/lib/notesApi', () => ...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useAncestryHighlight.test.tsx
tsx
7,110
6e1b34df806249f1eab5cf32228ee3d7a164a966e6ee898600d98e8eb4852489
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook } from '@testing-library/react'; // Mock store functions const mockGetAncestryChain = vi.fn(); const mockSetAncestryHighlightedNodes = vi.fn(); const mockClearAncestryHighlightedNodes = vi.fn(...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useNodeLock.test.ts
ts
24,625
e8fb4a043634d92c8845ce69fdb3097252f96930bee6651171cb092aac6d9e4d
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // Hoist all mock functions so they're available during vi.mock() hoisting const { mockIsNodeLockedByOthers, mockIsNodeLockedByMe, mockGetNodeLock, mockAddLo...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useAutoSave.integration.test.tsx
tsx
11,542
dedc086ff9c649a5a215b70b1a28b02a0f73672301e9c1213bf2e42af6f887b2
// @vitest-environment happy-dom /** * Integration tests for useAutoSave hook. * * These tests complement the existing useAutoSave.test.tsx with * renderHook-based integration tests covering: * - Hook initializes and returns correct interface * - Detects node changes and schedules auto-save after debounce * - D...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useAudioRecorder.test.tsx
tsx
10,623
abadae7768b9e4e8f045c1e736c2b54bf29d89866d889e88282b12d659af743e
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // Mock transcribeAudio with vi.hoisted const { mockTranscribeAudio } = vi.hoisted(() => ({ mockTranscribeAudio: vi.fn(), })); vi.mock('@/lib/audioApi'...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useRelatedContext.test.ts
ts
16,145
df0fd462523ea5243a05d2855cdbabdb4ac8b5a60b870a87cceb5721187ce187
// @vitest-environment happy-dom /** * Tests for useRelatedContext hook. * * Covers initial state, search with debounce, minimum query length, * abort controller, error handling, clear, and cleanup on unmount. */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } ...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useFeatureDiscovery.test.tsx
tsx
5,408
f542b5c37ab11046ff788621f3036519a222a52095ae5a2b03fc47a5cfe55417
/** * Tests for useFeatureDiscovery hook. * * Tests cover: * - Export verification * - FEATURE_KEYS constants * - localStorage interaction patterns * * Note: Full React hook tests require jsdom environment. * These tests focus on testable exports and constants. */ import { describe, it, expect, beforeEach, a...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useChatGeneration.test.tsx
tsx
54,653
399bf09451204361c6b267c5eee74a334875b4d5176f02da9338a9b363606600
/** * @vitest-environment happy-dom */ /** * Tests for useChatGeneration hook. * * This is the core streaming generation hook that powers all LLM interactions * in chat nodes. Tests cover: * - Initial state (isGenerating, isRefining default to false) * - handleSend with empty prompt (no-op) * - handleSend wit...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useAISelection.test.tsx
tsx
12,967
8ff684bacf24fd24cc0beb53dd1660449eb4cfc595bb2b3357c0e179e14b1e71
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act, waitFor } from '@testing-library/react'; // Use vi.hoisted to ensure mock function is available during module mocking const { mockTransformTextStream } = vi.hoisted(() => { return { ...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useMarkdownToolbar.test.ts
ts
4,879
e84665a2e484a4c1aee7da781a844b666cca56958950dd845d1d21429daafb8a
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useMarkdownToolbar } from '../useMarkdownToolbar'; describe('useMarkdownToolbar', () => { let mockTextarea: HTMLTextAreaElement; let textarea...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useLinkSuggestor.test.tsx
tsx
3,161
a456d0ea0bf80a0db65fb882be9e58fb27e8a4500b5ee733c52352c911d4aebd
// @vitest-environment happy-dom import { describe, it, expect, vi } from 'vitest'; import { renderHook, act } from '@testing-library/react'; vi.mock('../../lib/fuzzySearch', () => ({ fuzzyMatchWord: vi.fn((word: string, targets: string[]) => { return targets .filter(t => t.toLowerCase().includes(word.toLo...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useKnowledgeItems.test.ts
ts
5,488
9cfbdcdf40344611633e4dd30de7be2e089a044d99c9eaa03ef157407ebb1102
// @vitest-environment happy-dom /** * Tests for useKnowledgeItems hook. */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, waitFor, act } from '@testing-library/react'; // Hoist mocks const { mockFetchKnowledgeItems, mockCacheVersion } = vi.hoisted(() => ({ mockFetc...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useTokenEstimate.test.tsx
tsx
8,177
ff05179981541a2c282e8d79e76194fe560b220ebb54d122c36765b90c2ffd87
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; // Mock dependencies BEFORE importing the hook const mockEstimateChainTokens = vi.fn(); // Create a mutable state that can be updated per test let mockGr...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useGlobalSearch.test.ts
ts
10,412
34434c077b247adb769bdf83db8b360a4b6646555f1bb907593198c3fd8b5c89
// @vitest-environment happy-dom /** * Tests for useGlobalSearch hook. * * Covers initial state, 300ms debounce, minimum query length, loading state, * results population, error handling, abort management, clear, source filter * re-trigger (debounced), unmount cleanup, short query clearing, and caching. */ impor...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useClickOutside.test.tsx
tsx
6,618
80ccac8f449663718daf70e44dddb8d86fc7bfdd9c39c5344794870c5f29565b
/** * Tests for useClickOutside hook and related utilities. * * Tests cover: * - Export verification * - Function signatures * - Expected behavior patterns * * Note: Full React hook tests require jsdom environment. * These tests focus on testable exports and behavior patterns. */ import { describe, it, expec...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useGraphSearch.test.ts
ts
9,940
e8b94372e9842d3f0bd3db0e56a5b57208bf14aeede248d311915abb413118e6
// @vitest-environment happy-dom /** * Tests for useGraphSearch hook */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useGraphSearch, type GraphSearchableNode } from '../useGraphSearch'; // Mock fuzzysort vi.mock('fuzzyso...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useDocumentChat.phase.test.ts
ts
8,932
ac6c1e94d63ed3f8d8742384e560d99bab04b2645a83d52fd70520f1c4ff3419
// @vitest-environment happy-dom /** * Tests for the SSE phase parser inside useDocumentChat. * * The parser drives the panel's status row + degraded banner. Without these * tests, the most subtle piece of Part C (the "skip flipping to `generating` * if `phase === 'expanding'`" guard) is uncovered β€” exactly the ki...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useChatGeneration.extended.test.tsx
tsx
13,252
714286fca9b89f7415c22c2a3e0187949b048703c9a82060f4f9c5f31522497a
/** * @vitest-environment happy-dom */ /** * Extended tests for useChatGeneration hook. * * These tests complement the existing useChatGeneration.test.tsx with * coverage for edge cases and less common paths: * - refineInstruction state management * - handleRefreshStale delegates to handleRegenerate * - handl...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useGraphSelection.test.ts
ts
9,202
a02ec3170d4cb8e3e7fa78d64585966e40a667bd23f82cb39ff3cfe3382f7f87
/** * Tests for useGraphSelection hook. * * Tests cover: * - Export verification * - Adjacency map building logic * - Connected set computation * - handleNodeSelect behavior (single click, shift-click, selectMode) * - handleRectangleSelect behavior (replace vs additive) * - clearSelection * - handleContextMen...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useLinkAutocomplete.test.tsx
tsx
13,295
c6a73a890ce0e1b3b9975515618184a05807568f3c8e0c060b9f273ca9c00ec8
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useRef } from 'react'; // Mock notes store with vi.hoisted const { mockSearchNoteTitles, mockFetchAutocompleteData } = vi.hoisted(() => ({ mockSearchNoteT...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useModal.test.tsx
tsx
7,751
5b02a4bda71a9e78f16d0a90c1d7ef46b63c8c79daf47113c51fd3f23caff3e3
/** * Tests for useModal hook. * * Tests cover: * - Basic modal state (open, close, toggle) * - Initial state configuration * - Multiple modal management (useModals) * - Modal with data payload (useModalWithData) * - Escape key handling utility (onEscapeClose) * * Note: These tests use a custom renderHook imp...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useGlobalShortcuts.test.tsx
tsx
7,708
a4bb857b435cef07f19b0e5ba58e0b8d56777a83ce05b9892b09b5b4dd410aea
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook } from '@testing-library/react'; import { useGlobalShortcuts } from '../useGlobalShortcuts'; describe('useGlobalShortcuts', () => { const mockOnQuickCapture = vi.fn(); const mockOnQuickSea...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useAutoSave.test.tsx
tsx
13,826
95344aa9817e3cbc828d9a1ac72fc67d287b6a259cbf8ddfd3bd660b709637d4
// @vitest-environment happy-dom /** * Tests for useAutoSave hook. * * Tests cover: * - Tab switch saves with OLD tab's ID (not the new one) * - Debounced save after tab switch uses current activeTabId from ref * - Concurrent saves: second save queues after first (not dropped) * - Flow switch resets baselines wi...
eren23/non_linear_ai_chat
frontend/src/hooks/__tests__/useLinkSuggestor.test.ts
ts
1,693
c22f5ce85b54beb552f7c90e1b8670fb30b7160d0b4f6d02dd524b2d234fbd19
import { describe, it, expect } from 'vitest'; import { extractSignificantWords } from '../useLinkSuggestor'; describe('extractSignificantWords', () => { it('extracts words 4+ chars that are not stop words', () => { const result = extractSignificantWords('The architecture needs review'); const words = result...
eren23/non_linear_ai_chat
frontend/src/lib/libraryApi.ts
ts
16,912
860734bd560cdaf402b4a226a0575419c7ba95018e4fac62999683a36bb655a5
/** * API client for Personal Library management. */ import type { FileInfo, UploadTaskResponse } from './filesApi'; import { sanitizeName, sanitizeDescription, sanitizeTags, sanitizeRagQuery, INPUT_LIMITS } from './sanitize'; import { apiFetch } from '@/lib/csrfApi'; export type ProcessingStatus = 'uploading' | 'p...
eren23/non_linear_ai_chat
frontend/src/lib/commitmentsApi.ts
ts
17,105
95f85a8185dad2dbc4193244399fbd9030e69daefff2b29c161ac5589fa2bb05
/** * Commitments (Tasks) & Reminders API client. * * Communicates with /api/commitments endpoints for unified task management. * Tasks are commitments created via Telegram or web interface. * Reminders are time-based notifications that can be standalone or linked to tasks. */ import { apiFetch } from '@/lib/csr...
eren23/non_linear_ai_chat
frontend/src/lib/contextMetadata.ts
ts
3,944
d72eb2809ddf492f9e5dd01cd965447dd0e03a19b97ab83eebc2d26ee4c0239a
/** * Context source metadata for per-node context control. * * Same pattern as toolMetadata.ts β€” categories, icons, presets. */ export type ContextSourceId = | 'documents' | 'memories' | 'facts' | 'notes' | 'graphMemories' | 'summary'; export interface ContextSourceMeta { id: ContextSourceId; lab...
eren23/non_linear_ai_chat
frontend/src/lib/snapping.ts
ts
9,068
5b752687875ae86debb850a175b7128dbc7fd9527fc59a7e9ec67d25afca88fa
/** * Snapping utilities for hybrid snap mode. * Provides grid snapping + neighbor alignment with magnetic feel. * * Pure functions - no React/state dependencies. */ import type { AlignmentGuide, AlignmentType, GridSnapResult, NeighborSnapResult, NodeBounds, SnapConfig, SnapResult, } from '@/types/s...
eren23/non_linear_ai_chat
frontend/src/lib/globalSearchApi.ts
ts
2,434
1ac2e2e9acb15c33a1b1f1db6aa3c3f6bb5ef6f45254ed91d70282e2eda2bea9
/** * Global Search API Client * * Fetches unified search results across memories, notes, flows, documents, and captures. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = import.meta.env.VITE_API_URL || ''; export type SourceType = 'memory' | 'note' | 'flow' | 'document' | 'capture'; export type Res...
eren23/non_linear_ai_chat
frontend/src/lib/graphWorkerClient.ts
ts
7,904
2c35cf3454a7bea7dfe2d3d5b88798313afed044666ccb2f5eba9fc4598e05d3
/** * Graph Worker Client * * Main thread interface for communicating with the graph traversal Web Worker. * Provides a Promise-based API for graph operations. */ import type { WorkerRequest, WorkerResponse, SerializedNode, SerializedEdge, GetAncestryChainResult, GetMessagesForNodeResult, FindRecurs...
eren23/non_linear_ai_chat
frontend/src/lib/timeFormat.ts
ts
7,671
9bf81e95503936d212f8388e861fd943b645e4cbfd5c013713389080fa747ef1
/** * Relative Time Formatting Utilities * * Converts timestamps to human-friendly relative strings like "just now", * "5m ago", "2h ago", "Yesterday", "Jan 15". * * @example * ```typescript * formatRelativeTime(new Date(Date.now() - 30000)) // "just now" * formatRelativeTime(new Date(Date.now() - 300000)) //...
eren23/non_linear_ai_chat
frontend/src/lib/pretextDimensions.ts
ts
15,334
6baf4c20c9dc3ff1f6412a06f1a9ed006a480ec2df7f0dafd1694b262d36ff63
/** * Pretext Dimensions β€” calculates complete node heights by combining * pretext text measurements with known chrome (non-text) heights. * * Also provides markdown-aware height corrections by scanning raw * markdown for structural elements and applying CSS-derived offsets. */ import { pretextService, DEFAULT_F...
eren23/non_linear_ai_chat
frontend/src/lib/sanitize.ts
ts
1,269
7b7c2c965c7d0750d8f0b8e478b0b3e5ca03086203303a8fb809ffcc40f0c6cc
/** * Frontend input sanitization and validation utilities. * * Shared pure functions are re-exported from @spider-chat/shared. * Frontend-only functions (simplified sanitizeFileName) remain here. */ export { INPUT_LIMITS, sanitizeString, sanitizeMessage, sanitizeName, sanitizeDescription, sanitizeTag...
eren23/non_linear_ai_chat
frontend/src/lib/useConfirm.ts
ts
1,175
b7100e068775bd448bcc81ffa2d5bd58cb563ad809eec578a50c33ea9a7d32ad
/** * Hook for confirmation dialogs - Replaces confirm() calls */ import { useState, useCallback } from 'react'; export interface ConfirmOptions { title: string; message: string; confirmText?: string; cancelText?: string; type?: 'danger' | 'warning' | 'info'; } interface ConfirmState extends ConfirmOptio...
eren23/non_linear_ai_chat
frontend/src/lib/graphLayout.ts
ts
7,741
f91ac9a3ba3077fbd91651617419eb7f3689dea421932deb3a28cabb35bf1652
/** * Graph layout algorithms for memory visualization. */ import { forceSimulation, forceLink, forceManyBody, forceCenter, forceCollide, type SimulationNodeDatum, type SimulationLinkDatum, } from 'd3-force'; export interface LayoutNode extends SimulationNodeDatum { id: string; x?: number; y?: n...
eren23/non_linear_ai_chat
frontend/src/lib/analyticsApi.ts
ts
10,566
e91abb43c5e758445bf5dd990d1c994e1d4e8ccf63bb0630cb682ccc8e8332e4
/** * Analytics API client for advanced metrics and insights. */ import { API_BASE } from './api'; export interface DailyStats { date: string; users: number; newUsers: number; activeUsers: number; totalTokens: number; totalCost: number; queries: number; flows: number; newFlows: number; nodes: nu...
eren23/non_linear_ai_chat
frontend/src/lib/tokenEstimation.ts
ts
7,588
50c8b876946efa0c34a94e86c22ac03b32f8a5caa1f56e4e616de8f0adfbe8cd
/** * Token estimation utilities for ancestry chain analysis. * * Provides token counts for info nodes and entire ancestry chains, * enabling pre-generation warnings and user control. */ import type { GraphNode, NodeData, InformationNodeData } from '@/store/types'; import type { TextSubNodeData, ImageSubNodeData,...
eren23/non_linear_ai_chat
frontend/src/lib/webOpsApi.ts
ts
4,778
043c450ca558e3ae15ac942b6f0f319952c3cea523be5b5451a29f6ea0793265
/** * Web Operations API client for the frontend. * * Provides access to web search and scraping capabilities * through the backend's web-ops integration. */ import { apiClient } from './api'; // ───────────────────────────────────────────────────────────────────────────── // Types // ───────────────────────────...
eren23/non_linear_ai_chat
frontend/src/lib/socket.ts
ts
10,017
17402bbeaf7ab2cf86507ef3a338fa6cca990b48141a3f1da8fdfe42f8dc3706
import { io, Socket } from 'socket.io-client'; import { toastManager } from '../components/controls/ToastNotifications'; import useFileProgressStore from '../store/useFileProgressStore'; import type { FileProgressEvent } from '../store/useFileProgressStore'; import useDocumentEventsStore from '../store/useDocumentEvent...
eren23/non_linear_ai_chat
frontend/src/lib/nodeContentExtractor.ts
ts
6,110
3a0e09640e08e54c8efd0582bd94a66a63f5186b2fcfe4ad66882974955d1c96
/** * Node Content Extractor - Shared utility for extracting displayable content from any node type. * * Pure utility with no store dependencies. Used by FlowBrowserModal for multi-type node imports * and by message formatters for type-aware role mapping. */ import type { ImageSubNodeData, TextSubNodeData } from ...
eren23/non_linear_ai_chat
frontend/src/lib/userFactsApi.ts
ts
2,772
03558265425bf6b8bb4e22358e6cab97619518b81d806057ea332a8e1b7cd6ee
/** * User Facts API client. */ import { apiFetch } from '@/lib/csrfApi'; // Use /api proxy in production, direct URL in development const API_BASE = '/api'; export type FactPersistence = 'permanent' | 'seasonal' | 'short_term'; export type FactCategory = 'personal_info' | 'preference' | 'skill' | 'interest' | 'go...
eren23/non_linear_ai_chat
frontend/src/lib/telegramApi.ts
ts
1,579
24df94983bdd23600ef1ede237be375a437154ec55ae5d96bfc489f161f42163
/** * Telegram API client. * Handles communication with backend Telegram endpoints for account linking. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; // Type definitions export interface TelegramStatus { linked: boolean; username?: string; linkedAt?: string; lastMessageAt?: string;...
eren23/non_linear_ai_chat
frontend/src/lib/pretextService.ts
ts
8,241
1848e59966ab7cfc4a46f094352c32b541f67278f51fc59705a8f57f530867ed
/** * Pretext Service β€” DOM-free text measurement for Spider Chat. * * Wraps @chenglou/pretext to provide cached, font-aware text height * calculations without triggering browser layout reflow. * * Usage: * const height = pretextService.measureTextHeight(text, 760, { * baseFontSizePx: 14, * fontMulti...
eren23/non_linear_ai_chat
frontend/src/lib/useAuthenticatedImage.ts
ts
9,955
064e4c68da9475a5c2d1f0d2f3824dbe1a762bbe6881e40bab0b29fcf6e1f878
/** * Hook for loading images with authentication * Fetches images with credentials and converts them to blob URLs * Includes multi-layer caching (memory + IndexedDB) and lazy loading */ import { useEffect, useState, useRef } from 'react'; import { getCachedImageFromDB, setCachedImageInDB, isIndexedDBAvai...
eren23/non_linear_ai_chat
frontend/src/lib/canvasZoom.ts
ts
3,117
422a1d3b3e72c43388c3050fe63a4d055142bad551530c4478dfbdf465269bc8
/** * Sidebar-aware zoom and centering calculations for ReactFlow canvas. * * The sidebars use `position: fixed` and overlay the canvas, so ReactFlow's * built-in fitView/setCenter don't know about the occluded regions. These * utilities compute the correct zoom level and center offset to keep nodes * fully visib...
eren23/non_linear_ai_chat
frontend/src/lib/webVitals.ts
ts
1,837
2c2e16c1ada937c747dc88b549ccd8a716aac1071cc678aa47d27ffd65e3e1e8
/** * Web Vitals & Long Task Observer * * Collects Core Web Vitals (CLS, INP, LCP, FCP, TTFB) and long task timing. * - Dev: logs to console * - Prod: sends to Sentry via custom measurements */ import { onCLS, onINP, onLCP, onFCP, onTTFB, type Metric } from 'web-vitals'; import * as Sentry from '@sentry/react'; ...
eren23/non_linear_ai_chat
frontend/src/lib/urlUtils.ts
ts
286
01c2c4523da1a626f06f2718f46aec2c975a152dfbd758e481bfe082046279fb
/** Extract the pathname from a URL, stripping query params and trailing slashes. Returns '' for root paths. */ export function getUrlPath(url: string): string { try { const path = new URL(url).pathname.replace(/\/+$/, ''); return path || ''; } catch { return ''; } }
eren23/non_linear_ai_chat
frontend/src/lib/notesApi.ts
ts
18,314
f23c001bf278f48c250bb7ae383dda09f4958df83eb129eee1900a154efdcaab
import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; // Cache for notes graph with 5-minute TTL const NOTES_GRAPH_CACHE_TTL = 5 * 60 * 1000; // 5 minutes let notesGraphCache: { data: NoteGraphData; timestamp: number } | null = null; /** * Invalidate the notes graph cache. */ export function invalidat...
eren23/non_linear_ai_chat
frontend/src/lib/userPreferencesApi.ts
ts
3,091
5b0bc1b573eb5a9e77714fd7098de1aabcd6c4dcb7b7add56eaf5e57b64b3b93
/** * User preferences API service. */ import { cachedFetch, invalidateCache, CACHE_KEYS, CACHE_TTLS, } from './apiCache'; import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface UserPreferences { defaultModel: string | null; ragTopK: number; // Default: 5, range: 1-20 rag...
eren23/non_linear_ai_chat
frontend/src/lib/drawioApi.ts
ts
4,218
13fd179181535a682c14426dc4cbee2c8b02b9f5f4bcfce01d68b69f788581f8
/** * API client for DrawIO diagram features. * * Handles conversion, upload, download, and status polling * for DrawIO XML data and thumbnails stored in R2. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; /** Conversion task status returned by the backend. */ export interface ConversionSt...
eren23/non_linear_ai_chat
frontend/src/lib/adminModelsApi.ts
ts
8,301
67012e4f3a8b49c5c663f4c13c05639f7e08d5b58b00cbf3051e33548d4164af
/** * Admin model management API service. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface ModelInfo { id: string; name: string; provider: string; description?: string; category?: string; deprecated?: boolean; deprecatedReason?: string; problematic?: boolean; ...
eren23/non_linear_ai_chat
frontend/src/lib/pretextAutoSizer.ts
ts
4,198
4cae9314d48c63d116d7aa5d05a7d30653634fb2442962b55dd21dff09816735
/** * Pretext Auto-Sizer β€” Zustand subscriber that recalculates node dimensions * when content changes, regardless of whether the node is currently rendered. * * Critical for virtualization: ReactFlow's `onlyRenderVisibleElements={true}` * means off-screen nodes don't render (hooks don't run). This subscriber * e...
eren23/non_linear_ai_chat
frontend/src/lib/toolMetadata.ts
ts
4,107
eff244a8af1d79e199c73c5d53159839a2de9ebb8fe1dd8582c88e673c9cadd5
/** * Tool metadata: categories, icons, descriptions, and presets. * Single source of truth for tool display information across the app. */ // Tool category definitions export type ToolCategory = 'search' | 'memory' | 'productivity'; export interface ToolMeta { name: string; label: string; description: strin...
eren23/non_linear_ai_chat
frontend/src/lib/fileValidation.ts
ts
9,032
17d7e36a7ffbb7f5a8f8ce36cf0e83c0c6b4cd49ffe558fac3ebe56a480ac1db
/** * File validation utilities and limits. * Shared constants for file upload validation. */ import * as pdfjsLib from 'pdfjs-dist'; // Enabled file types after file processing rework export const ALLOWED_MIME_TYPES = new Set([ // PDF (always enabled) 'application/pdf', // Documents - T032, T033, T034 'a...
eren23/non_linear_ai_chat
frontend/src/lib/memoryGraphApi.ts
ts
5,104
6eeab279bdc601f7ed1075ab823b8b837934340e6004efed604992e21557573b
// Use same-origin /api (proxied by nginx in production) const API_BASE = '/api'; // Cache for memory graph with 5-minute TTL interface CachedGraph { data: MemoryGraph; timestamp: number; key: string; } const GRAPH_CACHE_TTL = 5 * 60 * 1000; // 5 minutes let memoryGraphCache: CachedGraph | null = null; let enti...
eren23/non_linear_ai_chat
frontend/src/lib/notifications.ts
ts
1,988
de4bef08fc0164f32fdbbfcd90e492b022337576219665f0599ab980f084fa99
/** * Notification utility - Replace alert() calls with proper notifications. */ import { createNotification, type NotificationType } from './notificationsApi'; import { toastManager } from '@/components/controls/ToastNotifications'; import i18n from '@/i18n'; /** * Show a notification instead of using alert(). *...
eren23/non_linear_ai_chat
frontend/src/lib/systemHealthApi.ts
ts
1,973
d2314efed1825ea25266c6131aabfd0e924b40bb199fbf8e38af0078df3bedd7
import { API_BASE } from './api'; export interface CacheStats { totalKeys: number; memoryUsage: string; hitRate: number; missRate: number; uptime: number; } export interface SystemHealth { status: string; uptime: number; memory: { rss: number; heapTotal: number; heapUsed: number; exter...
eren23/non_linear_ai_chat
frontend/src/lib/flowEvents.ts
ts
910
3a87bf169f5f520c3b6bfa4e53a66c8879bd418adf741be41230ed6336073f4d
/** * Centralized flow event system. * * Provides typed events for flow and group operations, * allowing components to react to changes in real-time. */ export const FLOW_EVENTS = { CREATED: 'flow:created', UPDATED: 'flow:updated', DELETED: 'flow:deleted', MOVED: 'flow:moved', GROUP_CREATED: 'flow:group...
eren23/non_linear_ai_chat
frontend/src/lib/sketchApi.ts
ts
1,643
424ddfe9c0c1cea75a479339837992d43056123b8b616839ffb4d971a74f8859
/** * API client for sketch sub-node features. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; /** * Upload a rasterized sketch PNG to R2. */ export async function uploadSketchPng( blob: Blob ): Promise<{ url: string; key: string; size: number }> { const formData = new FormData(); for...
eren23/non_linear_ai_chat
frontend/src/lib/errorCategories.ts
ts
9,862
8c475ed5d2c9bdc6129bbb3274e8caa75f63f9b47f227021ae39cd1ed4eb328b
/** * Frontend Error Categorization Utility * * Categorizes errors for user-friendly display. * Mirrors the backend errorMessages.ts categories for frontend use. * When the backend sends a structured error with `code`, use that directly. * Falls back to string-matching for unstructured errors. */ import i18n fr...
eren23/non_linear_ai_chat
frontend/src/lib/authApi.ts
ts
5,253
1cbf520c50d9bd0894755266942c4179e25959fdcfce0b841605d8f855eb91eb
/** * Authentication API service. */ import { clearAuthenticatedImageCache } from './useAuthenticatedImage'; const API_BASE = '/api'; export interface User { _id: string; email: string; name: string; picture?: string; isAdmin: boolean; defaultModel?: string; userTier?: string; } /** * Get current u...
eren23/non_linear_ai_chat
frontend/src/lib/memoriesApi.ts
ts
12,502
a29fdda76d1aadc82dd13772b368f1eb8e28309f9069d45ea717a5ac9e1136a9
/** * Memories API client. */ import { apiFetch } from '@/lib/csrfApi'; // Use /api proxy in production, direct URL in development const API_BASE = '/api'; export interface Memory { _id: string; userId: string; type: 'conversation' | 'note' | 'insight'; category?: 'personal_info' | 'task_short_term' | 'tas...
eren23/non_linear_ai_chat
frontend/src/lib/userStatsApi.ts
ts
2,022
e065d27d779d8b045f877b29168fc0ca9fe5a7a6aacfdaa82c622365e6dd172d
/** * User statistics API service. */ const API_BASE = '/api'; export interface UserStats { // Account info email: string; name: string; picture?: string; accountAgeDays: number; createdAt: string; lastLoginAt: string | null; daysSinceLastLogin: number | null; // Usage statistics totalTokens:...
eren23/non_linear_ai_chat
frontend/src/lib/utils.ts
ts
869
82cd26d90596cae2de416e7e64e360c50d861fda958bc95f57fb70bc127f7228
/** * Utility functions. */ import { type ClassValue, clsx } from 'clsx'; /** * Merge class names. */ export function cn(...inputs: ClassValue[]) { return clsx(inputs); } /** * Generate a unique ID. */ export function generateId(): string { return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;...
eren23/non_linear_ai_chat
frontend/src/lib/templatesApi.ts
ts
8,162
4cd2ffa42e0d8d025a944080ba0dd37302b8a75726141b7ea521e10a8c15ac68
/** * API client for template management. */ import type { Template, TemplateListItem, TemplateCategory, CreateTemplateInput, UpdateTemplateInput, CreateCategoryInput, UpdateCategoryInput, ImportTemplateResult, } from '@/types/templates'; import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/...
eren23/non_linear_ai_chat
frontend/src/lib/api.ts
ts
22,160
c524394a2dc06369625941920894aaef39c4bdacb54e9d26d7c231496902e020
import { GenerateRequest, Message, ModelInfo } from '@/types/graph'; import { apiFetch } from '@/lib/csrfApi'; /** * Tool event emitted during SSE streaming when the AI calls or receives results from tools. */ export interface ToolEvent { type: 'toolCall' | 'toolResult'; tool: string; arguments?: unknown; re...
eren23/non_linear_ai_chat
frontend/src/lib/adminApi.ts
ts
15,872
28646b2550808823bd0495a5bc85d503d1a8f2243851f681c0f737590632a431
/** * Admin API service. */ import { apiFetch } from './csrfApi'; const API_BASE = '/api'; export type AccountStatus = 'active' | 'suspended' | 'deleted' | 'inactive'; export interface User { _id: string; email: string; name: string; picture?: string; isAdmin: boolean; userTier?: string; accountStat...
eren23/non_linear_ai_chat
frontend/src/lib/domSanitize.ts
ts
4,355
528130834a2016058c98e418f8237c4aab048dafc09030e2c86d184808936e7f
/** * DOM Sanitization Utilities * * Provides secure sanitization functions for user-generated or * third-party content to prevent XSS and other injection attacks. */ import DOMPurify from 'dompurify'; /** * Configuration for SVG sanitization. * Allows safe SVG elements while blocking scripts and dangerous att...
eren23/non_linear_ai_chat
frontend/src/lib/indexedDBCache.ts
ts
7,293
1ae4b972cb5312a8f61db66cbc64a7cbe7f77077e4bcd0aded376c0c4be9e51e
/** * IndexedDB-based persistent cache for images. * Survives page refreshes and provides LRU eviction. */ const DB_NAME = 'SpiderChatImageCache'; const STORE_NAME = 'images'; const DB_VERSION = 1; const MAX_CACHE_SIZE = 100 * 1024 * 1024; // 100MB const MAX_AGE = 7 * 24 * 60 * 60 * 1000; // 7 days interface Cache...
eren23/non_linear_ai_chat
frontend/src/lib/filesApi.ts
ts
7,852
e578ffae6a06777443fa61aa9a7193db180483fcccb6aa821fb21f9590f908f4
/** * API client for file management. */ import { apiFetch } from '@/lib/csrfApi'; export interface FileInfo { _id: string; name: string; originalName: string; mimeType: string; size: number; type: 'text' | 'image' | 'pdf' | 'other'; content: string; // Markdown content flowId?: string; nodeIds?: ...
eren23/non_linear_ai_chat
frontend/src/lib/flowTabCleanup.ts
ts
897
edffa495aab7fc9280947538d313641dc5fdcbb304ff28d9ddd19f6ad41a3dca
import type { GraphStore } from '@/store/types'; type FlowWorkspaceStore = Pick<GraphStore, 'tabs' | 'closeTabs' | 'currentFlowId' | 'clearFlow'>; /** * Remove deleted/left flows from the current workspace without leaving * a selected tab pointing at missing content. */ export function removeFlowsFromWorkspace( ...
eren23/non_linear_ai_chat
frontend/src/lib/imageTemplatesApi.ts
ts
4,169
bfe37083aa75060d76bedd7c51beced01418e5a06e7a0e9deb6baabfaa06bba4
/** * Image templates API service. */ import { ImageTemplate, ImageTemplateParameters } from '@/types/graph'; import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface DefaultTemplate { id: string; name: string; category: string; description: string; parameters: ImageTemplatePar...
eren23/non_linear_ai_chat
frontend/src/lib/capabilityMetadata.ts
ts
7,994
3c58fa878886b3b6f5c319428df4a9d45201b4c6a04782956b6e5b57cf814cfa
/** * Unified Capability metadata β€” single source of truth for "what can the AI access". * * Maps a flat list of capability IDs to the two backend mechanisms: * β€’ enabledTools (OpenRouter function-calling tools) * β€’ contextConfig (auto-injected context sources) * * Users never see the dual mechanism; they j...
eren23/non_linear_ai_chat
frontend/src/lib/tagsApi.ts
ts
2,688
ca034f220ee8075be1783747908addec5ce14ca38d48c57c937e442e311bdf1f
/** * API client for tag management and search. */ import { cachedFetch, invalidateCache, CACHE_KEYS, CACHE_TTLS, } from './apiCache'; import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; /** * Get all tags for the current user. */ export async function getAllTags(): Promise<string[]> { c...
eren23/non_linear_ai_chat
frontend/src/lib/fuzzySearch.ts
ts
1,747
e9e34b08482a464e10d330f632ac6c0decde41fe8ef65d2091c80ab2e6df4f0e
/** * Thin typed wrapper around fuzzysort for fuzzy matching. * Used by autocomplete and link suggestor features. */ import fuzzysort from 'fuzzysort'; export interface FuzzyResult<T> { item: T; score: number; matchIndexes: number[]; } const MAX_QUERY_LENGTH = 200; /** * Sanitize search input: trim, limit...
eren23/non_linear_ai_chat
frontend/src/lib/flowMetadataApi.ts
ts
2,643
0bb2913d86c215da4c4627bd4a947eeb3fa8771e2720676aa891807cdb7ce640
/** * Flow Metadata API client. */ import { apiFetch } from '@/lib/csrfApi'; // Use /api proxy in production, direct URL in development const API_BASE = '/api'; export interface FlowMetadata { _id: string; flowId: string; userId: string; firstAccessedAt: string; lastAccessedAt: string; nodeCount: numbe...
eren23/non_linear_ai_chat
frontend/src/lib/collabBroadcast.ts
ts
6,477
6b550a6c037ee13c9a4b957b0bd2d46571e9db82ddee59c38cb6324ee7b284da
/** * Collaboration broadcast utilities for node data sync. * Used by useChatGeneration and ChatNode to broadcast data changes * without needing direct access to the useCollaboration hook. */ import { getSocket } from '@/lib/socket'; // Lazy store accessor to avoid circular dependency: // store slices import from...
eren23/non_linear_ai_chat
frontend/src/lib/parallelApi.ts
ts
6,359
b753541fe0e4f199a90418fefb63849bbe1d4aecfc4e1f6468ba624f4d5256ab
/** * Parallel generation API client. * * Handles SSE streaming for multi-branch LLM generation. */ import type { Message } from '@/types/graph'; import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; /** * SSE Event types from the parallel generation endpoint */ export type BranchStreamEvent = |...
eren23/non_linear_ai_chat
frontend/src/lib/notificationsApi.ts
ts
3,081
ab214f6977d89fd7d436c44e0e946405089731f602b5f05b3327a4e7a6d5c360
/** * Notifications API service. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export type NotificationType = 'error' | 'warning' | 'info' | 'success'; export interface Notification { _id: string; userId: string; type: NotificationType; title: string; message: string; read: boo...
eren23/non_linear_ai_chat
frontend/src/lib/ocrApi.ts
ts
1,539
11967f899b492bff37ad72b5cc40a800d16e0ecc1b5e532788023698e4636fd7
/** * OCR API client for extracting text from images. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export type OcrMode = 'standard' | 'handwriting'; /** * Extract text from an image file using OCR. * @param file - Image file to process * @param mode - OCR mode: 'standard' for printed t...
eren23/non_linear_ai_chat
frontend/src/lib/graphApi.ts
ts
8,414
16728b3236986f2e5775af74d2396c74264cf013b7b5715f796b6f9e83ee1a7e
/** * Graph API client functions. * * Provides access to the knowledge graph endpoints for * flow insights, topics, and related flows. */ const API_BASE = '/api'; /** * Flow insight data from the graph. */ export interface FlowGraphInsights { flowId: string; topics: Array<{ topic: string; weight: number }>...
eren23/non_linear_ai_chat
frontend/src/lib/authValidation.ts
ts
1,303
0199b2b61d2ddd34bd6b9d110ec534dd7ec454c5b8b09b5b88e4d0eb4638f15e
/** * Client-side auth form validation utilities. * Password rules must match backend (localAuth.ts). */ export function validateEmail(email: string): string | null { if (!email.trim()) return 'Email is required.'; if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim())) return 'Please enter a valid email address....
eren23/non_linear_ai_chat
frontend/src/lib/documentChatApi.ts
ts
7,458
7104b9bbef01095ea869d6e664f61f2552572d66790eb5399337a30b601a2f0c
/** * API client for Document Chat feature. * * Provides functions for session management, messaging, flow conversion, * and document summary retrieval. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api/document-chat'; // ========================================================================...
eren23/non_linear_ai_chat
frontend/src/lib/flowsApi.ts
ts
21,868
f63ad6839c660a4a669ebbdd35186cf0561cc596042ee7f2fd95f1251592c557
/** * API client for flow management. */ import { cachedFetch, invalidateCache, CACHE_KEYS, CACHE_TTLS, } from './apiCache'; import { dispatchFlowEvent, FLOW_EVENTS } from './flowEvents'; import { apiFetch } from '@/lib/csrfApi'; /** * Sanitize nodes for JSON serialization. * Removes ReactFlow internal pr...
eren23/non_linear_ai_chat
frontend/src/lib/bugReportsApi.ts
ts
2,622
30850095bca075a8639abcd57483d1fe043b7782b1f2c816ee81fe0277168cc0
/** * Bug reports API service. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export type BugReportStatus = 'open' | 'investigating' | 'resolved' | 'closed'; export interface BugReport { _id: string; userId: string; userEmail: string; userName?: string; title: string; descriptio...
eren23/non_linear_ai_chat
frontend/src/lib/spendingApi.ts
ts
6,369
85fef35ca38d4959e91d00b8ab941cf9ca233f4ce030c0452a3f6ecb14087c9b
/** * Spending API client for expense tracking. */ import type { SpendingStatus, DailySpending, FlowSpending, SpendingHistoryEntry, } from '@/types/graph'; const API_BASE = '/api'; /** * Response from the spending by flow endpoint */ export interface FlowSpendingResponse { flows: FlowSpending[]; pagi...
eren23/non_linear_ai_chat
frontend/src/lib/toolActivityLabels.ts
ts
1,895
87b2e3e2baafb71c4d3244db109faccfb9ec1dc01bc9a5566c9883efb4981ec5
/** * Maps tool names + arguments to human-readable labels for live tool activity feedback. */ /** * Get a human-readable label for a tool call. */ export function getToolActivityLabel(tool: string, args?: unknown): string { const a = args as Record<string, unknown> | undefined; const query = typeof a?.query =...