@hej / sigit / commits / c981188

Add support for session forking via unstable ACP feature

Seto Elkahfi committed Apr 24, 2026 at 02:04 UTC c981188eede82b1256ed18cc0ea35ab7ea7c70e5
2 files changed +27 -5
Cargo.toml
+1 -1
@@ -18,7 +18,7 @@ path = "src/main.rs"
18
19 [dependencies]
20 # ACP protocol SDK
21 -agent-client-protocol = "0.10.4"
21 +agent-client-protocol = { version = "0.10.4", features = ["unstable_session_fork"] }
22
23 # Onde Inference engine (local LLM)
24 onde = { path = "../onde" }
src/main.rs
+26 -4
@@ -42,9 +42,10 @@ use onde::inference::SamplingConfig;
42 use agent_client_protocol::{
43 Agent, AgentCapabilities, AgentSideConnection, AuthMethod, AuthMethodAgent,
44 AuthenticateRequest, AuthenticateResponse, CancelNotification, Client, ContentBlock,
45 - ContentChunk, Implementation, InitializeRequest, InitializeResponse, LoadSessionRequest,
46 - LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse,
47 - ProtocolVersion, SessionId, SessionNotification, SessionUpdate, StopReason,
45 + ContentChunk, ForkSessionRequest, ForkSessionResponse, Implementation, InitializeRequest,
46 + InitializeResponse, LoadSessionRequest, LoadSessionResponse, NewSessionRequest,
47 + NewSessionResponse, PromptRequest, PromptResponse, ProtocolVersion, SessionCapabilities,
48 + SessionForkCapabilities, SessionId, SessionNotification, SessionUpdate, StopReason,
49 };
50 use futures::future::LocalBoxFuture;
51 use onde::inference::{ChatEngine, GgufModelConfig, ToolDefinition, ToolResult};
@@ -121,7 +122,13 @@ impl Agent for SiGitAgent {
122 .auth_methods(vec![AuthMethod::Agent(AuthMethodAgent::new(
123 "sigit", "siGit",
124 ))])
124 - .agent_capabilities(AgentCapabilities::default().load_session(true)))
125 + .agent_capabilities(
126 + AgentCapabilities::default()
127 + .load_session(true)
128 + .session_capabilities(
129 + SessionCapabilities::new().fork(SessionForkCapabilities::new()),
130 + ),
131 + ))
132 }
133
134 async fn authenticate(
@@ -145,6 +152,21 @@ impl Agent for SiGitAgent {
152 Ok(LoadSessionResponse::new())
153 }
154
155 + async fn fork_session(
156 + &self,
157 + args: ForkSessionRequest,
158 + ) -> agent_client_protocol::Result<ForkSessionResponse> {
159 + let new_id = SessionId::new(uuid::Uuid::new_v4().to_string());
160 + log::info!("fork_session: from={} new={new_id}", args.session_id);
161 +
162 + // siGit doesn't persist history, so a fork is effectively a fresh
163 + // session — clear the conversation and let the user start over from
164 + // their edited message.
165 + self.engine.clear_history().await;
166 +
167 + Ok(ForkSessionResponse::new(new_id))
168 + }
169 +
170 async fn new_session(
171 &self,
172 _args: NewSessionRequest,