fix(agent): simplify state API and update consumers fixes #2633

This commit is contained in:
Mario Zechner
2026-03-30 12:43:34 +02:00
parent 5e3852fc9c
commit cbe1a8b732
24 changed files with 829 additions and 1198 deletions

View File

@@ -446,7 +446,7 @@ function createRunner(sandboxConfig: SandboxConfig, channelId: string, channelDi
// Load existing messages
const loadedSession = sessionManager.buildSessionContext();
if (loadedSession.messages.length > 0) {
agent.replaceMessages(loadedSession.messages);
agent.state.messages = loadedSession.messages;
log.logInfo(`[${channelId}] Loaded ${loadedSession.messages.length} messages from context.jsonl`);
}
@@ -656,7 +656,7 @@ function createRunner(sandboxConfig: SandboxConfig, channelId: string, channelDi
// This picks up any messages synced above
const reloadedSession = sessionManager.buildSessionContext();
if (reloadedSession.messages.length > 0) {
agent.replaceMessages(reloadedSession.messages);
agent.state.messages = reloadedSession.messages;
log.logInfo(`[${channelId}] Reloaded ${reloadedSession.messages.length} messages from context`);
}
@@ -672,7 +672,7 @@ function createRunner(sandboxConfig: SandboxConfig, channelId: string, channelDi
ctx.users,
skills,
);
session.agent.setSystemPrompt(systemPrompt);
session.agent.state.systemPrompt = systemPrompt;
// Set up file upload function
setUploadFunction(async (filePath: string, title?: string) => {