mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 03:01:56 +00:00
fix(coding-agent): sync agent state after newSession setup callback
Move setup callback handling from interactive/rpc modes into AgentSession.newSession(). After setup() runs, sync agent state via replaceMessages() so the LLM has context and the UI renders the messages properly. fixes #968
This commit is contained in:
parent
0134a2a73d
commit
f86e3c3103
4 changed files with 25 additions and 15 deletions
|
|
@ -261,10 +261,8 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
commandContextActions: {
|
||||
waitForIdle: () => session.agent.waitForIdle(),
|
||||
newSession: async (options) => {
|
||||
const success = await session.newSession({ parentSession: options?.parentSession });
|
||||
if (success && options?.setup) {
|
||||
await options.setup(session.sessionManager);
|
||||
}
|
||||
// Delegate to AgentSession (handles setup + agent state sync)
|
||||
const success = await session.newSession(options);
|
||||
return { cancelled: !success };
|
||||
},
|
||||
fork: async (entryId) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue