@laplace.live/internal 1.3.13 → 1.3.15

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.15",
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,92 @@ 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
+ /**
1118
+ * YYYY-MM-DD in Asia/Shanghai; the date the content claims the period began.
1119
+ *
1120
+ * Disambiguation rules baked into the AI prompt:
1121
+ * - Explicit qualifier ("今天/昨天/上周三") → resolved against post date.
1122
+ * - No qualifier at all ("魔法期来了") → treated as "now", uses post date.
1123
+ * - Vague non-anchorable past ("前几天/最近/上周") → null.
1124
+ */
1125
+ extractedPeriodStartDate: string | null
1126
+ /** YYYY-MM-DD in Asia/Shanghai; the post's publish date (auxiliary). */
1127
+ postedAt: string | null
1128
+ contentMentionsPeriod: boolean
1129
+ evidenceQuote: string | null
1130
+ pageType: 'video' | 'dynamic' | 'livestream_replay' | 'space' | 'unknown'
1131
+ confidence: number
1132
+ notes: string | null
1133
+ }
1134
+
1135
+ /**
1136
+ * Payload stored in bilibili_fertility_contributions.ai_data (jsonb).
1137
+ * Used both by the workers and by Drizzle via $type<>().
1138
+ */
1139
+ export interface FertilityAiData {
1140
+ sessionId: string
1141
+ model: string
1142
+ liveUrl?: string
1143
+ /** ISO 8601 */
1144
+ startedAt: string
1145
+ /** ISO 8601, set when status leaves 'running' */
1146
+ checkedAt?: string
1147
+ costUsd?: string
1148
+ confidence?: number
1149
+ evidence?: FertilityAiEvidence
1150
+ autoActionResult?: FertilityAiAutoActionResult
1151
+ errorMessage?: string
1152
+ }
1153
+
1154
+ /**
1155
+ * Response shape for POST /laplace/fertility-contribution-ai-check/:id
1156
+ * and GET /laplace/fertility-contribution-ai-check/:id.
1157
+ */
1158
+ export interface FertilityAiCheckResponse {
1159
+ id: number
1160
+ contributionStatus: ContributionStatus
1161
+ ai: {
1162
+ status: FertilityAiStatus | null
1163
+ verdict: FertilityAiVerdict | null
1164
+ data: FertilityAiData | null
1165
+ }
1166
+ }
1167
+
1076
1168
  // ============================================
1077
1169
  // Meme Types
1078
1170
  // ============================================