LibreChat/api/server/controllers/agents
Danny Avila 5a8700643c
perf: Build the Memory Message Copy Only When Something Reads It (#15164)
buildMessages formatted every history row twice per turn — a prompt
copy and a memory copy — then discarded the entire memory payload
unless some row carried fileContext, which is the rare case. The
memory copy has exactly two consumers: that payload, and the canonical
recount of a row, where it is content-identical to the prompt copy
unless the row itself has fileContext. So the prompt copy is now the
recount surface for context-free rows, a fileContext row builds its
memory copy at recount time, and the full memory payload is assembled
in a deferred pass — same formatting, same per-row merge order — only
once a row has proven the payload will be kept. The common turn
formats each row once instead of twice and no longer allocates a
payload it throws away.

Also forwards the run's useLegacyContent to formatAgentMessages as the
new legacyContent option, inert on the current SDK release: once the
SDK change ships, text history is emitted pre-flattened so the
per-request legacy projection stops cloning every message and the
context meter's identity-based count reuse holds across the
projection.
2026-08-24 10:33:47 -04:00
..
__tests__ 📇 feat: Surface Event Child Activity Through a Bounded Parent Index (#15142) 2026-08-23 18:50:00 -04:00
callbacks.background.spec.js 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
callbacks.js 📇 feat: Surface Event Child Activity Through a Bounded Parent Index (#15142) 2026-08-23 18:50:00 -04:00
client.js perf: Build the Memory Message Copy Only When Something Reads It (#15164) 2026-08-24 10:33:47 -04:00
client.test.js perf: Build the Memory Message Copy Only When Something Reads It (#15164) 2026-08-24 10:33:47 -04:00
errors.js
filterAuthorizedTools.spec.js 🔗 fix: Resolve MCP Tool-Key Boundary Against Configured Server Names (#14448) 2026-07-27 14:45:38 -04:00
openai.js 🧾 fix: Report Complete Agents API Usage (#15127) 2026-08-23 02:37:09 -04:00
protocol.js feat: Reliable Interrupt & Steer Escalation and Recovery (#14558) 2026-07-31 20:07:56 -04:00
recordCollectedUsage.spec.js
request.js 📇 feat: Surface Event Child Activity Through a Bounded Parent Index (#15142) 2026-08-23 18:50:00 -04:00
responses.js 🧾 fix: Report Complete Agents API Usage (#15127) 2026-08-23 02:37:09 -04:00
resume.js 📇 feat: Surface Event Child Activity Through a Bounded Parent Index (#15142) 2026-08-23 18:50:00 -04:00
steer.js 🛰️ feat: Execute Generic Agent Trigger Deliveries (#14921) 2026-08-17 08:45:49 -04:00
v1.js 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
v1.spec.js 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00