跳转到内容

前端 SDK 导出:MentionSelectionApi – ModelSubmitOutcome

本页由当前 SDK 声明自动生成。 导入入口:@woohaa3/frontend/extension-api。

返回接口索引

MentionSelectionApi · MenuEntry · MenuIcon · MenuItem · MenuListIcon · MenuRadioGroup · MenuRadioItem · MenuSeparator · MigrationIcon · MinusIcon · ModelEditorSession · ModelExecutionDraft · ModelExecutionDraftPatch · ModelExecutionStatus · ModelInteractionDefinition · ModelInteractionDescriptor · ModelInteractionRegistry · ModelInteractionSummary · ModelPanelComponent · ModelPanelProps · ModelPanelRenderers · ModelReferenceItem · ModelSubmitDraft · ModelSubmitOutcome

MentionSelectionApi

编辑器命令式选区 API。 供宿主(执行面板)在插入片段时替换当前选区或光标位置文本;不暴露编辑器内部结构。

export type MentionSelectionApi = {
getSelection: () => {
start: number;
end: number;
} | null;
replaceSelection: (text: string) => void;
};

成员说明:

  • getSelection:当前选区字符范围;无选区时为 null(光标位置)。
  • replaceSelection:用文本替换当前选区;无选区时插入光标位置。

MenuEntry

单个菜单项(普通 Dropdown 模式)。

export function MenuEntry(props: { item: MenuItem; itemClassName?: string; separatorClassName?: string; }): React.JSX.Element;

关联类型:MenuItem

MenuIcon

export const MenuIcon: { ({ size, strokeWidth, absoluteStrokeWidth, ...rest }: UiIconProps): React.JSX.Element; displayName: string; };

关联类型:UiIconProps

MenuItem

export type MenuItem = {
id: string;
label: ReactNode;
disabled?: boolean;
danger?: boolean;
separatorBefore?: boolean;
reason?: string;
selected?: boolean;
children?: readonly MenuItem[];
onSelect: (id: string) => void;
};

成员说明:

  • reason:禁用原因(桌面悬停提示/诊断;不构成无障碍契约)。
  • selected:选中态(radio/checked 语义)。

MenuListIcon

export const MenuListIcon: { ({ size, strokeWidth, absoluteStrokeWidth, ...rest }: UiIconProps): React.JSX.Element; displayName: string; };

关联类型:UiIconProps

MenuRadioGroup

export const MenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;

MenuRadioItem

单选菜单项(role="menuitemradio")。受 Radix RadioGroup 的 roving focus 与方向键管理; 保留 data-active/aria-checked 供既有测试与业务 class 使用。

export function MenuRadioItem(props: { value: string; active: boolean; label?: string; disabled?: boolean; className?: string; onSelect: (event: Event) => void; children: ReactNode; }): React.JSX.Element;

MenuSeparator

export const MenuSeparator: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;

MigrationIcon

数据迁移与导入。

export const MigrationIcon: { ({ size, strokeWidth, absoluteStrokeWidth, ...rest }: UiIconProps): React.JSX.Element; displayName: string; };

关联类型:UiIconProps

MinusIcon

export const MinusIcon: { ({ size, strokeWidth, absoluteStrokeWidth, ...rest }: UiIconProps): React.JSX.Element; displayName: string; };

关联类型:UiIconProps

ModelEditorSession

export class ModelEditorSession {
constructor();
getState: () => ModelEditorState;
subscribe: (listener: () => void) => (() => void);
enter: (nodeId: string) => void;
exit: () => void;
}

ModelExecutionDraft

受控 draft:Panel 可读、通过 patchDraft 写。

export type ModelExecutionDraft = {
prompt: string;
parameters: Record<string, unknown>;
};

ModelExecutionDraftPatch

export type ModelExecutionDraftPatch = Partial<ModelExecutionDraft>;

关联类型:ModelExecutionDraft

ModelExecutionStatus

执行状态(与 ExecutionPanelStatus 对齐,但不依赖 feature 类型)。

export type ModelExecutionStatus = "idle" | "pending" | "processing" | "materializing" | "successed" | "failed";

ModelInteractionDefinition

注册项:Plugin 在 activation 中以 owner-scoped disposer 注册。

export type ModelInteractionDefinition = {
id: string;
version: number;
owner: string;
Panel: ModelPanelComponent;
bindings?: (input: {
nodeId: string;
modelKey: string;
canvas: import("@woohaa3/contracts").ServerCanvas | null;
}) => ModelPanelBinding;
};

关联类型:ModelPanelComponent · ServerCanvas · ModelPanelBinding

成员说明:

  • bindings:Plugin 可选的受控绑定:由 Host 在解析后调用,为 Panel 提供 actions(打开 Plugin 自己的 Dialog 等)与 statusSummary(已确认的模型专用状态摘要)。这样专用逻辑留在 Plugin 内, Host 与其它 Plugin 都不需要知道具体模型。

ModelInteractionDescriptor

export type ModelInteractionDescriptor = {
id: string;
version: number;
};

ModelInteractionRegistry

