feat(automation): query op — list entities with detail and filters

Add a query op to the headless server: list entities with handle, type,
layer and basic geometry (Line start/end, Circle/Arc centre+radius, Point
location), filtered by type and/or layer and capped by limit. Closes the
observe half of an agent's act/observe loop. ocs.py gains ocs.query().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-17 21:22:46 +03:00
commit 6d29b8458c
3 changed files with 89 additions and 0 deletions

View file

@ -70,6 +70,15 @@ class Ocs:
"""Total entity count and a breakdown by type."""
return self._send(op="entities")
def query(
self,
type: Optional[str] = None,
layer: Optional[str] = None,
limit: Optional[int] = None,
) -> dict[str, Any]:
"""List entities (handle, type, layer, geometry), optionally filtered."""
return self._send(op="query", type=type, layer=layer, limit=limit)
def save(self, path: Optional[str] = None) -> dict[str, Any]:
"""Write the document (defaults to the opened/last-saved path)."""
return self._send(op="save", path=path)