/** * License 数据结构 — 纯本地授权,零 SaaS 依赖 * * 发放流程: CLI 生成 → HMAC 签名 → license.json → 交给客户 * 验证流程: Gateway 启动 → 读 license.json → 校验签名+过期 → 功能开关 */ export interface LicensePayload { /** License ID (UUID) */ id: string; /** 商户 ID */ merchantId: string; /** 商户名称 */ merchantName: string; /** 套餐等级 */ plan: LicensePlan; /** 功能开关 */ features: LicenseFeatures; /** 配额 */ quotas: LicenseQuotas; /** 发放时间 (ISO 8601) */ issuedAt: string; /** 过期时间 (ISO 8601) */ expiresAt: string; /** 绑定的机器指纹 (可选, 防拷贝) */ machineId?: string; } export interface LicenseFile { /** 版本号, 便于未来升级格式 */ version: 1; /** License 载荷 */ payload: LicensePayload; /** HMAC-SHA256 签名 (对 payload JSON 的签名) */ signature: string; } export type LicensePlan = 'free' | 'basic' | 'pro' | 'enterprise'; export interface LicenseFeatures { /** FTS5 全文搜索 */ fts_search: boolean; /** 向量搜索 (Phase 2) */ vector_search: boolean; /** 知识同步到 SaaS */ knowledge_sync: boolean; /** 多项目支持 */ multi_project: boolean; /** 自定义模型 */ custom_model: boolean; } export interface LicenseQuotas { /** 最大项目数 */ maxProjects: number; /** 每项目最大 Agent 数 */ maxAgentsPerProject: number; /** 月 Token 配额 (-1 = 无限) */ monthlyTokens: number; /** 日消息配额 (-1 = 无限) */ dailyMessages: number; } export declare const PLAN_PRESETS: Record; export interface LicenseValidation { valid: boolean; error?: string; payload?: LicensePayload; /** 剩余天数 (-1 = 已过期) */ daysRemaining: number; /** 是否在宽限期 (过期 7 天内) */ inGracePeriod: boolean; } //# sourceMappingURL=types.d.ts.map