import { type ProfileClient } from "./profile-client.js"; import { type SelectionCacheOptions } from "./selection-cache.js"; import { type PluginFileWitness, type PluginProjectionManifest } from "./plugin-projection.js"; import type { ResolvedSkillSelection } from "../types/skill-selection.js"; /** Version 1 is certified against native Claude 2.1.274 and 2.1.276; new hosts require a contract revision/test. */ export interface PluginAdmissionTarget { schemaVersion: 1; pluginId: string; /** One marketplace command serves all explicitly reviewed native registration scopes. */ registrations: Array<{ scope: "user" | "project"; projectPath: string | null; }>; native: { version: "2.1.274" | "2.1.276"; executable: string; digest: string; }; resolver: { executable: string; digest: string; }; } export interface PluginAdmissionBinding { schemaVersion: 2; authority: string; workspaceId: string; /** Stable account subject. Raw credential/key identities are never persisted. */ principal: PluginAdmissionPrincipal; profileId: string; bundleSlug: string; target: PluginAdmissionTarget; } export type PluginBundleIdentity = Pick; export interface PluginAdmissionPrincipal { userId: string; accountId: string; role: "owner"; } export interface PluginRoutingIdentity extends PluginBundleIdentity { aliases?: string[]; triggers?: { keywords?: string[]; paths?: string[]; always?: boolean; }; } /** Every field that can route or activate the admitted plugin participates in approval. */ export interface PluginAdmissionIdentity { schemaVersion: 3; binding: PluginAdmissionBinding; bindingId: string; profileRevision: string; selection: PluginRoutingIdentity; payloadSelections: PluginRoutingIdentity[]; manifest: PluginProjectionManifest; originalTreeDigest: string; projectionTreeDigest: string; files: PluginFileWitness[]; removed: PluginFileWitness[]; sourceCommand: string; /** Approved digest of the authenticated routing evidence snapshot. */ evidenceDigest: string; } export interface PluginAdmissionPlan extends PluginAdmissionIdentity { observation: { principal: PluginAdmissionPrincipal; profileRevision: string; integration: PluginRoutingIdentity; payloads: PluginRoutingIdentity[]; }; planDigest: string; } export interface PluginAdmissionReceipt { schemaVersion: 3; plan: PluginAdmissionPlan; materializedPath: string; admittedAt: string; } /** Client/store injections are for embedding and isolated tests. The CLI exposes neither. */ export interface PluginAdmissionOptions extends Pick { client?: ProfileClient; storeRoot?: string; timeoutMs?: number; } export declare function pluginAdmissionRoot(): string; export declare function validatePluginTarget(value: unknown): asserts value is PluginAdmissionTarget; /** The accepted native command opens and hashes one inode, then executes that same descriptor. */ export declare function pluginResolverCommand(binding: PluginAdmissionBinding): string; export declare function pluginBindingPath(storeRoot: string, id: string): string; export declare function pluginReceiptPath(storeRoot: string, id: string, digest: string): string; export declare function readPluginBinding(storeRoot: string, id: string): PluginAdmissionBinding; export declare function readPluginAdmissionReceipt(storeRoot: string, id: string, digest: string): PluginAdmissionReceipt; /** Command sources inherit an untrusted shell environment; authority comes from normal owner credentials. */ export declare function assertPluginAuthorityEnvironment(env?: Record): void; /** API reads only: a plan neither writes caches nor admits or executes package code. */ export declare function planPluginAdmission(spec: string, profileId: string, target: PluginAdmissionTarget, options?: PluginAdmissionOptions): Promise; /** Explicit local admission. Original archive and migrated payloads are already privately published. */ export declare function admitPlugin(spec: string, profileId: string, target: PluginAdmissionTarget, approvedDigest: string, approvedEvidenceDigest: string, options?: PluginAdmissionOptions): Promise; /** Fresh authority on every invocation. No receipt, API failure or revocation ever returns a stale directory. */ export declare function resolveAdmittedPlugin(id: string, options?: PluginAdmissionOptions): Promise;