mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
* feat: resolve executing agent ids in MCP header templates
* test: preserve MCP config source literal types
* 🪪 feat: Forward the Active Agent Id in Request Header Placeholders
A gateway in front of LibreChat sees the user, the conversation and the
message, but not which agent is running — so it cannot attribute spend per
agent, apply per-agent limits, or tell agent traffic from plain chat. Adds
`{{LIBRECHAT_AGENT_ID}}` as its own namespace beside the user / body / OpenID
ones, resolving wherever the existing request placeholders already work.
The value is the primary agent's, derived once per run, so subagent steps and
auxiliary calls (summarization, titles, activity labels, memory extraction)
forward the id of the turn they belong to rather than their own. Only
persisted agents resolve: ephemeral ids embed user-authored preset text that
is unsafe in a header value, so ephemeral runs and non-agent requests resolve
to an empty value rather than forwarding literal template text.
No behaviour change unless the placeholder is configured. The MCP surface
(#14303) is not covered — its connection classification derives from
`ALLOWED_BODY_FIELDS`, so a new namespace needs a follow-up.
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| __tests__ | ||
| callbacks.background.spec.js | ||
| callbacks.js | ||
| client.codeDecision.spec.js | ||
| client.imageDetail.spec.js | ||
| client.js | ||
| client.test.js | ||
| filterAuthorizedTools.spec.js | ||
| openai.js | ||
| promotion.js | ||
| protocol.js | ||
| queuedTurns.js | ||
| recordCollectedUsage.spec.js | ||
| request.js | ||
| responses.js | ||
| resume.js | ||
| steer.js | ||
| v1.js | ||
| v1.spec.js | ||