feat(research): add projects and revisioned evidence-linked findings

This commit is contained in:
Boki 2026-10-23 23:38:47 -04:00
parent 618fb9e33c
commit ee45257507
22 changed files with 2947 additions and 17 deletions

View file

@ -158,3 +158,5 @@ export type {
HistoricalDatasetV2,
HistoricalDatasetInputV2,
} from './historical-data';
export type * from './research';

View file

@ -0,0 +1,83 @@
/** Research narrative and citations. Referencing a measurement never validates prose. */
export type ResearchActor = 'operator' | 'service';
export type ResearchContentOrigin = 'human' | 'ai' | 'unknown';
export type ResearchMetricsVersion = 'canonical-analytics/v1' | 'legacy-display/v1';
export interface ResearchAuthorship {
submittedBy: ResearchActor;
/** Declared content origin, not authenticated model/agent identity. */
contentOrigin: ResearchContentOrigin;
}
export interface ResearchProject {
id: string;
title: string;
description: string;
revision: number;
ownerPrincipal: ResearchActor;
updatedBy: ResearchActor;
archived: boolean;
createdAt: string;
updatedAt: string;
}
export interface ResearchHypothesisRevision extends ResearchAuthorship {
id: string;
hypothesisId: string;
ordinal: number;
title: string;
proposition: string;
validationCriteria: string;
validationState: 'unvalidated';
createdAt: string;
}
export interface ResearchHypothesis {
id: string;
projectId: string;
ownerPrincipal: ResearchActor;
updatedBy: ResearchActor;
updatedAt: string;
archived: boolean;
createdAt: string;
latestRevision: ResearchHypothesisRevision;
}
export interface ResearchEvidenceReference {
runId: string;
metricsVersion: ResearchMetricsVersion;
metricPath: string;
/** Optional exact executable version; accepted only when bound by the run. */
strategyVersionId?: string | null;
}
export interface ResearchEvidence extends ResearchEvidenceReference {
backtestId: string;
value: number | null;
unit: 'fraction' | 'ratio' | 'count' | 'currency';
availability: 'available' | 'unavailable';
unavailableReason: string | null;
resultKind: 'canonical' | 'legacy';
financialEngine: 'rust' | 'native' | 'typescript' | 'legacy';
datasetHash: string | null;
limitations: { code: string; message: string }[];
}
export interface ResearchArtifactRevision extends ResearchAuthorship {
id: string;
artifactId: string;
ordinal: number;
title: string;
body: string;
validationState: 'unvalidated';
evidenceState: 'none' | 'referenced';
evidence: ResearchEvidence[];
createdAt: string;
}
export interface ResearchArtifact {
id: string;
projectId: string;
/** Links a particular narrative, not a hypothesis's mutable latest revision. */
hypothesisRevisionId: string | null;
kind: 'note' | 'finding';
ownerPrincipal: ResearchActor;
updatedBy: ResearchActor;
updatedAt: string;
archived: boolean;
createdAt: string;
latestRevision: ResearchArtifactRevision;
}