Skip to content

refactor(runtime-ports): type plugin runtime contracts#1455

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/plugin-runtime-contract-guards
Jul 7, 2026
Merged

refactor(runtime-ports): type plugin runtime contracts#1455
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/plugin-runtime-contract-guards

Conversation

@limityan

@limityan limityan commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Move Plugin Runtime contracts into a dedicated runtime-ports plugin module while keeping an explicit root export surface.
  • Replace the old raw JSON/accepted envelope shape with typed dispatch/read/response contracts for source, manifest, config validation, status snapshots, capability, payload refs, permission gates, diagnostics, quarantine, recovery actions, lifecycle events, and observed epochs.
  • Add core-boundary guards for plugin public API budgeting, wildcard export prevention, raw JSON ABI regressions, old accepted-bool responses, invalid permission materialization states, and product-full leakage.

Scope

This is a contract and boundary-guard PR. It does not enable an executable Plugin Runtime Host or claim completion of the P0 OpenCode-compatible Desktop command/settings + CLI diagnostics loop. Product assembly and agent runtime still reject executable plugin host bindings until the host implementation lands.

Review notes

Independent adversarial subagent review was run from backend architecture and product/plugin-ecosystem perspectives after rebasing onto gcwing/main (44b3f5138). Findings were fixed in this PR update:

  • Added a minimal read_plugins contract so discovery/status/config-validation projection is not only reachable through dispatch responses.
  • Removed unaudited NotRequired permission state and the free PluginMaterializeCondition flag; effect materialization is now derived from an auditable PluginPermissionGate.
  • Changed recovery execution requests to carry action_id, quarantine/scope, requester, authorization, epochs, and idempotency facts instead of letting callers resubmit a mutable action descriptor.
  • Narrowed prompt effect kinds to the typed payload set, added product-facing deny states, expanded quarantine scope granularity, and marked extensible public enums #[non_exhaustive].
  • Upgraded public API budget rules from a flat symbol list to owner/consumer/P0/rationale/exit metadata, and expanded the checker to cover top-level pub mod/pub fn/pub const/pub static plus all plugin re-export forms.

Remaining non-blocking follow-up: future host/CLI implementation should validate status/availability consistency and enforce owner-mediated recovery authorization at execution time.

Validation

Passed:

  • cargo test -p bitfun-runtime-ports
  • cargo test -p bitfun-product-capabilities --test product_capabilities
  • cargo test -p bitfun-agent-runtime builder_rejects_plugin_runtime_client_until_host_boundary_exists
  • cargo check -p bitfun-runtime-ports
  • cargo check -p bitfun-product-capabilities
  • cargo check -p bitfun-agent-runtime
  • node --test scripts/check-core-boundaries.test.mjs
  • node scripts/check-core-boundaries.mjs
  • pnpm run check:repo-hygiene
  • git diff --check gcwing/main...HEAD

Attempted but blocked outside this PR:

  • cargo check --workspace fails in third-party oxc_transformer 0.138.0 because its source uses experimental if let guards under the current local rustc 1.94.1 toolchain.

@limityan
limityan force-pushed the yanzhn/plugin-runtime-contract-guards branch from f57f3da to d32645b Compare July 7, 2026 09:14
@limityan
limityan marked this pull request as ready for review July 7, 2026 09:18
@limityan
limityan force-pushed the yanzhn/plugin-runtime-contract-guards branch from d32645b to d3b8031 Compare July 7, 2026 09:22
@limityan
limityan merged commit a240dbe into GCWing:main Jul 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant