# K1 External Subsystem Enabler
`K1Ese` is the synchronous/long-poll facade for the single KTO subsystem `k1-ese-subsystem`. It multiplexes exact `(Authority, external subsystem name)` streams while registering only once with transaction ordering.
## Public API
```rust
pub use kcode_k1_ese_driver_state::SubmitOutcome;
pub use kcode_k1_ese_format::{Authority, ExternalSubsystem, GroupId, TxId, UserId};
pub use kcode_k1_ese_store::ExternalUpdate;
pub enum EseErrorKind { Unavailable, InvalidProgress, OperationConflict, DependencyUnavailable }
pub struct EseError;
impl EseError {
pub const fn kind(&self) -> EseErrorKind;
pub fn message(&self) -> &str;
}
pub struct K1Ese;
impl K1Ese {
pub fn open(root: &Path, ordering: Arc<K1TxnOrdering>, peering: Arc<K1Peering>, groups: Arc<K1Groups>) -> Result<Self, String>;
pub fn register(&self, actor: UserId, stream: ExternalSubsystem) -> Result<(), EseError>;
pub fn submit(&self, actor: UserId, stream: ExternalSubsystem, operation_id: [u8; 32], payload: &[u8]) -> Result<SubmitOutcome, EseError>;
pub fn history(&self, actor: UserId, stream: &ExternalSubsystem, after: Option<TxId>) -> Result<Vec<ExternalUpdate>, EseError>;
pub async fn subscribe(&self, actor: UserId, stream: ExternalSubsystem, after: Option<TxId>) -> Result<Vec<ExternalUpdate>, EseError>;
}
```
A user authority requires the exact authenticated user. A group authority requires current `K1Groups::groups_for_user` membership. Authorization is checked on every operation and again after every subscription wake. Unknown and unauthorized streams share `Unavailable`.
Register is idempotent. Submit requires a 32-byte caller operation ID. A completed equal retry returns its original progress with `duplicate = true`; a differing payload conflicts. Concurrent equal submissions share one commit. Exact callback materialization wins over a Peering error identifying a committed transaction; successful submission without callback evidence faults the service.
History is complete, ordered, and isolated by exact stream. `None` starts at genesis; another cursor must identify an update in that stream. Subscribe first checks an already-available tail, otherwise waits without a package timeout, reauthorizes after notification, and returns the complete new tail. Notifications carry no payload and cannot lose the history race.
The derived store is opened at the supplied root and is rebuilt by KTO replay strictly after its checkpoint. Callback durability precedes notification. A reorganization discards only that append-only projection, faults the process-lifetime service, wakes waiters, and requires a fresh process open. There is no SQLite, AccessId, filter, paging, cap, compaction, deletion, accounting, retry, timeout, network listener, or background task.
Local work is linear in supplied name/payload/history bytes. The callback lane serializes canonical ESE updates; independent stream files and notification channels avoid a global data lock. No ESE lock spans Groups work, Peering submission, KTO callbacks, or asynchronous waiting. Opening longer than 100 ms emits one secret-free timing warning.