Merge branch 'master' of http://82.157.175.59:3000/GenarrativeAI/Genarrative
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-05 14:58:07 +08:00
238 changed files with 29234 additions and 144 deletions

View File

@@ -189,6 +189,7 @@ export type RedeemProfileRewardCodeResponse = {
export type ProfileTaskCycle = 'daily';
export type TrackingScopeKind = 'site' | 'work' | 'module' | 'user';
export type AnalyticsGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year';
export type ProfileTaskStatus =
| 'incomplete'
| 'claimable'
@@ -247,6 +248,24 @@ export type ProfileTaskConfigAdminListResponse = {
entries: ProfileTaskConfigAdminResponse[];
};
export type AnalyticsMetricQueryRequest = {
eventKey: string;
scopeKind: TrackingScopeKind;
scopeId: string;
granularity: AnalyticsGranularity;
};
export type AnalyticsBucketMetric = {
bucketKey: string;
bucketStartDateKey: number;
bucketEndDateKey: number;
value: number;
};
export type AnalyticsMetricQueryResponse = {
buckets: AnalyticsBucketMetric[];
};
export type AdminUpsertProfileTaskConfigRequest = {
taskId: string;
title: string;

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;
}

View File

@@ -0,0 +1,99 @@
/**
* 方洞挑战运行态共享契约。
* 后端负责当前形状、洞口兼容、胜负和连击真相;前端只提交洞口选择并渲染快照。
*/
export type SquareHoleRunStatus =
| 'running'
| 'won'
| 'failed'
| 'stopped'
| string;
export type SquareHoleShapeKind =
| 'square'
| 'circle'
| 'triangle'
| 'star'
| 'arch'
| 'diamond'
| string;
export type SquareHoleHoleKind =
| 'square'
| 'circle'
| 'triangle'
| 'star'
| 'arch'
| 'diamond'
| string;
export type SquareHoleDropRejectReason =
| 'run_not_active'
| 'snapshot_version_mismatch'
| 'hole_not_found'
| 'incompatible'
| 'time_up'
| string;
export interface SquareHoleShapeSnapshot {
shapeId: string;
shapeKind: SquareHoleShapeKind;
label: string;
color: string;
}
export interface SquareHoleHoleSnapshot {
holeId: string;
holeKind: SquareHoleHoleKind;
label: string;
x: number;
y: number;
}
export interface SquareHoleRunSnapshot {
runId: string;
profileId: string;
ownerUserId: string;
status: SquareHoleRunStatus;
snapshotVersion: number;
startedAtMs: number;
durationLimitMs: number;
remainingMs: number;
totalShapeCount: number;
completedShapeCount: number;
combo: number;
bestCombo: number;
score: number;
ruleLabel: string;
currentShape?: SquareHoleShapeSnapshot | null;
holes: SquareHoleHoleSnapshot[];
lastFeedback?: SquareHoleDropFeedback | null;
}
export interface StartSquareHoleRunRequest {
profileId: string;
}
export interface DropSquareHoleShapeRequest {
runId?: string;
holeId: string;
clientSnapshotVersion: number;
clientEventId: string;
droppedAtMs: number;
}
export interface StopSquareHoleRunRequest {
clientActionId: string;
}
export interface SquareHoleDropFeedback {
accepted: boolean;
rejectReason?: SquareHoleDropRejectReason | null;
message: string;
}
export interface SquareHoleDropResponse {
feedback: SquareHoleDropFeedback;
run: SquareHoleRunSnapshot;
}
export interface SquareHoleRunResponse {
run: SquareHoleRunSnapshot;
}

View File

@@ -0,0 +1,50 @@
/**
* 方洞挑战作品读写共享契约。
* 作品字段只表达结果页可编辑信息;运行规则真相由后端 runtime 快照负责。
*/
export type SquareHoleWorkPublicationStatus = 'draft' | 'published' | string;
export interface PutSquareHoleWorkRequest {
gameName: string;
themeText?: string;
twistRule: string;
summary: string;
tags: string[];
coverImageSrc?: string | null;
shapeCount: number;
difficulty: number;
}
export interface SquareHoleWorkSummary {
workId: string;
profileId: string;
ownerUserId: string;
sourceSessionId?: string | null;
gameName: string;
themeText: string;
twistRule: string;
summary: string;
tags: string[];
coverImageSrc?: string | null;
shapeCount: number;
difficulty: number;
publicationStatus: SquareHoleWorkPublicationStatus;
playCount: number;
updatedAt: string;
publishedAt?: string | null;
publishReady: boolean;
}
export interface SquareHoleWorkProfile extends SquareHoleWorkSummary {}
export interface SquareHoleWorksResponse {
items: SquareHoleWorkSummary[];
}
export interface SquareHoleWorkDetailResponse {
item: SquareHoleWorkProfile;
}
export interface SquareHoleWorkMutationResponse {
item: SquareHoleWorkProfile;
}

View File

@@ -13,6 +13,9 @@ export * from './contracts/puzzleAgentSession';
export * from './contracts/puzzleResultPreview';
export * from './contracts/puzzleRuntimeSession';
export * from './contracts/puzzleWorkSummary';
export * from './contracts/squareHoleAgent';
export * from './contracts/squareHoleRuntime';
export * from './contracts/squareHoleWorks';
export * from './contracts/rpgAgentActions';
export * from './contracts/rpgAgentAnchors';
export * from './contracts/rpgAgentDraft';