Skip to content

Plugin panels: MCP parity for panel surfaces (S08, api v29) - #3586

Merged
HakanSeven12 merged 4 commits into
HakanSeven12:mainfrom
schoeller:scene-ui-atomic-s08-mcp-parity
Nov 24, 2026
Merged

HakanSeven12 merged 4 commits into
HakanSeven12:mainfrom
schoeller:scene-ui-atomic-s08-mcp-parity

Conversation

@schoeller

Copy link
Copy Markdown
Contributor

Staged train (this PR is stage 8 — the final content stage)

Stages 1–7 are merged (scenes #3460, patches #3510, events #3530, widget tier #3540, buttons #3545, tables: this train's predecessor). Nothing follows.

Problem and minimal scope

Stage 8 — the evidence leg — of the atomic panel-surface train (#3460 scenes, #3510 patches, #3530 events, #3540 widget tier, the button and typed-table stages): MCP parity for panel surfaces. Everything an agent can do to a drawing through MCP, it can now do to a plugin panel: ocs_panels reads the published surfaces with bounded, keyed pages; ocs_panel_action performs the user's activation gesture; and the equivalence is PROVEN, not claimed — the MCP path and the GUI path route through the one PanelEventRouter and the one owner-targeted delivery, and a recorded-dispatch test asserts the resulting PanelSurfaceEvent is identical (modulo the sequence advancing, which is the identity contract working). No new wire, no second panel machinery: the facade rides the existing ocs_read/ocs_execute pipeline exactly as the GUI mutations do.

Public API / wire changes and current API-major basis

Based on the train's merged v29 (manifest API_VERSION unchanged — no new API major, no wire changes at all):

  • mcp_ops.rs: two OpDefs — plugin_panels (read: per-panel owner + per-tier revision/count overview; per-surface detail with tier/rows/after — scene tier answers COUNTS only, widget/table rows return keyed pages capped at 200) and plugin_panel_action (execute: panel_id + element (StableId) + kind (node_activated | element_clicked, defaulted by which tier holds the element; an element must exist in the addressed surface or the op refuses and burns no sequence number).
  • mcp_intent.rs: descriptors ocs_panels (Read) and ocs_panel_action (Execute) join the catalogue (NAMES 16 → 18; the catalogue-uniqueness test updated with them).
  • mcp.rs: READ_OPS/EXECUTE_OPS allow the two ops; TOOL_SCHEMA_DIGEST repinned deliberately (586df5bc… → 6f35562b…) — the diff is exactly the two new tool definitions plus the ocs_read description's guide list (reviewed per the pinned test's instruction; the inspector CI validates the live schema).
  • Host side: panel_surfaces gains owner-agnostic facade accessors (surface_summaries, *_any_owner) — the operator's own automation interface; plugin-to-plugin isolation (scene/widget/table owner checks) is untouched. panel_events gains on_element_clicked, mirroring on_node_activated (pos is pointer-derived payload, never identity).

Documentation (agent and plugin author)

New guide docs/automation/guides/plugin-panels.md, registered in GUIDES, INSTRUCTIONS, and the ocs_read description: the agent side (discover → page → activate, with real JSON shapes) AND the plugin side — constructing a widget tree with a BUTTON row, answering an Unloaded expansion with a keyed WidgetPage, publishing a typed table and canonicalizing committed edits with an atomic TablePatch, a scene surface, and menus via the existing v15 quad-panel API (no second menu path).

Legacy compatibility

Zero impact on existing tools, ops, schemas (append-only catalogue), surfaces, or the wire. Panels without surfaces read back as an empty overview. A v28 runner still cannot receive tag 16; nothing in this stage sends anything new.

Verification (exact commands, exit 0, at head abf5d067e, rebased on upstream a11cfab85)

  • cargo test -p ocs_plugin_api --all-features → 223 passed, 0 failed, 1 ignored (unchanged: no crate-side changes).
  • cargo test --lib -p OpenCADStudio -- plugin_panels mcp_panel_action tool_schema → 7 passed, 0 failed, including:
    • equivalence: the MCP plugin_panel_action and the GUI PanelWidgetNodeActivated message produce the SAME PanelSurfaceEvent (recorded dispatch, sequences 1 → 2 on the per-surface identity);
    • bounded reads + refusal discipline: overview/detail shapes; unknown panel/element refuse and dispatch no surface events;
    • scale: a 10k-row surface walked through 200-row keyed pages — 50 pages, every row exactly once, strictly increasing, no materialization.
  • cargo test --lib -p OpenCADStudio -- panel_events panel_surfaces plugin_scene panel_widgets plugin_tables → 25 passed, 0 failed (the train's surface suites, unchanged).
  • cargo check --lib -p OpenCADStudio → clean; wasm32 check → clean (delivery stays desktop-gated; the facade's activation arm is a no-op on web, same paired-stub convention).
  • Scoped rustfmt --check on the seven touched files → 0 diffs.
    (Recorded artifacts for every line above; tool_schema_digest_is_pinned green after the deliberate repin.)

Live-test evidence

Not run — honestly. The parity proof is the recorded-dispatch test (same router, same delivery, same event); a live MCP client against a live plugin panel awaits the Windows host mirror (pending note unchanged across the train). The MCP-conformance inspector job validates the advertised schema live on CI.

Upstream-baseline failures (not regressions)

Unchanged across the train: windows D3D12/windows-rs trait errors (inherited, documented with clean-checkout evidence on #3460/#3530); fmt/clippy informational jobs fail on pristine main. This PR adds zero new diagnostics.

- mcp_ops: plugin_panels (bounded reads: overview + tier detail + keyed
  paging) and plugin_panel_action (semantic activation) OpDefs.
- mcp: READ_OPS/EXECUTE_OPS allow the two ops.
- panel_surfaces: owner-agnostic facade accessors (surface_summaries,
  *_any_owner) for the host's own automation interface.
- panel_events: on_element_clicked mirroring on_node_activated.
- automation: plugin_panels_read/plugin_panels_detail/plugin_panel_action
  (registry owner lookup, element-in-surface validation, router dispatch,
  desktop-gated delivery).
- mcp_intent: ocs_panels + ocs_panel_action descriptors; catalogue NAMES
  and count extended (16 -> 18).
- Tests: the MCP plugin_panel_action routes the SAME PanelSurfaceEvent as
  the GUI gesture (recorded-dispatch equivalence, sequence monotonicity);
  bounded overview/paged reads; refusal discipline (no surface events);
  10k-row surface walked through 200-row keyed pages, every row exactly
  once, strictly increasing. In-process test sink satisfies the reaper's
  owner-visibility law without a plugin process.
- record_test_dispatch gains the PanelSurfaceEvent arm (was 'Other').
- docs/automation/guides/plugin-panels.md: agent-side reads/actions AND
  plugin-side construction (button rows, keyed pages, typed tables +
  canonicalizing patches, scenes, menus via the v15 quad path); registered
  in GUIDES, INSTRUCTIONS and the ocs_read description.
- TOOL_SCHEMA_DIGEST repinned deliberately: ocs_panels + ocs_panel_action
  joined the catalogue (NAMES 16 -> 18), ocs_read description mentions the
  new guide.
… fmt touch-up)

The rebase brought upstream's entities_delete test lines, which carry two
of the inherited baseline fmt hunks. Wrapping them leaves every file this
stage touches fmt-clean (baseline 28 -> 26).
…S08 CI fixes)

The windows test job caught six suite-wide pins the scoped gate filters
never ran:
- tool-count pins 20 -> 22 (advertises_the_shared_tools,
  negotiates_and_lists_tools, all_tools_keep_facades_first_and_append_...,
  renamed sixteen -> eighteen) and generated schemas 16 -> 18.
- INSTRUCTIONS budget 1100 -> 1200 (the catalogue announcement sentence is
  trimmed to one line; 1189 bytes).
- execute-request schema budget 45_000 -> 48_000 bytes (46,002 actual).
- plugin_panels is a READ op and never belonged in OPS (the execute
  request schema's anyOf builder iterates OPS, so a read op was wrongly
  advertised inside ocs_execute); removed from the OPS list - the
  ocs_panels descriptor references the OpDef directly, and read ops
  conventionally stay out of OPS (query/state/... were never there).
- TOOL_SCHEMA_DIGEST repinned deliberately (anyOf shrinks by the
  read-op variant).
Verified with the FULL unfiltered lib suite: 7029 passed, 0 failed,
45 ignored.
@schoeller

Copy link
Copy Markdown
Contributor Author

The windows test job caught six suite-wide MCP pins my scoped gate runs never executed (tool counts 20->22 / 16->18, the INSTRUCTIONS length budget, the execute-schema size budget) plus one real schema bug the failure exposed: plugin_panels is a READ op and had been registered in OPS, so the execute-request schema's anyOf (which iterates OPS) wrongly advertised it inside ocs_execute. Fixed in 628af88: pins updated to the new catalogue (18 intents), INSTRUCTIONS trimmed to 1189 bytes under a 1200 budget, execute-schema budget revisited to 48KB (46,002 actual), the read op removed from OPS (the ocs_panels descriptor references its OpDef directly; read ops have never lived in OPS), and the schema digest repinned. Verified with the full unfiltered lib suite: 7029 passed, 0 failed, 45 ignored.

@HakanSeven12
HakanSeven12 merged commit efb03f9 into HakanSeven12:main Nov 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants