fix: allow guidance open path

This commit is contained in:
lucaronin
2026-04-28 23:56:08 +02:00
parent 40544fc551
commit 87908d982f
3 changed files with 27 additions and 6 deletions

View File

@@ -17,6 +17,7 @@
"dialog:default",
"updater:default",
"process:default",
"opener:default"
"opener:default",
"opener:allow-open-path"
]
}

View File

@@ -590,11 +590,9 @@ fn dispatch_assistant_content_block<F>(
F: FnMut(ClaudeStreamEvent),
{
match block["type"].as_str() {
Some("text") => {
if emit_text {
if let Some(text) = block["text"].as_str() {
emit_text_delta(text, state, emit);
}
Some("text") if emit_text => {
if let Some(text) = block["text"].as_str() {
emit_text_delta(text, state, emit);
}
}
Some("tool_use") => {

View File

@@ -145,6 +145,8 @@ pub async fn stream_ai_agent(
mod tests {
use super::*;
use crate::vault::AiGuidanceFileState;
use serde_json::Value;
use std::{fs, path::Path};
#[test]
fn guidance_commands_report_and_restore_vault_guidance_files() {
@@ -167,4 +169,24 @@ mod tests {
assert!(dir.path().join("CLAUDE.md").exists());
assert!(dir.path().join("GEMINI.md").exists());
}
#[test]
fn desktop_capability_allows_opening_restored_guidance_files() {
let capability_path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("capabilities")
.join("default.json");
let capability_json = fs::read_to_string(capability_path).unwrap();
let capability: Value = serde_json::from_str(&capability_json).unwrap();
let permissions = capability
.get("permissions")
.and_then(Value::as_array)
.unwrap();
assert!(
permissions
.iter()
.any(|permission| permission.as_str() == Some("opener:allow-open-path")),
"desktop capabilities must allow opener open_path so restored guidance files can be opened"
);
}
}