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:
Mario Zechner 2025-12-31 13:47:34 +01:00
parent 027d39aa33
commit 8e1e99ca05
12 changed files with 64 additions and 50 deletions

View file

@ -45,7 +45,7 @@ export default function (pi: HookAPI) {
pi.on("session_before_branch", async (event, ctx) => {
if (!ctx.hasUI) return;
const choice = await ctx.ui.select(`Branch from turn ${event.entryIndex}?`, [
const choice = await ctx.ui.select(`Branch from entry ${event.entryId.slice(0, 8)}?`, [
"Yes, create branch",
"No, stay in current session",
]);