feat(coding-agent): added /fork command to duplicate current session

Creates a new session file with the exact same state as the current session,
including all entries (messages, model changes, compactions, etc.) and
artifacts. The new session's parentSession field links to the original.

- Added fork() method to SessionManager that creates new session file with copied entries
- Added fork() method to AgentSession that handles artifact directory copying
- Added /fork command handler in input-controller and command-controller
- Extended session switch event reason type to include 'fork'
This commit is contained in:
can1357
2026-01-28 01:17:58 +01:00
parent 938beca49e
commit b135c4567d
9 changed files with 160 additions and 4 deletions
@@ -269,6 +269,11 @@ export class InputController {
await this.ctx.handleClearCommand();
return;
}
if (text === "/fork") {
this.ctx.editor.setText("");
await this.ctx.handleForkCommand();
return;
}
if (text === "/compact" || text.startsWith("/compact ")) {
const customInstructions = text.startsWith("/compact ") ? text.slice(9).trim() : undefined;
this.ctx.editor.setText("");