@thehammer/template-verification 0.2.13 → 0.2.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/dist/components/VerifiedField.vue.d.ts +54 -34
- package/dist/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/template-verification.js +204 -193
- package/dist/types.d.ts +77 -4
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -132,6 +132,14 @@ export interface Correction {
|
|
|
132
132
|
*/
|
|
133
133
|
export interface ExtractedCandidate {
|
|
134
134
|
value: unknown;
|
|
135
|
+
/**
|
|
136
|
+
* WHO authored the value standing on this field — `extraction`, `audit` or `human`
|
|
137
|
+
* (SG-428/SG-615). Shipped in BOTH light and full mode, same argument as
|
|
138
|
+
* `source_discrepancy` below: one short string per field. Not to be confused with
|
|
139
|
+
* `VerificationSource.source_type`, which names a CITATION's own kind (`file` /
|
|
140
|
+
* `api_log`), a different fact about a different object.
|
|
141
|
+
*/
|
|
142
|
+
source?: string | null;
|
|
135
143
|
confidence: number | null;
|
|
136
144
|
reasoning?: string | null;
|
|
137
145
|
/**
|
|
@@ -182,10 +190,22 @@ export interface ExtractedCandidate {
|
|
|
182
190
|
/**
|
|
183
191
|
* One recorded attempt in a field's extraction history (SG-190). Mirrors the extracted
|
|
184
192
|
* candidate's provenance plus `is_chosen` (the single live winner) and its timestamp.
|
|
193
|
+
*
|
|
194
|
+
* SG-615: caught up to the host's `fieldHistoryPayload()` (SG-450, gpt-manager
|
|
195
|
+
* `TemplateDataResource`), which this type had drifted from in both directions — it never
|
|
196
|
+
* declared `source` (WHO authored this attempt — `extraction`/`audit`/`human`) or
|
|
197
|
+
* `set_by_name` (a real display name for the `human` tier), and it declared a `page` this
|
|
198
|
+
* host method has never emitted (no source in this library reads `.page` off a history
|
|
199
|
+
* entry either — the per-source `page`/`page_number` on {@link VerificationSource} is
|
|
200
|
+
* what's real).
|
|
185
201
|
*/
|
|
186
202
|
export interface VerificationHistoryEntry {
|
|
187
203
|
id?: number | string;
|
|
188
204
|
value: unknown;
|
|
205
|
+
/** WHO authored this attempt — `extraction`, `audit` or `human`. See {@link ExtractedCandidate.source}. */
|
|
206
|
+
source?: string | null;
|
|
207
|
+
/** A real display name for the `human` tier; null for every other tier. See {@link OverrideCandidate.set_by_name}. */
|
|
208
|
+
set_by_name?: string | null;
|
|
189
209
|
confidence: number | null;
|
|
190
210
|
reasoning?: string | null;
|
|
191
211
|
/** See {@link ExtractedCandidate.verbatim} — the same two-value model, per recorded attempt. */
|
|
@@ -193,16 +213,45 @@ export interface VerificationHistoryEntry {
|
|
|
193
213
|
state?: "present" | "absent" | "removed" | "failed" | null;
|
|
194
214
|
/** True for the single live/winning attempt; false for losers/FAILED/superseded values. */
|
|
195
215
|
is_chosen: boolean;
|
|
196
|
-
page?: number | null;
|
|
197
216
|
sources?: VerificationSource[];
|
|
198
217
|
created_at?: string | null;
|
|
199
218
|
}
|
|
200
|
-
/**
|
|
219
|
+
/**
|
|
220
|
+
* One page a human cites when saving/overriding a value (SG-565, widened to a list by
|
|
221
|
+
* SG-573) — the SAME `{file_id, texts}` shape on both the write side
|
|
222
|
+
* (`SaveOverrideArgs.citation`) and the read side (`OverrideCandidate.citations`), reused
|
|
223
|
+
* rather than shaped into two types so a reopened picker round-trips through the exact
|
|
224
|
+
* shape the save endpoint takes. `file_id` is a page-level StoredFile id (danx StoredFile
|
|
225
|
+
* is UUID-keyed, never an integer); `texts` is the ordered quoted passages the person read
|
|
226
|
+
* on that page, optional even once a page is named.
|
|
227
|
+
*/
|
|
228
|
+
export interface HumanCitation {
|
|
229
|
+
file_id: string;
|
|
230
|
+
texts?: string[];
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A user-saved override candidate — always the highest-priority resolution.
|
|
234
|
+
*
|
|
235
|
+
* `source_choice` is deliberately ABSENT here (SG-428) — it recorded whether the person
|
|
236
|
+
* pinned a candidate's value or typed their own, a fact about the gesture the host never
|
|
237
|
+
* reads back, and it is not part of the RESPONSE shape. It still rides on
|
|
238
|
+
* {@link SaveOverrideArgs} below, because both shipped clients still POST it.
|
|
239
|
+
*
|
|
240
|
+
* `state`/`set_by_name` (SG-428) and `confidence`/`reasoning`/`citations` (SG-565/SG-573)
|
|
241
|
+
* mirror the host's `humanCandidate()` (gpt-manager `TemplateDataResource`) — a person may
|
|
242
|
+
* OPTIONALLY rate their own confidence, explain their reasoning, and cite the page(s) they
|
|
243
|
+
* read the value from, the same three columns the extracted candidate carries for a
|
|
244
|
+
* machine reading. Null/absent on every override that did not opt in.
|
|
245
|
+
*/
|
|
201
246
|
export interface OverrideCandidate {
|
|
202
247
|
value: unknown;
|
|
203
|
-
|
|
248
|
+
state?: "present" | "absent" | "removed" | null;
|
|
204
249
|
set_by?: number | string | null;
|
|
250
|
+
set_by_name?: string | null;
|
|
205
251
|
set_at?: string | null;
|
|
252
|
+
confidence?: number | null;
|
|
253
|
+
reasoning?: string | null;
|
|
254
|
+
citations?: HumanCitation[];
|
|
206
255
|
}
|
|
207
256
|
/** A claim candidate asserted by an example/reference output — lowest priority. */
|
|
208
257
|
export interface ClaimCandidate {
|
|
@@ -230,6 +279,16 @@ export interface ResolvedValue {
|
|
|
230
279
|
/** The per-data-point verification metadata (one `__meta` map entry). */
|
|
231
280
|
export interface DataPointMeta {
|
|
232
281
|
anchor: DataPointAnchor;
|
|
282
|
+
/**
|
|
283
|
+
* The field's own declared JSON-Schema `type`/`format` (e.g. `{type: 'string',
|
|
284
|
+
* format: 'date'}`) — present on every `__meta` entry the host emits, but consumed
|
|
285
|
+
* by the `views/demands` React app (a separate consumer from this library), not by
|
|
286
|
+
* anything here. Declared here for shape accuracy against the wire contract; every
|
|
287
|
+
* `it` in `verificationContract.test.ts` would otherwise have to omit a key the host
|
|
288
|
+
* genuinely sends.
|
|
289
|
+
*/
|
|
290
|
+
type?: string | null;
|
|
291
|
+
format?: string | null;
|
|
233
292
|
candidates: CandidateSet;
|
|
234
293
|
discrepancy: boolean;
|
|
235
294
|
resolved: ResolvedValue;
|
|
@@ -252,7 +311,18 @@ export interface DataPointMeta {
|
|
|
252
311
|
export type MetaCarrier = Record<string, unknown> & {
|
|
253
312
|
__meta?: Record<string, DataPointMeta>;
|
|
254
313
|
};
|
|
255
|
-
/**
|
|
314
|
+
/**
|
|
315
|
+
* Arguments the library passes to the host-injected save transport (guide §7.4).
|
|
316
|
+
*
|
|
317
|
+
* `confidence`/`reason`/`citation` (SG-565, `citation` widened to a list by SG-573) let a
|
|
318
|
+
* person OPTIONALLY carry the same evidentiary shape a machine reading does — never
|
|
319
|
+
* required, so all three are optional here exactly as the host's
|
|
320
|
+
* `DataPointValueService::validationRules()` marks them `nullable`/`sometimes`. Omitted
|
|
321
|
+
* entirely, the save is byte-identical to before these two cards. Named `citation`
|
|
322
|
+
* (singular) and `reason` on the WRITE side, `citations`/`reasoning` on the READ side
|
|
323
|
+
* ({@link OverrideCandidate}) — deliberately different names on each side of the wire, so
|
|
324
|
+
* neither field is ever confused for the other.
|
|
325
|
+
*/
|
|
256
326
|
export interface SaveOverrideArgs {
|
|
257
327
|
workflow_input_id: number | string | null | undefined;
|
|
258
328
|
object_ids: Array<number | string>;
|
|
@@ -260,6 +330,9 @@ export interface SaveOverrideArgs {
|
|
|
260
330
|
field_path: string;
|
|
261
331
|
value: string | null;
|
|
262
332
|
source_choice: SourceChoice;
|
|
333
|
+
confidence?: number | null;
|
|
334
|
+
reason?: string | null;
|
|
335
|
+
citation?: HumanCitation[];
|
|
263
336
|
}
|
|
264
337
|
/**
|
|
265
338
|
* The host-injected save transport. Backend-agnostic: the host supplies the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thehammer/template-verification",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
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",
|