sim_lib_surface_card/descriptor.rs
1//! Codec-neutral surface-descriptor spine.
2
3use sim_kernel::{Symbol, Value};
4
5use crate::name::{ExternalNamePolicy, external_name};
6
7/// Plain-data spine describing a surface (a callable projected onto a foreign
8/// tool surface). Depends only on kernel types; concrete codecs render it.
9#[derive(Debug, Clone)]
10pub struct SurfaceDescriptor {
11 /// Stable surface id (for example a skill id).
12 pub id: String,
13 /// Kernel symbol that names the underlying callable.
14 pub symbol: Symbol,
15 /// Human-facing title.
16 pub title: String,
17 /// Human-facing description.
18 pub description: String,
19 /// Shape describing accepted input.
20 pub input_shape: Value,
21 /// Shape describing produced output, when known.
22 pub output_shape: Option<Value>,
23 /// Roles this surface is published under.
24 pub roles: Vec<Symbol>,
25 /// Capabilities the surface requires.
26 pub capabilities: Vec<Symbol>,
27 /// Free-form `(key, value)` annotations.
28 pub annotations: Vec<(String, String)>,
29}
30
31impl SurfaceDescriptor {
32 /// Project this surface's symbol onto an external name under `policy`.
33 pub fn external_name(&self, policy: ExternalNamePolicy) -> String {
34 external_name(&self.symbol, policy)
35 }
36}