跳转到内容

签名关联类型:CanvasTaskInputBinding – ConversationEventType

本页由当前 SDK 声明自动生成。

返回接口索引

CanvasTaskInputBinding · CanvasTaskModelType · CanvasTaskNodeType · CanvasWorkspaceHandle · CatalogItemActionContribution · CommandHandle · CommandLifecycle · CommonProps · ConfigIssue · ContentCommandCodec · ContentCommandEnvelope · ContentContribution · ContentCopyContext · ContentDiagnostic · ContentEditPlanner · ContentInteractionPolicy · ContentMcpTool · ContentMigration · ContentNodeDataCodec · ContentPresentationAdapter · ContentRoute · ContentRouteResult · ConversationEvent · ConversationEventType

CanvasTaskInputBinding

模型参考输入的 binding(design D4)。

取代旧的图片专用布尔/数组字段:一个 binding 描述一个输入 field 接受哪些 media kind、role、media type、数量以及 valueFormat。

export type CanvasTaskInputBinding = {
field: string;
semantic: "reference-image" | "reference-video" | "reference-audio";
roles: string[];
mediaKinds: CanvasReferenceMediaKind[];
mediaTypes: string[];
maxItems: number;
valueFormat: "url" | "reference";
label?: string;
required?: boolean;
declaredSlot?: boolean;
};

关联类型:CanvasReferenceMediaKind

成员说明:

  • label:槽位展示名(如「控制图」)。空表示按角色名兜底。 展示名随模型/工作流版本走,不在客户端硬编码:加一种条件输入不该要求客户端发版。
  • required:该槽位不填充就不能执行。 只对参考槽位有意义。普通参数的必填由参数 schema 表达,两处各写一份会让 「这条必填谁说了算」没有答案。
  • declaredSlot:这个 binding 是否描述一个模型显式声明的具名槽位。 只有它为真时才为未填充的槽位渲染空位。按模型类型兜底的默认绑定(视频模型的 first_frame / last_frame)表达的是“这类模型可以接”,不是“这个模型等你填”, 给它们都渲染空槽会让参考区凭空多出几个永远没人用的位置。

CanvasTaskModelType

服务端 catalog 中模型的 provider 类型。

export type CanvasTaskModelType = "language" | "image" | "video" | "audio" | "motion";

CanvasTaskNodeType

可执行的节点类型。text/image/video/audio 有执行入口。

export type CanvasTaskNodeType = "image" | "text" | "video" | "audio" | "motion";

CanvasWorkspaceHandle

Desktop-owned local workspace contracts. Absolute locations are never canvas data.

export type CanvasWorkspaceHandle = {
schemaVersion: 1;
owner: string;
canvasId: string;
requestId: string;
directoryKey: string;
runKey: string;
generation: number;
};

CatalogItemActionContribution

export type CatalogItemActionContribution = {
id: string;
owner: string;
priority?: number;
render: ComponentType<CanvasCatalogItemActionProps>;
};

关联类型:CanvasCatalogItemActionProps

成员说明:

  • id:贡献稳定 ID;同一 slot 内重复会启动失败。
  • owner:拥有者(诊断用)。
  • priority:越小越靠前。

CommandHandle

export type CommandHandle = {
commandId: string;
state: CommandLifecycle;
baseRevision: number;
resultRevision: number | null;
error: string | null;
settled: Promise<CommandHandle>;
durable?: Promise<CommandHandle>;
noop?: boolean;
};

关联类型:CommandLifecycle

成员说明:

  • state:当前生命周期。
  • baseRevision:提交时客户端看到的 revision(用于判断 derived 是否已覆盖)。
  • resultRevision:服务端接受的 revision;未 accepted 前为 null。
  • error:失败原因(rejected / 后续失败)。
  • settled:等待 committed(accepted 且 derived revision >= result revision)。
  • durable:等待服务端 durable 回执;不等待本地 canonical 派生。
  • noop:服务端把命令规范化为 no-op 时为 true。

CommandLifecycle

命令生命周期状态(design D9;observed 由 working projection 的 effect satisfaction 驱动)。

export type CommandLifecycle = "pending" | "accepted" | "observed" | "rejected" | "committed";

CommonProps

type CommonProps = {
options: readonly SegmentedOption[];
className?: string;
label?: string;
optionClassName?: string;
dataAttributes?: Record<`data-${string}`, string>;
};

关联类型:SegmentedOption

成员说明:

  • label:组可访问名。
  • optionClassName:每个选项追加 class 的钩子(迁移期保留业务 class)。
  • dataAttributes:透传到 radiogroup 根的数据属性(迁移期保留 data-* 契约)。

ConfigIssue

type ConfigIssue = {
readonly message: string;
readonly path?: ReadonlyArray<PropertyKey>;
};

ContentCommandCodec

export type ContentCommandCodec = {
readonly kinds: readonly string[];
readonly legacyTypes?: readonly string[];
decode(command: ContentCommandEnvelope): {
ok: true;
value: unknown;
} | {
ok: false;
code: string;
reason: string;
};
apply(value: unknown, canvas: ServerCanvas): {
ok: true;
canvas: ServerCanvas;
} | {
ok: false;
code: string;
reason: string;
};
satisfied(value: unknown, canvas: ServerCanvas): boolean;
};

