import type { PLUGIN_MANIFEST_VERSION, PLUGIN_MARKDOWN_BLOCK_RENDERER_MODES, PLUGIN_EDITOR_EXTENSION_MODES, PLUGIN_EDITOR_EXTENSION_PRIORITY_TIERS, PLUGIN_FILE_VIEWER_RENDERER_MODES, PLUGIN_NOTE_ACTION_SURFACES, PLUGIN_PERMISSIONS, PLUGIN_PLATFORMS, PLUGIN_RUNTIMES, PLUGIN_SETTING_FIELD_TYPES, PLUGIN_SETTING_STORAGE_CLASSES } from "./constants.js";
export type PluginRuntime = typeof PLUGIN_RUNTIMES[number];
export type PluginPlatform = typeof PLUGIN_PLATFORMS[number];
export type PluginPermission = typeof PLUGIN_PERMISSIONS[number];
export type PluginSettingFieldType = typeof PLUGIN_SETTING_FIELD_TYPES[number];
export type PluginSettingStorageClass = typeof PLUGIN_SETTING_STORAGE_CLASSES[number];
export type PluginMarkdownBlockRendererMode = typeof PLUGIN_MARKDOWN_BLOCK_RENDERER_MODES[number];
export type PluginEditorExtensionMode = typeof PLUGIN_EDITOR_EXTENSION_MODES[number];
export type PluginEditorExtensionPriorityTier = typeof PLUGIN_EDITOR_EXTENSION_PRIORITY_TIERS[number];
export type PluginFileViewerRendererMode = typeof PLUGIN_FILE_VIEWER_RENDERER_MODES[number];
export type PluginNoteActionSurface = typeof PLUGIN_NOTE_ACTION_SURFACES[number];
export type Sha256Digest = `sha256:${string}`;
export interface PluginViewContribution {
    readonly id: string;
    readonly title: string;
    readonly icon?: string;
}
export interface PluginCommandContribution {
    readonly id: string;
    readonly title: string;
    readonly icon?: string;
}
export interface PluginNavigationItemContribution {
    readonly id: string;
    readonly title: string;
    readonly view: string;
    readonly icon?: string;
}
export interface PluginSearchPresentationContribution {
    readonly id: string;
    readonly title: string;
    readonly icon?: string;
}
export type PluginMarkdownBlockConfigField = {
    readonly type: "boolean";
    readonly title?: string;
    readonly description?: string;
    readonly default?: boolean;
} | {
    readonly type: "integer" | "number";
    readonly title?: string;
    readonly description?: string;
    readonly default?: number;
    readonly minimum?: number;
    readonly maximum?: number;
} | {
    readonly type: "string";
    readonly title?: string;
    readonly description?: string;
    readonly default?: string;
    readonly enum?: readonly string[];
    readonly minLength?: number;
    readonly maxLength?: number;
};
export interface PluginMarkdownBlockConfigSchema {
    readonly version: 1;
    readonly type: "object";
    readonly properties: Readonly<Record<string, PluginMarkdownBlockConfigField>>;
    readonly required?: readonly string[];
    readonly additionalProperties: false;
}
export interface PluginMarkdownBlockContribution {
    readonly id: string;
    readonly title: string;
    /** Must equal the package runtime; retained in review metadata explicitly. */
    readonly runtime: PluginRuntime;
    readonly rendererMode: PluginMarkdownBlockRendererMode;
    readonly configSchema: PluginMarkdownBlockConfigSchema;
    /** Capabilities the renderer needs, all of which must be package-approved. */
    readonly permissions: readonly PluginPermission[];
}
export interface PluginEditorExtensionApplicability {
    /** Omit to apply to every host-recognized note type. */
    readonly noteTypes?: readonly string[];
    readonly modes: readonly PluginEditorExtensionMode[];
}
export interface PluginEditorExtensionPriority {
    /**
     * Ordering applies only among plugin contributions. Core editor policy and
     * persistence extensions always retain higher precedence.
     */
    readonly tier: PluginEditorExtensionPriorityTier;
    readonly order: number;
}
export interface PluginEditorExtensionContribution {
    readonly id: string;
    readonly title: string;
    readonly hostApiVersion: string;
    readonly appliesTo: PluginEditorExtensionApplicability;
    readonly priority: PluginEditorExtensionPriority;
    readonly configSchema: PluginMarkdownBlockConfigSchema;
}
export interface PluginEditorExtensionBuild {
    readonly proofVersion: 1;
    readonly path: string;
}
/**
 * A closed metadata-only query evaluated against the loaded note index.
 * Every populated list is an AND condition; `anyTags` is OR within the list.
 */