export interface ModelInteractionRegistry {
register(definition: ModelInteractionDefinition): () => void;
resolve(descriptor: ModelInteractionDescriptor): ModelInteractionDefinition | null;
list(): readonly ModelInteractionSummary[];
subscribe(listener: () => void): () => void;
}

关联类型:ModelInteractionDefinition · ModelInteractionDescriptor · ModelInteractionSummary

成员说明:

  • register:注册一个 definition;返回幂等 disposer,重复 {id,version} 稳定拒绝。
  • resolve:精确 {id,version} 解析;不隐式替代 generic。
  • list:稳定顺序的诊断摘要(不含 component/closure)。
  • subscribe:订阅注册/注销变化:Host 据此重新解析当前 interaction。 返回取消订阅函数;dispose 时清理全部 listener。

ModelInteractionSummary

稳定、只读、不含 React component/closure 的诊断摘要。

export type ModelInteractionSummary = {
id: string;
version: number;
owner: string;
};

ModelPanelComponent

export type ModelPanelComponent = ComponentType<ModelPanelProps>;

关联类型:ModelPanelProps

ModelPanelProps

Host 提供给 Model Panel 的受限 props。

Panel 拿不到 raw Y.Doc、Provider client、credentials、Task internal client 或 canonical state setter。需要写 Canvas 时只能通过 Plugin 自己注入的 CanvasSession 提交明确命令, 由 Plugin 创建受控 callback 交给 Panel。

export type ModelPanelProps = {
nodeId: string;
model: CanvasTaskCatalogModel;
catalogModels: readonly CanvasTaskCatalogModel[];
defaultModelKey: string;
writable: boolean;
readOnly: boolean;
presentation: ExecutionPanelPresentation;
status: ModelExecutionStatus;
progress?: number;
errorMessage?: string;
draft: Readonly<ModelExecutionDraft>;
references: readonly ModelReferenceItem[];
blockingReasons: readonly string[];
statusSummary?: readonly string[];
patchDraft(patch: ModelExecutionDraftPatch): void;
submit(input: ModelSubmitDraft): Promise<ModelSubmitOutcome>;
requestPresentation(intent: PanelPresentationIntent): void;
actions?: Readonly<Record<string, (arg?: string) => void>>;
renderers?: ModelPanelRenderers;
};

关联类型:CanvasTaskCatalogModel · ExecutionPanelPresentation · ModelExecutionStatus · ModelExecutionDraft · ModelReferenceItem · ModelExecutionDraftPatch · ModelSubmitDraft · ModelSubmitOutcome · PanelPresentationIntent · ModelPanelRenderers

成员说明:

  • catalogModels:同 panel 类型的全部 catalog 模型(含默认交互之外的),供带模型选择器的 Panel 复用。
  • readOnly:会话级只读(断线只读等)。 只读通过 writable=false 与 readOnly=true 同时表达:writable 允许 Panel 隐藏/ 灰化写操作,readOnly 让 Panel 保持主操作真正禁用,但 MUST NOT 把只读当成面板 输入问题在面板里重复说明(该状态由宿主级同步状态控件承载)。
  • progress:权威节点任务进度,百分比 0–100;未提供时只显示阶段。
  • errorMessage:失败态的安全错误信息(可选)。
  • statusSummary:已确认的模型专用状态摘要(例如 Seedance intent chips);Panel 只读展示。
  • actions:Plugin 提供的可选受控动作(例如打开模型 Dialog);由 Plugin closure 实现。
  • renderers:Host 提供的通用执行 UI 片段工厂(references chips / 结构化 prompt editor)。 这些是通用节点执行组件(非布局 DSL);Panel 可选用它们复用核心外观, 也可完全自定义布局而忽略。

ModelPanelRenderers

export type ModelPanelRenderers = {
modelSelector?: () => import("react").ReactNode;
references?: () => import("react").ReactNode;
promptEditor?: (args: {
value: string;
onChange: (next: string) => void;
disabled: boolean;
placeholder: string;
onSubmit?: () => void;
}) => import("react").ReactNode;
promptSkill?: (input: {
id: string;
label: string;
prompt: string;
}) => void | Promise<void>;
};

成员说明:

  • modelSelector:Host-owned atomic source/model selection, shared by generic and dedicated interactions.
  • promptSkill:快捷改写(提示词工具)回调;可选,由 Host 注入。

ModelReferenceItem

参考项(Host 已从 canonical 解析;Panel 只读展示)。

export type ModelReferenceItem = {
sourceNodeId: string;
slotId: string;
role: string;
label: string;
status: "ready" | "missing" | "pending" | "failed";
mediaKind?: "image" | "video" | "audio" | "text";
previewUrl?: string;
};

ModelSubmitDraft

Panel 提交意图:只有 prompt/parameters;Host 补齐 nodeId/modelKey/runId。

export type ModelSubmitDraft = {
prompt: string;
parameters: Record<string, unknown>;
};

ModelSubmitOutcome

export type ModelSubmitOutcome = {
ok: true;
runId: string;
jobId: string;
} | {
ok: false;
error: string;
};