remove ocs_doc_api crate and DocApi v2 host integration

- Drop crates/ocs_doc_api from workspace and host dependency.
- Remove src/app/doc_api.rs and its module declaration.
- Strip DocApi v2 undo/dispatch plumbing from HostSession.
- Remove HostApi::doc_api_dispatch default method.
- Remove PluginRequest::DocApiRequest / PluginResponse::DocApiResponse.
- Revert plugin API version from 6 back to 5.
This commit is contained in:
Sebastian committed 2026-09-11 08:07:30 +02:00
1 parent 7d0c059b30
commit fe8397b3cb
48 files changed
+4 -14869

No files matched your search

+1 -1
View File
@@ -908,7 +908,7 @@ fn generate_version_info(out_dir: &Path) {
"acadrust_version": acadrust.version.to_string(),
"acadrust_source": acadrust.source.as_ref().map(|s| s.to_string()),
"rustc_version": rustc_version,
"api_version": 6,
"api_version": 5,
"api_version_min_supported": 2,
"build_timestamp": build_timestamp,
});
-12
View File
@@ -552,18 +552,6 @@ pub trait HostApi {
let _ = tab_id;
None
}
/// DocApi v2 (`ocs_doc_api`): dispatch one bincode-serialized `DocApiEnvelope`
/// (one write op OR a read-only query batch) and return the bincode-serialized
/// `Result<Receipt, ApiError>`. Opaque bytes:
/// this crate does not depend on `ocs_doc_api`, it only routes the envelope.
///
/// Added for the DocApi v2 adapter. The default returns `Err` ("not supported");
/// the in-process host (`HostSession`) overrides it to call the DocApi executor.
fn doc_api_dispatch(&mut self, tab_id: u64, bytes: &[u8]) -> Result<Vec<u8>, String> {
let _ = (tab_id, bytes);
Err("DocApi v2 not supported by this host".to_string())
}
}
/// Simplified, read-only entity kind exposed by [`DocumentReader`].
-10
View File
@@ -138,12 +138,6 @@ pub enum PluginRequest {
GetTabId,
/// V5: ask the host for the filesystem path of the document in `tab_id`.
DocumentPath { tab_id: u64 },
/// DocApi v2 (`ocs_doc_api`): carry one bincode-serialized `DocApiEnvelope`
/// (one write op OR a read-only query batch). Appended at the end to keep
/// existing discriminants stable. The host routes this to the DocApi executor.
/// `serde_bytes` keeps the payload a single length-prefixed bulk copy (the
/// outer frame would otherwise walk it byte-by-byte).
DocApiRequest { tab_id: u64, #[serde(with = "serde_bytes")] bytes: Vec<u8> },
}
/// Responses the host sends back for `PluginRequest`.
@@ -170,10 +164,6 @@ pub enum PluginResponse {
TabId(u64),
/// V5: filesystem path of the document in the requested tab, if any.
DocumentPath(Option<std::ffi::OsString>),
/// DocApi v2 (`ocs_doc_api`): the bincode-serialized `Result<Receipt, ApiError>` answering a
/// `PluginRequest::DocApiRequest`. Appended at the end (discriminant stability).
/// `serde_bytes` keeps the payload a single length-prefixed bulk copy.
DocApiResponse { #[serde(with = "serde_bytes")] bytes: Vec<u8> },
}
/// Messages sent from the host to the plugin runner.
-4
View File
@@ -77,9 +77,5 @@ pub fn handle_plugin_request(
DocumentPath { tab_id } => PluginResponse::DocumentPath(
host.document_path(tab_id).map(|path| path.into_os_string()),
),
DocApiRequest { tab_id, bytes } => match host.doc_api_dispatch(tab_id, &bytes) {
Ok(bytes) => PluginResponse::DocApiResponse { bytes },
Err(msg) => PluginResponse::Error(msg),
},
}
}
+3 -9
View File
@@ -18,15 +18,9 @@
/// plugins and appends `document_reader` / `document_view` at the end of the
/// vtable so API v2 plugins keep working. v4 adds full-duplex notifications on
/// a multiplexed socket while leaving the V2/V3 ABI and protocol untouched. v5
/// adds the `BuiltinPlugin::on_load` lifecycle callback.
/// Host ABI major version. Bumped to 6 when the DocApi v2 surface
/// (`PluginRequest::DocApiRequest` / `PluginResponse::DocApiResponse` +
/// `HostApi::doc_api_dispatch`) was added: plugins that call DocApi require an
/// API-6 host and are rejected at handshake by older (API ≤ 5) hosts, instead of
/// failing at runtime with a bincode-decode transport error. The DocApi wire
/// changes are append-only and `doc_api_dispatch` is a defaulted method, so
/// older V2–V5 plugins still load unchanged on an API-6 host.
pub const API_VERSION: u32 = 6;
/// adds the `BuiltinPlugin::on_load` lifecycle callback and
/// `HostApi::document_path`.
pub const API_VERSION: u32 = 5;
/// Oldest plugin API major the current host still loads. This keeps previously
/// compiled cdylibs usable as long as their vtable layout is a prefix of the