@laplace.live/internal 1.3.31 → 1.3.34

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.31",
3
+ "version": "1.3.34",
4
4
  "module": "src/index.d.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -168,6 +168,7 @@ export declare namespace LaplaceInternal {
168
168
 
169
169
  /** FollowingV2 enrich 用户信息,仅查数据库(不请求上游),无记录时字段为空字符串 */
170
170
  interface FollowingV2EnrichedUser {
171
+ uid: number
171
172
  /** 用户名,数据库无记录时为空字符串 */
172
173
  username: string
173
174
  /**
@@ -188,8 +189,8 @@ export declare namespace LaplaceInternal {
188
189
  lastSeenAt: number
189
190
  unfollowedAt: number
190
191
  }>
191
- /** 按 uid 索引的用户信息,覆盖关注列表与 `laplace.unfollowed` 的全部 uid。`?enrich=1` 时返回,此时 `data.list` 一律为空数组 */
192
- users?: Record<string, FollowingV2EnrichedUser>
192
+ /** 用户信息,覆盖关注列表与 `laplace.unfollowed` 的全部 uid,保持上游关注列表顺序、取关条目在后。`?enrich=1` 时返回,此时 `data.list` 一律为空数组 */
193
+ users?: FollowingV2EnrichedUser[]
193
194
  }
194
195
  }
195
196
 
@@ -791,6 +792,58 @@ export declare namespace LaplaceInternal {
791
792
  submittedAt: number
792
793
  /** Optional: URL or description of the evidence source (e.g., livestream clip, tweet) */
793
794
  source?: string
795
+ /** Optional: prediction basis live when this entry was added; absent on legacy and backfilled entries */
796
+ predictedWith?: CyclePredictionBasis
797
+ }
798
+
799
+ /**
800
+ * What the live status projects the next period from
801
+ *
802
+ * @since Oct 4, 2026
803
+ */
804
+ export interface CyclePredictionBasis {
805
+ /** Unix timestamp (ms) - latest recorded period start at the time */
806
+ lastPeriodStart: number
807
+ /** Cycle length (days) in effect at the time */
808
+ effectiveCycleLength: number
809
+ }
810
+
811
+ /**
812
+ * How far a recorded period landed from its predicted start. Ovulation is predicted as next period - 14 days,
813
+ * so this is also the ovulation-date error.
814
+ *
815
+ * @since Oct 4, 2026
816
+ */
817
+ export interface PeriodPrediction {
818
+ /** ISO date string (YYYY-MM-DD, CST) */
819
+ predictedStart: string
820
+ /** Recorded minus predicted, in days: positive = came later than predicted */
821
+ errorDays: number
822
+ /** `snapshot` = stored when the entry was added; `backtest` = recomputed from the entries before it */
823
+ method: 'snapshot' | 'backtest'
824
+ }
825
+
826
+ /**
827
+ * Per-user summary of PeriodPrediction errors. Only periods recorded ~1 cycle after the previous one are
828
+ * scored; gaps with unrecorded periods in between (≥ 1.5 cycles) and sub-21-day noise are skipped.
829
+ *
830
+ * @since Oct 4, 2026
831
+ */
832
+ export interface PredictionAccuracy {
833
+ /** Mean absolute error in days (1 decimal); null when nothing is scored */
834
+ meanAbsErrorDays: number | null
835
+ /** Mean signed error in days (1 decimal), positive = periods come later than predicted; null when nothing is scored */
836
+ meanErrorDays: number | null
837
+ /** Number of scored periods */
838
+ samples: number
839
+ }
840
+
841
+ /**
842
+ * History entry as returned by GET /laplace/fertility/:uid
843
+ */
844
+ export interface FertilityHistoryEntry extends Omit<CycleHistoryItem, 'predictedWith'> {
845
+ /** Null when unscored: first entry, noise gap, or unrecorded periods in between */
846
+ prediction: PeriodPrediction | null
794
847
  }
795
848
 
796
849
  /**
@@ -867,11 +920,13 @@ export declare namespace LaplaceInternal {
867
920
  * status are projected from a stale observation.
868
921
  */
869
922
  cyclesElapsedSinceObservation: number
923
+ /** How far recorded periods landed from our predictions */
924
+ predictionAccuracy: PredictionAccuracy
870
925
  userPreferences: {
871
926
  cycleLength: number
872
927
  periodLength: number
873
928
  }
874
- history: CycleHistoryItem[]
929
+ history: FertilityHistoryEntry[]
875
930
  }
876
931
 
877
932
  /**
@@ -926,6 +981,8 @@ export declare namespace LaplaceInternal {
926
981
  * status are projected from a stale observation.
927
982
  */
928
983
  cyclesElapsedSinceObservation: number
984
+ /** How far recorded periods landed from our predictions */
985
+ predictionAccuracy: PredictionAccuracy
929
986
  }
930
987
 
931
988
  /**
@@ -1175,6 +1232,15 @@ export declare namespace LaplaceInternal {
1175
1232
  /** Verdict produced by evaluating the AI's structured output against the contribution's claim. */
1176
1233
  export type FertilityAiVerdict = 'valid' | 'invalid' | 'inconclusive'
1177
1234
 
1235
+ /**
1236
+ * What kicked off the check.
1237
+ * - `admin` — an admin pressed the button (POST /laplace/fertility-contribution-ai-check/:id)
1238
+ * - `submit` — fired automatically in the background when the contributor submitted
1239
+ *
1240
+ * Absent on rows written before the auto-check existed; treat undefined as `admin`.
1241
+ */
1242
+ export type FertilityAiTrigger = 'admin' | 'submit'
1243
+
1178
1244
  /**
1179
1245
  * What the system did automatically based on the verdict.
1180
1246
  * - `approved` — verdict was `valid`; approveFertilityContribution succeeded
@@ -1220,6 +1286,8 @@ export declare namespace LaplaceInternal {
1220
1286
  sessionId: string
1221
1287
  model: string
1222
1288
  liveUrl?: string
1289
+ /** What kicked off the check. Undefined on rows predating the auto-check; treat as `admin`. */
1290
+ trigger?: FertilityAiTrigger
1223
1291
  /** ISO 8601 */
1224
1292
  startedAt: string
1225
1293
  /** ISO 8601, set when status leaves 'running' */