Files
fusion/plugins/fusion-plugin-compound-engineering/src/dashboard-interop.d.ts
gsxdsm 8c170480dd fix(compound-engineering): break dashboard dependency cycle
A new workspace-acyclicity invariant on main (run via the PR merge) flagged
compound-engineering -> @fusion/dashboard -> compound-engineering: the plugin is
listed in @fusion/dashboard's deps (for view loading) AND declared @fusion/dashboard
as a runtime dependency, which the cycle check (deps+devDeps) and the
'bundled plugins must not depend on host packages' check both reject.

The plugin's only @fusion/dashboard use is the type-only PluginDashboardViewContext
import. Drop the @fusion/dashboard dependency and resolve that type via an ambient
dashboard-interop.d.ts + tsconfig paths mapping (the fusion-plugin-dependency-graph
interop pattern). Breaks the cycle; the host passes the real context at runtime.
2026-06-03 07:59:20 -07:00

35 lines
1.5 KiB
TypeScript

// Ambient declaration for the dashboard host's plugin-view context, so this
// bundled plugin can consume the type WITHOUT a runtime dependency on
// `@fusion/dashboard` (a host package). Depending on the host would create a
// dashboard -> plugin -> dashboard cycle and violate the workspace-acyclicity /
// "bundled plugins must not depend on host packages" invariants. The host
// passes the real object at runtime; this minimal structural shape is enough to
// type-check the fields this plugin actually reads. Mirrors the interop pattern
// used by fusion-plugin-dependency-graph.
declare module "@fusion/dashboard/app/plugins/types" {
import type { ReactNode } from "react";
import type { Task, TaskDetail, WorkflowStep } from "@fusion/core";
export type DetailTaskTab =
| "definition" | "logs" | "changes" | "comments" | "model" | "workflow" | "pr" | "retries";
export type PluginToastType = "success" | "error" | "warning" | "info";
export interface PluginCustomEvent {
event: string;
payload: unknown;
}
export interface PluginDashboardViewContext {
projectId?: string;
tasks: Task[];
workflowSteps: WorkflowStep[];
openTaskDetail: (task: Task | TaskDetail, initialTab?: DetailTaskTab) => void;
renderTaskCard?: (task: Task | TaskDetail) => ReactNode;
addToast?: (message: string, type?: PluginToastType) => void;
subscribePluginEvents?: (
pluginId: string,
onEvent: (event: PluginCustomEvent) => void,
) => () => void;
}
}