import { type CodexHookRpc } from "./codex-hook-rpc.js"; export interface CodexNativeSkill { /** Native qualified name, not a directory name or plugin identifier. */ name: string; path: string; enabled: boolean; pluginId: string | null; } export interface CodexNativeSkillCatalog { version: string; cwd: string; skills: CodexNativeSkill[]; /** Added in 0.10.20; older reviewed skills/list receipts remain valid for listed skills. */ plugins?: CodexInstalledPlugin[]; /** Remote install receipts read before the capture started any Codex process. */ remoteReceipts?: CodexRemoteReceiptSnapshot; } /** Schema of the remote install receipt snapshot embedded in a captured catalog. */ export declare const CODEX_REMOTE_RECEIPT_SNAPSHOT_SCHEMA: "hasna.skills-codex-remote-receipts.v1"; /** One plugin cache parent's native remote install receipt as it was on disk * before Codex started. `remotePluginId` is null when the receipt is not a * strictly valid schema-1 receipt; `sha256` is null when it is not a regular, * unlinked file of at most 16 KiB. */ export type CodexRemoteReceiptObservation = { pluginId: string; receipt: "absent"; } | { pluginId: string; receipt: "present"; sha256: string | null; remotePluginId: string | null; mtimeMs: number; }; export interface CodexRemoteReceiptSnapshot { schema: typeof CODEX_REMOTE_RECEIPT_SNAPSHOT_SCHEMA; cacheRoot: string; plugins: CodexRemoteReceiptObservation[]; } /** Safe installed-plugin identity needed when Codex hides a path-disabled skill. */ export interface CodexInstalledPlugin { id: string; name: string; installed: boolean; enabled: boolean; localVersion: string | null; /** Native remote identity; never a guessed installed cache version. */ remotePluginId?: string; sourceType?: "remote" | "local" | "git" | "npm"; /** Fingerprint of the complete native nonremote source declaration. */ sourceSha256?: string; /** Declared local installation input, distinct from the loaded cache root. */ sourcePath?: string; } /** The one remote rule for every receipt decision (install review, reconcile * and the inactive rule): Codex reports a remote source, or reports any remote * identity. A projected row can keep its remotePluginId while a missing or * unrecognized source projects to no sourceType, so the id alone counts. */ export declare function codexPluginIsRemote(plugin: Pick | undefined): boolean; /** Codex 0.160 derives remote installed keys from these native scope realms. * A nonremote declaration in one of them cannot prove config-owned enablement: * remote reconciliation may replace enabled even while config stays disabled. */ export declare function codexPluginSourceIsConfigControlled(plugin: Pick): boolean; export declare const remotePluginIdentifier: (value: unknown) => value is string; /** Project the measured native skills/list contract without retaining descriptions, * links, interfaces, errors, or any other untrusted native text. */ export declare function projectCodexNativeSkillCatalog(response: unknown, cwd: string): CodexNativeSkill[]; /** Project only the installed plugin identity needed to bind cache inventory. * Marketplace errors fail closed because an incomplete inventory cannot prove * that an absent skill belongs to the one measured installed plugin. */ export declare function projectCodexInstalledPlugins(response: unknown): CodexInstalledPlugin[]; /** Validate the bounded stored projection when it is consumed by a review. */ export declare function projectCodexInstalledPluginEntries(value: unknown): CodexInstalledPlugin[]; /** Read every plugin cache parent's native remote install receipt. Call it * before any Codex process starts: starting the app-server rewrites each remote * plugin's receipt to its own state, so a later read observes healed bytes and * cannot show a receipt that was missing or stale. Never follows an alias. */ export declare function captureCodexRemoteReceiptSnapshot(cache: string): CodexRemoteReceiptSnapshot; /** The plugin cache identity a snapshot is bound to: the real path of its * deepest existing ancestor plus the rest, so an absent cache still compares. */ export declare function canonicalCacheRoot(cache: string): string; /** Validate an embedded snapshot when a review consumes it; null when invalid. */ export declare function projectCodexRemoteReceiptSnapshot(value: unknown): CodexRemoteReceiptSnapshot | null; /** Read one consumer's catalog through an owned, bounded native client. The RPC * transport owns request deadlines and child shutdown. Native discovery can * maintain its own caches; callers must constrain writes when requiring isolation. */ export declare function captureCodexNativeSkillCatalog(options: { command: string; home: string; codexHome?: string; cwd: string; timeoutMs?: number; }, connect?: (options: { command: string; home: string; codexHome?: string; timeoutMs?: number; }) => Promise): Promise; /** Evaluate already-selected user/session rules in native order. This is a rule * projection, not proof that an existing live consumer adopted the rules. Names * use exact equality; paths use native canonicalization with lexical fallback. * Unknown fields remain the caller's property and are not rewritten here. */ export declare function isCodexNativeSkillDisabled(skill: CodexNativeSkill, rules: unknown): boolean;