Add hybrid research copilot workspace

This commit is contained in:
2026-03-14 19:32:00 -04:00
parent 7a42d73a48
commit 2ee9a549a3
27 changed files with 2864 additions and 323 deletions

View File

@@ -15,6 +15,8 @@ import type {
ResearchArtifact,
ResearchArtifactKind,
ResearchArtifactSource,
ResearchCopilotSession,
ResearchCopilotTurnResponse,
ResearchJournalEntry,
ResearchJournalEntryType,
SearchAnswerResponse,
@@ -226,6 +228,48 @@ export async function getResearchWorkspace(ticker: string) {
}, 'Unable to fetch research workspace');
}
export async function getResearchCopilotSession(ticker: string) {
return await requestJson<{ session: ResearchCopilotSession | null }>({
path: `/api/research/copilot/session?ticker=${encodeURIComponent(ticker.trim().toUpperCase())}`
}, 'Unable to fetch research copilot session');
}
export async function runResearchCopilotTurn(input: {
ticker: string;
query: string;
sources?: SearchSource[];
pinnedArtifactIds?: number[];
memoSection?: ResearchMemoSection | null;
}) {
return await requestJson<ResearchCopilotTurnResponse>({
path: '/api/research/copilot/turn',
method: 'POST',
body: {
ticker: input.ticker.trim().toUpperCase(),
query: input.query.trim(),
...(input.sources && input.sources.length > 0 ? { sources: input.sources } : {}),
...(input.pinnedArtifactIds && input.pinnedArtifactIds.length > 0 ? { pinnedArtifactIds: input.pinnedArtifactIds } : {}),
...(input.memoSection ? { memoSection: input.memoSection } : {})
}
}, 'Unable to run research copilot turn');
}
export async function queueResearchCopilotJob(input: {
ticker: string;
query: string;
sources?: SearchSource[];
}) {
return await requestJson<{ task: Task }>({
path: '/api/research/copilot/job',
method: 'POST',
body: {
ticker: input.ticker.trim().toUpperCase(),
query: input.query.trim(),
...(input.sources && input.sources.length > 0 ? { sources: input.sources } : {})
}
}, 'Unable to queue research brief');
}
export async function listResearchLibrary(input: {
ticker: string;
q?: string;