@thehammer/template-verification 0.2.8 → 0.2.10
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/AuditCallCard.vue.d.ts +1 -1
- package/dist/components/VerificationModal.vue.d.ts +14 -2
- package/dist/constants.d.ts +1 -1
- package/dist/context.d.ts +9 -13
- package/dist/index.d.ts +9 -7
- package/dist/lib/dataPointDetail.d.ts +41 -0
- package/dist/style.css +1 -1
- package/dist/template-verification.js +832 -983
- package/dist/types.d.ts +21 -2
- package/package.json +1 -1
- package/dist/components/ComparisonPage.vue.d.ts +0 -2
- package/dist/lib/audit.d.ts +0 -32
|
@@ -14,8 +14,20 @@ import type { DataPointMeta, SourceChoice } from "../types";
|
|
|
14
14
|
* - History: the live value's confidence + reasoning above the full extraction
|
|
15
15
|
* history; every attempt (winner, losers, FAILED) collapses to a summary row
|
|
16
16
|
* and expands to its own reasoning and page-grouped citations.
|
|
17
|
-
* - Audit trail:
|
|
18
|
-
*
|
|
17
|
+
* - Audit trail: every LLM call the pipeline made for this field; hidden
|
|
18
|
+
* entirely when the host minted no `detail_url`.
|
|
19
|
+
*
|
|
20
|
+
* SG-392: `props.meta.candidates.extracted` may be LIGHT (no `sources`/
|
|
21
|
+
* `history` — the base template render never ships those, only their
|
|
22
|
+
* `*_count`; see `types.ts`'s `ExtractedCandidate` docblock for why). The
|
|
23
|
+
* instant this dialog opens, it fetches the FULL detail (citation sources +
|
|
24
|
+
* extraction history + the LLM audit trace, all in one request — one host
|
|
25
|
+
* endpoint, `verification.detailUrl`) and merges it in; `extracted` (the
|
|
26
|
+
* merged computed) below is what every tab actually reads. A caller that already passed a FULL
|
|
27
|
+
* `extracted` (e.g. the live meta right after a save, which always carries
|
|
28
|
+
* full detail) is used as-is — the fetch still fires (the audit trace is
|
|
29
|
+
* needed either way) but never clobbers already-present sources/history with
|
|
30
|
+
* an absent one.
|
|
19
31
|
*
|
|
20
32
|
* `save` is null when the field is read-only (no transport / no anchor) — the
|
|
21
33
|
* resolution actions are hidden in that case.
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class applied to EVERY piece of library chrome (settings button + panel,
|
|
3
|
-
* overlay icons, discrepancy indicators,
|
|
3
|
+
* overlay icons, discrepancy indicators, modal). A single
|
|
4
4
|
* `@media print` rule hides all of it so the host template prints/exports clean —
|
|
5
5
|
* the library never touches the host's own content. Kept as a constant so
|
|
6
6
|
* components and the print-chrome regression test agree on one source of truth.
|
package/dist/context.d.ts
CHANGED
|
@@ -27,11 +27,14 @@ export interface InitVerificationConfig {
|
|
|
27
27
|
/** Opaque workflow input id echoed back in saves. */
|
|
28
28
|
workflowInputId?: number | string | null;
|
|
29
29
|
/**
|
|
30
|
-
* Token-sealed
|
|
31
|
-
* Present ⇒ the Inspector
|
|
32
|
-
*
|
|
30
|
+
* Token-sealed per-field detail endpoint base (`__verification.detail_url` from
|
|
31
|
+
* the host). Present ⇒ the Inspector dialog lazy-loads a data point's full
|
|
32
|
+
* citation sources, extraction history, and LLM-call audit trace from
|
|
33
|
+
* `{detailUrl}?object_id=&field=` the instant it opens for that field (SG-392).
|
|
34
|
+
* Absent ⇒ the Audit tab is hidden, and the base render's light `extracted`
|
|
35
|
+
* candidate (see `types.ts`) is all any tab ever shows.
|
|
33
36
|
*/
|
|
34
|
-
|
|
37
|
+
detailUrl?: string | null;
|
|
35
38
|
/** Seeds the overlay toggle ONLY when localStorage holds no prior value. */
|
|
36
39
|
defaultEnabled?: boolean;
|
|
37
40
|
/**
|
|
@@ -54,12 +57,10 @@ export interface Verification {
|
|
|
54
57
|
saveOverride?: SaveOverrideFn;
|
|
55
58
|
/** Opaque workflow input id echoed back in saves. */
|
|
56
59
|
workflowInputId?: number | string | null;
|
|
57
|
-
/** Token-sealed
|
|
58
|
-
|
|
60
|
+
/** Token-sealed per-field detail endpoint base; null/absent hides the Audit tab. */
|
|
61
|
+
detailUrl?: string | null;
|
|
59
62
|
/** True while the host is fetching a new data source; see {@link InitVerificationConfig.loading}. */
|
|
60
63
|
loading: boolean;
|
|
61
|
-
/** Open the comparison page (rendered by `<VerificationChrome>`). */
|
|
62
|
-
openComparison: () => void;
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
65
66
|
* Establish the app-wide verification config. Call ONCE at App.vue root setup —
|
|
@@ -75,11 +76,6 @@ export declare function initVerification(config: InitVerificationConfig): void;
|
|
|
75
76
|
* advanced hosts.
|
|
76
77
|
*/
|
|
77
78
|
export declare function useVerification(): Verification;
|
|
78
|
-
/**
|
|
79
|
-
* @internal Binds the comparison dialog's open-state for `<VerificationChrome>`.
|
|
80
|
-
* Not part of the public surface — chrome and `openComparison()` share one ref.
|
|
81
|
-
*/
|
|
82
|
-
export declare function useComparisonDialog(): Ref<boolean>;
|
|
83
79
|
/**
|
|
84
80
|
* @internal Test-only: clear the module singleton so each test starts from the
|
|
85
81
|
* uninitialized state. Not exported from the package entry point.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @thehammer/template-verification — read-write verification overlay for rendered
|
|
3
3
|
* template apps. Consumes the host's `__meta` sidecar (override > extracted >
|
|
4
|
-
* claim resolution + discrepancy), overlays confidence/status icons, a
|
|
5
|
-
* click-through
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* claim resolution + discrepancy), overlays confidence/status icons, and a
|
|
5
|
+
* click-through Inspector dialog with inline + modal-driven override editing.
|
|
6
|
+
* The host calls `initVerification` once with `data` and an optional
|
|
7
|
+
* `saveOverride` transport. SG-392: the base `__meta` is LIGHT (no citation
|
|
8
|
+
* sources/history — only their `*_count`); the ONE thing this library fetches
|
|
9
|
+
* on its own is that full per-field detail, via `detailUrl`, the instant the
|
|
10
|
+
* Inspector dialog opens for a field (see `fetchDataPointDetail`).
|
|
8
11
|
*/
|
|
9
12
|
import "./styles.css";
|
|
10
13
|
export { initVerification, useVerification } from "./context";
|
|
@@ -13,7 +16,6 @@ export { default as VerifiedField } from "./components/VerifiedField.vue";
|
|
|
13
16
|
export { default as VerificationChrome } from "./components/VerificationChrome.vue";
|
|
14
17
|
export { default as ConfidenceIcon } from "./components/ConfidenceIcon.vue";
|
|
15
18
|
export { default as VerificationModal } from "./components/VerificationModal.vue";
|
|
16
|
-
export { default as ComparisonPage } from "./components/ComparisonPage.vue";
|
|
17
19
|
export { default as CitationEvidence } from "./components/CitationEvidence.vue";
|
|
18
20
|
export { default as CitationPageList } from "./components/CitationPageList.vue";
|
|
19
21
|
export { default as CitationPage } from "./components/CitationPage.vue";
|
|
@@ -26,7 +28,7 @@ export { citationEvidence, citationSummary } from "./lib/citations";
|
|
|
26
28
|
export type { CitationPage as CitationPageModel, CitationEvidence as CitationEvidenceModel } from "./lib/citations";
|
|
27
29
|
export { computeProgress } from "./lib/progress";
|
|
28
30
|
export type { VerificationProgress } from "./lib/progress";
|
|
29
|
-
export {
|
|
30
|
-
export type { AuditLlmCall } from "./lib/
|
|
31
|
+
export { fetchDataPointDetail } from "./lib/dataPointDetail";
|
|
32
|
+
export type { AuditLlmCall, DataPointDetail } from "./lib/dataPointDetail";
|
|
31
33
|
export { CHROME_CLASS, ENABLED_STORAGE_KEY } from "./constants";
|
|
32
34
|
export type { VerificationStatus, ResolvedSource, SourceChoice, VerificationSource, ExtractedCandidate, OverrideCandidate, ClaimCandidate, CandidateSet, DataPointAnchor, ResolvedValue, DataPointMeta, MetaCarrier, SaveOverrideArgs, SaveOverrideFn, } from "./types";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DataPointAnchor, ExtractedCandidate } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* One sanitized LLM call from the host's token-sealed data-point detail endpoint
|
|
4
|
+
* (gpt-manager `TemplateRenderDataController::dataPointDetail()`).
|
|
5
|
+
* Request/response are the raw JSON payloads the team owns; headers/stack traces
|
|
6
|
+
* never ship.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuditLlmCall {
|
|
9
|
+
id: number | string;
|
|
10
|
+
service?: string | null;
|
|
11
|
+
endpoint?: string | null;
|
|
12
|
+
model?: string | null;
|
|
13
|
+
status_code?: number | null;
|
|
14
|
+
run_time_ms?: number | null;
|
|
15
|
+
started_at?: string | null;
|
|
16
|
+
request?: unknown;
|
|
17
|
+
response?: unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Which pipeline stage this call belongs to (e.g. "Data Extraction Directive") —
|
|
20
|
+
* the TaskOrchestrator name the host resolved this call's TaskWorker back to.
|
|
21
|
+
* Null when the host could not attribute a stage (see gpt-manager's
|
|
22
|
+
* DataPointAuditService for the current Extraction-only attribution scope).
|
|
23
|
+
*/
|
|
24
|
+
stage?: string | null;
|
|
25
|
+
}
|
|
26
|
+
/** One host detail-endpoint response — the full candidate + its LLM-call trace. */
|
|
27
|
+
export interface DataPointDetail {
|
|
28
|
+
/** The full extracted candidate (sources/history included), or null when the
|
|
29
|
+
* field has no verification provenance at all. */
|
|
30
|
+
extracted: ExtractedCandidate | null;
|
|
31
|
+
audit: AuditLlmCall[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Lazy-fetch the FULL detail for one data point (SG-392): its citation sources,
|
|
35
|
+
* full extraction history, and the LLM-call trace behind it, all in ONE request.
|
|
36
|
+
* The anchor's NEAREST object id + leaf field identify the attribute; the host
|
|
37
|
+
* re-resolves its sources server-side (the client never names ApiLog ids). Throws
|
|
38
|
+
* on a non-OK response — callers surface the failure state; an empty `audit`
|
|
39
|
+
* array or a null `extracted` is a valid "nothing there" result, not an error.
|
|
40
|
+
*/
|
|
41
|
+
export declare function fetchDataPointDetail(detailUrl: string, anchor: DataPointAnchor): Promise<DataPointDetail>;
|