Editful
DocsArtifact API

Plugin Artifact API.

Every public export from @editful/plugin-artifact.

  • Generated from declarations
  • TSDoc annotations

Functions

Function

isValidationError

#

Parameters

Parameters and TSDoc annotations
NameTypeStatusDescription
errorunknownRequiredNo description.
Show raw definition
TypeScript
export declare function isValidationError(error: unknown): error is PluginArtifactValidationError;
Function

parsePluginManifest

#

Parses and compatibility-gates schema-1 `plugin.json` without touching code.

Parameters

Parameters and TSDoc annotations
NameTypeStatusDescription
sourcestring | Uint8Array<ArrayBufferLike>RequiredNo description.
contextPluginCompatibilityContextRequiredNo description.
Show raw definition
TypeScript
/**
 * Parses and compatibility-gates schema-1 `plugin.json` without touching code.
 */
export declare function parsePluginManifest(source: string | Uint8Array, context: PluginCompatibilityContext): PluginManifest;
Function

validatePluginArtifact

#

Validates one explicit artifact directory without discovery or code execution. Failures throw `PluginArtifactValidationError`.

Parameters

Parameters and TSDoc annotations
NameTypeStatusDescription
directorystringRequiredNo description.
optionsPluginArtifactValidationOptionsRequiredNo description.
Show raw definition
TypeScript
/**
 * Validates one explicit artifact directory without discovery or code
 * execution. Failures throw `PluginArtifactValidationError`.
 */
export declare function validatePluginArtifact(directory: string, options: PluginArtifactValidationOptions): Promise<ValidatedPluginArtifact>;
Function

validatePluginArtifactResult

#

Result-shaped companion for UI and batch discovery callers.

Parameters

Parameters and TSDoc annotations
NameTypeStatusDescription
directorystringRequiredNo description.
optionsPluginArtifactValidationOptionsRequiredNo description.
Show raw definition
TypeScript
/** Result-shaped companion for UI and batch discovery callers. */
export declare function validatePluginArtifactResult(directory: string, options: PluginArtifactValidationOptions): Promise<PluginArtifactValidationResult>;
Function

validatePluginSettings

#

Reconciles untrusted persisted values with the current manifest schema. Unknown and invalid values are reported and omitted; declared defaults are copied into the effective view.

Parameters

Parameters and TSDoc annotations
NameTypeStatusDescription
manifestPluginManifestRequiredNo description.
storedunknownRequiredNo description.
Show raw definition
TypeScript
/**
 * Reconciles untrusted persisted values with the current manifest schema.
 * Unknown and invalid values are reported and omitted; declared defaults are
 * copied into the effective view.
 */
export declare function validatePluginSettings(manifest: PluginManifest, stored: unknown): ValidatedPluginSettings;
Function

validPluginSettingValue

#

Parameters

Parameters and TSDoc annotations
NameTypeStatusDescription
declarationPluginSettingDeclarationRequiredNo description.
valueunknownRequiredNo description.
Show raw definition
TypeScript
export declare function validPluginSettingValue(declaration: PluginSettingDeclaration, value: unknown): value is PluginSettingValue;

Classes

Class

PluginArtifactCache

#

Process-local content-addressed cache for the future app-owned protocol. Entries contain copies of validated bytes. Serving code asks by digest and never receives or reopens the original filesystem path.

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
sizenumberRequiredNo description.
has(digest: string) => booleanRequiredNo description.
get(digest: string) => ValidatedPluginModule | nullRequiredNo description.
keys() => IterableIterator<string>RequiredNo description.
retain(module: ValidatedPluginModule) => ValidatedPluginModuleRequiredNo description.
delete(digest: string) => booleanRequiredNo description.
clear() => voidRequiredNo description.
Show raw definition
TypeScript
/**
 * Process-local content-addressed cache for the future app-owned protocol.
 *
 * Entries contain copies of validated bytes. Serving code asks by digest and
 * never receives or reopens the original filesystem path.
 */
export declare class PluginArtifactCache {
    private readonly modules;
    get size(): number;
    has(digest: string): boolean;
    get(digest: string): ValidatedPluginModule | null;
    keys(): IterableIterator<string>;
    retain(module: ValidatedPluginModule): ValidatedPluginModule;
    delete(digest: string): boolean;
    clear(): void;
}
Class

PluginArtifactValidationError

#

Typed validation failure suitable for both logs and compatibility UI.

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
diagnosticPluginArtifactDiagnosticRequired · readonlyNo description.
Show raw definition
TypeScript
/** Typed validation failure suitable for both logs and compatibility UI. */
export declare class PluginArtifactValidationError extends Error {
    readonly diagnostic: PluginArtifactDiagnostic;
    constructor(diagnostic: PluginArtifactDiagnostic, options?: ErrorOptions);
}

