Implement EANCH-WP-0002 and EANCH-WP-0003 anchor hardening and DOM selectors
WP-0002: stale vs unresolved resolution, orphaned flag/helper, bounded fuzzy quote recovery, and PdfViewerAdapter promotion with resolveSelectors integration. WP-0003: DomSelectionCapture, DOM create/resolve ladder, HtmlViewerAdapter under evidence-anchor/dom, and finished workplans. Verification: 42 anchor tests, citation-evidence typecheck + 51 tests green.
This commit is contained in:
parent
e4582b52fa
commit
a1af0c6a45
22 changed files with 1118 additions and 105 deletions
24
src/types.ts
24
src/types.ts
|
|
@ -12,7 +12,11 @@
|
|||
import type { Document, DocumentRepresentation } from "@citation-evidence/engine/shared";
|
||||
import type { Selector } from "@citation-evidence/engine/shared";
|
||||
import type { AnnotationResolutionStatus } from "@citation-evidence/engine/shared";
|
||||
import type { NormalizedRect } from "@citation-evidence/engine/shared";
|
||||
import type {
|
||||
DomNodePath,
|
||||
NormalizedRect,
|
||||
StructuralPathSegment,
|
||||
} from "@citation-evidence/engine/shared";
|
||||
|
||||
/**
|
||||
* The raw selection captured from a viewer adapter — an opaque payload that
|
||||
|
|
@ -36,8 +40,17 @@ export interface PdfSelectionCapture {
|
|||
readonly boundingRect?: NormalizedRect;
|
||||
}
|
||||
|
||||
/** Reserved for the HTML/Markdown adapter. Not implementable in MVP. */
|
||||
export type DomSelectionCapture = never;
|
||||
/** Selection captured from a rendered HTML/Markdown viewer. */
|
||||
export interface DomSelectionCapture {
|
||||
readonly kind: "dom";
|
||||
/** Verbatim selected text, before canonical normalisation. */
|
||||
readonly text: string;
|
||||
readonly startPath: DomNodePath;
|
||||
readonly startOffset: number;
|
||||
readonly endPath: DomNodePath;
|
||||
readonly endOffset: number;
|
||||
readonly structuralPath?: readonly StructuralPathSegment[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A passage located inside a representation, ready to be scrolled to and
|
||||
|
|
@ -65,6 +78,11 @@ export interface AnchorResolution {
|
|||
/** Names of the selector kinds that produced a usable candidate. */
|
||||
readonly usedSelectorTypes: readonly string[];
|
||||
readonly warnings?: readonly string[];
|
||||
/**
|
||||
* True when no selector could place the anchor at all. Distinct from `stale`,
|
||||
* which signals representation drift and may still return fuzzy candidates.
|
||||
*/
|
||||
readonly orphaned?: boolean;
|
||||
}
|
||||
|
||||
export interface HighlightRenderOptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue