mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 04:30:59 +00:00
announce fork and ensure fork uses a new session id (#222)
Followup for https://github.com/zed-industries/claude-code-acp/pull/221 and https://github.com/zed-industries/claude-code-acp/pull/183.
This commit is contained in:
@@ -189,8 +189,7 @@ export class ClaudeAcpAgent implements Agent {
|
||||
sse: true,
|
||||
},
|
||||
sessionCapabilities: {
|
||||
// TODO: announce fork capability when sessionId handling is fixed
|
||||
// fork: {},
|
||||
fork: {},
|
||||
resume: {},
|
||||
},
|
||||
},
|
||||
@@ -595,7 +594,17 @@ export class ClaudeAcpAgent implements Agent {
|
||||
params: NewSessionRequest,
|
||||
creationOpts: { resume?: string; forkSession?: boolean } = {},
|
||||
): Promise<NewSessionResponse> {
|
||||
const sessionId = creationOpts.resume ?? randomUUID();
|
||||
// We want to create a new session id unless it is resume,
|
||||
// but not resume + forkSession.
|
||||
let sessionId;
|
||||
if (creationOpts.forkSession) {
|
||||
sessionId = randomUUID();
|
||||
} else if (creationOpts.resume) {
|
||||
sessionId = creationOpts.resume;
|
||||
} else {
|
||||
sessionId = randomUUID();
|
||||
}
|
||||
|
||||
const input = new Pushable<SDKUserMessage>();
|
||||
|
||||
const settingsManager = new SettingsManager(params.cwd, {
|
||||
|
||||
Reference in New Issue
Block a user