feat(chat): add one-click Plaza publish for HTML page messages.

Speed up the quick-plaza path with session snapshot reads, publish timeouts, and a modal fix so parent re-renders no longer abort in-flight requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-05 19:28:36 +08:00
parent 53eb0014ba
commit 3318c04490
11 changed files with 766 additions and 140 deletions
+30
View File
@@ -64,6 +64,7 @@ import type { AgentRunCreateOptions, AgentRunValidation } from '../utils/agentRu
const API = '/api';
const DEFAULT_API_TIMEOUT_MS = 20_000;
const AGENT_CONNECT_TIMEOUT_MS = 60_000;
const QUICK_PLAZA_TIMEOUT_MS = 120_000;
const AGENT_RUNS_PATH = '/agent/runs';
export type AgentRun = {
@@ -1086,6 +1087,35 @@ export async function quickShareFromChat(input: {
return result.data;
}
export async function quickPlazaFromChat(input: {
sessionId: string;
messageId: string;
selectedLinkIndex?: number;
}, signal?: AbortSignal): Promise<{
pageId: string;
publicationId: string;
publicUrl: string | null;
post: PlazaPostBrief;
}> {
const result = await apiFetch<{
data: {
pageId: string;
publicationId: string;
publicUrl: string | null;
post: PlazaPostBrief;
};
}>('/mindspace/v1/pages/quick-plaza-from-chat', {
method: 'POST',
body: JSON.stringify({
session_id: input.sessionId,
message_id: input.messageId,
selected_link_index: input.selectedLinkIndex ?? 0,
}),
signal,
}, { timeoutMs: QUICK_PLAZA_TIMEOUT_MS });
return result.data;
}
export async function downloadChatMessageDocx(input: {
sessionId: string;
messageId: string;