跳转到内容

后端 web-contracts-src-extension-services:TaskNotificationPreferences – isStorageObjectNotFoundError

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

返回接口索引

TaskNotificationPreferences · TaskNotificationService · TaskNotificationSnapshot · TaskNotificationTarget · TelemetryExport · TelemetryExportResult · TelemetryReadOptions · TemporaryHostingCandidateView · TemporaryHostingCategory · TemporaryHostingConstraints · TemporaryHostingDeclaration · TemporaryHostingLease · TemporaryHostingMode · TemporaryHostingQuery · TemporaryHostingRouteView · credentialEpoch · hostServiceAbi · hostServiceNames · isGenerationStableMediaResult · isPromptRequirement · isStorageExposeUnavailableError · isStorageObjectNotFoundError

TaskNotificationPreferences

本地偏好(版本化持久化的内容)。

export type TaskNotificationPreferences = {
categories: TaskNotificationCategories;
titleEnabled: boolean;
systemEnabled: boolean;
};

关联类型:TaskNotificationCategories

成员说明:

  • titleEnabled:Web 标题渠道(默认开)。
  • systemEnabled:Tauri 系统通知渠道(默认关;开启时才申请权限)。

TaskNotificationService

export type TaskNotificationService = {
getSnapshot(): TaskNotificationSnapshot;
subscribe(listener: () => void): () => void;
readonly actions: TaskNotificationActions;
deliveries(): readonly TaskNotificationDelivery[];
dispose(): void;
};

关联类型:TaskNotificationSnapshot · TaskNotificationActions · TaskNotificationDelivery

成员说明:

  • deliveries:最近投递(诊断/回归;有界)。

TaskNotificationSnapshot

服务快照(useSyncExternalStore 稳定引用)。

export type TaskNotificationSnapshot = {
preferences: TaskNotificationPreferences;
platform: "web" | "desktop";
channels: {
title: TaskNotificationChannelState;
system: TaskNotificationChannelState;
};
permission: TaskNotificationPermission;
pending: {
succeeded: number;
failed: number;
};
source: {
status: "idle" | "starting" | "live" | "unavailable";
reason: string | null;
};
storageError: string | null;
};

关联类型:TaskNotificationPreferences · TaskNotificationChannelState · TaskNotificationPermission

成员说明:

  • platform:当前呈现平台。
  • channels:当前会话能用的渠道(Web 只有 title;桌面为 title? + system)。
  • pending:在应用处于后台时累计的未读结果(标题前缀来源)。
  • source:观察源状态:不可用时 preferences 仍可读写,但不会产生提醒。
  • storageError:最近一次偏好持久化失败的安全文案;无错误为 null。

TaskNotificationTarget

通知选中一条历史记录后,用户点击要跳转的目标。

只携带稳定身份(taskKey 与可选画布/节点),不含 prompt、参数、媒体 URL 或任意外部地址。

export type TaskNotificationTarget = {
taskKey: string;
canvasId?: string;
nodeId?: string;
};

TelemetryExport

一个遥测出口(站点扩展注册)。

export type TelemetryExport = {
readonly exportId: string;
readonly label?: string;
readonly available?: boolean;
send(batch: readonly TelemetryEvent[]): Promise<TelemetryExportResult> | TelemetryExportResult;
};

关联类型:TelemetryEvent · TelemetryExportResult

成员说明:

  • exportId:出口的短标识,只用于日志、状态面与去重,不是“选择开关”。 core 不按它挑选目的地:telemetry.export.enabled 打开时,所有自述可用的出口都会收到事件; 「发到哪、用什么凭据」由出口自己的配置段决定(例如服务端接入扩展的部署地址与登录)。 这样 core 既不需要枚举出口,也不会出现“配了 id 却没人读”的死设置。 与扩展 identity 解耦:先例是 local-storage 扩展提供 backendId = "local";core 里不得 出现任何扩展 id 字面量(extension-purity 门禁)。
  • label:设置页与日志里的显示名。
  • available:当前是否可发(未登录、缺配置 → false);缺省视为可用。
  • send:送出一批事件。 允许抛错或返回失败;core 一律吞掉并计入该出口的丢弃数。实现不得假设 core 会重试—— 目标契约没有幂等键时重试会让计数翻倍,而计数正是这条通道唯一的产出。

