feat(types): add canonical evidence and reconstruction contracts
This commit is contained in:
@@ -28,3 +28,189 @@ export interface Registry {
|
|||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
updatedAt: Date;
|
updatedAt: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CapabilityDisposition =
|
||||||
|
| "CORE"
|
||||||
|
| "DEPENDENCY"
|
||||||
|
| "CHERRY_PICK"
|
||||||
|
| "ADAPTER"
|
||||||
|
| "REIMPLEMENT"
|
||||||
|
| "REFERENCE_ONLY"
|
||||||
|
| "DROP";
|
||||||
|
|
||||||
|
export type EvidenceConfidence =
|
||||||
|
| "measured"
|
||||||
|
| "observed"
|
||||||
|
| "inferred"
|
||||||
|
| "declared"
|
||||||
|
| "unknown";
|
||||||
|
|
||||||
|
export type ReconstructionMode = "clone" | "adapt" | "blend";
|
||||||
|
|
||||||
|
export type EvidenceKind =
|
||||||
|
| "dom"
|
||||||
|
| "runtime-html"
|
||||||
|
| "computed-style"
|
||||||
|
| "stylesheet"
|
||||||
|
| "accessibility"
|
||||||
|
| "screenshot"
|
||||||
|
| "asset"
|
||||||
|
| "network-request"
|
||||||
|
| "network-response"
|
||||||
|
| "har"
|
||||||
|
| "websocket"
|
||||||
|
| "sse"
|
||||||
|
| "storage"
|
||||||
|
| "interaction"
|
||||||
|
| "state-transition"
|
||||||
|
| "workflow"
|
||||||
|
| "animation"
|
||||||
|
| "media"
|
||||||
|
| "canvas"
|
||||||
|
| "webgl"
|
||||||
|
| "performance"
|
||||||
|
| "semantic-observation";
|
||||||
|
|
||||||
|
export interface CaptureViewport {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
deviceScaleFactor?: number;
|
||||||
|
isMobile?: boolean;
|
||||||
|
hasTouch?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CaptureProfile {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
authenticated: boolean;
|
||||||
|
role?: string;
|
||||||
|
locale?: string;
|
||||||
|
colorScheme?: "light" | "dark" | "no-preference";
|
||||||
|
viewport?: CaptureViewport;
|
||||||
|
featureFlags?: Record<string, string | boolean | number>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProvenanceSource {
|
||||||
|
repository?: string;
|
||||||
|
commit?: string;
|
||||||
|
sourcePaths?: string[];
|
||||||
|
license?: string;
|
||||||
|
classification?: CapabilityDisposition;
|
||||||
|
adapter?: string;
|
||||||
|
tool?: string;
|
||||||
|
toolVersion?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EvidenceRecord<T = unknown> {
|
||||||
|
id: string;
|
||||||
|
targetId: string;
|
||||||
|
kind: EvidenceKind;
|
||||||
|
route?: string;
|
||||||
|
capturedAt: string;
|
||||||
|
method: string;
|
||||||
|
confidence: EvidenceConfidence;
|
||||||
|
captureProfileId: string;
|
||||||
|
viewport?: CaptureViewport;
|
||||||
|
source: ProvenanceSource;
|
||||||
|
payload: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RouteNode {
|
||||||
|
id: string;
|
||||||
|
path: string;
|
||||||
|
canonicalUrl?: string;
|
||||||
|
title?: string;
|
||||||
|
evidenceIds: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RouteEdge {
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
trigger: "link" | "redirect" | "action" | "script" | "semantic-discovery";
|
||||||
|
evidenceIds: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StateTransition {
|
||||||
|
id: string;
|
||||||
|
fromState: string;
|
||||||
|
toState: string;
|
||||||
|
action: string;
|
||||||
|
evidenceIds: string[];
|
||||||
|
networkEvidenceIds?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductEntity {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
attributes: Record<string, unknown>;
|
||||||
|
evidenceIds: string[];
|
||||||
|
confidence: EvidenceConfidence;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductRelationship {
|
||||||
|
id: string;
|
||||||
|
fromEntityId: string;
|
||||||
|
toEntityId: string;
|
||||||
|
type: string;
|
||||||
|
cardinality?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
|
||||||
|
evidenceIds: string[];
|
||||||
|
confidence: EvidenceConfidence;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WorkflowStep {
|
||||||
|
id: string;
|
||||||
|
action: string;
|
||||||
|
preconditions?: string[];
|
||||||
|
resultingState?: string;
|
||||||
|
evidenceIds: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductWorkflow {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
steps: WorkflowStep[];
|
||||||
|
errorPaths?: WorkflowStep[][];
|
||||||
|
evidenceIds: string[];
|
||||||
|
confidence: EvidenceConfidence;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FidelityVector {
|
||||||
|
geometry?: number;
|
||||||
|
typography?: number;
|
||||||
|
colors?: number;
|
||||||
|
assets?: number;
|
||||||
|
responsiveCoverage?: number;
|
||||||
|
routeCoverage?: number;
|
||||||
|
interactionCoverage?: number;
|
||||||
|
workflowCoverage?: number;
|
||||||
|
networkContractParity?: number;
|
||||||
|
motionParity?: number;
|
||||||
|
accessibilityPass?: boolean;
|
||||||
|
runtimeErrorCount?: number;
|
||||||
|
productionBuildPass?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpstreamCapabilityRecord {
|
||||||
|
id: string;
|
||||||
|
capability: string;
|
||||||
|
disposition: CapabilityDisposition;
|
||||||
|
source: ProvenanceSource;
|
||||||
|
targetModule?: string;
|
||||||
|
rationale: string;
|
||||||
|
tests: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReconstructionSpec {
|
||||||
|
id: string;
|
||||||
|
targetId: string;
|
||||||
|
version: string;
|
||||||
|
mode: ReconstructionMode;
|
||||||
|
schemaVersion: string;
|
||||||
|
evidenceIds: string[];
|
||||||
|
routes: RouteNode[];
|
||||||
|
routeEdges: RouteEdge[];
|
||||||
|
entities: ProductEntity[];
|
||||||
|
relationships: ProductRelationship[];
|
||||||
|
workflows: ProductWorkflow[];
|
||||||
|
fidelityRequirements: FidelityVector;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user