LibreChat/api/server/services/ChannelAuthority.js
Dustin Healy 8596615d1d
🌐 feat: Wire Responses and Channel Lifecycle APIs (#17611)
* 🌐 feat: Wire Responses and Channel Lifecycle APIs

* fix: Align Channel Application Policy and Source Authority

* fix: Preserve Configured App Budgets in Canonical Response Commits

* Expose Fenced Channel Receipt Reconciliation Routes

* fix: Keep Ordinary Chat Capture In Its Existing Owner

* fix(channels): scope worker authority and defer browser activation

* fix(responses): gate admission on canonical queue readiness

* fix: Recover Durable Response Dispatch Across Queue Shutdown

* fix: Preserve Upstream Endpoint Config Insertions

* test: Align Channel Runtime Configuration Contract
2026-11-10 21:04:03 -08:00

40 lines
1.3 KiB
JavaScript

const {
createChannelApplicationAuthority,
createChannelApplicationPolicy,
encryptCredential,
decryptCredential,
} = require('@librechat/api');
const {
createChannelIdentityStorage,
createChannelRunStorage,
createResponseStorage,
} = require('@librechat/data-schemas');
const mongoose = require('mongoose');
const { getAppConfig } = require('./Config');
const { getEffectivePermissions } = require('./PermissionService');
const db = require('~/models');
module.exports = createChannelApplicationAuthority({
storage: createChannelRunStorage(mongoose),
policy: createChannelApplicationPolicy({
readAppConfig: getAppConfig,
findUser: db.findUser,
isPrincipalActive: db.isAgentTriggerPrincipalActive,
}),
channels: db,
identityStorage: createChannelIdentityStorage(mongoose),
findUser: (id) => db.findUser({ _id: id }),
getRole: db.getRoleByName,
isPrincipalActive: db.isAgentTriggerPrincipalActive,
access: { getAgent: db.getAgent, getEffectivePermissions },
credentials: {
encrypt: encryptCredential,
decrypt: decryptCredential,
responses: createResponseStorage(mongoose, {
getMCPAppMessageBudget: db.getMCPAppMessageBudget,
}),
createKey: db.createAgentApiKey,
getKey: db.getAgentApiKeyById,
deleteKey: db.deleteAgentApiKey,
},
});