apl_cpex/lib.rs
1// Location: ./crates/apl-cpex/src/lib.rs
2// Copyright 2025
3// SPDX-License-Identifier: Apache-2.0
4// Authors: Teryl Taylor
5//
6// apl-cpex — bridge between APL evaluator (`apl-core`) and CPEX runtime
7// (`cpex-core`).
8//
9// `apl-core::PluginInvoker` is string-typed by design (so `apl-core`
10// stays free of CPEX deps). The actual typed boundary lives in this
11// crate: one `PluginInvoker` implementation per `HookTypeDef`. The
12// payload type is locked at the impl level — e.g. [`CmfPluginInvoker`]
13// can only dispatch to CMF hooks because every internal call goes
14// through `invoke_named::<CmfHook>`, and the compiler enforces that
15// the payload is `MessagePayload`.
16//
17// # v0 simplification — single-view-per-Message
18//
19// CMF spec §4.2 distinguishes two messaging patterns:
20// - LLM wire format — bundled multi-part Messages (thinking + text +
21// tool_call(s)) — many MessageViews per Message.
22// - Framework/protocol format (MCP, A2A, LangGraph) — single
23// ContentPart per Message — one view per Message.
24//
25// v0 only handles request-side flows (outbound LLM call from the user,
26// outbound MCP tools/call from the agent). Both are single-part, so the
27// route → MessageView matching collapses to "one route fires per
28// Message." When response-side handling lands, this assumption breaks
29// and apl-core's route-matching layer needs to switch from
30// routes-as-map to routes-as-list with a `match:` block filtering on
31// MessageView attributes. See the APL implementation memory's
32// "list-with-matchers" deferred item.
33
34pub mod cmf_invoker;
35pub mod delegation_invoker;
36pub mod dispatch_plan;
37pub mod elicitation_invoker;
38pub mod parallel_safety;
39pub mod pdp_router;
40pub mod register;
41pub mod route_handler;
42pub mod session_resolver;
43pub mod session_store;
44pub mod visitor;
45
46pub use cmf_invoker::CmfPluginInvoker;
47pub use delegation_invoker::DelegationPluginInvoker;
48pub use dispatch_plan::{DispatchCache, RouteDispatchPlan, RoutePluginEntry};
49pub use elicitation_invoker::ElicitationPluginInvoker;
50pub use pdp_router::PdpRouter;
51pub use register::{register_apl, AplOptions};
52pub use route_handler::{
53 AplRouteHandler, Phase, ELICITATION_APPROVED_CODE, ELICITATION_ID_HEADER,
54 ELICITATION_PEEK_HEADER, ELICITATION_PENDING_CODE,
55};
56pub use session_store::{MemorySessionStore, SessionStore, SessionStoreError, SessionStoreFactory};
57pub use visitor::AplConfigVisitor;