After attaching a session, show a button and /last command that load the latest human/assistant turn via session.history so phone users can continue with context. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
926 B
TypeScript
29 lines
926 B
TypeScript
import type { Context } from '@deepseek-ai/cordis';
|
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
export interface LastTurn {
|
|
userText?: string;
|
|
assistantText?: string;
|
|
}
|
|
type LooseEvent = {
|
|
type?: string;
|
|
data?: {
|
|
source?: {
|
|
kind?: string;
|
|
};
|
|
content?: unknown;
|
|
message?: {
|
|
content?: unknown;
|
|
source?: {
|
|
kind?: string;
|
|
};
|
|
};
|
|
text?: string;
|
|
};
|
|
};
|
|
/** Extract the latest human Q + assistant A from a session event list. */
|
|
export declare function extractLastTurn(events: readonly LooseEvent[]): LastTurn;
|
|
export declare function formatLastTurn(turn: LastTurn, maxEach?: number): string;
|
|
/** Load last Q/A for a bound session (apiProxy history, else live agent events). */
|
|
export declare function loadLastTurn(ctx: Context, sessionId: string, agent?: Agent): Promise<LastTurn>;
|
|
export {};
|