关联类型:ContentCommandEnvelope · ServerCanvas

成员说明:

  • legacyTypes:过渡代认领的旧命令 type。内核据此分派,不写死业务名。

ContentCommandEnvelope

export type ContentCommandEnvelope = {
readonly extensionId: string;
readonly nodeId?: string;
readonly kind: string;
readonly payload: unknown;
};

ContentContribution

export type ContentContribution = {
readonly extensionId: string;
readonly contentVersion?: number;
readonly nodeData?: ContentNodeDataCodec;
readonly commands?: ContentCommandCodec;
readonly edit?: ContentEditPlanner;
readonly presentation?: ContentPresentationAdapter;
readonly interaction?: ContentInteractionPolicy;
readonly migrations?: readonly ContentMigration[];
readonly routes?: readonly ContentRoute[];
readonly mcpTools?: readonly ContentMcpTool[];
};

关联类型:ContentNodeDataCodec · ContentCommandCodec · ContentEditPlanner · ContentPresentationAdapter · ContentInteractionPolicy · ContentMigration · ContentRoute · ContentMcpTool

成员说明:

  • contentVersion:该扩展当前写入的内容版本。低于它的数据按 migrations 顺序升级。

ContentCopyContext

export type ContentCopyContext = {
readonly nodeIds: ReadonlyMap<string, string>;
createId(prefix: string, index: number): string;
};

ContentDiagnostic

export type ContentDiagnostic = {
readonly code: string;
readonly reason: string;
};

ContentEditPlanner

export type ContentEditPlanner = {
expand?(input: {
readonly nodeId: string;
readonly op: unknown;
}): unknown;
plan(before: ServerCanvas, after: ServerCanvas): {
ok: true;
forward: unknown;
inverse: unknown;
preconditions: readonly unknown[];
} | {
ok: false;
code: string;
reason: string;
};
};

关联类型:ServerCanvas

成员说明:

  • expand:Expand an opaque edit into bounded, non-recursive protected structure operations.

ContentInteractionPolicy

export type ContentInteractionPolicy = {
isManagedNode(type: string, data: unknown): boolean;
selectionActions(action: "delete" | "copy" | "cut" | "rename" | "download", type: string, data: unknown): {
allowed: true;
} | {
allowed: false;
reason: string;
};
hoverPlaybackTarget(type: string, data: unknown): {
ownerNodeId: string;
entityId: string;
} | null;
doubleClickTarget(type: string, data: unknown): {
kind: string;
nodeId: string;
entityId?: string;
} | null;
};

ContentMcpTool

export type ContentMcpTool = {
readonly name: string;
readonly title: string;
readonly description: string;
readonly inputSchema: unknown;
authorize?(input: unknown): ContentDiagnostic | null;
handle(input: unknown): {
ok: boolean;
text?: string;
structured?: unknown;
} | Promise<{
ok: boolean;
text?: string;
structured?: unknown;
}>;
};

关联类型:ContentDiagnostic

ContentMigration

export type ContentMigration = {
readonly extensionId: string;
readonly from: number;
readonly to: number;
migrate(data: unknown): unknown;
};

ContentNodeDataCodec

export type ContentNodeDataCodec = {
decode(data: unknown): {
ok: true;
value: unknown;
} | {
ok: false;
code: string;
reason: string;
};
validatePatch(previous: unknown, patch: unknown): ContentDiagnostic | null;
normalize(data: unknown): unknown;
sanitizeRuntime(data: unknown): unknown;
copy(nodeData: unknown, context: ContentCopyContext): {
data: unknown;
assetRefs: readonly string[];
remap: Readonly<Record<string, string>>;
};
diff(before: unknown, after: unknown, context: ContentCopyContext): {
ok: true;
forward: unknown;
inverse: unknown;
} | {
ok: false;
code: string;
reason: string;
};
schemaVersion?(data: unknown): number | null;
rejectLegacy?(type: string | undefined, data: unknown): ContentDiagnostic | null;
inspect?(data: unknown): {
ok: true;
report: unknown;
} | {
ok: false;
code: string;
reason: string;
};
};

关联类型:ContentDiagnostic · ContentCopyContext

成员说明:

  • schemaVersion:业务内容版本。认领不了时返回 null。
  • rejectLegacy:旧业务形态禁止新建或普通写入。不是这种数据时返回 null。

ContentPresentationAdapter

export type ContentPresentationAdapter = {
presentPrimitives(input: {
readonly nodeId: string;
readonly data: unknown;
}): unknown;
};

ContentRoute

export type ContentRoute = {
readonly method: string;
readonly path: readonly string[];
handle(request: {
readonly body: unknown;
}): ContentRouteResult | Promise<ContentRouteResult>;
};

关联类型:ContentRouteResult

ContentRouteResult

export type ContentRouteResult = {
readonly status: number;
readonly body?: unknown;
};

ConversationEvent

单调 sequence 事件;订阅重连按 cursor 重放,缺窗口返回权威 snapshot。

export type ConversationEvent = {
sequence: number;
conversationId: string;
turnId: string;
requestId: string;
type: ConversationEventType;
payload: unknown;
createdAt: string;
};

关联类型:ConversationEventType

ConversationEventType

export type ConversationEventType = (typeof CONVERSATION_EVENT_TYPES)[number];