Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ memchr = { version = "=2.8.3", default-features = false }
pkg-config = { version = "=0.3.34", default-features = false }
proptest = { version = "=1.11.0", default-features = false }
serde = { version = "=1.0.229", default-features = false }
schemars = { version = "=1.2.3", default-features = false }
serde_path_to_error = { version = "=0.1.20", default-features = false }
serde_json = { version = "=1.0.151", default-features = false }
sha2 = { version = "=0.11.0", default-features = false }
tempfile = { version = "=3.27.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion ci/hooks/pre_commit_fmt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run --no-project --script
"""The pre-commit hook body: format the Rust tree before it is committed.

Installed by `./install-hooks` (or `./push --install-hooks`). It runs the same
Expand Down
6 changes: 6 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ not get a line.

### Headless and automation

- **Typed MCP control.** Existing OBS MCP tools publish input and output schemas,
structured results and machine-readable domain errors. Read operations carry
annotations, and repeated output start/stop calls succeed with current state.
*All*, 2026-11-09. Issue [#4445](https://github.com/obs-rust/obs-studio/issues/4445),
PR [#4450](https://github.com/obs-rust/obs-studio/pull/4450).

- **`--disable-shutdown-check` works again.** After an unclean stop (power
loss, OOM killer, a hard stop of the VM or container), OBS starts without
the "Crash Detected" dialog and logs the unclean shutdown as a warning on
Expand Down
53 changes: 53 additions & 0 deletions docs/rust-port/control-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Control API

Extend obs-mcp; preserve existing tool names, successful text/image payloads,
headless stdio and the unchanged C++ obs-websocket plugin. New tools use
`domain_verb`: `vcam_start`, `vcam_stop`, `vcam_status`, `vmic_status`,
`media_restart`, `media_status`, `stats_get`, `stats_reset`, `wait_for`,
`pipeline_dump`.

## Contract

TypedTool declares serde/schemars input/output structs, NAME and ANNOTATIONS.
Inputs reject unknown fields and default optional fields. The Tool adapter
publishes inputSchema/outputSchema and returns structuredContent alongside JSON
text (and screenshot image content). The committed schema snapshot must match
schemas generated from the registered types. Backend additions use request and
response structs, never positional multi-argument methods.

Malformed requests and typed arguments are JSON-RPC errors. Domain failures
return isError and ToolError {code, category, message, retryable}, using
obs-websocket v5 codes: 600 ResourceNotFound, 207 NotReady, 604 InvalidResourceState
and 702 RequestProcessingFailed. Categories are independent of numeric ranges.
Read operations have readOnlyHint; start/stop are idempotent.

## State and measurements

`wait_for {condition, timeout_ms}` first checks, then waits within the deadline;
it returns {satisfied, elapsed_ms, last_value}. Condition is a typed enum:
OutputState {output,state}, SourceActive {name}, MediaState {name,state},
StatAtMost {metric,value}. Start accepts optional wait for bounded auto-wait.
Media uses obs_source_media_*; vcam uses virtualcam_output and its private
proc_handler. stats_get reports per-stage render/vcam/vmic {live,
latency_min_ns, latency_max_ns, frames_total, frames_dropped, xruns}, render
counters and {av_offset_ms, measured_from}. Unmeasured values remain unavailable;
queue estimates never masquerade as end-to-end measurements. stats_reset defines
a new counter baseline. pipeline_dump reports the current graph.

## Attachment

A loadable in-app module serves the same newline-delimited JSON-RPC Server on
$XDG_RUNTIME_DIR/obs-studio-rust/control.sock (0600). It uses the running OBS
instance; headless stdio still owns its own instance. `--mcp-attach [socket]`
proxies stdio to that socket. Socket ownership and cleanup follow module
lifecycle. OS code stays in src/platform or src/ffi. Windows named pipes require
a follow-up; unsupported attachment returns a clear error.

## Delivery

Parent #4444 has ordered native sub-issues: #4445 typed tools/errors/schema,
#4446 device/media/stats, #4447 waiting, #4448 socket/module/proxy, #4449 fluent
Rust client and ci/vcam_av_sync.py MCP transport. Each slice targets master
from a fresh infra/control-api-* branch with RED then GREEN shared MCP tests.
The client reuses server types; Python retains websocket and adds --transport
mcp plus fallback. Real GUI/device validation runs only in bosn containers.
Loading
Loading