export interface PluginNoteActionApplicabilityQuery {
    readonly noteTypes?: readonly string[];
    readonly allTags?: readonly string[];
    readonly anyTags?: readonly string[];
    readonly requiredProperties?: readonly string[];
}
export interface PluginNoteActionContribution {
    readonly id: string;
    readonly title: string;
    readonly icon?: string;
    /** Note actions are native-only in API v1. */
    readonly runtime: "native";
    readonly permissions: readonly PluginPermission[];
    readonly surfaces: readonly PluginNoteActionSurface[];
    readonly appliesTo: PluginNoteActionApplicabilityQuery;
}
export interface PluginFileViewerContribution {
    readonly id: string;
    readonly title: string;
    readonly icon?: string;
    /** Must equal the package runtime. */
    readonly runtime: PluginRuntime;
    readonly rendererMode: PluginFileViewerRendererMode;
    readonly permissions: readonly PluginPermission[];
    /** Exact lowercase extensions without a leading dot. Wildcards are invalid. */
    readonly extensions: readonly string[];
    /** Exact lowercase MIME types. Wildcards and structured suffix wildcards are invalid. */
    readonly mediaTypes: readonly string[];
    /** The host rejects the asset before reading more than this many bytes. */
    readonly maxBytes: number;
    readonly content: "bytes" | "text";
}
export interface PluginSettingOption {
    readonly value: string;
    readonly title: string;
}
interface PluginSettingFieldBase {
    readonly key: string;
    readonly title: string;
    readonly description?: string;
    readonly required?: boolean;
}
export interface PluginTextSettingField extends PluginSettingFieldBase {
    readonly type: "text" | "textarea";
    readonly storage: "synced" | "local";
    readonly placeholder?: string;
    readonly default?: string;
    readonly minLength?: number;
    readonly maxLength?: number;
}
export interface PluginNumberSettingField extends PluginSettingFieldBase {
    readonly type: "number";
    readonly storage: "synced" | "local";
    readonly default?: number;
    readonly min?: number;
    readonly max?: number;
    readonly step?: number;
}
export interface PluginCheckboxSettingField extends PluginSettingFieldBase {
    readonly type: "checkbox";
    readonly storage: "synced" | "local";
    readonly default?: boolean;
}
export interface PluginSelectSettingField extends PluginSettingFieldBase {
    readonly type: "select";
    readonly storage: "synced" | "local";
    readonly default?: string;
    readonly options: readonly PluginSettingOption[];
}
export interface PluginReferenceSettingField extends PluginSettingFieldBase {
    readonly type: "url" | "note" | "folder" | "asset";
    readonly storage: "synced" | "local";
    readonly placeholder?: string;
    readonly default?: string;
}
export interface PluginSecretSettingField extends PluginSettingFieldBase {
    readonly type: "secret";
    readonly storage: "encrypted-secret";
    /** Omit the manifest key from diagnostics and host DOM attributes. */
    readonly sensitiveName?: boolean;
}
export type PluginSettingField = PluginTextSettingField | PluginNumberSettingField | PluginCheckboxSettingField | PluginSelectSettingField | PluginReferenceSettingField | PluginSecretSettingField;
export interface PluginSettingSection {
    readonly id: string;
    readonly title: string;
    readonly fields: readonly PluginSettingField[];
}
export interface PluginSettingsContribution {
    readonly sections: readonly PluginSettingSection[];
}
export interface PluginStartupJobTrigger {
    readonly type: "startup";
}
export interface PluginIntervalJobTrigger {
    readonly type: "interval-while-active";
    readonly minutes?: number;
    readonly minutesSetting?: string;
}
export interface PluginCommandJobTrigger {
    readonly type: "command";
    readonly command: string;
}
export interface PluginVaultChangeJobTrigger {
    readonly type: "vault-change";
    readonly noteSetting: string;
}
export interface PluginAssetChangeJobTrigger {
    readonly type: "asset-change";
    readonly pathSetting: string;
}
export type PluginJobTrigger = PluginStartupJobTrigger | PluginIntervalJobTrigger | PluginCommandJobTrigger | PluginVaultChangeJobTrigger | PluginAssetChangeJobTrigger;
export interface PluginJobContribution {
    readonly id: string;
    readonly title: string;
    readonly triggers: readonly PluginJobTrigger[];
    readonly concurrency: "skip-if-running";
}
export interface PluginContributionsV2 {
    readonly views?: readonly PluginViewContribution[];
    readonly commands?: readonly PluginCommandContribution[];
    readonly navigationItems?: readonly PluginNavigationItemContribution[];
    readonly searchPresentations?: readonly PluginSearchPresentationContribution[];
    readonly markdownBlocks?: readonly PluginMarkdownBlockContribution[];
    readonly editorExtensions?: readonly PluginEditorExtensionContribution[];
    readonly noteActions?: readonly PluginNoteActionContribution[];
    readonly fileViewers?: readonly PluginFileViewerContribution[];
    readonly settings?: PluginSettingsContribution;
    readonly jobs?: readonly PluginJobContribution[];
}
export interface PluginNetworkFixedConnection {
    readonly id: string;
    readonly origin: string;
}
export interface PluginNetworkSettingConnection {
    readonly id: string;
    readonly originSetting: string;
    readonly requireHttps: true;
}
export type PluginNetworkConnection = PluginNetworkFixedConnection | PluginNetworkSettingConnection;
interface PluginManifestV2Base {
    readonly manifestVersion: typeof PLUGIN_MANIFEST_VERSION;
    readonly id: string;
    readonly name: string;
    readonly description?: string;
    readonly author?: string;
    readonly version: string;
    readonly apiVersion: string;
    readonly platforms: readonly PluginPlatform[];
    readonly permissions: readonly PluginPermission[];
    readonly network?: readonly PluginNetworkConnection[];
    readonly contributes: PluginContributionsV2;
}
export interface NativePluginManifestV2 extends PluginManifestV2Base {
    readonly runtime: "native";
    readonly entry: string;
    readonly styles?: readonly string[];
    readonly assets?: readonly string[];
    readonly integrity: Readonly<Record<string, Sha256Digest>>;
    readonly editorExtensionBuild?: PluginEditorExtensionBuild;
}
export interface SandboxedPagePluginManifestV2 extends PluginManifestV2Base {
    readonly runtime: "sandboxed-page";
    readonly entry: string;
    readonly styles?: readonly string[];
    readonly assets?: readonly string[];
    readonly integrity: Readonly<Record<string, Sha256Digest>>;
}
export interface LiveSandboxedPluginManifestV2 extends PluginManifestV2Base {
    readonly runtime: "live-sandboxed";
}
export type PackagedPluginManifestV2 = NativePluginManifestV2 | SandboxedPagePluginManifestV2;
export type PluginManifestV2 = PackagedPluginManifestV2 | LiveSandboxedPluginManifestV2;
export interface InstalledPluginPayloadEntry {
    readonly path: string;
    readonly kind: "file" | "symlink" | "directory" | "other";
    readonly sizeBytes: number;
    /** Evidence supplied by a filesystem adapter after containment checks. */
    readonly escapesPackageRoot?: boolean;
    /** Required for declared payload files; omitted for manifest.json. */
    readonly sha256?: Sha256Digest;
}
export interface PackageDigestFile {
    readonly path: string;
    readonly bytes: Uint8Array;
}
export interface PluginEditorExtensionBuildImport {
    readonly path: string;
    readonly kind: "import-statement" | "dynamic-import" | "require-call" | "other";
    readonly external: boolean;
}
export interface PluginEditorExtensionBuildInput {
    /** Normalized project-relative source path; never an absolute path. */
    readonly path: string;
    readonly bytes: number;
    readonly imports: readonly PluginEditorExtensionBuildImport[];
}
export interface PluginEditorExtensionBuildOutput {
    readonly path: string;
    readonly bytes: number;
    readonly entryPoint: string;
    readonly imports: readonly PluginEditorExtensionBuildImport[];
}
/**
 * Normalized from the supported bundler metafile. Integrity binds this proof
 * file to the package; entryDigest binds it to the exact native entry bytes.
 */
export interface PluginEditorExtensionBuildProofV1 {
    readonly version: 1;
    readonly builder: "esbuild";
    readonly entry: string;
    readonly entryDigest: Sha256Digest;
    readonly externalPackages: readonly string[];
    readonly inputs: readonly PluginEditorExtensionBuildInput[];
    readonly outputs: readonly PluginEditorExtensionBuildOutput[];
}
export {};
