warble_claude_code/emit/types.rs
1//! Public dispatch-time knobs: the render flavor and the hybrid-realization selector.
2//! Pure config enums with no dependencies; re-exported from the crate root via `emit`.
3
4/// Render flavor ([`ir-schema.md`][spec-ir] §v0.3 §4). `programmatic` (default): the agent stays
5/// read-only and emits a `{blocks}` envelope; a downstream renderer produces HTML deterministically.
6/// `prompt`: the plain-file fallback — the agent is granted scoped write and writes
7/// `dashboard.html` itself.
8///
9/// [spec-ir]: https://github.com/Canner/Warble/blob/v0.1.0/docs/spec/ir-schema.md
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum RenderFlavor {
12 Programmatic,
13 Prompt,
14}
15
16pub const DEFAULT_RENDER_FLAVOR: RenderFlavor = RenderFlavor::Programmatic;
17
18impl RenderFlavor {
19 pub fn as_str(&self) -> &'static str {
20 match self {
21 RenderFlavor::Programmatic => "programmatic",
22 RenderFlavor::Prompt => "prompt",
23 }
24 }
25
26 pub fn parse(value: &str) -> Option<RenderFlavor> {
27 match value {
28 "programmatic" => Some(RenderFlavor::Programmatic),
29 "prompt" => Some(RenderFlavor::Prompt),
30 _ => None,
31 }
32 }
33}
34
35/// How the file target realizes a hybrid binding's LOCAL step (`llm:per_step_provider`, see
36/// [`capability-model.md`][spec-cap] §7.2): `BashScript` emits a Bash-run local-inference script
37/// (needs `bash` in the allowlist); `McpServer` emits a `.mcp.json` registering `warble mcp-serve`
38/// so the driver calls a `local_infer` MCP tool (a separate permission gate — no `bash`
39/// widening). Default `BashScript`.
40///
41/// [spec-cap]: https://github.com/Canner/Warble/blob/v0.1.0/docs/spec/capability-model.md
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
43pub enum HybridRealization {
44 #[default]
45 BashScript,
46 McpServer,
47}
48
49impl HybridRealization {
50 pub fn parse(value: &str) -> Option<HybridRealization> {
51 match value {
52 "bash-script" => Some(HybridRealization::BashScript),
53 "mcp-server" => Some(HybridRealization::McpServer),
54 _ => None,
55 }
56 }
57}