595
},
596
execute(stateManager, chatUri, toolName, rawArgs): string {
598
>
// `ahp-chat` URI but sharing the same context/workspace. Comments belong
599
>
// to the session as a whole, so always resolve a chat URI back to its
600
>
// owning session and operate on the main session's annotations channel.
601
>
const mainSessionUri = parseChatUri(chatUri)?.session ?? chatUri;
602
>
const annotationsUri = buildAnnotationsUri(mainSessionUri);
603
>
const snapshot = stateManager.getSnapshot(annotationsUri);
604
>
const state: AnnotationsState = (snapshot?.state as AnnotationsState | undefined) ?? { annotations: [] };
605
>
const outcome = applyFeedbackTool(state, mainSessionUri, toolName, rawArgs);
606
>
for (const action of outcome.actions) {
607
>
stateManager.dispatchServerAction(annotationsUri, action);
608
>
}
609
>
return outcome.result;
610
>
},
611
};