135 lines
3.7 KiB
TypeScript
135 lines
3.7 KiB
TypeScript
import type { RpgAgentActionResponse, RpgAgentOperationRecord, RpgAgentSupportedAction, RpgAgentSuggestedAction } from './rpgAgentActions';
|
|
import type { RpgCreationAnchorContent } from './rpgAgentAnchors';
|
|
import type { RpgAgentAssetCoverageSummary, RpgAgentDraftCardDetail, RpgAgentDraftCardSummary } from './rpgAgentDraft';
|
|
import type { RpgCreationPreviewEnvelope } from './rpgCreationPreview';
|
|
|
|
/**
|
|
* RPG Agent 会话层契约。
|
|
* 这里承载 session 真相源与会话编排元数据,同时预留 resultPreview 与 supportedActions 两个后续主链字段。
|
|
*/
|
|
|
|
export interface RpgCreationIntentReadiness {
|
|
isReady: boolean;
|
|
completedKeys: string[];
|
|
missingKeys: string[];
|
|
}
|
|
|
|
export interface RpgAgentPendingClarification {
|
|
id: string;
|
|
label: string;
|
|
question: string;
|
|
targetKey:
|
|
| 'world_hook'
|
|
| 'player_premise'
|
|
| 'theme_and_tone'
|
|
| 'core_conflict'
|
|
| 'relationship_seed'
|
|
| 'iconic_element';
|
|
priority: number;
|
|
answer?: string;
|
|
}
|
|
|
|
export type RpgAgentStage =
|
|
| 'collecting_intent'
|
|
| 'clarifying'
|
|
| 'foundation_review'
|
|
| 'object_refining'
|
|
| 'visual_refining'
|
|
| 'long_tail_review'
|
|
| 'ready_to_publish'
|
|
| 'published'
|
|
| 'error';
|
|
|
|
export type RpgAgentMessageRole = 'user' | 'assistant' | 'system';
|
|
|
|
export type RpgAgentMessageKind =
|
|
| 'chat'
|
|
| 'clarification'
|
|
| 'summary'
|
|
| 'checkpoint'
|
|
| 'warning'
|
|
| 'action_result';
|
|
|
|
export interface RpgAgentMessage {
|
|
id: string;
|
|
role: RpgAgentMessageRole;
|
|
kind: RpgAgentMessageKind;
|
|
text: string;
|
|
createdAt: string;
|
|
relatedOperationId?: string | null;
|
|
}
|
|
|
|
export interface RpgAgentQualityFinding {
|
|
id: string;
|
|
severity: 'info' | 'warning' | 'blocker';
|
|
code: string;
|
|
targetId?: string | null;
|
|
message: string;
|
|
}
|
|
|
|
export interface RpgAgentSessionSnapshot {
|
|
sessionId: string;
|
|
currentTurn: number;
|
|
anchorContent: RpgCreationAnchorContent;
|
|
progressPercent: number;
|
|
lastAssistantReply: string | null;
|
|
stage: RpgAgentStage;
|
|
focusCardId: string | null;
|
|
creatorIntent: Record<string, unknown> | null;
|
|
creatorIntentReadiness: RpgCreationIntentReadiness;
|
|
anchorPack: Record<string, unknown> | null;
|
|
lockState: Record<string, unknown> | null;
|
|
draftProfile: Record<string, unknown> | null;
|
|
messages: RpgAgentMessage[];
|
|
draftCards: RpgAgentDraftCardSummary[];
|
|
pendingClarifications: RpgAgentPendingClarification[];
|
|
suggestedActions: RpgAgentSuggestedAction[];
|
|
recommendedReplies: string[];
|
|
qualityFindings: RpgAgentQualityFinding[];
|
|
assetCoverage: RpgAgentAssetCoverageSummary;
|
|
/**
|
|
* checkpoint 元数据需要进入 session snapshot 主链,
|
|
* 这样前端后续才能拿到真实可回滚目标,而不是只能盲发 checkpointId。
|
|
*/
|
|
checkpoints?: Array<{
|
|
checkpointId: string;
|
|
createdAt: string;
|
|
label: string;
|
|
}>;
|
|
/**
|
|
* 后续由工作包 E 的 action registry 真实填充。
|
|
* 当前保持可选,确保主链迁移期间不影响旧 session snapshot。
|
|
*/
|
|
supportedActions?: RpgAgentSupportedAction[];
|
|
/**
|
|
* 后续由服务端 preview compiler 输出。
|
|
* 当前保持可选,允许前端兼容层继续走 legacy profile。
|
|
*/
|
|
resultPreview?: RpgCreationPreviewEnvelope | null;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CreateRpgAgentSessionRequest {
|
|
seedText?: string;
|
|
}
|
|
|
|
export interface CreateRpgAgentSessionResponse {
|
|
session: RpgAgentSessionSnapshot;
|
|
}
|
|
|
|
export interface SendRpgAgentMessageRequest {
|
|
clientMessageId: string;
|
|
text: string;
|
|
quickFillRequested?: boolean;
|
|
focusCardId?: string | null;
|
|
selectedCardIds?: string[];
|
|
}
|
|
|
|
export interface SendRpgAgentMessageResponse extends RpgAgentActionResponse {
|
|
operation: RpgAgentOperationRecord;
|
|
}
|
|
|
|
export interface GetRpgAgentCardDetailResponse {
|
|
card: RpgAgentDraftCardDetail;
|
|
}
|