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:
co-authored by
Claude Fable 5
parent
ea5162ac65
commit
67f918439c
@@ -0,0 +1,54 @@
|
||||
use axum::extract::{Query, State};
|
||||
use axum::Json;
|
||||
use serde::Deserialize;
|
||||
use tc_domain::{AgentId, FileDrive, FileNode};
|
||||
|
||||
use crate::routes::claws::workspace_agent;
|
||||
use crate::{ApiError, AppState, Authed};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct FilesQuery {
|
||||
#[serde(rename = "clawId")]
|
||||
claw_id: AgentId,
|
||||
/// `documents` (default) or `received` for the per-agent drives.
|
||||
drive: Option<String>,
|
||||
}
|
||||
|
||||
/// GET /api/openclaw/files?clawId=&drive= — the agent's personal drives (§7.4).
|
||||
pub async fn openclaw_files(
|
||||
State(state): State<AppState>,
|
||||
Authed(user): Authed,
|
||||
Query(query): Query<FilesQuery>,
|
||||
) -> Result<Json<Vec<FileNode>>, ApiError> {
|
||||
let agent = workspace_agent(&state, &user, query.claw_id).await?;
|
||||
let drive: FileDrive = query
|
||||
.drive
|
||||
.as_deref()
|
||||
.unwrap_or("documents")
|
||||
.parse()
|
||||
.map_err(|_| ApiError::NotFound)?;
|
||||
if !drive.is_agent_scoped() {
|
||||
return Err(ApiError::NotFound); // shared drive has its own route
|
||||
}
|
||||
let nodes = tc_db::repo::files::list(&state.pool, user.workspace_id, drive, agent.id).await?;
|
||||
Ok(Json(nodes))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct SharedQuery {
|
||||
#[serde(rename = "clawId")]
|
||||
claw_id: AgentId,
|
||||
}
|
||||
|
||||
/// GET /api/shared-drive/files?clawId= — the team-wide ClawDrive (§7.4).
|
||||
pub async fn shared_files(
|
||||
State(state): State<AppState>,
|
||||
Authed(user): Authed,
|
||||
Query(query): Query<SharedQuery>,
|
||||
) -> Result<Json<Vec<FileNode>>, ApiError> {
|
||||
let agent = workspace_agent(&state, &user, query.claw_id).await?;
|
||||
let nodes =
|
||||
tc_db::repo::files::list(&state.pool, user.workspace_id, FileDrive::Shared, agent.id)
|
||||
.await?;
|
||||
Ok(Json(nodes))
|
||||
}
|
||||
Reference in New Issue
Block a user