Sync SharedContracts with DomRange/Structural selector shapes
Mirror citation-engine contract updates for non-PDF anchoring (EANCH-WP-0003).
This commit is contained in:
parent
57d64c6416
commit
e087949642
1 changed files with 57 additions and 2 deletions
|
|
@ -148,6 +148,37 @@ StructuralSelector heading/section/AST path
|
|||
FragmentSelector exported fragment / deep link (export-only)
|
||||
```
|
||||
|
||||
Field shapes (non-PDF selectors, EANCH-WP-0003):
|
||||
|
||||
```ts
|
||||
type DomNodePath = readonly number[];
|
||||
|
||||
interface DomRangeSelector {
|
||||
type: "DomRangeSelector";
|
||||
startPath: DomNodePath;
|
||||
startOffset: number;
|
||||
endPath: DomNodePath;
|
||||
endOffset: number;
|
||||
}
|
||||
|
||||
interface StructuralPathSegment {
|
||||
kind: "heading" | "section" | "block";
|
||||
index: number;
|
||||
level?: number;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
interface StructuralSelector {
|
||||
type: "StructuralSelector";
|
||||
path: readonly StructuralPathSegment[];
|
||||
startOffset: number;
|
||||
endOffset: number;
|
||||
}
|
||||
```
|
||||
|
||||
`StructureMap` on `DocumentRepresentation` maps canonical-text spans to
|
||||
structural paths. Ingest may omit it; viewer adapters populate at selection time.
|
||||
|
||||
**Selector redundancy rule:** when an annotation is created, the system stores
|
||||
*all selector types that are available* for that document representation, not
|
||||
just one. Resolution tries them in order of expected confidence and stops at
|
||||
|
|
@ -218,8 +249,32 @@ interface DocumentViewerAdapter {
|
|||
}
|
||||
```
|
||||
|
||||
MVP delivers a single `PDFViewerAdapter`. HTML and Markdown adapters are
|
||||
deferred.
|
||||
MVP delivers a single `PDFViewerAdapter`. HTML and Markdown adapters ship in
|
||||
`evidence-anchor/dom`.
|
||||
|
||||
`SelectionCapture` is a discriminated union:
|
||||
|
||||
```ts
|
||||
interface PdfSelectionCapture {
|
||||
kind: "pdf";
|
||||
text: string;
|
||||
page: number;
|
||||
rects: readonly NormalizedRect[];
|
||||
boundingRect?: NormalizedRect;
|
||||
}
|
||||
|
||||
interface DomSelectionCapture {
|
||||
kind: "dom";
|
||||
text: string;
|
||||
startPath: DomNodePath;
|
||||
startOffset: number;
|
||||
endPath: DomNodePath;
|
||||
endOffset: number;
|
||||
structuralPath?: readonly StructuralPathSegment[];
|
||||
}
|
||||
|
||||
type SelectionCapture = PdfSelectionCapture | DomSelectionCapture;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue