Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

fix(api, mcp): stabilization and backgrounds are in the schema, a job's status names the stabilize stage, and the CLI's server lists nothing (#337)

Jareer30584f7edef7
diff --git a/src/crates/concat-api/src/job.rs b/src/crates/concat-api/src/job.rs
index cd01ed46..49116a13 100644
--- a/src/crates/concat-api/src/job.rs
+++ b/src/crates/concat-api/src/job.rs
@@ -67,6 +67,10 @@ impl Book {
status.stage = Some("cutout".to_owned());
status.fraction = f64::from(*fraction).clamp(0.0, 1.0);
}
+ Event::StabilizeProgress { fraction, .. } => {
+ status.stage = Some("stabilize".to_owned());
+ status.fraction = f64::from(*fraction).clamp(0.0, 1.0);
+ }
Event::ExportProgress {
frame,
total,
diff --git a/src/crates/concat-api/src/message.rs b/src/crates/concat-api/src/message.rs
index cc4ec121..c85d7170 100644
--- a/src/crates/concat-api/src/message.rs
+++ b/src/crates/concat-api/src/message.rs
@@ -426,7 +426,8 @@ pub struct JobStatus {
pub output: String,
/// Running, or how it ended.
pub state: JobState,
- /// What it is doing: "cutout" while masks are found, then "video",
+ /// What it is doing: "cutout" while masks are found, "stabilize" while
+ /// shake is measured, then "video",
/// "audio" and "mux". Absent until it has said.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub stage: Option<String>,
diff --git a/src/crates/concat-cli/src/main.rs b/src/crates/concat-cli/src/main.rs
index ca99c221..2305609b 100644
--- a/src/crates/concat-cli/src/main.rs
+++ b/src/crates/concat-cli/src/main.rs
@@ -210,6 +210,9 @@ fn serve(
grpc,
token,
roots,
+ // The listing is the window's: a server in a terminal prints its
+ // address and token for whoever started it.
+ discovery: None,
};
let server = concat_server::Server::start(config, concat_api::Api::new)?;
if let Some(address) = server.json_addr() {
diff --git a/src/crates/concat-mcp/src/tools.rs b/src/crates/concat-mcp/src/tools.rs
index deadc103..b41246aa 100644
--- a/src/crates/concat-mcp/src/tools.rs
+++ b/src/crates/concat-mcp/src/tools.rs
@@ -33,7 +33,7 @@ const POLL: Duration = Duration::from_millis(250);
const WAIT_DEFAULT: f64 = 60.0;
const WAIT_LONGEST: f64 = 600.0;
/// The stages of an export in order, for one progress figure across them.
-const STAGES: [&str; 4] = ["cutout", "video", "audio", "mux"];
+const STAGES: [&str; 5] = ["cutout", "stabilize", "video", "audio", "mux"];
/// What a tool does with its arguments.
#[derive(Clone, Copy, Debug)]
@@ -385,7 +385,7 @@ pub fn catalogue() -> Vec<Tool> {
method(
"export_status",
"Export status",
- "How an export job stands, at once: `state` (\"running\", \"done\", \"cancelled\" or \"failed\"), `stage` (\"cutout\", \"video\", \"audio\", \"mux\"), frames done of total, `fraction` of the stage (0-1), and once done the file and its size, or the error.",
+ "How an export job stands, at once: `state` (\"running\", \"done\", \"cancelled\" or \"failed\"), `stage` (\"cutout\", \"stabilize\", \"video\", \"audio\", \"mux\"), frames done of total, `fraction` of the stage (0-1), and once done the file and its size, or the error.",
"export.status",
Raw,
)
diff --git a/src/crates/concat-project/src/commands/mod.rs b/src/crates/concat-project/src/commands/mod.rs
index 8694d2ff..ada853b2 100644
--- a/src/crates/concat-project/src/commands/mod.rs
+++ b/src/crates/concat-project/src/commands/mod.rs
@@ -177,6 +177,7 @@ pub struct ClipPatch {
with = "double_option",
skip_serializing_if = "Option::is_none"
)]
+ #[cfg_attr(feature = "schema", schemars(with = "Option<Background>"))]
pub background: Option<Option<Background>>,
}
diff --git a/src/crates/concat-project/src/model.rs b/src/crates/concat-project/src/model.rs
index 24e80854..cf49fe4d 100644
--- a/src/crates/concat-project/src/model.rs
+++ b/src/crates/concat-project/src/model.rs
@@ -583,6 +583,7 @@ impl Stroke {
/// analysis and cached in the project folder beside the masks; these are
/// the settings the smooth path and the correction are worked out from,
/// live, whenever they change. Off is no `Stabilize` at all.
+#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", default)]
pub struct Stabilize {
@@ -693,6 +694,7 @@ impl Crop {
/// A timeline carries one ([`Timeline::background`]) and a clip may carry
/// its own over it ([`Clip::background`]); which clips have one at all is
/// [`Timeline::background_of`]'s to say.
+#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize)]
#[serde(
tag = "kind",
@@ -774,6 +776,7 @@ fn rgb_of(hex: &str) -> Option<[u8; 3]> {
}
/// The two ways a picture can be sized to the frame in one go.
+#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum Framing {