Merge branch 't3code/expand-research-management-plan'

# Conflicts:
#	app/analysis/page.tsx
#	app/watchlist/page.tsx
#	components/shell/app-shell.tsx
#	lib/api.ts
#	lib/query/options.ts
#	lib/server/api/app.ts
#	lib/server/db/index.test.ts
#	lib/server/db/index.ts
#	lib/server/db/schema.ts
#	lib/server/repos/research-journal.ts
#	lib/types.ts
This commit is contained in:
2026-03-07 20:39:49 -05:00
38 changed files with 5533 additions and 427 deletions

View File

@@ -8,6 +8,19 @@ export type User = {
export type CoverageStatus = 'backlog' | 'active' | 'watch' | 'archive';
export type CoveragePriority = 'low' | 'medium' | 'high';
export type ResearchJournalEntryType = 'note' | 'filing_note' | 'status_change';
export type NumberScaleUnit = 'thousands' | 'millions' | 'billions';
export type ResearchArtifactKind = 'filing' | 'ai_report' | 'note' | 'upload' | 'memo_snapshot' | 'status_change';
export type ResearchArtifactSource = 'system' | 'user';
export type ResearchVisibilityScope = 'private' | 'organization';
export type ResearchMemoRating = 'strong_buy' | 'buy' | 'hold' | 'sell';
export type ResearchMemoConviction = 'low' | 'medium' | 'high';
export type ResearchMemoSection =
| 'thesis'
| 'variant_view'
| 'catalysts'
| 'risks'
| 'disconfirming_evidence'
| 'next_actions';
export type WatchlistItem = {
id: number;
@@ -232,6 +245,93 @@ export type SearchAnswerResponse = {
results: SearchResult[];
};
export type ResearchArtifact = {
id: number;
user_id: string;
organization_id: string | null;
ticker: string;
accession_number: string | null;
kind: ResearchArtifactKind;
source: ResearchArtifactSource;
subtype: string | null;
title: string | null;
summary: string | null;
body_markdown: string | null;
search_text: string | null;
visibility_scope: ResearchVisibilityScope;
tags: string[];
metadata: Record<string, unknown> | null;
file_name: string | null;
mime_type: string | null;
file_size_bytes: number | null;
storage_path: string | null;
created_at: string;
updated_at: string;
linked_to_memo: boolean;
};
export type ResearchMemo = {
id: number;
user_id: string;
organization_id: string | null;
ticker: string;
rating: ResearchMemoRating | null;
conviction: ResearchMemoConviction | null;
time_horizon_months: number | null;
packet_title: string | null;
packet_subtitle: string | null;
thesis_markdown: string;
variant_view_markdown: string;
catalysts_markdown: string;
risks_markdown: string;
disconfirming_evidence_markdown: string;
next_actions_markdown: string;
created_at: string;
updated_at: string;
};
export type ResearchMemoEvidenceLink = {
id: number;
memo_id: number;
artifact_id: number;
section: ResearchMemoSection;
annotation: string | null;
sort_order: number;
created_at: string;
artifact: ResearchArtifact;
};
export type ResearchPacketSection = {
section: ResearchMemoSection;
title: string;
body_markdown: string;
evidence: ResearchMemoEvidenceLink[];
};
export type ResearchPacket = {
ticker: string;
companyName: string | null;
generated_at: string;
memo: ResearchMemo | null;
sections: ResearchPacketSection[];
};
export type ResearchLibraryResponse = {
artifacts: ResearchArtifact[];
availableTags: string[];
};
export type ResearchWorkspace = {
ticker: string;
companyName: string | null;
coverage: WatchlistItem | null;
latestFilingDate: string | null;
memo: ResearchMemo | null;
library: ResearchArtifact[];
packet: ResearchPacket;
availableTags: string[];
};
export type CompanyFinancialPoint = {
filingDate: string;
filingType: Filing['filing_type'];