TelemetryExportResult

一次投递的结果。

ok: false 不是异常:出口失败是本机遥测的正常分支,core 只记日志与丢弃计数。 code 必须是稳定短标识(不是错误消息),便于页面按类别聚合并避免把远端正文带进本机。

export type TelemetryExportResult = {
readonly ok: true;
readonly accepted?: number;
} | {
readonly ok: false;
readonly code: string;
readonly message?: string;
};

TelemetryReadOptions

分组读取的可选口径(summary / anomalies 共用)。

attributeKey + attributeValue 是筛选:只在该属性取值相等的事件上聚合。它是 spec 「按 production 筛选的耗时分布不包含 dev 样本」的落点——不能靠界面隐藏行来假装分开。

export type TelemetryReadOptions = {
readonly groupBy?: TelemetryAttributeKey;
readonly attributeKey?: TelemetryAttributeKey;
readonly attributeValue?: string;
};

关联类型:TelemetryAttributeKey

成员说明:

  • groupBy:单键分组;缺省按事件名聚合。
  • attributeKey:与 attributeValue 成对出现的属性精确匹配;只给其一由路由层拒绝。

TemporaryHostingCandidateView

只读候选视图:供可用性检查、执行与能力中心共用同一解析结果。

export type TemporaryHostingCandidateView = {
readonly exposerId: string;
readonly label: string;
readonly category: TemporaryHostingCategory;
readonly ownerExtensionId: string | null;
readonly priority: number;
readonly configured: boolean;
readonly available: boolean;
readonly statusNote?: string | null;
readonly selected: boolean;
readonly lastError: string | null;
};

关联类型:TemporaryHostingCategory

成员说明:

  • configured:凭据/配置就绪(尚无调用证据也只显示已配置)。
  • available:当前请求条件下是否可用。
  • statusNote:来源自己的就绪说明;没有时为 null。
  • lastError:最近一次真实调用失败;与「已验证通过」分开表达。

TemporaryHostingCategory

临时图床类别:提供商提供的外链,或扩展声明的后备服务。

export type TemporaryHostingCategory = "provider" | "builtin";

TemporaryHostingConstraints

临时图床对素材的声明约束(缺省表示不限制)。

export type TemporaryHostingConstraints = {
readonly mediaKinds?: readonly string[];
readonly maxBytes?: number;
};

TemporaryHostingDeclaration

临时图床能力声明。

priority 越小越先被自动选中;相同优先级按稳定 exposerId 字典序。它独立于提供商配置 页面的排序与注册时序,避免 UI 调整改变实际执行来源。

export type TemporaryHostingDeclaration = {
readonly category: TemporaryHostingCategory;
readonly priority?: number;
readonly constraints?: TemporaryHostingConstraints;
readonly validitySeconds?: number | null;
readonly ready?: () => boolean;
readonly statusNote?: () => string | null;
readonly credentialEpoch?: () => number;
};

关联类型:TemporaryHostingCategory · TemporaryHostingConstraints

