mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
fix: record user messages for MCP-triggered agent prompts
Ensures MCP-originated prompts emit timeline events in real-time by calling recordUserMessage before starting agent runs. Fixes issue where messages sent via MCP tools only appeared after page refresh. - Add recordUserMessage call in send_agent_prompt tool - Add recordUserMessage call in create_coding_agent with initialPrompt - Both paths now mirror UI-sent message behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -195,6 +195,14 @@ export async function createAgentMcpServer(
|
||||
});
|
||||
|
||||
if (initialPrompt) {
|
||||
try {
|
||||
agentManager.recordUserMessage(snapshot.id, initialPrompt);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`[Agent MCP] Failed to record initial prompt for ${snapshot.id}:`,
|
||||
error
|
||||
);
|
||||
}
|
||||
try {
|
||||
startAgentRun(agentManager, snapshot.id, initialPrompt);
|
||||
} catch (error) {
|
||||
@@ -326,6 +334,15 @@ export async function createAgentMcpServer(
|
||||
await agentManager.setAgentMode(agentId, sessionMode);
|
||||
}
|
||||
|
||||
try {
|
||||
agentManager.recordUserMessage(agentId, prompt);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`[Agent MCP] Failed to record user message for ${agentId}:`,
|
||||
error
|
||||
);
|
||||
}
|
||||
|
||||
startAgentRun(agentManager, agentId, prompt);
|
||||
const snapshot = agentManager.getAgent(agentId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user