diff --git a/packages/api/src/admin/config.ts b/packages/api/src/admin/config.ts index 7d9b03d581..1aab9ea9fd 100644 --- a/packages/api/src/admin/config.ts +++ b/packages/api/src/admin/config.ts @@ -6,8 +6,8 @@ import { INTERFACE_PERMISSION_FIELDS, PERMISSION_SUB_KEYS, } from 'librechat-data-provider'; -import type { TCustomConfig } from 'librechat-data-provider'; import type { AppConfig, ConfigSection, IConfig } from '@librechat/data-schemas'; +import type { TCustomConfig } from 'librechat-data-provider'; import type { Types, ClientSession } from 'mongoose'; import type { Response } from 'express'; import type { CapabilityUser } from '~/middleware/capabilities'; diff --git a/packages/api/src/admin/skills.ts b/packages/api/src/admin/skills.ts index 78cea561d8..a64c98190e 100644 --- a/packages/api/src/admin/skills.ts +++ b/packages/api/src/admin/skills.ts @@ -1,5 +1,3 @@ -import type { Request, Response } from 'express'; -import type { Types } from 'mongoose'; import type { TGitHubSkillSyncStatusResponse, TGitHubSkillSyncSourceStatus, @@ -12,6 +10,8 @@ import type { SkillSyncCredentialSummary, UpsertSkillSyncCredentialInput, } from '@librechat/data-schemas'; +import type { Request, Response } from 'express'; +import type { Types } from 'mongoose'; import type { GitHubSkillSyncRunner } from '~/skills/sync'; type AdminSkillsRequest = Request & { diff --git a/packages/api/src/skills/handlers.ts b/packages/api/src/skills/handlers.ts index fbde00984a..5b0b4f17fc 100644 --- a/packages/api/src/skills/handlers.ts +++ b/packages/api/src/skills/handlers.ts @@ -5,19 +5,6 @@ import { PrincipalType, PermissionBits, } from 'librechat-data-provider'; -import type { Response } from 'express'; -import type { Types } from 'mongoose'; -import type { - ISkill, - ISkillFile, - ISkillSummary, - CreateSkillInput, - CreateSkillResult, - UpdateSkillInput, - ListSkillsByAccessResult, - UpdateSkillResult, - ValidationIssue, -} from '@librechat/data-schemas'; import type { TSkill, TSkillFile, @@ -31,6 +18,19 @@ import type { TSkillConflictResponse, TSkillFileContentResponse, } from 'librechat-data-provider'; +import type { + ISkill, + ISkillFile, + ISkillSummary, + CreateSkillInput, + CreateSkillResult, + UpdateSkillInput, + ListSkillsByAccessResult, + UpdateSkillResult, + ValidationIssue, +} from '@librechat/data-schemas'; +import type { Response } from 'express'; +import type { Types } from 'mongoose'; import type { ServerRequest, StrategyFunctions } from '~/types'; import { isBinaryBuffer } from './binary'; diff --git a/packages/api/src/skills/import.ts b/packages/api/src/skills/import.ts index 69193c07a2..f27cc459c2 100644 --- a/packages/api/src/skills/import.ts +++ b/packages/api/src/skills/import.ts @@ -1,10 +1,8 @@ -import crypto from 'crypto'; import path from 'path'; import JSZip from 'jszip'; -import { ResourceType, AccessRoleIds, PrincipalType } from 'librechat-data-provider'; +import crypto from 'crypto'; import { logger } from '@librechat/data-schemas'; -import type { Request, Response } from 'express'; -import type { Types } from 'mongoose'; +import { ResourceType, AccessRoleIds, PrincipalType } from 'librechat-data-provider'; import type { ISkill, ISkillFile, @@ -12,6 +10,8 @@ import type { CreateSkillResult, UpsertSkillFileInput, } from '@librechat/data-schemas'; +import type { Request, Response } from 'express'; +import type { Types } from 'mongoose'; import type { ImportLimits } from './limits'; import { resolveRequestTenantId } from '~/middleware/tenant'; import { DEFAULT_SKILL_IMPORT_LIMITS } from './limits'; diff --git a/packages/api/src/skills/sync/github.spec.ts b/packages/api/src/skills/sync/github.spec.ts index 4f01dc8291..fc7c89a086 100644 --- a/packages/api/src/skills/sync/github.spec.ts +++ b/packages/api/src/skills/sync/github.spec.ts @@ -1,5 +1,6 @@ import crypto from 'crypto'; import { Types } from 'mongoose'; +import { getTenantId } from '@librechat/data-schemas'; import type { ISkill, ISkillFile, @@ -8,10 +9,9 @@ import type { ISkillSyncStatus, SkillSyncStatusInput, } from '@librechat/data-schemas'; -import { getTenantId } from '@librechat/data-schemas'; +import type { GitHubSkillSyncDeps } from './github'; import { DEFAULT_SKILL_IMPORT_LIMITS } from '../limits'; import { createGitHubSkillSyncRunner } from './github'; -import type { GitHubSkillSyncDeps } from './github'; function response(body: unknown, status = 200, headers: Record = {}): Response { const normalizedHeaders = new Map( diff --git a/packages/api/src/skills/sync/github.ts b/packages/api/src/skills/sync/github.ts index 6887e18489..6a56d3f7ae 100644 --- a/packages/api/src/skills/sync/github.ts +++ b/packages/api/src/skills/sync/github.ts @@ -1,14 +1,13 @@ -import crypto from 'crypto'; import path from 'path'; +import crypto from 'crypto'; import { Types } from 'mongoose'; +import { logger, tenantStorage } from '@librechat/data-schemas'; import { ResourceType, PrincipalType, AccessRoleIds, SKILL_SYNC_DEFAULT_DISCOVERY_DEPTH, } from 'librechat-data-provider'; -import { logger, tenantStorage } from '@librechat/data-schemas'; -import type { SkillSyncConfig, SkillSyncGitHubSourceConfig } from 'librechat-data-provider'; import type { ISkill, ISkillFile, @@ -22,6 +21,7 @@ import type { SkillSyncCredentialSummary, SkillSyncStatusInput, } from '@librechat/data-schemas'; +import type { SkillSyncConfig, SkillSyncGitHubSourceConfig } from 'librechat-data-provider'; import { DEFAULT_SKILL_IMPORT_LIMITS } from '../limits'; import { parseSkillMarkdown } from '../parse'; diff --git a/packages/api/src/skills/sync/orchestrator.spec.ts b/packages/api/src/skills/sync/orchestrator.spec.ts index a6b952be47..03dd5d6b5b 100644 --- a/packages/api/src/skills/sync/orchestrator.spec.ts +++ b/packages/api/src/skills/sync/orchestrator.spec.ts @@ -1,6 +1,6 @@ import type { SkillSyncConfig } from 'librechat-data-provider'; -import type { GitHubSkillSyncRunner } from './github'; import type { SkillSyncTriggerRunnerFactoryInput } from './orchestrator'; +import type { GitHubSkillSyncRunner } from './github'; import { createSkillSyncTriggerOrchestrator } from './orchestrator'; type RunnerStatus = Awaited>; diff --git a/packages/api/src/skills/sync/scheduler.spec.ts b/packages/api/src/skills/sync/scheduler.spec.ts index 492d672707..da9eb0fff4 100644 --- a/packages/api/src/skills/sync/scheduler.spec.ts +++ b/packages/api/src/skills/sync/scheduler.spec.ts @@ -1,7 +1,7 @@ import type { SkillSyncConfig } from 'librechat-data-provider'; -import { __resetShutdownStateForTests } from '~/app/shutdown'; -import { SKILL_SYNC_MAX_TIMER_INTERVAL_MINUTES, startGitHubSkillSyncScheduler } from './scheduler'; import type { GitHubSkillSyncRunner } from './github'; +import { SKILL_SYNC_MAX_TIMER_INTERVAL_MINUTES, startGitHubSkillSyncScheduler } from './scheduler'; +import { __resetShutdownStateForTests } from '~/app/shutdown'; const source = { id: 'librechat-skills', diff --git a/packages/api/src/skills/sync/scheduler.ts b/packages/api/src/skills/sync/scheduler.ts index 69f0f83070..ada7ebc7a0 100644 --- a/packages/api/src/skills/sync/scheduler.ts +++ b/packages/api/src/skills/sync/scheduler.ts @@ -1,7 +1,7 @@ -import type { SkillSyncConfig } from 'librechat-data-provider'; import { logger } from '@librechat/data-schemas'; -import { registerShutdownTask } from '~/app/shutdown'; +import type { SkillSyncConfig } from 'librechat-data-provider'; import type { GitHubSkillSyncRunner } from './github'; +import { registerShutdownTask } from '~/app/shutdown'; const NODE_TIMER_MAX_MS = 2147483647; const SKILL_SYNC_MIN_INTERVAL_MINUTES = 5; diff --git a/packages/data-provider/src/api-endpoints.ts b/packages/data-provider/src/api-endpoints.ts index da09193b5c..bc3107d7ca 100644 --- a/packages/data-provider/src/api-endpoints.ts +++ b/packages/data-provider/src/api-endpoints.ts @@ -1,7 +1,7 @@ import type { StartupConfigContext } from './config'; import type { AssistantsEndpoint } from './schemas'; -import * as q from './types/queries'; import { ResourceType } from './accessPermissions'; +import * as q from './types/queries'; let BASE_URL = ''; if ( diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts index 26246ae13e..9035f6645b 100644 --- a/packages/data-provider/src/config.ts +++ b/packages/data-provider/src/config.ts @@ -10,11 +10,11 @@ import { } from './schemas'; import { ComponentTypes, SettingTypes, OptionTypes } from './generate'; import { specsConfigSchema, TSpecsConfig } from './models'; +import { REFILL_INTERVAL_UNITS } from './balance'; import { fileConfigSchema } from './file-config'; import { apiBaseUrl } from './api-endpoints'; import { FileSources } from './types/files'; import { MCPServersSchema } from './mcp'; -import { REFILL_INTERVAL_UNITS } from './balance'; export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord', 'saml']; diff --git a/packages/data-schemas/src/app/resolution.spec.ts b/packages/data-schemas/src/app/resolution.spec.ts index 62a4dd10a1..d3020c0707 100644 --- a/packages/data-schemas/src/app/resolution.spec.ts +++ b/packages/data-schemas/src/app/resolution.spec.ts @@ -1,6 +1,6 @@ import { INTERFACE_PERMISSION_FIELDS, PermissionTypes } from 'librechat-data-provider'; -import { mergeConfigOverrides } from './resolution'; import type { AppConfig, IConfig } from '~/types'; +import { mergeConfigOverrides } from './resolution'; function fakeConfig( overrides: Record, diff --git a/packages/data-schemas/src/methods/index.ts b/packages/data-schemas/src/methods/index.ts index 2254e33f14..6bab02a4f4 100644 --- a/packages/data-schemas/src/methods/index.ts +++ b/packages/data-schemas/src/methods/index.ts @@ -1,10 +1,10 @@ +import type { RoleMethods, RoleDeps } from './role'; import { createSessionMethods, DEFAULT_REFRESH_TOKEN_EXPIRY, type SessionMethods } from './session'; +import { createUserMethods, DEFAULT_SESSION_EXPIRY, type UserMethods } from './user'; import { createTokenMethods, type TokenMethods } from './token'; import { createRoleMethods, RoleConflictError } from './role'; -import type { RoleMethods, RoleDeps } from './role'; -import { createUserMethods, DEFAULT_SESSION_EXPIRY, type UserMethods } from './user'; -import { createKeyMethods, type KeyMethods } from './key'; import { createFileMethods, type FileMethods } from './file'; +import { createKeyMethods, type KeyMethods } from './key'; /* Memories */ import { createMemoryMethods, type MemoryMethods } from './memory'; /* Agent Categories */ diff --git a/packages/data-schemas/src/methods/skill.spec.ts b/packages/data-schemas/src/methods/skill.spec.ts index 3886140e1c..60451d821b 100644 --- a/packages/data-schemas/src/methods/skill.spec.ts +++ b/packages/data-schemas/src/methods/skill.spec.ts @@ -1,4 +1,5 @@ import mongoose from 'mongoose'; +import { logger, createModels } from '..'; import { MongoMemoryServer } from 'mongodb-memory-server'; import { SystemRoles, @@ -7,7 +8,6 @@ import { PrincipalType, PermissionBits, } from 'librechat-data-provider'; -import { createAclEntryMethods } from './aclEntry'; import { validateSkillName, validateSkillDescription, @@ -17,7 +17,7 @@ import { inferSkillFileCategory, deriveStructuredFrontmatterFields, } from './skill'; -import { logger, createModels } from '..'; +import { createAclEntryMethods } from './aclEntry'; import { createMethods } from './index'; logger.silent = true; diff --git a/packages/data-schemas/src/methods/skill.ts b/packages/data-schemas/src/methods/skill.ts index 63e3b8b091..a66b6cc2b8 100644 --- a/packages/data-schemas/src/methods/skill.ts +++ b/packages/data-schemas/src/methods/skill.ts @@ -16,8 +16,8 @@ import type { ISkillFileDocument, ISkillSummary, } from '~/types/skill'; -import { isValidObjectIdString } from '~/utils/objectId'; import { tenantSafeBulkWrite } from '~/utils/tenantBulkWrite'; +import { isValidObjectIdString } from '~/utils/objectId'; import { stripYamlTrailingComment } from '~/utils/yaml'; import { escapeRegExp } from '~/utils/string'; import logger from '~/config/winston'; diff --git a/packages/data-schemas/src/methods/skillSync.spec.ts b/packages/data-schemas/src/methods/skillSync.spec.ts index 8ab5354aa2..d384db1d7c 100644 --- a/packages/data-schemas/src/methods/skillSync.spec.ts +++ b/packages/data-schemas/src/methods/skillSync.spec.ts @@ -1,9 +1,9 @@ import mongoose from 'mongoose'; import { MongoMemoryServer } from 'mongodb-memory-server'; -import { createModels } from '../models'; -import { createSkillSyncMethods } from './skillSync'; import type { ISkillSyncCredential } from '~/types/skillSync'; +import { createSkillSyncMethods } from './skillSync'; import { encryptV2, decryptV2 } from '~/crypto'; +import { createModels } from '../models'; jest.mock('~/crypto', () => ({ encryptV2: jest.fn(async (value: string) => `encrypted:${value}`), diff --git a/packages/data-schemas/src/methods/skillSync.ts b/packages/data-schemas/src/methods/skillSync.ts index e662614956..98955af757 100644 --- a/packages/data-schemas/src/methods/skillSync.ts +++ b/packages/data-schemas/src/methods/skillSync.ts @@ -1,6 +1,5 @@ import { createHash } from 'crypto'; import type { Model, Types } from 'mongoose'; -import { encryptV2, decryptV2 } from '~/crypto'; import type { ISkillSyncStatus, SkillSyncProvider, @@ -9,6 +8,7 @@ import type { ISkillSyncCredential, ISkillSyncCredentialDocument, } from '~/types/skillSync'; +import { encryptV2, decryptV2 } from '~/crypto'; const LOCK_SOURCE_ID = '__global_lock__'; diff --git a/packages/data-schemas/src/models/index.ts b/packages/data-schemas/src/models/index.ts index 1a84023f97..57ffa5f770 100644 --- a/packages/data-schemas/src/models/index.ts +++ b/packages/data-schemas/src/models/index.ts @@ -1,38 +1,38 @@ -import { createUserModel } from './user'; -import { createTokenModel } from './token'; -import { createSessionModel } from './session'; -import { createBalanceModel } from './balance'; -import { createConversationModel } from './convo'; -import { createChatProjectModel } from './chatProject'; -import { createMessageModel } from './message'; -import { createAgentModel } from './agent'; -import { createAgentApiKeyModel } from './agentApiKey'; -import { createAgentCategoryModel } from './agentCategory'; -import { createMCPServerModel } from './mcpServer'; -import { createRoleModel } from './role'; -import { createActionModel } from './action'; -import { createAssistantModel } from './assistant'; -import { createFileModel } from './file'; -import { createBannerModel } from './banner'; -import { createKeyModel } from './key'; -import { createPluginAuthModel } from './pluginAuth'; -import { createTransactionModel } from './transaction'; -import { createPresetModel } from './preset'; -import { createPromptModel } from './prompt'; -import { createPromptGroupModel } from './promptGroup'; -import { createSkillModel } from './skill'; -import { createSkillFileModel } from './skillFile'; import { createSkillSyncCredentialModel } from './skillSyncCredential'; import { createSkillSyncStatusModel } from './skillSyncStatus'; import { createConversationTagModel } from './conversationTag'; -import { createSharedLinkModel } from './sharedLink'; -import { createToolCallModel } from './toolCall'; -import { createMemoryModel } from './memory'; -import { createAccessRoleModel } from './accessRole'; -import { createAclEntryModel } from './aclEntry'; +import { createAgentCategoryModel } from './agentCategory'; +import { createChatProjectModel } from './chatProject'; +import { createAgentApiKeyModel } from './agentApiKey'; +import { createTransactionModel } from './transaction'; +import { createPromptGroupModel } from './promptGroup'; import { createSystemGrantModel } from './systemGrant'; -import { createGroupModel } from './group'; +import { createPluginAuthModel } from './pluginAuth'; +import { createSharedLinkModel } from './sharedLink'; +import { createAccessRoleModel } from './accessRole'; +import { createMCPServerModel } from './mcpServer'; +import { createAssistantModel } from './assistant'; +import { createSkillFileModel } from './skillFile'; +import { createConversationModel } from './convo'; +import { createToolCallModel } from './toolCall'; +import { createAclEntryModel } from './aclEntry'; +import { createSessionModel } from './session'; +import { createBalanceModel } from './balance'; +import { createMessageModel } from './message'; +import { createActionModel } from './action'; +import { createBannerModel } from './banner'; +import { createPresetModel } from './preset'; +import { createPromptModel } from './prompt'; +import { createMemoryModel } from './memory'; import { createConfigModel } from './config'; +import { createTokenModel } from './token'; +import { createAgentModel } from './agent'; +import { createSkillModel } from './skill'; +import { createGroupModel } from './group'; +import { createUserModel } from './user'; +import { createRoleModel } from './role'; +import { createFileModel } from './file'; +import { createKeyModel } from './key'; /** * Creates all database models for all collections diff --git a/packages/data-schemas/src/models/skillSyncCredential.ts b/packages/data-schemas/src/models/skillSyncCredential.ts index 537fc7c541..0cad53ca6d 100644 --- a/packages/data-schemas/src/models/skillSyncCredential.ts +++ b/packages/data-schemas/src/models/skillSyncCredential.ts @@ -1,5 +1,5 @@ -import skillSyncCredentialSchema from '~/schema/skillSyncCredential'; import type { ISkillSyncCredentialDocument } from '~/types/skillSync'; +import skillSyncCredentialSchema from '~/schema/skillSyncCredential'; export function createSkillSyncCredentialModel(mongoose: typeof import('mongoose')) { // GitHub skill sync is intentionally app-wide in v1; credentials are referenced by diff --git a/packages/data-schemas/src/models/skillSyncStatus.ts b/packages/data-schemas/src/models/skillSyncStatus.ts index 408d8e7a18..8e5b0e2ec5 100644 --- a/packages/data-schemas/src/models/skillSyncStatus.ts +++ b/packages/data-schemas/src/models/skillSyncStatus.ts @@ -1,5 +1,5 @@ -import skillSyncStatusSchema from '~/schema/skillSyncStatus'; import type { ISkillSyncStatusDocument } from '~/types/skillSync'; +import skillSyncStatusSchema from '~/schema/skillSyncStatus'; export function createSkillSyncStatusModel(mongoose: typeof import('mongoose')) { // GitHub skill sync status supports app-wide YAML sources and tenant-scoped