mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🔎 feat: Add Prompt and Agent Permissions Migration Checks (#9063)
* chore: fix mock typing in packages/api tests * chore: improve imports, type handling and method signatures for MCPServersRegistry * chore: use enum in migration scripts * chore: ParsedServerConfig type to enhance server configuration handling * feat: Implement agent permissions migration check and logging * feat: Integrate migration checks into server initialization process * feat: Add prompt permissions migration check and logging to server initialization * chore: move prompt formatting functions to dedicated prompts dir
This commit is contained in:
parent
e8ddd279fd
commit
e4e25aaf2b
17 changed files with 636 additions and 96 deletions
45
api/server/services/start/migration.js
Normal file
45
api/server/services/start/migration.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
const { logger } = require('@librechat/data-schemas');
|
||||
const {
|
||||
logAgentMigrationWarning,
|
||||
logPromptMigrationWarning,
|
||||
checkAgentPermissionsMigration,
|
||||
checkPromptPermissionsMigration,
|
||||
} = require('@librechat/api');
|
||||
const { getProjectByName } = require('~/models/Project');
|
||||
const { Agent, PromptGroup } = require('~/db/models');
|
||||
const { findRoleByIdentifier } = require('~/models');
|
||||
|
||||
/**
|
||||
* Check if permissions migrations are needed for shared resources
|
||||
* This runs at the end to ensure all systems are initialized
|
||||
*/
|
||||
async function checkMigrations() {
|
||||
try {
|
||||
const agentMigrationResult = await checkAgentPermissionsMigration({
|
||||
db: {
|
||||
findRoleByIdentifier,
|
||||
getProjectByName,
|
||||
},
|
||||
AgentModel: Agent,
|
||||
});
|
||||
logAgentMigrationWarning(agentMigrationResult);
|
||||
} catch (error) {
|
||||
logger.error('Failed to check agent permissions migration:', error);
|
||||
}
|
||||
try {
|
||||
const promptMigrationResult = await checkPromptPermissionsMigration({
|
||||
db: {
|
||||
findRoleByIdentifier,
|
||||
getProjectByName,
|
||||
},
|
||||
PromptGroupModel: PromptGroup,
|
||||
});
|
||||
logPromptMigrationWarning(promptMigrationResult);
|
||||
} catch (error) {
|
||||
logger.error('Failed to check prompt permissions migration:', error);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
checkMigrations,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue