Files
dsh-telegram-channel/lib/history.d.ts
T
owoandCursor fb5a334edb feat: /last and bind button for previous Q/A context (v0.3.4)
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>
2026-08-14 20:25:07 +08:00

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 {};