From 277e062ac24beca325ac9f263de2760e83ecb9d7 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sat, 25 Jul 2026 16:51:51 -0400 Subject: [PATCH] style: sort content protection imports --- packages/api/src/agents/handlers.background.spec.ts | 2 +- packages/api/src/agents/hitl/inspection.spec.ts | 2 +- packages/api/src/agents/initialize.ts | 12 ++++++------ packages/api/src/assistants/protection.ts | 12 ++++++------ packages/api/src/files/code/extract.spec.ts | 2 +- packages/api/src/files/code/preflight.spec.ts | 2 +- packages/api/src/files/code/preflight.ts | 6 +++--- packages/api/src/middleware/contentFilter.spec.ts | 2 +- packages/api/src/protection/adapters/chat.spec.ts | 2 +- packages/api/src/protection/adapters/chat.ts | 2 +- packages/api/src/shared-links/protection.spec.ts | 4 ++-- packages/api/src/shared-links/protection.ts | 12 ++++++------ 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/api/src/agents/handlers.background.spec.ts b/packages/api/src/agents/handlers.background.spec.ts index 08fb04ad88..b561d58e32 100644 --- a/packages/api/src/agents/handlers.background.spec.ts +++ b/packages/api/src/agents/handlers.background.spec.ts @@ -2,9 +2,9 @@ import { z } from 'zod'; import { logger } from '@librechat/data-schemas'; import type { StructuredToolInterface } from '@librechat/agents/langchain/tools'; import type { FiltersConfig } from 'librechat-data-provider'; +import { ContentFilterError } from '../middleware/contentFilter'; import { CHECK_BACKGROUND_TASK_NAME } from './background'; import { createToolExecuteHandler } from './handlers'; -import { ContentFilterError } from '../middleware/contentFilter'; interface BatchInput { toolCalls: Array<{ diff --git a/packages/api/src/agents/hitl/inspection.spec.ts b/packages/api/src/agents/hitl/inspection.spec.ts index 145e30abeb..80e91211d9 100644 --- a/packages/api/src/agents/hitl/inspection.spec.ts +++ b/packages/api/src/agents/hitl/inspection.spec.ts @@ -1,5 +1,5 @@ -import type { AppConfig } from '@librechat/data-schemas'; import { Constants } from 'librechat-data-provider'; +import type { AppConfig } from '@librechat/data-schemas'; import { getResumeContentInspection } from './inspection'; const strictExtractedTextConfig = { diff --git a/packages/api/src/agents/initialize.ts b/packages/api/src/agents/initialize.ts index 55d2bff61d..3af3313995 100644 --- a/packages/api/src/agents/initialize.ts +++ b/packages/api/src/agents/initialize.ts @@ -31,9 +31,9 @@ import type { } from '~/types'; import type { ResolvedManualSkill, ResolvedAlwaysApplySkill, ResolvedSkillCatalog } from './skills'; import type { LCAvailableTools, RequestScopedMCPConnectionStore } from '../mcp/types'; -import type { TFilterFilesByAgentAccess } from './resources'; import type { ContentTraversalLimitError } from '../protection/adapters/nested'; import type { TextContentFragment } from '../protection/types'; +import type { TFilterFilesByAgentAccess } from './resources'; import { injectSkillCatalog, resolveSkillCatalog, @@ -42,6 +42,11 @@ import { unionPrimeAllowedTools, MAX_PRIMED_SKILLS_PER_TURN, } from './skills'; +import { + getContentTraversalFragments, + isContentTraversalProtected, + isContentTraversalLimitError, +} from '../protection/adapters/nested'; import { optionalChainWithEmptyCheck, extractLibreChatParams, @@ -54,11 +59,6 @@ import { isFileAuthoringToolDefinition, } from './tools'; import { extractAgentContent, extractSkillContent } from '../protection/adapters/submissions'; -import { - getContentTraversalFragments, - isContentTraversalProtected, - isContentTraversalLimitError, -} from '../protection/adapters/nested'; import { normalizeServerName, requiresEphemeralUserConnection } from '~/mcp/utils'; import { assertModelBoundContent } from '../middleware/modelBoundContent'; import { registerMemoryTools, memoryToolUsageGuard } from './memory'; diff --git a/packages/api/src/assistants/protection.ts b/packages/api/src/assistants/protection.ts index c9fa6ae3d0..d2fc8697ac 100644 --- a/packages/api/src/assistants/protection.ts +++ b/packages/api/src/assistants/protection.ts @@ -1,17 +1,17 @@ import { hasActivePiiPatterns } from 'librechat-data-provider'; import type { FiltersConfig, MessageFilterPiiConfig } from 'librechat-data-provider'; -import type { - AssistantContentInput, - StoredMessageContentInput, -} from '../protection/adapters/submissions'; -import type { ExternalChatMessage } from '../protection/adapters/messages'; import type { CanonicalFileInspectionFile, CanonicalFileInspectionUser, GetCanonicalFilesForInspection, } from '../protection/files'; -import { ContentTraversalLimitError } from '../protection/adapters/nested'; +import type { + AssistantContentInput, + StoredMessageContentInput, +} from '../protection/adapters/submissions'; +import type { ExternalChatMessage } from '../protection/adapters/messages'; import { hasActiveFilePolicy, resolveCanonicalFileReferences } from '../protection/files'; +import { ContentTraversalLimitError } from '../protection/adapters/nested'; import { assertModelBoundContent } from '../middleware/modelBoundContent'; const PAGE_LIMIT = 100; diff --git a/packages/api/src/files/code/extract.spec.ts b/packages/api/src/files/code/extract.spec.ts index c3dcba4303..5b179a98f2 100644 --- a/packages/api/src/files/code/extract.spec.ts +++ b/packages/api/src/files/code/extract.spec.ts @@ -1,7 +1,6 @@ import * as os from 'os'; import * as path from 'path'; import { logger } from '@librechat/data-schemas'; -import { parseDocument } from '~/files/documents/crud'; import { extractCodeArtifactRawText, extractCodeArtifactInspectionText, @@ -11,6 +10,7 @@ import { MAX_TEXT_CACHE_BYTES, MAX_TEXT_EXTRACT_BYTES, } from './extract'; +import { parseDocument } from '~/files/documents/crud'; jest.mock('@librechat/data-schemas', () => ({ logger: { diff --git a/packages/api/src/files/code/preflight.spec.ts b/packages/api/src/files/code/preflight.spec.ts index b4559b2663..bab11143bd 100644 --- a/packages/api/src/files/code/preflight.spec.ts +++ b/packages/api/src/files/code/preflight.spec.ts @@ -1,6 +1,6 @@ import type { FiltersConfig } from 'librechat-data-provider'; -import { CODE_OUTPUT_PREFLIGHT_MAX_BYTES, preflightCodeOutputBatch } from './preflight'; import type { CodeOutputArtifact, PrepareCodeOutputInput, PreparedCodeOutput } from './preflight'; +import { CODE_OUTPUT_PREFLIGHT_MAX_BYTES, preflightCodeOutputBatch } from './preflight'; const BLOCK_PATTERN = { id: 'private-token', diff --git a/packages/api/src/files/code/preflight.ts b/packages/api/src/files/code/preflight.ts index 6573d19901..0625f683f9 100644 --- a/packages/api/src/files/code/preflight.ts +++ b/packages/api/src/files/code/preflight.ts @@ -1,14 +1,14 @@ import { hasActivePiiPatterns } from 'librechat-data-provider'; import type { FileFilterField, FiltersConfig } from 'librechat-data-provider'; -import { ContentFilterError } from '../../middleware/contentFilter'; -import { inspectContent } from '../../protection/runtime'; -import { extractFileContent } from '../../protection/adapters/submissions'; import type { FileContentInput } from '../../protection/adapters/submissions'; import { UninspectableFileError, assertHydratedFileInspectable, getBlockedUninspectableFileField, } from '../../protection/files'; +import { extractFileContent } from '../../protection/adapters/submissions'; +import { ContentFilterError } from '../../middleware/contentFilter'; +import { inspectContent } from '../../protection/runtime'; const GENERATED_FILE_CONTENT_FIELDS = [ 'content', diff --git a/packages/api/src/middleware/contentFilter.spec.ts b/packages/api/src/middleware/contentFilter.spec.ts index e53231f5cd..2ed2515918 100644 --- a/packages/api/src/middleware/contentFilter.spec.ts +++ b/packages/api/src/middleware/contentFilter.spec.ts @@ -5,12 +5,12 @@ import { ContentTraversalLimitError, getContentTraversalFragments, } from '../protection/adapters/nested'; -import { extractAssistantContent, extractPresetContent } from '../protection/adapters/submissions'; import { contentFilterBlockResponse, createContentFilter, isContentFilterError, } from './contentFilter'; +import { extractAssistantContent, extractPresetContent } from '../protection/adapters/submissions'; import { UninspectableFileError } from '../protection/files'; jest.mock('@librechat/data-schemas', () => ({ diff --git a/packages/api/src/protection/adapters/chat.spec.ts b/packages/api/src/protection/adapters/chat.spec.ts index e4b973fed1..7a64be6a7d 100644 --- a/packages/api/src/protection/adapters/chat.spec.ts +++ b/packages/api/src/protection/adapters/chat.spec.ts @@ -1,9 +1,9 @@ -import { inspectContent } from '../runtime'; import { ContentTraversalLimitError, getContentTraversalFragments, getContentTraversalScopes, } from './nested'; +import { inspectContent } from '../runtime'; import { extractChatContent } from './chat'; describe('extractChatContent', () => { diff --git a/packages/api/src/protection/adapters/chat.ts b/packages/api/src/protection/adapters/chat.ts index 636d2d7f52..3fe555163c 100644 --- a/packages/api/src/protection/adapters/chat.ts +++ b/packages/api/src/protection/adapters/chat.ts @@ -1,11 +1,11 @@ import type { ContentFieldMap, ContentSource, TextContentFragment } from '../types'; import type { ModelParameterContentInput } from './submissions'; -import { extractModelParameterContent, extractToolArgumentContent } from './submissions'; import { ContentTraversalLimitError, getContentTraversalFragments, getContentTraversalScopes, } from './nested'; +import { extractModelParameterContent, extractToolArgumentContent } from './submissions'; import { getReferencedQuoteEntries, mergeQuotedText } from '../../utils/quotes'; export interface ChatSubmissionDecision { diff --git a/packages/api/src/shared-links/protection.spec.ts b/packages/api/src/shared-links/protection.spec.ts index 3ed323cd25..5db5222671 100644 --- a/packages/api/src/shared-links/protection.spec.ts +++ b/packages/api/src/shared-links/protection.spec.ts @@ -1,12 +1,12 @@ import type { FiltersConfig } from 'librechat-data-provider'; import type { SerializedSharedFile } from './protection'; -import { ContentFilterError } from '../middleware/contentFilter'; import { CONTENT_TRAVERSAL_MAX_NODES, ContentTraversalLimitError, } from '../protection/adapters/nested'; -import { UninspectableFileError } from '../protection/files'; +import { ContentFilterError } from '../middleware/contentFilter'; import { assertSharedFileMetadataAllowed } from './protection'; +import { UninspectableFileError } from '../protection/files'; const BLOCK_PATTERN = { id: 'private', diff --git a/packages/api/src/shared-links/protection.ts b/packages/api/src/shared-links/protection.ts index 2e5017808e..58984f26e2 100644 --- a/packages/api/src/shared-links/protection.ts +++ b/packages/api/src/shared-links/protection.ts @@ -6,12 +6,6 @@ import { } from 'librechat-data-provider'; import type { JsonPointer, TextContentFragment } from '../protection/types'; import type { FileContentInput } from '../protection/adapters/submissions'; -import { - extractFileContent, - extractStoredMessageContent, -} from '../protection/adapters/submissions'; -import { assertModelBoundContent } from '../middleware/modelBoundContent'; -import { ContentFilterError } from '../middleware/contentFilter'; import { CONTENT_TRAVERSAL_MAX_DEPTH, CONTENT_TRAVERSAL_MAX_NODES, @@ -26,6 +20,12 @@ import { hasActiveFilePolicy, UninspectableFileError, } from '../protection/files'; +import { + extractFileContent, + extractStoredMessageContent, +} from '../protection/adapters/submissions'; +import { assertModelBoundContent } from '../middleware/modelBoundContent'; +import { ContentFilterError } from '../middleware/contentFilter'; import { inspectContent } from '../protection/runtime'; export interface SerializedSharedFile extends FileContentInput {