par_term_config/scripting.rs
1//! Configuration types for external observer scripts.
2
3use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5
6use crate::automation::RestartPolicy;
7
8/// Configuration for an external observer script that receives terminal events via JSON protocol.
9#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
10pub struct ScriptConfig {
11 /// Human-readable name for this script
12 pub name: String,
13
14 /// Whether this script is enabled (default: true)
15 #[serde(default = "crate::defaults::bool_true")]
16 pub enabled: bool,
17
18 /// Path to the script executable
19 pub script_path: String,
20
21 /// Arguments to pass to the script
22 #[serde(default)]
23 pub args: Vec<String>,
24
25 /// Whether to start this script automatically when a tab opens
26 #[serde(default)]
27 pub auto_start: bool,
28
29 /// Policy for restarting the script when it exits
30 #[serde(default)]
31 pub restart_policy: RestartPolicy,
32
33 /// Delay in milliseconds before restarting (when restart_policy is not Never)
34 #[serde(default)]
35 pub restart_delay_ms: u64,
36
37 /// Event types to subscribe to (empty = all events)
38 #[serde(default)]
39 pub subscriptions: Vec<String>,
40
41 /// Additional environment variables to set for the script process
42 #[serde(default)]
43 pub env_vars: HashMap<String, String>,
44}