Types

Type

PluginArtifactDiagnostic

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
categoryPluginArtifactDiagnosticCategoryRequired · readonlyNo description.
codePluginArtifactDiagnosticCodeRequired · readonlyNo description.
messagestringRequired · readonlyNo description.
pathstringOptional · readonlyNo description.
pluginIdstringOptional · readonlyNo description.
Show raw definition
TypeScript
export interface PluginArtifactDiagnostic {
    readonly category: PluginArtifactDiagnosticCategory;
    readonly code: PluginArtifactDiagnosticCode;
    readonly message: string;
    readonly path?: string;
    readonly pluginId?: string;
}
Type

PluginArtifactDiagnosticCategory

#
Show raw definition
TypeScript
export type PluginArtifactDiagnosticCategory = 'missing' | 'malformed' | 'incompatible' | 'unsupported' | 'corrupt';
Type

PluginArtifactDiagnosticCode

#
Show raw definition
TypeScript
export type PluginArtifactDiagnosticCode = 'ARTIFACT_NOT_FOUND' | 'ARTIFACT_NOT_DIRECTORY' | 'ARTIFACT_UNREADABLE' | 'ARTIFACT_FILES_UNSUPPORTED' | 'MANIFEST_MISSING' | 'MANIFEST_NOT_REGULAR' | 'MANIFEST_TOO_LARGE' | 'MANIFEST_INVALID_UTF8' | 'MANIFEST_INVALID_JSON' | 'MANIFEST_INVALID_SHAPE' | 'MANIFEST_FIELD_INVALID' | 'MANIFEST_KEY_UNSUPPORTED' | 'MANIFEST_SCHEMA_UNSUPPORTED' | 'APP_INCOMPATIBLE' | 'SDK_INCOMPATIBLE' | 'CAPABILITY_UNSUPPORTED' | 'ENTRY_MISSING' | 'ENTRY_PATH_INVALID' | 'ENTRY_ESCAPES_ARTIFACT' | 'ENTRY_NOT_REGULAR' | 'ENTRY_TOO_LARGE' | 'ENTRY_INVALID_UTF8' | 'ENTRY_DIGEST_MISMATCH' | 'ENTRY_SYNTAX_INVALID' | 'ENTRY_IMPORT_UNSUPPORTED' | 'ENTRY_SOURCE_MAP_UNSUPPORTED' | 'ICON_PATH_INVALID' | 'ICON_NOT_REGULAR' | 'ICON_TOO_LARGE' | 'ICON_COUNT_EXCEEDED' | 'ICON_INVALID_UTF8' | 'ICON_SVG_INVALID';
Type

PluginArtifactValidationOptions

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
cachePluginArtifactCacheLikeOptional · readonly

Optional shared content-addressed retention for the future protocol.

appVersionstringRequired · readonly

Stable host application SemVer.

sdkVersionstringRequired · readonly

Exact public SDK package/contract version accepted by this host.

Show raw definition
TypeScript
export interface PluginArtifactValidationOptions extends PluginCompatibilityContext {
    /** Optional shared content-addressed retention for the future protocol. */
    readonly cache?: PluginArtifactCacheLike;
}
Type

PluginArtifactValidationResult

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
oktrue | falseRequired · readonlyNo description.
valueValidatedPluginArtifactOptional · readonlyNo description.
diagnosticPluginArtifactDiagnosticOptional · readonlyNo description.
Show raw definition
TypeScript
export type PluginArtifactValidationResult = {
    readonly ok: true;
    readonly value: ValidatedPluginArtifact;
} | {
    readonly ok: false;
    readonly diagnostic: PluginArtifactDiagnostic;
};
Type

PluginCapability

#
Show raw definition
TypeScript
export type PluginCapability = (typeof PLUGIN_CAPABILITIES)[number];
Type

PluginCompatibilityContext

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
appVersionstringRequired · readonly

Stable host application SemVer.

sdkVersionstringRequired · readonly

Exact public SDK package/contract version accepted by this host.

Show raw definition
TypeScript
export interface PluginCompatibilityContext {
    /** Stable host application SemVer. */
    readonly appVersion: string;
    /** Exact public SDK package/contract version accepted by this host. */
    readonly sdkVersion: string;
}
Type

PluginManifest

#
Show raw definition
TypeScript
export type PluginManifest = PluginManifestV1 | PluginManifestV2;
Type

