133 lines
3.4 KiB
TypeScript
133 lines
3.4 KiB
TypeScript
/**
|
|
* RPG Agent 动作与异步操作契约。
|
|
* 这里显式区分“建议动作”和“真实可执行动作”,为后续后端 registry 收口预留接口。
|
|
*/
|
|
|
|
export type RpgAgentSuggestedActionType =
|
|
| 'request_summary'
|
|
| 'draft_foundation'
|
|
| 'refine_focus_target'
|
|
| 'lock_current_target'
|
|
| 'generate_role_assets'
|
|
| 'generate_scene_assets'
|
|
| 'expand_long_tail'
|
|
| 'publish_world';
|
|
|
|
export interface RpgAgentSuggestedAction {
|
|
id: string;
|
|
type: RpgAgentSuggestedActionType;
|
|
label: string;
|
|
targetId?: string | null;
|
|
}
|
|
|
|
export type RpgAgentActionType =
|
|
| 'draft_foundation'
|
|
| 'update_draft_card'
|
|
| 'sync_result_profile'
|
|
| 'generate_characters'
|
|
| 'generate_landmarks'
|
|
| 'delete_characters'
|
|
| 'delete_landmarks'
|
|
| 'generate_role_assets'
|
|
| 'sync_role_assets'
|
|
| 'generate_scene_assets'
|
|
| 'sync_scene_assets'
|
|
| 'expand_long_tail'
|
|
| 'publish_world'
|
|
| 'revert_checkpoint';
|
|
|
|
export type RpgAgentActionCapabilityKey =
|
|
| RpgAgentSuggestedActionType
|
|
| RpgAgentActionType;
|
|
|
|
/**
|
|
* 当前先把能力矩阵定义为可选契约。
|
|
* 等工作包 E 的 registry 落地后,后端可以把真实 supportedActions 填充到 session snapshot。
|
|
*/
|
|
export interface RpgAgentSupportedAction {
|
|
action: RpgAgentActionCapabilityKey;
|
|
enabled: boolean;
|
|
reason?: string | null;
|
|
}
|
|
|
|
export type RpgAgentOperationType = RpgAgentActionType | 'process_message';
|
|
|
|
export type RpgAgentOperationStatus =
|
|
| 'queued'
|
|
| 'running'
|
|
| 'completed'
|
|
| 'failed';
|
|
|
|
export interface RpgAgentOperationRecord {
|
|
operationId: string;
|
|
type: RpgAgentOperationType;
|
|
status: RpgAgentOperationStatus;
|
|
phaseLabel: string;
|
|
phaseDetail: string;
|
|
progress: number;
|
|
error?: string | null;
|
|
/** 操作创建时间,草稿生成进度页用它计算总耗时。 */
|
|
startedAt?: string | null;
|
|
updatedAt?: string | null;
|
|
}
|
|
|
|
export type RpgAgentActionRequest =
|
|
| { action: 'draft_foundation' }
|
|
| {
|
|
action: 'update_draft_card';
|
|
cardId: string;
|
|
sections: Array<{
|
|
sectionId: string;
|
|
value: string;
|
|
}>;
|
|
}
|
|
| {
|
|
action: 'sync_result_profile';
|
|
profile: Record<string, unknown>;
|
|
}
|
|
| {
|
|
action: 'generate_characters';
|
|
count: number;
|
|
roleType?: 'playable' | 'story' | null;
|
|
promptText?: string | null;
|
|
anchorCardIds?: string[];
|
|
}
|
|
| {
|
|
action: 'generate_landmarks';
|
|
count: number;
|
|
promptText?: string | null;
|
|
anchorCardIds?: string[];
|
|
}
|
|
| { action: 'delete_characters'; roleIds: string[] }
|
|
| { action: 'delete_landmarks'; sceneIds: string[] }
|
|
| { action: 'generate_role_assets'; roleIds: string[] }
|
|
| {
|
|
action: 'sync_role_assets';
|
|
roleId: string;
|
|
portraitPath: string;
|
|
generatedVisualAssetId: string;
|
|
generatedAnimationSetId?: string | null;
|
|
animationMap?: Record<string, unknown> | null;
|
|
}
|
|
| {
|
|
action: 'generate_scene_assets';
|
|
sceneIds: string[];
|
|
sceneKind?: 'camp' | 'landmark' | null;
|
|
}
|
|
| {
|
|
action: 'sync_scene_assets';
|
|
sceneId: string;
|
|
sceneKind: 'camp' | 'landmark';
|
|
imageSrc: string;
|
|
generatedSceneAssetId: string;
|
|
generatedScenePrompt?: string | null;
|
|
generatedSceneModel?: string | null;
|
|
}
|
|
| { action: 'expand_long_tail' }
|
|
| { action: 'publish_world' }
|
|
| { action: 'revert_checkpoint'; checkpointId: string };
|
|
|
|
export interface RpgAgentActionResponse {
|
|
operation: RpgAgentOperationRecord;
|
|
}
|