Files
cflmy b31187a757 sdk: standalone marqdo-plugin-sdk workspace
Independent SDK consumer of the Marqdo plugin ABI v1:
- public contract pinned to CLI commit 2585915e16906dac75f8571bed02e7f6f868c6bc;
- no CLI checkout, native host, loader or worker dependency;
- third-party fixture built only with this SDK;
- frozen-CLI integration check (Int 42 + tampered digest rejection) against
  the released 3.0.0-rc.4 archive;
- AGENTS rules, README, license and Woodpecker CI.
2026-11-26 19:32:14 +08:00

67 lines
2.5 KiB
Markdown

# Marqdo Plugin SDK
Independent Rust SDK for the versioned Marqdo plugin ABI v1. It is the
plugin-developer side of the frozen C contract and contains no native loader,
host, worker process or CLI code.
This repository is its own Cargo workspace. The public contract is consumed
from exactly one pinned CLI commit (`Cargo.toml` → `marqdo-plugin-abi` git
`rev`); it never uses a relative `../cli` checkout and never duplicates the ABI
or Value Wire encodings.
## What it provides
- `mq_plugin_entry!` exporting the required `mq_plugin_entry_v1` symbol;
- safe wrappers over the C layout and buffer ownership rules;
- typed wire helpers (`decode_request`, `int_arg`, `text_arg`, `success`, ...)
that reuse the CLI's single Value Wire encoder through the contract;
- `PluginError`/result-code mapping from the public ABI contract.
The normative C header
[`include/marqdo_plugin_abi_v1.h`](https://git.cflmy.cn/cflmy/marqdo-cli/blob/master/include/marqdo_plugin_abi_v1.h)
and [`spec/plugin-abi.md`](https://git.cflmy.cn/cflmy/marqdo-cli/blob/master/spec/plugin-abi.md)
remain owned by the CLI repository. This SDK does not define a second protocol.
## Build
```bash
cargo build --locked
cargo test --locked
cargo clippy --all-targets -- -D warnings
```
## Cross-repository acceptance with a frozen CLI
The fixture in `tests/fixture` is a third-party plugin built with only this SDK
(no CLI sources, no native host). Build it and invoke it through a released CLI
binary:
```bash
# from a released archive (CLI + marqdo-provider-worker)
export MARQDO_BIN=/absolute/path/to/marqdo
python3 tools/check_with_frozen_cli.py --marqdo-bin "$MARQDO_BIN"
```
The script checks a real `Int 42` result and that a tampered artifact digest is
rejected. It never recompiles the CLI.
## Security
A C ABI is not a sandbox. Loading a native plugin requires an explicit trust
decision by the host; `--allow-plugin` is a separate grant. This SDK grants no
capability and does not claim isolation.
## Versioning
The SDK version tracks the contract generation, not the CLI product version.
Plugin ABI 1.0 layout, buffer ownership, limits and error codes are frozen; a
definitional change requires the CLI contract owner to publish a new ABI major
and a new SDK release.
## Related
- CLI contract producer: <https://git.cflmy.cn/cflmy/marqdo-cli>
- Architecture decision for this split:
`docs/adr/0072-sdk-independent-repository.md` in the CLI repository
- Tracking issue: <https://git.cflmy.cn/cflmy/marqdo-cli/issues/15>