PluginManifestV1

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
schemaVersion1Required · readonlyNo description.
capabilitiesreadonly ["node-kinds"]Required · readonlyNo description.
idstringRequired · readonlyNo description.
namestringRequired · readonlyNo description.
descriptionstringRequired · readonlyNo description.
versionstringRequired · readonlyNo description.
entry"plugin.mjs"Required · readonlyNo description.
sdkVersionstringRequired · readonlyNo description.
minAppVersionstringRequired · readonlyNo description.
maxAppVersionstringRequired · readonlyNo description.
entrySha256stringRequired · readonlyNo description.
authorstringOptional · readonlyNo description.
homepagestringOptional · readonlyNo description.
sourcestringOptional · readonlyNo description.
Show raw definition
TypeScript
export interface PluginManifestV1 extends PluginManifestBase {
    readonly schemaVersion: 1;
    readonly capabilities: readonly [
        'node-kinds'
    ];
}
Type

PluginManifestV2

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
schemaVersion2Required · readonlyNo description.
capabilitiesreadonly ("node-kinds" | "commands" | "editor-ui" | "importers" | "network" | "configuration" | "secrets" | "remote-media" | "interaction-regions" | "agent-actions")[]Required · readonlyNo description.
networkreadonly PluginNetworkDeclaration[]Required · readonlyNo description.
remoteMediareadonly PluginRemoteMediaDeclaration[]Required · readonlyNo description.
settingsreadonly PluginSettingDeclaration[]Required · readonlyNo description.
secretsreadonly PluginSecretDeclaration[]Required · readonlyNo description.
idstringRequired · readonlyNo description.
namestringRequired · readonlyNo description.
descriptionstringRequired · readonlyNo description.
versionstringRequired · readonlyNo description.
entry"plugin.mjs"Required · readonlyNo description.
sdkVersionstringRequired · readonlyNo description.
minAppVersionstringRequired · readonlyNo description.
maxAppVersionstringRequired · readonlyNo description.
entrySha256stringRequired · readonlyNo description.
authorstringOptional · readonlyNo description.
homepagestringOptional · readonlyNo description.
sourcestringOptional · readonlyNo description.
Show raw definition
TypeScript
export interface PluginManifestV2 extends PluginManifestBase {
    readonly schemaVersion: 2;
    readonly capabilities: readonly PluginCapability[];
    readonly network: readonly PluginNetworkDeclaration[];
    readonly remoteMedia: readonly PluginRemoteMediaDeclaration[];
    readonly settings: readonly PluginSettingDeclaration[];
    readonly secrets: readonly PluginSecretDeclaration[];
}
Type

PluginNetworkDeclaration

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
originstringRequired · readonlyNo description.
methodsreadonly PluginNetworkMethod[]Required · readonlyNo description.
purposestringRequired · readonlyNo description.
Show raw definition
TypeScript
export interface PluginNetworkDeclaration {
    readonly origin: string;
    readonly methods: readonly PluginNetworkMethod[];
    readonly purpose: string;
}
Type

PluginNetworkMethod

#
Show raw definition
TypeScript
export type PluginNetworkMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
Type

PluginRemoteMediaDeclaration

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
originstringRequired · readonlyNo description.
mediaTypesreadonly PluginRemoteMediaType[]Required · readonlyNo description.
purposestringRequired · readonlyNo description.
Show raw definition
TypeScript
export interface PluginRemoteMediaDeclaration {
    readonly origin: string;
    readonly mediaTypes: readonly PluginRemoteMediaType[];
    readonly purpose: string;
}
Type

PluginRemoteMediaType

#
Show raw definition
TypeScript
export type PluginRemoteMediaType = 'image/avif' | 'image/gif' | 'image/jpeg' | 'image/png' | 'image/webp';
Type

PluginSecretDeclaration

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
namestringRequired · readonlyNo description.
labelstringRequired · readonlyNo description.
descriptionstringRequired · readonlyNo description.
requiredbooleanRequired · readonlyNo description.
Show raw definition
TypeScript
export interface PluginSecretDeclaration {
    readonly name: string;
    readonly label: string;
    readonly description: string;
    readonly required: boolean;
}
Type

PluginSettingDeclaration

#
Show raw definition
TypeScript
export type PluginSettingDeclaration = (PluginSettingDeclarationBase & {
    readonly type: 'string';
    readonly default?: string;
}) | (PluginSettingDeclarationBase & {
    readonly type: 'number';
    readonly default?: number;
}) | (PluginSettingDeclarationBase & {
    readonly type: 'boolean';
    readonly default?: boolean;
}) | (PluginSettingDeclarationBase & {
    readonly type: 'enum';
    readonly values: readonly string[];
    readonly default?: string;
}) | (PluginSettingDeclarationBase & {
    readonly type: 'secret-ref';
    readonly secret: string;
});
Type

PluginSettingValue

#
Show raw definition
TypeScript
export type PluginSettingValue = string | number | boolean;
Type

ValidatedPluginArtifact

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
directorystringRequired · readonly

Canonical path used only for diagnostics and discovery identity.

manifestDigeststringRequired · readonly

