mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 21:03:19 +00:00
Change branch() to use entryId instead of entryIndex
- AgentSession.branch(entryId: string) now takes entry ID - SessionBeforeBranchEvent.entryId replaces entryIndex - getUserMessagesForBranching() returns entryId - Update RPC types and client - Update UserMessageSelectorComponent - Update hook examples and tests - Update docs (hooks.md, sdk.md)
This commit is contained in:
parent
027d39aa33
commit
8e1e99ca05
12 changed files with 64 additions and 50 deletions
|
|
@ -83,7 +83,7 @@ describe.skipIf(!API_KEY)("AgentSession branching", () => {
|
|||
expect(userMessages[0].text).toBe("Say hello");
|
||||
|
||||
// Branch from the first message
|
||||
const result = await session.branch(userMessages[0].entryIndex);
|
||||
const result = await session.branch(userMessages[0].entryId);
|
||||
expect(result.selectedText).toBe("Say hello");
|
||||
expect(result.cancelled).toBe(false);
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ describe.skipIf(!API_KEY)("AgentSession branching", () => {
|
|||
expect(session.messages.length).toBeGreaterThan(0);
|
||||
|
||||
// Branch from the first message
|
||||
const result = await session.branch(userMessages[0].entryIndex);
|
||||
const result = await session.branch(userMessages[0].entryId);
|
||||
expect(result.selectedText).toBe("Say hi");
|
||||
expect(result.cancelled).toBe(false);
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ describe.skipIf(!API_KEY)("AgentSession branching", () => {
|
|||
|
||||
// Branch from second message (keeps first message + response)
|
||||
const secondMessage = userMessages[1];
|
||||
const result = await session.branch(secondMessage.entryIndex);
|
||||
const result = await session.branch(secondMessage.entryId);
|
||||
expect(result.selectedText).toBe("Say two");
|
||||
|
||||
// After branching, should have first user message + assistant response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue