🔐 feat: Mint Code API Auth Tokens (#13028)

* feat: Mint CodeAPI auth tokens

* style: Format CodeAPI download route

* fix: Prune CodeAPI token cache

* fix: Propagate CodeAPI managed auth

* test: Mock CodeAPI auth in traversal suite

* fix: Pass auth context to invoked skill cache

* feat: Mint CodeAPI plan context

* chore: Refresh CodeAPI auth guidance

* fix: Guard OpenID JWT fallback

* fix: Default CodeAPI JWT tenant in single-tenant mode

* chore: Update @librechat/agents to version 3.1.84 in package-lock.json and package.json files

* chore: Standardize references to Code API in comments and tests
This commit is contained in:
Danny Avila 2026-05-09 16:09:10 -04:00 committed by GitHub
parent 8a654dc8b1
commit c67e2b54dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 973 additions and 58 deletions

View file

@ -21,6 +21,7 @@ const {
buildOAuthToolCallName,
buildToolClassification,
buildWebSearchDynamicContext,
getCodeApiAuthHeaders,
} = require('@librechat/api');
const {
Time,
@ -1009,6 +1010,7 @@ async function loadAgentTools({
agentId: agent.id,
agentToolOptions: agent.tool_options,
deferredToolsEnabled,
authHeaders: () => getCodeApiAuthHeaders(req),
});
const agentTools = [];
@ -1279,10 +1281,12 @@ async function loadToolsForExecution({
configurable.toolRegistry = toolRegistry;
try {
/**
* PTC auth is handled by the agents library / sandbox service
* directly; LibreChat no longer threads a per-run credential.
* LibreChat threads per-request Code API auth through the agents
* library so PTC calls share the same managed auth context.
*/
const ptcTool = createProgrammaticToolCallingTool({});
const ptcTool = createProgrammaticToolCallingTool({
authHeaders: () => getCodeApiAuthHeaders(req),
});
allLoadedTools.push(ptcTool);
} catch (error) {
logger.error('[loadToolsForExecution] Error creating PTC tool:', error);
@ -1292,7 +1296,9 @@ async function loadToolsForExecution({
const isBashTool = toolNames.includes(AgentConstants.BASH_TOOL);
if (isBashTool) {
try {
const bashTool = createBashExecutionTool({});
const bashTool = createBashExecutionTool({
authHeaders: () => getCodeApiAuthHeaders(req),
});
allLoadedTools.push(bashTool);
} catch (error) {
logger.error('[loadToolsForExecution] Failed to create bash_tool', error);