feat(automation): local TCP socket transport for --serve

OpenCADStudio --serve --port <N> listens on 127.0.0.1:<N> and serves the
same line-based JSON protocol over the socket (one client at a time; the
document session persists across reconnects), as an alternative to
stdin/stdout. ocs.py grows a port= option to connect either way.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-18 01:54:03 +03:00
1 parent d4f5ed3135
commit 8bae517eec
3 files changed
+110 -32

No files matched your search

+6 -4
View File
@@ -4,12 +4,14 @@ Open CAD Studio can run without a GUI and be driven over a line-based JSON
protocol — for scripts, batch jobs, or AI agents.
```sh
OpenCADStudio --serve
OpenCADStudio --serve # stdin/stdout transport
OpenCADStudio --serve --port 4242 # listen on 127.0.0.1:4242 instead
```
It reads one JSON request per line on **stdin** and writes one JSON response per
line on **stdout**. The active document persists across requests, so a caller
can act → observe → act.
It reads one JSON request per line and writes one JSON response per line — over
**stdin/stdout**, or over a **local TCP socket** with `--port`. The active
document persists across requests (and, on the socket, across reconnects), so a
caller can act → observe → act.
## Protocol