@simonarcher/fika-types 2.1.0 → 2.2.0

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.
@@ -20,6 +20,32 @@
20
20
  * - `created_new` — user created a new bean record from this scan
21
21
  */
22
22
  export type BeanScanAction = "pending" | "saved" | "tried" | "rejected" | "created_new";
23
+ /**
24
+ * FIK-185 — AI vision draft persisted on bean_scans.ai_inferred when the
25
+ * trigram matcher returns bean_score < 0.4. Mobile uses this to prefill the
26
+ * AddBeanStep submission form; admin uses it to show the curator what AI
27
+ * suggested vs what the user actually submitted.
28
+ *
29
+ * Field shape mirrors the gpt-4o-mini extraction prompt in
30
+ * Fika-server/src/services/openAIService.ts (`extractBeanFromImage`).
31
+ * Curator-only fields (variety, roastDate, weightG) aren't on the mobile
32
+ * form — they sit here for the admin review screen to surface.
33
+ */
34
+ export interface BeanScanAiDraft {
35
+ name: string | null;
36
+ roasterName: string | null;
37
+ roastLevel: string | null;
38
+ processing: string | null;
39
+ country: string | null;
40
+ isDecaf: boolean | null;
41
+ tastingNotes: string[] | null;
42
+ variety: string | null;
43
+ roastDate: string | null;
44
+ weightG: number | null;
45
+ model: string;
46
+ latencyMs: number;
47
+ extractedAt: string;
48
+ }
23
49
  /**
24
50
  * One row per user scan event. Powers the bag-scan loop: photograph →
25
51
  * OCR + photo similarity → top-N candidate beans → user picks (or rejects).
@@ -47,6 +73,12 @@ export interface BeanScan {
47
73
  matchedBeanId?: string;
48
74
  action: BeanScanAction;
49
75
  deviceMeta?: Record<string, unknown>;
76
+ /**
77
+ * FIK-185 — gpt-4o-mini vision draft, set by POST /bean-scans/:id/enrich
78
+ * when the trigram matcher's top bean_score is below the auto-route gate.
79
+ * NULL until enriched (or if the kill switch is off).
80
+ */
81
+ aiInferred?: BeanScanAiDraft;
50
82
  createdAt: string;
51
83
  resolvedAt?: string;
52
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonarcher/fika-types",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Shared TypeScript types for Fika projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",