Found while building an out-of-tree scripting plugin from scratch against
this doc and the actual ocs_plugin_api/host source. Two categories:
Fixed outright (docs/examples didn't match the real code):
- The worked CadModule example returned Vec<RibbonGroup> from
ribbon_groups(); the real trait requires &[RibbonGroup] - the example
wouldn't compile. Fixed with the OnceLock pattern the host's own
benchmark code already uses.
- Reconciled a contradiction between "process isolation removes the need
for a shared Rust ABI" and the exact-rustc_version requirement described
a few paragraphs earlier in the same doc.
- The roadmap's "Next" list still had external automation as unstarted;
--mcp/--serve are real and operational (src/cli.rs, src/mcp.rs).
- Added the missing plugin.toml to docs/plugin-template-v2 (its own
DESIGN.md already claimed one could be installed).
- Documented that plugin-template's CI floats rust-toolchain@stable, which
doesn't guarantee matching the host's exact rustc - added acadrust_source
to both templates' plugin.toml plus the release.yml step that fills it
from Cargo.lock's resolved acadrust source, alongside the existing
rustc_version fill.
Flagging for your call, not fixed here (found the behavior, not sure it's
the intended one, prefer to ask than guess at a fix):
- acadrust_compatible()'s ABI gate only runs at all if plugin.toml declares
acadrust_source - an undeclared field is silently treated as compatible,
unlike rustc_version (undeclared = incompatible). The same shortcut
appears in two places: ExternalPlugin::acadrust_compatible
(src/plugin/external.rs) and the inline check inside fetch_release_info
(src/plugin/marketplace.rs). If this is deliberate (e.g. back-compat with
manifests from before the field existed), no action needed beyond a
comment; if not, both call sites need the same fix.
- The command line still uppercases typed/pasted input even with the `>`
literal-spaces prefix (Message::CommandInput, src/app/update/mod.rs) -
`>` only stops a space from auto-submitting the line, it doesn't skip
`s.to_uppercase()`. A plugin command needing a case-sensitive typed
argument has no escape today short of automation.
- fetch_release_info (src/plugin/marketplace.rs) returns every release
under a linked repo with no filter on the manifest's own id field (which
it already parses to build ReleaseInfo) - a repo hosting more than one
plugin under tag-namespaced releases surfaces all of them mixed
together in one plugin's version list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Plugins could dispatch commands but not register interactive (click-to-
place) tools — the gap mf4633 flagged on #100 for Storm Sewer's SS_INLET
/ SS_PIPE. Add an InteractiveCommand trait + CommandStep to ocs_plugin_api
and HostApi::start_interactive; a host adapter bridges it to the internal
CadCommand, so a plugin tool drives the host's point-collection flow.
Hybrid by construction: the same command works by clicking in the viewport
AND by feeding coordinates over --serve (run "CMD x,y x,y"). Adding a
HostApi method changes the contract vtable, so API_VERSION bumps to 2 —
v1 plugin binaries are now refused at load.
Part of the #100 extensibility epic.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
OpenCADStudio ships no built-in plugins, so the spec and scaffold no
longer describe the in-tree inventory path, demo_plugin, or the fictional
Storm Sewer reference. The architecture doc now covers the external cdylib
model end to end (ocs_plugin_api contract, export_plugin!, building +
publishing per-platform releases, runtime loading, the marketplace +
curated registry, the approach-B ABI caveat). The template becomes a
standalone cdylib crate (Cargo.toml + src/lib.rs + release workflow)
instead of an in-tree module.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Plugins targeted the host's concrete HostSession type. Add a HostApi
trait in ocs_plugin_api behind an optional `host` feature (the only thing
that pulls acadrust, so the core crate stays dependency-free). HostSession
implements it and BuiltinPlugin::dispatch now takes `&mut dyn HostApi`, so
an out-of-tree add-on compiles against the contract crate alone. Per-tab
plugin state is reached through object-safe plugin_state* helpers.
Completes the phase-1 host-surface extraction in the #100 epic.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>