Files
deepseek-harness/packages/document/office-kit/src/identity.ts
T
yudshj a220e017b5 refactor(office): 合并为 office-kit,Kit 缺失时降级而非加载失败
- Kit CLI 由 office-kit/locate 在 Host 中定位(含 ASAR 映射与可选 root 越界检查),删除 Desktop 壳的 office-cli 与诊断文件;生产版 Desktop 由壳通过 DSH_BUNDLED_RUNTIME_ROOT 显式传入 Kit 根目录,开发版与 Web 不检查
- office-to-pdf 与 office-kit-resolver 合并为 @deepseek-ai/dsh-office-kit,由同一包定位 Kit 并提供转换服务
- Kit 缺失时 provider 照常注册,转换请求以 OfficeKitError unavailable 拒绝,之后安装 Kit 无需重载
- 类型统一使用 OfficeKit 前缀(OfficeKitRequest/Result/Priority/Key),同步消费方、文档、升级指南与 catalog
- 处理 ds-review-bot 意见,并更新 unknown 断言基线

本 PR 的 snapshot 统一在这个提交里用 keyless refresh 重新生成,前 3 个提交中的 snapshot 不一定和那一步的代码对应。
2026-11-04 18:17:57 +08:00

32 lines
1.5 KiB
TypeScript

/** Source locators and converter-owned identities for shared PDF reuse. */
import { brandString, type Branded } from '@deepseek-ai/dsh-brand'
/** Authorized execution scope and canonical source path, encoded by the consumer. */
export type OfficeSourceKey = Branded<'OfficeSourceKey'>
/**
* Label an authorized source locator for pre-read deduplication.
* @param key - unambiguous encoding of authorization scope, execution world, and canonical path.
* @returns branded source locator; source authorization remains the caller's responsibility.
*/
export function OfficeSourceKey(key: string): OfficeSourceKey { return brandString<OfficeSourceKey>(key) }
/** One provider lifetime, including its engine, rendering settings, and font configuration. */
export type OfficeKitGeneration = Branded<'OfficeKitGeneration'>
/**
* Label a provider lifetime.
* @param value - unique generation created by the provider.
* @returns branded converter generation.
*/
export function OfficeKitGeneration(value: string): OfficeKitGeneration {
return brandString<OfficeKitGeneration>(value)
}
/** Provider generation and source-content digest; consumers must not parse it. */
export type OfficeKitKey = Branded<'OfficeKitKey'>
/**
* Label a converter-owned content identity.
* @param value - generation and content identity created by the provider.
* @returns branded conversion identity.
*/
export function OfficeKitKey(value: string): OfficeKitKey { return brandString<OfficeKitKey>(value) }