A plugin-authored, structured error — throw this (instead of a plain throw new Error(...))
to report {error_code, data} through an exception rather than a return {error}. error_code
doubles as an i18n lookup key (see crates/lanrurugi-plugin/dispatcher/plugin-sdk.ts's
PluginError for the full field-meaning docs — this class's fields mirror that interface
exactly). The dispatcher's own catch (dispatcher.ts's handleRequest) uses real
instanceof against this exact class to extract error_code/data for the Rust host.
The real class lives in plugin-sdk.ts and is exposed here only as a global
(globalThis.PluginErrorException = PluginErrorException in dispatcher.ts) so every plugin
file can use it with zero import of its own — a plugin file's static import specifier can't
reach plugin-sdk.ts at all, since plugins_dir and plugin-sdk.ts's own directory
(temp_dir) have no fixed relative path between them (both are independent runtime CLI args).
declare class here (rather than declare var ...: PluginError) is what lets a plugin file
both throw new PluginErrorException(...) (construct) and catch it with instanceof
(matches the value dispatcher.ts actually assigns, a real ES class, not just its instance
shape).