@laplace.live/internal 1.3.13 → 1.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/internal",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "module": "src/index.d.ts",
5
5
  "exports": {
6
6
  ".": "./src/index.d.ts",
@@ -979,6 +979,12 @@ export declare namespace LaplaceInternal {
979
979
  /** ISO timestamp string */
980
980
  reviewedAt?: string
981
981
  rejectReason?: string
982
+ /** AI review state (see FertilityAiStatus). Null when never checked. */
983
+ aiStatus?: FertilityAiStatus | null
984
+ /** AI review verdict (see FertilityAiVerdict). Null when running, errored, or skipped without a verdict. */
985
+ aiVerdict?: FertilityAiVerdict | null
986
+ /** AI review per-attempt payload (see FertilityAiData). Null when never checked. */
987
+ aiData?: FertilityAiData | null
982
988
  }
983
989
 
984
990
  /**
@@ -1073,6 +1079,85 @@ export declare namespace LaplaceInternal {
1073
1079
  avgProcessingTimeHours: number | null
1074
1080
  }
1075
1081
 
1082
+ // ============================================
1083
+ // Fertility AI Check Types
1084
+ // ============================================
1085
+
1086
+ /**
1087
+ * AI review session lifecycle on our side.
1088
+ * - `running` — Browser Use session dispatched, waiting for terminal status
1089
+ * - `done` — verdict landed (see aiVerdict)
1090
+ * - `errored` — Browser Use failed or returned non-conforming output
1091
+ * - `skipped` — source URL was off-list (e.g. not a Bilibili page); never dispatched
1092
+ */
1093
+ export type FertilityAiStatus = 'running' | 'done' | 'errored' | 'skipped'
1094
+
1095
+ /** Verdict produced by evaluating the AI's structured output against the contribution's claim. */
1096
+ export type FertilityAiVerdict = 'valid' | 'invalid' | 'inconclusive'
1097
+
1098
+ /**
1099
+ * What the system did automatically based on the verdict.
1100
+ * - `approved` — verdict was `valid`; approveFertilityContribution succeeded
1101
+ * - `flagged` — verdict was `invalid` or `inconclusive`; row stays pending for admin review
1102
+ * - `approve_failed_duplicate` — verdict was `valid` but approval bounced because the period already exists in production
1103
+ * - `skipped_unsupported` — source URL was not Bilibili; no AI call made
1104
+ */
1105
+ export type FertilityAiAutoActionResult =
1106
+ | 'approved'
1107
+ | 'flagged'
1108
+ | 'approve_failed_duplicate'
1109
+ | 'skipped_unsupported'
1110
+
1111
+ /**
1112
+ * Structured output the Browser Use agent returns (matches FERTILITY_AI_OUTPUT_SCHEMA).
1113
+ */
1114
+ export interface FertilityAiEvidence {
1115
+ extractedUid: number | null
1116
+ uidMatches: boolean
1117
+ /** YYYY-MM-DD in Asia/Shanghai; the date the content claims the period began. */
1118
+ extractedPeriodStartDate: string | null
1119
+ /** YYYY-MM-DD in Asia/Shanghai; the post's publish date (auxiliary). */
1120
+ postedAt: string | null
1121
+ contentMentionsPeriod: boolean
1122
+ evidenceQuote: string | null
1123
+ pageType: 'video' | 'dynamic' | 'livestream_replay' | 'space' | 'unknown'
1124
+ confidence: number
1125
+ notes: string | null
1126
+ }
1127
+
1128
+ /**
1129
+ * Payload stored in bilibili_fertility_contributions.ai_data (jsonb).
1130
+ * Used both by the workers and by Drizzle via $type<>().
1131
+ */
1132
+ export interface FertilityAiData {
1133
+ sessionId: string
1134
+ model: string
1135
+ liveUrl?: string
1136
+ /** ISO 8601 */
1137
+ startedAt: string
1138
+ /** ISO 8601, set when status leaves 'running' */
1139
+ checkedAt?: string
1140
+ costUsd?: string
1141
+ confidence?: number
1142
+ evidence?: FertilityAiEvidence
1143
+ autoActionResult?: FertilityAiAutoActionResult
1144
+ errorMessage?: string
1145
+ }
1146
+
1147
+ /**
1148
+ * Response shape for POST /laplace/fertility-contribution-ai-check/:id
1149
+ * and GET /laplace/fertility-contribution-ai-check/:id.
1150
+ */
1151
+ export interface FertilityAiCheckResponse {
1152
+ id: number
1153
+ contributionStatus: ContributionStatus
1154
+ ai: {
1155
+ status: FertilityAiStatus | null
1156
+ verdict: FertilityAiVerdict | null
1157
+ data: FertilityAiData | null
1158
+ }
1159
+ }
1160
+
1076
1161
  // ============================================
1077
1162
  // Meme Types
1078
1163
  // ============================================