P3 backend: files, skills, routines, claw chat with LIVE taint plumbing

- tc-files: BlobStore trait + LocalBlobStore (traversal-proof keys); wired
  through Runtime (config storage.data_dir in deployments)
- File tools: files.write/files.list (workspace-internal) + files.delete
  (gated FileDeletion — tested: file survives pending, gone after approve);
  GET /api/openclaw/files + /api/shared-drive/files (drive/agent scoped)
- Skills: catalog/library + idempotent install with counter, uninstall;
  GET /api/skills[?clawId=], POST install/uninstall
- tc-scheduler: croner cron math (clock-controlled tests), SKIP LOCKED
  claim-and-advance firing REAL runs into dedicated ' name' sessions
  (reused, exactly-once), paused routines skipped; routines API + agent
  tool routine.schedule; loop spawned in server
- Claw chat: 1:1 threads, chat.send enforcing the target's Other-Claws
  policy, chat.inbox whose output carries inter_agent taint; the run loop
  now ACCUMULATES taint from tool outputs into LoopState, classifies with
  it, and stamps steps + approvals — a poisoned inbox followed by
  email.send produces an approval whose taint_sources says inter_agent
- ScriptedProvider scenario selection now keys on the most recent marker
  (session history kept earlier markers alive)

132 Rust tests green.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-10 05:28:50 -05:00
co-authored by Claude Fable 5
parent ea5162ac65
commit 67f918439c
69 changed files with 3651 additions and 183 deletions
+60
View File
@@ -0,0 +1,60 @@
use tc_files::{BlobError, BlobStore, LocalBlobStore};
fn store() -> (LocalBlobStore, std::path::PathBuf) {
let root = std::env::temp_dir().join(format!("tc-blobs-{}", uuid::Uuid::now_v7()));
(LocalBlobStore::new(root.clone()), root)
}
#[tokio::test]
async fn put_get_delete_round_trip() {
let (store, _root) = store();
store
.put("ws1/documents/agent1/report.md", b"# Q2 Report")
.await
.unwrap();
let bytes = store.get("ws1/documents/agent1/report.md").await.unwrap();
assert_eq!(bytes, b"# Q2 Report");
store
.delete("ws1/documents/agent1/report.md")
.await
.unwrap();
let gone = store.get("ws1/documents/agent1/report.md").await;
assert!(matches!(gone, Err(BlobError::NotFound)));
}
#[tokio::test]
async fn nested_keys_create_directories() {
let (store, _root) = store();
store.put("a/b/c/d/deep.txt", b"x").await.unwrap();
assert_eq!(store.get("a/b/c/d/deep.txt").await.unwrap(), b"x");
}
#[tokio::test]
async fn overwrite_replaces_content() {
let (store, _root) = store();
store.put("k", b"one").await.unwrap();
store.put("k", b"two").await.unwrap();
assert_eq!(store.get("k").await.unwrap(), b"two");
}
#[tokio::test]
async fn path_traversal_is_rejected() {
let (store, root) = store();
let escape = store.put("../outside.txt", b"nope").await;
assert!(matches!(escape, Err(BlobError::InvalidKey(_))));
let sneaky = store.put("ok/../../outside.txt", b"nope").await;
assert!(matches!(sneaky, Err(BlobError::InvalidKey(_))));
let absolute = store.put("/etc/passwd", b"nope").await;
assert!(matches!(absolute, Err(BlobError::InvalidKey(_))));
assert!(!root.parent().unwrap().join("outside.txt").exists());
}
#[tokio::test]
async fn deleting_missing_blobs_is_not_found() {
let (store, _root) = store();
assert!(matches!(
store.delete("never-existed").await,
Err(BlobError::NotFound)
));
}