scopeの再設計

This commit is contained in:
2026-04-14 12:09:18 +09:00
parent 3c58b5dde4
commit 2db2c1611c
24 changed files with 1074 additions and 318 deletions
+6 -1
View File
@@ -17,6 +17,7 @@ use session_store::FsStore;
const MANIFEST_TOML: &str = r#"
[pod]
name = "hello-pod"
pwd = "./"
[provider]
kind = "anthropic"
@@ -25,6 +26,10 @@ model = "claude-sonnet-4-20250514"
[worker]
system_prompt = "You are a concise assistant. Reply in one or two sentences."
max_tokens = 256
[[scope.allow]]
target = "./"
permission = "write"
"#;
#[tokio::main]
@@ -40,7 +45,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let store = FsStore::new(tmp.path()).await?;
// 3. Build the Pod from manifest
let mut pod = Pod::from_manifest(manifest, store, None, None).await?;
let mut pod = Pod::from_manifest(manifest, store, None).await?;
println!("Session: {}", pod.session_id());
// 4. Run a prompt
+6 -1
View File
@@ -11,6 +11,7 @@ use session_store::FsStore;
const MANIFEST_TOML: &str = r#"
[pod]
name = "protocol-demo"
pwd = "./"
[provider]
kind = "anthropic"
@@ -19,6 +20,10 @@ model = "claude-sonnet-4-20250514"
[worker]
system_prompt = "You are a concise assistant. Reply in one or two sentences."
max_tokens = 256
[[scope.allow]]
target = "./"
permission = "write"
"#;
#[tokio::main]
@@ -28,7 +33,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let manifest = PodManifest::from_toml(MANIFEST_TOML)?;
let tmp = tempfile::tempdir()?;
let store = FsStore::new(tmp.path()).await?;
let pod = pod::Pod::from_manifest(manifest, store, None, None).await?;
let pod = pod::Pod::from_manifest(manifest, store, None).await?;
let runtime_tmp = tempfile::tempdir()?;
let handle = PodController::spawn(pod, runtime_tmp.path()).await?;