import { type CodexInstalledPlugin, type CodexNativeSkillCatalog } from "./codex-native-skill-catalog.js"; export interface CodexPluginSkillControl { name: string; pluginId: string; namespace: string; pluginParent: string; manifestSha256: string; appSha256?: string; mcpSha256?: string; remotePluginId?: string; skillsOnly?: true; } /** A native nonremote installation disabled by the witnessed configuration. * Its cache is inert; this makes no claim about reviewed hook capabilities. */ export interface CodexInactivePluginControl { pluginId: string; namespace: string; pluginParent: string; sourceType: "local" | "git" | "npm"; sourceSha256: string; } export interface ReviewedCodexSkillDenial { name: string; path: string; sha256: string; } export interface CodexPluginSourceInput { pluginId: string; namespace: string; pluginParent: string; sourceRoot: string; sourceSha256: string; } type Read = (path: string) => string; /** The remote plugin identifier from the exact native install receipt Codex * writes beside a remote plugin's versions, or null when it is absent or invalid. */ export declare function codexRemoteInstallReceipt(parent: string, read: Read): string | null; /** Named install refusals for a plugin Codex's catalog reports as remote. */ export declare const CODEX_REMOTE_RECEIPT_MISSING = "CODEX_REMOTE_RECEIPT_MISSING"; export declare const CODEX_REMOTE_RECEIPT_MISMATCH = "CODEX_REMOTE_RECEIPT_MISMATCH"; export declare const CODEX_REMOTE_RECEIPT_SNAPSHOT_REQUIRED = "CODEX_REMOTE_RECEIPT_SNAPSHOT_REQUIRED"; /** The remote identity the reconcile may bind for a plugin Codex reports as * remote: the catalog's id when the receipt read before Codex started named it * and the current receipt still does; null otherwise. A catalog without a * valid pre-start reading for this cache refuses (SNAPSHOT_REQUIRED). */ export declare function codexPreStartRemoteReceipt(catalog: CodexNativeSkillCatalog, cache: string, parent: string, plugin: { id: string; remotePluginId?: string; }, read: Read): string | null; /** Whether an enrolled parent's bound receipt was not there, with that id, * before Codex started. Applies when a control binds a receipt and the parent * exists (an absent parent is left to its own rules); a catalog without a * valid pre-start reading for this cache then refuses (SNAPSHOT_REQUIRED). */ export declare function codexPreStartReceiptChanged(catalog: CodexNativeSkillCatalog, cache: string, parentControls: CodexPluginSkillControl[]): boolean; /** What a reconcile does with an enrolled parent whose stored controls do not * all carry its receipt (policies stored before every control recorded it). * A plugin Codex reports as remote is healed: every control gets the catalog's * id, on exactly the fresh-install proof (requireRemoteInstallReceipt: the * pre-start reading and the current receipt both name it; MISSING or MISMATCH * otherwise), and only when every bound control already agrees ("refuse"). * A plugin Codex does not report as remote refuses when only some controls are * bound. null: nothing to heal (every control bound, none bound and not * reported remote, or the parent is absent and left to its own rules). */ export declare function codexStoredReceiptHeal(catalog: CodexNativeSkillCatalog, cache: string, parentControls: CodexPluginSkillControl[], plugin: CodexInstalledPlugin | undefined, read: Read): { heal: string; } | "refuse" | null; /** Whether a vendor refresh's `.app.json` connector declaration is valid under * the same appControls validation rootControls applies (duplicate keys, the * single `apps` object, app names, `id`/`category`/`required` only, types and * caps), read as a regular, unlinked file of at most 1 MiB in strict UTF-8. * Every failure is false. */ export declare function codexAppDeclarationValid(path: string): boolean; export interface CodexPluginRootControls { namespace: string; manifestSha256: string; appSha256?: string; mcpSha256?: string; } /** Reuse the strict package-owned capability parser for an explicitly reviewed * plugin materialization. This does not establish parent or receipt identity. */ export declare function readCodexPluginRootControls(root: string, read: Read): CodexPluginRootControls; export interface CodexPluginCacheDocumentIdentity { name: string; namespace: string; pluginId: string; pluginParent: string; root: string; manifestSha256: string; } /** Classify one cache document as installed-plugin content through the same * manifest identity, capability review and real-path binding the reviewed * predicates use. This is identity only: it consults no enable rule, reviewed * control or native catalog, and it never admits anything by itself. */ export declare function classifyCodexPluginCacheDocument(document: string, cache: string, read: Read): CodexPluginCacheDocumentIdentity | null; /** Establish the reviewed denial/skills-only role for an exact remote parent. * Walk every ancestor: a dangling alias or non-directory is never absence. */ export declare function reviewedDisabledCodexPluginParent(cache: string, parent: string, controls: CodexPluginSkillControl[], rules: unknown): boolean; export declare function absentDisabledCodexPluginParent(cache: string, parent: string, controls: CodexPluginSkillControl[], rules: unknown): boolean; /** A body-free historical remote version has no remaining native skill entry. * Bind its capability-identical, skills-only identity before projecting it. */ export declare function reviewedRetiredCodexRoot(cache: string, root: string, controls: CodexPluginSkillControl[], rules: unknown, read: Read, allowAbsent?: boolean): boolean; /** Capability controls remain bound even after every native Skill body disappears. */ export declare function reviewedCodexPluginCapabilitiesUnchanged(cache: string, controls: CodexPluginSkillControl[], read: Read, rules?: unknown): boolean; export declare function reviewCodexPluginControls(catalog: CodexNativeSkillCatalog, documents: string[], cache: string, cwd: string, read: Read, rules: unknown, pluginSettings?: unknown, plannedRules?: unknown, denials?: ReviewedCodexSkillDenial[]): { skills: CodexPluginSkillControl[]; inactivePlugins: CodexInactivePluginControl[]; sourceInputs: CodexPluginSourceInput[]; }; /** Validate installation-input roles before omitting them from runtime inventory. * Discovery witnesses still cover the sources; migration inventory stays full. */ export declare function reviewedCodexPluginSourceRoots(cache: string, inputs: CodexPluginSourceInput[], read: Read): string[]; export declare function reviewCodexPluginSkillControls(catalog: CodexNativeSkillCatalog, documents: string[], cache: string, cwd: string, read: Read, rules: unknown, pluginSettings?: unknown): CodexPluginSkillControl[]; /** Cache refresh cannot reactivate a config-controlled disabled installation. * The caller verifies discovery/config witnesses before consuming this result. */ export declare function isReviewedCodexPluginInactive(document: string, cache: string, controls: CodexInactivePluginControl[], pluginSettings: unknown, rules: unknown, read: Read): boolean; export declare function isReviewedCodexPluginSkillDisabled(document: string, cache: string, controls: CodexPluginSkillControl[], rules: unknown, read: Read): boolean; /** Refusal code for a plugin change that touches more than its skill names: a * new or changed app, MCP, hooks, manifest or remote installation capability. */ export declare const CODEX_PLUGIN_CAPABILITY_REVIEW_REQUIRED = "CODEX_PLUGIN_CAPABILITY_REVIEW_REQUIRED"; export type CodexPluginCapabilityReason = "app" | "mcp" | "hooks" | "commands" | "agents" | "manifest" | "manifest-location" | "remote" | "unsupported"; /** Why a plugin Skills has not enrolled needs a review before its skills can be * enrolled automatically. Empty only when every version root holds nothing but * a supported skills-only manifest and skills. A remote installation is not * itself a capability; its receipt is checked separately. */ export declare function unenrolledCodexPluginCapabilities(parent: string, read: Read): CodexPluginCapabilityReason[]; /** The same classification with its evidence: every manifest path read. A * skills-only result (no reasons) always names at least one manifest. */ export declare function unenrolledCodexPluginEvidence(parent: string, read: Read): { reasons: CodexPluginCapabilityReason[]; manifests: string[]; }; /** Capability evidence for a plugin root outside the plugin cache (a Codex * runtime), where the version-directory contract does not apply. */ export declare function codexPluginRootEvidence(root: string, read: Read): { reasons: CodexPluginCapabilityReason[]; manifests: string[]; }; /** The strict scan for an enrolled plugin, run in addition to the reviewed-tuple * check over every current version root: anything the reviewed tuple does not * bind (a root plugin.json, hooks.json, commands/ or agents/, another manifest * directory, a case variant, a nested declaration, a link) is a capability. */ export declare function enrolledCodexPluginStrictChanges(parentControls: CodexPluginSkillControl[], read: Read): CodexPluginCapabilityReason[]; /** Which capability of an enrolled plugin parent no longer matches its reviewed * controls. Empty exactly when reviewedCodexPluginCapabilitiesUnchanged accepts it. */ export declare function codexPluginCapabilityChanges(cache: string, parentControls: CodexPluginSkillControl[], read: Read, rules?: unknown): CodexPluginCapabilityReason[]; /** Add newly enrolled qualified names to the reviewed control set. Never removes * an existing control, and changes one only to bind `remoteIdentities[parent]`, * the caller-verified native install receipt, onto an enrolled control stored * without it (codexStoredReceiptHeal). A name under an enrolled plugin parent * takes that parent's reviewed identity, and the native review must report the * same capability tuple for it; it never drops a receipt the review verified. * A name under a plugin Skills has not enrolled is admitted only for a * skills-only plugin, and binds `remoteIdentities[parent]` when it is remote. */ export declare function mergeReconciledCodexPluginControls(prior: CodexPluginSkillControl[], reviewed: CodexPluginSkillControl[], names: string[], remoteIdentities?: Record): CodexPluginSkillControl[]; export declare function disableReviewedCodexPluginNames(text: string, controls: CodexPluginSkillControl[]): string; export {};