Skip to main content

mars_agents/build/
bundle.rs

1use std::collections::BTreeMap;
2
3use serde::Serialize;
4
5pub const SLOT_PLACEHOLDER: &str = "###SLOT###";
6
7#[derive(Debug, Clone, Serialize)]
8pub struct LaunchBundle {
9    pub version: u32,
10    pub agent: Option<String>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub agent_body: Option<String>,
13    pub routing: Routing,
14    pub execution_policy: ExecutionPolicy,
15    pub prompt_surface: PromptSurface,
16    pub scaffold_slots: ScaffoldSlots,
17    pub tools: ToolsSpec,
18    pub skills_metadata: SkillsMetadata,
19    pub provenance: BTreeMap<String, String>,
20    pub warnings: Vec<String>,
21}
22
23#[derive(Debug, Clone, Serialize)]
24pub struct Routing {
25    pub model: String,
26    pub model_token: String,
27    pub harness: String,
28    pub selection_kind: String,
29    pub match_evidence: String,
30    pub harness_model: String,
31    pub harness_model_source: String,
32    pub harness_model_confidence: String,
33    pub candidate_slugs: Vec<String>,
34    pub route_trace: crate::routing::report::RouteDecisionReport,
35}
36
37#[derive(Debug, Clone, Serialize)]
38pub struct CodexRule {
39    pub name: String,
40    pub content: String,
41}
42
43#[derive(Debug, Clone, Serialize)]
44pub struct ExecutionPolicy {
45    pub effort: Option<String>,
46    pub approval: Option<String>,
47    pub sandbox: Option<String>,
48    pub autocompact: Option<u32>,
49    pub autocompact_pct: Option<u8>,
50    pub timeout: Option<u32>,
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub native_config: Option<serde_json::Map<String, serde_json::Value>>,
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub codex_rules: Option<Vec<CodexRule>>,
55}
56
57#[derive(Debug, Clone, Serialize)]
58pub struct PromptSurface {
59    pub system_instruction: String,
60    pub supplemental_documents: Vec<SupplementalDoc>,
61    pub inventory_prompt: String,
62}
63
64#[derive(Debug, Clone, Serialize)]
65pub struct ScaffoldSlots {
66    pub completion_contract: String,
67    pub context_prompt: String,
68    pub user_prompt_file: String,
69    pub context_files: String,
70    pub prior_session_context: String,
71    pub spawn_metadata: String,
72}
73
74impl ScaffoldSlots {
75    pub fn placeholders() -> Self {
76        Self {
77            completion_contract: SLOT_PLACEHOLDER.to_string(),
78            context_prompt: SLOT_PLACEHOLDER.to_string(),
79            user_prompt_file: SLOT_PLACEHOLDER.to_string(),
80            context_files: SLOT_PLACEHOLDER.to_string(),
81            prior_session_context: SLOT_PLACEHOLDER.to_string(),
82            spawn_metadata: SLOT_PLACEHOLDER.to_string(),
83        }
84    }
85}
86
87#[derive(Debug, Clone, Serialize)]
88pub struct SupplementalDoc {
89    pub kind: String,
90    pub name: String,
91    pub content: String,
92    pub skill_type: String,
93}
94
95#[derive(Debug, Clone, Serialize)]
96pub struct ToolsSpec {
97    pub allowed: Vec<String>,
98    pub disallowed: Vec<String>,
99    pub mcp: Vec<String>,
100}
101
102#[derive(Debug, Clone, Serialize)]
103pub struct SkillsMetadata {
104    pub loaded: Vec<String>,
105    pub missing: Vec<String>,
106}