export type TextFile = { path: string; content: string; }; export type SolutionDefinition = { id: string; role?: string; } /** 自定义 Solution:文本文件路径均相对于 Solution 根目录。 */ | { files: TextFile[]; role?: string; }; export type SkillFile = TextFile & { /** 二进制内容使用 base64;省略时为 UTF-8 文本。 */ encoding?: "utf-8" | "base64"; executable?: boolean; }; export interface SkillDefinition { /** 会话内安装名,格式为 `组织/名称`。 */ name: string; /** 必须包含根目录的 SKILL.md。 */ files: SkillFile[]; } export interface SessionConfig { /** Server 模型目录中的 model ID。 */ model?: string; enableThinking?: boolean; memoryEnabled?: boolean; compactionRatio?: number; env?: Record; disableTools?: string[]; } /** * 声明一个待创建的会话。传给 `client.sessions.create(...)` 后,SDK 会先准备 * Solution,再创建会话并安装 Skill;Promise resolve 时会话已经可以使用。 */ export interface SessionDefinition { intent?: string; solution?: SolutionDefinition; skills?: SkillDefinition[]; config?: SessionConfig; } export type SessionSetupStage = "solution" | "session" | "skill" | "connection"; /** 声明式会话准备失败;stage 和 sessionId 可直接用于界面提示或日志。 */ export declare class SessionSetupError extends Error { readonly stage: SessionSetupStage; readonly sessionId?: string | undefined; readonly name = "SessionSetupError"; readonly cause?: unknown; constructor(message: string, stage: SessionSetupStage, sessionId?: string | undefined, options?: { cause?: unknown; }); }