import { z } from "zod"; import type { CanvasSnapshot } from "../canvas/types.js"; import { type JsonRecord } from "../utils/value.js"; import type { CodexReasoningEffort, CodexSkillMetadata, CodexSkillSelector, CodexSkillsListEntry } from "./codex-protocol.js"; import type { AgentAttachment, AgentEmit, AgentPermissionMode } from "./types.js"; type CodexRunOptions = { threadId?: string; cwd?: string; permissionMode?: AgentPermissionMode; model?: string; effort?: CodexReasoningEffort; skill?: CodexSkillSelector; messageText?: string; appEmit?: AgentEmit; onStart?: () => void; onThread?: (threadId: string) => void; onTurn?: (turnId: string) => void; onFinish?: () => void; }; type CodexSkillDraftInput = { model?: string; effort?: CodexReasoningEffort; } & ({ source: "conversation"; threadId: string; } | { source: "canvas"; snapshot: CanvasSnapshot; }); declare const skillDraftSchema: z.ZodEffects; instructions: z.ZodString; shortDescription: z.ZodEffects; defaultPrompt: z.ZodString; }, "strict", z.ZodTypeAny, { name: string; displayName: string; description: string; instructions: string; shortDescription: string; defaultPrompt: string; }, { name: string; displayName: string; description: string; instructions: string; shortDescription: string; defaultPrompt: string; }>, { name: string; displayName: string; description: string; instructions: string; shortDescription: string; defaultPrompt: string; }, { name: string; displayName: string; description: string; instructions: string; shortDescription: string; defaultPrompt: string; }>; export type AgentSkillDraft = z.infer; export declare class CodexSkillLookupError extends Error { readonly statusCode: 400 | 404 | 409; name: string; constructor(message: string, statusCode: 400 | 404 | 409); } export { summarizeCodexThread } from "./codex-history.js"; /** 将 Codex turn 加入串行队列并等待执行完成。 */ export declare function runCodexTurn(prompt: string, lifecycleEmit: AgentEmit, attachments?: AgentAttachment[], options?: CodexRunOptions): Promise; /** 从当前对话或指定网页画布生成可编辑草稿,不写入 Skill 文件。 */ export declare function generateCodexSkillDraft(emit: AgentEmit, cwd: string, input: CodexSkillDraftInput): Promise; /** 中断当前线程正在执行的 Codex turn。 */ export declare function interruptCodexTurn(threadId?: string): Promise; /** 回复当前 app-server 的待处理权限请求。 */ export declare function resolveCodexApproval(requestId: string, decision: string): Promise; /** 创建新的 Codex 线程并记录当前线程 ID。 */ export declare function startCodexThread(emit: AgentEmit, cwd?: string, permissionMode?: AgentPermissionMode, preheat?: boolean): Promise; /** 恢复指定 Codex 线程并返回聊天历史。 */ export declare function resumeCodexThread(emit: AgentEmit, threadId: string, cwd?: string, permissionMode?: AgentPermissionMode, preheat?: boolean): Promise<{ thread: import("./codex-protocol.js").CodexThread; messages: { id: string; itemId: string; threadId: string; turnId: string; role: "user" | "assistant" | "tool" | "error"; title?: string; text: string; detail?: unknown; activityItems?: Record; }[]; settledTurnIds: string[]; historyReady: boolean; }>; /** 查询当前工作空间中的 Codex 线程。 */ export declare function listCodexThreads(emit: AgentEmit, options: { cwd: string; searchTerm?: string; limit?: number; }): Promise<{ data: { id: string; sessionId: string; preview: string; name: string | null; cwd: string; status: string; source: unknown; threadSource: unknown; createdAt: number; updatedAt: number; }[]; nextCursor: {} | null; backwardsCursor: {} | null; }>; /** 查询当前账号可用于新任务的 Codex 模型。 */ export declare function listCodexModels(emit: AgentEmit): Promise<{ data: import("./codex-protocol.js").CodexModel[]; nextCursor: string | null; }>; /** 查询当前工作空间的原生 Skill 列表。 */ export declare function listCodexSkills(emit: AgentEmit, cwd: string, forceReload?: boolean): Promise; /** 从原生 Skill 列表中解析并校验浏览器提交的选择器。 */ export declare function resolveCodexSkill(emit: AgentEmit, cwd: string, selector: CodexSkillSelector, requireEnabled?: boolean): Promise; /** 修改经过原生列表校验的 Skill 启用状态。 */ export declare function configureCodexSkill(emit: AgentEmit, cwd: string, selector: CodexSkillSelector, enabled: boolean): Promise<{ skill: { enabled: boolean; name: string; description: string; shortDescription?: string | null; interface?: import("./codex-protocol.js").CodexSkillInterface | null; dependencies?: JsonRecord | null; path: string; scope: import("./codex-protocol.js").CodexSkillScope; }; effectiveEnabled: boolean; }>; /** 读取指定 Codex 线程及其聊天历史。 */ export declare function readCodexThread(emit: AgentEmit, threadId: string, cwd?: string): Promise<{ thread: { id: string; sessionId: string; preview: string; name: string | null; cwd: string; status: string; source: unknown; threadSource: unknown; createdAt: number; updatedAt: number; }; messages: { id: string; itemId: string; threadId: string; turnId: string; role: "user" | "assistant" | "tool" | "error"; title?: string; text: string; detail?: unknown; activityItems?: Record; }[]; settledTurnIds: string[]; historyReady: boolean; }>; /** 归档指定 Codex 线程。 */ export declare function archiveCodexThread(emit: AgentEmit, threadId: string, cwd?: string): Promise; /** 判断线程异常是否允许自动新建线程后重试。 */ export declare function isRecoverableThreadError(error: unknown): boolean; /** 只保留理解画布流程所需的信息,避免把媒体、外部地址、坐标和本地凭证送入草稿线程。 */ export declare function canvasSkillSource(snapshot: CanvasSnapshot): JsonRecord; export declare function assertDraftHasNoSensitiveValues(draft: AgentSkillDraft, privateValues: string[]): void;