Файли
openidea/sdk/rust/openidea-plugin
Arnaud Ritti 04b1b863df feat(plugins): add persistent private filesystem directories (#2051)
Closes #1947

Adds API 1.3 `fs.plugin-dir`: a persistent owner-only directory per plugin (0700 directories / 0600 files on Unix, owner-only ACL on Windows), separate from the packaged code, storage and secrets. The plugin reads and writes under it without fs.* grants, can open files there in the editor and pass their paths to approved programs; editor saves keep the protection, restart keeps the content, uninstall removes it. Traversal and symlink escapes into other plugins' directories are rejected (real-Wasm regressions).

Co-authored-by: arnaud-ritti <[email protected]>
2026-11-08 06:53:36 +08:00
..

Rust plugin SDK

The Rust API is documented by cargo doc. Web pages shipped alongside a Rust component use window.openidea rather than Rust imports.

API 1.3 adds capability-gated interactive PTYs to that web bridge. Declare engines.openidea = "^1.3" and process:<program> in plugin.toml, then send pty-spawn, pty-input, pty-resize and pty-kill JSON strings using openidea.postMessage. Consume pty-data and acknowledge its sequence using pty-ack; handle pty-exit and pty-error through openidea.onMessage.

See the protocol, permission and resource limits and the minimal fixture. The frame cannot access IPC directly. Its sessions belong to that frame and end with its view or plugin. There is no new WIT import for this API.

API 1.3 also adds diagnostics for unsaved documents. Declare kinds = ["diagnostics"] and the supported languages under [[contributes.providers]], implement openidea_plugin::diagnostics::DiagnosticsProvider, and export it with register_plugin!(MyPlugin, diagnostics). The host supplies versioned text after a 300 ms debounce, cancels superseded calls, and drops stale answers under the editor-provider budget. Ranges use 0-based UTF-16 positions.

The provider declaration supplies the document; host imports retain their usual capability checks. Provider results coexist with manually published diagnostics and are cleared with the document, project or plugin. Native tests can call MockHost::refresh_diagnostics and inspect MockHost::provider_diagnostics.

See the diagnostics contract and limits and the real Wasm fixture.

API 1.3 also adds open-log-tab to the web bridge: a generic read-only editor tab streams output from a granted process, with plugin-defined argument toggles. It uses the same backend authorization and bounded PTY transport. See the protocol and lifecycle and the built fixture.