mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Refresh thread recency after turn start
This commit is contained in:
parent
e74b118d04
commit
a24a56fabf
2 changed files with 14 additions and 8 deletions
|
|
@ -214,13 +214,17 @@ const STREAM_UPDATE_PLANNERS = {
|
|||
} satisfies ServerNotificationStatePlannerMap<StreamUpdateNotificationMethod>;
|
||||
|
||||
const TURN_LIFECYCLE_PLANNERS = {
|
||||
"turn/started": (state, notification) =>
|
||||
actionPlan({
|
||||
type: "turn/started",
|
||||
threadId: notification.params.threadId,
|
||||
turnId: notification.params.turn.id,
|
||||
items: messageStreamItemsWithPendingPromptSubmitHooks(state, notification.params.turn.id),
|
||||
}),
|
||||
"turn/started": (state, notification) => ({
|
||||
actions: [
|
||||
{
|
||||
type: "turn/started",
|
||||
threadId: notification.params.threadId,
|
||||
turnId: notification.params.turn.id,
|
||||
items: messageStreamItemsWithPendingPromptSubmitHooks(state, notification.params.turn.id),
|
||||
},
|
||||
],
|
||||
effects: [{ type: "refresh-threads" }],
|
||||
}),
|
||||
"turn/completed": (state, notification) => {
|
||||
if (activeTurnId(state) !== notification.params.turn.id) return EMPTY_PLAN;
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -466,7 +466,8 @@ describe("ChatInboundHandler", () => {
|
|||
status: "completed",
|
||||
},
|
||||
]);
|
||||
const handler = handlerForState(state);
|
||||
const refreshActiveThreads = vi.fn();
|
||||
const handler = handlerForState(state, { refreshActiveThreads });
|
||||
|
||||
handler.handleNotification({
|
||||
method: "turn/started",
|
||||
|
|
@ -488,6 +489,7 @@ describe("ChatInboundHandler", () => {
|
|||
expect(chatStateMessageStreamItems(handler.currentState()).map((item) => item.id)).toEqual(["local-user-1", "hook-hook-1-1"]);
|
||||
expect(chatStateMessageStreamItems(handler.currentState())[1]).toMatchObject({ id: "hook-hook-1-1", turnId: "turn-active" });
|
||||
expect(pendingTurnStart(handler.currentState())).toBeNull();
|
||||
expect(refreshActiveThreads).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("moves pre-turn hook runs after the optimistic user message when a turn id is assigned", () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue