mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 08:02:17 +00:00
feat(coding-agent): add switchSession to Extension API (#1191)
Allows extension commands to programmatically switch to a different session file via ctx.switchSession(sessionPath). fixes #1187
This commit is contained in:
parent
0d934091f4
commit
d0228412d6
7 changed files with 24 additions and 0 deletions
|
|
@ -1059,6 +1059,10 @@ export class InteractiveMode {
|
|||
|
||||
return { cancelled: false };
|
||||
},
|
||||
switchSession: async (sessionPath) => {
|
||||
await this.handleResumeSession(sessionPath);
|
||||
return { cancelled: false };
|
||||
},
|
||||
},
|
||||
shutdownHandler: () => {
|
||||
this.shutdownRequested = true;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ export async function runPrintMode(session: AgentSession, options: PrintModeOpti
|
|||
});
|
||||
return { cancelled: result.cancelled };
|
||||
},
|
||||
switchSession: async (sessionPath) => {
|
||||
const success = await session.switchSession(sessionPath);
|
||||
return { cancelled: !success };
|
||||
},
|
||||
},
|
||||
onError: (err) => {
|
||||
console.error(`Extension error (${err.extensionPath}): ${err.error}`);
|
||||
|
|
|
|||
|
|
@ -277,6 +277,10 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
});
|
||||
return { cancelled: result.cancelled };
|
||||
},
|
||||
switchSession: async (sessionPath) => {
|
||||
const success = await session.switchSession(sessionPath);
|
||||
return { cancelled: !success };
|
||||
},
|
||||
},
|
||||
shutdownHandler: () => {
|
||||
shutdownRequested = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue