M13.14: agent-interface audit (every command over MCP, control channel and exec --list; automation ids for every widget)
- command.describe / list_commands {schemas} give each command's params JSON Schema;
MCP describe_command, add_effect, list_effects and get_state (app.capabilities)
- effectcraft-cli exec --list [--schemas]
- headless UI audit: every panel kind's interactive egui widgets are covered by
automation ids (fixed: timeline navigator, label swatch, bar trim edges, group and
property name cells)
- command lookup is indexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5cf37921ef
commit
0d5f60c4b7
@@ -348,8 +348,12 @@ fn list(_: &mut Session, p: &Value) -> Result<Value> {
|
||||
let filter = str_p(p, "filter").map(str::to_ascii_lowercase);
|
||||
let v: Vec<Value> = effectcraft_effects::all()
|
||||
.into_iter()
|
||||
.filter(|e| filter.as_ref().is_none_or(|f| e.name.to_ascii_lowercase().contains(f) || e.id.contains(f.as_str())))
|
||||
.map(|e| json!({"id": e.id, "name": e.name, "category": e.category, "params": e.params.iter().map(|p| json!({"id": p.id, "name": p.name, "default": p.default.to_json()})).collect::<Vec<_>>()}))
|
||||
.filter(|e| {
|
||||
filter.as_ref().is_none_or(|f| e.name.to_ascii_lowercase().contains(f) || e.id.contains(f.as_str()) || e.category.to_ascii_lowercase().contains(f))
|
||||
})
|
||||
.map(|e| {
|
||||
json!({"id": e.id, "name": e.name, "category": e.category, "gpu": e.gpu, "float": e.float, "params": e.params.iter().map(|p| json!({"id": p.id, "name": p.name, "default": p.default.to_json()})).collect::<Vec<_>>()})
|
||||
})
|
||||
.collect();
|
||||
Ok(json!(v))
|
||||
}
|
||||
|
||||
@@ -213,7 +213,16 @@ pub fn text_preset_list() -> Vec<(String, String)> {
|
||||
}
|
||||
|
||||
pub fn find(id: &str) -> Option<&'static CommandSpec> {
|
||||
command_specs().iter().find(|c| c.id == id)
|
||||
// Every command execution looks its spec up: index the ~2,000 ids once.
|
||||
static INDEX: OnceLock<std::collections::HashMap<&'static str, usize>> = OnceLock::new();
|
||||
let index = INDEX.get_or_init(|| {
|
||||
let mut m = std::collections::HashMap::new();
|
||||
for (i, c) in command_specs().iter().enumerate() {
|
||||
m.entry(c.id).or_insert(i);
|
||||
}
|
||||
m
|
||||
});
|
||||
index.get(id).map(|&i| &command_specs()[i])
|
||||
}
|
||||
|
||||
// ---------- parameter validation (agents) ----------
|
||||
@@ -256,6 +265,63 @@ pub fn accepted_params(doc: &str) -> Option<Vec<String>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Top-level pieces of a params doc (split at depth-0 commas), e.g. `{layer?, path|prop, value}`
|
||||
/// → `["layer?", "path|prop", "value"]`.
|
||||
fn doc_pieces(doc: &str) -> Option<Vec<String>> {
|
||||
let body = doc.trim().strip_prefix('{')?;
|
||||
let (mut out, mut cur, mut depth) = (Vec::new(), String::new(), 0i32);
|
||||
for c in body.chars() {
|
||||
match c {
|
||||
'{' | '[' | '(' => depth += 1,
|
||||
']' | ')' => depth -= 1,
|
||||
'}' if depth == 0 => {
|
||||
if !cur.trim().is_empty() {
|
||||
out.push(cur.trim().to_string());
|
||||
}
|
||||
return Some(out);
|
||||
}
|
||||
'}' => depth -= 1,
|
||||
',' if depth == 0 => {
|
||||
if !cur.trim().is_empty() {
|
||||
out.push(cur.trim().to_string());
|
||||
}
|
||||
cur.clear();
|
||||
continue;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
cur.push(c);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// The JSON Schema of a command's parameters, derived from its params doc: one property per
|
||||
/// accepted key (described by its piece of the doc), no others. MCP `describe_command` and
|
||||
/// `list_commands {schemas: true}` serve it.
|
||||
pub fn params_schema(spec: &CommandSpec) -> Value {
|
||||
let mut props = serde_json::Map::new();
|
||||
let mut required = vec![];
|
||||
for piece in doc_pieces(spec.params).unwrap_or_default() {
|
||||
let keys = accepted_params(&format!("{{{piece}}}")).unwrap_or_default();
|
||||
let alternatives = keys.len() > 1;
|
||||
for k in keys {
|
||||
// `key?` is optional; so is any key with alternatives (`path|prop`).
|
||||
let optional = alternatives || piece.contains(&format!("{k}?"));
|
||||
if !optional && !required.contains(&k) {
|
||||
required.push(k.clone());
|
||||
}
|
||||
props.insert(k, serde_json::json!({"description": piece}));
|
||||
}
|
||||
}
|
||||
serde_json::json!({
|
||||
"type": "object",
|
||||
"description": spec.params,
|
||||
"properties": props,
|
||||
"required": required,
|
||||
"additionalProperties": accepted_params(spec.params).is_none(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Keys every command understands (comp targeting, gesture merging) and accepted aliases.
|
||||
const ALWAYS_OK: &[&str] = &["comp", "merge"];
|
||||
const ALIASES: &[(&str, &str)] = &[("layers", "layer"), ("layer", "layers"), ("time", "frame"), ("frameRate", "fps"), ("properties", "property")];
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::{EngineError, Result, Session, query};
|
||||
fn list(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let filter = str_p(p, "filter").map(str::to_ascii_lowercase);
|
||||
let only = b_p(p, "enabledOnly").unwrap_or(false);
|
||||
let schemas = b_p(p, "schemas").unwrap_or(false);
|
||||
let v: Vec<Value> = super::command_specs()
|
||||
.iter()
|
||||
.filter(|c| filter.as_ref().is_none_or(|f| c.id.to_ascii_lowercase().contains(f) || c.label.to_ascii_lowercase().contains(f)))
|
||||
@@ -17,7 +18,12 @@ fn list(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if only && en.is_err() {
|
||||
return None;
|
||||
}
|
||||
Some(json!({"id": c.id, "label": c.label, "menu": c.menu, "shortcut": c.shortcut, "params": c.params, "enabled": en.is_ok(), "why": en.err()}))
|
||||
let mut o =
|
||||
json!({"id": c.id, "label": c.label, "menu": c.menu, "shortcut": c.shortcut, "params": c.params, "enabled": en.is_ok(), "why": en.err()});
|
||||
if schemas {
|
||||
o["schema"] = super::params_schema(c);
|
||||
}
|
||||
Some(o)
|
||||
})
|
||||
.collect();
|
||||
Ok(json!(v))
|
||||
@@ -147,13 +153,50 @@ fn layer_tree(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(o)
|
||||
}
|
||||
|
||||
/// One command in full, with the JSON Schema of its parameters.
|
||||
fn describe(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let id = str_p(p, "command").or(str_p(p, "id")).ok_or_else(|| super::bad("command.describe", "missing `command`"))?;
|
||||
let c = super::find(id).ok_or_else(|| EngineError::UnknownCommand(id.to_string()))?;
|
||||
let en = (c.enabled)(s);
|
||||
Ok(json!({
|
||||
"id": c.id, "label": c.label, "menu": c.menu, "shortcut": c.shortcut, "params": c.params,
|
||||
"schema": super::params_schema(c), "undoable": c.journal, "enabled": en.is_ok(), "why": en.err(),
|
||||
}))
|
||||
}
|
||||
|
||||
/// What this build can do: counts agents use to orient themselves, and the parity summary.
|
||||
fn capabilities(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
let fx = effectcraft_effects::registry();
|
||||
let formats: Vec<Value> = s.exporter.as_ref().map(|e| e.formats().iter().map(|f| json!(format!("{f:?}"))).collect()).unwrap_or_default();
|
||||
Ok(json!({
|
||||
"version": env!("CARGO_PKG_VERSION"),
|
||||
"commands": super::command_specs().len(),
|
||||
"effects": {"total": fx.len(), "gpu": fx.iter().filter(|e| e.gpu).count(), "float": fx.iter().filter(|e| e.float).count()},
|
||||
"export": formats,
|
||||
"import": s.importer.is_some(),
|
||||
"expressions": s.expr.is_some(),
|
||||
"scripting": s.script.is_some(),
|
||||
"gpu": s.accel.is_some(),
|
||||
"parity": {
|
||||
"target": "Adobe After Effects 2026",
|
||||
"summary": PARITY,
|
||||
"doc": "docs/parity.md",
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
/// The headline of `docs/parity.md` (kept in sync by hand at each audit).
|
||||
const PARITY: &str = "≈94% weighted feature parity (80 done / 12 partial / 0 missing of 92 features); 298 of 298 After Effects 2026 effects present";
|
||||
|
||||
fn state(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
Ok(serde_json::to_value(&s.state).unwrap_or_default())
|
||||
}
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
vec![
|
||||
query!("command.list", "List Commands", "{filter?, enabledOnly?}", list),
|
||||
query!("command.list", "List Commands", "{filter?, enabledOnly?, schemas? (add each command's params JSON Schema)}", list),
|
||||
query!("command.describe", "Describe Command", "{command} → id, label, menu, shortcut, params doc, JSON `schema`, enabled", describe),
|
||||
query!("app.capabilities", "App Capabilities", "{} → version, command/effect counts, export formats, parity summary", capabilities),
|
||||
query!("project.summary", "Project Summary", "{}", summary),
|
||||
query!("comp.info", "Composition Info", "{comp?}", comp_info),
|
||||
query!("layer.tree", "Layer Property Tree", "{layer?, comp?, depth?, time? (comp s)} → nodes with `path`", layer_tree),
|
||||
|
||||
Reference in New Issue
Block a user