# Wrengle local plugin authoring instructions for LLMs Use this text when a user asks you to create a Wrengle plugin. Wrengle plugin support is currently a local developer-preview feature. The safest default for non-technical users is a view-only plugin: a local folder with a plugin.toml manifest and one self-contained HTML file rendered by Wrengle in a sandboxed iframe tab. Local plugin code remains trusted local code. Do not imply marketplace availability, remote installation, or public stability. Capability declarations are not grants; grants are local to the user's app install. View-only plugin JavaScript can make direct network requests, and those direct requests are not controlled by the httpHosts capability. httpHosts applies only to Wrengle host-bridge HTTP used by WASM action plugins. Do not design or describe marketplace distribution, remote installation, process plugins, terminal access, arbitrary shell commands, arbitrary local file access, or direct access to Wrengle internals. Those are not available in the current local plugin surface. Plugin Builder currently supports static custom views and offline feature apps with plugin-scoped JSON state. Builder-created apps are offline and cannot read or write Wrengle workspace content. Workspace-aware generated plugins are future work. Builder-created offline apps can use `window.wrengle.state.get`, `window.wrengle.state.set`, and `window.wrengle.state.delete` for plugin-scoped local JSON state. Builder drafts declare expected state keys and generated code is checked against that draft contract before Apply. Installed app state remains scoped to the plugin. They do not receive `state.list` or `state.clear`; reset is a Wrengle-owned action from Plugin Builder. Resetting app state removes the app's local saved data only; it does not remove plugin files, prompt history, or conversations. Deleting a Builder-created app removes its managed plugin files, approved prompt history, rollback points, linked Builder conversations, and installed app state. For stateful edits, edit-preview state is temporary; preview interactions test the draft only, and applying an edit preserves installed app state. In the app, Plugin Builder is a minimal chat-and-preview workspace. Chat remains visible beside the generated preview, build progress appears as concise chat status cards, and installed-plugin lifecycle actions live in the project header instead of a permanent controls rail. Open and History stay visible in the header; edit, Reset app state for stateful apps, enable or disable, and delete stay in the actions menu. For supported static custom-view create prompts with clear static/sample/mock UI intent, Plugin Builder may recover from malformed provider JSON, invalid draft specs, or policy-blocked static HTML by discarding the provider output and synthesizing a safe local static starter draft. The recovered draft still runs local checks and smoke preview before install. Recovery does not apply to unsupported prompts, network/API/remote-service prompts, live/real/actual/production data requests, workspace data prompts, edit drafts, provider connection/auth/rate-limit failures, or local write, metadata, or fingerprint failures. Generated Builder views have no network, secrets, shell, filesystem, or Tauri IPC access. Plugin Builder creates local offline custom views and stateful offline feature apps. It does not create networked plugins, workspace readers, workspace writers, marketplace listings, or generated WASM tools in this release. Default output ============== Create a view-only plugin with this folder layout: my-plugin/ plugin.toml ui/ index.html The final answer to the user must include: 1. The folder tree. 2. The full contents of plugin.toml. 3. The full contents of ui/index.html. 4. Short load and test steps for Wrengle Settings -> Plugins. If the user asks for a WASM action plugin, do not generate it from this file alone. Ask the user to provide Wrengle's WASM action plugin documentation first. plugin.toml requirements ======================== For a view-only plugin, plugin.toml must include top-level metadata and at least one [[views]] block. Use this shape: id = "plugin.my-tool" name = "My Tool" version = "0.1.0" schema_version = 1 description = "Short description of what the plugin does." [[views]] id = "plugin.my-tool.view" label = "My Tool" entry = "ui/index.html" If the plugin should receive selected note text, add these fields to the same [[views]] block: accepts_selection = true selection_label = "Send to My Tool" Rules: - The top-level plugin id must start with plugin. - The rest of the top-level id should be lowercase ASCII. A safe pattern is plugin.. - The view id must start with the plugin id plus a dot. - Use lowercase ASCII ids with letters, digits, dots, and hyphens only. - Do not use consecutive dots in ids. - entry must be relative to the plugin folder. - entry must point to an HTML file that exists in the generated folder. - Use accepts_selection = true only when the view should receive selected note text from the editor Actions menu. - Add a clear selection_label when accepts_selection = true. - Do not include a [runtime] block for a view-only plugin. - Do not include plugin.wasm for a view-only plugin. - Do not require Rust, WASM, Node, npm, a bundler, or a build step for the default view-only plugin. ui/index.html requirements ========================== The entry file must be one self-contained HTML file. Rules: - Inline all CSS and JavaScript. - Do not use external script files. - Do not use external stylesheet files. - Do not use src attributes for local companion JavaScript files. - Keep the file under 5 MB. - Use Wrengle theme CSS variables for colors, borders, shadows, and surfaces. - Do not define an independent hard-coded light or dark color palette. - Support active theme updates by handling wrengle:init and wrengle:theme. - Build a complete, usable interface for the user's requested plugin idea. - If selected note text is supported, handle wrengle:selection messages. - Do not use network requests by default. - If the user explicitly asks for network requests, list the exact destination hosts, explain what data is sent, and make each send action user-triggered. - Never send selected note text or pasted user content to a remote service automatically. - Do not claim httpHosts grants control direct fetch or XMLHttpRequest calls from view JavaScript. Required bridge protocol ======================== Wrengle sends messages to the view over window.postMessage. The view must send wrengle:ready after it is ready to receive messages. Include this bridge inside a