Files
workinf_Blender_Wasm/web/protocol/blender-operator.ts
mes123456 e9bfef0c5a
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): complete Blender route runtime execution
2026-09-07 00:12:32 +08:00

124 lines
3.5 KiB
TypeScript

export type BlenderOperatorPropertyType = "boolean" | "number" | "enum" | "string";
export type BlenderOperatorPropertyValue = string | number | boolean;
export interface BlenderOperatorEnumItem {
value: string;
label: string;
}
export interface BlenderOperatorPropertySpec {
name: string;
type: BlenderOperatorPropertyType;
required: boolean;
label?: string;
description?: string;
defaultValue?: BlenderOperatorPropertyValue;
min?: number;
max?: number;
enumItems?: BlenderOperatorEnumItem[];
}
export interface BlenderOperatorDescriptor {
id: string;
label: string;
description?: string;
family: string;
context: "scene" | "object" | "main";
backgroundSafe: true;
properties: BlenderOperatorPropertySpec[];
}
export interface BlenderServerOperatorSchema {
operator: BlenderOperatorDescriptor;
blenderBuild: { version: string; buildSha256: string };
}
export interface BlenderOperatorInvocation {
operator: string;
properties?: Record<string, BlenderOperatorPropertyValue>;
baseRevision?: number;
}
export type BlenderFeatureRoute = "WEB_MAIN" | "SERVER_NATIVE" | "BROWSER_EQUIVALENT" | "UNAVAILABLE";
/** Browser-owned replacements for desktop context/window operators. */
export type BlenderBrowserActionGroup = "OPEN" | "SAVE" | "WORKSPACE" | "SELECTION" | "VIEW" | "EDITOR";
export interface BlenderBrowserEquivalentInvocation {
command: "invokeBrowserEquivalent";
route: string;
actionGroup: BlenderBrowserActionGroup;
browserCommand: string;
}
export interface BlenderFeatureRouteRuntimeAudit {
command: "featureRouteRuntimeAudit";
status: "PASS" | "FAILED" | "STATIC_DECLARATION";
behavioralEvidence: { separate: true };
}
export interface BlenderFeatureRouteLocation {
path: string;
line?: number;
evidence?: string;
}
/** Source-unit route metadata used by the F3 feature palette. */
export interface BlenderFeatureRouteEntry {
id: string;
kind: string;
identifier: string;
family: string;
route: BlenderFeatureRoute;
reason: string;
/** HTTP provider used by SERVER_NATIVE routes. */
httpRoute?: string;
/** Existing browser workflow used by BROWSER_EQUIVALENT routes. */
browserActionGroup?: BlenderBrowserActionGroup;
label?: string;
description?: string;
properties?: BlenderOperatorPropertySpec[];
locations?: BlenderFeatureRouteLocation[];
}
export interface BlenderFeatureRouteInvocation {
route: BlenderFeatureRouteEntry;
properties?: Record<string, BlenderOperatorPropertyValue>;
baseRevision?: number;
}
/** SERVER_NATIVE jobs deliberately carry only typed scalar operator properties. */
export const BLENDER_OPERATOR_BACKGROUND_CONTEXT = "BACKGROUND" as const;
export type BlenderMacroStepKind = "MAIN_COMMAND" | "SERVER_NATIVE" | "CONTEXT_DEPENDENT";
export interface BlenderMacroStep {
id: string;
kind: BlenderMacroStepKind;
context: "MAIN" | "BACKGROUND" | "UI";
operator?: string;
command?: Record<string, unknown>;
source: BlenderFeatureRouteLocation[];
}
/** A bounded, source-backed native plan assembled from Blender operator units. */
export interface BlenderMacroDescriptor {
id: string;
label: string;
description?: string;
family: string;
route: BlenderFeatureRoute;
contextDependent: boolean;
source: BlenderFeatureRouteLocation[];
steps: BlenderMacroStep[];
properties?: BlenderOperatorPropertySpec[];
}
export interface BlenderMacroInvocation {
macro: string;
properties?: Record<string, BlenderOperatorPropertyValue>;
baseRevision?: number;
serverJob?: Record<string, unknown>;
}