前端 SDK 导出:buildUploadedTextAsset – rectangularNodeResize
本页由当前 SDK 声明自动生成。 导入入口:@woohaa3/frontend/extension-api。
buildUploadedTextAsset · buttonClassName · color · createNodeImplementationRegistry · currentPanelDefaultModelKey · defineExtensionFrontend · defineExtensionPlugin · desktopAppVersion · desktopBootstrap · font · generationParameterError · isDesktopHost · modelNodeCapabilities · modelResourceDemand · modelWorkspaceFocus · nativeDocumentEditorClient · nodeActionContributions · objectPayload · openAgentAssistant · planReplaceImage · planUploadedNode · projectModelConfig · radius · rectangularNodeResize
buildUploadedTextAsset
文本上传:正文直接进资产 text 字段(无需媒体对象,也不上传 COS)。
export function buildUploadedTextAsset(input: { file: UploadFile; text: string; now?: string; }): StoredAsset;关联类型:UploadFile · StoredAsset
buttonClassName
生成统一 ui-button class(业务可传 className 追加布局类)。
export function buttonClassName(base: string, options: { size?: ButtonSize; tone?: ButtonTone; className?: string; }): string;关联类型:ButtonSize · ButtonTone
color
颜色访问器:只返回 var(--app-*),保证组件不持有独立品牌色。
export const color: { readonly panel: "var(--app-web-panel)"; readonly surface: "var(--app-web-surface)"; readonly surfaceHover: "var(--app-web-elevated)"; readonly chip: "var(--app-web-panel)"; readonly accent: "var(--app-interaction-accent)"; readonly accentWarm: "var(--app-status-danger)"; readonly text: "var(--app-web-text-primary)"; readonly textMuted: "var(--app-web-text-muted)"; readonly textFaint: "var(--app-web-text-muted)"; readonly border: "var(--app-web-border)"; readonly borderStrong: "var(--app-web-border-strong)"; readonly backdrop: "var(--app-web-backdrop)"; };createNodeImplementationRegistry
Bind existing adapter execution without exposing business interpretation to consumers.
fileModel 是页面注入的 GLB 渲染准备端口:
普通 model3d 按节点数据的权威来源在脚本执行与文件解析之间分流,两者不共存。
export function createNodeImplementationRegistry(fileModel?: FileModelPreparation): NodeImplementationRegistry;关联类型:FileModelPreparation · NodeImplementationRegistry
currentPanelDefaultModelKey
export function currentPanelDefaultModelKey(models: readonly CanvasTaskCatalogModel[], preferred: string): string;defineExtensionFrontend
声明一个 extension 前端入口描述(纯数据 + 工厂,无副作用)。
export function defineExtensionFrontend(descriptor: ExtensionFrontendDescriptor): ExtensionFrontendDescriptor;关联类型:ExtensionFrontendDescriptor
defineExtensionPlugin
完整 Cordis plugin 定义辅助(等价于宿主 kernel 的 definePlugin)。
Object.assign(fn, { name }) 会因函数 name 只读而在严格模式抛错;这里用
Object.defineProperty 设置 Cordis 需要的 name/inject/provide 元数据。
export function defineExtensionPlugin<T extends Context>(body: (ctx: T) => void | (() => void | Promise<void>), meta: { name: string; inject: readonly string[]; provide?: string | string[]; }): Plugin.Function<void>;desktopAppVersion
读取 Tauri 桌面壳自报的包版本(来自 desktop/tauri.conf.json);非桌面壳或未注入时返回 null。
export function desktopAppVersion(target?: typeof globalThis): string | null;desktopBootstrap
读取桌面壳注入的窗口能力;浏览器或令牌缺失时返回 undefined。
export function desktopBootstrap(target: typeof globalThis): DesktopBootstrap | undefined;关联类型:DesktopBootstrap
font
export const font: { readonly family: "\"Noto Sans SC\", \"Noto Sans\", system-ui, -apple-system, \"Segoe UI\", sans-serif"; readonly sizeSm: "13px"; readonly sizeBase: "16px"; readonly sizeLg: "18px"; readonly sizeTitle: "22px"; };generationParameterError
export function generationParameterError(field: GenerationParameterField, values: Record<string, unknown>): string;isDesktopHost
当前是否运行在 Tauri 桌面壳。
用于选择宿主提供的呈现位置:桌面窗口横栏(常驻窗口装饰)与浏览器浮动顶栏/工具栏的归属不同。
export function isDesktopHost(target?: typeof globalThis): boolean;modelNodeCapabilities
export function modelNodeCapabilities(context: Pick<NodeCapabilityContext, "data">): NodeCapabilities;关联类型:NodeCapabilityContext · NodeCapabilities
modelResourceDemand
export const modelResourceDemand: { channel: "image" | "video" | "model"; contentKey(context: NodeResourceContext): string | null; };关联类型:NodeResourceContext
modelWorkspaceFocus
export const modelWorkspaceFocus: { kind(context: NodeCapabilityContext): "model" | "extension" | null; };nativeDocumentEditorClient
Missing capability means WASM fallback; this function never chooses a provider.
export function nativeDocumentEditorClient(target?: typeof globalThis): NativeDocumentEditorClient | null;关联类型:NativeDocumentEditorClient
nodeActionContributions
export const nodeActionContributions: { accepts(context: NodeCapabilityContext): boolean; };objectPayload
便捷构造:要求 payload 是只含预期字段的对象。
export function objectPayload<T extends Record<string, unknown>>(name: string, read: (value: Record<string, unknown>) => T | null): (payload: unknown) => { ok: true; payload: T; } | { ok: false; error: string; };openAgentAssistant
Carries only an entry kind across page disposal, never credentials or target drafts.
export function openAgentAssistant(router: AppRouterService, kind: "login" | "installed" | "api-key"): void;关联类型:AppRouterService
planReplaceImage
规划「替换选中图片节点」命令批次 。
只在图片上传成功后调用。顺序:asset.upsert 新稳定资产 → nodeData.patch 目标节点。
patch 只更新输出资产引用与 ready 状态,并清理不再有效的运行态/结果/错误字段;保留
节点 ID、位置、尺寸、边、inputMapping、用户 prompt、模型和 parameters(其它字段不写入)。
export function planReplaceImage(input: { nodeId: string; asset: StoredAsset; }): CanvasCommand[];关联类型:StoredAsset · CanvasCommand
planUploadedNode
规划「上传 → 节点」命令批次。
顺序:asset.upsert → node.add(携带引用该资产的 nodeData)。服务端按序应用,
因此节点就绪时资产已存在。失败时整批拒绝,不产生部分状态。
connectFrom 用于拉线到空白后选择「上传…」:上传的节点会与源节点连线。
export function planUploadedNode(input: { nodeType: string; position: Woohaa3CanvasPosition; file: UploadFile; asset: StoredAsset; nodeId?: string; connectFrom?: { nodeId: string; nodeType: string; label?: string; }; }): CanvasCommand[];关联类型:Woohaa3CanvasPosition · UploadFile · StoredAsset · CanvasCommand
projectModelConfig
export function projectModelConfig(models: readonly CanvasTaskCatalogModel[], selected: string, fallbackDefault: string): ExecutionPanelModelConfig;关联类型:CanvasTaskCatalogModel · ExecutionPanelModelConfig
radius
export const radius: { readonly panel: "22px"; readonly page: "26px"; readonly card: "14px"; readonly chip: "22px"; };成员说明:
panel:ComposerBar / hud chipspage:InspectorPanelcard:Inner cards, inputs
rectangularNodeResize
export const rectangularNodeResize: { mode: "rect" | "scope"; minimum(context: NodeCapabilityContext): { width: number; height: number; }; };