Files
Genarrative/packages/shared/src/contracts/squareHoleAgent.ts
kdletters d06107f2c6
Some checks failed
CI / verify (push) Has been cancelled
落地方洞挑战图片与运行态交互
2026-05-06 12:52:47 +08:00

131 lines
3.1 KiB
TypeScript

/**
* 方洞挑战创作 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;
regenerateVisualAssets?: boolean;
visualAssetSlot?: 'cover' | 'background' | 'shape' | string | null;
visualAssetOptionId?: string | null;
}
export interface SquareHoleShapeOption {
optionId: string;
shapeKind: string;
label: string;
targetHoleId: string;
imagePrompt: string;
imageSrc?: string | null;
}
export interface SquareHoleHoleOption {
holeId: string;
holeKind: string;
label: string;
imagePrompt: string;
imageSrc?: 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;
shapeOptions: SquareHoleShapeOption[];
holeOptions: SquareHoleHoleOption[];
backgroundPrompt: string;
coverImageSrc?: string | null;
backgroundImageSrc?: string | null;
}
export interface SquareHoleResultDraft {
profileId: string;
gameName: string;
themeText: string;
twistRule: string;
summary: string;
tags: string[];
coverImageSrc?: string | null;
backgroundPrompt: string;
backgroundImageSrc?: string | null;
shapeOptions: SquareHoleShapeOption[];
holeOptions: SquareHoleHoleOption[];
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;
}