@thehammer/template-verification 0.2.5 → 0.2.7

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/dist/types.d.ts CHANGED
@@ -8,8 +8,13 @@
8
8
  * entry is a {@link DataPointMeta} describing that one field's verification state.
9
9
  */
10
10
  import type { PreviewFile } from "@thehammer/danx-ui";
11
- /** Status bucket derived from the integer 1-5 confidence (orthogonal to discrepancy). */
12
- export type VerificationStatus = "high" | "medium" | "low" | "unverifiable";
11
+ /**
12
+ * Status bucket derived from the integer 1-5 confidence (orthogonal to discrepancy),
13
+ * plus 'failed' (SG-189) — a distinct extraction/citation-correction OUTCOME, not a
14
+ * confidence bucket. 'failed' is resolved from the extracted candidate's `state`
15
+ * field, never from bucketing a confidence integer.
16
+ */
17
+ export type VerificationStatus = "high" | "medium" | "low" | "unverifiable" | "failed";
13
18
  /** The winning candidate key for a resolved data point, or `none` when no candidate exists. */
14
19
  export type ResolvedSource = "override" | "extracted" | "claim" | "none";
15
20
  /** The basis a user picked when saving an override. */
@@ -27,6 +32,12 @@ export interface VerificationSource {
27
32
  explanation?: string | null;
28
33
  stored_file_id?: number | string | null;
29
34
  agent_thread_message_id?: number | string | null;
35
+ /**
36
+ * Ordered verbatim snippets cited on this source's page (SG-181 — replaces the
37
+ * retired attribute-level `cited_text` column). Empty only when the page has no
38
+ * text transcript at all (image-only).
39
+ */
40
+ texts?: string[] | null;
30
41
  file_id?: number | string;
31
42
  page?: number;
32
43
  file_url?: string;
@@ -54,9 +65,41 @@ export interface ExtractedCandidate {
54
65
  value: unknown;
55
66
  confidence: number | null;
56
67
  reasoning?: string | null;
57
- cited_text?: string | null;
58
- cited_text_verified?: boolean | null;
68
+ /** verbatim | inferred — replaces the retired cited_text/cited_text_verified pair (SG-181). */
69
+ basis?: "verbatim" | "inferred" | null;
70
+ sources?: VerificationSource[];
71
+ /**
72
+ * Extraction/citation-correction outcome (SG-189). 'failed' means extraction/
73
+ * citation-correction failed for this field; when 'failed', `reasoning` carries
74
+ * the failure explanation instead of citation reasoning. Undefined/null for
75
+ * candidates predating this field.
76
+ */
77
+ state?: "extracted" | "corrected" | "failed" | "absent" | null;
78
+ /**
79
+ * The full per-field extraction history (SG-190) — every recorded attempt for this
80
+ * field, oldest first, including the live winner and every non-live loser / FAILED
81
+ * candidate / superseded value. The verification layer drills into this to show each
82
+ * attempt's timestamp, provenance, and confidence, with the chosen entry marked.
83
+ * Undefined for hosts predating SG-190.
84
+ */
85
+ history?: VerificationHistoryEntry[];
86
+ }
87
+ /**
88
+ * One recorded attempt in a field's extraction history (SG-190). Mirrors the extracted
89
+ * candidate's provenance plus `is_chosen` (the single live winner) and its timestamp.
90
+ */
91
+ export interface VerificationHistoryEntry {
92
+ id?: number | string;
93
+ value: unknown;
94
+ confidence: number | null;
95
+ reasoning?: string | null;
96
+ basis?: "verbatim" | "inferred" | null;
97
+ state?: "extracted" | "corrected" | "failed" | "absent" | null;
98
+ /** True for the single live/winning attempt; false for losers/FAILED/superseded values. */
99
+ is_chosen: boolean;
100
+ page?: number | null;
59
101
  sources?: VerificationSource[];
102
+ created_at?: string | null;
60
103
  }
61
104
  /** A user-saved override candidate — always the highest-priority resolution. */
62
105
  export interface OverrideCandidate {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thehammer/template-verification",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Read-write verification overlay for rendered template apps — per-data-point confidence, discrepancy, 3-source resolution (override > extracted > claim), inline edit, and a recursive comparison page. Consumes the host's __meta sidecar; fetches nothing.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,6 +43,7 @@
43
43
  "@thehammer/danx-ui": "^0.8.17",
44
44
  "@vitejs/plugin-vue": "^5.0.0",
45
45
  "@vue/test-utils": "^2.4.6",
46
+ "@vueuse/core": "^14.4.0",
46
47
  "happy-dom": "^20.3.9",
47
48
  "tailwindcss": "^4.0.0",
48
49
  "typescript": "~5.4.0",
@@ -1,28 +0,0 @@
1
- import type { PreviewFile } from "@thehammer/danx-ui";
2
- import type { VerificationSource } from "../types";
3
- /** A set of sources sharing one file identity, for grouped rendering in the modal. */
4
- export interface SourceGroup {
5
- /** Display label for the file (file_name, then a derived id, then a fallback). */
6
- fileLabel: string;
7
- /** A view/download URL when the host resolved one; the group links only when set. */
8
- fileUrl?: string;
9
- /**
10
- * The resolved StoredFile (danx-ui `PreviewFile`-shaped), when the host resolved
11
- * one — renders a real `DanxFile` thumbnail + `DanxFileViewer` preview. Falls back
12
- * to the plain `fileLabel`/`fileUrl` text link when absent (host predates file
13
- * resolution, or the source has no linked file).
14
- */
15
- file?: PreviewFile | null;
16
- /** The sources belonging to this file. */
17
- sources: VerificationSource[];
18
- }
19
- /**
20
- * Group an extracted candidate's sources by file identity so the modal can render
21
- * one block per file with its pages beneath. Links a group when a `file_url` (the
22
- * idealized shape) is present on any of its sources, falling back to the resolved
23
- * `file.url` (the live gpt-manager backend shape — `TemplateDataResource` never
24
- * emits `file_url`, only `file: {id,name,url,mime,size,thumb}`).
25
- */
26
- export declare function groupSources(sources?: VerificationSource[] | null): SourceGroup[];
27
- /** Human page/citation label for a single source row. */
28
- export declare function sourceRowLabel(source: VerificationSource): string;