mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-21 07:36:25 +00:00
🗿 feat: Add Attached Stateful Code Environments (#15352)
* feat: add attached stateful code environments * fix: include code environment in lazy agent type * fix: harden stateful environment routing * fix: complete code environment route isolation * fix: declare code environment map type * fix: preserve configured code execution routes * fix: harden stateful environment updates * test: assert route-scoped sandbox readiness * fix: harden stateful environment lifecycle * fix: isolate migrated code sessions * test: assert route-qualified code sessions
This commit is contained in:
parent
dc77b78d3e
commit
c1cb591d49
59 changed files with 1433 additions and 103 deletions
|
|
@ -785,6 +785,8 @@ async function loadToolDefinitionsWrapper({
|
|||
enabledCapabilities.has(AgentCapabilities.stateful_code_sessions) &&
|
||||
agent.stateful_code_sessions === true,
|
||||
environment: agent.stateful_code_environment,
|
||||
environmentId: agent.code_environment_id,
|
||||
environments: req.config?.endpoints?.agents?.statefulCodeSessions?.environments,
|
||||
userId: req.user.id,
|
||||
agentId: agent.id,
|
||||
conversationId: runtimeRequestBody?.conversationId,
|
||||
|
|
@ -1392,6 +1394,7 @@ async function loadToolDefinitionsWrapper({
|
|||
agentResourceType,
|
||||
codeApiBaseUrl: resolvedCodeExecutionContext.baseUrl,
|
||||
executionProfile: resolvedCodeExecutionContext.executionProfile,
|
||||
executionRouteKey: resolvedCodeExecutionContext.executionRouteKey,
|
||||
});
|
||||
if (toolContext) {
|
||||
dynamicToolContextMap[Tools.execute_code] = toolContext;
|
||||
|
|
@ -1642,6 +1645,8 @@ async function loadAgentTools({
|
|||
resolveCodeExecutionContext({
|
||||
statefulSessions: statefulCodeSessions,
|
||||
environment: agent.stateful_code_environment,
|
||||
environmentId: agent.code_environment_id,
|
||||
environments: req.config?.endpoints?.agents?.statefulCodeSessions?.environments,
|
||||
userId: req.user.id,
|
||||
agentId: agent.id,
|
||||
conversationId: requestBody?.conversationId ?? req.body?.conversationId,
|
||||
|
|
@ -2022,6 +2027,8 @@ async function loadToolsForExecution({
|
|||
const codeExecutionContext = resolveCodeExecutionContext({
|
||||
statefulSessions: statefulCodeSessions,
|
||||
environment: agent?.stateful_code_environment,
|
||||
environmentId: agent?.code_environment_id,
|
||||
environments: req.config?.endpoints?.agents?.statefulCodeSessions?.environments,
|
||||
userId: req.user.id,
|
||||
agentId: agent?.id,
|
||||
conversationId: conversationId ?? runtimeRequestBody?.conversationId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue