fix: migrate default conversation API usage to SDK 1.7.11 pattern (#1256)
Co-authored-by: Letta Code <noreply@letta.com>
This commit is contained in:
@@ -5819,11 +5819,12 @@ export default function App({
|
||||
// causing CONFLICT on the next user message.
|
||||
getClient()
|
||||
.then((client) => {
|
||||
const cancelId =
|
||||
conversationIdRef.current === "default"
|
||||
? agentIdRef.current
|
||||
: conversationIdRef.current;
|
||||
return client.conversations.cancel(cancelId);
|
||||
if (conversationIdRef.current === "default") {
|
||||
return client.conversations.cancel("default", {
|
||||
agent_id: agentIdRef.current,
|
||||
});
|
||||
}
|
||||
return client.conversations.cancel(conversationIdRef.current);
|
||||
})
|
||||
.catch(() => {
|
||||
// Silently ignore - cancellation already happened client-side
|
||||
@@ -5938,11 +5939,12 @@ export default function App({
|
||||
// Don't wait for it or show errors since user already got feedback
|
||||
getClient()
|
||||
.then((client) => {
|
||||
const cancelId =
|
||||
conversationIdRef.current === "default"
|
||||
? agentIdRef.current
|
||||
: conversationIdRef.current;
|
||||
return client.conversations.cancel(cancelId);
|
||||
if (conversationIdRef.current === "default") {
|
||||
return client.conversations.cancel("default", {
|
||||
agent_id: agentIdRef.current,
|
||||
});
|
||||
}
|
||||
return client.conversations.cancel(conversationIdRef.current);
|
||||
})
|
||||
.catch(() => {
|
||||
// Silently ignore - cancellation already happened client-side
|
||||
@@ -5962,11 +5964,13 @@ export default function App({
|
||||
setInterruptRequested(true);
|
||||
try {
|
||||
const client = await getClient();
|
||||
const cancelId =
|
||||
conversationIdRef.current === "default"
|
||||
? agentIdRef.current
|
||||
: conversationIdRef.current;
|
||||
await client.conversations.cancel(cancelId);
|
||||
if (conversationIdRef.current === "default") {
|
||||
await client.conversations.cancel("default", {
|
||||
agent_id: agentIdRef.current,
|
||||
});
|
||||
} else {
|
||||
await client.conversations.cancel(conversationIdRef.current);
|
||||
}
|
||||
|
||||
if (abortControllerRef.current) {
|
||||
abortControllerRef.current.abort();
|
||||
@@ -6174,9 +6178,7 @@ export default function App({
|
||||
// Build success message
|
||||
const agentLabel = agent.name || targetAgentId;
|
||||
const isSpecificConv =
|
||||
opts?.conversationId &&
|
||||
opts.conversationId !== "default" &&
|
||||
!opts?.conversationId.startsWith("agent-");
|
||||
opts?.conversationId && opts.conversationId !== "default";
|
||||
const successOutput = isSpecificConv
|
||||
? [
|
||||
`Switched to **${agentLabel}**`,
|
||||
@@ -8047,13 +8049,17 @@ export default function App({
|
||||
}
|
||||
: undefined;
|
||||
|
||||
const compactId =
|
||||
conversationIdRef.current === "default"
|
||||
? agentId
|
||||
: conversationIdRef.current;
|
||||
const compactConversationId = conversationIdRef.current;
|
||||
const compactBody =
|
||||
compactConversationId === "default"
|
||||
? {
|
||||
agent_id: agentId,
|
||||
...(compactParams ?? {}),
|
||||
}
|
||||
: compactParams;
|
||||
const result = await client.conversations.messages.compact(
|
||||
compactId,
|
||||
compactParams,
|
||||
compactConversationId,
|
||||
compactBody,
|
||||
);
|
||||
|
||||
// Format success message with before/after counts and summary
|
||||
|
||||
@@ -177,9 +177,7 @@ export const AgentInfoBar = memo(function AgentInfoBar({
|
||||
{/* Phantom alien row + Conversation ID */}
|
||||
<Box>
|
||||
<Text>{alienLines[3]}</Text>
|
||||
{conversationId &&
|
||||
conversationId !== "default" &&
|
||||
!conversationId.startsWith("agent-") ? (
|
||||
{conversationId && conversationId !== "default" ? (
|
||||
<Box width={rightWidth} flexShrink={1}>
|
||||
<Text dimColor wrap="truncate-end">
|
||||
{truncateText(conversationId, rightWidth)}
|
||||
|
||||
@@ -243,8 +243,9 @@ export function ConversationSelector({
|
||||
if (!afterCursor) {
|
||||
try {
|
||||
const defaultMessages = await client.conversations.messages.list(
|
||||
agentId,
|
||||
"default",
|
||||
{
|
||||
agent_id: agentId,
|
||||
limit: 20,
|
||||
order: "desc",
|
||||
},
|
||||
|
||||
@@ -180,7 +180,7 @@ export async function discoverFallbackRunIdForResume(
|
||||
}> = [];
|
||||
|
||||
if (ctx.conversationId === "default") {
|
||||
// Default conversation routes through resolvedConversationId (typically agent ID).
|
||||
// Default conversation lookup by conversation id first.
|
||||
lookupQueries.push({ conversation_id: ctx.resolvedConversationId });
|
||||
} else {
|
||||
// Named conversation: first use the explicit conversation id.
|
||||
|
||||
@@ -159,7 +159,8 @@ export async function runMessagesSubcommand(argv: string[]): Promise<number> {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const response = await client.conversations.messages.list(agentId, {
|
||||
const response = await client.conversations.messages.list("default", {
|
||||
agent_id: agentId,
|
||||
limit: parseLimit(parsed.values.limit, 20),
|
||||
after: parsed.values.after,
|
||||
before: parsed.values.before,
|
||||
|
||||
Reference in New Issue
Block a user