@thehammer/template-verification 0.2.15 → 0.2.16

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
@@ -7,7 +7,6 @@
7
7
  * A rendered object node carries a `__meta` MAP keyed by leaf field name; each
8
8
  * entry is a {@link DataPointMeta} describing that one field's verification state.
9
9
  */
10
- import type { PreviewFile } from "@thehammer/danx-ui";
11
10
  /**
12
11
  * Status bucket derived from the integer 1-5 confidence (orthogonal to discrepancy),
13
12
  * plus 'failed' (SG-189) — a distinct extraction/citation-correction OUTCOME, not a
@@ -20,45 +19,69 @@ export type ResolvedSource = "override" | "extracted" | "claim" | "none";
20
19
  /** The basis a user picked when saving an override. */
21
20
  export type SourceChoice = "extracted" | "claim" | "custom";
22
21
  /**
23
- * One citation source for an extracted candidate. The live host shape carries
24
- * `id`/`source_type`/`stored_file_id`/`explanation`; the optional `file_*`/`page`
25
- * fields cover the idealized document-page shape. Grouping + linking tolerate
26
- * either: group by file identity, link only when `file_url` is present.
22
+ * One citation source for an extracted candidate `CitationSourceResource`-shaped (SG-685),
23
+ * the SAME shape gpt-manager's session-authed `data-point-sources`/`data-point-history`
24
+ * endpoints already returned before this card promoted the token-sealed detail endpoint (and
25
+ * `history[]`) onto it too. Replaces the earlier `file`/`original_file`/`page_number`/
26
+ * `source_id`/`agent_thread_message_id` shape (`TemplateDataResource::sourcesPayload()`/
27
+ * `sourceFilePayload()`, deleted) — one citation transport, not two.
27
28
  */
28
29
  export interface VerificationSource {
29
30
  id?: number | string;
30
31
  source_type?: string | null;
31
- source_id?: number | string | null;
32
32
  explanation?: string | null;
33
- stored_file_id?: number | string | null;
34
- agent_thread_message_id?: number | string | null;
35
33
  /**
36
34
  * Ordered verbatim snippets cited on this source's page (SG-181 — replaces the
37
35
  * retired attribute-level `cited_text` column). Empty only when the page has no
38
36
  * text transcript at all (image-only).
39
37
  */
40
38
  texts?: string[] | null;
41
- file_id?: number | string;
42
- page?: number;
43
- file_url?: string;
44
- file_name?: string;
45
- /**
46
- * The resolved StoredFile behind `stored_file_id`, danx-ui `PreviewFile`-shaped
47
- * (id/name/size/mime/url/thumb?). Present when the host resolved it (gpt-manager's
48
- * `TemplateDataResource::sourceFilePayload`); null/absent when the source has no
49
- * linked file. This is what the modal renders a real thumbnail/preview from.
50
- */
51
- file?: PreviewFile | null;
52
- /** The page's position inside its parent document (from the transcode StoredFile). */
53
- page_number?: number | null;
39
+ /** Whether this citation resolved to a real page (or, for a `field` citation, a real
40
+ * cited attribute). `false` reports WHY via `unresolved_reason` rather than a silent gap. */
41
+ resolved?: boolean;
42
+ unresolved_reason?: string | null;
43
+ stored_file_id?: number | string | null;
44
+ /** The rendered PAGE this source cites. Null when unresolved, or not a document citation. */
45
+ page?: {
46
+ id: string;
47
+ page_number: number | null;
48
+ url: string | null;
49
+ thumb_url: string | null;
50
+ mime: string | null;
51
+ size: number | null;
52
+ } | null;
53
+ /** The FULL document the cited page was rendered from, reached through the page's own
54
+ * parent. Null when `page` is null. */
55
+ document?: {
56
+ id: string;
57
+ name: string | null;
58
+ url: string | null;
59
+ mime: string | null;
60
+ } | null;
61
+ /** Present only for a `field`-type citation (Generate Artifact) that resolved — the OTHER
62
+ * field this value was drawn from, never a document. Null for every other source_type. */
63
+ field?: {
64
+ team_object_id: number;
65
+ field: string;
66
+ value: unknown;
67
+ confidence: number | null;
68
+ reasoning: string | null;
69
+ state: string | null;
70
+ superseded: boolean;
71
+ record_deleted: boolean;
72
+ } | null;
73
+ /** The LLM call (ApiLog id) that produced this citation. */
74
+ api_log_id?: number | string | null;
75
+ created_at?: string | null;
54
76
  /**
55
- * The FULL parent document the cited page was transcoded from (PreviewFile-
56
- * shaped; `url` is the whole PDF). Null when the source file is not a
57
- * transcode page. Drives the Inspector's "view full document" drill-down.
77
+ * `CitationSourceResource extends` danx's `ActionResource`, which auto-prepends these three
78
+ * envelope keys to every `::collection()` call a real, always-present part of the wire
79
+ * shape (unlike the retired `sourcesPayload()`, a plain array that never carried them), not
80
+ * something this library's own components read.
58
81
  */
59
- original_file?: PreviewFile | null;
60
- /** The LLM call (ApiLog id) that produced this citation, via the source message. */
61
- api_log_id?: number | string | null;
82
+ __type?: string;
83
+ __timestamp?: number;
84
+ __deleted_at?: string | null;
62
85
  }
63
86
  /**
64
87
  * One piece of evidence a {@link SourceDiscrepancy} cites — the page a conflicting value
@@ -244,6 +267,12 @@ export interface HumanCitation {
244
267
  * machine reading. Null/absent on every override that did not opt in.
245
268
  */
246
269
  export interface OverrideCandidate {
270
+ /**
271
+ * The decisive human reading's own id (SG-685) — matches this exact row's `id` in
272
+ * gpt-manager's `data-point-history` response, letting a consumer find this candidate's own
273
+ * citations there rather than re-deriving which reading is decisive.
274
+ */
275
+ reading_id?: number;
247
276
  value: unknown;
248
277
  state?: "present" | "absent" | "removed" | null;
249
278
  set_by?: number | string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thehammer/template-verification",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
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",