fix(headless): scope default list_messages to default conversation (#1103)
This commit is contained in:
@@ -49,6 +49,7 @@ export interface ListMessagesHandlerClient {
|
||||
order: "asc" | "desc";
|
||||
before?: string;
|
||||
after?: string;
|
||||
conversation_id?: "default";
|
||||
},
|
||||
): Promise<AgentsMessagesPage>;
|
||||
};
|
||||
@@ -114,6 +115,7 @@ export async function handleListMessages(
|
||||
const page = await client.agents.messages.list(route.agentId, {
|
||||
limit,
|
||||
order,
|
||||
conversation_id: "default",
|
||||
...cursorOpts,
|
||||
});
|
||||
items = page.items;
|
||||
|
||||
@@ -197,9 +197,11 @@ describe("handleListMessages — API call arguments", () => {
|
||||
const opts = agentListSpy.mock.calls[0]?.[1] as {
|
||||
limit: number;
|
||||
order: string;
|
||||
conversation_id?: string;
|
||||
};
|
||||
expect(opts.limit).toBe(50);
|
||||
expect(opts.order).toBe("desc");
|
||||
expect(opts.conversation_id).toBe("default");
|
||||
});
|
||||
|
||||
test("forwards before cursor to conversations path", async () => {
|
||||
@@ -232,8 +234,12 @@ describe("handleListMessages — API call arguments", () => {
|
||||
client,
|
||||
});
|
||||
|
||||
const opts = agentListSpy.mock.calls[0]?.[1] as { before?: string };
|
||||
const opts = agentListSpy.mock.calls[0]?.[1] as {
|
||||
before?: string;
|
||||
conversation_id?: string;
|
||||
};
|
||||
expect(opts.before).toBe("msg-cursor-agents");
|
||||
expect(opts.conversation_id).toBe("default");
|
||||
});
|
||||
|
||||
test("does not include before/after when absent", async () => {
|
||||
|
||||
Reference in New Issue
Block a user