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: String,
11    pub routing: Routing,
12    pub execution_policy: ExecutionPolicy,
13    pub prompt_surface: PromptSurface,
14    pub scaffold_slots: ScaffoldSlots,
15    pub tools: ToolsSpec,
16    pub skills_metadata: SkillsMetadata,
17    pub provenance: BTreeMap<String, String>,
18    pub warnings: Vec<String>,
19}
20
21#[derive(Debug, Clone, Serialize)]
22pub struct Routing {
23    pub model: String,
24    pub model_token: String,
25    pub harness: String,
26}
27
28#[derive(Debug, Clone, Serialize)]
29pub struct ExecutionPolicy {
30    pub effort: Option<String>,
31    pub approval: Option<String>,
32    pub sandbox: Option<String>,
33    pub autocompact: Option<u32>,
34    pub autocompact_pct: Option<u8>,
35    pub timeout: Option<u32>,
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub native_config: Option<serde_json::Map<String, serde_json::Value>>,
38}
39
40#[derive(Debug, Clone, Serialize)]
41pub struct PromptSurface {
42    pub system_instruction: String,
43    pub supplemental_documents: Vec<SupplementalDoc>,
44    pub inventory_prompt: String,
45}
46
47#[derive(Debug, Clone, Serialize)]
48pub struct ScaffoldSlots {
49    pub completion_contract: String,
50    pub context_prompt: String,
51    pub user_prompt_file: String,
52    pub context_files: String,
53    pub prior_session_context: String,
54    pub spawn_metadata: String,
55}
56
57impl ScaffoldSlots {
58    pub fn placeholders() -> Self {
59        Self {
60            completion_contract: SLOT_PLACEHOLDER.to_string(),
61            context_prompt: SLOT_PLACEHOLDER.to_string(),
62            user_prompt_file: SLOT_PLACEHOLDER.to_string(),
63            context_files: SLOT_PLACEHOLDER.to_string(),
64            prior_session_context: SLOT_PLACEHOLDER.to_string(),
65            spawn_metadata: SLOT_PLACEHOLDER.to_string(),
66        }
67    }
68}
69
70#[derive(Debug, Clone, Serialize)]
71pub struct SupplementalDoc {
72    pub kind: String,
73    pub name: String,
74    pub content: String,
75    pub skill_type: String,
76}
77
78#[derive(Debug, Clone, Serialize)]
79pub struct ToolsSpec {
80    pub allowed: Vec<String>,
81    pub disallowed: Vec<String>,
82    pub mcp: Vec<String>,
83}
84
85#[derive(Debug, Clone, Serialize)]
86pub struct SkillsMetadata {
87    pub loaded: Vec<String>,
88    pub missing: Vec<String>,
89}