mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 03:01:56 +00:00
Rename /branch command to /fork
- RPC: branch -> fork, get_branch_messages -> get_fork_messages - SDK: branch() -> fork(), getBranchMessages() -> getForkMessages() - AgentSession: branch() -> fork(), getUserMessagesForBranching() -> getUserMessagesForForking() - Extension events: session_before_branch -> session_before_fork, session_branch -> session_fork - Settings: doubleEscapeAction 'branch' -> 'fork' fixes #641
This commit is contained in:
parent
e7352a50bf
commit
df3f5f41c0
27 changed files with 162 additions and 156 deletions
|
|
@ -338,19 +338,19 @@ export class RpcClient {
|
|||
}
|
||||
|
||||
/**
|
||||
* Branch from a specific message.
|
||||
* Fork from a specific message.
|
||||
* @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)
|
||||
*/
|
||||
async branch(entryId: string): Promise<{ text: string; cancelled: boolean }> {
|
||||
const response = await this.send({ type: "branch", entryId });
|
||||
async fork(entryId: string): Promise<{ text: string; cancelled: boolean }> {
|
||||
const response = await this.send({ type: "fork", entryId });
|
||||
return this.getData(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messages available for branching.
|
||||
* Get messages available for forking.
|
||||
*/
|
||||
async getBranchMessages(): Promise<Array<{ entryId: string; text: string }>> {
|
||||
const response = await this.send({ type: "get_branch_messages" });
|
||||
async getForkMessages(): Promise<Array<{ entryId: string; text: string }>> {
|
||||
const response = await this.send({ type: "get_fork_messages" });
|
||||
return this.getData<{ messages: Array<{ entryId: string; text: string }> }>(response).messages;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -300,8 +300,8 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
}
|
||||
return { cancelled: !success };
|
||||
},
|
||||
branch: async (entryId) => {
|
||||
const result = await session.branch(entryId);
|
||||
fork: async (entryId) => {
|
||||
const result = await session.fork(entryId);
|
||||
return { cancelled: result.cancelled };
|
||||
},
|
||||
navigateTree: async (targetId, options) => {
|
||||
|
|
@ -508,14 +508,14 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
return success(id, "switch_session", { cancelled });
|
||||
}
|
||||
|
||||
case "branch": {
|
||||
const result = await session.branch(command.entryId);
|
||||
return success(id, "branch", { text: result.selectedText, cancelled: result.cancelled });
|
||||
case "fork": {
|
||||
const result = await session.fork(command.entryId);
|
||||
return success(id, "fork", { text: result.selectedText, cancelled: result.cancelled });
|
||||
}
|
||||
|
||||
case "get_branch_messages": {
|
||||
const messages = session.getUserMessagesForBranching();
|
||||
return success(id, "get_branch_messages", { messages });
|
||||
case "get_fork_messages": {
|
||||
const messages = session.getUserMessagesForForking();
|
||||
return success(id, "get_fork_messages", { messages });
|
||||
}
|
||||
|
||||
case "get_last_assistant_text": {
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ export type RpcCommand =
|
|||
| { id?: string; type: "get_session_stats" }
|
||||
| { id?: string; type: "export_html"; outputPath?: string }
|
||||
| { id?: string; type: "switch_session"; sessionPath: string }
|
||||
| { id?: string; type: "branch"; entryId: string }
|
||||
| { id?: string; type: "get_branch_messages" }
|
||||
| { id?: string; type: "fork"; entryId: string }
|
||||
| { id?: string; type: "get_fork_messages" }
|
||||
| { id?: string; type: "get_last_assistant_text" }
|
||||
|
||||
// Messages
|
||||
|
|
@ -149,11 +149,11 @@ export type RpcResponse =
|
|||
| { id?: string; type: "response"; command: "get_session_stats"; success: true; data: SessionStats }
|
||||
| { id?: string; type: "response"; command: "export_html"; success: true; data: { path: string } }
|
||||
| { id?: string; type: "response"; command: "switch_session"; success: true; data: { cancelled: boolean } }
|
||||
| { id?: string; type: "response"; command: "branch"; success: true; data: { text: string; cancelled: boolean } }
|
||||
| { id?: string; type: "response"; command: "fork"; success: true; data: { text: string; cancelled: boolean } }
|
||||
| {
|
||||
id?: string;
|
||||
type: "response";
|
||||
command: "get_branch_messages";
|
||||
command: "get_fork_messages";
|
||||
success: true;
|
||||
data: { messages: Array<{ entryId: string; text: string }> };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue