Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
// Generated by scripts/gen-plugin-sdk.mjs from src/plugins/sdk.ts. Do not edit.
export const PLUGIN_SDK_DTS = "/**\n * Plugin API 1.0: what an in-process plugin sees.\n *\n * A plugin module exports `activate(ctx)` and, optionally, `deactivate()`.\n * Everything it registers or schedules through `ctx` is torn down\n * automatically when the plugin is disabled, uninstalled or updated, so a\n * plugin that only uses the context cannot leak timers or tools.\n *\n * `mercury plugins init` writes these types into every new plugin as\n * mercury-plugin.d.ts (src/plugins/sdk-dts.ts, regenerated by\n * `node scripts/gen-plugin-sdk.mjs`; a test keeps the two in sync).\n */\n\nexport interface Disposable {\n dispose(): void;\n}\n\nexport interface PluginLogger {\n debug(message: string, data?: Record<string, unknown>): void;\n info(message: string, data?: Record<string, unknown>): void;\n warn(message: string, data?: Record<string, unknown>): void;\n error(message: string, data?: Record<string, unknown>): void;\n}\n\nexport interface PluginToolDefinition {\n /** Must match a tool declared in the manifest's `contributes.tools`. */\n name: string;\n /** JSON Schema (type \"object\") for the tool's arguments. */\n inputSchema: Record<string, unknown>;\n /**\n * Runs the tool. Return a string, or any JSON-serialisable value. Throwing\n * reports an error to the model; repeated failures disable the plugin.\n * `signal` aborts on timeout, on disable, and when the turn is cancelled.\n */\n execute(args: Record<string, unknown>, options: { signal: AbortSignal }): unknown | Promise<unknown>;\n}\n\nexport interface PluginCommandIO {\n /** Send a message back to whoever ran the command (terminal, Telegram, web). */\n reply(text: string): Promise<void>;\n signal: AbortSignal;\n}\n\nexport interface PluginCommandDefinition {\n /** Must match a command declared in the manifest's `contributes.commands`. Invoked as `/<name>`. */\n name: string;\n run(args: string, io: PluginCommandIO): void | Promise<void>;\n}\n\nexport interface PluginContext {\n /** Plugin API version Mercury implements, e.g. \"1.0.0\". */\n readonly apiVersion: string;\n readonly mercuryVersion: string;\n readonly plugin: {\n readonly id: string;\n readonly version: string;\n /** A folder this plugin owns. Kept across updates; deleted only on uninstall --purge. */\n readonly dataDir: string;\n };\n readonly log: PluginLogger;\n readonly settings: {\n get<T = unknown>(key: string): T | undefined;\n all(): Record<string, unknown>;\n };\n /** Only the secrets declared in the manifest's `permissions.secrets` are readable. */\n readonly secrets: {\n get(name: string): string | undefined;\n };\n readonly tools: {\n register(definition: PluginToolDefinition): Disposable;\n };\n readonly commands: {\n register(definition: PluginCommandDefinition): Disposable;\n };\n /** Tracked timers: cleared automatically on disable. Errors inside them are contained. */\n readonly timers: {\n setTimeout(fn: () => void | Promise<void>, ms: number): Disposable;\n setInterval(fn: () => void | Promise<void>, ms: number): Disposable;\n };\n /**\n * fetch() limited to the hosts declared in `permissions.network`, through\n * Mercury's SSRF guard (private and loopback addresses are blocked).\n * Requests are aborted when the plugin is disabled.\n */\n fetch(url: string, init?: RequestInit): Promise<Response>;\n /** Aborted when the plugin is being disabled, updated or uninstalled. */\n readonly signal: AbortSignal;\n /** Run cleanup when the plugin stops. */\n onDispose(fn: () => void | Promise<void>): void;\n}\n\nexport interface PluginModule {\n activate(ctx: PluginContext): void | Promise<void>;\n deactivate?(): void | Promise<void>;\n}\n";