Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/mint-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ fn runtime_extra_defaults() -> BTreeMap<String, Value> {
"notionDatabaseId": "",
"notionPageId": "",
"notionTitleProperty": "Name",
"allowedShellModes": ["readOnly", "test"],
"allowedShellModes": ["readOnly", "test", "mutating", "network"],
"allowedNativePlugins": ["dev_tools", "system_metrics"],
"allowedMcpTools": {},
"mcpServers": {}
Expand Down Expand Up @@ -357,7 +357,7 @@ mod tests {
assert_eq!(config.extra["lineWebhookPort"], 3000);
assert_eq!(
config.extra["allowedShellModes"],
serde_json::json!(["readOnly", "test"])
serde_json::json!(["readOnly", "test", "mutating", "network"])
);
assert_eq!(
config.extra["allowedNativePlugins"],
Expand Down
33 changes: 31 additions & 2 deletions crates/mint-core/src/orchestration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fn request_chat_id(request: &ChatRequest) -> &str {
.unwrap_or(DEFAULT_CONVERSATION_ID)
}

const MAX_STEPS: usize = 16;
const MAX_STEPS: usize = 32;
const MAX_OBSERVATION_BYTES: usize = 16_000;
pub fn build_system_prompt(config: &MintConfig) -> String {
let mut allowed_actions = vec![
Expand Down Expand Up @@ -1680,14 +1680,22 @@ fn parse_agent_json<T: serde::de::DeserializeOwned>(raw: &str) -> Result<T, Orch
fn parse_shorthand_finish(raw: &str) -> Result<AgentDecision, serde_json::Error> {
let value: Value = serde_json::from_str(raw)?;
let finish = value.get("finish").cloned().unwrap_or(Value::Null);
let input = match finish {
Value::Object(_) => serde_json::from_value(finish)?,
Value::String(s) => AgentInput {
summary: s,
..AgentInput::default()
},
_ => AgentInput::default(),
};
Ok(AgentDecision {
thought: value
.get("thought")
.and_then(Value::as_str)
.unwrap_or_default()
.into(),
action: "finish".into(),
input: serde_json::from_value(finish)?,
input,
})
}

Expand Down Expand Up @@ -2006,6 +2014,27 @@ mod tests {
assert!(decision.input.summary.is_empty());
}

#[test]
fn shorthand_finish_allows_null_or_missing_finish() {
let decision = parse_decision(r#"{"thought":"done","finish":null}"#)
.expect("null finish should parse");
assert_eq!(decision.action, "finish");
assert!(decision.input.summary.is_empty());

let decision = parse_decision(r#"{"thought":"done"}"#)
.expect("missing finish should parse");
assert_eq!(decision.action, "finish");
assert!(decision.input.summary.is_empty());
}

#[test]
fn shorthand_finish_allows_string_finish_as_summary() {
let decision = parse_decision(r#"{"thought":"done","finish":"all done!"}"#)
.expect("string finish should parse as summary");
assert_eq!(decision.action, "finish");
assert_eq!(decision.input.summary, "all done!");
}

#[test]
fn write_file_policy_rejects_existing_workspace_file() {
let root =
Expand Down
7 changes: 6 additions & 1 deletion crates/mint-core/src/safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,15 @@ mod tests {

#[test]
fn shell_mode_policy_reads_config_allowlist() {
let config = MintConfig::default();
let mut config = MintConfig::default();
config.extra.insert(
"allowedShellModes".to_string(),
serde_json::json!(["readOnly", "test"]),
);
assert!(shell_mode_allowed(&config, ShellCommandMode::ReadOnly));
assert!(shell_mode_allowed(&config, ShellCommandMode::Test));
assert!(!shell_mode_allowed(&config, ShellCommandMode::Network));
assert!(!shell_mode_allowed(&config, ShellCommandMode::Mutating));
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tauri::{AppHandle, Emitter, Manager};

use crate::browser::{click, navigate, read_page_text};

const MAX_STEPS: usize = 10;
const MAX_STEPS: usize = 20;
const SYSTEM_PROMPT: &str = r#"You are Mint's native background task agent. Return only JSON:
{"thought":"short progress note","action":"done|propose_folder|propose_write_file|open_url|browser_read|browser_click|knowledge_search|propose_bash","target":"path, URL, selector, query, command, or final result","data":"optional file content"}
Use only one action per response. Background tasks never mutate the filesystem or execute shell commands. Use propose_folder, propose_write_file, and propose_bash so Mint can record a proposal for explicit user approval."#;
Expand Down
Loading
Loading