Preserve partial creation replies on stream failure
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
kdletters
2026-05-05 11:31:50 +08:00
parent 100fee7e7a
commit 995661e7cc
299 changed files with 13805 additions and 1429 deletions

View File

@@ -0,0 +1,100 @@
/**
* 方洞挑战创作 Agent 共享契约。
* 字段按 HTTP facade 的 camelCase DTO 命名,后端领域层 snake_case 字段由 facade 映射。
*/
export type SquareHoleCreationStage =
| 'collecting_config'
| 'draft_ready'
| string;
export type SquareHoleAnchorStatus =
| 'confirmed'
| 'missing'
| 'inferred'
| string;
export interface CreateSquareHoleSessionRequest {
seedText?: string;
themeText?: string;
twistRule?: string;
shapeCount?: number;
difficulty?: number;
}
export interface SendSquareHoleMessageRequest {
clientMessageId: string;
text: string;
quickFillRequested?: boolean;
}
export interface ExecuteSquareHoleActionRequest {
action: string;
gameName?: string;
summary?: string;
tags?: string[];
coverImageSrc?: string | null;
}
export interface SquareHoleAnchorItemResponse {
key: string;
label: string;
value: string;
status: SquareHoleAnchorStatus;
}
export interface SquareHoleAnchorPackResponse {
theme: SquareHoleAnchorItemResponse;
twistRule: SquareHoleAnchorItemResponse;
shapeCount: SquareHoleAnchorItemResponse;
difficulty: SquareHoleAnchorItemResponse;
}
export interface SquareHoleCreatorConfig {
themeText: string;
twistRule: string;
shapeCount: number;
difficulty: number;
}
export interface SquareHoleResultDraft {
profileId: string;
gameName: string;
themeText: string;
twistRule: string;
summary: string;
tags: string[];
shapeCount: number;
difficulty: number;
publishReady: boolean;
blockers: string[];
}
export interface SquareHoleAgentMessage {
id: string;
role: 'user' | 'assistant' | 'system' | string;
kind: 'chat' | 'summary' | 'action_result' | 'warning' | string;
text: string;
createdAt: string;
}
export interface SquareHoleSessionSnapshot {
sessionId: string;
currentTurn: number;
progressPercent: number;
stage: SquareHoleCreationStage;
anchorPack: SquareHoleAnchorPackResponse;
config: SquareHoleCreatorConfig;
draft?: SquareHoleResultDraft | null;
messages: SquareHoleAgentMessage[];
lastAssistantReply?: string | null;
publishedProfileId?: string | null;
updatedAt: string;
}
export interface SquareHoleSessionResponse {
session: SquareHoleSessionSnapshot;
}
export interface SquareHoleActionResponse {
session: SquareHoleSessionSnapshot;
}