SHA-256 of the exact bounded plugin.json bytes accepted by validation.

manifestPluginManifestRequired · readonlyNo description.
moduleValidatedPluginModuleRequired · readonlyNo description.
iconsreadonly ValidatedPluginIcon[]Required · readonlyNo description.
Show raw definition
TypeScript
export interface ValidatedPluginArtifact {
    /** Canonical path used only for diagnostics and discovery identity. */
    readonly directory: string;
    /** SHA-256 of the exact bounded plugin.json bytes accepted by validation. */
    readonly manifestDigest: string;
    readonly manifest: PluginManifest;
    readonly module: ValidatedPluginModule;
    readonly icons: readonly ValidatedPluginIcon[];
}
Type

ValidatedPluginIcon

#

Immutable, validated SVG toolbar asset bundled beside the plugin entry.

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
pathstringRequired · readonly

Explicit plugin-relative path, for example `./icons/search.svg`.

digeststringRequired · readonlyNo description.
sourcestringRequired · readonlyNo description.
byteLengthnumberRequired · readonlyNo description.
Show raw definition
TypeScript
/** Immutable, validated SVG toolbar asset bundled beside the plugin entry. */
export interface ValidatedPluginIcon {
    /** Explicit plugin-relative path, for example `./icons/search.svg`. */
    readonly path: string;
    readonly digest: string;
    readonly source: string;
    readonly byteLength: number;
}
Type

ValidatedPluginModule

#

Immutable content retained after validation. `readBytes` returns a copy so callers cannot mutate what a later protocol response serves. No API exposes a source path that should be read again.

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
digeststringRequired · readonlyNo description.
byteLengthnumberRequired · readonlyNo description.
sourcestringRequired · readonlyNo description.
readBytes() => Uint8ArrayRequiredNo description.
Show raw definition
TypeScript
/**
 * Immutable content retained after validation.
 *
 * `readBytes` returns a copy so callers cannot mutate what a later protocol
 * response serves. No API exposes a source path that should be read again.
 */
export interface ValidatedPluginModule {
    readonly digest: string;
    readonly byteLength: number;
    readonly source: string;
    readBytes(): Uint8Array;
}
Type

ValidatedPluginSettings

#

Properties

Properties and TSDoc annotations
NameTypeStatusDescription
valuesReadonly<Record<string, PluginSettingValue>>Required · readonlyNo description.
invalidKeysreadonly string[]Required · readonlyNo description.
removedKeysreadonly string[]Required · readonlyNo description.
Show raw definition
TypeScript
export interface ValidatedPluginSettings {
    readonly values: Readonly<Record<string, PluginSettingValue>>;
    readonly invalidKeys: readonly string[];
    readonly removedKeys: readonly string[];
}

Constants

Constant

MAX_PLUGIN_BUNDLE_BYTES

#
Show raw definition
TypeScript
export declare const MAX_PLUGIN_BUNDLE_BYTES: number;
Constant

MAX_PLUGIN_ICON_BYTES

#
Show raw definition
TypeScript
export declare const MAX_PLUGIN_ICON_BYTES: number;
Constant

MAX_PLUGIN_ICON_COUNT

#
Show raw definition
TypeScript
export declare const MAX_PLUGIN_ICON_COUNT = 16;
Constant

MAX_PLUGIN_ICON_TOTAL_BYTES

#
Show raw definition
TypeScript
export declare const MAX_PLUGIN_ICON_TOTAL_BYTES: number;
Constant

MAX_PLUGIN_MANIFEST_BYTES

#
Show raw definition
TypeScript
export declare const MAX_PLUGIN_MANIFEST_BYTES: number;
Constant

PLUGIN_CAPABILITIES

#
Show raw definition
TypeScript
export declare const PLUGIN_CAPABILITIES: readonly [
    "node-kinds",
    "commands",
    "editor-ui",
    "importers",
    "network",
    "configuration",
    "secrets",
    "remote-media",
    "interaction-regions",
    "agent-actions"
];
Constant

PLUGIN_ENTRY_FILE

#
Show raw definition
TypeScript
export declare const PLUGIN_ENTRY_FILE = "plugin.mjs";
Constant

PLUGIN_MANIFEST_FILE

#
Show raw definition
TypeScript
export declare const PLUGIN_MANIFEST_FILE = "plugin.json";
Constant

PLUGIN_MANIFEST_SCHEMA_VERSION

#
Show raw definition
TypeScript
export declare const PLUGIN_MANIFEST_SCHEMA_VERSION = 2;
Constant

SUPPORTED_PLUGIN_MANIFEST_SCHEMA_VERSIONS

#
Show raw definition
TypeScript
export declare const SUPPORTED_PLUGIN_MANIFEST_SCHEMA_VERSIONS: readonly [
    1,
    2
];