1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Surface: kernel-connected control interface.
//!
//! A Surface is a component that has direct access to the kernel
//! for management, monitoring, and configuration operations.
//! Unlike channels (which only pass messages through the gateway),
//! surfaces can read system state, modify configuration, manage agents,
//! and expose rich control-plane APIs.
//!
//! The web dashboard is the primary surface. Future surfaces could
//! include desktop apps, IDE plugins, or mobile control apps.
//!
//! # Why a separate trait?
//!
//! Channels implement [`ChannelPlugin`](crate::plugin::ChannelPlugin)
//! and receive only configuration — they are pure message relays.
//! Surfaces receive [`Arc<KernelHandle>`] because they need to inspect
//! and control the kernel directly.
//!
//! ```text
//! Channel (CLI, Telegram):
//! user ↔ message ↔ gateway ↔ orchestrator
//!
//! Surface (Web, Desktop):
//! user ↔ HTTP/UI ↔ KernelHandle (control plane)
//! user ↔ message ↔ gateway (chat via optional channel)
//! ```
use Result;
use async_trait;
use PathBuf;
use Arc;
use JoinHandle;
use crateChannel;
/// Context provided to surfaces during initialization.
/// Handle returned by a surface after initialization.
/// A kernel-connected control surface.
///
/// Implementors receive direct access to the kernel handle
/// for management and monitoring operations. They may optionally
/// also register a channel with the gateway for message routing.