成员说明:

  • validitySeconds:该来源承诺的有效窗口;用于判断本次请求所需窗口能否被满足。 - 数字:来源能确认的最小窗口; - null:明确未知/不承诺——上游没有返回期限时不能按宿主缺省一天冒充承诺。 未知窗口仍可服务「不要求未来有效性」的请求,但任何正数窗口要求都会排除该来源; - 缺省:沿用「来源只声明了临时图床能力、未单独声明窗口」的历史语义(宿主上限一天), 已有来源不受影响。
  • ready:配置完整、扩展已启用且上传实现就绪;返回 false 时不能成为候选。
  • statusNote:来源自己的就绪说明(可选,例如「未登录」)。能力中心在来源列表里优先显示它, 让「已配置但当前不可用」与「真的没配置」不再混为一谈;只读,不得触发上传或登录。
  • credentialEpoch:凭据修订。一次请求在开始前冻结该值,读取完成后再次比对;变化时旧响应不得算作成功。 缺省表示该来源没有可轮换的凭据。

TemporaryHostingLease

本次请求冻结的来源身份;由 core 在开始上传前记录。

export type TemporaryHostingLease = {
readonly exposerId: string;
readonly ownerExtensionId: string | null;
readonly credentialEpoch: number | null;
};

TemporaryHostingMode

临时图床的生效模式与真实选择。

export type TemporaryHostingMode = "auto" | "manual" | "disabled";

TemporaryHostingQuery

available / 能力中心共用的一次解析输入(不带 key 时只看配置面)。

export type TemporaryHostingQuery = {
readonly namespace?: string;
readonly scope?: StorageScope;
readonly request?: StorageExposeRequest;
};

关联类型:StorageScope · StorageExposeRequest

TemporaryHostingRouteView

export type TemporaryHostingRouteView = {
readonly mode: TemporaryHostingMode;
readonly selectionSource: "canvas" | "manual" | "auto" | "none";
readonly selectedId: string | null;
readonly candidates: readonly TemporaryHostingCandidateView[];
readonly error: string | null;
readonly lastFailure: {
readonly exposerId: string;
readonly message: string;
} | null;
};

关联类型:TemporaryHostingMode · TemporaryHostingCandidateView

成员说明:

  • error:当前配置无法解析时的真实原因;可读状态下为 null。

credentialEpoch

凭据修订。

GenerationProvider.credentialEpoch 要求「单调、只放不可逆摘要、绝不放明文密钥」。 各 Provider 用它把当前配置的凭据折叠成一个整数,参与 Task 侧 registry 的缓存签名—— 签名变化才会重建执行实例。

为什么必须有它:registry 原本只按 providerId/available/catalogRevision/models 缓存, 换 key 不改这些字段,于是缓存命中、继续用持旧 key 的实例。表现是配置已保存、 testConnection(现读配置)通过,真实生成却持续鉴权失败,只有重启进程才恢复 (2026-11-16 现场:RunningHub 同一个 key 重启前一失败一成功)。

用 FNV-1a 32 位:它在快、不依赖 Web Crypto(同步可用)、且只用于「是否变化」的比较; 不承担密码学强度职责(摘要不出日志、不出公开视图、不做认证)。

export function credentialEpoch(secret: string | undefined): number;

hostServiceAbi

宿主提供的某个服务面版本;未知服务面返回 undefined。

export function hostServiceAbi(name: string): number | undefined;

hostServiceNames

全部服务面名(稳定排序,便于生成清单与错误信息)。

export function hostServiceNames(): readonly HostServiceName[];

关联类型:HostServiceName

isGenerationStableMediaResult

识别稳定媒体结果;非法形状一律返回 false(调用方回落到既有 URL/bytes 路径)。

export function isGenerationStableMediaResult(value: unknown): value is GenerationStableMediaResult;

关联类型:GenerationStableMediaResult

isPromptRequirement

export function isPromptRequirement(value: unknown): value is PromptRequirement;

关联类型:PromptRequirement

isStorageExposeUnavailableError

按字符串判定 expose 不可用(跨 bundle 无法用 instanceof)。

export function isStorageExposeUnavailableError(error: unknown): boolean;

isStorageObjectNotFoundError

按字符串判定 not-found:与 StorageObjectNotFoundError 的 code/name 保持一致。

export function isStorageObjectNotFoundError(error: unknown): boolean;