@thehammer/template-verification 0.2.7 → 0.2.9

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.
@@ -1,4 +1,4 @@
1
- import type { AuditLlmCall } from "../lib/audit";
1
+ import type { AuditLlmCall } from "../lib/dataPointDetail";
2
2
  /**
3
3
  * One LLM call in the Inspector's Audit trail — model/service chips, status +
4
4
  * timing header, and collapsible JSON request/response viewers (danx-ui
@@ -4,8 +4,8 @@ import type { CitationPage } from "../lib/citations";
4
4
  * ordered verbatim quotes on the right, and the page-level actions.
5
5
  *
6
6
  * Renders ONLY the body — the collapsed header row lives in
7
- * {@link CitationPageList} because `DanxAccordion` renders its header as a
8
- * `<button>`, and the view/download controls here are themselves buttons.
7
+ * {@link CitationPageList} because the disclosure's header is itself a
8
+ * `<button>`, and the view/download controls here are buttons too.
9
9
  *
10
10
  * The thumbnail is a `DanxFile` in `downloadable` mode: hovering it exposes
11
11
  * danx-ui's own download control, and clicking it opens the full-screen viewer.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * A minimal, accessible collapsible-section list — the package's own, on purpose.
3
+ *
4
+ * danx-ui ships `DanxAccordion`, but a template app does NOT resolve danx-ui from
5
+ * this package's node_modules: the danxbot build marks it external and the browser
6
+ * resolves it at load time from the shell's vendor chunk, which pins
7
+ * `@thehammer/danx-ui: ^0.8.17` (see danxbot `spa-template-shell/package.json`).
8
+ * `DanxAccordion` does not exist there, and importing it fails the template's vite
9
+ * build with a Rollup "not exported" error — which is exactly what happened on the
10
+ * first attempt to ship this feature.
11
+ *
12
+ * The rule this encodes: this package must only use danx-ui surface that exists at
13
+ * the FLOOR of its declared peer range, never whatever the local install happens to
14
+ * resolve. A ~40-line disclosure is a much cheaper guarantee than a version bump
15
+ * coordinated across the shell and every template.
16
+ *
17
+ * The header is a `<button>` (its own accessible toggle), so slot content placed in
18
+ * it must not itself be interactive — put actions in the `panel` slot.
19
+ */
20
+ type __VLS_Props = {
21
+ /** Sections to render, in order. `value` is the open/closed key. */
22
+ items: Array<{
23
+ value: string;
24
+ label?: string;
25
+ }>;
26
+ /** Open section keys. Any number may be open at once. */
27
+ modelValue: string[];
28
+ /** Prefix for the generated aria ids — unique per usage on a page. */
29
+ idPrefix?: string;
30
+ };
31
+ declare var __VLS_1: {
32
+ item: {
33
+ value: string;
34
+ label?: string | undefined;
35
+ };
36
+ isOpen: boolean;
37
+ }, __VLS_3: {
38
+ item: {
39
+ value: string;
40
+ label?: string | undefined;
41
+ };
42
+ isOpen: boolean;
43
+ };
44
+ type __VLS_Slots = {} & {
45
+ header?: (props: typeof __VLS_1) => any;
46
+ } & {
47
+ panel?: (props: typeof __VLS_3) => any;
48
+ };
49
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
50
+ "update:modelValue": (value: string[]) => any;
51
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
52
+ "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
53
+ }>, {
54
+ idPrefix: string;
55
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, __VLS_Slots>;
56
+ export default _default;
57
+ type __VLS_WithSlots<T, S> = T & {
58
+ new (): {
59
+ $slots: S;
60
+ };
61
+ };
@@ -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: lazily fetched LLM calls (token-sealed host endpoint) rendered
18
- * as AuditCallCards; hidden entirely when the host minted no audit_url.
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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Class applied to EVERY piece of library chrome (settings button + panel,
3
- * overlay icons, discrepancy indicators, comparison-page trigger, modal). A single
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 audit endpoint base (`__verification.audit_url` from the host).
31
- * Present ⇒ the Inspector's Audit tab lazy-loads a data point's LLM-call trace
32
- * from `{auditUrl}?object_id=&field=`. Absent ⇒ the Audit tab is hidden.
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
- auditUrl?: string | null;
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 audit endpoint base; null/absent hides the Audit tab. */
58
- auditUrl?: string | null;
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 detail modal with inline + modal-driven override editing, and a
6
- * recursive comparison page. Fetches nothing — the host calls `initVerification`
7
- * once with `data` and an optional `saveOverride` transport.
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 { fetchDataPointAudit } from "./lib/audit";
30
- export type { AuditLlmCall } from "./lib/audit";
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>;