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>
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
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 {};
|
||||
Reference in New Issue
Block a user