PCP · pcp
PCP Core — Capability Protocol Foundation
Core types, traits, and error definitions for the Portal Capability Protocol (PCP). Defines PcpServer trait, CapabilityManifest, Element model, and cross-cutting services (audit, permission, signing, rate limiting).
Architecture
Overview
pcp-core is the foundation of the Portal Capability Protocol — the typed protocol that allows Portal-native applications (Tier 1) and external apps via AT-SPI2 (Tier 2) to expose their capabilities to the Portal desktop. The crate defines the PcpServer trait (6 async methods: manifest, invoke, validate_params, subscribe_events, query_dynamic_state, shutdown), the capability model (CapabilityManifest, Capability, CapabilityCategory, AuthLevel, SideEffect), the UI element model (Element with AtspiRole, AtspiState, TableInfo, ValueInfo, TextSelection), and the surface model (Surface, Geometry, WorkspaceId). It also includes cross-cutting concerns: audit logging, permission engine, Ed25519 manifest signing, rate limiting, session management, and i18n string catalogs.
Key Types
Modules
traits
PcpServer trait — the 6-method server contract every Tier 1 app implements.
manifest
Capability manifest types — CapabilityManifest, Capability, CapabilityCategory, AuthLevel, SideEffect, ManifestError.
element
UI element model — Element with role, state, relationships, table info, value info, text selection.
surface
Surface model — Surface with geometry, type, state, output and workspace associations.
detection
App detection — how Portal discovers and registers apps (Tier 1 via .desktop files, Tier 2 via AT-SPI2).
event
Event types — PcpPushEvent, EventDomain, SubscriptionId, OverflowStrategy for the push event bus.
permission
Permission engine — checks auth levels and user confirmations for capability invocations.
audit
Audit logging — records all capability invocations for security analysis.
signing
Ed25519 manifest signing — load_or_create_key, sign_manifest, verify_manifest.
rate_limit
Rate limiting — per-app, per-capability invocation rate limits.
session
Session management — client sessions for stateful capability interactions.
learning
Learning state types — CapabilityUsageRecord, ConfirmationBehavior, AdapterEffectivenessScore.
recovery
Recovery types — CrashRecoveryManager, TransactionRecord, RecoveryPhase, DataDurability.
Data Flow
App implements PcpServer → registers with pcpd via .desktop X-Portal-PCP-Manifest → pcpd verifies Ed25519 signature → capabilities become available → Portal invokes via IPC
Dependencies
External (17)
Foundation crate — all other PCP crates depend on this. External: serde, async-trait, thiserror, ed25519-dalek.