feat: use conversations endpoint for default conversation (#1206)

This commit is contained in:
cthomas
2026-02-27 15:37:15 -08:00
committed by GitHub
parent 841e2332f3
commit 0d5dab198a
13 changed files with 148 additions and 289 deletions

View File

@@ -28,10 +28,6 @@ export interface BootstrapMessagesPage {
getPaginatedItems(): unknown[];
}
export interface BootstrapAgentsPage {
items: unknown[];
}
export interface BootstrapHandlerClient {
conversations: {
messages: {
@@ -46,20 +42,6 @@ export interface BootstrapHandlerClient {
): Promise<BootstrapMessagesPage>;
};
};
agents: {
messages: {
list(
agentId: string,
opts: {
limit: number;
order: "asc" | "desc";
before?: string;
after?: string;
conversation_id?: "default";
},
): Promise<BootstrapAgentsPage>;
};
};
}
export interface BootstrapHandlerSessionContext {
@@ -115,22 +97,11 @@ export async function handleBootstrapSessionState(
);
const listStart = Date.now();
let items: unknown[];
if (route.kind === "conversations") {
const page = await client.conversations.messages.list(
route.conversationId,
{ limit, order },
);
items = page.getPaginatedItems();
} else {
const page = await client.agents.messages.list(route.agentId, {
limit,
order,
conversation_id: "default",
});
items = page.items;
}
const page = await client.conversations.messages.list(
route.conversationId,
{ limit, order },
);
const items = page.getPaginatedItems();
const listEnd = Date.now();
const hasMore = items.length >= limit;