feat: add Super Alpha research, management and MCP workflows
Deploy production / deploy (push) Successful in 56s

This commit is contained in:
yuxuanhui
2026-09-13 12:32:16 +08:00
parent 7c8188df9c
commit e256d6fef1
59 changed files with 3766 additions and 125 deletions
+12 -2
View File
@@ -15,6 +15,8 @@ export type PageContext = {
page:
| "home"
| "alphas"
| "superalphas"
| "superalpha-research"
| "account"
| "datasets"
| "fields"
@@ -48,9 +50,17 @@ export type PageContext = {
filters?: Record<string, unknown>;
};
export type AlphaUIAction =
| { type: "open_alpha"; alpha_id: string; nonce: number }
| { type: "open_alpha"; alpha_id: string; alpha_type?: string; nonce: number }
| { type: "apply_filters"; filters: Record<string, unknown>; nonce: number };
export type UIAction =
| {
type: "open_superalpha_research";
plan_id?: string;
version?: number;
experiment_id?: string;
alpha_id?: string;
nonce: number;
}
| { type: "open_feature"; asset_id: string; version?: number; nonce: number }
| { type: "open_template"; asset_id: string; version?: number; nonce: number }
| { type: "open_experiment"; experiment_id: string; nonce: number }
@@ -59,7 +69,7 @@ export type UIAction =
| { type: "open_research_input"; input_id: string; nonce: number }
| { type: "open_backtest"; run_id: string; nonce: number }
| { type: "open_backtest_preview"; preview_id: string; nonce: number }
| { type: "open_alpha"; alpha_id: string; nonce: number }
| { type: "open_alpha"; alpha_id: string; alpha_type?: string; nonce: number }
| { type: "apply_filters"; filters: Record<string, unknown>; nonce: number };
export type ToolCard = {
id: string;
+13
View File
@@ -68,6 +68,10 @@ const contextLabels: Record<
home: () => "上下文:首页看板",
alphas: (context) =>
`上下文:${context.alpha_id ? `Alpha ${context.alpha_id}` : "Alpha 列表"}${context.selected_ids?.length ? ` · 已选 ${context.selected_ids.length} 条` : ""}`,
superalphas: (c) =>
`上下文:Super Alpha 管理${c.alpha_id ? ` · ${c.alpha_id}` : ""}`,
"superalpha-research": (c) =>
`上下文:Super Alpha 研究${c.research_asset_id ? ` · 方案 ${c.research_asset_id}` : ""}${c.research_experiment_id ? ` · 候选 ${c.research_experiment_id}` : ""}`,
operators: () => "上下文:算子库",
templates: (context) =>
`上下文:模板工坊${context.research_asset_id ? ` · ${context.research_asset_id}` : ""}${context.research_experiment_id ? ` · 实验 ${context.research_experiment_id}` : ""}`,
@@ -100,6 +104,7 @@ type Destination = {
};
// Exhaustive action destinations prevent a new action silently falling into Alpha.
const destinations: Record<UIAction["type"], Destination> = {
open_superalpha_research: { page: "superalpha-research", chat: "responsive" },
open_feature: { page: "features", chat: "responsive" },
open_template: { page: "templates", chat: "responsive" },
open_experiment: { page: "templates", chat: "responsive" },
@@ -113,6 +118,14 @@ const destinations: Record<UIAction["type"], Destination> = {
};
export function actionDestination(action: UIAction): Destination | undefined {
if (action.type === "open_alpha" && action.alpha_type === "SUPER")
return { page: "superalphas", chat: "responsive" };
if (
action.type === "apply_filters" &&
(action.filters.management_scope === "super" ||
action.filters.alpha_type === "SUPER")
)
return { page: "superalphas", chat: "responsive" };
return Object.hasOwn(destinations, action.type)
? destinations[action.type]
: undefined;