refactor: extract neutral host contract and decouple plugin ABI (issue #13)
Implements the core M0-M3 boundary work from issue #13 / ADR-0071 without changing language semantics or any public protocol: - add marqdo-host-contract owning Host/HostOp/ExecutionContext/ResourceRead and the runtime observation facts; the engine depends on it only. - marqdo-runtime no longer links marqdo-host; the native host implements the contract and has no reverse edge to runtime/frontend/IR. - reduce marqdo-plugin-abi to the public C ABI/wire/error contract; move manifest/artifact/loader/worker execution into marqdo-host::plugin so the SDK carries no loader/worker/host dependency. - add a real independent consumer (tests/embedding, own workspace+lock) that runs Markdown -> frontend -> IR -> runtime with bounded budgets and explicit effect refusal, plus differential CLI comparison. - add an SDK-only third-party plugin fixture and real CLI invocation gate. - replace the frozen-crate architecture test with a reviewed responsibility graph enforced from Cargo metadata, with negative unit cases. - consolidate current docs/entry: ADR-0071, CURRENT responsibility map, developers/architecture indexes, historical banners, STATUS and evidence. - record keep-in-workspace for Engine/Native Host; no empty candidate repo. Evidence: docs/evidence/2026-11-26-issue-13-engine-host-boundary.md Refs #13
This commit is contained in:
1 parent
4bbefc9244
commit
9b4f0a0822
89 files changed
+3490
-545
No files matched your search
@@ -9,6 +9,51 @@ replace `spec/` or a recorded test log.
|
||||
- This is the **single current overview**. Do not add a second running "current state" file;
|
||||
update this file, `docs/STATUS.md` and an evidence file together.
|
||||
|
||||
## Engine / Host Contract / Native Host boundary (issue #13, ADR-0071)
|
||||
|
||||
The language engine is independent of every concrete native platform
|
||||
implementation. `marqdo-host-contract` owns the only side-effect interface the
|
||||
runtime knows (`Host`, `HostOp`, `ExecutionContext`, `ResourceRead` and the
|
||||
runtime observation facts); `marqdo-host` implements it with capabilities,
|
||||
resources, OS adapters and trusted extension execution; `crates/cli` remains the
|
||||
single product assembly. The plugin ABI crate is a public contract only: native
|
||||
loading, artifact/manifest execution and worker processes live in
|
||||
`marqdo-host::plugin`. The SDK depends on the contract, not on a loader or a
|
||||
host.
|
||||
|
||||
The Engine and the Native Host stay in **this workspace**. Issue #13 §9.2
|
||||
admission for a separate repository is not met yet: there is no real external
|
||||
Engine consumer outside the in-repo acceptance fixture, and no independent
|
||||
platform maintainer. A candidate empty `marqdo-engine`/`marqdo-host` repository
|
||||
would violate the issue's boundary conditions. The decision and its reopening
|
||||
conditions are recorded in [ADR-0071](../adr/0071-engine-host-contract-boundary.md).
|
||||
|
||||
## Workspace crate responsibility map
|
||||
|
||||
This is the reviewed allowlist for workspace members. A new crate must be added
|
||||
here, in `tools/ci/check_dependency_boundaries.py`, and with its dependency edges
|
||||
in the same change.
|
||||
|
||||
| Crate | Layer | Responsibility |
|
||||
|---|---|---|
|
||||
| `marqdo-span` | Engine | UTF-8 position and diagnostic base types |
|
||||
| `marqdo-value` | Engine | `Value`, `RuntimeError`, the one Value Wire encoding |
|
||||
| `marqdo-expression` | Engine | Expression grammar |
|
||||
| `marqdo-markdown` | Engine | The only Markdown profile and AST |
|
||||
| `marqdo-ir` | Engine | IR, function/binding identity, builtin inventory |
|
||||
| `marqdo-frontend` | Engine | Document mapping, signatures, static binding |
|
||||
| `marqdo-runtime` | Engine | Evaluator, control flow and `Memory` |
|
||||
| `marqdo-host-contract` | Engine boundary | Neutral `Host` trait and runtime observation facts |
|
||||
| `marqdo-host` | Native Host | Capabilities, resources, OS adapters, plugin loader and trusted execution |
|
||||
| `marqdo-sandbox` | Native Host support | OS isolation probe and strict launch |
|
||||
| `marqdo-foreign` | Native Host support | Controlled one-shot foreign kernels (F-A) |
|
||||
| `marqdo-plugin-abi` | Public contract | C ABI v1 layout, wire envelope and protocol errors |
|
||||
| `marqdo-plugin-sdk` | Public contract consumer | Third-party plugin development helpers |
|
||||
| `marqdo-worker-ipc` | Shared plumbing | One bounded worker frame transport |
|
||||
| `marqdo-provider-worker` | Shipped worker | Provider helper process |
|
||||
| `marqdo-package` | Product support | Project manifest, lock and dependency resolution |
|
||||
| `marqdo-cli` | Composition root | Arguments, prepare, commands, product projection |
|
||||
|
||||
> **Language contract and implementation.** The language contract is
|
||||
> [RFC-LANG-0002](RFC-LANG-0002-unified-semantics.md) (adopted by ADR-0052) and
|
||||
> `spec/mapping.md`. The frontend, `marqdo-expression`, IR lowering, runtime and
|
||||
@@ -156,11 +201,14 @@ Layer rules:
|
||||
Current Rust dependency edges (documented, not proposed):
|
||||
|
||||
```text
|
||||
marqdo-cli -> marqdo-runtime -> marqdo-host
|
||||
marqdo-cli -> marqdo-package, marqdo-sandbox, marqdo-frontend, ...
|
||||
marqdo-cli -> marqdo-runtime -> marqdo-host-contract
|
||||
marqdo-cli -> marqdo-host, marqdo-package, marqdo-sandbox, marqdo-frontend, ...
|
||||
marqdo-runtime -> marqdo-ir, marqdo-expression, marqdo-value
|
||||
marqdo-host -> marqdo-plugin-abi, marqdo-foreign, marqdo-sandbox, marqdo-worker-ipc
|
||||
marqdo-plugin-abi -> marqdo-worker-ipc
|
||||
marqdo-host-contract -> marqdo-value, marqdo-span
|
||||
marqdo-host -> marqdo-host-contract, marqdo-plugin-abi, marqdo-foreign,
|
||||
marqdo-sandbox, marqdo-worker-ipc
|
||||
marqdo-plugin-abi -> marqdo-value, serde/serde_json (contract only)
|
||||
marqdo-plugin-sdk -> marqdo-plugin-abi (contract only)
|
||||
marqdo-provider-worker -> marqdo-worker-ipc
|
||||
```
|
||||
|
||||
@@ -170,10 +218,13 @@ copy of bounded worker framing, deadlines and process teardown
|
||||
host, the plugin ABI, or a worker binary; sharing plumbing must not share
|
||||
capabilities. Foreign kernels and CLI Tools stay outside it.
|
||||
|
||||
`marqdo-runtime -> marqdo-host` is the current direction. Do not add a second
|
||||
execution backend or a `marqdo-stdlib` crate by implication. A future embedded
|
||||
runtime or a second backend needs the thin `ExecutionPort` contract described in the
|
||||
review RFC, not a new crate per provider.
|
||||
`marqdo-runtime -> marqdo-host-contract` is the only engine-to-host edge. The
|
||||
engine must never link `marqdo-host`, sandbox, foreign, plugin loading or the
|
||||
CLI in normal/build dependencies. The native host must not depend back on the
|
||||
runtime/frontend/IR. `tools/ci/check_dependency_boundaries.py` enforces the
|
||||
transitive graph from Cargo metadata; `tests/embedding` proves a real
|
||||
platform-neutral consumer. Do not add a second execution backend, a per-provider
|
||||
crate, or a `marqdo-stdlib` crate by implication.
|
||||
|
||||
| Public contract | API (`.mq.md`) | State | Tests |
|
||||
|---|---|---|---|
|
||||
@@ -268,7 +319,23 @@ that a phase is complete.
|
||||
current contract, replace in place, reject retired inputs, no compatibility
|
||||
path or version negotiation, and no version bump without a shape change.
|
||||
|
||||
## 7. References
|
||||
## 7. Repository decision and split admission
|
||||
|
||||
| Component | Decision for this round | Reopen condition (issue #13 §9.2) |
|
||||
|---|---|---|
|
||||
| Engine (`span`/`value`/`expression`/`markdown`/`ir`/`frontend`/`runtime`/`host-contract`) | **Keep in this workspace** as one atomic semantic-change domain | A real, non-in-repo consumer needs independent build/release, and the semantic change cost is acceptable |
|
||||
| Native Host (`host`/`sandbox`/`foreign`/plugin loader) | **Keep in this workspace**, dependent on the neutral contract | An independent platform maintainer or second product consumes it; security/conformance can be verified separately |
|
||||
| `marqdo-plugin-sdk` | Contract decoupled; physical move to an independent repository is a follow-up after the §6.3 external build and pinned-artifact mechanism | A clean-directory build against a fixed contract revision without the CLI checkout passes (S07/S08) |
|
||||
| Stdlib | Separate issue #11/#12 (Phase A build input); runtime contract unchanged | Ecosystem-assembled Bundle and extension replacement accepted; then retire the in-repo source authority |
|
||||
| Regex/compression domain services | **DEFERRED** under ADR-0062 ownership; no new domain operation may be added | A separately installable extension replaces the host-held service and the old entries are removed atomically |
|
||||
| Foreign F-A | Retained; no F-B, session or new transport in this change | Separate ADR and milestone |
|
||||
|
||||
No candidate empty `marqdo-engine`, `marqdo-host` or `marqdo-cli-*` repository
|
||||
is created by this decision. Git repository boundaries are ownership and release
|
||||
boundaries, not a mechanical projection of Cargo crates. The engine and native
|
||||
host are one source tree until the reopening evidence above exists.
|
||||
|
||||
## 8. References
|
||||
|
||||
- [Architecture index](README.md) — RFC/ADR/evidence history.
|
||||
- [Protocol convergence policy](PROTOCOL_CONVERGENCE_POLICY.md) — one-contract rules, anti-patterns and review checklist.
|
||||
@@ -288,7 +355,9 @@ that a phase is complete.
|
||||
- [ADR-0050: host regex extension](../adr/0050-host-regex-extension.md) — accepted project-mode groups/alternation/captures.
|
||||
- [ADR-0052: byte-exact HTTP framing](../adr/0051-byte-exact-http-framing.md) — accepted byte-list HTTP/1.1 parser/builder.
|
||||
- [Compute-machine RFC-0001](../MARQDO_COMPUTE_MACHINE_RFC_0001.md) and [core/stdlib RFC-0002](../MARQDO_COMPUTE_CORE_STDLIB_MIGRATION_RFC_0002.md) — design input.
|
||||
- [Architecture audit and refactor RFC](Marqdo_CLI_Latest_Architecture_Audit_and_Refactor_RFC.md) — review input for this migration.
|
||||
- [Architecture audit and refactor RFC](Marqdo_CLI_Latest_Architecture_Audit_and_Refactor_RFC.md) — historical review input; the current boundary decision is ADR-0071.
|
||||
- [ADR-0071: Engine / Host Contract / Native Host boundaries](../adr/0071-engine-host-contract-boundary.md) — accepted responsibility split and keep-in-workspace decision for issue #13.
|
||||
- [Issue #13 engine/host evidence](../evidence/2026-11-26-issue-13-engine-host-boundary.md) — executed candidate commands and results.
|
||||
- [RFC-EXT-0001](RFC-EXT-0001.md) — extensibility closure task specification (implementation status tracked here and in STATUS).
|
||||
- [ADR-0054: single callable binding](../adr/0054-callable-binding-single-source.md) — one registry/binding pass, runtime dispatch by identity.
|
||||
- [ADR-0055: resource provider CLI v2](../adr/0055-resource-provider-cli-v2.md) — provider v2 manifest/worker CLI closure and trust boundary.
|
||||
|
||||
Reference in new issue
Block a user