Skip to content

docs: add cpex Rust specification#50

Merged
araujof merged 1 commit into
devfrom
feat/cpex_rust_spec
May 11, 2026
Merged

docs: add cpex Rust specification#50
araujof merged 1 commit into
devfrom
feat/cpex_rust_spec

Conversation

@terylt

@terylt terylt commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the public API spec for CPEX's Rust core (cpex-core + cpex-sdk). Companion document to
cpex-go-spec.md, but covering the in-process Rust path: how to author a plugin, how to embed
the manager, and what the framework guarantees.

Audience

  • Plugin authors writing plugins that compile into the same binary as the host.
  • Embedders integrating PluginManager into a Rust application.

(Go integrators should keep using cpex-go-spec.md — that doc covers the C ABI surface, this one covers the typed
Rust API one layer below it.)

What's covered

  • Architecture & lifecycle — how PluginManager, the registry, and the executor fit together.
  • Plugin authoring — the Plugin, HookHandler<H>, HookTypeDef, and PluginPayload traits, with the borrow /
    clone / capability semantics spelled out.
  • Quick reference — one-line cheatsheet for the most common API calls.
  • Extensions, CMF payloads, YAML config, factories — sections 7-10 walk through each subsystem.
  • Sample plugin (§11) — end-to-end worked example, from payload to factory to YAML to invoke.
  • State, errors, threading, testing, build — sections 12-16, the operational stuff.
  • Dynamic plugin loading (§17, design note) — architectural sketch for how out-of-process plugins (C ABI,
    hypothetical Rust cdylib) work without changing the typed plugin-author API. Marked clearly as design-only where
    things aren't shipped yet.
  • Gaps (§18) — features present in the Python framework that the Rust core doesn't cover yet.

What this is not

  • Not a tutorial — it assumes Rust fluency and familiarity with CPEX as a concept.
  • Not a runtime/internals doc — only the public API. Internal modules (executor, routing cache, etc.) are referenced
    but not specified.
  • Not an FFI/C ABI reference — that's cpex-go-spec.md.

Review focus

  • Does §6 (Plugin Authoring) give you enough to write a plugin without reading source?
  • Does §11 (Sample Plugin) match what you'd actually write today?
  • Does §17 (Dynamic Loading) describe an architecture you're comfortable committing to, given that the Rust-cdylib
    path is design-only?
  • Anything missing that you'd expect a plugin author or embedder to ask?

Test plan

  • Renders cleanly in markdown preview
  • All cross-section references (§N) resolve
  • Code samples match current crates/cpex-core symbols (spot-check register_handler, HookTypeDef,
    define_hook!, PluginResult constructors)

@terylt terylt changed the base branch from main to dev May 7, 2026 22:35
@terylt terylt marked this pull request as ready for review May 7, 2026 22:37
@terylt terylt requested review from araujof and jonpspri as code owners May 7, 2026 22:37
@araujof araujof changed the title Feat/cpex rust spec docs: add cpex Rust specification May 8, 2026
@araujof araujof self-assigned this May 8, 2026
@araujof araujof added the documentation Improvements or additions to documentation label May 8, 2026
@araujof araujof added this to CPEX May 8, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in CPEX May 8, 2026
@araujof araujof moved this from Backlog to In review in CPEX May 8, 2026
@araujof araujof added this to the 0.2.0 milestone May 8, 2026
@araujof araujof linked an issue May 8, 2026 that may be closed by this pull request

@araujof araujof left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@araujof araujof merged commit 7bf30ca into dev May 11, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in CPEX May 11, 2026
@araujof araujof deleted the feat/cpex_rust_spec branch May 11, 2026 15:23
monshri pushed a commit to monshri/contextforge-plugins-framework that referenced this pull request May 27, 2026
Co-authored-by: Teryl Taylor <terylt@ibm.com>
araujof pushed a commit that referenced this pull request Jun 10, 2026
Co-authored-by: Teryl Taylor <terylt@ibm.com>
araujof added a commit that referenced this pull request Jun 10, 2026
* feat: initial Rust Core (cpex-core and cpex-sdk) (#13)

* feat: initial revision rust core.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fix: addressed comments in PR. Updated PluginContext to match spec.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

---------

Signed-off-by: Teryl Taylor <terylt@ibm.com>
Co-authored-by: Teryl Taylor <terylt@ibm.com>

* feat: CPEX Rust config (#38)

* feat: added yaml and routing rule support.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added example code to show how to load manager and plugins.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fixes: updated plugin errors, configs to more match python.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

---------

Signed-off-by: Teryl Taylor <terylt@ibm.com>
Co-authored-by: Teryl Taylor <terylt@ibm.com>

* feat:  RUST with CMF and extensions. (#44)

* feat: initial revision rust core.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fix: addressed comments in PR. Updated PluginContext to match spec.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added yaml and routing rule support.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added example code to show how to load manager and plugins.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fixes: updated plugin errors, configs to more match python.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: RUST CMF initial revision.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added invoke named support, added constants, fixed reviewed code.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added owned extensions and did some refactoring.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

---------

Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Co-authored-by: Teryl Taylor <terylt@ibm.com>
Co-authored-by: Frederico Araujo <frederico.araujo@ibm.com>

* feat: cgo Go bindings (#45)

* feat: initial revision rust core.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fix: addressed comments in PR. Updated PluginContext to match spec.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added yaml and routing rule support.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added example code to show how to load manager and plugins.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fixes: updated plugin errors, configs to more match python.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: RUST CMF initial revision.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added invoke named support, added constants, fixed reviewed code.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added owned extensions and did some refactoring.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added cgo and golang bindings, examples and readme.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* address P0/P1/P2 review findings (except #17)

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fix: address remaining P2/P3 review findings + testing gaps

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* docs: add CPEX Go public API spec

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* docs: renamed document

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* feat(cpex-rust): CGO review passes 1-11 + lint cleanup + Makefile targets

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fix: address linting issues, updated makefile to support building examples.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* docs: updated the go spec to reflect recent changes.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

---------

Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Co-authored-by: Teryl Taylor <terylt@ibm.com>
Co-authored-by: Frederico Araujo <frederico.araujo@ibm.com>

* docs: intial rust specification (#50)

Co-authored-by: Teryl Taylor <terylt@ibm.com>

* feat: change Plugin handler to async for performance (#49)

Co-authored-by: Teryl Taylor <terylt@ibm.com>

* fix: missing cmf-demo main.go file and gitignore fix that missed it (#52)

Co-authored-by: Teryl Taylor <terylt@ibm.com>

* feat: initial APL Rust implementation (#60)

* fix: initial revision APL.

* feat: apl-cpex bridge crate + plugin-registry-driven hook dispatch

* feat: add support for plugin calling in APL routes.

* feat: add more APL plugin support, unified config

* feat: added cedar direct PDP.

* feat: add identity hook and extensions.

* feat: added token delegation hooks and tests.

* feat: added plugin for jwt token identity, oauth and biscuit delegation, cedarling PDP.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* fix: updated identity and delegation to support keycloak. added delegate() function, and identity sections.

* fix: added some sample plugins, added updates to support cedar.

Signed-off-by: Teryl Taylor <terylt@ibm.com>

* feat: added session support, serialize and parallel and full effects capabilities.

* feat: add ffi pre-built .a library

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* chore: add workflow_dispatch target

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* fix: critical and high issues from review.

* feat: add APL FFI and go bindings

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* chore: add musl tools to musl runners

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* fix: potential double free after use bug.

* chore: update Go module paths after repo rename to cpex

* feat: map identity extension into cpex ffi

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* feat: add cpex_invoke_resolved abi

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* fix: has_hook_for handling

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* chore: update headers

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

---------

Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Co-authored-by: Frederico Araujo <frederico.araujo@ibm.com>

* fix: session binding

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* chore: updated comments

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

* tests: added more session tests for Tier 1 ids.

---------

Signed-off-by: Teryl Taylor <terylt@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Co-authored-by: terylt <30874627+terylt@users.noreply.github.com>
Co-authored-by: Teryl Taylor <terylt@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation framework Rust

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[EPIC]: CPEX Rust Core and multi-language plugin runtime

2 participants